1 // send html to the post editor
2 function send_to_editor(h) {
3 if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
6 ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
8 if ( h.indexOf('[caption') != -1 )
9 h = ed.plugins.wpeditimage._do_shcode(h);
11 ed.execCommand('mceInsertContent', false, h);
13 edInsertContent(edCanvas, h);
20 tb_position = function() {
21 var tbWindow = $('#TB_window');
22 var width = $(window).width();
23 var H = $(window).height();
24 var W = ( 720 < width ) ? 720 : width;
26 if ( tbWindow.size() ) {
27 tbWindow.width( W - 50 ).height( H - 45 );
28 $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
29 tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
30 if ( typeof document.body.style.maxWidth != 'undefined' )
31 tbWindow.css({'top':'20px','margin-top':'0'});
32 $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
35 return $('a.thickbox').each( function() {
36 var href = $(this).attr('href');
38 href = href.replace(/&width=[0-9]+/g, '');
39 href = href.replace(/&height=[0-9]+/g, '');
40 $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
44 jQuery('a.thickbox').click(function(){
45 if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) {
46 tinyMCE.get('content').focus();
47 tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
51 $(window).resize( function() { tb_position() } );