Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 7 years ago
commit 8a87ec180e

@ -4,7 +4,7 @@ define([
'/common/cryptpad-common.js',
'/customize/pages.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
], function ($, h, Cryptpad, Pages) {
$(function () {
var $body = $('body');

@ -16,7 +16,7 @@ define([
'cm/lib/codemirror',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/main.less',
'css!cm/lib/codemirror.css',

@ -18,9 +18,18 @@ define([
localStorage = {};
}
var fixURL = function (url) {
var mark = (url.indexOf('?') !== -1) ? '&' : '?';
return url + mark + key;
var fixURL = function (url, parent) {
// data: blob: etc
if (/^[a-zA-Z0-9]*:/.test(url)) { return url; }
var ua = url.split('#');
var mark = (ua[0].indexOf('?') !== -1) ? '&' : '?';
ua[0] = ua[0] + mark + key;
if (ua[0].indexOf(':') === -1 && ua[0].indexOf('/') && parent) {
ua[0] = parent.replace(/\/[^\/]*$/, '/') + ua[0];
}
var out = ua.join('#');
//console.log(url + " --> " + out);
return out;
};
var doXHR = Less.FileManager.prototype.doXHR;
@ -48,6 +57,40 @@ define([
localStorage['LESS_CACHE'] = key;
};
var fixAllURLs = function (source, parent) {
var urlRegEx = /@import\s*("([^"]*)"|'([^']*)')|url\s*\(\s*(\s*"([^"]*)"|'([^']*)'|[^\)]*\s*)\s*\)/ig;
var result, url;
while (!!(result = urlRegEx.exec(source))) {
url = result[3] || result[2] || result[5] || result[6] || result[4];
var newUrl = fixURL(url, parent);
var quoteLen = result[5] || result[6] ? 1 : 0;
source = source.substr(0, urlRegEx.lastIndex - url.length - quoteLen - 1)
+ newUrl + source.substr(urlRegEx.lastIndex - quoteLen - 1);
urlRegEx.lastIndex = urlRegEx.lastIndex + (newUrl.length - url.length);
}
return source;
};
var loadCSS = function (url, cb) {
var xhr = new window.XMLHttpRequest();
xhr.open("GET", fixURL(url), true);
xhr.responseType = 'text';
xhr.onload = function () {
if (/^4/.test('' + this.status)) { return cb("error loading " + url); }
cb(undefined, xhr.response);
};
xhr.send(null);
};
var loadLess = function (url, cb) {
Less.render('@import (multiple) "' + url + '";', {}, function(err, css) {
if (err) { return void cb(err); }
cb(undefined, css.css);
}, window.less);
};
module.exports.load = function (url /*:string*/, cb /*:()=>void*/) {
checkCache();
if (localStorage['LESS_CACHE|' + key + '|' + url]) {
@ -55,15 +98,12 @@ define([
cb();
return;
}
Less.render('@import (multiple) "' + url + '";', {}, function(err, css) {
if (err) {
console.log(err);
return;
}
localStorage['LESS_CACHE|' + key + '|' + url] = css.css;
inject(css.css, url);
((/\.less([\?\#].*)?$/.test(url)) ? loadLess : loadCSS)(url, function (err, css) {
var output = fixAllURLs(css, url);
localStorage['LESS_CACHE|' + key + '|' + url] = output;
inject(output, url);
cb();
}, window.less);
});
};
return module.exports;

@ -1,6 +1,6 @@
define([
'jquery',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/contacts/main.less',
'less!/customize/src/less/toolbar.less',

@ -7,7 +7,7 @@ define([
'/common/common-messenger.js',
'/contacts/messenger-ui.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
], function ($, Crypto, Toolbar, Cryptpad, Messenger, UI) {
var Messages = Cryptpad.Messages;

@ -1,5 +1,5 @@
define([
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/drive/file.less',
'less!/customize/src/less/cryptpad.less',

@ -11,7 +11,7 @@ define([
'/common/cryptget.js',
'/common/mergeDrive.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
], function ($, Listmap, Crypto, TextPatcher, JSONSortify, Cryptpad, FO, Toolbar, AppConfig, Get, Merge) {
var module = window.MODULE = {};

@ -13,7 +13,7 @@ define([
'/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/main.less',
], function (

@ -9,7 +9,7 @@ define([
'json.sortify',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/main.less',
], function (
$,

@ -3,7 +3,7 @@ define([
'/common/cryptpad-common.js',
'/common/login.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/loading.less',
], function ($, Cryptpad, Login) {
$(function () {

@ -3,7 +3,7 @@ define([
'cm/lib/codemirror',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/code/code.less',
'less!/customize/src/less/toolbar.less',

@ -10,7 +10,7 @@ define([
'/common/cryptget.js',
'/common/diffMarked.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less'
], function ($, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad,
Cryptget, DiffMd) {

@ -1,6 +1,6 @@
define([
'jquery',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/file/file.less',
'less!/customize/src/less/cryptpad.less',

@ -12,7 +12,7 @@ define([
'/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
], function ($, Crypto, realtimeInput, Toolbar, Cryptpad, Visible, Notify, FileCrypto, MediaTag) {
var Messages = Cryptpad.Messages;

@ -10,7 +10,7 @@ define([
'/common/cryptget.js',
'/slide/slide.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
], function ($, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, Cryptget, Slide) {
var Messages = Cryptpad.Messages;

@ -38,7 +38,7 @@ define([
'/bower_components/diff-dom/diffDOM.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/main.less',
], function (
$,

@ -10,7 +10,7 @@ define([
'/common/toolbar2.js',
'/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/customize/src/less/toolbar.less',
'less!/customize/src/less/cryptpad.less',

@ -5,7 +5,7 @@ define([
'/common/test.js',
'/common/credential.js', // preloaded for login.js
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/loading.less',
], function ($, Login, Cryptpad, Test, Cred) {
var Messages = Cryptpad.Messages;

@ -7,7 +7,7 @@ define([
'/bower_components/file-saver/FileSaver.min.js',
'less!/customize/src/less/cryptpad.less',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/customize/src/less/toolbar.less',
'less!/settings/main.less',

@ -17,7 +17,7 @@ define([
'cm/lib/codemirror',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/main.less',
'css!cm/lib/codemirror.css',

@ -1,6 +1,6 @@
define([
'jquery',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/todo/todo.less',
//'less!/customize/src/less/cryptpad.less',

@ -9,7 +9,7 @@ define([
//'/common/media-tag.js',
//'/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
], function ($, Crypto, Listmap, Toolbar, Cryptpad, Todo) {
var Messages = Cryptpad.Messages;

@ -15,7 +15,7 @@ define([
'/bower_components/secure-fabric.js/dist/fabric.min.js',
'/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/customize/src/less/cryptpad.less',
'less!/whiteboard/whiteboard.less',

Loading…
Cancel
Save