USERSTYLES - add missing FAVICON - (png)

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

当前为 2019-03-17 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name          USERSTYLES - add missing FAVICON - (png)
// @description   Add missing favicon for userstyles Forum  [from "CH CrowdSource-OneSpace Favicon" : http://www.mturkgrind.com/threads/clickhappiers-userscripts-and-modifications.23532/page-6]
// @version       1.01
// @author        decembre
// @namespace     decembre
// @include       https://forum.userstyles.org/*
// @require       http://code.jquery.com/jquery-latest.min.js
// @grant         GM_log

// favicons Userstyles from:
// https://forum.userstyles.org/discussion/28375/need-some-graphics

// [GM fork from clickhappier : CH CrowdSource-OneSpace Favicon] : 
// http://www.mturkgrind.com/threads/clickhappiers-userscripts-and-modifications.23532/page-6
// Replaces OneSpace favicon with a nicer-looking version.

// ==/UserScript==

// CrowdSource rebranded themselves as OneSpace on 11/17/2015. Their new favicon
// for both the work platform and their forums is an orange box with a white logo.
// I'm not particularly fond of it, and want the work platform to have a different
// favicon than the forum to better distinguish my tabs, so I made this userscript
// (based on my favicon userscript for MTurk) to switch it to a better logo version.
//
// Adapted from 'RTM Favicon Redesigned' by Tyler Sticka circa 2009-2010: http://userscripts-mirror.org/scripts/show/42247

// create the favicon element
var faviconElem = document.createElement('link');
faviconElem.rel = 'shortcut icon';
faviconElem.type = 'image/x-icon';
// 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 ):
faviconElem.href = 'https://forum.userstyles.org/uploads/FileUpload/11/2751.png';

// add this favicon to the head
headElem = document.getElementsByTagName('head')[0];
headElem.appendChild(faviconElem);

// remove any existing favicons
var headLinks = headElem.getElementsByTagName('link');
for (var i=0; i < headLinks.length; i++) 
{
	if ( headLinks[i].href == faviconElem.href ) 
	{
	    return;
	}
	if ( headLinks[i].rel == "shortcut icon" || headLinks[i].rel == "icon" )
	{
	    headElem.removeChild(headLinks[i]);
	}
}

// force browser to acknowledge change
var shim = document.createElement('iframe');
shim.width = shim.height = 0;
document.body.appendChild(shim);
shim.src = "icon";
document.body.removeChild(shim);