Commit 83bde0f5 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#193804 by starbow, Rob Loach, Wim Leers: add often used basePath setting by...

#193804 by starbow, Rob Loach, Wim Leers: add often used basePath setting by defualt to JS settings, also providing an elegant bugfix to #201248
parent cf790b5a
......@@ -1934,14 +1934,20 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
if (isset($data)) {
// Add jquery.js and drupal.js the first time a Javascript file is added.
// Add jquery.js and drupal.js, as well as the basePath setting, the
// first time a Javascript file is added.
if (empty($javascript)) {
$javascript['header'] = array(
'core' => array(
'misc/jquery.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
'misc/drupal.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
),
'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array(),
'module' => array(),
'theme' => array(),
'setting' => array(
array('basePath' => base_path()),
),
'inline' => array(),
);
}
......
......@@ -14,7 +14,7 @@ Drupal.behaviors.cleanURLsSettingsCheck = function(context) {
if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
return;
}
var url = location.pathname +"admin/settings/clean-urls/check";
var url = Drupal.settings.basePath +"admin/settings/clean-urls/check";
$("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
$("#clean-url p").hide();
$.ajax({
......@@ -42,7 +42,7 @@ Drupal.behaviors.cleanURLsSettingsCheck = function(context) {
* are currently enabled.
*/
Drupal.cleanURLsInstallCheck = function() {
var url = location.protocol +"//"+ location.host + location.pathname.replace(/\/[^\/]*$/, "/") +"admin/settings/clean-urls/check";
var url = location.protocol +"//"+ location.host + Drupal.settings.basePath +"admin/settings/clean-urls/check";
$("#clean-url .description").append('<span><div id="testing">'+ Drupal.settings.cleanURL.testing +"</div></span>");
$("#clean-url.install").css("display", "block");
$.ajax({
......@@ -85,7 +85,7 @@ Drupal.behaviors.copyFieldValue = function (context) {
sourceField.addClass('copy-field-values-processed');
}
}
}
};
/**
* Show/hide custom format sections on the date-time settings page.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment