Fix #329
This commit is contained in:
parent
82d43423c5
commit
44f83a756a
@ -14394,7 +14394,7 @@
|
||||
|
||||
Settings = {
|
||||
init: function() {
|
||||
var el, settings;
|
||||
var addSection, check, el, key, settings, value, _ref;
|
||||
|
||||
el = $.el('a', {
|
||||
className: 'settings-link',
|
||||
@ -14431,24 +14431,37 @@
|
||||
}
|
||||
return $.set('previousversion', g.VERSION);
|
||||
});
|
||||
Settings.addSection('Style', Settings.style);
|
||||
Settings.addSection('Themes', Settings.themes);
|
||||
Settings.addSection('Mascots', Settings.mascots);
|
||||
Settings.addSection('Script', Settings.main);
|
||||
Settings.addSection('Filter', Settings.filter);
|
||||
Settings.addSection('Sauce', Settings.sauce);
|
||||
Settings.addSection('Advanced', Settings.advanced);
|
||||
Settings.addSection('Keybinds', Settings.keybinds);
|
||||
addSection = Settings.addSection;
|
||||
_ref = {
|
||||
'style': 'Style',
|
||||
'themes': 'Themes',
|
||||
'mascots': 'Mascots',
|
||||
'main': 'Script',
|
||||
'filter': 'Filter',
|
||||
'sauce': 'Sauce',
|
||||
'advanced': 'Advanced',
|
||||
'keybinds': 'Keybinds'
|
||||
};
|
||||
for (key in _ref) {
|
||||
value = _ref[key];
|
||||
addSection(value, Settings[key]);
|
||||
}
|
||||
$.on(d, 'AddSettingsSection', Settings.addSection);
|
||||
$.on(d, 'OpenSettings', function(e) {
|
||||
return Settings.open(e.detail);
|
||||
});
|
||||
settings = JSON.parse(localStorage.getItem('4chan-settings')) || {};
|
||||
if (settings.disableAll) {
|
||||
return;
|
||||
if (!settings.disableAll) {
|
||||
settings.disableAll = true;
|
||||
check = true;
|
||||
}
|
||||
if (settings.keyBinds) {
|
||||
settings.keyBinds = false;
|
||||
check = true;
|
||||
}
|
||||
if (check) {
|
||||
return localStorage.setItem('4chan-settings', JSON.stringify(settings));
|
||||
}
|
||||
settings.disableAll = true;
|
||||
return localStorage.setItem('4chan-settings', JSON.stringify(settings));
|
||||
},
|
||||
open: function(openSection) {
|
||||
var dialog, link, links, overlay, section, sectionToOpen, _i, _len, _ref;
|
||||
|
||||
@ -14388,7 +14388,7 @@
|
||||
|
||||
Settings = {
|
||||
init: function() {
|
||||
var el, settings;
|
||||
var addSection, check, el, key, settings, value, _ref;
|
||||
|
||||
el = $.el('a', {
|
||||
className: 'settings-link',
|
||||
@ -14425,24 +14425,37 @@
|
||||
}
|
||||
return $.set('previousversion', g.VERSION);
|
||||
});
|
||||
Settings.addSection('Style', Settings.style);
|
||||
Settings.addSection('Themes', Settings.themes);
|
||||
Settings.addSection('Mascots', Settings.mascots);
|
||||
Settings.addSection('Script', Settings.main);
|
||||
Settings.addSection('Filter', Settings.filter);
|
||||
Settings.addSection('Sauce', Settings.sauce);
|
||||
Settings.addSection('Advanced', Settings.advanced);
|
||||
Settings.addSection('Keybinds', Settings.keybinds);
|
||||
addSection = Settings.addSection;
|
||||
_ref = {
|
||||
'style': 'Style',
|
||||
'themes': 'Themes',
|
||||
'mascots': 'Mascots',
|
||||
'main': 'Script',
|
||||
'filter': 'Filter',
|
||||
'sauce': 'Sauce',
|
||||
'advanced': 'Advanced',
|
||||
'keybinds': 'Keybinds'
|
||||
};
|
||||
for (key in _ref) {
|
||||
value = _ref[key];
|
||||
addSection(value, Settings[key]);
|
||||
}
|
||||
$.on(d, 'AddSettingsSection', Settings.addSection);
|
||||
$.on(d, 'OpenSettings', function(e) {
|
||||
return Settings.open(e.detail);
|
||||
});
|
||||
settings = JSON.parse(localStorage.getItem('4chan-settings')) || {};
|
||||
if (settings.disableAll) {
|
||||
return;
|
||||
if (!settings.disableAll) {
|
||||
settings.disableAll = true;
|
||||
check = true;
|
||||
}
|
||||
if (settings.keyBinds) {
|
||||
settings.keyBinds = false;
|
||||
check = true;
|
||||
}
|
||||
if (check) {
|
||||
return localStorage.setItem('4chan-settings', JSON.stringify(settings));
|
||||
}
|
||||
settings.disableAll = true;
|
||||
return localStorage.setItem('4chan-settings', JSON.stringify(settings));
|
||||
},
|
||||
open: function(openSection) {
|
||||
var dialog, link, links, overlay, section, sectionToOpen, _i, _len, _ref;
|
||||
|
||||
@ -6,7 +6,7 @@ Settings =
|
||||
href: 'javascript:;'
|
||||
textContent: 'Settings'
|
||||
$.on el, 'click', Settings.open
|
||||
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
type: 'header'
|
||||
el: el
|
||||
@ -30,22 +30,30 @@ Settings =
|
||||
$.on d, '4chanXInitFinished', Settings.open
|
||||
$.set 'previousversion', g.VERSION
|
||||
|
||||
Settings.addSection 'Style', Settings.style
|
||||
Settings.addSection 'Themes', Settings.themes
|
||||
Settings.addSection 'Mascots', Settings.mascots
|
||||
Settings.addSection 'Script', Settings.main
|
||||
Settings.addSection 'Filter', Settings.filter
|
||||
Settings.addSection 'Sauce', Settings.sauce
|
||||
Settings.addSection 'Advanced', Settings.advanced
|
||||
Settings.addSection 'Keybinds', Settings.keybinds
|
||||
{addSection} = Settings
|
||||
addSection value, Settings[key] for key, value of {
|
||||
'style': 'Style'
|
||||
'themes': 'Themes'
|
||||
'mascots': 'Mascots'
|
||||
'main': 'Script'
|
||||
'filter': 'Filter'
|
||||
'sauce': 'Sauce'
|
||||
'advanced': 'Advanced'
|
||||
'keybinds': 'Keybinds'
|
||||
}
|
||||
|
||||
$.on d, 'AddSettingsSection', Settings.addSection
|
||||
$.on d, 'OpenSettings', (e) -> Settings.open e.detail
|
||||
$.on d, 'AddSettingsSection', Settings.addSection
|
||||
$.on d, 'OpenSettings', (e) -> Settings.open e.detail
|
||||
|
||||
settings = JSON.parse(localStorage.getItem '4chan-settings') or {}
|
||||
return if settings.disableAll
|
||||
settings.disableAll = true
|
||||
localStorage.setItem '4chan-settings', JSON.stringify settings
|
||||
unless settings.disableAll
|
||||
settings.disableAll = true
|
||||
check = true
|
||||
if settings.keyBinds
|
||||
# Keybinds persist even with disableAll. Thanks moot.
|
||||
settings.keyBinds = false
|
||||
check = true
|
||||
localStorage.setItem '4chan-settings', JSON.stringify settings if check
|
||||
|
||||
open: (openSection) ->
|
||||
if Conf['editMode'] is "theme"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user