Hi,
as "promised" in https://piwigo.org/forum/viewtopic.php?id=28360 I'm currently trying to add support for pannellum.js to view google panoramas. During this I have run into the following problem:
1) I include pannellum.js & my own "starter" js via picture_content.tpl
This seems to work (see the source of http://www.feuster.com/piwigo/picture?/ … 49-bologna and the loaded "_data/combined/xxxxxx.js" in the end)
2) in the "_data/combined/xxxxxx.js" I then have
/*BEGIN ./plugins/piwigo-panorama/template/piwigopanorama.js */ jQuery(document).ready(function(){alert("Hello! I am an alert box!!");if(typeof panorama_options==='undefined'){return;} alert("Trying to load panorama with pannellum");pannellum.viewer('panorama',panorama_options);});
but the alert doesn't get executed. Any hint what I'm doing wrong here? Any way to debug this further?
Thanks,
Thomas
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
I imagine you do not post the whole content of _data/combined/xxx.js ! If there's another return somewhere, you're cannot be reached.
Offline
Actually, there are a lot of js-files that get included...
According to the documentation on $(document).ready all available handlers run as long as no error is thrown by any of them. And they are executed in order of appearance (https://stackoverflow.com/a/5263418). So here is a bit more code from the generated "_data/combined/xxxxxx.js":
/*BEGIN ./plugins/piwigo-panorama/template/piwigopanorama.js */ $(document).ready(function(){alert("Hello! I am an alert box!!");if(typeof panorama_options==='undefined'){return;} alert("Trying to load panorama with pannellum");pannellum.viewer('panorama',panorama_options);}); /*BEGIN local/js/my.imagemap.js */ $(document).ready(function(){$('#theMainImage').dynamicImageMap();});
What happens is that the one from my.imagemap.js gets executed but the one from piwigopanorama.js doesn't (at least there are no alerts popping up)...
Offline
Did you open the javascript console ?
You're right all $(function() {}) are executed but none of them are executed if one of them through an exception.
Offline
Yes, I now tried in the console and came up with a cause: the script as included by combine_script seems to be invalid js. See also https://piwigo.org/forum/viewtopic.php?id=30730. I'll wait for the resolution there and hopefully the issue here is resolved by this as well.
Offline
I have looked through the code and have found that the actual work is done inside of
JShrink_Minifier, breakdownScript()
Unfortunately, I have no idea what to do from here. There are options based to the minifier but they don't seem to be used during the processing in breakdownScript().^
Is there any way I can influence the behavior or dig further? The only way to fix this seems to be to include the pannellum.js myself and skip the combine_script part for it?
Any ideas welcome!
BTW: Last release of JShrink is v1.3.3. Piwigo seems to use 0.5.1? Maybe an upgrade might help?
Last edited by TheDoc (2020-11-10 21:47:26)
Offline