function wrap(parent, className = 'wrapper') {
const wrapper = document.createElement('div');
wrapper.classList = className;
parent.childNodes.forEach(ch => wrapper.appendChild(ch));
parent.appendChild(wrapper);
}
document.querySelectorAll('td')
.forEach(td => wrap(td, 'text'));
reader.onload = function () {
var img = new Image();
img.src = reader.result;
img.onload = () => drawMiniature(img);
};
Они чет какие-то жирные стали, расплылись.
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" display="none">
<symbol id="menu-white" viewBox="0 0 42 42">
<circle cx="20" cy="20" r="19" stroke="white" stroke-width="2"/>
<circle cx="19.5" cy="10.5" r="2.5" fill="currentColor"/>
<circle cx="19.5" cy="19.5" r="2.5" fill="currentColor"/>
<circle cx="19.5" cy="28.5" r="2.5" fill="currentColor"/>
</symbol>
</svg>
<svg class="ico" width="42" height="42"><use xlink:href="#menu-white"/></svg>
$color-white: #fff;
.ico {
color: $color-white;
}
function v(c) {
return (document.getElementById(c) || {}).value;
}
let arData = ['User', 'Name', 'Class', 'Info'];
function ob_info(str, arr) {
return arr.reduce((obj, item) => {
obj[item] = v(`${str}${item}`);
return obj;
}, {});
}
info = ob_info('data_', arData);
console.log(info);
function check(arr) {
let seqGrow = 0;
for (let i = 1; i < arr.length; i++) {
const pairGrow = Math.sign(arr[i] - arr[i - 1]);
if (pairGrow === 0) {
continue;
}
seqGrow = seqGrow || pairGrow;
if (pairGrow !== seqGrow) {
return false;
}
}
return true;
}
console.log(check([0, 1, 5, 9, 15]));
console.log(check([0, 1, 1, 5, 9, 9, 15]));
console.log(check([15, 8, 4, 2, 1]));
console.log(check([0, 1, 5, 15, 4]));
const pathHandler = {
get(target, prop) {
const val = target[prop];
if (typeof val === 'object' && val.hasOwnProperty('src')) {
val.toString = function() {
return this.src;
};
return new Proxy(val, pathHandler);
} else {
return target[prop];
}
}
}
const path = new Proxy({
styles: {
src: './path-to-styles-src',
dist: './path-to-styles-dist',
scss: {
src: './scss-src',
dist: './scss-dist',
}
},
images: {
src: './path-to-images-src',
dist: './path-to-images-dist'
},
}, pathHandler);
console.log('' + path.styles); // './path-to-styles-src'
console.log('' + path.styles.dist); // './path-to-styles-dist'
console.log('' + path.styles.scss); // './scss-src'
console.log('' + path.styles.scss.dist); // './scss-dist'