1 /**
  2  * @file TinyMCE plugin
  3  *
  4  * @author Dominik Kocuj
  5  * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 or later
  6  * @copyright Copyright (c) 2013-2018 kocuj.pl
  7  */
  8 
  9 (function() {})(); // empty function for correct minify with comments
 10 //'use strict'; // for jshint uncomment this and comment line above
 11 
 12 /* jshint strict: true */
 13 /* jshint -W034 */
 14 
 15 /* global ed */
 16 /* global tinymce */
 17 
 18 /**
 19  * TinyMCE plugin
 20  *
 21  * @namespace kocujSitemapPluginTinyMce
 22  * @public
 23  */
 24 var kocujSitemapPluginTinyMce = {
 25 	/**
 26 	 * Initialize TinyMCE plugin
 27 	 *
 28 	 * @public
 29 	 * @param {Object} ed Editor object
 30 	 * @param {string} url URL
 31 	 * @return {void}
 32 	 */
 33 	init : function(ed, url) {
 34 		'use strict';
 35 		// add button
 36 		ed.addButton('kocujsitemap', {
 37 			title : ed.getLang('kocujsitemap.buttontitle'),
 38 			cmd   : 'kocujsitemap',
 39 			image : url + '/addsitemap2.png'
 40 		});
 41 		// add command
 42 		ed.addCommand('kocujsitemap', function() {
 43 			var shortcode = '[KocujSitemap]';
 44 			ed.execCommand('mceInsertContent', 0, shortcode);
 45 		});
 46 	},
 47 
 48 	/**
 49 	 * Create control
 50 	 *
 51 	 * @public
 52 	 * @param {string} n Control type
 53 	 * @param {Object} cm Control object
 54 	 * @return {Object} Control object
 55 	 */
 56 	createControl : function(n, cm) {
 57 		'use strict';
 58 		// exit
 59 		return null;
 60 	},
 61 
 62 	/**
 63 	 * Get TinyMCE plugin information
 64 	 *
 65 	 * @public
 66 	 * @return {Object} TinyMCE plugin information
 67 	 */
 68 	getInfo : function() {
 69 		'use strict';
 70 		// exit
 71 		return {
 72 			longname  : ed.getLang('kocujsitemap.longname'),
 73 			author    : 'Dominik Kocuj',
 74 			authorurl : 'http://kocuj.pl',
 75 			infourl   : 'http://kocujsitemap.wpplugin.kocuj.pl',
 76 			version   : '2.1.0'
 77 		};
 78 	}
 79 };
 80 
 81 (function() {
 82 	'use strict';
 83 	tinymce.create('tinymce.plugins.KocujSitemap', kocujSitemapPluginTinyMce);
 84 	tinymce.PluginManager.add('kocujsitemap', tinymce.plugins.KocujSitemap);
 85 })();
 86