Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function send_to_editor(h) {
- if (window.location == "http://example.com/wp-admin/admin.php?page=slidorion_menu_new") {
- var source = h.match(/src=\".*\" alt/);
- source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
- jQuery('#'+current_slidorion_slide).val(source);
- jQuery('#img_preview_'+current_slidorion_slide).attr('src', source).css('background', 'none');
- tb_remove();
- } else {
- var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined';
- if ( !wpActiveEditor ) {
- if ( mce && tinymce.activeEditor ) {
- ed = tinymce.activeEditor;
- wpActiveEditor = ed.id;
- } else if ( !qt ) {
- return false;
- }
- } else if ( mce ) {
- if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') )
- ed = tinymce.activeEditor;
- else
- ed = tinymce.get(wpActiveEditor);
- }
- if ( ed && !ed.isHidden() ) {
- // restore caret position on IE
- if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
- ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
- if ( h.indexOf('[caption') === 0 ) {
- if ( ed.wpSetImgCaption )
- h = ed.wpSetImgCaption(h);
- } else if ( h.indexOf('[gallery') === 0 ) {
- if ( ed.plugins.wpgallery )
- h = ed.plugins.wpgallery._do_gallery(h);
- } else if ( h.indexOf('[embed') === 0 ) {
- if ( ed.plugins.wordpress )
- h = ed.plugins.wordpress._setEmbed(h);
- }
- ed.execCommand('mceInsertContent', false, h);
- } else if ( qt ) {
- QTags.insertContent(h);
- } else {
- document.getElementById(wpActiveEditor).value += h;
- }
- try{tb_remove();}catch(e){};
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement