Actually disable 4chan's inline extension on first-run before it had the time to execute.

This commit is contained in:
Nicolas Stepien 2012-09-08 17:22:15 +02:00
parent 614972640a
commit 5469bdf664
2 changed files with 25 additions and 15 deletions

View File

@ -2540,6 +2540,19 @@
Options = { Options = {
init: function() { 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; var a, settings, _i, _len, _ref;
_ref = ['navtopright', 'navbotright']; _ref = ['navtopright', 'navbotright'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -2552,13 +2565,6 @@
$.on(a, 'click', Options.dialog); $.on(a, 'click', Options.dialog);
$.prepend($.id(settings), [$.tn('['), a, $.tn('] ')]); $.prepend($.id(settings), [$.tn('['), a, $.tn('] ')]);
} }
if (!$.get('firstrun')) {
if (!Favicon.el) {
Favicon.init();
}
$.set('firstrun', true);
return Options.dialog();
}
}, },
dialog: function() { 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; 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; return;
} }
$.ready(Options.init); Options.init();
if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) { if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) {
Main.css += '#postForm { display: none; }'; Main.css += '#postForm { display: none; }';
} }

View File

@ -1995,6 +1995,15 @@ QR =
Options = Options =
init: -> 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'] for settings in ['navtopright', 'navbotright']
a = $.el 'a', a = $.el 'a',
href: 'javascript:;' href: 'javascript:;'
@ -2002,12 +2011,7 @@ Options =
textContent: '4chan X Settings' textContent: '4chan X Settings'
$.on a, 'click', Options.dialog $.on a, 'click', Options.dialog
$.prepend $.id(settings), [$.tn('['), a, $.tn('] ')] $.prepend $.id(settings), [$.tn('['), a, $.tn('] ')]
unless $.get 'firstrun' return
# Prevent race conditions
Favicon.init() unless Favicon.el
$.set 'firstrun', true
Options.dialog()
localStorage.setItem '4chan-settings', '{"disableAll":true}'
dialog: -> dialog: ->
dialog = $.el 'div' dialog = $.el 'div'
@ -3872,7 +3876,7 @@ Main =
location.href = url if url location.href = url if url
return return
$.ready Options.init Options.init()
if Conf['Quick Reply'] and Conf['Hide Original Post Form'] if Conf['Quick Reply'] and Conf['Hide Original Post Form']
Main.css += '#postForm { display: none; }' Main.css += '#postForm { display: none; }'