Closed unverbuggt closed 1 year ago
Regarding your remarks about this function, I haven't found any acceptable ways to do what you want.
Using eval()
may be the correct method, but... I don't want to use it.
I therefore decide not to implement your proposal for the moment (in the hope of finding something better). However, you can implement your reload function yourself, by using the new override default templates in Version 2.3.0.
you are right, the use if eval
is not a good practice.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval?retiredLocale=de#never_use_eval!
Hi,
in one of my projects I wanted to include small javscript code in an encrypted page which shouldn't be readable without knowing the password. So reload_js was not an option, besides it requires jquery which I do not use in my theme.
I made some small changes to find a script id and eval it on successful decryption: plugin.py
decrypt-contents.tpl.js
here is an example configuration: eval_script_id_example.zip It's a bit tricky, because if you simply declare a function it won't be usable by f.ex. onClick events. the function needs to be declared in a
window.newfunction = function() { ... }
style, but see the example.I'll just leave it here as suggestion. It's probably not the most elegant way (because it is a bit tricky and required adjusting the javascript code) but i works for me. Another suggestion would be to rewrite the reload_js function not to use jquery.