GPRO: Hide driver face

Remove the driver profile image on the driver profile pages.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         GPRO: Hide driver face
// @namespace    taviandir.gpro.driverface
// @version      0.0.3
// @description  Remove the driver profile image on the driver profile pages.
// @author       Taviandir
// @match        https://gpro.net/*
// @match        https://app.gpro.net/*
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @license      MIT
// @grant        none
// ==/UserScript==

// Run on page load
(function(){
	// check the URL of the current page to see if we are on a GPRO site
	var host = document.location.host;
	
	// on the old version of the app?
	if (host === "gpro.net") {
		// try and find the driver profile image element
		var el = document.querySelector("table#tableone tbody tr td a div img");
		// if found, then remove it
		if (el) {
			el.remove();
		}
	}
	// on the new version of the app?
	else if (host === "app.gpro.net") {
		// NOTE : we have to check every 0.1 seconds because during the 
		// new version of GPRO is a Single Page Application and thus,
		// the content won't be available directly on load.
		var intervalId = setInterval(() => {
			// try and find the driver profile image element (office page)
			var el = document.querySelector(".faceTd #driverFace img");
			
			if (!el) {
				// try and find the driver profile image element (driver profile page)
				el = document.querySelector(".driverProfileHighRes #driverFace img");
			}
			
			// if found, then remove it
			if (el) {
				el.remove();
				clearInterval(intervalId);
			}
		}, 100);		
	}
})();