// TinyMCE Emoticons plugin // send html to the editor function send_wp_editor(html) { var win = window.dialogArguments || opener || parent || top; win.send_to_editor(html); // alternatively direct tinyMCE command for insert // tinyMCE.execCommand("mceInsertContent", false, html); } function insert_link(html_link) { if ((typeof tinyMCE != "undefined") && ( edt = tinyMCE.getInstanceById('content') ) && !edt.isHidden() ) { var sel = edt.selection.getSel(); if (sel) { var link = '' + sel + ''; send_wp_editor(link); } } } // insert image to the editor function insert_image(src, title) { //var size = document.getElementById('img_size').value; var img = ''; send_wp_editor(img); } jQuery(document).ready(function($) { var i; var doc_height = $(document).height(); var post_area = $('.postarea').position(); var post_area_top = ''; if(post_area != null) post_area_top = post_area.top; //console.log(post_area.top); //var update_height = $('.updated').height(); //var notice_height = $('#notice').height(); //alert(update_height); var popup_top = post_area_top - 65; //if(update_height != null) popup_top += update_height + 25; //if(notice_height != null) popup_top += notice_height + 25; /***************************************/ /* FAMILIA 1 DE ALERGENOS ALIMENTARIOS */ /***************************************/ var popup = ""; /***************************************/ /* FAMILIA 2 DE ALERGENOS ALIMENTARIOS */ /***************************************/ var popup2 = ""; /***************************************/ /* FAMILIA 3 DE ALERGENOS ALIMENTARIOS */ /***************************************/ var popup3 = ""; /***************************************/ /* FAMILIA 4 DE ALERGENOS ALIMENTARIOS */ /***************************************/ var popup4 = ""; /***************************************/ /* FAMILIA 5 DE ALERGENOS ALIMENTARIOS */ /***************************************/ var popup5 = ""; /***************************************/ /* FAMILIA 6 DE ALERGENOS ALIMENTARIOS */ /***************************************/ var popup6 = ""; if(tinyEmoSettings.select_option == 'familia-1') $('#wpcontent #poststuff #post-body').append(popup); if(tinyEmoSettings.select_option == 'familia-2') $('#wpcontent #poststuff #post-body').append(popup2); if(tinyEmoSettings.select_option == 'familia-3') $('#wpcontent #poststuff #post-body').append(popup3); if(tinyEmoSettings.select_option == 'familia-4') $('#wpcontent #poststuff #post-body').append(popup4); if(tinyEmoSettings.select_option == 'familia-5') $('#wpcontent #poststuff #post-body').append(popup5); if(tinyEmoSettings.select_option == 'familia-6') $('#wpcontent #poststuff #post-body').append(popup6); $('html').click(function(e) { var clicked = $(e.target).attr('class'); //var clicked2 = $(e.target).parent().attr('class'); console.log(clicked); //console.log(clicked2); if((clicked != 'mce-ico mce-i-none') && (clicked != 'mceIcon') && clicked != 'mCSB_dragger_bar'){ $('.emoticons-popup').hide(); i=1; } }); $(document).on("click", ".mce_btnTinyEmo img.mceIcon, .mce-btnTinyEmo button",function(){ //console.log(i); if(i==0){ $('.emoticons-popup').hide(); i=1; } else{ $('.emoticons-popup').show(); i=0; } //$('.emoticons-popup').show(); }); $("#tinyemo-options a").click(function(){ $("#tinyemo-options a").removeClass("active"); $(this).addClass("active"); var opt_value = $(this).attr('alt'); $("#tinyemo-options #option-value").attr('value',opt_value); }); }); (function($){ var scroll_visible = false; $(window).load(function(){ /* custom scrollbar fn call */ $(".mce_btnTinyEmo, .mce-btnTinyEmo").live("click",function(){ if(scroll_visible != true){ $(".emoticons-popup").mCustomScrollbar({ scrollInertia:150 }); scroll_visible = true; } }); }); })(jQuery);