You’ll have to re-write it. jQuery will be available all right, alongside with some other built-in JS modules. Converting a big application to AMD is a bit painful, but definitely worth it in the end.
That’s an example of a typical small Tapestry script (with usage of Google Analytics as a bonus): require.config({ shim: { "ga": { exports: "ga" } }, paths: { "ga": "//www.google-analytics.com/analytics" } }); define(["jquery", "t5/core/events", "ga"], function($, events, ga) { return function(spec) { if (spec.googleAnalyticsId) { var $trackerName = 'eventTracker' + spec.danceEventId ga('create', spec.googleAnalyticsId, 'auto', { 'name': $trackerName, 'allowLinker': true }) if (spec.crossDomains) { ga($trackerName + '.require', 'linker') ga($trackerName + '.linker:autoLink', spec.crossDomains) } ga($trackerName + '.send', 'pageview') } } }); And this is how you enable it in your application (Scala code which you may call from *afterRender* phase): def setupEventGoogleAnalytics(jsSupport: JavaScriptSupport, event: Event): Unit = if (StringUtils.isNotBlank(event.getGoogleAnalyticsId)) { val spec = new JSONObject(*“*googleAnalyticsId", event.getGoogleAnalyticsId, "eventId", event.getId) if (StringUtils.isNotBlank(event.getGoogleAnalyticsDomains)) spec.put(*“*crossDomains", new JSONArray(StringUtils.split(event.getGoogleAnalyticsDomains, ',').map(_.trim): _*)) jsSupport.require("dcnet/eventga").`with`(spec) } You’ll need to *require* your re-written scripts using *JavaScriptSupport* service which you inject just like any other Tapestry service. 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 > > -- Ilya Obshadko