From 34a46d631836b5a2755a49653d672c43c5c077ce Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 23 Dec 2015 14:35:52 +0000 Subject: [PATCH 1/8] should be clean enough to push --- src/static/js/ace.js | 6 +++++- src/static/js/ace2_inner.js | 9 ++++++++- src/static/js/domline.js | 3 ++- src/static/js/pad.js | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/static/js/ace.js b/src/static/js/ace.js index a5e365ce..0e81974c 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -286,6 +286,7 @@ window.onload = function () {\n\ iframe.name = "ace_inner";\n\ iframe.title = "pad";\n\ iframe.scrolling = "no";\n\ + iframe.setAttribute("sandbox", "allow-same-origin allow-scripts allow-popups allow-forms allow-modals");\n\ var outerdocbody = document.getElementById("outerdocbody");\n\ iframe.frameBorder = 0;\n\ iframe.allowTransparency = true; // for IE\n\ @@ -325,10 +326,13 @@ window.onload = function () {\n\ // bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly // (throbs busy while typing) - outerHTML.push('', '', scriptTag(outerScript), '
x
'); + var testHTML = 'WONT WORK in Chrome'; + + outerHTML.push('', '', scriptTag(outerScript), '
x
'+testHTML+''); var outerFrame = document.createElement("IFRAME"); outerFrame.name = "ace_outer"; + outerFrame.setAttribute("sandbox", "allow-same-origin allow-scripts allow-popups allow-forms allow-modals"); outerFrame.frameBorder = 0; // for IE outerFrame.title = "Ether"; info.frame = outerFrame; diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index ccc16668..4473126c 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5006,8 +5006,14 @@ function Ace2Inner(){ }); }) +/* + $(root).on("dragend", function(e){ + top.console.log("dragend"); + }); + $(root).on("drop", function(e){ + top.console.log("DROP"); if(e.target.a || e.target.localName === "a"){ e.preventDefault(); } @@ -5020,7 +5026,7 @@ function Ace2Inner(){ e: e }); }); - +*/ // CompositionEvent is not implemented below IE version 8 if ( !(browser.msie && parseInt(browser.version <= 9)) && document.documentElement) @@ -5444,6 +5450,7 @@ function Ace2Inner(){ lineNumbersShown++; var n = lineNumbersShown; var div = odoc.createElement("DIV"); + //calculate height for new line number if(b){ var h = (b.clientHeight || b.offsetHeight); diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 03f1b9c8..013f713d 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -70,6 +70,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (document) { result.node = document.createElement("div"); + result.node.setAttribute("contentEditable", true); // Works but doesn't allow drag n drop ;( } else { @@ -80,7 +81,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) } var html = []; - var preHtml = '', + var preHtml = '', postHtml = ''; var curHTML = null; diff --git a/src/static/js/pad.js b/src/static/js/pad.js index eb90a883..394d853e 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -513,7 +513,7 @@ var pad = { _afterHandshake: function() { pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp; - + //initialize the chat chat.init(this); getParams(); From f16616d23bbbf813232bfa80f2796dca1eaf072c Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 8 Jan 2016 13:26:46 +0000 Subject: [PATCH 2/8] seems to work --- src/node/handler/ImportHandler.js | 2 +- src/static/js/pad.js | 2 +- src/templates/pad.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 026ce020..9f96a926 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -292,7 +292,7 @@ exports.doImport = function(req, res, padId) " diff --git a/src/static/js/ace.js b/src/static/js/ace.js index 0e81974c..a5e365ce 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -286,7 +286,6 @@ window.onload = function () {\n\ iframe.name = "ace_inner";\n\ iframe.title = "pad";\n\ iframe.scrolling = "no";\n\ - iframe.setAttribute("sandbox", "allow-same-origin allow-scripts allow-popups allow-forms allow-modals");\n\ var outerdocbody = document.getElementById("outerdocbody");\n\ iframe.frameBorder = 0;\n\ iframe.allowTransparency = true; // for IE\n\ @@ -326,13 +325,10 @@ window.onload = function () {\n\ // bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly // (throbs busy while typing) - var testHTML = 'WONT WORK in Chrome'; - - outerHTML.push('', '', scriptTag(outerScript), '
x
'+testHTML+''); + outerHTML.push('', '', scriptTag(outerScript), '
x
'); var outerFrame = document.createElement("IFRAME"); outerFrame.name = "ace_outer"; - outerFrame.setAttribute("sandbox", "allow-same-origin allow-scripts allow-popups allow-forms allow-modals"); outerFrame.frameBorder = 0; // for IE outerFrame.title = "Ether"; info.frame = outerFrame; diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 4473126c..9586de1d 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5006,12 +5006,6 @@ function Ace2Inner(){ }); }) -/* - $(root).on("dragend", function(e){ - top.console.log("dragend"); - }); - - $(root).on("drop", function(e){ top.console.log("DROP"); if(e.target.a || e.target.localName === "a"){ @@ -5026,7 +5020,6 @@ function Ace2Inner(){ e: e }); }); -*/ // CompositionEvent is not implemented below IE version 8 if ( !(browser.msie && parseInt(browser.version <= 9)) && document.documentElement) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index b4f3c1b6..877ef45d 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -522,11 +522,6 @@ var pad = { pad.initTime = +(new Date()); pad.padOptions = clientVars.initialOptions; - if ((!browser.msie) && (!(browser.firefox && browser.version.indexOf("1.8.") == 0))) - { -// document.domain = document.domain; // for comet - } - // for IE if (browser.msie) { From ae6110919f0256192224d1a38b1819fb18bb6ee4 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 8 Jan 2016 13:39:59 +0000 Subject: [PATCH 4/8] removal --- src/static/js/ace2_inner.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 9586de1d..6728f3b9 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5007,7 +5007,6 @@ function Ace2Inner(){ }) $(root).on("drop", function(e){ - top.console.log("DROP"); if(e.target.a || e.target.localName === "a"){ e.preventDefault(); } From cb874b695b35f574adb6989bb4eee0a66f478f6d Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 8 Jan 2016 13:40:25 +0000 Subject: [PATCH 5/8] herp --- src/templates/pad.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/templates/pad.html b/src/templates/pad.html index ecec5a00..767c1ec9 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -391,9 +391,6 @@ $ = jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery; // Expose jQuery #HACK browser = require('ep_etherpad-lite/static/js/browser'); - if ((!browser.msie) && (!(browser.mozilla && browser.version.indexOf("1.8.") == 0))) { -// document.domain = document.domain; // for comet - } var plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins'); var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks'); From f80407c6ffab746eeb12bedb59da622fa16aa532 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 8 Jan 2016 13:41:52 +0000 Subject: [PATCH 6/8] removal --- src/static/js/domline.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 013f713d..ed3f147a 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -70,7 +70,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (document) { result.node = document.createElement("div"); - result.node.setAttribute("contentEditable", true); // Works but doesn't allow drag n drop ;( } else { From 50c6b5ed61530af9946530c1c438feb7a7b06d25 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 10 Jan 2016 14:39:41 +0000 Subject: [PATCH 7/8] tidy up --- src/static/js/pad.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 877ef45d..d54f9c88 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -513,7 +513,6 @@ var pad = { _afterHandshake: function() { pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp; - //initialize the chat chat.init(this); getParams(); From 935b921c2b1a7a01c98f4ab99a36c1378c831b7d Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 10 Jan 2016 14:40:57 +0000 Subject: [PATCH 8/8] more tidy --- src/static/js/ace2_inner.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 6728f3b9..0cfdec3f 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5442,7 +5442,6 @@ function Ace2Inner(){ lineNumbersShown++; var n = lineNumbersShown; var div = odoc.createElement("DIV"); - //calculate height for new line number if(b){ var h = (b.clientHeight || b.offsetHeight);