From 73f97cc7d59d16942400c53c3c0a7adb6fc46db3 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Fri, 22 Jul 2011 13:45:12 +0100 Subject: [PATCH 1/9] removed the tests folder, we never did tests anyway --- tests/PadManager_tests.js | 37 ------------------------------------- tests/README | 1 - 2 files changed, 38 deletions(-) delete mode 100644 tests/PadManager_tests.js delete mode 100644 tests/README diff --git a/tests/PadManager_tests.js b/tests/PadManager_tests.js deleted file mode 100644 index 791af4218..000000000 --- a/tests/PadManager_tests.js +++ /dev/null @@ -1,37 +0,0 @@ -var padManager = require("../node/PadManager"); - -/** - * Tests if new Pads a created with the correct inital values - */ -exports.createAPad = function(test) -{ - test.expect(7); - - //Test if PadManager gives null when a Pad don't exist and you don't wish to create it - var pad = padManager.getPad("test", false); - test.equal(pad, null, "The PadManager gives a value for a pad that was never created'"); - - //Test if PadManager creates a Pad with the correct id when you want to create it - pad = padManager.getPad("test", true); - test.equal(pad.id, "test", "The PadManager gave a pad with a other id than expeted"); - - //Test if the startText is correct set - var atext = pad.atext; - test.equal(atext.text, padManager.startText + "\n", "The Starttext of a Pad is wrong set"); - - //Test if the atext().text and text() is the same - test.equal(atext.text, pad.text(), "pad.atext.text is not pad.text()"); - - //Test if the Revision Number is Zero - var head = pad.getHeadRevisionNumber(); - test.equal(head, 0, "The Revision Number is not zero!"); - - //Check if the first Author is a empty String - var firstAuthor = pad.getRevisionAuthor(0); - test.equal(firstAuthor, '', "The Author of the First Revision is not a empty String"); - - var firstChangeset = pad.getRevisionChangeset(0); - test.ok(firstChangeset.indexOf(padManager.startText) > -1, "The first Changeset does not contain the inital Text"); - - test.done(); -} diff --git a/tests/README b/tests/README deleted file mode 100644 index b762dcf75..000000000 --- a/tests/README +++ /dev/null @@ -1 +0,0 @@ -You can run the tests with runTests.sh in the bin folder From a717e075313283d6a094e821175fcc660e8bd590 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Fri, 22 Jul 2011 14:07:13 +0100 Subject: [PATCH 2/9] Moved John's code to the correct place --- static/js/pad2.js | 19 ------------------- static/js/pad_impexp.js | 21 +++++++++++++++++++++ static/pad.html | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/static/js/pad2.js b/static/js/pad2.js index f57656c5c..fddd9622e 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -21,13 +21,6 @@ var socket; $(document).ready(function() { handshake(); -// This is a temporary location, Peter to move - $("#exporthtmla").attr("href", document.location.href + "/export/html"); - $("#exportplaina").attr("href", document.location.href + "/export/txt"); - $("#exportworda").attr("href", document.location.href + "/export/doc"); - $("#exportpdfa").attr("href", document.location.href + "/export/pdf"); - $("#exportopena").attr("href", document.location.href + "/export/odt"); - $("#exportwordlea").attr("href", document.location.href + "/export/wordle"); }); $(window).unload(function() @@ -35,18 +28,6 @@ $(window).unload(function() pad.dispose(); }); -// Wordle code, Peter to move -function loadCont(){ - padUrl = location.pathname; - padHost = location.host; - var padUrl = "http://" + padHost + padUrl + "/export/txt"; - $.get(padUrl, function(data) { - $('.result').html(data); - $('#text').html(data); - $('#wordlepost').submit(); - }); -} - function createCookie(name, value, days) { if (days) diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 261a31382..964eced60 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -230,6 +230,14 @@ var padimpexp = (function() var self = { init: function() { + // build the export links + $("#exporthtmla").attr("href", document.location.href + "/export/html"); + $("#exportplaina").attr("href", document.location.href + "/export/txt"); + $("#exportworda").attr("href", document.location.href + "/export/doc"); + $("#exportpdfa").attr("href", document.location.href + "/export/pdf"); + $("#exportopena").attr("href", document.location.href + "/export/odt"); + $("#exportwordlea").attr("href", document.location.href + "/export/wordle"); + $("#importform").get(0).setAttribute('action', document.location.href + "/import"); $("#impexp-close").click(function() @@ -264,6 +272,19 @@ var padimpexp = (function() $("#impexp-disabled-clickcatcher").hide(); $("#import").css('opacity', 1); $("#impexp-export").css('opacity', 1); + }, + export2Wordle: function() + { + padUrl = location.pathname; + padHost = location.host; + var padUrl = "http://" + padHost + padUrl + "/export/txt"; + + $.get(padUrl, function(data) + { + $('.result').html(data); + $('#text').html(data); + $('#wordlepost').submit(); + }); } }; return self; diff --git a/static/pad.html b/static/pad.html index 09251abd7..03cec903e 100644 --- a/static/pad.html +++ b/static/pad.html @@ -234,7 +234,7 @@ We removed this feature cause its not worth the space it needs in the editbar
Microsoft Word
PDF
OpenDocument
-
Wordle
+
Wordle
From 3ccdcec7e8c9ca755a291dfc214e9acd25410175 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Fri, 22 Jul 2011 14:17:58 +0100 Subject: [PATCH 3/9] ensure we don't send a handshake on every reconnect --- static/js/pad2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/pad2.js b/static/js/pad2.js index fddd9622e..260b3dd09 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -80,7 +80,7 @@ function handshake() resource: resource }); - socket.on('connect', function() + socket.once('connect', function() { var padId = document.URL.substring(document.URL.lastIndexOf("/") + 1); From 1c8f70fae91892f6e3327dc80202daecd61d69bd Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 24 Jul 2011 20:18:47 +0100 Subject: [PATCH 4/9] Disabling minify creates now one big js file, instead of loading js files dynamicly. This solves problems we had with random loading of the js files --- node/minify.js | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/node/minify.js b/node/minify.js index 54fe18483..e438de229 100644 --- a/node/minify.js +++ b/node/minify.js @@ -228,24 +228,34 @@ exports.padJS = function(req, res) res.sendfile(pathStr, { maxAge: server.maxAge }); }) } - //minifying is disabled, so load the files with jquery + //minifying is disabled, so put the files together in one file else { - res.write("function loadjsfile(filename){\n"+ - "var fileref=document.createElement('script');\n"+ - "fileref.setAttribute('type','text/javascript');\n"+ - "var path = 'static/js/' + filename;\n"+ - "fileref.setAttribute('src', path);\n" + - "document.getElementsByTagName('head')[0].appendChild(fileref);\n" + - "}\n"); + var fileValues = {}; - for(var i in jsFiles) + //read all js files + async.forEach(jsFiles, function (item, callback) { - console.log(jsFiles[i]); - res.write("loadjsfile('"+ jsFiles[i] + "');\n"); - } - - res.end(); + fs.readFile("../static/js/" + item, "utf-8", function(err, data) + { + fileValues[item] = data; + callback(err); + }); + }, + //send all files together + function(err) + { + if(err) throw err; + + for(var i=0;i Date: Sun, 24 Jul 2011 09:28:45 -0700 Subject: [PATCH 5/9] Edited static/index.html via GitHub --- static/index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index c363f1908..53aa1047d 100644 --- a/static/index.html +++ b/static/index.html @@ -32,8 +32,7 @@ -moz-border-radius: 4px; border-radius: 4px; - background-color: #fff; - background: white; /* fallback for older/unsupporting browsers */ + background #fff; background: -moz-linear-gradient(top, #aaa, white 70%, white 70%); background: -webkit-gradient(linear, 0 0, 0 100%, from(#aaa), color-stop(70%, white), color-stop(70%, white)); From 646d300b249ad67c737f50ffdf6134fa04370466 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 24 Jul 2011 20:25:17 +0100 Subject: [PATCH 6/9] removed blue lines from export links --- static/css/pad_lite.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/css/pad_lite.css b/static/css/pad_lite.css index 66480fd43..9272d64ba 100644 --- a/static/css/pad_lite.css +++ b/static/css/pad_lite.css @@ -1000,6 +1000,10 @@ position: relative; background-position: 2px -49px; } +#export a{ + text-decoration: none; +} + #importstatusball{ display:none; } From 8138c7d15e7fa3fc126a2a0346579ca1252ff546 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 24 Jul 2011 20:29:53 +0100 Subject: [PATCH 7/9] rename pad_lite.css to pad.css, its just a better name --- static/css/{pad_lite.css => pad.css} | 0 static/pad.html | 6 +----- 2 files changed, 1 insertion(+), 5 deletions(-) rename static/css/{pad_lite.css => pad.css} (100%) diff --git a/static/css/pad_lite.css b/static/css/pad.css similarity index 100% rename from static/css/pad_lite.css rename to static/css/pad.css diff --git a/static/pad.html b/static/pad.html index 03cec903e..c4fbe1956 100644 --- a/static/pad.html +++ b/static/pad.html @@ -7,12 +7,8 @@ Etherpad Lite - - - +