亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? javascripttaglib.groovy

?? grails用戶使用指南
?? GROOVY
字號:
/* Copyright 2004-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT c;pWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */import org.springframework.validation.Errors;import org.springframework.context.NoSuchMessageException;import org.springframework.web.servlet.support.RequestContextUtils as RCU;import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU; /** *  A  tag lib that provides tags for developing javascript and ajax applications * * @author Graeme Rocher * @since 17-Jan-2006 */class JavascriptTagLib  {	/**	 * Mappings to the relevant files to be included for each library	 */	static final INCLUDED_LIBRARIES = "org.codehaus.grails.INCLUDED_JS_LIBRARIES"	static final INCLUDED_JS = "org.codehaus.grails.INCLUDED_JS"		static final LIBRARY_MAPPINGS = [										prototype : ['prototype/prototype'],										yahoo : [ 'yahoo/yahoo-min','yahoo/connection-min', 'yahoo/dom-min','yahoo/event-min','yahoo/animation-min'],										dojo : [ 'dojo/dojo']									]											static {		LIBRARY_MAPPINGS.scriptaculous = LIBRARY_MAPPINGS.prototype + ['prototype/scriptaculous','prototype/builder','prototype/controls','prototype/effects','prototype/slider','prototype/dragdrop']				LIBRARY_MAPPINGS.rico = LIBRARY_MAPPINGS.prototype + ['prototype/rico']					}										/**	 * Includes a javascript src file, library or inline script	 * if the tag has no 'src' or 'library' attributes its assumed to be an inline script:	 *	 * <g:javascript>alert('hello')</g:javascript>	 *	 * The 'library' attribute will attempt to use the library mappings defined above to import the 	 * right js files and not duplicate imports eg.	 *	 * <g:javascript library="scripaculous" /> // imports all the necessary js for the scriptaculous library	 *	 * The 'src' attribute will merely import the js file but within the right context (ie inside the /js/ directory of 	 * the Grails application:	 *	 * <g:javascript src="myscript.js" /> // actually imports '/app/js/myscript.js'	 **/	def javascript = { attrs, body ->		if(!request[INCLUDED_JS]) request[INCLUDED_JS] = []		if(!request[INCLUDED_LIBRARIES]) request[INCLUDED_LIBRARIES] = []				if(attrs.src) {			out << '<script type="text/javascript" src="'			out << grailsAttributes.getApplicationUri(request)			out << "/js/${attrs.src}"			out.println '"></script>'				}		else if(attrs.library) {			if(LIBRARY_MAPPINGS.containsKey(attrs.library)) {				if(!request[INCLUDED_LIBRARIES].contains(attrs.library)) {					LIBRARY_MAPPINGS[attrs.library].each {						if(!request[INCLUDED_JS].contains(it)) {								request[INCLUDED_JS] << it								out << '<script type="text/javascript" src="'								out << grailsAttributes.getApplicationUri(request)								out << "/js/${it}.js"															out.println '"></script>'						}										}					request[INCLUDED_LIBRARIES] << attrs.library									}							}			else {				if(!request[INCLUDED_LIBRARIES].contains(attrs.library)) {					out << '<script type="text/javascript" src="'					out << grailsAttributes.getApplicationUri(request)					out << "/js/${attrs.library}.js"											out.println '"></script>'					request[INCLUDED_LIBRARIES] << attrs.library					request[INCLUDED_JS] << attrs.library									}			}		}		else {			out.println '<script type="text/javascript">'				body()			out.println '</script>'		}	}    /**     *  Creates a remote function call using the prototype library     */    def remoteFunction = { attrs  ->    		// before remote function		def after = ''		if(attrs["before"])			out << "${attrs.remove('before')};"		if(attrs["after"])			after = "${attrs.remove('after')};"		def p = getProvider()		p.doRemoteFunction(owner,attrs,out)		attrs.remove('update')		// after remote function		if(after)		   out <<  after			           		       }                                          /**     * Normal map implementation does a shallow clone. This implements a deep clone for maps     * using recursion     */    private deepClone(Map map) {	    def cloned = [:]	    map?.each { k,v ->		    if(v instanceof Map) {			   cloned[k] = deepClone(v)   	        }            else {		     cloned[k] = v  		    		    }		}                		return cloned    }    /**     * A link to a remote uri that used the prototype library to invoke the link via ajax     */    def remoteLink = { attrs, body ->       out << "<a href=\""           def cloned = deepClone(attrs)	   createLink(cloned)               	   out << "\" onclick=\""        // create remote function        remoteFunction(attrs)   		attrs.remove('url')        out << "return false;\" "        // process remaining attributes        attrs.each { k,v ->            out << k << "=\"" << v << "\" "        }        out << ">"        // output the body        body()        // close tag        out << "</a>"    }	/**	 * A field that sends its value to a remote link	 */	def remoteField = { attrs, body ->		def paramName = attrs.paramName ? attrs.remove('paramName') : 'value'		def value = attrs.remove('value') 		if(!value) value = ''				out << "<input type='text' name='${attrs.remove('name')}' value='${value}' onkeyup=\""		if(attrs.params) {			if(attrs instanceof Map) {				attrs.params.put(paramName, 'this.value')			}			else {				attrs.params += "'${paramName}='+this.value"				}		}		else {    		attrs.params = "'${paramName}='+this.value"					}		remoteFunction(attrs)		attrs.remove('params')		out << "\""   		attrs.remove('url')		attrs.each { k,v->			out << " $k=\"$v\""		}		out <<" />"	}    /**     * A form which used prototype to serialize its parameters and submit via an asynchronous ajax call     */    def formRemote = { attrs, body ->        if(!attrs.name) {            throwTagError("Tag [formRemote] is missing required attribute [name]")        }                if(!attrs.url) {            throwTagError("Tag [formRemote] is missing required attribute [url]")        }                        // get javascript provider 		def p = getProvider()						def url = deepClone(attrs.url) 				// prepare form settings		prepareAjaxForm(p,attrs)                def params = [  onsubmit:TagLibUtil.outToString(remoteFunction,attrs) + 'return false',					    method: (attrs.method? attrs.method : 'POST' ),					    action: (attrs.action? attrs.action : TagLibUtil.outToString(createLink,url))		                 		             ]		attrs.remove('url')		             	    params.putAll(attrs)	    withTag(name:'form',attrs:params) {			body()   	    }		    }    /**     *  Creates a form submit button that submits the current form to a remote ajax call     */    def submitToRemote = { attrs, body ->    	// get javascript provider		def p = getProvider()    		// prepare form settings 		attrs.forSubmitTag = ".form"		prepareAjaxForm(p,attrs)            def params = [  onclick:TagLibUtil.outToString(remoteFunction,attrs) + 'return false',					    type: 'button',					    name: attrs.remove('name'),					    value: attrs.remove('value'), 					    id: attrs.remove('id'),					    'class':attrs.remove('class')		             ]		             		withTag(name:'input', attrs:params) {			body()			}    }		 private prepareAjaxForm(provider,attrs) {		if(provider instanceof PrototypeProvider) {			if(!attrs.forSubmitTag) attrs.forSubmitTag = ""		    attrs.params = "Form.serialize(this${attrs.remove('forSubmitTag')})"		}		else if(provider instanceof YahooProvider) {			if(attrs.before) {				attrs.before += ";YAHOO.util.Connect.setForm('${attrs.name}')"			}			else {				attrs.before = "YAHOO.util.Connect.setForm('${attrs.name}')"			}		}		else if(provider instanceof DojoProvider) {			if(attrs.params) attrs.params.formNode = "dojo.byId('${attrs.name}')"			else {				attrs.params = [formNode:"dojo.byId('${attrs.name}')"]			}		}	 }	/**	 * Escapes a javasacript string replacing single/double quotes and new lines	 *	 * <g:escapeJavascript>This is some "text" to be escaped</g:escapeJavascript>	 */	def escapeJavascript = { attrs,body ->		def js = ''		if(body instanceof Closure) {			def tmp = out			def sw = new StringWriter()			out = new PrintWriter(out)			// invoke body			body()			// restore out			out = tmp			js = sw.toString()					}		else if(body instanceof String) {			js = body		}		else if(attrs instanceof String) {			js = attrs			}		out << 	js.replaceAll(/\r\n|\n|\r/, '\\\\n')					.replaceAll('"','\\\\"')					  .replaceAll("'","\\\\'")	}	/**	 * Returns the provider of the necessary function calls to perform Javascript functions	 *	 **/	private JavascriptProvider getProvider() {							if(request[JavascriptTagLib.INCLUDED_LIBRARIES]?.contains('yahoo')) {			return new YahooProvider()		}		else if(request[JavascriptTagLib.INCLUDED_LIBRARIES]?.contains('dojo')) {			return new DojoProvider()		}				else {			return new PrototypeProvider()		}	}}/** * Interface defining methods that a JavaScript provider should implement * * @author Graeme Rocher **/interface JavascriptProvider {	/**	 * Creates a remote function call	 *	 * @param The attributes to use	 * @param The output to write to	 */	def doRemoteFunction(taglib,attrs, out)}/** * Prototype implementation of JavaScript provider * * @author Graeme Rocher */class PrototypeProvider implements JavascriptProvider {	def doRemoteFunction(taglib,attrs, out) {		out << 'new Ajax.'		if(attrs.update) {			out << 'Updater('			if(attrs.update instanceof Map) {				out << "{"				def update = []				if(attrs.update?.success) {					update << "success:'${attrs['update']['success']}'"				}				if(attrs.update?.failure) {					update << "failure:'${attrs['update']['failure']}'"				}				out << update.join(',')				out << "},"			}			else {				out << "'" << attrs.update << "',"			}			attrs.remove("update")		}		else {			out << "Request("		}		out << "'"										def pms = attrs.remove('params')   		if(attrs.url) {			taglib.createLink(attrs.url)					}                              		else {			taglib.createLink(attrs)					}				out << "',"		if(pms)		    attrs.params = pms		// process options		out << getAjaxOptions(attrs)		// close		out << ');'			}	    // helper function to build ajax options    def getAjaxOptions(options) {        def ajaxOptions = []       // necessary defaults       if(options.options?.asynchronous)           ajaxOptions << "asynchronous:${options.options.remove('asynchronous')}"       else           ajaxOptions << "asynchronous:true"                  if(options.options?.evalScripts)           ajaxOptions << "evalScripts:${options.options?.remove('evalScripts')}"       else           ajaxOptions << "evalScripts:true"                    if(options) {            // process callbacks            def callbacks = options.findAll { k,v ->                k ==~ /on(\p{Upper}|\d){1}\w+/            }            callbacks.each { k,v ->                ajaxOptions << "${k}:function(e){${v}}"                options.remove(k)            }            if(options.params) {                ajaxOptions << "parameters:${options.remove('params')}"            }            // remaining options            options.options?.each { k, v ->            	if(k!='url') {	                 switch(v) {	                    case 'true': ajaxOptions << "${k}:${v}"; break;	                    case 'false': ajaxOptions << "${k}:${v}"; break;	                    case ~/\s*function(\w*)\s*/: ajaxOptions << "${k}:${v}"; break;	                    default:ajaxOptions << "${k}:'${v}'"; break;	                 }            	            	}            }        }        return "{${ajaxOptions.join(',')}}"    }	}/** * A implementation for the Yahoo library * * @author Graeme Rocher **/class YahooProvider implements JavascriptProvider {	def doRemoteFunction(taglib,attrs, out)	{		def method = (attrs.method ? attrs.method : 'GET' )		if(attrs.onLoading) {			out << "${attrs.onLoading};"		}		out << "YAHOO.util.Connect.asyncRequest('${method}','"						if(attrs.url) {			taglib.createLink(attrs.url)		}		else {			taglib.createLink(attrs)		}						out << "',"		buildYahooCallback(attrs,out)		out << ',null);'	}			// helper method to create yahoo callback object	def buildYahooCallback(attrs,out) {		out << '{ '			if(attrs.update) {			  out <<'success: function(o) { '			    if(attrs.onLoaded) {					out << "${attrs.onLoaded}";				}				if(attrs.update instanceof Map) {					if(attrs.update.success) {						out << "YAHOO.util.Dom.get('${attrs.update.success}').innerHTML = o.responseText;"														}												}				else {					out <<  "YAHOO.util.Dom.get('${attrs.update}').innerHTML = o.responseText;"				}				if(attrs.onSuccess) {					out << ";${attrs.onSuccess};"				}					if(attrs.onComplete) {					out << ";${attrs.onComplete};"				}		  				out << ' }'				out << 	', failure: function(o) {'													if(attrs.update instanceof Map) {					if(attrs.update.failure) {						out << "YAHOO.util.Dom.get('${attrs.update.failure}').innerHTML = o.statusText;"																									}				}				if(attrs.onFailure) {					out << "${attrs.onFailure};"				}					if(attrs.onComplete) {					out << ";${attrs.onComplete};"				}																	out << '}'							}						out << '}'			}	}/** * An implementation for the Dojo javascript library * * @author Graeme Rocher */class DojoProvider implements JavascriptProvider {	 def doRemoteFunction(taglib,attrs, out) {		if(attrs.onLoading) {			out << "${attrs.onLoading};"		}				 out << 'dojo.io.bind({url:\''		 taglib.createLink(attrs) 		attrs.remove('params')		 out << '\',load:function(type,data,evt) {'	    if(attrs.onLoaded) {			out << "${attrs.onLoaded}";		}				 if(attrs.update) {						out << 'dojo.html.textContent( dojo.byId(\''			out << (attrs.update instanceof Map ? attrs.update.success : attrs.update)			out << '\'),data);'				 }		if(attrs.onSuccess) {			out << ";${attrs.onSuccess};"		}		if(attrs.onComplete) {			out << ";${attrs.onComplete};"		}				out << '}'		out << ',error:function(type,error) { '		if(attrs.update instanceof Map) {			if(attrs.update.failure) {				out << "dojo.html.textContent( dojo.byId('${attrs.update.failure}'),error.message);"												}		}		if(attrs.onFailure) {			out << ";${attrs.onFailure};"		}			if(attrs.onComplete) {			out << ";${attrs.onComplete};"		}					     out << '}'	     attrs.params?.each {k,v ->	     	out << ",$k:$v"	     }		 out << '});'	 }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美伦理视频网站| 三级欧美在线一区| 香蕉久久一区二区不卡无毒影院 | 亚洲 欧美综合在线网络| 国产一区二区三区精品视频| 欧美性受xxxx| 《视频一区视频二区| 国内精品在线播放| 91精品国产一区二区三区| 亚洲免费大片在线观看| 成人精品gif动图一区| 欧美不卡视频一区| 午夜视频在线观看一区二区| 91久久一区二区| 亚洲青青青在线视频| 成人精品视频一区二区三区尤物| 日韩精品一区二区三区四区| 亚洲第一av色| 欧美午夜一区二区| 一区二区三区日韩欧美精品 | 精品午夜久久福利影院| 欧美日韩久久久久久| 亚洲综合清纯丝袜自拍| 99精品视频一区二区三区| 日本一区二区不卡视频| 国产99久久精品| 欧美韩国一区二区| 成人性生交大片免费看在线播放| 久久久一区二区三区捆绑**| 国产一区二区三区黄视频 | 99国产精品久久久久久久久久久| 国产女人18毛片水真多成人如厕| 激情欧美一区二区| 久久精品在这里| 成人黄色一级视频| 亚洲欧美一区二区在线观看| 91首页免费视频| 天天色综合成人网| 日本精品一区二区三区四区的功能| 国产欧美日韩在线| www.激情成人| 亚洲三级在线播放| 色综合久久天天| 亚洲一级二级在线| 欧美精品在线视频| 美腿丝袜在线亚洲一区| 久久久久久久久99精品| 成人午夜av影视| 亚洲你懂的在线视频| 欧美视频日韩视频| 日韩和的一区二区| 国产亚洲精品资源在线26u| www.亚洲在线| 香蕉成人啪国产精品视频综合网| 欧美一区二区日韩一区二区| 久久国产精品色| 国产精品久久久久久一区二区三区| 色综合夜色一区| 久久你懂得1024| 本田岬高潮一区二区三区| 亚洲专区一二三| xnxx国产精品| 91麻豆国产福利在线观看| 日韩激情一区二区| 国产精品人妖ts系列视频| 欧美三日本三级三级在线播放| 精品一区二区av| 日韩美女视频19| 日韩欧美黄色影院| 91视频免费播放| 美女免费视频一区| 亚洲黄色免费网站| 国产午夜精品美女毛片视频| 在线观看网站黄不卡| 国产精品一区二区在线看| 性欧美大战久久久久久久久| 欧美激情一区在线| 日韩欧美国产一二三区| 色综合久久66| 福利一区二区在线观看| 日韩电影在线观看一区| 亚洲人成精品久久久久久| 欧美成人欧美edvon| 欧美亚洲丝袜传媒另类| 成人h精品动漫一区二区三区| 男女视频一区二区| 一区二区三区高清在线| 亚洲国产成人午夜在线一区| 欧美va在线播放| 欧美日韩免费高清一区色橹橹 | 久久国产精品免费| 亚洲午夜精品网| 最近中文字幕一区二区三区| 欧美v国产在线一区二区三区| 精品视频在线免费观看| 一本久久精品一区二区| 成人免费看视频| 国产乱人伦偷精品视频不卡| 日韩电影在线观看网站| 亚州成人在线电影| 亚洲地区一二三色| 亚洲影视在线播放| 亚洲欧美国产毛片在线| 国产精品成人一区二区艾草| 国产欧美精品一区二区色综合朱莉| 欧美一区二区三级| 777午夜精品免费视频| 欧美日韩国产电影| 欧美日韩www| 欧美日韩专区在线| 欧美日韩一区三区四区| 欧美色视频一区| 欧美日本一区二区| 欧美疯狂性受xxxxx喷水图片| 欧美午夜一区二区三区 | 久久亚洲一级片| 久久免费午夜影院| 欧美激情资源网| 亚洲欧洲日韩一区二区三区| 国产精品天美传媒| 国产精品青草综合久久久久99| 国产日韩欧美电影| 1024成人网| 亚洲成在人线免费| 日本成人超碰在线观看| 精品一区二区三区免费观看| 国产超碰在线一区| 91亚洲资源网| 欧美日韩精品欧美日韩精品一| 337p亚洲精品色噜噜噜| 精品国产三级a在线观看| 久久综合久久鬼色| 亚洲图片另类小说| 亚洲成av人片一区二区| 久久精品噜噜噜成人88aⅴ | 亚洲人吸女人奶水| 亚洲国产欧美在线人成| 日本在线不卡视频一二三区| 国产在线精品一区二区夜色| 成人h动漫精品一区二区| 在线观看视频一区二区| 日韩欧美色电影| 亚洲视频1区2区| 久久精品国产一区二区三| 成人性生交大片免费| 欧美日本一道本| 国产精品色一区二区三区| 亚洲大片在线观看| 国产91综合网| 欧美老肥妇做.爰bbww| 国产婷婷精品av在线| 亚洲国产视频a| 国产成人精品午夜视频免费| 欧美亚洲综合色| 久久看人人爽人人| 首页国产丝袜综合| 成人国产精品免费| 日韩午夜三级在线| 亚洲欧美欧美一区二区三区| 国内精品视频一区二区三区八戒| 色老头久久综合| 久久这里只有精品视频网| 亚洲午夜免费电影| 成人黄色综合网站| 精品乱人伦一区二区三区| 一区二区久久久| 成人黄色一级视频| 精品国产伦一区二区三区观看方式| 亚洲欧美日韩在线不卡| 国产麻豆精品95视频| 欧美精品丝袜中出| 亚洲色欲色欲www| 国产福利一区二区三区视频| 在线综合亚洲欧美在线视频| 日韩一区欧美小说| 成人免费视频视频| 精品久久一区二区三区| 日本欧美久久久久免费播放网| 色先锋久久av资源部| 国产精品国产自产拍高清av| 国精产品一区一区三区mba桃花| 欧美高清dvd| 视频一区二区国产| 色婷婷亚洲精品| 亚洲美女淫视频| 91啪在线观看| 日韩一区在线播放| 97精品电影院| 综合激情成人伊人| 成人深夜在线观看| 中文字幕免费不卡在线| 国产99久久久久| 国产精品色在线观看| 成人在线一区二区三区| 欧美激情一区二区三区不卡| 成人性生交大片| 成人免费在线视频| 色丁香久综合在线久综合在线观看| 亚洲欧美怡红院| 色偷偷成人一区二区三区91|