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

📄 page.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 3 页
字号:
	// call setSkinDir() and setHelperDir() to reset those cached values	this.setSkinDir();	this.setHelperDir();},//>	@classMethod	Page.getIsomorphicClientDir()//		Return the root directory for Isomorphic client files.////		@return	(string)	URL for root of client files.//		@group	files//<getIsomorphicClientDir : function () {	return this._directoryCache.ISOMORPHIC_CLIENT;},//>	@classMethod	Page.setIsomorphicDocsDir()//		Specify the root directory for Isomorphic documentation and example files.////		@param	[URL]		(string)	New URL for root of documentation and example files.//		@group	files//<// NOTE: not visible: we don't actually want customers to restructure the SDKsetIsomorphicDocsDir : function (URL) {	this._directoryCache.ISOMORPHIC_DOCS =             this.combineURLs(this.getAppDir(), URL != null ? URL : "[ISOMORPHIC]/system/reference/");	this.setIsomorphicDocsSkinDir();},//>	@classMethod	Page.getIsomorphicDocsDir()//		Return the root directory for Isomorphic documentation and example files.////		@return	(string)	URL for root of documentation and example files.//		@group	files//<getIsomorphicDocsDir : function () {	return this._directoryCache.ISOMORPHIC_DOCS;},setIsomorphicDocsSkinDir : function (URL) {	this._directoryCache.ISO_DOCS_SKIN =            this.combineURLs(this.getIsomorphicDocsDir(), URL != null ? URL : "skin/");},getIsomorphicDocsSkinDir : function () {	return this._directoryCache.ISO_DOCS_SKIN;},//>	@classMethod	Page.setHelperDir()//		Specify the directory for Isomorphic-specific helper files.////		@param	[URL]		(string)	New helperDir URL.//		@group	files, images//<// NOTE: not visible: we don't actually want customers to relocate the helpers dirsetHelperDir : function (URL) {	this._directoryCache.HELPERS =             this.combineURLs(this.getAppDir(), URL != null ? URL : "[ISOMORPHIC_CLIENT]/helpers/");},//>	@classMethod	Page.getHelperDir()//		Return the directory for Isomorphic supplied helper files.////		@return	(string)	URL for Isomorphic supplied helper files.//		@group	files, images//<getHelperDir : function () {	return isc.Page._directoryCache.HELPERS;},// ---------------------------------------------------------------------------------------//>	@classMethod	Page.getImgURL()// Return the full URL for app-specific or skin image.// <P>// To use a skin image, start the URL with "[SKIN]".  Any other relative URL is assumed// relative to the +link{Page.getAppImgDir(),appImgDir}.////		@param	src			(SCImgURL)	Local file name for the image.//		@param	[imgDir]	(string)	User-specified image directory,//										local to //		@return				(string)	URL for the image.//		@group	files, images// @visibility external//<_skinPrefix : "[SKIN]",_skinSlashPrefix : "[SKIN]/",getImgURL : function (src, imgDir) {    	// get the full URL for an image    var baseDir;	if (isc.startsWith(src, this._skinPrefix)) {        baseDir = isc.Page.getSkinImgDir(imgDir);		// NOTE: account for "[SKIN]/" as well; ignore the slash        var trim = isc.startsWith(src, this._skinSlashPrefix) ? 7 : 6;        src = src.substring(trim);    } else {        baseDir = isc.Page.getAppImgDir(imgDir);    }	return isc.Page.combineURLs(baseDir, src);},_$leftBracket : "[",_$dotSlash : "./",//>	@classMethod	Page.getURL()// Return a full URL for a relative path that uses a special prefix such as "[APPFILES]" or// "[SKIN]".// <P>// For images, use +link{Page.getImgURL()} instead.////		@param	fileName	(string)	Local file name for the image.//		@return				(string)	URL for the image.//		@group	files, images// @visibility external//<getURL : function (URL) {        // check for a special prefix	if (isc.startsWith(URL, this._$leftBracket)) {		var endIndex = URL.indexOf("]");		if (endIndex > 0) {			var directoryName = URL.substring(1,endIndex).toUpperCase(),				cachedDirectory = isc.Page._directoryCache[directoryName];            // substitute if we hit a known prefix			if (cachedDirectory != null) {				URL = isc.Page.combineURLs(cachedDirectory,                                            URL.substring(endIndex+(URL.charAt(endIndex+1)!="/"?1:2)));			//>DEBUG			} else {				this.logDebug("getURL("+URL+"): couldn't find cached directory " + directoryName);			//<DEBUG			}		//>DEBUG		} else {			this.logDebug("getURL("+URL+"): didn't find matching ']' in URL");		//<DEBUG		}	}	return URL;},//>	@classMethod	Page.combineURLs()//		Combine a "masterURL" and a "localURL" into a single URL.//		If the localURL is a fully specified URL (starts with "http:", "https:" or "file:"),//			we use that.////		If the localURL is a relative URL, combine with the masterURL//		to a single URL. ////		@param	masterURL	(string)	Master URL.//		@param	localURL	(string)	Local URL.//		@return				(string)	Combined URL.//		@group	files//<_$dotdot:"..",combineURLs : function (masterURL, localURL) {	if (!isc.isA.String(localURL)) return masterURL;    	if (isc.startsWith(localURL, this._$leftBracket)) {        // URL appears to contain a special directory name		return this.getURL(localURL);	}    var ns = isc._emptyString;	// if local directory was specified as a full URL, simply return that	if (masterURL == null || masterURL == ns || isc.Page.getProtocol(localURL) != ns) {		return localURL;	}        var slash = isc.slash;		    	var masterProtocol = isc.Page.getProtocol(masterURL);    if (isc.startsWith(localURL, slash)) {                // localURL is absolute; combine with just the protocol/hostName from masterURL         //if (isc.Log) isc.Log.logWarn("absolute local URL: " + localURL +         //                             ", base master is: " + masterURL +        //                             ", masterProtocol: " + masterProtocol);        if (isc.isAn.emptyString(masterProtocol)) {            // if master URL has no protocol and hence no host, empty it so that we we will the            // already absolute "localURL" unchanged            masterURL = isc.emptyString;        } else if (masterURL.indexOf(slash, masterProtocol.length) != -1) {            // We want to chop off everything in the master URL after the first "/"		    masterURL = masterURL.substring(0, masterURL.indexOf(slash, masterProtocol.length));        }                // eliminate any "./" entries in the localURL	// go up a directory in the masterURL for any "../" in the localURL            } else 	if (localURL.indexOf(this._$dotSlash) > -1) {                //alert("backups in local URL: " + localURL);    		// break up masterURL into protocol and directories		// break up localURL into directories		masterURL = masterURL.substring(masterProtocol.length, masterURL.length-1);		var masterDirs = masterURL.split(slash),			localDirs = localURL.split(slash)		;        // the first "dir" is actually the host        var masterHost = masterDirs[0];		masterDirs.shift();		while (localDirs[0] == isc.dot || localDirs[0] == this._$dotdot) {			// if ".", just skip it in the localDirs			if (localDirs[0] == isc.dot) {				localDirs.shift(); // take "." off front				continue;			}				// otherwise it's ".." -- take ".." off front of local dir			localDirs.shift();            // and go up one directory in the master dir (if possible)			if (masterDirs.length == 0) break;			masterDirs.pop(); // take last segment off master dir		}		masterURL = masterProtocol + masterHost + slash;        if (masterDirs.length > 0) masterURL += masterDirs.join(slash) + slash;		localURL = localDirs.join(slash);	}	//return the combined URLs	return masterURL + localURL;},//>	@classMethod	Page.getProtocol()//		Return the protocol for a given URL.//		Returns the full protocol (eg: "http://"), or//		the empty string ("") if protocol was not understood.//		@param	URL		(URL)		URL to get protocol for.//		@return			(string)	Protocol for the URL, or "" if not found/recognized.//		@group	files//		@see	Page._protocolsURLs//<getProtocol : function (URL) {    	for (var i = 0; i < isc.Page._protocolURLs.length; i++) {		if (isc.startsWith(URL, isc.Page._protocolURLs[i])) return isc.Page._protocolURLs[i];	}	return isc._emptyString;},// XHTML// --------------------------------------------------------------------------------------- isXHTML : function () {    if (this._isXHTML != null) return this._isXHTML;    if (isc.Browser.isIE) return false;    var wd = this.getWindow();    return (this._isXHTML = (this.getDocument().constructor == this.getWindow().XMLDocument));},//	Text direction// ---------------------------------------------------------------------------------------//> @classMethod Page.isRTL()//// Return whether the page text direction is right to left.  If you set "DIR=RTL" in the BODY tag of// the page, then this method will return true.  If you set "DIR=LTR" then this method will return// false.//    // @return (boolean) true if Page text direction is RTL, false otherwise// @visibility external//<isRTL : function () { return this.getTextDirection() == isc.Canvas.RTL },//>	@classMethod	Page.getTextDirection()//		@group	textDirection//		Return the text direction of the page for right-to-left //		language support.  Returned value will be://				* Page.LTR (left to right, eg: English), or//				* Page.RTL (right to left, eg: Arabic) //<getTextDirection : function () {    // if the textDirection of the page has never been set,     if (this.textDirection == null) {        var docElement = document.documentElement,            body = document.body,            // check body before document element, since it overrides.  (NOTE: empty string            // is false)            dir = (body ? body.dir : null) || docElement.dir;        if (dir) return (this.textDirection = dir.toLowerCase());        // don't save direction as LTR unless the body has been created, in case        // getTextDireciton() is called in an incomplete document        else if (body) return (this.textDirection = this.LTR);        return this.LTR;    }    // return the direction stored in the page object    return this.textDirection;},////	Dynamic loading/writing of various page structures for you////>	@classMethod	Page.loadStyleSheet()//		Load a styleSheet for this application.  ////		The styleSheetURL parameter can use any special directories, eg:<br>//      &nbsp;&nbsp;<code>Page.loadStylesheet("[SKIN]/skin_styles.css")</code><br>//      or<br>//      &nbsp;&nbsp;<code>Page.loadStylesheet("[APP]/app_styles.css")</code>.//      <P>//		If you don't specify a special directory, the app directory//			will be assumed.//		<P>//		Note:   If the document's ONLOAD handler has already fired, this//				will have no effect.////		@param	styleSheetURL	(URL)	URL to the stylesheet.  //										//		@group	skins, files, images//  @visibility external//<loadStyleSheet : function (styleSheetURL, wd, callback) {    var url = isc.Page.getURL(styleSheetURL);    var html = "<link rel='stylesheet' type='text/css' href=\"" + url + "\"\/>";    if (wd == null) wd = window;	if (isc.Page.isLoaded() && wd == window) {        if (isc.FileLoader) {            // The FileLoader preemptively loads the css that load_skin.js loads via a call to            // loadStyleSheet and stores a marker for us            var loadedSkins = isc.FileLoader._loadedSkins;            if (loadedSkins != null) {                for (var i = 0; i < loadedSkins.length; i++) {                    if (url.indexOf(loadedSkins[i]) != -1) {                        this.logDebug("skin "+loadedSkins[i]                                     +" already loaded by FileLoader - not loading css file");                        return;                    }                }            }            isc.FileLoader.loadCSSFile(url, callback);        } else {    		//>DEBUG	    	this.logWarn("isc.Page.loadStylesheet('"+styleSheetURL+                         "') called after page load.  Stylesheet not loaded.");    		//<DEBUG        }	} else {        if (this.isXHTML()) {            // XHTML: no document.write(), and body element may not exist yet.            // Per XHTML spec <link> elements appear in <head>, so dynamically add            // to <head> regardless of whether body exists            var doc = this.getDocument(),                head = doc.documentElement.firstChild,                // NOTE: namespace is required or you create a valid <link> element that does                // nothing because it's not treated as an HTMLLinkElement                elem = doc.createElementNS(doc.documentElement.namespaceURI, "link");            elem.rel = "stylesheet";            elem.type = "text/css";            elem.href = url;                        head.appendChild(elem);            this.logWarn("added stylesheet DOM style");        } else {            wd.document.write(html);        }	}},//>	@classMethod	Page.resizeTo()//		Resize the outer portion of the window to a specific width and height.//		@group	sizing////		@param	width	(number)	new width for the window//		@param	height	(number)	new height for the window// @visibility external//<resizeTo : function (width, height) {	window.resizeTo(width, height);},//>	@classMethod	Page.moveTo()//		Move the window to a specified top and left in screen coordinates.////		@param	left	(number)	new left coordinate for window//		@param	top		(number)	new top coordinate for window// @visibility external//<moveTo : function (top, left) {	window.moveTo(top, left);},

⌨️ 快捷键说明

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