wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edvin Syse <ed...@sysedata.no>
Subject Re: Can you control the order of <wicket:head> contra added headercontributors?
Date Fri, 01 Feb 2008 22:41:44 GMT
> That would still require me to do some code in every page they want to 
> use jquery stuff in. But what do you think of the possibility of the 
> JQuery headercontributor to "scan" the <wicket:head> section using a 
> regexp or something, and not add jquery if the regexp matches? Can I get 
> to the <wicket:head> stuff from a header-contributor?

Somewhere along the lines of this, in JQueryBehaviour:

     public static final Pattern JQUERY_REGEXP = Pattern.compile("<script.*?src=\".*jquery.*\\.js>");


     public void renderHead(IHeaderResponse response) {
	    super.renderHead(response);
             if(!JQUERY_REGEXP.matcher(response.getResponse().toString()).matches()) {
	            response.renderJavascriptReference(JQUERY_JS);
	            if (Application.DEVELOPMENT.equals(Application.get().getConfigurationType()))
{
	                response.renderJavascriptReference(JQUERY_DEBUG_JS);
	            }
             }
     }

.. or am I on the wrong track? :)

-- Edvin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message