New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback for keepalive js #16452
Fallback for keepalive js #16452
Changes from 6 commits
08f3e2f
1fc04f9
5fee537
627391a
6913407
ed4a177
80d499b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,20 @@ | |
document.addEventListener('DOMContentLoaded', function() { | ||
|
||
var keepaliveOptions = Joomla.getOptions('system.keepalive'), | ||
keepaliveUri = keepaliveOptions.uri ? keepaliveOptions.uri.replace(/&/g, '&') : window.location.pathname, | ||
keepaliveInterval = keepaliveOptions.interval ? keepaliveOptions.interval : 45 * 1000; | ||
keepaliveUri = keepaliveOptions && keepaliveOptions.uri ? keepaliveOptions.uri.replace(/&/g, '&') : '', | ||
keepaliveInterval = keepaliveOptions && keepaliveOptions.interval ? keepaliveOptions.interval : 45 * 1000; | ||
|
||
// Fallback in case no keepalive uri was found. | ||
if (keepaliveUri === '') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this check only for empty string, for check all "false" cases use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes but i want to strict check for empty string :) see above keepaliveUri = keepaliveOptions && keepaliveOptions.uri ? keepaliveOptions.uri.replace(/&/g, '&') : '', There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay 😉 |
||
{ | ||
var systemPaths = Joomla.getOptions('system.paths'); | ||
|
||
keepaliveUri = (systemPaths ? systemPaths.root + '/index.php' : window.location.pathname) + '?option=com_ajax&format=json'; | ||
} | ||
|
||
window.setInterval(function() { | ||
Joomla.request({ | ||
url: keepaliveUri, | ||
url: keepaliveUri, | ||
onSuccess: function(response, xhr) | ||
{ | ||
// Do nothing | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to
'base' => JUri::base(true)
?