Clean up spaces, tabs, indentation, and bracket formatting

This commit is contained in:
Brian Miyaji
2021-11-10 15:41:40 +09:00
parent e58beb1201
commit 3dff686a00
285 changed files with 29638 additions and 24147 deletions

View File

@@ -1,42 +1,58 @@
/* global tinymce */
( function () {
tinymce.PluginManager.add( 'sp_shortcodes_button', function( editor, url ) {
var ed = tinymce.activeEditor;
tinymce.PluginManager.add(
'sp_shortcodes_button',
function( editor, url ) {
var ed = tinymce.activeEditor;
var groups = ed.getLang( 'sportspress.shortcodes' ).split("]");
var menu = new Array();
var groups = ed.getLang( 'sportspress.shortcodes' ).split( "]" );
var menu = new Array();
groups.forEach(function(g) {
if ( "" == g ) return;
var p = g.split("[");
var label = p.shift();
var variations = p.shift();
var shortcodes = typeof variations!== 'undefined' ? variations.split("|") : [];
var submenu = new Array();
shortcodes.forEach(function(s) {
submenu.push({
text: ed.getLang( 'sportspress.' + s ),
onclick: function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( ed.getLang( 'sportspress.' + label ) + ' - ' + ed.getLang( 'sportspress.' + s ), 'admin-ajax.php?action=sportspress_' + label + '_' + s + '_shortcode&width=' + W + '&height=' + H );
groups.forEach(
function(g) {
if ( "" == g ) {
return;
}
});
});
menu.push({
text: ed.getLang( 'sportspress.' + label ),
menu: submenu
});
});
var p = g.split( "[" );
var label = p.shift();
var variations = p.shift();
var shortcodes = typeof variations !== 'undefined' ? variations.split( "|" ) : [];
var submenu = new Array();
shortcodes.forEach(
function(s) {
submenu.push(
{
text: ed.getLang( 'sportspress.' + s ),
onclick: function() {
// triggers the thickbox
var width = jQuery( window ).width(), H = jQuery( window ).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( ed.getLang( 'sportspress.' + label ) + ' - ' + ed.getLang( 'sportspress.' + s ), 'admin-ajax.php?action=sportspress_' + label + '_' + s + '_shortcode&width=' + W + '&height=' + H );
}
}
);
}
);
menu.push(
{
text: ed.getLang( 'sportspress.' + label ),
menu: submenu
}
);
}
);
editor.addButton( 'sp_shortcodes_button', {
title: ed.getLang('sportspress.insert'),
text: false,
icon: false,
type: 'menubutton',
menu: menu
});
});
editor.addButton(
'sp_shortcodes_button',
{
title: ed.getLang( 'sportspress.insert' ),
text: false,
icon: false,
type: 'menubutton',
menu: menu
}
);
}
);
})();