MCPcopy Create free account
hub / github.com/Milkyroad/SCiPNET / sideBarFun

Function sideBarFun

public/src/js/sideBar.js:1–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1export function sideBarFun() {
2 function randomInteger(min, max) {
3 return Math.floor(Math.random() * (max - min + 1)) + min;
4 }
5
6 function change(hold, tag, min, max, unit) {
7 $(hold + tag).text(randomInteger(min, max) + unit)
8 }
9 var span = document.getElementById('time');
10
11 window.bubbleIframeMouseMove = (iframe) => {
12 // Save any previous onmousemove handler
13 var existingOnMouseMove = iframe.contentWindow.onmousemove;
14
15 // Attach a new onmousemove listener
16 iframe.contentWindow.onmousemove = function(e) {
17 // Fire any existing onmousemove listener
18 if (existingOnMouseMove) existingOnMouseMove(e);
19
20 // Create a new event for the this window
21 var evt = document.createEvent("MouseEvents");
22
23 // We'll need this to offset the mouse move appropriately
24 var boundingClientRect = iframe.getBoundingClientRect();
25
26 // Initialize the event, copying exiting event values
27 // for the most part
28 evt.initMouseEvent(
29 "mousemove",
30 true, // bubbles
31 false, // not cancelable
32 window,
33 e.detail,
34 e.screenX,
35 e.screenY,
36 e.clientX + boundingClientRect.left,
37 e.clientY + boundingClientRect.top,
38 e.ctrlKey,
39 e.altKey,
40 e.shiftKey,
41 e.metaKey,
42 e.button,
43 null // no related element
44 );
45
46 // Dispatch the mousemove event on the iframe element
47 iframe.dispatchEvent(evt);
48 };
49 }
50
51 window.onload = function() {
52 $(document).on("mousemove", function(event) {
53 $("#mousepo").text(`X:${Math.round(event.pageX)} Y:${Math.round(event.pageY)}`);
54 });
55 bubbleIframeMouseMove(document.getElementById("cmdIframe"))
56 };
57
58 function time() {
59 var d = new Date();
60 var s = d.getSeconds();

Callers 1

script.jsFile · 0.90

Calls 5

changeFunction · 0.85
randomIntegerFunction · 0.85
failedLocationFunction · 0.85
getOSFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected