Merge branch 'staging' into serviceworker
This commit is contained in:
@@ -49,6 +49,7 @@ define([
|
||||
if (ua[0].indexOf(':') === -1 && ua[0].indexOf('/') && parent) {
|
||||
ua[0] = parent.replace(/\/[^\/]*$/, '/') + ua[0];
|
||||
}
|
||||
ua[0] = ua[0].replace(/^\/\.\.\//, '/');
|
||||
var out = ua.join('#');
|
||||
//console.log(url + " --> " + out);
|
||||
return out;
|
||||
@@ -91,17 +92,32 @@ define([
|
||||
};
|
||||
|
||||
var lessEngine;
|
||||
var tempCache = { key: Math.random() };
|
||||
var getLessEngine = function (cb) {
|
||||
if (lessEngine) {
|
||||
cb(lessEngine);
|
||||
} else {
|
||||
require(['/bower_components/less/dist/less.min.js'], function (Less) {
|
||||
if (lessEngine) { return void cb(lessEngine); }
|
||||
lessEngine = Less;
|
||||
var doXHR = lessEngine.FileManager.prototype.doXHR;
|
||||
lessEngine.FileManager.prototype.doXHR = function (url, type, callback, errback) {
|
||||
url = fixURL(url);
|
||||
//console.log("xhr: " + url);
|
||||
return doXHR(url, type, callback, errback);
|
||||
var cached = tempCache[url];
|
||||
if (cached && cached.res) {
|
||||
var res = cached.res;
|
||||
return void setTimeout(function () { callback(res[0], res[1]); });
|
||||
}
|
||||
if (cached) { return void cached.queue.push(callback); }
|
||||
cached = tempCache[url] = { queue: [ callback ], res: undefined };
|
||||
return doXHR(url, type, function (text, lastModified) {
|
||||
cached.res = [ text, lastModified ];
|
||||
var queue = cached.queue;
|
||||
cached.queue = [];
|
||||
queue.forEach(function (f) {
|
||||
setTimeout(function () { f(text, lastModified); });
|
||||
});
|
||||
}, errback);
|
||||
};
|
||||
cb(lessEngine);
|
||||
});
|
||||
|
||||
@@ -144,13 +144,15 @@ define([
|
||||
};
|
||||
|
||||
dialog.frame = function (content) {
|
||||
return h('div.alertify', {
|
||||
return $(h('div.alertify', {
|
||||
tabindex: 1,
|
||||
}, [
|
||||
h('div.dialog', [
|
||||
h('div', content),
|
||||
])
|
||||
]);
|
||||
])).click(function (e) {
|
||||
e.stopPropagation();
|
||||
})[0];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,10 @@ define([
|
||||
var UIElements = {};
|
||||
|
||||
// Configure MediaTags to use our local viewer
|
||||
if (MediaTag && MediaTag.PdfPlugin) {
|
||||
MediaTag.PdfPlugin.viewer = '/common/pdfjs/web/viewer.html';
|
||||
if (MediaTag) {
|
||||
MediaTag.setDefaultConfig('pdf', {
|
||||
viewer: '/common/pdfjs/web/viewer.html'
|
||||
});
|
||||
}
|
||||
|
||||
UIElements.updateTags = function (common, href) {
|
||||
@@ -626,7 +628,6 @@ define([
|
||||
}
|
||||
}
|
||||
sframeChan.query('Q_SAVE_AS_TEMPLATE', {
|
||||
title: title,
|
||||
toSave: toSave
|
||||
}, function () {
|
||||
UI.alert(Messages.templateSaved);
|
||||
@@ -1035,52 +1036,6 @@ define([
|
||||
|
||||
// Avatars
|
||||
|
||||
// Enable mediatags
|
||||
$(window.document).on('decryption', function (e) {
|
||||
var decrypted = e.originalEvent;
|
||||
if (decrypted.callback) {
|
||||
var cb = decrypted.callback;
|
||||
cb(function (mediaObject) {
|
||||
var root = mediaObject.element;
|
||||
if (!root) { return; }
|
||||
|
||||
if (mediaObject.type === 'image') {
|
||||
$(root).data('blob', decrypted.blob);
|
||||
}
|
||||
|
||||
if (mediaObject.type !== 'download') { return; }
|
||||
|
||||
var metadata = decrypted.metadata;
|
||||
|
||||
var title = '';
|
||||
var size = 0;
|
||||
if (metadata && metadata.name) {
|
||||
title = metadata.name;
|
||||
}
|
||||
|
||||
if (decrypted.blob) {
|
||||
size = decrypted.blob.size;
|
||||
}
|
||||
|
||||
var sizeMb = Util.bytesToMegabytes(size);
|
||||
|
||||
var $btn = $(root).find('button');
|
||||
$btn.addClass('btn btn-success')
|
||||
.attr('type', 'download')
|
||||
.html(function () {
|
||||
var text = Messages.download_mt_button + '<br>';
|
||||
if (title) {
|
||||
text += '<b>' + Util.fixHTML(title) + '</b><br>';
|
||||
}
|
||||
if (size) {
|
||||
text += '<em>' + Messages._getKey('formattedMB', [sizeMb]) + '</em>';
|
||||
}
|
||||
return text;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
UIElements.displayMediatagImage = function (Common, $tag, cb) {
|
||||
if (!$tag.length || !$tag.is('media-tag')) { return void cb('NOT_MEDIATAG'); }
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
|
||||
@@ -449,6 +449,26 @@ define([
|
||||
}).nThen(function () {
|
||||
Crypt.get(parsed.hash, function (err, val) {
|
||||
if (err) { throw new Error(err); }
|
||||
try {
|
||||
// Try to fix the title before importing the template
|
||||
var parsed = JSON.parse(val);
|
||||
var meta;
|
||||
if (Array.isArray(parsed) && typeof(parsed[3]) === "object") {
|
||||
meta = parsed[3].metadata; // pad
|
||||
} else if (parsed.info) {
|
||||
meta = parsed.info; // poll
|
||||
} else {
|
||||
meta = parsed.metadata;
|
||||
}
|
||||
if (typeof(meta) === "object") {
|
||||
meta.defaultTitle = meta.title || meta.defaultTitle;
|
||||
delete meta.users;
|
||||
delete meta.title;
|
||||
}
|
||||
val = JSON.stringify(parsed);
|
||||
} catch (e) {
|
||||
console.log("Can't fix template title", e);
|
||||
}
|
||||
Crypt.put(parsed2.hash, val, cb, optsPut);
|
||||
}, optsGet);
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -111,7 +111,7 @@ define([
|
||||
// RPC may not be responding
|
||||
// Send a report that can be handled manually
|
||||
console.error(obj.error);
|
||||
Feedback.send('ERROR_DELETING_OWNED_PAD=' + channelId, true);
|
||||
Feedback.send('ERROR_DELETING_OWNED_PAD=' + channelId + '|' + obj.error, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ define([
|
||||
exp.updateTitle = function (newTitle, cb) {
|
||||
cb = cb || $.noop;
|
||||
if (newTitle === exp.title) { return void cb(); }
|
||||
if (newTitle === exp.defaultTitle) {
|
||||
newTitle = "";
|
||||
}
|
||||
metadataMgr.updateTitle(newTitle);
|
||||
titleUpdated = cb;
|
||||
};
|
||||
@@ -51,7 +54,9 @@ define([
|
||||
if ($title) {
|
||||
$title.find('span.cp-toolbar-title-value').text(md.title || md.defaultTitle);
|
||||
$title.find('input').val(md.title || md.defaultTitle);
|
||||
$title.find('input').prop('placeholder', md.defaultTitle);
|
||||
}
|
||||
exp.defaultTitle = md.defaultTitle;
|
||||
exp.title = md.title;
|
||||
});
|
||||
metadataMgr.onTitleChange(function (title) {
|
||||
|
||||
Reference in New Issue
Block a user