Banner.cb.toggle()

Because sometimes you get that one banner you don't want.
This commit is contained in:
Zixaphir 2013-08-09 00:05:39 -07:00
parent dbc8e21297
commit 1451c8691b
4 changed files with 40 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* appchan x - Version 2.2.2 - 2013-08-08
* appchan x - Version 2.2.2 - 2013-08-09
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -18,7 +18,7 @@
// ==/UserScript==
/*
* appchan x - Version 2.2.2 - 2013-08-08
* appchan x - Version 2.2.2 - 2013-08-09
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -10629,6 +10629,7 @@
child = children[i];
if (child.tagName.toLowerCase() === "img") {
child.id = "Banner";
$.on(child, 'click', Banner.cb.toggle);
continue;
}
if (Conf['Custom Board Titles']) {
@ -10639,7 +10640,19 @@
$.add(title, nodes.reverse());
$.after(banner, title);
},
types: {
jpg: 227,
png: 270,
gif: 253
},
cb: {
toggle: function() {
var num, type;
type = ['jpg', 'png', 'gif'][Math.floor(3 * Math.random())];
num = Math.floor(Banner.types[type] * Math.random());
return this.src = "//static.4chan.org/image/title/" + num + "." + type;
},
click: function(e) {
if (e.shiftKey) {
return this.contentEditable = true;

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* appchan x - Version 2.2.2 - 2013-08-08
* appchan x - Version 2.2.2 - 2013-08-09
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -10617,6 +10617,7 @@
child = children[i];
if (child.tagName.toLowerCase() === "img") {
child.id = "Banner";
$.on(child, 'click', Banner.cb.toggle);
continue;
}
if (Conf['Custom Board Titles']) {
@ -10627,7 +10628,19 @@
$.add(title, nodes.reverse());
$.after(banner, title);
},
types: {
jpg: 227,
png: 270,
gif: 253
},
cb: {
toggle: function() {
var num, type;
type = ['jpg', 'png', 'gif'][Math.floor(3 * Math.random())];
num = Math.floor(Banner.types[type] * Math.random());
return this.src = "//static.4chan.org/image/title/" + num + "." + type;
},
click: function(e) {
if (e.shiftKey) {
return this.contentEditable = true;

View File

@ -14,6 +14,7 @@ Banner =
child = children[i]
if child.tagName.toLowerCase() is "img"
child.id = "Banner"
$.on child, 'click', Banner.cb.toggle
continue
if Conf['Custom Board Titles']
@ -25,7 +26,17 @@ Banner =
$.after banner, title
return
types:
jpg: 227
png: 270
gif: 253
cb:
toggle: ->
type = ['jpg', 'png', 'gif'][Math.floor 3 * Math.random()]
num = Math.floor Banner.types[type] * Math.random()
@src = "//static.4chan.org/image/title/#{num}.#{type}"
click: (e) ->
if e.shiftKey
@contentEditable = true