From ca9b0517def52bf023681004e62cd0b9be932572 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sat, 3 May 2014 01:09:35 -0700 Subject: [PATCH] Merge some changes from appchan. --- LICENSE | 2 +- builds/4chan-X.user.js | 24 ++++++++++++++---------- builds/crx/script.js | 24 ++++++++++++++---------- src/General/Main.coffee | 9 ++++++++- src/Miscellaneous/Banner.coffee | 14 ++++++-------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/LICENSE b/LICENSE index f79075c03..bc2416263 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.7.8 - 2014-04-20 +* 4chan X - Version 1.7.8 - 2014-05-03 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index da4ec0120..30f1b345a 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.7.8 - 2014-04-20 +* 4chan X - Version 1.7.8 - 2014-05-03 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -11049,20 +11049,19 @@ }); }, ready: function() { - var banner, child, children, i; + var banner, child, children, i, _i, _len; banner = $(".boardBanner"); children = banner.children; - i = 0; - while (child = children[i++]) { - if (i === 1) { + for (i = _i = 0, _len = children.length; _i < _len; i = ++_i) { + child = children[i]; + if (i === 0) { child.id = "Banner"; child.title = "Click to change"; - $.on(child, 'click', Banner.cb.toggle); + $.on(child, 'click error', Banner.cb.toggle); continue; } if (Conf['Custom Board Titles']) { - Banner.custom(child).title = "Ctrl+click to edit board " + (i === 3 ? 'sub' : '') + "title"; - child.spellcheck = false; + Banner.custom(child).title = "Ctrl+click to edit board " + (i === 2 ? 'sub' : '') + "title"; } } }, @@ -11071,14 +11070,14 @@ var types; types = { jpg: 227, - png: 270, + png: 262, gif: 253 }; return function() { var num, type; type = Object.keys(types)[Math.floor(3 * Math.random())]; num = Math.floor(types[type] * Math.random()); - return this.src = "//static.4chan.org/image/title/" + num + "." + type; + return this.src = "//s.4cdn.org/image/title/" + num + "." + type; }; })(), click: function(e) { @@ -13777,9 +13776,14 @@ return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'); }); $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]); + $('link[href*="yotsubluemobile.559.css"', d.head).disabled = true; } if (!Conf['JSON Navigation'] || g.VIEW === 'thread') { Main.initThread(); + $.add(d.head, $.el('link', { + href: "//s.4cdn.org/css/flags.556.css", + rel: "stylesheet" + })); } $.event('4chanXInitFinished'); test = $.el('span'); diff --git a/builds/crx/script.js b/builds/crx/script.js index 012e2cae5..7fab6db4d 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.7.8 - 2014-04-20 +* 4chan X - Version 1.7.8 - 2014-05-03 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -11063,20 +11063,19 @@ }); }, ready: function() { - var banner, child, children, i; + var banner, child, children, i, _i, _len; banner = $(".boardBanner"); children = banner.children; - i = 0; - while (child = children[i++]) { - if (i === 1) { + for (i = _i = 0, _len = children.length; _i < _len; i = ++_i) { + child = children[i]; + if (i === 0) { child.id = "Banner"; child.title = "Click to change"; - $.on(child, 'click', Banner.cb.toggle); + $.on(child, 'click error', Banner.cb.toggle); continue; } if (Conf['Custom Board Titles']) { - Banner.custom(child).title = "Ctrl+click to edit board " + (i === 3 ? 'sub' : '') + "title"; - child.spellcheck = false; + Banner.custom(child).title = "Ctrl+click to edit board " + (i === 2 ? 'sub' : '') + "title"; } } }, @@ -11085,14 +11084,14 @@ var types; types = { jpg: 227, - png: 270, + png: 262, gif: 253 }; return function() { var num, type; type = Object.keys(types)[Math.floor(3 * Math.random())]; num = Math.floor(types[type] * Math.random()); - return this.src = "//static.4chan.org/image/title/" + num + "." + type; + return this.src = "//s.4cdn.org/image/title/" + num + "." + type; }; })(), click: function(e) { @@ -13794,9 +13793,14 @@ return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'); }); $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]); + $('link[href*="yotsubluemobile.559.css"', d.head).disabled = true; } if (!Conf['JSON Navigation'] || g.VIEW === 'thread') { Main.initThread(); + $.add(d.head, $.el('link', { + href: "//s.4cdn.org/css/flags.556.css", + rel: "stylesheet" + })); } $.event('4chanXInitFinished'); try { diff --git a/src/General/Main.coffee b/src/General/Main.coffee index a3b716244..f4107bdac 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -190,10 +190,17 @@ Main = 'This will steal your data.' 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0' $.before styleSelector.previousSibling, [$.tn '['; passLink, $.tn ']\u00A0\u00A0'] + # Completely disable the mobile layout + $('link[href*="yotsubluemobile.559.css"', d.head).disabled = true # Parse HTML or skip it and start building from JSON. if !Conf['JSON Navigation'] or g.VIEW is 'thread' - Main.initThread() + Main.initThread() + + # JSON Navigation may not load on a page that has flags, so force their CSS to always be available. + $.add d.head, $.el 'link', + href: "//s.4cdn.org/css/flags.556.css" + rel: "stylesheet" $.event '4chanXInitFinished' diff --git a/src/Miscellaneous/Banner.coffee b/src/Miscellaneous/Banner.coffee index 95f64c9b6..121921580 100644 --- a/src/Miscellaneous/Banner.coffee +++ b/src/Miscellaneous/Banner.coffee @@ -7,21 +7,19 @@ Banner = banner = $ ".boardBanner" {children} = banner - i = 0 - while child = children[i++] - if i is 1 + for child, i in children + if i is 0 child.id = "Banner" child.title = "Click to change" - $.on child, 'click', Banner.cb.toggle + $.on child, 'click error', Banner.cb.toggle continue if Conf['Custom Board Titles'] - Banner.custom(child).title = "Ctrl+click to edit board #{if i is 3 + Banner.custom(child).title = "Ctrl+click to edit board #{if i is 2 'sub' else ''}title" - child.spellcheck = false return @@ -29,13 +27,13 @@ Banner = toggle: do -> types = jpg: 227 - png: 270 + png: 262 gif: 253 -> type = Object.keys(types)[Math.floor 3 * Math.random()] num = Math.floor types[type] * Math.random() - @src = "//static.4chan.org/image/title/#{num}.#{type}" + @src = "//s.4cdn.org/image/title/#{num}.#{type}" click: (e) -> if e.ctrlKey