more scripts improvements, title for ids and update package-lock

merge-requests/208/head
fatchan 4 years ago
parent 4ace3647eb
commit e66359de55
  1. 31
      gulp/res/js/hide.js
  2. 2
      gulp/res/js/threadstat.js
  3. 4
      package-lock.json

@ -1,5 +1,12 @@
const fileInput = document.getElementById('file');
fileInput ? fileInput.style.display = 'none' : void 0;
if (fileInput) {
fileInput.style.position = 'absolute';
fileInput.style.border = 'none';
fileInput.style.height = '0';
fileInput.style.width = '0';
fileInput.style.opacity = '0';
}
let hidden;
const loadHiddenStorage = () => {
try {
@ -103,8 +110,10 @@ const renderSheet = renderCSSLink.sheet;
const rulesKey = renderSheet.rules ? 'rules' : 'cssRules';
class CssToggle {
constructor (settingId, localStorageKey, settingCss) {
constructor (settingId, localStorageKey, localStorageDefault, settingCss) {
this.localStorageKey = localStorageKey;
this.localStorageDefault = localStorageDefault;
setDefaultLocalStorage(this.localStorageKey, this.localStorageDefault);
this.settingBoolean = localStorage.getItem(this.localStorageKey) == 'true';
this.settingCss = settingCss;
window.addEventListener('settingsReady', () => {
@ -136,26 +145,18 @@ class CssToggle {
}
};
//det localstorage defaults
// setDefaultLocalStorage('hidestubs', false);
setDefaultLocalStorage('hiderecursive', false);
setDefaultLocalStorage('hideimages', false);
setDefaultLocalStorage('crispimages', false);
setDefaultLocalStorage('heightlimit', false);
//define the css
//const hideStubsCss = `.post-container.hidden, .catalog-tile.hidden { visibility: hidden;margin-top: -1.5em;height: 0; }`;
const hideImagesCss = `.file-thumb { visibility: hidden !important; }`
const hideRecursiveCss = `.op.hidden ~ .anchor, .op.hidden ~ .post-container { display: none; }`;
const heightlimitCss = `img, video { max-height: unset; }`;
const crispCss = `img { image-rendering: crisp-edges; }`;
//make classes with css
//new CssToggle('hidestubs-setting', 'hidestubs', hideStubsCss);
new CssToggle('hiderecursive-setting', 'hiderecursive', hideRecursiveCss);
new CssToggle('heightlimit-setting', 'heightlimit', heightlimitCss);
new CssToggle('crispimages-setting', 'crispimages', crispCss);
new CssToggle('hideimages-setting', 'hideimages', hideImagesCss);
//new CssToggle('hidestubs-setting', 'hidestubs', false, hideStubsCss);
new CssToggle('hiderecursive-setting', 'hiderecursive', false, hideRecursiveCss);
new CssToggle('heightlimit-setting', 'heightlimit', false, heightlimitCss);
new CssToggle('crispimages-setting', 'crispimages', false, crispCss);
new CssToggle('hideimages-setting', 'hideimages', false, hideImagesCss);
window.addEventListener('addPost', function(e) {
const post = e.detail.post;

@ -19,7 +19,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
const updateCounts = () => {
for(let i = 0; i < idElems.length; i++) {
idElems[i].setAttribute('data-count', ` (${idMap.get(idElems[i].innerText)})`);
// idElems[i].setAttribute('title', `${idMap.get(idElems[i].innerText)} posts by this ID`); //title attribute style
idElems[i].setAttribute('title', `Double click to highlight posts`);
}
}

4
package-lock.json generated

@ -226,7 +226,7 @@
}
},
"@tohru/gm": {
"version": "github:fatchan/gm#c2ffb2ce0db3f64fbf4082462601429985b6dca6",
"version": "github:fatchan/gm#07df8fbf131b6b18c32fa010a84e67964e132955",
"from": "github:fatchan/gm",
"requires": {
"array-parallel": "^0.1.3",
@ -2415,7 +2415,7 @@
}
},
"express-fileupload": {
"version": "github:fatchan/express-fileupload#fd713ae7a3c7f381638d6479faa142d366304329",
"version": "github:fatchan/express-fileupload#f72901fd27b615664ca30fc4c4148b62c5c77fe9",
"from": "github:fatchan/express-fileupload",
"requires": {
"busboy": "^0.3.1"

Loading…
Cancel
Save