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

📄 xjslocation.java

📁 XBrowser是一个完全免费并且开源的Web浏览器
💻 JAVA
字号:
/*****************************************************************              XBrowser  -  eXtended web Browser                **                                                               **           Copyright (c) 2000-2001  Armond Avanes              **     Refer to ReadMe & License files for more information      **                                                               **                                                               **                 By: Uladzimir V. Kavalchuk                    **               Uladzimir_Kavalchuk@ep.minsk.by                 **               http://xbrowser.sourceforge.net/                ******************************************************************/package xbrowser.renderer.custom.js;import java.net.URL;import java.net.MalformedURLException;import org.mozilla.javascript.*;import xbrowser.renderer.custom.*;import xbrowser.renderer.*;public class XJSLocation extends ScriptableObject {    public XJSLocation() { // Prototype    }	public XJSLocation( URL from, XRenderer changeableURL) {	    locContent = changeableURL;	    try {			defineProperty( "hash", this, READONLY);			defineProperty( "host", this, READONLY);			defineProperty( "hostname", this, READONLY);			defineProperty( "href", this, READONLY);			defineProperty( "pathname", this, READONLY);			defineProperty( "port", this, READONLY);			defineProperty( "protocol", this, READONLY);			defineProperty( "search", this, DONTENUM);			defineFunctionProperties( props, getClass(), PERMANENT);			sealObject();		} catch( Exception e) {		    XRendererSupport.getContext().getLogger().message( this, e);		    XRendererSupport.getContext().getLogger().message( this, "Cannot define Location.");		}	}    public String getClassName() {        return "XJSLocation";    }	// JavaScript visible:	public void assign( String newUrl) {	    locContent.showURL( newUrl);	}	public String getHash() { return url.getRef(); }	public String getHost() { return url.getHost() + ":" + url.getPort(); }	public String getHostname() { return url.getHost(); }	public String getHref() { return url.toString(); }	public String getPathname() { return url.getFile(); } // this is url.getPath() in 1.3	public String getPort() { return Integer.toString( url.getPort()); }	public String getProtocol() { return url.getProtocol(); }	public void reload() { assign( url.toString()); }	public void replace( String newUrl) {	    locContent.showURL( newUrl); /** @todo: Remove from history. */	}	public String getSearch() {		   return url.getProtocol();	}	public void setSearch( String newQuery) {	    String newStr = url.toString();		int qPos = newStr.indexOf( '?');		if( qPos >= 0) {		  newStr = newStr.substring( 0, qPos+1) + newQuery;		} else {		  newStr = newStr + "?" + newQuery;		}		try {	        url = new URL( newStr);		} catch( MalformedURLException badUrl) {		   throw new WrappedException( badUrl);		}	}// Attributes:	final static String[] props = new String[] { "assign", "replace"};    protected URL url;	protected XRenderer locContent;}

⌨️ 快捷键说明

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