diff --git a/docroot/core/includes/anonymous.inc b/docroot/core/includes/anonymous.inc index eeb37ae6..c606ee31 100644 --- a/docroot/core/includes/anonymous.inc +++ b/docroot/core/includes/anonymous.inc @@ -9,7 +9,8 @@ * use of the AnonymousUser class in places where different kinds of users are * listed together. */ -class AnonymousUser implements UserInterface { +class AnonymousUser extends stdClass implements UserInterface { + public $uid = 0; public $name = NULL; public $hostname = NULL; diff --git a/docroot/core/includes/bootstrap.inc b/docroot/core/includes/bootstrap.inc index c5d57501..5ac2546b 100644 --- a/docroot/core/includes/bootstrap.inc +++ b/docroot/core/includes/bootstrap.inc @@ -7,7 +7,7 @@ /** * The current system version. */ -define('BACKDROP_VERSION', '1.25.1'); +define('BACKDROP_VERSION', '1.26.0'); /** * Core API compatibility. diff --git a/docroot/core/includes/common.inc b/docroot/core/includes/common.inc index 8464ad6e..678278fc 100644 --- a/docroot/core/includes/common.inc +++ b/docroot/core/includes/common.inc @@ -3044,19 +3044,6 @@ function backdrop_deliver_html_page($page_callback_result) { backdrop_add_http_header('X-Frame-Options', $frame_options); } - if ($site_config->get('block_interest_cohort')) { - $permissions_policy = backdrop_get_http_header('Permissions-Policy'); - if (is_null($permissions_policy)) { - backdrop_add_http_header('Permissions-Policy', 'interest-cohort=()'); - } - else { - // Only add interest-cohort if the header does not contain it already. - if (strpos($permissions_policy, 'interest-cohort') === FALSE) { - backdrop_add_http_header('Permissions-Policy', 'interest-cohort=()', TRUE); - } - } - } - // Menu status constants are integers; page content is a string or array. if (is_int($page_callback_result)) { // @todo: Break these up into separate functions? diff --git a/docroot/core/includes/config.inc b/docroot/core/includes/config.inc index 29f495c7..f4535eef 100644 --- a/docroot/core/includes/config.inc +++ b/docroot/core/includes/config.inc @@ -270,19 +270,27 @@ function config_load_multiple($names, $type = 'active') { } /** - * Moves the default config supplied by a module to the live config directory. + * Moves the default config supplied by a project to the live config directory. * - * @param string $module - * The name of the module we are installing. + * @param string $project + * The name of the project we are installing. * @param string|NULL $config_name * (optional) If wanting to copy just a single configuration file from the - * module, specify the configuration file name without the extension. + * project, specify the configuration file name without the extension. + * + * @since 1.26.0 First parameter changed from $module to $project. */ -function config_install_default_config($module, $config_name = NULL) { - $module_config_dir = backdrop_get_path('module', $module) . '/config'; - if (is_dir($module_config_dir)) { - $storage = new ConfigFileStorage($module_config_dir); - $files = glob($module_config_dir . '/*.json'); +function config_install_default_config($project, $config_name = NULL) { + $project_path = NULL; + foreach (array('module', 'theme') as $project_type) { + if ($project_path = backdrop_get_path($project_type, $project)) { + break; + } + } + $project_config_dir = $project_path . '/config'; + if (is_dir($project_config_dir)) { + $storage = new ConfigFileStorage($project_config_dir); + $files = glob($project_config_dir . '/*.json'); foreach ($files as $file) { // Load config data into the active store and write it out to the // file system in the Backdrop config directory. Note the config name @@ -305,11 +313,25 @@ function config_install_default_config($module, $config_name = NULL) { } /** - * Uninstall all the configuration provided by a module. + * Uninstall all the configuration provided by a project. + * + * @param string $project + * The name of the project we are uninstalling. + * @param string|NULL $config_name + * (optional) If wanting to remove just a single configuration file from the + * project, specify the configuration file name without the extension. + * + * @since 1.26.0 First parameter changed from $module to $project. */ -function config_uninstall_config($module, $config_name = NULL) { - backdrop_load('module', $module); - if ($configs = module_invoke($module, 'config_info')) { +function config_uninstall_config($project, $config_name = NULL) { + // If this is a theme key, load the matching template.php file. + if (!backdrop_load('module', $project) && $theme_path = backdrop_get_path('theme', $project)) { + if (file_exists($theme_path . '/template.php')) { + include_once $theme_path . '/template.php'; + } + } + + if ($configs = module_invoke($project, 'config_info')) { foreach ($configs as $config_name => $config_info) { if (isset($config_info['name_key'])) { $sub_names = config_get_names_with_prefix($config_name . '.'); diff --git a/docroot/core/includes/database/database.inc b/docroot/core/includes/database/database.inc index 7f921109..b028c36a 100644 --- a/docroot/core/includes/database/database.inc +++ b/docroot/core/includes/database/database.inc @@ -737,12 +737,12 @@ abstract class DatabaseConnection { if ($options['throw_exception']) { // Add additional debug information. if ($query instanceof DatabaseStatementInterface) { - $e->query_string = $stmt->getQueryString(); + $e->errorInfo['query_string'] = $stmt->getQueryString(); } else { - $e->query_string = $query; + $e->errorInfo['query_string'] = $query; } - $e->args = $args; + $e->errorInfo['args'] = $args; throw $e; } return NULL; diff --git a/docroot/core/includes/database/query.inc b/docroot/core/includes/database/query.inc index 4ab62bea..88e5fbf5 100644 --- a/docroot/core/includes/database/query.inc +++ b/docroot/core/includes/database/query.inc @@ -1283,6 +1283,13 @@ class MergeQuery extends Query implements QueryConditionInterface { */ protected $table; + /** + * The condition object for this query. + * + * @var DatabaseCondition + */ + protected $condition; + /** * An array of fields on which to insert. * diff --git a/docroot/core/includes/date.class.inc b/docroot/core/includes/date.class.inc index c7720922..d21e89a7 100644 --- a/docroot/core/includes/date.class.inc +++ b/docroot/core/includes/date.class.inc @@ -9,6 +9,24 @@ class BackdropDateTime extends DateTime { public $granularity = array(); public $errors = array(); + + /** + * @var bool + */ + public $dateOnly; + + /** + * @var bool + */ + public $timeOnly; + + /** + * Date string, timestamp or indexed date array. + * + * @var string|int|array + */ + public $originalTime; + protected static $allgranularity = array( 'year', 'month', diff --git a/docroot/core/includes/errors.inc b/docroot/core/includes/errors.inc index 1334d586..2445b5bb 100644 --- a/docroot/core/includes/errors.inc +++ b/docroot/core/includes/errors.inc @@ -107,8 +107,8 @@ function _backdrop_decode_exception($exception) { // We remove that call. array_shift($backtrace); } - if (isset($exception->query_string, $exception->args)) { - $message .= ": " . $exception->query_string . "; " . print_r($exception->args, TRUE); + if (isset($exception->errorInfo['query_string'], $exception->errorInfo['args'])) { + $message .= ": " . $exception->errorInfo['query_string'] . "; " . print_r($exception->errorInfo['args'], TRUE); } } $caller = _backdrop_get_last_caller($backtrace); diff --git a/docroot/core/includes/filetransfer/filetransfer.inc b/docroot/core/includes/filetransfer/filetransfer.inc index bdc0a55c..56337b50 100644 --- a/docroot/core/includes/filetransfer/filetransfer.inc +++ b/docroot/core/includes/filetransfer/filetransfer.inc @@ -16,6 +16,16 @@ abstract class FileTransfer { protected $hostname = 'localhost'; protected $port; + /** + * @var string + */ + protected $jail; + + /** + * @var string + */ + protected $chroot; + /** * The constructor for the UpdateConnection class. This method is also called * from the classes that extend this class and override this method. diff --git a/docroot/core/includes/form.inc b/docroot/core/includes/form.inc index 7c970d0f..725e65e2 100644 --- a/docroot/core/includes/form.inc +++ b/docroot/core/includes/form.inc @@ -3023,7 +3023,7 @@ function form_process_password_confirm($element) { '#title' => t('New password'), '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'], '#required' => $element['#required'], - '#attributes' => array('class' => array('password-field')), + '#attributes' => $element['#attributes'] + array('class' => array('password-field')), '#password_strength' => TRUE, '#password_shown' => FALSE, '#password_toggle' => FALSE, @@ -3033,7 +3033,7 @@ function form_process_password_confirm($element) { '#title' => t('Confirm new password'), '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'], '#required' => $element['#required'], - '#attributes' => array('class' => array('password-confirm')), + '#attributes' => $element['#attributes'] + array('class' => array('password-confirm')), '#password_strength' => FALSE, '#password_shown' => FALSE, '#password_toggle' => FALSE, @@ -4750,6 +4750,8 @@ function theme_textarea($variables) { function theme_password($variables) { $element = $variables['element']; $element['#attributes']['type'] = 'password'; + $element['#attributes']['spellcheck'] = !empty($element['#attributes']['spellcheck']) ? $element['#attributes']['spellcheck'] : 'false'; + element_set_attributes($element, array('id', 'name', 'size', 'maxlength', 'placeholder')); _form_set_class($element, array('form-text')); diff --git a/docroot/core/includes/session.inc b/docroot/core/includes/session.inc index 846721cb..06afbfbc 100644 --- a/docroot/core/includes/session.inc +++ b/docroot/core/includes/session.inc @@ -359,7 +359,7 @@ function backdrop_session_regenerate() { global $user, $is_https; // Nothing to do if we are not allowed to change the session. if (!backdrop_save_session()) { - return TRUE; + return; } if ($is_https && settings_get('https', FALSE)) { @@ -421,7 +421,6 @@ function backdrop_session_regenerate() { $user = $account; } date_default_timezone_set(backdrop_get_user_timezone()); - return TRUE; } /** diff --git a/docroot/core/includes/theme.inc b/docroot/core/includes/theme.inc index 0d430f81..7432aa56 100644 --- a/docroot/core/includes/theme.inc +++ b/docroot/core/includes/theme.inc @@ -1499,6 +1499,9 @@ function theme_get_setting($setting_name, $theme = NULL) { * TRUE if the theme has settings, FALSE otherwise. */ function theme_has_settings($theme) { + if (config_get_names_with_prefix($theme . '.settings')) { + return TRUE; + } $themes = list_themes(); $theme_info = $themes[$theme]; if (!empty($theme_info->info['settings'])) { @@ -1643,6 +1646,9 @@ function theme_enable($theme_list) { ->condition('type', 'theme') ->condition('name', $key) ->execute(); + + // Copy any default configuration data to the system config directory. + config_install_default_config($key); } list_themes(TRUE); @@ -1676,6 +1682,8 @@ function theme_disable($theme_list) { ->condition('type', 'theme') ->condition('name', $key) ->execute(); + + config_uninstall_config($key); } list_themes(TRUE); diff --git a/docroot/core/includes/updater.inc b/docroot/core/includes/updater.inc index 3ace8e94..3a6e7780 100644 --- a/docroot/core/includes/updater.inc +++ b/docroot/core/includes/updater.inc @@ -72,6 +72,16 @@ abstract class Updater implements BackdropUpdaterInterface { */ public $source; + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $title; + public function __construct($source) { $this->source = $source; $this->name = self::getProjectName($source); diff --git a/docroot/core/layouts/boxton/boxton.info b/docroot/core/layouts/boxton/boxton.info index f8051e8e..eee454cf 100644 --- a/docroot/core/layouts/boxton/boxton.info +++ b/docroot/core/layouts/boxton/boxton.info @@ -25,7 +25,7 @@ preview = boxton.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/geary/geary.info b/docroot/core/layouts/geary/geary.info index 92818a1f..b496d639 100644 --- a/docroot/core/layouts/geary/geary.info +++ b/docroot/core/layouts/geary/geary.info @@ -27,7 +27,7 @@ preview = geary.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/harris/harris.info b/docroot/core/layouts/harris/harris.info index a72f42b9..80707276 100644 --- a/docroot/core/layouts/harris/harris.info +++ b/docroot/core/layouts/harris/harris.info @@ -27,7 +27,7 @@ preview = harris.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/legacy/one_column/one_column.info b/docroot/core/layouts/legacy/one_column/one_column.info index a9cfef28..d7b208ac 100644 --- a/docroot/core/layouts/legacy/one_column/one_column.info +++ b/docroot/core/layouts/legacy/one_column/one_column.info @@ -18,7 +18,7 @@ regions[footer] = Footer ; Modify this line if you would like to change the default in this layout. default region = content -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/legacy/three_three_four_column/three_three_four_column.info b/docroot/core/layouts/legacy/three_three_four_column/three_three_four_column.info index 9bd48442..47acc53d 100644 --- a/docroot/core/layouts/legacy/three_three_four_column/three_three_four_column.info +++ b/docroot/core/layouts/legacy/three_three_four_column/three_three_four_column.info @@ -26,7 +26,7 @@ regions[footer] = Footer bottom ; Modify this line if you would like to change the default in this layout. default region = content -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/legacy/two_column/two_column.info b/docroot/core/layouts/legacy/two_column/two_column.info index b9f00573..112511c5 100644 --- a/docroot/core/layouts/legacy/two_column/two_column.info +++ b/docroot/core/layouts/legacy/two_column/two_column.info @@ -15,7 +15,7 @@ regions[footer] = Footer ; Modify this line if you would like to change the default in this layout. default region = content -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/legacy/two_column_flipped/two_column_flipped.info b/docroot/core/layouts/legacy/two_column_flipped/two_column_flipped.info index 0d85806b..7b512c4b 100644 --- a/docroot/core/layouts/legacy/two_column_flipped/two_column_flipped.info +++ b/docroot/core/layouts/legacy/two_column_flipped/two_column_flipped.info @@ -15,7 +15,7 @@ regions[footer] = Footer ; Modify this line if you would like to change the default in this layout. default region = content -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/moscone/moscone.info b/docroot/core/layouts/moscone/moscone.info index 32f76d6f..21c36ba5 100644 --- a/docroot/core/layouts/moscone/moscone.info +++ b/docroot/core/layouts/moscone/moscone.info @@ -26,7 +26,7 @@ preview = moscone.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/moscone_flipped/moscone_flipped.info b/docroot/core/layouts/moscone_flipped/moscone_flipped.info index 96911580..2018d874 100644 --- a/docroot/core/layouts/moscone_flipped/moscone_flipped.info +++ b/docroot/core/layouts/moscone_flipped/moscone_flipped.info @@ -26,7 +26,7 @@ preview = moscone-flipped.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/rolph/rolph.info b/docroot/core/layouts/rolph/rolph.info index 642a55bd..d27ae27a 100644 --- a/docroot/core/layouts/rolph/rolph.info +++ b/docroot/core/layouts/rolph/rolph.info @@ -28,7 +28,7 @@ preview = rolph.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/simmons/simmons.info b/docroot/core/layouts/simmons/simmons.info index 3eab8664..0a30ac6b 100644 --- a/docroot/core/layouts/simmons/simmons.info +++ b/docroot/core/layouts/simmons/simmons.info @@ -34,7 +34,7 @@ file = simmons.php ; Default stylesheets for this layout ; stylesheets[all][] = simmons.css -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/sutro/sutro.info b/docroot/core/layouts/sutro/sutro.info index be331709..62056054 100644 --- a/docroot/core/layouts/sutro/sutro.info +++ b/docroot/core/layouts/sutro/sutro.info @@ -27,7 +27,7 @@ preview = sutro.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/taylor/taylor.info b/docroot/core/layouts/taylor/taylor.info index ad792a55..05680502 100644 --- a/docroot/core/layouts/taylor/taylor.info +++ b/docroot/core/layouts/taylor/taylor.info @@ -27,7 +27,7 @@ preview = taylor.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/layouts/taylor_flipped/taylor_flipped.info b/docroot/core/layouts/taylor_flipped/taylor_flipped.info index ea2d4abc..f441342b 100644 --- a/docroot/core/layouts/taylor_flipped/taylor_flipped.info +++ b/docroot/core/layouts/taylor_flipped/taylor_flipped.info @@ -27,7 +27,7 @@ preview = taylor-flipped.png ; Include the Bootstrap4 Grid System libraries[] = bootstrap4-gs -; Added by Backdrop CMS packaging script on 2023-06-07 +; Added by Backdrop CMS packaging script on 2023-09-15 project = backdrop -version = 1.25.1 -timestamp = 1686169096 +version = 1.26.0 +timestamp = 1694823391 diff --git a/docroot/core/misc/ajax.js b/docroot/core/misc/ajax.js index 3cdac899..46d4785a 100644 --- a/docroot/core/misc/ajax.js +++ b/docroot/core/misc/ajax.js @@ -258,7 +258,7 @@ Backdrop.ajax = function (base, element, element_settings) { } // Bind the ajaxSubmit function to the element event. - $(ajax.element).bind(element_settings.event, function (event) { + $(ajax.element).on(element_settings.event, function (event) { if (!Backdrop.settings.urlIsAjaxTrusted[ajax.url] && !Backdrop.urlIsLocal(ajax.url)) { throw new Error(Backdrop.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url})); } @@ -269,7 +269,7 @@ Backdrop.ajax = function (base, element, element_settings) { // can be triggered through keyboard input as well as e.g. a mousedown // action. if (element_settings.keypress) { - $(ajax.element).keypress(function (event) { + $(ajax.element).on('keypress', function (event) { return ajax.keypressResponse(this, event); }); } @@ -278,7 +278,7 @@ Backdrop.ajax = function (base, element, element_settings) { // For example, prevent the browser default action of a click, even if the // AJAX behavior binds to mousedown. if (element_settings.prevent) { - $(ajax.element).bind(element_settings.prevent, false); + $(ajax.element).on(element_settings.prevent, false); } }; diff --git a/docroot/core/misc/autocomplete.js b/docroot/core/misc/autocomplete.js index 4b5ae47e..245bf0eb 100644 --- a/docroot/core/misc/autocomplete.js +++ b/docroot/core/misc/autocomplete.js @@ -14,7 +14,7 @@ Backdrop.behaviors.autocomplete = { var $input = $('#' + this.id.substr(0, this.id.length - 13)) .attr('autocomplete', 'OFF') .attr('aria-autocomplete', 'list'); - $($input[0].form).submit(Backdrop.autocompleteSubmit); + $($input[0].form).on('submit', Backdrop.autocompleteSubmit); $input.parent() .attr('role', 'application') .append($('') @@ -47,9 +47,9 @@ Backdrop.jsAC = function ($input, db) { this.db = db; $input - .keydown(function (event) { return ac.onkeydown(this, event); }) - .keyup(function (event) { ac.onkeyup(this, event); }) - .blur(function () { ac.hidePopup(); ac.db.cancel(); }); + .on('keydown', function (event) { return ac.onkeydown(this, event); }) + .on('keyup', function (event) { ac.onkeyup(this, event); }) + .on('blur', function () { ac.hidePopup(); ac.db.cancel(); }); }; /** diff --git a/docroot/core/misc/autosubmit.js b/docroot/core/misc/autosubmit.js index a4c4fede..c91cc207 100644 --- a/docroot/core/misc/autosubmit.js +++ b/docroot/core/misc/autosubmit.js @@ -39,7 +39,7 @@ Backdrop.behaviors.autosubmit = { // 'this' references the form element function triggerSubmit (e) { var $this = $(this); - $this.find('.autosubmit-click').click(); + $this.find('.autosubmit-click').trigger('click'); } // the change event bubbles so we only need to bind it to the outer form @@ -47,7 +47,7 @@ Backdrop.behaviors.autosubmit = { .add('.autosubmit', context) .filter('form, select, input:not(:text, :submit)') .once('autosubmit') - .change(function (e) { + .on('change', function (e) { // don't trigger on text change for full-form if ($(e.target).is(':not(:text, :submit, .autosubmit-exclude)')) { triggerSubmit.call(e.target.form); @@ -79,17 +79,17 @@ Backdrop.behaviors.autosubmit = { // each textinput element has his own timeout var timeoutID = 0; $(this) - .bind('keydown keyup', function (e) { + .on('keydown keyup', function (e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID && clearTimeout(timeoutID); } }) - .keyup(function(e) { + .on('keyup', function(e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); } }) - .bind('change', function (e) { + .on('change', function (e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); } diff --git a/docroot/core/misc/backdrop.js b/docroot/core/misc/backdrop.js index 73282221..afd992a8 100644 --- a/docroot/core/misc/backdrop.js +++ b/docroot/core/misc/backdrop.js @@ -69,7 +69,7 @@ Backdrop.attachBehaviors = function (context, settings) { settings = settings || Backdrop.settings; // Execute all of them. $.each(Backdrop.behaviors, function () { - if ($.isFunction(this.attach)) { + if (typeof this.attach === 'function') { this.attach(context, settings); } }); @@ -121,7 +121,7 @@ Backdrop.detachBehaviors = function (context, settings, trigger) { trigger = trigger || 'unload'; // Execute all of them. $.each(Backdrop.behaviors, function () { - if ($.isFunction(this.detach)) { + if (typeof this.detach === 'function') { this.detach(context, settings, trigger); } }); @@ -250,7 +250,7 @@ Backdrop.stringReplace = function (str, args, keys) { } // If the array of keys is not passed then collect the keys from the args. - if (!$.isArray(keys)) { + if (!Array.isArray(keys)) { keys = []; for (var k in args) { if (args.hasOwnProperty(k)) { @@ -551,7 +551,7 @@ Backdrop.getSelection = function (element) { * This is primarily used by Backdrop.displayAjaxError(). */ Backdrop.beforeUnloadCalled = false; -$(window).bind('beforeunload pagehide', function () { +$(window).on('beforeunload pagehide', function () { Backdrop.beforeUnloadCalled = true; }); diff --git a/docroot/core/misc/collapse.js b/docroot/core/misc/collapse.js index b3a0652f..a3673a38 100644 --- a/docroot/core/misc/collapse.js +++ b/docroot/core/misc/collapse.js @@ -69,8 +69,8 @@ Backdrop.behaviors.collapse = { var summary = $(''); $fieldset. - bind('summaryUpdated', function () { - var text = $.trim($fieldset.backdropGetSummary()); + on('summaryUpdated', function () { + var text = $fieldset.backdropGetSummary(); summary.html(text ? text : ''); }) .trigger('summaryUpdated'); @@ -88,7 +88,7 @@ Backdrop.behaviors.collapse = { var $link = $('') .prepend($legend.contents()) .appendTo($legend) - .click(function () { + .on('click', function () { var fieldset = $fieldset.get(0); // Don't animate multiple times. if (!fieldset.animating) { diff --git a/docroot/core/misc/dialog.js b/docroot/core/misc/dialog.js index 3ffbab68..f9f7e274 100644 --- a/docroot/core/misc/dialog.js +++ b/docroot/core/misc/dialog.js @@ -79,17 +79,19 @@ Backdrop.dialog = function (element, options) { // Because of Chromium's behavior, we must wait until the ajax-loaded // jquery.ui.dialog.css is applied. var computedStyle = getComputedStyle($element[0]); - var waitForCss = function() { + var waitForCss = function(counter) { var cssOverflowProperty = computedStyle.getPropertyValue('overflow'); - // If the overflow is not 'auto' yet, schedule this function again. - if (cssOverflowProperty != 'auto') { - setTimeout(waitForCss, 10); + // If the overflow is not 'auto' or 'hidden' yet, schedule this function + // again, but prevent infinite loops for dialogs that use a different + // overflow. + if (cssOverflowProperty != 'auto' && cssOverflowProperty != 'hidden' && counter < 10) { + setTimeout(waitForCss, 10, ++counter); } else { resetPosition(); } } - setTimeout(waitForCss, 0); + setTimeout(waitForCss, 0, 0); } dialog.open = true; $(window).trigger('dialog:aftercreate', [dialog, $element, settings]); diff --git a/docroot/core/misc/dismiss.js b/docroot/core/misc/dismiss.js index 06c54a00..7fa95571 100644 --- a/docroot/core/misc/dismiss.js +++ b/docroot/core/misc/dismiss.js @@ -8,11 +8,11 @@ Backdrop.behaviors.dismiss = { attach: function (context, settings) { - $('.messages a.dismiss').click(function(event) { + $('.messages a.dismiss').on('click', function(event) { event.preventDefault(); $(this).parent().fadeOut('fast', function() { - if ($('.l-messages').children(':visible').size() == 0) { + if ($('.l-messages').children(':visible').length == 0) { $('.l-messages').hide(); } }); diff --git a/docroot/core/misc/dropbutton.js b/docroot/core/misc/dropbutton.js index 43032bcc..205b8d89 100644 --- a/docroot/core/misc/dropbutton.js +++ b/docroot/core/misc/dropbutton.js @@ -22,6 +22,46 @@ Backdrop.behaviors.dropButton = { } }; +/** + * Set the min-width of dropbuttons (and their parent) to handle all of the + * link widths. + */ +Backdrop.behaviors.dropButtonWidths = { + attach: function(context, settings) { + function adjustDropButtonWidths() { + var $dropbutton = $(this); + + // Get widest item width. + var widestItem = 0, $item; + $dropbutton.find('li:hidden').each(function() { + // Use a clone element to avoid altering element CSS properties. + $item = $(this).clone().insertAfter($(this)).show().css('visibility','hidden'); + widestItem = Math.max($item.outerWidth(), widestItem); + $item.remove(); + }); + + // Set dropbutton list (