wp/wp-includes/js/thickbox/thickbox.js
author ymh <ymh.work@gmail.com>
Mon, 14 Oct 2019 17:39:30 +0200
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 18 be944660c56a
permissions -rw-r--r--
resynchronize code repo with production
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
 * Thickbox 3.1 - One Box To Rule Them All.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * By Cody Lindley (http://www.codylindley.com)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 * Copyright (c) 2007 cody lindley
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
*/
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
if ( typeof tb_pathToImage != 'string' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
	var tb_pathToImage = thickboxL10n.loadingAnimation;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
//on page load call tb_init
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
jQuery(document).ready(function(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
	imgLoader = new Image();// preload image
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
	imgLoader.src = tb_pathToImage;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    21
/*
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    22
 * Add thickbox to href & area elements that have a class of .thickbox.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    23
 * Remove the loading indicator when content in an iframe has loaded.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    24
 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
function tb_init(domChunk){
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    26
	jQuery( 'body' )
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    27
		.on( 'click', domChunk, tb_click )
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    28
		.on( 'thickbox:iframe:loaded', function() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    29
			jQuery( '#TB_window' ).removeClass( 'thickbox-loading' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    30
		});
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
function tb_click(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
	var t = this.title || this.name || null;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
	var a = this.href || this.alt;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
	var g = this.rel || false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
	tb_show(t,a,g);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
	this.blur();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
	return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    44
	var $closeBtn;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    45
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
	try {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
			jQuery("body","html").css({height: "100%", width: "100%"});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
			jQuery("html").css("overflow","hidden");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    51
				jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>");
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
				jQuery("#TB_overlay").click(tb_remove);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
		}else{//all others
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
			if(document.getElementById("TB_overlay") === null){
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    56
				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>");
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
				jQuery("#TB_overlay").click(tb_remove);
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    58
				jQuery( 'body' ).addClass( 'modal-open' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
		if(tb_detectMacXFF()){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
		}else{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
		if(caption===null){caption="";}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' width='208' /></div>");//add loader to the page
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
		jQuery('#TB_load').show();//show loader
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
		var baseURL;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
			baseURL = url.substr(0, url.indexOf("?"));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
	   }else{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
	   		baseURL = url;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
	   }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	   var urlType = baseURL.toLowerCase().match(urlString);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
			TB_PrevCaption = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
			TB_PrevURL = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
			TB_PrevHTML = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
			TB_NextCaption = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
			TB_NextURL = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
			TB_NextHTML = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
			TB_imageCount = "";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
			TB_FoundURL = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
			if(imageGroup){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
				TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
						if (!(TB_TempArray[TB_Counter].href == url)) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
							if (TB_FoundURL) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
								TB_NextCaption = TB_TempArray[TB_Counter].title;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
								TB_NextURL = TB_TempArray[TB_Counter].href;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.next+"</a></span>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
							} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
								TB_PrevURL = TB_TempArray[TB_Counter].href;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.prev+"</a></span>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
							}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
						} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
							TB_FoundURL = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
							TB_imageCount = thickboxL10n.image + ' ' + (TB_Counter + 1) + ' ' + thickboxL10n.of + ' ' + (TB_TempArray.length);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
						}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
			imgPreloader = new Image();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
			imgPreloader.onload = function(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
			imgPreloader.onload = null;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   117
			// Resizing large images - original by Christian Montoya edited by me.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
			var pagesize = tb_getPageSize();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
			var x = pagesize[0] - 150;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
			var y = pagesize[1] - 150;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
			var imageWidth = imgPreloader.width;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
			var imageHeight = imgPreloader.height;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
			if (imageWidth > x) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
				imageHeight = imageHeight * (x / imageWidth);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
				imageWidth = x;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
				if (imageHeight > y) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
					imageWidth = imageWidth * (y / imageHeight);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
					imageHeight = y;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
			} else if (imageHeight > y) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
				imageWidth = imageWidth * (y / imageHeight);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
				imageHeight = y;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
				if (imageWidth > x) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
					imageHeight = imageHeight * (x / imageWidth);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
					imageWidth = x;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
			// End Resizing
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
			TB_WIDTH = imageWidth + 30;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
			TB_HEIGHT = imageHeight + 60;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   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>");
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
			jQuery("#TB_closeWindowButton").click(tb_remove);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
			if (!(TB_PrevHTML === "")) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
				function goPrev(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
					jQuery("#TB_window").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
					jQuery("body").append("<div id='TB_window'></div>");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
					return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
				jQuery("#TB_prev").click(goPrev);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
			if (!(TB_NextHTML === "")) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
				function goNext(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
					jQuery("#TB_window").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
					jQuery("body").append("<div id='TB_window'></div>");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
					return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
				jQuery("#TB_next").click(goNext);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
			jQuery(document).bind('keydown.thickbox', function(e){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
				if ( e.which == 27 ){ // close
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   170
					tb_remove();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
				} else if ( e.which == 190 ){ // display previous image
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
					if(!(TB_NextHTML == "")){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
						jQuery(document).unbind('thickbox');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
						goNext();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
					}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
				} else if ( e.which == 188 ){ // display next image
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
					if(!(TB_PrevHTML == "")){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
						jQuery(document).unbind('thickbox');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
						goPrev();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
					}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
				return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
			});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
			tb_position();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
			jQuery("#TB_load").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
			jQuery("#TB_ImageOff").click(tb_remove);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
			jQuery("#TB_window").css({'visibility':'visible'}); //for safari using css instead of show
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
			};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
			imgPreloader.src = url;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
		}else{//code to show html
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
			var queryString = url.replace(/^[^\?]+\??/,'');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
			var params = tb_parseQuery( queryString );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   198
			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no parameters were added to URL
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   199
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no parameters were added to URL
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
			ajaxContentW = TB_WIDTH - 30;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
			ajaxContentH = TB_HEIGHT - 45;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
					urlNoQuery = url.split('TB_');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
					jQuery("#TB_iframeContent").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
					if(params['modal'] != "true"){//iframe no modal
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   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>");
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
					}else{//iframe modal
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
					jQuery("#TB_overlay").unbind();
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   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>");
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
					}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
			}else{// not an iframe, ajax
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
					if(jQuery("#TB_window").css("visibility") != "visible"){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
						if(params['modal'] != "true"){//ajax no modal
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   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>");
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
						}else{//ajax modal
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
						jQuery("#TB_overlay").unbind();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
						}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
					}else{//this means the window is already up, we are just loading new content via ajax
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
						jQuery("#TB_ajaxWindowTitle").html(caption);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
					}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
			jQuery("#TB_closeWindowButton").click(tb_remove);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
				if(url.indexOf('TB_inline') != -1){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
					jQuery("#TB_window").bind('tb_unload', function () {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
					});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
					tb_position();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
					jQuery("#TB_load").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
					jQuery("#TB_window").css({'visibility':'visible'});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
				}else if(url.indexOf('TB_iframe') != -1){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
					tb_position();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
					jQuery("#TB_load").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
					jQuery("#TB_window").css({'visibility':'visible'});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
				}else{
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   243
					var load_url = url;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   244
					load_url += -1 === url.indexOf('?') ? '?' : '&';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   245
					jQuery("#TB_ajaxContent").load(load_url += "random=" + (new Date().getTime()),function(){//to do a post change this load method
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
						tb_position();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
						jQuery("#TB_load").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
						tb_init("#TB_ajaxContent a.thickbox");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
						jQuery("#TB_window").css({'visibility':'visible'});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
					});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
		if(!params['modal']){
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   256
			jQuery(document).bind('keydown.thickbox', function(e){
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
				if ( e.which == 27 ){ // close
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   258
					tb_remove();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
					return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
			});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   264
		$closeBtn = jQuery( '#TB_closeWindowButton' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   265
		/*
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   266
		 * If the native Close button icon is visible, move focus on the button
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   267
		 * (e.g. in the Network Admin Themes screen).
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   268
		 * In other admin screens is hidden and replaced by a different icon.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   269
		 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   270
		if ( $closeBtn.find( '.tb-close-icon' ).is( ':visible' ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   271
			$closeBtn.focus();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   272
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   273
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
	} catch(e) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
		//nothing here
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
//helper functions below
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
function tb_showIframe(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
	jQuery("#TB_load").remove();
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   282
	jQuery("#TB_window").css({'visibility':'visible'}).trigger( 'thickbox:iframe:loaded' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
function tb_remove() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
 	jQuery("#TB_imageOff").unbind("click");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
	jQuery("#TB_closeWindowButton").unbind("click");
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   288
	jQuery( '#TB_window' ).fadeOut( 'fast', function() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   289
		jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).unbind().remove();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   290
		jQuery( 'body' ).trigger( 'thickbox:removed' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   291
	});
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   292
	jQuery( 'body' ).removeClass( 'modal-open' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
	jQuery("#TB_load").remove();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
		jQuery("body","html").css({height: "auto", width: "auto"});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
		jQuery("html").css("overflow","");
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
	jQuery(document).unbind('.thickbox');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
	return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
function tb_position() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
var isIE6 = typeof document.body.style.maxHeight === "undefined";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   304
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
	if ( ! isIE6 ) { // take away IE6
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
function tb_parseQuery ( query ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
   var Params = {};
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
   if ( ! query ) {return Params;}// return empty object
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
   var Pairs = query.split(/[;&]/);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
   for ( var i = 0; i < Pairs.length; i++ ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
      var KeyVal = Pairs[i].split('=');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
      var key = unescape( KeyVal[0] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
      var val = unescape( KeyVal[1] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
      val = val.replace(/\+/g, ' ');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
      Params[key] = val;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
   }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
   return Params;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
function tb_getPageSize(){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
	var de = document.documentElement;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
	arrayPageSize = [w,h];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
	return arrayPageSize;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
function tb_detectMacXFF() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
  var userAgent = navigator.userAgent.toLowerCase();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
    return true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
  }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
}