This commit is contained in:
Nicolas Stepien 2013-04-16 01:17:47 +02:00
parent f185557dc1
commit 35cd7a7e34
5 changed files with 57 additions and 0 deletions

View File

@ -1,3 +1,4 @@
- **New feature**: `Announcement Hiding`, enabled by default.
- Fix support for www.4chan.org/frames on Chrome.
- Fix quote features not working on dead quotelinks in inlined posts.
- Fix resurrecting dead quotelinks on HTTP.

View File

@ -370,6 +370,11 @@ a[href="javascript:;"] {
overflow: hidden;
}
/* Announcement Hiding */
:root.hide-announcement #globalMessage {
display: none;
}
/* Unread */
#unread-line {
margin: 0;

View File

@ -3,6 +3,7 @@ Config =
'Miscellaneous':
'Enable 4chan\'s Extension': [false, 'Compatibility between <%= meta.name %> and 4chan\'s inline extension is NOT guaranteed.']
'Custom Board Navigation': [true, 'Show custom links instead of the full board list']
'Announcement Hiding': [true, 'Add button to hide 4chan announcements.']
'404 Redirect': [true, 'Redirect dead threads and images.']
'Keybinds': [true, 'Bind actions to keyboard shortcuts.']
'Time Formatting': [true, 'Localize and format timestamps.']

View File

@ -783,6 +783,55 @@ Settings =
@value = key
$.cb.value.call @
PSAHiding =
init: ->
return if !Conf['Announcement Hiding']
$.addClass doc, 'hide-announcement'
$.on d, '4chanXInitFinished', @setup
setup: ->
$.off d, '4chanXInitFinished', PSAHiding.setup
unless psa = $.id 'globalMessage'
$.rmClass doc, 'hide-announcement'
return
PSAHiding.btn = btn = $.el 'a',
title: 'Toggle announcement.'
href: 'javascript:;'
$.on btn, 'click', PSAHiding.toggle
text = PSAHiding.trim psa
$.get 'hiddenPSAs', [], (item) ->
PSAHiding.sync item['hiddenPSAs']
$.before psa, btn
$.rmClass doc, 'hide-announcement'
$.sync 'hiddenPSAs', PSAHiding.sync
toggle: (e) ->
hide = $.hasClass @, 'hide-announcement'
text = PSAHiding.trim $.id 'globalMessage'
$.get 'hiddenPSAs', [], (item) ->
{hiddenPSAs} = item
if hide
hiddenPSAs.push text
else
i = hiddenPSAs.indexOf text
hiddenPSAs.splice i, 1
hiddenPSAs = hiddenPSAs[-5..]
PSAHiding.sync hiddenPSAs
$.set 'hiddenPSAs', hiddenPSAs
sync: (hiddenPSAs) ->
{btn} = PSAHiding
psa = $.id 'globalMessage'
[psa.hidden, btn.innerHTML, btn.className] = if PSAHiding.trim(psa) in hiddenPSAs
[true, '[&nbsp;+&nbsp;]', 'show-announcement']
else
[false, '[&nbsp;-&nbsp;]', 'hide-announcement']
trim: (psa) ->
psa.textContent.replace(/\W+/g, '').toLowerCase()
Fourchan =
init: ->
return if g.VIEW is 'catalog'

View File

@ -346,6 +346,7 @@ Main =
initFeature 'Polyfill', Polyfill
initFeature 'Header', Header
initFeature 'Settings', Settings
initFeature 'Announcement Hiding', PSAHiding
initFeature 'Fourchan thingies', Fourchan
initFeature 'Custom CSS', CustomCSS
initFeature 'Resurrect Quotes', Quotify