flymis/WebRoot/dojojs/src/uri/Uri.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.uri.Uri");
dojo.uri = new function() {
this.dojoUri = function (/*dojo.uri.Uri||String*/uri) {
// summary: returns a Uri object resolved relative to the dojo root
return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri(), uri);
}
this.moduleUri = function(/*String*/module, /*dojo.uri.Uri||String*/uri){
// summary: returns a Uri object relative to a (top-level) module
// description: Examples: dojo.uri.moduleUri("dojo","Editor"), or dojo.uri.moduleUri("acme","someWidget")
var loc = dojo.hostenv.getModulePrefix(module);
if(!loc){return null;}
if(loc.lastIndexOf("/") != loc.length-1){loc += "/";}
return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri()+loc,uri);
}
this.Uri = function (/*dojo.uri.Uri||String...*/) {
// summary: Constructor to create an object representing a URI.
// description:
// Each argument is evaluated in order relative to the next until
// a canonical uri is produced. To get an absolute Uri relative
// to the current document use
// new dojo.uri.Uri(document.baseURI, uri)
// TODO: support for IPv6, see RFC 2732
// resolve uri components relative to each other
var uri = arguments[0];
for (var i = 1; i < arguments.length; i++) {
if(!arguments[i]) { continue; }
// Safari doesn't support this.constructor so we have to be explicit
var relobj = new dojo.uri.Uri(arguments[i].toString());
var uriobj = new dojo.uri.Uri(uri.toString());
if ((relobj.path=="")&&(relobj.scheme==null)&&(relobj.authority==null)&&(relobj.query==null)) {
if (relobj.fragment != null) { uriobj.fragment = relobj.fragment; }
relobj = uriobj;
} else if (relobj.scheme == null) {
relobj.scheme = uriobj.scheme;
if (relobj.authority == null) {
relobj.authority = uriobj.authority;
if (relobj.path.charAt(0) != "/") {
var path = uriobj.path.substring(0,
uriobj.path.lastIndexOf("/") + 1) + relobj.path;
var segs = path.split("/");
后面还有 50 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。