2009-05-17 11:16:51 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
2017-05-23 14:30:14 +00:00
|
|
|
* https://www.drupal.org/node/2815083
|
2017-05-19 22:12:53 +00:00
|
|
|
* @preserve
|
|
|
|
**/
|
2015-06-05 20:17:55 +00:00
|
|
|
|
2013-09-21 23:39:42 +00:00
|
|
|
(function ($, Drupal, drupalSettings) {
|
2013-06-14 13:11:49 +00:00
|
|
|
Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) {
|
2009-05-17 11:16:51 +00:00
|
|
|
$('.hilited').removeClass('hilited');
|
|
|
|
$(response.selector).addClass('hilited');
|
|
|
|
};
|
|
|
|
|
Issue #2248223 by olli, Lendude, peterg.griffin, finne, mikeker, pjonckiere, b0unty, ohthehugemanatee, zniki.ru, dawehner, jhodgdon, effulgentsia, xjm, droplet, metzlerd: Adding a new Views filter and making it exposed returns user back to list of filters
2016-03-10 16:12:56 +00:00
|
|
|
Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) {
|
|
|
|
var $form = $('.js-views-ui-dialog form');
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
var $submitButtons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
|
|
|
|
$submitButtons.on('click mousedown', function () {
|
Issue #2248223 by olli, Lendude, peterg.griffin, finne, mikeker, pjonckiere, b0unty, ohthehugemanatee, zniki.ru, dawehner, jhodgdon, effulgentsia, xjm, droplet, metzlerd: Adding a new Views filter and making it exposed returns user back to list of filters
2016-03-10 16:12:56 +00:00
|
|
|
this.form.clk = this;
|
|
|
|
});
|
|
|
|
$form.once('views-ajax-submit').each(function () {
|
|
|
|
var $form = $(this);
|
2017-12-03 16:16:29 +00:00
|
|
|
var elementSettings = {
|
Issue #2248223 by olli, Lendude, peterg.griffin, finne, mikeker, pjonckiere, b0unty, ohthehugemanatee, zniki.ru, dawehner, jhodgdon, effulgentsia, xjm, droplet, metzlerd: Adding a new Views filter and making it exposed returns user back to list of filters
2016-03-10 16:12:56 +00:00
|
|
|
url: response.url,
|
|
|
|
event: 'submit',
|
|
|
|
base: $form.attr('id'),
|
|
|
|
element: this
|
|
|
|
};
|
2017-12-03 16:16:29 +00:00
|
|
|
var ajaxForm = Drupal.ajax(elementSettings);
|
Issue #2248223 by olli, Lendude, peterg.griffin, finne, mikeker, pjonckiere, b0unty, ohthehugemanatee, zniki.ru, dawehner, jhodgdon, effulgentsia, xjm, droplet, metzlerd: Adding a new Views filter and making it exposed returns user back to list of filters
2016-03-10 16:12:56 +00:00
|
|
|
ajaxForm.$form = $form;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2013-06-14 13:11:49 +00:00
|
|
|
Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) {
|
2009-05-17 11:16:51 +00:00
|
|
|
$('div.views-edit-view div.form-actions').removeClass('js-hide');
|
2014-07-22 20:17:28 +00:00
|
|
|
if (response.changed) {
|
|
|
|
$('div.views-edit-view div.view-changed.messages').removeClass('js-hide');
|
|
|
|
}
|
2009-05-17 11:16:51 +00:00
|
|
|
};
|
|
|
|
|
2013-06-14 13:11:49 +00:00
|
|
|
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) {
|
2009-05-17 11:16:51 +00:00
|
|
|
if ($('input#edit-displays-live-preview').is(':checked')) {
|
|
|
|
$('#preview-submit').trigger('click');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-06-14 13:11:49 +00:00
|
|
|
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) {
|
2013-11-26 22:07:54 +00:00
|
|
|
var doc = document;
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2009-05-17 11:16:51 +00:00
|
|
|
var oldTitle = doc.title;
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2015-10-13 22:37:56 +00:00
|
|
|
var escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
2009-05-17 11:16:51 +00:00
|
|
|
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 [];
|
2012-08-28 22:55:51 +00:00
|
|
|
};
|
2009-05-17 11:16:51 +00:00
|
|
|
|
|
|
|
Drupal.behaviors.livePreview = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2013-12-04 14:28:18 +00:00
|
|
|
$('input#edit-displays-live-preview', context).once('views-ajax').on('click', function () {
|
2009-05-17 11:16:51 +00:00
|
|
|
if ($(this).is(':checked')) {
|
2013-12-04 14:28:18 +00:00
|
|
|
$('#preview-submit').trigger('click');
|
2009-05-17 11:16:51 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2012-08-28 22:55:51 +00:00
|
|
|
};
|
2009-05-17 11:16:51 +00:00
|
|
|
|
|
|
|
Drupal.behaviors.syncPreviewDisplay = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2015-10-13 22:37:56 +00:00
|
|
|
$('#views-tabset a').once('views-ajax').on('click', function () {
|
2009-05-17 11:16:51 +00:00
|
|
|
var href = $(this).attr('href');
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
var displayId = href.substr(11);
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
$('#views-live-preview #preview-display-id').val(displayId);
|
2013-12-04 14:28:18 +00:00
|
|
|
});
|
2009-05-17 11:16:51 +00:00
|
|
|
}
|
2012-08-28 22:55:51 +00:00
|
|
|
};
|
2009-05-17 11:16:51 +00:00
|
|
|
|
|
|
|
Drupal.behaviors.viewsAjax = {
|
|
|
|
collapseReplaced: false,
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context, settings) {
|
2017-12-03 16:16:29 +00:00
|
|
|
var baseElementSettings = {
|
2015-08-07 14:08:23 +00:00
|
|
|
event: 'click',
|
2017-05-19 22:12:53 +00:00
|
|
|
progress: { type: 'fullscreen' }
|
2009-05-17 11:16:51 +00:00
|
|
|
};
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2013-12-04 14:28:18 +00:00
|
|
|
$('a.views-ajax-link', context).once('views-ajax').each(function () {
|
2017-12-03 16:16:29 +00:00
|
|
|
var elementSettings = baseElementSettings;
|
|
|
|
elementSettings.base = $(this).attr('id');
|
|
|
|
elementSettings.element = this;
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2009-05-17 11:16:51 +00:00
|
|
|
if ($(this).attr('href')) {
|
2017-12-03 16:16:29 +00:00
|
|
|
elementSettings.url = $(this).attr('href');
|
2009-05-17 11:16:51 +00:00
|
|
|
}
|
2017-12-03 16:16:29 +00:00
|
|
|
Drupal.ajax(elementSettings);
|
2009-05-17 11:16:51 +00:00
|
|
|
});
|
|
|
|
|
2017-05-19 22:12:53 +00:00
|
|
|
$('div#views-live-preview a').once('views-ajax').each(function () {
|
|
|
|
if (!$(this).attr('href')) {
|
|
|
|
return true;
|
|
|
|
}
|
2009-05-17 11:16:51 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
var elementSettings = baseElementSettings;
|
2009-05-17 11:16:51 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
elementSettings.url = $(this).attr('href');
|
|
|
|
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
|
2017-05-19 22:12:53 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
elementSettings.wrapper = 'views-preview-wrapper';
|
|
|
|
elementSettings.method = 'replaceWith';
|
|
|
|
elementSettings.base = $(this).attr('id');
|
|
|
|
elementSettings.element = this;
|
|
|
|
Drupal.ajax(elementSettings);
|
2017-05-19 22:12:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('div#views-live-preview input[type=submit]').once('views-ajax').each(function (event) {
|
|
|
|
$(this).on('click', function () {
|
|
|
|
this.form.clk = this;
|
|
|
|
return true;
|
2009-05-17 11:16:51 +00:00
|
|
|
});
|
2017-12-03 16:16:29 +00:00
|
|
|
var elementSettings = baseElementSettings;
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
elementSettings.url = $(this.form).attr('action');
|
|
|
|
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
|
2017-05-19 22:12:53 +00:00
|
|
|
return true;
|
|
|
|
}
|
2009-05-17 11:16:51 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
elementSettings.wrapper = 'views-preview-wrapper';
|
|
|
|
elementSettings.method = 'replaceWith';
|
|
|
|
elementSettings.event = 'click';
|
|
|
|
elementSettings.base = $(this).attr('id');
|
|
|
|
elementSettings.element = this;
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2017-12-03 16:16:29 +00:00
|
|
|
Drupal.ajax(elementSettings);
|
2017-05-19 22:12:53 +00:00
|
|
|
});
|
2009-05-17 11:16:51 +00:00
|
|
|
}
|
|
|
|
};
|
2017-05-19 22:12:53 +00:00
|
|
|
})(jQuery, Drupal, drupalSettings);
|