You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AiShopping/AiGouWu\greybox\gb_scripts.js

3 lines
11 KiB

11 months ago
var GB_CURRENT=null;GB_hide=function(a){GB_CURRENT.hide(a)};GreyBox=new AJS.Class({init:function(c){this.use_fx=AJS.fx;this.type="page";this.overlay_click_close=false;this.salt=0;this.root_dir=GB_ROOT_DIR;this.callback_fns=[];this.reload_on_close=false;this.src_loader=this.root_dir+"loader_frame.html";var b=window.location.hostname.indexOf("www");var a=this.src_loader.indexOf("www");if(b!=-1&&a==-1){this.src_loader=this.src_loader.replace("://","://www.")}if(b==-1&&a!=-1){this.src_loader=this.src_loader.replace("://www.","://")}this.show_loading=true;AJS.update(this,c)},addCallback:function(a){if(a){this.callback_fns.push(a)}},show:function(a){GB_CURRENT=this;this.url=a;var b=[AJS.$bytc("object"),AJS.$bytc("select")];AJS.map(AJS.flattenList(b),function(c){c.style.visibility="hidden"});this.createElements();return false},hide:function(a){var b=this;setTimeout(function(){var d=b.callback_fns;if(d!=[]){AJS.map(d,function(f){f()})}b.onHide();if(b.use_fx){var e=b.overlay;AJS.fx.fadeOut(b.overlay,{onComplete:function(){AJS.removeElement(e);e=null},duration:300});AJS.removeElement(b.g_window)}else{AJS.removeElement(b.g_window,b.overlay)}b.removeFrame();AJS.REV(window,"scroll",_GB_setOverlayDimension);AJS.REV(window,"resize",_GB_update);var c=[AJS.$bytc("object"),AJS.$bytc("select")];AJS.map(AJS.flattenList(c),function(f){f.style.visibility="visible"});GB_CURRENT=null;if(b.reload_on_close){window.location.reload()}if(AJS.isFunction(a)){a()}},10)},update:function(){this.setOverlayDimension();this.setFrameSize();this.setWindowPosition()},createElements:function(){this.initOverlay();this.g_window=AJS.DIV({id:"GB_window"});AJS.hideElement(this.g_window);AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);this.initFrame();this.initHook();this.update();var a=this;if(this.use_fx){AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){a.onShow();AJS.showElement(a.g_window);a.startLoading()}})}else{AJS.setOpacity(this.overlay,0.7);AJS.showElement(this.g_window);this.onShow();this.startLoading()}AJS.AEV(window,"scroll",_GB_setOverlayDimension);AJS.AEV(window,"resize",_GB_update)},removeFrame:function(){try{AJS.removeElement(this.iframe)}catch(a){}this.iframe=null},startLoading:function(){this.iframe.src=this.src_loader+"?s="+this.salt++;AJS.showElement(this.iframe)},setOverlayDimension:function(){var b=AJS.getWindowSize();if(AJS.isMozilla()||AJS.isOpera()){AJS.setWidth(this.overlay,"100%")}else{AJS.setWidth(this.overlay,b.w)}var a=Math.max(AJS.getScrollTop()+b.h,AJS.getScrollTop()+this.height);if(a<AJS.getScrollTop()){AJS.setHeight(this.overlay,a)}else{AJS.setHeight(this.overlay,AJS.getScrollTop()+b.h)}},initOverlay:function(){this.overlay=AJS.DIV({id:"GB_overlay"});if(this.overlay_click_close){AJS.AEV(this.overlay,"click",GB_hide)}AJS.setOpacity(this.overlay,0);AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild)},initFrame:function(){if(!this.iframe){var a={name:"GB_frame","class":"GB_frame",frameBorder:0};if(AJS.isIe()){a.src='javascript:false;document.write("");'}this.iframe=AJS.IFRAME(a);this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);this.top_cnt=AJS.DIV();this.bottom_cnt=AJS.DIV();AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt)}},onHide:function(){},onShow:function(){},setFrameSize:function(){},setWindowPosition:function(){},initHook:function(){}});_GB_update=function(){if(GB_CURRENT){GB_CURRENT.update()}};_GB_setOverlayDimension=function(){if(GB_CURRENT){GB_CURRENT.setOverlayDimension()}};AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");script_loaded=true;var GB_SETS={};function decoGreyboxLinks(){var a=AJS.$bytc("a");AJS.map(a,function(c){if(c.getAttribute("href")&&c.getAttribute("rel")){var b=c.getAttribute("rel");if(b.indexOf("gb_")==0){var f=b.match(/\w+/)[0];var e=b.match(/\[(.*)\]/)[1];var d=0;var g={caption:c.title||"",url:c.href};if(f=="gb_pageset"||f=="gb_imageset"){if(!GB_SETS[e]){GB_SETS[e]=[]}GB_SETS[e].push(g);d=GB_SETS[e].length}if(f=="gb_pageset"){c.onclick=function(){GB_showFullScreenSet(GB_SETS[e],d);return false}}if(f=="gb_imageset"){c.onclick
script_loaded=true;