// ==UserScript==
// @name DisplayZhuban
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://dzgw.zhbg.kjt.gx.gov/dist/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
if (window.location.href.indexOf("http://dzgw.zhbg.kjt.gx.gov/dist/#/forms/wd25/wd25formopinion") < 0){
return;
}
// 延迟1秒设置数据劫持函数
setTimeout(setProxy, 200);
// 数据劫持函数
function setProxy(){
let result = document.evaluate("//a[contains(text(),'会签意见:')]", document, null, XPathResult.ANY_TYPE, null);
let t = result.iterateNext();
if (t){
//如果是会签意见页面
//提取查询参数
//下载docguid信息
let httpRequest = new XMLHttpRequest();
httpRequest.open('POST', 'http://dzgw.zhbg.kjt.gx.gov/bgtoa/rest/handleframehbaction/getDataBean?isCommondto=true&action2rest=true', true); //第二步:打开连接
httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
let para = window.location.href;
let params = {inboxGuid:getQueryString(para,'inboxGuid'), outboxGuid:getQueryString(para,'outboxGuid'),rowGuid:getQueryString(para,'rowGuid'),fileType:'会签'};
//httpRequest.send("params=" + JSON.stringify(params) + '&cmdParams=%5B%5D&viewstate=%7B%22pageurl%22%3A%22' + encodeURIComponent(window.location.href) + '%22%7D');
httpRequest.send("params=" + JSON.stringify(params) + '&cmdParams=%5B%5D');
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState == 4 && httpRequest.status == 200) {
let data = JSON.parse(httpRequest.responseText);
handle(data.custom);
}
};
}else
{
setTimeout(setProxy, 200);
}
}
function handle(data){
let httpRequest = new XMLHttpRequest();http:
httpRequest.open('POST', '//dzgw.zhbg.kjt.gx.gov/bgtoa/rest/wd25form2action/getDataBean?isCommondto=true&action2rest=true&my=1', true); //第二步:打开连接
httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
let params = {guid:data.docguid, archivefiletypeguid:""};
httpRequest.send("params=" + JSON.stringify(params));
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState == 4 && httpRequest.status == 200) {
let data = JSON.parse(httpRequest.responseText);
let result = document.evaluate("//a[contains(text(),'会签意见:')]", document, null, XPathResult.ANY_TYPE, null);
let t = result.iterateNext().parentNode;
let item = document.createElement('div');
item.innerHTML = "主办意见: