+
+
+ self.$pane.on('click', '.meta-add', function() {
+ // create a metadata item
+ let $fg = $(this).parent();
+ let ns = $fg.data('ns');
+ let tag = $fg.data('tag');
+ let field = $fg.data('field');
+ let span = $('<span/>');
+ span.attr('x-node', tag);
+ span.attr('x-ns', ns)
+ if (field.value_type.hasLanguage) {
+ span.attr('x-a-xml-lang', 'pl');
+ }
+
+ rdf = $("> [x-node='RDF']", self.$edited);
+ if (!rdf.length) {
+ rdf = $("<span x-node='RDF' x-ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>");
+ self.$edited.prepend(rdf);
+ self.$edited.prepend('\n ');
+
+ }
+ rdfdesc = $("> [x-node='Description']", rdf);
+ if (!rdfdesc.length) {
+ rdfdesc = $("<span x-node='Description' x-ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#' x-a-rdf-about='" + self.doc.fullUri + "'>");
+ rdf.prepend(rdfdesc);
+ rdf.prepend('\n ');
+ rdfdesc.append('\n ');
+ rdf.append('\n ');
+ }
+ span.appendTo(rdfdesc);
+ rdfdesc.append('\n ');
+
+ self.displayMetaProperty($fg);
+
+ return false;
+ });
+
+ self.$pane.on('click', '.meta-delete', function() {
+ let $fg = $(this).closest('.form-group');
+ $('input', $fg).data('edited').remove();
+ self.displayMetaProperty($fg);
+ return false;
+ });
+
+
+ $('#media-chooser').on('show.bs.modal', function (event) {
+ var input = $("input", $(event.relatedTarget).parent());
+ var modal = $(this);
+ modal.data('target-input', input);
+ var imglist = modal.find('.modal-body');
+ imglist.html('');
+ $.each(self.doc.galleryImages, (i, imgItem) => {
+ img = $("<img>").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
+ imglist.find('img').removeClass('active');
+ $(this).addClass('active');
+ });
+ imglist.append(img);
+ });
+ })
+ $('#media-chooser .ctrl-ok').on('click', function (event) {
+ $('#media-chooser').data('target-input')
+ .val(
+ (new URL($('#media-chooser .active').data('url'), document.baseURI)).href
+ ).trigger('change');
+ $('#media-chooser').modal('hide');
+ });
+
+ self.$pane.on('click', '.current-convert', function() {
+ self.convert($(this).attr('data-to'));
+ });
+ self.$pane.on('click', '#current-delete', function() {
+ self.delete();
+ });
+