From 01483406ee2bd45b9f98e0e552b828556cb8b8d0 Mon Sep 17 00:00:00 2001 From: Robin Buse Date: Tue, 26 Jul 2011 18:11:51 +0300 Subject: [PATCH 1/8] pass w3c validator --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 7648e838..f6c350f4 100644 --- a/static/index.html +++ b/static/index.html @@ -85,7 +85,7 @@
New Pad

or create/open a Pad with the name
-
+
From 2e163f2924efd020e77d2d11569d21b3b134b1dc Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Tue, 26 Jul 2011 17:00:56 +0100 Subject: [PATCH 2/8] reorganzied the bin folder --- bin/{runDebug.sh => debugRun.sh} | 2 +- bin/runTests.sh | 14 -------------- bin/{runSafe.sh => safeRun.sh} | 0 3 files changed, 1 insertion(+), 15 deletions(-) rename bin/{runDebug.sh => debugRun.sh} (88%) delete mode 100755 bin/runTests.sh rename bin/{runSafe.sh => safeRun.sh} (100%) diff --git a/bin/runDebug.sh b/bin/debugRun.sh similarity index 88% rename from bin/runDebug.sh rename to bin/debugRun.sh index 46eec8e8..8e1d737e 100755 --- a/bin/runDebug.sh +++ b/bin/debugRun.sh @@ -3,7 +3,7 @@ type -P node-inspector &>/dev/null || { echo "You need to install node-inspector to run the tests!" >&2 echo "You can install it with npm" >&2 - echo "Run: npm install node-inspector" >&2 + echo "Run: npm install -g node-inspector" >&2 exit 1 } diff --git a/bin/runTests.sh b/bin/runTests.sh deleted file mode 100755 index f22004e3..00000000 --- a/bin/runTests.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -type -P nodeunit &>/dev/null || { - echo "You need to install Nodeunit to run the tests!" >&2 - echo "You can install it with npm" >&2 - echo "Run: npm install nodeunit" >&2 - exit 1 -} - -if [ -d "../bin" ]; then - cd "../" -fi - -nodeunit tests diff --git a/bin/runSafe.sh b/bin/safeRun.sh similarity index 100% rename from bin/runSafe.sh rename to bin/safeRun.sh From b987a23cd0cb83c6ff0b4beb659fda46347cb26b Mon Sep 17 00:00:00 2001 From: Robin Buse Date: Tue, 26 Jul 2011 19:32:41 +0300 Subject: [PATCH 3/8] Edited static/index.html via GitHub --- static/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index f6c350f4..955eb4db 100644 --- a/static/index.html +++ b/static/index.html @@ -73,12 +73,12 @@ font-weight: bold; font-size: 17px; padding: 5px; - width: 245px; + width: 215px; outline: none; } input[type="submit"] { height: 35px; - width: 40px; + width: 70px; }
From 3c493b2f50a98e1a9a02ceff3b66e1ef543f3ba1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Jul 2011 17:35:00 +0100 Subject: [PATCH 4/8] Fix for IE erroring on chat window close --- static/pad.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/pad.html b/static/pad.html index 613d8291..956bcdb4 100644 --- a/static/pad.html +++ b/static/pad.html @@ -260,7 +260,7 @@ Use this link to share a read-only version of your pad:
-
Chat
+
Chat
From 56ab112fa33d7fb9035a04d4a6ccdce4b9726724 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Tue, 26 Jul 2011 17:39:25 +0100 Subject: [PATCH 5/8] Timeslider Javascript is now minified too --- node/minify.js | 41 ++++++++++++++++++++++++++++++++--------- node/server.js | 8 ++++---- static/timeslider.html | 25 ++++--------------------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/node/minify.js b/node/minify.js index fe9a8908..f34b400f 100644 --- a/node/minify.js +++ b/node/minify.js @@ -30,16 +30,32 @@ var Buffer = require('buffer').Buffer; var gzip = require('gzip'); var server = require('./server'); +var padJS = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js"]; + +var timesliderJS = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "colorutils.js", "draggable.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "easysync2_client.js", "domline_client.js", "linestylefilter_client.js", "cssmanager_client.js", "broadcast.js", "broadcast_slider.js", "broadcast_revisions.js"]; + /** - * Answers a http request for the pad javascript + * creates the minifed javascript for the given minified name * @param req the Express request * @param res the Express response */ -exports.padJS = function(req, res) +exports.minifyJS = function(req, res, jsFilename) { res.header("Content-Type","text/javascript"); - - var jsFiles = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js"]; + + //choose the js files we need + if(jsFilename == "pad.js") + { + jsFiles = padJS; + } + else if(jsFilename == "timeslider.js") + { + jsFiles = timesliderJS; + } + else + { + throw new Error("there is no profile for creating " + name); + } //minifying is enabled if(settings.minify) @@ -91,7 +107,7 @@ exports.padJS = function(req, res) function(callback) { //check the modification time of the minified js - fs.stat("../var/minified_pad.js", function(err, stats) + fs.stat("../var/minified_" + jsFilename, function(err, stats) { if(err && err.code != "ENOENT") callback(err); @@ -122,6 +138,13 @@ exports.padJS = function(req, res) //find all includes in ace.js and embed them function(callback) { + //if this is not the creation of pad.js, skip this part + if(jsFilename != "pad.js") + { + callback(); + return; + } + var founds = fileValues["ace.js"].match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"]+\)/gi); //go trough all includes @@ -194,7 +217,7 @@ exports.padJS = function(req, res) //write the results plain in a file function(callback) { - fs.writeFile("../var/minified_pad.js", result, "utf8", callback); + fs.writeFile("../var/minified_" + jsFilename, result, "utf8", callback); }, //write the results compressed in a file function(callback) @@ -202,7 +225,7 @@ exports.padJS = function(req, res) gzip(result, 9, function(err, compressedResult){ if(err) {callback(err); return} - fs.writeFile("../var/minified_pad.js.gz", compressedResult, callback); + fs.writeFile("../var/minified_" + jsFilename + ".gz", compressedResult, callback); }); } ],callback); @@ -217,12 +240,12 @@ exports.padJS = function(req, res) var pathStr; if(gzipSupport) { - pathStr = path.normalize(__dirname + "/../var/minified_pad.js.gz"); + pathStr = path.normalize(__dirname + "/../var/minified_" + jsFilename + ".gz"); res.header('Content-Encoding', 'gzip'); } else { - pathStr = path.normalize(__dirname + "/../var/minified_pad.js"); + pathStr = path.normalize(__dirname + "/../var/minified_" + jsFilename ); } res.sendfile(pathStr, { maxAge: server.maxAge }); diff --git a/node/server.js b/node/server.js index a1c42ae1..c79dfede 100644 --- a/node/server.js +++ b/node/server.js @@ -87,19 +87,19 @@ async.waterfall([ }); //serve minified files - app.get('/minified/:id', function(req, res) + app.get('/minified/:id', function(req, res, next) { res.header("Server", serverName); var id = req.params.id; - if(id == "pad.js") + if(id == "pad.js" || id == "timeslider.js") { - minify.padJS(req,res); + minify.minifyJS(req,res,id); } else { - res.send('404 - Not Found', 404); + next(); } }); diff --git a/static/timeslider.html b/static/timeslider.html index 6c6ab850..b850874a 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -8,7 +8,10 @@ - + + + + - - - - - - - - - - - - - - - - - - - From 1a43731a062be3c31b1873a373741514e908033f Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Tue, 26 Jul 2011 18:02:23 +0100 Subject: [PATCH 6/8] Ops, looks like I broke the wordle export at some point, now I fixed it --- static/pad.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/pad.html b/static/pad.html index 613d8291..73af50b7 100644 --- a/static/pad.html +++ b/static/pad.html @@ -225,7 +225,7 @@ We removed this feature cause its not worth the space it needs in the editbar
Microsoft Word
PDF
OpenDocument
-
Wordle
+
Wordle
From 1e54c41f60c8ffa2f671132f9c767a6b6aeebadf Mon Sep 17 00:00:00 2001 From: Robin Buse Date: Tue, 26 Jul 2011 20:14:01 +0300 Subject: [PATCH 7/8] Edited static/index.html via GitHub --- static/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index 955eb4db..f6c350f4 100644 --- a/static/index.html +++ b/static/index.html @@ -73,12 +73,12 @@ font-weight: bold; font-size: 17px; padding: 5px; - width: 215px; + width: 245px; outline: none; } input[type="submit"] { height: 35px; - width: 70px; + width: 40px; }
From 6867d881b17f198afd148e9752fd2b37d048e0ca Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Tue, 26 Jul 2011 18:54:42 +0100 Subject: [PATCH 8/8] Hide import/export options that are not avaiable if abiword isn't configured --- node/PadMessageHandler.js | 2 ++ static/js/pad_impexp.js | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/node/PadMessageHandler.js b/node/PadMessageHandler.js index 5d43fa6b..faf0ec6f 100644 --- a/node/PadMessageHandler.js +++ b/node/PadMessageHandler.js @@ -24,6 +24,7 @@ var Changeset = require("./Changeset"); var AttributePoolFactory = require("./AttributePoolFactory"); var authorManager = require("./AuthorManager"); var readOnlyManager = require("./ReadOnlyManager"); +var settings = require('./settings'); /** * A associative array that translates a session to a pad @@ -731,6 +732,7 @@ function handleClientReady(client, message) "fullWidth": false, "hideSidebar": false }, + "abiwordAvailable": settings.abiword != null, "hooks": {} } diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 964eced6..e5dee7af 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -233,12 +233,26 @@ var padimpexp = (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"); + + //hide stuff thats not avaible if abiword is disabled + if(!clientVars.abiwordAvailable) + { + $("#exportworda").remove(); + $("#exportpdfa").remove(); + $("#exportopena").remove(); + $("#importexport").css({"height":"95px"}); + $("#importexportline").css({"height":"95px"}); + $("#import").html("Import is not available"); + } + else + { + $("#exportworda").attr("href", document.location.href + "/export/doc"); + $("#exportpdfa").attr("href", document.location.href + "/export/pdf"); + $("#exportopena").attr("href", document.location.href + "/export/odt"); + + $("#importform").get(0).setAttribute('action', document.location.href + "/import"); + } $("#impexp-close").click(function() {