/
sectionprefs.js
69 lines (58 loc) · 2.16 KB
/
sectionprefs.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
; // $Id$
function configSectionPopup() {
var title = "<a href=\"#\" onclick=\"window.location.reload()\" style=\"color:#fff;\">Sectional Display Prefs</a> ";
var buttons = createPopupButtons("<a href=\"/faq/UI.shtml#ui500\">[?]</a>","<a href=\"#\" onclick=\"window.location.reload()\">[X]</a>");
title = title + buttons;
createPopup(getXYForId('links-sections-title'), title, "sectionprefs", "", "Loading...");
var url = 'ajax.pl';
var params = {};
params['op'] = 'getSectionPrefsHTML';
ajax_update(params, 'sectionprefs-contents');
}
function masterChange(el) {
swapClassColors('secpref_master','secpref_nexus_row');
updateNexusAllTidPrefs(el);
//postSectionPrefChanges(el);
}
function individualChange(el) {
swapClassColors('secpref_nexus_row','secpref_master');
//postSectionPrefChanges(el);
}
function postSectionPrefChanges(el) {
var params = {};
params['op'] = 'setSectionNexusPrefs';
params[el.name] = el.value;
var sec_pref_msg = $dom("sectionprefs-message");
sec_pref_msg.innerHTML = "Saving...";
var url = 'ajax.pl';
ajax_update(params, 'sectionprefs-message');
}
function swapClassColors(class_name_active, class_name_deactive) {
for (i=0; i <document.getElementsByTagName("tr").length; i++) {
if (document.getElementsByTagName("tr").item(i).className == class_name_active){
document.getElementsByTagName("tr").item(i).style.color = "#000";
document.getElementsByTagName("tr").item(i).style.background = "#fff";
} else if (document.getElementsByTagName("tr").item(i).className == class_name_deactive){
document.getElementsByTagName("tr").item(i).style.color = "#999";
document.getElementsByTagName("tr").item(i).style.background = "#ccc";
}
}
}
function updateNexusAllTidPrefs(el) {
//theForm = document.forms["sectionprefs"];
theForm = document.forms["modal_prefs"];
for(i=0; i<theForm.elements.length; i++){
var regex = /^nexustid\d+$/;
if (regex.test(theForm.elements[i].name)) {
if (theForm.elements[i].value == el.value) {
theForm.elements[i].checked = true;
} else {
theForm.elements[i].checked = false;
}
}
}
}
function reportError(request) {
// replace with something else
alert("error");
}