From 43debdd3736216394c770819cdb828522ccac06e Mon Sep 17 00:00:00 2001 From: Desuwa Date: Sun, 5 Feb 2012 01:39:51 +0100 Subject: [PATCH] Remember the size of the QR on Firefox --- 4chan_x.user.js | 9 ++++++++- changelog | 2 ++ script.coffee | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 58309cfd8..385effc9c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -116,6 +116,7 @@ 'Cooldown': [true, 'Prevent "flood detected" errors.'], 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'], 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'], + 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'], 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'], 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR.'] @@ -1568,7 +1569,7 @@ } }, dialog: function() { - var e, fileInput, input, mimeTypes, name, spoiler, thread, threads, _i, _j, _len, _len2, _ref, _ref2; + var e, fileInput, input, mimeTypes, name, saved, spoiler, ta, thread, threads, _i, _j, _len, _len2, _ref, _ref2; qr.el = ui.dialog('qr', 'top:0;right:0;', '\
\ Quick Reply \ @@ -1584,6 +1585,12 @@ \
\ '); + if (conf['Remember QR size'] && engine === 'gecko') { + $.on((ta = qr.el.querySelector('textarea')), 'mouseup', function() { + return $.set('qr.size', this.style.cssText); + }); + if (saved = $.get('qr.size')) ta.style.cssText = saved; + } mimeTypes = $('.rules').textContent.match(/: (.+) /)[1].toLowerCase().replace(/\w+/g, function(type) { switch (type) { case 'jpg': diff --git a/changelog b/changelog index b08c04753..706d5e3b8 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- desuwa + Remember the size of the QR on Firefox. - Mayhem Increase Sauce linking possibilites: Thumbnails, full images, MD5 hashes. diff --git a/script.coffee b/script.coffee index 8994a342f..f963e7e41 100644 --- a/script.coffee +++ b/script.coffee @@ -36,6 +36,7 @@ config = 'Cooldown': [true, 'Prevent "flood detected" errors.'] 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'] 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'] + 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'] 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR.'] @@ -1178,6 +1179,12 @@ qr =
' + if conf['Remember QR size'] and engine is 'gecko' + $.on (ta = qr.el.querySelector 'textarea'), 'mouseup', -> + $.set 'qr.size', @style.cssText + if saved = $.get 'qr.size' + ta.style.cssText = saved + # Allow only this board's supported files. mimeTypes = $('.rules').textContent.match(/: (.+) /)[1].toLowerCase().replace /\w+/g, (type) -> switch type