Commit 385024d1 authored by Quan Nguyen's avatar Quan Nguyen

commit 0705

parent f72a8917
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, drupalSettings) {
var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e, $target) {
$target.parents('.vertical-tabs__pane').each(function (index, pane) {
$(pane).data('verticalTab').focus();
});
};
Drupal.behaviors.verticalTabs = {
attach: function attach(context) {
var width = drupalSettings.widthBreakpoint || 640;
var mq = "(max-width: ".concat(width, "px)");
if (window.matchMedia(mq).matches) {
return;
}
$('body').once('vertical-tabs-fragments').on('formFragmentLinkClickOrHashChange.verticalTabs', handleFragmentLinkClickOrHashChange);
$(context).find('[data-vertical-tabs-panes]').once('vertical-tabs').each(function () {
var $this = $(this).addClass('vertical-tabs__panes');
var focusID = $this.find(':hidden.vertical-tabs__active-tab').val();
var tabFocus;
var $details = $this.find('> details');
if ($details.length === 0) {
return;
}
var tabList = $('<ul class="vertical-tabs__menu"></ul>');
$this.wrap('<div class="vertical-tabs clearfix"></div>').before(tabList);
$details.each(function () {
var $that = $(this);
var verticalTab = new Drupal.verticalTab({
title: $that.find('> summary').text(),
details: $that
});
tabList.append(verticalTab.item);
$that.removeClass('collapsed').attr('open', true).addClass('vertical-tabs__pane').data('verticalTab', verticalTab);
if (this.id === focusID) {
tabFocus = $that;
}
});
$(tabList).find('> li').eq(0).addClass('first');
$(tabList).find('> li').eq(-1).addClass('last');
if (!tabFocus) {
var $locationHash = $this.find(window.location.hash);
if (window.location.hash && $locationHash.length) {
tabFocus = $locationHash.closest('.vertical-tabs__pane');
} else {
tabFocus = $this.find('> .vertical-tabs__pane').eq(0);
}
}
if (tabFocus.length) {
tabFocus.data('verticalTab').focus();
}
});
}
};
Drupal.verticalTab = function (settings) {
var self = this;
$.extend(this, settings, Drupal.theme('verticalTab', settings));
this.link.attr('href', "#".concat(settings.details.attr('id')));
this.link.on('click', function (e) {
e.preventDefault();
self.focus();
});
this.link.on('keydown', function (event) {
if (event.keyCode === 13) {
event.preventDefault();
self.focus();
$('.vertical-tabs__pane :input:visible:enabled').eq(0).trigger('focus');
}
});
this.details.on('summaryUpdated', function () {
self.updateSummary();
}).trigger('summaryUpdated');
};
Drupal.verticalTab.prototype = {
focus: function focus() {
this.details.siblings('.vertical-tabs__pane').each(function () {
var tab = $(this).data('verticalTab');
tab.details.hide();
tab.item.removeClass('is-selected');
}).end().show().siblings(':hidden.vertical-tabs__active-tab').val(this.details.attr('id'));
this.item.addClass('is-selected');
$('#active-vertical-tab').remove();
this.link.append("<span id=\"active-vertical-tab\" class=\"visually-hidden\">".concat(Drupal.t('(active tab)'), "</span>"));
},
updateSummary: function updateSummary() {
this.summary.html(this.details.drupalGetSummary());
},
tabShow: function tabShow() {
this.item.show();
this.item.closest('.js-form-type-vertical-tabs').show();
this.item.parent().children('.vertical-tabs__menu-item').removeClass('first').filter(':visible').eq(0).addClass('first');
this.details.removeClass('vertical-tab--hidden').show();
this.focus();
return this;
},
tabHide: function tabHide() {
this.item.hide();
this.item.parent().children('.vertical-tabs__menu-item').removeClass('first').filter(':visible').eq(0).addClass('first');
this.details.addClass('vertical-tab--hidden').hide();
var $firstTab = this.details.siblings('.vertical-tabs__pane:not(.vertical-tab--hidden)').eq(0);
if ($firstTab.length) {
$firstTab.data('verticalTab').focus();
} else {
this.item.closest('.js-form-type-vertical-tabs').hide();
}
return this;
}
};
Drupal.theme.verticalTab = function (settings) {
var tab = {};
tab.item = $('<li class="vertical-tabs__menu-item" tabindex="-1"></li>').append(tab.link = $('<a href="#"></a>').append(tab.title = $('<strong class="vertical-tabs__menu-item-title"></strong>').text(settings.title)).append(tab.summary = $('<span class="vertical-tabs__menu-item-summary"></span>')));
return tab;
};
})(jQuery, Drupal, drupalSettings);;
(function ($, Drupal, drupalSettings) {
'use strict';
Drupal.behaviors.tokenTree = {
attach: function (context, settings) {
$('table.token-tree', context).once('token-tree').each(function () {
$(this).treetable({ expandable: true });
});
}
};
Drupal.behaviors.tokenInsert = {
attach: function (context, settings) {
// Keep track of which textfield was last selected/focused.
$('textarea, input[type="text"]', context).focus(function () {
drupalSettings.tokenFocusedField = this;
});
$('.token-click-insert .token-key', context).once('token-click-insert').each(function () {
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(function () {
var content = this.text;
// Always work in normal text areas that currently have focus.
if (drupalSettings.tokenFocusedField && (drupalSettings.tokenFocusedField.tokenDialogFocus || drupalSettings.tokenFocusedField.tokenHasFocus)) {
insertAtCursor(drupalSettings.tokenFocusedField, content);
}
// Direct tinyMCE support.
else if (typeof(tinyMCE) != 'undefined' && tinyMCE.activeEditor) {
tinyMCE.activeEditor.execCommand('mceInsertContent', false, content);
}
// Direct CKEditor support. Only works if the field currently has focus,
// which is unusual since the dialog is open.
else if (typeof(CKEDITOR) != 'undefined' && CKEDITOR.currentInstance) {
CKEDITOR.currentInstance.insertHtml(content);
}
// Direct CodeMirror support.
else if (typeof(CodeMirror) != 'undefined' && drupalSettings.tokenFocusedField && $(drupalSettings.tokenFocusedField).parents('.CodeMirror').length) {
var editor = $(drupalSettings.tokenFocusedField).parents('.CodeMirror')[0].CodeMirror;
editor.replaceSelection(content);
editor.focus();
}
// WYSIWYG support, should work in all editors if available.
else if (Drupal.wysiwyg && Drupal.wysiwyg.activeId) {
Drupal.wysiwyg.instances[Drupal.wysiwyg.activeId].insert(content)
}
// CKeditor module support.
else if (typeof(CKEDITOR) != 'undefined' && typeof(Drupal.ckeditorActiveId) != 'undefined') {
CKEDITOR.instances[Drupal.ckeditorActiveId].insertHtml(content);
}
else if (drupalSettings.tokenFocusedField) {
insertAtCursor(drupalSettings.tokenFocusedField, content);
}
else {
alert(Drupal.t('First click a text field to insert your tokens into.'));
}
return false;
});
$(this).html(newThis);
});
function insertAtCursor(editor, content) {
// Record the current scroll position.
var scroll = editor.scrollTop;
// IE support.
if (document.selection) {
editor.focus();
var sel = document.selection.createRange();
sel.text = content;
}
// Mozilla/Firefox/Netscape 7+ support.
else if (editor.selectionStart || editor.selectionStart == '0') {
var startPos = editor.selectionStart;
var endPos = editor.selectionEnd;
editor.value = editor.value.substring(0, startPos) + content + editor.value.substring(endPos, editor.value.length);
}
// Fallback, just add to the end of the content.
else {
editor.value += content;
}
// Ensure the textarea does not unexpectedly scroll.
editor.scrollTop = scroll;
}
}
};
})(jQuery, Drupal, drupalSettings);
;
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, debounce) {
$.fn.drupalGetSummary = function () {
var callback = this.data('summaryCallback');
return this[0] && callback ? $.trim(callback(this[0])) : '';
};
$.fn.drupalSetSummary = function (callback) {
var self = this;
if (typeof callback !== 'function') {
var val = callback;
callback = function callback() {
return val;
};
}
return this.data('summaryCallback', callback).off('formUpdated.summary').on('formUpdated.summary', function () {
self.trigger('summaryUpdated');
}).trigger('summaryUpdated');
};
Drupal.behaviors.formSingleSubmit = {
attach: function attach() {
function onFormSubmit(e) {
var $form = $(e.currentTarget);
var formValues = $form.serialize();
var previousValues = $form.attr('data-drupal-form-submit-last');
if (previousValues === formValues) {
e.preventDefault();
} else {
$form.attr('data-drupal-form-submit-last', formValues);
}
}
$('body').once('form-single-submit').on('submit.singleSubmit', 'form:not([method~="GET"])', onFormSubmit);
}
};
function triggerFormUpdated(element) {
$(element).trigger('formUpdated');
}
function fieldsList(form) {
var $fieldList = $(form).find('[name]').map(function (index, element) {
return element.getAttribute('id');
});
return $.makeArray($fieldList);
}
Drupal.behaviors.formUpdated = {
attach: function attach(context) {
var $context = $(context);
var contextIsForm = $context.is('form');
var $forms = (contextIsForm ? $context : $context.find('form')).once('form-updated');
var formFields;
if ($forms.length) {
$.makeArray($forms).forEach(function (form) {
var events = 'change.formUpdated input.formUpdated ';
var eventHandler = debounce(function (event) {
triggerFormUpdated(event.target);
}, 300);
formFields = fieldsList(form).join(',');
form.setAttribute('data-drupal-form-fields', formFields);
$(form).on(events, eventHandler);
});
}
if (contextIsForm) {
formFields = fieldsList(context).join(',');
var currentFields = $(context).attr('data-drupal-form-fields');
if (formFields !== currentFields) {
triggerFormUpdated(context);
}
}
},
detach: function detach(context, settings, trigger) {
var $context = $(context);
var contextIsForm = $context.is('form');
if (trigger === 'unload') {
var $forms = (contextIsForm ? $context : $context.find('form')).removeOnce('form-updated');
if ($forms.length) {
$.makeArray($forms).forEach(function (form) {
form.removeAttribute('data-drupal-form-fields');
$(form).off('.formUpdated');
});
}
}
}
};
Drupal.behaviors.fillUserInfoFromBrowser = {
attach: function attach(context, settings) {
var userInfo = ['name', 'mail', 'homepage'];
var $forms = $('[data-user-info-from-browser]').once('user-info-from-browser');
if ($forms.length) {
userInfo.forEach(function (info) {
var $element = $forms.find("[name=".concat(info, "]"));
var browserData = localStorage.getItem("Drupal.visitor.".concat(info));
var emptyOrDefault = $element.val() === '' || $element.attr('data-drupal-default-value') === $element.val();
if ($element.length && emptyOrDefault && browserData) {
$element.val(browserData);
}
});
}
$forms.on('submit', function () {
userInfo.forEach(function (info) {
var $element = $forms.find("[name=".concat(info, "]"));
if ($element.length) {
localStorage.setItem("Drupal.visitor.".concat(info), $element.val());
}
});
});
}
};
var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e) {
var url;
if (e.type === 'click') {
url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget;
} else {
url = window.location;
}
var hash = url.hash.substr(1);
if (hash) {
var $target = $("#".concat(hash));
$('body').trigger('formFragmentLinkClickOrHashChange', [$target]);
setTimeout(function () {
return $target.trigger('focus');
}, 300);
}
};
var debouncedHandleFragmentLinkClickOrHashChange = debounce(handleFragmentLinkClickOrHashChange, 300, true);
$(window).on('hashchange.form-fragment', debouncedHandleFragmentLinkClickOrHashChange);
$(document).on('click.form-fragment', 'a[href*="#"]', debouncedHandleFragmentLinkClickOrHashChange);
})(jQuery, Drupal, Drupal.debounce);;
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, drupalSettings) {
Drupal.behaviors.machineName = {
attach: function attach(context, settings) {
var self = this;
var $context = $(context);
var timeout = null;
var xhr = null;
function clickEditHandler(e) {
var data = e.data;
data.$wrapper.removeClass('visually-hidden');
data.$target.trigger('focus');
data.$suffix.hide();
data.$source.off('.machineName');
}
function machineNameHandler(e) {
var data = e.data;
var options = data.options;
var baseValue = $(e.target).val();
var rx = new RegExp(options.replace_pattern, 'g');
var expected = baseValue.toLowerCase().replace(rx, options.replace).substr(0, options.maxlength);
if (xhr && xhr.readystate !== 4) {
xhr.abort();
xhr = null;
}
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
if (baseValue.toLowerCase() !== expected) {
timeout = setTimeout(function () {
xhr = self.transliterate(baseValue, options).done(function (machine) {
self.showMachineName(machine.substr(0, options.maxlength), data);
});
}, 300);
} else {
self.showMachineName(expected, data);
}
}
Object.keys(settings.machineName).forEach(function (sourceId) {
var options = settings.machineName[sourceId];
var $source = $context.find(sourceId).addClass('machine-name-source').once('machine-name');
var $target = $context.find(options.target).addClass('machine-name-target');
var $suffix = $context.find(options.suffix);
var $wrapper = $target.closest('.js-form-item');
if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) {
return;
}
if ($target.hasClass('error')) {
return;
}
options.maxlength = $target.attr('maxlength');
$wrapper.addClass('visually-hidden');
var machine = $target.val();
var $preview = $("<span class=\"machine-name-value\">".concat(options.field_prefix).concat(Drupal.checkPlain(machine)).concat(options.field_suffix, "</span>"));
$suffix.empty();
if (options.label) {
$suffix.append("<span class=\"machine-name-label\">".concat(options.label, ": </span>"));
}
$suffix.append($preview);
if ($target.is(':disabled')) {
return;
}
var eventData = {
$source: $source,
$target: $target,
$suffix: $suffix,
$wrapper: $wrapper,
$preview: $preview,
options: options
};
if (machine === '' && $source.val() !== '') {
self.transliterate($source.val(), options).done(function (machineName) {
self.showMachineName(machineName.substr(0, options.maxlength), eventData);
});
}
var $link = $("<span class=\"admin-link\"><button type=\"button\" class=\"link\">".concat(Drupal.t('Edit'), "</button></span>")).on('click', eventData, clickEditHandler);
$suffix.append($link);
if ($target.val() === '') {
$source.on('formUpdated.machineName', eventData, machineNameHandler).trigger('formUpdated.machineName');
}
$target.on('invalid', eventData, clickEditHandler);
});
},
showMachineName: function showMachineName(machine, data) {
var settings = data.options;
if (machine !== '') {
if (machine !== settings.replace) {
data.$target.val(machine);
data.$preview.html(settings.field_prefix + Drupal.checkPlain(machine) + settings.field_suffix);
}
data.$suffix.show();
} else {
data.$suffix.hide();
data.$target.val(machine);
data.$preview.empty();
}
},
transliterate: function transliterate(source, settings) {
return $.get(Drupal.url('machine_name/transliterate'), {
text: source,
langcode: drupalSettings.langcode,
replace_pattern: settings.replace_pattern,
replace_token: settings.replace_token,
replace: settings.replace,
lowercase: true
});
}
};
})(jQuery, Drupal, drupalSettings);;
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
function DetailsSummarizedContent(node) {
this.$node = $(node);
this.setupSummary();
}
$.extend(DetailsSummarizedContent, {
instances: []
});
$.extend(DetailsSummarizedContent.prototype, {
setupSummary: function setupSummary() {
this.$detailsSummarizedContentWrapper = $(Drupal.theme('detailsSummarizedContentWrapper'));
this.$node.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this)).trigger('summaryUpdated').find('> summary').append(this.$detailsSummarizedContentWrapper);
},
onSummaryUpdated: function onSummaryUpdated() {
var text = $.trim(this.$node.drupalGetSummary());
this.$detailsSummarizedContentWrapper.html(Drupal.theme('detailsSummarizedContentText', text));
}
});
Drupal.behaviors.detailsSummary = {
attach: function attach(context) {
var $detailsElements = $(context).find('details').once('details');
DetailsSummarizedContent.instances = DetailsSummarizedContent.instances.concat($detailsElements.map(function (index, details) {
return new DetailsSummarizedContent(details);
}).get());
}
};
Drupal.DetailsSummarizedContent = DetailsSummarizedContent;
Drupal.theme.detailsSummarizedContentWrapper = function () {
return "<span class=\"summary\"></span>";
};
Drupal.theme.detailsSummarizedContentText = function (text) {
return text ? " (".concat(text, ")") : '';
};
})(jQuery, Drupal);;
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
Drupal.behaviors.detailsAria = {
attach: function attach() {
$('body').once('detailsAria').on('click.detailsAria', 'summary', function (event) {
var $summary = $(event.currentTarget);
var open = $(event.currentTarget.parentNode).attr('open') === 'open' ? 'false' : 'true';
$summary.attr({
'aria-expanded': open,
'aria-pressed': open
});
});
}
};
})(jQuery, Drupal);;
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Modernizr, Drupal) {
function CollapsibleDetails(node) {
this.$node = $(node);
this.$node.data('details', this);
var anchor = window.location.hash && window.location.hash !== '#' ? ", ".concat(window.location.hash) : '';
if (this.$node.find(".error".concat(anchor)).length) {
this.$node.attr('open', true);
}
this.setupSummaryPolyfill();
}
$.extend(CollapsibleDetails, {
instances: []
});
$.extend(CollapsibleDetails.prototype, {
setupSummaryPolyfill: function setupSummaryPolyfill() {
var $summary = this.$node.find('> summary');
$('<span class="details-summary-prefix visually-hidden"></span>').append(this.$node.attr('open') ? Drupal.t('Hide') : Drupal.t('Show')).prependTo($summary).after(document.createTextNode(' '));
$('<a class="details-title"></a>').attr('href', "#".concat(this.$node.attr('id'))).prepend($summary.contents()).appendTo($summary);
$summary.append(this.$summary).on('click', $.proxy(this.onSummaryClick, this));
},
onSummaryClick: function onSummaryClick(e) {
this.toggle();
e.preventDefault();
},
toggle: function toggle() {
var _this = this;
var isOpen = !!this.$node.attr('open');
var $summaryPrefix = this.$node.find('> summary span.details-summary-prefix');
if (isOpen) {
$summaryPrefix.html(Drupal.t('Show'));
} else {
$summaryPrefix.html(Drupal.t('Hide'));
}
setTimeout(function () {
_this.$node.attr('open', !isOpen);
}, 0);
}
});
Drupal.behaviors.collapse = {
attach: function attach(context) {
if (Modernizr.details) {
return;
}
var $collapsibleDetails = $(context).find('details').once('collapse').addClass('collapse-processed');
if ($collapsibleDetails.length) {
for (var i = 0; i < $collapsibleDetails.length; i++) {
CollapsibleDetails.instances.push(new CollapsibleDetails($collapsibleDetails[i]));
}
}
}
};
var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e, $target) {
$target.parents('details').not('[open]').find('> summary').trigger('click');
};
$('body').on('formFragmentLinkClickOrHashChange.details', handleFragmentLinkClickOrHashChange);
Drupal.CollapsibleDetails = CollapsibleDetails;
})(jQuery, Modernizr, Drupal);;
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
var states = {
postponed: []
};
Drupal.states = states;
function invert(a, invertState) {
return invertState && typeof a !== 'undefined' ? !a : a;
}
function _compare2(a, b) {
if (a === b) {
return typeof a === 'undefined' ? a : true;
}
return typeof a === 'undefined' || typeof b === 'undefined';
}
function ternary(a, b) {
if (typeof a === 'undefined') {
return b;
}
if (typeof b === 'undefined') {
return a;
}
return a && b;
}
Drupal.behaviors.states = {
attach: function attach(context, settings) {
var $states = $(context).find('[data-drupal-states]');
var il = $states.length;
var _loop = function _loop(i) {
var config = JSON.parse($states[i].getAttribute('data-drupal-states'));
Object.keys(config || {}).forEach(function (state) {
new states.Dependent({
element: $($states[i]),
state: states.State.sanitize(state),
constraints: config[state]
});
});
};
for (var i = 0; i < il; i++) {
_loop(i);
}
while (states.postponed.length) {
states.postponed.shift()();
}
}
};
states.Dependent = function (args) {
var _this = this;
$.extend(this, {
values: {},
oldValue: null
}, args);
this.dependees = this.getDependees();
Object.keys(this.dependees || {}).forEach(function (selector) {
_this.initializeDependee(selector, _this.dependees[selector]);
});
};
states.Dependent.comparisons = {
RegExp: function RegExp(reference, value) {
return reference.test(value);
},
Function: function Function(reference, value) {
return reference(value);
},
Number: function Number(reference, value) {
return typeof value === 'string' ? _compare2(reference.toString(), value) : _compare2(reference, value);
}
};
states.Dependent.prototype = {
initializeDependee: function initializeDependee(selector, dependeeStates) {
var _this2 = this;
this.values[selector] = {};
Object.keys(dependeeStates).forEach(function (i) {
var state = dependeeStates[i];
if ($.inArray(state, dependeeStates) === -1) {
return;
}
state = states.State.sanitize(state);
_this2.values[selector][state.name] = null;
$(selector).on("state:".concat(state), {
selector: selector,
state: state
}, function (e) {
_this2.update(e.data.selector, e.data.state, e.value);
});
new states.Trigger({
selector: selector,
state: state
});
});
},
compare: function compare(reference, selector, state) {
var value = this.values[selector][state.name];
if (reference.constructor.name in states.Dependent.comparisons) {
return states.Dependent.comparisons[reference.constructor.name](reference, value);
}
return _compare2(reference, value);
},
update: function update(selector, state, value) {
if (value !== this.values[selector][state.name]) {
this.values[selector][state.name] = value;
this.reevaluate();
}
},
reevaluate: function reevaluate() {
var value = this.verifyConstraints(this.constraints);
if (value !== this.oldValue) {
this.oldValue = value;
value = invert(value, this.state.invert);
this.element.trigger({
type: "state:".concat(this.state),
value: value,
trigger: true
});
}
},
verifyConstraints: function verifyConstraints(constraints, selector) {
var result;
if ($.isArray(constraints)) {
var hasXor = $.inArray('xor', constraints) === -1;
var len = constraints.length;
for (var i = 0; i < len; i++) {
if (constraints[i] !== 'xor') {
var constraint = this.checkConstraints(constraints[i], selector, i);
if (constraint && (hasXor || result)) {
return hasXor;
}
result = result || constraint;
}
}
} else if ($.isPlainObject(constraints)) {
for (var n in constraints) {
if (constraints.hasOwnProperty(n)) {
result = ternary(result, this.checkConstraints(constraints[n], selector, n));
if (result === false) {
return false;
}
}
}
}
return result;
},
checkConstraints: function checkConstraints(value, selector, state) {
if (typeof state !== 'string' || /[0-9]/.test(state[0])) {
state = null;
} else if (typeof selector === 'undefined') {
selector = state;
state = null;
}
if (state !== null) {
state = states.State.sanitize(state);
return invert(this.compare(value, selector, state), state.invert);
}
return this.verifyConstraints(value, selector);
},
getDependees: function getDependees() {
var cache = {};
var _compare = this.compare;
this.compare = function (reference, selector, state) {
(cache[selector] || (cache[selector] = [])).push(state.name);
};
this.verifyConstraints(this.constraints);
this.compare = _compare;
return cache;
}
};
states.Trigger = function (args) {
$.extend(this, args);
if (this.state in states.Trigger.states) {
this.element = $(this.selector);
if (!this.element.data("trigger:".concat(this.state))) {
this.initialize();
}
}
};
states.Trigger.prototype = {
initialize: function initialize() {
var _this3 = this;
var trigger = states.Trigger.states[this.state];
if (typeof trigger === 'function') {
trigger.call(window, this.element);
} else {
Object.keys(trigger || {}).forEach(function (event) {
_this3.defaultTrigger(event, trigger[event]);
});
}
this.element.data("trigger:".concat(this.state), true);
},
defaultTrigger: function defaultTrigger(event, valueFn) {
var oldValue = valueFn.call(this.element);
this.element.on(event, $.proxy(function (e) {
var value = valueFn.call(this.element, e);
if (oldValue !== value) {
this.element.trigger({
type: "state:".concat(this.state),
value: value,
oldValue: oldValue
});
oldValue = value;
}
}, this));
states.postponed.push($.proxy(function () {
this.element.trigger({
type: "state:".concat(this.state),
value: oldValue,
oldValue: null
});
}, this));
}
};
states.Trigger.states = {
empty: {
keyup: function keyup() {
return this.val() === '';
}
},
checked: {
change: function change() {
var checked = false;
this.each(function () {
checked = $(this).prop('checked');
return !checked;
});
return checked;
}
},
value: {
keyup: function keyup() {
if (this.length > 1) {
return this.filter(':checked').val() || false;
}
return this.val();
},
change: function change() {
if (this.length > 1) {
return this.filter(':checked').val() || false;
}
return this.val();
}
},
collapsed: {
collapsed: function collapsed(e) {
return typeof e !== 'undefined' && 'value' in e ? e.value : !this.is('[open]');
}
}
};
states.State = function (state) {
this.pristine = state;
this.name = state;
var process = true;
do {
while (this.name.charAt(0) === '!') {
this.name = this.name.substring(1);
this.invert = !this.invert;
}
if (this.name in states.State.aliases) {
this.name = states.State.aliases[this.name];
} else {
process = false;
}
} while (process);
};
states.State.sanitize = function (state) {
if (state instanceof states.State) {
return state;
}
return new states.State(state);
};
states.State.aliases = {
enabled: '!disabled',
invisible: '!visible',
invalid: '!valid',
untouched: '!touched',
optional: '!required',
filled: '!empty',
unchecked: '!checked',
irrelevant: '!relevant',
expanded: '!collapsed',
open: '!collapsed',
closed: 'collapsed',
readwrite: '!readonly'
};
states.State.prototype = {
invert: false,
toString: function toString() {
return this.name;
}
};
var $document = $(document);
$document.on('state:disabled', function (e) {
if (e.trigger) {
$(e.target).prop('disabled', e.value).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value).find('select, input, textarea').prop('disabled', e.value);
}
});
$document.on('state:required', function (e) {
if (e.trigger) {
if (e.value) {
var label = "label".concat(e.target.id ? "[for=".concat(e.target.id, "]") : '');
var $label = $(e.target).attr({
required: 'required',
'aria-required': 'true'
}).closest('.js-form-item, .js-form-wrapper').find(label);
if (!$label.hasClass('js-form-required').length) {
$label.addClass('js-form-required form-required');
}
} else {
$(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required');
}
}
});
$document.on('state:visible', function (e) {
if (e.trigger) {
$(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggle(e.value);
}
});
$document.on('state:checked', function (e) {
if (e.trigger) {
$(e.target).prop('checked', e.value);
}
});
$document.on('state:collapsed', function (e) {
if (e.trigger) {
if ($(e.target).is('[open]') === e.value) {
$(e.target).find('> summary').trigger('click');
}
}
});
})(jQuery, Drupal);;
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -20,11 +20,13 @@ regions: ...@@ -20,11 +20,13 @@ regions:
content_second: 'Content Second' content_second: 'Content Second'
sidebar_right_second: 'Sidebar Right Second' sidebar_right_second: 'Sidebar Right Second'
content_third: 'Content Third' content_third: 'Content Third'
sidebar_right_third: 'Sidebar Right Third'
content_four: 'Content Four' content_four: 'Content Four'
sidebar_right_four: 'Sidebar Right Four'
content_five: 'Content Five' content_five: 'Content Five'
sidebar_right_five: 'Sidebar Right Five'
content_six: 'Content Six' content_six: 'Content Six'
sidebar_right_six: 'Sidebar Right Six' content_seven: 'Content Seven'
sidebar_right_seven: 'Sidebar Right Seven'
gallery: 'Gallery' gallery: 'Gallery'
ambassador: 'Ambassador' ambassador: 'Ambassador'
top_main_content: 'Top Main Content' top_main_content: 'Top Main Content'
......
...@@ -126,29 +126,49 @@ ...@@ -126,29 +126,49 @@
</div> </div>
</section> </section>
<section class="hot-news">
<div class="row">
<div class="col-lg-9 col-md-8 col-12">
<!-- content_third -->
{% if page.content_third %}
{{page.content_third}}
{% endif %}
<!-- end content_third -->
</div>
<div class="col-lg-3 col-md-4 col-12">
<!-- sidebar_right_third -->
{% if page.sidebar_right_third %}
{{page.sidebar_right_third}}
{% endif %}
<!-- end sidebar_right_third -->
</div>
</div>
</section>
<section class="impressive mb-5"> <section class="impressive mb-5">
<!-- sidebar_right_second --> <!-- content_four -->
{% if page.content_third %} {% if page.content_four %}
{{page.content_third}} {{page.content_four}}
{% endif %} {% endif %}
<!-- end sidebar_right_second --> <!-- end content_four -->
</section> </section>
<section class="hot-news"> <section class="hot-news">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-8 col-12"> <div class="col-lg-9 col-md-8 col-12">
<!-- content_four --> <!-- content_five -->
{% if page.content_four %} {% if page.content_five %}
{{page.content_four}} {{page.content_five}}
{% endif %} {% endif %}
<!-- end content_four --> <!-- end content_five -->
</div> </div>
<div class="col-lg-3 col-md-4 col-12"> <div class="col-lg-3 col-md-4 col-12">
<!-- sidebar_right_four --> <!-- sidebar_right_five -->
{% if page.sidebar_right_four %} {% if page.sidebar_right_five %}
{{page.sidebar_right_four}} {{page.sidebar_right_five}}
{% endif %} {% endif %}
<!-- end sidebar_right_four --> <!-- end sidebar_right_five -->
</div> </div>
</div> </div>
...@@ -156,29 +176,29 @@ ...@@ -156,29 +176,29 @@
<div class="banner d-lg-block d-none"> <div class="banner d-lg-block d-none">
<div class="row"> <div class="row">
<!-- content_five --> <!-- content_six -->
{% if page.content_five %} {% if page.content_six %}
{{page.content_five}} {{page.content_six}}
{% endif %} {% endif %}
<!-- end content_five --> <!-- end content_six -->
</div> </div>
</div> </div>
<section class="hot-news"> <section class="hot-news">
<div class="row"> <div class="row">
<div class="col-lg-9 col-12"> <div class="col-lg-9 col-12">
<!-- content_six --> <!-- content_seven -->
{% if page.content_six %} {% if page.content_seven %}
{{page.content_six}} {{page.content_seven}}
{% endif %} {% endif %}
<!-- end content_six --> <!-- end content_seven -->
</div> </div>
<div class="col-lg-3 col-12"> <div class="col-lg-3 col-12">
<!-- sidebar_right_six --> <!-- sidebar_right_seven -->
{% if page.sidebar_right_six %} {% if page.sidebar_right_seven %}
{{page.sidebar_right_six}} {{page.sidebar_right_seven}}
{% endif %} {% endif %}
<!-- end sidebar_right_six --> <!-- end sidebar_right_seven -->
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment