47 if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 |
47 if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 |
48 jQuery("body","html").css({height: "100%", width: "100%"}); |
48 jQuery("body","html").css({height: "100%", width: "100%"}); |
49 jQuery("html").css("overflow","hidden"); |
49 jQuery("html").css("overflow","hidden"); |
50 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 |
50 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 |
51 jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); |
51 jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); |
52 jQuery("#TB_overlay").click(tb_remove); |
52 jQuery("#TB_overlay").on( 'click', tb_remove ); |
53 } |
53 } |
54 }else{//all others |
54 }else{//all others |
55 if(document.getElementById("TB_overlay") === null){ |
55 if(document.getElementById("TB_overlay") === null){ |
56 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); |
56 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); |
57 jQuery("#TB_overlay").click(tb_remove); |
57 jQuery("#TB_overlay").on( 'click', tb_remove ); |
58 jQuery( 'body' ).addClass( 'modal-open' ); |
58 jQuery( 'body' ).addClass( 'modal-open' ); |
59 } |
59 } |
60 } |
60 } |
61 |
61 |
62 if(tb_detectMacXFF()){ |
62 if(tb_detectMacXFF()){ |
139 |
139 |
140 TB_WIDTH = imageWidth + 30; |
140 TB_WIDTH = imageWidth + 30; |
141 TB_HEIGHT = imageHeight + 60; |
141 TB_HEIGHT = imageHeight + 60; |
142 jQuery("#TB_window").append("<a href='' id='TB_ImageOff'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><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'><button type='button' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><span class='tb-close-icon'></span></button></div>"); |
142 jQuery("#TB_window").append("<a href='' id='TB_ImageOff'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><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'><button type='button' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><span class='tb-close-icon'></span></button></div>"); |
143 |
143 |
144 jQuery("#TB_closeWindowButton").click(tb_remove); |
144 jQuery("#TB_closeWindowButton").on( 'click', tb_remove ); |
145 |
145 |
146 if (!(TB_PrevHTML === "")) { |
146 if (!(TB_PrevHTML === "")) { |
147 function goPrev(){ |
147 function goPrev(){ |
148 if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);} |
148 if(jQuery(document).off("click",goPrev)){jQuery(document).off("click",goPrev);} |
149 jQuery("#TB_window").remove(); |
149 jQuery("#TB_window").remove(); |
150 jQuery("body").append("<div id='TB_window'></div>"); |
150 jQuery("body").append("<div id='TB_window'></div>"); |
151 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); |
151 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); |
152 return false; |
152 return false; |
153 } |
153 } |
154 jQuery("#TB_prev").click(goPrev); |
154 jQuery("#TB_prev").on( 'click', goPrev ); |
155 } |
155 } |
156 |
156 |
157 if (!(TB_NextHTML === "")) { |
157 if (!(TB_NextHTML === "")) { |
158 function goNext(){ |
158 function goNext(){ |
159 jQuery("#TB_window").remove(); |
159 jQuery("#TB_window").remove(); |
160 jQuery("body").append("<div id='TB_window'></div>"); |
160 jQuery("body").append("<div id='TB_window'></div>"); |
161 tb_show(TB_NextCaption, TB_NextURL, imageGroup); |
161 tb_show(TB_NextCaption, TB_NextURL, imageGroup); |
162 return false; |
162 return false; |
163 } |
163 } |
164 jQuery("#TB_next").click(goNext); |
164 jQuery("#TB_next").on( 'click', goNext ); |
165 |
165 |
166 } |
166 } |
167 |
167 |
168 jQuery(document).bind('keydown.thickbox', function(e){ |
168 jQuery(document).on('keydown.thickbox', function(e){ |
169 if ( e.which == 27 ){ // close |
169 if ( e.which == 27 ){ // close |
170 tb_remove(); |
170 tb_remove(); |
171 |
171 |
172 } else if ( e.which == 190 ){ // display previous image |
172 } else if ( e.which == 190 ){ // display previous image |
173 if(!(TB_NextHTML == "")){ |
173 if(!(TB_NextHTML == "")){ |
174 jQuery(document).unbind('thickbox'); |
174 jQuery(document).off('thickbox'); |
175 goNext(); |
175 goNext(); |
176 } |
176 } |
177 } else if ( e.which == 188 ){ // display next image |
177 } else if ( e.which == 188 ){ // display next image |
178 if(!(TB_PrevHTML == "")){ |
178 if(!(TB_PrevHTML == "")){ |
179 jQuery(document).unbind('thickbox'); |
179 jQuery(document).off('thickbox'); |
180 goPrev(); |
180 goPrev(); |
181 } |
181 } |
182 } |
182 } |
183 return false; |
183 return false; |
184 }); |
184 }); |
185 |
185 |
186 tb_position(); |
186 tb_position(); |
187 jQuery("#TB_load").remove(); |
187 jQuery("#TB_load").remove(); |
188 jQuery("#TB_ImageOff").click(tb_remove); |
188 jQuery("#TB_ImageOff").on( 'click', tb_remove ); |
189 jQuery("#TB_window").css({'visibility':'visible'}); //for safari using css instead of show |
189 jQuery("#TB_window").css({'visibility':'visible'}); //for safari using css instead of show |
190 }; |
190 }; |
191 |
191 |
192 imgPreloader.src = url; |
192 imgPreloader.src = url; |
193 }else{//code to show html |
193 }else{//code to show html |
204 urlNoQuery = url.split('TB_'); |
204 urlNoQuery = url.split('TB_'); |
205 jQuery("#TB_iframeContent").remove(); |
205 jQuery("#TB_iframeContent").remove(); |
206 if(params['modal'] != "true"){//iframe no modal |
206 if(params['modal'] != "true"){//iframe no modal |
207 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><button type='button' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><span class='tb-close-icon'></span></button></div></div><iframe frameborder='0' hspace='0' allowtransparency='true' 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 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><button type='button' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><span class='tb-close-icon'></span></button></div></div><iframe frameborder='0' hspace='0' allowtransparency='true' 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>"); |
208 }else{//iframe modal |
208 }else{//iframe modal |
209 jQuery("#TB_overlay").unbind(); |
209 jQuery("#TB_overlay").off(); |
210 jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' allowtransparency='true' 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>"); |
210 jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' allowtransparency='true' 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>"); |
211 } |
211 } |
212 }else{// not an iframe, ajax |
212 }else{// not an iframe, ajax |
213 if(jQuery("#TB_window").css("visibility") != "visible"){ |
213 if(jQuery("#TB_window").css("visibility") != "visible"){ |
214 if(params['modal'] != "true"){//ajax no modal |
214 if(params['modal'] != "true"){//ajax no modal |
215 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><button type='button' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><span class='tb-close-icon'></span></button></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); |
215 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><button type='button' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><span class='tb-close-icon'></span></button></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); |
216 }else{//ajax modal |
216 }else{//ajax modal |
217 jQuery("#TB_overlay").unbind(); |
217 jQuery("#TB_overlay").off(); |
218 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); |
218 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); |
219 } |
219 } |
220 }else{//this means the window is already up, we are just loading new content via ajax |
220 }else{//this means the window is already up, we are just loading new content via ajax |
221 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; |
221 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; |
222 jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; |
222 jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; |
223 jQuery("#TB_ajaxContent")[0].scrollTop = 0; |
223 jQuery("#TB_ajaxContent")[0].scrollTop = 0; |
224 jQuery("#TB_ajaxWindowTitle").html(caption); |
224 jQuery("#TB_ajaxWindowTitle").html(caption); |
225 } |
225 } |
226 } |
226 } |
227 |
227 |
228 jQuery("#TB_closeWindowButton").click(tb_remove); |
228 jQuery("#TB_closeWindowButton").on( 'click', tb_remove ); |
229 |
229 |
230 if(url.indexOf('TB_inline') != -1){ |
230 if(url.indexOf('TB_inline') != -1){ |
231 jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); |
231 jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); |
232 jQuery("#TB_window").bind('tb_unload', function () { |
232 jQuery("#TB_window").on('tb_unload', function () { |
233 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished |
233 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished |
234 }); |
234 }); |
235 tb_position(); |
235 tb_position(); |
236 jQuery("#TB_load").remove(); |
236 jQuery("#TB_load").remove(); |
237 jQuery("#TB_window").css({'visibility':'visible'}); |
237 jQuery("#TB_window").css({'visibility':'visible'}); |
281 jQuery("#TB_load").remove(); |
281 jQuery("#TB_load").remove(); |
282 jQuery("#TB_window").css({'visibility':'visible'}).trigger( 'thickbox:iframe:loaded' ); |
282 jQuery("#TB_window").css({'visibility':'visible'}).trigger( 'thickbox:iframe:loaded' ); |
283 } |
283 } |
284 |
284 |
285 function tb_remove() { |
285 function tb_remove() { |
286 jQuery("#TB_imageOff").unbind("click"); |
286 jQuery("#TB_imageOff").off("click"); |
287 jQuery("#TB_closeWindowButton").unbind("click"); |
287 jQuery("#TB_closeWindowButton").off("click"); |
288 jQuery( '#TB_window' ).fadeOut( 'fast', function() { |
288 jQuery( '#TB_window' ).fadeOut( 'fast', function() { |
289 jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).unbind().remove(); |
289 jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).off().remove(); |
290 jQuery( 'body' ).trigger( 'thickbox:removed' ); |
290 jQuery( 'body' ).trigger( 'thickbox:removed' ); |
291 }); |
291 }); |
292 jQuery( 'body' ).removeClass( 'modal-open' ); |
292 jQuery( 'body' ).removeClass( 'modal-open' ); |
293 jQuery("#TB_load").remove(); |
293 jQuery("#TB_load").remove(); |
294 if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 |
294 if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 |
295 jQuery("body","html").css({height: "auto", width: "auto"}); |
295 jQuery("body","html").css({height: "auto", width: "auto"}); |
296 jQuery("html").css("overflow",""); |
296 jQuery("html").css("overflow",""); |
297 } |
297 } |
298 jQuery(document).unbind('.thickbox'); |
298 jQuery(document).off('.thickbox'); |
299 return false; |
299 return false; |
300 } |
300 } |
301 |
301 |
302 function tb_position() { |
302 function tb_position() { |
303 var isIE6 = typeof document.body.style.maxHeight === "undefined"; |
303 var isIE6 = typeof document.body.style.maxHeight === "undefined"; |