Close #933.
This commit is contained in:
parent
f185557dc1
commit
35cd7a7e34
@ -1,3 +1,4 @@
|
|||||||
|
- **New feature**: `Announcement Hiding`, enabled by default.
|
||||||
- Fix support for www.4chan.org/frames on Chrome.
|
- Fix support for www.4chan.org/frames on Chrome.
|
||||||
- Fix quote features not working on dead quotelinks in inlined posts.
|
- Fix quote features not working on dead quotelinks in inlined posts.
|
||||||
- Fix resurrecting dead quotelinks on HTTP.
|
- Fix resurrecting dead quotelinks on HTTP.
|
||||||
|
|||||||
@ -370,6 +370,11 @@ a[href="javascript:;"] {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Announcement Hiding */
|
||||||
|
:root.hide-announcement #globalMessage {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Unread */
|
/* Unread */
|
||||||
#unread-line {
|
#unread-line {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ Config =
|
|||||||
'Miscellaneous':
|
'Miscellaneous':
|
||||||
'Enable 4chan\'s Extension': [false, 'Compatibility between <%= meta.name %> and 4chan\'s inline extension is NOT guaranteed.']
|
'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']
|
'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.']
|
'404 Redirect': [true, 'Redirect dead threads and images.']
|
||||||
'Keybinds': [true, 'Bind actions to keyboard shortcuts.']
|
'Keybinds': [true, 'Bind actions to keyboard shortcuts.']
|
||||||
'Time Formatting': [true, 'Localize and format timestamps.']
|
'Time Formatting': [true, 'Localize and format timestamps.']
|
||||||
|
|||||||
@ -783,6 +783,55 @@ Settings =
|
|||||||
@value = key
|
@value = key
|
||||||
$.cb.value.call @
|
$.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, '[ + ]', 'show-announcement']
|
||||||
|
else
|
||||||
|
[false, '[ - ]', 'hide-announcement']
|
||||||
|
trim: (psa) ->
|
||||||
|
psa.textContent.replace(/\W+/g, '').toLowerCase()
|
||||||
|
|
||||||
Fourchan =
|
Fourchan =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW is 'catalog'
|
return if g.VIEW is 'catalog'
|
||||||
|
|||||||
@ -346,6 +346,7 @@ Main =
|
|||||||
initFeature 'Polyfill', Polyfill
|
initFeature 'Polyfill', Polyfill
|
||||||
initFeature 'Header', Header
|
initFeature 'Header', Header
|
||||||
initFeature 'Settings', Settings
|
initFeature 'Settings', Settings
|
||||||
|
initFeature 'Announcement Hiding', PSAHiding
|
||||||
initFeature 'Fourchan thingies', Fourchan
|
initFeature 'Fourchan thingies', Fourchan
|
||||||
initFeature 'Custom CSS', CustomCSS
|
initFeature 'Custom CSS', CustomCSS
|
||||||
initFeature 'Resurrect Quotes', Quotify
|
initFeature 'Resurrect Quotes', Quotify
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user