forked from yhahn/searchlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchlight.admin.js
34 lines (33 loc) · 1.36 KB
/
searchlight.admin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// $Id$
(function ($) {
Drupal.behaviors.searchlight = {
attach: function(context, settiongs) {
$('.searchlight-backend-select:not(.searchlight-processed)', context).each(function() {
$(this).change(function() {
var value = $(this).val();
$('.searchlight-backend-settings').hide();
$('.searchlight-backend-' + value).show();
});
$(this).change();
}).addClass('searchlight-processed');
$('.searchlight-admin-environment .environment-settings:not(.searchlight-processed)', context).each(function() {
$('a.environment-settings-link', this).click(function() {
if ($(this).is('.settings-active')) {
$('.searchlight-admin-environment .environment-settings-form').hide();
$('a.environment-settings-link').removeClass('settings-active');
}
else {
// Hide & show per-facet settings forms.
$('.searchlight-admin-environment .environment-settings-form').hide();
var target = $(this).attr('href').split('#')[1];
$('#' + target).show();
// Set link classes.
$('a.environment-settings-link').removeClass('settings-active');
$(this).addClass('settings-active');
}
});
$(this).change();
}).addClass('searchlight-processed');
}
}
})(jQuery);