Catch up to Mayhem, without archive changes

This commit is contained in:
Jordan Bates 2013-05-09 19:33:33 -07:00
commit 875bc98d0f
10 changed files with 180 additions and 113 deletions

View File

@ -250,7 +250,7 @@
}, },
boardnav: '[ toggle-all ] [current-title]', boardnav: '[ toggle-all ] [current-title]',
QR: { QR: {
'QR.personas': ['#email:"sage";boards:jp;always'].join('\n') 'QR.personas': "#email:\"sage\";boards:jp;always"
}, },
time: '%m/%d/%y(%a)%H:%M:%S', time: '%m/%d/%y(%a)%H:%M:%S',
backlink: '>>%id', backlink: '>>%id',
@ -1518,7 +1518,9 @@
return; return;
} }
$.asap((function() { $.asap((function() {
return $.id('boardNavMobile') || d.readyState === 'complete'; var _ref;
return $.id('boardNavMobile') || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Header.setBoardList); }), Header.setBoardList);
$.prepend(d.body, _this.bar); $.prepend(d.body, _this.bar);
$.add(d.body, Header.hover); $.add(d.body, Header.hover);
@ -1822,7 +1824,7 @@
o.file = { o.file = {
name: data.filename + data.ext, name: data.filename + data.ext,
timestamp: "" + data.tim + data.ext, timestamp: "" + data.tim + data.ext,
url: "//images.4chan.org/" + boardID + "/src/" + data.tim + data.ext, url: boardID === 'f' ? "//images.4channel.org/" + boardID + "/src/" + data.filename + data.ext : "//images.4chan.org/" + boardID + "/src/" + data.tim + data.ext,
height: data.h, height: data.h,
width: data.w, width: data.w,
MD5: data.md5, MD5: data.md5,
@ -1842,11 +1844,11 @@
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE @license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
*/ */
var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref; var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileHtml, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file; postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file;
isOP = postID === threadID; isOP = postID === threadID;
staticPath = '//static.4chan.org'; staticPath = '//static.4chan.org/image/';
if (email) { if (email) {
emailStart = '<a href="mailto:' + email + '" class="useremail">'; emailStart = '<a href="mailto:' + email + '" class="useremail">';
emailEnd = '</a>'; emailEnd = '</a>';
@ -1861,26 +1863,26 @@
case 'admin_highlight': case 'admin_highlight':
capcodeClass = " capcodeAdmin"; capcodeClass = " capcodeAdmin";
capcodeStart = " <strong class='capcode hand id_admin'" + "title='Highlight posts by the Administrator'>## Admin</strong>"; capcodeStart = " <strong class='capcode hand id_admin'" + "title='Highlight posts by the Administrator'>## Admin</strong>";
capcode = (" <img src='" + staticPath + "/image/adminicon.gif' ") + "alt='This user is the 4chan Administrator.' " + "title='This user is the 4chan Administrator.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "adminicon.gif' ") + "alt='This user is the 4chan Administrator.' " + "title='This user is the 4chan Administrator.' class=identityIcon>";
break; break;
case 'mod': case 'mod':
capcodeClass = " capcodeMod"; capcodeClass = " capcodeMod";
capcodeStart = " <strong class='capcode hand id_mod' " + "title='Highlight posts by Moderators'>## Mod</strong>"; capcodeStart = " <strong class='capcode hand id_mod' " + "title='Highlight posts by Moderators'>## Mod</strong>";
capcode = (" <img src='" + staticPath + "/image/modicon.gif' ") + "alt='This user is a 4chan Moderator.' " + "title='This user is a 4chan Moderator.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "modicon.gif' ") + "alt='This user is a 4chan Moderator.' " + "title='This user is a 4chan Moderator.' class=identityIcon>";
break; break;
case 'developer': case 'developer':
capcodeClass = " capcodeDeveloper"; capcodeClass = " capcodeDeveloper";
capcodeStart = " <strong class='capcode hand id_developer' " + "title='Highlight posts by Developers'>## Developer</strong>"; capcodeStart = " <strong class='capcode hand id_developer' " + "title='Highlight posts by Developers'>## Developer</strong>";
capcode = (" <img src='" + staticPath + "/image/developericon.gif' ") + "alt='This user is a 4chan Developer.' " + "title='This user is a 4chan Developer.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "developericon.gif' ") + "alt='This user is a 4chan Developer.' " + "title='This user is a 4chan Developer.' class=identityIcon>";
break; break;
default: default:
capcodeClass = ''; capcodeClass = '';
capcodeStart = ''; capcodeStart = '';
capcode = ''; capcode = '';
} }
flag = flagCode ? (" <img src='" + staticPath + "/image/country/" + (boardID === 'pol' ? 'troll/' : '')) + flagCode.toLowerCase() + (".gif' alt=" + flagCode + " title='" + flagName + "' class=countryFlag>") : ''; flag = flagCode ? (" <img src='" + staticPath + "country/" + (boardID === 'pol' ? 'troll/' : '')) + flagCode.toLowerCase() + (".gif' alt=" + flagCode + " title='" + flagName + "' class=countryFlag>") : '';
if (file != null ? file.isDeleted : void 0) { if (file != null ? file.isDeleted : void 0) {
fileHTML = isOP ? ("<div id=f" + postID + " class=file><div class=fileInfo></div><span class=fileThumb>") + ("<img src='" + staticPath + "/image/filedeleted.gif' alt='File deleted.' class='fileDeleted retina'>") + "</span></div>" : ("<div id=f" + postID + " class=file><span class=fileThumb>") + ("<img src='" + staticPath + "/image/filedeleted-res.gif' alt='File deleted.' class='fileDeletedRes retina'>") + "</span></div>"; fileHtml = isOP ? ("<div class=file id=f" + data.no + "><div class=fileInfo></div><span class=fileThumb>") + ("<img src='" + staticPath + "filedeleted.gif' alt='File deleted.' class=fileDeletedRes>") + "</span></div>" : ("<div class=file id=f" + data.no + "><span class=fileThumb>") + ("<img src='" + staticPath + "filedeleted-res.gif' alt='File deleted.' class=fileDeletedRes>") + "</span></div>";
} else if (file) { } else if (file) {
ext = file.name.slice(-3); ext = file.name.slice(-3);
if (!file.twidth && !file.theight && ext === 'gif') { if (!file.twidth && !file.theight && ext === 'gif') {
@ -1892,7 +1894,7 @@
if (file.isSpoiler) { if (file.isSpoiler) {
fileSize = "Spoiler Image, " + fileSize; fileSize = "Spoiler Image, " + fileSize;
if (!isArchived) { if (!isArchived) {
fileThumb = '//static.4chan.org/image/spoiler'; fileThumb = "" + staticPath + "spoiler";
if (spoilerRange = Build.spoilerRange[boardID]) { if (spoilerRange = Build.spoilerRange[boardID]) {
fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random()); fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random());
} }
@ -1900,9 +1902,7 @@
file.twidth = file.theight = 100; file.twidth = file.theight = 100;
} }
} }
if (boardID.ID !== 'f') { imgSrc = boardID === 'f' ? '' : ("<a class='fileThumb" + (file.isSpoiler ? ' imgspoiler' : '') + "' href='" + file.url + "' target=_blank>") + ("<img src='" + fileThumb + "' alt='" + fileSize + "' data-md5=" + file.MD5 + " style='height: " + file.theight + "px; width: " + file.twidth + "px;'>") + "</a>";
imgSrc = ("<a class='fileThumb" + (file.isSpoiler ? ' imgspoiler' : '') + "' href='" + file.url + "' target=_blank>") + ("<img src='" + fileThumb + "' alt='" + fileSize + "' data-md5=" + file.MD5 + " style='height: " + file.theight + "px; width: " + file.twidth + "px;'></a>");
}
a = $.el('a', { a = $.el('a', {
innerHTML: file.name innerHTML: file.name
}); });
@ -1918,8 +1918,8 @@
fileHTML = ''; fileHTML = '';
} }
tripcode = tripcode ? " <span class=postertrip>" + tripcode + "</span>" : ''; tripcode = tripcode ? " <span class=postertrip>" + tripcode + "</span>" : '';
sticky = isSticky ? ' <img src=//static.4chan.org/image/sticky.gif alt=Sticky title=Sticky class=stickyIcon>' : ''; sticky = isSticky ? " <img src=" + staticPath + "sticky.gif alt=Sticky title=Sticky class=stickyIcon>" : '';
closed = isClosed ? ' <img src=//static.4chan.org/image/closed.gif alt=Closed title=Closed class=closedIcon>' : ''; closed = isClosed ? " <img src=" + staticPath + "closed.gif alt=Closed title=Closed class=closedIcon>" : '';
container = $.el('div', { container = $.el('div', {
id: "pc" + postID, id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
@ -3863,7 +3863,7 @@
} }
}, },
mouseover: function(e) { mouseover: function(e) {
var boardID, clone, origin, post, postID, posts, qp, quote, quoterID, threadID, _i, _j, _len, _len1, _ref, _ref1; var boardID, clone, origin, post, postID, posts, qp, quote, quoterID, root, threadID, workaround, _i, _j, _len, _len1, _ref, _ref1;
if ($.hasClass(this, 'inlined')) { if ($.hasClass(this, 'inlined')) {
return; return;
@ -3885,6 +3885,18 @@
return qp.firstElementChild; return qp.firstElementChild;
} }
}); });
root = this;
workaround = function(e) {
if (this === root) {
e.stopPropagation();
return;
}
$.event('mouseout', null, root);
$.off(d, 'mousemove', workaround);
return $.off(root, 'mousemove', workaround);
};
$.on(d, 'mousemove', workaround);
$.on(root, 'mousemove', workaround);
if (!(origin = g.posts["" + boardID + "." + postID])) { if (!(origin = g.posts["" + boardID + "." + postID])) {
return; return;
} }
@ -7511,12 +7523,13 @@
} }
} }
Unread.addPosts(posts); Unread.addPosts(posts);
if (Conf['Scroll to Last Read Post']) { if (!Conf['Scroll to Last Read Post']) {
return Unread.scroll(); return;
} }
return Unread.scroll();
}, },
scroll: function() { scroll: function() {
var hash, post, posts, prevID, root; var hash, onload, post, posts, prevID, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) { if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
return; return;
@ -7533,11 +7546,17 @@
break; break;
} }
} }
root.scrollIntoView(false); onload = function() {
return; return root.scrollIntoView(false);
};
} else {
posts = Object.keys(Unread.thread.posts);
post = Unread.thread.posts[posts[posts.length - 1]];
onload = function() {
return Header.scrollToPost(post.nodes.root);
};
} }
posts = Object.keys(Unread.thread.posts); return $.on(window, 'load', onload);
return Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
}, },
sync: function() { sync: function() {
var lastReadPost; var lastReadPost;
@ -9881,7 +9900,11 @@
} }
Conf['archivers'] = {}; Conf['archivers'] = {};
$.get(Conf, Main.initFeatures); $.get(Conf, Main.initFeatures);
return $.on(d, '4chanMainInit', Main.initStyle); return $.asap((function() {
var _ref;
return d.head && $('link[rel="shortcut icon"]', d.head) || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Main.initStyle);
}, },
initFeatures: function(items) { initFeatures: function(items) {
var init, pathname; var init, pathname;
@ -10000,7 +10023,6 @@
initStyle: function() { initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref; var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
$.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit()) { if (!Main.isThisPageLegit()) {
return; return;
} }

View File

@ -251,7 +251,7 @@
}, },
boardnav: '[ toggle-all ] [current-title]', boardnav: '[ toggle-all ] [current-title]',
QR: { QR: {
'QR.personas': ['#email:"sage";boards:jp;always'].join('\n') 'QR.personas': "#email:\"sage\";boards:jp;always"
}, },
time: '%m/%d/%y(%a)%H:%M:%S', time: '%m/%d/%y(%a)%H:%M:%S',
backlink: '>>%id', backlink: '>>%id',
@ -1514,7 +1514,9 @@
return; return;
} }
$.asap((function() { $.asap((function() {
return $.id('boardNavMobile') || d.readyState === 'complete'; var _ref;
return $.id('boardNavMobile') || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Header.setBoardList); }), Header.setBoardList);
$.prepend(d.body, _this.bar); $.prepend(d.body, _this.bar);
$.add(d.body, Header.hover); $.add(d.body, Header.hover);
@ -1818,7 +1820,7 @@
o.file = { o.file = {
name: data.filename + data.ext, name: data.filename + data.ext,
timestamp: "" + data.tim + data.ext, timestamp: "" + data.tim + data.ext,
url: "//images.4chan.org/" + boardID + "/src/" + data.tim + data.ext, url: boardID === 'f' ? "//images.4channel.org/" + boardID + "/src/" + data.filename + data.ext : "//images.4chan.org/" + boardID + "/src/" + data.tim + data.ext,
height: data.h, height: data.h,
width: data.w, width: data.w,
MD5: data.md5, MD5: data.md5,
@ -1838,11 +1840,11 @@
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE @license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
*/ */
var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref; var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileHtml, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file; postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file;
isOP = postID === threadID; isOP = postID === threadID;
staticPath = '//static.4chan.org'; staticPath = '//static.4chan.org/image/';
if (email) { if (email) {
emailStart = '<a href="mailto:' + email + '" class="useremail">'; emailStart = '<a href="mailto:' + email + '" class="useremail">';
emailEnd = '</a>'; emailEnd = '</a>';
@ -1857,26 +1859,26 @@
case 'admin_highlight': case 'admin_highlight':
capcodeClass = " capcodeAdmin"; capcodeClass = " capcodeAdmin";
capcodeStart = " <strong class='capcode hand id_admin'" + "title='Highlight posts by the Administrator'>## Admin</strong>"; capcodeStart = " <strong class='capcode hand id_admin'" + "title='Highlight posts by the Administrator'>## Admin</strong>";
capcode = (" <img src='" + staticPath + "/image/adminicon.gif' ") + "alt='This user is the 4chan Administrator.' " + "title='This user is the 4chan Administrator.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "adminicon.gif' ") + "alt='This user is the 4chan Administrator.' " + "title='This user is the 4chan Administrator.' class=identityIcon>";
break; break;
case 'mod': case 'mod':
capcodeClass = " capcodeMod"; capcodeClass = " capcodeMod";
capcodeStart = " <strong class='capcode hand id_mod' " + "title='Highlight posts by Moderators'>## Mod</strong>"; capcodeStart = " <strong class='capcode hand id_mod' " + "title='Highlight posts by Moderators'>## Mod</strong>";
capcode = (" <img src='" + staticPath + "/image/modicon.gif' ") + "alt='This user is a 4chan Moderator.' " + "title='This user is a 4chan Moderator.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "modicon.gif' ") + "alt='This user is a 4chan Moderator.' " + "title='This user is a 4chan Moderator.' class=identityIcon>";
break; break;
case 'developer': case 'developer':
capcodeClass = " capcodeDeveloper"; capcodeClass = " capcodeDeveloper";
capcodeStart = " <strong class='capcode hand id_developer' " + "title='Highlight posts by Developers'>## Developer</strong>"; capcodeStart = " <strong class='capcode hand id_developer' " + "title='Highlight posts by Developers'>## Developer</strong>";
capcode = (" <img src='" + staticPath + "/image/developericon.gif' ") + "alt='This user is a 4chan Developer.' " + "title='This user is a 4chan Developer.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "developericon.gif' ") + "alt='This user is a 4chan Developer.' " + "title='This user is a 4chan Developer.' class=identityIcon>";
break; break;
default: default:
capcodeClass = ''; capcodeClass = '';
capcodeStart = ''; capcodeStart = '';
capcode = ''; capcode = '';
} }
flag = flagCode ? (" <img src='" + staticPath + "/image/country/" + (boardID === 'pol' ? 'troll/' : '')) + flagCode.toLowerCase() + (".gif' alt=" + flagCode + " title='" + flagName + "' class=countryFlag>") : ''; flag = flagCode ? (" <img src='" + staticPath + "country/" + (boardID === 'pol' ? 'troll/' : '')) + flagCode.toLowerCase() + (".gif' alt=" + flagCode + " title='" + flagName + "' class=countryFlag>") : '';
if (file != null ? file.isDeleted : void 0) { if (file != null ? file.isDeleted : void 0) {
fileHTML = isOP ? ("<div id=f" + postID + " class=file><div class=fileInfo></div><span class=fileThumb>") + ("<img src='" + staticPath + "/image/filedeleted.gif' alt='File deleted.' class='fileDeleted retina'>") + "</span></div>" : ("<div id=f" + postID + " class=file><span class=fileThumb>") + ("<img src='" + staticPath + "/image/filedeleted-res.gif' alt='File deleted.' class='fileDeletedRes retina'>") + "</span></div>"; fileHtml = isOP ? ("<div class=file id=f" + data.no + "><div class=fileInfo></div><span class=fileThumb>") + ("<img src='" + staticPath + "filedeleted.gif' alt='File deleted.' class=fileDeletedRes>") + "</span></div>" : ("<div class=file id=f" + data.no + "><span class=fileThumb>") + ("<img src='" + staticPath + "filedeleted-res.gif' alt='File deleted.' class=fileDeletedRes>") + "</span></div>";
} else if (file) { } else if (file) {
ext = file.name.slice(-3); ext = file.name.slice(-3);
if (!file.twidth && !file.theight && ext === 'gif') { if (!file.twidth && !file.theight && ext === 'gif') {
@ -1888,7 +1890,7 @@
if (file.isSpoiler) { if (file.isSpoiler) {
fileSize = "Spoiler Image, " + fileSize; fileSize = "Spoiler Image, " + fileSize;
if (!isArchived) { if (!isArchived) {
fileThumb = '//static.4chan.org/image/spoiler'; fileThumb = "" + staticPath + "spoiler";
if (spoilerRange = Build.spoilerRange[boardID]) { if (spoilerRange = Build.spoilerRange[boardID]) {
fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random()); fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random());
} }
@ -1896,9 +1898,7 @@
file.twidth = file.theight = 100; file.twidth = file.theight = 100;
} }
} }
if (boardID.ID !== 'f') { imgSrc = boardID === 'f' ? '' : ("<a class='fileThumb" + (file.isSpoiler ? ' imgspoiler' : '') + "' href='" + file.url + "' target=_blank>") + ("<img src='" + fileThumb + "' alt='" + fileSize + "' data-md5=" + file.MD5 + " style='height: " + file.theight + "px; width: " + file.twidth + "px;'>") + "</a>";
imgSrc = ("<a class='fileThumb" + (file.isSpoiler ? ' imgspoiler' : '') + "' href='" + file.url + "' target=_blank>") + ("<img src='" + fileThumb + "' alt='" + fileSize + "' data-md5=" + file.MD5 + " style='height: " + file.theight + "px; width: " + file.twidth + "px;'></a>");
}
a = $.el('a', { a = $.el('a', {
innerHTML: file.name innerHTML: file.name
}); });
@ -1914,8 +1914,8 @@
fileHTML = ''; fileHTML = '';
} }
tripcode = tripcode ? " <span class=postertrip>" + tripcode + "</span>" : ''; tripcode = tripcode ? " <span class=postertrip>" + tripcode + "</span>" : '';
sticky = isSticky ? ' <img src=//static.4chan.org/image/sticky.gif alt=Sticky title=Sticky class=stickyIcon>' : ''; sticky = isSticky ? " <img src=" + staticPath + "sticky.gif alt=Sticky title=Sticky class=stickyIcon>" : '';
closed = isClosed ? ' <img src=//static.4chan.org/image/closed.gif alt=Closed title=Closed class=closedIcon>' : ''; closed = isClosed ? " <img src=" + staticPath + "closed.gif alt=Closed title=Closed class=closedIcon>" : '';
container = $.el('div', { container = $.el('div', {
id: "pc" + postID, id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
@ -7532,12 +7532,13 @@
} }
} }
Unread.addPosts(posts); Unread.addPosts(posts);
if (Conf['Scroll to Last Read Post']) { if (!Conf['Scroll to Last Read Post']) {
return Unread.scroll(); return;
} }
return Unread.scroll();
}, },
scroll: function() { scroll: function() {
var hash, post, posts, prevID, root; var hash, onload, post, posts, prevID, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) { if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
return; return;
@ -7554,11 +7555,17 @@
break; break;
} }
} }
root.scrollIntoView(false); onload = function() {
return; return root.scrollIntoView(false);
};
} else {
posts = Object.keys(Unread.thread.posts);
post = Unread.thread.posts[posts[posts.length - 1]];
onload = function() {
return Header.scrollToPost(post.nodes.root);
};
} }
posts = Object.keys(Unread.thread.posts); return $.on(window, 'load', onload);
return Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
}, },
sync: function() { sync: function() {
var lastReadPost; var lastReadPost;
@ -9904,7 +9911,11 @@
} }
Conf['archivers'] = {}; Conf['archivers'] = {};
$.get(Conf, Main.initFeatures); $.get(Conf, Main.initFeatures);
return $.on(d, '4chanMainInit', Main.initStyle); return $.asap((function() {
var _ref;
return d.head && $('link[rel="shortcut icon"]', d.head) || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Main.initStyle);
}, },
initFeatures: function(items) { initFeatures: function(items) {
var init, pathname; var init, pathname;
@ -10023,7 +10034,6 @@
initStyle: function() { initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref; var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
$.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit()) { if (!Main.isThisPageLegit()) {
return; return;
} }

View File

@ -233,7 +233,7 @@
}, },
boardnav: '[ toggle-all ] [current-title]', boardnav: '[ toggle-all ] [current-title]',
QR: { QR: {
'QR.personas': ['#email:"sage";boards:jp;always'].join('\n') 'QR.personas': "#email:\"sage\";boards:jp;always"
}, },
time: '%m/%d/%y(%a)%H:%M:%S', time: '%m/%d/%y(%a)%H:%M:%S',
backlink: '>>%id', backlink: '>>%id',
@ -1517,7 +1517,9 @@
return; return;
} }
$.asap((function() { $.asap((function() {
return $.id('boardNavMobile') || d.readyState === 'complete'; var _ref;
return $.id('boardNavMobile') || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Header.setBoardList); }), Header.setBoardList);
$.prepend(d.body, _this.bar); $.prepend(d.body, _this.bar);
$.add(d.body, Header.hover); $.add(d.body, Header.hover);
@ -1821,7 +1823,7 @@
o.file = { o.file = {
name: data.filename + data.ext, name: data.filename + data.ext,
timestamp: "" + data.tim + data.ext, timestamp: "" + data.tim + data.ext,
url: "//images.4chan.org/" + boardID + "/src/" + data.tim + data.ext, url: boardID === 'f' ? "//images.4channel.org/" + boardID + "/src/" + data.filename + data.ext : "//images.4chan.org/" + boardID + "/src/" + data.tim + data.ext,
height: data.h, height: data.h,
width: data.w, width: data.w,
MD5: data.md5, MD5: data.md5,
@ -1841,11 +1843,11 @@
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE @license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
*/ */
var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref; var a, boardID, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileHtml, fileInfo, fileSize, fileThumb, filename, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, shortFilename, spoilerRange, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref;
postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file; postID = o.postID, threadID = o.threadID, boardID = o.boardID, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file;
isOP = postID === threadID; isOP = postID === threadID;
staticPath = '//static.4chan.org'; staticPath = '//static.4chan.org/image/';
if (email) { if (email) {
emailStart = '<a href="mailto:' + email + '" class="useremail">'; emailStart = '<a href="mailto:' + email + '" class="useremail">';
emailEnd = '</a>'; emailEnd = '</a>';
@ -1860,26 +1862,26 @@
case 'admin_highlight': case 'admin_highlight':
capcodeClass = " capcodeAdmin"; capcodeClass = " capcodeAdmin";
capcodeStart = " <strong class='capcode hand id_admin'" + "title='Highlight posts by the Administrator'>## Admin</strong>"; capcodeStart = " <strong class='capcode hand id_admin'" + "title='Highlight posts by the Administrator'>## Admin</strong>";
capcode = (" <img src='" + staticPath + "/image/adminicon.gif' ") + "alt='This user is the 4chan Administrator.' " + "title='This user is the 4chan Administrator.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "adminicon.gif' ") + "alt='This user is the 4chan Administrator.' " + "title='This user is the 4chan Administrator.' class=identityIcon>";
break; break;
case 'mod': case 'mod':
capcodeClass = " capcodeMod"; capcodeClass = " capcodeMod";
capcodeStart = " <strong class='capcode hand id_mod' " + "title='Highlight posts by Moderators'>## Mod</strong>"; capcodeStart = " <strong class='capcode hand id_mod' " + "title='Highlight posts by Moderators'>## Mod</strong>";
capcode = (" <img src='" + staticPath + "/image/modicon.gif' ") + "alt='This user is a 4chan Moderator.' " + "title='This user is a 4chan Moderator.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "modicon.gif' ") + "alt='This user is a 4chan Moderator.' " + "title='This user is a 4chan Moderator.' class=identityIcon>";
break; break;
case 'developer': case 'developer':
capcodeClass = " capcodeDeveloper"; capcodeClass = " capcodeDeveloper";
capcodeStart = " <strong class='capcode hand id_developer' " + "title='Highlight posts by Developers'>## Developer</strong>"; capcodeStart = " <strong class='capcode hand id_developer' " + "title='Highlight posts by Developers'>## Developer</strong>";
capcode = (" <img src='" + staticPath + "/image/developericon.gif' ") + "alt='This user is a 4chan Developer.' " + "title='This user is a 4chan Developer.' class=identityIcon>"; capcode = (" <img src='" + staticPath + "developericon.gif' ") + "alt='This user is a 4chan Developer.' " + "title='This user is a 4chan Developer.' class=identityIcon>";
break; break;
default: default:
capcodeClass = ''; capcodeClass = '';
capcodeStart = ''; capcodeStart = '';
capcode = ''; capcode = '';
} }
flag = flagCode ? (" <img src='" + staticPath + "/image/country/" + (boardID === 'pol' ? 'troll/' : '')) + flagCode.toLowerCase() + (".gif' alt=" + flagCode + " title='" + flagName + "' class=countryFlag>") : ''; flag = flagCode ? (" <img src='" + staticPath + "country/" + (boardID === 'pol' ? 'troll/' : '')) + flagCode.toLowerCase() + (".gif' alt=" + flagCode + " title='" + flagName + "' class=countryFlag>") : '';
if (file != null ? file.isDeleted : void 0) { if (file != null ? file.isDeleted : void 0) {
fileHTML = isOP ? ("<div id=f" + postID + " class=file><div class=fileInfo></div><span class=fileThumb>") + ("<img src='" + staticPath + "/image/filedeleted.gif' alt='File deleted.' class='fileDeleted retina'>") + "</span></div>" : ("<div id=f" + postID + " class=file><span class=fileThumb>") + ("<img src='" + staticPath + "/image/filedeleted-res.gif' alt='File deleted.' class='fileDeletedRes retina'>") + "</span></div>"; fileHtml = isOP ? ("<div class=file id=f" + data.no + "><div class=fileInfo></div><span class=fileThumb>") + ("<img src='" + staticPath + "filedeleted.gif' alt='File deleted.' class=fileDeletedRes>") + "</span></div>" : ("<div class=file id=f" + data.no + "><span class=fileThumb>") + ("<img src='" + staticPath + "filedeleted-res.gif' alt='File deleted.' class=fileDeletedRes>") + "</span></div>";
} else if (file) { } else if (file) {
ext = file.name.slice(-3); ext = file.name.slice(-3);
if (!file.twidth && !file.theight && ext === 'gif') { if (!file.twidth && !file.theight && ext === 'gif') {
@ -1891,7 +1893,7 @@
if (file.isSpoiler) { if (file.isSpoiler) {
fileSize = "Spoiler Image, " + fileSize; fileSize = "Spoiler Image, " + fileSize;
if (!isArchived) { if (!isArchived) {
fileThumb = '//static.4chan.org/image/spoiler'; fileThumb = "" + staticPath + "spoiler";
if (spoilerRange = Build.spoilerRange[boardID]) { if (spoilerRange = Build.spoilerRange[boardID]) {
fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random()); fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random());
} }
@ -1899,9 +1901,7 @@
file.twidth = file.theight = 100; file.twidth = file.theight = 100;
} }
} }
if (boardID.ID !== 'f') { imgSrc = boardID === 'f' ? '' : ("<a class='fileThumb" + (file.isSpoiler ? ' imgspoiler' : '') + "' href='" + file.url + "' target=_blank>") + ("<img src='" + fileThumb + "' alt='" + fileSize + "' data-md5=" + file.MD5 + " style='height: " + file.theight + "px; width: " + file.twidth + "px;'>") + "</a>";
imgSrc = ("<a class='fileThumb" + (file.isSpoiler ? ' imgspoiler' : '') + "' href='" + file.url + "' target=_blank>") + ("<img src='" + fileThumb + "' alt='" + fileSize + "' data-md5=" + file.MD5 + " style='height: " + file.theight + "px; width: " + file.twidth + "px;'></a>");
}
a = $.el('a', { a = $.el('a', {
innerHTML: file.name innerHTML: file.name
}); });
@ -1917,8 +1917,8 @@
fileHTML = ''; fileHTML = '';
} }
tripcode = tripcode ? " <span class=postertrip>" + tripcode + "</span>" : ''; tripcode = tripcode ? " <span class=postertrip>" + tripcode + "</span>" : '';
sticky = isSticky ? ' <img src=//static.4chan.org/image/sticky.gif alt=Sticky title=Sticky class=stickyIcon>' : ''; sticky = isSticky ? " <img src=" + staticPath + "sticky.gif alt=Sticky title=Sticky class=stickyIcon>" : '';
closed = isClosed ? ' <img src=//static.4chan.org/image/closed.gif alt=Closed title=Closed class=closedIcon>' : ''; closed = isClosed ? " <img src=" + staticPath + "closed.gif alt=Closed title=Closed class=closedIcon>" : '';
container = $.el('div', { container = $.el('div', {
id: "pc" + postID, id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
@ -7511,12 +7511,13 @@
} }
} }
Unread.addPosts(posts); Unread.addPosts(posts);
if (Conf['Scroll to Last Read Post']) { if (!Conf['Scroll to Last Read Post']) {
return Unread.scroll(); return;
} }
return Unread.scroll();
}, },
scroll: function() { scroll: function() {
var hash, post, posts, prevID, root; var hash, onload, post, posts, prevID, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) { if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
return; return;
@ -7533,11 +7534,17 @@
break; break;
} }
} }
root.scrollIntoView(false); onload = function() {
return; return root.scrollIntoView(false);
};
} else {
posts = Object.keys(Unread.thread.posts);
post = Unread.thread.posts[posts[posts.length - 1]];
onload = function() {
return Header.scrollToPost(post.nodes.root);
};
} }
posts = Object.keys(Unread.thread.posts); return $.on(window, 'load', onload);
return Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
}, },
sync: function() { sync: function() {
var lastReadPost; var lastReadPost;
@ -9886,7 +9893,11 @@
} }
Conf['archivers'] = {}; Conf['archivers'] = {};
$.get(Conf, Main.initFeatures); $.get(Conf, Main.initFeatures);
return $.on(d, '4chanMainInit', Main.initStyle); return $.asap((function() {
var _ref;
return d.head && $('link[rel="shortcut icon"]', d.head) || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Main.initStyle);
}, },
initFeatures: function(items) { initFeatures: function(items) {
var init, pathname; var init, pathname;
@ -10005,7 +10016,6 @@
initStyle: function() { initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref; var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
$.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit()) { if (!Main.isThisPageLegit()) {
return; return;
} }

View File

@ -28,7 +28,7 @@
"grunt-contrib-compress": "~0.5.0", "grunt-contrib-compress": "~0.5.0",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1", "grunt-contrib-copy": "~0.4.1",
"grunt-contrib-watch": "~0.4.0", "grunt-contrib-watch": "~0.4.1",
"grunt-shell": "~0.2.2" "grunt-shell": "~0.2.2"
}, },
"repository": { "repository": {
@ -44,6 +44,6 @@
"license": "MIT", "license": "MIT",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"engines": { "engines": {
"node": ">=0.8" "node": ">=0.10"
} }
} }

