diff --git a/Dollchan_Extension_Tools.user.js b/Dollchan_Extension_Tools.user.js index d21992c31..456fb86a4 100644 --- a/Dollchan_Extension_Tools.user.js +++ b/Dollchan_Extension_Tools.user.js @@ -3809,7 +3809,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var _marked = regeneratorRuntime.mark(getFormElements); var version = '18.2.19.0'; - var commit = '6586137'; + var commit = '0a1dda8'; var defaultCfg = { @@ -4164,7 +4164,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons notext: ['Скрывать без текста', 'Hide without text', 'Ховати без тексту'], text: ['Скрыть схожий текст', 'Hide similar text', 'Сховати схожий текст'], refs: ['Скрыть с ответами', 'Hide with answers', 'Сховати з відповідями'], - refsonly: ['Скрыть только ответы', 'Hide answers only', 'Сховати лише відповіді'] + refsonly: ['Скрывать только ответы', 'Hide answers only', 'Ховати лише відповіді'] }, selExpandThr: [ ['+10 постов', 'Последние 30', 'Последние 50', 'Последние 100', 'Весь тред'], ['+10 posts', 'Last 30 posts', 'Last 50 posts', 'Last 100 posts', 'Entire thread'], ['+10 постів', 'Останні 30', 'Останні 50', 'Останні 100', 'Весь тред']], @@ -4957,8 +4957,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } _createClass(WorkerPool, [{ - key: 'clear', - value: function clear() { + key: 'clearWorkers', + value: function clearWorkers() { window.URL.revokeObjectURL(this._url); this._freeWorkers.forEach(function (w) { return w.terminate(); @@ -6938,7 +6938,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons break; case 66: - AjaxCache.clear(); + AjaxCache.clearCache(); if (isUpdate) { setStored('DESU_Favorites', JSON.stringify(fav)); } @@ -7531,9 +7531,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons case 'hideRefPsts': for (var _post3 = Thread.first.op; _post3; _post3 = _post3.next) { if (!Cfg.hideRefPsts) { - _post3.ref.unhide(); + _post3.ref.unhideRef(); } else if (_post3.hidden) { - _post3.ref.hide(); + _post3.ref.hideRef(); } } break; @@ -8169,7 +8169,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ntKeys: null, tKeys: null, version: 7, - clear: function clear() { + clearCPost: function clearCPost() { this.cPost = null; this.lastPageOffset = 0; }, @@ -8179,7 +8179,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons if (this.cPost) { this.cPost.unselect(); } - this.clear(); + this.clearCPost(); this.gKeys = this.ntKeys = this.tKeys = null; doc.removeEventListener('keydown', this, true); } @@ -8951,7 +8951,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons Images_.afterpreload = Images_.progressId = null; } if (rjf) { - rjf.clear(); + rjf.clearWorkers(); } }); Images_.preloading = true; @@ -9829,7 +9829,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons fixURL: function fixURL(url) { return '' + url + (url.includes('?') ? '&' : '?') + 'nocache=' + Math.random(); }, - clear: function clear() { + clearCache: function clearCache() { this._data = new Map(); }, runCachedAjax: function runCachedAjax(url, useCache) { @@ -10172,7 +10172,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons PostForm.setUserPassw(); } if (HotKeys.enabled) { - HotKeys.clear(); + HotKeys.clearCPost(); } case 9: @@ -10529,7 +10529,7 @@ true, true]; SpellsRunner.unhideAll(); this.disable(); saveCfg('spells', JSON.stringify([Date.now(), null, null, null])); - locStorage['__de-spells'] = '{ "hide": false, "data": null }'; + locStorage['__de-spells'] = '{ hide: false, data: null }'; locStorage.removeItem('__de-spells'); } $q('input[info="hideBySpell"]').checked = false; @@ -11586,16 +11586,16 @@ true, true]; } if (weightVals) { var w = image.weight; - var hide = void 0; + var isHide = void 0; switch (compareRule) { case 0: - hide = w >= weightVals[0] && w <= weightVals[1];break; + isHide = w >= weightVals[0] && w <= weightVals[1];break; case 1: - hide = w < weightVals[0];break; + isHide = w < weightVals[0];break; case 2: - hide = w > weightVals[0];break; + isHide = w > weightVals[0];break; } - if (!hide) { + if (!isHide) { continue; } else if (!sizeVals) { return true; @@ -12018,7 +12018,7 @@ true, true]; this.txta.value = ''; } if (this.files) { - this.files.clear(); + this.files.clearInputs(); } if (this.video) { this.video.value = ''; @@ -12259,7 +12259,7 @@ true, true]; this.files = new Files(this, $q('tr input[type="file"]', this.form)); window.addEventListener('load', function () { return setTimeout(function () { - return !_this26.files.filesCount && _this26.files.clear(); + return !_this26.files.filesCount && _this26.files.clearInputs(); }, 0); }); } @@ -12455,7 +12455,7 @@ true, true]; clearBtn.onclick = function () { saveCfg('sageReply', 0); _this31._setSage(); - _this31.files.clear(); + _this31.files.clearInputs(); [_this31.txta, _this31.name, _this31.mail, _this31.subj, _this31.video, _this31.cap && _this31.cap.textEl].forEach(function (el) { return el && (el.value = ''); }); @@ -12890,7 +12890,7 @@ true, true]; } this._inputs = inputs; this._files = []; - this.hide(); + this.hideEmpty(); } _createClass(Files, [{ @@ -12913,11 +12913,11 @@ true, true]; inp.changeMode(cfg); } - this.hide(); + this.hideEmpty(); } }, { - key: 'clear', - value: function clear() { + key: 'clearInputs', + value: function clearInputs() { for (var _iterator25 = this._inputs, _isArray25 = Array.isArray(_iterator25), _i34 = 0, _iterator25 = _isArray25 ? _iterator25 : _iterator25[Symbol.iterator]();;) { var _ref69; @@ -12932,13 +12932,13 @@ true, true]; var inp = _ref69; - inp.clear(); + inp.clearInp(); } - this.hide(); + this.hideEmpty(); } }, { - key: 'hide', - value: function hide() { + key: 'hideEmpty', + value: function hideEmpty() { for (var _els2 = this._inputs, i = _els2.length - 1; i > 0; --i) { var inp = _els2[i]; if (inp.hasFile) { @@ -12947,7 +12947,7 @@ true, true]; inp.show(); break; } - inp.hide(); + inp.hideInp(); } } }, { @@ -13061,8 +13061,8 @@ true, true]; this._thumb = this._mediaEl = null; } }, { - key: 'clear', - value: function clear() { + key: 'clearInp', + value: function clearInp() { if (FileInput._isThumb) { this._thumb.classList.add('de-file-off'); if (this._mediaEl) { @@ -13134,8 +13134,8 @@ true, true]; if (isThumb) { this._input.click(); } else if (el === this._btnDel) { - this.clear(); - this._parent.hide(); + this.clearInp(); + this._parent.hideEmpty(); delete this._parent._files[this._parent._inputs.indexOf(this)]; DollchanAPI.notify('filechange', this._parent._files); } else if (el === this._btnSpoil) { @@ -13198,8 +13198,8 @@ true, true]; } } }, { - key: 'hide', - value: function hide() { + key: 'hideInp', + value: function hideInp() { if (FileInput._isThumb) { this._showDelBtn(false); $hide(this._thumb); @@ -13363,7 +13363,7 @@ true, true]; this._txtInput.classList.add('de-file-txt-noedit'); this._txtInput.placeholder = Lng.dropFileHere[lang]; } - this._parent.hide(); + this._parent.hideEmpty(); if (!nav.isPresto && !aib.fch && /^image\/(?:png|jpeg)$/.test(hasImgFile ? this.imgFile[2] : this._input.files[0].type)) { $del(this._rarMsg); $show(this._btnRarJpg); @@ -14187,7 +14187,7 @@ true, true]; pByEl.delete(this.el); pByNum.delete(this.num); if (this.hidden) { - this.ref.unhide(); + this.ref.unhideRef(); } RefMap.upd(this, false); if (this.prev.next = this.next) { @@ -14262,59 +14262,61 @@ true, true]; } }, { key: 'setUserVisib', - value: function setUserVisib(hide) { - var save = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + value: function setUserVisib(isHide) { + var isSave = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var note = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; this.userToggled = true; - this.setVisib(hide, note); - if (this.isOp || this.hidden === hide) { - this.hideBtn.setAttribute('class', hide ? 'de-btn-unhide-user' : 'de-btn-hide-user'); + this.setVisib(isHide, note); + if (this.isOp || this.hidden === isHide) { + this.hideBtn.setAttribute('class', isHide ? 'de-btn-unhide-user' : 'de-btn-hide-user'); } - if (save) { - HiddenPosts.set(this.num, this.thr.num, hide); + if (isSave) { + var num = this.num; + + HiddenPosts.set(num, this.thr.num, isHide); if (this.isOp) { - if (hide) { - HiddenThreads.set(this.num, this.num, this.title); + if (isHide) { + HiddenThreads.set(num, num, this.title); } else { - HiddenThreads.remove(this.num); + HiddenThreads.remove(num); } } locStorage['__de-post'] = JSON.stringify({ - hide: hide, + hide: isHide, brd: aib.b, - num: this.num, + num: num, thrNum: this.thr.num, title: this.isOp ? this.title : '' }); locStorage.removeItem('__de-post'); } - this.ref.toggleRef(!hide, false); + this.ref.toggleRef(isHide, false); } }, { key: 'setVisib', - value: function setVisib(hide) { + value: function setVisib(isHide) { var _this45 = this; var note = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - if (this.hidden === hide) { - if (hide && note) { + if (this.hidden === isHide) { + if (isHide && note) { this.note.set(note); } return; } if (this.isOp) { - this.thr.hidden = hide; + this.thr.hidden = isHide; } else { if (Cfg.delHiddPost === 1 || Cfg.delHiddPost === 2) { - if (hide) { + if (isHide) { this.wrap.classList.add('de-hidden'); } else { this.wrap.classList.remove('de-hidden'); } } else { - this._pref.onmouseover = this._pref.onmouseout = !hide ? null : function (e) { + this._pref.onmouseover = this._pref.onmouseout = !isHide ? null : function (e) { var yOffset = window.pageYOffset; _this45.hideContent(e.type === 'mouseout'); scrollTo(window.pageXOffset, yOffset); @@ -14323,16 +14325,16 @@ true, true]; } if (Cfg.strikeHidd) { setTimeout(function () { - return _this45._strikePostNum(hide); + return _this45._strikePostNum(isHide); }, 50); } - if (hide) { + if (isHide) { this.note.set(note); } else { - this.note.hide(); + this.note.hideNote(); } - this.hidden = hide; - this.hideContent(hide); + this.hidden = isHide; + this.hideContent(isHide); } }, { key: 'spellHide', @@ -14340,7 +14342,7 @@ true, true]; this.spellHidden = true; if (!this.userToggled) { this.setVisib(true, note); - this.ref.hide(); + this.ref.hideRef(); } } }, { @@ -14349,7 +14351,7 @@ true, true]; this.spellHidden = false; if (!this.userToggled) { this.setVisib(false); - this.ref.unhide(); + this.ref.unhideRef(); } } }, { @@ -14397,8 +14399,7 @@ true, true]; }, { key: '_clickMenu', value: function _clickMenu(el) { - var hidden = this.hidden; - + var isHide = !this.hidden; switch (el.getAttribute('info')) { case 'hide-sel': { @@ -14460,18 +14461,18 @@ true, true]; var words = Post.getWrds(this.text); for (var post = Thread.first.op; post; post = post.next) { - Post.findSameText(num, hidden, words, post); + Post.findSameText(num, !isHide, words, post); } return; } case 'hide-notext': Spells.add(0x10B , '', true);return; case 'hide-refs': - this.ref.toggleRef(hidden, true); - this.setUserVisib(!hidden); + this.ref.toggleRef(isHide, true); + this.setUserVisib(isHide); return; case 'hide-refsonly': - this.ref.toggleRef(null, true);return; + Spells.add(0 , '>>' + this.num, false);return; case 'thr-exp': { var task = parseInt(el.textContent.match(/\d+/), 10); @@ -14529,17 +14530,17 @@ true, true]; $each($Q('[de-form] a[href*="' + (aib.anchor + num) + '"]'), isHide ? function (el) { el.classList.add('de-link-hid'); if (Cfg.removeHidd && el.classList.contains('de-link-ref')) { - var refmap = el.parentNode; - if (!$q('.de-link-ref:not(.de-link-hid)', refmap)) { - $hide(refmap); + var refMapEl = el.parentNode; + if (!$q('.de-link-ref:not(.de-link-hid)', refMapEl)) { + $hide(refMapEl); } } } : function (el) { el.classList.remove('de-link-hid'); if (Cfg.removeHidd && el.classList.contains('de-link-ref')) { - var refmap = el.parentNode; - if ($q('.de-link-ref:not(.de-link-hid)', refmap)) { - $show(refmap); + var refMapEl = el.parentNode; + if ($q('.de-link-ref:not(.de-link-hid)', refMapEl)) { + $show(refMapEl); } } }); @@ -14701,22 +14702,22 @@ true, true]; } }, { key: 'hideContent', - value: function hideContent(headerEl, hideBtn, isUser, hide) { - if (hide) { - if (aib.t) { - Thread.first.hidCounter++; - } - hideBtn.setAttribute('class', isUser ? 'de-btn-unhide-user' : 'de-btn-unhide'); - if (headerEl) { - for (var el = headerEl.nextElementSibling; el; el = el.nextElementSibling) { - el.classList.add('de-post-hiddencontent'); - } - } - } else { + value: function hideContent(headerEl, hideBtn, isUser, isHide) { + if (!isHide) { hideBtn.setAttribute('class', isUser ? 'de-btn-hide-user' : 'de-btn-hide'); $each($Q('.de-post-hiddencontent', headerEl.parentNode), function (el) { return el.classList.remove('de-post-hiddencontent'); }); + return; + } + if (aib.t) { + Thread.first.hidCounter++; + } + hideBtn.setAttribute('class', isUser ? 'de-btn-unhide-user' : 'de-btn-unhide'); + if (headerEl) { + for (var el = headerEl.nextElementSibling; el; el = el.nextElementSibling) { + el.classList.add('de-post-hiddencontent'); + } } } }]); @@ -14823,8 +14824,8 @@ true, true]; } _createClass(PostNote, [{ - key: 'hide', - value: function hide() { + key: 'hideNote', + value: function hideNote() { if (this.isHideThr) { this._aEl.onmouseover = this._aEl.onmouseout = this._aEl.onclick = null; } @@ -14837,7 +14838,7 @@ true, true]; if (this.isHideThr) { this.set(null); } else { - this.hide(); + this.hideNote(); } } }, { @@ -15586,8 +15587,8 @@ true, true]; } } }, { - key: 'hide', - value: function hide() { + key: 'hideBtns', + value: function hideBtns() { this._btnsStyle.display = 'none'; this._hidden = true; this._oldX = this._oldY = -1; @@ -15615,7 +15616,7 @@ true, true]; clearTimeout(this._hideTmt); this._hideTmt = setTimeout(function () { - return _this52.hide(); + return _this52.hideBtns(); }, 2e3); } }]); @@ -15889,7 +15890,7 @@ true, true]; this._btns.autoBtn.classList.add('de-img-btn-none'); } } else if (this.hasOwnProperty('_btns')) { - this._btns.hide(); + this._btns.hideBtns(); } data.post.thr.form.el.appendChild(obj); this.toggleVideoLoop(); @@ -16392,7 +16393,7 @@ true, true]; sesStorage['de-imageshash'] = JSON.stringify(this._storage); } if (this.hasOwnProperty('_workers')) { - this._workers.clear(); + this._workers.clearWorkers(); delete this._workers; } }, @@ -17249,7 +17250,7 @@ true, true]; this._el.insertAdjacentHTML('beforeend', this._getHTML(num, '', isHidden)); if (Cfg.hideRefPsts && this._post.hidden) { post.setVisib(true, 'reference to >>' + num); - post.ref.hide(); + post.ref.hideRef(); } } } @@ -17264,8 +17265,8 @@ true, true]; return this._set.has(num); } }, { - key: 'hide', - value: function hide() { + key: 'hideRef', + value: function hideRef() { var isForced = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!isForced && !Cfg.hideRefPsts || !this.hasMap || this._hidden) { @@ -17290,10 +17291,10 @@ true, true]; if (post && !post.hidden) { if (isForced) { post.setUserVisib(true, true, 'reference to >>' + this._post.num); - post.ref.hide(true); + post.ref.hideRef(true); } else if (!post.userToggled) { post.setVisib(true, 'reference to >>' + this._post.num); - post.ref.hide(); + post.ref.hideRef(); } } } @@ -17353,15 +17354,15 @@ true, true]; }, { key: 'toggleRef', value: function toggleRef(isHide, isForced) { - if (isHide === true || isHide === null && this._hidden) { - this.unhide(isForced); + if (isHide) { + this.hideRef(isForced); } else { - this.hide(isForced); + this.unhideRef(isForced); } } }, { - key: 'unhide', - value: function unhide() { + key: 'unhideRef', + value: function unhideRef() { var isForced = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (this._hidden && !this.hasMap) { @@ -17386,10 +17387,10 @@ true, true]; if (post && post.hidden && !post.spellHidden) { if (isForced) { post.setUserVisib(false); - post.ref.unhide(true); + post.ref.unhideRef(true); } else if (!post.userToggled) { post.setVisib(false); - post.ref.unhide(); + post.ref.unhideRef(); } } } @@ -17929,7 +17930,7 @@ true, true]; Pview.updatePosition(true); } if (pBuilder.isClosed) { - AjaxCache.clear(); + AjaxCache.clearCache(); return { newCount: newVisPosts, locked: true }; } return { newCount: newVisPosts, locked: false }; diff --git a/src/Dollchan_Extension_Tools.es6.user.js b/src/Dollchan_Extension_Tools.es6.user.js index ae772a22b..399d4b067 100644 --- a/src/Dollchan_Extension_Tools.es6.user.js +++ b/src/Dollchan_Extension_Tools.es6.user.js @@ -30,7 +30,7 @@ 'use strict'; const version = '18.2.19.0'; -const commit = '6586137'; +const commit = '0a1dda8'; /* ==[ DefaultCfg.js ]======================================================================================== DEFAULT CONFIG @@ -892,9 +892,9 @@ const Lng = { 'Hide with answers', 'Сховати з відповідями'], refsonly: [ - 'Скрыть только ответы', + 'Скрывать только ответы', 'Hide answers only', - 'Сховати лише відповіді'] + 'Ховати лише відповіді'] }, selExpandThr: [ // "Expand thread" post button ['+10 постов', 'Последние 30', 'Последние 50', 'Последние 100', 'Весь тред'], @@ -2005,7 +2005,7 @@ class WorkerPool { this._freeWorkers.push(new Worker(url)); } } - clear() { + clearWorkers() { window.URL.revokeObjectURL(this._url); this._freeWorkers.forEach(w => w.terminate()); this._freeWorkers = []; @@ -3875,7 +3875,7 @@ function showFavoritesWindow(body, data) { } } } - AjaxCache.clear(); + AjaxCache.clearCache(); if(isUpdate) { setStored('DESU_Favorites', JSON.stringify(fav)); } @@ -4332,9 +4332,9 @@ const CfgWindow = { case 'hideRefPsts': for(let post = Thread.first.op; post; post = post.next) { if(!Cfg.hideRefPsts) { - post.ref.unhide(); + post.ref.unhideRef(); } else if(post.hidden) { - post.ref.hide(); + post.ref.hideRef(); } } break; @@ -5103,7 +5103,7 @@ const HotKeys = { ntKeys : null, tKeys : null, version : 7, - clear() { + clearCPost() { this.cPost = null; this.lastPageOffset = 0; }, @@ -5113,7 +5113,7 @@ const HotKeys = { if(this.cPost) { this.cPost.unselect(); } - this.clear(); + this.clearCPost(); this.gKeys = this.ntKeys = this.tKeys = null; doc.removeEventListener('keydown', this, true); } @@ -5833,7 +5833,7 @@ function preloadImages(data) { Images_.afterpreload = Images_.progressId = null; } if(rjf) { - rjf.clear(); + rjf.clearWorkers(); } }); Images_.preloading = true; @@ -6649,7 +6649,7 @@ const AjaxCache = { fixURL(url) { return `${ url }${ url.includes('?') ? '&' : '?' }nocache=${ Math.random() }`; }, - clear() { + clearCache() { this._data = new Map(); }, runCachedAjax(url, useCache) { @@ -6852,7 +6852,7 @@ const Pages = { PostForm.setUserPassw(); } if(HotKeys.enabled) { - HotKeys.clear(); + HotKeys.clearCPost(); } } }; @@ -7151,7 +7151,7 @@ const Spells = Object.create({ SpellsRunner.unhideAll(); this.disable(); saveCfg('spells', JSON.stringify([Date.now(), null, null, null])); - locStorage['__de-spells'] = '{ "hide": false, "data": null }'; + locStorage['__de-spells'] = '{ hide: false, data: null }'; locStorage.removeItem('__de-spells'); } $q('input[info="hideBySpell"]').checked = false; @@ -7956,13 +7956,13 @@ class SpellsInterpreter { } if(weightVals) { const w = image.weight; - let hide; + let isHide; switch(compareRule) { - case 0: hide = w >= weightVals[0] && w <= weightVals[1]; break; - case 1: hide = w < weightVals[0]; break; - case 2: hide = w > weightVals[0]; break; + case 0: isHide = w >= weightVals[0] && w <= weightVals[1]; break; + case 1: isHide = w < weightVals[0]; break; + case 2: isHide = w > weightVals[0]; break; } - if(!hide) { + if(!isHide) { continue; } else if(!sizeVals) { return true; @@ -8330,7 +8330,7 @@ class PostForm { this.txta.value = ''; } if(this.files) { - this.files.clear(); + this.files.clearInputs(); } if(this.video) { this.video.value = ''; @@ -8560,7 +8560,7 @@ class PostForm { this.files = new Files(this, $q('tr input[type="file"]', this.form)); // We need to clear file inputs in case if session was restored. window.addEventListener('load', - () => setTimeout(() => !this.files.filesCount && this.files.clear(), 0)); + () => setTimeout(() => !this.files.filesCount && this.files.clearInputs(), 0)); } _initSubmit() { this.subm.addEventListener('click', e => { @@ -8726,7 +8726,7 @@ class PostForm { clearBtn.onclick = () => { saveCfg('sageReply', 0); this._setSage(); - this.files.clear(); + this.files.clearInputs(); [this.txta, this.name, this.mail, this.subj, this.video, this.cap && this.cap.textEl].forEach( el => el && (el.value = '')); }; @@ -9158,7 +9158,7 @@ class Files { } this._inputs = inputs; this._files = []; - this.hide(); + this.hideEmpty(); } get rarInput() { const value = $bEnd(docBody, ''); @@ -9183,15 +9183,15 @@ class Files { for(const inp of this._inputs) { inp.changeMode(cfg); } - this.hide(); + this.hideEmpty(); } - clear() { + clearInputs() { for(const inp of this._inputs) { - inp.clear(); + inp.clearInp(); } - this.hide(); + this.hideEmpty(); } - hide() { + hideEmpty() { for(let els = this._inputs, i = els.length - 1; i > 0; --i) { const inp = els[i]; if(inp.hasFile) { @@ -9200,7 +9200,7 @@ class Files { inp.show(); break; } - inp.hide(); + inp.hideInp(); } } } @@ -9281,7 +9281,7 @@ class FileInput { $del(this._thumb); this._thumb = this._mediaEl = null; } - clear() { + clearInp() { if(FileInput._isThumb) { this._thumb.classList.add('de-file-off'); if(this._mediaEl) { @@ -9344,8 +9344,8 @@ class FileInput { if(isThumb) { this._input.click(); } else if(el === this._btnDel) { - this.clear(); - this._parent.hide(); + this.clearInp(); + this._parent.hideEmpty(); delete this._parent._files[this._parent._inputs.indexOf(this)]; DollchanAPI.notify('filechange', this._parent._files); } else if(el === this._btnSpoil) { @@ -9404,7 +9404,7 @@ class FileInput { } } } - hide() { + hideInp() { if(FileInput._isThumb) { this._showDelBtn(false); $hide(this._thumb); @@ -9559,7 +9559,7 @@ class FileInput { this._txtInput.classList.add('de-file-txt-noedit'); this._txtInput.placeholder = Lng.dropFileHere[lang]; } - this._parent.hide(); + this._parent.hideEmpty(); if(!nav.isPresto && !aib.fch && /^image\/(?:png|jpeg)$/.test(hasImgFile ? this.imgFile[2] : this._input.files[0].type) ) { @@ -10288,21 +10288,21 @@ class Post extends AbstractPost { static getWrds(text) { return text.replace(/\s+/g, ' ').replace(/[^a-zа-яё ]/ig, '').trim().substring(0, 800).split(' '); } - static hideContent(headerEl, hideBtn, isUser, hide) { - if(hide) { - if(aib.t) { - Thread.first.hidCounter++; - } - hideBtn.setAttribute('class', isUser ? 'de-btn-unhide-user' : 'de-btn-unhide'); - if(headerEl) { - for(let el = headerEl.nextElementSibling; el; el = el.nextElementSibling) { - el.classList.add('de-post-hiddencontent'); - } - } - } else { + static hideContent(headerEl, hideBtn, isUser, isHide) { + if(!isHide) { hideBtn.setAttribute('class', isUser ? 'de-btn-hide-user' : 'de-btn-hide'); $each($Q('.de-post-hiddencontent', headerEl.parentNode), el => el.classList.remove('de-post-hiddencontent')); + return; + } + if(aib.t) { + Thread.first.hidCounter++; + } + hideBtn.setAttribute('class', isUser ? 'de-btn-unhide-user' : 'de-btn-unhide'); + if(headerEl) { + for(let el = headerEl.nextElementSibling; el; el = el.nextElementSibling) { + el.classList.add('de-post-hiddencontent'); + } } } get banned() { @@ -10373,7 +10373,7 @@ class Post extends AbstractPost { pByEl.delete(this.el); pByNum.delete(this.num); if(this.hidden) { - this.ref.unhide(); + this.ref.unhideRef(); } RefMap.upd(this, false); if((this.prev.next = this.next)) { @@ -10437,50 +10437,51 @@ class Post extends AbstractPost { } this.select(); } - setUserVisib(hide, save = true, note = null) { + setUserVisib(isHide, isSave = true, note = null) { this.userToggled = true; - this.setVisib(hide, note); - if(this.isOp || this.hidden === hide) { - this.hideBtn.setAttribute('class', hide ? 'de-btn-unhide-user' : 'de-btn-hide-user'); + this.setVisib(isHide, note); + if(this.isOp || this.hidden === isHide) { + this.hideBtn.setAttribute('class', isHide ? 'de-btn-unhide-user' : 'de-btn-hide-user'); } - if(save) { - HiddenPosts.set(this.num, this.thr.num, hide); + if(isSave) { + const { num } = this; + HiddenPosts.set(num, this.thr.num, isHide); if(this.isOp) { - if(hide) { - HiddenThreads.set(this.num, this.num, this.title); + if(isHide) { + HiddenThreads.set(num, num, this.title); } else { - HiddenThreads.remove(this.num); + HiddenThreads.remove(num); } } locStorage['__de-post'] = JSON.stringify({ - hide, + hide : isHide, brd : aib.b, - num : this.num, + num, thrNum : this.thr.num, title : this.isOp ? this.title : '' }); locStorage.removeItem('__de-post'); } - this.ref.toggleRef(!hide, false); + this.ref.toggleRef(isHide, false); } - setVisib(hide, note = null) { - if(this.hidden === hide) { - if(hide && note) { + setVisib(isHide, note = null) { + if(this.hidden === isHide) { + if(isHide && note) { this.note.set(note); } return; } if(this.isOp) { - this.thr.hidden = hide; + this.thr.hidden = isHide; } else { if(Cfg.delHiddPost === 1 || Cfg.delHiddPost === 2) { - if(hide) { + if(isHide) { this.wrap.classList.add('de-hidden'); } else { this.wrap.classList.remove('de-hidden'); } } else { - this._pref.onmouseover = this._pref.onmouseout = !hide ? null : e => { + this._pref.onmouseover = this._pref.onmouseout = !isHide ? null : e => { const yOffset = window.pageYOffset; this.hideContent(e.type === 'mouseout'); scrollTo(window.pageXOffset, yOffset); @@ -10488,28 +10489,28 @@ class Post extends AbstractPost { } } if(Cfg.strikeHidd) { - setTimeout(() => this._strikePostNum(hide), 50); + setTimeout(() => this._strikePostNum(isHide), 50); } - if(hide) { + if(isHide) { this.note.set(note); } else { - this.note.hide(); + this.note.hideNote(); } - this.hidden = hide; - this.hideContent(hide); + this.hidden = isHide; + this.hideContent(isHide); } spellHide(note) { this.spellHidden = true; if(!this.userToggled) { this.setVisib(true, note); - this.ref.hide(); + this.ref.hideRef(); } } spellUnhide() { this.spellHidden = false; if(!this.userToggled) { this.setVisib(false); - this.ref.unhide(); + this.ref.unhideRef(); } } toggleImages(expand = !this.images.expanded, isExpandVideos = true) { @@ -10536,7 +10537,7 @@ class Post extends AbstractPost { } _clickMenu(el) { - const { hidden } = this; + const isHide = !this.hidden; switch(el.getAttribute('info')) { case 'hide-sel': { let { startContainer: start, endContainer: end } = this._selRange; @@ -10587,16 +10588,16 @@ class Post extends AbstractPost { const { num } = this; const words = Post.getWrds(this.text); for(let post = Thread.first.op; post; post = post.next) { - Post.findSameText(num, hidden, words, post); + Post.findSameText(num, !isHide, words, post); } return; } case 'hide-notext': Spells.add(0x10B /* (#all & !#tlen) */, '', true); return; case 'hide-refs': - this.ref.toggleRef(hidden, true); - this.setUserVisib(!hidden); + this.ref.toggleRef(isHide, true); + this.setUserVisib(isHide); return; - case 'hide-refsonly': this.ref.toggleRef(null, true); return; + case 'hide-refsonly': Spells.add(0 /* #words */, '>>' + this.num, false); return; case 'thr-exp': { const task = parseInt(el.textContent.match(/\d+/), 10); this.thr.loadPosts(!task ? 'all' : task === 10 ? 'more' : task); @@ -10647,17 +10648,17 @@ class Post extends AbstractPost { $each($Q(`[de-form] a[href*="${ aib.anchor + num }"]`), isHide ? el => { el.classList.add('de-link-hid'); if(Cfg.removeHidd && el.classList.contains('de-link-ref')) { - const refmap = el.parentNode; - if(!$q('.de-link-ref:not(.de-link-hid)', refmap)) { - $hide(refmap); + const refMapEl = el.parentNode; + if(!$q('.de-link-ref:not(.de-link-hid)', refMapEl)) { + $hide(refMapEl); } } } : el => { el.classList.remove('de-link-hid'); if(Cfg.removeHidd && el.classList.contains('de-link-ref')) { - const refmap = el.parentNode; - if($q('.de-link-ref:not(.de-link-hid)', refmap)) { - $show(refmap); + const refMapEl = el.parentNode; + if($q('.de-link-ref:not(.de-link-hid)', refMapEl)) { + $show(refMapEl); } } }); @@ -10742,7 +10743,7 @@ Post.Note = class PostNote { this._aEl = $q('a', this._noteEl); this.textEl = this._aEl.nextElementSibling; } - hide() { + hideNote() { if(this.isHideThr) { this._aEl.onmouseover = this._aEl.onmouseout = this._aEl.onclick = null; } @@ -10753,7 +10754,7 @@ Post.Note = class PostNote { if(this.isHideThr) { this.set(null); } else { - this.hide(); + this.hideNote(); } } set(note) { @@ -11398,7 +11399,7 @@ class ImagesNavigation { } } } - hide() { + hideBtns() { this._btnsStyle.display = 'none'; this._hidden = true; this._oldX = this._oldY = -1; @@ -11418,7 +11419,7 @@ class ImagesNavigation { _setHideTmt() { clearTimeout(this._hideTmt); - this._hideTmt = setTimeout(() => this.hide(), 2e3); + this._hideTmt = setTimeout(() => this.hideBtns(), 2e3); } } @@ -11657,7 +11658,7 @@ class AttachmentViewer { this._btns.autoBtn.classList.add('de-img-btn-none'); } } else if(this.hasOwnProperty('_btns')) { - this._btns.hide(); + this._btns.hideBtns(); } data.post.thr.form.el.appendChild(obj); this.toggleVideoLoop(); @@ -12066,7 +12067,7 @@ const ImagesHashStorage = Object.create({ sesStorage['de-imageshash'] = JSON.stringify(this._storage); } if(this.hasOwnProperty('_workers')) { - this._workers.clear(); + this._workers.clearWorkers(); delete this._workers; } }, @@ -12856,7 +12857,7 @@ class RefMap { this._el.insertAdjacentHTML('beforeend', this._getHTML(num, '', isHidden)); if(Cfg.hideRefPsts && this._post.hidden) { post.setVisib(true, 'reference to >>' + num); - post.ref.hide(); + post.ref.hideRef(); } } } @@ -12866,7 +12867,7 @@ class RefMap { has(num) { return this._set.has(num); } - hide(isForced = false) { + hideRef(isForced = false) { if(!isForced && !Cfg.hideRefPsts || !this.hasMap || this._hidden) { return; } @@ -12876,10 +12877,10 @@ class RefMap { if(post && !post.hidden) { if(isForced) { post.setUserVisib(true, true, 'reference to >>' + this._post.num); - post.ref.hide(true); + post.ref.hideRef(true); } else if(!post.userToggled) { post.setVisib(true, 'reference to >>' + this._post.num); - post.ref.hide(); + post.ref.hideRef(); } } } @@ -12914,13 +12915,13 @@ class RefMap { this.hasMap = false; } toggleRef(isHide, isForced) { - if(isHide === true || isHide === null && this._hidden) { - this.unhide(isForced); + if(isHide) { + this.hideRef(isForced); } else { - this.hide(isForced); + this.unhideRef(isForced); } } - unhide(isForced = false) { + unhideRef(isForced = false) { if(this._hidden && !this.hasMap) { return; } @@ -12930,10 +12931,10 @@ class RefMap { if(post && post.hidden && !post.spellHidden) { if(isForced) { post.setUserVisib(false); - post.ref.unhide(true); + post.ref.unhideRef(true); } else if(!post.userToggled) { post.setVisib(false); - post.ref.unhide(); + post.ref.unhideRef(); } } } @@ -13354,7 +13355,7 @@ class Thread { Pview.updatePosition(true); } if(pBuilder.isClosed) { - AjaxCache.clear(); + AjaxCache.clearCache(); return { newCount: newVisPosts, locked: true }; } return { newCount: newVisPosts, locked: false }; diff --git a/src/modules/Ajax.js b/src/modules/Ajax.js index ac40333ce..662f90b1c 100644 --- a/src/modules/Ajax.js +++ b/src/modules/Ajax.js @@ -146,7 +146,7 @@ const AjaxCache = { fixURL(url) { return `${ url }${ url.includes('?') ? '&' : '?' }nocache=${ Math.random() }`; }, - clear() { + clearCache() { this._data = new Map(); }, runCachedAjax(url, useCache) { diff --git a/src/modules/ContentLoad.js b/src/modules/ContentLoad.js index 1f7d9d4f5..aa2bffd77 100644 --- a/src/modules/ContentLoad.js +++ b/src/modules/ContentLoad.js @@ -143,7 +143,7 @@ function preloadImages(data) { Images_.afterpreload = Images_.progressId = null; } if(rjf) { - rjf.clear(); + rjf.clearWorkers(); } }); Images_.preloading = true; diff --git a/src/modules/Form.js b/src/modules/Form.js index 399e58f38..11386c105 100644 --- a/src/modules/Form.js +++ b/src/modules/Form.js @@ -152,7 +152,7 @@ class PostForm { this.txta.value = ''; } if(this.files) { - this.files.clear(); + this.files.clearInputs(); } if(this.video) { this.video.value = ''; @@ -382,7 +382,7 @@ class PostForm { this.files = new Files(this, $q('tr input[type="file"]', this.form)); // We need to clear file inputs in case if session was restored. window.addEventListener('load', - () => setTimeout(() => !this.files.filesCount && this.files.clear(), 0)); + () => setTimeout(() => !this.files.filesCount && this.files.clearInputs(), 0)); } _initSubmit() { this.subm.addEventListener('click', e => { @@ -548,7 +548,7 @@ class PostForm { clearBtn.onclick = () => { saveCfg('sageReply', 0); this._setSage(); - this.files.clear(); + this.files.clearInputs(); [this.txta, this.name, this.mail, this.subj, this.video, this.cap && this.cap.textEl].forEach( el => el && (el.value = '')); }; diff --git a/src/modules/FormFile.js b/src/modules/FormFile.js index 41653ab41..9fb16e347 100644 --- a/src/modules/FormFile.js +++ b/src/modules/FormFile.js @@ -16,7 +16,7 @@ class Files { } this._inputs = inputs; this._files = []; - this.hide(); + this.hideEmpty(); } get rarInput() { const value = $bEnd(docBody, ''); @@ -41,15 +41,15 @@ class Files { for(const inp of this._inputs) { inp.changeMode(cfg); } - this.hide(); + this.hideEmpty(); } - clear() { + clearInputs() { for(const inp of this._inputs) { - inp.clear(); + inp.clearInp(); } - this.hide(); + this.hideEmpty(); } - hide() { + hideEmpty() { for(let els = this._inputs, i = els.length - 1; i > 0; --i) { const inp = els[i]; if(inp.hasFile) { @@ -58,7 +58,7 @@ class Files { inp.show(); break; } - inp.hide(); + inp.hideInp(); } } } @@ -139,7 +139,7 @@ class FileInput { $del(this._thumb); this._thumb = this._mediaEl = null; } - clear() { + clearInp() { if(FileInput._isThumb) { this._thumb.classList.add('de-file-off'); if(this._mediaEl) { @@ -202,8 +202,8 @@ class FileInput { if(isThumb) { this._input.click(); } else if(el === this._btnDel) { - this.clear(); - this._parent.hide(); + this.clearInp(); + this._parent.hideEmpty(); delete this._parent._files[this._parent._inputs.indexOf(this)]; DollchanAPI.notify('filechange', this._parent._files); } else if(el === this._btnSpoil) { @@ -262,7 +262,7 @@ class FileInput { } } } - hide() { + hideInp() { if(FileInput._isThumb) { this._showDelBtn(false); $hide(this._thumb); @@ -417,7 +417,7 @@ class FileInput { this._txtInput.classList.add('de-file-txt-noedit'); this._txtInput.placeholder = Lng.dropFileHere[lang]; } - this._parent.hide(); + this._parent.hideEmpty(); if(!nav.isPresto && !aib.fch && /^image\/(?:png|jpeg)$/.test(hasImgFile ? this.imgFile[2] : this._input.files[0].type) ) { diff --git a/src/modules/Hotkeys.js b/src/modules/Hotkeys.js index ba07b47dd..748bcb067 100644 --- a/src/modules/Hotkeys.js +++ b/src/modules/Hotkeys.js @@ -10,7 +10,7 @@ const HotKeys = { ntKeys : null, tKeys : null, version : 7, - clear() { + clearCPost() { this.cPost = null; this.lastPageOffset = 0; }, @@ -20,7 +20,7 @@ const HotKeys = { if(this.cPost) { this.cPost.unselect(); } - this.clear(); + this.clearCPost(); this.gKeys = this.ntKeys = this.tKeys = null; doc.removeEventListener('keydown', this, true); } diff --git a/src/modules/Localization.js b/src/modules/Localization.js index 60754d976..95ada3521 100644 --- a/src/modules/Localization.js +++ b/src/modules/Localization.js @@ -721,9 +721,9 @@ const Lng = { 'Hide with answers', 'Сховати з відповідями'], refsonly: [ - 'Скрыть только ответы', + 'Скрывать только ответы', 'Hide answers only', - 'Сховати лише відповіді'] + 'Ховати лише відповіді'] }, selExpandThr: [ // "Expand thread" post button ['+10 постов', 'Последние 30', 'Последние 50', 'Последние 100', 'Весь тред'], diff --git a/src/modules/Pages.js b/src/modules/Pages.js index fc76f63a4..6d35f7865 100644 --- a/src/modules/Pages.js +++ b/src/modules/Pages.js @@ -97,7 +97,7 @@ const Pages = { PostForm.setUserPassw(); } if(HotKeys.enabled) { - HotKeys.clear(); + HotKeys.clearCPost(); } } }; diff --git a/src/modules/PostImages.js b/src/modules/PostImages.js index 08993b018..ada64704f 100644 --- a/src/modules/PostImages.js +++ b/src/modules/PostImages.js @@ -63,7 +63,7 @@ class ImagesNavigation { } } } - hide() { + hideBtns() { this._btnsStyle.display = 'none'; this._hidden = true; this._oldX = this._oldY = -1; @@ -83,7 +83,7 @@ class ImagesNavigation { _setHideTmt() { clearTimeout(this._hideTmt); - this._hideTmt = setTimeout(() => this.hide(), 2e3); + this._hideTmt = setTimeout(() => this.hideBtns(), 2e3); } } @@ -322,7 +322,7 @@ class AttachmentViewer { this._btns.autoBtn.classList.add('de-img-btn-none'); } } else if(this.hasOwnProperty('_btns')) { - this._btns.hide(); + this._btns.hideBtns(); } data.post.thr.form.el.appendChild(obj); this.toggleVideoLoop(); @@ -731,7 +731,7 @@ const ImagesHashStorage = Object.create({ sesStorage['de-imageshash'] = JSON.stringify(this._storage); } if(this.hasOwnProperty('_workers')) { - this._workers.clear(); + this._workers.clearWorkers(); delete this._workers; } }, diff --git a/src/modules/Posts.js b/src/modules/Posts.js index 62a0b86f2..94c359656 100644 --- a/src/modules/Posts.js +++ b/src/modules/Posts.js @@ -462,21 +462,21 @@ class Post extends AbstractPost { static getWrds(text) { return text.replace(/\s+/g, ' ').replace(/[^a-zа-яё ]/ig, '').trim().substring(0, 800).split(' '); } - static hideContent(headerEl, hideBtn, isUser, hide) { - if(hide) { - if(aib.t) { - Thread.first.hidCounter++; - } - hideBtn.setAttribute('class', isUser ? 'de-btn-unhide-user' : 'de-btn-unhide'); - if(headerEl) { - for(let el = headerEl.nextElementSibling; el; el = el.nextElementSibling) { - el.classList.add('de-post-hiddencontent'); - } - } - } else { + static hideContent(headerEl, hideBtn, isUser, isHide) { + if(!isHide) { hideBtn.setAttribute('class', isUser ? 'de-btn-hide-user' : 'de-btn-hide'); $each($Q('.de-post-hiddencontent', headerEl.parentNode), el => el.classList.remove('de-post-hiddencontent')); + return; + } + if(aib.t) { + Thread.first.hidCounter++; + } + hideBtn.setAttribute('class', isUser ? 'de-btn-unhide-user' : 'de-btn-unhide'); + if(headerEl) { + for(let el = headerEl.nextElementSibling; el; el = el.nextElementSibling) { + el.classList.add('de-post-hiddencontent'); + } } } get banned() { @@ -547,7 +547,7 @@ class Post extends AbstractPost { pByEl.delete(this.el); pByNum.delete(this.num); if(this.hidden) { - this.ref.unhide(); + this.ref.unhideRef(); } RefMap.upd(this, false); if((this.prev.next = this.next)) { @@ -611,50 +611,51 @@ class Post extends AbstractPost { } this.select(); } - setUserVisib(hide, save = true, note = null) { + setUserVisib(isHide, isSave = true, note = null) { this.userToggled = true; - this.setVisib(hide, note); - if(this.isOp || this.hidden === hide) { - this.hideBtn.setAttribute('class', hide ? 'de-btn-unhide-user' : 'de-btn-hide-user'); + this.setVisib(isHide, note); + if(this.isOp || this.hidden === isHide) { + this.hideBtn.setAttribute('class', isHide ? 'de-btn-unhide-user' : 'de-btn-hide-user'); } - if(save) { - HiddenPosts.set(this.num, this.thr.num, hide); + if(isSave) { + const { num } = this; + HiddenPosts.set(num, this.thr.num, isHide); if(this.isOp) { - if(hide) { - HiddenThreads.set(this.num, this.num, this.title); + if(isHide) { + HiddenThreads.set(num, num, this.title); } else { - HiddenThreads.remove(this.num); + HiddenThreads.remove(num); } } locStorage['__de-post'] = JSON.stringify({ - hide, + hide : isHide, brd : aib.b, - num : this.num, + num, thrNum : this.thr.num, title : this.isOp ? this.title : '' }); locStorage.removeItem('__de-post'); } - this.ref.toggleRef(!hide, false); + this.ref.toggleRef(isHide, false); } - setVisib(hide, note = null) { - if(this.hidden === hide) { - if(hide && note) { + setVisib(isHide, note = null) { + if(this.hidden === isHide) { + if(isHide && note) { this.note.set(note); } return; } if(this.isOp) { - this.thr.hidden = hide; + this.thr.hidden = isHide; } else { if(Cfg.delHiddPost === 1 || Cfg.delHiddPost === 2) { - if(hide) { + if(isHide) { this.wrap.classList.add('de-hidden'); } else { this.wrap.classList.remove('de-hidden'); } } else { - this._pref.onmouseover = this._pref.onmouseout = !hide ? null : e => { + this._pref.onmouseover = this._pref.onmouseout = !isHide ? null : e => { const yOffset = window.pageYOffset; this.hideContent(e.type === 'mouseout'); scrollTo(window.pageXOffset, yOffset); @@ -662,28 +663,28 @@ class Post extends AbstractPost { } } if(Cfg.strikeHidd) { - setTimeout(() => this._strikePostNum(hide), 50); + setTimeout(() => this._strikePostNum(isHide), 50); } - if(hide) { + if(isHide) { this.note.set(note); } else { - this.note.hide(); + this.note.hideNote(); } - this.hidden = hide; - this.hideContent(hide); + this.hidden = isHide; + this.hideContent(isHide); } spellHide(note) { this.spellHidden = true; if(!this.userToggled) { this.setVisib(true, note); - this.ref.hide(); + this.ref.hideRef(); } } spellUnhide() { this.spellHidden = false; if(!this.userToggled) { this.setVisib(false); - this.ref.unhide(); + this.ref.unhideRef(); } } toggleImages(expand = !this.images.expanded, isExpandVideos = true) { @@ -710,7 +711,7 @@ class Post extends AbstractPost { } _clickMenu(el) { - const { hidden } = this; + const isHide = !this.hidden; switch(el.getAttribute('info')) { case 'hide-sel': { let { startContainer: start, endContainer: end } = this._selRange; @@ -761,16 +762,16 @@ class Post extends AbstractPost { const { num } = this; const words = Post.getWrds(this.text); for(let post = Thread.first.op; post; post = post.next) { - Post.findSameText(num, hidden, words, post); + Post.findSameText(num, !isHide, words, post); } return; } case 'hide-notext': Spells.add(0x10B /* (#all & !#tlen) */, '', true); return; case 'hide-refs': - this.ref.toggleRef(hidden, true); - this.setUserVisib(!hidden); + this.ref.toggleRef(isHide, true); + this.setUserVisib(isHide); return; - case 'hide-refsonly': this.ref.toggleRef(null, true); return; + case 'hide-refsonly': Spells.add(0 /* #words */, '>>' + this.num, false); return; case 'thr-exp': { const task = parseInt(el.textContent.match(/\d+/), 10); this.thr.loadPosts(!task ? 'all' : task === 10 ? 'more' : task); @@ -821,17 +822,17 @@ class Post extends AbstractPost { $each($Q(`[de-form] a[href*="${ aib.anchor + num }"]`), isHide ? el => { el.classList.add('de-link-hid'); if(Cfg.removeHidd && el.classList.contains('de-link-ref')) { - const refmap = el.parentNode; - if(!$q('.de-link-ref:not(.de-link-hid)', refmap)) { - $hide(refmap); + const refMapEl = el.parentNode; + if(!$q('.de-link-ref:not(.de-link-hid)', refMapEl)) { + $hide(refMapEl); } } } : el => { el.classList.remove('de-link-hid'); if(Cfg.removeHidd && el.classList.contains('de-link-ref')) { - const refmap = el.parentNode; - if($q('.de-link-ref:not(.de-link-hid)', refmap)) { - $show(refmap); + const refMapEl = el.parentNode; + if($q('.de-link-ref:not(.de-link-hid)', refMapEl)) { + $show(refMapEl); } } }); @@ -916,7 +917,7 @@ Post.Note = class PostNote { this._aEl = $q('a', this._noteEl); this.textEl = this._aEl.nextElementSibling; } - hide() { + hideNote() { if(this.isHideThr) { this._aEl.onmouseover = this._aEl.onmouseout = this._aEl.onclick = null; } @@ -927,7 +928,7 @@ Post.Note = class PostNote { if(this.isHideThr) { this.set(null); } else { - this.hide(); + this.hideNote(); } } set(note) { diff --git a/src/modules/RefMap.js b/src/modules/RefMap.js index bdc9b38f7..031295808 100644 --- a/src/modules/RefMap.js +++ b/src/modules/RefMap.js @@ -103,7 +103,7 @@ class RefMap { this._el.insertAdjacentHTML('beforeend', this._getHTML(num, '', isHidden)); if(Cfg.hideRefPsts && this._post.hidden) { post.setVisib(true, 'reference to >>' + num); - post.ref.hide(); + post.ref.hideRef(); } } } @@ -113,7 +113,7 @@ class RefMap { has(num) { return this._set.has(num); } - hide(isForced = false) { + hideRef(isForced = false) { if(!isForced && !Cfg.hideRefPsts || !this.hasMap || this._hidden) { return; } @@ -123,10 +123,10 @@ class RefMap { if(post && !post.hidden) { if(isForced) { post.setUserVisib(true, true, 'reference to >>' + this._post.num); - post.ref.hide(true); + post.ref.hideRef(true); } else if(!post.userToggled) { post.setVisib(true, 'reference to >>' + this._post.num); - post.ref.hide(); + post.ref.hideRef(); } } } @@ -161,13 +161,13 @@ class RefMap { this.hasMap = false; } toggleRef(isHide, isForced) { - if(isHide === true || isHide === null && this._hidden) { - this.unhide(isForced); + if(isHide) { + this.hideRef(isForced); } else { - this.hide(isForced); + this.unhideRef(isForced); } } - unhide(isForced = false) { + unhideRef(isForced = false) { if(this._hidden && !this.hasMap) { return; } @@ -177,10 +177,10 @@ class RefMap { if(post && post.hidden && !post.spellHidden) { if(isForced) { post.setUserVisib(false); - post.ref.unhide(true); + post.ref.unhideRef(true); } else if(!post.userToggled) { post.setVisib(false); - post.ref.unhide(); + post.ref.unhideRef(); } } } diff --git a/src/modules/Spells.js b/src/modules/Spells.js index 2b60b7934..b72b4d3dc 100644 --- a/src/modules/Spells.js +++ b/src/modules/Spells.js @@ -272,7 +272,7 @@ const Spells = Object.create({ SpellsRunner.unhideAll(); this.disable(); saveCfg('spells', JSON.stringify([Date.now(), null, null, null])); - locStorage['__de-spells'] = '{ "hide": false, "data": null }'; + locStorage['__de-spells'] = '{ hide: false, data: null }'; locStorage.removeItem('__de-spells'); } $q('input[info="hideBySpell"]').checked = false; @@ -1077,13 +1077,13 @@ class SpellsInterpreter { } if(weightVals) { const w = image.weight; - let hide; + let isHide; switch(compareRule) { - case 0: hide = w >= weightVals[0] && w <= weightVals[1]; break; - case 1: hide = w < weightVals[0]; break; - case 2: hide = w > weightVals[0]; break; + case 0: isHide = w >= weightVals[0] && w <= weightVals[1]; break; + case 1: isHide = w < weightVals[0]; break; + case 2: isHide = w > weightVals[0]; break; } - if(!hide) { + if(!isHide) { continue; } else if(!sizeVals) { return true; diff --git a/src/modules/Threads.js b/src/modules/Threads.js index 8b93aa25e..93f757c80 100644 --- a/src/modules/Threads.js +++ b/src/modules/Threads.js @@ -386,7 +386,7 @@ class Thread { Pview.updatePosition(true); } if(pBuilder.isClosed) { - AjaxCache.clear(); + AjaxCache.clearCache(); return { newCount: newVisPosts, locked: true }; } return { newCount: newVisPosts, locked: false }; diff --git a/src/modules/Utils.js b/src/modules/Utils.js index 66a848c20..a1504390f 100644 --- a/src/modules/Utils.js +++ b/src/modules/Utils.js @@ -470,7 +470,7 @@ class WorkerPool { this._freeWorkers.push(new Worker(url)); } } - clear() { + clearWorkers() { window.URL.revokeObjectURL(this._url); this._freeWorkers.forEach(w => w.terminate()); this._freeWorkers = []; diff --git a/src/modules/WindowFavorites.js b/src/modules/WindowFavorites.js index 0e142a2d0..5d7e7d6ca 100644 --- a/src/modules/WindowFavorites.js +++ b/src/modules/WindowFavorites.js @@ -246,7 +246,7 @@ function showFavoritesWindow(body, data) { } } } - AjaxCache.clear(); + AjaxCache.clearCache(); if(isUpdate) { setStored('DESU_Favorites', JSON.stringify(fav)); } diff --git a/src/modules/WindowSettings.js b/src/modules/WindowSettings.js index 4c2c57133..c805996fd 100644 --- a/src/modules/WindowSettings.js +++ b/src/modules/WindowSettings.js @@ -320,9 +320,9 @@ const CfgWindow = { case 'hideRefPsts': for(let post = Thread.first.op; post; post = post.next) { if(!Cfg.hideRefPsts) { - post.ref.unhide(); + post.ref.unhideRef(); } else if(post.hidden) { - post.ref.hide(); + post.ref.hideRef(); } } break; diff --git a/src/modules/Wrap.js b/src/modules/Wrap.js index d28025159..caa43ce7d 100644 --- a/src/modules/Wrap.js +++ b/src/modules/Wrap.js @@ -6,7 +6,7 @@ 'use strict'; const version = '18.2.19.0'; -const commit = '6586137'; +const commit = '0a1dda8'; /* ==[ DefaultCfg.js ]== */ /* ==[ Localization.js ]== */