From c4d31153e76caf0dbccdfe108574afc4b030c926 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 2 Aug 2014 16:26:17 +0200 Subject: 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. --- js/CGP-sync.js | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 js/CGP-sync.js (limited to 'js/CGP-sync.js') diff --git a/js/CGP-sync.js b/js/CGP-sync.js deleted file mode 100644 index 01f6b19..0000000 --- a/js/CGP-sync.js +++ /dev/null @@ -1,21 +0,0 @@ -function draw(id) { - var rrdgraph = prepare_draw(id); - - try { - rrdgraph.graph_paint(); - } catch (e) { - alert(e+"\n"+e.stack); - } -} - -function drawAll() -{ - var list=[]; - var a=document.getElementsByClassName('rrd'); - for (var i=0,l=a.length;i