From 0c723c26868906188896c131a5f9e6ec242d70f1 Mon Sep 17 00:00:00 2001 From: booo Date: Mon, 30 Jan 2012 15:59:13 +0100 Subject: [PATCH 01/20] remove joose dependency --- node/db/Pad.js | 869 ++++++++++++++++++++---------------------- node/db/PadManager.js | 2 +- package.json | 1 - 3 files changed, 415 insertions(+), 457 deletions(-) diff --git a/node/db/Pad.js b/node/db/Pad.js index 7807d4643..632eebe8c 100644 --- a/node/db/Pad.js +++ b/node/db/Pad.js @@ -2,8 +2,6 @@ * The pad object, defined with joose */ -require('joose'); - var ERR = require("async-stacktrace"); var Changeset = require("../utils/Changeset"); var AttributePoolFactory = require("../utils/AttributePoolFactory"); @@ -22,490 +20,451 @@ var crypto = require("crypto"); */ exports.cleanText = function (txt) { return txt.replace(/\r\n/g,'\n').replace(/\r/g,'\n').replace(/\t/g, ' ').replace(/\xa0/g, ' '); -} +}; -Class('Pad', { - // these are the properties - has : { - - atext : { - is : 'rw', // readwrite - init : function() { return Changeset.makeAText("\n"); } // first value - }, // atext - - pool : { - is: 'rw', - init : function() { return AttributePoolFactory.createAttributePool(); }, - getterName : 'apool' // legacy - }, // pool - - head : { - is : 'rw', - init : -1, - getterName : 'getHeadRevisionNumber' - }, // head - - chatHead : { - is: 'rw', - init: -1 - }, // chatHead - - publicStatus : { - is: 'rw', - init: false, - getterName : 'getPublicStatus' - }, //publicStatus - - passwordHash : { - is: 'rw', - init: null - }, // passwordHash - - id : { is : 'r' } - }, +var Pad = function Pad(id) { - methods : { - - BUILD : function (id) - { - return { - 'id' : id, - } - }, - - appendRevision : function(aChangeset, author) - { - if(!author) - author = ''; + this.atext = Changeset.makeAText("\n"); + this.pool = AttributePoolFactory.createAttributePool(); + this.head = -1; + this.chatHead = -1; + this.publicStatus = false; + this.passwordHash = null; + this.id = id; - var newAText = Changeset.applyToAText(aChangeset, this.atext, this.pool); - Changeset.copyAText(newAText, this.atext); - - var newRev = ++this.head; - - var newRevData = {}; - newRevData.changeset = aChangeset; - newRevData.meta = {}; - newRevData.meta.author = author; - newRevData.meta.timestamp = new Date().getTime(); - - //ex. getNumForAuthor - if(author != '') - this.pool.putAttrib(['author', author || '']); - - if(newRev % 100 == 0) - { - newRevData.meta.atext = this.atext; - } - - db.set("pad:"+this.id+":revs:"+newRev, newRevData); - db.set("pad:"+this.id, {atext: this.atext, - pool: this.pool.toJsonable(), - head: this.head, - chatHead: this.chatHead, - publicStatus: this.publicStatus, - passwordHash: this.passwordHash}); - }, //appendRevision - - getRevisionChangeset : function(revNum, callback) +}; + +exports.Pad = Pad; + +Pad.prototype.apool = function apool() { + return this.pool; +}; + +Pad.prototype.getHeadRevisionNumber = function getHeadRevisionNumber() { + return this.head; +}; + +Pad.prototype.getPublicStatus = function getPublicStatus() { + return this.publicStatus; +}; + +Pad.prototype.appendRevision = function appendRevision(aChangeset, author) { + if(!author) + author = ''; + + var newAText = Changeset.applyToAText(aChangeset, this.atext, this.pool); + Changeset.copyAText(newAText, this.atext); + + var newRev = ++this.head; + + var newRevData = {}; + newRevData.changeset = aChangeset; + newRevData.meta = {}; + newRevData.meta.author = author; + newRevData.meta.timestamp = new Date().getTime(); + + //ex. getNumForAuthor + if(author != '') + this.pool.putAttrib(['author', author || '']); + + if(newRev % 100 == 0) + { + newRevData.meta.atext = this.atext; + } + + db.set("pad:"+this.id+":revs:"+newRev, newRevData); + db.set("pad:"+this.id, {atext: this.atext, + pool: this.pool.toJsonable(), + head: this.head, + chatHead: this.chatHead, + publicStatus: this.publicStatus, + passwordHash: this.passwordHash}); +}; + +Pad.prototype.getRevisionChangeset = function getRevisionChangeset(revNum, callback) { + db.getSub("pad:"+this.id+":revs:"+revNum, ["changeset"], callback); +}; + +Pad.prototype.getRevisionAuthor = function getRevisionAuthor(revNum, callback) { + db.getSub("pad:"+this.id+":revs:"+revNum, ["meta", "author"], callback); +}; + +Pad.prototype.getRevisionDate = function getRevisionDate(revNum, callback) { + db.getSub("pad:"+this.id+":revs:"+revNum, ["meta", "timestamp"], callback); +}; + +Pad.prototype.getAllAuthors = function getAllAuthors() { + var authors = []; + + for(key in this.pool.numToAttrib) + { + if(this.pool.numToAttrib[key][0] == "author" && this.pool.numToAttrib[key][1] != "") { - db.getSub("pad:"+this.id+":revs:"+revNum, ["changeset"], callback); - }, // getRevisionChangeset - - getRevisionAuthor : function(revNum, callback) - { - db.getSub("pad:"+this.id+":revs:"+revNum, ["meta", "author"], callback); - }, // getRevisionAuthor - - getRevisionDate : function(revNum, callback) - { - db.getSub("pad:"+this.id+":revs:"+revNum, ["meta", "timestamp"], callback); - }, // getRevisionAuthor - - getAllAuthors : function() + authors.push(this.pool.numToAttrib[key][1]); + } + } + + return authors; +}; + +Pad.prototype.getInternalRevisionAText = function getInternalRevisionAText(targetRev, callback) { + var _this = this; + + var keyRev = this.getKeyRevisionNumber(targetRev); + var atext; + var changesets = []; + + //find out which changesets are needed + var neededChangesets = []; + var curRev = keyRev; + while (curRev < targetRev) + { + curRev++; + neededChangesets.push(curRev); + } + + async.series([ + //get all needed data out of the database + function(callback) { - var authors = []; - - for(key in this.pool.numToAttrib) - { - if(this.pool.numToAttrib[key][0] == "author" && this.pool.numToAttrib[key][1] != "") + async.parallel([ + //get the atext of the key revision + function (callback) { - authors.push(this.pool.numToAttrib[key][1]); + db.getSub("pad:"+_this.id+":revs:"+keyRev, ["meta", "atext"], function(err, _atext) + { + if(ERR(err, callback)) return; + atext = Changeset.cloneAText(_atext); + callback(); + }); + }, + //get all needed changesets + function (callback) + { + async.forEach(neededChangesets, function(item, callback) + { + _this.getRevisionChangeset(item, function(err, changeset) + { + if(ERR(err, callback)) return; + changesets[item] = changeset; + callback(); + }); + }, callback); } - } - - return authors; + ], callback); }, - - getInternalRevisionAText : function(targetRev, callback) + //apply all changesets to the key changeset + function(callback) { - var _this = this; - - var keyRev = this.getKeyRevisionNumber(targetRev); - var atext; - var changesets = []; - - //find out which changesets are needed - var neededChangesets = []; + var apool = _this.apool(); var curRev = keyRev; - while (curRev < targetRev) + + while (curRev < targetRev) { curRev++; - neededChangesets.push(curRev); + var cs = changesets[curRev]; + atext = Changeset.applyToAText(cs, atext, apool); } - - async.series([ - //get all needed data out of the database - function(callback) - { - async.parallel([ - //get the atext of the key revision - function (callback) - { - db.getSub("pad:"+_this.id+":revs:"+keyRev, ["meta", "atext"], function(err, _atext) - { - if(ERR(err, callback)) return; - atext = Changeset.cloneAText(_atext); - callback(); - }); - }, - //get all needed changesets - function (callback) - { - async.forEach(neededChangesets, function(item, callback) - { - _this.getRevisionChangeset(item, function(err, changeset) - { - if(ERR(err, callback)) return; - changesets[item] = changeset; - callback(); - }); - }, callback); - } - ], callback); - }, - //apply all changesets to the key changeset - function(callback) - { - var apool = _this.apool(); - var curRev = keyRev; - - while (curRev < targetRev) - { - curRev++; - var cs = changesets[curRev]; - atext = Changeset.applyToAText(cs, atext, apool); - } - - callback(null); - } - ], function(err) - { - if(ERR(err, callback)) return; - callback(null, atext); - }); - }, - - getKeyRevisionNumber : function(revNum) - { - return Math.floor(revNum / 100) * 100; - }, - - text : function() - { - return this.atext.text; - }, - - setText : function(newText) - { - //clean the new text - newText = exports.cleanText(newText); - - var oldText = this.text(); - - //create the changeset - var changeset = Changeset.makeSplice(oldText, 0, oldText.length-1, newText); - - //append the changeset - this.appendRevision(changeset); - }, - - appendChatMessage: function(text, userId, time) - { + + callback(null); + } + ], function(err) + { + if(ERR(err, callback)) return; + callback(null, atext); + }); +}; + +Pad.prototype.getKeyRevisionNumber = function getKeyRevisionNumber(revNum) { + return Math.floor(revNum / 100) * 100; +}; + +Pad.prototype.text = function text() { + return this.atext.text; +}; + +Pad.prototype.setText = function setText(newText) { + //clean the new text + newText = exports.cleanText(newText); + + var oldText = this.text(); + + //create the changeset + var changeset = Changeset.makeSplice(oldText, 0, oldText.length-1, newText); + + //append the changeset + this.appendRevision(changeset); +}; + +Pad.prototype.appendChatMessage = function appendChatMessage(text, userId, time) { this.chatHead++; //save the chat entry in the database db.set("pad:"+this.id+":chat:"+this.chatHead, {"text": text, "userId": userId, "time": time}); //save the new chat head db.setSub("pad:"+this.id, ["chatHead"], this.chatHead); - }, - - getChatMessage: function(entryNum, callback) - { - var _this = this; - var entry; - - async.series([ - //get the chat entry - function(callback) - { - db.get("pad:"+_this.id+":chat:"+entryNum, function(err, _entry) - { - if(ERR(err, callback)) return; - entry = _entry; - callback(); - }); - }, - //add the authorName - function(callback) - { - //this chat message doesn't exist, return null - if(entry == null) - { - callback(); - return; - } - - //get the authorName - authorManager.getAuthorName(entry.userId, function(err, authorName) - { - if(ERR(err, callback)) return; - entry.userName = authorName; - callback(); - }); - } - ], function(err) +}; + +Pad.prototype.getChatMessage = function getChatMessage(entryNum, callback) { + var _this = this; + var entry; + + async.series([ + //get the chat entry + function(callback) + { + db.get("pad:"+_this.id+":chat:"+entryNum, function(err, _entry) { if(ERR(err, callback)) return; - callback(null, entry); + entry = _entry; + callback(); }); }, - - getLastChatMessages: function(count, callback) + //add the authorName + function(callback) { - //return an empty array if there are no chat messages - if(this.chatHead == -1) + //this chat message doesn't exist, return null + if(entry == null) { - callback(null, []); + callback(); return; } - - var _this = this; - - //works only if we decrement the amount, for some reason - count--; - //set the startpoint - var start = this.chatHead-count; - if(start < 0) - start = 0; - - //set the endpoint - var end = this.chatHead; - - //collect the numbers of chat entries and in which order we need them - var neededEntries = []; - var order = 0; - for(var i=start;i<=end; i++) - { - neededEntries.push({entryNum:i, order: order}); - order++; - } - - //get all entries out of the database - var entries = []; - async.forEach(neededEntries, function(entryObject, callback) - { - _this.getChatMessage(entryObject.entryNum, function(err, entry) - { - if(ERR(err, callback)) return; - entries[entryObject.order] = entry; - callback(); - }); - }, function(err) - { - if(ERR(err, callback)) return; - - //sort out broken chat entries - //it looks like in happend in the past that the chat head was - //incremented, but the chat message wasn't added - var cleanedEntries = []; - for(var i=0;i delete the entry of this pad in the group - function(callback) - { - //is it a group pad? - if(padID.indexOf("$")!=-1) - { - var groupID = padID.substring(0,padID.indexOf("$")); - - db.get("group:" + groupID, function (err, group) - { - if(ERR(err, callback)) return; - - //remove the pad entry - delete group.pads[padID]; - - //set the new value - db.set("group:" + groupID, group); - - callback(); - }); - } - //its no group pad, nothing to do here - else - { - callback(); - } - }, - //remove the readonly entries - function(callback) - { - readOnlyManager.getReadOnlyId(padID, function(err, readonlyID) - { - if(ERR(err, callback)) return; - - db.remove("pad2readonly:" + padID); - db.remove("readonly2pad:" + readonlyID); - - callback(); - }); - }, - //delete all chat messages - function(callback) - { - var chatHead = _this.chatHead; - - for(var i=0;i<=chatHead;i++) - { - db.remove("pad:"+padID+":chat:"+i); - } - - callback(); - }, - //delete all revisions - function(callback) - { - var revHead = _this.head; - - for(var i=0;i<=revHead;i++) - { - db.remove("pad:"+padID+":revs:"+i); - } - - callback(); - } - ], callback); - }, - //delete the pad entry and delete pad from padManager - function(callback) - { - db.remove("pad:"+padID); - padManager.unloadPad(padID); - callback(); - } - ], function(err) + //get the authorName + authorManager.getAuthorName(entry.userId, function(err, authorName) { if(ERR(err, callback)) return; + entry.userName = authorName; callback(); - }) - }, - //set in db - setPublicStatus: function(publicStatus) - { - this.publicStatus = publicStatus; - db.setSub("pad:"+this.id, ["publicStatus"], this.publicStatus); - }, - setPassword: function(password) - { - this.passwordHash = password == null ? null : hash(password, generateSalt()); - db.setSub("pad:"+this.id, ["passwordHash"], this.passwordHash); - }, - isCorrectPassword: function(password) - { - return compare(this.passwordHash, password) - }, - isPasswordProtected: function() - { - return this.passwordHash != null; + }); } - }, // methods -}); + ], function(err) + { + if(ERR(err, callback)) return; + callback(null, entry); + }); +}; + +Pad.prototype.getLastChatMessages = function getLastChatMessages(count, callback) { + //return an empty array if there are no chat messages + if(this.chatHead == -1) + { + callback(null, []); + return; + } + + var _this = this; + + //works only if we decrement the amount, for some reason + count--; + + //set the startpoint + var start = this.chatHead-count; + if(start < 0) + start = 0; + + //set the endpoint + var end = this.chatHead; + + //collect the numbers of chat entries and in which order we need them + var neededEntries = []; + var order = 0; + for(var i=start;i<=end; i++) + { + neededEntries.push({entryNum:i, order: order}); + order++; + } + + //get all entries out of the database + var entries = []; + async.forEach(neededEntries, function(entryObject, callback) + { + _this.getChatMessage(entryObject.entryNum, function(err, entry) + { + if(ERR(err, callback)) return; + entries[entryObject.order] = entry; + callback(); + }); + }, function(err) + { + if(ERR(err, callback)) return; + + //sort out broken chat entries + //it looks like in happend in the past that the chat head was + //incremented, but the chat message wasn't added + var cleanedEntries = []; + for(var i=0;i delete the entry of this pad in the group + function(callback) + { + //is it a group pad? + if(padID.indexOf("$")!=-1) + { + var groupID = padID.substring(0,padID.indexOf("$")); + + db.get("group:" + groupID, function (err, group) + { + if(ERR(err, callback)) return; + + //remove the pad entry + delete group.pads[padID]; + + //set the new value + db.set("group:" + groupID, group); + + callback(); + }); + } + //its no group pad, nothing to do here + else + { + callback(); + } + }, + //remove the readonly entries + function(callback) + { + readOnlyManager.getReadOnlyId(padID, function(err, readonlyID) + { + if(ERR(err, callback)) return; + + db.remove("pad2readonly:" + padID); + db.remove("readonly2pad:" + readonlyID); + + callback(); + }); + }, + //delete all chat messages + function(callback) + { + var chatHead = _this.chatHead; + + for(var i=0;i<=chatHead;i++) + { + db.remove("pad:"+padID+":chat:"+i); + } + + callback(); + }, + //delete all revisions + function(callback) + { + var revHead = _this.head; + + for(var i=0;i<=revHead;i++) + { + db.remove("pad:"+padID+":revs:"+i); + } + + callback(); + } + ], callback); + }, + //delete the pad entry and delete pad from padManager + function(callback) + { + db.remove("pad:"+padID); + padManager.unloadPad(padID); + callback(); + } + ], function(err) + { + if(ERR(err, callback)) return; + callback(); + }); +}; + //set in db +Pad.prototype.setPublicStatus = function setPublicStatus(publicStatus) { + this.publicStatus = publicStatus; + db.setSub("pad:"+this.id, ["publicStatus"], this.publicStatus); +}; + +Pad.prototype.setPassword = function setPassword(password) { + this.passwordHash = password == null ? null : hash(password, generateSalt()); + db.setSub("pad:"+this.id, ["passwordHash"], this.passwordHash); +}; + +Pad.prototype.isCorrectPassword = function isCorrectPassword(password) { + return compare(this.passwordHash, password); +}; + +Pad.prototype.isPasswordProtected = function isPasswordProtected() { + return this.passwordHash != null; +}; /* Crypto helper methods */ @@ -531,5 +490,5 @@ function generateSalt() function compare(hashStr, password) { - return hash(password, hashStr.split("$")[1]) === hashStr; + return hash(password, hashStr.split("$")[1]) === hashStr; } diff --git a/node/db/PadManager.js b/node/db/PadManager.js index 1aadcd1ff..231aa901f 100644 --- a/node/db/PadManager.js +++ b/node/db/PadManager.js @@ -20,7 +20,7 @@ var ERR = require("async-stacktrace"); var customError = require("../utils/customError"); -require("../db/Pad"); +var Pad = require("../db/Pad").Pad; var db = require("./DB").db; /** diff --git a/package.json b/package.json index e24a776c3..ec6936975 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "socket.io" : "0.8.7", "ueberDB" : "0.1.3", "async" : "0.1.15", - "joose" : "3.50.0", "express" : "2.5.0", "clean-css" : "0.2.4", "uglify-js" : "1.1.1", From f83e619fd97883d9e55494c2f3cc7e84d98fd5a8 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 28 Jan 2012 17:25:24 -0800 Subject: [PATCH 02/20] Null-out the padeditor's reference to ace once it has been distroyed. This enables the guards placed in `padeditor.disable` to work. On `window.unload` the pad's connection would get closed which would lead to the editor becomming disabled. If the editor had already been `disposed` then the call to `disable` would raise the exception: `Uncaught TypeError: Cannot call method 'ace_setProperty' of null` --- static/js/pad_editor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 6d3cbf409..d336aa874 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -141,6 +141,7 @@ var padeditor = (function() if (self.ace) { self.ace.destroy(); + self.ace = null; } }, disable: function() From 23a166ca99d442284001844ca0b4fff7280de4a8 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 30 Jan 2012 13:27:43 -0800 Subject: [PATCH 03/20] JSON exports itself. This fixes issue #376. --- static/js/json2.js | 2 ++ static/js/pad.js | 2 +- static/js/timeslider.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/json2.js b/static/js/json2.js index 898e8369d..663f932cd 100644 --- a/static/js/json2.js +++ b/static/js/json2.js @@ -469,3 +469,5 @@ if (!JSON) }; } }()); + +module.exports = JSON; diff --git a/static/js/pad.js b/static/js/pad.js index fb297d4af..0ed2a5d08 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -30,7 +30,7 @@ require('/jquery'); require('/jquery-ui'); require('/farbtastic'); require('/excanvas'); -require('/json2'); +JSON = require('/json2'); require('/undo-xpopup'); var chat = require('/chat').chat; diff --git a/static/js/timeslider.js b/static/js/timeslider.js index 939c4c642..b02fd22f2 100644 --- a/static/js/timeslider.js +++ b/static/js/timeslider.js @@ -23,7 +23,7 @@ // These jQuery things should create local references, but for now `require()` // assigns to the global `$` and augments it with plugins. require('/jquery'); -require('/json2'); +JSON = require('/json2'); require('/undo-xpopup'); function createCookie(name,value,days) From b32f883a9da5216300113a1f81fbd67fb793e7f1 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Tue, 31 Jan 2012 13:27:46 +0100 Subject: [PATCH 04/20] Optimize javascript minification, slight increase of file size, but massive performance improvement --- node/utils/Minify.js | 1 - 1 file changed, 1 deletion(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 98774d195..d9623d7e5 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -326,7 +326,6 @@ function compressJS(values) var complete = values.join("\n"); var ast = jsp.parse(complete); // parse code and get the initial AST ast = pro.ast_mangle(ast); // get a new AST with mangled names - ast = pro.ast_squeeze(ast); // get an AST with compression optimizations return pro.gen_code(ast); // compressed code here } From 9d72ddfbc73a2864ca629284140a7e8f6f46ad75 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 31 Jan 2012 14:15:36 +0000 Subject: [PATCH 05/20] Solves first part of #377 -- Swap order of title and pad name --- static/js/pad.js | 2 +- static/js/timeslider.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/pad.js b/static/js/pad.js index 0ed2a5d08..4fa46ac6b 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -197,7 +197,7 @@ function handshake() padId = decodeURIComponent(padId); // unescape neccesary due to Safari and Opera interpretation of spaces if(!isReconnect) - document.title = document.title + " | " + padId.replace(/_+/g, ' '); + document.title = padId.replace(/_+/g, ' ') + " | " + document.title; var token = readCookie("token"); if (token == null) diff --git a/static/js/timeslider.js b/static/js/timeslider.js index b02fd22f2..a36bd628a 100644 --- a/static/js/timeslider.js +++ b/static/js/timeslider.js @@ -73,7 +73,7 @@ function init() { padId = decodeURIComponent(urlParts[urlParts.length-2]); //set the title - document.title = document.title + " | " + padId.replace(/_+/g, ' '); + document.title = padId.replace(/_+/g, ' ') + " | " + document.title; //ensure we have a token token = readCookie("token"); From 3f3bb950730e0ea8d959320677a230f79a546be5 Mon Sep 17 00:00:00 2001 From: booo Date: Thu, 2 Feb 2012 11:26:36 +0100 Subject: [PATCH 06/20] Revert "Optimize javascript minification, slight increase of file size, but massive performance improvement" This reverts commit b32f883a9da5216300113a1f81fbd67fb793e7f1. --- node/utils/Minify.js | 1 + 1 file changed, 1 insertion(+) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index d9623d7e5..98774d195 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -326,6 +326,7 @@ function compressJS(values) var complete = values.join("\n"); var ast = jsp.parse(complete); // parse code and get the initial AST ast = pro.ast_mangle(ast); // get a new AST with mangled names + ast = pro.ast_squeeze(ast); // get an AST with compression optimizations return pro.gen_code(ast); // compressed code here } From fc0cbdb55ccb9e5c5662772b9fe375d8f7071d76 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Thu, 2 Feb 2012 12:24:13 +0100 Subject: [PATCH 07/20] Updated uglify-js, that might fixes #389 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec6936975..d91725d53 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "async" : "0.1.15", "express" : "2.5.0", "clean-css" : "0.2.4", - "uglify-js" : "1.1.1", + "uglify-js" : "1.2.5", "formidable" : "1.0.7", "log4js" : "0.4.1", "jsdom-nocontextifiy" : "0.2.10", From 3d108d6dceaac78e2e8395620d80b10f88b766d5 Mon Sep 17 00:00:00 2001 From: 0ip Date: Fri, 3 Feb 2012 19:20:32 +0100 Subject: [PATCH 08/20] Update jQuery, removes "event.layerX/layerY are broken and deprecated in WebKit" message --- bin/installDeps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 8580387db..696e018e2 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -54,7 +54,7 @@ npm install || { echo "Ensure jQuery is downloaded and up to date..." DOWNLOAD_JQUERY="true" -NEEDED_VERSION="1.7" +NEEDED_VERSION="1.7.1" if [ -f "static/js/jquery.js" ]; then VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9].[0-9]"); From 2adda472fcbff24a804d5b1ef92997acd518f0ca Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 Feb 2012 20:43:09 +0100 Subject: [PATCH 09/20] Highlight button for currently opened dialog --- static/css/pad.css | 8 ++++++++ static/js/pad_editbar.js | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/static/css/pad.css b/static/css/pad.css index be9d96565..6a5ff9026 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1290,3 +1290,11 @@ label { font-size: 11px; font-weight: bold; } + +.selected { + background: #eee; + background: -webkit-linear-gradient(#EEE, #F0F0F0); + background: -moz-linear-gradient(#EEE, #F0F0F0); + background: -ms-linear-gradient(#EEE, #F0F0F0); + background: -o-linear-gradient(#EEE, #F0F0F0); +} diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index e6ff9adf7..71053d0c6 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -168,11 +168,12 @@ var padeditbar = (function() }, toogleDropDown: function(moduleName) { - var modules = ["embed", "users", "readonly", "importexport", "settingsmenu"]; + var modules = ["settingsmenu", "importexport", "embed", "users"]; //hide all modules if(moduleName == "none") { + $("#editbar ul#menu_right > li").removeClass("selected"); for(var i=0;i Date: Fri, 3 Feb 2012 20:48:47 +0100 Subject: [PATCH 10/20] overwrite existing bg --- static/css/pad.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 6a5ff9026..b877bad84 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1292,9 +1292,9 @@ label { } .selected { - background: #eee; - background: -webkit-linear-gradient(#EEE, #F0F0F0); - background: -moz-linear-gradient(#EEE, #F0F0F0); - background: -ms-linear-gradient(#EEE, #F0F0F0); - background: -o-linear-gradient(#EEE, #F0F0F0); + background: #eee !important; + background: -webkit-linear-gradient(#EEE, #F0F0F0) !important; + background: -moz-linear-gradient(#EEE, #F0F0F0) !important; + background: -ms-linear-gradient(#EEE, #F0F0F0) !important; + background: -o-linear-gradient(#EEE, #F0F0F0) !important; } From bb808d11ac0fbc3872ee95d035f5557238c4938f Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 Feb 2012 21:20:02 +0100 Subject: [PATCH 11/20] remove jquery ui --- node/utils/tar.json | 1 - static/css/pad.css | 3 +- static/js/chat.js | 49 ++----------- static/js/jquery-ui.js | 157 ----------------------------------------- 4 files changed, 7 insertions(+), 203 deletions(-) delete mode 100644 static/js/jquery-ui.js diff --git a/node/utils/tar.json b/node/utils/tar.json index e1e6fb2b1..8813b776b 100644 --- a/node/utils/tar.json +++ b/node/utils/tar.json @@ -18,7 +18,6 @@ , "pad_impexp.js" , "pad_savedrevs.js" , "pad_connectionstatus.js" - , "jquery-ui.js" , "chat.js" , "excanvas.js" , "farbtastic.js" diff --git a/static/css/pad.css b/static/css/pad.css index be9d96565..ebaee4577 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -875,8 +875,7 @@ ul#colorpickerswatches li:hover #titlelabel { font-size:13px; - margin-left:20px; - padding-top:3px; + margin:4px 0 0 4px position:absolute; } diff --git a/static/js/chat.js b/static/js/chat.js index 9b28c3334..b0ad92e0a 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -27,46 +27,13 @@ var padcookie = require('/pad_cookie').padcookie; var chat = (function() { var isStuck = false; - var sDuration = 500; - var hDuration = 750; var chatMentions = 0; var title = document.title; - if (browser.mobile){ - sDuration = hDuration = 0; - } var self = { show: function () { - $("#chaticon").hide("slide", { - direction: "down" - }, hDuration, function () - { - $("#chatbox").show("slide", { - direction: "down" - }, sDuration, self.scrollDown); - $("#chatbox").resizable( - { - handles: 'nw', - minHeight: 40, - minWidth: 80, - start: function (event, ui) - { - $("#focusprotector").show(); - }, - stop: function (event, ui) - { - $("#focusprotector").hide(); - - if(browser.mobile) { - $("#chatbox").css({right: "0px", bottom: "32px", left: "", top: ""}); - } else { - $("#chatbox").css({right: "20px", bottom: "0px", left: "", top: ""}); - } - - self.scrollDown(); - } - }); - }); + $("#chaticon").hide(); + $("#chatbox").show(); chatMentions = 0; document.title = title; }, @@ -90,10 +57,8 @@ var chat = (function() hide: function () { $("#chatcounter").text("0"); - $("#chatbox").hide("slide", { direction: "down" }, sDuration, function() - { - $("#chaticon").show("slide", { direction: "down" }, hDuration); - }); + $("#chaticon").show(); + $("#chatbox").hide(); }, scrollDown: function() { @@ -156,15 +121,13 @@ var chat = (function() if (chatMentions == 0){ title = document.title; } - $('#chatthrob').html(""+authorName+"" + ": " + text); - $('#chatthrob').effect("pulsate", {times:1,mode:"hide"},4000); + $('#chatthrob').html(""+authorName+"" + ": " + text).show().delay(4000).hide(400); chatMentions++; document.title = "("+chatMentions+") " + title; } else { - $('#chatthrob').html(""+authorName+"" + ": " + text); - $('#chatthrob').effect("pulsate", {times:1,mode:"hide"},2000); + $('#chatthrob').html(""+authorName+"" + ": " + text).show().delay(2000).hide(400); } } diff --git a/static/js/jquery-ui.js b/static/js/jquery-ui.js deleted file mode 100644 index 026ffdbea..000000000 --- a/static/js/jquery-ui.js +++ /dev/null @@ -1,157 +0,0 @@ -/*! - * jQuery UI 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14", -keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus(); -b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this, -"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection", -function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth, -outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b); -return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e= -0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted= -false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); -;/* - * jQuery UI Resizable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element, -_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), -top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= -this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", -nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== -String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); -this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy(); -var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a= -false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"}); -this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff= -{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis]; -if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false}, -_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f, -{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight: -Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(cb.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left= -null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+ -a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+ -c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]); -b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.14"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(), -10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top- -f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType? -e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a= -e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing, -step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= -e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset; -var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left: -a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top- -d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition, -f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, -display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b= -e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height= -d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); -;/* - * jQuery UI Effects 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; -f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, -[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.14",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); -c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, -a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); -a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", -"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* -((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= -e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= -e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h Date: Fri, 3 Feb 2012 21:28:19 +0100 Subject: [PATCH 12/20] rem jQ-UI from pad.js too --- static/js/pad.js | 1 - 1 file changed, 1 deletion(-) diff --git a/static/js/pad.js b/static/js/pad.js index 4fa46ac6b..47b1635b2 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -27,7 +27,6 @@ var socket; // These jQuery things should create local references, but for now `require()` // assigns to the global `$` and augments it with plugins. require('/jquery'); -require('/jquery-ui'); require('/farbtastic'); require('/excanvas'); JSON = require('/json2'); From f3531f3f6337ec1151739e4a0495acc06a89e0b9 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 Feb 2012 21:32:36 +0100 Subject: [PATCH 13/20] fix css --- static/css/pad.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/css/pad.css b/static/css/pad.css index ebaee4577..d6c5a9a43 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -875,7 +875,7 @@ ul#colorpickerswatches li:hover #titlelabel { font-size:13px; - margin:4px 0 0 4px + margin:4px 0 0 4px; position:absolute; } From 79794c0572026217e3558b589e4974e5d2dde9de Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 Feb 2012 21:45:25 +0100 Subject: [PATCH 14/20] remove unnecessary module --- static/js/chat.js | 1 - 1 file changed, 1 deletion(-) diff --git a/static/js/chat.js b/static/js/chat.js index b0ad92e0a..bc71219cb 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -21,7 +21,6 @@ */ var padutils = require('/pad_utils').padutils; -var browser = require('/ace2_common').browser; var padcookie = require('/pad_cookie').padcookie; var chat = (function() From a8cc61545cbf66a6fb608927a9f6116ce4226b4d Mon Sep 17 00:00:00 2001 From: 0ip Date: Fri, 3 Feb 2012 22:29:43 +0100 Subject: [PATCH 15/20] Prevent that li.sepereator gets .selected --- static/js/pad_editbar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 71053d0c6..9280bc7bc 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -190,8 +190,11 @@ var padeditbar = (function() } else { - $("#editbar ul#menu_right li:not(:nth-child(" + (modules.indexOf(moduleName) + 1) + "))").removeClass("selected"); - $("#editbar ul#menu_right li:nth-child(" + (modules.indexOf(moduleName) + 1) + ")").toggleClass("selected"); + var nth_child = modules.indexOf(moduleName) + 1; + if (nth_child > 0 && nth_child <= 3) { + $("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected"); + $("#editbar ul#menu_right li:nth-child(" + nth_child + ")").toggleClass("selected"); + } //hide all modules that are not selected and show the selected one for(var i=0;i Date: Fri, 3 Feb 2012 22:52:57 +0100 Subject: [PATCH 16/20] Scroll down --- static/js/chat.js | 1 + 1 file changed, 1 insertion(+) diff --git a/static/js/chat.js b/static/js/chat.js index bc71219cb..e094f93df 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -33,6 +33,7 @@ var chat = (function() { $("#chaticon").hide(); $("#chatbox").show(); + self.scrollDown(); chatMentions = 0; document.title = title; }, From 7075ff6731300a88a9b79a0790096ff70daae8a2 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 4 Feb 2012 18:08:04 +0100 Subject: [PATCH 17/20] get rid of vendor prefixes --- node/utils/tar.json | 1 + static/css/pad.css | 59 ++---- static/js/pad.js | 1 + static/js/prefixfree.js | 419 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 433 insertions(+), 47 deletions(-) create mode 100644 static/js/prefixfree.js diff --git a/node/utils/tar.json b/node/utils/tar.json index 8813b776b..aeafe23fb 100644 --- a/node/utils/tar.json +++ b/node/utils/tar.json @@ -21,6 +21,7 @@ , "chat.js" , "excanvas.js" , "farbtastic.js" + , "prefixfree.js" ] , "timeslider.js": [ "jquery.js" diff --git a/static/css/pad.css b/static/css/pad.css index a71c5d594..e407b3a4f 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -15,7 +15,6 @@ iframe {position:absolute;} top: 40px; color: #fff; padding: 5px; - -moz-border-radius: 6px; border-radius: 6px; } @@ -39,10 +38,7 @@ a img #editbar { background: #f7f7f7; - background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%); + background: linear-gradient(#f7f7f7, #f1f1f1 80%); border-bottom: 1px solid #ccc; height: 32px; overflow: hidden; @@ -53,10 +49,7 @@ a img #editbar ul li { background: #fff; - background: -moz-linear-gradient(#fff, #f0f0f0); - background: -ms-linear-gradient(#fff, #f0f0f0); - background: -o-linear-gradient(#fff, #f0f0f0); - background: -webkit-linear-gradient(#fff, #f0f0f0); + background: linear-gradient(#fff, #f0f0f0); border: 1px solid #ccc; border-radius: 4px; cursor: pointer; @@ -86,10 +79,7 @@ a img #editbar ul li:active { background: #eee; - background: -moz-linear-gradient(#ddd, #fff); - background: -ms-linear-gradient(#ddd, #fff); - background: -o-linear-gradient(#ddd, #fff); - background: -webkit-linear-gradient(#ddd, #fff); + background: linear-gradient(#ddd, #fff); } #editbar ul li.separator @@ -190,7 +180,6 @@ a#backtoprosite { padding-left: 20px; left: 6px; #alertbar { margin-top: 6px; opacity: 0; - filter: alpha(opacity = 0); /* IE */ display: none; position:absolute; left:0; @@ -384,10 +373,7 @@ a#hidetopmsg { position: absolute; right: 5px; bottom: 5px; } #mycolorpickersave, #mycolorpickercancel { background: #fff; - background: -moz-linear-gradient(#fff, #ccc); - background: -ms-linear-gradient(#fff, #ccc); - background: -o-linear-gradient(#fff, #ccc); - background: -webkit-linear-gradient(#fff, #ccc); + background: linear-gradient(#fff, #ccc); border: 1px solid #ccc; border-radius: 4px; font-size:12px; @@ -725,14 +711,7 @@ a#topbarmaximize { text-decoration: none; padding: 50pt; font-size: 20pt; - -moz-border-radius-topleft: 3pt; - -moz-border-radius-topright: 3pt; - -moz-border-radius-bottomleft: 3pt; - -moz-border-radius-bottomright: 3pt; - -webkit-border-top-left-radius: 3pt; - -webkit-border-top-right-radius: 3pt; - -webkit-border-bottom-left-radius: 3pt; - -webkit-border-bottom-right-radius: 3pt; + border-radius: 3pt; } .modaldialog .bigbutton { @@ -953,7 +932,7 @@ position: relative; } .impexpbutton{ - background-image: -moz-linear-gradient(center top , #EEEEEE, white 20%, white 20%); + background-image: linear-gradient(center top , #EEEEEE, white 20%, white 20%); padding:3px; } @@ -1021,7 +1000,6 @@ color: white; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.7); padding: 10px; --moz-border-radius: 6px; border-radius: 6px; opacity:.8; } @@ -1118,14 +1096,12 @@ width:33px !important; #embedreadonlyqr { box-shadow: 0 0 10px #000; border-radius: 3px; - -webkit-transition: all .2s ease-in-out; - -moz-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; } #embedreadonlyqr:hover { cursor: none; - -moz-transform: scale(1.5); - -webkit-transform: scale(1.5); + transform: scale(1.5); } @media screen and (max-width: 960px) { @@ -1166,10 +1142,7 @@ width:33px !important; } #editbar ul#menu_right { background: #f7f7f7; - background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%); + background: linear-gradient(#f7f7f7, #f1f1f1 80%); width: 100%; overflow: hidden; height: 32px; @@ -1193,10 +1166,7 @@ width:33px !important; border-right: none; border-radius: 0; background: #f7f7f7; - background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%); + background: linear-gradient(#f7f7f7, #f1f1f1 80%); border: 0; } #chatbox { @@ -1237,8 +1207,7 @@ label { border-radius: 6px; background: #222; background: rgba(0,0,0,.7); - background: -webkit-linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); - background: -moz-linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); + background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); box-shadow: 0 0 8px #888; color: #fff; } @@ -1247,7 +1216,6 @@ label { width: 100%; padding: 5px; box-sizing: border-box; - -moz-box-sizing: border-box; display:block; margin-top: 10px; } @@ -1292,8 +1260,5 @@ label { .selected { background: #eee !important; - background: -webkit-linear-gradient(#EEE, #F0F0F0) !important; - background: -moz-linear-gradient(#EEE, #F0F0F0) !important; - background: -ms-linear-gradient(#EEE, #F0F0F0) !important; - background: -o-linear-gradient(#EEE, #F0F0F0) !important; + background: linear-gradient(#EEE, #F0F0F0) !important; } diff --git a/static/js/pad.js b/static/js/pad.js index 47b1635b2..c7a740cbb 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -31,6 +31,7 @@ require('/farbtastic'); require('/excanvas'); JSON = require('/json2'); require('/undo-xpopup'); +require('prefixfree'); var chat = require('/chat').chat; var getCollabClient = require('/collab_client').getCollabClient; diff --git a/static/js/prefixfree.js b/static/js/prefixfree.js new file mode 100644 index 000000000..1b0d52466 --- /dev/null +++ b/static/js/prefixfree.js @@ -0,0 +1,419 @@ +/** + * StyleFix 1.0.1 + * @author Lea Verou + * MIT license + */ + +(function(){ + +if(!window.addEventListener) { + return; +} + +var self = window.StyleFix = { + link: function(link) { + try { + // Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets + if(link.rel !== 'stylesheet' || !link.sheet.cssRules || link.hasAttribute('data-noprefix')) { + return; + } + } + catch(e) { + return; + } + + var url = link.href || link.getAttribute('data-href'), + base = url.replace(/[^\/]+$/, ''), + parent = link.parentNode, + xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + + xhr.onreadystatechange = function() { + if(xhr.readyState === 4) { + var css = xhr.responseText; + + if(css && link.parentNode) { + css = self.fix(css, true, link); + + // Convert relative URLs to absolute, if needed + if(base) { + css = css.replace(/url\((?:'|")?(.+?)(?:'|")?\)/gi, function($0, url) { + if(!/^([a-z]{3,10}:|\/|#)/i.test(url)) { // If url not absolute & not a hash + // May contain sequences like /../ and /./ but those DO work + return 'url("' + base + url + '")'; + } + + return $0; + }); + + // behavior URLs shoudn’t be converted (Issue #19) + css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + base, 'gi'), '$1'); + } + + var style = document.createElement('style'); + style.textContent = css; + style.media = link.media; + style.disabled = link.disabled; + style.setAttribute('data-href', link.getAttribute('href')); + + parent.insertBefore(style, link); + parent.removeChild(link); + } + } + }; + + xhr.send(null); + + link.setAttribute('data-inprogress', ''); + }, + + styleElement: function(style) { + var disabled = style.disabled; + + style.textContent = self.fix(style.textContent, true, style); + + style.disabled = disabled; + }, + + styleAttribute: function(element) { + var css = element.getAttribute('style'); + + css = self.fix(css, false, element); + + element.setAttribute('style', css); + }, + + process: function() { + // Linked stylesheets + $('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); + + // Inline stylesheets + $('style').forEach(StyleFix.styleElement); + + // Inline styles + $('[style]').forEach(StyleFix.styleAttribute); + }, + + register: function(fixer, index) { + (self.fixers = self.fixers || []) + .splice(index === undefined? self.fixers.length : index, 0, fixer); + }, + + fix: function(css, raw) { + for(var i=0; i 3) { + parts.pop(); + + var shorthand = parts.join('-'); + + if(supported(shorthand) && properties.indexOf(shorthand) === -1) { + properties.push(shorthand); + } + } + } + }, + supported = function(property) { + return StyleFix.camelCase(property) in dummy; + } + + // Some browsers have numerical indices for the properties, some don't + if(style.length > 0) { + for(var i=0; i Date: Sat, 4 Feb 2012 18:11:41 +0100 Subject: [PATCH 18/20] add missing slash --- static/js/pad.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/pad.js b/static/js/pad.js index c7a740cbb..7eb744a12 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -31,7 +31,7 @@ require('/farbtastic'); require('/excanvas'); JSON = require('/json2'); require('/undo-xpopup'); -require('prefixfree'); +require('/prefixfree'); var chat = require('/chat').chat; var getCollabClient = require('/collab_client').getCollabClient; From eb24404d3d55dd87444c24484e042ce64db3de07 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 4 Feb 2012 18:37:36 +0100 Subject: [PATCH 19/20] automatic prefixfree.js dl --- bin/installDeps.sh | 15 ++ static/js/prefixfree.js | 419 ---------------------------------------- 2 files changed, 15 insertions(+), 419 deletions(-) delete mode 100644 static/js/prefixfree.js diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 8580387db..ab976a66b 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -67,6 +67,21 @@ if [ $DOWNLOAD_JQUERY = "true" ]; then curl -lo static/js/jquery.js http://code.jquery.com/jquery-$NEEDED_VERSION.js || exit 1 fi +echo "Ensure prefixfree is downloaded and up to date..." +DOWNLOAD_PREFIXFREE="true" +NEEDED_VERSION="1.0.4" +if [ -f "static/js/prefixfree.js" ]; then + VERSION=$(cat static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); + + if [ ${VERSION#v} = $NEEDED_VERSION ]; then + DOWNLOAD_PREFIXFREE="false" + fi +fi + +if [ $DOWNLOAD_PREFIXFREE = "true" ]; then + curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.min.js || exit 1 +fi + #Remove all minified data to force node creating it new echo "Clear minfified cache..." rm -f var/minified* diff --git a/static/js/prefixfree.js b/static/js/prefixfree.js deleted file mode 100644 index 1b0d52466..000000000 --- a/static/js/prefixfree.js +++ /dev/null @@ -1,419 +0,0 @@ -/** - * StyleFix 1.0.1 - * @author Lea Verou - * MIT license - */ - -(function(){ - -if(!window.addEventListener) { - return; -} - -var self = window.StyleFix = { - link: function(link) { - try { - // Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets - if(link.rel !== 'stylesheet' || !link.sheet.cssRules || link.hasAttribute('data-noprefix')) { - return; - } - } - catch(e) { - return; - } - - var url = link.href || link.getAttribute('data-href'), - base = url.replace(/[^\/]+$/, ''), - parent = link.parentNode, - xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - - xhr.onreadystatechange = function() { - if(xhr.readyState === 4) { - var css = xhr.responseText; - - if(css && link.parentNode) { - css = self.fix(css, true, link); - - // Convert relative URLs to absolute, if needed - if(base) { - css = css.replace(/url\((?:'|")?(.+?)(?:'|")?\)/gi, function($0, url) { - if(!/^([a-z]{3,10}:|\/|#)/i.test(url)) { // If url not absolute & not a hash - // May contain sequences like /../ and /./ but those DO work - return 'url("' + base + url + '")'; - } - - return $0; - }); - - // behavior URLs shoudn’t be converted (Issue #19) - css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + base, 'gi'), '$1'); - } - - var style = document.createElement('style'); - style.textContent = css; - style.media = link.media; - style.disabled = link.disabled; - style.setAttribute('data-href', link.getAttribute('href')); - - parent.insertBefore(style, link); - parent.removeChild(link); - } - } - }; - - xhr.send(null); - - link.setAttribute('data-inprogress', ''); - }, - - styleElement: function(style) { - var disabled = style.disabled; - - style.textContent = self.fix(style.textContent, true, style); - - style.disabled = disabled; - }, - - styleAttribute: function(element) { - var css = element.getAttribute('style'); - - css = self.fix(css, false, element); - - element.setAttribute('style', css); - }, - - process: function() { - // Linked stylesheets - $('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); - - // Inline stylesheets - $('style').forEach(StyleFix.styleElement); - - // Inline styles - $('[style]').forEach(StyleFix.styleAttribute); - }, - - register: function(fixer, index) { - (self.fixers = self.fixers || []) - .splice(index === undefined? self.fixers.length : index, 0, fixer); - }, - - fix: function(css, raw) { - for(var i=0; i 3) { - parts.pop(); - - var shorthand = parts.join('-'); - - if(supported(shorthand) && properties.indexOf(shorthand) === -1) { - properties.push(shorthand); - } - } - } - }, - supported = function(property) { - return StyleFix.camelCase(property) in dummy; - } - - // Some browsers have numerical indices for the properties, some don't - if(style.length > 0) { - for(var i=0; i Date: Sat, 4 Feb 2012 18:46:43 +0100 Subject: [PATCH 20/20] fixes automatic update --- .gitignore | 3 ++- bin/installDeps.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 32f9ea7d7..6b1e54c64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules settings.json static/js/jquery.js +static/js/prefixfree.js APIKEY.txt bin/abiword.exe bin/node.exe @@ -8,4 +9,4 @@ etherpad-lite-win.zip var/dirty.db bin/convertSettings.json *~ -*.patch \ No newline at end of file +*.patch diff --git a/bin/installDeps.sh b/bin/installDeps.sh index ab976a66b..4892f3ebb 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -73,13 +73,13 @@ NEEDED_VERSION="1.0.4" if [ -f "static/js/prefixfree.js" ]; then VERSION=$(cat static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); - if [ ${VERSION#v} = $NEEDED_VERSION ]; then + if [ $VERSION = $NEEDED_VERSION ]; then DOWNLOAD_PREFIXFREE="false" fi fi if [ $DOWNLOAD_PREFIXFREE = "true" ]; then - curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.min.js || exit 1 + curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1 fi #Remove all minified data to force node creating it new