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

📄 popwin.js

📁 Java开的发文件管理系统,可以管理整个服务器的文件,并按要求进行处理!
💻 JS
字号:
/**
  * PopUP window
  */
// reference local blank image
Ext.BLANK_IMAGE_URL = 'images/default/s.gif';
 
// create namespace
Ext.namespace('popWindowBase');
 
// create application
popWindowBase.app = function() {
    // do NOT access DOM from here; elements don't exist yet
 
    // private variables
  	var dg; 
  	var tb;
  	var windows;
  	// to manage the windows 
  	var selectedWin=new Ext.Window();
  	var wins = new Array();
  	var totalWins = 0;
  	
  	
    // private functions
 	function idGen(title){
 		var id='';
 		var repeatTimes = 0;
 	   for (var i = 0, len = wins.length; i < len; i++){
 	      if(wins[i].title == title){
 	      	repeatTimes ++;
 	      }
       }
       if(repeatTimes !=0){
       		repeatTimes++;
       		return title + '[' + repeatTimes + ']';
       }else{
       		return title;	
       }
 	
 	};
    // public space
    return {
        // public properties, e.g. strings to translate
 
        // public methods
        init: function() {
            windows=new Ext.WindowGroup();
				tb= new Ext.Toolbar();
				tb.render('taskbar');
				
		    tb.add({
		            text:''
		        });
        },
        showDetail:function(page,title,modal,width,height){
        		var win;
            	var winWid = width;
            	var winHeight = height;
				
                // create the window on the first click and reuse on subsequent clicks
                if (!win) {
					
	                win = new Ext.Window({
						animateTarget:'taskbar',
                        layout: 'border',
                        width: winWid,
                        height: winHeight,
                        closeAction: 'close',
						maximizable :true,
						minimizable:true,
                        modal: modal,
						hideBorders :true,
						manager:windows,
						title:title,
						items:[{
								region:'center',
								html:'<iframe frameBorder="0" width=100% height=100% src='+page+'></iframe>',
								hideBorders :true
						}
						]
                    });
                    title = idGen(title);
                    wins.push(win);
                    selectedWin = win;//make win as the currently selected Window
                    var btn=new Ext.Toolbar.Button({text:title,
                    		handler:function(){
                    			win.show();
                    			selectedWin = win;//make win as the currently selected Window when focus on it
                    			}
                    		});
                }
				win.on('minimize',function(){this.hide();selectedWin = null;});
				win.on('close',function(){
					btn.destroy();
					wins.remove(win);//remove the window instance from the windowArrays
					selectedWin = null;//remove the current selected window
					win=null;
				});
				win.on('focus',function(){selectedWin = win;});
                win.show();
				tb.add(btn);
            },
       showDetailMax:function(page,title,modal){
       			var screenHeight = screen.height*2/3;
				var screenWidth = screen.width-20;
				this.showDetail(page,title,modal,screenWidth,screenHeight);
       },
       exitWindow : function(){

       		if(wins.indexOf(selectedWin) != -1){
       			selectedWin.close();
       		}
       		//parent.location.reload();
       },
       resize:function(width,height){
       	  if(selectedWin){
       	  	selectedWin.setWidth(width);
       	  	selectedWin.setHeight(height);
       	  }else{
       	  	alert('getInnerHeight: '+selectedWin.getInnerHeight());
       	  	alert('getInnerWidth: '+selectedWin.getInnerWidth());       	  	
       	  }
       },
       rename:function(newTitle){
       	 if(selectedWin){
       	 	selectedWin.setTitle(newTitle);
       	  }
       			  
       }
    };
}();  

⌨️ 快捷键说明

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