MCPcopy Create free account
hub / github.com/hoothin/UserScripts / getContentClientRect

Function getContentClientRect

Picviewer CE+/Picviewer CE+.user.js:13592–13608  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

13590
13591 //获取位置
13592 function getContentClientRect(target){
13593 var rect=target.getBoundingClientRect();
13594 var compStyle=unsafeWindow.getComputedStyle(target);
13595 var pFloat=parseFloat;
13596 var top=rect.top + pFloat(compStyle.borderTopWidth);
13597 var right=rect.right - pFloat(compStyle.borderRightWidth);
13598 var bottom=rect.bottom - pFloat(compStyle.borderBottomWidth);
13599 var left=rect.left + pFloat(compStyle.borderLeftWidth);
13600 return {
13601 top:top,
13602 right:right,
13603 bottom:bottom,
13604 left:left,
13605 width:right-left,
13606 height:bottom-top,
13607 };
13608 };
13609
13610 //获取窗口大小.
13611 function getWindowSize(){

Callers 1

initFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected