From d65dc2ca9704ed5f78e4c5d29763bce208a40801 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 26 Jan 2015 00:57:17 -0800 Subject: [PATCH] Fix a bunch of feature initialization conditions. Conflicts: LICENSE builds/appchan-x.user.js builds/crx/script.js src/Filtering/PostHiding.coffee src/General/Index.coffee src/General/Navigate.coffee src/Images/FappeTyme.coffee src/Images/Gallery.coffee src/Images/ImageExpand.coffee src/Images/ImageLoader.coffee src/Menu/Labels.coffee src/Miscellaneous/Keybinds.coffee src/Monitoring/ThreadWatcher.coffee --- src/Images/FappeTyme.coffee | 2 +- src/Images/Gallery.coffee | 4 ++-- src/Images/ImageExpand.coffee | 4 ++-- src/Images/ImageLoader.coffee | 5 +++-- src/Miscellaneous/Keybinds.coffee | 9 +++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Images/FappeTyme.coffee b/src/Images/FappeTyme.coffee index 4c4c0ee70..7d98304d6 100755 --- a/src/Images/FappeTyme.coffee +++ b/src/Images/FappeTyme.coffee @@ -1,6 +1,6 @@ FappeTyme = init: -> - return if !(Conf['Fappe Tyme'] or Conf['Werk Tyme']) or g.VIEW not in ['index', 'thread'] or g.BOARD.ID is 'f' + return unless (Conf['Fappe Tyme'] or Conf['Werk Tyme']) and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' @nodes = {} @enabled = diff --git a/src/Images/Gallery.coffee b/src/Images/Gallery.coffee index 6b9adab75..f3cef9bf4 100644 --- a/src/Images/Gallery.coffee +++ b/src/Images/Gallery.coffee @@ -1,6 +1,6 @@ Gallery = init: -> - return if g.VIEW not in ['index', 'thread'] or g.BOARD is 'f' or !Conf['Gallery'] + return unless @enabled = Conf['Gallery'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' @delay = Conf['Slide Delay'] @@ -291,7 +291,7 @@ Gallery = menu: init: -> - return if g.VIEW not in ['index', 'thread'] or !Conf['Gallery'] + return unless Gallery.enabled el = $.el 'span', textContent: 'Gallery' diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index e903cbd6e..653b1c867 100755 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -1,6 +1,6 @@ ImageExpand = init: -> - return if g.VIEW not in ['index', 'thread'] or !Conf['Image Expansion'] + return unless @enabled = Conf['Image Expansion'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' @EAI = $.el 'a', className: 'expand-all-shortcut fa fa-expand' @@ -242,7 +242,7 @@ ImageExpand = menu: init: -> - return if g.VIEW not in ['index', 'thread'] or !Conf['Image Expansion'] + return unless ImageExpand.enabled el = $.el 'span', textContent: 'Image Expansion' diff --git a/src/Images/ImageLoader.coffee b/src/Images/ImageLoader.coffee index c4e2120c9..0c73999cf 100755 --- a/src/Images/ImageLoader.coffee +++ b/src/Images/ImageLoader.coffee @@ -1,7 +1,8 @@ ImageLoader = init: -> - return if g.VIEW not in ['index', 'thread'] - return unless Conf['Image Prefetching'] or Conf['Replace JPG'] or Conf['Replace PNG'] or Conf['Replace GIF'] or Conf['Replace WEBM'] + return unless g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' + return unless Conf['Image Prefetching'] or + Conf['Replace JPG'] or Conf['Replace PNG'] or Conf['Replace GIF'] or Conf['Replace WEBM'] Post.callbacks.push name: 'Image Replace' diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 48110a460..a17ef1180 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -88,19 +88,20 @@ Keybinds = ThreadWatcher.toggle thread # Images when Conf['Expand image'] - return unless threadRoot + return unless ImageExpand.enabled and threadRoot Keybinds.img threadRoot when Conf['Expand images'] - return unless threadRoot + return unless ImageExpand.enabled and threadRoot Keybinds.img threadRoot, true when Conf['Open Gallery'] - return if g.VIEW not in ['index', 'thread'] + return unless Gallery.enabled Gallery.cb.toggle() when Conf['fappeTyme'] - return if !Conf['Fappe Tyme'] or g.VIEW not in ['index', 'thread'] or g.BOARD is 'f' + return unless Conf['Fappe Tyme'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' FappeTyme.toggle 'fappe' when Conf['werkTyme'] return if !Conf['Werk Tyme'] or g.VIEW not in ['index', 'thread'] or g.BOARD is 'f' + return unless Conf['Werk Tyme'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f' FappeTyme.toggle 'werk' # Board Navigation when Conf['Front page']