define([ 'jquery', '/api/config', '/common/common-util.js', '/common/common-hash.js', '/common/common-language.js', '/common/common-interface.js', '/common/common-feedback.js', '/common/media-tag.js', '/customize/messages.js', 'css!/common/tippy.css', ], function ($, Config, Util, Hash, Language, UI, Feedback, MediaTag, Messages) { var UIElements = {}; // Configure MediaTags to use our local viewer if (MediaTag && MediaTag.PdfPlugin) { MediaTag.PdfPlugin.viewer = '/common/pdfjs/web/viewer.html'; } UIElements.updateTags = function (common, href) { var sframeChan = common.getSframeChannel(); sframeChan.query('Q_TAGS_GET', href || null, function (err, res) { if (err || res.error) { if (res.error === 'NO_ENTRY') { UI.alert(Messages.tags_noentry); } return void console.error(err || res.error); } UI.dialog.tagPrompt(res.data, function (tags) { if (!Array.isArray(tags)) { return; } sframeChan.event('EV_TAGS_SET', { tags: tags, href: href, }); }); }); }; var importContent = function (type, f, cfg) { return function () { var $files = $('', {type:"file"}); if (cfg && cfg.accept) { $files.attr('accept', cfg.accept); } $files.click(); $files.on('change', function (e) { var file = e.target.files[0]; var reader = new FileReader(); reader.onload = function (e) { f(e.target.result, file); }; reader.readAsText(file, type); }); }; }; UIElements.createButton = function (common, type, rightside, data, callback) { var AppConfig = common.getAppConfig(); var button; var size = "17px"; var sframeChan = common.getSframeChannel(); switch (type) { case 'export': button = $('