From f8e954ff794c4da0df4051e7987a5058e8cf499d Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Tue, 12 Feb 2019 18:30:44 +0100 Subject: [PATCH] =?UTF-8?q?Range=20les=20fichiers=20statiques=20K-F=C3=AAt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les fichiers JS et CSS externes sont dans `static/kfet/vendor`, minifiés ; on bump la version de `reconnecting-websocket`. --- kfet/forms.py | 4 +- kfet/static/kfet/js/reconnecting-websocket.js | 365 ------------ .../bootstrap-datetimepicker.min.css | 0 .../bootstrap-datetimepicker.min.js | 0 .../{css => vendor/jquery}/jquery-confirm.css | 0 .../{js => vendor/jquery}/jquery-confirm.js | 0 .../kfet/vendor/jquery/jquery-confirm.min.css | 9 + .../kfet/vendor/jquery/jquery-confirm.min.js | 1 + .../jquery.tablesorter.combined.js | 0 .../jquery/jquery.tablesorter.combined.min.js | 4 + kfet/static/kfet/{js => vendor}/js.cookie.js | 0 .../multiple-select}/multiple-select.css | 0 .../multiple-select}/multiple-select.js | 0 .../multiple-select}/multiple-select.png | Bin .../kfet/vendor/reconnecting-websocket.js | 529 ++++++++++++++++++ .../kfet/vendor/reconnecting-websocket.min.js | 1 + kfet/templates/kfet/base.html | 12 +- 17 files changed, 552 insertions(+), 373 deletions(-) delete mode 100644 kfet/static/kfet/js/reconnecting-websocket.js rename kfet/static/kfet/{css => vendor/bootstrap}/bootstrap-datetimepicker.min.css (100%) rename kfet/static/kfet/{js => vendor/bootstrap}/bootstrap-datetimepicker.min.js (100%) rename kfet/static/kfet/{css => vendor/jquery}/jquery-confirm.css (100%) rename kfet/static/kfet/{js => vendor/jquery}/jquery-confirm.js (100%) create mode 100644 kfet/static/kfet/vendor/jquery/jquery-confirm.min.css create mode 100644 kfet/static/kfet/vendor/jquery/jquery-confirm.min.js rename kfet/static/kfet/vendor/{jquery-tablesorter => jquery}/jquery.tablesorter.combined.js (100%) create mode 100644 kfet/static/kfet/vendor/jquery/jquery.tablesorter.combined.min.js rename kfet/static/kfet/{js => vendor}/js.cookie.js (100%) rename kfet/static/kfet/{css => vendor/multiple-select}/multiple-select.css (100%) rename kfet/static/kfet/{js => vendor/multiple-select}/multiple-select.js (100%) rename kfet/static/kfet/{img => vendor/multiple-select}/multiple-select.png (100%) create mode 100644 kfet/static/kfet/vendor/reconnecting-websocket.js create mode 100644 kfet/static/kfet/vendor/reconnecting-websocket.min.js diff --git a/kfet/forms.py b/kfet/forms.py index b8d670c1..2a7f111a 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -37,8 +37,8 @@ class DateTimeWidget(forms.DateTimeInput): self.attrs["format"] = "%Y-%m-%d %H:%M" class Media: - css = {"all": ("kfet/css/bootstrap-datetimepicker.min.css",)} - js = ("kfet/js/bootstrap-datetimepicker.min.js",) + css = {"all": ("kfet/vendor/bootstrap/bootstrap-datetimepicker.min.css",)} + js = ("kfet/vendor/bootstrap/bootstrap-datetimepicker.min.js",) # ----- diff --git a/kfet/static/kfet/js/reconnecting-websocket.js b/kfet/static/kfet/js/reconnecting-websocket.js deleted file mode 100644 index 0cd4332d..00000000 --- a/kfet/static/kfet/js/reconnecting-websocket.js +++ /dev/null @@ -1,365 +0,0 @@ -// MIT License: -// -// Copyright (c) 2010-2012, Joe Walnes -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/** - * This behaves like a WebSocket in every way, except if it fails to connect, - * or it gets disconnected, it will repeatedly poll until it successfully connects - * again. - * - * It is API compatible, so when you have: - * ws = new WebSocket('ws://....'); - * you can replace with: - * ws = new ReconnectingWebSocket('ws://....'); - * - * The event stream will typically look like: - * onconnecting - * onopen - * onmessage - * onmessage - * onclose // lost connection - * onconnecting - * onopen // sometime later... - * onmessage - * onmessage - * etc... - * - * It is API compatible with the standard WebSocket API, apart from the following members: - * - * - `bufferedAmount` - * - `extensions` - * - `binaryType` - * - * Latest version: https://github.com/joewalnes/reconnecting-websocket/ - * - Joe Walnes - * - * Syntax - * ====== - * var socket = new ReconnectingWebSocket(url, protocols, options); - * - * Parameters - * ========== - * url - The url you are connecting to. - * protocols - Optional string or array of protocols. - * options - See below - * - * Options - * ======= - * Options can either be passed upon instantiation or set after instantiation: - * - * var socket = new ReconnectingWebSocket(url, null, { debug: true, reconnectInterval: 4000 }); - * - * or - * - * var socket = new ReconnectingWebSocket(url); - * socket.debug = true; - * socket.reconnectInterval = 4000; - * - * debug - * - Whether this instance should log debug messages. Accepts true or false. Default: false. - * - * automaticOpen - * - Whether or not the websocket should attempt to connect immediately upon instantiation. The socket can be manually opened or closed at any time using ws.open() and ws.close(). - * - * reconnectInterval - * - The number of milliseconds to delay before attempting to reconnect. Accepts integer. Default: 1000. - * - * maxReconnectInterval - * - The maximum number of milliseconds to delay a reconnection attempt. Accepts integer. Default: 30000. - * - * reconnectDecay - * - The rate of increase of the reconnect delay. Allows reconnect attempts to back off when problems persist. Accepts integer or float. Default: 1.5. - * - * timeoutInterval - * - The maximum time in milliseconds to wait for a connection to succeed before closing and retrying. Accepts integer. Default: 2000. - * - */ -(function (global, factory) { - if (typeof define === 'function' && define.amd) { - define([], factory); - } else if (typeof module !== 'undefined' && module.exports){ - module.exports = factory(); - } else { - global.ReconnectingWebSocket = factory(); - } -})(this, function () { - - if (!('WebSocket' in window)) { - return; - } - - function ReconnectingWebSocket(url, protocols, options) { - - // Default settings - var settings = { - - /** Whether this instance should log debug messages. */ - debug: false, - - /** Whether or not the websocket should attempt to connect immediately upon instantiation. */ - automaticOpen: true, - - /** The number of milliseconds to delay before attempting to reconnect. */ - reconnectInterval: 1000, - /** The maximum number of milliseconds to delay a reconnection attempt. */ - maxReconnectInterval: 30000, - /** The rate of increase of the reconnect delay. Allows reconnect attempts to back off when problems persist. */ - reconnectDecay: 1.5, - - /** The maximum time in milliseconds to wait for a connection to succeed before closing and retrying. */ - timeoutInterval: 2000, - - /** The maximum number of reconnection attempts to make. Unlimited if null. */ - maxReconnectAttempts: null, - - /** The binary type, possible values 'blob' or 'arraybuffer', default 'blob'. */ - binaryType: 'blob' - } - if (!options) { options = {}; } - - // Overwrite and define settings with options if they exist. - for (var key in settings) { - if (typeof options[key] !== 'undefined') { - this[key] = options[key]; - } else { - this[key] = settings[key]; - } - } - - // These should be treated as read-only properties - - /** The URL as resolved by the constructor. This is always an absolute URL. Read only. */ - this.url = url; - - /** The number of attempted reconnects since starting, or the last successful connection. Read only. */ - this.reconnectAttempts = 0; - - /** - * The current state of the connection. - * Can be one of: WebSocket.CONNECTING, WebSocket.OPEN, WebSocket.CLOSING, WebSocket.CLOSED - * Read only. - */ - this.readyState = WebSocket.CONNECTING; - - /** - * A string indicating the name of the sub-protocol the server selected; this will be one of - * the strings specified in the protocols parameter when creating the WebSocket object. - * Read only. - */ - this.protocol = null; - - // Private state variables - - var self = this; - var ws; - var forcedClose = false; - var timedOut = false; - var eventTarget = document.createElement('div'); - - // Wire up "on*" properties as event handlers - - eventTarget.addEventListener('open', function(event) { self.onopen(event); }); - eventTarget.addEventListener('close', function(event) { self.onclose(event); }); - eventTarget.addEventListener('connecting', function(event) { self.onconnecting(event); }); - eventTarget.addEventListener('message', function(event) { self.onmessage(event); }); - eventTarget.addEventListener('error', function(event) { self.onerror(event); }); - - // Expose the API required by EventTarget - - this.addEventListener = eventTarget.addEventListener.bind(eventTarget); - this.removeEventListener = eventTarget.removeEventListener.bind(eventTarget); - this.dispatchEvent = eventTarget.dispatchEvent.bind(eventTarget); - - /** - * This function generates an event that is compatible with standard - * compliant browsers and IE9 - IE11 - * - * This will prevent the error: - * Object doesn't support this action - * - * http://stackoverflow.com/questions/19345392/why-arent-my-parameters-getting-passed-through-to-a-dispatched-event/19345563#19345563 - * @param s String The name that the event should use - * @param args Object an optional object that the event will use - */ - function generateEvent(s, args) { - var evt = document.createEvent("CustomEvent"); - evt.initCustomEvent(s, false, false, args); - return evt; - }; - - this.open = function (reconnectAttempt) { - ws = new WebSocket(self.url, protocols || []); - ws.binaryType = this.binaryType; - - if (reconnectAttempt) { - if (this.maxReconnectAttempts && this.reconnectAttempts > this.maxReconnectAttempts) { - return; - } - } else { - eventTarget.dispatchEvent(generateEvent('connecting')); - this.reconnectAttempts = 0; - } - - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'attempt-connect', self.url); - } - - var localWs = ws; - var timeout = setTimeout(function() { - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'connection-timeout', self.url); - } - timedOut = true; - localWs.close(); - timedOut = false; - }, self.timeoutInterval); - - ws.onopen = function(event) { - clearTimeout(timeout); - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'onopen', self.url); - } - self.protocol = ws.protocol; - self.readyState = WebSocket.OPEN; - self.reconnectAttempts = 0; - var e = generateEvent('open'); - e.isReconnect = reconnectAttempt; - reconnectAttempt = false; - eventTarget.dispatchEvent(e); - }; - - ws.onclose = function(event) { - clearTimeout(timeout); - ws = null; - if (forcedClose) { - self.readyState = WebSocket.CLOSED; - eventTarget.dispatchEvent(generateEvent('close')); - } else { - self.readyState = WebSocket.CONNECTING; - var e = generateEvent('connecting'); - e.code = event.code; - e.reason = event.reason; - e.wasClean = event.wasClean; - eventTarget.dispatchEvent(e); - if (!reconnectAttempt && !timedOut) { - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'onclose', self.url); - } - eventTarget.dispatchEvent(generateEvent('close')); - } - - var timeout = self.reconnectInterval * Math.pow(self.reconnectDecay, self.reconnectAttempts); - setTimeout(function() { - self.reconnectAttempts++; - self.open(true); - }, timeout > self.maxReconnectInterval ? self.maxReconnectInterval : timeout); - } - }; - ws.onmessage = function(event) { - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'onmessage', self.url, event.data); - } - var e = generateEvent('message'); - e.data = event.data; - eventTarget.dispatchEvent(e); - }; - ws.onerror = function(event) { - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'onerror', self.url, event); - } - eventTarget.dispatchEvent(generateEvent('error')); - }; - } - - // Whether or not to create a websocket upon instantiation - if (this.automaticOpen == true) { - this.open(false); - } - - /** - * Transmits data to the server over the WebSocket connection. - * - * @param data a text string, ArrayBuffer or Blob to send to the server. - */ - this.send = function(data) { - if (ws) { - if (self.debug || ReconnectingWebSocket.debugAll) { - console.debug('ReconnectingWebSocket', 'send', self.url, data); - } - return ws.send(data); - } else { - throw 'INVALID_STATE_ERR : Pausing to reconnect websocket'; - } - }; - - /** - * Closes the WebSocket connection or connection attempt, if any. - * If the connection is already CLOSED, this method does nothing. - */ - this.close = function(code, reason) { - // Default CLOSE_NORMAL code - if (typeof code == 'undefined') { - code = 1000; - } - forcedClose = true; - if (ws) { - ws.close(code, reason); - } - }; - - /** - * Additional public API method to refresh the connection if still open (close, re-open). - * For example, if the app suspects bad data / missed heart beats, it can try to refresh. - */ - this.refresh = function() { - if (ws) { - ws.close(); - } - }; - } - - /** - * An event listener to be called when the WebSocket connection's readyState changes to OPEN; - * this indicates that the connection is ready to send and receive data. - */ - ReconnectingWebSocket.prototype.onopen = function(event) {}; - /** An event listener to be called when the WebSocket connection's readyState changes to CLOSED. */ - ReconnectingWebSocket.prototype.onclose = function(event) {}; - /** An event listener to be called when a connection begins being attempted. */ - ReconnectingWebSocket.prototype.onconnecting = function(event) {}; - /** An event listener to be called when a message is received from the server. */ - ReconnectingWebSocket.prototype.onmessage = function(event) {}; - /** An event listener to be called when an error occurs. */ - ReconnectingWebSocket.prototype.onerror = function(event) {}; - - /** - * Whether all instances of ReconnectingWebSocket should log debug messages. - * Setting this to true is the equivalent of setting all instances of ReconnectingWebSocket.debug to true. - */ - ReconnectingWebSocket.debugAll = false; - - ReconnectingWebSocket.CONNECTING = WebSocket.CONNECTING; - ReconnectingWebSocket.OPEN = WebSocket.OPEN; - ReconnectingWebSocket.CLOSING = WebSocket.CLOSING; - ReconnectingWebSocket.CLOSED = WebSocket.CLOSED; - - return ReconnectingWebSocket; -}); diff --git a/kfet/static/kfet/css/bootstrap-datetimepicker.min.css b/kfet/static/kfet/vendor/bootstrap/bootstrap-datetimepicker.min.css similarity index 100% rename from kfet/static/kfet/css/bootstrap-datetimepicker.min.css rename to kfet/static/kfet/vendor/bootstrap/bootstrap-datetimepicker.min.css diff --git a/kfet/static/kfet/js/bootstrap-datetimepicker.min.js b/kfet/static/kfet/vendor/bootstrap/bootstrap-datetimepicker.min.js similarity index 100% rename from kfet/static/kfet/js/bootstrap-datetimepicker.min.js rename to kfet/static/kfet/vendor/bootstrap/bootstrap-datetimepicker.min.js diff --git a/kfet/static/kfet/css/jquery-confirm.css b/kfet/static/kfet/vendor/jquery/jquery-confirm.css similarity index 100% rename from kfet/static/kfet/css/jquery-confirm.css rename to kfet/static/kfet/vendor/jquery/jquery-confirm.css diff --git a/kfet/static/kfet/js/jquery-confirm.js b/kfet/static/kfet/vendor/jquery/jquery-confirm.js similarity index 100% rename from kfet/static/kfet/js/jquery-confirm.js rename to kfet/static/kfet/vendor/jquery/jquery-confirm.js diff --git a/kfet/static/kfet/vendor/jquery/jquery-confirm.min.css b/kfet/static/kfet/vendor/jquery/jquery-confirm.min.css new file mode 100644 index 00000000..cb8c3245 --- /dev/null +++ b/kfet/static/kfet/vendor/jquery/jquery-confirm.min.css @@ -0,0 +1,9 @@ +/*! + * jquery-confirm v2.5.1 (http://craftpip.github.io/jquery-confirm/) + * Author: boniface pereira + * Website: www.craftpip.com + * Contact: hey@craftpip.com + * + * Copyright 2013-2016 jquery-confirm + * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE) + */@-webkit-keyframes jconfirm-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes jconfirm-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.jconfirm{position:fixed;top:0;left:0;right:0;bottom:0;z-index:99999999;font-family:inherit;overflow:hidden}.jconfirm .jconfirm-bg{position:fixed;top:0;left:0;right:0;bottom:0;opacity:0;-webkit-transition:all .4s;transition:all .4s}.jconfirm .jconfirm-bg.seen{opacity:1}.jconfirm .jconfirm-scrollpane{position:fixed;top:0;left:0;right:0;bottom:0;overflow-y:auto;-webkit-perspective:500px;perspective:500px;-webkit-perspective-origin:center;perspective-origin:center}.jconfirm .jconfirm-box{background:#fff;border-radius:4px;position:relative;outline:none;padding:15px 15px 0}.jconfirm .jconfirm-box div.closeIcon{height:20px;width:20px;position:absolute;top:5px;right:5px;cursor:pointer;opacity:.6;text-align:center;-webkit-transition:opacity .1s ease-in;transition:opacity .1s ease-in;display:none;font-size:27px;line-height:14px}.jconfirm .jconfirm-box div.closeIcon .fa{font-size:16px}.jconfirm .jconfirm-box div.closeIcon .glyphicon{font-size:16px}.jconfirm .jconfirm-box div.closeIcon .zmdi{font-size:16px}.jconfirm .jconfirm-box div.closeIcon:hover{opacity:1}.jconfirm .jconfirm-box div.title-c{display:block;font-size:22px;line-height:20px}.jconfirm .jconfirm-box div.title-c .icon-c{font-size:inherit;padding-bottom:15px;display:inline-block;margin-right:8px;vertical-align:middle}.jconfirm .jconfirm-box div.title-c .icon-c i{vertical-align:middle}.jconfirm .jconfirm-box div.title-c .icon-c:empty{display:none}.jconfirm .jconfirm-box div.title-c .title{font-size:inherit;font-family:inherit;display:inline-block;vertical-align:middle;padding-bottom:15px}.jconfirm .jconfirm-box div.title-c .title:empty{display:none}.jconfirm .jconfirm-box div.content-pane{margin-bottom:15px;height:auto;-webkit-transition:height .4s ease-in;transition:height .4s ease-in;display:inline-block;width:100%;position:relative}.jconfirm .jconfirm-box div.content-pane .content{position:absolute;top:0;left:0;-webkit-transition:all .2s ease-in;transition:all .2s ease-in;right:0}.jconfirm .jconfirm-box div.content-pane .content img{width:100%;height:auto}.jconfirm .jconfirm-box div.content-pane .content:empty{display:none}.jconfirm .jconfirm-box div.content-pane .content:empty.loading{height:40px;position:relative;opacity:.6;display:block}.jconfirm .jconfirm-box div.content-pane .content:empty.loading:before{content:'';height:20px;width:20px;border:solid 2px transparent;position:absolute;left:50%;margin-left:-10px;border-radius:50%;-webkit-animation:jconfirm-rotate 1s infinite linear;animation:jconfirm-rotate 1s infinite linear;border-bottom-color:#aaa;top:50%;margin-top:-10px}.jconfirm .jconfirm-box div.content-pane .content:empty.loading:after{content:'';position:absolute;left:50%;margin-left:-15px}.jconfirm .jconfirm-box .buttons{padding-bottom:15px}.jconfirm .jconfirm-box .buttons button+button{margin-left:5px}.jconfirm .jquery-clear{clear:both}.jconfirm.rtl{direction:rtl}.jconfirm.rtl div.closeIcon{left:12px;right:auto}.jconfirm.jconfirm-white .jconfirm-bg{background-color:rgba(0,0,0,0.2)}.jconfirm.jconfirm-white .jconfirm-box{box-shadow:0 2px 6px rgba(0,0,0,0.2);border-radius:5px}.jconfirm.jconfirm-white .jconfirm-box .buttons{float:right}.jconfirm.jconfirm-white .jconfirm-box .buttons button{border:none;background-image:none;text-transform:uppercase;font-size:14px;font-weight:bold;text-shadow:none;-webkit-transition:background .1s;transition:background .1s;color:#fff}.jconfirm.jconfirm-white .jconfirm-box .buttons button.btn-default{box-shadow:none;color:#333}.jconfirm.jconfirm-white .jconfirm-box .buttons button.btn-default:hover{background:#ddd}.jconfirm.jconfirm-black .jconfirm-bg{background-color:rgba(0,0,0,0.5)}.jconfirm.jconfirm-black .jconfirm-box{box-shadow:0 2px 6px rgba(0,0,0,0.2);background:#444;border-radius:5px;color:#fff}.jconfirm.jconfirm-black .jconfirm-box .buttons{float:right}.jconfirm.jconfirm-black .jconfirm-box .buttons button{border:none;background-image:none;text-transform:uppercase;font-size:14px;font-weight:bold;text-shadow:none;-webkit-transition:background .1s;transition:background .1s;color:#fff}.jconfirm.jconfirm-black .jconfirm-box .buttons button.btn-default{box-shadow:none;color:#fff;background:none}.jconfirm.jconfirm-black .jconfirm-box .buttons button.btn-default:hover{background:#666}.jconfirm .jconfirm-box.hilight{-webkit-animation:hilight .82s cubic-bezier(.36, .07, .19, .97) both;animation:hilight .82s cubic-bezier(.36, .07, .19, .97) both;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}@-webkit-keyframes hilight{10%,90%{-webkit-transform:translate3d(-2px, 0, 0);transform:translate3d(-2px, 0, 0)}20%,80%{-webkit-transform:translate3d(4px, 0, 0);transform:translate3d(4px, 0, 0)}30%,50%,70%{-webkit-transform:translate3d(-8px, 0, 0);transform:translate3d(-8px, 0, 0)}40%,60%{-webkit-transform:translate3d(8px, 0, 0);transform:translate3d(8px, 0, 0)}}@keyframes hilight{10%,90%{-webkit-transform:translate3d(-2px, 0, 0);transform:translate3d(-2px, 0, 0)}20%,80%{-webkit-transform:translate3d(4px, 0, 0);transform:translate3d(4px, 0, 0)}30%,50%,70%{-webkit-transform:translate3d(-8px, 0, 0);transform:translate3d(-8px, 0, 0)}40%,60%{-webkit-transform:translate3d(8px, 0, 0);transform:translate3d(8px, 0, 0)}}.jconfirm{-webkit-perspective:400px;perspective:400px}.jconfirm .jconfirm-box{opacity:1;-webkit-transition-property:-webkit-transform,opacity,box-shadow;transition-property:transform,opacity,box-shadow}.jconfirm .jconfirm-box.anim-top,.jconfirm .jconfirm-box.anim-left,.jconfirm .jconfirm-box.anim-right,.jconfirm .jconfirm-box.anim-bottom,.jconfirm .jconfirm-box.anim-opacity,.jconfirm .jconfirm-box.anim-zoom,.jconfirm .jconfirm-box.anim-scale,.jconfirm .jconfirm-box.anim-none,.jconfirm .jconfirm-box.anim-rotate,.jconfirm .jconfirm-box.anim-rotatex,.jconfirm .jconfirm-box.anim-rotatey,.jconfirm .jconfirm-box.anim-scaley,.jconfirm .jconfirm-box.anim-scalex{opacity:0}.jconfirm .jconfirm-box.anim-rotate{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.jconfirm .jconfirm-box.anim-rotatex{-webkit-transform:rotateX(90deg);transform:rotateX(90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.anim-rotatexr{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.anim-rotatey{-webkit-transform:rotatey(90deg);-ms-transform:rotatey(90deg);transform:rotatey(90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.anim-rotateyr{-webkit-transform:rotatey(-90deg);-ms-transform:rotatey(-90deg);transform:rotatey(-90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.anim-scaley{-webkit-transform:scaley(1.5);-ms-transform:scaley(1.5);transform:scaley(1.5);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.anim-scalex{-webkit-transform:scalex(1.5);-ms-transform:scalex(1.5);transform:scalex(1.5);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.anim-top{-webkit-transform:translate(0, -100px);-ms-transform:translate(0, -100px);transform:translate(0, -100px)}.jconfirm .jconfirm-box.anim-left{-webkit-transform:translate(-100px, 0);-ms-transform:translate(-100px, 0);transform:translate(-100px, 0)}.jconfirm .jconfirm-box.anim-right{-webkit-transform:translate(100px, 0);-ms-transform:translate(100px, 0);transform:translate(100px, 0)}.jconfirm .jconfirm-box.anim-bottom{-webkit-transform:translate(0, 100px);-ms-transform:translate(0, 100px);transform:translate(0, 100px)}.jconfirm .jconfirm-box.anim-zoom{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.jconfirm .jconfirm-box.anim-scale{-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}.jconfirm .jconfirm-box.anim-none{display:none}.jconfirm.jconfirm-supervan .jconfirm-bg{background-color:rgba(54,70,93,0.95)}.jconfirm.jconfirm-supervan .jconfirm-box{background-color:transparent}.jconfirm.jconfirm-supervan .jconfirm-box div.closeIcon{color:#fff}.jconfirm.jconfirm-supervan .jconfirm-box div.title-c{text-align:center;color:#fff;font-size:28px;font-weight:normal}.jconfirm.jconfirm-supervan .jconfirm-box div.title-c>*{padding-bottom:25px}.jconfirm.jconfirm-supervan .jconfirm-box div.content-pane{margin-bottom:25px}.jconfirm.jconfirm-supervan .jconfirm-box div.content{text-align:center;color:#fff}.jconfirm.jconfirm-supervan .jconfirm-box .buttons{text-align:center}.jconfirm.jconfirm-supervan .jconfirm-box .buttons button{font-size:16px;border-radius:2px;background:#303f53;text-shadow:none;border:none;color:#fff;padding:10px;min-width:100px}.jconfirm.jconfirm-material .jconfirm-bg{background-color:rgba(0,0,0,0.67)}.jconfirm.jconfirm-material .jconfirm-box{background-color:#fff;box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);padding:30px 25px 10px 25px}.jconfirm.jconfirm-material .jconfirm-box div.closeIcon{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-material .jconfirm-box div.title-c{color:rgba(0,0,0,0.87);font-size:22px;font-weight:bold}.jconfirm.jconfirm-material .jconfirm-box div.content{text-align:left;color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-material .jconfirm-box .buttons{text-align:right}.jconfirm.jconfirm-material .jconfirm-box .buttons button{text-transform:uppercase;font-weight:500}.jconfirm.jconfirm-bootstrap .jconfirm-bg{background-color:rgba(0,0,0,0.21)}.jconfirm.jconfirm-bootstrap .jconfirm-box{background-color:#fff;box-shadow:0 3px 8px 0 rgba(0,0,0,0.2);border:solid 1px rgba(0,0,0,0.4);padding:15px 0 0}.jconfirm.jconfirm-bootstrap .jconfirm-box div.closeIcon{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-bootstrap .jconfirm-box div.title-c{color:rgba(0,0,0,0.87);font-size:22px;font-weight:bold;padding-left:15px;padding-right:15px}.jconfirm.jconfirm-bootstrap .jconfirm-box div.content{text-align:left;color:rgba(0,0,0,0.87);padding:0 15px}.jconfirm.jconfirm-bootstrap .jconfirm-box .buttons{text-align:right;padding:0 0 0;margin:-5px 0 0;border-top:solid 1px #ddd;overflow:hidden;border-radius:0 0 4px 4px}.jconfirm.jconfirm-bootstrap .jconfirm-box .buttons button{font-weight:500;border-radius:0;margin:0;border-left:solid 1px #ddd} \ No newline at end of file diff --git a/kfet/static/kfet/vendor/jquery/jquery-confirm.min.js b/kfet/static/kfet/vendor/jquery/jquery-confirm.min.js new file mode 100644 index 00000000..f766c1fc --- /dev/null +++ b/kfet/static/kfet/vendor/jquery/jquery-confirm.min.js @@ -0,0 +1 @@ +if("undefined"==typeof jQuery)throw new Error("jquery-confirm requires jQuery");var jconfirm,Jconfirm;!function(t){"use strict";t.fn.confirm=function(n,i){return void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:i||!1}),t(this).each(function(){var i=t(this);i.on("click",function(e){e.preventDefault();var o=t.extend({},n);i.attr("data-title")&&(o.title=i.attr("data-title")),i.attr("data-content")&&(o.content=i.attr("data-content")),o.$target=i,i.attr("href")&&!n.confirm&&(o.confirm=function(){location.href=i.attr("href")}),t.confirm(o)})}),t(this)},t.confirm=function(t,n){return void 0===t&&(t={}),"string"==typeof t&&(t={content:t,title:n||!1}),jconfirm(t)},t.alert=function(t,n){return void 0===t&&(t={}),"string"==typeof t&&(t={content:t,title:n||!1}),t.cancelButton=!1,jconfirm(t)},t.dialog=function(t,n){return void 0===t&&(t={}),"string"==typeof t&&(t={content:t,title:n||!1}),t.cancelButton=!1,t.confirmButton=!1,t.confirmKeys=[13],jconfirm(t)},jconfirm=function(n){void 0===n&&(n={}),jconfirm.defaults&&t.extend(jconfirm.pluginDefaults,jconfirm.defaults);n=t.extend({},jconfirm.pluginDefaults,n);return new Jconfirm(n)},(Jconfirm=function(n){t.extend(this,n),this._init()}).prototype={_init:function(){var t=this;this._rand=Math.round(99999*Math.random()),this._buildHTML(),this._bindEvents(),setTimeout(function(){t.open(),t._watchContent()},0)},_buildHTML:function(){var n=this;this.animation="anim-"+this.animation.toLowerCase(),this.closeAnimation="anim-"+this.closeAnimation.toLowerCase(),this.theme="jconfirm-"+this.theme.toLowerCase(),"anim-none"==this.animation&&(this.animationSpeed=0),this._lastFocused=t("body").find(":focus"),this.$el=t(this.template).appendTo(this.container).addClass(this.theme),this.$el.find(".jconfirm-box-container").addClass(this.columnClass),this.$el.find(".jconfirm-bg").css(this._getCSS(this.animationSpeed,1)),this.$el.find(".jconfirm-bg").css("opacity",this.opacity),this.$b=this.$el.find(".jconfirm-box").css(this._getCSS(this.animationSpeed,this.animationBounce)).addClass(this.animation),this.$body=this.$b,this.rtl&&this.$el.addClass("rtl"),this._contentReady=t.Deferred(),this._modalReady=t.Deferred(),this.$title=this.$el.find(".title"),this.contentDiv=this.$el.find("div.content"),this.$content=this.contentDiv,this.$contentPane=this.$el.find(".content-pane"),this.$icon=this.$el.find(".icon-c"),this.$closeIcon=this.$el.find(".closeIcon"),this.$contentPane.css(this._getCSS(this.animationSpeed,1)),this.setTitle(),this.setIcon(),this._setButtons(),this.closeIconClass&&this.$closeIcon.html(''),n._contentHash=this._hash(n.$content.html()),t.when(this._contentReady,this._modalReady).then(function(){n.setContent(),n.setTitle(),n.setIcon()}),this._getContent(),this._imagesLoaded(),this.autoClose&&this._startCountDown()},_unwatchContent:function(){clearInterval(this._timer)},_hash:function(){return btoa(encodeURIComponent(this.$content.html()))},_watchContent:function(){var t=this;this._timer=setInterval(function(){var n=t._hash(t.$content.html());t._contentHash!=n&&(t._contentHash=n,t.setDialogCenter(),t._imagesLoaded())},this.watchInterval)},_bindEvents:function(){var n=this,i=!1;this.$el.find(".jconfirm-scrollpane").click(function(t){i||(n.backgroundDismiss?(n.cancel(),n.close()):(n.$b.addClass("hilight"),setTimeout(function(){n.$b.removeClass("hilight")},800))),i=!1}),this.$el.find(".jconfirm-box").click(function(t){i=!0}),this.$confirmButton&&this.$confirmButton.click(function(t){t.preventDefault();var i=n.confirm(n.$b);n._stopCountDown(),n.onAction("confirm"),(void 0===i||i)&&n.close()}),this.$cancelButton&&this.$cancelButton.click(function(t){t.preventDefault();var i=n.cancel(n.$b);n._stopCountDown(),n.onAction("cancel"),(void 0===i||i)&&n.close()}),this.$closeButton&&this.$closeButton.click(function(t){t.preventDefault(),n._stopCountDown(),n.cancel(),n.onAction("close"),n.close()}),this.keyboardEnabled&&setTimeout(function(){t(window).on("keyup."+this._rand,function(t){n.reactOnKey(t)})},500),t(window).on("resize."+this._rand,function(){n.setDialogCenter(!0)})},_getCSS:function(t,n){return{"-webkit-transition-duration":t/1e3+"s","transition-duration":t/1e3+"s","-webkit-transition-timing-function":"cubic-bezier(.36,1.1,.2, "+n+")","transition-timing-function":"cubic-bezier(.36,1.1,.2, "+n+")"}},_imagesLoaded:function(){var n=this;t.each(this.$content.find("img:not(.loaded)"),function(i,e){var o=setInterval(function(){"0px"!==t(e).css("height")&&(t(e).addClass("loaded"),n.setDialogCenter(),clearInterval(o))},40)})},_setButtons:function(){this.$btnc=this.$el.find(".buttons"),this.confirmButton&&""!==t.trim(this.confirmButton)&&(this.$confirmButton=t('").appendTo(this.$btnc).addClass(this.confirmButtonClass)),this.cancelButton&&""!==t.trim(this.cancelButton)&&(this.$cancelButton=t('").appendTo(this.$btnc).addClass(this.cancelButtonClass)),this.confirmButton||this.cancelButton||this.$btnc.hide(),this.confirmButton||this.cancelButton||null!==this.closeIcon||(this.$closeButton=this.$b.find(".closeIcon").show()),!0===this.closeIcon&&(this.$closeButton=this.$b.find(".closeIcon").show())},setTitle:function(t){this.title=void 0!==t?t:this.title,this.$title.html(this.title||"")},setIcon:function(t){this.title="undefined"!=typeof string?t:this.title,this.$icon.html(this.icon?'':"")},setContent:function(t){this.content=void 0===t?this.content:t,""==this.content?(this.$content.html(this.content),this.$contentPane.hide()):(this.$content.html(this.content),this.$contentPane.show()),this.$content.hasClass("loading")&&(this.$content.removeClass("loading"),this.$btnc.find("button").prop("disabled",!1))},_getContent:function(n){var i=this;if(n=n||this.content,this._isAjax=!1,this.content)if("string"==typeof this.content)if("url:"===this.content.substr(0,4).toLowerCase()){this._isAjax=!0,this.$content.addClass("loading"),this.$btnc.find("button").prop("disabled",!0);var e=this.content.substring(4,this.content.length);t.get(e).done(function(t){i.content=t,i._contentReady.resolve()}).always(function(t,n,e){"function"==typeof i.contentLoaded&&i.contentLoaded(t,n,e)})}else this.setContent(this.content),this._contentReady.reject();else if("function"==typeof this.content){this.$content.addClass("loading"),this.$btnc.find("button").attr("disabled","disabled");var o=this.content(this);"object"!=typeof o?console.error("The content function must return jquery promise."):"function"!=typeof o.always?console.error("The object returned is not a jquery promise."):(this._isAjax=!0,o.always(function(t,n){i._contentReady.resolve()}))}else console.error("Invalid option for property content, passed: "+typeof this.content);else this.content="",this.setContent(this.content),this._contentReady.reject();this.setDialogCenter()},_stopCountDown:function(){clearInterval(this.timerInterval),this.$cd&&this.$cd.remove()},_startCountDown:function(){var n=this.autoClose.split("|");if(/cancel/.test(n[0])&&"alert"===this.type)return!1;if(/confirm|cancel/.test(n[0])){this.$cd=t('').appendTo(this["$"+n[0]+"Button"]);var i=this;i.$cd.parent().click();var e=n[1]/1e3;this.timerInterval=setInterval(function(){i.$cd.html(" ("+(e-=1)+")"),0===e&&(i.$cd.html(""),i.$cd.parent().trigger("click"),clearInterval(i.timerInterval))},1e3)}else console.error("Invalid option "+n[0]+", must be confirm/cancel")},reactOnKey:function(n){var i=t(".jconfirm");if(i.eq(i.length-1)[0]!==this.$el[0])return!1;var e=n.which;if(this.contentDiv.find(":input").is(":focus")&&/13|32/.test(e))return!1;-1!==t.inArray(e,this.cancelKeys)&&(this.$cancelButton?this.$cancelButton.click():this.close())},setDialogCenter:function(){if("none"==this.$contentPane.css("display"))var n=0,i=0;else{n=this.$content.outerHeight();0==(i=this.$contentPane.height())&&(i=n)}var e=this.$content.outerWidth();this.$content.css({clip:"rect(0px "+(100+e)+"px "+n+"px -100px)"}),this.$contentPane.css({height:n});var o=t(window).height(),s=this.$b.outerHeight()-i+n,c=(o-s)/2;if(s>o-100){var a={"margin-top":50,"margin-bottom":50};t("body").addClass("jconfirm-noscroll")}else{a={"margin-top":c};t("body").removeClass("jconfirm-noscroll")}this.$b.css(a)},close:function(){var n=this;if(this.isClosed())return!1;"function"==typeof this.onClose&&this.onClose(),this._unwatchContent(),n._lastFocused.focus(),t(window).unbind("resize."+this._rand),this.keyboardEnabled&&t(window).unbind("keyup."+this._rand),n.$el.find(".jconfirm-bg").removeClass("seen"),t("body").removeClass("jconfirm-noscroll"),this.$b.addClass(this.closeAnimation);var i="anim-none"==this.closeAnimation?0:this.animationSpeed;return setTimeout(function(){n.$el.remove()},25*i/100),jconfirm.record.closed+=1,jconfirm.record.currentlyOpen-=1,!0},open:function(){var t=this;if(this.isClosed())return!1;t.$el.find(".jconfirm-bg").addClass("seen"),this.$b.removeClass(this.animation),jconfirm.record.opened+=1,jconfirm.record.currentlyOpen+=1,"function"==typeof this.onOpen&&this.onOpen();var n="jconfirm-box"+this._rand;return this.$b.attr("aria-labelledby",n).attr("tabindex",-1).focus(),this.$b.find("input[autofocus]:visible:first").focus(),this.$title?this.$title.attr("id",n):this.$content&&this.$content.attr("id",n),setTimeout(function(){t.$b.css({"transition-property":t.$b.css("transition-property")+", margin"}),t._modalReady.resolve()},this.animationSpeed),!0},isClosed:function(){return""===this.$el.css("display")}},jconfirm.pluginDefaults={template:'
',title:"Hello",content:"Are you sure to continue?",contentLoaded:function(){},icon:"",opacity:.2,confirmButton:"Okay",cancelButton:"Close",confirmButtonClass:"btn-default",cancelButtonClass:"btn-default",theme:"white",animation:"zoom",closeAnimation:"scale",animationSpeed:500,animationBounce:1.2,keyboardEnabled:!1,rtl:!1,confirmKeys:[13],cancelKeys:[27],container:"body",confirm:function(){},cancel:function(){},backgroundDismiss:!1,autoClose:!1,closeIcon:null,closeIconClass:!1,watchInterval:100,columnClass:"col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1",onOpen:function(){},onClose:function(){},onAction:function(){}},jconfirm.record={opened:0,closed:0,currentlyOpen:0}}(jQuery); \ No newline at end of file diff --git a/kfet/static/kfet/vendor/jquery-tablesorter/jquery.tablesorter.combined.js b/kfet/static/kfet/vendor/jquery/jquery.tablesorter.combined.js similarity index 100% rename from kfet/static/kfet/vendor/jquery-tablesorter/jquery.tablesorter.combined.js rename to kfet/static/kfet/vendor/jquery/jquery.tablesorter.combined.js diff --git a/kfet/static/kfet/vendor/jquery/jquery.tablesorter.combined.min.js b/kfet/static/kfet/vendor/jquery/jquery.tablesorter.combined.min.js new file mode 100644 index 00000000..0efd971c --- /dev/null +++ b/kfet/static/kfet/vendor/jquery/jquery.tablesorter.combined.min.js @@ -0,0 +1,4 @@ +(function(factory){if (typeof define === 'function' && define.amd){define(['jquery'], factory);} else if (typeof module === 'object' && typeof module.exports === 'object'){module.exports = factory(require('jquery'));} else {factory(jQuery);}}(function(jQuery){ + +/*! tablesorter (FORK) - updated 2018-11-20 (v2.31.1)*/ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(R){"use strict";var T=R.tablesorter={version:"2.31.1",parsers:[],widgets:[],defaults:{theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,tabIndex:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,resort:!0,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortStable:!1,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",duplicateSpan:!0,textExtraction:"basic",textAttribute:"data-text",textSorter:null,numberSorter:null,initWidgets:!0,widgetClass:"widget-{name}",widgets:[],widgetOptions:{zebra:["even","odd"]},initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssInfoBlock:"tablesorter-infoOnly",cssNoSort:"tablesorter-noSort",cssIgnoreRow:"tablesorter-ignoreRow",cssIcon:"tablesorter-icon",cssIconNone:"",cssIconAsc:"",cssIconDesc:"",cssIconDisabled:"",pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[],globalize:0,imgAttr:0},css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"},language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",sortDisabled:"sorting is disabled",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i,chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i,comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/,digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g},string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1},keyCodes:{enter:13},dates:{},instanceMethods:{},setup:function(t,r){if(t&&t.tHead&&0!==t.tBodies.length&&!0!==t.hasInitialized){var e,a="",s=R(t),i=R.metadata;t.hasInitialized=!1,t.isProcessing=!0,t.config=r,R.data(t,"tablesorter",r),T.debug(r,"core")&&(console[console.group?"group":"log"]("Initializing tablesorter v"+T.version),R.data(t,"startoveralltimer",new Date)),r.supportsDataObject=((e=R.fn.jquery.split("."))[0]=parseInt(e[0],10),1':"",l.$headers=R(R.map(l.$table.find(l.selectorHeaders),function(e,t){var r,a,s,i,o,n=R(e);if(!T.getClosest(n,"tr").hasClass(l.cssIgnoreRow))return/(th|td)/i.test(e.nodeName)||(o=T.getClosest(n,"th, td"),n.attr("data-column",o.attr("data-column"))),r=T.getColumnData(l.table,l.headers,t,!0),l.headerContent[t]=n.html(),""===l.headerTemplate||n.find("."+T.css.headerIn).length||(i=l.headerTemplate.replace(T.regex.templateContent,n.html()).replace(T.regex.templateIcon,n.find("."+T.css.icon).length?"":c),l.onRenderTemplate&&(a=l.onRenderTemplate.apply(n,[t,i]))&&"string"==typeof a&&(i=a),n.html('
'+i+"
")),l.onRenderHeader&&l.onRenderHeader.apply(n,[t,l,l.$table]),s=parseInt(n.attr("data-column"),10),e.column=s,o=T.getOrder(T.getData(n,r,"sortInitialOrder")||l.sortInitialOrder),l.sortVars[s]={count:-1,order:o?l.sortReset?[1,0,2]:[1,0]:l.sortReset?[0,1,2]:[0,1],lockedOrder:!1,sortedBy:""},void 0!==(o=T.getData(n,r,"lockedOrder")||!1)&&!1!==o&&(l.sortVars[s].lockedOrder=!0,l.sortVars[s].order=T.getOrder(o)?[1,1]:[0,0]),l.headerList[t]=e,n.addClass(T.css.header+" "+l.cssHeader),T.getClosest(n,"tr").addClass(T.css.headerRow+" "+l.cssHeaderRow).attr("role","row"),l.tabIndex&&n.attr("tabindex",0),e})),l.$headerIndexed=[],r=0;r'),t=o.$table.width(),s=(a=o.$tbodies.find("tr:first").children(":visible")).length,i=0;i").css("width",r));o.$table.prepend(n)}},getData:function(e,t,r){var a,s,i="",o=R(e);return o.length?(a=!!R.metadata&&o.metadata(),s=" "+(o.attr("class")||""),void 0!==o.data(r)||void 0!==o.data(r.toLowerCase())?i+=o.data(r)||o.data(r.toLowerCase()):a&&void 0!==a[r]?i+=a[r]:t&&void 0!==t[r]?i+=t[r]:" "!==s&&s.match(" "+r+"-")&&(i=s.match(new RegExp("\\s"+r+"-([\\w-]+)"))[1]||""),R.trim(i)):""},getColumnData:function(e,t,r,a,s){if("object"!=typeof t||null===t)return t;var i,o=(e=R(e)[0]).config,n=s||o.$headers,l=o.$headerIndexed&&o.$headerIndexed[r]||n.find('[data-column="'+r+'"]:last');if(void 0!==t[r])return a?t[r]:t[n.index(l)];for(i in t)if("string"==typeof i&&l.filter(i).add(l.find(i)).length)return t[i]},isProcessing:function(e,t,r){var a=(e=R(e))[0].config,s=r||e.find("."+T.css.header);t?(void 0!==r&&0'),R.fn.detach?t.detach():t.remove();var a=R(e).find("colgroup.tablesorter-savemyplace");t.insertAfter(a),a.remove(),e.isProcessing=!1},clearTableBody:function(e){R(e)[0].config.$tbodies.children().detach()},characterEquivalents:{a:"áàâãäąå",A:"ÁÀÂÃÄĄÅ",c:"çćč",C:"ÇĆČ",e:"éèêëěę",E:"ÉÈÊËĚĘ",i:"íìİîïı",I:"ÍÌİÎÏ",o:"óòôõöō",O:"ÓÒÔÕÖŌ",ss:"ß",SS:"ẞ",u:"úùûüů",U:"ÚÙÛÜŮ"},replaceAccents:function(e){var t,r="[",a=T.characterEquivalents;if(!T.characterRegex){for(t in T.characterRegexArray={},a)"string"==typeof t&&(r+=a[t],T.characterRegexArray[t]=new RegExp("["+a[t]+"]","g"));T.characterRegex=new RegExp(r+"]")}if(T.characterRegex.test(e))for(t in a)"string"==typeof t&&(e=e.replace(T.characterRegexArray[t],t));return e},validateOptions:function(e){var t,r,a,s,i="headers sortForce sortList sortAppend widgets".split(" "),o=e.originalSettings;if(o){for(t in T.debug(e,"core")&&(s=new Date),o)if("undefined"===(a=typeof T.defaults[t]))console.warn('Tablesorter Warning! "table.config.'+t+'" option not recognized');else if("object"===a)for(r in o[t])a=T.defaults[t]&&typeof T.defaults[t][r],R.inArray(t,i)<0&&"undefined"===a&&console.warn('Tablesorter Warning! "table.config.'+t+"."+r+'" option not recognized');T.debug(e,"core")&&console.log("validate options time:"+T.benchmark(s))}},restoreHeaders:function(e){var t,r,a=R(e)[0].config,s=a.$table.find(a.selectorHeaders),i=s.length;for(t=0;t tr").children("th, td");!1===t&&0<=R.inArray("uitheme",i.widgets)&&(s.triggerHandler("applyWidgetId",["uitheme"]),s.triggerHandler("applyWidgetId",["zebra"])),o.find("tr").not(n).remove(),a="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets removeWidget destroy mouseup mouseleave "+"keypress sortBegin sortEnd resetToLoadState ".split(" ").join(i.namespace+" "),s.removeData("tablesorter").unbind(a.replace(T.regex.spaces," ")),i.$headers.add(l).removeClass([T.css.header,i.cssHeader,i.cssAsc,i.cssDesc,T.css.sortAsc,T.css.sortDesc,T.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),n.find(i.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(i.namespace+" ").replace(T.regex.spaces," ")),T.restoreHeaders(e),s.toggleClass(T.css.table+" "+i.tableClass+" tablesorter-"+i.theme,!1===t),s.removeClass(i.namespace.slice(1)),e.hasInitialized=!1,delete e.config.cache,"function"==typeof r&&r(e),T.debug(i,"core")&&console.log("tablesorter has been removed")}}};R.fn.tablesorter=function(t){return this.each(function(){var e=R.extend(!0,{},T.defaults,t,T.instanceMethods);e.originalSettings=t,!this.hasInitialized&&T.buildTable&&"TABLE"!==this.nodeName?T.buildTable(this,e):T.setup(this,e)})},window.console&&window.console.log||(T.logs=[],console={},console.log=console.warn=console.error=console.table=function(){var e=1> Using",n?u:"cookies"),b.parseJSON&&(l=n?b.parseJSON(y[u][t]||"null")||{}:(i=v.cookie.split(/[;\s|=]/),0!==(s=b.inArray(t,i)+1)&&b.parseJSON(i[s]||"null")||{})),void 0===r||!y.JSON||!JSON.hasOwnProperty("stringify"))return l&&l[m]?l[m][h]:"";l[m]||(l[m]={}),l[m][h]=r,n?y[u][t]=JSON.stringify(l):((o=new Date).setTime(o.getTime()+31536e6),v.cookie=t+"="+JSON.stringify(l).replace(/\"/g,'"')+"; expires="+o.toGMTString()+"; path=/")}}(e,window,document),function($){"use strict";var S=$.tablesorter||{};S.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"glyphicon glyphicon-chevron-up",iconSortDesc:"glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s ui-icon-caret-2-n-s",iconSortAsc:"ui-icon-carat-1-n ui-icon-caret-1-n",iconSortDesc:"ui-icon-carat-1-s ui-icon-caret-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}},$.extend(S.css,{wrapper:"tablesorter-wrapper"}),S.addWidget({id:"uitheme",priority:10,format:function(e,t,r){var a,s,i,o,n,l,c,d,f,u,g,p,h,m=S.themes,b=t.$table.add($(t.namespace+"_extra_table")),y=t.$headers.add($(t.namespace+"_extra_headers")),v=t.theme||"jui",w=m[v]||{},x=$.trim([w.sortNone,w.sortDesc,w.sortAsc,w.active].join(" ")),C=$.trim([w.iconSortNone,w.iconSortDesc,w.iconSortAsc].join(" ")),_=S.debug(t,"uitheme");for(_&&(n=new Date),b.hasClass("tablesorter-"+v)&&t.theme===t.appliedTheme&&r.uitheme_applied||(r.uitheme_applied=!0,u=m[t.appliedTheme]||{},g=(h=!$.isEmptyObject(u))?[u.sortNone,u.sortDesc,u.sortAsc,u.active].join(" "):"",p=h?[u.iconSortNone,u.iconSortDesc,u.iconSortAsc].join(" "):"",h&&(r.zebra[0]=$.trim(" "+r.zebra[0].replace(" "+u.even,"")),r.zebra[1]=$.trim(" "+r.zebra[1].replace(" "+u.odd,"")),t.$tbodies.children().removeClass([u.even,u.odd].join(" "))),w.even&&(r.zebra[0]+=" "+w.even),w.odd&&(r.zebra[1]+=" "+w.odd),b.children("caption").removeClass(u.caption||"").addClass(w.caption),d=b.removeClass((t.appliedTheme?"tablesorter-"+(t.appliedTheme||""):"")+" "+(u.table||"")).addClass("tablesorter-"+v+" "+(w.table||"")).children("tfoot"),t.appliedTheme=t.theme,d.length&&d.children("tr").removeClass(u.footerRow||"").addClass(w.footerRow).children("th, td").removeClass(u.footerCells||"").addClass(w.footerCells),y.removeClass((h?[u.header,u.hover,g].join(" "):"")||"").addClass(w.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(e){$(this)["mouseenter"===e.type?"addClass":"removeClass"](w.hover||"")}),y.each(function(){var e=$(this);e.find("."+S.css.wrapper).length||e.wrapInner('
')}),t.cssIcon&&y.find("."+S.css.icon).removeClass(h?[u.icons,p].join(" "):"").addClass(w.icons||""),S.hasWidget(t.table,"filter")&&(s=function(){b.children("thead").children("."+S.css.filterRow).removeClass(h&&u.filterRow||"").addClass(w.filterRow||"")},r.filter_initialized?s():b.one("filterInit",function(){s()}))),a=0;a> Applied "+v+" theme"+S.benchmark(n))},remove:function(e,t,r,a){if(r.uitheme_applied){var s=t.$table,i=t.appliedTheme||"jui",o=S.themes[i]||S.themes.jui,n=s.children("thead").children(),l=o.sortNone+" "+o.sortDesc+" "+o.sortAsc,c=o.iconSortNone+" "+o.iconSortDesc+" "+o.iconSortAsc;s.removeClass("tablesorter-"+i+" "+o.table),r.uitheme_applied=!1,a||(s.find(S.css.header).removeClass(o.header),n.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(o.hover+" "+l+" "+o.active).filter("."+S.css.filterRow).removeClass(o.filterRow),n.find("."+S.css.icon).removeClass(o.icons+" "+c))}}})}(e),function(b){"use strict";var y=b.tablesorter||{};y.addWidget({id:"columns",priority:65,options:{columns:["primary","secondary","tertiary"]},format:function(e,t,r){var a,s,i,o,n,l,c,d,f=t.$table,u=t.$tbodies,g=t.sortList,p=g.length,h=r&&r.columns||["primary","secondary","tertiary"],m=h.length-1;for(c=h.join(" "),s=0;s=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(e,t,r){if(!H.orTest.test(t.iFilter)&&!H.orSplit.test(t.filter)||H.regex.test(t.filter))return null;var a,s,i,o=A.extend({},t),n=t.filter.split(H.orSplit),l=t.iFilter.split(H.orSplit),c=n.length;for(a=0;a]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(s.data("placeholder")||s.attr("data-placeholder")||d.filter_placeholder.select||"")+"":"",0<=(a=o=t).indexOf(d.filter_selectSourceSeparator)&&(a=(o=t.split(d.filter_selectSourceSeparator))[1],o=o[0]),e+="");c.$table.find("thead").find("select."+b.filter+'[data-column="'+i+'"]').append(e),(n="function"==typeof(a=d.filter_selectSource)||N.getColumnData(r,a,i))&&D.buildSelect(c.table,i,"",!0,s.hasClass(d.filter_onlyAvail))}D.buildDefault(r,!0),D.bindSearch(r,c.$table.find("."+b.filter),!0),d.filter_external&&D.bindSearch(r,d.filter_external),d.filter_hideFilters&&D.hideFilters(c),c.showProcessing&&(a="filterStart filterEnd ".split(" ").join(c.namespace+"filter-sp "),c.$table.unbind(a.replace(N.regex.spaces," ")).bind(a,function(e,t){s=t?c.$table.find("."+b.header).filter("[data-column]").filter(function(){return""!==t[A(this).data("column")]}):"",N.isProcessing(r,"filterStart"===e.type,t?s:"")})),c.filteredRows=c.totalRows,a="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(c.namespace+"filter "),c.$table.unbind(a.replace(N.regex.spaces," ")).bind(a,function(){D.completeInit(this)}),c.pager&&c.pager.initialized&&!d.filter_initialized?(c.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){D.filterInitComplete(c)},100)):d.filter_initialized||D.completeInit(r)},completeInit:function(e){var t=e.config,r=t.widgetOptions,a=D.setDefaults(e,t,r)||[];a.length&&(t.delayInit&&""===a.join("")||N.setFilters(e,a,!0)),t.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){r.filter_initialized||D.filterInitComplete(t)},100)},formatterUpdated:function(e,t){var r=e&&e.closest("table"),a=r.length&&r[0].config,s=a&&a.widgetOptions;s&&!s.filter_initialized&&(s.filter_formatterInit[t]=1)},filterInitComplete:function(e){var t,r,a=e.widgetOptions,s=0,i=function(){a.filter_initialized=!0,e.lastSearch=e.$table.data("lastSearch"),e.$table.triggerHandler("filterInit",e),D.findRows(e.table,e.lastSearch||[]),N.debug(e,"filter")&&console.log("Filter >> Widget initialized")};if(A.isEmptyObject(a.filter_formatter))i();else{for(r=a.filter_formatterInit.length,t=0;t';for(i=0;i").appendTo(t.$table.children("thead").eq(0)).children("td"),i=0;i").appendTo(a):((d=N.getColumnData(e,r.filter_formatter,i))?(r.filter_formatterCount++,(h=d(a,i))&&0===h.length&&(h=a.children("input")),h&&(0===h.parent().length||h.parent().length&&h.parent()[0]!==a[0])&&a.append(h)):h=A('').appendTo(a),h&&(f=o.data("placeholder")||o.attr("data-placeholder")||r.filter_placeholder.search||"",h.attr("placeholder",f))),h&&(c=(A.isArray(r.filter_cssFilter)?void 0!==r.filter_cssFilter[i]&&r.filter_cssFilter[i]||"":r.filter_cssFilter)||"",h.addClass(b.filter+" "+c),(f=(c=r.filter_filterLabel).match(/{{([^}]+?)}}/g))||(f=["{{label}}"]),A.each(f,function(e,t){var r=new RegExp(t,"g"),a=o.attr("data-"+t.replace(/{{|}}/g,"")),s=void 0===a?o.text():a;c=c.replace(r,A.trim(s))}),h.attr({"data-column":a.attr("data-column"),"aria-label":c}),l&&(h.attr("placeholder","").addClass(b.filterDisabled)[0].disabled=!0)))},bindSearch:function(s,e,t){if(s=A(s)[0],(e=A(e)).length){var r,i=s.config,o=i.widgetOptions,a=i.namespace+"filter",n=o.filter_$externalFilters;!0!==t&&(r=o.filter_anyColumnSelector+","+o.filter_multipleColumnSelector,o.filter_$anyMatch=e.filter(r),n&&n.length?o.filter_$externalFilters=o.filter_$externalFilters.add(e):o.filter_$externalFilters=e,N.setFilters(s,i.$table.data("lastSearch")||[],!1===t)),r="keypress keyup keydown search change input ".split(" ").join(a+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(r.replace(N.regex.spaces," ")).bind("keydown"+a,function(e){if(e.which===l.escape&&!s.config.widgetOptions.filter_resetOnEsc)return!1}).bind("keyup"+a,function(e){o=s.config.widgetOptions;var t=parseInt(A(this).attr("data-column"),10),r="boolean"==typeof o.filter_liveSearch?o.filter_liveSearch:N.getColumnData(s,o.filter_liveSearch,t);if(void 0===r&&(r=o.filter_liveSearch.fallback||!1),A(this).attr("data-lastSearchTime",(new Date).getTime()),e.which===l.escape)this.value=o.filter_resetOnEsc?"":i.lastSearch[t];else{if(""!==this.value&&("number"==typeof r&&this.value.length=l.left&&e.which<=l.down)))return;if(!1===r&&""!==this.value&&e.which!==l.enter)return}D.searching(s,!0,!0,t)}).bind("search change keypress input blur ".split(" ").join(a+" "),function(e){var t=parseInt(A(this).attr("data-column"),10),r=e.type,a="boolean"==typeof o.filter_liveSearch?o.filter_liveSearch:N.getColumnData(s,o.filter_liveSearch,t);!s.config.widgetOptions.filter_initialized||e.which!==l.enter&&"search"!==r&&"blur"!==r&&("change"!==r&&"input"!==r||!0!==a&&(!0===a||"INPUT"===e.target.nodeName)||this.value===i.lastSearch[t])||(e.preventDefault(),A(this).attr("data-lastSearchTime",(new Date).getTime()),D.searching(s,"keypress"!==r,!0,t))})}},searching:function(e,t,r,a){var s,i=e.config.widgetOptions;void 0===a?s=!1:void 0===(s="boolean"==typeof i.filter_liveSearch?i.filter_liveSearch:N.getColumnData(e,i.filter_liveSearch,a))&&(s=i.filter_liveSearch.fallback||!1),clearTimeout(i.filter_searchTimer),void 0===t||!0===t?i.filter_searchTimer=setTimeout(function(){D.checkFilters(e,t,r)},s?i.filter_searchDelay:10):D.checkFilters(e,t,r)},equalFilters:function(e,t,r){var a,s=[],i=[],o=e.columns+1;for(t=A.isArray(t)?t:[],r=A.isArray(r)?r:[],a=0;a=e.columns&&(n=e.columns-1);o<=n;o++)u[u.length]=o;t=t.replace(s[d],"")}if(!r&&/,/.test(t))for(f=(l=t.split(/\s*,\s*/)).length,c=0;c> Starting filter widget search",r),m=new Date),F.filteredRows=0,t=z||[],c=F.totalRows=0;c> Searching through "+(w&&v> Completed search"+N.benchmark(m)),R.filter_initialized&&(F.$table.triggerHandler("filterBeforeEnd",F),F.$table.triggerHandler("filterEnd",F)),setTimeout(function(){N.applyWidget(F.table)},0)}},getOptionSource:function(e,t,r){var a=(e=A(e)[0]).config,s=!1,i=a.widgetOptions.filter_selectSource,o=a.$table.data("lastSearch")||[],n="function"==typeof i||N.getColumnData(e,i,t);if(r&&""!==o[t]&&(r=!1),!0===n)s=i(e,t,r);else{if(n instanceof A||"string"===A.type(n)&&0<=n.indexOf(""))return n;if(A.isArray(n))s=n;else if("object"===A.type(i)&&n&&null===(s=n(e,t,r)))return null}return!1===s&&(s=D.getOptions(e,t,r)),D.processOptions(e,t,s)},processOptions:function(s,i,r){if(!A.isArray(r))return!1;var o,e,t,a,n,l,c=(s=A(s)[0]).config,d=null!=i&&0<=i&&i'+(p.data("placeholder")||p.attr("data-placeholder")||g.filter_placeholder.select||"")+"",m=u.$table.find("thead").find("select."+b.filter+'[data-column="'+t+'"]').val();if(void 0!==r&&""!==r||null!==(r=D.getOptionSource(e,t,s))){if(A.isArray(r)){for(i=0;i"}else""+f!="[object Object]"&&(0<=(o=n=f=(""+f).replace(H.quote,""")).indexOf(g.filter_selectSourceSeparator)&&(o=(l=n.split(g.filter_selectSourceSeparator))[0],n=l[1]),h+=""!==f?"":"");r=[]}c=(u.$filters?u.$filters:u.$table.children("thead")).find("."+b.filter),g.filter_$externalFilters&&(c=c&&c.length?c.add(g.filter_$externalFilters):g.filter_$externalFilters),(d=c.filter('select[data-column="'+t+'"]')).length&&(d[a?"html":"append"](h),A.isArray(r)||d.append(r).val(m),d.val(m))}}},buildDefault:function(e,t){var r,a,s,i=e.config,o=i.widgetOptions,n=i.columns;for(r=0;r'),x=d.parent().addClass(F.css.stickyHide).css({position:m.length?"absolute":"fixed",padding:parseInt(d.parent().parent().css("padding-left"),10),top:c+w,left:0,visibility:"hidden",zIndex:p.stickyHeaders_zIndex||2}),f=d.children("thead:first"),C="",u=function(e,t){var r,a,s,i,o,n=e.filter(":visible"),l=n.length;for(r=0;rr.top&&l thead:gt(0), tr.sticky-false").hide(),d.find("> tbody, > tfoot").remove(),d.find("caption").toggle(p.stickyHeaders_includeCaption),i=f.children().children(),d.css({height:0,width:0,margin:0}),i.find("."+F.css.resizer).remove(),h.addClass("hasStickyHeaders").bind("pagerComplete"+o,function(){$()}),F.bindEvents(e,f.children().children("."+F.css.header)),p.stickyHeaders_appendTo?S(p.stickyHeaders_appendTo).append(x):h.after(x),r.onRenderHeader)for(a=(s=f.children("tr").children()).length,t=0;t";d("head").append(e)}),f.resizable={init:function(e,t){if(!e.$table.hasClass("hasResizable")){e.$table.addClass("hasResizable");var r,a,s,i,o=e.$table,n=o.parent(),l=parseInt(o.css("margin-top"),10),c=t.resizable_vars={useStorage:f.storage&&!1!==t.resizable,$wrap:n,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===n.css("overflow")||"scroll"===n.css("overflow")||"auto"===n.css("overflow-x")||"scroll"===n.css("overflow-x"),storedSizes:[]};for(f.resizableReset(e.table,!0),c.tableWidth=o.width(),c.fullWidth=Math.abs(n.width()-c.tableWidth)<20,c.useStorage&&c.overflow&&(f.storage(e.table,"tablesorter-table-original-css-width",c.tableWidth),i=f.storage(e.table,"tablesorter-table-resized-width")||"auto",f.resizable.setWidth(o,i,!0)),t.resizable_vars.storedSizes=s=(c.useStorage?f.storage(e.table,f.css.resizableStorage):[])||[],f.resizable.setWidths(e,t,s),f.resizable.updateStoredSizes(e,t),t.$resizable_container=d('
').css({top:l}).insertBefore(o),a=0;a').appendTo(t.$resizable_container).attr({"data-column":a,unselectable:"on"}).data("header",r).bind("selectstart",!1);f.resizable.bindings(e,t)}},updateStoredSizes:function(e,t){var r,a,s=e.columns,i=t.resizable_vars;for(i.storedSizes=[],r=0;r> Saving last sort: "+e.sortList+c.benchmark(s))):(i.addClass("hasSaveSort"),n="",c.storage&&(n=d(e),l&&console.log('saveSort >> Last sort loaded: "'+n+'"'+c.benchmark(s)),i.bind("saveSortReset",function(e){e.stopPropagation(),c.storage(t,"tablesorter-savesort","")})),a&&n&&0 + * https://github.com/pladaria/reconnecting-websocket + * License MIT + */ + var getGlobalWebSocket = function () { + if (typeof WebSocket !== 'undefined') { + // @ts-ignore + return WebSocket; + } + }; + /** + * Returns true if given argument looks like a WebSocket class + */ + var isWebSocket = function (w) { return typeof w === 'function' && w.CLOSING === 2; }; + var DEFAULT = { + maxReconnectionDelay: 10000, + minReconnectionDelay: 1000 + Math.random() * 4000, + minUptime: 5000, + reconnectionDelayGrowFactor: 1.3, + connectionTimeout: 4000, + maxRetries: Infinity, + debug: false, + }; + var ReconnectingWebSocket = /** @class */ (function () { + function ReconnectingWebSocket(url, protocols, options) { + if (options === void 0) { options = {}; } + var _this = this; + this._listeners = { + error: [], + message: [], + open: [], + close: [], + }; + this._retryCount = -1; + this._shouldReconnect = true; + this._connectLock = false; + this._binaryType = 'blob'; + this._closeCalled = false; + this._messageQueue = []; + /** + * An event listener to be called when the WebSocket connection's readyState changes to CLOSED + */ + this.onclose = undefined; + /** + * An event listener to be called when an error occurs + */ + this.onerror = undefined; + /** + * An event listener to be called when a message is received from the server + */ + this.onmessage = undefined; + /** + * An event listener to be called when the WebSocket connection's readyState changes to OPEN; + * this indicates that the connection is ready to send and receive data + */ + this.onopen = undefined; + this._handleOpen = function (event) { + _this._debug('open event'); + var _a = _this._options.minUptime, minUptime = _a === void 0 ? DEFAULT.minUptime : _a; + clearTimeout(_this._connectTimeout); + _this._uptimeTimeout = setTimeout(function () { return _this._acceptOpen(); }, minUptime); + // @ts-ignore + _this._ws.binaryType = _this._binaryType; + // send enqueued messages (messages sent before websocket open event) + _this._messageQueue.forEach(function (message) { return _this._ws.send(message); }); + _this._messageQueue = []; + if (_this.onopen) { + _this.onopen(event); + } + _this._listeners.open.forEach(function (listener) { return _this._callEventListener(event, listener); }); + }; + this._handleMessage = function (event) { + _this._debug('message event'); + if (_this.onmessage) { + _this.onmessage(event); + } + _this._listeners.message.forEach(function (listener) { return _this._callEventListener(event, listener); }); + }; + this._handleError = function (event) { + _this._debug('error event', event.message); + _this._disconnect(undefined, event.message === 'TIMEOUT' ? 'timeout' : undefined); + if (_this.onerror) { + _this.onerror(event); + } + _this._debug('exec error listeners'); + _this._listeners.error.forEach(function (listener) { return _this._callEventListener(event, listener); }); + _this._connect(); + }; + this._handleClose = function (event) { + _this._debug('close event'); + _this._clearTimeouts(); + if (_this._shouldReconnect) { + _this._connect(); + } + if (_this.onclose) { + _this.onclose(event); + } + _this._listeners.close.forEach(function (listener) { return _this._callEventListener(event, listener); }); + }; + this._url = url; + this._protocols = protocols; + this._options = options; + this._connect(); + } + Object.defineProperty(ReconnectingWebSocket, "CONNECTING", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket, "OPEN", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket, "CLOSING", { + get: function () { + return 2; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket, "CLOSED", { + get: function () { + return 3; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "CONNECTING", { + get: function () { + return ReconnectingWebSocket.CONNECTING; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "OPEN", { + get: function () { + return ReconnectingWebSocket.OPEN; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "CLOSING", { + get: function () { + return ReconnectingWebSocket.CLOSING; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "CLOSED", { + get: function () { + return ReconnectingWebSocket.CLOSED; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "binaryType", { + get: function () { + return this._ws ? this._ws.binaryType : this._binaryType; + }, + set: function (value) { + this._binaryType = value; + if (this._ws) { + // @ts-ignore + this._ws.binaryType = value; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "retryCount", { + /** + * Returns the number or connection retries + */ + get: function () { + return Math.max(this._retryCount, 0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "bufferedAmount", { + /** + * The number of bytes of data that have been queued using calls to send() but not yet + * transmitted to the network. This value resets to zero once all queued data has been sent. + * This value does not reset to zero when the connection is closed; if you keep calling send(), + * this will continue to climb. Read only + */ + get: function () { + var bytes = this._messageQueue.reduce(function (acc, message) { + if (typeof message === 'string') { + acc += message.length; // not byte size + } + else if (message instanceof Blob) { + acc += message.size; + } + else { + acc += message.byteLength; + } + return acc; + }, 0); + return bytes + (this._ws ? this._ws.bufferedAmount : 0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "extensions", { + /** + * The extensions selected by the server. This is currently only the empty string or a list of + * extensions as negotiated by the connection + */ + get: function () { + return this._ws ? this._ws.extensions : ''; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "protocol", { + /** + * A string indicating the name of the sub-protocol the server selected; + * this will be one of the strings specified in the protocols parameter when creating the + * WebSocket object + */ + get: function () { + return this._ws ? this._ws.protocol : ''; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "readyState", { + /** + * The current state of the connection; this is one of the Ready state constants + */ + get: function () { + return this._ws ? this._ws.readyState : ReconnectingWebSocket.CONNECTING; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReconnectingWebSocket.prototype, "url", { + /** + * The URL as resolved by the constructor + */ + get: function () { + return this._ws ? this._ws.url : ''; + }, + enumerable: true, + configurable: true + }); + /** + * Closes the WebSocket connection or connection attempt, if any. If the connection is already + * CLOSED, this method does nothing + */ + ReconnectingWebSocket.prototype.close = function (code, reason) { + if (code === void 0) { code = 1000; } + this._closeCalled = true; + this._shouldReconnect = false; + this._clearTimeouts(); + if (!this._ws) { + this._debug('close enqueued: no ws instance'); + return; + } + if (this._ws.readyState === this.CLOSED) { + this._debug('close: already closed'); + return; + } + this._ws.close(code, reason); + }; + /** + * Closes the WebSocket connection or connection attempt and connects again. + * Resets retry counter; + */ + ReconnectingWebSocket.prototype.reconnect = function (code, reason) { + this._shouldReconnect = true; + this._closeCalled = false; + this._retryCount = -1; + if (!this._ws || this._ws.readyState === this.CLOSED) { + this._connect(); + } + else { + this._disconnect(code, reason); + this._connect(); + } + }; + /** + * Enqueue specified data to be transmitted to the server over the WebSocket connection + */ + ReconnectingWebSocket.prototype.send = function (data) { + if (this._ws && this._ws.readyState === this.OPEN) { + this._debug('send', data); + this._ws.send(data); + } + else { + this._debug('enqueue', data); + this._messageQueue.push(data); + } + }; + /** + * Register an event handler of a specific event type + */ + ReconnectingWebSocket.prototype.addEventListener = function (type, listener) { + if (this._listeners[type]) { + // @ts-ignore + this._listeners[type].push(listener); + } + }; + /** + * Removes an event listener + */ + ReconnectingWebSocket.prototype.removeEventListener = function (type, listener) { + if (this._listeners[type]) { + // @ts-ignore + this._listeners[type] = this._listeners[type].filter(function (l) { return l !== listener; }); + } + }; + ReconnectingWebSocket.prototype._debug = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (this._options.debug) { + // not using spread because compiled version uses Symbols + // tslint:disable-next-line + console.log.apply(console, ['RWS>'].concat(args)); + } + }; + ReconnectingWebSocket.prototype._getNextDelay = function () { + var _a = this._options, _b = _a.reconnectionDelayGrowFactor, reconnectionDelayGrowFactor = _b === void 0 ? DEFAULT.reconnectionDelayGrowFactor : _b, _c = _a.minReconnectionDelay, minReconnectionDelay = _c === void 0 ? DEFAULT.minReconnectionDelay : _c, _d = _a.maxReconnectionDelay, maxReconnectionDelay = _d === void 0 ? DEFAULT.maxReconnectionDelay : _d; + var delay = minReconnectionDelay; + if (this._retryCount > 0) { + delay = + minReconnectionDelay * Math.pow(reconnectionDelayGrowFactor, this._retryCount - 1); + if (delay > maxReconnectionDelay) { + delay = maxReconnectionDelay; + } + } + this._debug('next delay', delay); + return delay; + }; + ReconnectingWebSocket.prototype._wait = function () { + var _this = this; + return new Promise(function (resolve) { + setTimeout(resolve, _this._getNextDelay()); + }); + }; + ReconnectingWebSocket.prototype._getNextUrl = function (urlProvider) { + if (typeof urlProvider === 'string') { + return Promise.resolve(urlProvider); + } + if (typeof urlProvider === 'function') { + var url = urlProvider(); + if (typeof url === 'string') { + return Promise.resolve(url); + } + if (url.then) { + return url; + } + } + throw Error('Invalid URL'); + }; + ReconnectingWebSocket.prototype._connect = function () { + var _this = this; + if (this._connectLock || !this._shouldReconnect) { + return; + } + this._connectLock = true; + var _a = this._options, _b = _a.maxRetries, maxRetries = _b === void 0 ? DEFAULT.maxRetries : _b, _c = _a.connectionTimeout, connectionTimeout = _c === void 0 ? DEFAULT.connectionTimeout : _c, _d = _a.WebSocket, WebSocket = _d === void 0 ? getGlobalWebSocket() : _d; + if (this._retryCount >= maxRetries) { + this._debug('max retries reached', this._retryCount, '>=', maxRetries); + return; + } + this._retryCount++; + this._debug('connect', this._retryCount); + this._removeListeners(); + if (!isWebSocket(WebSocket)) { + throw Error('No valid WebSocket class provided'); + } + this._wait() + .then(function () { return _this._getNextUrl(_this._url); }) + .then(function (url) { + // close could be called before creating the ws + if (_this._closeCalled) { + _this._connectLock = false; + return; + } + _this._debug('connect', { url: url, protocols: _this._protocols }); + _this._ws = _this._protocols + ? new WebSocket(url, _this._protocols) + : new WebSocket(url); + // @ts-ignore + _this._ws.binaryType = _this._binaryType; + _this._connectLock = false; + _this._addListeners(); + _this._connectTimeout = setTimeout(function () { return _this._handleTimeout(); }, connectionTimeout); + }); + }; + ReconnectingWebSocket.prototype._handleTimeout = function () { + this._debug('timeout event'); + this._handleError(new ErrorEvent(Error('TIMEOUT'), this)); + }; + ReconnectingWebSocket.prototype._disconnect = function (code, reason) { + if (code === void 0) { code = 1000; } + this._clearTimeouts(); + if (!this._ws) { + return; + } + this._removeListeners(); + try { + this._ws.close(code, reason); + this._handleClose(new CloseEvent(code, reason, this)); + } + catch (error) { + // ignore + } + }; + ReconnectingWebSocket.prototype._acceptOpen = function () { + this._debug('accept open'); + this._retryCount = 0; + }; + ReconnectingWebSocket.prototype._callEventListener = function (event, listener) { + if ('handleEvent' in listener) { + // @ts-ignore + listener.handleEvent(event); + } + else { + // @ts-ignore + listener(event); + } + }; + ReconnectingWebSocket.prototype._removeListeners = function () { + if (!this._ws) { + return; + } + this._debug('removeListeners'); + this._ws.removeEventListener('open', this._handleOpen); + this._ws.removeEventListener('close', this._handleClose); + this._ws.removeEventListener('message', this._handleMessage); + // @ts-ignore + this._ws.removeEventListener('error', this._handleError); + }; + ReconnectingWebSocket.prototype._addListeners = function () { + if (!this._ws) { + return; + } + this._debug('addListeners'); + this._ws.addEventListener('open', this._handleOpen); + this._ws.addEventListener('close', this._handleClose); + this._ws.addEventListener('message', this._handleMessage); + // @ts-ignore + this._ws.addEventListener('error', this._handleError); + }; + ReconnectingWebSocket.prototype._clearTimeouts = function () { + clearTimeout(this._connectTimeout); + clearTimeout(this._uptimeTimeout); + }; + return ReconnectingWebSocket; + }()); + + return ReconnectingWebSocket; + +}()); \ No newline at end of file diff --git a/kfet/static/kfet/vendor/reconnecting-websocket.min.js b/kfet/static/kfet/vendor/reconnecting-websocket.min.js new file mode 100644 index 00000000..8c7a3167 --- /dev/null +++ b/kfet/static/kfet/vendor/reconnecting-websocket.min.js @@ -0,0 +1 @@ +var ReconnectingWebSocket=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};function t(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}var n=function(){return function(e,t){this.target=t,this.type=e}}(),o=function(e){function n(t,n){var o=e.call(this,"error",n)||this;return o.message=t.message,o.error=t,o}return t(n,e),n}(n),r=function(e){function n(t,n,o){void 0===t&&(t=1e3),void 0===n&&(n="");var r=e.call(this,"close",o)||this;return r.wasClean=!0,r.code=t,r.reason=n,r}return t(n,e),n}(n),i=function(){if("undefined"!=typeof WebSocket)return WebSocket},s={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,debug:!1};return function(){function e(e,t,n){void 0===n&&(n={});var o=this;this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=void 0,this.onerror=void 0,this.onmessage=void 0,this.onopen=void 0,this._handleOpen=function(e){o._debug("open event");var t=o._options.minUptime,n=void 0===t?s.minUptime:t;clearTimeout(o._connectTimeout),o._uptimeTimeout=setTimeout(function(){return o._acceptOpen()},n),o._ws.binaryType=o._binaryType,o._messageQueue.forEach(function(e){return o._ws.send(e)}),o._messageQueue=[],o.onopen&&o.onopen(e),o._listeners.open.forEach(function(t){return o._callEventListener(e,t)})},this._handleMessage=function(e){o._debug("message event"),o.onmessage&&o.onmessage(e),o._listeners.message.forEach(function(t){return o._callEventListener(e,t)})},this._handleError=function(e){o._debug("error event",e.message),o._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),o.onerror&&o.onerror(e),o._debug("exec error listeners"),o._listeners.error.forEach(function(t){return o._callEventListener(e,t)}),o._connect()},this._handleClose=function(e){o._debug("close event"),o._clearTimeouts(),o._shouldReconnect&&o._connect(),o.onclose&&o.onclose(e),o._listeners.close.forEach(function(t){return o._callEventListener(e,t)})},this._url=e,this._protocols=t,this._options=n,this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){return this._messageQueue.reduce(function(e,t){return"string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e},0)+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")},e.prototype.reconnect=function(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()},e.prototype.send=function(e){this._ws&&this._ws.readyState===this.OPEN?(this._debug("send",e),this._ws.send(e)):(this._debug("enqueue",e),this._messageQueue.push(e))},e.prototype.addEventListener=function(e,t){this._listeners[e]&&this._listeners[e].push(t)},e.prototype.removeEventListener=function(e,t){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(function(e){return e!==t}))},e.prototype._debug=function(){for(var e=[],t=0;t"].concat(e))},e.prototype._getNextDelay=function(){var e=this._options,t=e.reconnectionDelayGrowFactor,n=void 0===t?s.reconnectionDelayGrowFactor:t,o=e.minReconnectionDelay,r=void 0===o?s.minReconnectionDelay:o,i=e.maxReconnectionDelay,c=void 0===i?s.maxReconnectionDelay:i,u=r;return this._retryCount>0&&(u=r*Math.pow(n,this._retryCount-1))>c&&(u=c),this._debug("next delay",u),u},e.prototype._wait=function(){var e=this;return new Promise(function(t){setTimeout(t,e._getNextDelay())})},e.prototype._getNextUrl=function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")},e.prototype._connect=function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,n=t.maxRetries,o=void 0===n?s.maxRetries:n,r=t.connectionTimeout,c=void 0===r?s.connectionTimeout:r,u=t.WebSocket,a=void 0===u?i():u;if(this._retryCount>=o)this._debug("max retries reached",this._retryCount,">=",o);else{if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),"function"!=typeof(h=a)||2!==h.CLOSING)throw Error("No valid WebSocket class provided");var h;this._wait().then(function(){return e._getNextUrl(e._url)}).then(function(t){e._closeCalled?e._connectLock=!1:(e._debug("connect",{url:t,protocols:e._protocols}),e._ws=e._protocols?new a(t,e._protocols):new a(t),e._ws.binaryType=e._binaryType,e._connectLock=!1,e._addListeners(),e._connectTimeout=setTimeout(function(){return e._handleTimeout()},c))})}}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new o(Error("TIMEOUT"),this))},e.prototype._disconnect=function(e,t){if(void 0===e&&(e=1e3),this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new r(e,t,this))}catch(e){}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(e,t){"handleEvent"in t?t.handleEvent(e):t(e)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}()}(); \ No newline at end of file diff --git a/kfet/templates/kfet/base.html b/kfet/templates/kfet/base.html index d415c5de..9b75af03 100644 --- a/kfet/templates/kfet/base.html +++ b/kfet/templates/kfet/base.html @@ -9,23 +9,23 @@ - + {# CSS #} - + {# JS #} - + - - - + + +