Changeset 3880:e6d1f6d9d7df for plugins/tags
- Timestamp:
- 09/18/18 20:22:10 (7 years ago)
- Branch:
- default
- Location:
- plugins/tags/js
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/tags/js/ckeditor-tags-plugin.js
r3709 r3880 8 8 exec: function(editor) { 9 9 if (editor.getSelection().getNative().toString().replace(/\s*/, '') != '') { 10 varstr = editor.getSelection().getNative().toString().replace(/\s*/, '');11 varurl = dotclear.msg.tag_url;10 const str = editor.getSelection().getNative().toString().replace(/\s*/, ''); 11 const url = dotclear.msg.tag_url; 12 12 window.dc_tag_editor.addMeta(str); 13 var link = '<a href="' + $.stripBaseURL(url + '/' + str) + '">' + str + '</a>';14 varelement = CKEDITOR.dom.element.createFromHtml(link);13 const link = `<a href="${$.stripBaseURL(url + '/' + str)}">${str}</a>`; 14 const element = CKEDITOR.dom.element.createFromHtml(link); 15 15 editor.insertElement(element); 16 16 } -
plugins/tags/js/legacy-post.js
r3709 r3880 35 35 }; 36 36 jsToolBar.prototype.elements.tag.fn.markdown = function() { 37 varurl = this.elements.tag.url;37 const url = this.elements.tag.url; 38 38 this.encloseSelection('', '', function(str) { 39 39 if (str == '') { … … 50 50 }; 51 51 jsToolBar.prototype.elements.tag.fn.xhtml = function() { 52 varurl = this.elements.tag.url;52 const url = this.elements.tag.url; 53 53 this.encloseSelection('', '', function(str) { 54 54 if (str == '') { … … 65 65 }; 66 66 jsToolBar.prototype.elements.tag.fn.wysiwyg = function() { 67 vart = this.getSelectedText();67 const t = this.getSelectedText(); 68 68 69 69 if (t == '') { … … 75 75 } 76 76 77 varn = this.getSelectedNode();78 vara = document.createElement('a');77 const n = this.getSelectedNode(); 78 const a = document.createElement('a'); 79 79 a.href = this.stripBaseURL(this.elements.tag.url + '/' + t); 80 80 a.appendChild(n); -
plugins/tags/js/post.js
r3709 r3880 4 4 $(function() { 5 5 $('#edit-entry').onetabload(function() { 6 vartags_edit = $('#tags-edit');7 varpost_id = $('#id');8 varmeta_field = null;9 varmEdit = null;6 const tags_edit = $('#tags-edit'); 7 let post_id = $('#id'); 8 let meta_field = null; 9 let mEdit = null; 10 10 11 11 if (tags_edit.length > 0) { … … 34 34 matchContains: true, 35 35 parse: function(xml) { 36 varresults = [];36 let results = []; 37 37 $(xml).find('meta').each(function() { 38 38 results[results.length] = { -
plugins/tags/js/posts_actions.js
r3709 r3880 3 3 4 4 $(function() { 5 vartag_field = $('#new_tags');5 const tag_field = $('#new_tags'); 6 6 7 8 7 tag_field.after('<div id="tags_list"></div>'); 8 tag_field.hide(); 9 9 10 vartarget = $('#tags_list');11 var mEdit = new metaEditor(target,tag_field,'tag',editor_tags_options);12 10 const target = $('#tags_list'); 11 let mEdit = new metaEditor(target, tag_field, 'tag', editor_tags_options); 12 mEdit.meta_url = 'plugin.php?p=tags&m=tag_posts&tag='; 13 13 14 15 mEdit.meta_dialog.attr('title',mEdit.text_add_meta.replace(/%s/,mEdit.meta_type));16 mEdit.meta_dialog.attr('id','post_meta_input');17 mEdit.meta_dialog.css('width','90%');14 mEdit.meta_dialog = $('<input type="text" />'); 15 mEdit.meta_dialog.attr('title', mEdit.text_add_meta.replace(/%s/, mEdit.meta_type)); 16 mEdit.meta_dialog.attr('id', 'post_meta_input'); 17 mEdit.meta_dialog.css('width', '90%'); 18 18 19 19 mEdit.addMetaDialog(); 20 20 21 22 23 21 $('input[name="save_tags"]').click(function() { 22 tag_field.val($('#post_meta_input').val()); 23 }); 24 24 25 26 27 'f':'searchMeta',28 29 30 31 32 33 34 35 varresults = [];36 $(xml).find('meta').each(function(){37 38 39 'id':$(this).text(),40 'count':$(this).attr('count'),41 42 43 44 45 46 47 48 49 50 51 replace('%p',tag.percent).52 replace('%e',tag.count + ' ' +53 54 55 56 57 58 59 60 61 62 25 $('#post_meta_input').autocomplete(mEdit.service_uri, { 26 extraParams: { 27 'f': 'searchMeta', 28 'metaType': 'tag' 29 }, 30 delay: 1000, 31 multiple: true, 32 matchSubset: false, 33 matchContains: true, 34 parse: function(xml) { 35 let results = []; 36 $(xml).find('meta').each(function() { 37 results[results.length] = { 38 data: { 39 'id': $(this).text(), 40 'count': $(this).attr('count'), 41 'percent': $(this).attr('roundpercent') 42 }, 43 result: $(this).text() 44 }; 45 }); 46 return results; 47 }, 48 formatItem: function(tag) { 49 return tag.id + ' <em>(' + 50 dotclear.msg.tags_autocomplete. 51 replace('%p', tag.percent). 52 replace('%e', tag.count + ' ' + 53 (tag.count > 1 ? 54 dotclear.msg.entries : 55 dotclear.msg.entry) 56 ) + 57 ')</em>'; 58 }, 59 formatResult: function(tag) { 60 return tag.result; 61 } 62 }); 63 63 });
Note: See TracChangeset
for help on using the changeset viewer.