View File

@ -35,7 +35,10 @@ Build =
o.file = o.file =
name: data.filename + data.ext name: data.filename + data.ext
timestamp: "#{data.tim}#{data.ext}" timestamp: "#{data.tim}#{data.ext}"
url: "//images.4chan.org/#{boardID}/src/#{data.tim}#{data.ext}" url: if boardID is 'f'
"//images.4channel.org/#{boardID}/src/#{data.filename}#{data.ext}"
else
"//images.4chan.org/#{boardID}/src/#{data.tim}#{data.ext}"
height: data.h height: data.h
width: data.w width: data.w
MD5: data.md5 MD5: data.md5
@ -60,7 +63,7 @@ Build =
} = o } = o
isOP = postID is threadID isOP = postID is threadID
staticPath = '//static.4chan.org' staticPath = '//static.4chan.org/image/'
if email if email
emailStart = '<a href="mailto:' + email + '" class="useremail">' emailStart = '<a href="mailto:' + email + '" class="useremail">'
@ -83,21 +86,21 @@ Build =
capcodeClass = " capcodeAdmin" capcodeClass = " capcodeAdmin"
capcodeStart = " <strong class='capcode hand id_admin'" + capcodeStart = " <strong class='capcode hand id_admin'" +
"title='Highlight posts by the Administrator'>## Admin</strong>" "title='Highlight posts by the Administrator'>## Admin</strong>"
capcode = " <img src='#{staticPath}/image/adminicon.gif' " + capcode = " <img src='#{staticPath}adminicon.gif' " +
"alt='This user is the 4chan Administrator.' " + "alt='This user is the 4chan Administrator.' " +
"title='This user is the 4chan Administrator.' class=identityIcon>" "title='This user is the 4chan Administrator.' class=identityIcon>"
when 'mod' when 'mod'
capcodeClass = " capcodeMod" capcodeClass = " capcodeMod"
capcodeStart = " <strong class='capcode hand id_mod' " + capcodeStart = " <strong class='capcode hand id_mod' " +
"title='Highlight posts by Moderators'>## Mod</strong>" "title='Highlight posts by Moderators'>## Mod</strong>"
capcode = " <img src='#{staticPath}/image/modicon.gif' " + capcode = " <img src='#{staticPath}modicon.gif' " +
"alt='This user is a 4chan Moderator.' " + "alt='This user is a 4chan Moderator.' " +
"title='This user is a 4chan Moderator.' class=identityIcon>" "title='This user is a 4chan Moderator.' class=identityIcon>"
when 'developer' when 'developer'
capcodeClass = " capcodeDeveloper" capcodeClass = " capcodeDeveloper"
capcodeStart = " <strong class='capcode hand id_developer' " + capcodeStart = " <strong class='capcode hand id_developer' " +
"title='Highlight posts by Developers'>## Developer</strong>" "title='Highlight posts by Developers'>## Developer</strong>"
capcode = " <img src='#{staticPath}/image/developericon.gif' " + capcode = " <img src='#{staticPath}developericon.gif' " +
"alt='This user is a 4chan Developer.' " + "alt='This user is a 4chan Developer.' " +
"title='This user is a 4chan Developer.' class=identityIcon>" "title='This user is a 4chan Developer.' class=identityIcon>"
else else
@ -107,21 +110,20 @@ Build =
flag = flag =
if flagCode if flagCode
" <img src='#{staticPath}/image/country/#{if boardID is 'pol' then 'troll/' else ''}" + " <img src='#{staticPath}country/#{if boardID is 'pol' then 'troll/' else ''}" +
flagCode.toLowerCase() + ".gif' alt=#{flagCode} title='#{flagName}' class=countryFlag>" flagCode.toLowerCase() + ".gif' alt=#{flagCode} title='#{flagName}' class=countryFlag>"
else else
'' ''
if file?.isDeleted if file?.isDeleted
fileHTML = fileHtml = if isOP
if isOP "<div class=file id=f#{data.no}><div class=fileInfo></div><span class=fileThumb>" +
"<div id=f#{postID} class=file><div class=fileInfo></div><span class=fileThumb>" + "<img src='#{staticPath}filedeleted.gif' alt='File deleted.' class=fileDeletedRes>" +
"<img src='#{staticPath}/image/filedeleted.gif' alt='File deleted.' class='fileDeleted retina'>" + "</span></div>"
"</span></div>" else
else "<div class=file id=f#{data.no}><span class=fileThumb>" +
"<div id=f#{postID} class=file><span class=fileThumb>" + "<img src='#{staticPath}filedeleted-res.gif' alt='File deleted.' class=fileDeletedRes>" +
"<img src='#{staticPath}/image/filedeleted-res.gif' alt='File deleted.' class='fileDeletedRes retina'>" + "</span></div>"
"</span></div>"
else if file else if file
ext = file.name[-3..] ext = file.name[-3..]
if !file.twidth and !file.theight and ext is 'gif' # wtf ? if !file.twidth and !file.theight and ext is 'gif' # wtf ?
@ -134,16 +136,19 @@ Build =
if file.isSpoiler if file.isSpoiler
fileSize = "Spoiler Image, #{fileSize}" fileSize = "Spoiler Image, #{fileSize}"
unless isArchived unless isArchived
fileThumb = '//static.4chan.org/image/spoiler' fileThumb = "#{staticPath}spoiler"
if spoilerRange = Build.spoilerRange[boardID] if spoilerRange = Build.spoilerRange[boardID]
# Randomize the spoiler image. # Randomize the spoiler image.
fileThumb += "-#{boardID}" + Math.floor 1 + spoilerRange * Math.random() fileThumb += "-#{boardID}" + Math.floor 1 + spoilerRange * Math.random()
fileThumb += '.png' fileThumb += '.png'
file.twidth = file.theight = 100 file.twidth = file.theight = 100
if boardID.ID isnt 'f' imgSrc = if boardID is 'f'
imgSrc = "<a class='fileThumb#{if file.isSpoiler then ' imgspoiler' else ''}' href='#{file.url}' target=_blank>" + ''
"<img src='#{fileThumb}' alt='#{fileSize}' data-md5=#{file.MD5} style='height: #{file.theight}px; width: #{file.twidth}px;'></a>" else
"<a class='fileThumb#{if file.isSpoiler then ' imgspoiler' else ''}' href='#{file.url}' target=_blank>" +
"<img src='#{fileThumb}' alt='#{fileSize}' data-md5=#{file.MD5} style='height: #{file.theight}px; width: #{file.twidth}px;'>" +
"</a>"
# Ha ha, filenames! # Ha ha, filenames!
# html -> text, translate WebKit's %22s into "s # html -> text, translate WebKit's %22s into "s
@ -179,12 +184,12 @@ Build =
sticky = sticky =
if isSticky if isSticky
' <img src=//static.4chan.org/image/sticky.gif alt=Sticky title=Sticky class=stickyIcon>' " <img src=#{staticPath}sticky.gif alt=Sticky title=Sticky class=stickyIcon>"
else else
'' ''
closed = closed =
if isClosed if isClosed
' <img src=//static.4chan.org/image/closed.gif alt=Closed title=Closed class=closedIcon>' " <img src=#{staticPath}closed.gif alt=Closed title=Closed class=closedIcon>"
else else
'' ''

