diff --git a/builds/4chan-X.js b/builds/4chan-X.js
index 78515abe7..bb6ee1054 100644
--- a/builds/4chan-X.js
+++ b/builds/4chan-X.js
@@ -250,7 +250,7 @@
},
boardnav: '[ toggle-all ] [current-title]',
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',
backlink: '>>%id',
@@ -1518,7 +1518,9 @@
return;
}
$.asap((function() {
- return $.id('boardNavMobile') || d.readyState === 'complete';
+ var _ref;
+
+ return $.id('boardNavMobile') || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Header.setBoardList);
$.prepend(d.body, _this.bar);
$.add(d.body, Header.hover);
@@ -1822,7 +1824,7 @@
o.file = {
name: data.filename + 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,
width: data.w,
MD5: data.md5,
@@ -1842,11 +1844,11 @@
@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;
isOP = postID === threadID;
- staticPath = '//static.4chan.org';
+ staticPath = '//static.4chan.org/image/';
if (email) {
emailStart = '';
emailEnd = '';
@@ -1861,26 +1863,26 @@
case 'admin_highlight':
capcodeClass = " capcodeAdmin";
capcodeStart = " ## Admin";
- capcode = ("
";
+ capcode = ("
";
break;
case 'mod':
capcodeClass = " capcodeMod";
capcodeStart = " ## Mod";
- capcode = ("
";
+ capcode = ("
";
break;
case 'developer':
capcodeClass = " capcodeDeveloper";
capcodeStart = " ## Developer";
- capcode = ("
";
+ capcode = ("
";
break;
default:
capcodeClass = '';
capcodeStart = '';
capcode = '';
}
- flag = flagCode ? ("
") : '';
+ flag = flagCode ? ("
") : '';
if (file != null ? file.isDeleted : void 0) {
- fileHTML = isOP ? ("
") + ("
") + " " : ("") + ("
") + " ";
+ fileHtml = isOP ? ("") + ("
") + " " : ("") + ("
") + " ";
} else if (file) {
ext = file.name.slice(-3);
if (!file.twidth && !file.theight && ext === 'gif') {
@@ -1892,7 +1894,7 @@
if (file.isSpoiler) {
fileSize = "Spoiler Image, " + fileSize;
if (!isArchived) {
- fileThumb = '//static.4chan.org/image/spoiler';
+ fileThumb = "" + staticPath + "spoiler";
if (spoilerRange = Build.spoilerRange[boardID]) {
fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random());
}
@@ -1900,9 +1902,7 @@
file.twidth = file.theight = 100;
}
}
- if (boardID.ID !== 'f') {
- imgSrc = ("") + ("
");
- }
+ imgSrc = boardID === 'f' ? '' : ("") + ("
") + "";
a = $.el('a', {
innerHTML: file.name
});
@@ -1918,8 +1918,8 @@
fileHTML = '';
}
tripcode = tripcode ? " " + tripcode + "" : '';
- sticky = isSticky ? '
' : '';
- closed = isClosed ? '
' : '';
+ sticky = isSticky ? "
" : '';
+ closed = isClosed ? "
" : '';
container = $.el('div', {
id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
@@ -3863,7 +3863,7 @@
}
},
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')) {
return;
@@ -3885,6 +3885,18 @@
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])) {
return;
}
@@ -7511,12 +7523,13 @@
}
}
Unread.addPosts(posts);
- if (Conf['Scroll to Last Read Post']) {
- return Unread.scroll();
+ if (!Conf['Scroll to Last Read Post']) {
+ return;
}
+ return Unread.scroll();
},
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) {
return;
@@ -7533,11 +7546,17 @@
break;
}
}
- root.scrollIntoView(false);
- return;
+ onload = function() {
+ 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 Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
+ return $.on(window, 'load', onload);
},
sync: function() {
var lastReadPost;
@@ -9881,7 +9900,11 @@
}
Conf['archivers'] = {};
$.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) {
var init, pathname;
@@ -10000,7 +10023,6 @@
initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
- $.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit()) {
return;
}
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index 840966155..3d0049811 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -251,7 +251,7 @@
},
boardnav: '[ toggle-all ] [current-title]',
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',
backlink: '>>%id',
@@ -1514,7 +1514,9 @@
return;
}
$.asap((function() {
- return $.id('boardNavMobile') || d.readyState === 'complete';
+ var _ref;
+
+ return $.id('boardNavMobile') || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Header.setBoardList);
$.prepend(d.body, _this.bar);
$.add(d.body, Header.hover);
@@ -1818,7 +1820,7 @@
o.file = {
name: data.filename + 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,
width: data.w,
MD5: data.md5,
@@ -1838,11 +1840,11 @@
@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;
isOP = postID === threadID;
- staticPath = '//static.4chan.org';
+ staticPath = '//static.4chan.org/image/';
if (email) {
emailStart = '';
emailEnd = '';
@@ -1857,26 +1859,26 @@
case 'admin_highlight':
capcodeClass = " capcodeAdmin";
capcodeStart = " ## Admin";
- capcode = ("
";
+ capcode = ("
";
break;
case 'mod':
capcodeClass = " capcodeMod";
capcodeStart = " ## Mod";
- capcode = ("
";
+ capcode = ("
";
break;
case 'developer':
capcodeClass = " capcodeDeveloper";
capcodeStart = " ## Developer";
- capcode = ("
";
+ capcode = ("
";
break;
default:
capcodeClass = '';
capcodeStart = '';
capcode = '';
}
- flag = flagCode ? ("
") : '';
+ flag = flagCode ? ("
") : '';
if (file != null ? file.isDeleted : void 0) {
- fileHTML = isOP ? ("") + ("
") + " " : ("") + ("
") + " ";
+ fileHtml = isOP ? ("") + ("
") + " " : ("") + ("
") + " ";
} else if (file) {
ext = file.name.slice(-3);
if (!file.twidth && !file.theight && ext === 'gif') {
@@ -1888,7 +1890,7 @@
if (file.isSpoiler) {
fileSize = "Spoiler Image, " + fileSize;
if (!isArchived) {
- fileThumb = '//static.4chan.org/image/spoiler';
+ fileThumb = "" + staticPath + "spoiler";
if (spoilerRange = Build.spoilerRange[boardID]) {
fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random());
}
@@ -1896,9 +1898,7 @@
file.twidth = file.theight = 100;
}
}
- if (boardID.ID !== 'f') {
- imgSrc = ("") + ("
");
- }
+ imgSrc = boardID === 'f' ? '' : ("") + ("
") + "";
a = $.el('a', {
innerHTML: file.name
});
@@ -1914,8 +1914,8 @@
fileHTML = '';
}
tripcode = tripcode ? " " + tripcode + "" : '';
- sticky = isSticky ? '
' : '';
- closed = isClosed ? '
' : '';
+ sticky = isSticky ? "
" : '';
+ closed = isClosed ? "
" : '';
container = $.el('div', {
id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
@@ -7532,12 +7532,13 @@
}
}
Unread.addPosts(posts);
- if (Conf['Scroll to Last Read Post']) {
- return Unread.scroll();
+ if (!Conf['Scroll to Last Read Post']) {
+ return;
}
+ return Unread.scroll();
},
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) {
return;
@@ -7554,11 +7555,17 @@
break;
}
}
- root.scrollIntoView(false);
- return;
+ onload = function() {
+ 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 Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
+ return $.on(window, 'load', onload);
},
sync: function() {
var lastReadPost;
@@ -9904,7 +9911,11 @@
}
Conf['archivers'] = {};
$.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) {
var init, pathname;
@@ -10023,7 +10034,6 @@
initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
- $.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit()) {
return;
}
diff --git a/builds/crx/script.js b/builds/crx/script.js
index 5c8f56b3c..e9928ecff 100644
--- a/builds/crx/script.js
+++ b/builds/crx/script.js
@@ -233,7 +233,7 @@
},
boardnav: '[ toggle-all ] [current-title]',
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',
backlink: '>>%id',
@@ -1517,7 +1517,9 @@
return;
}
$.asap((function() {
- return $.id('boardNavMobile') || d.readyState === 'complete';
+ var _ref;
+
+ return $.id('boardNavMobile') || ((_ref = d.readyState) === 'interactive' || _ref === 'complete');
}), Header.setBoardList);
$.prepend(d.body, _this.bar);
$.add(d.body, Header.hover);
@@ -1821,7 +1823,7 @@
o.file = {
name: data.filename + 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,
width: data.w,
MD5: data.md5,
@@ -1841,11 +1843,11 @@
@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;
isOP = postID === threadID;
- staticPath = '//static.4chan.org';
+ staticPath = '//static.4chan.org/image/';
if (email) {
emailStart = '';
emailEnd = '';
@@ -1860,26 +1862,26 @@
case 'admin_highlight':
capcodeClass = " capcodeAdmin";
capcodeStart = " ## Admin";
- capcode = ("
";
+ capcode = ("
";
break;
case 'mod':
capcodeClass = " capcodeMod";
capcodeStart = " ## Mod";
- capcode = ("
";
+ capcode = ("
";
break;
case 'developer':
capcodeClass = " capcodeDeveloper";
capcodeStart = " ## Developer";
- capcode = ("
";
+ capcode = ("
";
break;
default:
capcodeClass = '';
capcodeStart = '';
capcode = '';
}
- flag = flagCode ? ("
") : '';
+ flag = flagCode ? ("
") : '';
if (file != null ? file.isDeleted : void 0) {
- fileHTML = isOP ? ("") + ("
") + " " : ("") + ("
") + " ";
+ fileHtml = isOP ? ("") + ("
") + " " : ("") + ("
") + " ";
} else if (file) {
ext = file.name.slice(-3);
if (!file.twidth && !file.theight && ext === 'gif') {
@@ -1891,7 +1893,7 @@
if (file.isSpoiler) {
fileSize = "Spoiler Image, " + fileSize;
if (!isArchived) {
- fileThumb = '//static.4chan.org/image/spoiler';
+ fileThumb = "" + staticPath + "spoiler";
if (spoilerRange = Build.spoilerRange[boardID]) {
fileThumb += ("-" + boardID) + Math.floor(1 + spoilerRange * Math.random());
}
@@ -1899,9 +1901,7 @@
file.twidth = file.theight = 100;
}
}
- if (boardID.ID !== 'f') {
- imgSrc = ("") + ("
");
- }
+ imgSrc = boardID === 'f' ? '' : ("") + ("
") + "";
a = $.el('a', {
innerHTML: file.name
});
@@ -1917,8 +1917,8 @@
fileHTML = '';
}
tripcode = tripcode ? " " + tripcode + "" : '';
- sticky = isSticky ? '
' : '';
- closed = isClosed ? '
' : '';
+ sticky = isSticky ? "
" : '';
+ closed = isClosed ? "
" : '';
container = $.el('div', {
id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
@@ -7511,12 +7511,13 @@
}
}
Unread.addPosts(posts);
- if (Conf['Scroll to Last Read Post']) {
- return Unread.scroll();
+ if (!Conf['Scroll to Last Read Post']) {
+ return;
}
+ return Unread.scroll();
},
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) {
return;
@@ -7533,11 +7534,17 @@
break;
}
}
- root.scrollIntoView(false);
- return;
+ onload = function() {
+ 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 Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
+ return $.on(window, 'load', onload);
},
sync: function() {
var lastReadPost;
@@ -9886,7 +9893,11 @@
}
Conf['archivers'] = {};
$.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) {
var init, pathname;
@@ -10005,7 +10016,6 @@
initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
- $.off(d, '4chanMainInit', Main.initStyle);
if (!Main.isThisPageLegit()) {
return;
}
diff --git a/package.json b/package.json
index bfc9fd9c5..11c95ce9a 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
"grunt-contrib-compress": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
- "grunt-contrib-watch": "~0.4.0",
+ "grunt-contrib-watch": "~0.4.1",
"grunt-shell": "~0.2.2"
},
"repository": {
@@ -44,6 +44,6 @@
"license": "MIT",
"readmeFilename": "README.md",
"engines": {
- "node": ">=0.8"
+ "node": ">=0.10"
}
}
diff --git a/src/General/Build.coffee b/src/General/Build.coffee
index 0506515fd..1f14e7107 100644
--- a/src/General/Build.coffee
+++ b/src/General/Build.coffee
@@ -35,7 +35,10 @@ Build =
o.file =
name: data.filename + 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
width: data.w
MD5: data.md5
@@ -60,7 +63,7 @@ Build =
} = o
isOP = postID is threadID
- staticPath = '//static.4chan.org'
+ staticPath = '//static.4chan.org/image/'
if email
emailStart = ''
@@ -83,21 +86,21 @@ Build =
capcodeClass = " capcodeAdmin"
capcodeStart = " ## Admin"
- capcode = "
"
when 'mod'
capcodeClass = " capcodeMod"
capcodeStart = " ## Mod"
- capcode = "
"
when 'developer'
capcodeClass = " capcodeDeveloper"
capcodeStart = " ## Developer"
- capcode = "
"
else
@@ -107,21 +110,20 @@ Build =
flag =
if flagCode
- "
"
else
''
if file?.isDeleted
- fileHTML =
- if isOP
- "" +
- "
" +
- " "
- else
- "" +
- "
" +
- " "
+ fileHtml = if isOP
+ "" +
+ "
" +
+ " "
+ else
+ "" +
+ "
" +
+ " "
else if file
ext = file.name[-3..]
if !file.twidth and !file.theight and ext is 'gif' # wtf ?
@@ -134,16 +136,19 @@ Build =
if file.isSpoiler
fileSize = "Spoiler Image, #{fileSize}"
unless isArchived
- fileThumb = '//static.4chan.org/image/spoiler'
+ fileThumb = "#{staticPath}spoiler"
if spoilerRange = Build.spoilerRange[boardID]
# Randomize the spoiler image.
fileThumb += "-#{boardID}" + Math.floor 1 + spoilerRange * Math.random()
fileThumb += '.png'
file.twidth = file.theight = 100
- if boardID.ID isnt 'f'
- imgSrc = "" +
- "
"
+ imgSrc = if boardID is 'f'
+ ''
+ else
+ "" +
+ "
" +
+ ""
# Ha ha, filenames!
# html -> text, translate WebKit's %22s into "s
@@ -179,12 +184,12 @@ Build =
sticky =
if isSticky
- '
'
+ "
"
else
''
closed =
if isClosed
- '
'
+ "
"
else
''
@@ -249,4 +254,4 @@ Build =
continue if href[0] is '/' # Cross-board quote, or board link
quote.href = "/#{boardID}/res/#{href}" # Fix pathnames
- container
\ No newline at end of file
+ container
diff --git a/src/General/Config.coffee b/src/General/Config.coffee
index 6bcc5ae49..e529fa2d2 100644
--- a/src/General/Config.coffee
+++ b/src/General/Config.coffee
@@ -451,9 +451,9 @@ http://iqdb.org/?url=%TURL
boardnav: '[ toggle-all ] [current-title]'
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'
diff --git a/src/General/Header.coffee b/src/General/Header.coffee
index 0b9b5ba0c..81873e61e 100644
--- a/src/General/Header.coffee
+++ b/src/General/Header.coffee
@@ -70,7 +70,7 @@ Header =
return unless Main.isThisPageLegit()
# Wait for #boardNavMobile instead of #boardNavDesktop,
# 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
$.add d.body, Header.hover
@setBarPosition Conf['Bottom Header']
diff --git a/src/General/Main.coffee b/src/General/Main.coffee
index 55e982eb9..a057f03e0 100644
--- a/src/General/Main.coffee
+++ b/src/General/Main.coffee
@@ -17,7 +17,8 @@ Main =
Conf['archivers'] = {}
$.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) ->
Conf = items
@@ -126,7 +127,6 @@ Main =
$.ready Main.initReady
initStyle: ->
- $.off d, '4chanMainInit', Main.initStyle
return unless Main.isThisPageLegit()
# disable the mobile layout
$('link[href*=mobile]', d.head)?.disabled = true
diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee
index 0d322e4b1..75415b7e5 100644
--- a/src/Monitoring/Unread.coffee
+++ b/src/Monitoring/Unread.coffee
@@ -30,7 +30,8 @@ Unread =
for ID, post of Unread.thread.posts
posts.push post if post.isReply
Unread.addPosts posts
- Unread.scroll() if Conf['Scroll to Last Read Post']
+ return unless Conf['Scroll to Last Read Post']
+ Unread.scroll()
scroll: ->
# Let the header's onload callback handle it.
@@ -43,11 +44,15 @@ Unread =
break if prevID is post.ID
prevID = post.ID
break unless post.isHidden
- root.scrollIntoView false
- return
- # Scroll to the last read post.
- posts = Object.keys Unread.thread.posts
- Header.scrollToPost Unread.thread.posts[posts[posts.length - 1]].nodes.root
+ onload = -> root.scrollIntoView false
+ else
+ # Scroll to the last read post.
+ posts = Object.keys Unread.thread.posts
+ 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: ->
lastReadPost = Unread.db.get
diff --git a/src/Quotelinks/QuotePreview.coffee b/src/Quotelinks/QuotePreview.coffee
index 4cbe40e27..8301f623b 100644
--- a/src/Quotelinks/QuotePreview.coffee
+++ b/src/Quotelinks/QuotePreview.coffee
@@ -33,6 +33,21 @@ QuotePreview =
cb: QuotePreview.mouseout
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}"]
if Conf['Quote Highlighting']
@@ -60,4 +75,4 @@ QuotePreview =
return unless Conf['Quote Highlighting']
for post in [post].concat post.clones
$.rmClass post.nodes.post, 'qphl'
- return
\ No newline at end of file
+ return