generated from htmlacademy/html2-basic-template
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,567 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
const modifyTextAmount = (multiplier, selectors) => { | ||
const $els = [...document.querySelectorAll(selectors.join(","))].flatMap((el) => [...el.childNodes]); | ||
for (const $el of $els) { | ||
if ($el.nodeType !== $el.TEXT_NODE) continue; | ||
if (!$el.textContent) continue; | ||
|
||
const text = $el.textContent; | ||
|
||
// Умножим строку на меньшее целое число множителя | ||
const intCnt = Math.floor(multiplier); | ||
$el.textContent = Array.from({ length: intCnt }) | ||
.map(() => text) | ||
.join(""); | ||
|
||
// Добавим остаток строки из множителя | ||
const tailMultiplier = multiplier % 1; | ||
$el.textContent += text.slice(0, Math.floor(text.length * tailMultiplier)); | ||
} | ||
}; | ||
|
||
const modifyChildrenAmount = (multiplier, selectors) => { | ||
const $els = [...document.querySelectorAll(selectors.join(","))]; | ||
const getRandomIntBetween = (min, max, seed = 0.5) => { | ||
min = Math.ceil(min); | ||
max = Math.floor(max); | ||
return Math.floor(seed * (max - min + 1) + min); | ||
}; | ||
for (const $el of $els) { | ||
if ($el.nodeType !== $el.ELEMENT_NODE) { | ||
throw new Error( | ||
`По одному из селекторов «${selectors.join("», «")}» найден элемент с неверным nodeType равным ${$el.nodeType}` | ||
); | ||
} | ||
if ($el.childElementCount < 2) continue; | ||
const newLength = Math.ceil($el.childElementCount * multiplier); | ||
|
||
if (newLength === $el.childElementCount) continue; | ||
while ($el.childElementCount !== newLength) { | ||
const idx = getRandomIntBetween(0, $el.childElementCount - 1); | ||
const $child = $el.children[idx]; | ||
if (newLength < $el.childElementCount) { | ||
$el.removeChild($child); | ||
} else if (newLength > $el.childElementCount) { | ||
$el.appendChild($child.cloneNode(true)); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const modifyImages = (isBig, selectors) => { | ||
const $els = [...document.querySelectorAll(selectors.join(","))]; | ||
for (const $el of $els) { | ||
if ($el.tagName !== "IMG") { | ||
throw new Error( | ||
`По одному из селекторов «${selectors.join("», «")}» найден элемент с неверным tagName равным ${ | ||
$el.tagName | ||
}, должен быть IMG` | ||
); | ||
} | ||
// 1500x1500 | ||
const largeImgSrc = | ||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABdwAAAXcBAMAAADKG1FXAAAAG1BMVEXMzMyWlpacnJyqqqrFxcWxsbGjo6O3t7e+vr6He3KoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAQhklEQVR4nO3dzXPbRpoHYFCiPo6iMrZzFGPvxkcruzM7R2ri8lxNH1I5Sp7UOkfRk3XtkZqtrfm3RwRA4qtJwFYYoKPnqYpM8gWkd4q/aTYbIJgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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
} | ||
}; | ||
|
||
const defaultTextIncreaseMultiplier = 2.1; | ||
const defaultTextDecreaseMultiplier = 0.4; | ||
|
||
const defaultChildrenIncreaseMultiplier = 1.5; | ||
const defaultChildrenDecreaseMultiplier = 0.6; | ||
|
||
const defaultTextSelectors = ["a", "button", "h1", "h2", "h3", "h4", "h5", "h6", "p", "span", "label", "legend", "li"]; | ||
const defaultChildrenSelectors = ["fieldset", "ul", "ol", "dl"]; | ||
const defaultImgSelectors = ["img"]; | ||
|
||
module.exports = async (page, scenario, vp) => { | ||
console.log('SCENARIO > ' + scenario.label); | ||
// add more ready handlers here... | ||
await page.waitForFunction(() => { | ||
return document.fonts.ready.then(() => { | ||
console.log('Fonts loaded'); | ||
return true; | ||
}); | ||
}); | ||
|
||
await page.evaluate(modifyChildrenAmount, scenario.multiplier || defaultChildrenDecreaseMultiplier, defaultChildrenSelectors) | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
const modifyTextAmount = (multiplier, selectors) => { | ||
const $els = [...document.querySelectorAll(selectors.join(","))].flatMap((el) => [...el.childNodes]); | ||
for (const $el of $els) { | ||
if ($el.nodeType !== $el.TEXT_NODE) continue; | ||
if (!$el.textContent) continue; | ||
|
||
const text = $el.textContent; | ||
|
||
// Умножим строку на меньшее целое число множителя | ||
const intCnt = Math.floor(multiplier); | ||
$el.textContent = Array.from({ length: intCnt }) | ||
.map(() => text) | ||
.join(""); | ||
|
||
// Добавим остаток строки из множителя | ||
const tailMultiplier = multiplier % 1; | ||
$el.textContent += text.slice(0, Math.floor(text.length * tailMultiplier)); | ||
} | ||
}; | ||
|
||
const modifyChildrenAmount = (multiplier, selectors) => { | ||
const $els = [...document.querySelectorAll(selectors.join(","))]; | ||
const getRandomIntBetween = (min, max, seed = 0.5) => { | ||
min = Math.ceil(min); | ||
max = Math.floor(max); | ||
return Math.floor(seed * (max - min + 1) + min); | ||
}; | ||
for (const $el of $els) { | ||
if ($el.nodeType !== $el.ELEMENT_NODE) { | ||
throw new Error( | ||
`По одному из селекторов «${selectors.join("», «")}» найден элемент с неверным nodeType равным ${$el.nodeType}` | ||
); | ||
} | ||
if ($el.childElementCount < 2) continue; | ||
const newLength = Math.ceil($el.childElementCount * multiplier); | ||
|
||
if (newLength === $el.childElementCount) continue; | ||
while ($el.childElementCount !== newLength) { | ||
const idx = getRandomIntBetween(0, $el.childElementCount - 1); | ||
const $child = $el.children[idx]; | ||
if (newLength < $el.childElementCount) { | ||
$el.removeChild($child); | ||
} else if (newLength > $el.childElementCount) { | ||
$el.appendChild($child.cloneNode(true)); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const modifyImages = (isBig, selectors) => { | ||
const $els = [...document.querySelectorAll(selectors.join(","))]; | ||
for (const $el of $els) { | ||
if ($el.tagName !== "IMG") { | ||
throw new Error( | ||
`По одному из селекторов «${selectors.join("», «")}» найден элемент с неверным tagName равным ${ | ||
$el.tagName | ||
}, должен быть IMG` | ||
); | ||
} | ||
// 1500x1500 | ||
const largeImgSrc = | ||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABdwAAAXcBAMAAADKG1FXAAAAG1BMVEXMzMyWlpacnJyqqqrFxcWxsbGjo6O3t7e+vr6He3KoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAQhklEQVR4nO3dzXPbRpoHYFCiPo6iMrZzFGPvxkcruzM7R2ri8lxNH1I5Sp7UOkfRk3XtkZqtrfm3RwRA4qtJwFYYoKPnqYpM8gWkd4q/aTYbIJgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAElFTkSuQmCC"; | ||
// 15x15 | ||
const smallImgSrc = | ||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPBAMAAADJ+Ih5AAAAG1BMVEXMzMyWlpaqqqq3t7ejo6OcnJyxsbG+vr7FxcXPXVcRAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAN0lEQVQImWNgIAswKTMwcAQoGTAwAznMAgYMDCxhbOYMAq4JDOyFHA4MAuUCDGxqIJGkBGLMAwAMYQT0Tdpz9wAAAABJRU5ErkJggg=="; | ||
|
||
$el.src = isBig ? largeImgSrc : smallImgSrc; | ||
$el.width = isBig ? 1500 : 15; | ||
} | ||
}; | ||
|
||
const defaultTextIncreaseMultiplier = 2.1; | ||
const defaultTextDecreaseMultiplier = 0.4; | ||
|
||
const defaultChildrenIncreaseMultiplier = 1.5; | ||
const defaultChildrenDecreaseMultiplier = 0.5; | ||
|
||
const defaultTextSelectors = ["a", "button", "h1", "h2", "h3", "h4", "h5", "h6", "p", "span", "label", "legend", "li"]; | ||
const defaultChildrenSelectors = ["fieldset", "ul", "ol", "dl"]; | ||
const defaultImgSelectors = ["img"]; | ||
|
||
module.exports = async (page, scenario, vp) => { | ||
console.log('SCENARIO > ' + scenario.label); | ||
// add more ready handlers here... | ||
await page.waitForFunction(() => { | ||
return document.fonts.ready.then(() => { | ||
console.log('Fonts loaded'); | ||
return true; | ||
}); | ||
}); | ||
|
||
await page.evaluate(modifyChildrenAmount, scenario.multiplier || defaultChildrenIncreaseMultiplier, defaultChildrenSelectors) | ||
|
||
}; |
Oops, something went wrong.