View File

@ -451,9 +451,9 @@ http://iqdb.org/?url=%TURL
boardnav: '[ toggle-all ] [current-title]' boardnav: '[ toggle-all ] [current-title]'
QR: QR:
'QR.personas': [ 'QR.personas': """
'#email:"sage";boards:jp;always' #email:"sage";boards:jp;always
].join '\n' """
time: '%m/%d/%y(%a)%H:%M:%S' time: '%m/%d/%y(%a)%H:%M:%S'

View File

@ -70,7 +70,7 @@ Header =
return unless Main.isThisPageLegit() return unless Main.isThisPageLegit()
# Wait for #boardNavMobile instead of #boardNavDesktop, # Wait for #boardNavMobile instead of #boardNavDesktop,
# it might be incomplete otherwise. # it might be incomplete otherwise.
$.asap (-> $.id('boardNavMobile') or d.readyState is 'complete'), Header.setBoardList $.asap (-> $.id('boardNavMobile') or d.readyState in ['interactive', 'complete']), Header.setBoardList
$.prepend d.body, @bar $.prepend d.body, @bar
$.add d.body, Header.hover $.add d.body, Header.hover
@setBarPosition Conf['Bottom Header'] @setBarPosition Conf['Bottom Header']

View File

@ -17,7 +17,8 @@ Main =
Conf['archivers'] = {} Conf['archivers'] = {}
$.get Conf, Main.initFeatures $.get Conf, Main.initFeatures
$.on d, '4chanMainInit', Main.initStyle $.asap (-> d.head and $('link[rel="shortcut icon"]', d.head) or d.readyState in ['interactive', 'complete']),\
Main.initStyle
initFeatures: (items) -> initFeatures: (items) ->
Conf = items Conf = items
@ -126,7 +127,6 @@ Main =
$.ready Main.initReady $.ready Main.initReady
initStyle: -> initStyle: ->
$.off d, '4chanMainInit', Main.initStyle
return unless Main.isThisPageLegit() return unless Main.isThisPageLegit()
# disable the mobile layout # disable the mobile layout
$('link[href*=mobile]', d.head)?.disabled = true $('link[href*=mobile]', d.head)?.disabled = true

View File

@ -30,7 +30,8 @@ Unread =
for ID, post of Unread.thread.posts for ID, post of Unread.thread.posts
posts.push post if post.isReply posts.push post if post.isReply
Unread.addPosts posts Unread.addPosts posts
Unread.scroll() if Conf['Scroll to Last Read Post'] return unless Conf['Scroll to Last Read Post']
Unread.scroll()
scroll: -> scroll: ->
# Let the header's onload callback handle it. # Let the header's onload callback handle it.
@ -43,11 +44,15 @@ Unread =
break if prevID is post.ID break if prevID is post.ID
prevID = post.ID prevID = post.ID
break unless post.isHidden break unless post.isHidden
root.scrollIntoView false onload = -> root.scrollIntoView false
return else
# Scroll to the last read post. # Scroll to the last read post.
posts = Object.keys Unread.thread.posts posts = Object.keys Unread.thread.posts
Header.scrollToPost Unread.thread.posts[posts[posts.length - 1]].nodes.root post = Unread.thread.posts[posts[posts.length - 1]]
onload = -> Header.scrollToPost post.nodes.root
# Prevent the browser to scroll back to
# the previous scroll location on page load.
$.on window, 'load', onload
sync: -> sync: ->
lastReadPost = Unread.db.get lastReadPost = Unread.db.get

View File

@ -33,6 +33,21 @@ QuotePreview =
cb: QuotePreview.mouseout cb: QuotePreview.mouseout
asapTest: -> qp.firstElementChild asapTest: -> qp.firstElementChild
<% if (type === 'userjs') { %>
# XXX Opera workaround for "no mouseout fired" bug.
# Remove it once Opera uses Blink.
root = @
workaround = (e) ->
if @ is root
e.stopPropagation()
return
$.event 'mouseout', null, root
$.off d, 'mousemove', workaround
$.off root, 'mousemove', workaround
$.on d, 'mousemove', workaround
$.on root, 'mousemove', workaround
<% } %>
return unless origin = g.posts["#{boardID}.#{postID}"] return unless origin = g.posts["#{boardID}.#{postID}"]
if Conf['Quote Highlighting'] if Conf['Quote Highlighting']