5 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php |
5 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php |
6 */ |
6 */ |
7 |
7 |
8 if ( typeof tb_pathToImage != 'string' ) { |
8 if ( typeof tb_pathToImage != 'string' ) { |
9 var tb_pathToImage = thickboxL10n.loadingAnimation; |
9 var tb_pathToImage = thickboxL10n.loadingAnimation; |
10 } |
|
11 if ( typeof tb_closeImage != 'string' ) { |
|
12 var tb_closeImage = thickboxL10n.closeImage; |
|
13 } |
10 } |
14 |
11 |
15 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ |
12 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ |
16 |
13 |
17 //on page load call tb_init |
14 //on page load call tb_init |
57 }else{ |
54 }else{ |
58 jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity |
55 jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity |
59 } |
56 } |
60 |
57 |
61 if(caption===null){caption="";} |
58 if(caption===null){caption="";} |
62 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page |
59 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' width='208' /></div>");//add loader to the page |
63 jQuery('#TB_load').show();//show loader |
60 jQuery('#TB_load').show();//show loader |
64 |
61 |
65 var baseURL; |
62 var baseURL; |
66 if(url.indexOf("?")!==-1){ //ff there is a query string involved |
63 if(url.indexOf("?")!==-1){ //ff there is a query string involved |
67 baseURL = url.substr(0, url.indexOf("?")); |
64 baseURL = url.substr(0, url.indexOf("?")); |
130 } |
127 } |
131 // End Resizing |
128 // End Resizing |
132 |
129 |
133 TB_WIDTH = imageWidth + 30; |
130 TB_WIDTH = imageWidth + 30; |
134 TB_HEIGHT = imageHeight + 60; |
131 TB_HEIGHT = imageHeight + 60; |
135 jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='"+thickboxL10n.close+"'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div>"); |
132 jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='"+thickboxL10n.close+"'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><div class='tb-close-icon'></div></a></div>"); |
136 |
133 |
137 jQuery("#TB_closeWindowButton").click(tb_remove); |
134 jQuery("#TB_closeWindowButton").click(tb_remove); |
138 |
135 |
139 if (!(TB_PrevHTML === "")) { |
136 if (!(TB_PrevHTML === "")) { |
140 function goPrev(){ |
137 function goPrev(){ |
198 |
195 |
199 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window |
196 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window |
200 urlNoQuery = url.split('TB_'); |
197 urlNoQuery = url.split('TB_'); |
201 jQuery("#TB_iframeContent").remove(); |
198 jQuery("#TB_iframeContent").remove(); |
202 if(params['modal'] != "true"){//iframe no modal |
199 if(params['modal'] != "true"){//iframe no modal |
203 jQuery("#TB_window").append("<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><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 + 29)+"px;height:"+(ajaxContentH + 17)+"px;' >"+thickboxL10n.noiframes+"</iframe>"); |
200 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><div class='tb-close-icon'></div></a></div></div><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 + 29)+"px;height:"+(ajaxContentH + 17)+"px;' >"+thickboxL10n.noiframes+"</iframe>"); |
204 }else{//iframe modal |
201 }else{//iframe modal |
205 jQuery("#TB_overlay").unbind(); |
202 jQuery("#TB_overlay").unbind(); |
206 jQuery("#TB_window").append("<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 + 29)+"px;height:"+(ajaxContentH + 17)+"px;'>"+thickboxL10n.noiframes+"</iframe>"); |
203 jQuery("#TB_window").append("<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 + 29)+"px;height:"+(ajaxContentH + 17)+"px;'>"+thickboxL10n.noiframes+"</iframe>"); |
207 } |
204 } |
208 }else{// not an iframe, ajax |
205 }else{// not an iframe, ajax |
209 if(jQuery("#TB_window").css("visibility") != "visible"){ |
206 if(jQuery("#TB_window").css("visibility") != "visible"){ |
210 if(params['modal'] != "true"){//ajax no modal |
207 if(params['modal'] != "true"){//ajax no modal |
211 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src='" + tb_closeImage + "' /></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); |
208 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><div class='tb-close-icon'></div></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); |
212 }else{//ajax modal |
209 }else{//ajax modal |
213 jQuery("#TB_overlay").unbind(); |
210 jQuery("#TB_overlay").unbind(); |
214 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); |
211 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); |
215 } |
212 } |
216 }else{//this means the window is already up, we are just loading new content via ajax |
213 }else{//this means the window is already up, we are just loading new content via ajax |