PageSourceSearch

https://b2b.myushop.net/js/thickbox.js?1733808149

js myushop.net collected 2026-10-02 11:23:10 UTC 12,568 bytes, 336 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.