Merge some changes from appchan.

This commit is contained in:
Zixaphir 2014-05-03 01:09:35 -07:00
parent 871d7820b7
commit ca9b0517de
5 changed files with 43 additions and 30 deletions

View File

@ -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. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE

View File

@ -24,7 +24,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.7.8 - 2014-04-20 * 4chan X - Version 1.7.8 - 2014-05-03
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -11049,20 +11049,19 @@
}); });
}, },
ready: function() { ready: function() {
var banner, child, children, i; var banner, child, children, i, _i, _len;
banner = $(".boardBanner"); banner = $(".boardBanner");
children = banner.children; children = banner.children;
i = 0; for (i = _i = 0, _len = children.length; _i < _len; i = ++_i) {
while (child = children[i++]) { child = children[i];
if (i === 1) { if (i === 0) {
child.id = "Banner"; child.id = "Banner";
child.title = "Click to change"; child.title = "Click to change";
$.on(child, 'click', Banner.cb.toggle); $.on(child, 'click error', Banner.cb.toggle);
continue; continue;
} }
if (Conf['Custom Board Titles']) { if (Conf['Custom Board Titles']) {
Banner.custom(child).title = "Ctrl+click to edit board " + (i === 3 ? 'sub' : '') + "title"; Banner.custom(child).title = "Ctrl+click to edit board " + (i === 2 ? 'sub' : '') + "title";
child.spellcheck = false;
} }
} }
}, },
@ -11071,14 +11070,14 @@
var types; var types;
types = { types = {
jpg: 227, jpg: 227,
png: 270, png: 262,
gif: 253 gif: 253
}; };
return function() { return function() {
var num, type; var num, type;
type = Object.keys(types)[Math.floor(3 * Math.random())]; type = Object.keys(types)[Math.floor(3 * Math.random())];
num = Math.floor(types[type] * 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) { 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'); 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')]); $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
$('link[href*="yotsubluemobile.559.css"', d.head).disabled = true;
} }
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') { if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
Main.initThread(); Main.initThread();
$.add(d.head, $.el('link', {
href: "//s.4cdn.org/css/flags.556.css",
rel: "stylesheet"
}));
} }
$.event('4chanXInitFinished'); $.event('4chanXInitFinished');
test = $.el('span'); test = $.el('span');

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // 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. * Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE * https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -11063,20 +11063,19 @@
}); });
}, },
ready: function() { ready: function() {
var banner, child, children, i; var banner, child, children, i, _i, _len;
banner = $(".boardBanner"); banner = $(".boardBanner");
children = banner.children; children = banner.children;
i = 0; for (i = _i = 0, _len = children.length; _i < _len; i = ++_i) {
while (child = children[i++]) { child = children[i];
if (i === 1) { if (i === 0) {
child.id = "Banner"; child.id = "Banner";
child.title = "Click to change"; child.title = "Click to change";
$.on(child, 'click', Banner.cb.toggle); $.on(child, 'click error', Banner.cb.toggle);
continue; continue;
} }
if (Conf['Custom Board Titles']) { if (Conf['Custom Board Titles']) {
Banner.custom(child).title = "Ctrl+click to edit board " + (i === 3 ? 'sub' : '') + "title"; Banner.custom(child).title = "Ctrl+click to edit board " + (i === 2 ? 'sub' : '') + "title";
child.spellcheck = false;
} }
} }
}, },
@ -11085,14 +11084,14 @@
var types; var types;
types = { types = {
jpg: 227, jpg: 227,
png: 270, png: 262,
gif: 253 gif: 253
}; };
return function() { return function() {
var num, type; var num, type;
type = Object.keys(types)[Math.floor(3 * Math.random())]; type = Object.keys(types)[Math.floor(3 * Math.random())];
num = Math.floor(types[type] * 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) { 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'); 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')]); $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
$('link[href*="yotsubluemobile.559.css"', d.head).disabled = true;
} }
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') { if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
Main.initThread(); Main.initThread();
$.add(d.head, $.el('link', {
href: "//s.4cdn.org/css/flags.556.css",
rel: "stylesheet"
}));
} }
$.event('4chanXInitFinished'); $.event('4chanXInitFinished');
try { try {

View File

@ -190,11 +190,18 @@ Main =
'This will steal your data.' 'This will steal your data.'
'left=0,top=0,width=500,height=255,toolbar=0,resizable=0' 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'
$.before styleSelector.previousSibling, [$.tn '['; passLink, $.tn ']\u00A0\u00A0'] $.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. # Parse HTML or skip it and start building from JSON.
if !Conf['JSON Navigation'] or g.VIEW is 'thread' 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' $.event '4chanXInitFinished'
<% if (type === 'userscript') { %> <% if (type === 'userscript') { %>

View File

@ -7,21 +7,19 @@ Banner =
banner = $ ".boardBanner" banner = $ ".boardBanner"
{children} = banner {children} = banner
i = 0 for child, i in children
while child = children[i++] if i is 0
if i is 1
child.id = "Banner" child.id = "Banner"
child.title = "Click to change" child.title = "Click to change"
$.on child, 'click', Banner.cb.toggle $.on child, 'click error', Banner.cb.toggle
continue continue
if Conf['Custom Board Titles'] 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' 'sub'
else else
''}title" ''}title"
child.spellcheck = false
return return
@ -29,13 +27,13 @@ Banner =
toggle: do -> toggle: do ->
types = types =
jpg: 227 jpg: 227
png: 270 png: 262
gif: 253 gif: 253
-> ->
type = Object.keys(types)[Math.floor 3 * Math.random()] type = Object.keys(types)[Math.floor 3 * Math.random()]
num = Math.floor types[type] * 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) -> click: (e) ->
if e.ctrlKey if e.ctrlKey