diff --git a/4chan_x.user.js b/4chan_x.user.js index 6a3487b9c..a77833e17 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2540,6 +2540,19 @@ Options = { init: function() { + if (!$.get('firstrun')) { + $.set('firstrun', true); + localStorage.setItem('4chan-settings', '{"disableAll":true}'); + $.ready(function() { + if (!Favicon.el) { + Favicon.init(); + } + return Options.dialog(); + }); + } + return $.ready(Options.initReady); + }, + initReady: function() { var a, settings, _i, _len, _ref; _ref = ['navtopright', 'navbotright']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -2552,13 +2565,6 @@ $.on(a, 'click', Options.dialog); $.prepend($.id(settings), [$.tn('['), a, $.tn('] ')]); } - if (!$.get('firstrun')) { - if (!Favicon.el) { - Favicon.init(); - } - $.set('firstrun', true); - return Options.dialog(); - } }, dialog: function() { var arr, back, checked, description, dialog, favicon, fileInfo, filter, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, sauce, time, tr, ul, _i, _len, _ref, _ref1, _ref2; @@ -4972,7 +4978,7 @@ }); return; } - $.ready(Options.init); + Options.init(); if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) { Main.css += '#postForm { display: none; }'; } diff --git a/script.coffee b/script.coffee index b15acea03..9aba6b73a 100644 --- a/script.coffee +++ b/script.coffee @@ -1995,6 +1995,15 @@ QR = Options = init: -> + unless $.get 'firstrun' + $.set 'firstrun', true + localStorage.setItem '4chan-settings', '{"disableAll":true}' + $.ready -> + # Prevent race conditions + Favicon.init() unless Favicon.el + Options.dialog() + $.ready Options.initReady + initReady: -> for settings in ['navtopright', 'navbotright'] a = $.el 'a', href: 'javascript:;' @@ -2002,12 +2011,7 @@ Options = textContent: '4chan X Settings' $.on a, 'click', Options.dialog $.prepend $.id(settings), [$.tn('['), a, $.tn('] ')] - unless $.get 'firstrun' - # Prevent race conditions - Favicon.init() unless Favicon.el - $.set 'firstrun', true - Options.dialog() - localStorage.setItem '4chan-settings', '{"disableAll":true}' + return dialog: -> dialog = $.el 'div' @@ -3872,7 +3876,7 @@ Main = location.href = url if url return - $.ready Options.init + Options.init() if Conf['Quick Reply'] and Conf['Hide Original Post Form'] Main.css += '#postForm { display: none; }'