Merge from Appchan X: src/General/Main.coffee

This commit is contained in:
ccd0 2015-02-04 16:57:59 -08:00
parent 7c32cb37c9
commit 1a3b3012db

View File

@ -3,8 +3,8 @@ Main =
if location.hostname is 'www.google.com' if location.hostname is 'www.google.com'
return $.ready -> Captcha.noscript.initFrame() return $.ready -> Captcha.noscript.initFrame()
g.threads = new SimpleDict g.threads = new SimpleDict()
g.posts = new SimpleDict g.posts = new SimpleDict()
pathname = location.pathname.split '/' pathname = location.pathname.split '/'
g.BOARD = new Board pathname[1] g.BOARD = new Board pathname[1]
@ -90,6 +90,7 @@ Main =
error: err error: err
# finally # finally
# c.timeEnd "#{name} initialization" # c.timeEnd "#{name} initialization"
# c.timeEnd 'All initializations' # c.timeEnd 'All initializations'
$.ready Main.initReady $.ready Main.initReady
@ -163,19 +164,19 @@ Main =
Settings.open() Settings.open()
$.set 'previousversion', g.VERSION $.set 'previousversion', g.VERSION
return unless Conf['Show Support Message'] if Conf['Show Support Message']
<% if (type === 'userscript') { %> <% if (type === 'userscript') { %>
GMver = GM_info.version.split '.' GMver = GM_info.version.split '.'
for v, i in "<%= meta.min.greasemonkey %>".split '.' for v, i in "<%= meta.min.greasemonkey %>".split '.'
continue if v is GMver[i] continue if v is GMver[i]
(v < GMver[i]) or new Notice 'warning', "Your version of Greasemonkey is outdated (v#{GM_info.version} instead of v<%= meta.min.greasemonkey %> minimum) and <%= meta.name %> may not operate correctly.", 30 (v < GMver[i]) or new Notice 'warning', "Your version of Greasemonkey is outdated (v#{GM_info.version} instead of v<%= meta.min.greasemonkey %> minimum) and <%= meta.name %> may not operate correctly.", 30
break break
<% } %> <% } %>
try try
localStorage.getItem '4chan-settings' localStorage.getItem '4chan-settings'
catch err catch err
new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to operate properly.', 30 new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to operate properly.', 30
initThread: -> initThread: ->
if board = $ '.board' if board = $ '.board'