Fix classes
This commit is contained in:
parent
02fd87266e
commit
ba66d077cd
@ -3141,15 +3141,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Callbacks.prototype.execute = function(nodes) {
|
Callbacks.prototype.execute = function(nodes) {
|
||||||
var cb, err, errors, i, j, name, node;
|
var err, errors, name, node, _i, _j, _len, _len1, _ref;
|
||||||
i = 0;
|
_ref = this.keys;
|
||||||
while (name = this.keys[i++]) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
j = 0;
|
name = _ref[_i];
|
||||||
cb = this[name];
|
|
||||||
while (node = nodes[j++]) {
|
|
||||||
try {
|
try {
|
||||||
if (!cb.disconnected) {
|
for (_j = 0, _len1 = nodes.length; _j < _len1; _j++) {
|
||||||
cb.call(node);
|
node = nodes[_j];
|
||||||
|
this[name].call(node);
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
err = _error;
|
err = _error;
|
||||||
@ -3162,7 +3161,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
return Main.handleErrors(errors);
|
return Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
@ -3216,13 +3214,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Thread.prototype.setPage = function(pageNum) {
|
Thread.prototype.setPage = function(pageNum) {
|
||||||
var icon, key, _i, _len, _ref;
|
var icon, info, quote, _ref;
|
||||||
icon = $('.page-num', this.OP.nodes.info);
|
_ref = this.OP.nodes, info = _ref.info, quote = _ref.quote;
|
||||||
_ref = ['title', 'textContent'];
|
if (!(icon = $('.page-num', info))) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
icon = $.el('span', {
|
||||||
key = _ref[_i];
|
className: 'page-num'
|
||||||
icon[key] = icon[key].replace(/\d+/, pageNum);
|
});
|
||||||
|
$.after(quote, [$.tn(' '), icon]);
|
||||||
}
|
}
|
||||||
|
icon.title = "This thread is on page " + pageNum + " in the original index.";
|
||||||
|
icon.textContent = "[" + pageNum + "]";
|
||||||
if (this.catalogView) {
|
if (this.catalogView) {
|
||||||
return this.catalogView.nodes.pageCount.textContent = pageNum;
|
return this.catalogView.nodes.pageCount.textContent = pageNum;
|
||||||
}
|
}
|
||||||
@ -3239,7 +3240,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Thread.prototype.setStatus = function(type, status) {
|
Thread.prototype.setStatus = function(type, status) {
|
||||||
var name, typeLC;
|
var name;
|
||||||
name = "is" + type;
|
name = "is" + type;
|
||||||
if (this[name] === status) {
|
if (this[name] === status) {
|
||||||
return;
|
return;
|
||||||
@ -3248,7 +3249,6 @@
|
|||||||
if (!this.OP) {
|
if (!this.OP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
typeLC = type.toLowerCase();
|
|
||||||
this.setIcon('Sticky', this.isSticky);
|
this.setIcon('Sticky', this.isSticky);
|
||||||
this.setIcon('Closed', this.isClosed && !this.isArchived);
|
this.setIcon('Closed', this.isClosed && !this.isArchived);
|
||||||
return this.setIcon('Archived', this.isArchived);
|
return this.setIcon('Archived', this.isArchived);
|
||||||
@ -3275,7 +3275,7 @@
|
|||||||
title: type,
|
title: type,
|
||||||
className: "" + typeLC + "Icon retina"
|
className: "" + typeLC + "Icon retina"
|
||||||
});
|
});
|
||||||
root = type !== 'Sticky' && this.isSticky ? $('.stickyIcon', this.OP.nodes.info) : $('.page-num', this.OP.nodes.info) || $('[title="Reply to this post"]', this.OP.nodes.info);
|
root = type !== 'Sticky' && this.isSticky ? $('.stickyIcon', this.OP.nodes.info) : $('.page-num', this.OP.nodes.info) || this.OP.nodes.quote;
|
||||||
$.after(root, [$.tn(' '), icon]);
|
$.after(root, [$.tn(' '), icon]);
|
||||||
if (!this.catalogView) {
|
if (!this.catalogView) {
|
||||||
return;
|
return;
|
||||||
@ -3349,11 +3349,12 @@
|
|||||||
this.board = this.thread.board;
|
this.board = this.thread.board;
|
||||||
this.nodes = {
|
this.nodes = {
|
||||||
root: root,
|
root: root,
|
||||||
thumb: $('.thumb', root),
|
thumb: $('.catalog-thumb', root),
|
||||||
icons: $('.thread-icons', root),
|
icons: $('.catalog-icons', root),
|
||||||
postCount: $('.post-count', root),
|
postCount: $('.post-count', root),
|
||||||
fileCount: $('.file-count', root),
|
fileCount: $('.file-count', root),
|
||||||
pageCount: $('.page-count', root)
|
pageCount: $('.page-count', root),
|
||||||
|
comment: $('.comment', root)
|
||||||
};
|
};
|
||||||
this.thread.catalogView = this;
|
this.thread.catalogView = this;
|
||||||
}
|
}
|
||||||
@ -3378,17 +3379,18 @@
|
|||||||
}
|
}
|
||||||
this.ID = +root.id.slice(2);
|
this.ID = +root.id.slice(2);
|
||||||
this.fullID = "" + this.board + "." + this.ID;
|
this.fullID = "" + this.board + "." + this.ID;
|
||||||
post = $('.post', root);
|
|
||||||
info = $('.postInfo', post);
|
|
||||||
if (that.isOriginalMarkup) {
|
if (that.isOriginalMarkup) {
|
||||||
this.cleanup(root, post);
|
this.cleanup(root, post);
|
||||||
}
|
}
|
||||||
|
post = $('.post', root);
|
||||||
|
info = $('.postInfo', post);
|
||||||
root.dataset.fullID = this.fullID;
|
root.dataset.fullID = this.fullID;
|
||||||
this.nodes = {
|
this.nodes = {
|
||||||
root: root,
|
root: root,
|
||||||
post: post,
|
post: post,
|
||||||
info: info,
|
info: info,
|
||||||
nameBlock: $('.nameBlock', info),
|
nameBlock: $('.nameBlock', info),
|
||||||
|
quote: $('.postNum > a:nth-of-type(2)', info),
|
||||||
comment: $('.postMessage', post),
|
comment: $('.postMessage', post),
|
||||||
links: [],
|
links: [],
|
||||||
quotelinks: [],
|
quotelinks: [],
|
||||||
@ -3396,8 +3398,12 @@
|
|||||||
};
|
};
|
||||||
if (!(this.isReply = $.hasClass(post, 'reply'))) {
|
if (!(this.isReply = $.hasClass(post, 'reply'))) {
|
||||||
this.thread.OP = this;
|
this.thread.OP = this;
|
||||||
|
this.thread.isArchived = !!$('.archivedIcon', info);
|
||||||
this.thread.isSticky = !!$('.stickyIcon', info);
|
this.thread.isSticky = !!$('.stickyIcon', info);
|
||||||
this.thread.isClosed = !!$('.closedIcon', info);
|
this.thread.isClosed = this.thread.isArchived || !!$('.closedIcon', info);
|
||||||
|
if (this.thread.isArchived) {
|
||||||
|
this.thread.kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.info = {};
|
this.info = {};
|
||||||
this.info.nameBlock = Conf['Anonymize'] ? 'Anonymous' : this.nodes.nameBlock.textContent.trim();
|
this.info.nameBlock = Conf['Anonymize'] ? 'Anonymous' : this.nodes.nameBlock.textContent.trim();
|
||||||
@ -3448,27 +3454,45 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Post.prototype.parseComment = function() {
|
Post.prototype.parseComment = function() {
|
||||||
var bq, i, node, nodes, text;
|
var bq, i, node, nodes, spoilers;
|
||||||
this.nodes.comment.normalize();
|
this.nodes.comment.normalize();
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
nodes = $$('.abbr, .exif, b', bq);
|
nodes = $$('.abbr, .exif, b, marquee', bq);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (node = nodes[i++]) {
|
while (node = nodes[i++]) {
|
||||||
$.rm(node);
|
$.rm(node);
|
||||||
}
|
}
|
||||||
|
this.info.comment = this.nodesToText(bq);
|
||||||
|
spoilers = $$('s', bq);
|
||||||
|
return this.info.commentSpoilered = (function() {
|
||||||
|
var _i, _len;
|
||||||
|
if (spoilers.length) {
|
||||||
|
for (_i = 0, _len = spoilers.length; _i < _len; _i++) {
|
||||||
|
node = spoilers[_i];
|
||||||
|
$.replace(node, $.tn('[spoiler]'));
|
||||||
|
}
|
||||||
|
return this.nodesToText(bq);
|
||||||
|
} else {
|
||||||
|
return this.info.comment;
|
||||||
|
}
|
||||||
|
}).call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Post.prototype.nodesToText = function(bq) {
|
||||||
|
var i, node, nodes, text;
|
||||||
text = "";
|
text = "";
|
||||||
nodes = $.X('.//br|.//text()', bq);
|
nodes = $.X('.//br|.//text()', bq);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (node = nodes.snapshotItem(i++)) {
|
while (node = nodes.snapshotItem(i++)) {
|
||||||
text += node.data || '\n';
|
text += node.data || '\n';
|
||||||
}
|
}
|
||||||
return this.info.comment = text.trim().replace(/\s+$/gm, '');
|
return text.trim().replace(/\s+$/gm, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.parseQuotes = function() {
|
Post.prototype.parseQuotes = function() {
|
||||||
var quotelink, _i, _len, _ref;
|
var quotelink, _i, _len, _ref;
|
||||||
this.quotes = [];
|
this.quotes = [];
|
||||||
_ref = $$('.quotelink', this.nodes.comment);
|
_ref = $$(':not(pre) > .quotelink', this.nodes.comment);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quotelink = _ref[_i];
|
quotelink = _ref[_i];
|
||||||
this.parseQuote(quotelink);
|
this.parseQuote(quotelink);
|
||||||
@ -3477,7 +3501,7 @@
|
|||||||
|
|
||||||
Post.prototype.parseQuote = function(quotelink) {
|
Post.prototype.parseQuote = function(quotelink) {
|
||||||
var fullID, match;
|
var fullID, match;
|
||||||
if (!(match = quotelink.href.match(/boards\.4chan\.org\/([^\/]+)\/thread\/\d+.*\#p(\d+)$/))) {
|
if (!(match = quotelink.href.match(/boards\.4chan\.org\/([^\/]+)\/(?:res|thread)\/\d+(?:\/[^#]*)?#p(\d+)$/))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.nodes.quotelinks.push(quotelink);
|
this.nodes.quotelinks.push(quotelink);
|
||||||
@ -3511,30 +3535,26 @@
|
|||||||
size *= 1024;
|
size *= 1024;
|
||||||
}
|
}
|
||||||
this.file.sizeInBytes = size;
|
this.file.sizeInBytes = size;
|
||||||
this.file.thumbURL = that.isArchived ? thumb.src : "" + location.protocol + "//t.4cdn.org/" + this.board + "/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg";
|
this.file.thumbURL = "" + location.protocol + "//t.4cdn.org/" + this.board + "/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg";
|
||||||
this.file.isImage = /(jpg|png|gif)$/i.test(this.file.URL);
|
this.file.isImage = /(jpg|png|gif)$/i.test(this.file.URL);
|
||||||
this.file.isVideo = /webm$/i.test(this.file.URL);
|
this.file.isVideo = /webm$/i.test(this.file.URL);
|
||||||
|
nameNode = $('a', fileText);
|
||||||
if (this.file.isImage || this.file.isVideo) {
|
if (this.file.isImage || this.file.isVideo) {
|
||||||
this.file.dimensions = fileText.childNodes[2].data.match(/\d+x\d+/)[0];
|
this.file.dimensions = nameNode.nextSibling.textContent.match(/\d+x\d+/)[0];
|
||||||
}
|
}
|
||||||
return this.file.name = !this.file.isSpoiler && (nameNode = $('a', fileText)) ? nameNode.title || nameNode.textContent : fileText.title;
|
return this.file.name = fileText.title || nameNode.title || nameNode.textContent;
|
||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.cleanup = function(root, post) {
|
Post.prototype.cleanup = function(root) {
|
||||||
var node, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
|
var node, _i, _j, _len, _len1, _ref, _ref1;
|
||||||
_ref = $$('.mobile', root);
|
_ref = $$('.mobile', root);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
node = _ref[_i];
|
node = _ref[_i];
|
||||||
$.rm(node);
|
$.rm(node);
|
||||||
}
|
}
|
||||||
_ref1 = $$('[id]:not(.exif)', post);
|
_ref1 = $$('.desktop', root);
|
||||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||||
node = _ref1[_j];
|
node = _ref1[_j];
|
||||||
node.removeAttribute('id');
|
|
||||||
}
|
|
||||||
_ref2 = $$('.desktop', root);
|
|
||||||
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
|
||||||
node = _ref2[_k];
|
|
||||||
$.rmClass(node, 'desktop');
|
$.rmClass(node, 'desktop');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3606,9 +3626,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isHidden = false;
|
this.isHidden = false;
|
||||||
this.labels = this.labels.filter(function(label) {
|
|
||||||
return !/^(Manually hidden|Recursively hidden|Hidden by)/.test(label);
|
|
||||||
});
|
|
||||||
_ref = Get.allQuotelinksLinkingTo(this);
|
_ref = Get.allQuotelinksLinkingTo(this);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quotelink = _ref[_i];
|
quotelink = _ref[_i];
|
||||||
@ -3637,8 +3654,7 @@
|
|||||||
return delete this.nodes.stub;
|
return delete this.nodes.stub;
|
||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.highlight = function(label, highlight, top) {
|
Post.prototype.highlight = function(highlight, top) {
|
||||||
this.labels.push(label);
|
|
||||||
if (__indexOf.call(this.highlights, highlight) < 0) {
|
if (__indexOf.call(this.highlights, highlight) < 0) {
|
||||||
this.highlights.push(highlight);
|
this.highlights.push(highlight);
|
||||||
$.addClass(this.nodes.root, highlight);
|
$.addClass(this.nodes.root, highlight);
|
||||||
@ -3751,7 +3767,7 @@
|
|||||||
__extends(Clone, _super);
|
__extends(Clone, _super);
|
||||||
|
|
||||||
function Clone(origin, context, contractThumb) {
|
function Clone(origin, context, contractThumb) {
|
||||||
var file, info, inline, inlined, key, nodes, post, root, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
var file, info, inline, inlined, key, nodes, post, root, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3;
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
_ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
|
_ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
|
||||||
@ -3760,13 +3776,15 @@
|
|||||||
this[key] = origin[key];
|
this[key] = origin[key];
|
||||||
}
|
}
|
||||||
nodes = origin.nodes;
|
nodes = origin.nodes;
|
||||||
root = nodes.root.cloneNode(true);
|
root = contractThumb ? this.cloneWithoutVideo(nodes.root) : nodes.root.cloneNode(true);
|
||||||
post = $('.post', root);
|
post = $('.post', root);
|
||||||
info = $('.postInfo', post);
|
info = $('.postInfo', post);
|
||||||
this.nodes = {
|
this.nodes = {
|
||||||
root: root,
|
root: root,
|
||||||
post: post,
|
post: post,
|
||||||
info: info,
|
info: info,
|
||||||
|
nameBlock: $('.nameBlock', info),
|
||||||
|
quote: $('.postNum > a:nth-of-type(2)', info),
|
||||||
comment: $('.postMessage', post),
|
comment: $('.postMessage', post),
|
||||||
quotelinks: [],
|
quotelinks: [],
|
||||||
backlinks: info.getElementsByClassName('backlink')
|
backlinks: info.getElementsByClassName('backlink')
|
||||||
@ -3800,10 +3818,10 @@
|
|||||||
this.nodes.uniqueID = $('.posteruid', info);
|
this.nodes.uniqueID = $('.posteruid', info);
|
||||||
}
|
}
|
||||||
if (nodes.capcode) {
|
if (nodes.capcode) {
|
||||||
this.nodes.capcode = $('.capcode', info);
|
this.nodes.capcode = $('.capcode.hand', info);
|
||||||
}
|
}
|
||||||
if (nodes.flag) {
|
if (nodes.flag) {
|
||||||
this.nodes.flag = $('.countryFlag', info);
|
this.nodes.flag = $('.flag, .countryFlag', info);
|
||||||
}
|
}
|
||||||
if (nodes.date) {
|
if (nodes.date) {
|
||||||
this.nodes.date = $('.dateTime', info);
|
this.nodes.date = $('.dateTime', info);
|
||||||
@ -3818,18 +3836,11 @@
|
|||||||
}
|
}
|
||||||
file = $('.file', post);
|
file = $('.file', post);
|
||||||
this.file.text = file.firstElementChild;
|
this.file.text = file.firstElementChild;
|
||||||
this.file.thumb = $('img[data-md5], video[data-md5]', file);
|
this.file.thumb = $('.fileThumb > [data-md5]', file);
|
||||||
this.file.fullImage = $('.full-image', file);
|
this.file.fullImage = $('.full-image', file);
|
||||||
|
this.file.videoControls = $('.video-controls', this.file.text);
|
||||||
if (contractThumb) {
|
if (contractThumb) {
|
||||||
$.rmClass(root, 'expanded-image');
|
ImageExpand.contract(this);
|
||||||
$.rmClass(this.file.thumb, 'expanding');
|
|
||||||
}
|
|
||||||
this.file.isExpanded = $.hasClass(root, 'expanded-image');
|
|
||||||
if ((_ref4 = this.file.fullImage) != null) {
|
|
||||||
_ref4.removeAttribute('id');
|
|
||||||
}
|
|
||||||
if ((_ref5 = $('.video-controls', this.file.text)) != null) {
|
|
||||||
_ref5.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (origin.isDead) {
|
if (origin.isDead) {
|
||||||
@ -3839,6 +3850,23 @@
|
|||||||
root.dataset.clone = origin.clones.push(this) - 1;
|
root.dataset.clone = origin.clones.push(this) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clone.prototype.cloneWithoutVideo = function(node) {
|
||||||
|
var child, clone, _i, _len, _ref;
|
||||||
|
if (node.tagName === 'VIDEO' && !node.dataset.md5) {
|
||||||
|
return [];
|
||||||
|
} else if (node.nodeType === Node.ELEMENT_NODE && $('video', node)) {
|
||||||
|
clone = node.cloneNode(false);
|
||||||
|
_ref = node.childNodes;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
child = _ref[_i];
|
||||||
|
$.add(clone, this.cloneWithoutVideo(child));
|
||||||
|
}
|
||||||
|
return clone;
|
||||||
|
} else {
|
||||||
|
return node.cloneNode(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return Clone;
|
return Clone;
|
||||||
|
|
||||||
})(Post);
|
})(Post);
|
||||||
@ -4012,12 +4040,13 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
Notice = (function() {
|
Notice = (function() {
|
||||||
function Notice(type, content, timeout) {
|
function Notice(type, content, timeout, onclose) {
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
|
this.onclose = onclose;
|
||||||
this.close = __bind(this.close, this);
|
this.close = __bind(this.close, this);
|
||||||
this.add = __bind(this.add, this);
|
this.add = __bind(this.add, this);
|
||||||
this.el = $.el('div', {
|
this.el = $.el('div', {
|
||||||
innerHTML: '<a href=javascript:; class="close fa" title=Close>\uf00d</a><div class=message></div>'
|
innerHTML: "<a href=\"javascript:;\" class=\"close fa fa-times\" title=\"Close\"></a><div class=\"message\"></div>"
|
||||||
});
|
});
|
||||||
this.el.style.opacity = 0;
|
this.el.style.opacity = 0;
|
||||||
this.setType(type);
|
this.setType(type);
|
||||||
@ -4049,7 +4078,8 @@
|
|||||||
|
|
||||||
Notice.prototype.close = function() {
|
Notice.prototype.close = function() {
|
||||||
$.off(d, 'visibilitychange', this.add);
|
$.off(d, 'visibilitychange', this.add);
|
||||||
return $.rm(this.el);
|
$.rm(this.el);
|
||||||
|
return typeof this.onclose === "function" ? this.onclose() : void 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Notice;
|
return Notice;
|
||||||
@ -4089,7 +4119,7 @@
|
|||||||
|
|
||||||
RandomAccessList.prototype.before = function(root, item) {
|
RandomAccessList.prototype.before = function(root, item) {
|
||||||
var prev;
|
var prev;
|
||||||
if (item.next === root) {
|
if (item.next === root || item === root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.rmi(item);
|
this.rmi(item);
|
||||||
@ -4099,6 +4129,8 @@
|
|||||||
item.prev = prev;
|
item.prev = prev;
|
||||||
if (prev) {
|
if (prev) {
|
||||||
return prev.next = item;
|
return prev.next = item;
|
||||||
|
} else {
|
||||||
|
return this.first = item;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4114,6 +4146,8 @@
|
|||||||
item.next = next;
|
item.next = next;
|
||||||
if (next) {
|
if (next) {
|
||||||
return next.prev = item;
|
return next.prev = item;
|
||||||
|
} else {
|
||||||
|
return this.last = item;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4125,7 +4159,11 @@
|
|||||||
}
|
}
|
||||||
this.rmi(item);
|
this.rmi(item);
|
||||||
item.next = first;
|
item.next = first;
|
||||||
|
if (first) {
|
||||||
first.prev = item;
|
first.prev = item;
|
||||||
|
} else {
|
||||||
|
this.last = item;
|
||||||
|
}
|
||||||
this.first = item;
|
this.first = item;
|
||||||
return delete item.prev;
|
return delete item.prev;
|
||||||
};
|
};
|
||||||
@ -4279,7 +4317,28 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
Polyfill = {
|
Polyfill = {
|
||||||
init: function() {},
|
init: function() {
|
||||||
|
this.notificationPermission();
|
||||||
|
this.toBlob();
|
||||||
|
return this.visibility();
|
||||||
|
},
|
||||||
|
notificationPermission: function() {
|
||||||
|
if (!window.Notification || 'permission' in Notification || !window.webkitNotifications) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return Object.defineProperty(Notification, 'permission', {
|
||||||
|
get: function() {
|
||||||
|
switch (webkitNotifications.checkPermission()) {
|
||||||
|
case 0:
|
||||||
|
return 'granted';
|
||||||
|
case 1:
|
||||||
|
return 'default';
|
||||||
|
case 2:
|
||||||
|
return 'denied';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
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) {
|
||||||
@ -4294,6 +4353,26 @@
|
|||||||
type: 'image/png'
|
type: 'image/png'
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
visibility: function() {
|
||||||
|
if ('visibilityState' in d) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object.defineProperties(HTMLDocument.prototype, {
|
||||||
|
visibilityState: {
|
||||||
|
get: function() {
|
||||||
|
return this.webkitVisibilityState;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hidden: {
|
||||||
|
get: function() {
|
||||||
|
return this.webkitHidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $.on(d, 'webkitvisibilitychange', function() {
|
||||||
|
return $.event('visibilitychange');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -13442,7 +13521,7 @@
|
|||||||
MarkNewIPs.ipCount = this.ipCount;
|
MarkNewIPs.ipCount = this.ipCount;
|
||||||
MarkNewIPs.postIDs = (function() {
|
MarkNewIPs.postIDs = (function() {
|
||||||
var _i, _len, _ref, _results;
|
var _i, _len, _ref, _results;
|
||||||
_ref = this.post.keys;
|
_ref = this.posts.keys;
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
x = _ref[_i];
|
x = _ref[_i];
|
||||||
|
|||||||
@ -3167,15 +3167,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Callbacks.prototype.execute = function(nodes) {
|
Callbacks.prototype.execute = function(nodes) {
|
||||||
var cb, err, errors, i, j, name, node;
|
var err, errors, name, node, _i, _j, _len, _len1, _ref;
|
||||||
i = 0;
|
_ref = this.keys;
|
||||||
while (name = this.keys[i++]) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
j = 0;
|
name = _ref[_i];
|
||||||
cb = this[name];
|
|
||||||
while (node = nodes[j++]) {
|
|
||||||
try {
|
try {
|
||||||
if (!cb.disconnected) {
|
for (_j = 0, _len1 = nodes.length; _j < _len1; _j++) {
|
||||||
cb.call(node);
|
node = nodes[_j];
|
||||||
|
this[name].call(node);
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
err = _error;
|
err = _error;
|
||||||
@ -3188,7 +3187,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
return Main.handleErrors(errors);
|
return Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
@ -3242,13 +3240,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Thread.prototype.setPage = function(pageNum) {
|
Thread.prototype.setPage = function(pageNum) {
|
||||||
var icon, key, _i, _len, _ref;
|
var icon, info, quote, _ref;
|
||||||
icon = $('.page-num', this.OP.nodes.info);
|
_ref = this.OP.nodes, info = _ref.info, quote = _ref.quote;
|
||||||
_ref = ['title', 'textContent'];
|
if (!(icon = $('.page-num', info))) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
icon = $.el('span', {
|
||||||
key = _ref[_i];
|
className: 'page-num'
|
||||||
icon[key] = icon[key].replace(/\d+/, pageNum);
|
});
|
||||||
|
$.after(quote, [$.tn(' '), icon]);
|
||||||
}
|
}
|
||||||
|
icon.title = "This thread is on page " + pageNum + " in the original index.";
|
||||||
|
icon.textContent = "[" + pageNum + "]";
|
||||||
if (this.catalogView) {
|
if (this.catalogView) {
|
||||||
return this.catalogView.nodes.pageCount.textContent = pageNum;
|
return this.catalogView.nodes.pageCount.textContent = pageNum;
|
||||||
}
|
}
|
||||||
@ -3265,7 +3266,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Thread.prototype.setStatus = function(type, status) {
|
Thread.prototype.setStatus = function(type, status) {
|
||||||
var name, typeLC;
|
var name;
|
||||||
name = "is" + type;
|
name = "is" + type;
|
||||||
if (this[name] === status) {
|
if (this[name] === status) {
|
||||||
return;
|
return;
|
||||||
@ -3274,7 +3275,6 @@
|
|||||||
if (!this.OP) {
|
if (!this.OP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
typeLC = type.toLowerCase();
|
|
||||||
this.setIcon('Sticky', this.isSticky);
|
this.setIcon('Sticky', this.isSticky);
|
||||||
this.setIcon('Closed', this.isClosed && !this.isArchived);
|
this.setIcon('Closed', this.isClosed && !this.isArchived);
|
||||||
return this.setIcon('Archived', this.isArchived);
|
return this.setIcon('Archived', this.isArchived);
|
||||||
@ -3301,7 +3301,7 @@
|
|||||||
title: type,
|
title: type,
|
||||||
className: "" + typeLC + "Icon retina"
|
className: "" + typeLC + "Icon retina"
|
||||||
});
|
});
|
||||||
root = type !== 'Sticky' && this.isSticky ? $('.stickyIcon', this.OP.nodes.info) : $('.page-num', this.OP.nodes.info) || $('[title="Reply to this post"]', this.OP.nodes.info);
|
root = type !== 'Sticky' && this.isSticky ? $('.stickyIcon', this.OP.nodes.info) : $('.page-num', this.OP.nodes.info) || this.OP.nodes.quote;
|
||||||
$.after(root, [$.tn(' '), icon]);
|
$.after(root, [$.tn(' '), icon]);
|
||||||
if (!this.catalogView) {
|
if (!this.catalogView) {
|
||||||
return;
|
return;
|
||||||
@ -3375,11 +3375,12 @@
|
|||||||
this.board = this.thread.board;
|
this.board = this.thread.board;
|
||||||
this.nodes = {
|
this.nodes = {
|
||||||
root: root,
|
root: root,
|
||||||
thumb: $('.thumb', root),
|
thumb: $('.catalog-thumb', root),
|
||||||
icons: $('.thread-icons', root),
|
icons: $('.catalog-icons', root),
|
||||||
postCount: $('.post-count', root),
|
postCount: $('.post-count', root),
|
||||||
fileCount: $('.file-count', root),
|
fileCount: $('.file-count', root),
|
||||||
pageCount: $('.page-count', root)
|
pageCount: $('.page-count', root),
|
||||||
|
comment: $('.comment', root)
|
||||||
};
|
};
|
||||||
this.thread.catalogView = this;
|
this.thread.catalogView = this;
|
||||||
}
|
}
|
||||||
@ -3404,17 +3405,18 @@
|
|||||||
}
|
}
|
||||||
this.ID = +root.id.slice(2);
|
this.ID = +root.id.slice(2);
|
||||||
this.fullID = "" + this.board + "." + this.ID;
|
this.fullID = "" + this.board + "." + this.ID;
|
||||||
post = $('.post', root);
|
|
||||||
info = $('.postInfo', post);
|
|
||||||
if (that.isOriginalMarkup) {
|
if (that.isOriginalMarkup) {
|
||||||
this.cleanup(root, post);
|
this.cleanup(root, post);
|
||||||
}
|
}
|
||||||
|
post = $('.post', root);
|
||||||
|
info = $('.postInfo', post);
|
||||||
root.dataset.fullID = this.fullID;
|
root.dataset.fullID = this.fullID;
|
||||||
this.nodes = {
|
this.nodes = {
|
||||||
root: root,
|
root: root,
|
||||||
post: post,
|
post: post,
|
||||||
info: info,
|
info: info,
|
||||||
nameBlock: $('.nameBlock', info),
|
nameBlock: $('.nameBlock', info),
|
||||||
|
quote: $('.postNum > a:nth-of-type(2)', info),
|
||||||
comment: $('.postMessage', post),
|
comment: $('.postMessage', post),
|
||||||
links: [],
|
links: [],
|
||||||
quotelinks: [],
|
quotelinks: [],
|
||||||
@ -3422,8 +3424,12 @@
|
|||||||
};
|
};
|
||||||
if (!(this.isReply = $.hasClass(post, 'reply'))) {
|
if (!(this.isReply = $.hasClass(post, 'reply'))) {
|
||||||
this.thread.OP = this;
|
this.thread.OP = this;
|
||||||
|
this.thread.isArchived = !!$('.archivedIcon', info);
|
||||||
this.thread.isSticky = !!$('.stickyIcon', info);
|
this.thread.isSticky = !!$('.stickyIcon', info);
|
||||||
this.thread.isClosed = !!$('.closedIcon', info);
|
this.thread.isClosed = this.thread.isArchived || !!$('.closedIcon', info);
|
||||||
|
if (this.thread.isArchived) {
|
||||||
|
this.thread.kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.info = {};
|
this.info = {};
|
||||||
this.info.nameBlock = Conf['Anonymize'] ? 'Anonymous' : this.nodes.nameBlock.textContent.trim();
|
this.info.nameBlock = Conf['Anonymize'] ? 'Anonymous' : this.nodes.nameBlock.textContent.trim();
|
||||||
@ -3474,27 +3480,45 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Post.prototype.parseComment = function() {
|
Post.prototype.parseComment = function() {
|
||||||
var bq, i, node, nodes, text;
|
var bq, i, node, nodes, spoilers;
|
||||||
this.nodes.comment.normalize();
|
this.nodes.comment.normalize();
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
nodes = $$('.abbr, .exif, b', bq);
|
nodes = $$('.abbr, .exif, b, marquee', bq);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (node = nodes[i++]) {
|
while (node = nodes[i++]) {
|
||||||
$.rm(node);
|
$.rm(node);
|
||||||
}
|
}
|
||||||
|
this.info.comment = this.nodesToText(bq);
|
||||||
|
spoilers = $$('s', bq);
|
||||||
|
return this.info.commentSpoilered = (function() {
|
||||||
|
var _i, _len;
|
||||||
|
if (spoilers.length) {
|
||||||
|
for (_i = 0, _len = spoilers.length; _i < _len; _i++) {
|
||||||
|
node = spoilers[_i];
|
||||||
|
$.replace(node, $.tn('[spoiler]'));
|
||||||
|
}
|
||||||
|
return this.nodesToText(bq);
|
||||||
|
} else {
|
||||||
|
return this.info.comment;
|
||||||
|
}
|
||||||
|
}).call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
Post.prototype.nodesToText = function(bq) {
|
||||||
|
var i, node, nodes, text;
|
||||||
text = "";
|
text = "";
|
||||||
nodes = $.X('.//br|.//text()', bq);
|
nodes = $.X('.//br|.//text()', bq);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (node = nodes.snapshotItem(i++)) {
|
while (node = nodes.snapshotItem(i++)) {
|
||||||
text += node.data || '\n';
|
text += node.data || '\n';
|
||||||
}
|
}
|
||||||
return this.info.comment = text.trim().replace(/\s+$/gm, '');
|
return text.trim().replace(/\s+$/gm, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.parseQuotes = function() {
|
Post.prototype.parseQuotes = function() {
|
||||||
var quotelink, _i, _len, _ref;
|
var quotelink, _i, _len, _ref;
|
||||||
this.quotes = [];
|
this.quotes = [];
|
||||||
_ref = $$('.quotelink', this.nodes.comment);
|
_ref = $$(':not(pre) > .quotelink', this.nodes.comment);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quotelink = _ref[_i];
|
quotelink = _ref[_i];
|
||||||
this.parseQuote(quotelink);
|
this.parseQuote(quotelink);
|
||||||
@ -3503,7 +3527,7 @@
|
|||||||
|
|
||||||
Post.prototype.parseQuote = function(quotelink) {
|
Post.prototype.parseQuote = function(quotelink) {
|
||||||
var fullID, match;
|
var fullID, match;
|
||||||
if (!(match = quotelink.href.match(/boards\.4chan\.org\/([^\/]+)\/thread\/\d+.*\#p(\d+)$/))) {
|
if (!(match = quotelink.href.match(/boards\.4chan\.org\/([^\/]+)\/(?:res|thread)\/\d+(?:\/[^#]*)?#p(\d+)$/))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.nodes.quotelinks.push(quotelink);
|
this.nodes.quotelinks.push(quotelink);
|
||||||
@ -3517,7 +3541,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.parseFile = function(that) {
|
Post.prototype.parseFile = function(that) {
|
||||||
var anchor, fileEl, fileText, nameNode, size, thumb, unit, _ref;
|
var anchor, fileEl, fileText, nameNode, size, thumb, unit;
|
||||||
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
|
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3537,31 +3561,26 @@
|
|||||||
size *= 1024;
|
size *= 1024;
|
||||||
}
|
}
|
||||||
this.file.sizeInBytes = size;
|
this.file.sizeInBytes = size;
|
||||||
this.file.thumbURL = that.isArchived ? thumb.src : "" + location.protocol + "//t.4cdn.org/" + this.board + "/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg";
|
this.file.thumbURL = "" + location.protocol + "//t.4cdn.org/" + this.board + "/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg";
|
||||||
this.file.isImage = /(jpg|png|gif)$/i.test(this.file.URL);
|
this.file.isImage = /(jpg|png|gif)$/i.test(this.file.URL);
|
||||||
this.file.isVideo = /webm$/i.test(this.file.URL);
|
this.file.isVideo = /webm$/i.test(this.file.URL);
|
||||||
|
nameNode = $('a', fileText);
|
||||||
if (this.file.isImage || this.file.isVideo) {
|
if (this.file.isImage || this.file.isVideo) {
|
||||||
this.file.dimensions = fileText.childNodes[2].data.match(/\d+x\d+/)[0];
|
this.file.dimensions = nameNode.nextSibling.textContent.match(/\d+x\d+/)[0];
|
||||||
}
|
}
|
||||||
this.file.name = !this.file.isSpoiler && (nameNode = $('a', fileText)) ? nameNode.title || nameNode.textContent : fileText.title;
|
return this.file.name = fileText.title || nameNode.title || nameNode.textContent;
|
||||||
return this.file.name = (_ref = this.file.name) != null ? _ref.replace(/%22/g, '"') : void 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.cleanup = function(root, post) {
|
Post.prototype.cleanup = function(root) {
|
||||||
var node, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
|
var node, _i, _j, _len, _len1, _ref, _ref1;
|
||||||
_ref = $$('.mobile', root);
|
_ref = $$('.mobile', root);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
node = _ref[_i];
|
node = _ref[_i];
|
||||||
$.rm(node);
|
$.rm(node);
|
||||||
}
|
}
|
||||||
_ref1 = $$('[id]:not(.exif)', post);
|
_ref1 = $$('.desktop', root);
|
||||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||||
node = _ref1[_j];
|
node = _ref1[_j];
|
||||||
node.removeAttribute('id');
|
|
||||||
}
|
|
||||||
_ref2 = $$('.desktop', root);
|
|
||||||
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
|
||||||
node = _ref2[_k];
|
|
||||||
$.rmClass(node, 'desktop');
|
$.rmClass(node, 'desktop');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3633,9 +3652,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isHidden = false;
|
this.isHidden = false;
|
||||||
this.labels = this.labels.filter(function(label) {
|
|
||||||
return !/^(Manually hidden|Recursively hidden|Hidden by)/.test(label);
|
|
||||||
});
|
|
||||||
_ref = Get.allQuotelinksLinkingTo(this);
|
_ref = Get.allQuotelinksLinkingTo(this);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quotelink = _ref[_i];
|
quotelink = _ref[_i];
|
||||||
@ -3664,8 +3680,7 @@
|
|||||||
return delete this.nodes.stub;
|
return delete this.nodes.stub;
|
||||||
};
|
};
|
||||||
|
|
||||||
Post.prototype.highlight = function(label, highlight, top) {
|
Post.prototype.highlight = function(highlight, top) {
|
||||||
this.labels.push(label);
|
|
||||||
if (__indexOf.call(this.highlights, highlight) < 0) {
|
if (__indexOf.call(this.highlights, highlight) < 0) {
|
||||||
this.highlights.push(highlight);
|
this.highlights.push(highlight);
|
||||||
$.addClass(this.nodes.root, highlight);
|
$.addClass(this.nodes.root, highlight);
|
||||||
@ -3778,7 +3793,7 @@
|
|||||||
__extends(Clone, _super);
|
__extends(Clone, _super);
|
||||||
|
|
||||||
function Clone(origin, context, contractThumb) {
|
function Clone(origin, context, contractThumb) {
|
||||||
var file, info, inline, inlined, key, nodes, post, root, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
var file, info, inline, inlined, key, nodes, post, root, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3;
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
_ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
|
_ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
|
||||||
@ -3787,13 +3802,15 @@
|
|||||||
this[key] = origin[key];
|
this[key] = origin[key];
|
||||||
}
|
}
|
||||||
nodes = origin.nodes;
|
nodes = origin.nodes;
|
||||||
root = nodes.root.cloneNode(true);
|
root = contractThumb ? this.cloneWithoutVideo(nodes.root) : nodes.root.cloneNode(true);
|
||||||
post = $('.post', root);
|
post = $('.post', root);
|
||||||
info = $('.postInfo', post);
|
info = $('.postInfo', post);
|
||||||
this.nodes = {
|
this.nodes = {
|
||||||
root: root,
|
root: root,
|
||||||
post: post,
|
post: post,
|
||||||
info: info,
|
info: info,
|
||||||
|
nameBlock: $('.nameBlock', info),
|
||||||
|
quote: $('.postNum > a:nth-of-type(2)', info),
|
||||||
comment: $('.postMessage', post),
|
comment: $('.postMessage', post),
|
||||||
quotelinks: [],
|
quotelinks: [],
|
||||||
backlinks: info.getElementsByClassName('backlink')
|
backlinks: info.getElementsByClassName('backlink')
|
||||||
@ -3827,10 +3844,10 @@
|
|||||||
this.nodes.uniqueID = $('.posteruid', info);
|
this.nodes.uniqueID = $('.posteruid', info);
|
||||||
}
|
}
|
||||||
if (nodes.capcode) {
|
if (nodes.capcode) {
|
||||||
this.nodes.capcode = $('.capcode', info);
|
this.nodes.capcode = $('.capcode.hand', info);
|
||||||
}
|
}
|
||||||
if (nodes.flag) {
|
if (nodes.flag) {
|
||||||
this.nodes.flag = $('.countryFlag', info);
|
this.nodes.flag = $('.flag, .countryFlag', info);
|
||||||
}
|
}
|
||||||
if (nodes.date) {
|
if (nodes.date) {
|
||||||
this.nodes.date = $('.dateTime', info);
|
this.nodes.date = $('.dateTime', info);
|
||||||
@ -3845,18 +3862,11 @@
|
|||||||
}
|
}
|
||||||
file = $('.file', post);
|
file = $('.file', post);
|
||||||
this.file.text = file.firstElementChild;
|
this.file.text = file.firstElementChild;
|
||||||
this.file.thumb = $('img[data-md5], video[data-md5]', file);
|
this.file.thumb = $('.fileThumb > [data-md5]', file);
|
||||||
this.file.fullImage = $('.full-image', file);
|
this.file.fullImage = $('.full-image', file);
|
||||||
|
this.file.videoControls = $('.video-controls', this.file.text);
|
||||||
if (contractThumb) {
|
if (contractThumb) {
|
||||||
$.rmClass(root, 'expanded-image');
|
ImageExpand.contract(this);
|
||||||
$.rmClass(this.file.thumb, 'expanding');
|
|
||||||
}
|
|
||||||
this.file.isExpanded = $.hasClass(root, 'expanded-image');
|
|
||||||
if ((_ref4 = this.file.fullImage) != null) {
|
|
||||||
_ref4.removeAttribute('id');
|
|
||||||
}
|
|
||||||
if ((_ref5 = $('.video-controls', this.file.text)) != null) {
|
|
||||||
_ref5.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (origin.isDead) {
|
if (origin.isDead) {
|
||||||
@ -3866,6 +3876,23 @@
|
|||||||
root.dataset.clone = origin.clones.push(this) - 1;
|
root.dataset.clone = origin.clones.push(this) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clone.prototype.cloneWithoutVideo = function(node) {
|
||||||
|
var child, clone, _i, _len, _ref;
|
||||||
|
if (node.tagName === 'VIDEO' && !node.dataset.md5) {
|
||||||
|
return [];
|
||||||
|
} else if (node.nodeType === Node.ELEMENT_NODE && $('video', node)) {
|
||||||
|
clone = node.cloneNode(false);
|
||||||
|
_ref = node.childNodes;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
child = _ref[_i];
|
||||||
|
$.add(clone, this.cloneWithoutVideo(child));
|
||||||
|
}
|
||||||
|
return clone;
|
||||||
|
} else {
|
||||||
|
return node.cloneNode(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return Clone;
|
return Clone;
|
||||||
|
|
||||||
})(Post);
|
})(Post);
|
||||||
@ -4039,12 +4066,13 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
Notice = (function() {
|
Notice = (function() {
|
||||||
function Notice(type, content, timeout) {
|
function Notice(type, content, timeout, onclose) {
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
|
this.onclose = onclose;
|
||||||
this.close = __bind(this.close, this);
|
this.close = __bind(this.close, this);
|
||||||
this.add = __bind(this.add, this);
|
this.add = __bind(this.add, this);
|
||||||
this.el = $.el('div', {
|
this.el = $.el('div', {
|
||||||
innerHTML: '<a href=javascript:; class="close fa" title=Close>\uf00d</a><div class=message></div>'
|
innerHTML: "<a href=\"javascript:;\" class=\"close fa fa-times\" title=\"Close\"></a><div class=\"message\"></div>"
|
||||||
});
|
});
|
||||||
this.el.style.opacity = 0;
|
this.el.style.opacity = 0;
|
||||||
this.setType(type);
|
this.setType(type);
|
||||||
@ -4076,7 +4104,8 @@
|
|||||||
|
|
||||||
Notice.prototype.close = function() {
|
Notice.prototype.close = function() {
|
||||||
$.off(d, 'visibilitychange', this.add);
|
$.off(d, 'visibilitychange', this.add);
|
||||||
return $.rm(this.el);
|
$.rm(this.el);
|
||||||
|
return typeof this.onclose === "function" ? this.onclose() : void 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Notice;
|
return Notice;
|
||||||
@ -4116,7 +4145,7 @@
|
|||||||
|
|
||||||
RandomAccessList.prototype.before = function(root, item) {
|
RandomAccessList.prototype.before = function(root, item) {
|
||||||
var prev;
|
var prev;
|
||||||
if (item.next === root) {
|
if (item.next === root || item === root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.rmi(item);
|
this.rmi(item);
|
||||||
@ -4126,6 +4155,8 @@
|
|||||||
item.prev = prev;
|
item.prev = prev;
|
||||||
if (prev) {
|
if (prev) {
|
||||||
return prev.next = item;
|
return prev.next = item;
|
||||||
|
} else {
|
||||||
|
return this.first = item;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4141,6 +4172,8 @@
|
|||||||
item.next = next;
|
item.next = next;
|
||||||
if (next) {
|
if (next) {
|
||||||
return next.prev = item;
|
return next.prev = item;
|
||||||
|
} else {
|
||||||
|
return this.last = item;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4152,7 +4185,11 @@
|
|||||||
}
|
}
|
||||||
this.rmi(item);
|
this.rmi(item);
|
||||||
item.next = first;
|
item.next = first;
|
||||||
|
if (first) {
|
||||||
first.prev = item;
|
first.prev = item;
|
||||||
|
} else {
|
||||||
|
this.last = item;
|
||||||
|
}
|
||||||
this.first = item;
|
this.first = item;
|
||||||
return delete item.prev;
|
return delete item.prev;
|
||||||
};
|
};
|
||||||
@ -4307,7 +4344,26 @@
|
|||||||
|
|
||||||
Polyfill = {
|
Polyfill = {
|
||||||
init: function() {
|
init: function() {
|
||||||
return this.toBlob();
|
this.notificationPermission();
|
||||||
|
this.toBlob();
|
||||||
|
return this.visibility();
|
||||||
|
},
|
||||||
|
notificationPermission: function() {
|
||||||
|
if (!window.Notification || 'permission' in Notification || !window.webkitNotifications) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return Object.defineProperty(Notification, 'permission', {
|
||||||
|
get: function() {
|
||||||
|
switch (webkitNotifications.checkPermission()) {
|
||||||
|
case 0:
|
||||||
|
return 'granted';
|
||||||
|
case 1:
|
||||||
|
return 'default';
|
||||||
|
case 2:
|
||||||
|
return 'denied';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
toBlob: function() {
|
toBlob: function() {
|
||||||
var _base;
|
var _base;
|
||||||
@ -4323,6 +4379,26 @@
|
|||||||
type: 'image/png'
|
type: 'image/png'
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
visibility: function() {
|
||||||
|
if ('visibilityState' in d) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object.defineProperties(HTMLDocument.prototype, {
|
||||||
|
visibilityState: {
|
||||||
|
get: function() {
|
||||||
|
return this.webkitVisibilityState;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hidden: {
|
||||||
|
get: function() {
|
||||||
|
return this.webkitHidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $.on(d, 'webkitvisibilitychange', function() {
|
||||||
|
return $.event('visibilitychange');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -13469,7 +13545,7 @@
|
|||||||
MarkNewIPs.ipCount = this.ipCount;
|
MarkNewIPs.ipCount = this.ipCount;
|
||||||
MarkNewIPs.postIDs = (function() {
|
MarkNewIPs.postIDs = (function() {
|
||||||
var _i, _len, _ref, _results;
|
var _i, _len, _ref, _results;
|
||||||
_ref = this.post.keys;
|
_ref = this.posts.keys;
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
x = _ref[_i];
|
x = _ref[_i];
|
||||||
|
|||||||
@ -11,21 +11,13 @@ class Callbacks
|
|||||||
disconnect: (name) -> @[name].disconnected = true if @[name]
|
disconnect: (name) -> @[name].disconnected = true if @[name]
|
||||||
|
|
||||||
execute: (nodes) ->
|
execute: (nodes) ->
|
||||||
i = 0
|
for name in @keys
|
||||||
# c.time 'Features'
|
|
||||||
while name = @keys[i++]
|
|
||||||
j = 0
|
|
||||||
cb = @[name]
|
|
||||||
# c.time name
|
|
||||||
while node = nodes[j++]
|
|
||||||
try
|
try
|
||||||
cb.call node unless cb.disconnected
|
@[name].call node for node in nodes
|
||||||
catch err
|
catch err
|
||||||
errors = [] unless errors
|
errors = [] unless errors
|
||||||
errors.push
|
errors.push
|
||||||
message: ['"', name, '" crashed on node ', @type, ' No.', node.ID, ' (', node.board, ').'].join('')
|
message: ['"', name, '" crashed on node ', @type, ' No.', node.ID, ' (', node.board, ').'].join('')
|
||||||
error: err
|
error: err
|
||||||
# c.timeEnd name
|
|
||||||
# c.timeEnd 'Features'
|
|
||||||
|
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
|
|||||||
@ -7,9 +7,10 @@ class CatalogThread
|
|||||||
@board = @thread.board
|
@board = @thread.board
|
||||||
@nodes =
|
@nodes =
|
||||||
root: root
|
root: root
|
||||||
thumb: $ '.thumb', root
|
thumb: $ '.catalog-thumb', root
|
||||||
icons: $ '.thread-icons', root
|
icons: $ '.catalog-icons', root
|
||||||
postCount: $ '.post-count', root
|
postCount: $ '.post-count', root
|
||||||
fileCount: $ '.file-count', root
|
fileCount: $ '.file-count', root
|
||||||
pageCount: $ '.page-count', root
|
pageCount: $ '.page-count', root
|
||||||
|
comment: $ '.comment', root
|
||||||
@thread.catalogView = @
|
@thread.catalogView = @
|
||||||
|
|||||||
@ -5,13 +5,18 @@ class Clone extends Post
|
|||||||
@[key] = origin[key]
|
@[key] = origin[key]
|
||||||
|
|
||||||
{nodes} = origin
|
{nodes} = origin
|
||||||
root = nodes.root.cloneNode true
|
root = if contractThumb
|
||||||
|
@cloneWithoutVideo nodes.root
|
||||||
|
else
|
||||||
|
nodes.root.cloneNode true
|
||||||
post = $ '.post', root
|
post = $ '.post', root
|
||||||
info = $ '.postInfo', post
|
info = $ '.postInfo', post
|
||||||
@nodes =
|
@nodes =
|
||||||
root: root
|
root: root
|
||||||
post: post
|
post: post
|
||||||
info: info
|
info: info
|
||||||
|
nameBlock: $ '.nameBlock', info
|
||||||
|
quote: $ '.postNum > a:nth-of-type(2)', info
|
||||||
comment: $ '.postMessage', post
|
comment: $ '.postMessage', post
|
||||||
quotelinks: []
|
quotelinks: []
|
||||||
backlinks: info.getElementsByClassName 'backlink'
|
backlinks: info.getElementsByClassName 'backlink'
|
||||||
@ -37,9 +42,9 @@ class Clone extends Post
|
|||||||
if nodes.uniqueID
|
if nodes.uniqueID
|
||||||
@nodes.uniqueID = $ '.posteruid', info
|
@nodes.uniqueID = $ '.posteruid', info
|
||||||
if nodes.capcode
|
if nodes.capcode
|
||||||
@nodes.capcode = $ '.capcode', info
|
@nodes.capcode = $ '.capcode.hand', info
|
||||||
if nodes.flag
|
if nodes.flag
|
||||||
@nodes.flag = $ '.countryFlag', info
|
@nodes.flag = $ '.flag, .countryFlag', info
|
||||||
if nodes.date
|
if nodes.date
|
||||||
@nodes.date = $ '.dateTime', info
|
@nodes.date = $ '.dateTime', info
|
||||||
|
|
||||||
@ -53,21 +58,23 @@ class Clone extends Post
|
|||||||
@file[key] = val
|
@file[key] = val
|
||||||
file = $ '.file', post
|
file = $ '.file', post
|
||||||
@file.text = file.firstElementChild
|
@file.text = file.firstElementChild
|
||||||
@file.thumb = $ 'img[data-md5], video[data-md5]', file
|
@file.thumb = $ '.fileThumb > [data-md5]', file
|
||||||
@file.fullImage = $ '.full-image', file
|
@file.fullImage = $ '.full-image', file
|
||||||
|
@file.videoControls = $ '.video-controls', @file.text
|
||||||
|
|
||||||
# Contract thumbnails in quote preview
|
# Contract thumbnails in quote preview
|
||||||
if contractThumb
|
ImageExpand.contract @ if contractThumb
|
||||||
$.rmClass root, 'expanded-image'
|
|
||||||
$.rmClass @file.thumb, 'expanding'
|
|
||||||
@file.isExpanded = $.hasClass root, 'expanded-image'
|
|
||||||
|
|
||||||
# Remove any #ihover ID
|
|
||||||
@file.fullImage?.removeAttribute 'id'
|
|
||||||
|
|
||||||
# Remove video controls.
|
|
||||||
($ '.video-controls', @file.text)?.remove()
|
|
||||||
|
|
||||||
@isDead = true if origin.isDead
|
@isDead = true if origin.isDead
|
||||||
@isClone = true
|
@isClone = true
|
||||||
root.dataset.clone = origin.clones.push(@) - 1
|
root.dataset.clone = origin.clones.push(@) - 1
|
||||||
|
|
||||||
|
cloneWithoutVideo: (node) ->
|
||||||
|
if node.tagName is 'VIDEO' and !node.dataset.md5 # (exception for WebM thumbnails)
|
||||||
|
[]
|
||||||
|
else if node.nodeType is Node.ELEMENT_NODE and $ 'video', node
|
||||||
|
clone = node.cloneNode false
|
||||||
|
$.add clone, @cloneWithoutVideo child for child in node.childNodes
|
||||||
|
clone
|
||||||
|
else
|
||||||
|
node.cloneNode true
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
class Notice
|
class Notice
|
||||||
constructor: (type, content, @timeout) ->
|
constructor: (type, content, @timeout, @onclose) ->
|
||||||
@el = $.el 'div',
|
@el = $.el 'div',
|
||||||
innerHTML: '<a href=javascript:; class="close fa" title=Close>\uf00d</a><div class=message></div>'
|
<%= html('<a href="javascript:;" class="close fa fa-times" title="Close"></a><div class="message"></div>') %>
|
||||||
@el.style.opacity = 0
|
@el.style.opacity = 0
|
||||||
@setType type
|
@setType type
|
||||||
$.on @el.firstElementChild, 'click', @close
|
$.on @el.firstElementChild, 'click', @close
|
||||||
@ -27,3 +27,4 @@ class Notice
|
|||||||
close: =>
|
close: =>
|
||||||
$.off d, 'visibilitychange', @add
|
$.off d, 'visibilitychange', @add
|
||||||
$.rm @el
|
$.rm @el
|
||||||
|
@onclose?()
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
Polyfill =
|
Polyfill =
|
||||||
init: ->
|
init: ->
|
||||||
<% if (type === 'crx') { %>
|
@notificationPermission()
|
||||||
@toBlob()
|
@toBlob()
|
||||||
<% } %>
|
@visibility()
|
||||||
|
notificationPermission: ->
|
||||||
|
return if !window.Notification or 'permission' of Notification or !window.webkitNotifications
|
||||||
|
Object.defineProperty Notification, 'permission',
|
||||||
|
get: ->
|
||||||
|
switch webkitNotifications.checkPermission()
|
||||||
|
when 0
|
||||||
|
'granted'
|
||||||
|
when 1
|
||||||
|
'default'
|
||||||
|
when 2
|
||||||
|
'denied'
|
||||||
toBlob: ->
|
toBlob: ->
|
||||||
HTMLCanvasElement::toBlob or= (cb) ->
|
HTMLCanvasElement::toBlob or= (cb) ->
|
||||||
data = atob @toDataURL()[22..]
|
data = atob @toDataURL()[22..]
|
||||||
@ -12,3 +23,12 @@ Polyfill =
|
|||||||
for i in [0...l] by 1
|
for i in [0...l] by 1
|
||||||
ui8a[i] = data.charCodeAt i
|
ui8a[i] = data.charCodeAt i
|
||||||
cb new Blob [ui8a], type: 'image/png'
|
cb new Blob [ui8a], type: 'image/png'
|
||||||
|
visibility: ->
|
||||||
|
# page visibility API
|
||||||
|
return if 'visibilityState' of d
|
||||||
|
Object.defineProperties HTMLDocument.prototype,
|
||||||
|
visibilityState:
|
||||||
|
get: -> @webkitVisibilityState
|
||||||
|
hidden:
|
||||||
|
get: -> @webkitHidden
|
||||||
|
$.on d, 'webkitvisibilitychange', -> $.event 'visibilitychange'
|
||||||
|
|||||||
@ -6,15 +6,16 @@ class Post
|
|||||||
@ID = +root.id[2..]
|
@ID = +root.id[2..]
|
||||||
@fullID = "#{@board}.#{@ID}"
|
@fullID = "#{@board}.#{@ID}"
|
||||||
|
|
||||||
|
@cleanup root, post if that.isOriginalMarkup
|
||||||
post = $ '.post', root
|
post = $ '.post', root
|
||||||
info = $ '.postInfo', post
|
info = $ '.postInfo', post
|
||||||
@cleanup root, post if that.isOriginalMarkup
|
|
||||||
root.dataset.fullID = @fullID
|
root.dataset.fullID = @fullID
|
||||||
@nodes =
|
@nodes =
|
||||||
root: root
|
root: root
|
||||||
post: post
|
post: post
|
||||||
info: info
|
info: info
|
||||||
nameBlock: $ '.nameBlock', info
|
nameBlock: $ '.nameBlock', info
|
||||||
|
quote: $ '.postNum > a:nth-of-type(2)', info
|
||||||
comment: $ '.postMessage', post
|
comment: $ '.postMessage', post
|
||||||
links: []
|
links: []
|
||||||
quotelinks: []
|
quotelinks: []
|
||||||
@ -22,8 +23,10 @@ class Post
|
|||||||
|
|
||||||
unless @isReply = $.hasClass post, 'reply'
|
unless @isReply = $.hasClass post, 'reply'
|
||||||
@thread.OP = @
|
@thread.OP = @
|
||||||
|
@thread.isArchived = !!$ '.archivedIcon', info
|
||||||
@thread.isSticky = !!$ '.stickyIcon', info
|
@thread.isSticky = !!$ '.stickyIcon', info
|
||||||
@thread.isClosed = !!$ '.closedIcon', info
|
@thread.isClosed = @thread.isArchived or !!$ '.closedIcon', info
|
||||||
|
@thread.kill() if @thread.isArchived
|
||||||
|
|
||||||
@info = {}
|
@info = {}
|
||||||
@info.nameBlock = if Conf['Anonymize']
|
@info.nameBlock = if Conf['Anonymize']
|
||||||
@ -71,28 +74,44 @@ class Post
|
|||||||
parseComment: ->
|
parseComment: ->
|
||||||
# Merge text nodes and remove empty ones.
|
# Merge text nodes and remove empty ones.
|
||||||
@nodes.comment.normalize()
|
@nodes.comment.normalize()
|
||||||
|
|
||||||
# Get the comment's text.
|
# Get the comment's text.
|
||||||
# <br> -> \n
|
# <br> -> \n
|
||||||
# Remove:
|
# Remove:
|
||||||
|
# 'Comment too long'...
|
||||||
# EXIF data. (/p/)
|
# EXIF data. (/p/)
|
||||||
# Rolls. (/tg/)
|
# Rolls. (/tg/)
|
||||||
|
# Marquees. (/pol/)
|
||||||
# Preceding and following new lines.
|
# Preceding and following new lines.
|
||||||
# Trailing spaces.
|
# Trailing spaces.
|
||||||
bq = @nodes.comment.cloneNode true
|
bq = @nodes.comment.cloneNode true
|
||||||
nodes = $$ '.abbr, .exif, b', bq
|
nodes = $$ '.abbr, .exif, b, marquee', bq
|
||||||
i = 0
|
i = 0
|
||||||
while node = nodes[i++]
|
$.rm node while node = nodes[i++]
|
||||||
$.rm node
|
@info.comment = @nodesToText bq
|
||||||
|
|
||||||
|
# Get the comment's text with spoilers hidden.
|
||||||
|
spoilers = $$ 's', bq
|
||||||
|
@info.commentSpoilered = if spoilers.length
|
||||||
|
for node in spoilers
|
||||||
|
$.replace node, $.tn '[spoiler]'
|
||||||
|
@nodesToText bq
|
||||||
|
else
|
||||||
|
@info.comment
|
||||||
|
|
||||||
|
nodesToText: (bq) ->
|
||||||
text = ""
|
text = ""
|
||||||
nodes = $.X './/br|.//text()', bq
|
nodes = $.X './/br|.//text()', bq
|
||||||
i = 0
|
i = 0
|
||||||
while node = nodes.snapshotItem i++
|
while node = nodes.snapshotItem i++
|
||||||
text += node.data or '\n'
|
text += node.data or '\n'
|
||||||
@info.comment = text.trim().replace /\s+$/gm, ''
|
text.trim().replace /\s+$/gm, ''
|
||||||
|
|
||||||
parseQuotes: ->
|
parseQuotes: ->
|
||||||
@quotes = []
|
@quotes = []
|
||||||
for quotelink in $$ '.quotelink', @nodes.comment
|
# XXX https://github.com/4chan/4chan-JS/issues/77
|
||||||
|
# 4chan currently creates quote links inside [code] tags; ignore them
|
||||||
|
for quotelink in $$ ':not(pre) > .quotelink', @nodes.comment
|
||||||
@parseQuote quotelink
|
@parseQuote quotelink
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -106,9 +125,8 @@ class Post
|
|||||||
return unless match = quotelink.href.match ///
|
return unless match = quotelink.href.match ///
|
||||||
boards\.4chan\.org/
|
boards\.4chan\.org/
|
||||||
([^/]+) # boardID
|
([^/]+) # boardID
|
||||||
/thread/\d+
|
/(?:res|thread)/\d+(?:\/[^#]*)?#p
|
||||||
.* # thread slug
|
(\d+) # postID
|
||||||
\#p(\d+) # postID
|
|
||||||
$
|
$
|
||||||
///
|
///
|
||||||
|
|
||||||
@ -122,7 +140,7 @@ class Post
|
|||||||
|
|
||||||
parseFile: (that) ->
|
parseFile: (that) ->
|
||||||
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
|
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
|
||||||
# Supports JPG/PNG/GIF/WEBM/PDF.
|
# Supports JPG/PNG/GIF/PDF.
|
||||||
# Flash files are not supported.
|
# Flash files are not supported.
|
||||||
anchor = thumb.parentNode
|
anchor = thumb.parentNode
|
||||||
fileText = fileEl.firstElementChild
|
fileText = fileEl.firstElementChild
|
||||||
@ -137,32 +155,17 @@ class Post
|
|||||||
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
||||||
size *= 1024 while unit-- > 0
|
size *= 1024 while unit-- > 0
|
||||||
@file.sizeInBytes = size
|
@file.sizeInBytes = size
|
||||||
@file.thumbURL = if that.isArchived
|
@file.thumbURL = "#{location.protocol}//t.4cdn.org/#{@board}/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
|
||||||
thumb.src
|
|
||||||
else
|
|
||||||
"#{location.protocol}//t.4cdn.org/#{@board}/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
|
|
||||||
@file.isImage = /(jpg|png|gif)$/i.test @file.URL
|
@file.isImage = /(jpg|png|gif)$/i.test @file.URL
|
||||||
@file.isVideo = /webm$/i.test @file.URL
|
@file.isVideo = /webm$/i.test @file.URL
|
||||||
|
nameNode = $ 'a', fileText
|
||||||
if @file.isImage or @file.isVideo
|
if @file.isImage or @file.isVideo
|
||||||
@file.dimensions = fileText.childNodes[2].data.match(/\d+x\d+/)[0]
|
@file.dimensions = nameNode.nextSibling.textContent.match(/\d+x\d+/)[0]
|
||||||
@file.name = if !@file.isSpoiler and nameNode = $ 'a', fileText
|
@file.name = fileText.title or nameNode.title or nameNode.textContent
|
||||||
nameNode.title or nameNode.textContent
|
|
||||||
else
|
|
||||||
fileText.title
|
|
||||||
<% if (type === 'crx') { %>
|
|
||||||
# replace %22 with quotes, see:
|
|
||||||
# crbug.com/81193
|
|
||||||
# webk.it/62107
|
|
||||||
# https://www.w3.org/Bugs/Public/show_bug.cgi?id=16909
|
|
||||||
# http://www.whatwg.org/specs/web-apps/current-work/#multipart-form-data
|
|
||||||
@file.name = @file.name?.replace /%22/g, '"'
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
cleanup: (root, post) ->
|
cleanup: (root) ->
|
||||||
for node in $$ '.mobile', root
|
for node in $$ '.mobile', root
|
||||||
$.rm node
|
$.rm node
|
||||||
for node in $$ '[id]:not(.exif)', post
|
|
||||||
node.removeAttribute 'id'
|
|
||||||
for node in $$ '.desktop', root
|
for node in $$ '.desktop', root
|
||||||
$.rmClass node, 'desktop'
|
$.rmClass node, 'desktop'
|
||||||
return
|
return
|
||||||
@ -209,9 +212,6 @@ class Post
|
|||||||
show: (showRecursively=Conf['Recursive Hiding']) ->
|
show: (showRecursively=Conf['Recursive Hiding']) ->
|
||||||
return if !@isHidden
|
return if !@isHidden
|
||||||
@isHidden = false
|
@isHidden = false
|
||||||
@labels = @labels.filter (label) ->
|
|
||||||
# This is lame.
|
|
||||||
!/^(Manually hidden|Recursively hidden|Hidden by)/.test label
|
|
||||||
|
|
||||||
for quotelink in Get.allQuotelinksLinkingTo @
|
for quotelink in Get.allQuotelinksLinkingTo @
|
||||||
$.rmClass quotelink, 'filtered'
|
$.rmClass quotelink, 'filtered'
|
||||||
@ -233,8 +233,7 @@ class Post
|
|||||||
@nodes.post.previousElementSibling.hidden = false
|
@nodes.post.previousElementSibling.hidden = false
|
||||||
$.rm @nodes.stub
|
$.rm @nodes.stub
|
||||||
delete @nodes.stub
|
delete @nodes.stub
|
||||||
highlight: (label, highlight, top) ->
|
highlight: (highlight, top) ->
|
||||||
@labels.push label
|
|
||||||
unless highlight in @highlights
|
unless highlight in @highlights
|
||||||
@highlights.push highlight
|
@highlights.push highlight
|
||||||
$.addClass @nodes.root, highlight
|
$.addClass @nodes.root, highlight
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class RandomAccessList
|
|||||||
@length++
|
@length++
|
||||||
|
|
||||||
before: (root, item) ->
|
before: (root, item) ->
|
||||||
return if item.next is root
|
return if item.next is root or item is root
|
||||||
|
|
||||||
@rmi item
|
@rmi item
|
||||||
|
|
||||||
@ -29,7 +29,10 @@ class RandomAccessList
|
|||||||
root.prev = item
|
root.prev = item
|
||||||
item.next = root
|
item.next = root
|
||||||
item.prev = prev
|
item.prev = prev
|
||||||
prev.next = item if prev
|
if prev
|
||||||
|
prev.next = item
|
||||||
|
else
|
||||||
|
@first = item
|
||||||
|
|
||||||
after: (root, item) ->
|
after: (root, item) ->
|
||||||
return if item.prev is root
|
return if item.prev is root
|
||||||
@ -40,14 +43,20 @@ class RandomAccessList
|
|||||||
root.next = item
|
root.next = item
|
||||||
item.prev = root
|
item.prev = root
|
||||||
item.next = next
|
item.next = next
|
||||||
next.prev = item if next
|
if next
|
||||||
|
next.prev = item
|
||||||
|
else
|
||||||
|
@last = item
|
||||||
|
|
||||||
prepend: (item) ->
|
prepend: (item) ->
|
||||||
{first} = @
|
{first} = @
|
||||||
return if item is first or not @[item.ID]
|
return if item is first or not @[item.ID]
|
||||||
@rmi item
|
@rmi item
|
||||||
item.next = first
|
item.next = first
|
||||||
|
if first
|
||||||
first.prev = item
|
first.prev = item
|
||||||
|
else
|
||||||
|
@last = item
|
||||||
@first = item
|
@first = item
|
||||||
delete item.prev
|
delete item.prev
|
||||||
|
|
||||||
|
|||||||
@ -22,21 +22,25 @@ class Thread
|
|||||||
g.threads.push @fullID, board.threads.push @, @
|
g.threads.push @fullID, board.threads.push @, @
|
||||||
|
|
||||||
setPage: (pageNum) ->
|
setPage: (pageNum) ->
|
||||||
icon = $ '.page-num', @OP.nodes.info
|
{info, quote} = @OP.nodes
|
||||||
for key in ['title', 'textContent']
|
unless icon = $ '.page-num', info
|
||||||
icon[key] = icon[key].replace /\d+/, pageNum
|
icon = $.el 'span', className: 'page-num'
|
||||||
|
$.after quote, [$.tn(' '), icon]
|
||||||
|
icon.title = "This thread is on page #{pageNum} in the original index."
|
||||||
|
icon.textContent = "[#{pageNum}]"
|
||||||
@catalogView.nodes.pageCount.textContent = pageNum if @catalogView
|
@catalogView.nodes.pageCount.textContent = pageNum if @catalogView
|
||||||
|
|
||||||
setCount: (type, count, reachedLimit) ->
|
setCount: (type, count, reachedLimit) ->
|
||||||
return unless @catalogView
|
return unless @catalogView
|
||||||
el = @catalogView.nodes["#{type}Count"]
|
el = @catalogView.nodes["#{type}Count"]
|
||||||
el.textContent = count
|
el.textContent = count
|
||||||
(if reachedLimit then $.addClass else $.rmClass) el, 'warning'
|
(if reachedLimit then $.addClass else $.rmClass) el, 'warning'
|
||||||
|
|
||||||
setStatus: (type, status) ->
|
setStatus: (type, status) ->
|
||||||
name = "is#{type}"
|
name = "is#{type}"
|
||||||
return if @[name] is status
|
return if @[name] is status
|
||||||
@[name] = status
|
@[name] = status
|
||||||
return unless @OP
|
return unless @OP
|
||||||
typeLC = type.toLowerCase()
|
|
||||||
|
|
||||||
@setIcon 'Sticky', @isSticky
|
@setIcon 'Sticky', @isSticky
|
||||||
@setIcon 'Closed', @isClosed and !@isArchived
|
@setIcon 'Closed', @isClosed and !@isArchived
|
||||||
@ -58,11 +62,10 @@ class Thread
|
|||||||
title: type
|
title: type
|
||||||
className: "#{typeLC}Icon retina"
|
className: "#{typeLC}Icon retina"
|
||||||
|
|
||||||
root =
|
root = if type isnt 'Sticky' and @isSticky
|
||||||
if type isnt 'Sticky' and @isSticky
|
|
||||||
$ '.stickyIcon', @OP.nodes.info
|
$ '.stickyIcon', @OP.nodes.info
|
||||||
else
|
else
|
||||||
$('.page-num', @OP.nodes.info) or $('[title="Reply to this post"]', @OP.nodes.info)
|
$('.page-num', @OP.nodes.info) or @OP.nodes.quote
|
||||||
$.after root, [$.tn(' '), icon]
|
$.after root, [$.tn(' '), icon]
|
||||||
|
|
||||||
return unless @catalogView
|
return unless @catalogView
|
||||||
@ -71,6 +74,7 @@ class Thread
|
|||||||
pin: ->
|
pin: ->
|
||||||
@isPinned = true
|
@isPinned = true
|
||||||
$.addClass @catalogView.nodes.root, 'pinned' if @catalogView
|
$.addClass @catalogView.nodes.root, 'pinned' if @catalogView
|
||||||
|
|
||||||
unpin: ->
|
unpin: ->
|
||||||
@isPinned = false
|
@isPinned = false
|
||||||
$.rmClass @catalogView.nodes.root, 'pinned' if @catalogView
|
$.rmClass @catalogView.nodes.root, 'pinned' if @catalogView
|
||||||
@ -81,6 +85,7 @@ class Thread
|
|||||||
@OP.nodes.root.parentElement.hidden = true
|
@OP.nodes.root.parentElement.hidden = true
|
||||||
if button = $ '.hide-post-button', @OP.nodes.root
|
if button = $ '.hide-post-button', @OP.nodes.root
|
||||||
$.replace button, PostHiding.makeButton false
|
$.replace button, PostHiding.makeButton false
|
||||||
|
|
||||||
show: ->
|
show: ->
|
||||||
return if !@isHidden
|
return if !@isHidden
|
||||||
@isHidden = false
|
@isHidden = false
|
||||||
|
|||||||
@ -7,7 +7,7 @@ MarkNewIPs =
|
|||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
MarkNewIPs.ipCount = @ipCount
|
MarkNewIPs.ipCount = @ipCount
|
||||||
MarkNewIPs.postIDs = (+x for x in @post.keys)
|
MarkNewIPs.postIDs = (+x for x in @posts.keys)
|
||||||
$.on d, 'ThreadUpdate', MarkNewIPs.onUpdate
|
$.on d, 'ThreadUpdate', MarkNewIPs.onUpdate
|
||||||
|
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user