diff --git a/css/main.css b/css/main.css index 6c59de8d9..8f1f0856b 100644 --- a/css/main.css +++ b/css/main.css @@ -31,6 +31,10 @@ html, body{ height: 100%; } +#etherpad { + z-index: 0; +} + .videocontainer>span { display: none; /* enable when you want nicks to be shown */ position: absolute; diff --git a/etherpad.js b/etherpad.js index f4be84610..f14465552 100644 --- a/etherpad.js +++ b/etherpad.js @@ -1,5 +1,8 @@ var Etherpad = (function (my) { var etherpadName = null; + var etherpadIFrame = null; + var domain = null; + var options = "?showControls=true&showChat=false&showLineNumbers=true&useMonospaceFont=false"; /** * Initializes the etherpad. @@ -8,6 +11,8 @@ var Etherpad = (function (my) { if (config.etherpad_base && !etherpadName) { + domain = config.etherpad_base; + if (!name) { // In case we're the focus we generate the name. etherpadName = Math.random().toString(36).substring(7) + '_' + (new Date().getTime()).toString(); @@ -15,21 +20,8 @@ var Etherpad = (function (my) { } else etherpadName = name; - - this.domain = config.etherpad_base; - this.options = "?showControls=true&showChat=false&showLineNumbers=true&useMonospaceFont=false"; createEtherpadButton(); - - this.iframe = document.createElement('iframe'); - this.iframe.src = this.domain + etherpadName + this.options; - this.iframe.frameBorder = 0; - this.iframe.scrolling = "no"; - this.iframe.width = $('#largeVideoContainer').width() || 640; - this.iframe.height = $('#largeVideoContainer').height() || 480; - this.iframe.setAttribute('style', 'visibility: hidden;'); - - document.getElementById('etherpad').appendChild(this.iframe); } } @@ -37,6 +29,10 @@ var Etherpad = (function (my) { * Opens/hides the Etherpad. */ my.toggleEtherpad = function (isPresentation) { + if (!etherpadIFrame) + createIFrame(); + + // TODO FIX large video and prezi toggling. Too many calls from different places. var largeVideo = null; if (isPresentationVisible()) largeVideo = $('#presentation>iframe'); @@ -102,6 +98,22 @@ var Etherpad = (function (my) { toolbar.insertBefore(separator, button); } + /** + * Creates the IFrame for the etherpad. + */ + function createIFrame() { + etherpadIFrame = document.createElement('iframe'); + etherpadIFrame.src = domain + etherpadName + options; + console.log("ETHER PAD URL", etherpadIFrame.src); + etherpadIFrame.frameBorder = 0; + etherpadIFrame.scrolling = "no"; + etherpadIFrame.width = $('#largeVideoContainer').width() || 640; + etherpadIFrame.height = $('#largeVideoContainer').height() || 480; + etherpadIFrame.setAttribute('style', 'visibility: hidden;'); + + document.getElementById('etherpad').appendChild(etherpadIFrame); + } + /** * On Etherpad added to muc. */ @@ -128,7 +140,7 @@ var Etherpad = (function (my) { if (!config.etherpad_base) return; - if ($('#etherpad>iframe').css('visibility') != 'hidden') + if (etherpadIFrame && etherpadIFrame.style.visibility != 'hidden') Etherpad.toggleEtherpad(isPresentation); }); diff --git a/index.html b/index.html index 4ce5d9a00..5e2531b68 100644 --- a/index.html +++ b/index.html @@ -8,17 +8,17 @@ - + - + - +