⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window.js

📁 在流览器上仿CS界面的JAVASCRIPT脚本
💻 JS
📖 第 1 页 / 共 4 页
字号:
this._colorOkButton=new BiButton("OK");this._colorCancelButton=new BiButton("Cancel");this.setAcceptButton(this._colorOkButton);this.setCancelButton(this._colorCancelButton);cp.add(this._colorOkButton);cp.add(this._colorCancelButton);this._colorOkButton.setWidth(75);this._cancelButton.setWidth(75);this._colorCancelButton.setRight(5);this._colorCancelButton.setBottom(5);this._colorOkButton.setRight(85);this._colorOkButton.setBottom(5);this._colorOkButton.addEventListener("action",function(e){this.setDialogResult(this.getRgbString());this.close();},this);this._colorCancelButton.addEventListener("action",function(e){this.setDialogResult(null);this.close();},this);this._hsl={h:0,s:0,l:1};this._rgb={r:0,g:0,b:0};this.setRgb({r:255,g:0,b:0});}
var _p=BiColorPicker.prototype=new BiDialog;_p._className="BiColorPicker";BiColorPicker.HUE_SATURATION_IMAGE_URI=application.getPath()+"images/huesaturation.jpg";BiColorPicker.HUE_SATURATION_HANDLE_IMAGE_URI=application.getPath()+"images/huesaturationhandle.gif";BiColorPicker.BRIGHTNESS_IMAGE_URI=application.getPath()+"images/brightness.jpg";BiColorPicker.BRIGHTNESS_HANDLE_IMAGE_URI=application.getPath()+"images/brightnesshandle.gif";_p._colors=["rgb(255,128,128)","rgb(255,255,128)","rgb(128,255,128)","rgb(0,155,128)","rgb(128,255,255)","rgb(0,128,255)","rgb(255,128,192)","rgb(255,128,255)","rgb(255,0,0)","rgb(255,255,0)","rgb(128,255,0)","rgb(0,255,64)","rgb(0,255,255)","rgb(0,128,192)","rgb(128,128,192)","rgb(255,0,255)","rgb(128,64,64)","rgb(255,128,64)","rgb(0,255,0)","rgb(0,128,128)","rgb(0,64,128)","rgb(128,128,255)","rgb(128,0,64)","rgb(255,0,128)","rgb(128,0,0)","rgb(255,128,0)","rgb(0,128,0)","rgb(0,128,64)","rgb(0,0,255)","rgb(0,160,160)","rgb(128,0,128)","rgb(128,0,255)","rgb(64,0,0)","rgb(128,64,0)","rgb(0,64,0)","rgb(0,64,64)","rgb(0,0,128)","rgb(0,0,64)","rgb(64,0,64)","rgb(64,0,128)","rgb(0,0,0)","rgb(128,128,0)","rgb(128,128,64)","rgb(128,128,128)","rgb(64,128,128)","rgb(192,192,192)","rgb(32,0,32)","rgb(255,255,255)"];_p._insetBorder=new BiBorder(2,"inset");_p._itemWidth=20;_p._itemHeight=17;_p._itemGap=5;_p._rgbString="rgb(255,0,0)";_p._fireChange=true;BiColorPicker.hslToRgb=function(hsl){var rgb={};var h=hsl.h;var s=hsl.s;var l=hsl.l*255;if(s==0){rgb.r=rgb.g=rgb.b=l;return rgb;}
h=h/60%6;var i=Math.floor(h);var f=h-i;var p=l*(1-s);var q=l*(1-s*f);var t=l*(1-s*(1-f));switch(i){case 0:rgb.r=l;rgb.g=t;rgb.b=p;break;case 1:rgb.r=q;rgb.g=l;rgb.b=p;break;case 2:rgb.r=p;rgb.g=l;rgb.b=t;break;case 3:rgb.r=p;rgb.g=q;rgb.b=l;break;case 4:rgb.r=t;rgb.g=p;rgb.b=l;break;default:rgb.r=l;rgb.g=p;rgb.b=q;break;}
return rgb;};BiColorPicker.rgbToHsl=function(rgb){var hsl={};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);hsl.l=max;var delta=max-min;if(max!=0)
hsl.s=delta/max;else{hsl.s=0;hsl.h=0;return hsl;}
if(rgb.r==max)
hsl.h=(rgb.g-rgb.b)/delta;else if(rgb.g==max)
hsl.h=2+(rgb.b-rgb.r)/delta;else hsl.h=4+(rgb.r-rgb.g)/delta;hsl.h*=60;if(hsl.h<0)
hsl.h+=360;hsl.l/=255;return hsl;};BiColorPicker.getRgbFromRgbString=function(s){var re= /^rgb\s*\(\s*(\d+)\s*\,\s*(\d+)\s*\,\s*(\d+)\s*\)$/i;var a=re.exec(s);return{r:Number(RegExp.$1),g:Number(RegExp.$2),b:Number(RegExp.$3)};};BiColorPicker.getRgbStringFromRgb=function(rgb){return"rgb("+Math.floor(rgb.r)+","+Math.floor(rgb.g)+","+Math.floor(rgb.b)+")";};_p.setRgbString=function(sValue){this.setRgb(BiColorPicker.getRgbFromRgbString(sValue));};_p.getRgbString=function(){return this._rgbString;};_p._onClick=function(e){var t=e.getTarget();if(this._items.contains(t)){this.setRgbString(t.getBackColor());}};_p._onHueDown=function(e){this._hueImage.addEventListener("mousemove",this._onHueMove,this);this._hueImage.addEventListener("mouseup",this._onHueUp,this);this._hueImage.addEventListener("losecapture",this._onHueUp,this);this._hueImage.setCapture(true);this._onHueMove(e);e.preventDefault();};_p._onHueMove=function(e){var width=this._hueImage.getWidth();var height=this._hueImage.getHeight();var left=Math.min(this._hueImage.getWidth(),Math.max(0,e.getScreenX()-this._hueImage.getScreenLeft()));var top=Math.min(this._hueImage.getHeight(),Math.max(0,e.getScreenY()-this._hueImage.getScreenTop()));var s=(1-top/height);var h=Math.max(0,Math.min(360,(360*(left/width))));this.setHsl({h:h,s:s,l:this._hsl.l});};_p._onHueUp=function(e){this._hueImage.removeEventListener("mousemove",this._onHueMove,this);this._hueImage.removeEventListener("mouseup",this._onHueUp,this);this._hueImage.removeEventListener("losecapture",this._onHueUp,this);this._hueImage.setCapture(false);};_p._onBrightnessDown=function(e){this._brightnessImage.addEventListener("mousemove",this._onBrightnessMove,this);this._brightnessImage.addEventListener("mouseup",this._onBrightnessUp,this);this._brightnessImage.addEventListener("losecapture",this._onBrightnessUp,this);this._brightnessImage.setCapture(true);this._onBrightnessMove(e);e.preventDefault();};_p._onBrightnessMove=function(e){var height=this._brightnessImage.getHeight();var top=Math.min(height,Math.max(0,e.getScreenY()-this._brightnessImage.getScreenTop()));var l=(1-top/height);this.setHsl({h:this._hsl.h,s:this._hsl.s,l:l});};_p._onBrightnessUp=function(e){this._brightnessImage.removeEventListener("mousemove",this._onBrightnessMove,this);this._brightnessImage.removeEventListener("mouseup",this._onBrightnessUp,this);this._brightnessImage.removeEventListener("losecapture",this._onBrightnessUp,this);this._brightnessImage.setCapture(false);};_p._syncHandles=function(){if(this._dontSync)return;var brightnessHeight=this._brightnessImage.getHeight();var width=this._hueImage.getWidth();var height=this._hueImage.getHeight();this._hueHandle.setLeft(this._hueImage.getLeft()-Math.floor(this._hueHandle.getWidth()/2)+this._hsl.h/360*width);this._hueHandle.setTop(this._hueImage.getTop()-Math.floor(this._hueHandle.getHeight()/2)+height-this._hsl.s*height);this._brightnessHandle.setTop(brightnessHeight-this._hsl.l*brightnessHeight);this._hueImage.setOpacity(this._hsl.l);};_p.setRgb=function(rgb){this.setHsl(BiColorPicker.rgbToHsl(rgb));};_p.getRgb=function(){return{r:this._rgb.r,g:this._rgb.g,b:this._rgb.b};};_p.setHsl=function(hsl){if(this._hsl.h!=hsl.h||this._hsl.s!=hsl.s||this._hsl.l!=hsl.l){var oldFireChange=this._fireChange;this._fireChange=false;if(hsl.h== -1||isNaN(hsl.h))
hsl={h:this._hsl.h,s:hsl.s,l:hsl.l};this._hsl=hsl;this._rgb=BiColorPicker.hslToRgb(hsl);this._hueField.setValue(Math.round(this._hsl.h));this._satField.setValue(Math.round(100*this._hsl.s));this._lumField.setValue(Math.round(100*this._hsl.l));this._redField.setValue(Math.round(this._rgb.r));this._greenField.setValue(Math.round(this._rgb.g));this._blueField.setValue(Math.round(this._rgb.b));this._rgbString=BiColorPicker.getRgbStringFromRgb(this._rgb);this._colorBox.setBackColor(this._rgbString);this._hueImage.setOpacity(this._hsl.l);this._syncHandles();this._fireChange=oldFireChange;if(this._fireChange)
this.dispatchEvent(new BiEvent("change"));}};_p.getHsl=function(){return{h:this._hsl.h,g:this._hsl.s,b:this._hsl.l};};_p._onSpinnerChange=function(e){if(!this._fireChange)return;var oldFireChange=this._fireChange;this._fireChange=false;var t=e.getTarget();switch(t){case this._hueField:this.setHsl({h:t.getValue(),s:this._hsl.s,l:this._hsl.l});break;case this._satField:this.setHsl({h:this._hsl.h,s:t.getValue()/100,l:this._hsl.l});break;case this._lumField:this.setHsl({h:this._hsl.h,s:this._hsl.s,l:t.getValue()/100});break;case this._redField:this.setRgb({r:t.getValue(),g:this._rgb.g,b:this._rgb.b});break;case this._greenField:this.setRgb({r:this._rgb.r,g:t.getValue(),b:this._rgb.b});break;case this._blueField:this.setRgb({r:this._rgb.r,g:this._rgb.g,b:t.getValue()});break;}
this._fireChange=oldFireChange;};function BiWizardPane()
{BiComponent.call(this);this.setBackColor("ThreeDFace");this.setSize(440,310);this._pages=[];this._backButton=new BiButton("< Back");this._nextButton=new BiButton("Next >");this._finishButton=new BiButton("Finish");this._cancelButton=new BiButton("Cancel");this._backButton.setMnemonic("b");this._nextButton.setMnemonic("n");this._backButton.setAccessKey("b");this._nextButton.setAccessKey("n");this._backButton.setWidth(75);this._nextButton.setWidth(75);this._finishButton.setWidth(75);this._cancelButton.setWidth(75);this._backButton.setBottom(10);this._nextButton.setBottom(10);this._finishButton.setBottom(10);this._cancelButton.setBottom(10);this._backButton.setRight(170);this._nextButton.setRight(95);this._finishButton.setRight(95);this._cancelButton.setRight(10);var b=new BiBorder;b.setTop(2,"groove");this._separator=new BiComponent;this._separator.setBackColor("ThreeDFace");this._separator.setBorder(b);this._separator.setHeight(47);this._separator.setLeft(0);this._separator.setRight(0);this._separator.setBottom(0);this._backdropImage=new BiImage(new BiUri(application.getPath(),"images/wizardbackdrop.gif"),132,300);this._backdropImage.setLocation(0,0);this.add(this._backdropImage,null);this.add(this._separator,null);this.add(this._backButton,null);this.add(this._nextButton,null);this.add(this._finishButton,null);this.add(this._cancelButton,null);this._backButton.addEventListener("action",this.back,this);this._nextButton.addEventListener("action",this.next,this);this._finishButton.addEventListener("action",this.finish,this);this._cancelButton.addEventListener("action",this.cancel,this);}
_p=BiWizardPane.prototype=new BiComponent;_p._className="BiWizardPane";BiWizardPane.prototype.getSelectedIndex=function(){return this._selectedIndex;};BiWizardPane.prototype.getSelectedPage=function(){return this._selectedPage;};BiWizardPane.prototype.getPages=function(){return this._pages;};BiWizardPane.prototype.getNextButton=function(){return this._nextButton;};BiWizardPane.prototype.getBackButton=function(){return this._backButton;};BiWizardPane.prototype.getFinishButton=function(){return this._finishButton;};BiWizardPane.prototype.getCancelButton=function(){return this._cancelButton;};_p._selectedIndex= -1;_p._selectedPage=null;_p.setSelectedIndex=function(n)
{if(this._selectedPage)
{if(!this._selectedPage.dispatchEvent(new BiEvent("deactivated")))
return;}
if(!this.dispatchEvent(new BiEvent("beforechange")))
return;if(this._selectedPage)
this.remove(this._selectedPage);var p=this._pages[n];if(p)
{p.setTop(10);p.setRight(10);p.setLeft(132+15);p.setBottom(47+10);this._selectedPage=p;this._selectedIndex=n;this.add(p);this._syncNavigationButtons();var t=new BiTimer(20);t.addEventListener("tick",function(e)
{p.dispatchEvent(new BiEvent("activated"));t.dispose();t=null;},this);t.start();this.dispatchEvent(new BiEvent("change"));}
else {this._selectedPage=null;this._selectedIndex= -1;}};_p.setSelectedPage=function(p)
{var i=this._pages.indexOf(p);this.setSelectedIndex(i);};_p._syncNavigationButtons=function()
{var n=this.getSelectedIndex();var last=n==this._pages.length-1;this._backButton.setEnabled(n!=0);this._nextButton.setEnabled(!last);this._finishButton.setEnabled(last);this._nextButton.setVisible(!last);this._finishButton.setVisible(last);};_p.next=function()
{this.setSelectedIndex(this.getSelectedIndex()+1);};_p.back=function()
{this.setSelectedIndex(this.getSelectedIndex()-1);};_p.finish=function()
{this.dispatchEvent(new BiEvent("finish"));};_p.cancel=function()
{this.dispatchEvent(new BiEvent("cancel"));};_p.addPage=function(oPage,oBefore)
{if(oBefore==null)
this._pages.push(oPage);else this._pages.insertBefore(oPage,oBefore);if(this._pages.length==1)
this.setSelectedIndex(0);this._syncNavigationButtons();};_p.removePage=function(oPage)
{var idx=this._pages.indexOf(oPage);var wasSelected=idx==this.getSelectedIndex();this._pages.remove(oPage);if(wasSelected)
{if(idx<this._pages.length)
this.setSelectedIndex(idx);else if(this._pages.length>0)
this.setSelectedIndex(this._pages.length-1);}
return oPage;};_p.addXmlNode=function(oNode,oParser)
{if(oNode.nodeType==1)
{var p=oParser.fromNode(oNode);if(p)
this.addPage(p);}};function BiWizard(sCaption)
{BiDialog.call(this,sCaption);this.setSize(450,330);var wp=new BiWizardPane;this.setContentPane(wp);this.setCancelButton(wp._cancelButton);wp.addEventListener("finish",this.finish,this);wp.addEventListener("cancel",this.cancel,this);wp.addEventListener("change",this._onWizardPaneChange,this);wp.addEventListener("beforechange",this._onWizardPaneBeforeChange,this);}
_p=BiWizard.prototype=new BiDialog;_p._className="BiWizard";_p.setSelectedIndex=function(n)
{this.getContentPane().setSelectedIndex(n);};_p.getSelectedIndex=function()
{return this.getContentPane().getSelectedIndex();};_p.setSelectedPage=function(p)
{this.getContentPane().setSelectedPage(p);};_p.getSelectedPage=function()
{return this.getContentPane().getSelectedPage();};_p.finish=function()
{this.dispatchEvent(new BiEvent("finish"));this.close();};_p.cancel=function()
{this.dispatchEvent(new BiEvent("cancel"));this.close();};_p.addPage=function(oPage,oBefore)
{this.getContentPane().addPage(oPage,oBefore);this._syncNavigationButtons();};_p.removePage=function(oPage)
{this.getContentPane().removePage(oPage);this._syncNavigationButtons();return oPage;};_p.getpages=function()
{return this.getContentPane().getPages();};_p._onWizardPaneChange=function(e)
{this.dispatchEvent(new BiEvent("change"));this._syncNavigationButtons();};_p._onWizardPaneBeforeChange=function(e)
{if(!this.dispatchEvent(new BiEvent("beforechange")))
e.preventDefault();};_p._syncNavigationButtons=function()
{var wp=this.getContentPane();var n=wp.getSelectedIndex();var b=n==wp._pages.length-1?wp._finishButton:wp._nextButton;this.setAcceptButton(b);var ac=this.getActiveComponent();if((ac==null||ac==this)&&b.getCanFocus())
b.setFocused(true);};_p.addXmlNode=function(oNode,oParser)
{if(oNode.nodeType==1)
{var p=oParser.fromNode(oNode);if(p)
this.addPage(p);}};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -