Now all modules are in core modules folder

This commit is contained in:
Manuel Cillero 2017-08-08 12:14:45 +02:00
parent 5ba1cdfa0b
commit 05b6a91b0c
1907 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,113 @@
;(function($) {
Drupal.behaviors.custom_search = function (context) {
if (!Drupal.settings.custom_search.solr) {
// Check if the search box is not empty on submit
$('form.search-form', context).submit(function(){
var box = $(this).find('input.custom-search-box');
if (box.val() != undefined && (box.val() == '' || box.val() == $(this).find('input.default-text').val())) {
$(this).find('input.custom-search-box').addClass('error');
return false;
}
// If basic search is hidden, copy or value to the keys
if ($(this).find('#edit-keys').parents('div.element-invisible').attr('class') == 'element-invisible') {
$(this).find('#edit-keys').val($(this).find('#edit-or').val());
$(this).find('#edit-or').val('');
}
return true;
});
}
// Search from target
$('form.search-form').attr('target', Drupal.settings.custom_search.form_target);
// Clear default text on focus, and put it back on blur. Also displays Popup.
$('input.custom-search-box', context)
.blur(function(e){
var $this = $(this);
var $parentForm = $this.parents('form');
if ($this.val() == '') {
$this.addClass('custom-search-default-value');
$this.val($parentForm.find('input.default-text').val());
}
})
.bind('click focus', function(e){
var $this = $(this);
var $parentForm = $this.parents('form');
if ($this.val() == $parentForm.find('input.default-text').val()) $this.val('');
$this.removeClass('custom-search-default-value');
// check if there's something in the popup and displays it
var popup = $parentForm.find('fieldset.custom_search-popup');
if (popup.find('input,select').length && !popup.hasClass('opened')) popup.fadeIn().addClass('opened');
e.stopPropagation();
}
);
$(document).bind('click focus', function(){
$('fieldset.custom_search-popup').hide().removeClass('opened');
});
// Handle checkboxes
$('.custom-search-selector input:checkbox', context).each(function(){
var el = $(this);
if (el.val() == 'c-all') {
el.change(function(){
$(this).parents('.custom-search-selector').find('input:checkbox[value!=c-all]').attr('checked', false);
});
}
else {
if (el.val().substr(0,2) == 'c-') {
el.change(function(){
$('.custom-search-selector input:checkbox').each(function(){
if ($(this).val().substr(0,2) == 'o-') $(this).attr('checked', false);
});
$(this).parents('.custom-search-selector').find('input:checkbox[value=c-all]').attr('checked', false);
});
} else {
el.change(function(){
$(this).parents('.custom-search-selector').find('input:checkbox[value!='+el.val()+']').attr('checked', false);
});
}
}
});
// Reselect types and terms in advanced search
var edit_keys = $('#edit-keys').val();
if(edit_keys) {
// types
var pos = edit_keys.indexOf('type:');
if (pos) {
var pos2 = edit_keys.indexOf(' ',pos);
if (pos2==-1) pos2 = edit_keys.length;
var types = edit_keys.substring(pos+5,pos2);
types = types.split(',');
for (var i=0; i<types.length; i++) {
$('.search-form input:checkbox[value='+types[i]+']').attr('checked', true);
}
}
// terms
var pos = edit_keys.indexOf('category:');
if (pos) {
var pos2 = edit_keys.indexOf(' ',pos);
if (pos2==-1) pos2 = edit_keys.length;
var terms = edit_keys.substring(pos+9,pos2);
terms = terms.split(',');
for (var i=0; i<terms.length; i++) {
$('.search-form option[value='+terms[i]+']').attr('selected', true);
}
}
}
var popup = $('fieldset.custom_search-popup:not(.custom_search-processed)', context).addClass("custom_search-processed");
popup.click(function(e){
e.stopPropagation();
})
popup.append('<a class="custom_search-popup-close" href="#">' + Drupal.t('Close') + '</a>');
$('a.custom_search-popup-close').click(function(e){
$('fieldset.custom_search-popup.opened').hide().removeClass('opened');
e.preventDefault();
});
}
}(jQuery));

View file

@ -0,0 +1,92 @@
;(function($) {
/**
* Move a block in the blocks table from one region to another via select list.
*
* This behavior is dependent on the tableDrag behavior, since it uses the
* objects initialized in that behavior to update the row.
*/
Drupal.behaviors.customSearchSort = function(context) {
var table = $('table#elements');
var tableDrag = Drupal.tableDrag.elements; // Get the blocks tableDrag object.
// Add a handler for when a row is swapped, update empty regions.
tableDrag.row.prototype.onSwap = function(swappedRow) {
checkEmptyRegions(table, this);
};
// Add a handler so when a row is dropped, update fields dropped into new regions.
tableDrag.onDrop = function() {
var dragObject = this;
if ($(dragObject.rowObject.element).prev('tr').is('.region-message')) {
var regionRow = $(dragObject.rowObject.element).prev('tr').get(0);
var regionName = regionRow.className.replace(/([^ ]+[ ]+)*region-([^ ]+)-message([ ]+[^ ]+)*/, '$2');
var regionField = $('select.region-select', dragObject.rowObject.element);
var weightField = $('select.sort-select', dragObject.rowObject.element);
var oldRegionName = weightField[0].className.replace(/([^ ]+[ ]+)*sort-select-([^ ]+)([ ]+[^ ]+)*/, '$2');
if (!regionField.is('.region-select-'+ regionName)) {
regionField.removeClass('region-select-' + oldRegionName).addClass('region-select-' + regionName);
weightField.removeClass('sort-select-' + oldRegionName).addClass('sort-select-' + regionName);
regionField.val(regionName);
}
}
};
// Add the behavior to each region select list.
$('select.region-select:not(.regionselect-processed)', context).each(function() {
$(this).change(function(event) {
// Make our new row and select field.
var row = $(this).parents('tr:first');
var select = $(this);
tableDrag.rowObject = new tableDrag.row(row);
// Find the correct region and insert the row as the first in the region.
$('tr.region-message', table).each(function() {
if ($(this).is('.region-' + select[0].value + '-message')) {
// Add the new row and remove the old one.
$(this).after(row);
// Manually update weights and restripe.
tableDrag.updateFields(row.get(0));
tableDrag.rowObject.changed = true;
if (tableDrag.oldRowElement) {
$(tableDrag.oldRowElement).removeClass('drag-previous');
}
tableDrag.oldRowElement = row.get(0);
tableDrag.restripeTable();
tableDrag.rowObject.markChanged();
tableDrag.oldRowElement = row;
$(row).addClass('drag-previous');
}
});
// Modify empty regions with added or removed fields.
checkEmptyRegions(table, row);
// Remove focus from selectbox.
select.get(0).blur();
});
$(this).addClass('regionselect-processed');
});
var checkEmptyRegions = function(table, rowObject) {
$('tr.region-message', table).each(function() {
// If the dragged row is in this region, but above the message row, swap it down one space.
if ($(this).prev('tr').get(0) == rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows up.
if ((rowObject.method != 'keyboard' || rowObject.direction == 'down')) {
rowObject.swap('after', this);
}
}
// This region has become empty
if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').size() == 0) {
$(this).removeClass('region-populated').addClass('region-empty');
}
// This region has become populated.
else if ($(this).is('.region-empty')) {
$(this).removeClass('region-empty').addClass('region-populated');
}
});
};
};
}(jQuery));