X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fthemes%2Fcontrib%2Fbootstrap%2Fjs%2Fmisc%2Fdialog.js;fp=web%2Fthemes%2Fcontrib%2Fbootstrap%2Fjs%2Fmisc%2Fdialog.js;h=0000000000000000000000000000000000000000;hp=5a92e8223b20071530fa811c6acaf1843089ff9a;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/themes/contrib/bootstrap/js/misc/dialog.js b/web/themes/contrib/bootstrap/js/misc/dialog.js deleted file mode 100644 index 5a92e8223..000000000 --- a/web/themes/contrib/bootstrap/js/misc/dialog.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @file - * Dialog API inspired by HTML5 dialog element. - * - * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#the-dialog-element - */ - -(function ($, Drupal, drupalSettings) { - - 'use strict'; - - /** - * Default dialog options. - * - * @type {object} - * - * @prop {bool} [autoOpen=true] - * @prop {string} [dialogClass=''] - * @prop {string} [buttonClass='button'] - * @prop {string} [buttonPrimaryClass='button--primary'] - * @prop {function} close - */ - drupalSettings.dialog = { - autoOpen: true, - dialogClass: '', - // Drupal-specific extensions: see dialog.jquery-ui.js. - buttonClass: 'button', - buttonPrimaryClass: 'button--primary', - // When using this API directly (when generating dialogs on the client - // side), you may want to override this method and do - // `jQuery(event.target).remove()` as well, to remove the dialog on - // closing. - close: function (event) { - Drupal.detachBehaviors(event.target, null, 'unload'); - } - }; - - /** - * @typedef {object} Drupal.dialog~dialogDefinition - * - * @prop {boolean} open - * Is the dialog open or not. - * @prop {*} returnValue - * Return value of the dialog. - * @prop {function} show - * Method to display the dialog on the page. - * @prop {function} showModal - * Method to display the dialog as a modal on the page. - * @prop {function} close - * Method to hide the dialog from the page. - */ - - /** - * Polyfill HTML5 dialog element with jQueryUI. - * - * @param {HTMLElement} element - * @param {object} options - * jQuery UI options to be passed to the dialog. - * - * @return {Drupal.dialog~dialogDefinition} - */ - Drupal.dialog = function (element, options) { - var $element = $(element); - - function openDialog(settings) { - settings = $.extend({}, drupalSettings.dialog, options, settings); - // Trigger a global event to allow scripts to bind events to the dialog. - $(window).trigger('dialog:beforecreate', [dialog, $element, settings]); - $element - .modal(settings) - .on('shown.bs.modal.drupal', function () { - dialog.open = true; - $(window).trigger('dialog:aftercreate', [dialog, $element, settings]); - }) - ; - } - - function closeDialog(value) { - $(window).trigger('dialog:beforeclose', [dialog, $element]); - $element - .on('hidden.bs.modal.drupal', function () { - dialog.returnValue = value; - dialog.open = false; - $(window).trigger('dialog:afterclose', [dialog, $element]); - }) - .modal('hide'); - } - - var dialog = { - open: false, - returnValue: void(0), - show: function () { - openDialog({show: false}); - }, - showModal: function () { - openDialog({show: true}); - }, - close: closeDialog - }; - - return dialog; - }; - -})(jQuery, Drupal, drupalSettings);