-
+ EFDCCB1C590C39567E97E2A340CD410E38156116257DB5EA2571E29461965FA32F4859FFDE51B4E481C1D76F8E6833B3FB8B6F8BD7A9A1ADF3874080EE2A8CE8
mp-wp/wp-includes/js/thickbox/thickbox.js
(0 . 0)(1 . 320)
117978 /*
117979 * Thickbox 3.1 - One Box To Rule Them All.
117980 * By Cody Lindley (http://www.codylindley.com)
117981 * Copyright (c) 2007 cody lindley
117982 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
117983 */
117984
117985 var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif";
117986 var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";
117987
117988 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
117989
117990 //on page load call tb_init
117991 jQuery(document).ready(function(){
117992 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
117993 imgLoader = new Image();// preload image
117994 imgLoader.src = tb_pathToImage;
117995 });
117996
117997 //add thickbox to href & area elements that have a class of .thickbox
117998 function tb_init(domChunk){
117999 jQuery(domChunk).click(function(){
118000 var t = this.title || this.name || null;
118001 var a = this.href || this.alt;
118002 var g = this.rel || false;
118003 tb_show(t,a,g);
118004 this.blur();
118005 return false;
118006 });
118007 }
118008
118009 function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
118010
118011 try {
118012 if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
118013 jQuery("body","html").css({height: "100%", width: "100%"});
118014 jQuery("html").css("overflow","hidden");
118015 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
118016 jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
118017 jQuery("#TB_overlay").click(tb_remove);
118018 }
118019 }else{//all others
118020 if(document.getElementById("TB_overlay") === null){
118021 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
118022 jQuery("#TB_overlay").click(tb_remove);
118023 }
118024 }
118025
118026 if(tb_detectMacXFF()){
118027 jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
118028 }else{
118029 jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
118030 }
118031
118032 if(caption===null){caption="";}
118033 jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
118034 jQuery('#TB_load').show();//show loader
118035
118036 var baseURL;
118037 if(url.indexOf("?")!==-1){ //ff there is a query string involved
118038 baseURL = url.substr(0, url.indexOf("?"));
118039 }else{
118040 baseURL = url;
118041 }
118042
118043 var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
118044 var urlType = baseURL.toLowerCase().match(urlString);
118045
118046 if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
118047
118048 TB_PrevCaption = "";
118049 TB_PrevURL = "";
118050 TB_PrevHTML = "";
118051 TB_NextCaption = "";
118052 TB_NextURL = "";
118053 TB_NextHTML = "";
118054 TB_imageCount = "";
118055 TB_FoundURL = false;
118056 if(imageGroup){
118057 TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
118058 for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
118059 var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
118060 if (!(TB_TempArray[TB_Counter].href == url)) {
118061 if (TB_FoundURL) {
118062 TB_NextCaption = TB_TempArray[TB_Counter].title;
118063 TB_NextURL = TB_TempArray[TB_Counter].href;
118064 TB_NextHTML = "<span id='TB_next'>  <a href='#'>Next ></a></span>";
118065 } else {
118066 TB_PrevCaption = TB_TempArray[TB_Counter].title;
118067 TB_PrevURL = TB_TempArray[TB_Counter].href;
118068 TB_PrevHTML = "<span id='TB_prev'>  <a href='#'>< Prev</a></span>";
118069 }
118070 } else {
118071 TB_FoundURL = true;
118072 TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
118073 }
118074 }
118075 }
118076
118077 imgPreloader = new Image();
118078 imgPreloader.onload = function(){
118079 imgPreloader.onload = null;
118080
118081 // Resizing large images - orginal by Christian Montoya edited by me.
118082 var pagesize = tb_getPageSize();
118083 var x = pagesize[0] - 150;
118084 var y = pagesize[1] - 150;
118085 var imageWidth = imgPreloader.width;
118086 var imageHeight = imgPreloader.height;
118087 if (imageWidth > x) {
118088 imageHeight = imageHeight * (x / imageWidth);
118089 imageWidth = x;
118090 if (imageHeight > y) {
118091 imageWidth = imageWidth * (y / imageHeight);
118092 imageHeight = y;
118093 }
118094 } else if (imageHeight > y) {
118095 imageWidth = imageWidth * (y / imageHeight);
118096 imageHeight = y;
118097 if (imageWidth > x) {
118098 imageHeight = imageHeight * (x / imageWidth);
118099 imageWidth = x;
118100 }
118101 }
118102 // End Resizing
118103
118104 TB_WIDTH = imageWidth + 30;
118105 TB_HEIGHT = imageHeight + 60;
118106 jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='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='Close'><img src='" + tb_closeImage + "' /></a></div>");
118107
118108 jQuery("#TB_closeWindowButton").click(tb_remove);
118109
118110 if (!(TB_PrevHTML === "")) {
118111 function goPrev(){
118112 if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
118113 jQuery("#TB_window").remove();
118114 jQuery("body").append("<div id='TB_window'></div>");
118115 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
118116 return false;
118117 }
118118 jQuery("#TB_prev").click(goPrev);
118119 }
118120
118121 if (!(TB_NextHTML === "")) {
118122 function goNext(){
118123 jQuery("#TB_window").remove();
118124 jQuery("body").append("<div id='TB_window'></div>");
118125 tb_show(TB_NextCaption, TB_NextURL, imageGroup);
118126 return false;
118127 }
118128 jQuery("#TB_next").click(goNext);
118129
118130 }
118131
118132 document.onkeydown = function(e){
118133 if (e == null) { // ie
118134 keycode = event.keyCode;
118135 } else { // mozilla
118136 keycode = e.which;
118137 }
118138 if(keycode == 27){ // close
118139 tb_remove();
118140 } else if(keycode == 190){ // display previous image
118141 if(!(TB_NextHTML == "")){
118142 document.onkeydown = "";
118143 goNext();
118144 }
118145 } else if(keycode == 188){ // display next image
118146 if(!(TB_PrevHTML == "")){
118147 document.onkeydown = "";
118148 goPrev();
118149 }
118150 }
118151 };
118152
118153 tb_position();
118154 jQuery("#TB_load").remove();
118155 jQuery("#TB_ImageOff").click(tb_remove);
118156 jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
118157 };
118158
118159 imgPreloader.src = url;
118160 }else{//code to show html
118161
118162 var queryString = url.replace(/^[^\?]+\??/,'');
118163 var params = tb_parseQuery( queryString );
118164
118165 TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
118166 TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
118167 ajaxContentW = TB_WIDTH - 30;
118168 ajaxContentH = TB_HEIGHT - 45;
118169
118170 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
118171 urlNoQuery = url.split('TB_');
118172 jQuery("#TB_iframeContent").remove();
118173 if(params['modal'] != "true"){//iframe no modal
118174 jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='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;' > </iframe>");
118175 }else{//iframe modal
118176 jQuery("#TB_overlay").unbind();
118177 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;'> </iframe>");
118178 }
118179 }else{// not an iframe, ajax
118180 if(jQuery("#TB_window").css("display") != "block"){
118181 if(params['modal'] != "true"){//ajax no modal
118182 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>");
118183 }else{//ajax modal
118184 jQuery("#TB_overlay").unbind();
118185 jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
118186 }
118187 }else{//this means the window is already up, we are just loading new content via ajax
118188 jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
118189 jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
118190 jQuery("#TB_ajaxContent")[0].scrollTop = 0;
118191 jQuery("#TB_ajaxWindowTitle").html(caption);
118192 }
118193 }
118194
118195 jQuery("#TB_closeWindowButton").click(tb_remove);
118196
118197 if(url.indexOf('TB_inline') != -1){
118198 jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
118199 jQuery("#TB_window").unload(function () {
118200 jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
118201 });
118202 tb_position();
118203 jQuery("#TB_load").remove();
118204 jQuery("#TB_window").css({display:"block"});
118205 }else if(url.indexOf('TB_iframe') != -1){
118206 tb_position();
118207 if($.browser.safari){//safari needs help because it will not fire iframe onload
118208 jQuery("#TB_load").remove();
118209 jQuery("#TB_window").css({display:"block"});
118210 }
118211 }else{
118212 jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
118213 tb_position();
118214 jQuery("#TB_load").remove();
118215 tb_init("#TB_ajaxContent a.thickbox");
118216 jQuery("#TB_window").css({display:"block"});
118217 });
118218 }
118219
118220 }
118221
118222 if(!params['modal']){
118223 document.onkeyup = function(e){
118224 if (e == null) { // ie
118225 keycode = event.keyCode;
118226 } else { // mozilla
118227 keycode = e.which;
118228 }
118229 if(keycode == 27){ // close
118230 tb_remove();
118231 }
118232 };
118233 }
118234
118235 } catch(e) {
118236 //nothing here
118237 }
118238 }
118239
118240 //helper functions below
118241 function tb_showIframe(){
118242 jQuery("#TB_load").remove();
118243 jQuery("#TB_window").css({display:"block"});
118244 }
118245
118246 function tb_remove() {
118247 jQuery("#TB_imageOff").unbind("click");
118248 jQuery("#TB_closeWindowButton").unbind("click");
118249 jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
118250 jQuery("#TB_load").remove();
118251 if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
118252 jQuery("body","html").css({height: "auto", width: "auto"});
118253 jQuery("html").css("overflow","");
118254 }
118255 document.onkeydown = "";
118256 document.onkeyup = "";
118257 return false;
118258 }
118259
118260 function tb_position() {
118261 jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
118262 if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
118263 jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
118264 }
118265 }
118266
118267 function tb_parseQuery ( query ) {
118268 var Params = {};
118269 if ( ! query ) {return Params;}// return empty object
118270 var Pairs = query.split(/[;&]/);
118271 for ( var i = 0; i < Pairs.length; i++ ) {
118272 var KeyVal = Pairs[i].split('=');
118273 if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
118274 var key = unescape( KeyVal[0] );
118275 var val = unescape( KeyVal[1] );
118276 val = val.replace(/\+/g, ' ');
118277 Params[key] = val;
118278 }
118279 return Params;
118280 }
118281
118282 function tb_getPageSize(){
118283 var de = document.documentElement;
118284 var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
118285 var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
118286 arrayPageSize = [w,h];
118287 return arrayPageSize;
118288 }
118289
118290 function tb_detectMacXFF() {
118291 var userAgent = navigator.userAgent.toLowerCase();
118292 if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
118293 return true;
118294 }
118295 }
118296
118297