(function($, undefined){
jQuery(document).ready(function(){
// JavaScript Document
(function() {
$(window).on('load', function(){
$('#content_ifr').contents().on('click','.cg_featured_sm .edit_X', function () {
var my_click = $(this).parent().parent()
tinyMCE.activeEditor.windowManager.open( {
title: 'Set the parameters of the Featured Box',
body: [
{
type : 'container',
name : 'name_box',
label : 'Name Block Featured',
html : ''
},
{
type: 'container',
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 : 'description_tbox',
label : 'Description Block',
html : ''
},
{
type : 'container',
name : 'backcolor',
label : 'Background Color Icon:',
html : ''
},
{
type : 'container',
name : 'backcolor_hover',
label : 'Background Color Icon Hover:',
html : ''
},
{
type : 'container',
name : 'iconcolor',
label : 'Background Color Icon:',
html : ''
},
{
type : 'container',
name : 'iconcolor_hover',
label : 'Background Color Icon:',
html : ''
},
{
type : 'container',
name : 'insert_animation',
label : 'Animation:',
html : ''
},
{
type : 'container',
name : 'insert_delay',
label : 'Delay:',
html : ''
},
],
onsubmit: function( e ) { // это будет происходить после заполнения полей и нажатии кнопки отправки
var iconner = $('#iconner .selected').removeClass('selected').attr('class')
var name_box = $('input#name_box').val()
var insert_description = $('textarea#description_tbox').val()
var backcolor = $('input#backcolor').val()
var backcolor_hover = $('input#backcolor_hover').val()
var iconcolor = $('input#iconcolor').val()
var iconcolor_hover = $('input#iconcolor_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('"')[4].substring(3)).addClass('selected')
$('#iconner '+'.'+my_click.find('.invisible_shortcode').html().split('"')[3].substring(3)).addClass('selected')
$('select#insert_animation [value="'+my_click.find('.invisible_shortcode').html().split('"')[15]+'"]').attr("selected", "");
$('select#insert_delay [value="'+my_click.find('.invisible_shortcode').html().split('"')[17]+'"]').attr("selected", "");
//alert(my_click.find('.invisible_shortcode').html())
//alert(my_click.find('.invisible_shortcode').html().split('"')[15])
//alert(my_click.find('.invisible_shortcode').html().split('"')[17])
//alert(my_click.find('.invisible_shortcode').html().split('"')[8])
//alert(my_click.find('.invisible_shortcode').html().split('"')[7])
});
})
tinymce.PluginManager.add('true_mce_button_featuredicon', function( editor, url ) { // id кнопки true_mce_button должен быть везде один и тот же
editor.addButton( 'true_mce_button_featuredicon', { // id кнопки true_mce_button
icon: ' fa fa-cubes', // мой собственный CSS класс, благодаря которому я задам иконку кнопки
type: 'menubutton',
title: 'Add Featured List', // всплывающая подсказка при наведении
menu: [ // тут начинается первый выпадающий список
{ // первый элемент первого выпадающего списка
text: 'Add Fearured Box',
onclick: function() {
editor.windowManager.open( {
title: 'Set the parameters of the Featured Box',
body: [
{
type : 'container',
name : 'name_box',
label : 'Name Block Featured',
html : ''
},
{
type: 'container',
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 : 'description_tbox',
label : 'Description Block',
html : ''
},
{
type : 'container',
name : 'backcolor',
label : 'Background Color Icon:',
html : ''
},
{
type : 'container',
name : 'backcolor_hover',
label : 'Background Color Icon Hover:',
html : ''
},
{
type : 'container',
name : 'iconcolor',
label : 'Background Color Icon:',
html : ''
},
{
type : 'container',
name : 'iconcolor_hover',
label : 'Background Color Icon:',
html : ''
},
{
type : 'container',
name : 'insert_animation',
label : 'Animation:',
html : ''
},
{
type : 'container',
name : 'insert_delay',
label : 'Delay:',
html : ''
},
],
onsubmit: function( e ) { // это будет происходить после заполнения полей и нажатии кнопки отправки
var iconner = $('#iconner .selected').removeClass('selected').attr('class')
var name_box = $('input#name_box').val()
var insert_description = $('textarea#description_tbox').val()
var backcolor = $('input#backcolor').val()
var backcolor_hover = $('input#backcolor_hover').val()
var iconcolor = $('input#iconcolor').val()
var iconcolor_hover = $('input#iconcolor_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 = '