(function($, undefined){
jQuery(document).ready(function(){
// JavaScript Document
(function() {
$(window).on('load', function(){
$('#content_ifr').contents().on('click','.hexagon_big_block .edit_X', function () {
var my_click = $(this).parent().parent()
tinyMCE.activeEditor.windowManager.open( {
title: 'Set the parameters of the HEXAGON Box',
width: 550,
height: 500,
style: 'overflow: auto; padding-bottom:100px; box-sizing: border-box;',
body: [
{
type : 'container',
name : 'name_box',
label : 'Name Hexagon Block',
html : ''
},
{
type : 'container',
name : 'description_tbox',
label : 'Description Block',
html : ''
},
{
type : 'container',
name : 'button_box',
label : 'Name Button',
html : ''
},
{
type : 'container',
name : 'mylink_box',
label : 'Link Block',
html : ''
},
{
type: 'container', // тип listbox = выпадающий список select
name: 'icon',
label: 'Select Icon',
html : '
---- Web Application Icons ----
---- Hand Icons ----
---- Transporatation Icons ----
---- Gender Icons ----
---- File Type Icons ----
---- Spinner Icons ----
---- Form Control Icons ----
---- Payment Icons ----
---- Chart Icons ----
---- Currency Icons ----
---- Text Editor Icons ----
---- Directional Icons ----
---- Video Player Icons ----
---- Brand Icons ----
---- Medical Icons ----
',
},
{
type : 'container',
name : 'prima_color',
label : 'Background Color:',
html : ''
},
{
type : 'container',
name : 'prima_color_hover',
label : 'Background Color Hover:',
html : ''
},
{
type : 'container',
name : 'text_color',
label : 'Text Color:',
html : ''
},
{
type : 'container',
name : 'text_color_hover',
label : 'Text Color Hover:',
html : ''
},
{
type : 'container',
name : 'insert_animation',
label : 'Animation:',
html : ''
},
{
type : 'container',
name : 'insert_delay',
label : 'Delay:',
html : ''
},
{
type : 'container',
name : 'empty2',
label : ' ',
html : '
'
},
],
onsubmit: function( e ) { // это будет происходить после заполнения полей и нажатии кнопки отправки
var insert_name = $('input#name_box').val()
var insert_description = $('textarea#description_tbox').val()
var insert_button = $('input#button_box').val()
var insert_mylink = $('input#mylink_box').val()
var insert_icon = $('#iconner .selected').removeClass('selected').attr('class')
var insert_prima_color = $('input#prima_color').val()
var insert_prima_color_hover = $('input#prima_color_hover').val()
var insert_text_color = $('input#text_color').val()
var insert_text_color_hover = $('input#text_color_hover').val()
var insert_animation = $('select#insert_animation').val()
var insert_delay = $('select#insert_delay').val()
var id_this_td = 'unique_style_' + ( Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000 )
var current_style = '';
var my_demo_template = '
')
my_click.remove()
}
});
$('#iconner').on('click','i', function () {
$('#iconner i').removeClass('selected')
$(this).addClass('selected')
});
$('.mce-container.mce-panel.mce-foot').css({'position' : 'fixed', 'left' : 'auto', 'top' : 'auto'})
$('#iconner '+'.'+my_click.find('.invisible_shortcode').html().split('"')[9].substring(3)).addClass('selected')
$('select#insert_animation [value="'+my_click.find('.invisible_shortcode').html().split('"')[19]+'"]').attr("selected", "");
$('select#insert_delay [value="'+my_click.find('.invisible_shortcode').html().split('"')[21]+'"]').attr("selected", "");
/*alert(my_click.find('.invisible_shortcode').html())
alert(my_click.find('.invisible_shortcode').html().split('"')[9])
alert(my_click.find('.invisible_shortcode').html().split('"')[19])
alert(my_click.find('.invisible_shortcode').html().split('"')[21])*/
});
})
tinymce.PluginManager.add('true_mce_button_big_hexagon', function( editor, url ) { // id кнопки true_mce_button должен быть везде один и тот же
editor.addButton( 'true_mce_button_big_hexagon', { // id кнопки true_mce_button
icon: ' fa fa-newspaper-o', // мой собственный CSS класс, благодаря которому я задам иконку кнопки
type: 'menubutton',
title: 'Add Hexagon Box', // всплывающая подсказка при наведении
menu: [ // тут начинается первый выпадающий список
{ // первый элемент первого выпадающего списка
text: 'Add Big Featured Box',
onclick: function() {
editor.windowManager.open( {
title: 'Set the parameters of the HEXAGON Box',
width: 550,
height: 500,
style: 'overflow: auto; padding-bottom:100px; box-sizing: border-box;',
body: [
{
type : 'container',
name : 'name_box',
label : 'Name Hexagon Block',
html : ''
},
{
type : 'container',
name : 'description_tbox',
label : 'Description Block',
html : ''
},
{
type : 'container',
name : 'button_box',
label : 'Name Button',
html : ''
},
{
type : 'container',
name : 'mylink_box',
label : 'Link Block',
html : ''
},
{
type: 'container', // тип listbox = выпадающий список select
name: 'icon',
label: 'Select Icon',
html : '
---- Web Application Icons ----
---- Hand Icons ----
---- Transporatation Icons ----
---- Gender Icons ----
---- File Type Icons ----
---- Spinner Icons ----
---- Form Control Icons ----
---- Payment Icons ----
---- Chart Icons ----
---- Currency Icons ----
---- Text Editor Icons ----
---- Directional Icons ----
---- Video Player Icons ----
---- Brand Icons ----
---- Medical Icons ----
',
},
{
type : 'container',
name : 'prima_color',
label : 'Background Color:',
html : ''
},
{
type : 'container',
name : 'prima_color_hover',
label : 'Background Color Hover:',
html : ''
},
{
type : 'container',
name : 'text_color',
label : 'Text Color:',
html : ''
},
{
type : 'container',
name : 'text_color_hover',
label : 'Text Color Hover:',
html : ''
},
{
type : 'container',
name : 'insert_animation',
label : 'Animation:',
html : ''
},
{
type : 'container',
name : 'insert_delay',
label : 'Delay:',
html : ''
},
{
type : 'container',
name : 'empty2',
label : ' ',
html : '
'
},
],
onsubmit: function( e ) { // это будет происходить после заполнения полей и нажатии кнопки отправки
var insert_name = $('input#name_box').val()
var insert_description = $('textarea#description_tbox').val()
var insert_button = $('input#button_box').val()
var insert_mylink = $('input#mylink_box').val()
var insert_icon = $('#iconner .selected').removeClass('selected').attr('class')
var insert_prima_color = $('input#prima_color').val()
var insert_prima_color_hover = $('input#prima_color_hover').val()
var insert_text_color = $('input#text_color').val()
var insert_text_color_hover = $('input#text_color_hover').val()
var insert_animation = $('select#insert_animation').val()
var insert_delay = $('select#insert_delay').val()
var id_this_td = 'unique_style_' + ( Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000 )
var current_style = '';
var my_demo_template = '