Remove support for old media-tag
This commit is contained in:
@@ -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) {
|
||||
@@ -1034,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) {
|
||||
|
||||
@@ -83,8 +83,9 @@
|
||||
},
|
||||
download: function (metadata, url, content, cfg, cb) {
|
||||
var btn = document.createElement('button');
|
||||
btn.setAttribute('class', 'btn btn-success');
|
||||
btn.innerHTML = cfg.download.text + '<br>' +
|
||||
metadata.name ? '<b>' + fixHTML(metadata.name) + '</b>' : '';
|
||||
(metadata.name ? '<b>' + fixHTML(metadata.name) + '</b>' : '');
|
||||
btn.addEventListener('click', function () {
|
||||
saveFile(content, url, metadata.name);
|
||||
});
|
||||
@@ -317,11 +318,6 @@
|
||||
|
||||
addMissingConfig(cfg, config);
|
||||
|
||||
// Add support for old mediatag library
|
||||
if (!cfg.pdf.viewer && init.PdfPlugin && init.PdfPlugin.viewer) {
|
||||
cfg.pdf.viewer = init.PdfPlugin.viewer;
|
||||
}
|
||||
|
||||
// Handle jQuery elements
|
||||
if (typeof(el) === "object" && el.jQuery) { el = el[0]; }
|
||||
|
||||
@@ -424,7 +420,9 @@
|
||||
// Add the cache as a property of MediaTag
|
||||
cache = init.__Cryptpad_Cache = {};
|
||||
|
||||
init.PdfPlugin = {};
|
||||
init.setDefaultConfig = function (key, value) {
|
||||
config[key] = value;
|
||||
};
|
||||
|
||||
return init;
|
||||
}));
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user