-
Notifications
You must be signed in to change notification settings - Fork 0
/
voyeur-admin.js
43 lines (42 loc) · 2.16 KB
/
voyeur-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
35
36
37
38
39
40
41
42
43
Drupal.behaviors.VoyeurBehaviorAdmin = function (context) {
// Load our dynamic tool options right from the beginning.
voyeurUpdateOptions($('#voyeur-admin'), $('#edit-voyeur-tool').val());
$('#edit-voyeur-tool').change(function() {
voyeurUpdateOptions($('#voyeur-admin'), $('#edit-voyeur-tool').val());
});
}
/**
* Handles changing options available when a user changes the tool.
*
* @param object voyeurSettingsForm References jQuery widget area.
* @param object voyeurSettingsForm References jQuery widget area.
* @param string currentTool The current tool that was just selected.
*/
function voyeurUpdateOptions(voyeurSettingsForm, currentTool) {
var fadeTime = 250;
if (currentTool == 'Reader' || currentTool == 'WordCountFountain') {
voyeurSettingsForm.find('#edit-voyeur-by-user-remove-func-words-wrapper').fadeOut(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-limit-wrapper').fadeOut(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-query-wrapper').fadeOut(fadeTime);
}
if (currentTool == 'Cirrus') {
voyeurSettingsForm.find('#edit-voyeur-by-user-remove-func-words-wrapper').fadeIn(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-limit-wrapper').fadeIn(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-query-wrapper').fadeOut(fadeTime);
}
if (currentTool == 'CorpusTypeFrequenciesGrid') {
voyeurSettingsForm.find('#edit-voyeur-by-user-remove-func-words-wrapper').fadeIn(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-limit-wrapper').fadeOut(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-query-wrapper').fadeIn(fadeTime);
}
if (currentTool == 'Bubbles' || currentTool == 'Links') {
voyeurSettingsForm.find('#edit-voyeur-by-user-remove-func-words-wrapper').fadeIn(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-limit-wrapper').fadeOut(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-query-wrapper').fadeOut(fadeTime);
}
if (currentTool == 'CorpusSummary') {
voyeurSettingsForm.find('#edit-voyeur-by-user-remove-func-words-wrapper').fadeIn(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-limit-wrapper').fadeOut(fadeTime);
voyeurSettingsForm.find('#edit-voyeur-query-wrapper').fadeOut(fadeTime);
}
}