Greasy Fork is available in English.
gorgias 增加基本信息 易仓补发
当前为
// ==UserScript==
// @name gorgias ticket prod
// @namespace gorgias
// @version 1.9
// @description gorgias 增加基本信息 易仓补发
// @author jerry
// @include https://y.gorgias.com/app/*
// @grant none
// @license MIT
// ==/UserScript==
(function () {
console.log('脚本启动了')
let basic = null;
let lastBasic = null;
let reissue = null;
let lastReissue = null;
let ifrm1 = null;
let lastHeight = 0;
let lastTicketId = '';
let lastContainerWidth = '';
const interTime = setInterval(function () {
if (window.location.href.indexOf("y.gorgias.com/app/ticket") > -1) {
const container = document.querySelector('._2kR-sqQlwwzR6ywqhSPTyA');
if(!lastContainerWidth){
let width = localStorage.getItem("ccm_container_width");
container.style.width = width || "500px";
lastContainerWidth = container.style.width;
} else {
localStorage.setItem("ccm_container_width",container.style.width)
}
const HTTP = document.querySelector('.oo8e0GwNUh4Ca4aa5sJYe');
if(HTTP.innerText==="HTTP"){
HTTP.style.display = "none"
}
const mainAll = document.querySelectorAll(".RuJMo3siFIFE6nUnkpyMQ");
for (i = 0; i < mainAll.length; ++i) {
const el = mainAll[i].getElementsByClassName('field-value')[0];
if(el){
if(el.innerText === '基本信息'|| el.innerText === '侧边栏' || el.innerText === '文明静'){
basic = mainAll[i];
break;
}
}
}
if(basic&&lastBasic !== basic){
lastBasic = basic
console.log('basic:',basic)
let basicSimple = basic.querySelector(".simple-field");
console.log('basicSimple:',basicSimple);
var url = window.location.href;
var ticketId = url.substring(url.lastIndexOf('/')+1).trim();
console.log("ticketId:",ticketId);
if(basicSimple && ticketId !== lastTicketId){
lastTicketId = ticketId;
basicSimple.style.padding = 0;
ifrm1 = document.createElement("iframe");
ifrm1.setAttribute("src", "https://ccm.youniverse.cc/grogias?lastUrl=grogias&ticketId=" + ticketId ); ifrm1.setAttribute("id", "basic-ifrm");
ifrm1.style.width = "100%";
ifrm1.style.minHeight = "40vh";
ifrm1.style.overflow = "hidden";
ifrm1.style.border = "0";
basicSimple.innerHTML = "<div></div>";
basicSimple.appendChild(ifrm1);
window.addEventListener('message', (event) => {
let data = event.data;
console.log("message1111:",event,event.origin);
console.log("message2222:",data,typeof data !== 'number');
if(event.origin&&event.origin.indexOf("feishu")>-1){
data = 500;
console.log("message3333:",data,typeof data !== 'number');
}
if(typeof data !== 'number') return;
if(event.data>1000){
ifrm1.style.height = `${data+12}px`;
lastHeight = data+12;
}else{
ifrm1.style.height=`${data+12}px`;
lastHeight = data+12;
}
})
}
}
}
}, 100);
})();