2009-01-07 00:02:40 -05:00
|
|
|
/*
|
|
|
|
* Thickbox 3.1 - One Box To Rule Them All.
|
|
|
|
* By Cody Lindley (http://www.codylindley.com)
|
|
|
|
* Copyright (c) 2007 cody lindley
|
|
|
|
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
|
|
|
|
*/
|
2009-11-17 19:19:55 -05:00
|
|
|
|
|
|
|
if ( typeof tb_pathToImage != 'string' ) {
|
2011-04-05 20:42:07 -04:00
|
|
|
var tb_pathToImage = thickboxL10n.loadingAnimation;
|
2009-11-17 19:19:55 -05:00
|
|
|
}
|
2009-01-07 00:02:40 -05:00
|
|
|
|
|
|
|
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
|
|
|
|
|
|
|
|
//on page load call tb_init
|
2009-11-17 19:19:55 -05:00
|
|
|
jQuery(document).ready(function(){
|
2009-01-07 00:02:40 -05:00
|
|
|
tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
|
|
|
|
imgLoader = new Image();// preload image
|
|
|
|
imgLoader.src = tb_pathToImage;
|
|
|
|
});
|
|
|
|
|
2015-10-28 14:19:26 -04:00
|
|
|
/*
|
|
|
|
* Add thickbox to href & area elements that have a class of .thickbox.
|
|
|
|
* Remove the loading indicator when content in an iframe has loaded.
|
|
|
|
*/
|
2009-01-07 00:02:40 -05:00
|
|
|
function tb_init(domChunk){
|
2015-10-28 14:19:26 -04:00
|
|
|
jQuery( 'body' )
|
|
|
|
.on( 'click', domChunk, tb_click )
|
|
|
|
.on( 'thickbox:iframe:loaded', function() {
|
|
|
|
jQuery( '#TB_window' ).removeClass( 'thickbox-loading' );
|
|
|
|
});
|
2010-04-07 09:52:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function tb_click(){
|
2009-01-07 00:02:40 -05:00
|
|
|
var t = this.title || this.name || null;
|
|
|
|
var a = this.href || this.alt;
|
|
|
|
var g = this.rel || false;
|
|
|
|
tb_show(t,a,g);
|
2021-02-18 06:28:06 -05:00
|
|
|
this.blur();
|
2009-01-07 00:02:40 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
|
|
|
|
|
2016-03-10 17:37:26 -05:00
|
|
|
var $closeBtn;
|
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
try {
|
|
|
|
if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
|
|
|
|
jQuery("body","html").css({height: "100%", width: "100%"});
|
|
|
|
jQuery("html").css("overflow","hidden");
|
|
|
|
if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
|
2015-10-28 14:19:26 -04:00
|
|
|
jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>");
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_overlay").on( 'click', tb_remove );
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
}else{//all others
|
|
|
|
if(document.getElementById("TB_overlay") === null){
|
2015-10-28 14:19:26 -04:00
|
|
|
jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>");
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_overlay").on( 'click', tb_remove );
|
2014-08-01 16:15:15 -04:00
|
|
|
jQuery( 'body' ).addClass( 'modal-open' );
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
if(tb_detectMacXFF()){
|
|
|
|
jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
|
|
|
|
}else{
|
|
|
|
jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
|
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
if(caption===null){caption="";}
|
2012-11-05 16:00:15 -05:00
|
|
|
jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' width='208' /></div>");//add loader to the page
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery('#TB_load').show();//show loader
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
var baseURL;
|
|
|
|
if(url.indexOf("?")!==-1){ //ff there is a query string involved
|
|
|
|
baseURL = url.substr(0, url.indexOf("?"));
|
2009-11-17 19:19:55 -05:00
|
|
|
}else{
|
2009-01-07 00:02:40 -05:00
|
|
|
baseURL = url;
|
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
Media: enable AVIF support.
Add support for uploading, editing and saving AVIF images when supported by the server.
Add 'image/avif' to supported mime types. Correctly identify AVIF images and sizes even when PHP doesn't support AVIF. Resize uploaded AVIF files (when supported) and use for front end markup.
Props adamsilverstein, lukefiretoss, ayeshrajans, navjotjsingh, Tyrannous, jb510, gregbenz, nickpagz, JavierCasares, mukesh27, yguyon, swissspidy.
Fixes #51228.
Built from https://develop.svn.wordpress.org/trunk@57524
git-svn-id: http://core.svn.wordpress.org/trunk@57025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-02 12:48:15 -05:00
|
|
|
var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.webp$|\.avif$/;
|
2009-01-07 00:02:40 -05:00
|
|
|
var urlType = baseURL.toLowerCase().match(urlString);
|
|
|
|
|
2022-05-30 10:53:11 -04:00
|
|
|
if(urlType == '.jpg' ||
|
|
|
|
urlType == '.jpeg' ||
|
|
|
|
urlType == '.png' ||
|
|
|
|
urlType == '.gif' ||
|
|
|
|
urlType == '.bmp' ||
|
Media: enable AVIF support.
Add support for uploading, editing and saving AVIF images when supported by the server.
Add 'image/avif' to supported mime types. Correctly identify AVIF images and sizes even when PHP doesn't support AVIF. Resize uploaded AVIF files (when supported) and use for front end markup.
Props adamsilverstein, lukefiretoss, ayeshrajans, navjotjsingh, Tyrannous, jb510, gregbenz, nickpagz, JavierCasares, mukesh27, yguyon, swissspidy.
Fixes #51228.
Built from https://develop.svn.wordpress.org/trunk@57524
git-svn-id: http://core.svn.wordpress.org/trunk@57025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-02 12:48:15 -05:00
|
|
|
urlType == '.webp' ||
|
|
|
|
urlType == '.avif'
|
2022-05-30 10:53:11 -04:00
|
|
|
){//code to show images
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
TB_PrevCaption = "";
|
|
|
|
TB_PrevURL = "";
|
|
|
|
TB_PrevHTML = "";
|
|
|
|
TB_NextCaption = "";
|
|
|
|
TB_NextURL = "";
|
|
|
|
TB_NextHTML = "";
|
|
|
|
TB_imageCount = "";
|
|
|
|
TB_FoundURL = false;
|
|
|
|
if(imageGroup){
|
|
|
|
TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
|
|
|
|
for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
|
|
|
|
var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
|
2009-11-17 19:19:55 -05:00
|
|
|
if (!(TB_TempArray[TB_Counter].href == url)) {
|
2009-01-07 00:02:40 -05:00
|
|
|
if (TB_FoundURL) {
|
|
|
|
TB_NextCaption = TB_TempArray[TB_Counter].title;
|
|
|
|
TB_NextURL = TB_TempArray[TB_Counter].href;
|
2009-11-25 06:08:39 -05:00
|
|
|
TB_NextHTML = "<span id='TB_next'> <a href='#'>"+thickboxL10n.next+"</a></span>";
|
2009-01-07 00:02:40 -05:00
|
|
|
} else {
|
|
|
|
TB_PrevCaption = TB_TempArray[TB_Counter].title;
|
|
|
|
TB_PrevURL = TB_TempArray[TB_Counter].href;
|
2009-11-25 06:08:39 -05:00
|
|
|
TB_PrevHTML = "<span id='TB_prev'> <a href='#'>"+thickboxL10n.prev+"</a></span>";
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
TB_FoundURL = true;
|
2009-11-25 06:08:39 -05:00
|
|
|
TB_imageCount = thickboxL10n.image + ' ' + (TB_Counter + 1) + ' ' + thickboxL10n.of + ' ' + (TB_TempArray.length);
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
imgPreloader = new Image();
|
2009-11-17 19:19:55 -05:00
|
|
|
imgPreloader.onload = function(){
|
2009-01-07 00:02:40 -05:00
|
|
|
imgPreloader.onload = null;
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2014-08-12 23:56:17 -04:00
|
|
|
// Resizing large images - original by Christian Montoya edited by me.
|
2009-01-07 00:02:40 -05:00
|
|
|
var pagesize = tb_getPageSize();
|
|
|
|
var x = pagesize[0] - 150;
|
|
|
|
var y = pagesize[1] - 150;
|
|
|
|
var imageWidth = imgPreloader.width;
|
|
|
|
var imageHeight = imgPreloader.height;
|
|
|
|
if (imageWidth > x) {
|
2009-11-17 19:19:55 -05:00
|
|
|
imageHeight = imageHeight * (x / imageWidth);
|
|
|
|
imageWidth = x;
|
|
|
|
if (imageHeight > y) {
|
|
|
|
imageWidth = imageWidth * (y / imageHeight);
|
|
|
|
imageHeight = y;
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
} else if (imageHeight > y) {
|
|
|
|
imageWidth = imageWidth * (y / imageHeight);
|
|
|
|
imageHeight = y;
|
|
|
|
if (imageWidth > x) {
|
|
|
|
imageHeight = imageHeight * (x / imageWidth);
|
2009-01-07 00:02:40 -05:00
|
|
|
imageWidth = x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// End Resizing
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
TB_WIDTH = imageWidth + 30;
|
|
|
|
TB_HEIGHT = imageHeight + 60;
|
2024-05-17 16:30:15 -04:00
|
|
|
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' aria-hidden='true'></span></button></div>");
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_closeWindowButton").on( 'click', tb_remove );
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
if (!(TB_PrevHTML === "")) {
|
|
|
|
function goPrev(){
|
2021-02-16 15:25:03 -05:00
|
|
|
if(jQuery(document).off("click",goPrev)){jQuery(document).off("click",goPrev);}
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery("#TB_window").remove();
|
|
|
|
jQuery("body").append("<div id='TB_window'></div>");
|
|
|
|
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
|
2009-11-17 19:19:55 -05:00
|
|
|
return false;
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_prev").on( 'click', goPrev );
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
|
|
|
if (!(TB_NextHTML === "")) {
|
2009-01-07 00:02:40 -05:00
|
|
|
function goNext(){
|
|
|
|
jQuery("#TB_window").remove();
|
|
|
|
jQuery("body").append("<div id='TB_window'></div>");
|
2009-11-17 19:19:55 -05:00
|
|
|
tb_show(TB_NextCaption, TB_NextURL, imageGroup);
|
|
|
|
return false;
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_next").on( 'click', goNext );
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery(document).on('keydown.thickbox', function(e){
|
2011-05-28 22:04:52 -04:00
|
|
|
if ( e.which == 27 ){ // close
|
2014-02-03 00:31:14 -05:00
|
|
|
tb_remove();
|
2011-05-28 22:04:52 -04:00
|
|
|
|
|
|
|
} else if ( e.which == 190 ){ // display previous image
|
2009-01-07 00:02:40 -05:00
|
|
|
if(!(TB_NextHTML == "")){
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery(document).off('thickbox');
|
2009-01-07 00:02:40 -05:00
|
|
|
goNext();
|
|
|
|
}
|
2011-05-28 22:04:52 -04:00
|
|
|
} else if ( e.which == 188 ){ // display next image
|
2009-01-07 00:02:40 -05:00
|
|
|
if(!(TB_PrevHTML == "")){
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery(document).off('thickbox');
|
2009-01-07 00:02:40 -05:00
|
|
|
goPrev();
|
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
}
|
2011-05-28 22:04:52 -04:00
|
|
|
return false;
|
|
|
|
});
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
tb_position();
|
|
|
|
jQuery("#TB_load").remove();
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_ImageOff").on( 'click', tb_remove );
|
2011-09-30 18:24:34 -04:00
|
|
|
jQuery("#TB_window").css({'visibility':'visible'}); //for safari using css instead of show
|
2009-01-07 00:02:40 -05:00
|
|
|
};
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
imgPreloader.src = url;
|
|
|
|
}else{//code to show html
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
var queryString = url.replace(/^[^\?]+\??/,'');
|
|
|
|
var params = tb_parseQuery( queryString );
|
|
|
|
|
2014-08-12 23:56:17 -04:00
|
|
|
TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no parameters were added to URL
|
|
|
|
TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no parameters were added to URL
|
2009-01-07 00:02:40 -05:00
|
|
|
ajaxContentW = TB_WIDTH - 30;
|
|
|
|
ajaxContentH = TB_HEIGHT - 45;
|
2009-11-17 19:19:55 -05:00
|
|
|
|
|
|
|
if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
|
2009-01-07 00:02:40 -05:00
|
|
|
urlNoQuery = url.split('TB_');
|
|
|
|
jQuery("#TB_iframeContent").remove();
|
|
|
|
if(params['modal'] != "true"){//iframe no modal
|
2024-05-17 16:30:15 -04:00
|
|
|
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' aria-hidden='true'></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>");
|
2009-01-07 00:02:40 -05:00
|
|
|
}else{//iframe modal
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery("#TB_overlay").off();
|
2016-03-10 17:37:26 -05:00
|
|
|
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>");
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
}else{// not an iframe, ajax
|
2011-09-30 18:24:34 -04:00
|
|
|
if(jQuery("#TB_window").css("visibility") != "visible"){
|
2009-01-07 00:02:40 -05:00
|
|
|
if(params['modal'] != "true"){//ajax no modal
|
2024-05-17 16:30:15 -04:00
|
|
|
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' aria-hidden='true'></span></button></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
|
2009-01-07 00:02:40 -05:00
|
|
|
}else{//ajax modal
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery("#TB_overlay").off();
|
2009-11-17 19:19:55 -05:00
|
|
|
jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
}else{//this means the window is already up, we are just loading new content via ajax
|
|
|
|
jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
|
|
|
|
jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
|
|
|
|
jQuery("#TB_ajaxContent")[0].scrollTop = 0;
|
|
|
|
jQuery("#TB_ajaxWindowTitle").html(caption);
|
|
|
|
}
|
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2021-02-23 05:54:06 -05:00
|
|
|
jQuery("#TB_closeWindowButton").on( 'click', tb_remove );
|
2009-11-17 19:19:55 -05:00
|
|
|
|
|
|
|
if(url.indexOf('TB_inline') != -1){
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery("#TB_window").on('tb_unload', function () {
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
|
|
|
|
});
|
|
|
|
tb_position();
|
|
|
|
jQuery("#TB_load").remove();
|
2011-09-30 18:24:34 -04:00
|
|
|
jQuery("#TB_window").css({'visibility':'visible'});
|
2009-01-07 00:02:40 -05:00
|
|
|
}else if(url.indexOf('TB_iframe') != -1){
|
|
|
|
tb_position();
|
2013-02-28 13:05:28 -05:00
|
|
|
jQuery("#TB_load").remove();
|
|
|
|
jQuery("#TB_window").css({'visibility':'visible'});
|
2009-01-07 00:02:40 -05:00
|
|
|
}else{
|
2015-05-13 17:42:24 -04:00
|
|
|
var load_url = url;
|
|
|
|
load_url += -1 === url.indexOf('?') ? '?' : '&';
|
|
|
|
jQuery("#TB_ajaxContent").load(load_url += "random=" + (new Date().getTime()),function(){//to do a post change this load method
|
2009-01-07 00:02:40 -05:00
|
|
|
tb_position();
|
|
|
|
jQuery("#TB_load").remove();
|
|
|
|
tb_init("#TB_ajaxContent a.thickbox");
|
2011-09-30 18:24:34 -04:00
|
|
|
jQuery("#TB_window").css({'visibility':'visible'});
|
2009-01-07 00:02:40 -05:00
|
|
|
});
|
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!params['modal']){
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery(document).on('keydown.thickbox', function(e){
|
2011-05-28 22:04:52 -04:00
|
|
|
if ( e.which == 27 ){ // close
|
2014-02-03 00:31:14 -05:00
|
|
|
tb_remove();
|
2011-05-28 22:04:52 -04:00
|
|
|
return false;
|
2009-11-17 19:19:55 -05:00
|
|
|
}
|
2011-05-28 22:04:52 -04:00
|
|
|
});
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
2009-11-17 19:19:55 -05:00
|
|
|
|
2016-03-10 17:37:26 -05:00
|
|
|
$closeBtn = jQuery( '#TB_closeWindowButton' );
|
|
|
|
/*
|
|
|
|
* If the native Close button icon is visible, move focus on the button
|
|
|
|
* (e.g. in the Network Admin Themes screen).
|
|
|
|
* In other admin screens is hidden and replaced by a different icon.
|
|
|
|
*/
|
|
|
|
if ( $closeBtn.find( '.tb-close-icon' ).is( ':visible' ) ) {
|
2021-02-16 15:25:03 -05:00
|
|
|
$closeBtn.trigger( 'focus' );
|
2016-03-10 17:37:26 -05:00
|
|
|
}
|
|
|
|
|
2009-01-07 00:02:40 -05:00
|
|
|
} catch(e) {
|
|
|
|
//nothing here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//helper functions below
|
|
|
|
function tb_showIframe(){
|
|
|
|
jQuery("#TB_load").remove();
|
2015-10-28 14:19:26 -04:00
|
|
|
jQuery("#TB_window").css({'visibility':'visible'}).trigger( 'thickbox:iframe:loaded' );
|
2009-01-07 00:02:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function tb_remove() {
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery("#TB_imageOff").off("click");
|
|
|
|
jQuery("#TB_closeWindowButton").off("click");
|
2016-03-10 17:37:26 -05:00
|
|
|
jQuery( '#TB_window' ).fadeOut( 'fast', function() {
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).off().remove();
|
2016-03-10 17:37:26 -05:00
|
|
|
jQuery( 'body' ).trigger( 'thickbox:removed' );
|
|
|
|
});
|
2014-08-01 16:15:15 -04:00
|
|
|
jQuery( 'body' ).removeClass( 'modal-open' );
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery("#TB_load").remove();
|
|
|
|
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
|
|
|
|
jQuery("body","html").css({height: "auto", width: "auto"});
|
|
|
|
jQuery("html").css("overflow","");
|
|
|
|
}
|
2021-02-16 15:25:03 -05:00
|
|
|
jQuery(document).off('.thickbox');
|
2009-01-07 00:02:40 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function tb_position() {
|
2009-01-24 06:58:21 -05:00
|
|
|
var isIE6 = typeof document.body.style.maxHeight === "undefined";
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
|
2009-01-24 06:58:21 -05:00
|
|
|
if ( ! isIE6 ) { // take away IE6
|
2009-01-07 00:02:40 -05:00
|
|
|
jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function tb_parseQuery ( query ) {
|
|
|
|
var Params = {};
|
|
|
|
if ( ! query ) {return Params;}// return empty object
|
|
|
|
var Pairs = query.split(/[;&]/);
|
|
|
|
for ( var i = 0; i < Pairs.length; i++ ) {
|
|
|
|
var KeyVal = Pairs[i].split('=');
|
|
|
|
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
|
|
|
|
var key = unescape( KeyVal[0] );
|
|
|
|
var val = unescape( KeyVal[1] );
|
|
|
|
val = val.replace(/\+/g, ' ');
|
|
|
|
Params[key] = val;
|
|
|
|
}
|
|
|
|
return Params;
|
|
|
|
}
|
|
|
|
|
|
|
|
function tb_getPageSize(){
|
|
|
|
var de = document.documentElement;
|
|
|
|
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
|
|
|
|
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
|
|
|
|
arrayPageSize = [w,h];
|
|
|
|
return arrayPageSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
function tb_detectMacXFF() {
|
|
|
|
var userAgent = navigator.userAgent.toLowerCase();
|
|
|
|
if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|