Changeset 608737
- Timestamp:
- 10/05/2012 11:06:14 PM (13 years ago)
- File:
-
- 1 edited
-
auto-thickbox-plus/trunk/thickbox.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
auto-thickbox-plus/trunk/thickbox.js
r607313 r608737 501 501 var params = tb_parseQuery( queryString ); 502 502 503 TB_WIDTH = (params['width']*1) || tb_options.win_width; //defaults to 600 if no paramaters were added to URL504 TB_HEIGHT = (params['height']*1) || tb_options.win_height; //defaults to 400 if no paramaters were added to URL505 ajaxContentW = TB_WIDTH;506 ajaxContentH = TB_HEIGHT;507 508 503 if (typeof caption == "object") caption = tb_caption(caption, tb_options.ref_title); 509 504 TB_Title = "<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div></div>"; 510 505 511 506 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window 512 ajaxContentW += ('\v'=='v' ? 10 : 8) * 2; // add default body margin (IE or not)513 ajaxContentH += ('\v'=='v' ? 15 : 8) * 2;514 507 urlNoQuery = url.split(/[?&]TB_/); 515 508 jQuery("#TB_iframeContent").remove(); 516 TB_Iframe = "<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'>"+thickboxL10n.noiframes+"</iframe>";509 TB_Iframe = "<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()'>"+thickboxL10n.noiframes+"</iframe>"; 517 510 if(params['modal'] != "true"){//iframe no modal 518 511 switch (tb_options.position_title) { … … 530 523 }else{// not an iframe, ajax 531 524 if(jQuery("#TB_window").css("display") != "block"){ 532 TB_Ajax = "<div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>";525 TB_Ajax = "<div id='TB_ajaxContent'></div>"; 533 526 if(params['modal'] != "true"){//ajax no modal 534 527 switch (tb_options.position_title) { … … 546 539 } 547 540 }else{//this means the window is already up, we are just loading new content via ajax 548 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";549 jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";550 541 jQuery("#TB_ajaxContent")[0].scrollTop = 0; 551 542 jQuery("#TB_ajaxWindowTitle").html(caption); 552 543 } 553 }554 555 if(url.indexOf('TB_iframe') != -1) {556 TB_WIDTH += ('\v'=='v' ? 10 : 8) * 2; // add default body margin (IE or not)557 TB_HEIGHT += ('\v'=='v' ? 15 : 8) * 2 + tb_getSize(jQuery("#TB_title"))[1]; // add body margin and title bar height558 } else {559 var innerSize = tb_getSize(jQuery("#TB_ajaxContent"), "padding");560 var size = tb_getSize(jQuery("#TB_ajaxContent"));561 TB_WIDTH += innerSize[0] - size[0]; // add content padding562 TB_HEIGHT += innerSize[1] - size[1] + tb_getSize(jQuery("#TB_title"))[1];563 544 } 564 545 … … 570 551 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished 571 552 }); 572 tb_position ();553 tb_position_html(url, params); 573 554 jQuery("#TB_load").remove(); 574 555 tb_open(); 575 556 tb_roundCorner("iframe"); 576 557 }else if(url.indexOf('TB_iframe') != -1){ 577 tb_position ();558 tb_position_html(url, params); 578 559 if ((!("onload" in jQuery("#TB_iframeContent")[0]) && (typeof jQuery("#TB_iframeContent")[0]["onload"] != "function")) // not support iframe onload - http://kangax.github.com/iseventsupported/ 579 560 || urlType == '.pdf') { // XXX: Not wait for loading to complete because "onload" event won't triggered in IE and Firefox … … 583 564 var sign = (url.indexOf('?') == -1) ? '?' : '&'; 584 565 jQuery("#TB_ajaxContent").load(url += sign + "random=" + (new Date().getTime()),function(){//to do a post change this load method 585 tb_position ();566 tb_position_html(url, params); 586 567 jQuery("#TB_load").remove(); 587 568 tb_open(); … … 829 810 } 830 811 812 function tb_position_html(url, params) { 813 TB_WIDTH = (params['width']*1) || tb_options.win_width; //defaults to 600 if no paramaters were added to URL 814 TB_HEIGHT = (params['height']*1) || tb_options.win_height; //defaults to 400 if no paramaters were added to URL 815 ajaxContentW = TB_WIDTH; 816 ajaxContentH = TB_HEIGHT; 817 818 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window 819 ajaxContentW += ('\v'=='v' ? 10 : 8) * 2; // add default body margin (IE or not) 820 ajaxContentH += ('\v'=='v' ? 15 : 8) * 2; 821 jQuery("#TB_iframeContent").attr("style", "width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;"); 822 }else{// not an iframe, ajax 823 if(jQuery("#TB_window").css("display") != "block"){ 824 jQuery("#TB_ajaxContent").attr("style", "width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;"); 825 }else{//this means the window is already up, we are just loading new content via ajax 826 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; 827 jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; 828 } 829 } 830 831 if(url.indexOf('TB_iframe') != -1) { 832 TB_WIDTH += ('\v'=='v' ? 10 : 8) * 2; // add default body margin (IE or not) 833 TB_HEIGHT += ('\v'=='v' ? 15 : 8) * 2 + tb_getSize(jQuery("#TB_title"))[1]; // add body margin and title bar height 834 } else { 835 var innerSize = tb_getSize(jQuery("#TB_ajaxContent"), "padding"); 836 var size = tb_getSize(jQuery("#TB_ajaxContent")); 837 TB_WIDTH += innerSize[0] - size[0]; // add content padding 838 TB_HEIGHT += innerSize[1] - size[1] + tb_getSize(jQuery("#TB_title"))[1]; 839 } 840 841 tb_position(); 842 } 843 831 844 function tb_parseQuery ( query ) { 832 845 var Params = {};
Note: See TracChangeset
for help on using the changeset viewer.