Add missing FAVICON (ico) - AFP Factuel

Add missing favicon for AFP Factuel [from "CH CrowdSource-OneSpace Favicon" : http://www.mturkgrind.com/threads/clickhappiers-userscripts-and-modifications.23532/page-6]

  1. // ==UserScript==
  2. // @name Add missing FAVICON (ico) - AFP Factuel
  3. // @description Add missing favicon for AFP Factuel [from "CH CrowdSource-OneSpace Favicon" : http://www.mturkgrind.com/threads/clickhappiers-userscripts-and-modifications.23532/page-6]
  4. // @version 1.00
  5. // @author decembre
  6. // @namespace decembre
  7. // @include https://factuel.afp.com/*
  8. // @require http://code.jquery.com/jquery-latest.min.js
  9. // @grant GM_log
  10.  
  11. // favicons Userstyles from:
  12. // https://forum.userstyles.org/discussion/28375/need-some-graphics
  13.  
  14. // [GM fork from clickhappier : CH CrowdSource-OneSpace Favicon] :
  15. // http://www.mturkgrind.com/threads/clickhappiers-userscripts-and-modifications.23532/page-6
  16. // Replaces OneSpace favicon with a nicer-looking version.
  17.  
  18. // ==/UserScript==
  19.  
  20. // CrowdSource rebranded themselves as OneSpace on 11/17/2015. Their new favicon
  21. // for both the work platform and their forums is an orange box with a white logo.
  22. // I'm not particularly fond of it, and want the work platform to have a different
  23. // favicon than the forum to better distinguish my tabs, so I made this userscript
  24. // (based on my favicon userscript for MTurk) to switch it to a better logo version.
  25. //
  26. // Adapted from 'RTM Favicon Redesigned' by Tyler Sticka circa 2009-2010: http://userscripts-mirror.org/scripts/show/42247
  27.  
  28. // create the favicon element
  29. var faviconElem = document.createElement('link');
  30. faviconElem.rel = 'shortcut icon';
  31. faviconElem.type = 'image/x-icon';
  32. // 64-bit text-encoded copy of improved favicon file's data (created from https://work.onespace.com/static/work-station/img/svg/logo_footer.svg ):
  33. //faviconElem.href = 'https://forum.userstyles.org/uploads/FileUpload/11/2751.png';
  34. // AFP FACTUEL
  35. faviconElem.href = 'https://external-content.duckduckgo.com/ip3/factuel.afp.com.ico';
  36. // add this favicon to the head
  37. headElem = document.getElementsByTagName('head')[0];
  38. headElem.appendChild(faviconElem);
  39.  
  40. // remove any existing favicons
  41. var headLinks = headElem.getElementsByTagName('link');
  42. for (var i=0; i < headLinks.length; i++)
  43. {
  44. if ( headLinks[i].href == faviconElem.href )
  45. {
  46. return;
  47. }
  48. if ( headLinks[i].rel == "shortcut icon" || headLinks[i].rel == "icon" )
  49. {
  50. headElem.removeChild(headLinks[i]);
  51. }
  52. }
  53.  
  54. // force browser to acknowledge change
  55. var shim = document.createElement('iframe');
  56. shim.width = shim.height = 0;
  57. document.body.appendChild(shim);
  58. shim.src = "icon";
  59. document.body.removeChild(shim);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址