Chris@0: /** Chris@0: * DO NOT EDIT THIS FILE. Chris@0: * See the following change record for more information, Chris@0: * https://www.drupal.org/node/2815083 Chris@0: * @preserve Chris@0: **/ Chris@0: Chris@0: (function ($, Drupal, drupalSettings) { Chris@0: Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) { Chris@0: $('.hilited').removeClass('hilited'); Chris@0: $(response.selector).addClass('hilited'); Chris@0: }; Chris@0: Chris@0: Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) { Chris@0: var $form = $('.js-views-ui-dialog form'); Chris@0: Chris@14: var $submitButtons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit'); Chris@14: $submitButtons.on('click mousedown', function () { Chris@0: this.form.clk = this; Chris@0: }); Chris@0: $form.once('views-ajax-submit').each(function () { Chris@0: var $form = $(this); Chris@14: var elementSettings = { Chris@0: url: response.url, Chris@0: event: 'submit', Chris@0: base: $form.attr('id'), Chris@0: element: this Chris@0: }; Chris@14: var ajaxForm = Drupal.ajax(elementSettings); Chris@0: ajaxForm.$form = $form; Chris@0: }); Chris@0: }; Chris@0: Chris@0: Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) { Chris@0: $('div.views-edit-view div.form-actions').removeClass('js-hide'); Chris@0: if (response.changed) { Chris@0: $('div.views-edit-view div.view-changed.messages').removeClass('js-hide'); Chris@0: } Chris@0: }; Chris@0: Chris@0: Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) { Chris@0: if ($('input#edit-displays-live-preview').is(':checked')) { Chris@0: $('#preview-submit').trigger('click'); Chris@0: } Chris@0: }; Chris@0: Chris@0: Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) { Chris@0: var doc = document; Chris@0: Chris@0: var oldTitle = doc.title; Chris@0: Chris@0: var escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); Chris@0: var re = new RegExp('.+ (.) ' + escapedSiteName); Chris@0: doc.title = oldTitle.replace(re, response.title + ' $1 ' + response.siteName); Chris@0: Chris@0: $('h1.page-title').text(response.title); Chris@0: }; Chris@0: Chris@0: Drupal.theme.tableDragChangedWarning = function () { Chris@0: return []; Chris@0: }; Chris@0: Chris@0: Drupal.behaviors.livePreview = { Chris@0: attach: function attach(context) { Chris@0: $('input#edit-displays-live-preview', context).once('views-ajax').on('click', function () { Chris@0: if ($(this).is(':checked')) { Chris@0: $('#preview-submit').trigger('click'); Chris@0: } Chris@0: }); Chris@0: } Chris@0: }; Chris@0: Chris@0: Drupal.behaviors.syncPreviewDisplay = { Chris@0: attach: function attach(context) { Chris@0: $('#views-tabset a').once('views-ajax').on('click', function () { Chris@0: var href = $(this).attr('href'); Chris@0: Chris@14: var displayId = href.substr(11); Chris@0: Chris@14: $('#views-live-preview #preview-display-id').val(displayId); Chris@0: }); Chris@0: } Chris@0: }; Chris@0: Chris@0: Drupal.behaviors.viewsAjax = { Chris@0: collapseReplaced: false, Chris@0: attach: function attach(context, settings) { Chris@14: var baseElementSettings = { Chris@0: event: 'click', Chris@0: progress: { type: 'fullscreen' } Chris@0: }; Chris@0: Chris@0: $('a.views-ajax-link', context).once('views-ajax').each(function () { Chris@14: var elementSettings = baseElementSettings; Chris@14: elementSettings.base = $(this).attr('id'); Chris@14: elementSettings.element = this; Chris@0: Chris@0: if ($(this).attr('href')) { Chris@14: elementSettings.url = $(this).attr('href'); Chris@0: } Chris@14: Drupal.ajax(elementSettings); Chris@0: }); Chris@0: Chris@0: $('div#views-live-preview a').once('views-ajax').each(function () { Chris@0: if (!$(this).attr('href')) { Chris@0: return true; Chris@0: } Chris@0: Chris@14: var elementSettings = baseElementSettings; Chris@0: Chris@14: elementSettings.url = $(this).attr('href'); Chris@14: if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') { Chris@0: return true; Chris@0: } Chris@0: Chris@14: elementSettings.wrapper = 'views-preview-wrapper'; Chris@14: elementSettings.method = 'replaceWith'; Chris@14: elementSettings.base = $(this).attr('id'); Chris@14: elementSettings.element = this; Chris@14: Drupal.ajax(elementSettings); Chris@0: }); Chris@0: Chris@0: $('div#views-live-preview input[type=submit]').once('views-ajax').each(function (event) { Chris@0: $(this).on('click', function () { Chris@0: this.form.clk = this; Chris@0: return true; Chris@0: }); Chris@14: var elementSettings = baseElementSettings; Chris@0: Chris@14: elementSettings.url = $(this.form).attr('action'); Chris@14: if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') { Chris@0: return true; Chris@0: } Chris@0: Chris@14: elementSettings.wrapper = 'views-preview-wrapper'; Chris@14: elementSettings.method = 'replaceWith'; Chris@14: elementSettings.event = 'click'; Chris@14: elementSettings.base = $(this).attr('id'); Chris@14: elementSettings.element = this; Chris@0: Chris@14: Drupal.ajax(elementSettings); Chris@0: }); Chris@0: } Chris@0: }; Chris@0: })(jQuery, Drupal, drupalSettings);