From 283d5c2944550e5828a61a26674f21de4f7acec7 Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Mon, 26 Mar 2012 11:12:56 -0500 Subject: [PATCH 1/6] Fix $.open in firefox. --- 4chan_x.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index d18824f69..044ef2d64 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -439,7 +439,7 @@ } }, open: function(url) { - return (GM_openInTab || window.open)(url, '_blank'); + return (GM_openInTab || window.open)(location.protocol + url, '_blank'); }, isDST: function() { /* From 03a24e399e21dc771def84f3ff763f5d48f1ef59 Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Tue, 27 Mar 2012 04:18:06 -0500 Subject: [PATCH 2/6] Move $.open by rest of the GM_ functions. Coffeescript. --- 4chan_x.user.js | 9 ++++++--- script.coffee | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 044ef2d64..232a417bb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -438,9 +438,6 @@ el.removeEventListener(event, handler, false); } }, - open: function(url) { - return (GM_openInTab || window.open)(location.protocol + url, '_blank'); - }, isDST: function() { /* http://en.wikipedia.org/wiki/Eastern_Time_Zone @@ -496,6 +493,9 @@ return defaultValue; } }, + open: function(url) { + return GM_openInTab(location.protocol + url); + }, set: function(name, value) { name = Main.namespace + name; localStorage.setItem(name, JSON.stringify(value)); @@ -515,6 +515,9 @@ }, set: function(name, value) { return localStorage.setItem(Main.namespace + name, JSON.stringify(value)); + }, + open: function(url) { + return window.open(location.protocol + url, '_blank'); } }); diff --git a/script.coffee b/script.coffee index b34d48329..b936d8b8c 100644 --- a/script.coffee +++ b/script.coffee @@ -347,8 +347,6 @@ $.extend $, for event in events.split ' ' el.removeEventListener event, handler, false return - open: (url) -> - (GM_openInTab or window.open) url, '_blank' isDST: -> ### http://en.wikipedia.org/wiki/Eastern_Time_Zone @@ -420,6 +418,8 @@ $.extend $, JSON.parse value else defaultValue + open: (url) -> + GM_openInTab location.protocol + url set: (name, value) -> name = Main.namespace + name # for `storage` events @@ -435,6 +435,8 @@ $.extend $, defaultValue set: (name, value) -> localStorage.setItem Main.namespace + name, JSON.stringify value + open: (url) -> + window.open location.protocol + url, '_blank' $$ = (selector, root=d.body) -> Array::slice.call root.querySelectorAll selector From 9c6c8f20bb74bf15009350751e591d4104d7d508 Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Mon, 7 May 2012 00:38:49 -0500 Subject: [PATCH 3/6] Fix mimetypes on certain boards (/w/). --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 48149a363..f2859efd6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1854,7 +1854,7 @@ return "image/" + type; } }); - QR.mimeTypes = mimeTypes.split(', '); + QR.mimeTypes = mimeTypes.replace(/\s+/g, '').split(','); QR.mimeTypes.push(''); fileInput = $('[type=file]', QR.el); fileInput.max = $('[name=MAX_FILE_SIZE]').value; diff --git a/script.coffee b/script.coffee index 36db6c35b..1bec8dac8 100644 --- a/script.coffee +++ b/script.coffee @@ -1415,7 +1415,7 @@ QR = 'application/pdf' else "image/#{type}" - QR.mimeTypes = mimeTypes.split ', ' + QR.mimeTypes = mimeTypes.replace(/\s+/g, '').split ',' # Add empty mimeType to avoid errors with URLs selected in Window's file dialog. QR.mimeTypes.push '' fileInput = $ '[type=file]', QR.el From 894d5d879045d53651d4c44337fb4adff187fc6b Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Mon, 7 May 2012 00:46:36 -0500 Subject: [PATCH 4/6] Revert. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index f2859efd6..48149a363 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1854,7 +1854,7 @@ return "image/" + type; } }); - QR.mimeTypes = mimeTypes.replace(/\s+/g, '').split(','); + QR.mimeTypes = mimeTypes.split(', '); QR.mimeTypes.push(''); fileInput = $('[type=file]', QR.el); fileInput.max = $('[name=MAX_FILE_SIZE]').value; diff --git a/script.coffee b/script.coffee index 1bec8dac8..36db6c35b 100644 --- a/script.coffee +++ b/script.coffee @@ -1415,7 +1415,7 @@ QR = 'application/pdf' else "image/#{type}" - QR.mimeTypes = mimeTypes.replace(/\s+/g, '').split ',' + QR.mimeTypes = mimeTypes.split ', ' # Add empty mimeType to avoid errors with URLs selected in Window's file dialog. QR.mimeTypes.push '' fileInput = $ '[type=file]', QR.el From 6750437071f93d71d4d667b535cfa5ce32d5716d Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Wed, 9 May 2012 03:37:31 -0500 Subject: [PATCH 5/6] Revert 'Move $.open by rest of the GM_ functions. Coffeescript.' --- 4chan_x.user.js | 9 +++------ script.coffee | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 48149a363..bbbccf8d6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -450,6 +450,9 @@ el.removeEventListener(event, handler, false); } }, + open: function(url) { + return (GM_openInTab || window.open)(location.protocol + url, '_blank'); + }, isDST: function() { /* http://en.wikipedia.org/wiki/Eastern_Time_Zone @@ -518,9 +521,6 @@ return defaultValue; } }, - open: function(url) { - return GM_openInTab(location.protocol + url); - }, set: function(name, value) { name = Main.namespace + name; localStorage.setItem(name, JSON.stringify(value)); @@ -540,9 +540,6 @@ }, set: function(name, value) { return localStorage.setItem(Main.namespace + name, JSON.stringify(value)); - }, - open: function(url) { - return window.open(location.protocol + url, '_blank'); } }); diff --git a/script.coffee b/script.coffee index 36db6c35b..022c8f4ef 100644 --- a/script.coffee +++ b/script.coffee @@ -347,6 +347,8 @@ $.extend $, for event in events.split ' ' el.removeEventListener event, handler, false return + open: (url) -> + (GM_openInTab or window.open) url, '_blank' isDST: -> ### http://en.wikipedia.org/wiki/Eastern_Time_Zone @@ -418,8 +420,6 @@ $.extend $, JSON.parse value else defaultValue - open: (url) -> - GM_openInTab location.protocol + url set: (name, value) -> name = Main.namespace + name # for `storage` events @@ -435,8 +435,6 @@ $.extend $, defaultValue set: (name, value) -> localStorage.setItem Main.namespace + name, JSON.stringify value - open: (url) -> - window.open location.protocol + url, '_blank' $$ = (selector, root=d.body) -> Array::slice.call root.querySelectorAll selector From 21c2d6fdaa567f7eb73c451fbeb5ff717d7e391b Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Wed, 9 May 2012 03:44:56 -0500 Subject: [PATCH 6/6] Coffeescript. --- script.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.coffee b/script.coffee index 022c8f4ef..6ba243117 100644 --- a/script.coffee +++ b/script.coffee @@ -348,7 +348,7 @@ $.extend $, el.removeEventListener event, handler, false return open: (url) -> - (GM_openInTab or window.open) url, '_blank' + (GM_openInTab or window.open) location.protocol + url, '_blank' isDST: -> ### http://en.wikipedia.org/wiki/Eastern_Time_Zone