/(function($){ Drupal.behaviors.block_carousel = { attach: function (context, settings) { if ($('.page-node .owl-carousel-rte').length) { $('.owl-carousel-rte').owlCarousel({ pagination: false, navigation: true, // Show next and prev buttons slideSpeed: 300, paginationSpeed: 400, singleItem: true, // "singleItem:true" is a shortcut for: // items : 1, // itemsDesktop : false, // itemsDesktopSmall : false, // itemsTablet: false, itemsMobile: false }); } } }; })(jQuery); ;/*})'"*/ ;/*})'"*/ /** * jQuery Plugin which renders a standard select with hierarchical options as * a set of selects, one for each level of the hierarchy. * */ ; (function ($, window, document, undefined) { // Create the defaults once var pluginName = "simplerSelect", defaults = { noneLabel: "- Please choose -", noneValue: "_none", labels: [] }; // The actual plugin constructor function Plugin(element, options) { this.element = element; this.$element = $(element); // vars this.settings = $.extend({}, defaults, options); this._selectOptions = []; this._tree = null; this._defaults = defaults; this._name = pluginName; // start! this.init(); } Plugin.prototype = { init: function () { // parse options var that = this; $('option', this.element).each(function () { var $this = $(this); var parent = $this.data('parent'); parent = (typeof parent !== 'undefined') ? parent : 0; var value = $this.val(); that._selectOptions.push({ 'value': value, 'parent': parent, 'label': $this.text(), 'children': [] }); }); // console.log(this._selectOptions ); this._tree = this.buildTree(this._selectOptions); if (this._tree == null) { return; } var initialValue = this.$element.val(); var initialParents = []; if (initialValue) { // console.log(typeof initialValue); if (typeof initialValue !== 'string') { // if array, flatten it initialValue = initialValue.shift(); } // get all parents, starting from the initial value initialParents = this.getAllParents(initialValue); // reverse the parents, that they start from the root initialParents.reverse(); // add the current value as the last leave. initialParents.push(initialValue); //console.log(initialParents); } // create the root select var $select = this.createSelect(this._tree); this.$element.after($select); // create the other selects var $currentSelect = $select; $.each(initialParents, function (idx, value) { that.selectSetValue($currentSelect, value); var optionInfo = that.getOptionInfoByValue(value); var $nextSelect = that.createSelect(optionInfo.children, value, idx+1); $currentSelect.after($nextSelect); $currentSelect = $nextSelect; }); //hide the original this.$element.hide(); }, /** * onChange handler of a select element * * @param $currentSelect */ onChange: function ($currentSelect) { // remove deeper selects this.selectRemoveNext($currentSelect); // get the selected value and also set the original drop-down var $selected = $currentSelect.find('option:selected'); var selectedValue = $selected.val(); var parentValue = $selected.data('parent-value'); if (typeof parentValue == 'undefined') { parentValue = selectedValue; } this.$element.val(parentValue); this.$element.change(); if (selectedValue == this.settings.noneValue) { return; } // build new child select var optionInfo = this.getOptionInfoByValue(selectedValue); if (typeof optionInfo.children !== 'undefined') { var currentLevel = this.selectGetLevel($currentSelect); $newSelect = this.createSelect(optionInfo.children, selectedValue, currentLevel); this.addSelectAfter($currentSelect, $newSelect); } }, /** * Given an array of options, build an HTML select element * * @param options * @returns {*|HTMLElement} */ createSelect: function (options, parent, level) { if (options.length < 1) return; var that = this; var parent = typeof parent !== 'undefined' ? parent : that.settings.noneValue; var level = typeof level !== 'undefined' ? level : 0; var label = typeof this.settings.labels[level] !== 'undefined' ? this.settings.labels[level] : ''; var $select = $('