// ==UserScript==
// @name 页面平移功能
// @namespace http://tampermonkey.net/
// @version 2024-01-10
// @description try to take over the world!
// @author songaimin
// @match https://oa.aaaa.com/admin/flow/*/flow
// @icon https://www.google.com/s2/favicons?sz=64&domain=zlgx.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
function myGetByClass(className){
return document.getElementsByClassName(className);
}
function moveTop(num){
myGetByClass("FlowEditor_container__ORjL1")[0].scrollTop = myGetByClass("FlowEditor_container__ORjL1")[0].scrollTop+num;
}
function moveLeft(num){
myGetByClass("FlowEditor_container__ORjL1")[0].scrollLeft = myGetByClass("FlowEditor_container__ORjL1")[0].scrollLeft+num;
}
var lastX,lastY,dragTimer;
function mouseDown(e){
lastX=e.x;
lastY=e.y;
dragTimer = setTimeout(function(){myGetByClass("FlowEditor_container__ORjL1")[0].onmousemove = mouseMove;document.body.style.cursor = "move" ;},300);
}
function mouseUp(e){
clearTimeout(dragTimer);
myGetByClass("FlowEditor_container__ORjL1")[0].onmousemove = function(){return false;};
document.body.style.cursor = "auto" ;
}
function mouseMove(e){
moveTop(lastY-e.y);
moveLeft(lastX-e.x);
lastX=e.x;
lastY=e.y;
}
setTimeout(function(){
console.log("拖动生效")
myGetByClass("FlowEditor_container__ORjL1")[0].onmousedown=mouseDown;
myGetByClass("FlowEditor_container__ORjL1")[0].onmouseup=mouseUp;
}, 1200);
})();