From b38ef315fc87e61cf22222b734a41ebf8019793d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 28 Apr 2011 22:04:12 +0200 Subject: [PATCH 1/5] Fix custom favicons on Chrome. --- 4chan_x.js | 1 + script.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/4chan_x.js b/4chan_x.js index 353fb8225..c7bb600ca 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1692,6 +1692,7 @@ favicon = $('link[rel="shortcut icon"]', d.head); clone = favicon.cloneNode(true); clone.href = href; + clone.setAttribute('type', 'image/x-icon'); return $.replace(favicon, clone); } }; diff --git a/script.coffee b/script.coffee index a6012e3ed..01a4d6914 100644 --- a/script.coffee +++ b/script.coffee @@ -1322,6 +1322,7 @@ Favicon = favicon = $ 'link[rel="shortcut icon"]', d.head clone = favicon.cloneNode true clone.href = href + clone.setAttribute 'type', 'image/x-icon' $.replace favicon, clone From e981ff898be810cde49110ef7e49fbea4afe08ba Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 28 Apr 2011 23:32:44 +0200 Subject: [PATCH 2/5] Fix 404 favicon, close #40 --- 4chan_x.js | 1 + script.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/4chan_x.js b/4chan_x.js index c7bb600ca..634e843b7 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1341,6 +1341,7 @@ input.value = 404; } d.title = d.title.match(/.+- /)[0] + 404; + g.dead = true; Favicon.update(); return; } diff --git a/script.coffee b/script.coffee index 01a4d6914..84b451147 100644 --- a/script.coffee +++ b/script.coffee @@ -1055,6 +1055,7 @@ updater = input.disabled = true input.value = 404 d.title = d.title.match(/.+- /)[0] + 404 + g.dead = true Favicon.update() return From cf3a8f73f3e639b051ea281b50db57ec04730574 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 28 Apr 2011 23:51:26 +0200 Subject: [PATCH 3/5] No need to clone and replace. --- 4chan_x.js | 8 +++----- script.coffee | 7 ++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 634e843b7..e92ae5131 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1675,7 +1675,7 @@ haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC', haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII=', update: function() { - var clone, favicon, href, l; + var favicon, href, l; l = unread.replies.length; if (g.dead) { if (l > 0) { @@ -1691,10 +1691,8 @@ } } favicon = $('link[rel="shortcut icon"]', d.head); - clone = favicon.cloneNode(true); - clone.href = href; - clone.setAttribute('type', 'image/x-icon'); - return $.replace(favicon, clone); + favicon.setAttribute('type', 'image/x-icon'); + return favicon.href = href; } }; redirect = function() { diff --git a/script.coffee b/script.coffee index 84b451147..e68012ec8 100644 --- a/script.coffee +++ b/script.coffee @@ -1319,12 +1319,9 @@ Favicon = else href = Favicon.default - #XXX `favicon.href = href` doesn't work favicon = $ 'link[rel="shortcut icon"]', d.head - clone = favicon.cloneNode true - clone.href = href - clone.setAttribute 'type', 'image/x-icon' - $.replace favicon, clone + favicon.setAttribute 'type', 'image/x-icon' + favicon.href = href redirect = -> From ea73a1a41751939ef39c9cfc7dd7ce2b5f20cb8f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 29 Apr 2011 00:25:31 +0200 Subject: [PATCH 4/5] Typo --- 4chan_x.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index e92ae5131..137476d7e 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1679,7 +1679,7 @@ l = unread.replies.length; if (g.dead) { if (l > 0) { - href = Favicon.headHalo; + href = Favicon.deadHalo; } else { href = Favicon.dead; } diff --git a/script.coffee b/script.coffee index e68012ec8..c065ee5f9 100644 --- a/script.coffee +++ b/script.coffee @@ -1310,7 +1310,7 @@ Favicon = l = unread.replies.length if g.dead if l > 0 - href = Favicon.headHalo + href = Favicon.deadHalo else href = Favicon.dead else From c22b982378ee769535b5163b51d6fe45f9503bde Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 29 Apr 2011 00:51:08 +0200 Subject: [PATCH 5/5] Cloning and replacing is needed [spoiler]for Firefox[/spoiler] --- 4chan_x.js | 8 +++++--- script.coffee | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 137476d7e..fc306ea8e 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1675,7 +1675,7 @@ haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC', haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII=', update: function() { - var favicon, href, l; + var clone, favicon, href, l; l = unread.replies.length; if (g.dead) { if (l > 0) { @@ -1691,8 +1691,10 @@ } } favicon = $('link[rel="shortcut icon"]', d.head); - favicon.setAttribute('type', 'image/x-icon'); - return favicon.href = href; + clone = favicon.cloneNode(true); + clone.href = href; + clone.setAttribute('type', 'image/x-icon'); + return $.replace(favicon, clone); } }; redirect = function() { diff --git a/script.coffee b/script.coffee index c065ee5f9..e29a4a430 100644 --- a/script.coffee +++ b/script.coffee @@ -1319,9 +1319,12 @@ Favicon = else href = Favicon.default + #XXX `favicon.href = href` doesn't work on Firefox favicon = $ 'link[rel="shortcut icon"]', d.head - favicon.setAttribute 'type', 'image/x-icon' - favicon.href = href + clone = favicon.cloneNode true + clone.href = href + clone.setAttribute 'type', 'image/x-icon' + $.replace favicon, clone redirect = ->