From 96ee77d85b9e0880c7986894de16c546f114b3d2 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 18:05:27 -0800 Subject: [PATCH 01/13] Check error not stats. --- node/utils/caching_middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/utils/caching_middleware.js b/node/utils/caching_middleware.js index 809bb210f..2cdb2dfcf 100644 --- a/node/utils/caching_middleware.js +++ b/node/utils/caching_middleware.js @@ -53,7 +53,7 @@ CachingMiddleware.prototype = new function () { fs.stat(CACHE_DIR + 'minified_' + cacheKey, function (error, stats) { var modifiedSince = (req.headers['if-modified-since'] && new Date(req.headers['if-modified-since'])); - var lastModifiedCache = stats && stats.mtime; + var lastModifiedCache = !error && stats.mtime; if (lastModifiedCache) { req.headers['if-modified-since'] = lastModifiedCache.toUTCString(); } else { From 24a26953a7c2e69cd365270a464bd4d347f70771 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 18:06:30 -0800 Subject: [PATCH 02/13] Account for undefined argument. --- node/utils/caching_middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/utils/caching_middleware.js b/node/utils/caching_middleware.js index 2cdb2dfcf..8c51f662f 100644 --- a/node/utils/caching_middleware.js +++ b/node/utils/caching_middleware.js @@ -87,7 +87,7 @@ CachingMiddleware.prototype = new function () { // Update cache var buffer = ''; - Object.keys(headers).forEach(function (key) { + Object.keys(headers || {}).forEach(function (key) { res.setHeader(key, headers[key]); }); headers = _headers; From 118e7928b96f771127775486b2a84f3cd8cba824 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 18:08:03 -0800 Subject: [PATCH 03/13] Headers should only be set after file is written. --- node/utils/caching_middleware.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/node/utils/caching_middleware.js b/node/utils/caching_middleware.js index 8c51f662f..b0da22dc7 100644 --- a/node/utils/caching_middleware.js +++ b/node/utils/caching_middleware.js @@ -91,7 +91,6 @@ CachingMiddleware.prototype = new function () { res.setHeader(key, headers[key]); }); headers = _headers; - responseCache[cacheKey] = {statusCode: status, headers: headers}; old_res.write = res.write; old_res.end = res.end; @@ -118,7 +117,10 @@ CachingMiddleware.prototype = new function () { } }); } - ], respond); + ], function () { + responseCache[cacheKey] = {statusCode: status, headers: headers}; + respond(); + }); }; } else if (status == 304) { // Nothing new changed from the cached version. From a7c009d0c9bb711d11ee20b998ffdd853a4d5c47 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 18:09:33 -0800 Subject: [PATCH 04/13] Status code should not be assumed. --- node/utils/caching_middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/utils/caching_middleware.js b/node/utils/caching_middleware.js index b0da22dc7..f25059b88 100644 --- a/node/utils/caching_middleware.js +++ b/node/utils/caching_middleware.js @@ -164,7 +164,7 @@ CachingMiddleware.prototype = new function () { res.writeHead(statusCode, headers); util.pump(readStream, res); } else { - res.writeHead(200, headers); + res.writeHead(statusCode, headers); res.end(); } } From 45ba5d60dc9d2e48f491cfcc9e30ceadb129facc Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 18:13:10 -0800 Subject: [PATCH 05/13] Windows does not like IP addresses of 0.0.0.0. --- node/server.js | 2 +- node/utils/Minify.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/server.js b/node/server.js index 8b0ab2f59..c5377d81b 100644 --- a/node/server.js +++ b/node/server.js @@ -154,7 +154,7 @@ async.waterfall([ // CommonJS loader on the client-side. var jsServer = new (Yajsml.Server)({ rootPath: 'minified/' - , rootURI: 'http://' + settings.ip + ":" + settings.port + '/static/js/' + , rootURI: 'http://localhost:' + settings.port + '/static/js/' }); var StaticAssociator = Yajsml.associators.StaticAssociator; var associations = diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 00e1ce224..04371851c 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -148,7 +148,7 @@ function getAceFile(callback) { var filename = item.match(/"([^"]*)"/)[1]; var request = require('request'); - var baseURI = 'http://' + settings.ip + ":" + settings.port + var baseURI = 'http://localhost:' + settings.port request(baseURI + path.normalize(path.join('/static/', filename)), function (error, response, body) { if (!error && response.statusCode == 200) { From 45b7cafca491c01fb0e76ca5e39a7d3ed401996e Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 18:29:23 -0800 Subject: [PATCH 06/13] Don't let filenames be changed to Windows' backslash-notation. --- node/utils/Minify.js | 1 + 1 file changed, 1 insertion(+) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 04371851c..98eb6f926 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -57,6 +57,7 @@ exports.minify = function(req, res, next) filename = path.normalize(path.join(ROOT_DIR, filename)); if (filename.indexOf(ROOT_DIR) == 0) { filename = filename.slice(ROOT_DIR.length); + filename = filename.replace(/\\/g, '/'); // Windows (safe generally?) } else { res.writeHead(404, {}); res.end(); From 82652dffdae5ab593780f12447745a984e1410b3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 19:00:27 -0800 Subject: [PATCH 07/13] Revert "Add a hack to prevent redirect of requests for `/static/js/pad` to `/static/js/pad.js`." This reverts commit af4bd5ca65637dc660a2ccda9f2454180f38f4d3. --- node/utils/Minify.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 98eb6f926..a49195a7b 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -35,10 +35,9 @@ var TAR_PATH = path.join(__dirname, 'tar.json'); var tar = JSON.parse(fs.readFileSync(TAR_PATH, 'utf8')); // Rewrite tar to include modules with no extensions and proper rooted paths. -// HACK: Also use non-extension name so redirects are not encountered. exports.tar = {}; for (var key in tar) { - exports.tar['/' + key.replace(/\.js$/, '')] = + exports.tar['/' + key] = tar[key].map(function (p) {return '/' + p}).concat( tar[key].map(function (p) {return '/' + p.replace(/\.js$/, '')}) ); From 07823ddf26a14c9ec56ff62973db5b1647843ef1 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 28 Feb 2012 19:40:10 -0800 Subject: [PATCH 08/13] Update to yajsml with more windows support. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3231eb6ca..01eb8e96a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "name": "Robin Buse" } ], "dependencies" : { - "yajsml" : "1.1.1", + "yajsml" : "1.1.2", "request" : "2.9.100", "require-kernel" : "1.0.3", "socket.io" : "0.8.7", From cefda46a44d7b7a0fee10ca8b208e1e17e0918ff Mon Sep 17 00:00:00 2001 From: 0ip Date: Wed, 29 Feb 2012 12:54:44 +0100 Subject: [PATCH 09/13] fixes #520, sideeffect: looks bad now using Chrome --- static/css/pad.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index fe188e474..24421069d 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1118,12 +1118,6 @@ width:33px !important; word-wrap: break-word; } -/* fix for misaligned labels */ -label { - position: relative; - bottom: 1px; -} - .right { float:right; } From 43e90c7470f3133cb7f6b4093bfd47f1624a2622 Mon Sep 17 00:00:00 2001 From: 0ip Date: Wed, 29 Feb 2012 13:17:35 +0100 Subject: [PATCH 10/13] cross-browser compatible solution + removed some resizing stuff --- static/css/pad.css | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 24421069d..969d00276 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -878,40 +878,6 @@ ul#colorpickerswatches li:hover margin-left: 3px; margin-right: 3px; margin-top:2px; -} - - -/* resizable stuff for chat */ -.ui-resizable { -position: relative; -} -.ui-resizable-handle { - position: absolute; - font-size: 0.1px; - z-index: 99999; - display: block; - -} - -.ui-resizable-nw { - background-image: url("../../static/img/etherpad_lite_icons.png"); - background-position: 0 -416px; - background-repeat: no-repeat; - background-size: 100% auto; - cursor: nw-resize; - height: 17px; - left: 3px; - top: 3px; - width: 17px; -} - -.ui-resizable-ne -{ - cursor: ne-resize; - width: 9px; - height: 9px; - right: -5px; - top: -5px; } .exporttype{ @@ -1118,6 +1084,11 @@ width:33px !important; word-wrap: break-word; } +/* fix for misaligned checkboxes */ +input[type=checkbox] { + vertical-align: -1px; +} + .right { float:right; } From 173e7c8f278c2feba69526e13fdedfae8dd72341 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Wed, 29 Feb 2012 14:16:20 +0100 Subject: [PATCH 11/13] Extend colorutils Add color invertion and calculation of complementary colors. --- static/js/colorutils.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/static/js/colorutils.js b/static/js/colorutils.js index 9bba39ad2..5fbefb4df 100644 --- a/static/js/colorutils.js +++ b/static/js/colorutils.js @@ -120,4 +120,19 @@ colorutils.blend = function(c1, c2, t) return [colorutils.scale(t, c1[0], c2[0]), colorutils.scale(t, c1[1], c2[1]), colorutils.scale(t, c1[2], c2[2])]; } +colorutils.invert = function(c) +{ + return [1 - c[0], 1 - c[1], 1- c[2]]; +} + +colorutils.complementary = function(c) +{ + var inv = colorutils.invert(c); + return [ + (inv[0] >= c[0]) ? Math.min(inv[0] * 1.30, 1) : (c[0] * 0.30), + (inv[1] >= c[1]) ? Math.min(inv[1] * 1.59, 1) : (c[1] * 0.59), + (inv[2] >= c[2]) ? Math.min(inv[2] * 1.11, 1) : (c[2] * 0.11) + ]; +} + exports.colorutils = colorutils; From f5f82a76375bb07366f9246e15d565224e84af72 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Wed, 29 Feb 2012 14:21:35 +0100 Subject: [PATCH 12/13] Rework dynamic text contrast -Remove hard coding of default text color -add dynamic link text contrast --- static/js/ace2_inner.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 71f7d20f8..17d02036f 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -229,18 +229,34 @@ function Ace2Inner(){ bgcolor = fadeColor(bgcolor, info.fade); } - // Text color - var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) ? '#ffffff' : '#000000'; - var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))); - authorStyle.backgroundColor = bgcolor; - authorStyle.color = txtcolor; - var authorStyleTop = dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))); + var anchorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))+' > a') + + // author color + authorStyle.backgroundColor = bgcolor; authorStyleTop.backgroundColor = bgcolor; - authorStyleTop.color = txtcolor; + + // text contrast + if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) + { + authorStyle.color = '#ffffff'; + authorStyleTop.color = '#ffffff'; + }else{ + authorStyle.color = null; + authorStyleTop.color = null; + } + + // anchor text contrast + if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.55) + { + anchorStyle.color = colorutils.triple2css(colorutils.complementary(colorutils.css2triple(bgcolor))); + }else{ + anchorStyle.color = null; + } } } } From b148a42946d537a53f2dcbd47653d46411499012 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 29 Feb 2012 13:45:42 +0000 Subject: [PATCH 13/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a996c9054..84e866585 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ contribute to Etherpad Lite. # Donations * [Etherpad Foundation Flattr] (http://flattr.com/thing/71378/Etherpad-Foundation) -* [Paypal] (https://www.paypal.com/uk/cgi-bin/webscr?cmd=_flow&SESSION=TXRTE1vjRbRm3BLkUVjy905bTyvanL6f_zwKicQII2Vp8aijc2gHHd4tTgm&dispatch=5885d80a13c0db1f8e263663d3faee8d43b1bb6ca6ed6d454adc375ba2d28b99) +* [Paypal] (http://etherpad.org) <-- Click the donate button # License [Apache License v2](http://www.apache.org/licenses/LICENSE-2.0.html) \ No newline at end of file