From 1f1709d86a8fa3d216a668c386b84b42de3eced0 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 26 Mar 2013 00:21:28 +0100 Subject: [PATCH] Move the Custom CSS setting to the Rice tab. #968 The checkbox will toggle the style live. --- src/config.coffee | 2 +- src/features.coffee | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 2ac7f2bfd..6bf9d3ec1 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -11,7 +11,6 @@ Config = 'Comment Expansion': [true, 'Add buttons to expand too long comments.'] 'Thread Expansion': [true, 'Add buttons to expand threads.'] 'Index Navigation': [false, 'Add buttons to navigate between threads.'] - 'Custom CSS': [false, 'Apply custom CSS to 4chan.'] 'Check for Updates': [true, 'Check for updated versions of <%= meta.name %>.'] 'Filtering': 'Anonymize': [false, 'Make everyone Anonymous.'] @@ -130,6 +129,7 @@ Config = '#//archive.foolz.us/%board/search/image/%MD5/;text:View same on foolz /%board/' '#//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/' ].join '\n' + 'Custom CSS': false 'Header auto-hide': false 'Header catalog links': false boardnav: '[current-title / toggle-all]' diff --git a/src/features.coffee b/src/features.coffee index a1c8b8632..c2c7a068b 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -301,7 +301,7 @@ Settings = description = arr[1] div = $.el 'div', innerHTML: ": #{description}" - $.on $('input', div), 'click', $.cb.checked + $.on $('input', div), 'change', $.cb.checked $.add fs, div $.add section, fs @@ -572,9 +572,9 @@ Settings =
- Custom CSS is disabled. + Custom CSS - +
""" for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'usercss'] @@ -588,6 +588,7 @@ Settings = unless name in ['usercss'] $.on input, event, Settings[name] Settings[name].call input + $.on $('input[name="Custom CSS"]', section), 'change', Settings.togglecss $.on $.id('apply-css'), 'click', Settings.usercss boardnav: -> Header.generateBoardList @value @@ -618,11 +619,14 @@ Settings = """ - usercss: -> - if Conf['Custom CSS'] - CustomCSS.update() - else + togglecss: -> + if $('textarea', @parentNode.parentNode).disabled = !@checked CustomCSS.rmStyle() + else + CustomCSS.addStyle() + $.cb.checked.call @ + usercss: -> + CustomCSS.update() keybinds: (section) -> section.innerHTML = """