From a0049f0b7f4e8c544efbfc749f961c408989574d Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 17 Feb 2014 16:32:09 -0800 Subject: [PATCH] Add sauce to /f/ --- builds/appchan-x.user.js | 18 +++++++++++++++--- builds/crx/script.js | 18 +++++++++++++++--- src/Theming/Style.coffee | 14 ++++++++++++-- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index a4a137574..acd2b6382 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -13622,10 +13622,22 @@ } if (g.BOARD.ID === 'f') { $.ready(function() { - var badLink; + var badLink, sauceLink, swfName; $.globalEval('SWFEmbed.init()'); - badLink = $('.navLinks'); - return badLink.parentNode.removeChild(badLink); + if (g.VIEW === 'thread') { + sauceLink = d.createElement('a'); + swfName = $('.fileText > a'); + badLink = $('.navLinks'); + i = 0; + while (i < 3) { + badLink.removeChild(badLink.firstChild); + i++; + } + sauceLink.textContent = 'Check Sauce on SWFCHAN'; + sauceLink.href = 'http://eye.swfchan.com/search/?q=' + swfName.textContent; + badLink.appendChild(sauceLink); + return badLink.removeChild(badLink.firstChild.nextSibling); + } }); } $.addStyle(JSColor.css(), 'jsColor'); diff --git a/builds/crx/script.js b/builds/crx/script.js index ebffd3ad0..8d27b4065 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -13623,10 +13623,22 @@ } if (g.BOARD.ID === 'f') { $.ready(function() { - var badLink; + var badLink, sauceLink, swfName; $.globalEval('SWFEmbed.init()'); - badLink = $('.navLinks'); - return badLink.parentNode.removeChild(badLink); + if (g.VIEW === 'thread') { + sauceLink = d.createElement('a'); + swfName = $('.fileText > a'); + badLink = $('.navLinks'); + i = 0; + while (i < 3) { + badLink.removeChild(badLink.firstChild); + i++; + } + sauceLink.textContent = 'Check Sauce on SWFCHAN'; + sauceLink.href = 'http://eye.swfchan.com/search/?q=' + swfName.textContent; + badLink.appendChild(sauceLink); + return badLink.removeChild(badLink.firstChild.nextSibling); + } }); } $.addStyle(JSColor.css(), 'jsColor'); diff --git a/src/Theming/Style.coffee b/src/Theming/Style.coffee index e64fab73c..784063a4c 100644 --- a/src/Theming/Style.coffee +++ b/src/Theming/Style.coffee @@ -25,8 +25,18 @@ Style = if g.BOARD.ID is 'f' $.ready -> $.globalEval 'SWFEmbed.init()' - badLink = $ '.navLinks' - badLink.parentNode.removeChild(badLink) + if g.VIEW is 'thread' + sauceLink = d.createElement 'a' + swfName = $ '.fileText > a' + badLink = $ '.navLinks' + i = 0 + while i < 3 + badLink.removeChild badLink.firstChild + i++ + sauceLink.textContent = 'Check Sauce on SWFCHAN' + sauceLink.href = 'http://eye.swfchan.com/search/?q=' + swfName.textContent + badLink.appendChild(sauceLink) + badLink.removeChild badLink.firstChild.nextSibling # Non-customizable $.addStyle JSColor.css(), 'jsColor'