Skip to content

Commit

Permalink
'Hide answers only' - add #words(>>65536) spell (#1181)
Browse files Browse the repository at this point in the history
  • Loading branch information
SthephanShinkufag committed Feb 25, 2018
1 parent 0a1dda8 commit 3b66b3c
Show file tree
Hide file tree
Showing 18 changed files with 310 additions and 307 deletions.
219 changes: 110 additions & 109 deletions Dollchan_Extension_Tools.user.js

Large diffs are not rendered by default.

199 changes: 100 additions & 99 deletions src/Dollchan_Extension_Tools.es6.user.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/modules/Ajax.js
Expand Up @@ -146,7 +146,7 @@ const AjaxCache = {
fixURL(url) {
return `${ url }${ url.includes('?') ? '&' : '?' }nocache=${ Math.random() }`;
},
clear() {
clearCache() {
this._data = new Map();
},
runCachedAjax(url, useCache) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ContentLoad.js
Expand Up @@ -143,7 +143,7 @@ function preloadImages(data) {
Images_.afterpreload = Images_.progressId = null;
}
if(rjf) {
rjf.clear();
rjf.clearWorkers();
}
});
Images_.preloading = true;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/Form.js
Expand Up @@ -152,7 +152,7 @@ class PostForm {
this.txta.value = '';
}
if(this.files) {
this.files.clear();
this.files.clearInputs();
}
if(this.video) {
this.video.value = '';
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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 = ''));
};
Expand Down
24 changes: 12 additions & 12 deletions src/modules/FormFile.js
Expand Up @@ -16,7 +16,7 @@ class Files {
}
this._inputs = inputs;
this._files = [];
this.hide();
this.hideEmpty();
}
get rarInput() {
const value = $bEnd(docBody, '<input type="file" style="display: none;">');
Expand All @@ -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) {
Expand All @@ -58,7 +58,7 @@ class Files {
inp.show();
break;
}
inp.hide();
inp.hideInp();
}
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -262,7 +262,7 @@ class FileInput {
}
}
}
hide() {
hideInp() {
if(FileInput._isThumb) {
this._showDelBtn(false);
$hide(this._thumb);
Expand Down Expand Up @@ -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)
) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Hotkeys.js
Expand Up @@ -10,7 +10,7 @@ const HotKeys = {
ntKeys : null,
tKeys : null,
version : 7,
clear() {
clearCPost() {
this.cPost = null;
this.lastPageOffset = 0;
},
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Localization.js
Expand Up @@ -721,9 +721,9 @@ const Lng = {
'Hide with answers',
'Сховати з відповідями'],
refsonly: [
'Скрыть только ответы',
'Скрывать только ответы',
'Hide answers only',
'Сховати лише відповіді']
'Ховати лише відповіді']
},
selExpandThr: [ // "Expand thread" post button
['+10 постов', 'Последние 30', 'Последние 50', 'Последние 100', 'Весь тред'],
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Pages.js
Expand Up @@ -97,7 +97,7 @@ const Pages = {
PostForm.setUserPassw();
}
if(HotKeys.enabled) {
HotKeys.clear();
HotKeys.clearCPost();
}
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/modules/PostImages.js
Expand Up @@ -63,7 +63,7 @@ class ImagesNavigation {
}
}
}
hide() {
hideBtns() {
this._btnsStyle.display = 'none';
this._hidden = true;
this._oldX = this._oldY = -1;
Expand All @@ -83,7 +83,7 @@ class ImagesNavigation {

_setHideTmt() {
clearTimeout(this._hideTmt);
this._hideTmt = setTimeout(() => this.hide(), 2e3);
this._hideTmt = setTimeout(() => this.hideBtns(), 2e3);
}
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
},
Expand Down

1 comment on commit 3b66b3c

@SthephanShinkufag
Copy link
Owner Author

@SthephanShinkufag SthephanShinkufag commented on 3b66b3c Feb 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зело бесят короткие обезличенные функции вроде hide, unhide, clear.
Порой бывает сложно быстро определить, к какому классу они относятся, и соответственно перейти к их телу для правки. Если имя функции информативное, перейти к её телу дело пары кликов, тупо по совпадению. А так изврат какой-то.

Надо ещё переименовать delete, close, show, add, remove, run, update, и т.д.

Please sign in to comment.