亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
蜜臀91精品一区二区三区| 97se亚洲国产综合自在线| 成人自拍视频在线观看| 欧美系列亚洲系列| 国产人成一区二区三区影院| 亚洲综合色丁香婷婷六月图片| 久久黄色级2电影| 欧美日韩一区 二区 三区 久久精品| 精品国产一区二区亚洲人成毛片| 亚洲精品高清视频在线观看| 国产乱人伦偷精品视频免下载| 欧美撒尿777hd撒尿| 一区在线观看免费| 国产成人精品一区二区三区四区 | 国产精品久久久久一区| 极品少妇xxxx精品少妇| 欧美日本韩国一区二区三区视频| 国产精品毛片久久久久久久| 久久精品72免费观看| 91精品国产综合久久蜜臀 | 久久精品亚洲一区二区三区浴池| 亚洲成av人片观看| 91黄色小视频| 伊人婷婷欧美激情| 在线视频欧美精品| 亚洲免费在线电影| 91福利国产成人精品照片| 亚洲美女电影在线| 91麻豆精品一区二区三区| 中文字幕第一区二区| 国产成人综合亚洲91猫咪| 久久中文娱乐网| 精品亚洲成a人在线观看| 日韩视频不卡中文| 韩国在线一区二区| 精品国产乱码久久久久久老虎| 久久国产人妖系列| 欧美精品一区二区三区久久久| 久久超级碰视频| 久久久91精品国产一区二区三区| 国产成人av在线影院| 国产精品日韩精品欧美在线| av一二三不卡影片| 亚洲午夜精品网| 欧美另类久久久品| 久久99最新地址| 欧美国产激情一区二区三区蜜月| 成人午夜免费视频| 一区二区三区在线观看国产| 欧美日韩国产一二三| 看电影不卡的网站| 国产亲近乱来精品视频| 91在线小视频| 日韩精品久久理论片| 精品久久久三级丝袜| 东方aⅴ免费观看久久av| 国产精品全国免费观看高清| 欧美性生活大片视频| 日韩精品一级中文字幕精品视频免费观看 | 国产成人高清在线| 最新日韩在线视频| 91精品婷婷国产综合久久竹菊| 精品在线亚洲视频| 亚洲天堂免费在线观看视频| 欧美三级日韩三级国产三级| 麻豆精品在线看| 国产精品美女久久久久久| 欧美性生活久久| 国产一区二区三区| 亚洲免费在线电影| 欧美大片在线观看一区二区| 成人高清av在线| 天堂成人免费av电影一区| www国产精品av| 91免费观看国产| 久久福利视频一区二区| 中文字幕日韩一区| 欧美mv日韩mv国产| 在线观看区一区二| 国产一区二区三区四区在线观看| 亚洲视频一二三| 久久综合色之久久综合| 在线欧美日韩国产| 成人一级片网址| 美女视频一区二区三区| 亚洲精品视频一区二区| 国产日韩欧美制服另类| 欧美精品亚洲一区二区在线播放| 成人av电影免费观看| 石原莉奈在线亚洲三区| 亚洲免费看黄网站| 中文无字幕一区二区三区| 日韩一区二区三区免费看| 一本久久精品一区二区| 粉嫩aⅴ一区二区三区四区| 久久精品久久综合| 视频一区二区中文字幕| 亚洲制服丝袜av| 中文字幕在线视频一区| 久久网这里都是精品| 日韩视频免费观看高清在线视频| 欧美在线视频不卡| 色哟哟国产精品免费观看| www.亚洲色图.com| 丁香桃色午夜亚洲一区二区三区| 美女视频黄a大片欧美| 亚洲444eee在线观看| 亚洲一级不卡视频| 亚洲欧美aⅴ...| 亚洲免费在线观看| 一区二区激情视频| 亚洲在线免费播放| 亚洲午夜一区二区| 亚洲精品视频免费看| 亚洲精品欧美专区| 一区二区视频在线看| 亚洲一二三专区| 无码av免费一区二区三区试看| 亚洲小说欧美激情另类| 五月天视频一区| 奇米精品一区二区三区在线观看| 亚洲成a人片综合在线| 日日夜夜免费精品| 美国欧美日韩国产在线播放| 激情成人综合网| 懂色av中文字幕一区二区三区 | 日韩激情av在线| 奇米综合一区二区三区精品视频| 蜜桃精品视频在线| 国产乱妇无码大片在线观看| 成人91在线观看| 欧美最猛黑人xxxxx猛交| 欧美猛男gaygay网站| 日韩女同互慰一区二区| 国产视频一区二区在线观看| 欧美国产日产图区| 亚洲综合色自拍一区| 日韩电影一区二区三区四区| 经典三级一区二区| 99riav一区二区三区| 欧美日韩视频在线观看一区二区三区 | 国产精品一区二区久激情瑜伽| 国产成人小视频| 91久久奴性调教| 日韩一区二区不卡| 专区另类欧美日韩| 日韩av在线免费观看不卡| 国产精品亚洲成人| 欧美综合一区二区| 26uuu色噜噜精品一区二区| 亚洲同性gay激情无套| 日韩电影在线一区二区三区| 国产成人亚洲精品青草天美| 色综合久久久久| 日韩精品自拍偷拍| 一区二区视频免费在线观看| 久久99热狠狠色一区二区| caoporn国产一区二区| 欧美一区二区三区白人| 国产精品国产精品国产专区不片| 婷婷久久综合九色综合伊人色| 成人综合在线网站| 91精品欧美久久久久久动漫| ...中文天堂在线一区| 久久精品国产久精国产| 一本色道久久综合亚洲aⅴ蜜桃| 欧美成人一区二区三区片免费| 中文字幕中文字幕在线一区 | 日韩女优av电影| 亚洲已满18点击进入久久| 国产一区二区三区不卡在线观看| 在线看一区二区| 国产精品日韩成人| 精品一区二区成人精品| 欧美日韩国产综合一区二区| 日韩美女视频一区| 国产成人综合视频| 日韩精品一区在线观看| 午夜久久久久久久久久一区二区| av爱爱亚洲一区| 久久久久久久久蜜桃| 久久不见久久见免费视频7| 欧美日韩视频在线一区二区| 亚洲同性同志一二三专区| 国产91精品久久久久久久网曝门 | 性欧美疯狂xxxxbbbb| 色综合久久综合| 亚洲视频免费在线观看| 成人国产精品免费观看动漫| 欧美精品一区二区精品网| 日韩成人免费电影| 欧美日韩三级一区二区| 亚洲高清免费观看 | 欧美一级黄色录像| 日韩精品一二三| 欧美理论电影在线| 午夜久久福利影院| 欧美一区二区福利视频| 日韩国产欧美一区二区三区| 欧美男同性恋视频网站|