2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function ($, Drupal, drupalSettings) {
9 Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) {
10 $('.hilited').removeClass('hilited');
11 $(response.selector).addClass('hilited');
14 Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) {
15 var $form = $('.js-views-ui-dialog form');
17 var $submit_buttons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
18 $submit_buttons.on('click mousedown', function () {
21 $form.once('views-ajax-submit').each(function () {
23 var element_settings = {
26 base: $form.attr('id'),
29 var ajaxForm = Drupal.ajax(element_settings);
30 ajaxForm.$form = $form;
34 Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) {
35 $('div.views-edit-view div.form-actions').removeClass('js-hide');
36 if (response.changed) {
37 $('div.views-edit-view div.view-changed.messages').removeClass('js-hide');
41 Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) {
42 if ($('input#edit-displays-live-preview').is(':checked')) {
43 $('#preview-submit').trigger('click');
47 Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) {
50 var oldTitle = doc.title;
52 var escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
53 var re = new RegExp('.+ (.) ' + escapedSiteName);
54 doc.title = oldTitle.replace(re, response.title + ' $1 ' + response.siteName);
56 $('h1.page-title').text(response.title);
59 Drupal.theme.tableDragChangedWarning = function () {
63 Drupal.behaviors.livePreview = {
64 attach: function attach(context) {
65 $('input#edit-displays-live-preview', context).once('views-ajax').on('click', function () {
66 if ($(this).is(':checked')) {
67 $('#preview-submit').trigger('click');
73 Drupal.behaviors.syncPreviewDisplay = {
74 attach: function attach(context) {
75 $('#views-tabset a').once('views-ajax').on('click', function () {
76 var href = $(this).attr('href');
78 var display_id = href.substr(11);
80 $('#views-live-preview #preview-display-id').val(display_id);
85 Drupal.behaviors.viewsAjax = {
86 collapseReplaced: false,
87 attach: function attach(context, settings) {
88 var base_element_settings = {
90 progress: { type: 'fullscreen' }
93 $('a.views-ajax-link', context).once('views-ajax').each(function () {
94 var element_settings = base_element_settings;
95 element_settings.base = $(this).attr('id');
96 element_settings.element = this;
98 if ($(this).attr('href')) {
99 element_settings.url = $(this).attr('href');
101 Drupal.ajax(element_settings);
104 $('div#views-live-preview a').once('views-ajax').each(function () {
105 if (!$(this).attr('href')) {
109 var element_settings = base_element_settings;
111 element_settings.url = $(this).attr('href');
112 if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
116 element_settings.wrapper = 'views-preview-wrapper';
117 element_settings.method = 'replaceWith';
118 element_settings.base = $(this).attr('id');
119 element_settings.element = this;
120 Drupal.ajax(element_settings);
123 $('div#views-live-preview input[type=submit]').once('views-ajax').each(function (event) {
124 $(this).on('click', function () {
125 this.form.clk = this;
128 var element_settings = base_element_settings;
130 element_settings.url = $(this.form).attr('action');
131 if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
135 element_settings.wrapper = 'views-preview-wrapper';
136 element_settings.method = 'replaceWith';
137 element_settings.event = 'click';
138 element_settings.base = $(this).attr('id');
139 element_settings.element = this;
141 Drupal.ajax(element_settings);
145 })(jQuery, Drupal, drupalSettings);