Skip to content

Commit

Permalink
Fixed loading additional javascripts
Browse files Browse the repository at this point in the history
The server side loader does limit to 10 files, but the client side code
happily generates more requests.

Depending on loaded pages, this could lead to some javascript files not
being loaded (eg. if you went to monitor directly from home page).

Fixes #13362

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Jun 6, 2017
1 parent 253c9be commit 58023e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog
- issue #13323 Fixed wrong encoding of table at triggers
- issue #12976 Fixed natural sorting in several places
- issue #12718 Show warning for users removed from mysql.user table
- issue #13362 Fixed loading additional javascripts

4.7.1 (2017-05-25)
- issue #13132 Always execute tracking queries as controluser
Expand Down
15 changes: 12 additions & 3 deletions js/ajax.js
Expand Up @@ -573,13 +573,19 @@ var AJAX = {
needRequest = true;
this.add(script);
request.push("scripts%5B%5D=" + script);
if (request.length >= 10) {
// Download scripts in chunks
this.appendScript(request);
request = [];
needRequest = false;
}
}
}
request.push("call_done=1");
request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
// Download the composite js file, if necessary
if (needRequest) {
this.appendScript("js/get_scripts.js.php?" + request.join("&"));
this.appendScript(request);
} else {
self.done(callback);
}
Expand All @@ -606,11 +612,14 @@ var AJAX = {
*
* @return void
*/
appendScript: function (url) {
appendScript: function (request) {
var head = document.head || document.getElementsByTagName('head')[0];
var script = document.createElement('script');

request.push("call_done=1");
request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
script.type = 'text/javascript';
script.src = url;
script.src = "js/get_scripts.js.php?" + request.join("&");
script.async = false;
head.appendChild(script);
},
Expand Down

0 comments on commit 58023e9

Please sign in to comment.