Merge Zixaphir X
This commit is contained in:
commit
2fcbe0bf30
@ -1370,10 +1370,7 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
Polyfill = {
|
Polyfill = {
|
||||||
init: function() {
|
init: function() {},
|
||||||
Polyfill.toBlob();
|
|
||||||
return Polyfill.visibility();
|
|
||||||
},
|
|
||||||
toBlob: function() {
|
toBlob: function() {
|
||||||
var _base;
|
var _base;
|
||||||
return (_base = HTMLCanvasElement.prototype).toBlob || (_base.toBlob = function(cb) {
|
return (_base = HTMLCanvasElement.prototype).toBlob || (_base.toBlob = function(cb) {
|
||||||
@ -1413,10 +1410,10 @@
|
|||||||
|
|
||||||
Header = {
|
Header = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var barFixedToggler, barPositionToggler, customNavToggler, editCustomNav, footerToggler, headerToggler, linkJustifyToggler,
|
var barFixedToggler, barPositionToggler, customNavToggler, editCustomNav, footerToggler, headerToggler, linkJustifyToggler, menuButton,
|
||||||
_this = this;
|
_this = this;
|
||||||
this.menu = new UI.Menu('header');
|
this.menu = new UI.Menu('header');
|
||||||
this.menuButton = $.el('span', {
|
menuButton = $.el('span', {
|
||||||
className: 'menu-button',
|
className: 'menu-button',
|
||||||
innerHTML: '<i></i>'
|
innerHTML: '<i></i>'
|
||||||
});
|
});
|
||||||
@ -1448,7 +1445,7 @@
|
|||||||
this.headerToggler = headerToggler.firstElementChild;
|
this.headerToggler = headerToggler.firstElementChild;
|
||||||
this.footerToggler = footerToggler.firstElementChild;
|
this.footerToggler = footerToggler.firstElementChild;
|
||||||
this.customNavToggler = customNavToggler.firstElementChild;
|
this.customNavToggler = customNavToggler.firstElementChild;
|
||||||
$.on(this.menuButton, 'click', this.menuToggle);
|
$.on(menuButton, 'click', this.menuToggle);
|
||||||
$.on(this.barFixedToggler, 'change', this.toggleBarFixed);
|
$.on(this.barFixedToggler, 'change', this.toggleBarFixed);
|
||||||
$.on(this.barPositionToggler, 'change', this.toggleBarPosition);
|
$.on(this.barPositionToggler, 'change', this.toggleBarPosition);
|
||||||
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
|
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
|
||||||
@ -1463,7 +1460,7 @@
|
|||||||
$.sync('Bottom Header', Header.setBarPosition);
|
$.sync('Bottom Header', Header.setBarPosition);
|
||||||
$.sync('Header auto-hide', Header.setBarVisibility);
|
$.sync('Header auto-hide', Header.setBarVisibility);
|
||||||
$.sync('Centered links', Header.setLinkJustify);
|
$.sync('Centered links', Header.setLinkJustify);
|
||||||
this.addShortcut(Header.menuButton);
|
this.addShortcut(menuButton);
|
||||||
$.event('AddMenuEntry', {
|
$.event('AddMenuEntry', {
|
||||||
type: 'header',
|
type: 'header',
|
||||||
el: $.el('span', {
|
el: $.el('span', {
|
||||||
@ -1963,6 +1960,9 @@
|
|||||||
threadFromRoot: function(root) {
|
threadFromRoot: function(root) {
|
||||||
return g.threads["" + g.BOARD + "." + root.id.slice(1)];
|
return g.threads["" + g.BOARD + "." + root.id.slice(1)];
|
||||||
},
|
},
|
||||||
|
threadFromNode: function(node) {
|
||||||
|
return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node));
|
||||||
|
},
|
||||||
postFromRoot: function(root) {
|
postFromRoot: function(root) {
|
||||||
var boardID, index, link, post, postID;
|
var boardID, index, link, post, postID;
|
||||||
link = $('a[title="Highlight this post"]', root);
|
link = $('a[title="Highlight this post"]', root);
|
||||||
@ -1979,8 +1979,8 @@
|
|||||||
postFromNode: function(root) {
|
postFromNode: function(root) {
|
||||||
return Get.postFromRoot($.x('(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root));
|
return Get.postFromRoot($.x('(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root));
|
||||||
},
|
},
|
||||||
contextFromNode: function(quotelink) {
|
contextFromNode: function(node) {
|
||||||
return Get.postFromRoot($.x('ancestor::div[parent::div[@class="thread"]][1]', quotelink));
|
return Get.postFromRoot($.x('ancestor::div[parent::div[@class="thread"]][1]', node));
|
||||||
},
|
},
|
||||||
postDataFromLink: function(link) {
|
postDataFromLink: function(link) {
|
||||||
var boardID, path, postID, threadID, _ref;
|
var boardID, path, postID, threadID, _ref;
|
||||||
@ -2413,7 +2413,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Menu.prototype.focus = function(entry) {
|
Menu.prototype.focus = function(entry) {
|
||||||
var bottom, cHeight, cWidth, eRect, focused, left, right, sRect, style, submenu, top, _i, _len, _ref, _ref1, _ref2;
|
var cHeight, cWidth, eRect, focused, sRect, submenu, _i, _len, _ref;
|
||||||
while (focused = $.x('parent::*/child::*[contains(@class,"focused")]', entry)) {
|
while (focused = $.x('parent::*/child::*[contains(@class,"focused")]', entry)) {
|
||||||
$.rmClass(focused, 'focused');
|
$.rmClass(focused, 'focused');
|
||||||
}
|
}
|
||||||
@ -2430,13 +2430,20 @@
|
|||||||
eRect = entry.getBoundingClientRect();
|
eRect = entry.getBoundingClientRect();
|
||||||
cHeight = doc.clientHeight;
|
cHeight = doc.clientHeight;
|
||||||
cWidth = doc.clientWidth;
|
cWidth = doc.clientWidth;
|
||||||
_ref1 = eRect.top + sRect.height < cHeight ? ['0px', 'auto'] : ['auto', '0px'], top = _ref1[0], bottom = _ref1[1];
|
if (eRect.top + sRect.height < cHeight) {
|
||||||
_ref2 = eRect.right + sRect.width < cWidth ? ['100%', 'auto'] : ['auto', '100%'], left = _ref2[0], right = _ref2[1];
|
$.addClass(submenu, 'top');
|
||||||
style = submenu.style;
|
$.rmClass(submenu, 'bottom');
|
||||||
style.top = top;
|
} else {
|
||||||
style.bottom = bottom;
|
$.addClass(submenu, 'bottom');
|
||||||
style.left = left;
|
$.rmClass(submenu, 'top');
|
||||||
return style.right = right;
|
}
|
||||||
|
if (eRect.right + sRect.width < cWidth) {
|
||||||
|
$.addClass(submenu, 'left');
|
||||||
|
return $.rmClass(submenu, 'right');
|
||||||
|
} else {
|
||||||
|
$.addClass(submenu, 'right');
|
||||||
|
return $.rmClass(submenu, 'left');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu.prototype.addEntry = function(e) {
|
Menu.prototype.addEntry = function(e) {
|
||||||
@ -3202,7 +3209,7 @@
|
|||||||
post.nodes.stub = $.el('div', {
|
post.nodes.stub = $.el('div', {
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
});
|
});
|
||||||
$.add(post.nodes.stub, !Conf['Menu'] ? a : [a, $.tn(' '), button = Menu.makeButton(post)]);
|
$.add(post.nodes.stub, Conf['Menu'] ? [a, $.tn(' '), button = Menu.makeButton(post)] : a);
|
||||||
return $.prepend(post.nodes.root, post.nodes.stub);
|
return $.prepend(post.nodes.root, post.nodes.stub);
|
||||||
},
|
},
|
||||||
show: function(post, showRecursively) {
|
show: function(post, showRecursively) {
|
||||||
@ -3516,7 +3523,7 @@
|
|||||||
return ThreadHiding.saveHiddenState(thread);
|
return ThreadHiding.saveHiddenState(thread);
|
||||||
},
|
},
|
||||||
hide: function(thread, makeStub) {
|
hide: function(thread, makeStub) {
|
||||||
var OP, a, button, numReplies, opInfo, span, threadRoot;
|
var OP, a, numReplies, opInfo, span, threadRoot;
|
||||||
if (makeStub == null) {
|
if (makeStub == null) {
|
||||||
makeStub = Conf['Stubs'];
|
makeStub = Conf['Stubs'];
|
||||||
}
|
}
|
||||||
@ -3535,7 +3542,7 @@
|
|||||||
thread.stub = $.el('div', {
|
thread.stub = $.el('div', {
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
});
|
});
|
||||||
$.add(thread.stub, !Conf['Menu'] ? a : [a, $.tn(' '), button = Menu.makeButton(OP)]);
|
$.add(thread.stub, Conf['Menu'] ? [a, $.tn(' '), Menu.makeButton()] : a);
|
||||||
return $.prepend(threadRoot, thread.stub);
|
return $.prepend(threadRoot, thread.stub);
|
||||||
},
|
},
|
||||||
show: function(thread) {
|
show: function(thread) {
|
||||||
@ -3640,25 +3647,22 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var board, boardID, quotelink, quotelinks, quotes, thread, threadID, _i, _len, _ref, _ref1;
|
var board, boardID, quotelink, thread, threadID, _i, _len, _ref, _ref1, _ref2;
|
||||||
if (this.isClone && this.thread === this.context.thread) {
|
if (this.isClone && this.thread === this.context.thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(quotes = this.quotes).length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
quotelinks = this.nodes.quotelinks;
|
|
||||||
_ref = this.isClone ? this.context : this, board = _ref.board, thread = _ref.thread;
|
_ref = this.isClone ? this.context : this, board = _ref.board, thread = _ref.thread;
|
||||||
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
_ref1 = this.nodes.quotelinks;
|
||||||
quotelink = quotelinks[_i];
|
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||||
_ref1 = Get.postDataFromLink(quotelink), boardID = _ref1.boardID, threadID = _ref1.threadID;
|
quotelink = _ref1[_i];
|
||||||
|
_ref2 = Get.postDataFromLink(quotelink), boardID = _ref2.boardID, threadID = _ref2.threadID;
|
||||||
if (!threadID) {
|
if (!threadID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (this.isClone) {
|
if (this.isClone) {
|
||||||
quotelink.textContent = quotelink.textContent.replace(QuoteCT.text, '');
|
quotelink.textContent = quotelink.textContent.replace(QuoteCT.text, '');
|
||||||
}
|
}
|
||||||
if (boardID === this.board.ID && threadID !== thread.ID) {
|
if (boardID === board.ID && threadID !== thread.ID) {
|
||||||
$.add(quotelink, $.tn(QuoteCT.text));
|
$.add(quotelink, $.tn(QuoteCT.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3800,7 +3804,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var boardID, op, postID, quotelink, quotelinks, quotes, _i, _j, _len, _len1, _ref;
|
var boardID, fullID, i, postID, quotelink, quotelinks, quotes, _ref;
|
||||||
if (this.isClone && this.thread === this.context.thread) {
|
if (this.isClone && this.thread === this.context.thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3809,19 +3813,19 @@
|
|||||||
}
|
}
|
||||||
quotelinks = this.nodes.quotelinks;
|
quotelinks = this.nodes.quotelinks;
|
||||||
if (this.isClone && quotes.contains(this.thread.fullID)) {
|
if (this.isClone && quotes.contains(this.thread.fullID)) {
|
||||||
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
i = 0;
|
||||||
quotelink = quotelinks[_i];
|
while (quotelink = quotelinks[i++]) {
|
||||||
quotelink.textContent = quotelink.textContent.replace(QuoteOP.text, '');
|
quotelink.textContent = quotelink.textContent.replace(QuoteOP.text, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
op = (this.isClone ? this.context : this).thread.fullID;
|
fullID = (this.isClone ? this.context : this).thread.fullID;
|
||||||
if (!quotes.contains(op)) {
|
if (!quotes.contains(fullID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (_j = 0, _len1 = quotelinks.length; _j < _len1; _j++) {
|
i = 0;
|
||||||
quotelink = quotelinks[_j];
|
while (quotelink = quotelinks[i++]) {
|
||||||
_ref = Get.postDataFromLink(quotelink), boardID = _ref.boardID, postID = _ref.postID;
|
_ref = Get.postDataFromLink(quotelink), boardID = _ref.boardID, postID = _ref.postID;
|
||||||
if (("" + boardID + "." + postID) === op) {
|
if (("" + boardID + "." + postID) === fullID) {
|
||||||
$.add(quotelink, $.tn(QuoteOP.text));
|
$.add(quotelink, $.tn(QuoteOP.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5170,7 +5174,7 @@
|
|||||||
}
|
}
|
||||||
_ref = QR.nodes, com = _ref.com, thread = _ref.thread;
|
_ref = QR.nodes, com = _ref.com, thread = _ref.thread;
|
||||||
if (!com.value) {
|
if (!com.value) {
|
||||||
thread.value = Get.contextFromNode(this).thread;
|
thread.value = Get.threadFromNode(this);
|
||||||
}
|
}
|
||||||
caretPos = com.selectionStart;
|
caretPos = com.selectionStart;
|
||||||
com.value = com.value.slice(0, caretPos) + text + com.value.slice(com.selectionEnd);
|
com.value = com.value.slice(0, caretPos) + text + com.value.slice(com.selectionEnd);
|
||||||
@ -6121,7 +6125,7 @@
|
|||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
});
|
});
|
||||||
$.on(this.EAI, 'click', ImageExpand.cb.toggleAll);
|
$.on(this.EAI, 'click', ImageExpand.cb.toggleAll);
|
||||||
Header.addShortcut(this.EAI);
|
Header.addShortcut(this.EAI, 2);
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
name: 'Image Expansion',
|
name: 'Image Expansion',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
@ -6834,45 +6838,44 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu = (function() {
|
Menu = {
|
||||||
var a;
|
init: function() {
|
||||||
a = $.el('a', {
|
if (g.VIEW === 'catalog' || !Conf['Menu']) {
|
||||||
className: 'menu-button brackets-wrap',
|
return;
|
||||||
innerHTML: '<i></i>',
|
|
||||||
href: 'javascript:;'
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
init: function() {
|
|
||||||
if (g.VIEW === 'catalog' || !Conf['Menu']) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.menu = new UI.Menu('post');
|
|
||||||
return Post.prototype.callbacks.push({
|
|
||||||
name: 'Menu',
|
|
||||||
cb: this.node
|
|
||||||
});
|
|
||||||
},
|
|
||||||
node: function() {
|
|
||||||
var button;
|
|
||||||
if (this.isClone) {
|
|
||||||
button = $('.menu-button', this.nodes.info);
|
|
||||||
} else {
|
|
||||||
button = a.cloneNode(true);
|
|
||||||
$.add(this.nodes.info, [$.tn('\u00A0'), button]);
|
|
||||||
}
|
|
||||||
return $.on(button, 'click', Menu.toggle);
|
|
||||||
},
|
|
||||||
makeButton: function() {
|
|
||||||
var el;
|
|
||||||
el = a.cloneNode(true);
|
|
||||||
$.on(el, 'click', Menu.toggle);
|
|
||||||
return el;
|
|
||||||
},
|
|
||||||
toggle: function(e) {
|
|
||||||
return Menu.menu.toggle(e, this, Get.postFromNode(this));
|
|
||||||
}
|
}
|
||||||
};
|
this.menu = new UI.Menu('post');
|
||||||
})();
|
return Post.prototype.callbacks.push({
|
||||||
|
name: 'Menu',
|
||||||
|
cb: this.node
|
||||||
|
});
|
||||||
|
},
|
||||||
|
node: function() {
|
||||||
|
if (this.isClone) {
|
||||||
|
return $.on($('.menu-button', this.nodes.info), 'click', Menu.toggle);
|
||||||
|
} else {
|
||||||
|
return $.add(this.nodes.info, [$.tn('\u00A0'), Menu.makeButton()]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
makeButton: (function() {
|
||||||
|
var a;
|
||||||
|
a = $.el('a', {
|
||||||
|
className: 'menu-button brackets-wrap',
|
||||||
|
innerHTML: '<i></i>',
|
||||||
|
href: 'javascript:;'
|
||||||
|
});
|
||||||
|
return function() {
|
||||||
|
var button;
|
||||||
|
button = a.cloneNode(true);
|
||||||
|
$.on(button, 'click', Menu.toggle);
|
||||||
|
return button;
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
toggle: function(e) {
|
||||||
|
var post;
|
||||||
|
post = Get.postFromNode(this);
|
||||||
|
return Menu.menu.toggle(e, this, post);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ReportLink = {
|
ReportLink = {
|
||||||
init: function() {
|
init: function() {
|
||||||
@ -7629,11 +7632,13 @@
|
|||||||
fetching: 0
|
fetching: 0
|
||||||
},
|
},
|
||||||
fetchAllStatus: function() {
|
fetchAllStatus: function() {
|
||||||
var thread, _i, _len, _ref;
|
var thread, threads, _i, _len;
|
||||||
|
if (!(threads = ThreadWatcher.getAll()).length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ThreadWatcher.status.textContent = '...';
|
ThreadWatcher.status.textContent = '...';
|
||||||
_ref = ThreadWatcher.getAll();
|
for (_i = 0, _len = threads.length; _i < _len; _i++) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
thread = threads[_i];
|
||||||
thread = _ref[_i];
|
|
||||||
ThreadWatcher.fetchStatus(thread);
|
ThreadWatcher.fetchStatus(thread);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8778,7 +8783,7 @@
|
|||||||
return ("" + status + " " + posts + " post" + (posts > 1 ? 's' : '')) + (+files ? " and " + files + " image repl" + (files > 1 ? 'ies' : 'y') : "") + (" " + (status === '-' ? 'shown' : 'omitted') + ".");
|
return ("" + status + " " + posts + " post" + (posts > 1 ? 's' : '')) + (+files ? " and " + files + " image repl" + (files > 1 ? 'ies' : 'y') : "") + (" " + (status === '-' ? 'shown' : 'omitted') + ".");
|
||||||
},
|
},
|
||||||
cbToggle: function() {
|
cbToggle: function() {
|
||||||
return ExpandThread.toggle(Get.threadFromRoot(this.parentNode));
|
return ExpandThread.toggle(Get.threadFromNode(this));
|
||||||
},
|
},
|
||||||
toggle: function(thread) {
|
toggle: function(thread) {
|
||||||
var a, files, filesCount, inlined, num, post, posts, postsCount, reply, threadRoot, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
var a, files, filesCount, inlined, num, post, posts, postsCount, reply, threadRoot, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||||
@ -10378,7 +10383,6 @@
|
|||||||
}
|
}
|
||||||
Conf['selectedArchives'] = {};
|
Conf['selectedArchives'] = {};
|
||||||
Conf['CachedTitles'] = [];
|
Conf['CachedTitles'] = [];
|
||||||
Conf['archives'] = Redirect.archives;
|
|
||||||
$.get(Conf, function(items) {
|
$.get(Conf, function(items) {
|
||||||
$.extend(Conf, items);
|
$.extend(Conf, items);
|
||||||
return Main.initFeatures();
|
return Main.initFeatures();
|
||||||
@ -10551,7 +10555,7 @@
|
|||||||
},
|
},
|
||||||
initReady: function() {
|
initReady: function() {
|
||||||
var board, err, errors, href, passLink, postRoot, posts, styleSelector, thread, threadRoot, threads, _i, _j, _len, _len1, _ref, _ref1;
|
var board, err, errors, href, passLink, postRoot, posts, styleSelector, thread, threadRoot, threads, _i, _j, _len, _len1, _ref, _ref1;
|
||||||
if (d.title === '4chan - 404 Not Found') {
|
if (['4chan - Temporarily Offline', '4chan - 404 Not Found'].contains(d.title)) {
|
||||||
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
||||||
href = Redirect.to('thread', {
|
href = Redirect.to('thread', {
|
||||||
boardID: g.BOARD.ID,
|
boardID: g.BOARD.ID,
|
||||||
|
|||||||
@ -1426,10 +1426,10 @@
|
|||||||
|
|
||||||
Header = {
|
Header = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var barFixedToggler, barPositionToggler, customNavToggler, editCustomNav, footerToggler, headerToggler, linkJustifyToggler,
|
var barFixedToggler, barPositionToggler, customNavToggler, editCustomNav, footerToggler, headerToggler, linkJustifyToggler, menuButton,
|
||||||
_this = this;
|
_this = this;
|
||||||
this.menu = new UI.Menu('header');
|
this.menu = new UI.Menu('header');
|
||||||
this.menuButton = $.el('span', {
|
menuButton = $.el('span', {
|
||||||
className: 'menu-button',
|
className: 'menu-button',
|
||||||
innerHTML: '<i></i>'
|
innerHTML: '<i></i>'
|
||||||
});
|
});
|
||||||
@ -1461,7 +1461,7 @@
|
|||||||
this.headerToggler = headerToggler.firstElementChild;
|
this.headerToggler = headerToggler.firstElementChild;
|
||||||
this.footerToggler = footerToggler.firstElementChild;
|
this.footerToggler = footerToggler.firstElementChild;
|
||||||
this.customNavToggler = customNavToggler.firstElementChild;
|
this.customNavToggler = customNavToggler.firstElementChild;
|
||||||
$.on(this.menuButton, 'click', this.menuToggle);
|
$.on(menuButton, 'click', this.menuToggle);
|
||||||
$.on(this.barFixedToggler, 'change', this.toggleBarFixed);
|
$.on(this.barFixedToggler, 'change', this.toggleBarFixed);
|
||||||
$.on(this.barPositionToggler, 'change', this.toggleBarPosition);
|
$.on(this.barPositionToggler, 'change', this.toggleBarPosition);
|
||||||
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
|
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
|
||||||
@ -1476,7 +1476,7 @@
|
|||||||
$.sync('Bottom Header', Header.setBarPosition);
|
$.sync('Bottom Header', Header.setBarPosition);
|
||||||
$.sync('Header auto-hide', Header.setBarVisibility);
|
$.sync('Header auto-hide', Header.setBarVisibility);
|
||||||
$.sync('Centered links', Header.setLinkJustify);
|
$.sync('Centered links', Header.setLinkJustify);
|
||||||
this.addShortcut(Header.menuButton);
|
this.addShortcut(menuButton);
|
||||||
$.event('AddMenuEntry', {
|
$.event('AddMenuEntry', {
|
||||||
type: 'header',
|
type: 'header',
|
||||||
el: $.el('span', {
|
el: $.el('span', {
|
||||||
@ -1976,6 +1976,9 @@
|
|||||||
threadFromRoot: function(root) {
|
threadFromRoot: function(root) {
|
||||||
return g.threads["" + g.BOARD + "." + root.id.slice(1)];
|
return g.threads["" + g.BOARD + "." + root.id.slice(1)];
|
||||||
},
|
},
|
||||||
|
threadFromNode: function(node) {
|
||||||
|
return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node));
|
||||||
|
},
|
||||||
postFromRoot: function(root) {
|
postFromRoot: function(root) {
|
||||||
var boardID, index, link, post, postID;
|
var boardID, index, link, post, postID;
|
||||||
link = $('a[title="Highlight this post"]', root);
|
link = $('a[title="Highlight this post"]', root);
|
||||||
@ -1992,8 +1995,8 @@
|
|||||||
postFromNode: function(root) {
|
postFromNode: function(root) {
|
||||||
return Get.postFromRoot($.x('(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root));
|
return Get.postFromRoot($.x('(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root));
|
||||||
},
|
},
|
||||||
contextFromNode: function(quotelink) {
|
contextFromNode: function(node) {
|
||||||
return Get.postFromRoot($.x('ancestor::div[parent::div[@class="thread"]][1]', quotelink));
|
return Get.postFromRoot($.x('ancestor::div[parent::div[@class="thread"]][1]', node));
|
||||||
},
|
},
|
||||||
postDataFromLink: function(link) {
|
postDataFromLink: function(link) {
|
||||||
var boardID, path, postID, threadID, _ref;
|
var boardID, path, postID, threadID, _ref;
|
||||||
@ -2426,7 +2429,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Menu.prototype.focus = function(entry) {
|
Menu.prototype.focus = function(entry) {
|
||||||
var bottom, cHeight, cWidth, eRect, focused, left, right, sRect, style, submenu, top, _i, _len, _ref, _ref1, _ref2;
|
var cHeight, cWidth, eRect, focused, sRect, submenu, _i, _len, _ref;
|
||||||
while (focused = $.x('parent::*/child::*[contains(@class,"focused")]', entry)) {
|
while (focused = $.x('parent::*/child::*[contains(@class,"focused")]', entry)) {
|
||||||
$.rmClass(focused, 'focused');
|
$.rmClass(focused, 'focused');
|
||||||
}
|
}
|
||||||
@ -2443,13 +2446,20 @@
|
|||||||
eRect = entry.getBoundingClientRect();
|
eRect = entry.getBoundingClientRect();
|
||||||
cHeight = doc.clientHeight;
|
cHeight = doc.clientHeight;
|
||||||
cWidth = doc.clientWidth;
|
cWidth = doc.clientWidth;
|
||||||
_ref1 = eRect.top + sRect.height < cHeight ? ['0px', 'auto'] : ['auto', '0px'], top = _ref1[0], bottom = _ref1[1];
|
if (eRect.top + sRect.height < cHeight) {
|
||||||
_ref2 = eRect.right + sRect.width < cWidth ? ['100%', 'auto'] : ['auto', '100%'], left = _ref2[0], right = _ref2[1];
|
$.addClass(submenu, 'top');
|
||||||
style = submenu.style;
|
$.rmClass(submenu, 'bottom');
|
||||||
style.top = top;
|
} else {
|
||||||
style.bottom = bottom;
|
$.addClass(submenu, 'bottom');
|
||||||
style.left = left;
|
$.rmClass(submenu, 'top');
|
||||||
return style.right = right;
|
}
|
||||||
|
if (eRect.right + sRect.width < cWidth) {
|
||||||
|
$.addClass(submenu, 'left');
|
||||||
|
return $.rmClass(submenu, 'right');
|
||||||
|
} else {
|
||||||
|
$.addClass(submenu, 'right');
|
||||||
|
return $.rmClass(submenu, 'left');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu.prototype.addEntry = function(e) {
|
Menu.prototype.addEntry = function(e) {
|
||||||
@ -3208,7 +3218,7 @@
|
|||||||
post.nodes.stub = $.el('div', {
|
post.nodes.stub = $.el('div', {
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
});
|
});
|
||||||
$.add(post.nodes.stub, !Conf['Menu'] ? a : [a, $.tn(' '), button = Menu.makeButton(post)]);
|
$.add(post.nodes.stub, Conf['Menu'] ? [a, $.tn(' '), button = Menu.makeButton(post)] : a);
|
||||||
return $.prepend(post.nodes.root, post.nodes.stub);
|
return $.prepend(post.nodes.root, post.nodes.stub);
|
||||||
},
|
},
|
||||||
show: function(post, showRecursively) {
|
show: function(post, showRecursively) {
|
||||||
@ -3522,7 +3532,7 @@
|
|||||||
return ThreadHiding.saveHiddenState(thread);
|
return ThreadHiding.saveHiddenState(thread);
|
||||||
},
|
},
|
||||||
hide: function(thread, makeStub) {
|
hide: function(thread, makeStub) {
|
||||||
var OP, a, button, numReplies, opInfo, span, threadRoot;
|
var OP, a, numReplies, opInfo, span, threadRoot;
|
||||||
if (makeStub == null) {
|
if (makeStub == null) {
|
||||||
makeStub = Conf['Stubs'];
|
makeStub = Conf['Stubs'];
|
||||||
}
|
}
|
||||||
@ -3541,7 +3551,7 @@
|
|||||||
thread.stub = $.el('div', {
|
thread.stub = $.el('div', {
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
});
|
});
|
||||||
$.add(thread.stub, !Conf['Menu'] ? a : [a, $.tn(' '), button = Menu.makeButton(OP)]);
|
$.add(thread.stub, Conf['Menu'] ? [a, $.tn(' '), Menu.makeButton()] : a);
|
||||||
return $.prepend(threadRoot, thread.stub);
|
return $.prepend(threadRoot, thread.stub);
|
||||||
},
|
},
|
||||||
show: function(thread) {
|
show: function(thread) {
|
||||||
@ -3646,25 +3656,22 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var board, boardID, quotelink, quotelinks, quotes, thread, threadID, _i, _len, _ref, _ref1;
|
var board, boardID, quotelink, thread, threadID, _i, _len, _ref, _ref1, _ref2;
|
||||||
if (this.isClone && this.thread === this.context.thread) {
|
if (this.isClone && this.thread === this.context.thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(quotes = this.quotes).length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
quotelinks = this.nodes.quotelinks;
|
|
||||||
_ref = this.isClone ? this.context : this, board = _ref.board, thread = _ref.thread;
|
_ref = this.isClone ? this.context : this, board = _ref.board, thread = _ref.thread;
|
||||||
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
_ref1 = this.nodes.quotelinks;
|
||||||
quotelink = quotelinks[_i];
|
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||||
_ref1 = Get.postDataFromLink(quotelink), boardID = _ref1.boardID, threadID = _ref1.threadID;
|
quotelink = _ref1[_i];
|
||||||
|
_ref2 = Get.postDataFromLink(quotelink), boardID = _ref2.boardID, threadID = _ref2.threadID;
|
||||||
if (!threadID) {
|
if (!threadID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (this.isClone) {
|
if (this.isClone) {
|
||||||
quotelink.textContent = quotelink.textContent.replace(QuoteCT.text, '');
|
quotelink.textContent = quotelink.textContent.replace(QuoteCT.text, '');
|
||||||
}
|
}
|
||||||
if (boardID === this.board.ID && threadID !== thread.ID) {
|
if (boardID === board.ID && threadID !== thread.ID) {
|
||||||
$.add(quotelink, $.tn(QuoteCT.text));
|
$.add(quotelink, $.tn(QuoteCT.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3806,7 +3813,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var boardID, op, postID, quotelink, quotelinks, quotes, _i, _j, _len, _len1, _ref;
|
var boardID, fullID, i, postID, quotelink, quotelinks, quotes, _ref;
|
||||||
if (this.isClone && this.thread === this.context.thread) {
|
if (this.isClone && this.thread === this.context.thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3815,19 +3822,19 @@
|
|||||||
}
|
}
|
||||||
quotelinks = this.nodes.quotelinks;
|
quotelinks = this.nodes.quotelinks;
|
||||||
if (this.isClone && quotes.contains(this.thread.fullID)) {
|
if (this.isClone && quotes.contains(this.thread.fullID)) {
|
||||||
for (_i = 0, _len = quotelinks.length; _i < _len; _i++) {
|
i = 0;
|
||||||
quotelink = quotelinks[_i];
|
while (quotelink = quotelinks[i++]) {
|
||||||
quotelink.textContent = quotelink.textContent.replace(QuoteOP.text, '');
|
quotelink.textContent = quotelink.textContent.replace(QuoteOP.text, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
op = (this.isClone ? this.context : this).thread.fullID;
|
fullID = (this.isClone ? this.context : this).thread.fullID;
|
||||||
if (!quotes.contains(op)) {
|
if (!quotes.contains(fullID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (_j = 0, _len1 = quotelinks.length; _j < _len1; _j++) {
|
i = 0;
|
||||||
quotelink = quotelinks[_j];
|
while (quotelink = quotelinks[i++]) {
|
||||||
_ref = Get.postDataFromLink(quotelink), boardID = _ref.boardID, postID = _ref.postID;
|
_ref = Get.postDataFromLink(quotelink), boardID = _ref.boardID, postID = _ref.postID;
|
||||||
if (("" + boardID + "." + postID) === op) {
|
if (("" + boardID + "." + postID) === fullID) {
|
||||||
$.add(quotelink, $.tn(QuoteOP.text));
|
$.add(quotelink, $.tn(QuoteOP.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5177,7 +5184,7 @@
|
|||||||
}
|
}
|
||||||
_ref = QR.nodes, com = _ref.com, thread = _ref.thread;
|
_ref = QR.nodes, com = _ref.com, thread = _ref.thread;
|
||||||
if (!com.value) {
|
if (!com.value) {
|
||||||
thread.value = Get.contextFromNode(this).thread;
|
thread.value = Get.threadFromNode(this);
|
||||||
}
|
}
|
||||||
caretPos = com.selectionStart;
|
caretPos = com.selectionStart;
|
||||||
com.value = com.value.slice(0, caretPos) + text + com.value.slice(com.selectionEnd);
|
com.value = com.value.slice(0, caretPos) + text + com.value.slice(com.selectionEnd);
|
||||||
@ -6103,7 +6110,7 @@
|
|||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
});
|
});
|
||||||
$.on(this.EAI, 'click', ImageExpand.cb.toggleAll);
|
$.on(this.EAI, 'click', ImageExpand.cb.toggleAll);
|
||||||
Header.addShortcut(this.EAI);
|
Header.addShortcut(this.EAI, 2);
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
name: 'Image Expansion',
|
name: 'Image Expansion',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
@ -6816,45 +6823,44 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu = (function() {
|
Menu = {
|
||||||
var a;
|
init: function() {
|
||||||
a = $.el('a', {
|
if (g.VIEW === 'catalog' || !Conf['Menu']) {
|
||||||
className: 'menu-button brackets-wrap',
|
return;
|
||||||
innerHTML: '<i></i>',
|
|
||||||
href: 'javascript:;'
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
init: function() {
|
|
||||||
if (g.VIEW === 'catalog' || !Conf['Menu']) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.menu = new UI.Menu('post');
|
|
||||||
return Post.prototype.callbacks.push({
|
|
||||||
name: 'Menu',
|
|
||||||
cb: this.node
|
|
||||||
});
|
|
||||||
},
|
|
||||||
node: function() {
|
|
||||||
var button;
|
|
||||||
if (this.isClone) {
|
|
||||||
button = $('.menu-button', this.nodes.info);
|
|
||||||
} else {
|
|
||||||
button = a.cloneNode(true);
|
|
||||||
$.add(this.nodes.info, [$.tn('\u00A0'), button]);
|
|
||||||
}
|
|
||||||
return $.on(button, 'click', Menu.toggle);
|
|
||||||
},
|
|
||||||
makeButton: function() {
|
|
||||||
var el;
|
|
||||||
el = a.cloneNode(true);
|
|
||||||
$.on(el, 'click', Menu.toggle);
|
|
||||||
return el;
|
|
||||||
},
|
|
||||||
toggle: function(e) {
|
|
||||||
return Menu.menu.toggle(e, this, Get.postFromNode(this));
|
|
||||||
}
|
}
|
||||||
};
|
this.menu = new UI.Menu('post');
|
||||||
})();
|
return Post.prototype.callbacks.push({
|
||||||
|
name: 'Menu',
|
||||||
|
cb: this.node
|
||||||
|
});
|
||||||
|
},
|
||||||
|
node: function() {
|
||||||
|
if (this.isClone) {
|
||||||
|
return $.on($('.menu-button', this.nodes.info), 'click', Menu.toggle);
|
||||||
|
} else {
|
||||||
|
return $.add(this.nodes.info, [$.tn('\u00A0'), Menu.makeButton()]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
makeButton: (function() {
|
||||||
|
var a;
|
||||||
|
a = $.el('a', {
|
||||||
|
className: 'menu-button brackets-wrap',
|
||||||
|
innerHTML: '<i></i>',
|
||||||
|
href: 'javascript:;'
|
||||||
|
});
|
||||||
|
return function() {
|
||||||
|
var button;
|
||||||
|
button = a.cloneNode(true);
|
||||||
|
$.on(button, 'click', Menu.toggle);
|
||||||
|
return button;
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
toggle: function(e) {
|
||||||
|
var post;
|
||||||
|
post = Get.postFromNode(this);
|
||||||
|
return Menu.menu.toggle(e, this, post);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ReportLink = {
|
ReportLink = {
|
||||||
init: function() {
|
init: function() {
|
||||||
@ -7611,11 +7617,13 @@
|
|||||||
fetching: 0
|
fetching: 0
|
||||||
},
|
},
|
||||||
fetchAllStatus: function() {
|
fetchAllStatus: function() {
|
||||||
var thread, _i, _len, _ref;
|
var thread, threads, _i, _len;
|
||||||
|
if (!(threads = ThreadWatcher.getAll()).length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ThreadWatcher.status.textContent = '...';
|
ThreadWatcher.status.textContent = '...';
|
||||||
_ref = ThreadWatcher.getAll();
|
for (_i = 0, _len = threads.length; _i < _len; _i++) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
thread = threads[_i];
|
||||||
thread = _ref[_i];
|
|
||||||
ThreadWatcher.fetchStatus(thread);
|
ThreadWatcher.fetchStatus(thread);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8765,7 +8773,7 @@
|
|||||||
return ("" + status + " " + posts + " post" + (posts > 1 ? 's' : '')) + (+files ? " and " + files + " image repl" + (files > 1 ? 'ies' : 'y') : "") + (" " + (status === '-' ? 'shown' : 'omitted') + ".");
|
return ("" + status + " " + posts + " post" + (posts > 1 ? 's' : '')) + (+files ? " and " + files + " image repl" + (files > 1 ? 'ies' : 'y') : "") + (" " + (status === '-' ? 'shown' : 'omitted') + ".");
|
||||||
},
|
},
|
||||||
cbToggle: function() {
|
cbToggle: function() {
|
||||||
return ExpandThread.toggle(Get.threadFromRoot(this.parentNode));
|
return ExpandThread.toggle(Get.threadFromNode(this));
|
||||||
},
|
},
|
||||||
toggle: function(thread) {
|
toggle: function(thread) {
|
||||||
var a, files, filesCount, inlined, num, post, posts, postsCount, reply, threadRoot, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
var a, files, filesCount, inlined, num, post, posts, postsCount, reply, threadRoot, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||||
@ -10363,7 +10371,6 @@
|
|||||||
}
|
}
|
||||||
Conf['selectedArchives'] = {};
|
Conf['selectedArchives'] = {};
|
||||||
Conf['CachedTitles'] = [];
|
Conf['CachedTitles'] = [];
|
||||||
Conf['archives'] = Redirect.archives;
|
|
||||||
$.get(Conf, function(items) {
|
$.get(Conf, function(items) {
|
||||||
$.extend(Conf, items);
|
$.extend(Conf, items);
|
||||||
if (!items) {
|
if (!items) {
|
||||||
@ -10545,7 +10552,7 @@
|
|||||||
},
|
},
|
||||||
initReady: function() {
|
initReady: function() {
|
||||||
var board, err, errors, href, passLink, postRoot, posts, styleSelector, thread, threadRoot, threads, _i, _j, _len, _len1, _ref, _ref1;
|
var board, err, errors, href, passLink, postRoot, posts, styleSelector, thread, threadRoot, threads, _i, _j, _len, _len1, _ref, _ref1;
|
||||||
if (d.title === '4chan - 404 Not Found') {
|
if (['4chan - Temporarily Offline', '4chan - 404 Not Found'].contains(d.title)) {
|
||||||
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
||||||
href = Redirect.to('thread', {
|
href = Redirect.to('thread', {
|
||||||
boardID: g.BOARD.ID,
|
boardID: g.BOARD.ID,
|
||||||
|
|||||||
9
html/General/Header.html
Normal file
9
html/General/Header.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<div id="header-bar" class="dialog">
|
||||||
|
<span id="shortcuts" class="brackets-wrap"></span>
|
||||||
|
<span id="board-list">
|
||||||
|
<span id="custom-board-list"></span>
|
||||||
|
<span id="full-board-list" hidden></span>
|
||||||
|
</span>
|
||||||
|
<div id="toggle-header-bar" title="Toggle the header auto-hiding."></div>
|
||||||
|
</div>
|
||||||
|
<div id="notifications"></div>
|
||||||
@ -2,6 +2,7 @@
|
|||||||
"name": "4chan-X",
|
"name": "4chan-X",
|
||||||
"version": "1.2.27",
|
"version": "1.2.27",
|
||||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||||
|
|
||||||
"meta": {
|
"meta": {
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
"repo": "https://github.com/seaweedchan/4chan-x/",
|
"repo": "https://github.com/seaweedchan/4chan-x/",
|
||||||
|
|||||||
@ -186,10 +186,10 @@ PostHiding =
|
|||||||
$.add a, $.tn " #{postInfo}"
|
$.add a, $.tn " #{postInfo}"
|
||||||
post.nodes.stub = $.el 'div',
|
post.nodes.stub = $.el 'div',
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
$.add post.nodes.stub, unless Conf['Menu']
|
$.add post.nodes.stub, if Conf['Menu']
|
||||||
a
|
[a, $.tn(' '), button = Menu.makeButton post]
|
||||||
else
|
else
|
||||||
[a, $.tn(' '), button = Menu.makeButton post]
|
a
|
||||||
$.prepend post.nodes.root, post.nodes.stub
|
$.prepend post.nodes.root, post.nodes.stub
|
||||||
|
|
||||||
show: (post, showRecursively=Conf['Recursive Hiding']) ->
|
show: (post, showRecursively=Conf['Recursive Hiding']) ->
|
||||||
@ -204,4 +204,4 @@ PostHiding =
|
|||||||
Recursive.rm PostHiding.hide, post
|
Recursive.rm PostHiding.hide, post
|
||||||
for quotelink in Get.allQuotelinksLinkingTo post
|
for quotelink in Get.allQuotelinksLinkingTo post
|
||||||
$.rmClass quotelink, 'filtered'
|
$.rmClass quotelink, 'filtered'
|
||||||
return
|
return
|
||||||
|
|||||||
@ -191,10 +191,10 @@ ThreadHiding =
|
|||||||
$.add a, $.tn " #{opInfo} (#{numReplies})"
|
$.add a, $.tn " #{opInfo} (#{numReplies})"
|
||||||
thread.stub = $.el 'div',
|
thread.stub = $.el 'div',
|
||||||
className: 'stub'
|
className: 'stub'
|
||||||
$.add thread.stub, unless Conf['Menu']
|
$.add thread.stub, if Conf['Menu']
|
||||||
a
|
[a, $.tn(' '), Menu.makeButton()]
|
||||||
else
|
else
|
||||||
[a, $.tn(' '), button = Menu.makeButton OP]
|
a
|
||||||
$.prepend threadRoot, thread.stub
|
$.prepend threadRoot, thread.stub
|
||||||
|
|
||||||
show: (thread) ->
|
show: (thread) ->
|
||||||
|
|||||||
@ -10,6 +10,8 @@ Get =
|
|||||||
"/#{thread.board}/ - #{excerpt}"
|
"/#{thread.board}/ - #{excerpt}"
|
||||||
threadFromRoot: (root) ->
|
threadFromRoot: (root) ->
|
||||||
g.threads["#{g.BOARD}.#{root.id[1..]}"]
|
g.threads["#{g.BOARD}.#{root.id[1..]}"]
|
||||||
|
threadFromNode: (node) ->
|
||||||
|
Get.threadFromRoot $.x 'ancestor::div[@class="thread"]', node
|
||||||
postFromRoot: (root) ->
|
postFromRoot: (root) ->
|
||||||
link = $ 'a[title="Highlight this post"]', root
|
link = $ 'a[title="Highlight this post"]', root
|
||||||
boardID = link.pathname.split('/')[1]
|
boardID = link.pathname.split('/')[1]
|
||||||
@ -19,8 +21,8 @@ Get =
|
|||||||
if index then post.clones[index] else post
|
if index then post.clones[index] else post
|
||||||
postFromNode: (root) ->
|
postFromNode: (root) ->
|
||||||
Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root
|
Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root
|
||||||
contextFromNode: (quotelink) ->
|
contextFromNode: (node) ->
|
||||||
Get.postFromRoot $.x 'ancestor::div[parent::div[@class="thread"]][1]', quotelink
|
Get.postFromRoot $.x 'ancestor::div[parent::div[@class="thread"]][1]', node
|
||||||
postDataFromLink: (link) ->
|
postDataFromLink: (link) ->
|
||||||
if link.hostname is 'boards.4chan.org'
|
if link.hostname is 'boards.4chan.org'
|
||||||
path = link.pathname.split '/'
|
path = link.pathname.split '/'
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
Header =
|
Header =
|
||||||
init: ->
|
init: ->
|
||||||
@menu = new UI.Menu 'header'
|
@menu = new UI.Menu 'header'
|
||||||
@menuButton = $.el 'span',
|
|
||||||
|
menuButton = $.el 'span',
|
||||||
className: 'menu-button'
|
className: 'menu-button'
|
||||||
innerHTML: '<i></i>'
|
innerHTML: '<i></i>'
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ Header =
|
|||||||
@footerToggler = footerToggler.firstElementChild
|
@footerToggler = footerToggler.firstElementChild
|
||||||
@customNavToggler = customNavToggler.firstElementChild
|
@customNavToggler = customNavToggler.firstElementChild
|
||||||
|
|
||||||
$.on @menuButton, 'click', @menuToggle
|
$.on menuButton, 'click', @menuToggle
|
||||||
$.on @barFixedToggler, 'change', @toggleBarFixed
|
$.on @barFixedToggler, 'change', @toggleBarFixed
|
||||||
$.on @barPositionToggler, 'change', @toggleBarPosition
|
$.on @barPositionToggler, 'change', @toggleBarPosition
|
||||||
$.on @linkJustifyToggler, 'change', @toggleLinkJustify
|
$.on @linkJustifyToggler, 'change', @toggleLinkJustify
|
||||||
@ -46,7 +47,7 @@ Header =
|
|||||||
$.sync 'Header auto-hide', Header.setBarVisibility
|
$.sync 'Header auto-hide', Header.setBarVisibility
|
||||||
$.sync 'Centered links', Header.setLinkJustify
|
$.sync 'Centered links', Header.setLinkJustify
|
||||||
|
|
||||||
@addShortcut Header.menuButton
|
@addShortcut menuButton
|
||||||
|
|
||||||
$.event 'AddMenuEntry',
|
$.event 'AddMenuEntry',
|
||||||
type: 'header'
|
type: 'header'
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
Main =
|
Main =
|
||||||
init: ->
|
init: ->
|
||||||
|
|
||||||
# flatten Config into Conf
|
# flatten Config into Conf
|
||||||
# and get saved or default values
|
# and get saved or default values
|
||||||
flatten = (parent, obj) ->
|
flatten = (parent, obj) ->
|
||||||
@ -16,7 +17,6 @@ Main =
|
|||||||
Conf[db] = boards: {}
|
Conf[db] = boards: {}
|
||||||
Conf['selectedArchives'] = {}
|
Conf['selectedArchives'] = {}
|
||||||
Conf['CachedTitles'] = []
|
Conf['CachedTitles'] = []
|
||||||
Conf['archives'] = Redirect.archives
|
|
||||||
$.get Conf, (items) ->
|
$.get Conf, (items) ->
|
||||||
$.extend Conf, items
|
$.extend Conf, items
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
@ -52,6 +52,7 @@ Main =
|
|||||||
'index'
|
'index'
|
||||||
if g.VIEW is 'thread'
|
if g.VIEW is 'thread'
|
||||||
g.THREADID = +pathname[3]
|
g.THREADID = +pathname[3]
|
||||||
|
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
when 'api.4chan.org'
|
when 'api.4chan.org'
|
||||||
return
|
return
|
||||||
@ -183,7 +184,7 @@ Main =
|
|||||||
attributeFilter: ['href']
|
attributeFilter: ['href']
|
||||||
|
|
||||||
initReady: ->
|
initReady: ->
|
||||||
if d.title is '4chan - 404 Not Found'
|
if ['4chan - Temporarily Offline', '4chan - 404 Not Found'].contains d.title
|
||||||
if Conf['404 Redirect'] and g.VIEW is 'thread'
|
if Conf['404 Redirect'] and g.VIEW is 'thread'
|
||||||
href = Redirect.to 'thread',
|
href = Redirect.to 'thread',
|
||||||
boardID: g.BOARD.ID
|
boardID: g.BOARD.ID
|
||||||
|
|||||||
@ -91,7 +91,7 @@ UI = do ->
|
|||||||
$.addClass menu, 'left'
|
$.addClass menu, 'left'
|
||||||
|
|
||||||
entry = $ '.entry', menu
|
entry = $ '.entry', menu
|
||||||
# We've removed flexbox, so we don't user order anymore.
|
# We've removed flexbox, so we don't use order anymore.
|
||||||
# while prevEntry = @findNextEntry entry, -1
|
# while prevEntry = @findNextEntry entry, -1
|
||||||
# entry = prevEntry
|
# entry = prevEntry
|
||||||
@focus entry
|
@focus entry
|
||||||
@ -171,19 +171,18 @@ UI = do ->
|
|||||||
eRect = entry.getBoundingClientRect()
|
eRect = entry.getBoundingClientRect()
|
||||||
cHeight = doc.clientHeight
|
cHeight = doc.clientHeight
|
||||||
cWidth = doc.clientWidth
|
cWidth = doc.clientWidth
|
||||||
[top, bottom] = if eRect.top + sRect.height < cHeight
|
if eRect.top + sRect.height < cHeight
|
||||||
['0px', 'auto']
|
$.addClass submenu, 'top'
|
||||||
|
$.rmClass submenu, 'bottom'
|
||||||
else
|
else
|
||||||
['auto', '0px']
|
$.addClass submenu, 'bottom'
|
||||||
[left, right] = if eRect.right + sRect.width < cWidth
|
$.rmClass submenu, 'top'
|
||||||
['100%', 'auto']
|
if eRect.right + sRect.width < cWidth
|
||||||
|
$.addClass submenu, 'left'
|
||||||
|
$.rmClass submenu, 'right'
|
||||||
else
|
else
|
||||||
['auto', '100%']
|
$.addClass submenu, 'right'
|
||||||
{style} = submenu
|
$.rmClass submenu, 'left'
|
||||||
style.top = top
|
|
||||||
style.bottom = bottom
|
|
||||||
style.left = left
|
|
||||||
style.right = right
|
|
||||||
|
|
||||||
addEntry: (e) ->
|
addEntry: (e) ->
|
||||||
entry = e.detail
|
entry = e.detail
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
Polyfill =
|
Polyfill =
|
||||||
init: ->
|
init: ->
|
||||||
|
<% if (type === 'crx') { %>
|
||||||
Polyfill.toBlob()
|
Polyfill.toBlob()
|
||||||
Polyfill.visibility()
|
Polyfill.visibility()
|
||||||
|
<% } %>
|
||||||
toBlob: ->
|
toBlob: ->
|
||||||
HTMLCanvasElement::toBlob or= (cb) ->
|
HTMLCanvasElement::toBlob or= (cb) ->
|
||||||
data = atob @toDataURL()[22..]
|
data = atob @toDataURL()[22..]
|
||||||
|
|||||||
@ -8,7 +8,7 @@ ImageExpand =
|
|||||||
title: 'Expand All Images'
|
title: 'Expand All Images'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.on @EAI, 'click', ImageExpand.cb.toggleAll
|
$.on @EAI, 'click', ImageExpand.cb.toggleAll
|
||||||
Header.addShortcut @EAI
|
Header.addShortcut @EAI, 2
|
||||||
|
|
||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Image Expansion'
|
name: 'Image Expansion'
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
Menu = do ->
|
Menu =
|
||||||
a = $.el 'a',
|
|
||||||
className: 'menu-button brackets-wrap'
|
|
||||||
innerHTML: '<i></i>'
|
|
||||||
href: 'javascript:;'
|
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW is 'catalog' or !Conf['Menu']
|
return if g.VIEW is 'catalog' or !Conf['Menu']
|
||||||
|
|
||||||
@ -14,16 +9,20 @@ Menu = do ->
|
|||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
if @isClone
|
if @isClone
|
||||||
button = $ '.menu-button', @nodes.info
|
$.on $('.menu-button', @nodes.info), 'click', Menu.toggle
|
||||||
else
|
else
|
||||||
button = a.cloneNode true
|
$.add @nodes.info, [$.tn('\u00A0'), Menu.makeButton()]
|
||||||
$.add @nodes.info, [$.tn('\u00A0'), button]
|
|
||||||
$.on button, 'click', Menu.toggle
|
|
||||||
|
|
||||||
makeButton: ->
|
makeButton: do ->
|
||||||
el = a.cloneNode true
|
a = $.el 'a',
|
||||||
$.on el, 'click', Menu.toggle
|
className: 'menu-button brackets-wrap'
|
||||||
el
|
innerHTML: '<i></i>'
|
||||||
|
href: 'javascript:;'
|
||||||
|
->
|
||||||
|
button = a.cloneNode true
|
||||||
|
$.on button, 'click', Menu.toggle
|
||||||
|
button
|
||||||
|
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
Menu.menu.toggle e, @, Get.postFromNode @
|
post = Get.postFromNode @
|
||||||
|
Menu.menu.toggle e, @, post
|
||||||
|
|||||||
@ -22,7 +22,7 @@ ExpandThread =
|
|||||||
" #{if status is '-' then 'shown' else 'omitted'}."
|
" #{if status is '-' then 'shown' else 'omitted'}."
|
||||||
|
|
||||||
cbToggle: ->
|
cbToggle: ->
|
||||||
ExpandThread.toggle Get.threadFromRoot @parentNode
|
ExpandThread.toggle Get.threadFromNode @
|
||||||
|
|
||||||
toggle: (thread) ->
|
toggle: (thread) ->
|
||||||
threadRoot = thread.OP.nodes.root.parentNode
|
threadRoot = thread.OP.nodes.root.parentNode
|
||||||
|
|||||||
@ -107,8 +107,9 @@ ThreadWatcher =
|
|||||||
fetched: 0
|
fetched: 0
|
||||||
fetching: 0
|
fetching: 0
|
||||||
fetchAllStatus: ->
|
fetchAllStatus: ->
|
||||||
|
return unless (threads = ThreadWatcher.getAll()).length
|
||||||
ThreadWatcher.status.textContent = '...'
|
ThreadWatcher.status.textContent = '...'
|
||||||
for thread in ThreadWatcher.getAll()
|
for thread in threads
|
||||||
ThreadWatcher.fetchStatus thread
|
ThreadWatcher.fetchStatus thread
|
||||||
return
|
return
|
||||||
fetchStatus: ({boardID, threadID, data}) ->
|
fetchStatus: ({boardID, threadID, data}) ->
|
||||||
|
|||||||
@ -385,7 +385,7 @@ QR =
|
|||||||
$.addClass QR.nodes.el, 'dump'
|
$.addClass QR.nodes.el, 'dump'
|
||||||
QR.cooldown.auto = true
|
QR.cooldown.auto = true
|
||||||
{com, thread} = QR.nodes
|
{com, thread} = QR.nodes
|
||||||
thread.value = Get.contextFromNode(@).thread unless com.value
|
thread.value = Get.threadFromNode @ unless com.value
|
||||||
|
|
||||||
caretPos = com.selectionStart
|
caretPos = com.selectionStart
|
||||||
# Replace selection for text.
|
# Replace selection for text.
|
||||||
|
|||||||
@ -13,16 +13,13 @@ QuoteCT =
|
|||||||
node: ->
|
node: ->
|
||||||
# Stop there if it's a clone of a post in the same thread.
|
# Stop there if it's a clone of a post in the same thread.
|
||||||
return if @isClone and @thread is @context.thread
|
return if @isClone and @thread is @context.thread
|
||||||
# Stop there if there's no quotes in that post.
|
|
||||||
return unless (quotes = @quotes).length
|
|
||||||
{quotelinks} = @nodes
|
|
||||||
|
|
||||||
{board, thread} = if @isClone then @context else @
|
{board, thread} = if @isClone then @context else @
|
||||||
for quotelink in quotelinks
|
for quotelink in @nodes.quotelinks
|
||||||
{boardID, threadID} = Get.postDataFromLink quotelink
|
{boardID, threadID} = Get.postDataFromLink quotelink
|
||||||
continue unless threadID # deadlink
|
continue unless threadID # deadlink
|
||||||
if @isClone
|
if @isClone
|
||||||
quotelink.textContent = quotelink.textContent.replace QuoteCT.text, ''
|
quotelink.textContent = quotelink.textContent.replace QuoteCT.text, ''
|
||||||
if boardID is @board.ID and threadID isnt thread.ID
|
if boardID is board.ID and threadID isnt thread.ID
|
||||||
$.add quotelink, $.tn QuoteCT.text
|
$.add quotelink, $.tn QuoteCT.text
|
||||||
return
|
return
|
||||||
|
|||||||
@ -10,6 +10,7 @@ QuoteOP =
|
|||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Mark OP Quotes'
|
name: 'Mark OP Quotes'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
# Stop there if it's a clone of a post in the same thread.
|
# Stop there if it's a clone of a post in the same thread.
|
||||||
return if @isClone and @thread is @context.thread
|
return if @isClone and @thread is @context.thread
|
||||||
@ -19,14 +20,16 @@ QuoteOP =
|
|||||||
|
|
||||||
# rm (OP) from cross-thread quotes.
|
# rm (OP) from cross-thread quotes.
|
||||||
if @isClone and quotes.contains @thread.fullID
|
if @isClone and quotes.contains @thread.fullID
|
||||||
for quotelink in quotelinks
|
i = 0
|
||||||
|
while quotelink = quotelinks[i++]
|
||||||
quotelink.textContent = quotelink.textContent.replace QuoteOP.text, ''
|
quotelink.textContent = quotelink.textContent.replace QuoteOP.text, ''
|
||||||
|
|
||||||
op = (if @isClone then @context else @).thread.fullID
|
{fullID} = (if @isClone then @context else @).thread
|
||||||
# add (OP) to quotes quoting this context's OP.
|
# add (OP) to quotes quoting this context's OP.
|
||||||
return unless quotes.contains op
|
return unless quotes.contains fullID
|
||||||
for quotelink in quotelinks
|
i = 0
|
||||||
|
while quotelink = quotelinks[i++]
|
||||||
{boardID, postID} = Get.postDataFromLink quotelink
|
{boardID, postID} = Get.postDataFromLink quotelink
|
||||||
if "#{boardID}.#{postID}" is op
|
if "#{boardID}.#{postID}" is fullID
|
||||||
$.add quotelink, $.tn QuoteOP.text
|
$.add quotelink, $.tn QuoteOP.text
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user