Astroid-Framework icon indicating copy to clipboard operation
Astroid-Framework copied to clipboard

[improvement] Reworking of the "Custom JS Files" Description and Implementation

Open FaySmash opened this issue 5 years ago • 11 comments

The Issue:

Define some Custom JS script in multiple lines: custom js


Expectation: the paths of the defined custom JS files are written into the <head> tag with the form <script src="/misc/custom%20JS/set global variables.js"></script>


Reality: the paths of the defined custom JS files are written into the <head> tag, but for every but the last loaded file in the form

<script src="/misc/custom%20JS/set global variables.js
"></script>

console log

Notice the appended linefeed on every but the last imported script. This leads to breaking of some joomla plugins.

FaySmash avatar Jan 04 '20 19:01 FaySmash

Hello,

Please use Comma (,) for multi-files.

Example /misc/custom%20JS/set global variables.js, /misc/custom%20JS/set global variables.js, /misc/custom%20JS/set global variables.js

itxchandan avatar Jan 05 '20 08:01 itxchandan

Thank you @chandanndeep , this worked. But please consider changing the "Custom JS Files" Description to something like this:

desc

Also, all but the last sources are now in the form <script src="/misc/custom JS/set global variables.js" ,="" "=""></script>. The now appended ,="" "="" declarations are unnecessary. They cause my currently used plugins no trouble though it might be cleaner if the implementation of multiple Custom JS lines would be reworked.

Edit: It only worked, because I forgot to delete the " symbol in front of every ,, so my listed custom JS files actually looked like this:

/misc/custom JS/set global variables.js",
/misc/custom JS/get display mode.js",
/misc/custom JS/set display mode.js",
/misc/custom JS/set Menu Toggle.js",
/misc/custom JS/hide header on scroll.js",
/misc/custom JS/JDBuilder/set Accordion Mode.js",
/misc/custom JS/JDBuilder/toggle Tab.js",
/misc/custom JS/astroid.js"

If I remove the " and only set a ,, the problem persists.

Edit 2: What actually fixed the issue was to put a " behind every line, not a ,:

/misc/custom JS/set global variables.js"
/misc/custom JS/get display mode.js"
/misc/custom JS/set display mode.js"
/misc/custom JS/set Menu Toggle.js"
/misc/custom JS/hide header on scroll.js"
/misc/custom JS/JDBuilder/set Accordion Mode.js"
/misc/custom JS/JDBuilder/toggle Tab.js"
/misc/custom JS/astroid.js"

Now, no line feed character is put into the src= attribute. I consider this only as a workaround and no a solution though.

FaySmash avatar Jan 05 '20 12:01 FaySmash

@FaySmash

I found, space in file name. Don't use space while creating directory.

Please confirm the astroid version.

itxchandan avatar Jan 06 '20 04:01 itxchandan

@chandanndeep I tried replacing all spaces with _ in the whole file path but this won't change the fact, that a line feed character is but into the src= attribute. Please note the Edit of my previous comment too.

I'm running astroid 2.3.0

FaySmash avatar Jan 06 '20 08:01 FaySmash

Sure.

itxchandan avatar Jan 10 '20 12:01 itxchandan

@FaySmash Sorry for late reply.

Is your query solved?

itxchandan avatar Apr 21 '20 12:04 itxchandan

@chandanndeep no, I used a workaround by importing resources like this:

workaround

It's sub-optimal thought.

FaySmash avatar Apr 21 '20 14:04 FaySmash

@FaySmash

Try without double quote

/misc/custom JS/set global variables.js
/misc/custom JS/get display mode.js
/misc/custom JS/set display mode.js
/misc/custom JS/set Menu Toggle.js
/misc/custom JS/hide header on scroll.js
/misc/custom JS/JDBuilder/set Accordion Mode.js
/misc/custom JS/JDBuilder/toggle Tab.js
/misc/custom JS/astroid.js

itxchandan avatar Apr 21 '20 18:04 itxchandan

@FaySmash

Try without double quote

/misc/custom JS/set global variables.js
/misc/custom JS/get display mode.js
/misc/custom JS/set display mode.js
/misc/custom JS/set Menu Toggle.js
/misc/custom JS/hide header on scroll.js
/misc/custom JS/JDBuilder/set Accordion Mode.js
/misc/custom JS/JDBuilder/toggle Tab.js
/misc/custom JS/astroid.js

Compare this listing of resources with mine in the OP, it's exactly the same and and therefore the problem still persists.

FaySmash avatar Apr 23 '20 12:04 FaySmash

It's working perfect. See the screenshot.

Make sure you have not changed custom.php the file or override

Backend

image

Frontend

image

itxchandan avatar Apr 29 '20 11:04 itxchandan

Have you tried to right click on one of the highlighted rows and select "Edit as HTML"? Only then the line break will be visible.

FaySmash avatar Apr 29 '20 11:04 FaySmash