web/wp-includes/js/thickbox/thickbox.js
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
     2  * Thickbox 3.1 - One Box To Rule Them All.
     2  * Thickbox 3.1 - One Box To Rule Them All.
     3  * By Cody Lindley (http://www.codylindley.com)
     3  * By Cody Lindley (http://www.codylindley.com)
     4  * Copyright (c) 2007 cody lindley
     4  * Copyright (c) 2007 cody lindley
     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 var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif";
     8 if ( typeof tb_pathToImage != 'string' ) {
     9 var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";
     9 	var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif";
       
    10 }
       
    11 if ( typeof tb_closeImage != 'string' ) {
       
    12 	var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";
       
    13 }
    10 
    14 
    11 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
    15 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
    12 
    16 
    13 //on page load call tb_init
    17 //on page load call tb_init
    14 jQuery(document).ready(function(){   
    18 jQuery(document).ready(function(){
    15 	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
    19 	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
    16 	imgLoader = new Image();// preload image
    20 	imgLoader = new Image();// preload image
    17 	imgLoader.src = tb_pathToImage;
    21 	imgLoader.src = tb_pathToImage;
    18 });
    22 });
    19 
    23 
    43 			if(document.getElementById("TB_overlay") === null){
    47 			if(document.getElementById("TB_overlay") === null){
    44 				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
    48 				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
    45 				jQuery("#TB_overlay").click(tb_remove);
    49 				jQuery("#TB_overlay").click(tb_remove);
    46 			}
    50 			}
    47 		}
    51 		}
    48 		
    52 
    49 		if(tb_detectMacXFF()){
    53 		if(tb_detectMacXFF()){
    50 			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
    54 			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
    51 		}else{
    55 		}else{
    52 			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
    56 			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
    53 		}
    57 		}
    54 		
    58 
    55 		if(caption===null){caption="";}
    59 		if(caption===null){caption="";}
    56 		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
    60 		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
    57 		jQuery('#TB_load').show();//show loader
    61 		jQuery('#TB_load').show();//show loader
    58 		
    62 
    59 		var baseURL;
    63 		var baseURL;
    60 	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
    64 	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
    61 			baseURL = url.substr(0, url.indexOf("?"));
    65 			baseURL = url.substr(0, url.indexOf("?"));
    62 	   }else{ 
    66 	   }else{
    63 	   		baseURL = url;
    67 	   		baseURL = url;
    64 	   }
    68 	   }
    65 	   
    69 
    66 	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
    70 	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
    67 	   var urlType = baseURL.toLowerCase().match(urlString);
    71 	   var urlType = baseURL.toLowerCase().match(urlString);
    68 
    72 
    69 		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
    73 		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
    70 				
    74 
    71 			TB_PrevCaption = "";
    75 			TB_PrevCaption = "";
    72 			TB_PrevURL = "";
    76 			TB_PrevURL = "";
    73 			TB_PrevHTML = "";
    77 			TB_PrevHTML = "";
    74 			TB_NextCaption = "";
    78 			TB_NextCaption = "";
    75 			TB_NextURL = "";
    79 			TB_NextURL = "";
    78 			TB_FoundURL = false;
    82 			TB_FoundURL = false;
    79 			if(imageGroup){
    83 			if(imageGroup){
    80 				TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
    84 				TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
    81 				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
    85 				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
    82 					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
    86 					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
    83 						if (!(TB_TempArray[TB_Counter].href == url)) {						
    87 						if (!(TB_TempArray[TB_Counter].href == url)) {
    84 							if (TB_FoundURL) {
    88 							if (TB_FoundURL) {
    85 								TB_NextCaption = TB_TempArray[TB_Counter].title;
    89 								TB_NextCaption = TB_TempArray[TB_Counter].title;
    86 								TB_NextURL = TB_TempArray[TB_Counter].href;
    90 								TB_NextURL = TB_TempArray[TB_Counter].href;
    87 								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
    91 								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.next+"</a></span>";
    88 							} else {
    92 							} else {
    89 								TB_PrevCaption = TB_TempArray[TB_Counter].title;
    93 								TB_PrevCaption = TB_TempArray[TB_Counter].title;
    90 								TB_PrevURL = TB_TempArray[TB_Counter].href;
    94 								TB_PrevURL = TB_TempArray[TB_Counter].href;
    91 								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
    95 								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.prev+"</a></span>";
    92 							}
    96 							}
    93 						} else {
    97 						} else {
    94 							TB_FoundURL = true;
    98 							TB_FoundURL = true;
    95 							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
    99 							TB_imageCount = thickboxL10n.image + ' ' + (TB_Counter + 1) + ' ' + thickboxL10n.of + ' ' + (TB_TempArray.length);
    96 						}
   100 						}
    97 				}
   101 				}
    98 			}
   102 			}
    99 
   103 
   100 			imgPreloader = new Image();
   104 			imgPreloader = new Image();
   101 			imgPreloader.onload = function(){		
   105 			imgPreloader.onload = function(){
   102 			imgPreloader.onload = null;
   106 			imgPreloader.onload = null;
   103 				
   107 
   104 			// Resizing large images - orginal by Christian Montoya edited by me.
   108 			// Resizing large images - orginal by Christian Montoya edited by me.
   105 			var pagesize = tb_getPageSize();
   109 			var pagesize = tb_getPageSize();
   106 			var x = pagesize[0] - 150;
   110 			var x = pagesize[0] - 150;
   107 			var y = pagesize[1] - 150;
   111 			var y = pagesize[1] - 150;
   108 			var imageWidth = imgPreloader.width;
   112 			var imageWidth = imgPreloader.width;
   109 			var imageHeight = imgPreloader.height;
   113 			var imageHeight = imgPreloader.height;
   110 			if (imageWidth > x) {
   114 			if (imageWidth > x) {
   111 				imageHeight = imageHeight * (x / imageWidth); 
   115 				imageHeight = imageHeight * (x / imageWidth);
   112 				imageWidth = x; 
   116 				imageWidth = x;
   113 				if (imageHeight > y) { 
   117 				if (imageHeight > y) {
   114 					imageWidth = imageWidth * (y / imageHeight); 
   118 					imageWidth = imageWidth * (y / imageHeight);
   115 					imageHeight = y; 
   119 					imageHeight = y;
   116 				}
   120 				}
   117 			} else if (imageHeight > y) { 
   121 			} else if (imageHeight > y) {
   118 				imageWidth = imageWidth * (y / imageHeight); 
   122 				imageWidth = imageWidth * (y / imageHeight);
   119 				imageHeight = y; 
   123 				imageHeight = y;
   120 				if (imageWidth > x) { 
   124 				if (imageWidth > x) {
   121 					imageHeight = imageHeight * (x / imageWidth); 
   125 					imageHeight = imageHeight * (x / imageWidth);
   122 					imageWidth = x;
   126 					imageWidth = x;
   123 				}
   127 				}
   124 			}
   128 			}
   125 			// End Resizing
   129 			// End Resizing
   126 			
   130 
   127 			TB_WIDTH = imageWidth + 30;
   131 			TB_WIDTH = imageWidth + 30;
   128 			TB_HEIGHT = imageHeight + 60;
   132 			TB_HEIGHT = imageHeight + 60;
   129 			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>"); 		
   133 			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>");
   130 			
   134 
   131 			jQuery("#TB_closeWindowButton").click(tb_remove);
   135 			jQuery("#TB_closeWindowButton").click(tb_remove);
   132 			
   136 
   133 			if (!(TB_PrevHTML === "")) {
   137 			if (!(TB_PrevHTML === "")) {
   134 				function goPrev(){
   138 				function goPrev(){
   135 					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
   139 					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
   136 					jQuery("#TB_window").remove();
   140 					jQuery("#TB_window").remove();
   137 					jQuery("body").append("<div id='TB_window'></div>");
   141 					jQuery("body").append("<div id='TB_window'></div>");
   138 					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
   142 					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
   139 					return false;	
   143 					return false;
   140 				}
   144 				}
   141 				jQuery("#TB_prev").click(goPrev);
   145 				jQuery("#TB_prev").click(goPrev);
   142 			}
   146 			}
   143 			
   147 
   144 			if (!(TB_NextHTML === "")) {		
   148 			if (!(TB_NextHTML === "")) {
   145 				function goNext(){
   149 				function goNext(){
   146 					jQuery("#TB_window").remove();
   150 					jQuery("#TB_window").remove();
   147 					jQuery("body").append("<div id='TB_window'></div>");
   151 					jQuery("body").append("<div id='TB_window'></div>");
   148 					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
   152 					tb_show(TB_NextCaption, TB_NextURL, imageGroup);
   149 					return false;	
   153 					return false;
   150 				}
   154 				}
   151 				jQuery("#TB_next").click(goNext);
   155 				jQuery("#TB_next").click(goNext);
   152 				
   156 
   153 			}
   157 			}
   154 
   158 
   155 			document.onkeydown = function(e){ 	
   159 			document.onkeydown = function(e){
   156 				if (e == null) { // ie
   160 				if (e == null) { // ie
   157 					keycode = event.keyCode;
   161 					keycode = event.keyCode;
   158 				} else { // mozilla
   162 				} else { // mozilla
   159 					keycode = e.which;
   163 					keycode = e.which;
   160 				}
   164 				}
   168 				} else if(keycode == 188){ // display next image
   172 				} else if(keycode == 188){ // display next image
   169 					if(!(TB_PrevHTML == "")){
   173 					if(!(TB_PrevHTML == "")){
   170 						document.onkeydown = "";
   174 						document.onkeydown = "";
   171 						goPrev();
   175 						goPrev();
   172 					}
   176 					}
   173 				}	
   177 				}
   174 			};
   178 			};
   175 			
   179 
   176 			tb_position();
   180 			tb_position();
   177 			jQuery("#TB_load").remove();
   181 			jQuery("#TB_load").remove();
   178 			jQuery("#TB_ImageOff").click(tb_remove);
   182 			jQuery("#TB_ImageOff").click(tb_remove);
   179 			jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
   183 			jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
   180 			};
   184 			};
   181 			
   185 
   182 			imgPreloader.src = url;
   186 			imgPreloader.src = url;
   183 		}else{//code to show html
   187 		}else{//code to show html
   184 			
   188 
   185 			var queryString = url.replace(/^[^\?]+\??/,'');
   189 			var queryString = url.replace(/^[^\?]+\??/,'');
   186 			var params = tb_parseQuery( queryString );
   190 			var params = tb_parseQuery( queryString );
   187 
   191 
   188 			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
   192 			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
   189 			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
   193 			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
   190 			ajaxContentW = TB_WIDTH - 30;
   194 			ajaxContentW = TB_WIDTH - 30;
   191 			ajaxContentH = TB_HEIGHT - 45;
   195 			ajaxContentH = TB_HEIGHT - 45;
   192 			
   196 
   193 			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
   197 			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
   194 					urlNoQuery = url.split('TB_');
   198 					urlNoQuery = url.split('TB_');
   195 					jQuery("#TB_iframeContent").remove();
   199 					jQuery("#TB_iframeContent").remove();
   196 					if(params['modal'] != "true"){//iframe no modal
   200 					if(params['modal'] != "true"){//iframe no modal
   197 						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>");
   201 						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;' > </iframe>");
   198 					}else{//iframe modal
   202 					}else{//iframe modal
   199 					jQuery("#TB_overlay").unbind();
   203 					jQuery("#TB_overlay").unbind();
   200 						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>");
   204 						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>");
   201 					}
   205 					}
   202 			}else{// not an iframe, ajax
   206 			}else{// not an iframe, ajax
   203 					if(jQuery("#TB_window").css("display") != "block"){
   207 					if(jQuery("#TB_window").css("display") != "block"){
   204 						if(params['modal'] != "true"){//ajax no modal
   208 						if(params['modal'] != "true"){//ajax no modal
   205 						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>");
   209 						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>");
   206 						}else{//ajax modal
   210 						}else{//ajax modal
   207 						jQuery("#TB_overlay").unbind();
   211 						jQuery("#TB_overlay").unbind();
   208 						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
   212 						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
   209 						}
   213 						}
   210 					}else{//this means the window is already up, we are just loading new content via ajax
   214 					}else{//this means the window is already up, we are just loading new content via ajax
   211 						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
   215 						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
   212 						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
   216 						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
   213 						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
   217 						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
   214 						jQuery("#TB_ajaxWindowTitle").html(caption);
   218 						jQuery("#TB_ajaxWindowTitle").html(caption);
   215 					}
   219 					}
   216 			}
   220 			}
   217 					
   221 
   218 			jQuery("#TB_closeWindowButton").click(tb_remove);
   222 			jQuery("#TB_closeWindowButton").click(tb_remove);
   219 			
   223 
   220 				if(url.indexOf('TB_inline') != -1){	
   224 				if(url.indexOf('TB_inline') != -1){
   221 					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
   225 					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
   222 					jQuery("#TB_window").unload(function () {
   226 					jQuery("#TB_window").unload(function () {
   223 						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
   227 						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
   224 					});
   228 					});
   225 					tb_position();
   229 					tb_position();
   226 					jQuery("#TB_load").remove();
   230 					jQuery("#TB_load").remove();
   227 					jQuery("#TB_window").css({display:"block"}); 
   231 					jQuery("#TB_window").css({display:"block"});
   228 				}else if(url.indexOf('TB_iframe') != -1){
   232 				}else if(url.indexOf('TB_iframe') != -1){
   229 					tb_position();
   233 					tb_position();
   230 					if($.browser.safari){//safari needs help because it will not fire iframe onload
   234 					if($.browser.safari){//safari needs help because it will not fire iframe onload
   231 						jQuery("#TB_load").remove();
   235 						jQuery("#TB_load").remove();
   232 						jQuery("#TB_window").css({display:"block"});
   236 						jQuery("#TB_window").css({display:"block"});
   237 						jQuery("#TB_load").remove();
   241 						jQuery("#TB_load").remove();
   238 						tb_init("#TB_ajaxContent a.thickbox");
   242 						tb_init("#TB_ajaxContent a.thickbox");
   239 						jQuery("#TB_window").css({display:"block"});
   243 						jQuery("#TB_window").css({display:"block"});
   240 					});
   244 					});
   241 				}
   245 				}
   242 			
   246 
   243 		}
   247 		}
   244 
   248 
   245 		if(!params['modal']){
   249 		if(!params['modal']){
   246 			document.onkeyup = function(e){ 	
   250 			document.onkeyup = function(e){
   247 				if (e == null) { // ie
   251 				if (e == null) { // ie
   248 					keycode = event.keyCode;
   252 					keycode = event.keyCode;
   249 				} else { // mozilla
   253 				} else { // mozilla
   250 					keycode = e.which;
   254 					keycode = e.which;
   251 				}
   255 				}
   252 				if(keycode == 27){ // close
   256 				if(keycode == 27){ // close
   253 					tb_remove();
   257 					tb_remove();
   254 				}	
   258 				}
   255 			};
   259 			};
   256 		}
   260 		}
   257 		
   261 
   258 	} catch(e) {
   262 	} catch(e) {
   259 		//nothing here
   263 		//nothing here
   260 	}
   264 	}
   261 }
   265 }
   262 
   266 
   315   var userAgent = navigator.userAgent.toLowerCase();
   319   var userAgent = navigator.userAgent.toLowerCase();
   316   if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
   320   if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
   317     return true;
   321     return true;
   318   }
   322   }
   319 }
   323 }
   320 
       
   321