mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-02-11 10:59:15 +00:00
”2016-08-01”
This commit is contained in:
parent
3f25058766
commit
12dc5549bd
241
smartoffice/SODashServer/SODashServer/app/js/mdot.js
Normal file
241
smartoffice/SODashServer/SODashServer/app/js/mdot.js
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
'use strict';
|
||||||
|
/* global Backbone, _, $ */
|
||||||
|
/* global mainview */
|
||||||
|
/* jshint browser: true , devel: true*/
|
||||||
|
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
var mqttConfig = {
|
||||||
|
orgId: 'qz0da4',
|
||||||
|
userName: 'a-qz0da4-dfwwdkmkzr',
|
||||||
|
appKey: '9txJEf3Cjy7hkSOvkv',
|
||||||
|
prefix: 'iot-2/type/mDot/id/'
|
||||||
|
};
|
||||||
|
|
||||||
|
var sendAuthentication = function(xhr) {
|
||||||
|
var user = 'a-qz0da4-dfwwdkmkzr'; // Your actual username
|
||||||
|
var pass = '9txJEf3Cjy7hkSOvkv'; // Your actual password
|
||||||
|
var token = user.concat(':', pass);
|
||||||
|
xhr.setRequestHeader('Authorization', ('Basic '.concat(btoa(token))));
|
||||||
|
};
|
||||||
|
|
||||||
|
var EventsModel = Backbone.Model.extend({
|
||||||
|
initialize: function() {
|
||||||
|
_.bindAll(this, 'processAdded');
|
||||||
|
this.on('all',function(d) {
|
||||||
|
console.log('model:all',d);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
this.on('add',function() {
|
||||||
|
this.processAdded();
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
processAdded: function() {
|
||||||
|
console.log('Model:ProcessAdded');
|
||||||
|
|
||||||
|
_.invoke(DeviceCollection.toArray(), 'destroy');
|
||||||
|
|
||||||
|
_(this.get('events')).each(function(i) {
|
||||||
|
i.evt.decoded = this.decoder(i.evt.data);
|
||||||
|
i.evt.dateTime = this.dateTime(i.timestamp.$date);
|
||||||
|
DeviceCollection.add({dt: i.evt.dateTime.dateTime,lux: i.evt.decoded.light, temp: i.evt.decoded.temp, co2: i.evt.decoded.co2, humid: i.evt.decoded.humid, noise: i.evt.decoded.noise});
|
||||||
|
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
decoder: function(data) {
|
||||||
|
var _obj = {};
|
||||||
|
var _data = window.atob(data).split('');
|
||||||
|
|
||||||
|
var bytes = _data.map(i => i.charCodeAt());
|
||||||
|
|
||||||
|
_obj.light = parseInt('0x' + ('0' + bytes[0]).substr(-2) + ('0' + bytes[1]).substr(-2));
|
||||||
|
_obj.co2 = parseInt(_data[2] + _data[3] + _data[4] + _data[5] + _data[6], 10);
|
||||||
|
_obj.temp = (parseInt(_data[7] + _data[8] + _data[9] + _data[10] + _data[11], 10) - 1000) / 10;
|
||||||
|
_obj.humid = (parseInt(_data[12] + _data[13] + _data[14] + _data[15] + _data[16], 10) / 10);
|
||||||
|
_obj.noise = parseInt('0x' + ('0' + bytes[17]).substr(-2) + ('0' + bytes[18]).substr(-2));
|
||||||
|
_obj.binData = bytes;
|
||||||
|
return _obj;
|
||||||
|
},
|
||||||
|
dateTime: function($date) {
|
||||||
|
var dateTime = new Date.create($date);
|
||||||
|
var date = dateTime.format('{yyyy}-{MM}-{dd}');
|
||||||
|
var time = dateTime.format('{HH}:{mm}:{ss}');
|
||||||
|
return {dateTime: dateTime.format('{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}'), date: date, time: time};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var mDotCollection = Backbone.Collection.extend({
|
||||||
|
model: EventsModel,
|
||||||
|
url: 'https://qz0da4.internetofthings.ibmcloud.com/api/v0002/historian/types/mDot/devices/',
|
||||||
|
initialize: function() {
|
||||||
|
this.on('all',function(d) {
|
||||||
|
console.log('Collection:all',d);
|
||||||
|
|
||||||
|
});
|
||||||
|
this.on('update', function() {
|
||||||
|
// Console.log('Collection:update',this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
var ItemView = Backbone.View.extend({
|
||||||
|
tagName: 'div', className: 'item mui-container', initialize: function() {
|
||||||
|
this.template = _.template($('#item-template').html());
|
||||||
|
console.log('ItemView:Init');
|
||||||
|
this.render();
|
||||||
|
}, render: function() {
|
||||||
|
console.log('ItemView:Render');
|
||||||
|
_(this.model.events).each(function(i) {
|
||||||
|
this.$el.append(this.template({item: i}));
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var MDOT = Backbone.View.extend({
|
||||||
|
model: EventsModel, el: $('#output'),
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click button#refresh': 'refresh'
|
||||||
|
}, initialize: function() {
|
||||||
|
_.bindAll(this, 'render', 'refresh', 'update');
|
||||||
|
this.collection.bind('change reset add remove', this.render, this);
|
||||||
|
|
||||||
|
this.template = _.template($('#list-template').html());
|
||||||
|
this.render();
|
||||||
|
}, refresh: function() {
|
||||||
|
|
||||||
|
}, update: function() {
|
||||||
|
console.log('MDOT:update');
|
||||||
|
this.collection.each(function(model) {
|
||||||
|
|
||||||
|
// Var events = model.get('events');
|
||||||
|
// var e = new ItemView({model: model.toJSON()});
|
||||||
|
});
|
||||||
|
|
||||||
|
}, render: function() {
|
||||||
|
console.log('MDOT:render');
|
||||||
|
var that = this;
|
||||||
|
this.$el.empty();
|
||||||
|
this.collection.each(function(model) {
|
||||||
|
|
||||||
|
var events = model.get('events');
|
||||||
|
var e = new ItemView({model: model.toJSON()}).render().el;
|
||||||
|
|
||||||
|
console.log('render:done:');
|
||||||
|
that.$el.append(e);
|
||||||
|
|
||||||
|
});
|
||||||
|
console.log('bah');
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var MainView = Backbone.View.extend({
|
||||||
|
el: $('#main'),
|
||||||
|
template: _.template($('#main-template').html()),
|
||||||
|
events: {
|
||||||
|
'change select#device': 'changeDevice'
|
||||||
|
},
|
||||||
|
initialize: function() {
|
||||||
|
_.bindAll(this, 'render','changeDevice');
|
||||||
|
this.render();
|
||||||
|
},
|
||||||
|
render: function() {
|
||||||
|
$(this.el).html(this.template());
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
changeDevice: function() {
|
||||||
|
var newDevice;
|
||||||
|
console.log('MainView:ChangeDevice');
|
||||||
|
newDevice = this.$el.find('#device')[0].value;
|
||||||
|
|
||||||
|
this.collection.url = 'https://qz0da4.internetofthings.ibmcloud.com/api/v0002/historian/types/mDot/devices/' + newDevice;
|
||||||
|
this.collection.fetch({beforeSend: sendAuthentication});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var GraphView = Backbone.View.extend({
|
||||||
|
el: $('#graph'),
|
||||||
|
template: _.template($('#graph-template').html()),
|
||||||
|
initialize: function() {
|
||||||
|
this.modes = ['','lux','temp','co2','humid','noise'];
|
||||||
|
this.mode = 0;
|
||||||
|
console.log('GraphView!');
|
||||||
|
_.bindAll(this, 'render', 'changeMode', 'updateGraph');
|
||||||
|
this.render();
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
'change select#displaymode': 'changeMode'
|
||||||
|
},
|
||||||
|
render: function() {
|
||||||
|
$(this.el).html(this.template());
|
||||||
|
this.$line = $(this.el).find('#line');
|
||||||
|
this.$maxY = $(this.el).find('#maxY');
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
changeMode: function() {
|
||||||
|
this.mode = this.$el.find('#displaymode')[0].value;
|
||||||
|
this.updateGraph();
|
||||||
|
console.log('new mode:', this.mode);
|
||||||
|
|
||||||
|
},
|
||||||
|
updateGraph: function() {
|
||||||
|
|
||||||
|
var ceiling, ceilingLimit;
|
||||||
|
var points = [];
|
||||||
|
var getMode = this.modes[this.mode];
|
||||||
|
|
||||||
|
_(this.collection.models).each(function(i) {
|
||||||
|
points.push(i.get(getMode));
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
ceiling = points.reduce(function(p, v) {
|
||||||
|
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
|
||||||
|
});
|
||||||
|
|
||||||
|
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 10) * 10);
|
||||||
|
if (ceilingLimit > 1000) {
|
||||||
|
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 50) * 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
var scale = 124 / ceilingLimit;
|
||||||
|
// Var xstep = (280 - 46) / 100;
|
||||||
|
var xstep = 2.34;
|
||||||
|
var startX = 46 + (100 - points.length) * xstep;
|
||||||
|
var calcArray = [];
|
||||||
|
for (var x = 0;x < points.length;x++) {
|
||||||
|
calcArray.push((startX + (x * xstep)).toFixed(2) + ',' + (136 - ((points[x]) * scale)).toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$line[0].setAttribute('points',calcArray.join(' '));
|
||||||
|
|
||||||
|
this.$maxY[0].textContent = ceilingLimit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
var DeviceCollection = new Backbone.Collection;
|
||||||
|
|
||||||
|
var mdotCollection = new mDotCollection();
|
||||||
|
|
||||||
|
var mainview = new MainView({collection: mdotCollection});
|
||||||
|
|
||||||
|
var mdot = new MDOT({collection: mdotCollection});
|
||||||
|
|
||||||
|
var grapher = new GraphView({collection: DeviceCollection});
|
||||||
|
|
||||||
|
})(jQuery);
|
61
smartoffice/SODashServer/SODashServer/app/lib/base64.js
Normal file
61
smartoffice/SODashServer/SODashServer/app/lib/base64.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
;(function () {
|
||||||
|
|
||||||
|
var object = typeof exports != 'undefined' ? exports : self; // #8: web workers
|
||||||
|
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||||
|
|
||||||
|
function InvalidCharacterError(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
InvalidCharacterError.prototype = new Error;
|
||||||
|
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
||||||
|
|
||||||
|
// encoder
|
||||||
|
// [https://gist.github.com/999166] by [https://github.com/nignag]
|
||||||
|
object.btoa || (
|
||||||
|
object.btoa = function (input) {
|
||||||
|
var str = String(input);
|
||||||
|
for (
|
||||||
|
// initialize result and counter
|
||||||
|
var block, charCode, idx = 0, map = chars, output = '';
|
||||||
|
// if the next str index does not exist:
|
||||||
|
// change the mapping table to "="
|
||||||
|
// check if d has no fractional digits
|
||||||
|
str.charAt(idx | 0) || (map = '=', idx % 1);
|
||||||
|
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
||||||
|
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
||||||
|
) {
|
||||||
|
charCode = str.charCodeAt(idx += 3/4);
|
||||||
|
if (charCode > 0xFF) {
|
||||||
|
throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
|
||||||
|
}
|
||||||
|
block = block << 8 | charCode;
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
});
|
||||||
|
|
||||||
|
// decoder
|
||||||
|
// [https://gist.github.com/1020396] by [https://github.com/atk]
|
||||||
|
object.atob || (
|
||||||
|
object.atob = function (input) {
|
||||||
|
var str = String(input).replace(/=+$/, '');
|
||||||
|
if (str.length % 4 == 1) {
|
||||||
|
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
||||||
|
}
|
||||||
|
for (
|
||||||
|
// initialize result and counters
|
||||||
|
var bc = 0, bs, buffer, idx = 0, output = '';
|
||||||
|
// get next character
|
||||||
|
buffer = str.charAt(idx++);
|
||||||
|
// character found in table? initialize bit storage and add its ascii value;
|
||||||
|
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
||||||
|
// and if not first of each 4 characters,
|
||||||
|
// convert the first 8 bits to one ascii character
|
||||||
|
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
||||||
|
) {
|
||||||
|
// try to find character in table (0-63, not found => -1)
|
||||||
|
buffer = chars.indexOf(buffer);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
});
|
||||||
|
|
||||||
|
}());
|
@ -7,13 +7,9 @@
|
|||||||
type="text/css"/>
|
type="text/css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="lib/jquery.js"
|
|
||||||
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
<script src="lib/underscore.js"></script>
|
|
||||||
<script src="lib/backbone.js"></script>
|
|
||||||
|
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
|
<div id="graph"></div>
|
||||||
<div id="output"></div>
|
<div id="output"></div>
|
||||||
<script type="text/template" id="main-template">
|
<script type="text/template" id="main-template">
|
||||||
<div class="mui-container">
|
<div class="mui-container">
|
||||||
@ -65,146 +61,72 @@
|
|||||||
<ul></ul>
|
<ul></ul>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/template" id="item-template">
|
<script type="text/template" id="item-template">
|
||||||
<div>
|
<div class="mui-row">
|
||||||
<%= item.device_id %> <%= item.device_type %>
|
<div class="mui-col-md-2"><%= item.evt.dateTime.dateTime %></div>
|
||||||
|
<div class="mui-col-md-2"><%= item.evt.decoded.light %></div>
|
||||||
|
<div class="mui-col-md-2"><%= item.evt.decoded.co2 %></div>
|
||||||
|
<div class="mui-col-md-2"><%= item.evt.decoded.temp %></div>
|
||||||
|
<div class="mui-col-md-2"><%= item.evt.decoded.humid %></div>
|
||||||
|
<div class="mui-col-md-2"><%= item.evt.decoded.noise %></div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script type="text/template" id="graph-template">
|
||||||
|
<div class="mui-container">
|
||||||
|
<div class="mui-row">
|
||||||
|
<div class="mui-select mui-col-md-6">
|
||||||
|
<select id="displaymode" name="displaymode">
|
||||||
|
<option value="0"></option>
|
||||||
|
<option value="1">
|
||||||
|
Light
|
||||||
|
</option>
|
||||||
|
|
||||||
<script>
|
<option value="2">
|
||||||
(function($) {
|
Temp
|
||||||
|
</option>
|
||||||
|
<option value="3">
|
||||||
|
Co2
|
||||||
|
</option>
|
||||||
|
|
||||||
var mqttConfig = {
|
<option value="4">
|
||||||
orgId: 'qz0da4',
|
Humidity
|
||||||
userName: 'a-qz0da4-dfwwdkmkzr',
|
</option>
|
||||||
appKey: '9txJEf3Cjy7hkSOvkv',
|
<option value="5">
|
||||||
prefix: 'iot-2/type/mDot/id/'
|
Noise
|
||||||
};
|
</option>
|
||||||
|
|
||||||
sendAuthentication = function(xhr) {
|
</select> <label>Graph</label>
|
||||||
var user = 'a-qz0da4-dfwwdkmkzr';// your actual username
|
|
||||||
var pass = '9txJEf3Cjy7hkSOvkv';// your actual password
|
|
||||||
var token = user.concat(":", pass);
|
|
||||||
xhr.setRequestHeader('Authorization', ("Basic ".concat(btoa(token))));
|
|
||||||
};
|
|
||||||
|
|
||||||
var mDotModel = Backbone.Model.extend({});
|
</div>
|
||||||
|
<div class="mui-col-md-6">
|
||||||
var mDotCollection = Backbone.Collection.extend({
|
<svg id="graphSVG" width="300" height="150" fill="blue">
|
||||||
model: mDotModel,
|
<line x1="46" y1="12" x2="280" y2="12"
|
||||||
url: 'https://qz0da4.internetofthings.ibmcloud.com/api/v0002/historian/types/mDot/devices/'
|
style="stroke:#004c6d;stroke-width:2;"></line>
|
||||||
//url: 'https://qz0da4.internetofthings.ibmcloud.com/api/v0002/historian/types/mDot/devices/HIE-smart-campus-4'
|
<text id="maxY" x="36" y="15" text-anchor="end">--</text>
|
||||||
});
|
<line x1="46" y1="136" x2="280" y2="136"
|
||||||
|
style="stroke:#004c6d;stroke-width:2;"></line>
|
||||||
var ItemView = Backbone.View.extend({
|
<text id="MinY" x="36" y="139" text-anchor="end">0</text>
|
||||||
tagName: 'div', className: 'item', initialize: function() {
|
<polyline id="line" fill="none" stroke="#2196F3"
|
||||||
this.template = _.template($('#item-template').html());
|
text-anchor="end" stroke-width="2"
|
||||||
console.log('ItemView:Init');
|
points=""></polyline>
|
||||||
this.render();
|
</svg>
|
||||||
}, render: function() {
|
</div>
|
||||||
var self = this;
|
</div>
|
||||||
console.log('ItemView:Render');
|
</div>
|
||||||
console.log(this.model);
|
|
||||||
_(this.model.events).each(function(i){
|
|
||||||
// console.log(this.template({item:i}));
|
|
||||||
this.$el.append(this.template({item:i}));
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
//this.$el.html(this.template({item:this.model}));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var MDOT = Backbone.View.extend({
|
|
||||||
model: mDotModel, el: $('#output'),
|
|
||||||
|
|
||||||
events: {
|
|
||||||
'click button#refresh': 'refresh'
|
|
||||||
}, initialize: function() {
|
|
||||||
_.bindAll(this, 'render', 'refresh', 'update');
|
|
||||||
//this.collection = new mDotCollection();
|
|
||||||
this.collection.bind('change reset add remove', this.render, this);
|
|
||||||
|
|
||||||
this.template = _.template($('#list-template').html());
|
|
||||||
this.render();
|
|
||||||
//this.collection.
|
|
||||||
}, refresh: function() {
|
|
||||||
|
|
||||||
}, update: function() {
|
|
||||||
console.log('MDOT:update');
|
|
||||||
console.log(this);
|
|
||||||
|
|
||||||
this.collection.each(function(model) {
|
|
||||||
|
|
||||||
var events = model.get('events');
|
|
||||||
var e = new ItemView({model: model.toJSON()});
|
|
||||||
// that.$el.append();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}, render: function() {
|
|
||||||
console.log('MDOT:render');
|
|
||||||
that = this;
|
|
||||||
this.$el.empty();
|
|
||||||
//this.$el.append(this.template());
|
|
||||||
|
|
||||||
this.collection.each(function(model) {
|
|
||||||
|
|
||||||
var events = model.get('events');
|
|
||||||
var e = new ItemView({model: model.toJSON()}).render().el;
|
|
||||||
|
|
||||||
console.log('done:',e);
|
|
||||||
that.$el.append(e);
|
|
||||||
|
|
||||||
});
|
|
||||||
console.log('bah');
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var MainView = Backbone.View.extend({
|
|
||||||
el: $('#main'),
|
|
||||||
template:_.template($('#main-template').html()),
|
|
||||||
events: {
|
|
||||||
'change select#device': 'changeDevice'
|
|
||||||
},
|
|
||||||
initialize: function() {
|
|
||||||
_.bindAll(this, 'render','changeDevice');
|
|
||||||
|
|
||||||
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
render: function(){
|
|
||||||
$(this.el).html(this.template());
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
changeDevice: function() {
|
|
||||||
var newDevice;
|
|
||||||
console.log('MainView:ChangeDevice');
|
|
||||||
console.log(this);
|
|
||||||
this.collection.set('id','HIE-smart-campus-4');
|
|
||||||
//this.collection.fetch({beforeSend: sendAuthentication});
|
|
||||||
|
|
||||||
newDevice = this.$el.find('#device')[0].value
|
|
||||||
|
|
||||||
console.log('D:',this.$el.find('#device')[0].value);
|
|
||||||
this.collection.url = 'https://qz0da4.internetofthings.ibmcloud.com/api/v0002/historian/types/mDot/devices/' + newDevice;
|
|
||||||
this.collection.fetch({beforeSend: sendAuthentication});
|
|
||||||
|
|
||||||
//{data:{fetch:true, type:"post", page:1}}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var mdotCollection = new mDotCollection();
|
|
||||||
|
|
||||||
var mainview = new MainView({collection: mdotCollection});
|
|
||||||
|
|
||||||
var mdot = new MDOT({collection: mdotCollection});
|
|
||||||
|
|
||||||
// mdotCollection.fetch({beforeSend: sendAuthentication});
|
|
||||||
})(jQuery);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="lib/jquery.js"
|
||||||
|
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="lib/base64.js"></script>
|
||||||
|
<script src="lib/underscore.js"></script>
|
||||||
|
<script src="lib/backbone.js"></script>
|
||||||
|
<script src="lib/sugar-date.js"></script>
|
||||||
|
<script src="js/mdot.js"></script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"jquery": "^2.2.3",
|
"jquery": "^2.2.3",
|
||||||
"mui": "^0.6.8",
|
"mui": "^0.6.8",
|
||||||
"sugarjs-date": "^1.5.1",
|
"sugarjs-date": "^1.5.1",
|
||||||
"backbone": "^1.3.3"
|
"backbone": "^1.3.3",
|
||||||
|
"base64": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "base64",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Base64 encoding and decoding",
|
||||||
|
"main": "./base64.js",
|
||||||
|
"license": "WTFPL",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/davidchambers/Base64.js.git"
|
||||||
|
},
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"Makefile",
|
||||||
|
"coverage/",
|
||||||
|
"scripts/",
|
||||||
|
"test/"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/davidchambers/Base64.js",
|
||||||
|
"_release": "1.0.0",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "1.0.0",
|
||||||
|
"commit": "8f1b14b549725d55457e2821ca250e523d007822"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/davidchambers/Base64.js.git",
|
||||||
|
"_target": "^1.0.0",
|
||||||
|
"_originalSource": "base64",
|
||||||
|
"_direct": true
|
||||||
|
}
|
@ -0,0 +1,219 @@
|
|||||||
|
This software is dual-licensed under Apache 2.0 and WTFPL
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2015 David Chambers
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (c) 2011..2012 David Chambers <dc@hashify.me>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
copies of this license document, and changing it is allowed as long
|
||||||
|
as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
@ -0,0 +1,34 @@
|
|||||||
|
# Base64.js
|
||||||
|
|
||||||
|
≈ 500 byte* polyfill for browsers which don't provide [`window.btoa`][1] and
|
||||||
|
[`window.atob`][2].
|
||||||
|
|
||||||
|
Although the script does no harm in browsers which do provide these functions,
|
||||||
|
a conditional script loader such as [yepnope][3] can prevent unnecessary HTTP
|
||||||
|
requests.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
yepnope({
|
||||||
|
test: window.btoa && window.atob,
|
||||||
|
nope: 'base64.js',
|
||||||
|
callback: function () {
|
||||||
|
// `btoa` and `atob` are now safe to use
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Base64.js stems from a [gist][4] by [yahiko][5].
|
||||||
|
|
||||||
|
### Running the test suite
|
||||||
|
|
||||||
|
make setup
|
||||||
|
make test
|
||||||
|
|
||||||
|
\* Minified and gzipped. Run `make bytes` to verify.
|
||||||
|
|
||||||
|
|
||||||
|
[1]: https://developer.mozilla.org/en/DOM/window.btoa
|
||||||
|
[2]: https://developer.mozilla.org/en/DOM/window.atob
|
||||||
|
[3]: http://yepnopejs.com/
|
||||||
|
[4]: https://gist.github.com/229984
|
||||||
|
[5]: https://github.com/yahiko
|
@ -0,0 +1,61 @@
|
|||||||
|
;(function () {
|
||||||
|
|
||||||
|
var object = typeof exports != 'undefined' ? exports : self; // #8: web workers
|
||||||
|
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||||
|
|
||||||
|
function InvalidCharacterError(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
InvalidCharacterError.prototype = new Error;
|
||||||
|
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
||||||
|
|
||||||
|
// encoder
|
||||||
|
// [https://gist.github.com/999166] by [https://github.com/nignag]
|
||||||
|
object.btoa || (
|
||||||
|
object.btoa = function (input) {
|
||||||
|
var str = String(input);
|
||||||
|
for (
|
||||||
|
// initialize result and counter
|
||||||
|
var block, charCode, idx = 0, map = chars, output = '';
|
||||||
|
// if the next str index does not exist:
|
||||||
|
// change the mapping table to "="
|
||||||
|
// check if d has no fractional digits
|
||||||
|
str.charAt(idx | 0) || (map = '=', idx % 1);
|
||||||
|
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
||||||
|
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
||||||
|
) {
|
||||||
|
charCode = str.charCodeAt(idx += 3/4);
|
||||||
|
if (charCode > 0xFF) {
|
||||||
|
throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
|
||||||
|
}
|
||||||
|
block = block << 8 | charCode;
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
});
|
||||||
|
|
||||||
|
// decoder
|
||||||
|
// [https://gist.github.com/1020396] by [https://github.com/atk]
|
||||||
|
object.atob || (
|
||||||
|
object.atob = function (input) {
|
||||||
|
var str = String(input).replace(/=+$/, '');
|
||||||
|
if (str.length % 4 == 1) {
|
||||||
|
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
||||||
|
}
|
||||||
|
for (
|
||||||
|
// initialize result and counters
|
||||||
|
var bc = 0, bs, buffer, idx = 0, output = '';
|
||||||
|
// get next character
|
||||||
|
buffer = str.charAt(idx++);
|
||||||
|
// character found in table? initialize bit storage and add its ascii value;
|
||||||
|
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
||||||
|
// and if not first of each 4 characters,
|
||||||
|
// convert the first 8 bits to one ascii character
|
||||||
|
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
||||||
|
) {
|
||||||
|
// try to find character in table (0-63, not found => -1)
|
||||||
|
buffer = chars.indexOf(buffer);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
});
|
||||||
|
|
||||||
|
}());
|
1
smartoffice/SODashServer/SODashServer/src/bower_modules/base64/base64.min.js
vendored
Normal file
1
smartoffice/SODashServer/SODashServer/src/bower_modules/base64/base64.min.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:self,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(n=a.charCodeAt(i+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}();
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "base64",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Base64 encoding and decoding",
|
||||||
|
"main": "./base64.js",
|
||||||
|
"license": "WTFPL",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/davidchambers/Base64.js.git"
|
||||||
|
},
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"Makefile",
|
||||||
|
"coverage/",
|
||||||
|
"scripts/",
|
||||||
|
"test/"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "Base64",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Base64 encoding and decoding",
|
||||||
|
"author": "David Chambers <dc@davidchambers.me>",
|
||||||
|
"main": "./base64.js",
|
||||||
|
"license": "(Apache-2.0 OR WTFPL)",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/davidchambers/Base64.js.git"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"coffee-script": "1.8.x",
|
||||||
|
"istanbul": "0.2.x",
|
||||||
|
"mocha": "1.18.x",
|
||||||
|
"uglify-js": "2.4.x",
|
||||||
|
"xyz": "0.5.x"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"/LICENSE",
|
||||||
|
"/README.md",
|
||||||
|
"/base64.js",
|
||||||
|
"/package.json"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user