您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Highlight my incidents/changes
当前为
// ==UserScript== // @name Highlight Assigned to Me // @version 0.1 // @description Highlight my incidents/changes // @author Ricardo Constantino // @match https://frusupport.service-now.com/*_list.do?* // @grant none // @namespace https://greasyfork.org/users/129739 // ==/UserScript== (function() { 'use strict'; const TABLES = ['change_request', 'incident']; const BG_COLOR = '#bcefff'; const EVEN_STYLE = ` background-color: ${BG_COLOR} !important; `; const ODD_STYLE = ` /* background-color: ${BG_COLOR}87 !important; */ ${EVEN_STYLE} `; let assignedToColumn = document.querySelector('th[name="assigned_to"]'); if (!assignedToColumn) return; let assignedToColumnIdx = [...assignedToColumn.parentElement.children].indexOf(assignedToColumn); let tableElem = assignedToColumn.parentElement.parentElement.parentElement; if (TABLES.indexOf(assignedToColumn.parentElement.parentElement.parentElement.getAttribute('list_name')) === -1) return; let rowsAssignedToMe = [...tableElem.querySelectorAll('td:nth-child('+(assignedToColumnIdx+1)+')')] .filter(e => e.children.length > 0) .map(e => e.children[0]) .filter(e => e.getAttribute('sys_id') === g_user.getUserID()) .map(e => e.parentElement.parentElement); rowsAssignedToMe.forEach(r => r.addClassName('assignedToMe')); let d = document.createElement('style'); d.textContent = `tr.assignedToMe.list_even td { ${EVEN_STYLE} }\ntr.assignedToMe.list_odd td { ${ODD_STYLE} }`; document.querySelector("style").append(d); })();