diff --git a/core/misc/dialog/dialog.ajax.js b/core/assets/components/dialog/dialog.ajax.js similarity index 100% rename from core/misc/dialog/dialog.ajax.js rename to core/assets/components/dialog/dialog.ajax.js diff --git a/core/misc/dialog/dialog.jquery-ui.js b/core/assets/components/dialog/dialog.jquery-ui.js similarity index 100% rename from core/misc/dialog/dialog.jquery-ui.js rename to core/assets/components/dialog/dialog.jquery-ui.js diff --git a/core/misc/dialog/dialog.js b/core/assets/components/dialog/dialog.js similarity index 100% rename from core/misc/dialog/dialog.js rename to core/assets/components/dialog/dialog.js diff --git a/core/misc/dialog/dialog.position.js b/core/assets/components/dialog/dialog.position.js similarity index 100% rename from core/misc/dialog/dialog.position.js rename to core/assets/components/dialog/dialog.position.js diff --git a/core/misc/dialog.theme.css b/core/assets/components/dialog/dialog.theme.css similarity index 100% rename from core/misc/dialog.theme.css rename to core/assets/components/dialog/dialog.theme.css diff --git a/core/misc/dropbutton/dropbutton.css b/core/assets/components/dropbutton/dropbutton.css similarity index 100% rename from core/misc/dropbutton/dropbutton.css rename to core/assets/components/dropbutton/dropbutton.css diff --git a/core/misc/dropbutton/dropbutton.js b/core/assets/components/dropbutton/dropbutton.js similarity index 100% rename from core/misc/dropbutton/dropbutton.js rename to core/assets/components/dropbutton/dropbutton.js diff --git a/core/misc/dropbutton/dropbutton.theme.css b/core/assets/components/dropbutton/dropbutton.theme.css similarity index 100% rename from core/misc/dropbutton/dropbutton.theme.css rename to core/assets/components/dropbutton/dropbutton.theme.css diff --git a/core/misc/print.css b/core/assets/css/print.css similarity index 100% rename from core/misc/print.css rename to core/assets/css/print.css diff --git a/core/misc/vertical-tabs.css b/core/assets/css/vertical-tabs.css similarity index 100% rename from core/misc/vertical-tabs.css rename to core/assets/css/vertical-tabs.css diff --git a/core/misc/active-link.js b/core/assets/js/active-link.js similarity index 100% rename from core/misc/active-link.js rename to core/assets/js/active-link.js diff --git a/core/misc/ajax.js b/core/assets/js/ajax.js similarity index 100% rename from core/misc/ajax.js rename to core/assets/js/ajax.js diff --git a/core/misc/announce.js b/core/assets/js/announce.js similarity index 100% rename from core/misc/announce.js rename to core/assets/js/announce.js diff --git a/core/misc/autocomplete.js b/core/assets/js/autocomplete.js similarity index 100% rename from core/misc/autocomplete.js rename to core/assets/js/autocomplete.js diff --git a/core/misc/batch.js b/core/assets/js/batch.js similarity index 100% rename from core/misc/batch.js rename to core/assets/js/batch.js diff --git a/core/misc/collapse.js b/core/assets/js/collapse.js similarity index 100% rename from core/misc/collapse.js rename to core/assets/js/collapse.js diff --git a/core/misc/debounce.js b/core/assets/js/debounce.js similarity index 100% rename from core/misc/debounce.js rename to core/assets/js/debounce.js diff --git a/core/misc/displace.js b/core/assets/js/displace.js similarity index 100% rename from core/misc/displace.js rename to core/assets/js/displace.js diff --git a/core/misc/drupal.js b/core/assets/js/drupal.js similarity index 100% copy from core/misc/drupal.js copy to core/assets/js/drupal.js diff --git a/core/misc/form.js b/core/assets/js/form.js similarity index 100% rename from core/misc/form.js rename to core/assets/js/form.js diff --git a/core/misc/jquery.intrinsic.js b/core/assets/js/jquery.intrinsic.js similarity index 100% rename from core/misc/jquery.intrinsic.js rename to core/assets/js/jquery.intrinsic.js diff --git a/core/misc/machine-name.js b/core/assets/js/machine-name.js similarity index 100% rename from core/misc/machine-name.js rename to core/assets/js/machine-name.js diff --git a/core/misc/progress.js b/core/assets/js/progress.js similarity index 100% rename from core/misc/progress.js rename to core/assets/js/progress.js diff --git a/core/misc/states.js b/core/assets/js/states.js similarity index 100% rename from core/misc/states.js rename to core/assets/js/states.js diff --git a/core/misc/tabbingmanager.js b/core/assets/js/tabbingmanager.js similarity index 100% rename from core/misc/tabbingmanager.js rename to core/assets/js/tabbingmanager.js diff --git a/core/misc/tabledrag.js b/core/assets/js/tabledrag.js similarity index 100% rename from core/misc/tabledrag.js rename to core/assets/js/tabledrag.js diff --git a/core/misc/tableheader.js b/core/assets/js/tableheader.js similarity index 100% rename from core/misc/tableheader.js rename to core/assets/js/tableheader.js diff --git a/core/misc/tableresponsive.js b/core/assets/js/tableresponsive.js similarity index 100% rename from core/misc/tableresponsive.js rename to core/assets/js/tableresponsive.js diff --git a/core/misc/tableselect.js b/core/assets/js/tableselect.js similarity index 100% rename from core/misc/tableselect.js rename to core/assets/js/tableselect.js diff --git a/core/misc/timezone.js b/core/assets/js/timezone.js similarity index 100% rename from core/misc/timezone.js rename to core/assets/js/timezone.js diff --git a/core/misc/vertical-tabs.js b/core/assets/js/vertical-tabs.js similarity index 100% rename from core/misc/vertical-tabs.js rename to core/assets/js/vertical-tabs.js diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 1a36202..212db50 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -45,7 +45,7 @@ domready: drupal: version: VERSION js: - misc/drupal.js: { weight: -18 } + assets/js/drupal.js: { weight: -18 } dependencies: - core/domready @@ -67,7 +67,7 @@ drupalSettings: drupal.active-link: version: VERSION js: - misc/active-link.js: {} + assets/js/active-link.js: {} dependencies: - core/drupal - core/drupalSettings @@ -76,7 +76,7 @@ drupal.active-link: drupal.ajax: version: VERSION js: - misc/ajax.js: {} + assets/js/ajax.js: {} dependencies: - core/jquery - core/drupal @@ -87,7 +87,7 @@ drupal.ajax: drupal.announce: version: VERSION js: - misc/announce.js: {} + assets/js/announce.js: {} dependencies: - core/drupal - core/drupal.debounce @@ -95,7 +95,7 @@ drupal.announce: drupal.autocomplete: version: VERSION js: - misc/autocomplete.js: { weight: -1 } + assets/js/autocomplete.js: { weight: -1 } dependencies: - core/jquery - core/drupal @@ -106,7 +106,7 @@ drupal.autocomplete: drupal.batch: version: VERSION js: - misc/batch.js: { cache: false } + assets/js/batch.js: { cache: false } dependencies: - core/jquery - core/drupal @@ -118,7 +118,7 @@ drupal.batch: drupal.collapse: version: VERSION js: - misc/collapse.js: {} + assets/js/collapse.js: {} dependencies: - core/jquery - core/modernizr @@ -129,7 +129,7 @@ drupal.collapse: drupal.debounce: version: VERSION js: - misc/debounce.js: {} + assets/js/debounce.js: {} dependencies: # @todo Remove Drupal dependency. - core/drupal @@ -137,12 +137,12 @@ drupal.debounce: drupal.dialog: version: VERSION js: - misc/dialog/dialog.js: {} - misc/dialog/dialog.position.js: {} - misc/dialog/dialog.jquery-ui.js: {} + assets/components/dialog/dialog.js: {} + assets/components/dialog/dialog.position.js: {} + assets/components/dialog/dialog.jquery-ui.js: {} css: theme: - misc/dialog.theme.css: {} + assets/components/dialog/dialog.theme.css: {} dependencies: - core/jquery - core/drupal @@ -154,7 +154,7 @@ drupal.dialog: drupal.dialog.ajax: version: VERSION js: - misc/dialog/dialog.ajax.js: {} + assets/components/dialog/dialog.ajax.js: {} dependencies: - core/jquery - core/drupal @@ -165,7 +165,7 @@ drupal.dialog.ajax: drupal.displace: version: VERSION js: - misc/displace.js: {} + assets/js/displace.js: {} dependencies: - core/jquery - core/drupal @@ -174,12 +174,12 @@ drupal.displace: drupal.dropbutton: version: VERSION js: - misc/dropbutton/dropbutton.js: {} + assets/components/dropbutton/dropbutton.js: {} css: component: - misc/dropbutton/dropbutton.css: {} + assets/components/dropbutton/dropbutton.css: {} theme: - misc/dropbutton/dropbutton.theme.css: {} + assets/components/dropbutton/dropbutton.theme.css: {} dependencies: - core/jquery - core/drupal @@ -189,7 +189,7 @@ drupal.dropbutton: drupal.form: version: VERSION js: - misc/form.js: {} + assets/js/form.js: {} dependencies: - core/jquery - core/drupal @@ -200,7 +200,7 @@ drupal.form: drupal.machine-name: version: VERSION js: - misc/machine-name.js: {} + assets/js/machine-name.js: {} dependencies: - core/jquery - core/jquery.once @@ -210,7 +210,7 @@ drupal.machine-name: drupal.progress: version: VERSION js: - misc/progress.js: {} + assets/js/progress.js: {} dependencies: - core/drupal - core/jquery @@ -219,7 +219,7 @@ drupal.progress: drupal.states: version: VERSION js: - misc/states.js: {} + assets/js/states.js: {} dependencies: - core/jquery - core/drupal @@ -229,7 +229,7 @@ drupal.states: drupal.tabbingmanager: version: VERSION js: - misc/tabbingmanager.js: {} + assets/js/tabbingmanager.js: {} dependencies: - core/jquery # Supplies the ':tabbable' pseudo selector. @@ -239,7 +239,7 @@ drupal.tabbingmanager: drupal.tabledrag: version: VERSION js: - misc/tabledrag.js: { weight: -1 } + assets/js/tabledrag.js: { weight: -1 } dependencies: - core/jquery - core/modernizr @@ -251,7 +251,7 @@ drupal.tabledrag: drupal.tableheader: version: VERSION js: - misc/tableheader.js: {} + assets/js/tableheader.js: {} dependencies: - core/jquery - core/drupal @@ -262,7 +262,7 @@ drupal.tableheader: drupal.tableresponsive: version: VERSION js: - misc/tableresponsive.js: {} + assets/js/tableresponsive.js: {} dependencies: - core/jquery - core/drupal @@ -271,7 +271,7 @@ drupal.tableresponsive: drupal.tableselect: version: VERSION js: - misc/tableselect.js: {} + assets/js/tableselect.js: {} dependencies: - core/drupal - core/jquery @@ -280,7 +280,7 @@ drupal.tableselect: drupal.timezone: version: VERSION js: - misc/timezone.js: {} + assets/js/timezone.js: {} dependencies: - core/jquery - core/jquery.once @@ -290,10 +290,10 @@ drupal.vertical-tabs: version: VERSION js: # Load before core/drupal.collapse. - misc/vertical-tabs.js: { weight: -1 } + assets/js/vertical-tabs.js: { weight: -1 } css: component: - misc/vertical-tabs.css: {} + assets/css/vertical-tabs.css: {} dependencies: - core/jquery - core/jquery.once @@ -364,7 +364,7 @@ jquery.form: jquery.intrinsic: version: VERSION js: - misc/jquery.intrinsic.js: {} + assets/js/jquery.intrinsic.js: {} dependencies: - core/jquery diff --git a/core/includes/common.inc b/core/includes/common.inc index 1c915e9..91db7d1 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1140,8 +1140,8 @@ function drupal_clean_id_identifier($id) { * * Examples: * @code - * _drupal_add_js('core/misc/collapse.js'); - * _drupal_add_js('core/misc/collapse.js', 'file'); + * _drupal_add_js('core/assets/js/collapse.js'); + * _drupal_add_js('core/assets/js/collapse.js', 'file'); * _drupal_add_js('http://example.com/example.js', 'external'); * _drupal_add_js(array('myModule' => array('key' => 'value')), 'setting'); * @endcode diff --git a/core/lib/Drupal/Core/Ajax/AddCssCommand.php b/core/lib/Drupal/Core/Ajax/AddCssCommand.php index ccd6312..d0a8a41 100644 --- a/core/lib/Drupal/Core/Ajax/AddCssCommand.php +++ b/core/lib/Drupal/Core/Ajax/AddCssCommand.php @@ -13,9 +13,9 @@ * An AJAX command for adding css to the page via ajax. * * This command is implemented by Drupal.AjaxCommands.prototype.add_css() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * - * @see misc/ajax.js + * @see assets/js/ajax.js * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/AfterCommand.php b/core/lib/Drupal/Core/Ajax/AfterCommand.php index 8674c73..78a2bd2 100644 --- a/core/lib/Drupal/Core/Ajax/AfterCommand.php +++ b/core/lib/Drupal/Core/Ajax/AfterCommand.php @@ -17,7 +17,7 @@ * given selector. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @see http://docs.jquery.com/Manipulation/after#content * diff --git a/core/lib/Drupal/Core/Ajax/AppendCommand.php b/core/lib/Drupal/Core/Ajax/AppendCommand.php index d758720..d6b92cb 100644 --- a/core/lib/Drupal/Core/Ajax/AppendCommand.php +++ b/core/lib/Drupal/Core/Ajax/AppendCommand.php @@ -17,7 +17,7 @@ * by the given selector. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @see http://docs.jquery.com/Manipulation/append#content * diff --git a/core/lib/Drupal/Core/Ajax/BeforeCommand.php b/core/lib/Drupal/Core/Ajax/BeforeCommand.php index 7e3e2ea..f85da16 100644 --- a/core/lib/Drupal/Core/Ajax/BeforeCommand.php +++ b/core/lib/Drupal/Core/Ajax/BeforeCommand.php @@ -17,7 +17,7 @@ * the given selector. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @see http://docs.jquery.com/Manipulation/before#content * diff --git a/core/lib/Drupal/Core/Ajax/ChangedCommand.php b/core/lib/Drupal/Core/Ajax/ChangedCommand.php index 2832d58..11491da 100644 --- a/core/lib/Drupal/Core/Ajax/ChangedCommand.php +++ b/core/lib/Drupal/Core/Ajax/ChangedCommand.php @@ -16,7 +16,7 @@ * given selector as 'ajax-changed'. * * This command is implemented by Drupal.AjaxCommands.prototype.changed() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/CssCommand.php b/core/lib/Drupal/Core/Ajax/CssCommand.php index 470d583..d960190 100644 --- a/core/lib/Drupal/Core/Ajax/CssCommand.php +++ b/core/lib/Drupal/Core/Ajax/CssCommand.php @@ -16,7 +16,7 @@ * apply the CSS arguments to elements matched by the given selector. * * This command is implemented by Drupal.AjaxCommands.prototype.css() defined - * in misc/ajax.js. + * in assets/js/ajax.js. * * @see http://docs.jquery.com/CSS/css#properties * diff --git a/core/lib/Drupal/Core/Ajax/DataCommand.php b/core/lib/Drupal/Core/Ajax/DataCommand.php index 5b40e30..d04bb3c 100644 --- a/core/lib/Drupal/Core/Ajax/DataCommand.php +++ b/core/lib/Drupal/Core/Ajax/DataCommand.php @@ -16,7 +16,7 @@ * selector via jQuery's data cache. * * This command is implemented by Drupal.AjaxCommands.prototype.data() defined - * in misc/ajax.js. + * in assets/js/ajax.js. * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/HtmlCommand.php b/core/lib/Drupal/Core/Ajax/HtmlCommand.php index b9c9568..0f181de 100644 --- a/core/lib/Drupal/Core/Ajax/HtmlCommand.php +++ b/core/lib/Drupal/Core/Ajax/HtmlCommand.php @@ -17,7 +17,7 @@ * leaving the outer tags intact. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @see http://docs.jquery.com/Attributes/html#val * diff --git a/core/lib/Drupal/Core/Ajax/InsertCommand.php b/core/lib/Drupal/Core/Ajax/InsertCommand.php index d1f0133..a84ebb9 100644 --- a/core/lib/Drupal/Core/Ajax/InsertCommand.php +++ b/core/lib/Drupal/Core/Ajax/InsertCommand.php @@ -17,7 +17,7 @@ * variable of the element that triggered the request. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/InvokeCommand.php b/core/lib/Drupal/Core/Ajax/InvokeCommand.php index 4aa1ea1..1da7e34 100644 --- a/core/lib/Drupal/Core/Ajax/InvokeCommand.php +++ b/core/lib/Drupal/Core/Ajax/InvokeCommand.php @@ -18,7 +18,7 @@ * removeClass(), toggleClass(), etc. * * This command is implemented by Drupal.AjaxCommands.prototype.invoke() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/PrependCommand.php b/core/lib/Drupal/Core/Ajax/PrependCommand.php index d977197..825bf30 100644 --- a/core/lib/Drupal/Core/Ajax/PrependCommand.php +++ b/core/lib/Drupal/Core/Ajax/PrependCommand.php @@ -17,7 +17,7 @@ * by the given selector. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @see http://docs.jquery.com/Manipulation/prepend#content * diff --git a/core/lib/Drupal/Core/Ajax/RemoveCommand.php b/core/lib/Drupal/Core/Ajax/RemoveCommand.php index f0e5aab..def44f8 100644 --- a/core/lib/Drupal/Core/Ajax/RemoveCommand.php +++ b/core/lib/Drupal/Core/Ajax/RemoveCommand.php @@ -17,7 +17,7 @@ * within them. * * This command is implemented by Drupal.AjaxCommands.prototype.remove() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @see http://docs.jquery.com/Manipulation/remove#expr * diff --git a/core/lib/Drupal/Core/Ajax/ReplaceCommand.php b/core/lib/Drupal/Core/Ajax/ReplaceCommand.php index fb2b9e5..69ec457 100644 --- a/core/lib/Drupal/Core/Ajax/ReplaceCommand.php +++ b/core/lib/Drupal/Core/Ajax/ReplaceCommand.php @@ -17,7 +17,7 @@ * selector with the given HTML. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * See * @link http://docs.jquery.com/Manipulation/replaceWith#content jQuery replaceWith command @endlink diff --git a/core/lib/Drupal/Core/Ajax/RestripeCommand.php b/core/lib/Drupal/Core/Ajax/RestripeCommand.php index 708344c..ffb59b9 100644 --- a/core/lib/Drupal/Core/Ajax/RestripeCommand.php +++ b/core/lib/Drupal/Core/Ajax/RestripeCommand.php @@ -16,7 +16,7 @@ * usually used after a table has been modified by a replace or append command. * * This command is implemented by Drupal.AjaxCommands.prototype.restripe() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/SettingsCommand.php b/core/lib/Drupal/Core/Ajax/SettingsCommand.php index a5a8dc8..c574756 100644 --- a/core/lib/Drupal/Core/Ajax/SettingsCommand.php +++ b/core/lib/Drupal/Core/Ajax/SettingsCommand.php @@ -17,7 +17,7 @@ * given array, depending on the value of the $merge parameter. * * This command is implemented by Drupal.AjaxCommands.prototype.settings() - * defined in misc/ajax.js. + * defined in assets/js/ajax.js. * * @ingroup ajax */ diff --git a/core/lib/Drupal/Core/Ajax/UpdateBuildIdCommand.php b/core/lib/Drupal/Core/Ajax/UpdateBuildIdCommand.php index 2ce74db..bb6af78 100644 --- a/core/lib/Drupal/Core/Ajax/UpdateBuildIdCommand.php +++ b/core/lib/Drupal/Core/Ajax/UpdateBuildIdCommand.php @@ -18,7 +18,7 @@ * forms. * * This command is implemented by - * Drupal.AjaxCommands.prototype.update_build_id() defined in misc/ajax.js. + * Drupal.AjaxCommands.prototype.update_build_id() defined in assets/js/ajax.js. *O * @ingroup ajax */ diff --git a/core/misc/drupal.js b/core/misc/drupal.js index 4244ed6..66bb881 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -1,432 +1,2 @@ -/** - * Base framework for Drupal-specific JavaScript, behaviors, and settings. - */ -window.Drupal = {behaviors: {}, locale: {}}; - -// Class indicating that JS is enabled; used for styling purpose. -document.documentElement.className += ' js'; - -// Allow other JavaScript libraries to use $. -if (window.jQuery) { - jQuery.noConflict(); -} - -// JavaScript should be made compatible with libraries other than jQuery by -// wrapping it in an anonymous closure. -(function (domready, Drupal, drupalSettings) { - - "use strict"; - - /** - * Custom error type thrown after attach/detach if one or more behaviors failed. - * - * @param list - * An array of errors thrown during attach/detach. - * @param event - * A string containing either 'attach' or 'detach'. - */ - function DrupalBehaviorError(list, event) { - this.name = 'DrupalBehaviorError'; - this.event = event || 'attach'; - this.list = list; - // Makes the list of errors readable. - var messageList = []; - messageList.push(this.event); - for (var i = 0, il = this.list.length; i < il; i++) { - messageList.push(this.list[i].behavior + ': ' + this.list[i].error.message); - } - this.message = messageList.join(' ; '); - } - - DrupalBehaviorError.prototype = new Error(); - - /** - * Attach all registered behaviors to a page element. - * - * Behaviors are event-triggered actions that attach to page elements, enhancing - * default non-JavaScript UIs. Behaviors are registered in the Drupal.behaviors - * object using the method 'attach' and optionally also 'detach' as follows: - * @code - * Drupal.behaviors.behaviorName = { - * attach: function (context, settings) { - * ... - * }, - * detach: function (context, settings, trigger) { - * ... - * } - * }; - * @endcode - * - * Drupal.attachBehaviors is added below to the jQuery.ready event and therefore - * runs on initial page load. Developers implementing Ajax in their solutions - * should also call this function after new page content has been loaded, - * feeding in an element to be processed, in order to attach all behaviors to - * the new content. - * - * Behaviors should use - * @code - * var elements = $(context).find(selector).once('behavior-name'); - * @endcode - * to ensure the behavior is attached only once to a given element. (Doing so - * enables the reprocessing of given elements, which may be needed on occasion - * despite the ability to limit behavior attachment to a particular element.) - * - * @param context - * An element to attach behaviors to. If none is given, the document element - * is used. - * @param settings - * An object containing settings for the current context. If none is given, - * the global drupalSettings object is used. - */ - Drupal.attachBehaviors = function (context, settings) { - context = context || document; - settings = settings || drupalSettings; - var i, errors = [], behaviors = Drupal.behaviors; - // Execute all of them. - for (i in behaviors) { - if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') { - // Don't stop the execution of behaviors in case of an error. - try { - behaviors[i].attach(context, settings); - } - catch (e) { - errors.push({behavior: i, error: e}); - } - } - } - // Once all behaviors have been processed, inform the user about errors. - if (errors.length) { - throw new DrupalBehaviorError(errors, 'attach'); - } - }; - - // Attach all behaviors. - domready(function () { Drupal.attachBehaviors(document, drupalSettings); }); - - /** - * Detach registered behaviors from a page element. - * - * Developers implementing AHAH/Ajax in their solutions should call this - * function before page content is about to be removed, feeding in an element - * to be processed, in order to allow special behaviors to detach from the - * content. - * - * Such implementations should look for the class name that was added in their - * corresponding Drupal.behaviors.behaviorName.attach implementation, i.e. - * behaviorName-processed, to ensure the behavior is detached only from - * previously processed elements. - * - * @param context - * An element to detach behaviors from. If none is given, the document element - * is used. - * @param settings - * An object containing settings for the current context. If none given, the - * global drupalSettings object is used. - * @param trigger - * A string containing what's causing the behaviors to be detached. The - * possible triggers are: - * - unload: (default) The context element is being removed from the DOM. - * - move: The element is about to be moved within the DOM (for example, - * during a tabledrag row swap). After the move is completed, - * Drupal.attachBehaviors() is called, so that the behavior can undo - * whatever it did in response to the move. Many behaviors won't need to - * do anything simply in response to the element being moved, but because - * IFRAME elements reload their "src" when being moved within the DOM, - * behaviors bound to IFRAME elements (like WYSIWYG editors) may need to - * take some action. - * - serialize: When an Ajax form is submitted, this is called with the - * form as the context. This provides every behavior within the form an - * opportunity to ensure that the field elements have correct content - * in them before the form is serialized. The canonical use-case is so - * that WYSIWYG editors can update the hidden textarea to which they are - * bound. - * - * @see Drupal.attachBehaviors - */ - Drupal.detachBehaviors = function (context, settings, trigger) { - context = context || document; - settings = settings || drupalSettings; - trigger = trigger || 'unload'; - var i, errors = [], behaviors = Drupal.behaviors; - // Execute all of them. - for (i in behaviors) { - if (behaviors.hasOwnProperty(i) && typeof behaviors[i].detach === 'function') { - // Don't stop the execution of behaviors in case of an error. - try { - behaviors[i].detach(context, settings, trigger); - } - catch (e) { - errors.push({behavior: i, error: e}); - } - } - } - // Once all behaviors have been processed, inform the user about errors. - if (errors.length) { - throw new DrupalBehaviorError(errors, 'detach:' + trigger); - } - }; - - /** - * Helper to test document width for mobile configurations. - * @todo Temporary solution for the mobile initiative. - */ - Drupal.checkWidthBreakpoint = function (width) { - width = width || drupalSettings.widthBreakpoint || 640; - return (document.documentElement.clientWidth > width); - }; - - /** - * Encode special characters in a plain-text string for display as HTML. - * - * @param str - * The string to be encoded. - * @return - * The encoded string. - * @ingroup sanitization - */ - Drupal.checkPlain = function (str) { - str = str.toString() - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); - return str; - }; - - /** - * Replace placeholders with sanitized values in a string. - * - * @param {String} str - * A string with placeholders. - * @param {Object} args - * An object of replacements pairs to make. Incidences of any key in this - * array are replaced with the corresponding value. Based on the first - * character of the key, the value is escaped and/or themed: - * - !variable: inserted as is - * - @variable: escape plain text to HTML (Drupal.checkPlain) - * - %variable: escape text and theme as a placeholder for user-submitted - * content (checkPlain + Drupal.theme('placeholder')) - * - * @return {String} - * Returns the replaced string. - * - * @see Drupal.t() - * @ingroup sanitization - */ - Drupal.formatString = function (str, args) { - // Transform arguments before inserting them. - for (var key in args) { - if (args.hasOwnProperty(key)) { - switch (key.charAt(0)) { - // Escaped only. - case '@': - args[key] = Drupal.checkPlain(args[key]); - break; - // Pass-through. - case '!': - break; - // Escaped and placeholder. - default: - args[key] = Drupal.theme('placeholder', args[key]); - break; - } - } - } - - return Drupal.stringReplace(str, args, null); - }; - - /** - * Replace substring. - * - * The longest keys will be tried first. Once a substring has been replaced, - * its new value will not be searched again. - * - * @param {String} str - * A string with placeholders. - * @param {Object} args - * Key-value pairs. - * @param {Array|null} keys - * Array of keys from the "args". Internal use only. - * - * @return {String} - * Returns the replaced string. - */ - Drupal.stringReplace = function (str, args, keys) { - if (str.length === 0) { - return str; - } - - // If the array of keys is not passed then collect the keys from the args. - if (!Array.isArray(keys)) { - keys = []; - for (var k in args) { - if (args.hasOwnProperty(k)) { - keys.push(k); - } - } - - // Order the keys by the character length. The shortest one is the first. - keys.sort(function (a, b) { return a.length - b.length; }); - } - - if (keys.length === 0) { - return str; - } - - // Take next longest one from the end. - var key = keys.pop(); - var fragments = str.split(key); - - if (keys.length) { - for (var i = 0; i < fragments.length; i++) { - // Process each fragment with a copy of remaining keys. - fragments[i] = Drupal.stringReplace(fragments[i], args, keys.slice(0)); - } - } - - return fragments.join(args[key]); - }; - - /** - * Translate strings to the page language or a given language. - * - * See the documentation of the server-side t() function for further details. - * - * @param str - * A string containing the English string to translate. - * @param args - * An object of replacements pairs to make after translation. Incidences - * of any key in this array are replaced with the corresponding value. - * See Drupal.formatString(). - * - * @param options - * - 'context' (defaults to the empty context): The context the source string - * belongs to. - * - * @return - * The translated string. - */ - Drupal.t = function (str, args, options) { - options = options || {}; - options.context = options.context || ''; - - // Fetch the localized version of the string. - if (Drupal.locale.strings && Drupal.locale.strings[options.context] && Drupal.locale.strings[options.context][str]) { - str = Drupal.locale.strings[options.context][str]; - } - - if (args) { - str = Drupal.formatString(str, args); - } - return str; - }; - - /** - * Returns the URL to a Drupal page. - */ - Drupal.url = function (path) { - return drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix + path; - }; - - /** - * Format a string containing a count of items. - * - * This function ensures that the string is pluralized correctly. Since - * Drupal.t() is called by this function, make sure not to pass - * already-localized strings to it. - * - * See the documentation of the server-side - * \Drupal\Core\StringTranslation\TranslationInterface::formatPlural() - * function for more details. - * - * @param {Number} count - * The item count to display. - * @param {String} singular - * The string for the singular case. Please make sure it is clear this is - * singular, to ease translation (e.g. use "1 new comment" instead of "1 - * new"). Do not use @count in the singular string. - * @param {String} plural - * The string for the plural case. Please make sure it is clear this is - * plural, to ease translation. Use @count in place of the item count, as in - * "@count new comments". - * @param {Object} args - * An object of replacements pairs to make after translation. Incidences - * of any key in this array are replaced with the corresponding value. - * See Drupal.formatString(). - * Note that you do not need to include @count in this array. - * This replacement is done automatically for the plural case. - * @param {Object} options - * The options to pass to the Drupal.t() function. - * - * @return {String} - * A translated string. - */ - Drupal.formatPlural = function (count, singular, plural, args, options) { - args = args || {}; - args['@count'] = count; - - var pluralDelimiter = drupalSettings.locale.pluralDelimiter, - translations = Drupal.t(singular + pluralDelimiter + plural, args, options).split(pluralDelimiter), - index = 0; - - // Determine the index of the plural form. - if (Drupal.locale.pluralFormula) { - index = count in Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula[count] : Drupal.locale.pluralFormula['default']; - } - else if (args['@count'] !== 1) { - index = 1; - } - - return translations[index]; - }; - - /** - * Encodes a Drupal path for use in a URL. - * - * For aesthetic reasons slashes are not escaped. - */ - Drupal.encodePath = function (item) { - return window.encodeURIComponent(item).replace(/%2F/g, '/'); - }; - - /** - * Generate the themed representation of a Drupal object. - * - * All requests for themed output must go through this function. It examines - * the request and routes it to the appropriate theme function. If the current - * theme does not provide an override function, the generic theme function is - * called. - * - * For example, to retrieve the HTML for text that should be emphasized and - * displayed as a placeholder inside a sentence, call - * Drupal.theme('placeholder', text). - * - * @param func - * The name of the theme function to call. - * @param ... - * Additional arguments to pass along to the theme function. - * @return - * Any data the theme function returns. This could be a plain HTML string, - * but also a complex object. - */ - Drupal.theme = function (func) { - var args = Array.prototype.slice.apply(arguments, [1]); - if (func in Drupal.theme) { - return Drupal.theme[func].apply(this, args); - } - }; - - /** - * Formats text for emphasized display in a placeholder inside a sentence. - * - * @param str - * The text to format (plain-text). - * @return - * The formatted text (html). - */ - Drupal.theme.placeholder = function (str) { - return '' + Drupal.checkPlain(str) + ''; - }; - -})(domready, Drupal, window.drupalSettings); +// Placeholder file to prevent the root check in drush 7.x-dev from failing. +// This file has been moved to core/assets/js/drupal.js diff --git a/core/modules/book/templates/book-export-html.html.twig b/core/modules/book/templates/book-export-html.html.twig index 5fb2e97..e7e258b 100644 --- a/core/modules/book/templates/book-export-html.html.twig +++ b/core/modules/book/templates/book-export-html.html.twig @@ -24,7 +24,7 @@ {{ title }} {{ page.head }} - + {# diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 273bf3c..ccbfaff 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -54,8 +54,8 @@ function simpletest_js_alter(&$javascript) { // Since SimpleTest is a special use case for the table select, stick the // SimpleTest JavaScript above the table select. $simpletest = drupal_get_path('module', 'simpletest') . '/simpletest.js'; - if (array_key_exists($simpletest, $javascript) && array_key_exists('core/misc/tableselect.js', $javascript)) { - $javascript[$simpletest]['weight'] = $javascript['core/misc/tableselect.js']['weight'] - 1; + if (array_key_exists($simpletest, $javascript) && array_key_exists('core/assets/js/tableselect.js', $javascript)) { + $javascript[$simpletest]['weight'] = $javascript['core/assets/js/tableselect.js']['weight'] - 1; } } diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php index d0ab879..52071ff 100644 --- a/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -58,7 +58,7 @@ * - For Twig templates, use 't' or 'trans' filters to indicate translatable * text. See https://www.drupal.org/node/2133321 for more information. * - In JavaScript code, use the Drupal.t() and Drupal.formatPlural() functions - * (defined in core/misc/drupal.js) to translate UI text. + * (defined in assets/js/drupal.js) to translate UI text. * - If you are using a custom module, theme, etc. that is not hosted on * Drupal.org, see * @link interface_translation_properties Interface translation properties topic @endlink diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php index 4e29567..3ac9ab5 100644 --- a/core/modules/system/src/Tests/Ajax/DialogTest.php +++ b/core/modules/system/src/Tests/Ajax/DialogTest.php @@ -138,7 +138,7 @@ public function testDialog() { // Check that CSS and JavaScript are "added" to the page dynamically. $this->assertTrue(in_array('dialog.css', array_keys($ajax_result[0]['settings']['ajaxPageState']['css'])), 'jQuery UI dialog CSS added to the page.'); $this->assertTrue(in_array('core/assets/vendor/jquery.ui/ui/dialog-min.js', array_keys($ajax_result[0]['settings']['ajaxPageState']['js'])), 'jQuery UI dialog JS added to the page.'); - $this->assertTrue(in_array('core/misc/dialog/dialog.ajax.js', array_keys($ajax_result[0]['settings']['ajaxPageState']['js'])), 'Drupal dialog JS added to the page.'); + $this->assertTrue(in_array('core/assets/components/dialog/dialog.ajax.js', array_keys($ajax_result[0]['settings']['ajaxPageState']['js'])), 'Drupal dialog JS added to the page.'); // Check that the response matches the expected value. $this->assertEqual($modal_expected_response, $ajax_result[3], 'POST request modal dialog JSON response matches.'); diff --git a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php index 8401acf..63bb771 100644 --- a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php +++ b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php @@ -352,7 +352,7 @@ function testAlter() { // tableselect.js. See simpletest_js_alter() to see where this alteration // takes place. $js = drupal_get_js(); - $this->assertTrue(strpos($js, 'simpletest.js') < strpos($js, 'core/misc/tableselect.js'), 'Altering JavaScript weight through the alter hook.'); + $this->assertTrue(strpos($js, 'simpletest.js') < strpos($js, 'core/assets/js/tableselect.js'), 'Altering JavaScript weight through the alter hook.'); } /** diff --git a/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php b/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php index 44a47c2..9e032cd 100644 --- a/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php +++ b/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php @@ -38,8 +38,8 @@ protected function setUp() { */ function testJavaScriptOrdering() { $this->drupalGet('form_test/vertical-tabs'); - $position1 = strpos($this->content, 'core/misc/vertical-tabs.js'); - $position2 = strpos($this->content, 'core/misc/collapse.js'); + $position1 = strpos($this->content, 'core/assets/js/vertical-tabs.js'); + $position2 = strpos($this->content, 'core/assets/js/collapse.js'); $this->assertTrue($position1 !== FALSE && $position2 !== FALSE && $position1 < $position2, 'vertical-tabs.js is included before collapse.js'); } diff --git a/core/modules/system/src/Tests/System/SystemAuthorizeTest.php b/core/modules/system/src/Tests/System/SystemAuthorizeTest.php index cbc359a..de8da16 100644 --- a/core/modules/system/src/Tests/System/SystemAuthorizeTest.php +++ b/core/modules/system/src/Tests/System/SystemAuthorizeTest.php @@ -61,6 +61,6 @@ function testFileTransferHooks() { $this->assertText('System Test Username'); // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets as // expected to the first page of the authorize.php script. - $this->assertRaw('core/misc/states.js'); + $this->assertRaw('core/assets/js/states.js'); } } diff --git a/core/modules/system/src/Tests/Theme/TableTest.php b/core/modules/system/src/Tests/Theme/TableTest.php index 412cb8e..138cc4e 100644 --- a/core/modules/system/src/Tests/Theme/TableTest.php +++ b/core/modules/system/src/Tests/Theme/TableTest.php @@ -47,7 +47,7 @@ function testThemeTableStickyHeaders() { ); $this->render($table); $js = _drupal_add_js(); - $this->assertTrue(isset($js['core/misc/tableheader.js']), 'tableheader.js found.'); + $this->assertTrue(isset($js['core/assets/js/tableheader.js']), 'tableheader.js found.'); $this->assertRaw('sticky-enabled'); drupal_static_reset('_drupal_add_js'); } @@ -72,7 +72,7 @@ function testThemeTableNoStickyHeaders() { ); $this->render($table); $js = _drupal_add_js(); - $this->assertFalse(isset($js['core/misc/tableheader.js']), 'tableheader.js not found.'); + $this->assertFalse(isset($js['core/assets/js/tableheader.js']), 'tableheader.js not found.'); $this->assertNoRaw('sticky-enabled'); drupal_static_reset('_drupal_add_js'); } diff --git a/core/modules/system/tests/upgrade/drupal-7.language.database.php b/core/modules/system/tests/upgrade/drupal-7.language.database.php index b113e36..5ce84b0 100644 --- a/core/modules/system/tests/upgrade/drupal-7.language.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.language.database.php @@ -124,7 +124,7 @@ )) ->values(array( 'lid' => '1', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'An AJAX HTTP error occurred.', 'context' => '', @@ -132,7 +132,7 @@ )) ->values(array( 'lid' => '2', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'HTTP Result Code: !status', 'context' => '', @@ -140,7 +140,7 @@ )) ->values(array( 'lid' => '3', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'An AJAX HTTP request terminated abnormally.', 'context' => '', @@ -148,7 +148,7 @@ )) ->values(array( 'lid' => '4', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'Debugging information follows.', 'context' => '', @@ -156,7 +156,7 @@ )) ->values(array( 'lid' => '5', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'Path: !uri', 'context' => '', @@ -164,7 +164,7 @@ )) ->values(array( 'lid' => '6', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'StatusText: !statusText', 'context' => '', @@ -172,7 +172,7 @@ )) ->values(array( 'lid' => '7', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'ResponseText: !responseText', 'context' => '', @@ -180,7 +180,7 @@ )) ->values(array( 'lid' => '8', - 'location' => 'misc/drupal.js', + 'location' => 'assets/js/drupal.js', 'textgroup' => 'default', 'source' => 'ReadyState: !readyState', 'context' => '', @@ -236,7 +236,7 @@ )) ->values(array( 'lid' => '15', - 'location' => 'misc/tabledrag.js', + 'location' => 'assets/js/tabledrag.js', 'textgroup' => 'default', 'source' => 'Re-order rows by numerical weight instead of dragging.', 'context' => '', @@ -244,7 +244,7 @@ )) ->values(array( 'lid' => '16', - 'location' => 'misc/tabledrag.js', + 'location' => 'assets/js/tabledrag.js', 'textgroup' => 'default', 'source' => 'Show row weights', 'context' => '', @@ -252,7 +252,7 @@ )) ->values(array( 'lid' => '17', - 'location' => 'misc/tabledrag.js', + 'location' => 'assets/js/tabledrag.js', 'textgroup' => 'default', 'source' => 'Hide row weights', 'context' => '', @@ -260,7 +260,7 @@ )) ->values(array( 'lid' => '18', - 'location' => 'misc/tabledrag.js', + 'location' => 'assets/js/tabledrag.js', 'textgroup' => 'default', 'source' => 'Drag to re-order', 'context' => '', @@ -268,7 +268,7 @@ )) ->values(array( 'lid' => '19', - 'location' => 'misc/tabledrag.js', + 'location' => 'assets/js/tabledrag.js', 'textgroup' => 'default', 'source' => 'Changes made in this table will not be saved until the form is submitted.', 'context' => '', @@ -276,7 +276,7 @@ )) ->values(array( 'lid' => '20', - 'location' => 'misc/collapse.js', + 'location' => 'assets/js/collapse.js', 'textgroup' => 'default', 'source' => 'Hide', 'context' => '', @@ -284,7 +284,7 @@ )) ->values(array( 'lid' => '21', - 'location' => 'misc/collapse.js', + 'location' => 'assets/js/collapse.js', 'textgroup' => 'default', 'source' => 'Show', 'context' => '', @@ -384,7 +384,7 @@ )) ->values(array( 'name' => 'javascript_parsed', - 'value' => 'a:16:{i:0;s:14:"misc/drupal.js";i:1;s:14:"misc/jquery.js";i:2;s:19:"misc/jquery.once.js";s:10:"refresh:ca";s:7:"waiting";i:3;s:29:"misc/ui/jquery.ui.core.min.js";i:4;s:21:"misc/jquery.ba-bbq.js";i:5;s:33:"modules/overlay/overlay-parent.js";i:6;s:32:"modules/contextual/contextual.js";i:7;s:21:"misc/jquery.cookie.js";i:8;s:26:"modules/toolbar/toolbar.js";i:9;s:32:"modules/overlay/overlay-child.js";i:10;s:19:"misc/tableheader.js";i:11;s:17:"misc/tabledrag.js";i:12;s:12:"misc/form.js";i:13;s:16:"misc/collapse.js";s:10:"refresh:cv";s:7:"waiting";}', + 'value' => 'a:16:{i:0;s:14:"assets/js/drupal.js";i:1;s:14:"assets/js/jquery.js";i:2;s:19:"assets/js/jquery.once.js";s:10:"refresh:ca";s:7:"waiting";i:3;s:29:"assets/js/ui/jquery.ui.core.min.js";i:4;s:21:"assets/js/jquery.ba-bbq.js";i:5;s:33:"modules/overlay/overlay-parent.js";i:6;s:32:"modules/contextual/contextual.js";i:7;s:21:"assets/js/jquery.cookie.js";i:8;s:26:"modules/toolbar/toolbar.js";i:9;s:32:"modules/overlay/overlay-child.js";i:10;s:19:"assets/js/tableheader.js";i:11;s:17:"assets/js/tabledrag.js";i:12;s:12:"assets/js/form.js";i:13;s:16:"assets/js/collapse.js";s:10:"refresh:cv";s:7:"waiting";}', )) ->values(array( 'name' => 'language_count', diff --git a/core/themes/classy/templates/book-export-html.html.twig b/core/themes/classy/templates/book-export-html.html.twig index cbeb3b3..82fe14e 100644 --- a/core/themes/classy/templates/book-export-html.html.twig +++ b/core/themes/classy/templates/book-export-html.html.twig @@ -24,7 +24,7 @@ {{ title }} {{ page.head }} - + {# diff --git a/core/themes/seven/css/components/vertical-tabs.css b/core/themes/seven/css/components/vertical-tabs.css index 325a3af..14907c2 100644 --- a/core/themes/seven/css/components/vertical-tabs.css +++ b/core/themes/seven/css/components/vertical-tabs.css @@ -1,5 +1,5 @@ /** - * Override of misc/vertical-tabs.css. + * Override of assets/css/vertical-tabs.css. */ .vertical-tabs { position: relative;