//////////////////////////////////////////////////////////////// // // // BYKLEIN CHROMELESS WINDOW OBJECT 2.0 // // FOR MICROSOFT IEXPLORER 5.5 & UP // // // // (c) Copyright 2003. Mariano Klein || www.byklein.com // // Distributed under the terms of the GNU GPL // // // // Thanks to Gabriel Suchowolski || www.microbians.com // //////////////////////////////////////////////////////////////// ChromelessWindow = function () { var a = ChromelessWindow.arguments; ////////////////////////////////////////////////////////////////////PRIVATE PROPERTIES //var URL = a[0]; var title = a[1]; var titlebarImage = a[2]; var titlebarHeight = a[3]; var titleFont = a[4]; var titleSize = a[5]; var titleColor = a[6]; var scrollbars = a[7]; var w = (a[14]*2); // var w = a[8]+(a[14]*2); var h = a[14]+a[3]; // var h = a[9]+a[14]+a[3]; var centered = a[10]; var xPos = a[11]; var yPos = a[12]; var borderColor = a[13]; var borderSize = a[14]; var minimizeButton = a[15]; var closeButton = a[16]; this.author = "Mariano Klein"; this.version = "ByKlein Chromeless Windows 2.0"; var win = (navigator.appVersion.indexOf("Windows"))?true:false; var ie= (navigator.appName == "Microsoft Internet Explorer")?true:false; var v = navigator.appVersion; var v55 = v.indexOf("MSIE 5.5")?true:false; var v60 = v.indexOf("MSIE 6.0")?true:false; var chromelessCompatible = null; var titlebarContent = null; var chromelessWW = null; ////////////////////////////////////////////////////////////////////PUBLIC METHODS if (ie) { openChromeless = function(cad,wid,hei,titImg,scroll){scrollbars=scroll;titlebarImage=titImg;w=wid;h=hei;URL=cad;if(chromelessWW==null || chromelessWW.closed){openParent();setChrome();moveChromeless();setParentSource();}else{chromelessWW.execScript("showChromeless()");}} } if (!ie) { openChromeless = function(cad,wid,hei,titImg,scroll){scrollbars=scroll;titlebarImage=titImg;w=wid;h=hei;URL=cad;if(chromelessWW==null || chromelessWW.closed){openParent()}} } closeChromeless = function(){if(chromelessWW && !chromelessWW.closed)chromelessWW.close();chromelessWW=null} minimizeChromeless = function(){if(chromelessWW && !chromelessWW.closed)chromelessWW.execScript("minimizeChromeless()")} setURL = function(){URL = arguments[0];if(chromelessWW && !chromelessWW.closed){chromelessWW.execScript("b.all.canvas.URL='"+URL+"'");chromelessWW.execScript("showChromeless()");}} moveChromeless= function() { if (arguments.length == 0) { if (centered) { var tempX = w; var tempY = h; xPos = (screen.availWidth/2)-(tempX/2); yPos = (screen.availHeight/2)-(tempY/2); } } else if(arguments[0]=="center") { var tempX = w; var tempY = h; xPos = (screen.availWidth/2)-(tempX/2); yPos = (screen.availHeight/2)-(tempY/2); } else { xPos = arguments[0]; yPos = arguments[1]; } if((chromelessWW)&&(arguments.length != 0)) { if(chromelessCompatible) { chromelessWW.execScript('var cx='+xPos+';'); chromelessWW.execScript('var cy='+yPos+';'); chromelessWW.execScript("showChromeless()"); chromelessWW.execScript("focus()"); } else { chromelessWW.moveTo(xPos,yPos); } } } resizeChromeless = function() { w = arguments[0]; h = arguments[1]; cH = (h-titlebarHeight)-borderSize; cW = w -(borderSize*2); if(chromelessWW) { chromelessWW.execScript('var cw='+w+';'); chromelessWW.execScript('var ch='+h+';'); chromelessWW.execScript("b.all.canvas.style.width='"+cW+"'"); chromelessWW.execScript("b.all.canvas.style.height='"+cH+"'"); chromelessWW.execScript("b.all.closeButton.style.right='"+borderSize+"'"); chromelessWW.execScript("b.all.minimizeButton.style.right='"+(borderSize+20)+"'"); chromelessWW.execScript("showChromeless();focus()"); } } ////////////////////////////////////////////////////////////////////PRIVATE METHODS openParent = function() { chromelessCompatible = win && ie && (v55 || v60); var sc = (scrollbars)?"yes":"no"; if (chromelessCompatible) { chromelessWW = window.open("about:blank","","top=5000,left=5000,width=100,height=100,scrollbars="+sc); } else { chromelessWW = window.open(URL, "chromelessWindow","top="+yPos+",left="+xPos+",width="+w+",height="+(h-20)+",scrollbars="+sc+",resizable=0"); chromelessWW.document.title = title; } } setChrome = function() { var cH = (h-titlebarHeight)-borderSize; var cW = w -(borderSize*2); this.c = ""; if((titlebarImage==null)||(titlebarImage=="")) { titlebarContent=""; tb = false; } else { titlebarContent=""; tb = true; } menu = "\
"+title+"
\ \ "+titlebarContent+"\\
"; } setParentSource = function() { if(chromelessWW) { chromelessWW.document.open(); parentSource = '\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; chromelessWW.document.write(parentSource); chromelessWW.document.close(); chromelessWW.document.title = title; chromelessWW.focus(); } } //////////////////////////// // PUBLIC METHODS /// //////////////////////////// this.openChromeless = openChromeless; this.closeChromeless = closeChromeless; this.minimizeChromeless = minimizeChromeless; this.setURL = setURL; this.resizeChromeless = resizeChromeless; this.moveChromeless = moveChromeless; }