diff --git a/LICENSE b/LICENSE
index 57a02b06c..3a3500b90 100755
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
/*
-* 4chan X - Version 1.2.35 - 2013-08-23
+* 4chan X - Version 1.2.35 - 2013-08-24
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index ecee35ed1..bea587717 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -22,7 +22,7 @@
// ==/UserScript==
/*
-* 4chan X - Version 1.2.35 - 2013-08-23
+* 4chan X - Version 1.2.35 - 2013-08-24
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@@ -161,7 +161,8 @@
'Replace PNG': [false, 'Replace pngs.'],
'Replace JPG': [false, 'Replace jpgs.'],
'Image Prefetching': [false, 'Preload images'],
- 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*']
+ 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'],
+ 'Werk Tyme': [false, 'Hide all post images.']
},
'Menu': {
'Menu': [true, 'Add a drop-down menu to posts.'],
@@ -287,7 +288,9 @@
'Update': ['r', 'Update the thread now.'],
'Expand image': ['Shift+e', 'Expand selected image.'],
'Expand images': ['e', 'Expand all images.'],
+ 'Open Gallery': ['g', 'Opens the gallery.'],
'fappeTyme': ['f', 'Fappe Tyme.'],
+ 'werkTyme': ['Shift+w', 'Werk Tyme'],
'Front page': ['0', 'Jump to page 0.'],
'Open front page': ['Shift+0', 'Open page 0 in a new tab.'],
'Next page': ['Shift+Right', 'Jump to the next page.'],
@@ -6455,20 +6458,35 @@
init: function() {
var el, input;
- if (!Conf['Fappe Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
+ if (!(Conf['Fappe Tyme'] || Conf['Werk Tyme']) || g.VIEW === 'catalog' || g.BOARD === 'f') {
return;
}
- el = $.el('label', {
- innerHTML: " Fappe Tyme",
- title: 'Fappe Tyme'
- });
- FappeTyme.input = input = el.firstElementChild;
- $.on(input, 'change', FappeTyme.toggle);
- $.event('AddMenuEntry', {
- type: 'header',
- el: el,
- order: 97
- });
+ if (Conf['Fappe Tyme']) {
+ el = $.el('label', {
+ innerHTML: " Fappe Tyme",
+ title: 'Fappe Tyme'
+ });
+ FappeTyme.fappe = input = el.firstElementChild;
+ $.on(input, 'change', FappeTyme.cb.fappe);
+ $.event('AddMenuEntry', {
+ type: 'header',
+ el: el,
+ order: 97
+ });
+ }
+ if (Conf['Werk Tyme']) {
+ el = $.el('label', {
+ innerHTML: " Werk Tyme",
+ title: 'Werk Tyme'
+ });
+ FappeTyme.werk = input = el.firstElementChild;
+ $.on(input, 'change', FappeTyme.cb.werk);
+ $.event('AddMenuEntry', {
+ type: 'header',
+ el: el,
+ order: 98
+ });
+ }
return Post.prototype.callbacks.push({
name: 'Fappe Tyme',
cb: this.node
@@ -6480,9 +6498,15 @@
}
return $.addClass(this.nodes.root, "noFile");
},
- toggle: function() {
- $.event('CloseMenu');
- return (this.checked ? $.addClass : $.rmClass)(doc, 'fappeTyme');
+ cb: {
+ fappe: function() {
+ $.toggleClass(doc, 'fappeTyme');
+ return FappeTyme.fappe.checked = $.hasClass(doc, 'fappeTyme');
+ },
+ werk: function() {
+ $.toggleClass(doc, 'werkTyme');
+ return FappeTyme.werk.checked = $.hasClass(doc, 'werkTyme');
+ }
}
};
@@ -9357,36 +9381,40 @@
});
},
node: function() {
- var str, uid;
+ var rgb, span, style, uid;
- if (this.isClone || !(str = this.info.uniqueID)) {
+ if (this.isClone || !(uid = this.info.uniqueID)) {
return;
}
- uid = $('.hand', this.nodes.uniqueID);
- if (!(uid && uid.nodeName === 'SPAN')) {
+ span = $('.hand', this.nodes.uniqueID);
+ if (!(span && span.nodeName === 'SPAN')) {
return;
}
- return uid.style.cssText = IDColor.css(IDColor.ids[str] || IDColor.compute(str));
+ rgb = IDColor.compute(uid);
+ style = span.style;
+ style.color = rgb[3];
+ style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
+ $.addClass(span, painted);
+ return span.title = 'Highlight posts by this ID';
},
- compute: function(str) {
+ compute: function(uid) {
var hash, rgb;
- hash = IDColor.hash(str);
+ if (IDColor.ids[uid]) {
+ return IDColor.ids[uid];
+ }
+ hash = IDColor.hash(uid);
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
- rgb[3] = ((rgb[0] * 0.299) + (rgb[1] * 0.587) + (rgb[2] * 0.114)) > 125;
- this.ids[str] = rgb;
- return rgb;
+ rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
+ return this.ids[uid] = rgb;
},
- css: function(rgb) {
- return "background-color: rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "); color: " + (rgb[3] ? "#000" : "#fff") + "; border-radius: 3px; padding: 0px 2px;";
- },
- hash: function(str) {
+ hash: function(uid) {
var i, msg;
msg = 0;
i = 0;
while (i < 8) {
- msg = ((msg << 5) - msg) + str.charCodeAt(i++);
+ msg = (msg << 5) - msg + uid.charCodeAt(i++);
}
return msg;
}
@@ -10026,11 +10054,14 @@
case Conf['Expand images']:
Keybinds.img(threadRoot, true);
break;
+ case Conf['Open Gallery']:
+ Gallery.cb.toggle();
+ break;
case Conf['fappeTyme']:
- if (!$('#menu.left')) {
- Header.menuButton.click();
- }
- FappeTyme.input.click();
+ FappeTyme.cb.fappe();
+ break;
+ case Conf['werkTyme']:
+ FappeTyme.cb.werk();
break;
case Conf['Front page']:
window.location = "/" + g.BOARD + "/0#delform";
diff --git a/builds/crx/script.js b/builds/crx/script.js
index 005a488f2..4c8d4bc44 100644
--- a/builds/crx/script.js
+++ b/builds/crx/script.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
-* 4chan X - Version 1.2.35 - 2013-08-23
+* 4chan X - Version 1.2.35 - 2013-08-24
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@@ -140,7 +140,8 @@
'Replace PNG': [false, 'Replace pngs.'],
'Replace JPG': [false, 'Replace jpgs.'],
'Image Prefetching': [false, 'Preload images'],
- 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*']
+ 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'],
+ 'Werk Tyme': [false, 'Hide all post images.']
},
'Menu': {
'Menu': [true, 'Add a drop-down menu to posts.'],
@@ -266,7 +267,9 @@
'Update': ['r', 'Update the thread now.'],
'Expand image': ['Shift+e', 'Expand selected image.'],
'Expand images': ['e', 'Expand all images.'],
+ 'Open Gallery': ['g', 'Opens the gallery.'],
'fappeTyme': ['f', 'Fappe Tyme.'],
+ 'werkTyme': ['Shift+w', 'Werk Tyme'],
'Front page': ['0', 'Jump to page 0.'],
'Open front page': ['Shift+0', 'Open page 0 in a new tab.'],
'Next page': ['Shift+Right', 'Jump to the next page.'],
@@ -6440,20 +6443,35 @@
init: function() {
var el, input;
- if (!Conf['Fappe Tyme'] || g.VIEW === 'catalog' || g.BOARD === 'f') {
+ if (!(Conf['Fappe Tyme'] || Conf['Werk Tyme']) || g.VIEW === 'catalog' || g.BOARD === 'f') {
return;
}
- el = $.el('label', {
- innerHTML: " Fappe Tyme",
- title: 'Fappe Tyme'
- });
- FappeTyme.input = input = el.firstElementChild;
- $.on(input, 'change', FappeTyme.toggle);
- $.event('AddMenuEntry', {
- type: 'header',
- el: el,
- order: 97
- });
+ if (Conf['Fappe Tyme']) {
+ el = $.el('label', {
+ innerHTML: " Fappe Tyme",
+ title: 'Fappe Tyme'
+ });
+ FappeTyme.fappe = input = el.firstElementChild;
+ $.on(input, 'change', FappeTyme.cb.fappe);
+ $.event('AddMenuEntry', {
+ type: 'header',
+ el: el,
+ order: 97
+ });
+ }
+ if (Conf['Werk Tyme']) {
+ el = $.el('label', {
+ innerHTML: " Werk Tyme",
+ title: 'Werk Tyme'
+ });
+ FappeTyme.werk = input = el.firstElementChild;
+ $.on(input, 'change', FappeTyme.cb.werk);
+ $.event('AddMenuEntry', {
+ type: 'header',
+ el: el,
+ order: 98
+ });
+ }
return Post.prototype.callbacks.push({
name: 'Fappe Tyme',
cb: this.node
@@ -6465,9 +6483,15 @@
}
return $.addClass(this.nodes.root, "noFile");
},
- toggle: function() {
- $.event('CloseMenu');
- return (this.checked ? $.addClass : $.rmClass)(doc, 'fappeTyme');
+ cb: {
+ fappe: function() {
+ $.toggleClass(doc, 'fappeTyme');
+ return FappeTyme.fappe.checked = $.hasClass(doc, 'fappeTyme');
+ },
+ werk: function() {
+ $.toggleClass(doc, 'werkTyme');
+ return FappeTyme.werk.checked = $.hasClass(doc, 'werkTyme');
+ }
}
};
@@ -9348,36 +9372,40 @@
});
},
node: function() {
- var str, uid;
+ var rgb, span, style, uid;
- if (this.isClone || !(str = this.info.uniqueID)) {
+ if (this.isClone || !(uid = this.info.uniqueID)) {
return;
}
- uid = $('.hand', this.nodes.uniqueID);
- if (!(uid && uid.nodeName === 'SPAN')) {
+ span = $('.hand', this.nodes.uniqueID);
+ if (!(span && span.nodeName === 'SPAN')) {
return;
}
- return uid.style.cssText = IDColor.css(IDColor.ids[str] || IDColor.compute(str));
+ rgb = IDColor.compute(uid);
+ style = span.style;
+ style.color = rgb[3];
+ style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
+ $.addClass(span, painted);
+ return span.title = 'Highlight posts by this ID';
},
- compute: function(str) {
+ compute: function(uid) {
var hash, rgb;
- hash = IDColor.hash(str);
+ if (IDColor.ids[uid]) {
+ return IDColor.ids[uid];
+ }
+ hash = IDColor.hash(uid);
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
- rgb[3] = ((rgb[0] * 0.299) + (rgb[1] * 0.587) + (rgb[2] * 0.114)) > 125;
- this.ids[str] = rgb;
- return rgb;
+ rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
+ return this.ids[uid] = rgb;
},
- css: function(rgb) {
- return "background-color: rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "); color: " + (rgb[3] ? "#000" : "#fff") + "; border-radius: 3px; padding: 0px 2px;";
- },
- hash: function(str) {
+ hash: function(uid) {
var i, msg;
msg = 0;
i = 0;
while (i < 8) {
- msg = ((msg << 5) - msg) + str.charCodeAt(i++);
+ msg = (msg << 5) - msg + uid.charCodeAt(i++);
}
return msg;
}
@@ -10017,11 +10045,14 @@
case Conf['Expand images']:
Keybinds.img(threadRoot, true);
break;
+ case Conf['Open Gallery']:
+ Gallery.cb.toggle();
+ break;
case Conf['fappeTyme']:
- if (!$('#menu.left')) {
- Header.menuButton.click();
- }
- FappeTyme.input.click();
+ FappeTyme.cb.fappe();
+ break;
+ case Conf['werkTyme']:
+ FappeTyme.cb.werk();
break;
case Conf['Front page']:
window.location = "/" + g.BOARD + "/0#delform";
diff --git a/src/General/Config.coffee b/src/General/Config.coffee
index 9ec2d716c..aa393ab8a 100755
--- a/src/General/Config.coffee
+++ b/src/General/Config.coffee
@@ -179,6 +179,10 @@ Config =
false
'Hide posts without images. *hint* *hint*'
]
+ 'Werk Tyme': [
+ false
+ 'Hide all post images.'
+ ]
'Menu':
'Menu': [
@@ -604,10 +608,18 @@ q-replace
'e'
'Expand all images.'
]
+ 'Open Gallery': [
+ 'g'
+ 'Opens the gallery.'
+ ]
'fappeTyme': [
'f'
'Fappe Tyme.'
]
+ 'werkTyme': [
+ 'Shift+w'
+ 'Werk Tyme'
+ ]
# Board Navigation
'Front page': [
'0'
diff --git a/src/Images/FappeTyme.coffee b/src/Images/FappeTyme.coffee
index 20f51caee..304eb2e03 100755
--- a/src/Images/FappeTyme.coffee
+++ b/src/Images/FappeTyme.coffee
@@ -1,18 +1,34 @@
FappeTyme =
init: ->
- return if !Conf['Fappe Tyme'] or g.VIEW is 'catalog' or g.BOARD is 'f'
- el = $.el 'label',
- innerHTML: " Fappe Tyme"
- title: 'Fappe Tyme'
-
- FappeTyme.input = input = el.firstElementChild
+ return if !(Conf['Fappe Tyme'] or Conf['Werk Tyme']) or g.VIEW is 'catalog' or g.BOARD is 'f'
- $.on input, 'change', FappeTyme.toggle
+ if Conf['Fappe Tyme']
+ el = $.el 'label',
+ innerHTML: " Fappe Tyme"
+ title: 'Fappe Tyme'
- $.event 'AddMenuEntry',
- type: 'header'
- el: el
- order: 97
+ FappeTyme.fappe = input = el.firstElementChild
+
+ $.on input, 'change', FappeTyme.cb.fappe
+
+ $.event 'AddMenuEntry',
+ type: 'header'
+ el: el
+ order: 97
+
+ if Conf['Werk Tyme']
+ el = $.el 'label',
+ innerHTML: " Werk Tyme"
+ title: 'Werk Tyme'
+
+ FappeTyme.werk = input = el.firstElementChild
+
+ $.on input, 'change', FappeTyme.cb.werk
+
+ $.event 'AddMenuEntry',
+ type: 'header'
+ el: el
+ order: 98
Post::callbacks.push
name: 'Fappe Tyme'
@@ -22,6 +38,10 @@ FappeTyme =
return if @file
$.addClass @nodes.root, "noFile"
- toggle: ->
- $.event 'CloseMenu'
- (if @checked then $.addClass else $.rmClass) doc, 'fappeTyme'
\ No newline at end of file
+ cb:
+ fappe: ->
+ $.toggleClass doc, 'fappeTyme'
+ FappeTyme.fappe.checked = $.hasClass doc, 'fappeTyme'
+ werk: ->
+ $.toggleClass doc, 'werkTyme'
+ FappeTyme.werk.checked = $.hasClass doc, 'werkTyme'
\ No newline at end of file
diff --git a/src/Miscellaneous/ColorUserIDs.coffee b/src/Miscellaneous/ColorUserIDs.coffee
index bfe7ea0f5..0726a9681 100755
--- a/src/Miscellaneous/ColorUserIDs.coffee
+++ b/src/Miscellaneous/ColorUserIDs.coffee
@@ -1,7 +1,6 @@
IDColor =
init: ->
- return if g.VIEW is 'catalog' or !Conf['Color User IDs']
-
+ return if g.VIEW is 'catalog' or not Conf['Color User IDs']
@ids = {}
Post::callbacks.push
@@ -9,30 +8,34 @@ IDColor =
cb: @node
node: ->
- return if @isClone or not str = @info.uniqueID
- uid = $ '.hand', @nodes.uniqueID
- return unless uid and uid.nodeName is 'SPAN'
- uid.style.cssText = IDColor.css IDColor.ids[str] or IDColor.compute str
+ return if @isClone or not uid = @info.uniqueID
+ span = $ '.hand', @nodes.uniqueID
+ return unless span and span.nodeName is 'SPAN'
+ rgb = IDColor.compute uid
+ {style} = span
+ style.color = rgb[3]
+ style.backgroundColor = "rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]})"
+ $.addClass span, painted
+ span.title = 'Highlight posts by this ID'
- compute: (str) ->
- hash = IDColor.hash str
+ compute: (uid) ->
+ return IDColor.ids[uid] if IDColor.ids[uid]
+ hash = IDColor.hash uid
rgb = [
(hash >> 24) & 0xFF
(hash >> 16) & 0xFF
- (hash >> 8) & 0xFF
+ (hash >> 8) & 0xFF
]
+ rgb[3] = if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
+ '#000'
+ else
+ '#fff'
+ @ids[uid] = rgb
- rgb[3] = ((rgb[0] * 0.299) + (rgb[1] * 0.587) + (rgb[2] * 0.114)) > 125
-
- @ids[str] = rgb
- rgb
-
- css: (rgb) -> "background-color: rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]}); color: #{if rgb[3] then "#000" else "#fff"}; border-radius: 3px; padding: 0px 2px;"
-
- hash: (str) ->
+ hash: (uid) ->
msg = 0
i = 0
while i < 8
- msg = ((msg << 5) - msg) + str.charCodeAt i++
- msg
+ msg = (msg << 5) - msg + uid.charCodeAt i++
+ msg
\ No newline at end of file
diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee
index e52c46e0b..932f019f1 100755
--- a/src/Miscellaneous/Keybinds.coffee
+++ b/src/Miscellaneous/Keybinds.coffee
@@ -69,10 +69,12 @@ Keybinds =
Keybinds.img threadRoot
when Conf['Expand images']
Keybinds.img threadRoot, true
+ when Conf['Open Gallery']
+ Gallery.cb.toggle()
when Conf['fappeTyme']
- unless $('#menu.left')
- Header.menuButton.click()
- FappeTyme.input.click()
+ FappeTyme.cb.fappe()
+ when Conf['werkTyme']
+ FappeTyme.cb.werk()
# Board Navigation
when Conf['Front page']
window.location = "/#{g.BOARD}/0#delform"