Flow Icon --> SG Icon

Change the favicon, logo and titles of Autodesk's Flow Production Tracking back to ShotGrid (for as long as they maintain the old images on the server)

当前为 2024-04-02 提交的版本,查看 最新版本

// ==UserScript==
// @name        Flow Icon --> SG Icon
// @namespace   halil3d
// @include      *.shotgunstudio.com/*
// @include      *.shotgrid.autodesk.com/*
// @grant       none
// @version     1.0
// @author      halil3d
// @description Change the favicon, logo and titles of Autodesk's Flow Production Tracking back to ShotGrid (for as long as they maintain the old images on the server)
// @icon        https://tank.shotgunstudio.com/images/favicon/shotgun-icon-310x310.png
// ==/UserScript==


(function() {
	'use strict';
	function log(...toLog) {
		console.log("[Flow --> SG]", ...toLog);
	}
  window.addEventListener('load', function() {
	  log("Changing Flow Production Tracking favicon...");
    const shortcutIconUrl = "/images/favicon/shotgun-icon-64x64.png";
    const iconUrl = "/images/favicon/shotgun-icon-310x310.png";
		let shortcutIcon = document.querySelector('link[rel="shortcut icon"]');
    let icon = document.querySelector('link[rel="icon"]');
    let sgLogo = document.querySelector('img[alt="SG"]');
    let title = document.title.replace("Flow Production Tracking", "ShotGrid");
    document.title = title;
		if (shortcutIcon) {
			shortcutIcon.href = shortcutIconUrl;
      log("shortcutIcon: ", shortcutIcon);
		} else {
			log("shortcutIcon: Something went wrong.");
		}
		if (icon) {
			icon.href = iconUrl;
      log("icon: ", icon);
		} else {
			log("icon: Something went wrong.");
		}
		if (sgLogo) {
			sgLogo.src = iconUrl;
      log("sgLogo: ", sgLogo);
		} else {
			log("sgLogo: Something went wrong.");
		}
    log("Changing Flow favicon complete.");
	}, false);
  // Something resets this back so we set it correctly again after 6 seconds...
  setTimeout(function(){
    const iconUrl = "/images/favicon/shotgun-icon-310x310.png";
    let sgLogo = document.querySelector('img[alt="SG"]');
    if (sgLogo) {
      sgLogo.src = iconUrl;
      log("sgLogo: ", sgLogo);
    } else {
      log("sgLogo: Something went wrong.");
    }
  }, 7000);
})();