diff --git a/webinterface/src/main/resources/static/components.js b/webinterface/src/main/resources/static/components.js index 36e9617..ec655cf 100644 --- a/webinterface/src/main/resources/static/components.js +++ b/webinterface/src/main/resources/static/components.js @@ -5,8 +5,8 @@ const nbsp = '\u00a0'; var MainMenuItem = React.createClass({ render: function(){ - var liActive = {} - var aText = this.props.title + var liActive = {}; + var aText = this.props.title; if (this.props.active) { liActive = {className: 'active'}; @@ -47,12 +47,12 @@ var Navbar = React.createClass({ var Panel = React.createClass({ render: function(){ - colored = 'default'; + var colored = 'default'; if (this.props.colored) { colored = this.props.colored; } - elements = [ce('div', {className: 'panel-body'}, this.props.children)]; + var elements = [ce('div', {className: 'panel-body'}, this.props.children)]; if (this.props.title) { elements.unshift(ce('div', {className: 'panel-heading'}, this.props.title)); } diff --git a/webinterface/src/main/resources/static/fetch.js b/webinterface/src/main/resources/static/fetch.js index 6bac6b3..2e5c369 100644 --- a/webinterface/src/main/resources/static/fetch.js +++ b/webinterface/src/main/resources/static/fetch.js @@ -10,7 +10,7 @@ iterable: 'Symbol' in self && 'iterator' in Symbol, blob: 'FileReader' in self && 'Blob' in self && (function() { try { - new Blob() + new Blob(); return true } catch(e) { return false @@ -18,7 +18,7 @@ })(), formData: 'FormData' in self, arrayBuffer: 'ArrayBuffer' in self - } + }; if (support.arrayBuffer) { var viewClasses = [ @@ -31,11 +31,11 @@ '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]' - ] + ]; var isDataView = function(obj) { return obj && DataView.prototype.isPrototypeOf(obj) - } + }; var isArrayBufferView = ArrayBuffer.isView || function(obj) { return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 @@ -46,7 +46,7 @@ if (typeof name !== 'string') { name = String(name) } - if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { + if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { throw new TypeError('Invalid character in header field name') } return name.toLowerCase() @@ -63,10 +63,10 @@ function iteratorFor(items) { var iterator = { next: function() { - var value = items.shift() + var value = items.shift(); return {done: value === undefined, value: value} } - } + }; if (support.iterable) { iterator[Symbol.iterator] = function() { @@ -78,7 +78,7 @@ } function Headers(headers) { - this.map = {} + this.map = {}; if (headers instanceof Headers) { headers.forEach(function(value, name) { @@ -96,28 +96,28 @@ } Headers.prototype.append = function(name, value) { - name = normalizeName(name) - value = normalizeValue(value) - var oldValue = this.map[name] + name = normalizeName(name); + value = normalizeValue(value); + var oldValue = this.map[name]; this.map[name] = oldValue ? oldValue+','+value : value - } + }; Headers.prototype['delete'] = function(name) { delete this.map[normalizeName(name)] - } + }; Headers.prototype.get = function(name) { - name = normalizeName(name) + name = normalizeName(name); return this.has(name) ? this.map[name] : null - } + }; Headers.prototype.has = function(name) { return this.map.hasOwnProperty(normalizeName(name)) - } + }; Headers.prototype.set = function(name, value) { this.map[normalizeName(name)] = normalizeValue(value) - } + }; Headers.prototype.forEach = function(callback, thisArg) { for (var name in this.map) { @@ -125,25 +125,25 @@ callback.call(thisArg, this.map[name], name, this) } } - } + }; Headers.prototype.keys = function() { - var items = [] - this.forEach(function(value, name) { items.push(name) }) + var items = []; + this.forEach(function(value, name) { items.push(name) }); return iteratorFor(items) - } + }; Headers.prototype.values = function() { - var items = [] - this.forEach(function(value) { items.push(value) }) + var items = []; + this.forEach(function(value) { items.push(value) }); return iteratorFor(items) - } + }; Headers.prototype.entries = function() { - var items = [] - this.forEach(function(value, name) { items.push([name, value]) }) + var items = []; + this.forEach(function(value, name) { items.push([name, value]) }); return iteratorFor(items) - } + }; if (support.iterable) { Headers.prototype[Symbol.iterator] = Headers.prototype.entries @@ -160,7 +160,7 @@ return new Promise(function(resolve, reject) { reader.onload = function() { resolve(reader.result) - } + }; reader.onerror = function() { reject(reader.error) } @@ -168,22 +168,22 @@ } function readBlobAsArrayBuffer(blob) { - var reader = new FileReader() - var promise = fileReaderReady(reader) - reader.readAsArrayBuffer(blob) + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsArrayBuffer(blob); return promise } function readBlobAsText(blob) { - var reader = new FileReader() - var promise = fileReaderReady(reader) - reader.readAsText(blob) + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsText(blob); return promise } function readArrayBufferAsText(buf) { - var view = new Uint8Array(buf) - var chars = new Array(view.length) + var view = new Uint8Array(buf); + var chars = new Array(view.length); for (var i = 0; i < view.length; i++) { chars[i] = String.fromCharCode(view[i]) @@ -195,17 +195,17 @@ if (buf.slice) { return buf.slice(0) } else { - var view = new Uint8Array(buf.byteLength) - view.set(new Uint8Array(buf)) + var view = new Uint8Array(buf.byteLength); + view.set(new Uint8Array(buf)); return view.buffer } } function Body() { - this.bodyUsed = false + this.bodyUsed = false; this._initBody = function(body) { - this._bodyInit = body + this._bodyInit = body; if (!body) { this._bodyText = '' } else if (typeof body === 'string') { @@ -217,7 +217,7 @@ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this._bodyText = body.toString() } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer) + this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. this._bodyInit = new Blob([this._bodyArrayBuffer]) } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { @@ -235,11 +235,11 @@ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') } } - } + }; if (support.blob) { this.blob = function() { - var rejected = consumed(this) + var rejected = consumed(this); if (rejected) { return rejected } @@ -253,7 +253,7 @@ } else { return Promise.resolve(new Blob([this._bodyText])) } - } + }; this.arrayBuffer = function() { if (this._bodyArrayBuffer) { @@ -265,7 +265,7 @@ } this.text = function() { - var rejected = consumed(this) + var rejected = consumed(this); if (rejected) { return rejected } @@ -279,7 +279,7 @@ } else { return Promise.resolve(this._bodyText) } - } + }; if (support.formData) { this.formData = function() { @@ -289,49 +289,49 @@ this.json = function() { return this.text().then(JSON.parse) - } + }; return this } // HTTP methods whose capitalization should be normalized - var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'] + var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; function normalizeMethod(method) { - var upcased = method.toUpperCase() + var upcased = method.toUpperCase(); return (methods.indexOf(upcased) > -1) ? upcased : method } function Request(input, options) { - options = options || {} - var body = options.body + options = options || {}; + var body = options.body; if (input instanceof Request) { if (input.bodyUsed) { throw new TypeError('Already read') } - this.url = input.url - this.credentials = input.credentials + this.url = input.url; + this.credentials = input.credentials; if (!options.headers) { this.headers = new Headers(input.headers) } - this.method = input.method - this.mode = input.mode - if (!body && input._bodyInit != null) { - body = input._bodyInit + this.method = input.method; + this.mode = input.mode; + if (!body && input._bodyInit !== null) { + body = input._bodyInit; input.bodyUsed = true } } else { this.url = String(input) } - this.credentials = options.credentials || this.credentials || 'omit' + this.credentials = options.credentials || this.credentials || 'omit'; if (options.headers || !this.headers) { this.headers = new Headers(options.headers) } - this.method = normalizeMethod(options.method || this.method || 'GET') - this.mode = options.mode || this.mode || null - this.referrer = null + this.method = normalizeMethod(options.method || this.method || 'GET'); + this.mode = options.mode || this.mode || null; + this.referrer = null; if ((this.method === 'GET' || this.method === 'HEAD') && body) { throw new TypeError('Body not allowed for GET or HEAD requests') @@ -341,51 +341,51 @@ Request.prototype.clone = function() { return new Request(this, { body: this._bodyInit }) - } + }; function decode(body) { - var form = new FormData() + var form = new FormData(); body.trim().split('&').forEach(function(bytes) { if (bytes) { - var split = bytes.split('=') - var name = split.shift().replace(/\+/g, ' ') - var value = split.join('=').replace(/\+/g, ' ') + var split = bytes.split('='); + var name = split.shift().replace(/\+/g, ' '); + var value = split.join('=').replace(/\+/g, ' '); form.append(decodeURIComponent(name), decodeURIComponent(value)) } - }) + }); return form } function parseHeaders(rawHeaders) { - var headers = new Headers() + var headers = new Headers(); rawHeaders.split(/\r?\n/).forEach(function(line) { - var parts = line.split(':') - var key = parts.shift().trim() + var parts = line.split(':'); + var key = parts.shift().trim(); if (key) { - var value = parts.join(':').trim() + var value = parts.join(':').trim(); headers.append(key, value) } - }) + }); return headers } - Body.call(Request.prototype) + Body.call(Request.prototype); function Response(bodyInit, options) { if (!options) { options = {} } - this.type = 'default' - this.status = 'status' in options ? options.status : 200 - this.ok = this.status >= 200 && this.status < 300 - this.statusText = 'statusText' in options ? options.statusText : 'OK' - this.headers = new Headers(options.headers) - this.url = options.url || '' + this.type = 'default'; + this.status = 'status' in options ? options.status : 200; + this.ok = this.status >= 200 && this.status < 300; + this.statusText = 'statusText' in options ? options.statusText : 'OK'; + this.headers = new Headers(options.headers); + this.url = options.url || ''; this._initBody(bodyInit) } - Body.call(Response.prototype) + Body.call(Response.prototype); Response.prototype.clone = function() { return new Response(this._bodyInit, { @@ -394,15 +394,15 @@ headers: new Headers(this.headers), url: this.url }) - } + }; Response.error = function() { - var response = new Response(null, {status: 0, statusText: ''}) - response.type = 'error' + var response = new Response(null, {status: 0, statusText: ''}); + response.type = 'error'; return response - } + }; - var redirectStatuses = [301, 302, 303, 307, 308] + var redirectStatuses = [301, 302, 303, 307, 308]; Response.redirect = function(url, status) { if (redirectStatuses.indexOf(status) === -1) { @@ -410,37 +410,37 @@ } return new Response(null, {status: status, headers: {location: url}}) - } + }; - self.Headers = Headers - self.Request = Request - self.Response = Response + self.Headers = Headers; + self.Request = Request; + self.Response = Response; self.fetch = function(input, init) { return new Promise(function(resolve, reject) { - var request = new Request(input, init) - var xhr = new XMLHttpRequest() + var request = new Request(input, init); + var xhr = new XMLHttpRequest(); xhr.onload = function() { var options = { status: xhr.status, statusText: xhr.statusText, headers: parseHeaders(xhr.getAllResponseHeaders() || '') - } - options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') - var body = 'response' in xhr ? xhr.response : xhr.responseText + }; + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); + var body = 'response' in xhr ? xhr.response : xhr.responseText; resolve(new Response(body, options)) - } + }; xhr.onerror = function() { reject(new TypeError('Network request failed')) - } + }; xhr.ontimeout = function() { reject(new TypeError('Network request failed')) - } + }; - xhr.open(request.method, request.url, true) + xhr.open(request.method, request.url, true); if (request.credentials === 'include') { xhr.withCredentials = true @@ -452,10 +452,10 @@ request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value) - }) + }); xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) }) - } + }; self.fetch.polyfill = true })(typeof self !== 'undefined' ? self : this); diff --git a/webinterface/src/main/resources/static/module.js b/webinterface/src/main/resources/static/module.js index da693a4..2fa85f5 100644 --- a/webinterface/src/main/resources/static/module.js +++ b/webinterface/src/main/resources/static/module.js @@ -24,13 +24,13 @@ var BundleTableRow = React.createClass({ lastModified: this.props.lastModified }}, stateToStr: function(state) { - if (state == 1) {return 'UNINSTALLED'} - else if (state == 2) {return 'INSTALLED'} - else if (state == 4) {return 'RESOLVED'} - else if (state == 8) {return 'STARTING'} - else if (state == 16) {return 'STOPPING'} - else if (state == 32) {return 'ACTIVE'} - else {return 'UNKNOW('+state+')'} + if (state === 1) {return 'UNINSTALLED'} + else if (state === 2) {return 'INSTALLED'} + else if (state === 4) {return 'RESOLVED'} + else if (state === 8) {return 'STARTING'} + else if (state === 16) {return 'STOPPING'} + else if (state === 32) {return 'ACTIVE'} + else {return 'UNKNOW('+state+')'} }, bndUpd: function() { var _this = this; @@ -52,7 +52,7 @@ var BundleTableRow = React.createClass({ }); }, render: function(){ - vertAlign = {'vertical-align': 'middle'}; + var vertAlign = {'vertical-align': 'middle'}; return( ce('tr', null, ce('td', {style: vertAlign}, this.state.id),