aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js/CGP-async.js
diff options
context:
space:
mode:
authorPeter Wu2014-08-02 16:26:17 +0200
committerPeter Wu2014-08-02 16:30:29 +0200
commitc4d31153e76caf0dbccdfe108574afc4b030c926 (patch)
tree7fdb35c051432d055697b54c94833b01ce0d226d /js/CGP-async.js
parentjsrrdgraph: Fix error functions. Error prototype. (diff)
downloadapt-panopticon_cgp-c4d31153e76caf0dbccdfe108574afc4b030c926.zip
apt-panopticon_cgp-c4d31153e76caf0dbccdfe108574afc4b030c926.tar.gz
apt-panopticon_cgp-c4d31153e76caf0dbccdfe108574afc4b030c926.tar.bz2
apt-panopticon_cgp-c4d31153e76caf0dbccdfe108574afc4b030c926.tar.xz
Merge (a)sync code, reformat CGP.js
Best viewed with `git diff -w`. Since CGP-sync.js and CGP-async.js are almost equal except for one function call, merge them into a single function. While at it, reformat CGP.js to expose a single namespace (`CGP`) which exports the symbol `drawAll`. Remove `alert()` and add a `console.error()` call instead. This is less intrustive to users (who will notice a broken graph anyway) and be more helpful for developers (who can examine the call trace in the Developer Console. Add `"use strict"` and use the standard four spaces as indent. Process the script through `js-beautify` which re-indented the code and added some spaces between operators. Replace double by single quotes for consistency. Rename `catch(e)` to `catch(ex)` to supress a jshint warning about IE8.
Diffstat (limited to 'js/CGP-async.js')
-rw-r--r--js/CGP-async.js21
1 files changed, 0 insertions, 21 deletions
diff --git a/js/CGP-async.js b/js/CGP-async.js
deleted file mode 100644
index 4976509..0000000
--- a/js/CGP-async.js
+++ /dev/null
@@ -1,21 +0,0 @@
1function draw(id) {
2 var rrdgraph = prepare_draw(id);
3
4 try {
5 rrdgraph.graph_paint_async();
6 } catch (e) {
7 alert(e+"\n"+e.stack);
8 }
9}
10
11function drawAll()
12{
13 var list=[];
14 var a=document.getElementsByClassName('rrd');
15 for (var i=0,l=a.length;i<l;i++)
16 {
17 draw(a[i].getAttribute('id'))
18 }
19}
20
21window.onload = drawAll()