subduino 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/subduino +18 -5
- data/duino/Makefile +2 -3
- data/duino/duino.pde +97 -66
- data/lib/subduino/ard_io.rb +33 -14
- data/lib/subduino/ard_ps.rb +47 -24
- data/lib/subduino/os.rb +49 -0
- data/lib/subduino/parse/bool.rb +1 -1
- data/lib/subduino/parse/energy.rb +18 -0
- data/lib/subduino/parse/flow.rb +13 -0
- data/lib/subduino/parse/lux.rb +1 -1
- data/lib/subduino/parse/presence.rb +9 -0
- data/lib/subduino/parse/pressure.rb +13 -0
- data/lib/subduino/parse/temp.rb +1 -1
- data/lib/subduino/parse.rb +3 -3
- data/lib/subduino/scaffold/Makefile +72 -73
- data/lib/subduino/scaffold/scaffold.pde +77 -0
- data/lib/subduino/store.rb +1 -1
- data/spec/subduino/parse_spec.rb +1 -1
- data/subduino.gemspec +8 -249
- metadata +8 -249
- data/webapp/Gemfile +0 -8
- data/webapp/Gemfile.lock +0 -14
- data/webapp/Rakefile +0 -49
- data/webapp/Readme.textile +0 -45
- data/webapp/VERSION +0 -1
- data/webapp/config.yml +0 -20
- data/webapp/lib/app.rb +0 -103
- data/webapp/lib/duino.rb +0 -206
- data/webapp/lib/environment.rb +0 -36
- data/webapp/lib/messenger.rb +0 -16
- data/webapp/public/app.css +0 -119
- data/webapp/public/app.js +0 -34
- data/webapp/public/custom.js +0 -187
- data/webapp/public/date_input.css +0 -149
- data/webapp/public/facebox.css +0 -83
- data/webapp/public/facebox.js +0 -319
- data/webapp/public/favicon.ico +0 -0
- data/webapp/public/faye.js +0 -1
- data/webapp/public/icons/alarm-clock-blue.png +0 -0
- data/webapp/public/icons/alarm-clock.png +0 -0
- data/webapp/public/icons/balloon-left.png +0 -0
- data/webapp/public/icons/bandaid.png +0 -0
- data/webapp/public/icons/bell-disable.png +0 -0
- data/webapp/public/icons/bell.png +0 -0
- data/webapp/public/icons/big_icon.png +0 -0
- data/webapp/public/icons/bomb.png +0 -0
- data/webapp/public/icons/bookmark.png +0 -0
- data/webapp/public/icons/box-label.png +0 -0
- data/webapp/public/icons/brightness-control-up.png +0 -0
- data/webapp/public/icons/brightness-control.png +0 -0
- data/webapp/public/icons/brightness-small.png +0 -0
- data/webapp/public/icons/broom.png +0 -0
- data/webapp/public/icons/bug.png +0 -0
- data/webapp/public/icons/calculator.png +0 -0
- data/webapp/public/icons/calendar-day.png +0 -0
- data/webapp/public/icons/camera.png +0 -0
- data/webapp/public/icons/cards-address.png +0 -0
- data/webapp/public/icons/chart.png +0 -0
- data/webapp/public/icons/clock-select.png +0 -0
- data/webapp/public/icons/color.png +0 -0
- data/webapp/public/icons/compass.png +0 -0
- data/webapp/public/icons/control-power-small.png +0 -0
- data/webapp/public/icons/control-power.png +0 -0
- data/webapp/public/icons/control-record-small.png +0 -0
- data/webapp/public/icons/cpus.png +0 -0
- data/webapp/public/icons/credit-card.png +0 -0
- data/webapp/public/icons/cross-small.png +0 -0
- data/webapp/public/icons/current.png +0 -0
- data/webapp/public/icons/dashboard.png +0 -0
- data/webapp/public/icons/database.png +0 -0
- data/webapp/public/icons/databases.png +0 -0
- data/webapp/public/icons/day.png +0 -0
- data/webapp/public/icons/door-big.png +0 -0
- data/webapp/public/icons/door-open-in.png +0 -0
- data/webapp/public/icons/door-open-out.png +0 -0
- data/webapp/public/icons/door-open.png +0 -0
- data/webapp/public/icons/door.png +0 -0
- data/webapp/public/icons/drive-globe.png +0 -0
- data/webapp/public/icons/equalizer.png +0 -0
- data/webapp/public/icons/exclamation-diamond.png +0 -0
- data/webapp/public/icons/exclamation.png +0 -0
- data/webapp/public/icons/eye-disable.png +0 -0
- data/webapp/public/icons/eye.png +0 -0
- data/webapp/public/icons/false.png +0 -0
- data/webapp/public/icons/favicon.png +0 -0
- data/webapp/public/icons/gear-small.png +0 -0
- data/webapp/public/icons/gear.png +0 -0
- data/webapp/public/icons/groups.png +0 -0
- data/webapp/public/icons/heart.png +0 -0
- data/webapp/public/icons/heart_empty.png +0 -0
- data/webapp/public/icons/info.png +0 -0
- data/webapp/public/icons/irrigation.png +0 -0
- data/webapp/public/icons/key.png +0 -0
- data/webapp/public/icons/lamp-big.png +0 -0
- data/webapp/public/icons/lightbulb.png +0 -0
- data/webapp/public/icons/lightbulb_off.png +0 -0
- data/webapp/public/icons/lightning-disable.png +0 -0
- data/webapp/public/icons/lightning-small.png +0 -0
- data/webapp/public/icons/lightning.png +0 -0
- data/webapp/public/icons/lock-unlock.png +0 -0
- data/webapp/public/icons/lock.png +0 -0
- data/webapp/public/icons/locked.png +0 -0
- data/webapp/public/icons/lux.png +0 -0
- data/webapp/public/icons/marker.png +0 -0
- data/webapp/public/icons/media-player-phone.png +0 -0
- data/webapp/public/icons/megaphone.png +0 -0
- data/webapp/public/icons/mem.png +0 -0
- data/webapp/public/icons/microphone.png +0 -0
- data/webapp/public/icons/monitor.png +0 -0
- data/webapp/public/icons/navigation.png +0 -0
- data/webapp/public/icons/night.png +0 -0
- data/webapp/public/icons/noise.png +0 -0
- data/webapp/public/icons/off.png +0 -0
- data/webapp/public/icons/on.png +0 -0
- data/webapp/public/icons/onoff.png +0 -0
- data/webapp/public/icons/pin.png +0 -0
- data/webapp/public/icons/plug--exclamation.png +0 -0
- data/webapp/public/icons/plug-disable.png +0 -0
- data/webapp/public/icons/plug.png +0 -0
- data/webapp/public/icons/rain.png +0 -0
- data/webapp/public/icons/refrigeration.png +0 -0
- data/webapp/public/icons/restart.png +0 -0
- data/webapp/public/icons/ruby.png +0 -0
- data/webapp/public/icons/server.png +0 -0
- data/webapp/public/icons/shield-disable.png +0 -0
- data/webapp/public/icons/shield.png +0 -0
- data/webapp/public/icons/socket--exclamation.png +0 -0
- data/webapp/public/icons/socket-disable.png +0 -0
- data/webapp/public/icons/socket.png +0 -0
- data/webapp/public/icons/start.png +0 -0
- data/webapp/public/icons/stop.png +0 -0
- data/webapp/public/icons/switch--exclamation.png +0 -0
- data/webapp/public/icons/switch-disable.png +0 -0
- data/webapp/public/icons/switch-small.png +0 -0
- data/webapp/public/icons/switch.png +0 -0
- data/webapp/public/icons/target.png +0 -0
- data/webapp/public/icons/television-off.png +0 -0
- data/webapp/public/icons/television.png +0 -0
- data/webapp/public/icons/temp.png +0 -0
- data/webapp/public/icons/terminal.png +0 -0
- data/webapp/public/icons/tick-small.png +0 -0
- data/webapp/public/icons/traffic-light-off.png +0 -0
- data/webapp/public/icons/traffic-light.png +0 -0
- data/webapp/public/icons/traffic.png +0 -0
- data/webapp/public/icons/true.png +0 -0
- data/webapp/public/icons/umbrella.png +0 -0
- data/webapp/public/icons/unlocked.png +0 -0
- data/webapp/public/icons/unmonitor.png +0 -0
- data/webapp/public/icons/unmonitored.png +0 -0
- data/webapp/public/icons/users.png +0 -0
- data/webapp/public/icons/vcard.png +0 -0
- data/webapp/public/icons/wall.png +0 -0
- data/webapp/public/icons/wall_brick.png +0 -0
- data/webapp/public/icons/wall_disable.png +0 -0
- data/webapp/public/icons/wand-disable.png +0 -0
- data/webapp/public/icons/wand.png +0 -0
- data/webapp/public/icons/warn.png +0 -0
- data/webapp/public/icons/weather_clouds.png +0 -0
- data/webapp/public/icons/weather_cloudy.png +0 -0
- data/webapp/public/icons/weather_lightning.png +0 -0
- data/webapp/public/icons/weather_rain.png +0 -0
- data/webapp/public/icons/weather_snow.png +0 -0
- data/webapp/public/icons/weather_sun.png +0 -0
- data/webapp/public/icons/wrench-screwdriver.png +0 -0
- data/webapp/public/icons/wrench.png +0 -0
- data/webapp/public/images/ajax-loader.gif +0 -0
- data/webapp/public/images/b.png +0 -0
- data/webapp/public/images/bendl.gif +0 -0
- data/webapp/public/images/bendr.gif +0 -0
- data/webapp/public/images/bendsb.gif +0 -0
- data/webapp/public/images/bg.jpg +0 -0
- data/webapp/public/images/bhead.gif +0 -0
- data/webapp/public/images/bheadl.gif +0 -0
- data/webapp/public/images/bheadr.gif +0 -0
- data/webapp/public/images/bl.png +0 -0
- data/webapp/public/images/bnd.gif +0 -0
- data/webapp/public/images/br.png +0 -0
- data/webapp/public/images/bread.gif +0 -0
- data/webapp/public/images/btnb.gif +0 -0
- data/webapp/public/images/btnb_.gif +0 -0
- data/webapp/public/images/btnm.gif +0 -0
- data/webapp/public/images/btnm_.gif +0 -0
- data/webapp/public/images/btns.gif +0 -0
- data/webapp/public/images/btns_.gif +0 -0
- data/webapp/public/images/cal.jpg +0 -0
- data/webapp/public/images/close.png +0 -0
- data/webapp/public/images/closelabel.gif +0 -0
- data/webapp/public/images/error.gif +0 -0
- data/webapp/public/images/ft.gif +0 -0
- data/webapp/public/images/hdr.gif +0 -0
- data/webapp/public/images/hdrl.gif +0 -0
- data/webapp/public/images/hdrr.gif +0 -0
- data/webapp/public/images/hld.jpg +0 -0
- data/webapp/public/images/imgb.gif +0 -0
- data/webapp/public/images/imgo.gif +0 -0
- data/webapp/public/images/imgt.gif +0 -0
- data/webapp/public/images/info.gif +0 -0
- data/webapp/public/images/jquery.wysiwyg.gif +0 -0
- data/webapp/public/images/li.gif +0 -0
- data/webapp/public/images/mbg.png +0 -0
- data/webapp/public/images/nsp.gif +0 -0
- data/webapp/public/images/phs.gif +0 -0
- data/webapp/public/images/sdd.jpg +0 -0
- data/webapp/public/images/sdd_.jpg +0 -0
- data/webapp/public/images/sidebar.gif +0 -0
- data/webapp/public/images/sorta.gif +0 -0
- data/webapp/public/images/sortd.gif +0 -0
- data/webapp/public/images/srch.gif +0 -0
- data/webapp/public/images/srch_.gif +0 -0
- data/webapp/public/images/success.gif +0 -0
- data/webapp/public/images/thumb1.jpg +0 -0
- data/webapp/public/images/thumb2.jpg +0 -0
- data/webapp/public/images/thumb3.jpg +0 -0
- data/webapp/public/images/tiny.gif +0 -0
- data/webapp/public/images/tiny_.gif +0 -0
- data/webapp/public/images/tl.png +0 -0
- data/webapp/public/images/tr.png +0 -0
- data/webapp/public/images/upload.gif +0 -0
- data/webapp/public/images/warning.gif +0 -0
- data/webapp/public/iui/backButton.png +0 -0
- data/webapp/public/iui/blueButton.png +0 -0
- data/webapp/public/iui/cancel.png +0 -0
- data/webapp/public/iui/grayButton.png +0 -0
- data/webapp/public/iui/greenButton.png +0 -0
- data/webapp/public/iui/iui-logo-touch-icon.png +0 -0
- data/webapp/public/iui/iui.css +0 -396
- data/webapp/public/iui/iui.js +0 -511
- data/webapp/public/iui/iuix.css +0 -1
- data/webapp/public/iui/iuix.js +0 -1
- data/webapp/public/iui/listArrow.png +0 -0
- data/webapp/public/iui/listArrowSel.png +0 -0
- data/webapp/public/iui/listGroup.png +0 -0
- data/webapp/public/iui/loading.gif +0 -0
- data/webapp/public/iui/pinstripes.png +0 -0
- data/webapp/public/iui/redButton.png +0 -0
- data/webapp/public/iui/selection.png +0 -0
- data/webapp/public/iui/thumb.png +0 -0
- data/webapp/public/iui/toggle.png +0 -0
- data/webapp/public/iui/toggleOn.png +0 -0
- data/webapp/public/iui/toolButton.png +0 -0
- data/webapp/public/iui/toolbar.png +0 -0
- data/webapp/public/iui/whiteButton.png +0 -0
- data/webapp/public/iui/yellowButton.png +0 -0
- data/webapp/public/jquery.img.preload.js +0 -152
- data/webapp/public/jquery.js +0 -154
- data/webapp/public/jquery.sparkline.js +0 -85
- data/webapp/public/jquery.tablesorter.min.js +0 -2
- data/webapp/public/jquery.visualize.js +0 -452
- data/webapp/public/jquery.wysiwyg.css +0 -56
- data/webapp/public/layout.css +0 -33
- data/webapp/public/right.js +0 -9
- data/webapp/public/rt.js +0 -7
- data/webapp/public/sparkline.js +0 -85
- data/webapp/public/style.css +0 -881
- data/webapp/public/visualize.css +0 -32
- data/webapp/spec/duino_spec.rb +0 -8
- data/webapp/spec/spec_helper.rb +0 -10
- data/webapp/views/command.haml +0 -4
- data/webapp/views/icon.haml +0 -6
- data/webapp/views/index.haml +0 -367
- data/webapp/views/layout.haml +0 -88
- data/webapp/views/mobile.haml +0 -21
- data/webapp/views/switch.haml +0 -56
- data/webapp/views/template.haml +0 -676
- data/webapp/views/top.haml +0 -4
- data/webapp/views/watch.haml +0 -26
@@ -1,2 +0,0 @@
|
|
1
|
-
|
2
|
-
(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
|
@@ -1,452 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* --------------------------------------------------------------------
|
3
|
-
* jQuery inputToButton plugin
|
4
|
-
* Author: Scott Jehl, scott@filamentgroup.com
|
5
|
-
* Copyright (c) 2009 Filament Group
|
6
|
-
* licensed under MIT (filamentgroup.com/examples/mit-license.txt)
|
7
|
-
* --------------------------------------------------------------------
|
8
|
-
*/
|
9
|
-
(function($) {
|
10
|
-
$.fn.visualize = function(options, container){
|
11
|
-
return $(this).each(function(){
|
12
|
-
//configuration
|
13
|
-
var o = $.extend({
|
14
|
-
type: 'bar', //also available: area, pie, line
|
15
|
-
width: $(this).width(), //height of canvas - defaults to table height
|
16
|
-
height: $(this).height(), //height of canvas - defaults to table height
|
17
|
-
appendTitle: true, //table caption text is added to chart
|
18
|
-
title: null, //grabs from table caption if null
|
19
|
-
appendKey: true, //color key is added to chart
|
20
|
-
colors: ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#5a3b16','#26a4ed','#f45a90','#e9e744'],
|
21
|
-
textColors: [], //corresponds with colors array. null/undefined items will fall back to CSS
|
22
|
-
parseDirection: 'x', //which direction to parse the table data
|
23
|
-
pieMargin: 20, //pie charts only - spacing around pie
|
24
|
-
pieLabelPos: 'inside',
|
25
|
-
lineWeight: 4, //for line and area - stroke weight
|
26
|
-
barGroupMargin: 10,
|
27
|
-
barMargin: 1, //space around bars in bar chart (added to both sides of bar)
|
28
|
-
yLabelInterval: 30 //distance between y labels
|
29
|
-
},options);
|
30
|
-
|
31
|
-
//reset width, height to numbers
|
32
|
-
o.width = parseFloat(o.width);
|
33
|
-
o.height = parseFloat(o.height);
|
34
|
-
|
35
|
-
|
36
|
-
var self = $(this);
|
37
|
-
|
38
|
-
//function to scrape data from html table
|
39
|
-
function scrapeTable(){
|
40
|
-
var colors = o.colors;
|
41
|
-
var textColors = o.textColors;
|
42
|
-
var tableData = {
|
43
|
-
dataGroups: function(){
|
44
|
-
var dataGroups = [];
|
45
|
-
if(o.parseDirection == 'x'){
|
46
|
-
self.find('tr:gt(0)').each(function(i){
|
47
|
-
dataGroups[i] = {};
|
48
|
-
dataGroups[i].points = [];
|
49
|
-
dataGroups[i].color = colors[i];
|
50
|
-
if(textColors[i]){ dataGroups[i].textColor = textColors[i]; }
|
51
|
-
$(this).find('td').each(function(){
|
52
|
-
dataGroups[i].points.push( parseFloat($(this).text()) );
|
53
|
-
});
|
54
|
-
});
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
var cols = self.find('tr:eq(1) td').size();
|
58
|
-
for(var i=0; i<cols; i++){
|
59
|
-
dataGroups[i] = {};
|
60
|
-
dataGroups[i].points = [];
|
61
|
-
dataGroups[i].color = colors[i];
|
62
|
-
if(textColors[i]){ dataGroups[i].textColor = textColors[i]; }
|
63
|
-
self.find('tr:gt(0)').each(function(){
|
64
|
-
dataGroups[i].points.push( $(this).find('td').eq(i).text()*1 );
|
65
|
-
});
|
66
|
-
};
|
67
|
-
}
|
68
|
-
return dataGroups;
|
69
|
-
},
|
70
|
-
allData: function(){
|
71
|
-
var allData = [];
|
72
|
-
$(this.dataGroups()).each(function(){
|
73
|
-
allData.push(this.points);
|
74
|
-
});
|
75
|
-
return allData;
|
76
|
-
},
|
77
|
-
dataSum: function(){
|
78
|
-
var dataSum = 0;
|
79
|
-
var allData = this.allData().join(',').split(',');
|
80
|
-
$(allData).each(function(){
|
81
|
-
dataSum += parseFloat(this);
|
82
|
-
});
|
83
|
-
return dataSum
|
84
|
-
},
|
85
|
-
topValue: function(){
|
86
|
-
var topValue = 0;
|
87
|
-
var allData = this.allData().join(',').split(',');
|
88
|
-
$(allData).each(function(){
|
89
|
-
if(parseFloat(this,10)>topValue) topValue = parseFloat(this);
|
90
|
-
});
|
91
|
-
return topValue;
|
92
|
-
},
|
93
|
-
bottomValue: function(){
|
94
|
-
var bottomValue = 0;
|
95
|
-
var allData = this.allData().join(',').split(',');
|
96
|
-
$(allData).each(function(){
|
97
|
-
if(this<bottomValue) bottomValue = parseFloat(this);
|
98
|
-
});
|
99
|
-
return bottomValue;
|
100
|
-
},
|
101
|
-
memberTotals: function(){
|
102
|
-
var memberTotals = [];
|
103
|
-
var dataGroups = this.dataGroups();
|
104
|
-
$(dataGroups).each(function(l){
|
105
|
-
var count = 0;
|
106
|
-
$(dataGroups[l].points).each(function(m){
|
107
|
-
count +=dataGroups[l].points[m];
|
108
|
-
});
|
109
|
-
memberTotals.push(count);
|
110
|
-
});
|
111
|
-
return memberTotals;
|
112
|
-
},
|
113
|
-
yTotals: function(){
|
114
|
-
var yTotals = [];
|
115
|
-
var dataGroups = this.dataGroups();
|
116
|
-
var loopLength = this.xLabels().length;
|
117
|
-
for(var i = 0; i<loopLength; i++){
|
118
|
-
yTotals[i] =[];
|
119
|
-
var thisTotal = 0;
|
120
|
-
$(dataGroups).each(function(l){
|
121
|
-
yTotals[i].push(this.points[i]);
|
122
|
-
});
|
123
|
-
yTotals[i].join(',').split(',');
|
124
|
-
$(yTotals[i]).each(function(){
|
125
|
-
thisTotal += parseFloat(this);
|
126
|
-
});
|
127
|
-
yTotals[i] = thisTotal;
|
128
|
-
|
129
|
-
}
|
130
|
-
return yTotals;
|
131
|
-
},
|
132
|
-
topYtotal: function(){
|
133
|
-
var topYtotal = 0;
|
134
|
-
var yTotals = this.yTotals().join(',').split(',');
|
135
|
-
$(yTotals).each(function(){
|
136
|
-
if(parseFloat(this,10)>topYtotal) topYtotal = parseFloat(this);
|
137
|
-
});
|
138
|
-
return topYtotal;
|
139
|
-
},
|
140
|
-
totalYRange: function(){
|
141
|
-
return this.topValue() - this.bottomValue();
|
142
|
-
},
|
143
|
-
xLabels: function(){
|
144
|
-
var xLabels = [];
|
145
|
-
if(o.parseDirection == 'x'){
|
146
|
-
self.find('tr:eq(0) th').each(function(){
|
147
|
-
xLabels.push($(this).html());
|
148
|
-
});
|
149
|
-
}
|
150
|
-
else {
|
151
|
-
self.find('tr:gt(0) th').each(function(){
|
152
|
-
xLabels.push($(this).html());
|
153
|
-
});
|
154
|
-
}
|
155
|
-
return xLabels;
|
156
|
-
},
|
157
|
-
yLabels: function(){
|
158
|
-
var yLabels = [];
|
159
|
-
yLabels.push(bottomValue);
|
160
|
-
var numLabels = Math.round(o.height / o.yLabelInterval);
|
161
|
-
var loopInterval = Math.ceil(totalYRange / numLabels) || 1;
|
162
|
-
while( yLabels[yLabels.length-1] < topValue - loopInterval){
|
163
|
-
yLabels.push(yLabels[yLabels.length-1] + loopInterval);
|
164
|
-
}
|
165
|
-
yLabels.push(topValue);
|
166
|
-
return yLabels;
|
167
|
-
}
|
168
|
-
};
|
169
|
-
|
170
|
-
return tableData;
|
171
|
-
};
|
172
|
-
|
173
|
-
|
174
|
-
//function to create a chart
|
175
|
-
var createChart = {
|
176
|
-
pie: function(){
|
177
|
-
|
178
|
-
canvasContain.addClass('visualize-pie');
|
179
|
-
|
180
|
-
if(o.pieLabelPos == 'outside'){ canvasContain.addClass('visualize-pie-outside'); }
|
181
|
-
|
182
|
-
var centerx = Math.round(canvas.width()/2);
|
183
|
-
var centery = Math.round(canvas.height()/2);
|
184
|
-
var radius = centery - o.pieMargin;
|
185
|
-
var counter = 0.0;
|
186
|
-
var toRad = function(integer){ return (Math.PI/180)*integer; };
|
187
|
-
var labels = $('<ul class="visualize-labels"></ul>')
|
188
|
-
.insertAfter(canvas);
|
189
|
-
|
190
|
-
//draw the pie pieces
|
191
|
-
$.each(memberTotals, function(i){
|
192
|
-
var fraction = (this <= 0 || isNaN(this))? 0 : this / dataSum;
|
193
|
-
ctx.beginPath();
|
194
|
-
ctx.moveTo(centerx, centery);
|
195
|
-
ctx.arc(centerx, centery, radius,
|
196
|
-
counter * Math.PI * 2 - Math.PI * 0.5,
|
197
|
-
(counter + fraction) * Math.PI * 2 - Math.PI * 0.5,
|
198
|
-
false);
|
199
|
-
ctx.lineTo(centerx, centery);
|
200
|
-
ctx.closePath();
|
201
|
-
ctx.fillStyle = dataGroups[i].color;
|
202
|
-
ctx.fill();
|
203
|
-
// draw labels
|
204
|
-
var sliceMiddle = (counter + fraction/2);
|
205
|
-
var distance = o.pieLabelPos == 'inside' ? radius/1.5 : radius + radius / 5;
|
206
|
-
var labelx = Math.round(centerx + Math.sin(sliceMiddle * Math.PI * 2) * (distance));
|
207
|
-
var labely = Math.round(centery - Math.cos(sliceMiddle * Math.PI * 2) * (distance));
|
208
|
-
var leftRight = (labelx > centerx) ? 'right' : 'left';
|
209
|
-
var topBottom = (labely > centery) ? 'bottom' : 'top';
|
210
|
-
var percentage = Math.round(fraction*100);
|
211
|
-
if(percentage){
|
212
|
-
var labeltext = $('<span class="visualize-label">' + percentage + '%</span>')
|
213
|
-
.css(leftRight, 0)
|
214
|
-
.css(topBottom, 0);
|
215
|
-
if(labeltext)
|
216
|
-
var label = $('<li class="visualize-label-pos"></li>')
|
217
|
-
.appendTo(labels)
|
218
|
-
.css({left: labelx, top: labely})
|
219
|
-
.append(labeltext);
|
220
|
-
labeltext
|
221
|
-
.css('font-size', radius / 8)
|
222
|
-
.css('margin-'+leftRight, -labeltext.width()/2)
|
223
|
-
.css('margin-'+topBottom, -labeltext.outerHeight()/2);
|
224
|
-
|
225
|
-
|
226
|
-
if(dataGroups[i].textColor){ labeltext.css('color', dataGroups[i].textColor); }
|
227
|
-
}
|
228
|
-
counter+=fraction;
|
229
|
-
});
|
230
|
-
},
|
231
|
-
|
232
|
-
line: function(area){
|
233
|
-
|
234
|
-
if(area){ canvasContain.addClass('visualize-area'); }
|
235
|
-
else{ canvasContain.addClass('visualize-line'); }
|
236
|
-
|
237
|
-
//write X labels
|
238
|
-
var xInterval = canvas.width() / (xLabels.length -1);
|
239
|
-
var xlabelsUL = $('<ul class="visualize-labels-x"></ul>')
|
240
|
-
.width(canvas.width())
|
241
|
-
.height(canvas.height())
|
242
|
-
.insertBefore(canvas);
|
243
|
-
$.each(xLabels, function(i){
|
244
|
-
var thisLi = $('<li><span>'+this+'</span></li>')
|
245
|
-
.prepend('<span class="line" />')
|
246
|
-
.css('left', xInterval * i)
|
247
|
-
.appendTo(xlabelsUL);
|
248
|
-
var label = thisLi.find('span:not(.line)');
|
249
|
-
var leftOffset = label.width()/-2;
|
250
|
-
if(i == 0){ leftOffset = 0; }
|
251
|
-
else if(i== xLabels.length-1){ leftOffset = -label.width(); }
|
252
|
-
label
|
253
|
-
.css('margin-left', leftOffset)
|
254
|
-
.addClass('label');
|
255
|
-
});
|
256
|
-
|
257
|
-
//write Y labels
|
258
|
-
var yScale = canvas.height() / totalYRange;
|
259
|
-
var liBottom = canvas.height() / (yLabels.length-1);
|
260
|
-
var ylabelsUL = $('<ul class="visualize-labels-y"></ul>')
|
261
|
-
.width(canvas.width())
|
262
|
-
.height(canvas.height())
|
263
|
-
.insertBefore(canvas);
|
264
|
-
|
265
|
-
$.each(yLabels, function(i){
|
266
|
-
var thisLi = $('<li><span>'+this+'</span></li>')
|
267
|
-
.prepend('<span class="line" />')
|
268
|
-
.css('bottom',liBottom*i)
|
269
|
-
.prependTo(ylabelsUL);
|
270
|
-
var label = thisLi.find('span:not(.line)');
|
271
|
-
var topOffset = label.height()/-2;
|
272
|
-
if(i == 0){ topOffset = -label.height(); }
|
273
|
-
else if(i== yLabels.length-1){ topOffset = 0; }
|
274
|
-
label
|
275
|
-
.css('margin-top', topOffset)
|
276
|
-
.addClass('label');
|
277
|
-
});
|
278
|
-
|
279
|
-
//start from the bottom left
|
280
|
-
ctx.translate(0,zeroLoc);
|
281
|
-
//iterate and draw
|
282
|
-
$.each(dataGroups,function(h){
|
283
|
-
ctx.beginPath();
|
284
|
-
ctx.lineWidth = o.lineWeight;
|
285
|
-
ctx.lineJoin = 'round';
|
286
|
-
var points = this.points;
|
287
|
-
var integer = 0;
|
288
|
-
ctx.moveTo(0,-(points[0]*yScale));
|
289
|
-
$.each(points, function(){
|
290
|
-
ctx.lineTo(integer,-(this*yScale));
|
291
|
-
integer+=xInterval;
|
292
|
-
});
|
293
|
-
ctx.strokeStyle = this.color;
|
294
|
-
ctx.stroke();
|
295
|
-
if(area){
|
296
|
-
ctx.lineTo(integer,0);
|
297
|
-
ctx.lineTo(0,0);
|
298
|
-
ctx.closePath();
|
299
|
-
ctx.fillStyle = this.color;
|
300
|
-
ctx.globalAlpha = .3;
|
301
|
-
ctx.fill();
|
302
|
-
ctx.globalAlpha = 1.0;
|
303
|
-
}
|
304
|
-
else {ctx.closePath();}
|
305
|
-
});
|
306
|
-
},
|
307
|
-
|
308
|
-
area: function(){
|
309
|
-
createChart.line(true);
|
310
|
-
},
|
311
|
-
|
312
|
-
bar: function(){
|
313
|
-
|
314
|
-
canvasContain.addClass('visualize-bar');
|
315
|
-
|
316
|
-
//write X labels
|
317
|
-
var xInterval = canvas.width() / (xLabels.length);
|
318
|
-
var xlabelsUL = $('<ul class="visualize-labels-x"></ul>')
|
319
|
-
.width(canvas.width())
|
320
|
-
.height(canvas.height())
|
321
|
-
.insertBefore(canvas);
|
322
|
-
$.each(xLabels, function(i){
|
323
|
-
var thisLi = $('<li><span class="label">'+this+'</span></li>')
|
324
|
-
.prepend('<span class="line" />')
|
325
|
-
.css('left', xInterval * i)
|
326
|
-
.width(xInterval)
|
327
|
-
.appendTo(xlabelsUL);
|
328
|
-
var label = thisLi.find('span.label');
|
329
|
-
label.addClass('label');
|
330
|
-
});
|
331
|
-
|
332
|
-
//write Y labels
|
333
|
-
var yScale = canvas.height() / totalYRange;
|
334
|
-
var liBottom = canvas.height() / (yLabels.length-1);
|
335
|
-
var ylabelsUL = $('<ul class="visualize-labels-y"></ul>')
|
336
|
-
.width(canvas.width())
|
337
|
-
.height(canvas.height())
|
338
|
-
.insertBefore(canvas);
|
339
|
-
$.each(yLabels, function(i){
|
340
|
-
var thisLi = $('<li><span>'+this+'</span></li>')
|
341
|
-
.prepend('<span class="line" />')
|
342
|
-
.css('bottom',liBottom*i)
|
343
|
-
.prependTo(ylabelsUL);
|
344
|
-
var label = thisLi.find('span:not(.line)');
|
345
|
-
var topOffset = label.height()/-2;
|
346
|
-
if(i == 0){ topOffset = -label.height(); }
|
347
|
-
else if(i== yLabels.length-1){ topOffset = 0; }
|
348
|
-
label
|
349
|
-
.css('margin-top', topOffset)
|
350
|
-
.addClass('label');
|
351
|
-
});
|
352
|
-
|
353
|
-
//start from the bottom left
|
354
|
-
ctx.translate(0,zeroLoc);
|
355
|
-
//iterate and draw
|
356
|
-
for(var h=0; h<dataGroups.length; h++){
|
357
|
-
ctx.beginPath();
|
358
|
-
var linewidth = (xInterval-o.barGroupMargin*2) / dataGroups.length; //removed +1
|
359
|
-
var strokeWidth = linewidth - (o.barMargin*2);
|
360
|
-
ctx.lineWidth = strokeWidth;
|
361
|
-
var points = dataGroups[h].points;
|
362
|
-
var integer = 0;
|
363
|
-
for(var i=0; i<points.length; i++){
|
364
|
-
var xVal = (integer-o.barGroupMargin)+(h*linewidth)+linewidth/2;
|
365
|
-
xVal += o.barGroupMargin*2;
|
366
|
-
|
367
|
-
ctx.moveTo(xVal, 0);
|
368
|
-
ctx.lineTo(xVal, Math.round(-points[i]*yScale));
|
369
|
-
integer+=xInterval;
|
370
|
-
}
|
371
|
-
ctx.strokeStyle = dataGroups[h].color;
|
372
|
-
ctx.stroke();
|
373
|
-
ctx.closePath();
|
374
|
-
}
|
375
|
-
}
|
376
|
-
};
|
377
|
-
|
378
|
-
//create new canvas, set w&h attrs (not inline styles)
|
379
|
-
var canvasNode = document.createElement("canvas");
|
380
|
-
canvasNode.setAttribute('height',o.height);
|
381
|
-
canvasNode.setAttribute('width',o.width);
|
382
|
-
var canvas = $(canvasNode);
|
383
|
-
|
384
|
-
//get title for chart
|
385
|
-
var title = o.title || self.find('caption').text();
|
386
|
-
|
387
|
-
//create canvas wrapper div, set inline w&h, append
|
388
|
-
var canvasContain = (container || $('<div class="visualize" role="img" aria-label="Chart representing data from the table: '+ title +'" />'))
|
389
|
-
.height(o.height)
|
390
|
-
.width(o.width)
|
391
|
-
.append(canvas);
|
392
|
-
|
393
|
-
//scrape table (this should be cleaned up into an obj)
|
394
|
-
var tableData = scrapeTable();
|
395
|
-
var dataGroups = tableData.dataGroups();
|
396
|
-
var allData = tableData.allData();
|
397
|
-
var dataSum = tableData.dataSum();
|
398
|
-
var topValue = tableData.topValue();
|
399
|
-
var bottomValue = tableData.bottomValue();
|
400
|
-
var memberTotals = tableData.memberTotals();
|
401
|
-
var totalYRange = tableData.totalYRange();
|
402
|
-
var zeroLoc = o.height * (topValue/totalYRange);
|
403
|
-
var xLabels = tableData.xLabels();
|
404
|
-
var yLabels = tableData.yLabels();
|
405
|
-
|
406
|
-
//title/key container
|
407
|
-
if(o.appendTitle || o.appendKey){
|
408
|
-
var infoContain = $('<div class="visualize-info"></div>')
|
409
|
-
.appendTo(canvasContain);
|
410
|
-
}
|
411
|
-
|
412
|
-
//append title
|
413
|
-
if(o.appendTitle){
|
414
|
-
$('<div class="visualize-title">'+ title +'</div>').appendTo(infoContain);
|
415
|
-
}
|
416
|
-
|
417
|
-
|
418
|
-
//append key
|
419
|
-
if(o.appendKey){
|
420
|
-
var newKey = $('<ul class="visualize-key"></ul>');
|
421
|
-
var selector = (o.parseDirection == 'x') ? 'tr:gt(0) th' : 'tr:eq(0) th' ;
|
422
|
-
self.find(selector).each(function(i){
|
423
|
-
$('<li><span class="visualize-key-color" style="background: '+dataGroups[i].color+'"></span><span class="visualize-key-label">'+ $(this).text() +'</span></li>')
|
424
|
-
.appendTo(newKey);
|
425
|
-
});
|
426
|
-
newKey.appendTo(infoContain);
|
427
|
-
};
|
428
|
-
|
429
|
-
//append new canvas to page
|
430
|
-
|
431
|
-
if(!container){canvasContain.insertAfter(this); }
|
432
|
-
if( typeof(G_vmlCanvasManager) != 'undefined' ){ G_vmlCanvasManager.init(); G_vmlCanvasManager.initElement(canvas[0]); }
|
433
|
-
|
434
|
-
//set up the drawing board
|
435
|
-
var ctx = canvas[0].getContext('2d');
|
436
|
-
|
437
|
-
//create chart
|
438
|
-
createChart[o.type]();
|
439
|
-
|
440
|
-
//clean up some doubled lines that sit on top of canvas borders (done via JS due to IE)
|
441
|
-
$('.visualize-line li:first-child span.line, .visualize-line li:last-child span.line, .visualize-area li:first-child span.line, .visualize-area li:last-child span.line, .visualize-bar li:first-child span.line,.visualize-bar .visualize-labels-y li:last-child span.line').css('border','none');
|
442
|
-
if(!container){
|
443
|
-
//add event for updating
|
444
|
-
canvasContain.bind('visualizeRefresh', function(){
|
445
|
-
self.visualize(o, $(this).empty());
|
446
|
-
});
|
447
|
-
}
|
448
|
-
}).next(); //returns canvas(es)
|
449
|
-
};
|
450
|
-
})(jQuery);
|
451
|
-
|
452
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
div.wysiwyg { border: 1px solid #bbb; padding: 0; background-color: #fefefe; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; width: 99.5% !important; }
|
2
|
-
div.wysiwyg * { margin: 0; padding: 0; outline: none; }
|
3
|
-
|
4
|
-
div.wysiwyg ul.panel { border-bottom: 1px solid #cccccc; background: #fafafa; float: left; width: 99.1%; padding: 5px; margin: 0; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; }
|
5
|
-
div.wysiwyg ul.panel li { list-style-type: none; float: left; padding: 0; margin: 2px 2px 2px 0; background: none; height: 19px; overflow: hidden; }
|
6
|
-
div.wysiwyg ul.panel li.separator { height: 18px; margin: 3px 4px 0; border-left: 1px solid #cccccc; }
|
7
|
-
div.wysiwyg ul.panel li a { text-indent: -5000px; opacity: 0.85; filter:alpha(opacity=85); display: block; width: 16px; height: 16px; background: url('jquery.wysiwyg.gif') no-repeat -64px -80px; border: 0; cursor: pointer; padding: 0; margin: 1px; border: 1px solid #fafafa; }
|
8
|
-
div.wysiwyg ul.panel li a:hover, div.wysiwyg ul.panel li a.active { opacity: 1.00; filter:alpha(opacity=100); }
|
9
|
-
div.wysiwyg ul.panel li a.active { border: 1px solid #ddd; background-color: #fff; padding: 0; }
|
10
|
-
|
11
|
-
div.wysiwyg ul.panel li a.bold { background-position: 0 -17px; }
|
12
|
-
div.wysiwyg ul.panel li a.italic { background-position: -16px -17px; }
|
13
|
-
div.wysiwyg ul.panel li a.strikeThrough { background-position: -32px -17px; }
|
14
|
-
div.wysiwyg ul.panel li a.underline { background-position: -48px -16px; }
|
15
|
-
|
16
|
-
div.wysiwyg ul.panel li a.justifyLeft { background-position: 0 0; }
|
17
|
-
div.wysiwyg ul.panel li a.justifyCenter { background-position: -16px 0; }
|
18
|
-
div.wysiwyg ul.panel li a.justifyRight { background-position: -32px 0; }
|
19
|
-
div.wysiwyg ul.panel li a.justifyFull { background-position: -48px 0; }
|
20
|
-
|
21
|
-
div.wysiwyg ul.panel li a.indent { background-position: -64px 0; }
|
22
|
-
div.wysiwyg ul.panel li a.outdent { background-position: -80px 0; }
|
23
|
-
|
24
|
-
div.wysiwyg ul.panel li a.subscript { background-position: -64px -16px; }
|
25
|
-
div.wysiwyg ul.panel li a.superscript { background-position: -80px -16px; }
|
26
|
-
|
27
|
-
div.wysiwyg ul.panel li a.undo { background-position: 0 -63px; }
|
28
|
-
div.wysiwyg ul.panel li a.redo { background-position: -16px -65px; }
|
29
|
-
|
30
|
-
div.wysiwyg ul.panel li a.insertOrderedList { background-position: -32px -48px; }
|
31
|
-
div.wysiwyg ul.panel li a.insertUnorderedList { background-position: -16px -48px; }
|
32
|
-
div.wysiwyg ul.panel li a.insertHorizontalRule { background-position: 0 -48px; }
|
33
|
-
|
34
|
-
div.wysiwyg ul.panel li a.h1 { background-position: 0 -32px; }
|
35
|
-
div.wysiwyg ul.panel li a.h2 { background-position: -16px -32px; }
|
36
|
-
div.wysiwyg ul.panel li a.h3 { background-position: -32px -32px; }
|
37
|
-
div.wysiwyg ul.panel li a.h4 { background-position: -48px -32px; }
|
38
|
-
div.wysiwyg ul.panel li a.h5 { background-position: -64px -32px; }
|
39
|
-
div.wysiwyg ul.panel li a.h6 { background-position: -80px -32px; }
|
40
|
-
|
41
|
-
div.wysiwyg ul.panel li a.cut { background-position: -32px -64px; }
|
42
|
-
div.wysiwyg ul.panel li a.copy { background-position: -48px -64px; }
|
43
|
-
div.wysiwyg ul.panel li a.paste { background-position: -64px -64px; }
|
44
|
-
|
45
|
-
div.wysiwyg ul.panel li a.increaseFontSize { background-position: -16px -80px; }
|
46
|
-
div.wysiwyg ul.panel li a.decreaseFontSize { background-position: -32px -80px; }
|
47
|
-
|
48
|
-
div.wysiwyg ul.panel li a.createLink { background-position: -80px -48px; }
|
49
|
-
div.wysiwyg ul.panel li a.insertImage { background-position: -80px -80px; }
|
50
|
-
|
51
|
-
div.wysiwyg ul.panel li a.html { background-position: -47px -46px; }
|
52
|
-
div.wysiwyg ul.panel li a.removeFormat { background-position: -80px -64px; }
|
53
|
-
|
54
|
-
div.wysiwyg ul.panel li a.empty { background-position: -64px -80px; }
|
55
|
-
|
56
|
-
div.wysiwyg iframe { border: 0; clear: left; margin: 0; width: 100% !important; }
|
data/webapp/public/layout.css
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
.buttons {
|
2
|
-
background-color: #eeeeff;
|
3
|
-
/* border: 2px solid #ddddff */
|
4
|
-
padding: 8px;
|
5
|
-
margin-top: 10px;
|
6
|
-
height: 32px;
|
7
|
-
word-spacing: 10px;
|
8
|
-
text-align: right; }
|
9
|
-
|
10
|
-
.button {
|
11
|
-
-moz-border-radius: 5px;
|
12
|
-
background: url("../../images/layout/button-large.png") repeat-x scroll center top transparent;
|
13
|
-
border: 1px solid #999999;
|
14
|
-
color: inherit;
|
15
|
-
margin: 0;
|
16
|
-
overflow: visible;
|
17
|
-
padding: 5px 8px;
|
18
|
-
/* width: 100px */
|
19
|
-
/* border-bottom: 2px solid #bbb */
|
20
|
-
/* border-top: none */
|
21
|
-
/* border-left: none */
|
22
|
-
/* border-right: 2px solid #bbb */
|
23
|
-
/* height: 30px */
|
24
|
-
/* background-color: #fff */
|
25
|
-
color: #444444;
|
26
|
-
font-weight: bold; }
|
27
|
-
.button:hover {
|
28
|
-
cursor: pointer; }
|
29
|
-
.button:active {
|
30
|
-
background: -moz-linear-gradient(center top, #cccccc, white) repeat scroll 0 0 transparent;
|
31
|
-
border: 1px solid #555555;
|
32
|
-
text-shadow: 0 1px 0 #eeeeee;
|
33
|
-
cursor: pointer; }
|