diff --git a/4chan_x.user.js b/4chan_x.user.js index 2a03c818f..6c5a446fc 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1281,7 +1281,16 @@ return $.addClass(qr.el, 'dump'); }, dialog: function() { - var input, mimeTypes, name, _ref; + var input, mimeTypes, name, thread, threads, _i, _len, _ref, _ref2; + if (!g.REPLY) { + threads = 'New thread'; + _ref = $$('.op'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + thread = _ref[_i]; + threads += "Thread " + thread.id; + } + threads = "" + threads + ""; + } mimeTypes = $('.rules').textContent.toLowerCase().match(/: (.+)/)[1].replace(/\w+/g, function(type) { switch (type) { case 'jpg': @@ -1293,7 +1302,12 @@ } }); qr.mimeTypes = mimeTypes.split(', '); - qr.el = ui.dialog('qr', 'top:0;right:0;', " Quick Reply ⨯ "); + qr.el = ui.dialog('qr', 'top:0;right:0;', " Quick Reply " + threads + " ⨯ "); + if (!g.REPLY) { + $.on($('select', qr.el), 'mousedown', function(e) { + return e.stopPropagation(); + }); + } $.on($('#autohide', qr.el), 'click', qr.hide); $.on($('.close', qr.el), 'click', qr.close); $.on($('#dump', qr.el), 'click', function() { @@ -1305,9 +1319,9 @@ email: $('[name=email]', qr.el) }; if (conf['Remember Subject']) qr.inputs.subject = $('[name=subject]', qr.el); - _ref = qr.inputs; - for (name in _ref) { - input = _ref[name]; + _ref2 = qr.inputs; + for (name in _ref2) { + input = _ref2[name]; input.value = $.get("qr_" + name, null); } $.on(window, 'storage', function(e) { diff --git a/script.coffee b/script.coffee index eb2f9da95..db9294b23 100644 --- a/script.coffee +++ b/script.coffee @@ -944,7 +944,13 @@ qr = $.addClass qr.el, 'dump' dialog: -> - # chose only allowed files + # create a new thread or select thread to reply to + unless g.REPLY + threads = 'New thread' + for thread in $$ '.op' + threads += "Thread #{thread.id}" + threads = "#{threads}" + # chose only supported files mimeTypes = $('.rules').textContent.toLowerCase().match(/: (.+)/)[1].replace /\w+/g, (type) -> switch type when 'jpg' @@ -961,7 +967,10 @@ qr = } #qr > .move { min-width: 300px; - text-align: right; + overflow: hidden; +} +#qr > .move > span { + float: right; } #qr > form { margin: 0; @@ -1034,9 +1043,8 @@ textarea.field { - Quick Reply - - ⨯ + Quick Reply #{threads} + ⨯ @@ -1047,10 +1055,12 @@ textarea.field { " - $.on $('#autohide', qr.el), 'click', qr.hide - $.on $('.close', qr.el), 'click', qr.close - $.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump' - $.on $('form', qr.el), 'submit', qr.submit + unless g.REPLY + $.on $('select', qr.el), 'mousedown', (e) -> e.stopPropagation() + $.on $('#autohide', qr.el), 'click', qr.hide + $.on $('.close', qr.el), 'click', qr.close + $.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump' + $.on $('form', qr.el), 'submit', qr.submit # save & load inputs' value with localStorage qr.inputs =