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

📄 _base.js

📁 这是一个ajax的例子大家好好的看看就是一个鱼眼的效果
💻 JS
📖 第 1 页 / 共 2 页
字号:
				if(filter[1]){					if(filter[1][0]){						str = filter[0](str, this.resolvePath(filter[1][1], context));					}else{						str = filter[0](str, filter[1][1]);					}				}else{					str = filter[0](str);				}			}			return str;		},		resolvePath: function(path, context){			var current, parts;			var first = path.charAt(0);			var last = path.slice(-1);			if(!isNaN(parseInt(first))){				current = (path.indexOf(".") == -1) ? parseInt(path) : parseFloat(path);			}else if(first == '"' && first == last){				current = path.slice(1, -1);			}else{				if(path == "true"){ return true; }				if(path == "false"){ return false; }				if(path == "null" || path == "None"){ return null; }				parts = path.split(".");				current = context.get(parts[0]);				for(var i = 1; i < parts.length; i++){					var part = parts[i];					if(current){						if(dojo.isObject(current) && part == "items" && typeof current[part] == "undefined"){							var items = [];							for(var key in current){								items.push([key, current[key]]);							}							current = items;							continue;						}						if(current.get && dojo.isFunction(current.get)){							current = current.get(part);						}else if(typeof current[part] == "undefined"){							current = current[part];							break;						}else{							current = current[part];						}						if(dojo.isFunction(current)){							if(current.alters_data){								current = "";							}else{								current = current();							}						}					}else{						return "";					}				}			}			return current;		}	});	dd._TextNode = dd._Node = dojo.extend(function(/*Object*/ obj){		// summary: Basic catch-all node		this.contents = obj;	},	{		set: function(data){			this.contents = data;		},		render: function(context, buffer){			// summary: Adds content onto the buffer			return buffer.concat(this.contents);		}	});	dd._NodeList = dojo.extend(function(/*Node[]*/ nodes){		// summary: Allows us to render a group of nodes		this.contents = nodes || [];		this.last = "";	},	{		push: function(node){			// summary: Add a new node to the list			this.contents.push(node);		},		render: function(context, buffer){			// summary: Adds all content onto the buffer			for(var i = 0; i < this.contents.length; i++){				buffer = this.contents[i].render(context, buffer);				if(!buffer) throw new Error("Template must return buffer");			}			return buffer;		},		dummyRender: function(context){			return this.render(context, dd.Template.prototype.getBuffer()).toString();		},		unrender: function(){ return arguments[1]; },		clone: function(){ return this; }	});	dd._VarNode = dojo.extend(function(str){		// summary: A node to be processed as a variable		this.contents = new dd._Filter(str);	},	{		render: function(context, buffer){			var str = this.contents.resolve(context);			return buffer.concat(str);		}	});	dd._noOpNode = new function(){		// summary: Adds a no-op node. Useful in custom tags		this.render = this.unrender = function(){ return arguments[1]; }		this.clone = function(){ return this; }	}	dd._Parser = dojo.extend(function(tokens){		// summary: Parser used during initialization and for tag groups.		this.contents = tokens;	},	{		i: 0,		parse: function(/*Array?*/ stop_at){			// summary: Turns tokens into nodes			// description: Steps into tags are they're found. Blocks use the parse object			//		to find their closing tag (the stop_at array). stop_at is inclusive, it			//		returns the node that matched.			var types = ddt.types;			var terminators = {};			stop_at = stop_at || [];			for(var i = 0; i < stop_at.length; i++){				terminators[stop_at[i]] = true;			}			var nodelist = new dd._NodeList();			while(this.i < this.contents.length){				token = this.contents[this.i++];				if(dojo.isString(token)){					nodelist.push(new dd._TextNode(token));				}else{					var type = token[0];					var text = token[1];					if(type == types.varr){						nodelist.push(new dd._VarNode(text));					}else if(type == types.tag){						if(terminators[text]){							--this.i;							return nodelist;						}						var cmd = text.split(/\s+/g);						if(cmd.length){							cmd = cmd[0];							var fn = ddt.getTag(cmd);							if(fn){								nodelist.push(fn(this, text));							}						}					}				}			}			if(stop_at.length){				throw new Error("Could not find closing tag(s): " + stop_at.toString());			}			this.contents.length = 0;			return nodelist;		},		next: function(){			// summary: Returns the next token in the list.			var token = this.contents[this.i++];			return {type: token[0], text: token[1]};		},		skipPast: function(endtag){			var types = ddt.types;			while(this.i < this.contents.length){				var token = this.contents[this.i++];				if(token[0] == types.tag && token[1] == endtag){					return;				}			}			throw new Error("Unclosed tag found when looking for " + endtag);		},		getVarNodeConstructor: function(){			return dd._VarNode;		},		getTextNodeConstructor: function(){			return dd._TextNode;		},		getTemplate: function(file){			return new dd.Template(file);		}	});	dd.register = {		_registry: {			attributes: [],			tags: [],			filters: []		},		get: function(/*String*/ module, /*String*/ name){			var registry = dd.register._registry[module + "s"];			for(var i = 0, entry; entry = registry[i]; i++){				if(dojo.isString(entry[0])){					if(entry[0] == name){						return entry;					}				}else if(name.match(entry[0])){					return entry;				}			}		},		getAttributeTags: function(){			var tags = [];			var registry = dd.register._registry.attributes;			for(var i = 0, entry; entry = registry[i]; i++){				if(entry.length == 3){					tags.push(entry);				}else{					var fn = dojo.getObject(entry[1]);					if(fn && dojo.isFunction(fn)){						entry.push(fn);						tags.push(entry);					}				}			}			return tags;		},		_any: function(type, base, locations){			for(var path in locations){				for(var i = 0, fn; fn = locations[path][i]; i++){					var key = fn;					if(dojo.isArray(fn)){						key = fn[0];						fn = fn[1];					}					if(dojo.isString(key)){						if(key.substr(0, 5) == "attr:"){							var attr = fn;							if(attr.substr(0, 5) == "attr:"){								attr = attr.slice(5);							}							dd.register._registry.attributes.push([attr, base + "." + path + "." + attr]);						}						key = key.toLowerCase();					}					dd.register._registry[type].push([						key,						fn,						base + "." + path					]);				}			}		},		tags: function(/*String*/ base, /*Object*/ locations){			dd.register._any("tags", base, locations);		},		filters: function(/*String*/ base, /*Object*/ locations){			dd.register._any("filters", base, locations);		}	}	dd.register.tags("dojox.dtl.tag", {		"date": ["now"],		"logic": ["if", "for", "ifequal", "ifnotequal"],		"loader": ["extends", "block", "include", "load", "ssi"],		"misc": ["comment", "debug", "filter", "firstof", "spaceless", "templatetag", "widthratio", "with"],		"loop": ["cycle", "ifchanged", "regroup"]	});	dd.register.filters("dojox.dtl.filter", {		"dates": ["date", "time", "timesince", "timeuntil"],		"htmlstrings": ["escape", "linebreaks", "linebreaksbr", "removetags", "striptags"],		"integers": ["add", "get_digit"],		"lists": ["dictsort", "dictsortreversed", "first", "join", "length", "length_is", "random", "slice", "unordered_list"],		"logic": ["default", "default_if_none", "divisibleby", "yesno"],		"misc": ["filesizeformat", "pluralize", "phone2numeric", "pprint"],		"strings": ["addslashes", "capfirst", "center", "cut", "fix_ampersands", "floatformat", "iriencode", "linenumbers", "ljust", "lower", "make_list", "rjust", "slugify", "stringformat", "title", "truncatewords", "truncatewords_html", "upper", "urlencode", "urlize", "urlizetrunc", "wordcount", "wordwrap"]	});})();}

⌨️ 快捷键说明

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