From 25a3c3aeede4e0c58d3ff7364c9662e0f74efba2 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 13 Sep 2014 00:59:02 -0700 Subject: [PATCH 1/3] remove duplicate Persistent QR code --- src/Posting/QR.coffee | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 4c6d2b8c1..6afcb6711 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -29,12 +29,6 @@ QR = $.on d, '4chanXInitFinished', @initReady - if Conf['Persistent QR'] - unless g.BOARD.ID is 'f' and g.VIEW is 'index' - $.on d, '4chanXInitFinished', @persist - else - $.ready @persist - Post.callbacks.push name: 'Quick Reply' cb: @node @@ -94,11 +88,6 @@ QR = node: -> $.on $('a[title="Reply to this post"]', @nodes.info), 'click', QR.quote - persist: -> - return unless QR.postingIsEnabled - QR.open() - QR.hide() if Conf['Auto Hide QR'] or g.VIEW is 'catalog' - open: -> if QR.nodes QR.nodes.el.hidden = false From 13283aac62aaafc75940853d556ca31ab78c0f1d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 13 Sep 2014 03:13:35 -0700 Subject: [PATCH 2/3] avoid using exceptions; was annoying when debugging --- src/Posting/QR.coffee | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 6afcb6711..453dfcda9 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -442,15 +442,12 @@ QR = setNode 'fileInput', '[type=file]' rules = $('ul.rules').textContent.trim() - QR.min_width = QR.min_height = 1 - QR.max_width = QR.max_height = 10000 - try - [_, QR.min_width, QR.min_height] = rules.match(/.+smaller than (\d+)x(\d+).+/) - [_, QR.max_width, QR.max_height] = rules.match(/.+greater than (\d+)x(\d+).+/) - for prop in ['min_width', 'min_height', 'max_width', 'max_height'] - QR[prop] = parseInt QR[prop], 10 - catch - null + match_min = rules.match(/.+smaller than (\d+)x(\d+).+/) + match_max = rules.match(/.+greater than (\d+)x(\d+).+/) + QR.min_width = +match_min?[1] or 1 + QR.min_height = +match_min?[2] or 1 + QR.max_width = +match_max?[1] or 10000 + QR.max_height = +match_max?[2] or 10000 nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value From 4011f4b8a961f566147799f11f924391857a8c6f Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 13 Sep 2014 11:00:46 -0700 Subject: [PATCH 3/3] add beta/dev to userscript names so beta/developement versions can be installed alongside stable --- Gruntfile.coffee | 12 ++++++++++-- package.json | 11 +++++++++-- src/General/meta/metadata.js | 6 +++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index a5c74fd04..0ae0aa899 100755 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -103,7 +103,9 @@ module.exports = (grunt) -> src: '*' dest: 'builds/' expand: true - filter: 'isFile' + filter: (src) -> + pkg = grunt.config 'pkg' + grunt.file.isFile(src) and src isnt "testbuilds/#{pkg.name}#{pkg.meta.suffix.dev}.user.js" coffee: script: @@ -186,7 +188,11 @@ module.exports = (grunt) -> builds: 'builds' testbuilds: 'testbuilds' tmpcrx: ['tmp-crx', 'testbuilds/updates<%= pkg.meta.suffix.noupdate %>.xml'] - tmpuserscript: ['tmp-userscript', 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix.noupdate %>.meta.js'] + tmpuserscript: [ + 'tmp-userscript', + 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix.noupdate %>.meta.js', + 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix.dev %>.meta.js' + ] require('load-grunt-tasks') grunt @@ -253,6 +259,8 @@ module.exports = (grunt) -> 'concat:userscript' 'set-channel:noupdate' 'concat:userscript' + 'set-channel:dev' + 'concat:userscript' 'clean:tmpuserscript' ] diff --git a/package.json b/package.json index 6dbc26a3c..e4458a0b5 100755 --- a/package.json +++ b/package.json @@ -20,7 +20,14 @@ "suffix": { "stable": "", "beta": "-beta", - "noupdate": "-noupdate" + "noupdate": "-noupdate", + "dev": "-dev" + }, + "namesuffix": { + "stable": "", + "beta": " beta", + "noupdate": "", + "dev": " dev" }, "min": { "chrome": "31", @@ -57,4 +64,4 @@ "engines": { "node": ">=0.10" } -} \ No newline at end of file +} diff --git a/src/General/meta/metadata.js b/src/General/meta/metadata.js index cb7629f76..86d508a62 100755 --- a/src/General/meta/metadata.js +++ b/src/General/meta/metadata.js @@ -1,5 +1,5 @@ // ==UserScript== -// @name <%= meta.name %> +// @name <%= meta.name %><%= meta.namesuffix[channel] %> // @version <%= meta.version %> // @minGMVer <%= meta.min.greasemonkey %> // @minFFVer <%= meta.min.firefox %> @@ -18,7 +18,7 @@ // @grant GM_openInTab // @grant GM_xmlhttpRequest // @run-at document-start -<% if (channel !== 'noupdate') { %>// @updateURL <%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.meta.js +<% if (channel !== 'dev') { %><% if (channel !== 'noupdate') { %>// @updateURL <%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.meta.js <% } %>// @downloadURL <%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.user.js -// @icon data:image/png;base64,<%= grunt.file.read('src/General/img/icon48.png', {encoding: 'base64'}) %> +<% } %>// @icon data:image/png;base64,<%= grunt.file.read('src/General/img/icon48.png', {encoding: 'base64'}) %> // ==/UserScript==