diff --git a/builds/4chan-X.js b/builds/4chan-X.js index fcc42e793..57c2b8855 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -4653,30 +4653,31 @@ return status.disabled = disabled || false; }, persona: { - name: [], - email: [], - sub: [], pwd: '', always: {}, init: function() { QR.persona.getPassword(); return $.get('QR.personas', Conf['QR.personas'], function(_arg) { - var item, personas, type, _i, _j, _len, _len1, _ref, _ref1; + var arr, item, personas, type, types, _i, _len, _ref; personas = _arg['QR.personas']; + types = { + name: [], + email: [], + sub: [] + }; _ref = personas.split('\n'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { item = _ref[_i]; - QR.persona.parseItem(item.trim()); + QR.persona.parseItem(item.trim(), types); } - _ref1 = ['name', 'email', 'sub']; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - type = _ref1[_j]; - QR.persona.loadPersonas(type); + for (type in types) { + arr = types[type]; + QR.persona.loadPersonas(type, arr); } }); }, - parseItem: function(item) { + parseItem: function(item, types) { var boards, match, type, val, _ref, _ref1, _ref2; if (item[0] === '#') { @@ -4701,17 +4702,16 @@ if (/always/i.test(item)) { QR.persona.always[type] = val; } - if (__indexOf.call(QR.persona[type], val) < 0) { - return QR.persona[type].push(val); + if (__indexOf.call(types[type], val) < 0) { + return types[type].push(val); } }, - loadPersonas: function(type) { - var list, val, _i, _len, _ref; + loadPersonas: function(type, arr) { + var list, val, _i, _len; list = $("#list-" + type, QR.nodes.el); - _ref = QR.persona[type]; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - val = _ref[_i]; + for (_i = 0, _len = arr.length; _i < _len; _i++) { + val = arr[_i]; $.add(list, $.el('option', { textContent: val })); diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 186efab94..c65efc99a 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -4649,30 +4649,31 @@ return status.disabled = disabled || false; }, persona: { - name: [], - email: [], - sub: [], pwd: '', always: {}, init: function() { QR.persona.getPassword(); return $.get('QR.personas', Conf['QR.personas'], function(_arg) { - var item, personas, type, _i, _j, _len, _len1, _ref, _ref1; + var arr, item, personas, type, types, _i, _len, _ref; personas = _arg['QR.personas']; + types = { + name: [], + email: [], + sub: [] + }; _ref = personas.split('\n'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { item = _ref[_i]; - QR.persona.parseItem(item.trim()); + QR.persona.parseItem(item.trim(), types); } - _ref1 = ['name', 'email', 'sub']; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - type = _ref1[_j]; - QR.persona.loadPersonas(type); + for (type in types) { + arr = types[type]; + QR.persona.loadPersonas(type, arr); } }); }, - parseItem: function(item) { + parseItem: function(item, types) { var boards, match, type, val, _ref, _ref1, _ref2; if (item[0] === '#') { @@ -4697,17 +4698,16 @@ if (/always/i.test(item)) { QR.persona.always[type] = val; } - if (__indexOf.call(QR.persona[type], val) < 0) { - return QR.persona[type].push(val); + if (__indexOf.call(types[type], val) < 0) { + return types[type].push(val); } }, - loadPersonas: function(type) { - var list, val, _i, _len, _ref; + loadPersonas: function(type, arr) { + var list, val, _i, _len; list = $("#list-" + type, QR.nodes.el); - _ref = QR.persona[type]; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - val = _ref[_i]; + for (_i = 0, _len = arr.length; _i < _len; _i++) { + val = arr[_i]; $.add(list, $.el('option', { textContent: val })); diff --git a/builds/crx/script.js b/builds/crx/script.js index fb450a981..77638a2ba 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4652,30 +4652,31 @@ return status.disabled = disabled || false; }, persona: { - name: [], - email: [], - sub: [], pwd: '', always: {}, init: function() { QR.persona.getPassword(); return $.get('QR.personas', Conf['QR.personas'], function(_arg) { - var item, personas, type, _i, _j, _len, _len1, _ref, _ref1; + var arr, item, personas, type, types, _i, _len, _ref; personas = _arg['QR.personas']; + types = { + name: [], + email: [], + sub: [] + }; _ref = personas.split('\n'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { item = _ref[_i]; - QR.persona.parseItem(item.trim()); + QR.persona.parseItem(item.trim(), types); } - _ref1 = ['name', 'email', 'sub']; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - type = _ref1[_j]; - QR.persona.loadPersonas(type); + for (type in types) { + arr = types[type]; + QR.persona.loadPersonas(type, arr); } }); }, - parseItem: function(item) { + parseItem: function(item, types) { var boards, match, type, val, _ref, _ref1, _ref2; if (item[0] === '#') { @@ -4700,17 +4701,16 @@ if (/always/i.test(item)) { QR.persona.always[type] = val; } - if (__indexOf.call(QR.persona[type], val) < 0) { - return QR.persona[type].push(val); + if (__indexOf.call(types[type], val) < 0) { + return types[type].push(val); } }, - loadPersonas: function(type) { - var list, val, _i, _len, _ref; + loadPersonas: function(type, arr) { + var list, val, _i, _len; list = $("#list-" + type, QR.nodes.el); - _ref = QR.persona[type]; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - val = _ref[_i]; + for (_i = 0, _len = arr.length; _i < _len; _i++) { + val = arr[_i]; $.add(list, $.el('option', { textContent: val })); diff --git a/src/Posting/QuickReply.coffee b/src/Posting/QuickReply.coffee index 34ac287ad..2400b82f3 100644 --- a/src/Posting/QuickReply.coffee +++ b/src/Posting/QuickReply.coffee @@ -158,20 +158,21 @@ QR = status.disabled = disabled or false persona: - name: [] - email: [] - sub: [] pwd: '' always: {} init: -> QR.persona.getPassword() $.get 'QR.personas', Conf['QR.personas'], ({'QR.personas': personas}) -> + types = + name: [] + email: [] + sub: [] for item in personas.split '\n' - QR.persona.parseItem item.trim() - for type in ['name', 'email', 'sub'] - QR.persona.loadPersonas type + QR.persona.parseItem item.trim(), types + for type, arr of types + QR.persona.loadPersonas type, arr return - parseItem: (item) -> + parseItem: (item, types) -> return if item[0] is '#' return unless match = item.match /(name|email|subject|password):"(.*)"/i [match, type, val] = match @@ -192,11 +193,11 @@ QR = if /always/i.test item QR.persona.always[type] = val - unless val in QR.persona[type] - QR.persona[type].push val - loadPersonas: (type) -> + unless val in types[type] + types[type].push val + loadPersonas: (type, arr) -> list = $ "#list-#{type}", QR.nodes.el - for val in QR.persona[type] + for val in arr $.add list, $.el 'option', textContent: val return