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