Files
creator-child/js/short-zenphoto.js
2017-02-02 06:42:50 +01:00

40 lines
1.4 KiB
JavaScript

(function() {
tinymce.create('tinymce.plugins.zenphoto', {
init : function(ed, url) {
ed.addButton('zenphoto', {
title : 'Add Zenphoto Shortcode',
image : url+'/recentpostsbutton.png',
onclick : function() {
var album = prompt("Album", "");
var image = prompt("Image", "");
if (image != null && image != ''){
if (album != null && album != '')
ed.execCommand('mceInsertContent', false, '[zenphoto album="'+album+'" image="'+image+'"]');
/*else
ed.execCommand('mceInsertContent', false, '[zenphoto'+text+'[/recent-posts]');*/
}
else{
if (album != null && album != '')
ed.execCommand('mceInsertContent', false, '[zenphoto album="'+album+'"]');
/*else
ed.execCommand('mceInsertContent', false, '[zenphoto]');*/
}
}
});
},
createControl : function(n, cm) {
return null;
},
getInfo : function() {
return {
longname : "Zenphoto Shortcode",
author : 'Bruno',
authorurl : 'https://clicclac.info',
infourl : 'https://clicclac.info/wordpress/',
version : "1.0"
};
}
});
tinymce.PluginManager.add('zenphoto', tinymce.plugins.zenphoto);
})();