()
| 1 | export 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(); |
no test coverage detected