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

📄 bench.js

📁 使用php+js编写的brocade简单demo
💻 JS
字号:
/**
 * Copyright 2006 Sunyat-tao
 * brocade.sourceforge.net
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var me = this;
var ua = navigator.userAgent;
if(parseFloat(ua.substring(ua.indexOf("MSIE ") + 5, ua.indexOf(";", ua.indexOf("MSIE ")))) <=6){
    this.isFixIE=true;
}
    	
//main container.
container = new bc.w.Container("container",{});//dragable:true
document.body.appendChild(container._e);

//--------------------------
//banner panel
//--------------------------
var banner = new bc.w.Container("banner",{});

var infoA = ["<span>演示程序在IE5.5及以上版本、Firefox 1.0及以上版本测试通过。</span>",
	"<span style='color:red'>由于IE6及之前版本存在png文件处理bug,建议用Firefox或IE7,预览效果更佳。</span>",
	"<a href='http://getFirefox.com' target='_blank'>Firefox</a> 是一款开源的、跨平台的、兼容性极好的浏览器,而且易于脚本调试,强烈推荐使用。"];
	
var info = new bc.w.Container("infoPanel",{});

if(/MSIE/.test(navigator.userAgent) || window.opera)
	info.setStyle({styleFloat:'right'});
else
	info.setStyle({cssFloat:'right'});
	
info.addClassName("info");
banner.addChild(info);
info.setContent(infoA[0]);

var infoLen = infoA.length;
timer = setInterval(function(){
	info.setContent(infoA[parseInt(Math.random()*infoLen)]);
},9000);

var logo = document.createElement("label");
logo.innerHTML = "&nbsp;Brocade Demo";
Element.setStyle(logo,{fontSize:'28px',color:'blue',marginTop:'0px'});
banner.addChild(logo);

container.addChild(banner);

//--------------------------
// download panel
//--------------------------
var downloadPanel = new bc.w.Panel("downloadPanel",{});
downloadPanel.setWidth(200);
downloadPanel.setHeight(20);
downloadPanel.setStyle({left:15,top:'390px',padding:'5px',border:'#ccc solid 1px',position:'absolute'});
downloadPanel.addClassName("tranpanel");
downloadPanel.content.addClassName("panel");

downloadPanel.setContent("<a href='brocadeDemo1-0.1.zip' target='_blank' style='margin-left:5px'>下载演示程序</a>");
container.addChild(downloadPanel);

//--------------------------
//function panel.
//--------------------------
var funPanel = new bc.w.Panel("funPanel",{});
funPanel.setWidth(200);
funPanel.setHeight(300);
funPanel.setStyle({left:15,top:35,padding:'5px',border:'#ccc solid 1px'});
funPanel.addClassName("tranpanel");

//create title bar.
var funPanelTitleBar = new bc.w.TitleBar('演示功能:',{closeIcon:'images/close.gif'});
funPanelTitleBar.addClassName("titleBar");
funPanel.setTitleBar(funPanelTitleBar);

if(!this.isFixIE)
	funPanel.content.addClassName("panel");
	
//create list.
var funList = document.createElement("ul");
funList.id="funList";
Element.addClassName(funList,"list");
//jslibs
var l1 = document.createElement("li");
l1.id="jslibs";
l1.innerHTML = "脚本库集锦";
funList.appendChild(l1);

//panel
var l2 = document.createElement("li");
l2.innerHTML = "Panel";
l2.id="panel";
funList.appendChild(l2);
funPanel.addChild(funList);

//menu
var l3 = document.createElement("li");
l3.innerHTML = "Menu";
l3.id="menu";
funList.appendChild(l3);

//popup
var l4 = document.createElement("li");
l4.innerHTML = "Popup";
l4.id="popup";
funList.appendChild(l4);

funPanel.addChild(funList);

container.addChild(funPanel);

new bc.u.c.Ul(funList,{
			defaultClass:'default',
			disabledClass:'disabled',
			hoveredClass:'hovered',
			selectedClass:'selected',
			callback:function(rs){
				switch(rs[0]){
					case "jslibs" :
						if(this.jslibsShow)return;
						this.jslibsShow = true;
						var jslibs = new JsLibs();
						jslibs.onClose=function(e){this.jslibsShow=false;jslibs = null;return true;}.bindAsEventListener(this);
						break;
					case "panel" :
						if(null != this.panelDemo)return;
						this.panelDemo = new PanelDemo();
						this.panelDemo.onClose = function(e){this.panelDemo=null;return true;}.bindAsEventListener(this);
						break;
					case "menu" :
						if(null != this.menuPanel)return;
						this.menuPanel = new MenuPanel();
						this.menuPanel.onClose = function(e){this.menuPanel=null;return true;}.bindAsEventListener(this);
						break;
					case "popup" :
						if(null != this.popupPanel)return;
						this.popupPanel = new PopupPanel();
						this.popupPanel.onClose = function(e){this.popupPanel = null;return true;}.bindAsEventListener(this);
				}
			}.bind(this)
		});

//create welcome panel.
container.addChild(new Welcome());

⌨️ 快捷键说明

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