From c5869b79b6a1e9af179222b824a1d9b5a325bb67 Mon Sep 17 00:00:00 2001 From: fo Date: Fri, 22 Aug 2014 12:21:02 +0300 Subject: [PATCH] Adds mousemove listeners to the etherpad iframes. Adds css styles so the etherpad buttons beneath the header are accessible. --- css/videolayout_default.css | 3 ++- etherpad.js | 42 +++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/css/videolayout_default.css b/css/videolayout_default.css index 2f6015578..ffed256ed 100644 --- a/css/videolayout_default.css +++ b/css/videolayout_default.css @@ -280,6 +280,7 @@ left:0; right:0; z-index:10; + pointer-events: none; } #toolbar { @@ -295,7 +296,7 @@ background-color: rgba(0,0,0,0.8); border: 1px solid rgba(256, 256, 256, 0.2); border-radius: 6px; - + pointer-events: auto; } #subject { diff --git a/etherpad.js b/etherpad.js index bb273e514..f7a0b3ec2 100644 --- a/etherpad.js +++ b/etherpad.js @@ -46,7 +46,6 @@ var Etherpad = (function (my) { largeVideo.css({opacity: '0'}); } else { VideoLayout.setLargeVideoVisible(false); - ToolbarToggler.dockToolbar(true); } $('#etherpad>iframe').fadeIn(300, function () { @@ -64,7 +63,6 @@ var Etherpad = (function (my) { if (!isPresentation) { $('#largeVideo').fadeIn(300, function () { VideoLayout.setLargeVideoVisible(true); - ToolbarToggler.dockToolbar(false); }); } }); @@ -116,6 +114,46 @@ var Etherpad = (function (my) { etherpadIFrame.setAttribute('style', 'visibility: hidden;'); document.getElementById('etherpad').appendChild(etherpadIFrame); + + etherpadIFrame.onload = function() { + + document.domain = document.domain; + bubbleIframeMouseMove(etherpadIFrame); + setTimeout(function() { + //the iframes inside of the etherpad are not yet loaded when the etherpad iframe is loaded + var outer = etherpadIFrame.contentDocument.getElementsByName("ace_outer")[0]; + bubbleIframeMouseMove(outer); + var inner = outer.contentDocument.getElementsByName("ace_inner")[0]; + bubbleIframeMouseMove(inner); + }, 2000); + }; + } + + function bubbleIframeMouseMove(iframe){ + var existingOnMouseMove = iframe.contentWindow.onmousemove; + iframe.contentWindow.onmousemove = function(e){ + if(existingOnMouseMove) existingOnMouseMove(e); + var evt = document.createEvent("MouseEvents"); + var boundingClientRect = iframe.getBoundingClientRect(); + evt.initMouseEvent( + "mousemove", + true, // bubbles + false, // not cancelable + window, + e.detail, + e.screenX, + e.screenY, + e.clientX + boundingClientRect.left, + e.clientY + boundingClientRect.top, + e.ctrlKey, + e.altKey, + e.shiftKey, + e.metaKey, + e.button, + null // no related element + ); + iframe.dispatchEvent(evt); + }; } /**