Rename the Notification class to Notice.
To avoid conflicts with window.Notification.
This commit is contained in:
parent
030b1278bc
commit
b9afef771d
@ -30,7 +30,7 @@ Filter =
|
||||
regexp = RegExp regexp[1], regexp[2]
|
||||
catch err
|
||||
# I warned you, bro.
|
||||
new Notification 'warning', err.message, 60
|
||||
new Notice 'warning', err.message, 60
|
||||
continue
|
||||
|
||||
# Filter OPs along with their threads, replies only, or both.
|
||||
|
||||
@ -175,7 +175,7 @@ Header =
|
||||
'The header bar will automatically hide itself.'
|
||||
else
|
||||
'The header bar will remain visible.'
|
||||
new Notification 'info', message, 2
|
||||
new Notice 'info', message, 2
|
||||
|
||||
setBarPosition: (bottom) ->
|
||||
Header.barPositionToggler.checked = bottom
|
||||
@ -266,5 +266,5 @@ Header =
|
||||
|
||||
createNotification: (e) ->
|
||||
{type, content, lifetime, cb} = e.detail
|
||||
notif = new Notification type, content, lifetime
|
||||
notif = new Notice type, content, lifetime
|
||||
cb notif if cb
|
||||
|
||||
@ -34,7 +34,7 @@ Main =
|
||||
$.extend Conf, items
|
||||
<% if (type === 'crx') { %>
|
||||
unless items
|
||||
new Notification 'error', $.el 'span',
|
||||
new Notice 'error', $.el 'span',
|
||||
innerHTML: """
|
||||
It seems like your <%= meta.name %> settings became corrupted due to a <a href="https://code.google.com/p/chromium/issues/detail?id=261623" target=_blank>Chrome bug</a>.<br>
|
||||
Unfortunately, you'll have to <a href="https://github.com/MayhemYDG/4chan-x/wiki/FAQ#known-problems" target=_blank>fix it yourself</a>.
|
||||
@ -208,7 +208,7 @@ Main =
|
||||
try
|
||||
localStorage.getItem '4chan-settings'
|
||||
catch err
|
||||
new Notification 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30
|
||||
new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30
|
||||
|
||||
$.event '4chanXInitFinished'
|
||||
|
||||
@ -250,7 +250,7 @@ Main =
|
||||
else if errors.length is 1
|
||||
error = errors[0]
|
||||
if error
|
||||
new Notification 'error', Main.parseError(error), 15
|
||||
new Notice 'error', Main.parseError(error), 15
|
||||
return
|
||||
|
||||
div = $.el 'div',
|
||||
@ -266,7 +266,7 @@ Main =
|
||||
for error in errors
|
||||
$.add logs, Main.parseError error
|
||||
|
||||
new Notification 'error', [div, logs], 30
|
||||
new Notice 'error', [div, logs], 30
|
||||
|
||||
parseError: (data) ->
|
||||
Main.logError data
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
class Notification
|
||||
class Notice
|
||||
constructor: (type, content, @timeout) ->
|
||||
@el = $.el 'div',
|
||||
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
|
||||
|
||||
@ -29,7 +29,7 @@ Settings =
|
||||
changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
|
||||
el = $.el 'span',
|
||||
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>."
|
||||
new Notification 'info', el, 30
|
||||
new Notice 'info', el, 30
|
||||
else
|
||||
$.on d, '4chanXInitFinished', Settings.open
|
||||
# The archive list will always be updated with 4chan X updates.
|
||||
|
||||
@ -162,14 +162,14 @@ ThreadUpdater =
|
||||
'The thread is not a sticky anymore.'
|
||||
else
|
||||
'The thread is not closed anymore.'
|
||||
new Notification 'info', message, 30
|
||||
new Notice 'info', message, 30
|
||||
$.rm $ ".#{titleLC}Icon", ThreadUpdater.thread.OP.nodes.info
|
||||
return
|
||||
message = if title is 'Sticky'
|
||||
'The thread is now a sticky.'
|
||||
else
|
||||
'The thread is now closed.'
|
||||
new Notification 'info', message, 30
|
||||
new Notice 'info', message, 30
|
||||
icon = $.el 'img',
|
||||
src: "//static.4chan.org/image/#{titleLC}.gif"
|
||||
alt: title
|
||||
|
||||
@ -112,7 +112,7 @@ QR =
|
||||
# Focus the captcha input on captcha error.
|
||||
QR.captcha.nodes.input.focus()
|
||||
alert el.textContent if d.hidden
|
||||
QR.notifications.push new Notification 'warning', el
|
||||
QR.notifications.push new Notice 'warning', el
|
||||
notifications: []
|
||||
cleanNotifications: ->
|
||||
for notification in QR.notifications
|
||||
@ -1064,7 +1064,7 @@ QR =
|
||||
|
||||
h1 = $ 'h1', resDoc
|
||||
QR.cleanNotifications()
|
||||
QR.notifications.push new Notification 'success', h1.textContent, 5
|
||||
QR.notifications.push new Notice 'success', h1.textContent, 5
|
||||
|
||||
QR.persona.set post
|
||||
|
||||
@ -1114,5 +1114,5 @@ QR =
|
||||
delete QR.req
|
||||
QR.posts[0].unlock()
|
||||
QR.cooldown.auto = false
|
||||
QR.notifications.push new Notification 'info', 'QR upload aborted.', 5
|
||||
QR.notifications.push new Notice 'info', 'QR upload aborted.', 5
|
||||
QR.status()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user