Files
roi-theme/wp-content/plugins/sociallocker-next-premium/bizpanda/assets/admin/js/optinpanda.tinymce4.010.js
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

54 lines
2.0 KiB
JavaScript
Executable File

( function($) {
tinymce.PluginManager.add( 'optinpanda', function( editor, url ) {
var menuCreated = false;
var menu = [];
editor.addButton( 'optinpanda', {
title: window.bizpanda_shortcode_title ? window.bizpanda_shortcode_title : 'BizPanda',
type: 'menubutton',
icon: 'icon onp-sl-shortcode-icon',
menu: menu,
/*
* After rendeing contol, starts to load manu items (locker shortcodes).
*/
onpostrender: function(e) {
if ( menuCreated ) return;
menuCreated = true;
var self = this;
var req = $.ajax(ajaxurl, {
type: 'post',
dataType: 'json',
data: {
action: 'get_opanda_lockers'
},
success: function(data, textStatus, jqXHR) {
$.each(data, function(index, item){
var shortcodeStart = '[' + item.shortcode + ']';
if ( item.id && !item.isDefault ) {
shortcodeStart = '[' + item.shortcode + ' id=' + item.id + ']';
}
var shortcodeEnd = '[/' + item.shortcode + ']';
menu.push({
text: item.title,
value: item.id,
onclick: function() {
editor.selection.setContent(shortcodeStart + editor.selection.getContent() + shortcodeEnd);
}
});
});
self.settings.menu = menu;
}
});
}
});
});
} )(jQuery);