math_vis: remove use of register_module
[blender-addons.git] / netrender / netrender.js
blob9839a219654a1f7b3a9dfd27e36c305022e494c1
1 lastFrame = -1
2 maxFrame = -1
3 minFrame = -1
5 function request(url, data)
7 xmlhttp = new XMLHttpRequest();
8 xmlhttp.open("POST", url, false);
9 xmlhttp.send(data);
10 window.location.reload()
13 function edit(id, info)
15 request("/edit_" + id, info)
18 function clear_jobs()
20 var r=confirm("Also delete files on master?");
22 if (r==true) {
23 request('/clear', '{"clear":true}');
24 } else {
25 request('/clear', '{"clear":false}');
29 function cancel_job(id)
31 var r=confirm("Also delete files on master?");
33 if (r==true) {
34 request('/cancel_' + id, '{"clear":true}');
35 } else {
36 request('/cancel_' + id, '{"clear":false}');
40 function balance_edit(id, old_value)
42 var new_value = prompt("New limit", old_value);
43 if (new_value != null && new_value != "") {
44 request("/balance_limit", '{"' + id + '":"' + new_value + '"}');
48 function balance_enable(id, value)
50 request("/balance_enable", '{"' + id + '":' + value + "}");
53 function showThumb(job, frame)
55 if (lastFrame != -1) {
57 if (maxFrame != -1 && minFrame != -1) {
58 if (frame >= minFrame && frame <= maxFrame) {
59 for(i = minFrame; i <= maxFrame; i=i+1) {
60 toggleThumb(job, i);
62 minFrame = -1;
63 maxFrame = -1;
64 lastFrame = -1;
65 } else if (frame > maxFrame) {
66 for(i = maxFrame+1; i <= frame; i=i+1) {
67 toggleThumb(job, i);
69 maxFrame = frame;
70 lastFrame = frame;
71 } else {
72 for(i = frame; i <= minFrame-1; i=i+1) {
73 toggleThumb(job, i);
75 minFrame = frame;
76 lastFrame = frame;
78 } else if (frame == lastFrame) {
79 toggleThumb(job, frame);
80 } else if (frame < lastFrame) {
81 minFrame = frame;
82 maxFrame = lastFrame;
84 for(i = minFrame; i <= maxFrame-1; i=i+1) {
85 toggleThumb(job, i);
87 lastFrame = frame;
88 } else {
89 minFrame = lastFrame;
90 maxFrame = frame;
92 for(i = minFrame+1; i <= maxFrame; i=i+1) {
93 toggleThumb(job, i);
95 lastFrame = frame;
97 } else {
98 toggleThumb(job, frame);
102 function toggleThumb(job, frame)
104 img = document.images["thumb" + frame];
105 url = "/thumb_" + job + "_" + frame + ".jpg"
107 if (img.style.display == "block") {
108 img.style.display = "none";
109 img.src = "";
110 lastFrame = -1;
111 } else {
112 img.src = url;
113 img.style.display = "block";
114 lastFrame = frame;
118 function returnObjById( id )
120 if (document.getElementById)
121 var returnVar = document.getElementById(id);
122 else if (document.all)
123 var returnVar = document.all[id];
124 else if (document.layers)
125 var returnVar = document.layers[id];
126 return returnVar;
129 function toggleDisplay( className, value1, value2 )
131 style = getStyle(className)
133 if (style.style["display"] == value1) {
134 style.style["display"] = value2;
135 } else {
136 style.style["display"] = value1;
140 function getStyle(className) {
141 var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules
142 for(var x=0;x<classes.length;x++) {
143 if(classes[x].selectorText==className) {
144 return classes[x];