Content deleted Content added
(bot/CD) |
(bot/CD) |
||
Line 351:
var version = "0.8.0";
var gitAbbrevHash = "
var gitBranch = "main";
var gitDate = "
var gitVersion = "0.8.0+
/**
Line 1,142:
*
* @param sectionHeading
* @param sectionHeadingPredicate A function which returns `true` if the section should stop here
* @return Section headings.
*/
Line 1,229:
const heading = normalizeWikiHeading(el);
return heading != null &&
// Require that this heading is already normalized.
// TODO: Remove at some point.
// This shouldn't be required if double-normalization wasn't a thing.
el === heading.h &&
// eslint-disable-next-line security/detect-non-literal-regexp
Line 1,292 ⟶ 1,295:
const heading = normalizeWikiHeading(sectionHeading);
const ceiling = heading.root.parentElement;
return getSectionElements(heading.root, (el) => {
var _a, _b;
// TODO: Avoid double normalization
const norm = normalizeWikiHeading(el, ceiling);
return (heading.level >= ((_a = norm === null || norm === void 0 ? void 0 : norm.level) !== null && _a !== void 0 ? _a : Infinity)) ||
this.isContributionSurveyHeading((_b = norm === null || norm === void 0 ? void 0 : norm.h) !== null && _b !== void 0 ? _b : el);
});
}
/**
Line 4,189 ⟶ 4,198:
let dateReverseScore = 1;
let byteScore = 1;
let dateStreak = 0;
let dateReverseStreak = 0;
let byteStreak = 0;
for (const diff of diffs) {
if (last == null) {
Line 4,196 ⟶ 4,208:
const diffTimestamp = new Date(diff.timestamp).getTime();
const lastTimestamp = new Date(last.timestamp).getTime();
// exists, or set it to 1 if a streak was broken.
dateStreak =
diffTimestamp > lastTimestamp ? dateStreak + 1 : 0;
dateReverseStreak =
diffTimestamp < lastTimestamp ? dateReverseStreak + 1 : 0;
byteStreak =
diff.diffsize <= last.diffsize ? byteStreak + 1 : 0;
dateScore = (dateScore + ((diffTimestamp > lastTimestamp ? 1 : 0) * (1 + dateStreak * 0.3))) / 2;
dateReverseScore = (dateReverseScore + ((diffTimestamp < lastTimestamp ? 1 : 0) * (1 + dateReverseStreak * 0.3))) / 2;
byteScore = (byteScore + ((diff.diffsize <= last.diffsize ? 1 : 0) * (1 + byteStreak * 0.3))) / 2;
last = diff;
}
}
// Multiply by weights to remove ties
dateScore *= 1.
dateReverseScore *= 1.
switch (Math.max(dateScore, dateReverseScore, byteScore)) {
case byteScore:
|