diff --git a/CHANGELOG.md b/CHANGELOG.md index e513fbdf3..3c8aeccb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**seaweedchan**: +- Optimizations for the banner and board title code + ### v2.3.3 *2013-08-16* diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js new file mode 100755 index 000000000..31c6eae7e --- /dev/null +++ b/builds/4chan-X.meta.js @@ -0,0 +1,19 @@ +// ==UserScript== +// @name 4chan X +// @version 1.2.32 +// @namespace 4chan-X +// @description Cross-browser userscript for maximum lurking on 4chan. +// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE +// @match *://api.4chan.org/* +// @match *://boards.4chan.org/* +// @match *://images.4chan.org/* +// @match *://sys.4chan.org/* +// @grant GM_getValue +// @grant GM_setValue +// @grant GM_deleteValue +// @grant GM_openInTab +// @run-at document-start +// @updateURL https://github.com/seaweedchan/4chan-x/raw/stable/builds/4chan-X.meta.js +// @downloadURL https://github.com/seaweedchan/4chan-x/raw/stable/builds/4chan-X.user.js +// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC +// ==/UserScript== \ No newline at end of file diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index ddd4699bc..3cae44dd6 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -11078,18 +11078,22 @@ $.after(banner, title); }, cb: { - toggle: function() { - var num, type, types; + toggle: (function() { + var types; types = { jpg: 227, png: 270, gif: 253 }; - 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 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; + }; + })(), click: function(e) { if (e.ctrlKey) { this.contentEditable = true; diff --git a/builds/crx/script.js b/builds/crx/script.js index 52828e016..8e29492db 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -11070,18 +11070,22 @@ $.after(banner, title); }, cb: { - toggle: function() { - var num, type, types; + toggle: (function() { + var types; types = { jpg: 227, png: 270, gif: 253 }; - 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 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; + }; + })(), click: function(e) { if (e.ctrlKey) { this.contentEditable = true; diff --git a/src/Theming/Banner.coffee b/src/Theming/Banner.coffee index 5f4fb5cbf..169d0b5eb 100644 --- a/src/Theming/Banner.coffee +++ b/src/Theming/Banner.coffee @@ -30,15 +30,16 @@ Banner = return cb: - toggle: -> + toggle: do -> types = jpg: 227 png: 270 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}" + -> + type = Object.keys(types)[Math.floor 3 * Math.random()] + num = Math.floor types[type] * Math.random() + @src = "//static.4chan.org/image/title/#{num}.#{type}" click: (e) -> if e.ctrlKey @@ -88,5 +89,4 @@ Banner = else $.set string, cachedTest $.set string2, cachedTest - child \ No newline at end of file