This commit is contained in:
Zixaphir 2014-07-27 16:27:53 -07:00
parent d9e4c2abcf
commit 04c60a62ef
4 changed files with 17 additions and 2 deletions

View File

@ -156,7 +156,8 @@
'Color User IDs': [false, 'Assign unique colors to user IDs on boards that use them'], 'Color User IDs': [false, 'Assign unique colors to user IDs on boards that use them'],
'Remove Spoilers': [false, 'Remove all spoilers in text.'], 'Remove Spoilers': [false, 'Remove all spoilers in text.'],
'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'],
'Show Support Message': [true, 'Warn if your browser is unsupported. 4chan X may not operate correctly on unsupported browser versions.'] 'Show Support Message': [true, 'Warn if your browser is unsupported. 4chan X may not operate correctly on unsupported browser versions.'],
'Announcement Hiding': [true, 'Enable announcements to be hidden.']
}, },
'Linkification': { 'Linkification': {
'Linkify': [true, 'Convert text into links where applicable.'], 'Linkify': [true, 'Convert text into links where applicable.'],
@ -14946,6 +14947,9 @@
PSAHiding = { PSAHiding = {
init: function() { init: function() {
if (!Conf['Announcement Hiding']) {
return;
}
$.addClass(doc, 'hide-announcement'); $.addClass(doc, 'hide-announcement');
return $.on(d, '4chanXInitFinished', this.setup); return $.on(d, '4chanXInitFinished', this.setup);
}, },

View File

@ -131,7 +131,8 @@
'Color User IDs': [false, 'Assign unique colors to user IDs on boards that use them'], 'Color User IDs': [false, 'Assign unique colors to user IDs on boards that use them'],
'Remove Spoilers': [false, 'Remove all spoilers in text.'], 'Remove Spoilers': [false, 'Remove all spoilers in text.'],
'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'],
'Show Support Message': [true, 'Warn if your browser is unsupported. 4chan X may not operate correctly on unsupported browser versions.'] 'Show Support Message': [true, 'Warn if your browser is unsupported. 4chan X may not operate correctly on unsupported browser versions.'],
'Announcement Hiding': [true, 'Enable announcements to be hidden.']
}, },
'Linkification': { 'Linkification': {
'Linkify': [true, 'Convert text into links where applicable.'], 'Linkify': [true, 'Convert text into links where applicable.'],
@ -14960,6 +14961,9 @@
PSAHiding = { PSAHiding = {
init: function() { init: function() {
if (!Conf['Announcement Hiding']) {
return;
}
$.addClass(doc, 'hide-announcement'); $.addClass(doc, 'hide-announcement');
return $.on(d, '4chanXInitFinished', this.setup); return $.on(d, '4chanXInitFinished', this.setup);
}, },

View File

@ -77,6 +77,10 @@ Config =
true true
'Warn if your browser is unsupported. 4chan X may not operate correctly on unsupported browser versions.' 'Warn if your browser is unsupported. 4chan X may not operate correctly on unsupported browser versions.'
] ]
'Announcement Hiding': [
true
'Enable announcements to be hidden.'
]
'Linkification': 'Linkification':
'Linkify': [ 'Linkify': [

View File

@ -1,5 +1,6 @@
PSAHiding = PSAHiding =
init: -> init: ->
return unless Conf['Announcement Hiding']
$.addClass doc, 'hide-announcement' $.addClass doc, 'hide-announcement'
$.on d, '4chanXInitFinished', @setup $.on d, '4chanXInitFinished', @setup
@ -34,6 +35,7 @@ PSAHiding =
$.rmClass doc, 'hide-announcement' $.rmClass doc, 'hide-announcement'
$.sync 'hiddenPSA', PSAHiding.sync $.sync 'hiddenPSA', PSAHiding.sync
toggle: (e) -> toggle: (e) ->
if $.hasClass @, 'hide-announcement' if $.hasClass @, 'hide-announcement'
UTC = +$.id('globalMessage').dataset.utc UTC = +$.id('globalMessage').dataset.utc
@ -42,6 +44,7 @@ PSAHiding =
$.event 'CloseMenu' $.event 'CloseMenu'
$.delete 'hiddenPSA' $.delete 'hiddenPSA'
PSAHiding.sync UTC PSAHiding.sync UTC
sync: (UTC) -> sync: (UTC) ->
psa = $.id 'globalMessage' psa = $.id 'globalMessage'
psa.hidden = PSAHiding.btn.hidden = if UTC and UTC >= +psa.dataset.utc psa.hidden = PSAHiding.btn.hidden = if UTC and UTC >= +psa.dataset.utc