Hi Erich, one example of using jQuery in inline scripts can be:
<script> require(['jquery'], function($) { <!-- Use $ as usual here --> }); </script> I would suggest to replace inline scripts with JavaScript modules, i.e. one per component/page: http://tapestry.apache.org/javascript-modules.html You can override jQuery version with the one you need, check configuration symbols here: https://github.com/apache/tapestry-5/blob/b3db0dd817d709a646b0a3e754f2e710c8f2a86f/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java#L91 If you haven't already, check http://tapestry5-jquery.com, it can still be helpful for 5.4.x, especially if you're using jQuery IU. Here are the configuration symbols for tapestry5-jquery: https://github.com/got5/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/services/JQueryModule.java On Sat, Mar 24, 2018 at 2:51 PM, Erich Gormann <e.gorm...@gormann.de> wrote: > Dear all, > > after migrating to tapestry 5.4.3 it is not possible anymore, to use > inlines scripts in tml files. > > In principle I understood the idea and usgage of requirejs, but I'm > confused, because they seem to be several ways to achieve certain goals for > individual solutions. > > So I try to give a concrete example to illustrate my problems during > restructuring our inline scripts wiith requirejs. As precondition I would > like to say, that I set the javascipt infrastucture provider in Tapestry to > "jquery". > > Currently we have these two kind of scripting in our Tapestry 5.3.8 > project (I show them only because of the use of the aliases): > > if ( jQuery( "#searchFilterSelector" ).length ) { > jQuery("#deleteSearchFilter").show(); > } else { > jQuery("#deleteSearchFilter").hide(); > } > > (function($) { > $('#finderSearchBtn').click(function() { > showLoadingIndicator(); > }); > })(jQuery); > > 1. question: what if my scripts need jquery or jqueryui? Do I have to put > a jquery.js and jqueryui.js in my own poject or can I use the one of > Tapestry 5.4.3? > 2, question: If I can use the jquery libs of Tapestry, how do I have to > make them known to my appkication? Must I put them in requirejs.config > section and how (because they are in the Tapestry libs, not in the path of > may appliaction) > 3. question: Do I have to reqrite the above inline scripts and make use of > another jquery alias? > 4. question: How to process with already existing "browser global > scripts"? I read about the shim config framework as part of requirejs, but > it seems, that no scripts using define calls and such ones defined via shim > can be used together in one appliaction, or am I wrong? > > I would appreciate, if you can give me an example how to make old scripst > work again under Tapestry 5.4.3 > > Thanks for your support! > > Regards, Erich > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Dmitry Gusev AnjLab Team http://anjlab.com