raw
mp-wp_genesis           1 // send html to the post editor
mp-wp_genesis 2 function send_to_editor(h) {
mp-wp_genesis 3 if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
mp-wp_genesis 4 ed.focus();
mp-wp_genesis 5 if (tinymce.isIE)
mp-wp_genesis 6 ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
mp-wp_genesis 7
mp-wp_genesis 8 if ( h.indexOf('[caption') === 0 ) {
mp-wp_genesis 9 if ( ed.plugins.wpeditimage )
mp-wp_genesis 10 h = ed.plugins.wpeditimage._do_shcode(h);
mp-wp_genesis 11 } else if ( h.indexOf('[gallery') === 0 ) {
mp-wp_genesis 12 if ( ed.plugins.wpgallery )
mp-wp_genesis 13 h = ed.plugins.wpgallery._do_gallery(h);
mp-wp_genesis 14 }
mp-wp_genesis 15
mp-wp_genesis 16 ed.execCommand('mceInsertContent', false, h);
mp-wp_genesis 17
mp-wp_genesis 18 } else if ( typeof edInsertContent == 'function' ) {
mp-wp_genesis 19 edInsertContent(edCanvas, h);
mp-wp_genesis 20 } else {
mp-wp_genesis 21 jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
mp-wp_genesis 22 }
mp-wp_genesis 23
mp-wp_genesis 24 tb_remove();
mp-wp_genesis 25 }
mp-wp_genesis 26
mp-wp_genesis 27 // thickbox settings
mp-wp_genesis 28 jQuery(function($) {
mp-wp_genesis 29 tb_position = function() {
mp-wp_genesis 30 var tbWindow = $('#TB_window');
mp-wp_genesis 31 var width = $(window).width();
mp-wp_genesis 32 var H = $(window).height();
mp-wp_genesis 33 var W = ( 720 < width ) ? 720 : width;
mp-wp_genesis 34
mp-wp_genesis 35 if ( tbWindow.size() ) {
mp-wp_genesis 36 tbWindow.width( W - 50 ).height( H - 45 );
mp-wp_genesis 37 $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
mp-wp_genesis 38 tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
mp-wp_genesis 39 if ( typeof document.body.style.maxWidth != 'undefined' )
mp-wp_genesis 40 tbWindow.css({'top':'20px','margin-top':'0'});
mp-wp_genesis 41 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
mp-wp_genesis 42 };
mp-wp_genesis 43
mp-wp_genesis 44 return $('a.thickbox').each( function() {
mp-wp_genesis 45 var href = $(this).attr('href');
mp-wp_genesis 46 if ( ! href ) return;
mp-wp_genesis 47 href = href.replace(/&width=[0-9]+/g, '');
mp-wp_genesis 48 href = href.replace(/&height=[0-9]+/g, '');
mp-wp_genesis 49 $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
mp-wp_genesis 50 });
mp-wp_genesis 51 };
mp-wp_genesis 52
mp-wp_genesis 53 jQuery('a.thickbox').click(function(){
mp-wp_genesis 54 if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) {
mp-wp_genesis 55 tinyMCE.get('content').focus();
mp-wp_genesis 56 tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
mp-wp_genesis 57 }
mp-wp_genesis 58 });
mp-wp_genesis 59
mp-wp_genesis 60 $(window).resize( function() { tb_position() } );
mp-wp_genesis 61 });
mp-wp_genesis 62