From 251eaf802f22b77b011be0010f4b1c6b025274d4 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sun, 12 Jan 2014 19:44:47 -0700 Subject: [PATCH] Fix Favicon on Catalog --- builds/4chan-X.user.js | 8 ++++++-- builds/crx/script.js | 8 ++++++-- src/General/Index.coffee | 3 +-- src/General/html/Features/Index-navlinks.html | 2 +- src/Monitoring/Favicon.coffee | 4 +++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 46944f91d..79754d7d1 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -2281,7 +2281,7 @@ }); this.navLinks = $.el('div', { className: 'navLinks', - innerHTML: "Return [Catalog] Bottom ×" + innerHTML: "Return [Catalog] Bottom ×" }); this.searchInput = $('#index-search', this.navLinks); this.currentPage = this.getCurrentPage(); @@ -8632,8 +8632,12 @@ Favicon = { init: function() { + return $.asap((function() { + return Favicon.el = $('link[rel="shortcut icon"]', d.head); + }), Favicon.initAsap); + }, + initAsap: function() { var href; - Favicon.el = $('link[rel="shortcut icon"]', d.head); Favicon.el.type = 'image/x-icon'; href = Favicon.el.href; Favicon.SFW = /ws\.ico$/.test(href); diff --git a/builds/crx/script.js b/builds/crx/script.js index 47478d8e2..845d6cfff 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -2291,7 +2291,7 @@ }); this.navLinks = $.el('div', { className: 'navLinks', - innerHTML: "Return [Catalog] Bottom ×" + innerHTML: "Return [Catalog] Bottom ×" }); this.searchInput = $('#index-search', this.navLinks); this.currentPage = this.getCurrentPage(); @@ -8615,8 +8615,12 @@ Favicon = { init: function() { + return $.asap((function() { + return Favicon.el = $('link[rel="shortcut icon"]', d.head); + }), Favicon.initAsap); + }, + initAsap: function() { var href; - Favicon.el = $('link[rel="shortcut icon"]', d.head); Favicon.el.type = 'image/x-icon'; href = Favicon.el.href; Favicon.SFW = /ws\.ico$/.test(href); diff --git a/src/General/Index.coffee b/src/General/Index.coffee index db23e5620..c8515fc17 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -84,8 +84,7 @@ Index = $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#returnlink', @navLinks), 'click', Navigate.navigate - $.on $('#cataloglink', @navLinks), 'click', -> - window.location = "//boards.4chan.org/#{g.BOARD}/catalog" + $.on $('#cataloglink', @navLinks), 'click', -> window.location = "//boards.4chan.org/#{g.BOARD}/catalog" @update() if g.VIEW is 'index' diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index ee175d9dc..7db70087e 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -1,5 +1,5 @@ Return -[Catalog] +[Catalog] Bottom diff --git a/src/Monitoring/Favicon.coffee b/src/Monitoring/Favicon.coffee index 157ee1dda..98384ac50 100755 --- a/src/Monitoring/Favicon.coffee +++ b/src/Monitoring/Favicon.coffee @@ -1,6 +1,8 @@ Favicon = init: -> - Favicon.el = $ 'link[rel="shortcut icon"]', d.head + $.asap (-> Favicon.el = $ 'link[rel="shortcut icon"]', d.head), Favicon.initAsap + + initAsap: -> Favicon.el.type = 'image/x-icon' {href} = Favicon.el Favicon.SFW = /ws\.ico$/.test href