Rename the Notification class to Notice.

To avoid conflicts with window.Notification.
This commit is contained in:
Mayhem 2013-08-17 15:46:21 +02:00
parent 030b1278bc
commit b9afef771d
7 changed files with 14 additions and 14 deletions

View File

@ -30,7 +30,7 @@ Filter =
regexp = RegExp regexp[1], regexp[2] regexp = RegExp regexp[1], regexp[2]
catch err catch err
# I warned you, bro. # I warned you, bro.
new Notification 'warning', err.message, 60 new Notice 'warning', err.message, 60
continue continue
# Filter OPs along with their threads, replies only, or both. # Filter OPs along with their threads, replies only, or both.

View File

@ -175,7 +175,7 @@ Header =
'The header bar will automatically hide itself.' 'The header bar will automatically hide itself.'
else else
'The header bar will remain visible.' 'The header bar will remain visible.'
new Notification 'info', message, 2 new Notice 'info', message, 2
setBarPosition: (bottom) -> setBarPosition: (bottom) ->
Header.barPositionToggler.checked = bottom Header.barPositionToggler.checked = bottom
@ -266,5 +266,5 @@ Header =
createNotification: (e) -> createNotification: (e) ->
{type, content, lifetime, cb} = e.detail {type, content, lifetime, cb} = e.detail
notif = new Notification type, content, lifetime notif = new Notice type, content, lifetime
cb notif if cb cb notif if cb

View File

@ -34,7 +34,7 @@ Main =
$.extend Conf, items $.extend Conf, items
<% if (type === 'crx') { %> <% if (type === 'crx') { %>
unless items unless items
new Notification 'error', $.el 'span', new Notice 'error', $.el 'span',
innerHTML: """ 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> 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>. 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 try
localStorage.getItem '4chan-settings' localStorage.getItem '4chan-settings'
catch err 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' $.event '4chanXInitFinished'
@ -250,7 +250,7 @@ Main =
else if errors.length is 1 else if errors.length is 1
error = errors[0] error = errors[0]
if error if error
new Notification 'error', Main.parseError(error), 15 new Notice 'error', Main.parseError(error), 15
return return
div = $.el 'div', div = $.el 'div',
@ -266,7 +266,7 @@ Main =
for error in errors for error in errors
$.add logs, Main.parseError error $.add logs, Main.parseError error
new Notification 'error', [div, logs], 30 new Notice 'error', [div, logs], 30
parseError: (data) -> parseError: (data) ->
Main.logError data Main.logError data

View File

@ -1,4 +1,4 @@
class Notification class Notice
constructor: (type, content, @timeout) -> constructor: (type, content, @timeout) ->
@el = $.el 'div', @el = $.el 'div',
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>' innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'

View File

@ -29,7 +29,7 @@ Settings =
changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
el = $.el 'span', el = $.el 'span',
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>." 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 else
$.on d, '4chanXInitFinished', Settings.open $.on d, '4chanXInitFinished', Settings.open
# The archive list will always be updated with 4chan X updates. # The archive list will always be updated with 4chan X updates.

View File

@ -162,14 +162,14 @@ ThreadUpdater =
'The thread is not a sticky anymore.' 'The thread is not a sticky anymore.'
else else
'The thread is not closed anymore.' 'The thread is not closed anymore.'
new Notification 'info', message, 30 new Notice 'info', message, 30
$.rm $ ".#{titleLC}Icon", ThreadUpdater.thread.OP.nodes.info $.rm $ ".#{titleLC}Icon", ThreadUpdater.thread.OP.nodes.info
return return
message = if title is 'Sticky' message = if title is 'Sticky'
'The thread is now a sticky.' 'The thread is now a sticky.'
else else
'The thread is now closed.' 'The thread is now closed.'
new Notification 'info', message, 30 new Notice 'info', message, 30
icon = $.el 'img', icon = $.el 'img',
src: "//static.4chan.org/image/#{titleLC}.gif" src: "//static.4chan.org/image/#{titleLC}.gif"
alt: title alt: title

View File

@ -112,7 +112,7 @@ QR =
# Focus the captcha input on captcha error. # Focus the captcha input on captcha error.
QR.captcha.nodes.input.focus() QR.captcha.nodes.input.focus()
alert el.textContent if d.hidden alert el.textContent if d.hidden
QR.notifications.push new Notification 'warning', el QR.notifications.push new Notice 'warning', el
notifications: [] notifications: []
cleanNotifications: -> cleanNotifications: ->
for notification in QR.notifications for notification in QR.notifications
@ -1064,7 +1064,7 @@ QR =
h1 = $ 'h1', resDoc h1 = $ 'h1', resDoc
QR.cleanNotifications() QR.cleanNotifications()
QR.notifications.push new Notification 'success', h1.textContent, 5 QR.notifications.push new Notice 'success', h1.textContent, 5
QR.persona.set post QR.persona.set post
@ -1114,5 +1114,5 @@ QR =
delete QR.req delete QR.req
QR.posts[0].unlock() QR.posts[0].unlock()
QR.cooldown.auto = false 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() QR.status()