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 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..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$/, '')}) ); @@ -57,6 +56,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(); @@ -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) { diff --git a/node/utils/caching_middleware.js b/node/utils/caching_middleware.js index 809bb210f..f25059b88 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 { @@ -87,11 +87,10 @@ 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; - 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. @@ -162,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(); } } 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", diff --git a/static/css/pad.css b/static/css/pad.css index fe188e474..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,10 +1084,9 @@ width:33px !important; word-wrap: break-word; } -/* fix for misaligned labels */ -label { - position: relative; - bottom: 1px; +/* fix for misaligned checkboxes */ +input[type=checkbox] { + vertical-align: -1px; } .right { 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; + } } } } 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;