KH0RKHE Posted March 30, 2021 Share Posted March 30, 2021 Is there a way to add custom CSS and JavaScript, aside from the properties "CustomCSS" and "customFiles"? This approach, for large projects, would bring back the days of jQuery hell into the Delphi world, making unmaintainable spaghetti out of the sources. I'd like to add CSS, and JavaScript code with limited scope, in my descendant of a unigui control, for a modular, object oriented programming. This approach is typically used in modern web front end frameworks, such as ReactJS or Angular, to enforce isolation between our building blocks. How could this be achieved with unigui? And is this the right place to post, or should I put it in feature request? Thanks for your time Link to comment Share on other sites More sharing options...
x11 Posted March 31, 2021 Share Posted March 31, 2021 9 hours ago, KH0RKHE said: Is there a way to add custom CSS and JavaScript, aside from the properties "CustomCSS" and "customFiles"? procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean); begin LoadScriptCSS; ... ... end; procedure TUniMainModule.LoadScriptCSS; begin if ExtLocale = 'ukr' then begin if UniMainModule.IsMobilePlatform then UniSession.AddJS('Ext.Loader.loadScript("/files/' + cCSSDir + 'custommob_ukr.css")') else UniSession.AddJS('Ext.Loader.loadScript("/files/' + cCSSDir + 'custom_ukr.css")'); end else begin if UniMainModule.IsMobilePlatform then UniSession.AddJS('Ext.Loader.loadScript("/files/' + cCSSDir + 'custommob.css")') else UniSession.AddJS('Ext.Loader.loadScript("/files/' + cCSSDir + 'custom.css")'); end; end; Link to comment Share on other sites More sharing options...
KH0RKHE Posted April 1, 2021 Author Share Posted April 1, 2021 This is still global, at the main module level. Will look into using unisession within controls, thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now