Announcement

#1 2020-11-09 20:54:16

TheDoc
Member
Munich / Germany
2015-10-18
173

Error in combine_script?

Hi,

while debugging my issue from https://piwigo.org/forum/viewtopic.php?id=30726 I have found the following:

I'm trying to include pannellum.js (https://github.com/mpetroff/pannellum/r … -2.5.6.zip) like this in my picture_content.tpl:

Code:

{combine_script id='pannellum' path=$PIWIGOPANORAMA_PATH|cat:'template/lib/pannellum/pannellum.js' load='async'}

In the js that is sent to the browser I can find the corresponding entry (e.g. in http://www.feuster.com/piwigo/_data/combined/semmbs.js) for

/*BEGIN ./plugins/piwigo-panorama/template/lib/pannellum/pannellum.js */...

BUT that can't be loaded since its not valid js!.

If I paste the js code into a developer console I get an error message "Uncaught SyntaxError: unmatched ) in regular expression" around

Code:

function qa(a){return/^(?:[a-z]+:)?\/\U,!1)

If I paste the original pannellum.js (which looks different around that function) in the console I don't get any error message and my image is shown as a 360° panorama.

Questions:

* Is there any way I can influence the behavior of combine_script to simply include the minified js without further changes?
* Is that a known behavior / feature of combine_script?

I could provide the js code in question, but its to long to be simply added here...

Piwigo URL: http://bilder.feuster.com
    Piwigo 2.10.2 Check for upgrade
    Operating system: Linux
    PHP: 7.3.24 (Show info) [2020-11-08 21:17:40]
    MySQL: 5.5.60-0+deb7u1-log [2020-11-08 21:17:40]
    Graphics Library: External ImageMagick 6.9.10-23

Offline

 

#2 2020-11-10 05:36:22

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7235

Re: Error in combine_script?

Hi :-)

have you assign "PIWIGOPANORAMA_PATH" for template ?


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2020-11-10 17:08:42

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Error in combine_script?

Yes, I have. As I said above, you can see the included js e.g. in  http://www.feuster.com/piwigo/_data/combined/semmbs.js. Thats also where I extracted the code to paste in the webdeveloper console to find the error...

Offline

 

#4 2020-11-11 16:05:15

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Error in combine_script?

Next step: I have manually upgraded to JShrink v1.3.3 but the issue still remains.

If I compare the included js with the original one I can see the following:

Original js:

Code:

function qa(a){return/^(?:[a-z]+:)?\/\//i.test(a)||"/"==a[0]||"blob:"==a.slice(0,5)}function pa()...

until an end of line.

js after JShrink:

Code:

function qa(a){return/^(?:[a-z]+:)?\/\U,!1),J.addEventListener(...

Where everything after \/\ til the end of the line is omitted and U,!1) is the first stuff on the new line. So it seems that JShrink can't handle the combination "\/\//" properly!

I will ask JShrink for this. But in the meantime: is there any option to switch of minifying of js with some parameter?

Offline

 

#5 2020-11-11 19:17:08

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Error in combine_script?

Found a workaround :-)

Rename pannellum.js to pannellum.min.js

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact