亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产.精品.日韩.另类.中文.在线.播放| 日韩av不卡在线观看| 日韩欧美激情一区| 欧美日韩另类一区| 欧美视频你懂的| 91精品国产一区二区三区| 日韩小视频在线观看专区| 日韩免费视频一区| 久久婷婷国产综合精品青草| 精品国一区二区三区| 国产无人区一区二区三区| 国产人成一区二区三区影院| 国产精品国产自产拍高清av| 亚洲男人电影天堂| 亚洲自拍偷拍综合| 日本免费在线视频不卡一不卡二| 秋霞午夜鲁丝一区二区老狼| 久久不见久久见中文字幕免费| 国产精品一品二品| 色婷婷综合中文久久一本| 在线观看视频一区二区| 91精品国产色综合久久不卡蜜臀| 欧美mv和日韩mv的网站| 欧美高清在线视频| 视频一区欧美精品| 精品一区二区三区香蕉蜜桃 | 国产欧美一区二区精品久导航| 久久亚洲精品小早川怜子| 亚洲日本在线观看| 日本亚洲最大的色成网站www| 国产美女一区二区三区| 在线观看日韩国产| 精品国产乱码久久久久久浪潮| 中文字幕在线观看不卡| 日韩成人伦理电影在线观看| 成人自拍视频在线| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲国产成人porn| 国产一区欧美日韩| 欧美三区在线观看| 国产精品毛片高清在线完整版| 亚洲国产精品自拍| 成人精品鲁一区一区二区| 欧美精品v国产精品v日韩精品| 国产亚洲美州欧州综合国| 51精品视频一区二区三区| 亚洲第一精品在线| 国产成人精品一区二| 欧美一区二区三区色| 综合久久给合久久狠狠狠97色| 麻豆一区二区三| 欧美日韩五月天| 亚洲欧美激情小说另类| 国产精品一区二区不卡| 日韩一区二区三区在线视频| 亚洲国产人成综合网站| 菠萝蜜视频在线观看一区| 亚洲精品一区二区三区香蕉| 亚洲丝袜制服诱惑| 成人精品一区二区三区四区| 久久蜜桃香蕉精品一区二区三区| 亚洲777理论| 欧美色国产精品| 亚洲精选免费视频| 一本色道久久综合亚洲精品按摩| 日本一区二区成人| 国产成人av一区| 国产欧美一区二区三区沐欲| 国内久久精品视频| 337p日本欧洲亚洲大胆精品| 精品亚洲免费视频| 精品国产伦一区二区三区观看方式 | 日韩欧美一区二区免费| 天天综合天天综合色| 色婷婷精品大在线视频 | 欧美一区二区三区男人的天堂| 一区二区三区精品久久久| 91麻豆国产在线观看| 中文字幕一区二区日韩精品绯色| 成人污污视频在线观看| 中文字幕一区二区不卡| 色噜噜狠狠一区二区三区果冻| 亚洲摸摸操操av| 欧美色涩在线第一页| 日韩在线一区二区| 欧美xxxx在线观看| 成人激情综合网站| 亚洲精品成人精品456| 欧美日韩一区二区三区高清| 日韩1区2区3区| 欧美成人video| www.欧美日韩国产在线| 午夜精品久久久久| 日韩精品一区在线观看| 成人黄色大片在线观看| 亚洲一区二区欧美激情| 日韩欧美激情四射| 99精品视频一区| 亚洲成人www| 国产亚洲成年网址在线观看| 91蜜桃传媒精品久久久一区二区| 亚洲制服丝袜av| 日韩欧美国产电影| 成人伦理片在线| 日韩电影网1区2区| 中文字幕在线不卡视频| 在线不卡a资源高清| 国产99久久久精品| 日韩在线一区二区三区| 国产女主播一区| 欧美丰满嫩嫩电影| www.av精品| 韩国成人在线视频| 亚洲国产精品一区二区www在线| 久久影视一区二区| 欧美视频在线观看一区| 国产成+人+日韩+欧美+亚洲| 日韩中文字幕区一区有砖一区| 国产精品美女一区二区| 日韩久久久久久| 欧美久久一区二区| 91亚洲永久精品| 国产一区二区导航在线播放| 亚州成人在线电影| 亚洲丝袜另类动漫二区| 国产日韩高清在线| 欧美一级高清片| 在线播放中文字幕一区| 91福利社在线观看| 97se亚洲国产综合自在线| 国产精品99久久久久| 美女久久久精品| 天天综合色天天综合色h| 一区二区三区四区在线播放| 中文字幕中文字幕一区二区 | 成人不卡免费av| 激情欧美一区二区三区在线观看| 亚洲v日本v欧美v久久精品| 国产精品蜜臀av| 亚洲国产精品v| 国产日韩欧美电影| 2022国产精品视频| 国产亚洲精品资源在线26u| 久久亚洲影视婷婷| 亚洲精品在线观看网站| 精品美女被调教视频大全网站| 欧美一区二区视频免费观看| 欧美日韩中文另类| 欧美一区二区视频在线观看2022| 欧美人与z0zoxxxx视频| 91精品欧美一区二区三区综合在 | 奇米一区二区三区av| 天天色综合成人网| 日韩一区欧美二区| 麻豆极品一区二区三区| 另类小说视频一区二区| 久久97超碰色| 国产河南妇女毛片精品久久久| 国产91精品一区二区麻豆亚洲| 国产成人综合亚洲91猫咪| 成人性生交大片免费看中文| 国产成人超碰人人澡人人澡| 成人午夜又粗又硬又大| 成人免费电影视频| 色婷婷av一区二区三区gif| 欧美图片一区二区三区| 在线电影一区二区三区| 久久在线观看免费| 国产精品剧情在线亚洲| 亚洲精品菠萝久久久久久久| 五月综合激情日本mⅴ| 另类欧美日韩国产在线| 成人蜜臀av电影| 欧美日韩高清在线| 久久婷婷综合激情| 亚洲欧美aⅴ...| 青草av.久久免费一区| 国产超碰在线一区| 欧美视频中文一区二区三区在线观看| 91精品国产综合久久小美女| 久久久久国产免费免费 | 青青草原综合久久大伊人精品| 韩国三级电影一区二区| 91丝袜国产在线播放| 欧美一卡二卡三卡| 国产精品久久久久久久久搜平片| 亚洲自拍都市欧美小说| 国产精品一区二区免费不卡| 欧美日韩综合一区| 欧美激情综合在线| 免费成人在线网站| 91国偷自产一区二区开放时间 | 亚洲一区中文在线| 九九视频精品免费| 欧美亚洲自拍偷拍| 欧美韩国日本不卡| 激情综合五月天| 欧美日本一区二区三区| 国产精品乱子久久久久| 日本欧美在线观看|