diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 4d201ab3f..6ad1c4154 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -11537,33 +11537,31 @@ return $.asap((function() { return $('.mPagelist'); }), function() { - var next, nextA, nextAction, prev, prevA, prevAction; + var i, item, items; - prev = $(".pagelist > .prev"); - prevA = $.el('a', { - textContent: '<' - }); - next = $(".pagelist > .next"); - nextA = $.el('a', { - textContent: '>' - }); - if ((prevAction = prev.firstElementChild).nodeName === 'FORM') { - prevA.href = 'javascript:;'; - $.on(prevA, 'click', function() { - return prevAction.firstElementChild.click(); - }); + items = [['prev', '<'], ['next', '>']]; + i = 0; + while (item = items[i++]) { + Style.pages(item[0], item[1]); } - if ((nextAction = next.firstElementChild).nodeName === 'FORM') { - nextA.href = 'javascript:;'; - $.on(nextA, 'click', function() { - return nextAction.firstElementChild.click(); - }); - } - $.add(prev, prevA); - return $.add(next, nextA); }); } }, + pages: function(name, text) { + var action, el, elA; + + el = $(".pagelist > ." + name); + elA = $.el('a', { + textContent: text + }); + if ((action = prev.firstElementChild).nodeName === 'FORM') { + elA.href = 'javascript:;'; + $.on(elA, 'click', function() { + return action.firstElementChild.click(); + }); + } + return $.add(el, elA); + }, readyInit: function() { var exLink; diff --git a/builds/crx/script.js b/builds/crx/script.js index c33e8706e..008f2fe47 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -11525,33 +11525,31 @@ return $.asap((function() { return $('.mPagelist'); }), function() { - var next, nextA, nextAction, prev, prevA, prevAction; + var i, item, items; - prev = $(".pagelist > .prev"); - prevA = $.el('a', { - textContent: '<' - }); - next = $(".pagelist > .next"); - nextA = $.el('a', { - textContent: '>' - }); - if ((prevAction = prev.firstElementChild).nodeName === 'FORM') { - prevA.href = 'javascript:;'; - $.on(prevA, 'click', function() { - return prevAction.firstElementChild.click(); - }); + items = [['prev', '<'], ['next', '>']]; + i = 0; + while (item = items[i++]) { + Style.pages(item[0], item[1]); } - if ((nextAction = next.firstElementChild).nodeName === 'FORM') { - nextA.href = 'javascript:;'; - $.on(nextA, 'click', function() { - return nextAction.firstElementChild.click(); - }); - } - $.add(prev, prevA); - return $.add(next, nextA); }); } }, + pages: function(name, text) { + var action, el, elA; + + el = $(".pagelist > ." + name); + elA = $.el('a', { + textContent: text + }); + if ((action = prev.firstElementChild).nodeName === 'FORM') { + elA.href = 'javascript:;'; + $.on(elA, 'click', function() { + return action.firstElementChild.click(); + }); + } + return $.add(el, elA); + }, readyInit: function() { var exLink; diff --git a/src/Theming/Style.coffee b/src/Theming/Style.coffee index 10a2dbf20..2bb69f095 100644 --- a/src/Theming/Style.coffee +++ b/src/Theming/Style.coffee @@ -25,27 +25,26 @@ Style = if g.VIEW is 'index' $.asap (-> $ '.mPagelist'), -> + items = [ + ['prev', '<'] + ['next', '>'] + ] + i = 0 + while item = items[i++] + Style.pages item[0], item[1] + return - prev = $ ".pagelist > .prev" - prevA = $.el 'a', - textContent: '<' + pages: (name, text) -> + el = $ ".pagelist > .#{name}" + elA = $.el 'a', + textContent: text - next = $ ".pagelist > .next" - nextA = $.el 'a', - textContent: '>' + if (action = prev.firstElementChild).nodeName is 'FORM' + elA.href = 'javascript:;' + $.on elA, 'click', -> + action.firstElementChild.click() - if (prevAction = prev.firstElementChild).nodeName is 'FORM' - prevA.href = 'javascript:;' - $.on prevA, 'click', -> - prevAction.firstElementChild.click() - - if (nextAction = next.firstElementChild).nodeName is 'FORM' - nextA.href = 'javascript:;' - $.on nextA, 'click', -> - nextAction.firstElementChild.click() - - $.add prev, prevA - $.add next, nextA + $.add el, elA readyInit: -> Style.padding()