forked from cbsandeep10/IMathAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg.js
More file actions
executable file
·79 lines (73 loc) · 2.2 KB
/
msg.js
File metadata and controls
executable file
·79 lines (73 loc) · 2.2 KB
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
70
71
72
73
74
75
76
77
78
79
//IMathAS (c) 2007 David Lippman
//Flag toggles and pic rotation for message list
function togglecolor(threadid,tagged) {
var imgchg = document.getElementById("tag"+threadid);
if (tagged==1) {
$('#tr'+threadid).addClass("tagged")
imgchg.src = imasroot+"/img/flagfilled.gif";
} else {
$('#tr'+threadid).removeClass("tagged")
imgchg.src = imasroot+"/img/flagempty.gif";
}
}
function toggletagged(threadid) {
var trchg = document.getElementById("tr"+threadid);
if ($('#tr'+threadid).hasClass("tagged")) {
submitTagged(threadid,0);
} else {
submitTagged(threadid,1);
}
return false;
}
function submitTagged(thread,tagged) {
url = AHAHsaveurl + '&threadid='+thread+'&tagged='+tagged;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (typeof req != 'undefined') {
req.onreadystatechange = function() {ahahDone(url, thread, tagged);};
req.open("GET", url, true);
req.send("");
}
}
function ahahDone(url, threadid, tagged) {
if (req.readyState == 4) { // only if req is "loaded"
if (req.status == 200) { // only if "OK"
if (req.responseText=='OK') {
togglecolor(threadid, tagged);
} else {
alert(req.responseText);
alert("Oops, error toggling the tag");
}
} else {
alert(" Couldn't save changes:\n"+ req.status + "\n" +req.statusText);
}
}
}
var picsize = 0;
function rotatepics() {
picsize = (picsize+1)%3;
picshow(picsize);
}
function picshow(size) {
if (size==0) {
els = document.getElementById("myTable").getElementsByTagName("img");
for (var i=0; i<els.length; i++) {
els[i].style.display = "none";
}
} else {
els = document.getElementById("myTable").getElementsByTagName("img");
for (var i=0; i<els.length; i++) {
els[i].style.display = "inline";
if (els[i].getAttribute("src").match("userimg_sm")) {
if (size==2) {
els[i].setAttribute("src",els[i].getAttribute("src").replace("_sm","_"));
}
} else if (size==1) {
els[i].setAttribute("src",els[i].getAttribute("src").replace("_","_sm"));
}
}
}
}