From e50045c4fb45b93832567cf1311fc2ab39537da8 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Mon, 7 Mar 2016 22:19:57 -0800 Subject: [PATCH] Python control program --- .gitignore | 4 + Makefile | 65 ++ README.md | 6 +- SConstruct | 91 -- bbctrl.init.d | 50 ++ bbctrl.py | 112 +++ package.json | 11 + setup.sh => setup_rpi.sh | 0 src/bbmc.cpp | 44 - src/bbmc.scons | 34 - src/bbmc/App.cpp | 106 --- src/bbmc/App.h | 79 -- src/bbmc/Server.cpp | 102 --- src/bbmc/Server.h | 56 -- src/bbmc/Transaction.cpp | 65 -- src/bbmc/Transaction.h | 65 -- src/jade/index.jade | 65 ++ src/js/app.js | 85 ++ src/js/gauge.js | 64 ++ src/js/main.js | 8 + src/js/slider.js | 25 + src/resources/css/fd-slider-tooltip.css | 109 +++ src/resources/css/fd-slider.css | 1004 +++++++++++++++++++++++ src/resources/js/fd-slider.min.js | 2 + src/resources/js/gauge.min.js | 1 + src/resources/js/socket.io.js | 3 + src/resources/js/sockjs.min.js | 3 + src/stylus/style.styl | 25 + 28 files changed, 1639 insertions(+), 645 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile delete mode 100644 SConstruct create mode 100644 bbctrl.init.d create mode 100755 bbctrl.py create mode 100644 package.json rename setup.sh => setup_rpi.sh (100%) delete mode 100644 src/bbmc.cpp delete mode 100644 src/bbmc.scons delete mode 100644 src/bbmc/App.cpp delete mode 100644 src/bbmc/App.h delete mode 100644 src/bbmc/Server.cpp delete mode 100644 src/bbmc/Server.h delete mode 100644 src/bbmc/Transaction.cpp delete mode 100644 src/bbmc/Transaction.h create mode 100644 src/jade/index.jade create mode 100644 src/js/app.js create mode 100644 src/js/gauge.js create mode 100644 src/js/main.js create mode 100644 src/js/slider.js create mode 100644 src/resources/css/fd-slider-tooltip.css create mode 100644 src/resources/css/fd-slider.css create mode 100644 src/resources/js/fd-slider.min.js create mode 100644 src/resources/js/gauge.min.js create mode 100644 src/resources/js/socket.io.js create mode 100644 src/resources/js/sockjs.min.js create mode 100644 src/stylus/style.styl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99a7751 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.sconf_temp/ +.sconsign.dblite +*~ +\#* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ebbe0d9 --- /dev/null +++ b/Makefile @@ -0,0 +1,65 @@ +DIR := $(shell dirname $(lastword $(MAKEFILE_LIST))) + +NODE_MODS := $(DIR)/node_modules +JADE := $(NODE_MODS)/jade/bin/jade.js +STYLUS := $(NODE_MODS)/stylus/bin/stylus +AP := $(NODE_MODS)/autoprefixer/autoprefixer +BROWSERIFY := $(NODE_MODS)/browserify/bin/cmd.js + +HTTP := http +HTML := index +HTML := $(patsubst %,$(HTTP)/%.html,$(HTML)) +CSS := style +CSS := $(patsubst %,$(HTTP)/%.css,$(CSS)) +JS := $(wildcard src/js/*.js) +JS_ASSETS := $(HTTP)/js/assets.js +TEMPLS := $(wildcard src/jade/templates/*.jade) +STATIC := $(shell find src/resources -type f) +STATIC := $(patsubst src/resources/%,http/%,$(STATIC)) + +WATCH := src/jade src/stylus src/js Makefile + +TARGETS := $(HTML) $(CSS) $(JS_ASSETS) $(STATIC) + +all: node_modules $(TARGETS) copy + +copy: $(TARGETS) + cp -r bbctrl.py http/ bbctrl/ + +$(HTTP)/admin.html: build/templates.jade + +$(HTTP)/%.html: src/jade/%.jade + $(JADE) -P $< --out $(shell dirname $@) || \ + (rm -f $@; exit 1) + +$(HTTP)/%.css: src/stylus/%.styl + mkdir -p $(shell dirname $@) + $(STYLUS) < $< > $@ || (rm -f $@; exit 1) + +$(HTTP)/%: src/resources/% + install -D $< $@ + +build/templates.jade: $(TEMPLS) + mkdir -p build + cat $(TEMPLS) >$@ + +$(JS_ASSETS): $(JS) + @mkdir -p $(shell dirname $@) + $(BROWSERIFY) src/js/main.js -s main -o $@ || \ + (rm -f $@; exit 1) + +node_modules: + npm install + +watch: + @clear + $(MAKE) + @while sleep 1; do \ + inotifywait -qr -e modify -e create -e delete \ + --exclude .*~ --exclude \#.* $(WATCH); \ + clear; \ + $(MAKE); \ + done + +clean: + rm -rf $(HTTP) diff --git a/README.md b/README.md index a178df3..d42b74b 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ ssh pi@ Substitute ```` with the correct IP address. The default password is ``raspberry``. You should see a prompt like this: ``pi@raspberrypi ~ $``, but in color. ## Configure the RPi -Copy the ``setup.sh`` script to the RPi and run it as root: +Copy the ``setup_rpi.sh`` script to the RPi and run it as root: ``` -scp setup.sh pi@: -ssh pi@ sudo ./setup.sh +scp setup_rpi.sh pi@: +ssh pi@ sudo ./setup_rpi.sh ``` This will take some time and will end by rebooting the RPi. After this script has run you can log in to the RPi with out typing the IP addrerss like this: diff --git a/SConstruct b/SConstruct deleted file mode 100644 index f0ddf65..0000000 --- a/SConstruct +++ /dev/null @@ -1,91 +0,0 @@ -# Setup -import os -env = Environment(ENV = os.environ) -try: - env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')]) -except Exception, e: - raise Exception, 'CBANG_HOME not set?\n' + str(e) - -env.CBLoadTools('compiler cbang dist resources build_info packager') -conf = env.CBConfigure() - -# Settings -name = 'bbmc' - -# Version -version = '0.0.1' -major, minor, revision = version.split('.') - -# Config vars -env.Replace(PACKAGE_VERSION = version) -env.Replace(RESOURCES_NS = 'bbmc') -env.Replace(BUILD_INFO_NS = 'bbmc::BuildInfo') - -if not env.GetOption('clean') and not 'package' in COMMAND_LINE_TARGETS: - conf.CBConfig('compiler') - - conf.CBConfig('cbang') - env.CBDefine('USING_CBANG') # Using CBANG macro namespace - - conf.CBRequireLib('re2') - conf.CBRequireCXXHeader('re2/re2.h') - -conf.Finish() - -# Program -Export('env name') -prog, lib = \ - SConscript('src/%s.scons' % name, variant_dir = 'build', duplicate = 0) -Default(prog) - -# Clean -Clean(prog, ['build', 'config.log']) - -# Dist -docs = ['README.md'] -tar = env.TarBZ2Dist(name, docs + [prog]) -Alias('dist', tar) -AlwaysBuild(tar) - -description = \ -''' -Buildbotics Machine Controller -''' - -short_description = description - - -if 'package' in COMMAND_LINE_TARGETS: - pkg = env.Packager( - name, - version = version, - maintainer = 'Joseph Coffland ', - vendor = 'Buildbotics LLC', - url = 'http://github.com/buildbotics/machine-controller/', - license = 'copyright', - bug_url = 'https://github.com/buildbotics/machine-controller/issues', - summary = 'Buildbotics Machine Controller', - description = description, - prefix = '/usr', - - documents = docs, - programs = [str(prog[0])], - init_d = [['scripts/' + name + '.init.d', name]], - changelog = 'ChangeLog', - - deb_directory = 'debian', - deb_section = 'science', - deb_depends = 'debconf | debconf-2.0, libc6, bzip2, zlib1g', - deb_pre_depends = 'adduser, ssl-cert', - deb_priority = 'optional', - ) - - AlwaysBuild(pkg) - env.Alias('package', pkg) - - f = None - try: - f = open('package-description.txt', 'w') - f.write(short_description.strip()) - finally: - if f is not None: f.close() diff --git a/bbctrl.init.d b/bbctrl.init.d new file mode 100644 index 0000000..cc1f882 --- /dev/null +++ b/bbctrl.init.d @@ -0,0 +1,50 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: bbctl +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Buildbotics Controller Web service +# Description: Buildbotics Controller Web service +### END INIT INFO + +DAEMON=/usr/local/bin/bbctrl.py +DAEMON_NAME=bbctrl +DAEMON_OPTS="" +DAEMON_USER=root +PIDFILE=/var/run/$DAEMON_NAME.pid + + +. /lib/lsb/init-functions + + +do_start () { + log_daemon_msg "Starting system $DAEMON_NAME daemon" + start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile \ + --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- \ + $DAEMON_OPTS + log_end_msg $? +} + + +do_stop () { + log_daemon_msg "Stopping system $DAEMON_NAME daemon" + start-stop-daemon --stop --pidfile $PIDFILE --retry 10 + log_end_msg $? +} + + +case "$1" in + start|stop) do_${1} ;; + restart|reload|force-reload) do_stop; do_start ;; + status) + status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $? + ;; + + *) + echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/bbctrl.py b/bbctrl.py new file mode 100755 index 0000000..c6f8a48 --- /dev/null +++ b/bbctrl.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python + +## Change this to match your local settings +SERIAL_PORT = '/dev/ttyAMA0' +SERIAL_BAUDRATE = 115200 + +import os +from tornado import web, ioloop +from sockjs.tornado import SockJSRouter, SockJSConnection +import json +import serial +import multiprocessing + +DIR = os.path.dirname(__file__) + +state = {} +clients = [] + +input_queue = multiprocessing.Queue() +output_queue = multiprocessing.Queue() + + +class SerialProcess(multiprocessing.Process): + def __init__(self, input_queue, output_queue): + multiprocessing.Process.__init__(self) + self.input_queue = input_queue + self.output_queue = output_queue + self.sp = serial.Serial(SERIAL_PORT, SERIAL_BAUDRATE, timeout = 1) + self.input_queue.put('\n') + + + def close(self): + self.sp.close() + + + def writeSerial(self, data): + self.sp.write(data.encode()) + + + def readSerial(self): + return self.sp.readline().replace("\n", "") + + + def run(self): + self.sp.flushInput() + + while True: + # look for incoming tornado request + if not self.input_queue.empty(): + data = self.input_queue.get() + + # send it to the serial device + self.writeSerial(data) + + # look for incoming serial data + if (self.sp.inWaiting() > 0): + data = self.readSerial() + # send it back to tornado + self.output_queue.put(data) + print data + + + +class Connection(SockJSConnection): + def on_open(self, info): + clients.append(self) + self.send(state) + + def on_close(self): + clients.remove(self) + + + def on_message(self, data): + input_queue.put(data + '\n') + + + +# check the queue for pending messages, and rely that to all connected clients +def checkQueue(): + while not output_queue.empty(): + try: + msg = json.loads(output_queue.get()) + state.update(msg) + for c in clients: c.send(msg) + except: pass + + +handlers = [ + (r'/(.*)', web.StaticFileHandler, + {'path': os.path.join(DIR, 'http/'), + "default_filename": "index.html"}), + ] + +router = SockJSRouter(Connection, '/ws') + + +if __name__ == "__main__": + import logging + logging.getLogger().setLevel(logging.DEBUG) + + # Start the serial worker + sp = SerialProcess(input_queue, output_queue) + sp.daemon = True + sp.start() + + # Adjust the interval according to frames sent by serial port + ioloop.PeriodicCallback(checkQueue, 100).start() + + # Start the web server + app = web.Application(router.urls + handlers) + app.listen(8080) + ioloop.IOLoop.instance().start() diff --git a/package.json b/package.json new file mode 100644 index 0000000..eff8596 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "bbctrl", + "private": true, + + "dependencies": { + "autoprefixer": ">=3.0.0", + "jade": ">=1.3.0", + "stylus": ">=0.42.3", + "browserify": ">=8.1.1" + } +} diff --git a/setup.sh b/setup_rpi.sh similarity index 100% rename from setup.sh rename to setup_rpi.sh diff --git a/src/bbmc.cpp b/src/bbmc.cpp deleted file mode 100644 index 2a05f86..0000000 --- a/src/bbmc.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#include -#include - -#include - -int main(int argc, char *argv[]) { -#ifdef DEBUG - cb::Event::Event::enableDebugMode(); -#endif - - return cb::doApplication(argc, argv); -} diff --git a/src/bbmc.scons b/src/bbmc.scons deleted file mode 100644 index 283a46b..0000000 --- a/src/bbmc.scons +++ /dev/null @@ -1,34 +0,0 @@ -import glob - -Import('*') - -env.Append(CPPPATH = ['#/src']) - -subdirs = [''] - -# Source -src = [] -for dir in subdirs: - src += Glob('bbmc/' + dir + '/*.cpp') - - -# Resources -res = env.Resources('resources.cpp', ['#/src/resources']) -resLib = env.Library(name + 'Resources', res) -Precious(resLib) - -# Build lib -lib = env.Library(name, src) - - -# Build Info -info = env.BuildInfo('build_info.cpp', []) -AlwaysBuild(info) - -# Main program -prog = env.Program('#/' + name, [name + '.cpp', info, lib, resLib]); - - -# Return -pair = (prog, lib) -Return('pair') diff --git a/src/bbmc/App.cpp b/src/bbmc/App.cpp deleted file mode 100644 index 36c3646..0000000 --- a/src/bbmc/App.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#include "App.h" - -#include -#include -#include - -#include -#include - -using namespace bbmc; -using namespace cb; -using namespace std; - - -App::App() : - ServerApplication("Buildbotics Machine Controller", &App::_hasFeature), - dns(base), client(base, dns), server(*this) { - - options.pushCategory("Buildbotics Machine Controller"); - options.add("http-root", "Serve /* files from this directory."); - options.popCategory(); - - options.pushCategory("Debugging"); - options.add("debug-libevent", "Enable verbose libevent debugging" - )->setDefault(false); - options.popCategory(); - - // Enable libevent logging - Event::Event::enableLogging(3); -} - - -bool App::_hasFeature(int feature) { - if (feature == FEATURE_LIFELINE) return true; - return ServerApplication::_hasFeature(feature); -} - -int App::init(int argc, char *argv[]) { - int i = ServerApplication::init(argc, argv); - if (i == -1) return -1; - - // Libevent debugging - if (options["debug-libevent"].toBoolean()) Event::Event::enableDebugLogging(); - - server.init(); - - // Check lifeline - if (getLifeline()) base.newEvent(this, &App::lifelineEvent).add(0.25); - - // Handle exit signal - base.newSignal(SIGINT, this, &App::signalEvent).add(); - base.newSignal(SIGTERM, this, &App::signalEvent).add(); - - return 0; -} - - -void App::run() { - try { - base.dispatch(); - LOG_INFO(1, "Clean exit"); - } CATCH_ERROR; -} - - -void App::lifelineEvent(Event::Event &e, int signal, unsigned flags) { - e.add(0.25); - if (shouldQuit()) base.loopExit(); -} - - -void App::signalEvent(Event::Event &e, int signal, unsigned flags) { - base.loopExit(); -} diff --git a/src/bbmc/App.h b/src/bbmc/App.h deleted file mode 100644 index 67ca809..0000000 --- a/src/bbmc/App.h +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#ifndef BBMC_APP_H -#define BBMC_APP_H - -#include "Server.h" - -#include -#include - -#include -#include -#include - -namespace cb { - namespace Event {class Event;} -} - - -namespace bbmc { - class App : public cb::ServerApplication { - cb::Event::Base base; - cb::Event::DNSBase dns; - cb::Event::Client client; - - Server server; - - public: - App(); - - static bool _hasFeature(int feature); - - cb::Event::Base &getEventBase() {return base;} - cb::Event::DNSBase &getEventDNS() {return dns;} - cb::Event::Client &getEventClient() {return client;} - - Server &getServer() {return server;} - - // From cb::Application - int init(int argc, char *argv[]); - void run(); - - void lifelineEvent(cb::Event::Event &e, int signal, unsigned flags); - void signalEvent(cb::Event::Event &e, int signal, unsigned flags); - }; -} - -#endif // BBMC_APP_H - diff --git a/src/bbmc/Server.cpp b/src/bbmc/Server.cpp deleted file mode 100644 index 03765e7..0000000 --- a/src/bbmc/Server.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#include "Server.h" -#include "App.h" -#include "Transaction.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace cb; -using namespace std; -using namespace bbmc; - -namespace bbmc { - extern const DirectoryResource resource0; -} - - -Server::Server(App &app) : - Event::WebServer(app.getOptions(), app.getEventBase()), app(app) { -} - - -void Server::init() { - Event::WebServer::init(); - - // Event::HTTP request callbacks - HTTPHandlerGroup &api = *addGroup(HTTP_ANY, "/api/.*"); - -#define ADD_TM(GROUP, METHODS, PATTERN, FUNC) \ - (GROUP).addMember(METHODS, PATTERN, &Transaction::FUNC) - - // API not found - ADD_TM(api, HTTP_ANY, "", apiNotFound); - - // Docs - HTTPHandlerGroup &docs = *addGroup(HTTP_ANY, "/docs/.*"); - if (app.getOptions()["http-root"].hasValue()) - docs.addHandler(app.getOptions()["http-root"]); - else docs.addHandler(*resource0.find("http")); - - docs.addMember(HTTP_ANY, ".*\\..*", &Transaction::notFound); - - // Root - if (app.getOptions()["http-root"].hasValue()) { - string root = app.getOptions()["http-root"]; - - addHandler(root); - addHandler(root + "/index.html"); - - } else { - addHandler(*resource0.find("http")); - addHandler(*resource0.find("http/index.html")); - } -} - - -Event::Request *Server::createRequest(evhttp_request *req) { - return new Transaction(app, req); -} diff --git a/src/bbmc/Server.h b/src/bbmc/Server.h deleted file mode 100644 index 4c8dce5..0000000 --- a/src/bbmc/Server.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#ifndef BBMC_SERVER_H -#define BBMC_SERVER_H - -#include - - -namespace bbmc { - class App; - - class Server : public cb::Event::WebServer { - App &app; - - public: - Server(App &app); - - void init(); - - // From cb::Event::HTTPHandler - cb::Event::Request *createRequest(evhttp_request *req); - }; -} - -#endif // BBMC_SERVER_H - diff --git a/src/bbmc/Transaction.cpp b/src/bbmc/Transaction.cpp deleted file mode 100644 index e33d8b8..0000000 --- a/src/bbmc/Transaction.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#include "Transaction.h" -#include "App.h" - -#include -#include -#include - -using namespace std; -using namespace cb; -using namespace bbmc; - - -Transaction::Transaction(App &app, evhttp_request *req) : - Request(req), app(app) { - LOG_DEBUG(5, "Transaction()"); -} - - -Transaction::~Transaction() { - LOG_DEBUG(5, "~Transaction()"); -} - - -bool Transaction::apiNotFound() { - THROWXS("Invalid API method " << getURI().getPath(), HTTP_NOT_FOUND); - return true; -} - - -bool Transaction::notFound() { - THROWXS("Not found " << getURI().getPath(), HTTP_NOT_FOUND); - return true; -} diff --git a/src/bbmc/Transaction.h b/src/bbmc/Transaction.h deleted file mode 100644 index 8f6190d..0000000 --- a/src/bbmc/Transaction.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************\ - - This file is part of the Buildbotics Machine Controller. - - Copyright (c) 2015-2016, Buildbotics LLC - All rights reserved. - - The Buildbotics Machine Controller is free software: you can - redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software - Foundation, either version 2 of the License, or (at your option) - any later version. - - The Buildbotics Webserver is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this software. If not, see - . - - In addition, BSD licensing may be granted on a case by case basis - by written permission from at least one of the copyright holders. - You may request written permission by emailing the authors. - - For information regarding this software email: - Joseph Coffland - joseph@cauldrondevelopment.com - -\******************************************************************************/ - -#ifndef BBMC_TRANSACTION_H -#define BBMC_TRANSACTION_H - -#include -#include -#include - - -namespace cb { - namespace JSON { - class Writer; - class Value; - } -} - - -namespace bbmc { - class App; - - class Transaction : public cb::Event::Request { - App &app; - - public: - Transaction(App &app, evhttp_request *req); - ~Transaction(); - - bool apiNotFound(); - bool notFound(); - }; -} - -#endif // BBMC_TRANSACTION_H - diff --git a/src/jade/index.jade b/src/jade/index.jade new file mode 100644 index 0000000..1118b18 --- /dev/null +++ b/src/jade/index.jade @@ -0,0 +1,65 @@ +doctype html +html(lang="en") + head + title Buildbotics Controller - Web interface + meta(charset="utf-8") + + script(src="//code.jquery.com/jquery-1.11.3.min.js") + script(src="//cdn.jsdelivr.net/vue/1.0.13/vue.min.js") + script(src="js/sockjs.min.js") + script(src="js/gauge.min.js") + script(src="js/fd-slider.min.js") + script(src="js/assets.js") + + - var faURL = "//maxcdn.bootstrapcdn.com/font-awesome" + link(rel="stylesheet" href=faURL + "/4.5.0/css/font-awesome.min.css") + + link(rel="stylesheet" href="/style.css") + + body + table + tr + td + td: button(@click="jog('y', 1)") Y+ + td + td: button(@click="jog('z', 1)") Z+ + td: button(@click="jog('a', 1)") A+ + tr + td: button(@click="jog('x', -1)") -X + td + td: button(@click="jog('x', 1)") X+ + tr + td + td: button(@click="jog('y', -1)") -Y + td + td: button(@click="jog('z', -1)") Z- + td: button(@click="jog('a', -1)") A- + + h2 Velocity {{state.vel}} + h2 Step {{step}} + + table.axes + tr + th Axis + th Position + th Step + th Flags + th Current + th StallGuard + + each axis in ['x', 'y', 'z'] + tr.axis + th.name #{axis} + td {{state.pos#{axis}}} + td {{state.dstep#{axis}}} + td {{state.dflags#{axis}}} + td + | {{state.dcur#{axis} | percent}} + gauge(:value="state.dcur#{axis} * 32", :min="1", :max="32") + input(type="range" min=1 max=32 v-model="current#{axis}") + td + gauge(:value="state.sguard#{axis}", :min="0", :max="511") + + + #templates + diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..4ce1b88 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1,85 @@ +'use strict' + + +function is_array(x) { + return Object.prototype.toString.call(x) === '[object Array]'; +} + + +module.exports = new Vue({ + el: 'body', + + + data: function () { + return { + axes: 'xyza', + state: { + dcurx: 1, dcury: 1, dcurz: 1, dcura: 1 + //sguardx: 1, sguardy: 1, sguardz: 1, sguarda: 1 + }, + step: 10 + } + }, + + + components: { + gauge: require('./gauge') + }, + + + watch: { + currentx: function (value) {this.current('x', value);}, + currenty: function (value) {this.current('y', value);}, + currentz: function (value) {this.current('z', value);}, + currenta: function (value) {this.current('a', value);} + }, + + + ready: function () { + this.sock = new SockJS('//' + window.location.host + '/ws'); + + this.sock.onmessage = function (e) { + var data = e.data; + console.debug(data); + + for (var key in data) { + this.$set('state.' + key, data[key]); + + for (var axis of ['x', 'y', 'z', 'a']) + if (key == 'dcur' + axis && typeof this.$get('current' + axis) == 'undefined') + this.$set('current' + axis, (32 * data[key]).toFixed()); + } + }.bind(this); + }, + + + methods: { + send: function (data) { + this.sock.send(JSON.stringify(data)); + }, + + + jog: function (axis, dir) { + var pos = this.state['pos' + axis] + dir * this.step; + this.sock.send('g0' + axis + pos); + }, + + + current: function (axis, value) { + var x = value / 32.0; + if (this.state['dcur' + axis] == x) return; + + var data = {}; + data['dcur' + axis] = x; + this.send(data); + } + }, + + + filters: { + percent: function (value, precision) { + if (typeof precision == 'undefined') precision = 2; + return (value * 100.0).toFixed(precision) + '%'; + } + } +}) diff --git a/src/js/gauge.js b/src/js/gauge.js new file mode 100644 index 0000000..dda1b4b --- /dev/null +++ b/src/js/gauge.js @@ -0,0 +1,64 @@ +module.exports = Vue.extend({ + template: '
', + + + props: { + value: {tupe: Number, required: true}, + lines: {type: Number, default: 1}, + angle: {type: Number, default: 0.1}, + lineWidth: {type: Number, default: 0.25}, + ptrLength: {type: Number, default: 0.85}, + ptrStrokeWidth: {type: Number, default: 0.054}, + ptrColor: {type: String, default: '#666'}, + limitMax: {type: Boolean, default: true}, + colorStart: {type: String, default: '#6FADCF'}, + colorStop: {type: String, default: '#8FC0DA'}, + strokeColor: String, + min: {type: Number, default: 0}, + max: {type: Number, default: 100} + }, + + + data: function () { + return { + } + }, + + + watch: { + value: function (value) {this.set(value)} + }, + + + compiled: function () { + this.gauge = new Gauge(this.$el.children[0]).setOptions({ + lines: this.lines, + angle: this.angle, + lineWidth: this.lineWidth, + pointer: { + length: this.ptrLength, + strokeWidth: this.ptrStrokeWidth, + color: this.ptrColor + }, + limitMax: this.limitMax, + colorStart: this.colorStart, + colorStop: this.colorStop, + strokeColor: this.strokeColor, + minValue: this.min, + maxValue: this.max + }); + + this.gauge.minValue = parseInt(this.min); + this.gauge.maxValue = parseInt(this.max); + this.set(this.value); + + this.gauge.setTextField(this.$el.children[1]); + }, + + + methods: { + set: function (value) { + if (typeof value == 'number') this.gauge.set(value); + } + } +}) diff --git a/src/js/main.js b/src/js/main.js new file mode 100644 index 0000000..8cff07a --- /dev/null +++ b/src/js/main.js @@ -0,0 +1,8 @@ +$(function() { + // Vue debugging + Vue.config.debug = true; + Vue.util.warn = function (msg) {console.debug('[Vue warn]: ' + msg)} + + // Vue app + require('./app'); +}); diff --git a/src/js/slider.js b/src/js/slider.js new file mode 100644 index 0000000..f25f873 --- /dev/null +++ b/src/js/slider.js @@ -0,0 +1,25 @@ +module.exports = new Vue({ + template: '', + replace: true, + + + props: { + value: Number, + min: Number, + max: Number, + step: Number + }, + + + data: function () { + return { + } + }, + + + compiled: function () { + this.$el.attributes.min = this.min; + this.$el.attributes.max = this.max; + this.$el.attributes.step = this.step; + } +} diff --git a/src/resources/css/fd-slider-tooltip.css b/src/resources/css/fd-slider-tooltip.css new file mode 100644 index 0000000..bbdd5b4 --- /dev/null +++ b/src/resources/css/fd-slider-tooltip.css @@ -0,0 +1,109 @@ +/* + Sample tooltip code. Only works on grade A browsers (so no IE6, 7 or 8). + + See: http://nicolasgallagher.com/multiple-backgrounds-and-borders-with-css2/ + for full info on how to style generated content & the associated pitfalls. +*/ + +.fd-slider-handle:before, +.fd-slider-handle:after + { + content:""; + /* Remove from screen */ + opacity:0; + -webkit-transition-property: all; + -moz-transition-property: all; + -ms-transition-property: all; + -o-transition-property: all; + transition-property: all; + -webkit-transition-duration: 0.3s; + -moz-transition-duration: 0.3s; + -ms-transition-duration: 0.3s; + -o-transition-duration: 0.3s; + transition-duration: 0.3s; + -webkit-transition-delay: 0.2s; + -moz-transition-delay: 0.2s; + -ms-transition-delay: 0.2s; + -o-transition-delay: 0.2s; + transition-delay: 0.2s; + } +/* + The tooltip body - as we position it above the slider and position the + tooltip arrow below it, we need to know the height of the body. This means + that multi-line tooltips are not supported. + + To support multi-line tooltips, you will need to position the tooltip below + the slider and the tooltip pointer above the tooltip body. Additionally, you + will have to set the tooltip body "height" to auto +*/ +.fd-slider-handle:before + { + display:block; + position:absolute; + top:-30px; + left:-25px; + margin:0; + width:60px; + padding:5px; + height:14px; + line-height:12px; + font-size:10px; + text-shadow:0 1px 0 #000; + color:#fff; + background:#222; + z-index:1; + /* Use the ARIA valuetext property, set by the script, to generate the + tooltip content */ + content:attr(aria-valuetext); + -webkit-border-radius:3px; + -moz-border-radius:3px; + border-radius:3px; + -webkit-box-shadow: 0 0 4px #aaa; + -moz-box-shadow: 0 0 4px #aaa; + box-shadow: 0 0 4px #aaa; + } +.fd-slider-handle:after + { + outline:none; + content:""; + display:block; + position:absolute; + top:-14px; + left:50%; + margin:0 0 0 -5px; + background:#222; + z-index:2; + width:10px; + height:10px; + overflow:hidden; + /* Rotate element by 45 degress to get the "\/" pointer effect */ + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + -webkit-box-shadow: 0 0 4px #aaa; + -moz-box-shadow: 0 0 4px #aaa; + box-shadow: 0 0 4px #aaa; + clip:rect(4px, 14px, 14px, 4px); + } +/* Change opacity and position to kick in the transitions */ +.fd-slider-focused .fd-slider-handle:before, +.fd-slider-hover .fd-slider-handle:before, +.fd-slider-active .fd-slider-handle:before + { + top:-25px; + opacity:1; + } +.fd-slider-focused .fd-slider-handle:after, +.fd-slider-hover .fd-slider-handle:after, +.fd-slider-active .fd-slider-handle:after + { + top:-9px; + opacity:1; + } +/* Remove completely for IE 6, 7 and 8 */ +.oldie .fd-slider-handle:before, +.oldie .fd-slider-handle:after + { + display:none; + } \ No newline at end of file diff --git a/src/resources/css/fd-slider.css b/src/resources/css/fd-slider.css new file mode 100644 index 0000000..84d5def --- /dev/null +++ b/src/resources/css/fd-slider.css @@ -0,0 +1,1004 @@ +/* + + Don't use this version of the file in a production environment. A minified + version tailored specifically to your needs can be generated in-browser by + using the /css-generator/index.html file. + + Notes for the adventurous: + + 1. The script automagically adds the classname "oldie" to IE6, 7 & 8. + + 2. A combination of the .oldie class and "safe css hacks" are used to target + specific IE versions. See: http://mathiasbynens.be/notes/safe-css-hacks + + 3. MSHTML has been used to base64 encode the various png images used for the + drag handle in IE6 and 7. IE7 gets served one base64 encoded image sprite + whereas IE6 gets served individual base64 encoded images. + + See: http://www.phpied.com/the-proper-mhtml-syntax/ for more info on MHTML + + The base64 encoded images have been placed into their own .mht file. This + means only IE6 and 7 will ever be burdened with downloading the file. + + A Microsoft security update in July 2011 means that .mht files now have to + be delivered with the mimetype "message/rfc822". If using IIS, there is + nothing to do as IIS appears to default to using the required + "message/rfc822" mimetype, if using Apache, there are two ways in which to + configure this behaviour: + + A. You have Admin rights and can restart the Apache server + + Update the apache_root/httpd/conf/Srm.conf file and add the following + line: + + AddType message/rfc822 mht + + This method requires that you restart Apache. + + B. You can simply use an htaccess directive + + You can add the following to an .htaccess file that sits in the same + directory as the .mht file (or to an htaccess file at the root of your + website if one exists already): + + AddType message/rfc822 mht + + You do not need to restart Apache for the change to take effect. + + Yikes - I cant do either of the above! + + Don't worry, using the .mht file isn't compulsory - just replace the + various mhtml: references (found within the .oldie classes) to point to + the correct image file on your server (not forgetting to actually upload + the image files to your server of course). + + All of the relevant rules have further instructions embedded within them. + + 4. All browsers but IE6 get one "normal" base64 encoded image sprite. IE6 has + to use separate images for each animation state. + + 5. The drag handle is only 20px in width & height, most probably not suitable + for touch screen devices. + + 6. It's painless to base64 encode your own images, use an online encoder. + See: http://www.google.com/search?q=base+64+encoder - the only problem is + that IE6 needs each frame of the handle sprite to be encoded individually. + + 7. If you want to use a different image for vertical slider drag handles, + uncomment the relevant classes below (easy to spot as they all have the + classname ".fd-slider-vertical" somewhere within the declaration). + + 8. As a reminder, the following HTML is being targetted by the CSS: + + + + + + +   + + + +*/ + +/* + Element: Form element associated with the slider + Notes: The styles given to the associated form element in order to hide + it within the display +*/ +.fd-form-element-hidden + { + display:none; + } +/* + Element: Outer wrapper + Orientation: Horizontal +*/ +.fd-slider + { + width:100%; + height:20px; + margin:0 0 10px 0; + } +/* + Element: Outer wrapper + Orientation: Vertical + Notes: You may wish to float the vertical sliders left or use + display:inline-block (inline-block should work even in IE6 as the slider + is constructed from span elements but don't quote me on that) +*/ +.fd-slider-vertical + { + width:20px; + height:100%; + margin:0 10px 10px 0; + } +/* + Element: Outer wrapper + Orientation: Both horizontal & vertical +*/ +.fd-slider, +.fd-slider-vertical + { + text-align:center; + display:block; + position:relative; + cursor:pointer; + text-decoration:none; + border:0 none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + } +/* + Element: Outer Wrapper + Orientation: Both horizontal & vertical + Notes: IE6 & 7 need a transparent gif as a background in order for + hover events to work. This has been base64 encoded within the .mht file. + As it's not a png, no AlphaImageLoader filter is required for IE6. +*/ +.oldie .fd-slider, +.oldie .fd-slider-vertical + { + /* + If using the .mht file then uncomment the following rule and edit the + filepath to match the absolute path to the fd-slider.mht file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + *background:transparent url(mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!blank) repeat; + + */ + + /* + If not using the .mht file then uncomment the following rule and edit + the filepath to match the absolute path to the blank.gif file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + *background:transparent url(http://www.your-domain.com/the/path/to/blank.gif) repeat; + + */ + } +/* + Element: Inner wrapper + Notes: All other DOM elements added as children to this element. +*/ +.fd-slider-wrapper + { + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + } +/* + Element: Inner wrapper + Notes: IE6 needs an expression as it cannot do a height:100% on + absolutely positioned elements and it also can't position on four + corners - so we are left with a "one time evaluated" self-deleting + expression to do the dirty work. +*/ + +.oldie .fd-slider-vertical .fd-slider-wrapper + { + *clear:expression(style.height=parentNode.offsetHeight+'px',style.clear='none', 0); + } +/* + Element: ieBlur shiv + Notes: Used only by IE for the onfocus "Blur" effect +*/ +.fd-slider-inner + { + display:none; + } +/* + Element: ieBlur shiv + Orientation: Horizontal + Notes: IE6, 7 & 8 only. + Use the "Blur" filter to simulate the box-shadow - not brilliant but the + best we can do for IE. IE6 can't absolutely position on 4 sides so we + reset the right to "auto" and use a nasty expression to calculate the + width dynamically. +*/ +.oldie .fd-slider-inner + { + position:absolute; + height:2px; + border:1px solid #bbf; + background:#bbf; + top:4px; + bottom:auto; + left:4px; + right:12px; + z-index:2; + margin:0; + padding:0; + overflow:hidden; + line-height:4px; + _right:auto; + _width:expression((this.parentNode.offsetWidth - 12) + "px"); + filter:progid:DXImageTransform.Microsoft.Blur(pixelradius=3.5); + } +/* + Element: ieBlur shiv + Orientation: Vertical + Notes: Reposition the "Blur" filter for the vertical slider for IE6, + 7 & 8. The "Blur" filter rule cascades from the rule above so no need to + redeclare here, we just reposition. +*/ +.oldie .fd-slider-vertical .fd-slider-inner + { + width:2px; + height:auto; + bottom:12px; + right:auto; + _bottom:auto; + *clear:expression(style.height=(parentNode.offsetHeight - 8)+'px',style.clear='none', 0); + } +/* + Element: ieBlur shiv + Orientation: Horizontal & Vertical + Notes: Display the "Blurred" inner div for IE6, 7 & 8 when the slider + gains focus +*/ +.oldie .fd-slider-focused .fd-slider-inner + { + display:block; + } +/* + Element: Inner track bar + Orientation: Horizontal +*/ +.fd-slider-bar + { + display:block; + position:absolute; + top:8px; + right:10px; + left:10px; + z-index:2; + height:2px; + margin:0; + padding:0; + overflow:hidden; + border:1px solid #bbb; + border-bottom:1px solid #aaa; + border-right:1px solid #aaa; + border:1px solid rgba(187, 187, 187, .8); + border-bottom:1px solid rgba(170, 170, 170, .8); + border-right:1px solid rgba(170, 170, 170, .8); + line-height:4px; + background-color:#ddd; + background-image: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#ccc)); + background-image: -webkit-linear-gradient(top, #ececec, #ccc); + background-image: -moz-linear-gradient(top, #ececec, #ccc); + background-image: -ms-linear-gradient(top, #ececec, #ccc); + background-image: -o-linear-gradient(top, #ececec, #ccc); + background-image: linear-gradient(to bottom, #ececec, #ccc); + border-radius:2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + } +/* + Element: Inner track bar + Orientation: Horizontal + Notes: For IE6 & 7 & 8. IE6 does not recognise absolute positioning on + four sides (top, right, bottom & left) so we use an expression to + dynamically calculate the track bar size. Yes, it is horrible - you + don't need to remind me. +*/ +.oldie .fd-slider-bar + { + _right:auto; + _width:expression((this.parentNode.offsetWidth - 20) + "px"); + filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffececec',endColorstr='#ffcccccc'); + } +/* + Element: Inner track bar + Orientation: Vertical +*/ +.fd-slider-vertical .fd-slider-bar + { + width:2px; + top:10px; + right:auto; + bottom:10px; + left:8px; + height:auto; + background-color:#ddd; + background-image: -webkit-gradient(linear, left top, right top, from(#ececec), to(#ccc)); + background-image: -webkit-linear-gradient(left, #ececec, #ccc); + background-image: -moz-linear-gradient(left, #ececec, #ccc); + background-image: -ms-linear-gradient(left, #ececec, #ccc); + background-image: -o-linear-gradient(left, #ececec, #ccc); + background-image: linear-gradient(to right, #ececec, #ccc); + } +/* + Element: Inner track bar + Orientation: Vertical + Notes: For IE6 & 7 & 8. The gradient filter colour strings in AARRGGBB + format (to save you one less google). IE6 gets repositioned and alas, + an expression to calculate the height. +*/ +.oldie .fd-slider-vertical .fd-slider-bar + { + _bottom:auto; + *clear:expression(style.height=(parentNode.offsetHeight - 20)+'px',style.clear='none', 0); + filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ffececec',endColorstr='#ffcccccc'); + } +/* + Element: Inner track bar + Orientation: Horizontal & Vertical + State: Focused + Notes: Drop shadow on the inner bar when focused - newer browsers get + an animation. IE6, 7 & 8 get a "Blur" filter on an inner SPAN + .fd-slider-inner instead +*/ +.fd-slider-focused .fd-slider-bar + { + box-shadow: 0 0 6px rgba(10, 130, 170, 0.7); + -webkit-animation:fd-pulse 2s infinite; + -moz-animation:fd-pulse 2s infinite; + -o-animation:fd-pulse 2s infinite; + animation:fd-pulse 2s infinite; + } +/* + Element: Inner animated range bar + Orientation: Horizontal +*/ +.fd-slider-range + { + display:block; + position:absolute; + top:9px; + left:11px; + z-index:3; + height:2px; + margin:0; + padding:0; + overflow:hidden; + line-height:2px; + background-color:#4cc; + background-image: -webkit-gradient(linear, left top, right top, from(#6cc), to(#3cf)); + background-image: -webkit-linear-gradient(left, #6cc, #3cf); + background-image: -moz-linear-gradient(left, #6cc, #3cf); + background-image: -ms-linear-gradient(left, #6cc, #3cf); + background-image: -o-linear-gradient(left, #6cc, #3cf); + background-image: linear-gradient(to right, #6cc, #3cf); + border-radius:2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + } +/* + Element: Inner range bar + Orientation: Horizontal + Notes: IE6, 7 & 8 +*/ +.oldie .fd-slider-range + { + /* IE6 - is this needed? To test. */ + _left:10px; + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ff66cccc',endColorstr='#ff33ccff'); + } +/* + Element: Inner range bar + Orientation: Vertical +*/ +.fd-slider-vertical .fd-slider-range + { + height:auto; + width:2px; + top:auto; + right:auto; + bottom:11px; + left:9px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#3cf), to(#6cc)); + background-image: -webkit-linear-gradient(top, #3cf, #6cc); + background-image: -moz-linear-gradient(top, #3cf, #6cc); + background-image: -ms-linear-gradient(top, #3cf, #6cc); + background-image: -o-linear-gradient(top, #3cf, #6cc); + background-image: linear-gradient(to bottom, #3cf, #6cc); + } +/* + Element: Inner range bar + Orientation: Vertical + Notes: IE6, 7 & 8 +*/ +.oldie .fd-slider-vertical .fd-slider-range + { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ff66cccc',endColorstr='#ff33ccff'); + } +/* + Element: Drag handle + Orientation: Horizontal + State: Default. + Notes: The image sprite used for the handle is base64 encoded below. IE7 + gets its own version within the .mht file, IE6 does not use an image + sprite and it is necessary to base64 encode individual animation frames + within the .mht file. +*/ +.fd-slider-handle + { + position:absolute; + display:block; + padding:0; + border:0 none; + margin:0; + z-index:3; + top:0; + left:0; + width:20px; + height:20px; + outline:0 none; + background-color:transparent; + background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAABQCAYAAAAZQFV3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjFFRDg4NEVDNENDODExRTFCMTZDREIyQTZDMjlDNTQ2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjFFRDg4NEVENENDODExRTFCMTZDREIyQTZDMjlDNTQ2Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MUVEODg0RUE0Q0M4MTFFMUIxNkNEQjJBNkMyOUM1NDYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MUVEODg0RUI0Q0M4MTFFMUIxNkNEQjJBNkMyOUM1NDYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz68iMNZAAAIQElEQVR42uxYW28b1xGes7tckiIp3iRboi6mbollya5DF4VsVWpaw42ABCmaogWSFH3oDyjQoijQP2AUyFOLFshbn4SqsYFabowmdaW4NhDJiKXaUuwotm6UKJK6kKIkipfl7p7OWR3aa5kiVdQoEjQLDM7u2TPfnss3MztDKKXwPC8BnvP1xQeUSnUSvGBwshl8R18Fq70PZOtx44WSn4F89hYkV6/B26ElWuIAyP4+xBKd70311tXV/bzb7+oLOcDaYiWSTSAkR0EfT9P8UDj1j8Rq/Lfw1ukx1NcOnKExs4tDbT6f75e9tc6+c05q90gEtwWRdAoyblG/k4jeVvcr76qKZePi0K9Q5ZF5pvuXLENj6xv1Pvc5n6DJyQJAQgGdjWZCuFQRwTLQ7P/W6PaLb0YBfoNd+YMAq8BR/TIpFCzhDECEgK5SeGafJAJEA0FqO+L7LgL+rhygEwE7FrMFWMqAVvY4CX6I2hoMHYDNg5es60I8Z9xXNiHd2A25PG3WInFPY9BfLRFiwePQS8AKuJEFHWA3Fl1PVOChArPT96Gp5YRDJMSFoExZ1Z8cisQ/sqOBroRnZgydMoBpGLk8mm9uDemdJzs8kkA8FgZKQMSXbFN1ZEiqQGl26eFS4cbwiKFTxvQyMPbhZPb9weHl6bsL4ZymZzRKXSKBADKbtew5+vDB8vKVwb8kPrh029A5yFIMYgO4UNrh1Nl+6H/9PBwPtUMg6DcGRBcTMDM5CzevjsDU2E3smUXZMRO7pOlh40AJoAR56+KvdxgsyiJvd/ebHinlYPlMZYPoezyTHx/a3p6xZSqHcg5fCn9ITC0xPRcvapJnLEoqASQUOczvRdM7WqQjisqfdTOwtA9M5GLhByHzMSJ/r3EghUuB92kcg5pnKHJlK4qdSxV/Lo5Tuatip5zlkjd9zBhITEtjyg5FUdx/iuVeuJQi35lTxZc2QGpkg2tAjbRJ2r9+6KGjb9bbHsqyLOzbV53RhnAwG+NcMpn0vxPVvz2pWn/sc9i6TlcRyzErCDbkZhY94CdpWhhPZO72yvnBXzeI/8RwkeDcZE5Pk0wHIOfz+ao/r6RP3M67ftLhtXb3OInFKyFXGV9xAnZ0qn0ukL2iPfS3mCri2PWfOhwTVqtV4duhC6Yly/F43H0lBa8QW1WnX6TSlqqTRQx1KHRhT/BeJw6BSl0+58mPdoXXmA4/PAOrOEPjQGKxmHtRD4aaqS5G8wRWC0B1YFvyhDXovigOpgWKftZq/0Ys9sh97Nix9SK9zLQRNzY2XEnP8QDJaSReIFTECIpbR83cZaaqUZ1q6GUF3eJnOmauPmUpu7u7FnDrwpqigygKCMimAcRMazZDjYmGY3R1T6eEpRgWUCgUVM/uZlLx1Lp8shFTCC6YFBHZwRi+hAqQ1yhYt7ZSTIdz8LGlFM1JxeXt1iUjC2FPbbMVuzFQ4SzxJX0SU9g3VJzdFm7u0VQszHT4CWtFSynao+JwOBKdCzMfp1w1L6iB5oATQ4nXQowoZwDrBMEpwSCsy4n4Wmv8848dDd4EN0N9b+57gIZ9NjU1JTvU7YmWR7dv5FcWV8NZVUurGrXjXtYiH1mbVnWajUc2XA/GP2rKbNxmOhxQNdsyAy20tbVtz8/Pz21PTV1zfBLfnm/s6rlzpKVxq7q2mg1yb69v16wtRFoj98fbIXsreOrUHNPhTuKpPWTT1TweT66rq2sdN3oaPvts2zf19xm0ngAeqpOHhjRaRRTNba6zszOMYxNMx+TSaDEEPOW+kFvyxMSEc2VlpZqRXVVVm/F1ScrV19dvNTQ0bJ85cyZdU1OjmNwXmAGfu4M1u3Ld1P5XIWA/MP1CRL0vcZ5y4cKFZuTcq6Io9qEYeYqmaTMot5Cb165fv374PGVgYOAckvdntbW1fdjKaOMicpABUuSoMjs7O5pKpX6PoJXzlJ6enrbq6upfIIG/iYA2FtlYIEMww9lin4h9F6anpy04dq1inoKzeQMBe1HJiksTstnsfgrhDy2Rg8FgP5roj/D5nbJ5isVieRk/aNnZ2SHpdFo/4HePNRa/338e2z+UzVMQsAPBBASrRGzCf0jL5yk4o1LLLHnx2ZfPUxAs7na7fThT/iN7MBiuZK0SD5Wtra37CNiJ3COMKgx034+98YwujSLgg4p5SiQSGXW5XCGkTTueNEF5Csj4qqIA8nB+aWnpmTxlP2AGfy0m7Xb7MN7/AEGDgiAQm80GbAuQJjSXywGOCSO5h8Ph8J1D5ylIif5AIHDe6/W2V1VVGXlKJpNJbG5uzkaj0ZFEIvFVnvJ/67H/p6WqWvAd/TpY7V0gWxt5qSoC+ex9SK7egbdD64cNAYLzvakTdXV13+v2u7pCDrC0WInAS1V0HNOKoXDqbmI1fhXeOj2D+nqlUlU9xpHv99Y6u845qeyRGCcfl6pIv5NYva3u0LuqIm1cHPojqkTLhQAJGlvP1vvcnT5Bk3ipipYoVYkDzf7u0e0X+9FcLvPfuZKAVnBUn0QvIPJSFS1TqhLbjvheQsC/lgO0IWCAl6r0Q5Sq/DylSx8EaPkPS1XAU+GypapNT2PQdchS1ValUlUBZqeXoKmliZeqoEypiirhmYh5/0oB5mDk8r18c2ub3nkyUKFUtVa4MXyPp7UHml4exj6cy74/OL48fTcezmnUVKoCU6lqY/nK4Fjig0ufm4P8QSGAlQbq4dTZbuh//WtwPFQPgaCLl6p2YGYyBjev3oOpsU+xJ8Yib6UQIHAq+FCO8tZeDNsoLNFZ5W1uv+mVCwHFgobNRI0C3zO2TPWrEGBc/xZgAJyadcoLu6zuAAAAAElFTkSuQmCC); + background-position:0 0; + cursor:W-resize; + line-height:20px; + font-size:10px; + -moz-outline:0 none; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + } +/* + Element: Drag handle + Orientation: Horizontal + State: Default + Notes: IE6, 7 & 8 use a nasty expression in order to not draw focus + outline on drag handle. +*/ +.oldie .fd-slider-handle + { + /* IE6 & 7 - set the handle sprite as the background image */ + + /* + If using the .mht file then uncomment the following rule and edit the + filepath to match the absolute path to the fd-slider.mht file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + *background-image:url(mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!fullsprite); + + */ + + /* + If not using the .mht file then uncomment the following rule and edit + the filepath to match the absolute path to the fd-slider-sprite.png + file on your server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + *background-image:url(http://www.your-domain.com/the/path/to/fd-slider-sprite.png); + + */ + + /**********************************************************************/ + + /* IE6 - reset the background image sprite stipulated above. */ + _background-image:none; + + /* + IE6 - use the AlphaImageLoader to either load a base64 encoded image + from the .mht file or a normal png image from the server + */ + + /* + If using the .mht file then uncomment the following rule and edit the + filepath to match the absolute path to the fd-slider.mht file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handlenormal'); + + */ + + /* + If not using the .mht file then uncomment the following rule and edit + the filepath to match the absolute path to the fd-handle-normal.png + file on your server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-normal.png'); + + */ + + /* IE6, 7 & 8 */ + outline:expression(hideFocus='true'); + } +/* + Element: Drag handle + Orientation: Horizontal & Vertical + State: Focused + Notes: Attempts to remove the focus outline, remove the rule if it + offends your sensibilities. +*/ +.fd-slider-handle:focus + { + outline:0 none; + border:0 none; + -moz-user-focus:normal; + } +.fd-slider-handle:focus::-moz-focus-inner + { + border-color: transparent; + } +/* + Element: Drag handle + Orientation: Horizontal + State: Focused and Hovered and also while handle is animating into + position or being dragged. + Notes: I'm using the same image for focused, hover and active states + but you can, of course, go wild. +*/ +.fd-slider-focused .fd-slider-handle, +.fd-slider-hover .fd-slider-handle, +.fd-slider-active .fd-slider-handle + { + background-position:0 -20px; + } +/* + Element: Drag handle + Orientation: Horizontal + State: Focused and Hovered and also while handle is animating into + position or being dragged. + Notes: IE6 only. +*/ +.oldie .fd-slider-focused .fd-slider-handle, +.oldie .fd-slider-hover .fd-slider-handle, +.oldie .fd-slider-active .fd-slider-handle + { + /* + IE6 - use the AlphaImageLoader to either load a base64 encoded image + from the .mht file or a normal png image from the server + */ + + /* + If using the .mht file then uncomment the following rule and edit the + filepath to match the absolute path to the fd-slider.mht file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handleglow'); + + */ + + /* + If not using the .mht file then uncomment the following rule and edit + the filepath to match the absolute path to the fd-handle-glow.png + file on your server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-glow.png'); + + */ + } +/* + Element: Drag handle + Orientation: Vertical + Notes: Change the cursor to the correct icon. +*/ +.fd-slider-vertical .fd-slider-handle + { + cursor:N-resize; + } +/* + Element: Drag handle + Orientation: Vertical + Notes: IE6, 7 & 8 + +.oldie .fd-slider-vertical .fd-slider-handle + { + } +*/ +/* + Element: Drag handle + Orientation: Vertical + State: Focused and Hovered and also while handle is animating into + position or being dragged. + +.fd-slider-vertical .fd-slider-focused .fd-slider-handle, +.fd-slider-vertical .fd-slider-hover .fd-slider-handle, +.fd-slider-vertical .fd-slider-active .fd-slider-handle + { + } +*/ +/* + Element: Drag handle + Orientation: Vertical + State: Focused and Hovered and also while handle is animating into + position or being dragged. + Notes: IE6, 7 & 8 + +.oldie .fd-slider-vertical .fd-slider-focused .fd-slider-handle, +.oldie .fd-slider-vertical .fd-slider-hover .fd-slider-handle, +.oldie .fd-slider-vertical .fd-slider-active .fd-slider-handle + { + } +*/ +/* + Element: Drag handle + Orientation: Horizontal & Vertical + State: User has not yet used the slider to set a value + Notes: I screwed the positioning of the image sprite by 1px which is why + it's -59px and not -60px. Yeah - I suck at Photoshop. +*/ +.fd-slider-no-value .fd-slider-handle + { + background-position:0 -59px; + } +/* + Element: Drag handle + Orientation: Horizontal + State: User has not yet used the slider to set a value + Notes: IE6 only +*/ +.oldie .fd-slider-no-value .fd-slider-handle + { + /* + IE6 - use the AlphaImageLoader to either load a base64 encoded image + from the .mht file or a normal png image from the server + */ + + /* + If using the .mht file then uncomment the following rule and edit the + filepath to match the absolute path to the fd-slider.mht file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handlenovalue'); + + */ + + /* + If not using the .mht file then uncomment the following rule and edit + the filepath to match the absolute path to the fd-handle-no-value.png + file on your server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-no-value.png'); + + */ + } +/* + Element: Drag handle + Orientation: Vertical + State: User has not yet used the slider to set a value + Notes: IE6, 7 & 8. Only required should you use a different image for + vertical sliders. + +.oldie .fd-slider-vertical .fd-slider-no-value .fd-slider-handle + { + } +*/ +/* + Element: document.body + Orientation: Horizontal and Vertical + Notes: Class given to body to change cursor style when dragging. It also + attempts to stop text selection while dragging. +*/ +body.fd-slider-drag-horizontal, +body.fd-slider-drag-horizontal *, +body.fd-slider-drag-vertical, +body.fd-slider-drag-vertical * + { + cursor:N-resize !important; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + } +/* + Element: document.body + Orientation: Horizontal + Notes: Class given to body to change cursor style when dragging +*/ +body.fd-slider-drag-horizontal, +body.fd-slider-drag-horizontal * + { + cursor:W-resize !important; + } +/* + Element: Inner wrapper + Orientation: Horizontal & Vertical + State: disabled + Notes: Class given to slider when disabled +*/ +.fd-slider-disabled + { + opacity:.8; + cursor:default; + } +/* + Element: Drag handle + Orientation: Horizontal + State: disabled + Notes: Class given to slider when disabled +*/ +.fd-slider-disabled .fd-slider-handle + { + cursor:default !important; + background-position:0 -40px; + opacity:1; + } +/* + Element: Drag handle + Orientation: Horizontal + State: disabled + Notes: IE6 only +*/ +.oldie .fd-slider-disabled .fd-slider-handle + { + /* + IE6 - use the AlphaImageLoader to either load a base64 encoded image + from the .mht file or a normal png image from the server + */ + + /* + If using the .mht file then uncomment the following rule and edit the + filepath to match the absolute path to the fd-slider.mht file on your + server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handledisabled'); + + */ + + /* + If not using the .mht file then uncomment the following rule and edit + the filepath to match the absolute path to the fd-handle-disabled.png + file on your server (replace "www.your-domain.com/the/path/to/") + */ + + /* + + _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-disabled.png'); + + */ + } +/* + Element: Drag handle + Orientation: Vertical + State: disabled + +.fd-slider-vertical .fd-slider-disabled .fd-slider-handle + { + } +.oldie .fd-slider-vertical .fd-slider-disabled .fd-slider-handle + { + } +*/ +/* + Element: Inner track bar + Orientation: Horizontal + State: disabled +*/ +.fd-slider-disabled .fd-slider-bar + { + cursor:auto !important; + border:1px solid #888; + border-bottom:1px solid #999; + border-right:1px solid #999; + border:1px solid rgba(136,136,136,.8); + border-bottom:1px solid rgba(153,153,153,.8); + border-right:1px solid rgba(153,153,153,.8); + background-color:#555; + background-image: -webkit-gradient(linear, left top, right top, from(#666), to(#333)); + background-image: -webkit-linear-gradient(left, #666, #333); + background-image: -moz-linear-gradient(left, #666, #333); + background-image: -ms-linear-gradient(left, #666, #333); + background-image: -o-linear-gradient(left, #666, #333); + background-image: linear-gradient(to right, #666, #333); + } +/* + Element: Inner track bar + Orientation: Vertical + State: disabled +*/ +.fd-slider-vertical .fd-slider-disabled .fd-slider-bar + { + background-image: -webkit-gradient(linear, left top, right bottom, from(#333), to(#666)); + background-image: -webkit-linear-gradient(top, #333, #666); + background-image: -moz-linear-gradient(top, #333, #666); + background-image: -ms-linear-gradient(top, #333, #666); + background-image: -o-linear-gradient(top, #333, #666); + background-image: linear-gradient(to bottom, #333, #666); + } +/* + Element: Inner track bar + Orientation: Horizontal + State: disabled + Notes: IE6, 7 & 8 +*/ +.oldie .fd-slider-disabled .fd-slider-bar + { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ff666666',endColorstr='#ff333333'); + } +/* + Element: Inner track bar + Orientation: Vertical + State: disabled + Notes: IE6, 7 & 8 +*/ +.oldie .fd-slider-vertical .fd-slider-disabled .fd-slider-bar + { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ff666666',endColorstr='#ff333333'); + } +/* + Element: Range bar + Orientation: Horizontal + State: disabled +*/ +.fd-slider-disabled .fd-slider-range + { + cursor:auto !important; + background-color:#222; + background-image: -webkit-gradient(linear, left top, right top, from(#222), to(#000)); + background-image: -webkit-linear-gradient(left, #222, #000); + background-image: -moz-linear-gradient(left, #222, #000); + background-image: -ms-linear-gradient(left, #222, #000); + background-image: -o-linear-gradient(left, #222, #000); + background-image: linear-gradient(to right, #222, #000); + } +/* + Element: Range bar + Orientation: Horizontal + State: disabled + Notes: IE6, 7 & 8 +*/ +.oldie .fd-slider-disabled .fd-slider-range + { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ff222222',endColorstr='#ff000000'); + } +/* + Element: Range bar + Orientation: Vertical + State: disabled +*/ +.fd-slider-vertical .fd-slider-disabled .fd-slider-range + { + background-image: -webkit-gradient(linear, left top, right bottom, from(#000), to(#222)); + background-image: -webkit-linear-gradient(top, #000, #222); + background-image: -moz-linear-gradient(top, #000, #222); + background-image: -ms-linear-gradient(top, #000, #222); + background-image: -o-linear-gradient(top, #000, #222); + background-image: linear-gradient(to bottom, #000, #222); + } +/* + Element: Range bar + Orientation: Vertical + State: disabled + Notes: IE6, 7 & 8 +*/ +.oldie .fd-slider-vertical .fd-slider-disabled .fd-slider-range + { + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ff222222',endColorstr='#ff000000'); + } +/* + The various prefixed keyframe rules for the glow effect used whenever + the slider gains keyboard focus +*/ +@-webkit-keyframes fd-pulse { +0% { + box-shadow:0 0 3px rgba(100, 130, 170, 0.55); + } +20% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +40% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +60% { + box-shadow:0 0 6px rgba(10, 130, 170, 0.7); + } +80% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +100% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +} +@-moz-keyframes fd-pulse { +0% { + box-shadow:0 0 3px rgba(100, 130, 170, 0.55); + } +20% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +40% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +60% { + box-shadow:0 0 6px rgba(10, 130, 170, 0.7); + } +80% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +100% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +} +@-o-keyframes fd-pulse { +0% { + box-shadow:0 0 3px rgba(100, 130, 170, 0.55); + } +20% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +40% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +60% { + box-shadow:0 0 6px rgba(10, 130, 170, 0.7); + } +80% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +100% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +} +@keyframes fd-pulse { +0% { + box-shadow:0 0 3px rgba(100, 130, 170, 0.55); + } +20% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +40% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +60% { + box-shadow:0 0 6px rgba(10, 130, 170, 0.7); + } +80% { + box-shadow:0 0 5px rgba(40, 130, 170, 0.65); + } +100% { + box-shadow:0 0 4px rgba(70, 130, 170, 0.6); + } +} diff --git a/src/resources/js/fd-slider.min.js b/src/resources/js/fd-slider.min.js new file mode 100644 index 0000000..264cae7 --- /dev/null +++ b/src/resources/js/fd-slider.min.js @@ -0,0 +1,2 @@ +/*! Unobtrusive Slider Control / HTML5 Input Range polyfill - MIT/GPL2 @freqdec */ +var fdSlider=function(){function ut(n){function nf(n){n=!!n,n!=ft&&(ft=n,pt(kt()))}function nu(){if(!p||d=="select")return;var n=g(e);if(n.min==tt&&n.max==st&&n.step==nt)return;tt=+n.min,st=+n.max,ut=tt,it=st,nt=+n.step,ir=Math.abs(st-tt),li=nt*2,bi=Math.ceil(ir/nt),ft=!1,ar(tt,st)}function gr(n){if(oi&&!n)return;try{di(l,-1),i(l,"focus",fu),i(l,"blur",su),o?i(l,"keypress",yi):(i(l,"keydown",yi),i(l,"keypress",ou)),i(a,"mouseover",br),i(a,"mouseout",sr),i(a,"mousedown",fi),i(a,"touchstart",fi),c&&(window.addEventListener&&!window.devicePixelRatio?window.removeEventListener("DOMMouseScroll",at,!1):(i(document,"mousewheel",at),i(window,"mousewheel",at)))}catch(t){}u(v,"fd-slider-focused"),u(v,"fd-slider-active"),f(v,"fd-slider-disabled"),a.setAttribute("aria-disabled",!0),e.disabled=oi=!0,clearTimeout(ht),n||ot("disable")}function hu(n){if(!oi&&!n)return;di(l,0),t(l,"focus",fu),t(l,"blur",su),o?t(l,"keypress",yi):(t(l,"keydown",yi),t(l,"keypress",ou)),t(a,"touchstart",fi),t(a,"mousedown",fi),t(a,"mouseover",br),t(a,"mouseout",sr),u(v,"fd-slider-disabled"),a.setAttribute("aria-disabled",!1),e.disabled=oi=gt=!1,n||ot("enable")}function ku(){clearTimeout(ht),ri=vt=l=a=v=ht=null,ot("destroy"),ki=null}function ii(){wr();try{var t=a.offsetWidth,n=a.offsetHeight,r=l.offsetWidth,i=l.offsetHeight,o=vt.offsetHeight,s=vt.offsetWidth,u=b?n-i:t-r;ct=u/bi,ni=Math.max(et?er(tr(ut)):Math.abs((ut-tt)/nt)*ct,0),bt=Math.min(et?er(tr(it)):Math.abs((it-tt)/nt)*ct,Math.floor(b?n-i:t-r)),ru=t,dr=n,pt(nr?kt():d=="select"?e.selectedIndex:parseFloat(e.value),!1)}catch(f){}ot("redraw")}function ot(n){var r,i,u,t;if(wt){if(n.match(/^(blur|focus|change)$/i))if(typeof document.createEvent!="undefined")t=document.createEvent("HTMLEvents"),t.initEvent(n,!0,!0),e.dispatchEvent(t);else if(typeof document.createEventObject!="undefined")try{t=document.createEventObject(),e.fireEvent("on"+n.toLowerCase(),t)}catch(f){}}else if(ki.hasOwnProperty(n))for(r={userSet:ft,disabled:oi,elem:e,value:d=="select"?e.options[e.selectedIndex].value:e.value},i=0;u=ki[n][i];i++)u.call(e,r)}function fu(){return f(v,"fd-slider-focused"),h.onfocus&&(ft=!0,pt(kt())),c&&(t(window,"DOMMouseScroll",at),t(document,"mousewheel",at),o||t(window,"mousewheel",at)),ot("focus"),!0}function su(){u(v,"fd-slider-focused"),c&&(i(document,"mousewheel",at),i(window,"DOMMouseScroll",at),o||i(window,"mousewheel",at)),lt=!0,ot("blur")}function at(n){if(!lt)return;n=n||window.event;var t=0,i;n.wheelDelta?(t=n.wheelDelta/120,o&&window.opera.version()<9.2&&(t=-t)):n.detail&&(t=-n.detail/3),b&&(t=-t),t&&(i=kt(),i+=t<0?-nt:nt,ft=!0,pt(hi(i))),s(n)}function ou(n){return n=n||window.event,n.keyCode>=33&&n.keyCode<=40||!lt||n.keyCode==45||n.keyCode==46?k(n):!0}function yi(n){if(!lt)return!0;n=n||window.event;var t=n.keyCode!==null?n.keyCode:n.charCode,i;if(t<33||t>40&&t!=45&&t!=46)return!0;i=kt(),t==37||t==40||t==46||t==34?i-=n.ctrlKey||t==34?+li:+nt:t==39||t==38||t==45||t==33?i+=n.ctrlKey||t==33?+li:+nt:t==35?i=it:t==36&&(i=ut),ft=!0,pt(hi(i)),ot("update"),s(n)}function br(){f(v,"fd-slider-hover")}function sr(){u(v,"fd-slider-hover")}function fi(n){var u,r;n=n||window.event,s(n),n.target?u=n.target:n.srcElement&&(u=n.srcElement),u&&u.nodeType==3&&(u=u.parentNode);if(n.touches){if(n.targetTouches&&n.targetTouches.length!=1)return!1;n=n.touches[0],gt=!0}return clearTimeout(ht),ht=null,lt=!1,ft=!0,u.className.search("fd-slider-handle")!=-1?(rr=b?n.clientY:n.clientX,tu=parseInt(b?l.offsetTop:l.offsetLeft)||0,ci(n),gt?(t(document,"touchmove",ci),t(document,"touchend",vi),i(a,"mousedown",fi)):(t(document,"mousemove",ci),t(document,"mouseup",vi)),f(v,"fd-slider-active"),f(document.body,"fd-slider-drag-"+(b?"vertical":"horizontal")),ot("dragstart")):(wr(),r=0,n.pageX||n.pageY?r=b?n.pageY:n.pageX:(n.clientX||n.clientY)&&(r=b?n.clientY+document.body.scrollTop+document.documentElement.scrollTop:n.clientX+document.body.scrollLeft+document.documentElement.scrollLeft),r-=b?hr+Math.round(l.offsetHeight/2):iu+Math.round(l.offsetWidth/2),r=pi(r),pr=="tween"?(f(v,"fd-slider-active"),bu(r)):pr=="timed"?(f(v,"fd-slider-active"),t(document,gt?"touchend":"mouseup",cr),ui=r,yr()):ai(r)),!1}function cr(n){return n=n||window.event,s(n),i(document,gt?"touchend":"mouseup",cr),u(v,"fd-slider-active"),clearTimeout(ht),ht=null,lt=!0,!1}function vi(n){return n=n||window.event,s(n),gt?(i(document,"touchmove",ci),i(document,"touchend",vi)):(i(document,"mousemove",ci),i(document,"mouseup",vi)),lt=!0,u(document.body,"fd-slider-drag-"+(b?"vertical":"horizontal")),u(v,"fd-slider-active"),ot("dragend"),!1}function ci(n){n=n||window.event,s(n);if(n.touches){if(n.targetTouches&&n.targetTouches.length!=1)return!1;n=n.touches[0]}return ai(pi(tu+(b?n.clientY-rr:n.clientX-rr))),!1}function ei(n){var t=kt();ft=!0,t+=n*nt,pt(hi(t))}function wr(){var i=0,t=0,n=a;try{do i+=n.offsetLeft,t+=n.offsetTop;while(n=n.offsetParent)}catch(r){}iu=i,hr=t}function yr(){var n=parseInt(b?l.offsetTop:l.offsetLeft,10);n=Math.round(ui20?50:100):(lt=!0,u(v,"fd-slider-active"),ot("finalise"))}function bu(n){lt=!1,or=parseInt(n,10),fr=parseInt(b?l.offsetTop:l.offsetLeft,10),uu=or-fr,lu=20,ur=0,ht||(ht=setTimeout(gi,20))}function si(n){return isNaN(n)||n===""||typeof n=="undefined"?(ft=!1,yt):nMath.max(ut,it)?(ft=!1,Math.max(ut,it)):(ft=!0,n)}function kt(){return hi(d=="input"?parseFloat(e.value):e.selectedIndex)}function hi(n){return isNaN(n)||n===""||typeof n=="undefined"?yt:Math.min(Math.max(n,Math.min(ut,it)),Math.max(ut,it))}function ai(n){var t=hi(et?du(tf(n)):b?st-Math.round(n/ct)*nt:tt+Math.round(n/ct)*nt);l.style[b?"top":"left"]=(n||0)+"px",lr(),vr(d=="select"||nt==1?Math.round(t):t)}function pt(n,t){var r=!1,i;(typeof n=="undefined"||isNaN(n)||n==="")&&d=="input"&&!nr?(i=yt,r=!0,ft=!1):i=si(n),l.style[b?"top":"left"]=(et?er(tr(i)):b?Math.round((st-i)/nt*ct):Math.round((i-tt)/nt*ct))+"px",lr(),!0&&vr(r?"":i)}function pi(n){if(et)return Math.max(Math.min(bt,n),ni);var t=n%ct;return t&&t>=ct/2?n+=ct-t:n-=t,nMath.max(Math.abs(ni),Math.abs(bt))&&(n=Math.max(Math.abs(ni),Math.abs(bt))),Math.min(Math.max(n,0),bt)}function du(n){var i=0,r=tt,u,t;for(t in et){if(!et.hasOwnProperty(t))continue;n+t||(u=r+(n-i)*(+et[t]-r)/(+t-i)),i=+t,r=+et[t]}return u}function tr(n){var r=0,i=tt,u=0,t;for(t in et){if(!et.hasOwnProperty(t))continue;n+et[t]||(u=r+(n-i)*(+t-r)/(+et[t]-i)),r=+t,i=+et[t]}return u}function er(n){return(a[b?"offsetHeight":"offsetWidth"]-l[b?"offsetHeight":"offsetWidth"])/100*n}function tf(n){return n/((a[b?"offsetHeight":"offsetWidth"]-a[l?"offsetHeight":"offsetWidth"])/100)}function vr(n){ot("update"),ft?u(v,"fd-slider-no-value"):f(v,"fd-slider-no-value");if(d=="select")try{n=parseInt(n,10);if(e.selectedIndex===n){dt();return}e.options[n].selected=!0}catch(t){}else{n===""||wi||(n=(tt+Math.round((+n-tt)/nt)*nt).toFixed(yu));if(e.value===n){dt();return}e.value=n}dt(),ot("change")}function ar(n,t){ut>it?(n=Math.min(tt,Math.max(n,t)),t=Math.max(st,Math.min(n,t)),ut=Math.max(n,t),it=Math.min(n,t)):(n=Math.max(tt,Math.min(n,t)),t=Math.min(st,Math.max(n,t)),ut=Math.min(n,t),it=Math.max(n,t)),ytMath.max(ut,it)&&(yt=Math.max(ut,it)),l.setAttribute("aria-valuemin",ut),l.setAttribute("aria-valuemax",it),si(d=="input"?parseFloat(e.value):e.selectedIndex),ii()}function lr(){if(y)return;b?ti.style.height=Math.max(1,vt.offsetHeight-l.offsetTop)+"px":ti.style.width=Math.max(1,l.offsetLeft)+"px"}function cu(){for(var t=!1,r=document.getElementsByTagName("label"),n,i=0;n=r[i];i++)if(n.htmlFor&&n.htmlFor==e.id||n.getAttribute("for")==e.id){t=n;break}return t&&!t.id&&(t.id=e.id+"_label"),t}function dt(){var n=d=="select"?e.options[e.selectedIndex].value:e.value,t=kr?kr(n):d=="select"?e.options[e.selectedIndex].text?e.options[e.selectedIndex].text:n:n;l.setAttribute("aria-valuenow",n),l.setAttribute("aria-valuetext",t)}function wu(){ft=!0,wi=gu,pt(d=="input"?parseFloat(e.value):e.selectedIndex),dt(),wi=!1}function pu(){d=="input"?e.value=e.defaultValue:e.selectedIndex=au,si(d=="select"?e.options[e.selectedIndex].value:e.value),ii(),dt()}function di(n,t){n.setAttribute("tabIndex",t),n.tabIndex=t}var e=n.inp,oi=!1,d=e.tagName.toLowerCase(),tt=+n.min,st=+n.max,ut=+n.min,it=+n.max,ir=Math.abs(st-tt),nt=d=="select"?1:+n.step,li=n.maxStep?+n.maxStep:nt*2,yu=n.precision||0,bi=Math.ceil(ir/nt),et=n.scale||!1,rf=!!n.hideInput,pr=n.animation||"",b=!!n.vertical,ki=n.callbacks||{},vu=n.classNames||"",wt=!!n.html5Shim,yt=st/gim,"").replace(/\bfunction\b/g,"function-"),");"].join(""));return t()}}catch(i){}return{err:"Could not parse the JSON object"}},it=function(n){if(typeof n!="object")return;for(var t in n){value=n[t];switch(t.toLowerCase()){case"mousewheelenabled":c=!!value;break;case"fullaria":rt=!!value;break;case"describedby":w=String(value);break;case"norangebar":y=!!value;break;case"html5animation":ft=String(value).search(/^(jump|tween|timed)$/i)!=-1?String(value).toLowerCase():"jump";break;case"watchattributes":p=!!value;break;case"varsetrules":"onfocus"in value&&(h.onfocus=!!value.onfocus),"onvalue"in value&&(h.onvalue=!!value.onvalue)}}},t=function(n,t,i){n.addEventListener?n.addEventListener(t,i,!0):n.attachEvent&&n.attachEvent("on"+t,i)},i=function(n,t,i){try{n.removeEventListener?n.removeEventListener(t,i,!0):n.detachEvent&&n.detachEvent("on"+t,i)}catch(r){}},k=function(n){n=n||window.event,n.stopPropagation&&(n.stopPropagation(),n.preventDefault());/*@cc_on@if(@_win32)n.cancelBubble=!0,n.returnValue=!1;@end@*/return!1},s=function(n){n=n||window.event;if(n.preventDefault){n.preventDefault();return}n.returnValue=!1},f=function(n,t){if(new RegExp("(^|\\s)"+t+"(\\s|$)").test(n.className))return;n.className+=(n.className?" ":"")+t},u=function(n,t){n.className=t?n.className.replace(new RegExp("(^|\\s)"+t+"(\\s|$)")," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""):""},ct=function(){var i={},t;for(t in n)i[t]=n[t].getValueSet();return i},st=function(t,i){n[t].setValueSet(!!i)},e=function(t){return!!(t in n&&n.hasOwnProperty(t))},vt=function(t){if(!t||!t.inp||!t.inp.tagName||t.inp.tagName.search(/^input|select/i)==-1)return!1;t.html5Shim=!1;if(t.inp.tagName.toLowerCase()=="select"){if(t.inp.options.length<2)return!1;t.min=0,t.max=t.inp.options.length-1,t.step=1,t.precision=0,t.scale=!1,t.forceValue=!0}else{if(String(t.inp.type).search(/^(text|range)$/i)==-1)return!1;t.min=t.min&&String(t.min).search(v)!=-1?+t.min:0,t.max=t.max&&String(t.max).search(v)!=-1?+t.max:100,t.step=t.step&&String(t.step).search(b)!=-1?t.step:1,t.precision=t.precision&&String(t.precision).search(/^[0-9]+$/)!=-1?t.precision:String(t.step).search(/\.([0-9]+)$/)!=-1?String(t.step).match(/\.([0-9]+)$/)[1].length:0,t.scale=t.scale||!1,t.forceValue="forceValue"in t?!!t.forceValue:!1,t.userSnap="userSnap"in t?!!t.userSnap:!1}return t.ariaFormat="ariaFormat"in t&&typeof t.ariaFormat=="function"?t.ariaFormat:!1,t.maxStep=t.maxStep&&String(t.maxStep).search(b)!=-1?+t.maxStep:+t.step*2,t.classNames=t.classNames||"",t.callbacks=t.callbacks||!1,a(t.inp.id),n[t.inp.id]=new ut(t),!0},r=function(n,t){return n.getAttribute(t)||""},l=function(){for(var e=document.getElementsByTagName("input"),i,u,t,f=0;t=e[f];f++)if(t.tagName.toLowerCase()=="input"&&r(t,"type")&&r(t,"type").toLowerCase()=="range"&&(r(t,"min")&&r(t,"min").search(v)!=-1||r(t,"max")&&r(t,"max").search(v)!=-1||r(t,"step")&&r(t,"step").search(/^(any|([0-9]+(\.[0-9]+){0,1}))$/i)!=-1)){if(t.id&&document.getElementById("fd-slider-"+t.id))continue;else t.id&&!document.getElementById("fd-slider-"+t.id)&&a(t.id);t.id||(t.id="fd-slider-form-elem-"+lt++),i={inp:t,callbacks:[],animation:ft,vertical:r(t,"data-fd-slider-vertical")?!0:t.offsetHeight>t.offsetWidth,classNames:r(t,"data-fd-slider-vertical"),html5Shim:!0},i.vertical&&!r(t,"data-fd-slider-vertical")&&(i.inpHeight=t.offsetHeight),u=g(t),i.min=u.min,i.max=u.max,i.step=u.step,i.precision=String(i.step).search(/\.([0-9]+)$/)!=-1?String(i.step).match(/\.([0-9]+)$/)[1].length:0,i.maxStep=i.step*2,a(i.inp.id),n[i.inp.id]=new ut(i)}return!0},g=function(n){return{min:+(r(n,"min")||0),max:+(r(n,"max")||100),step:+(r(n,"step").search(b)!=-1?n.getAttribute("step"):1)}},a=function(t){return t in n&&n.hasOwnProperty(t)?(n[t].destroy(),delete n[t],!0):!1},tt=function(){for(var i in n)n.hasOwnProperty(i)&&n[i].destroy();n=[]},at=function(){tt(),n=null},d=function(){for(var i in n)n.hasOwnProperty(i)&&n[i].onResize()},et=function(){for(var t in n)n.hasOwnProperty(t)&&n[t].rescan()},ht=function(){nt(),l()},nt=function(){i(window,"load",l)};t(window,"load",l),t(window,"load",function(){setTimeout(function(){var t;for(t in n)n[t].checkValue()},0)}),t(window,"resize",d),t(window,"unload",at),(function(){var t=document.getElementsByTagName("script"),n=ot(String(t[t.length-1].innerHTML).replace(/[\n\r\s\t]+/g," ").replace(/^\s+/,"").replace(/\s+$/,""));typeof n!="object"||"err"in n||it(n)})();/*@if(@_jscript_version<9)f(document.documentElement,"oldie");@end@*/return{rescanDocument:l,createSlider:function(n){return vt(n)},onDomReady:function(){ht()},destroyAll:function(){tt()},destroySlider:function(n){return a(n)},redrawAll:function(){d()},addEvent:t,removeEvent:i,stopEvent:k,increment:function(t,i){if(!e(t))return!1;n[t].increment(i)},stepUp:function(t,i){if(!e(t))return!1;n[t].stepUp(Math.abs(i)||1)},stepDown:function(t,i){if(!e(t))return!1;n[t].stepDown(-Math.abs(i)||-1)},setRange:function(t,i,r){if(!e(t))return!1;n[t].setRange(i,r)},updateSlider:function(t){if(!e(t))return!1;n[t].onResize(),n[t].reset()},disable:function(t){if(!e(t))return!1;n[t].disable()},enable:function(t){if(!e(t))return!1;n[t].enable()},getValueSet:function(){return ct()},setValueSet:function(n,t){if(!e(id))return!1;st(n,t)},setGlobalVariables:function(n){it(n)},removeOnload:function(){nt()},rescanAttributes:et}}() \ No newline at end of file diff --git a/src/resources/js/gauge.min.js b/src/resources/js/gauge.min.js new file mode 100644 index 0000000..733d502 --- /dev/null +++ b/src/resources/js/gauge.min.js @@ -0,0 +1 @@ +(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q={}.hasOwnProperty,r=function(a,b){function c(){this.constructor=a}for(var d in b)q.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};!function(){var a,b,c,d,e,f,g;for(g=["ms","moz","webkit","o"],c=0,e=g.length;e>c&&(f=g[c],!window.requestAnimationFrame);c++)window.requestAnimationFrame=window[f+"RequestAnimationFrame"],window.cancelAnimationFrame=window[f+"CancelAnimationFrame"]||window[f+"CancelRequestAnimationFrame"];return a=null,d=0,b={},requestAnimationFrame?window.cancelAnimationFrame?void 0:(a=window.requestAnimationFrame,window.requestAnimationFrame=function(c,e){var f;return f=++d,a(function(){return b[f]?void 0:c()},e),f},window.cancelAnimationFrame=function(a){return b[a]=!0}):(window.requestAnimationFrame=function(a,b){var c,d,e,f;return c=(new Date).getTime(),f=Math.max(0,16-(c-e)),d=window.setTimeout(function(){return a(c+f)},f),e=c+f,d},window.cancelAnimationFrame=function(a){return clearTimeout(a)})}(),String.prototype.hashCode=function(){var a,b,c,d,e;if(b=0,0===this.length)return b;for(c=d=0,e=this.length;e>=0?e>d:d>e;c=e>=0?++d:--d)a=this.charCodeAt(c),b=(b<<5)-b+a,b&=b;return b},o=function(a){var b,c;for(b=Math.floor(a/3600),c=Math.floor((a-3600*b)/60),a-=3600*b+60*c,a+="",c+="";c.length<2;)c="0"+c;for(;a.length<2;)a="0"+a;return b=b?b+":":"",b+c+":"+a},m=function(a){return k(a.toFixed(0))},p=function(a,b){var c,d;for(c in b)q.call(b,c)&&(d=b[c],a[c]=d);return a},n=function(a,b){var c,d,e;d={};for(c in a)q.call(a,c)&&(e=a[c],d[c]=e);for(c in b)q.call(b,c)&&(e=b[c],d[c]=e);return d},k=function(a){var b,c,d,e;for(a+="",c=a.split("."),d=c[0],e="",c.length>1&&(e="."+c[1]),b=/(\d+)(\d{3})/;b.test(d);)d=d.replace(b,"$1,$2");return d+e},l=function(a){return"#"===a.charAt(0)?a.substring(1,7):a},j=function(){function a(a,b){null==a&&(a=!0),this.clear=null!=b?b:!0,a&&AnimationUpdater.add(this)}return a.prototype.animationSpeed=32,a.prototype.update=function(a){var b;return null==a&&(a=!1),a||this.displayedValue!==this.value?(this.ctx&&this.clear&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),b=this.value-this.displayedValue,Math.abs(b/this.animationSpeed)<=.001?this.displayedValue=this.value:this.displayedValue=this.displayedValue+b/this.animationSpeed,this.render(),!0):!1},a}(),e=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return r(b,a),b.prototype.displayScale=1,b.prototype.setTextField=function(a){return this.textField=a instanceof i?a:new i(a)},b.prototype.setMinValue=function(a,b){var c,d,e,f,g;if(this.minValue=a,null==b&&(b=!0),b){for(this.displayedValue=this.minValue,f=this.gp||[],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.displayedValue=this.minValue);return g}},b.prototype.setOptions=function(a){return null==a&&(a=null),this.options=n(this.options,a),this.textField&&(this.textField.el.style.fontSize=a.fontSize+"px"),this.options.angle>.5&&(this.gauge.options.angle=.5),this.configDisplayScale(),this},b.prototype.configDisplayScale=function(){var a,b,c,d,e;return d=this.displayScale,this.options.highDpiSupport===!1?delete this.displayScale:(b=window.devicePixelRatio||1,a=this.ctx.webkitBackingStorePixelRatio||this.ctx.mozBackingStorePixelRatio||this.ctx.msBackingStorePixelRatio||this.ctx.oBackingStorePixelRatio||this.ctx.backingStorePixelRatio||1,this.displayScale=b/a),this.displayScale!==d&&(e=this.canvas.G__width||this.canvas.width,c=this.canvas.G__height||this.canvas.height,this.canvas.width=e*this.displayScale,this.canvas.height=c*this.displayScale,this.canvas.style.width=e+"px",this.canvas.style.height=c+"px",this.canvas.G__width=e,this.canvas.G__height=c),this},b}(j),i=function(){function a(a){this.el=a}return a.prototype.render=function(a){return this.el.innerHTML=m(a.displayedValue)},a}(),a=function(a){function b(a,b){this.elem=a,this.text=null!=b?b:!1,this.value=1*this.elem.innerHTML,this.text&&(this.value=0)}return r(b,a),b.prototype.displayedValue=0,b.prototype.value=0,b.prototype.setVal=function(a){return this.value=1*a},b.prototype.render=function(){var a;return a=this.text?o(this.displayedValue.toFixed(0)):k(m(this.displayedValue)),this.elem.innerHTML=a},b}(j),b={create:function(b){var c,d,e,f;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(new a(c));return f}},h=function(a){function b(a){this.gauge=a,this.ctx=this.gauge.ctx,this.canvas=this.gauge.canvas,b.__super__.constructor.call(this,!1,!1),this.setOptions()}return r(b,a),b.prototype.displayedValue=0,b.prototype.value=0,b.prototype.options={strokeWidth:.035,length:.1,color:"#000000"},b.prototype.setOptions=function(a){return null==a&&(a=null),p(this.options,a),this.length=this.canvas.height*this.options.length,this.strokeWidth=this.canvas.height*this.options.strokeWidth,this.maxValue=this.gauge.maxValue,this.minValue=this.gauge.minValue,this.animationSpeed=this.gauge.animationSpeed,this.options.angle=this.gauge.options.angle},b.prototype.render=function(){var a,b,c,d,e,f,g,h,i;return a=this.gauge.getAngle.call(this,this.displayedValue),b=this.canvas.width/2,c=.9*this.canvas.height,h=Math.round(b+this.length*Math.cos(a)),i=Math.round(c+this.length*Math.sin(a)),f=Math.round(b+this.strokeWidth*Math.cos(a-Math.PI/2)),g=Math.round(c+this.strokeWidth*Math.sin(a-Math.PI/2)),d=Math.round(b+this.strokeWidth*Math.cos(a+Math.PI/2)),e=Math.round(c+this.strokeWidth*Math.sin(a+Math.PI/2)),this.ctx.fillStyle=this.options.color,this.ctx.beginPath(),this.ctx.arc(b,c,this.strokeWidth,0,2*Math.PI,!0),this.ctx.fill(),this.ctx.beginPath(),this.ctx.moveTo(f,g),this.ctx.lineTo(h,i),this.ctx.lineTo(d,e),this.ctx.fill()},b}(j),c=function(){function a(a){this.elem=a}return a.prototype.updateValues=function(a){return this.value=a[0],this.maxValue=a[1],this.avgValue=a[2],this.render()},a.prototype.render=function(){var a,b;return this.textField&&this.textField.text(m(this.value)),0===this.maxValue&&(this.maxValue=2*this.avgValue),b=this.value/this.maxValue*100,a=this.avgValue/this.maxValue*100,$(".bar-value",this.elem).css({width:b+"%"}),$(".typical-value",this.elem).css({width:a+"%"})},a}(),g=function(a){function b(a){this.canvas=a,b.__super__.constructor.call(this),this.percentColors=null,"undefined"!=typeof G_vmlCanvasManager&&(this.canvas=window.G_vmlCanvasManager.initElement(this.canvas)),this.ctx=this.canvas.getContext("2d"),this.gp=[new h(this)],this.setOptions(),this.render()}return r(b,a),b.prototype.elem=null,b.prototype.value=[20],b.prototype.maxValue=80,b.prototype.minValue=0,b.prototype.displayedAngle=0,b.prototype.displayedValue=0,b.prototype.lineWidth=40,b.prototype.paddingBottom=.1,b.prototype.percentColors=null,b.prototype.options={colorStart:"#6fadcf",colorStop:void 0,gradientType:0,strokeColor:"#e0e0e0",pointer:{length:.8,strokeWidth:.035},angle:.15,lineWidth:.44,fontSize:40,limitMax:!1},b.prototype.setOptions=function(a){var c,d,e,f;for(null==a&&(a=null),b.__super__.setOptions.call(this,a),this.configPercentColors(),this.lineWidth=this.canvas.height*(1-this.paddingBottom)*this.options.lineWidth,this.radius=this.canvas.height*(1-this.paddingBottom)-this.lineWidth,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.render(),f=this.gp,d=0,e=f.length;e>d;d++)c=f[d],c.setOptions(this.options.pointer),c.render();return this},b.prototype.configPercentColors=function(){var a,b,c,d,e,f,g;if(this.percentColors=null,void 0!==this.options.percentColors){for(this.percentColors=new Array,f=[],c=d=0,e=this.options.percentColors.length-1;e>=0?e>=d:d>=e;c=e>=0?++d:--d)g=parseInt(l(this.options.percentColors[c][1]).substring(0,2),16),b=parseInt(l(this.options.percentColors[c][1]).substring(2,4),16),a=parseInt(l(this.options.percentColors[c][1]).substring(4,6),16),f.push(this.percentColors[c]={pct:this.options.percentColors[c][0],color:{r:g,g:b,b:a}});return f}},b.prototype.set=function(a){var b,c,d,e,f,g,i;if(a instanceof Array||(a=[a]),a.length>this.gp.length)for(b=c=0,g=a.length-this.gp.length;g>=0?g>c:c>g;b=g>=0?++c:--c)this.gp.push(new h(this));for(b=0,f=!1,d=0,e=a.length;e>d;d++)i=a[d],i>this.maxValue&&(this.maxValue=1.1*this.value,f=!0),this.gp[b].value=i,this.gp[b++].setOptions({maxValue:this.maxValue,angle:this.options.angle});return this.value=a[a.length-1],f&&this.options.limitMax?void 0:AnimationUpdater.run()},b.prototype.getAngle=function(a){return(1+this.options.angle)*Math.PI+(a-this.minValue)/(this.maxValue-this.minValue)*(1-2*this.options.angle)*Math.PI},b.prototype.getColorForPercentage=function(a,b){var c,d,e,f,g,h,i;if(0===a)c=this.percentColors[0].color;else for(c=this.percentColors[this.percentColors.length-1].color,e=f=0,h=this.percentColors.length-1;h>=0?h>=f:f>=h;e=h>=0?++f:--f)if(a<=this.percentColors[e].pct){b===!0?(i=this.percentColors[e-1],d=this.percentColors[e],g=(a-i.pct)/(d.pct-i.pct),c={r:Math.floor(i.color.r*(1-g)+d.color.r*g),g:Math.floor(i.color.g*(1-g)+d.color.g*g),b:Math.floor(i.color.b*(1-g)+d.color.b*g)}):c=this.percentColors[e].color;break}return"rgb("+[c.r,c.g,c.b].join(",")+")"},b.prototype.getColorForValue=function(a,b){var c;return c=(a-this.minValue)/(this.maxValue-this.minValue),this.getColorForPercentage(c,b)},b.prototype.render=function(){var a,b,c,d,e,f,g,h,i;for(i=this.canvas.width/2,d=this.canvas.height*(1-this.paddingBottom),a=this.getAngle(this.displayedValue),this.textField&&this.textField.render(this),this.ctx.lineCap="butt",void 0!==this.options.customFillStyle?b=this.options.customFillStyle(this):null!==this.percentColors?b=this.getColorForValue(this.displayedValue,!0):void 0!==this.options.colorStop?(b=0===this.options.gradientType?this.ctx.createRadialGradient(i,d,9,i,d,70):this.ctx.createLinearGradient(0,0,i,0),b.addColorStop(0,this.options.colorStart),b.addColorStop(1,this.options.colorStop)):b=this.options.colorStart,this.ctx.strokeStyle=b,this.ctx.beginPath(),this.ctx.arc(i,d,this.radius,(1+this.options.angle)*Math.PI,a,!1),this.ctx.lineWidth=this.lineWidth,this.ctx.stroke(),this.ctx.strokeStyle=this.options.strokeColor,this.ctx.beginPath(),this.ctx.arc(i,d,this.radius,a,(2-this.options.angle)*Math.PI,!1),this.ctx.stroke(),g=this.gp,h=[],e=0,f=g.length;f>e;e++)c=g[e],h.push(c.update(!0));return h},b}(e),d=function(a){function b(a){this.canvas=a,b.__super__.constructor.call(this),"undefined"!=typeof G_vmlCanvasManager&&(this.canvas=window.G_vmlCanvasManager.initElement(this.canvas)),this.ctx=this.canvas.getContext("2d"),this.setOptions(),this.render()}return r(b,a),b.prototype.lineWidth=15,b.prototype.displayedValue=0,b.prototype.value=33,b.prototype.maxValue=80,b.prototype.minValue=0,b.prototype.options={lineWidth:.1,colorStart:"#6f6ea0",colorStop:"#c0c0db",strokeColor:"#eeeeee",shadowColor:"#d5d5d5",angle:.35},b.prototype.getAngle=function(a){return(1-this.options.angle)*Math.PI+(a-this.minValue)/(this.maxValue-this.minValue)*(2+this.options.angle-(1-this.options.angle))*Math.PI},b.prototype.setOptions=function(a){return null==a&&(a=null),b.__super__.setOptions.call(this,a),this.lineWidth=this.canvas.height*this.options.lineWidth,this.radius=this.canvas.height/2-this.lineWidth/2,this},b.prototype.set=function(a){return this.value=a,this.value>this.maxValue&&(this.maxValue=1.1*this.value),AnimationUpdater.run()},b.prototype.render=function(){var a,b,c,d,e,f;return a=this.getAngle(this.displayedValue),f=this.canvas.width/2,c=this.canvas.height/2,this.textField&&this.textField.render(this),b=this.ctx.createRadialGradient(f,c,39,f,c,70),b.addColorStop(0,this.options.colorStart),b.addColorStop(1,this.options.colorStop),d=this.radius-this.lineWidth/2,e=this.radius+this.lineWidth/2,this.ctx.strokeStyle=this.options.strokeColor,this.ctx.beginPath(),this.ctx.arc(f,c,this.radius,(1-this.options.angle)*Math.PI,(2+this.options.angle)*Math.PI,!1),this.ctx.lineWidth=this.lineWidth,this.ctx.lineCap="round",this.ctx.stroke(),this.ctx.strokeStyle=b,this.ctx.beginPath(),this.ctx.arc(f,c,this.radius,(1-this.options.angle)*Math.PI,a,!1),this.ctx.stroke()},b}(e),f=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return r(b,a),b.prototype.strokeGradient=function(a,b,c,d){var e;return e=this.ctx.createRadialGradient(a,b,c,a,b,d),e.addColorStop(0,this.options.shadowColor),e.addColorStop(.12,this.options._orgStrokeColor),e.addColorStop(.88,this.options._orgStrokeColor),e.addColorStop(1,this.options.shadowColor),e},b.prototype.setOptions=function(a){var c,d,e,f;return null==a&&(a=null),b.__super__.setOptions.call(this,a),f=this.canvas.width/2,c=this.canvas.height/2,d=this.radius-this.lineWidth/2,e=this.radius+this.lineWidth/2,this.options._orgStrokeColor=this.options.strokeColor,this.options.strokeColor=this.strokeGradient(f,c,d,e),this},b}(d),window.AnimationUpdater={elements:[],animId:null,addAll:function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(AnimationUpdater.elements.push(b));return e},add:function(a){return AnimationUpdater.elements.push(a)},run:function(){var a,b,c,d,e;for(a=!0,e=AnimationUpdater.elements,c=0,d=e.length;d>c;c++)b=e[c],b.update()&&(a=!1);return a?cancelAnimationFrame(AnimationUpdater.animId):AnimationUpdater.animId=requestAnimationFrame(AnimationUpdater.run)}},"function"==typeof window.define&&null!=window.define.amd?define(function(){return{Gauge:g,Donut:f,BaseDonut:d,TextRenderer:i}}):"undefined"!=typeof module&&null!=module.exports?module.exports={Gauge:g,Donut:f,BaseDonut:d,TextRenderer:i}:(window.Gauge=g,window.Donut=f,window.BaseDonut=d,window.TextRenderer=i)}).call(this); \ No newline at end of file diff --git a/src/resources/js/socket.io.js b/src/resources/js/socket.io.js new file mode 100644 index 0000000..e43c4ad --- /dev/null +++ b/src/resources/js/socket.io.js @@ -0,0 +1,3 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.io=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&!this.encoding){var pack=this.packetBuffer.shift();this.packet(pack)}};Manager.prototype.cleanup=function(){var sub;while(sub=this.subs.shift())sub.destroy();this.packetBuffer=[];this.encoding=false;this.decoder.destroy()};Manager.prototype.close=Manager.prototype.disconnect=function(){this.skipReconnect=true;this.backoff.reset();this.readyState="closed";this.engine&&this.engine.close()};Manager.prototype.onclose=function(reason){debug("close");this.cleanup();this.backoff.reset();this.readyState="closed";this.emit("close",reason);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};Manager.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var self=this;if(this.backoff.attempts>=this._reconnectionAttempts){debug("reconnect failed");this.backoff.reset();this.emitAll("reconnect_failed");this.reconnecting=false}else{var delay=this.backoff.duration();debug("will wait %dms before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout(function(){if(self.skipReconnect)return;debug("attempting reconnect");self.emitAll("reconnect_attempt",self.backoff.attempts);self.emitAll("reconnecting",self.backoff.attempts);if(self.skipReconnect)return;self.open(function(err){if(err){debug("reconnect attempt error");self.reconnecting=false;self.reconnect();self.emitAll("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}})},delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.backoff.attempts;this.reconnecting=false;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",attempt)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(_dereq_,module,exports){module.exports=on;function on(obj,ev,fn){obj.on(ev,fn);return{destroy:function(){obj.removeListener(ev,fn)}}}},{}],5:[function(_dereq_,module,exports){var parser=_dereq_("socket.io-parser");var Emitter=_dereq_("component-emitter");var toArray=_dereq_("to-array");var on=_dereq_("./on");var bind=_dereq_("component-bind");var debug=_dereq_("debug")("socket.io-client:socket");var hasBin=_dereq_("has-binary");module.exports=exports=Socket;var events={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1};var emit=Emitter.prototype.emit;function Socket(io,nsp){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};if(this.io.autoConnect)this.open();this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true}Emitter(Socket.prototype);Socket.prototype.subEvents=function(){if(this.subs)return;var io=this.io;this.subs=[on(io,"open",bind(this,"onopen")),on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose"))]};Socket.prototype.open=Socket.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();return this};Socket.prototype.send=function(){var args=toArray(arguments);args.unshift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(events.hasOwnProperty(ev)){emit.apply(this,arguments);return this}var args=toArray(arguments);var parserType=parser.EVENT;if(hasBin(args)){parserType=parser.BINARY_EVENT}var packet={type:parserType,data:args};if("function"==typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}if(this.connected){this.packet(packet)}else{this.sendBuffer.push(packet)}return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.packet(packet)};Socket.prototype.onopen=function(){debug("transport is open - connecting");if("/"!=this.nsp){this.packet({type:parser.CONNECT})}};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.connected=false;this.disconnected=true;delete this.id;this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){if(packet.nsp!=this.nsp)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.BINARY_EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.BINARY_ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(null!=packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.receiveBuffer.push(args)}};Socket.prototype.ack=function(id){var self=this;var sent=false;return function(){if(sent)return;sent=true;var args=toArray(arguments);debug("sending ack %j",args);var type=hasBin(args)?parser.BINARY_ACK:parser.ACK;self.packet({type:type,id:id,data:args})}};Socket.prototype.onack=function(packet){debug("calling ack %s with %j",packet.id,packet.data);var fn=this.acks[packet.id];fn.apply(this,packet.data);delete this.acks[packet.id]};Socket.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};Socket.prototype.emitBuffered=function(){var i;for(i=0;i0&&opts.jitter<=1?opts.jitter:0;this.attempts=0}Backoff.prototype.duration=function(){var ms=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var rand=Math.random();var deviation=Math.floor(rand*this.jitter*ms);ms=(Math.floor(rand*10)&1)==0?ms-deviation:ms+deviation}return Math.min(ms,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(min){this.ms=min};Backoff.prototype.setMax=function(max){this.max=max};Backoff.prototype.setJitter=function(jitter){this.jitter=jitter}},{}],8:[function(_dereq_,module,exports){var slice=[].slice;module.exports=function(obj,fn){if("string"==typeof fn)fn=obj[fn];if("function"!=typeof fn)throw new Error("bind() requires a function");var args=slice.call(arguments,2);return function(){return fn.apply(obj,args.concat(slice.call(arguments)))}}},{}],9:[function(_dereq_,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){var self=this;this._callbacks=this._callbacks||{};function on(){self.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}var cb;for(var i=0;i=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i';iframe=document.createElement(html)}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId;iframe.src="javascript:0"}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();data=data.replace(rEscapedNewline,"\\\n");this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(_dereq_,module,exports){(function(global){var XMLHttpRequest=_dereq_("xmlhttprequest");var Polling=_dereq_("./polling");var Emitter=_dereq_("component-emitter");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling-xhr");module.exports=XHR;module.exports.Request=Request;function empty(){}function XHR(opts){Polling.call(this,opts);if(global.location){var isSSL="https:"==location.protocol;var port=location.port;if(!port){port=isSSL?443:80}this.xd=opts.hostname!=global.location.hostname||port!=opts.port;this.xs=opts.secure!=isSSL}}inherit(XHR,Polling);XHR.prototype.supportsBinary=true;XHR.prototype.request=function(opts){opts=opts||{};opts.uri=this.uri();opts.xd=this.xd;opts.xs=this.xs;opts.agent=this.agent||false;opts.supportsBinary=this.supportsBinary;opts.enablesXDR=this.enablesXDR;opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;return new Request(opts)};XHR.prototype.doWrite=function(data,fn){var isBinary=typeof data!=="string"&&data!==undefined;var req=this.request({method:"POST",data:data,isBinary:isBinary});var self=this;req.on("success",fn);req.on("error",function(err){self.onError("xhr post error",err)});this.sendXhr=req};XHR.prototype.doPoll=function(){debug("xhr poll");var req=this.request();var self=this;req.on("data",function(data){self.onData(data)});req.on("error",function(err){self.onError("xhr poll error",err)});this.pollXhr=req};function Request(opts){this.method=opts.method||"GET";this.uri=opts.uri;this.xd=!!opts.xd;this.xs=!!opts.xs;this.async=false!==opts.async;this.data=undefined!=opts.data?opts.data:null;this.agent=opts.agent;this.isBinary=opts.isBinary;this.supportsBinary=opts.supportsBinary;this.enablesXDR=opts.enablesXDR;this.pfx=opts.pfx;this.key=opts.key;this.passphrase=opts.passphrase;this.cert=opts.cert;this.ca=opts.ca;this.ciphers=opts.ciphers;this.rejectUnauthorized=opts.rejectUnauthorized;this.create()}Emitter(Request.prototype);Request.prototype.create=function(){var opts={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;var xhr=this.xhr=new XMLHttpRequest(opts);var self=this;try{debug("xhr open %s: %s",this.method,this.uri);xhr.open(this.method,this.uri,this.async);if(this.supportsBinary){xhr.responseType="arraybuffer"}if("POST"==this.method){try{if(this.isBinary){xhr.setRequestHeader("Content-type","application/octet-stream")}else{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(e){}}if("withCredentials"in xhr){xhr.withCredentials=true}if(this.hasXDR()){xhr.onload=function(){self.onLoad()};xhr.onerror=function(){self.onError(xhr.responseText)}}else{xhr.onreadystatechange=function(){if(4!=xhr.readyState)return;if(200==xhr.status||1223==xhr.status){self.onLoad()}else{setTimeout(function(){self.onError(xhr.status)},0)}}}debug("xhr data %s",this.data);xhr.send(this.data)}catch(e){setTimeout(function(){self.onError(e)},0);return}if(global.document){this.index=Request.requestsCount++;Request.requests[this.index]=this}};Request.prototype.onSuccess=function(){this.emit("success");this.cleanup()};Request.prototype.onData=function(data){this.emit("data",data);this.onSuccess()};Request.prototype.onError=function(err){this.emit("error",err);this.cleanup(true)};Request.prototype.cleanup=function(fromError){if("undefined"==typeof this.xhr||null===this.xhr){return}if(this.hasXDR()){this.xhr.onload=this.xhr.onerror=empty}else{this.xhr.onreadystatechange=empty}if(fromError){try{this.xhr.abort()}catch(e){}}if(global.document){delete Request.requests[this.index]}this.xhr=null};Request.prototype.onLoad=function(){var data;try{var contentType;try{contentType=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(e){}if(contentType==="application/octet-stream"){data=this.xhr.response}else{if(!this.supportsBinary){data=this.xhr.responseText}else{data="ok"}}}catch(e){this.onError(e)}if(null!=data){this.onData(data)}};Request.prototype.hasXDR=function(){return"undefined"!==typeof global.XDomainRequest&&!this.xs&&this.enablesXDR};Request.prototype.abort=function(){this.cleanup()};if(global.document){Request.requestsCount=0;Request.requests={};if(global.attachEvent){global.attachEvent("onunload",unloadHandler)}else if(global.addEventListener){global.addEventListener("beforeunload",unloadHandler,false)}}function unloadHandler(){for(var i in Request.requests){if(Request.requests.hasOwnProperty(i)){Request.requests[i].abort()}}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(_dereq_,module,exports){var Transport=_dereq_("../transport");var parseqs=_dereq_("parseqs");var parser=_dereq_("engine.io-parser");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling");module.exports=Polling;var hasXHR2=function(){var XMLHttpRequest=_dereq_("xmlhttprequest");var xhr=new XMLHttpRequest({xdomain:false});return null!=xhr.responseType}();function Polling(opts){var forceBase64=opts&&opts.forceBase64;if(!hasXHR2||forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(Polling,Transport);Polling.prototype.name="polling";Polling.prototype.doOpen=function(){this.poll()};Polling.prototype.pause=function(onPause){var pending=0;var self=this;this.readyState="pausing";function pause(){debug("paused");self.readyState="paused";onPause()}if(this.polling||!this.writable){var total=0;if(this.polling){debug("we are currently polling - waiting to pause");total++;this.once("pollComplete",function(){debug("pre-pause polling complete");--total||pause()})}if(!this.writable){debug("we are currently writing - waiting to pause");total++;this.once("drain",function(){debug("pre-pause writing complete");--total||pause()})}}else{pause()}};Polling.prototype.poll=function(){debug("polling");this.polling=true;this.doPoll();this.emit("poll")};Polling.prototype.onData=function(data){var self=this;debug("polling got data %s",data);var callback=function(packet,index,total){if("opening"==self.readyState){self.onOpen()}if("close"==packet.type){self.onClose();return false}self.onPacket(packet)};parser.decodePayload(data,this.socket.binaryType,callback);if("closed"!=this.readyState){this.polling=false;this.emit("pollComplete");if("open"==this.readyState){this.poll()}else{debug('ignoring poll - transport state "%s"',this.readyState)}}};Polling.prototype.doClose=function(){var self=this;function close(){debug("writing close packet");self.write([{type:"close"}])}if("open"==this.readyState){debug("transport open - closing");close()}else{debug("transport not open - deferring close");this.once("open",close)}};Polling.prototype.write=function(packets){var self=this;this.writable=false;var callbackfn=function(){self.writable=true;self.emit("drain")};var self=this;parser.encodePayload(packets,this.supportsBinary,function(data){self.doWrite(data,callbackfn)})};Polling.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"https":"http";var port="";if(false!==this.timestampRequests){query[this.timestampParam]=+new Date+"-"+Transport.timestamps++}if(!this.supportsBinary&&!query.sid){query.b64=1}query=parseqs.encode(query);if(this.port&&("https"==schema&&this.port!=443||"http"==schema&&this.port!=80)){port=":"+this.port}if(query.length){query="?"+query}return schema+"://"+this.hostname+port+this.path+query}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(_dereq_,module,exports){var Transport=_dereq_("../transport");var parser=_dereq_("engine.io-parser");var parseqs=_dereq_("parseqs");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:websocket");var WebSocket=_dereq_("ws");module.exports=WS;function WS(opts){var forceBase64=opts&&opts.forceBase64;if(forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(WS,Transport);WS.prototype.name="websocket";WS.prototype.supportsBinary=true;WS.prototype.doOpen=function(){if(!this.check()){return}var self=this;var uri=this.uri();var protocols=void 0;var opts={agent:this.agent};opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;this.ws=new WebSocket(uri,protocols,opts);if(this.ws.binaryType===undefined){this.supportsBinary=false}this.ws.binaryType="arraybuffer";this.addEventListeners()};WS.prototype.addEventListeners=function(){var self=this;this.ws.onopen=function(){self.onOpen()};this.ws.onclose=function(){self.onClose()};this.ws.onmessage=function(ev){self.onData(ev.data)};this.ws.onerror=function(e){self.onError("websocket error",e)}};if("undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)){WS.prototype.onData=function(data){var self=this;setTimeout(function(){Transport.prototype.onData.call(self,data)},0)}}WS.prototype.write=function(packets){var self=this;this.writable=false;for(var i=0,l=packets.length;i=31}exports.formatters.j=function(v){return JSON.stringify(v)};function formatArgs(){var args=arguments;var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return args;var c="color: "+this.color;args=[args[0],c,"color: inherit"].concat(Array.prototype.slice.call(args,1));var index=0;var lastC=0;args[0].replace(/%[a-z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c);return args}function log(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){localStorage.removeItem("debug")}else{localStorage.debug=namespaces}}catch(e){}}function load(){var r;try{r=localStorage.debug}catch(e){}return r}exports.enable(load())},{"./debug":23}],23:[function(_dereq_,module,exports){exports=module.exports=debug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=_dereq_("ms");exports.names=[];exports.skips=[];exports.formatters={};var prevColor=0;var prevTime;function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(namespace){function disabled(){}disabled.enabled=false;function enabled(){var self=enabled;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;if(null==self.useColors)self.useColors=exports.useColors();if(null==self.color&&self.useColors)self.color=selectColor();var args=Array.prototype.slice.call(arguments);args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args=["%o"].concat(args)}var index=0;args[0]=args[0].replace(/%([a-z%])/g,function(match,format){if(match==="%%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match});if("function"===typeof exports.formatArgs){args=exports.formatArgs.apply(self,args)}var logFn=enabled.log||exports.log||console.log.bind(console);logFn.apply(self,args)}enabled.enabled=true;var fn=exports.enabled(namespace)?enabled:disabled;fn.namespace=namespace;return fn}function enable(namespaces){exports.save(namespaces);var split=(namespaces||"").split(/[\s,]+/);var len=split.length;for(var i=0;i=d)return Math.round(ms/d)+"d";if(ms>=h)return Math.round(ms/h)+"h";if(ms>=m)return Math.round(ms/m)+"m";if(ms>=s)return Math.round(ms/s)+"s";return ms+"ms"}function long(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}}var asArray=new Uint8Array(data);var type=asArray[0];var rest=sliceBuffer(data,1);if(Blob&&binaryType==="blob"){rest=new Blob([rest])}return{type:packetslist[type],data:rest}};exports.decodeBase64Packet=function(msg,binaryType){var type=packetslist[msg.charAt(0)];if(!global.ArrayBuffer){return{type:type,data:{base64:true,data:msg.substr(1)}}}var data=base64encoder.decode(msg.substr(1));if(binaryType==="blob"&&Blob){data=new Blob([data])}return{type:type,data:data}};exports.encodePayload=function(packets,supportsBinary,callback){if(typeof supportsBinary=="function"){callback=supportsBinary;supportsBinary=null}var isBinary=hasBinary(packets);if(supportsBinary&&isBinary){if(Blob&&!dontSendBlobs){return exports.encodePayloadAsBlob(packets,callback)}return exports.encodePayloadAsArrayBuffer(packets,callback)}if(!packets.length){return callback("0:")}function setLengthHeader(message){return message.length+":"+message}function encodeOne(packet,doneCallback){exports.encodePacket(packet,!isBinary?false:supportsBinary,true,function(message){doneCallback(null,setLengthHeader(message))})}map(packets,encodeOne,function(err,results){return callback(results.join(""))})};function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function(i,el,cb){each(el,function(error,msg){result[i]=msg;cb(error,result)})};for(var i=0;i0){var tailArray=new Uint8Array(bufferTail);var isString=tailArray[0]===0;var msgLength="";for(var i=1;;i++){if(tailArray[i]==255)break;if(msgLength.length>310){numberTooLong=true;break}msgLength+=tailArray[i]}if(numberTooLong)return callback(err,0,1);bufferTail=sliceBuffer(bufferTail,2+msgLength.length);msgLength=parseInt(msgLength);var msg=sliceBuffer(bufferTail,0,msgLength);if(isString){try{msg=String.fromCharCode.apply(null,new Uint8Array(msg))}catch(e){var typed=new Uint8Array(msg);msg="";for(var i=0;ibytes){end=bytes}if(start>=bytes||start>=end||bytes===0){return new ArrayBuffer(0)}var abv=new Uint8Array(arraybuffer);var result=new Uint8Array(end-start);for(var i=start,ii=0;i>2];base64+=chars[(bytes[i]&3)<<4|bytes[i+1]>>4];base64+=chars[(bytes[i+1]&15)<<2|bytes[i+2]>>6];base64+=chars[bytes[i+2]&63]}if(len%3===2){base64=base64.substring(0,base64.length-1)+"="}else if(len%3===1){base64=base64.substring(0,base64.length-2)+"=="}return base64};exports.decode=function(base64){var bufferLength=base64.length*.75,len=base64.length,i,p=0,encoded1,encoded2,encoded3,encoded4;if(base64[base64.length-1]==="="){bufferLength--;if(base64[base64.length-2]==="="){bufferLength--}}var arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i=0;i>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(_dereq_,module,exports){(function(global){var BlobBuilder=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder;var blobSupported=function(){try{var a=new Blob(["hi"]);return a.size===2}catch(e){return false}}();var blobSupportsArrayBufferView=blobSupported&&function(){try{var b=new Blob([new Uint8Array([1,2])]);return b.size===2}catch(e){return false}}();var blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function mapArrayBufferViews(ary){for(var i=0;i=55296&&value<=56319&&counter65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}return output}function checkScalarValue(codePoint){if(codePoint>=55296&&codePoint<=57343){throw Error("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value") +}}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if((codePoint&4294967168)==0){return stringFromCharCode(codePoint)}var symbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}else if((codePoint&4294901760)==0){checkScalarValue(codePoint);symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}else if((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);return symbol}function utf8encode(string){var codePoints=ucs2decode(string);var length=codePoints.length;var index=-1;var codePoint;var byteString="";while(++index=byteCount){throw Error("Invalid byte index")}var continuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){return continuationByte&63}throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1;var byte2;var byte3;var byte4;var codePoint;if(byteIndex>byteCount){throw Error("Invalid byte index")}if(byteIndex==byteCount){return false}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){return byte1}if((byte1&224)==192){var byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){checkScalarValue(codePoint);return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&15)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){return codePoint}}throw Error("Invalid UTF-8 detected")}var byteArray;var byteCount;var byteIndex;function utf8decode(byteString){byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;var codePoints=[];var tmp;while((tmp=decodeSymbol())!==false){codePoints.push(tmp)}return ucs2encode(codePoints)}var utf8={version:"2.0.0",encode:utf8encode,decode:utf8decode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return utf8})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=utf8}else{var object={};var hasOwnProperty=object.hasOwnProperty;for(var key in utf8){hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}}}else{root.utf8=utf8}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],32:[function(_dereq_,module,exports){(function(global){var rvalidchars=/^[\],:{}\s]*$/;var rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g;var rtrimLeft=/^\s+/;var rtrimRight=/\s+$/;module.exports=function parsejson(data){if("string"!=typeof data||!data){return null}data=data.replace(rtrimLeft,"").replace(rtrimRight,"");if(global.JSON&&JSON.parse){return JSON.parse(data)}if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return new Function("return "+data)()}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],33:[function(_dereq_,module,exports){exports.encode=function(obj){var str="";for(var i in obj){if(obj.hasOwnProperty(i)){if(str.length)str+="&";str+=encodeURIComponent(i)+"="+encodeURIComponent(obj[i])}}return str};exports.decode=function(qs){var qry={};var pairs=qs.split("&");for(var i=0,l=pairs.length;i1)))/4)-floor((year-1901+month)/100)+floor((year-1601+month)/400)}}if(!(isProperty={}.hasOwnProperty)){isProperty=function(property){var members={},constructor;if((members.__proto__=null,members.__proto__={toString:1},members).toString!=getClass){isProperty=function(property){var original=this.__proto__,result=property in(this.__proto__=null,this);this.__proto__=original;return result}}else{constructor=members.constructor;isProperty=function(property){var parent=(this.constructor||constructor).prototype;return property in this&&!(property in parent&&this[property]===parent[property])}}members=null;return isProperty.call(this,property)}}var PrimitiveTypes={"boolean":1,number:1,string:1,undefined:1};var isHostType=function(object,property){var type=typeof object[property];return type=="object"?!!object[property]:!PrimitiveTypes[type]};forEach=function(object,callback){var size=0,Properties,members,property;(Properties=function(){this.valueOf=0}).prototype.valueOf=0;members=new Properties;for(property in members){if(isProperty.call(members,property)){size++}}Properties=members=null;if(!size){members=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,length;var hasProperty=!isFunction&&typeof object.constructor!="function"&&isHostType(object,"hasOwnProperty")?object.hasOwnProperty:isProperty;for(property in object){if(!(isFunction&&property=="prototype")&&hasProperty.call(object,property)){callback(property)}}for(length=members.length;property=members[--length];hasProperty.call(object,property)&&callback(property));}}else if(size==2){forEach=function(object,callback){var members={},isFunction=getClass.call(object)==functionClass,property;for(property in object){if(!(isFunction&&property=="prototype")&&!isProperty.call(members,property)&&(members[property]=1)&&isProperty.call(object,property)){callback(property)}}}}else{forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,isConstructor;for(property in object){if(!(isFunction&&property=="prototype")&&isProperty.call(object,property)&&!(isConstructor=property==="constructor")){callback(property)}}if(isConstructor||isProperty.call(object,property="constructor")){callback(property)}}}return forEach(object,callback)};if(!has("json-stringify")){var Escapes={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var leadingZeroes="000000";var toPaddedString=function(width,value){return(leadingZeroes+(value||0)).slice(-width)};var unicodePrefix="\\u00";var quote=function(value){var result='"',index=0,length=value.length,isLarge=length>10&&charIndexBuggy,symbols;if(isLarge){symbols=value.split("")}for(;index-1/0&&value<1/0){if(getDay){date=floor(value/864e5);for(year=floor(date/365.2425)+1970-1;getDay(year+1,0)<=date;year++);for(month=floor((date-getDay(year,0))/30.42);getDay(year,month+1)<=date;month++);date=1+date-getDay(year,month);time=(value%864e5+864e5)%864e5;hours=floor(time/36e5)%24;minutes=floor(time/6e4)%60;seconds=floor(time/1e3)%60;milliseconds=time%1e3}else{year=value.getUTCFullYear();month=value.getUTCMonth();date=value.getUTCDate();hours=value.getUTCHours();minutes=value.getUTCMinutes();seconds=value.getUTCSeconds();milliseconds=value.getUTCMilliseconds()}value=(year<=0||year>=1e4?(year<0?"-":"+")+toPaddedString(6,year<0?-year:year):toPaddedString(4,year))+"-"+toPaddedString(2,month+1)+"-"+toPaddedString(2,date)+"T"+toPaddedString(2,hours)+":"+toPaddedString(2,minutes)+":"+toPaddedString(2,seconds)+"."+toPaddedString(3,milliseconds)+"Z"}else{value=null}}else if(typeof value.toJSON=="function"&&(className!=numberClass&&className!=stringClass&&className!=arrayClass||isProperty.call(value,"toJSON"))){value=value.toJSON(property)}}if(callback){value=callback.call(object,property,value)}if(value===null){return"null"}className=getClass.call(value);if(className==booleanClass){return""+value}else if(className==numberClass){return value>-1/0&&value<1/0?""+value:"null"}else if(className==stringClass){return quote(""+value)}if(typeof value=="object"){for(length=stack.length;length--;){if(stack[length]===value){throw TypeError()}}stack.push(value);results=[];prefix=indentation;indentation+=whitespace;if(className==arrayClass){for(index=0,length=value.length;index0){for(whitespace="",width>10&&(width=10);whitespace.length=48&&charCode<=57||charCode>=97&&charCode<=102||charCode>=65&&charCode<=70)){abort()}}value+=fromCharCode("0x"+source.slice(begin,Index));break;default:abort()}}else{if(charCode==34){break}charCode=source.charCodeAt(Index);begin=Index;while(charCode>=32&&charCode!=92&&charCode!=34){charCode=source.charCodeAt(++Index)}value+=source.slice(begin,Index)}}if(source.charCodeAt(Index)==34){Index++;return value}abort();default:begin=Index;if(charCode==45){isSigned=true;charCode=source.charCodeAt(++Index)}if(charCode>=48&&charCode<=57){if(charCode==48&&(charCode=source.charCodeAt(Index+1),charCode>=48&&charCode<=57)){abort()}isSigned=false;for(;Index=48&&charCode<=57);Index++);if(source.charCodeAt(Index)==46){position=++Index;for(;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}charCode=source.charCodeAt(Index);if(charCode==101||charCode==69){charCode=source.charCodeAt(++Index);if(charCode==43||charCode==45){Index++}for(position=Index;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}return+source.slice(begin,Index)}if(isSigned){abort()}if(source.slice(Index,Index+4)=="true"){Index+=4;return true}else if(source.slice(Index,Index+5)=="false"){Index+=5;return false}else if(source.slice(Index,Index+4)=="null"){Index+=4;return null}abort()}}return"$"};var get=function(value){var results,hasMembers;if(value=="$"){abort()}if(typeof value=="string"){if((charIndexBuggy?value.charAt(0):value[0])=="@"){return value.slice(1)}if(value=="["){results=[];for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="]"){break}if(hasMembers){if(value==","){value=lex();if(value=="]"){abort()}}else{abort()}}if(value==","){abort()}results.push(get(value))}return results}else if(value=="{"){results={};for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="}"){break}if(hasMembers){if(value==","){value=lex();if(value=="}"){abort()}}else{abort()}}if(value==","||typeof value!="string"||(charIndexBuggy?value.charAt(0):value[0])!="@"||lex()!=":"){abort()}results[value.slice(1)]=get(lex())}return results}abort()}return value};var update=function(source,property,callback){var element=walk(source,property,callback);if(element===undef){delete source[property]}else{source[property]=element}};var walk=function(source,property,callback){var value=source[property],length;if(typeof value=="object"&&value){if(getClass.call(value)==arrayClass){for(length=value.length;length--;){update(value,length,callback)}}else{forEach(value,function(property){update(value,property,callback)})}}return callback.call(source,property,value)};JSON3.parse=function(source,callback){var result,value;Index=0;Source=""+source;result=get(lex());if(lex()!="$"){abort()}Index=Source=null;return callback&&getClass.call(callback)==functionClass?walk((value={},value[""]=result,value),"",callback):result}}}if(isLoader){define(function(){return JSON3})}})(this)},{}],48:[function(_dereq_,module,exports){module.exports=toArray;function toArray(list,index){var array=[];index=index||0;for(var i=index||0;i1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(t){var e=t.type,n=Array.prototype.slice.call(arguments,0);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=new t(r,this._transUrl);return i.on("message",this._transportMessage.bind(this)),i.once("close",this._transportClose.bind(this)),i.transportName=t.transportName,void(this._transport=i)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t1&&a.index=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n \f\r   ᠎              \u2028\u2029",_="​",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){e.exports=t.WebSocket||t.MozWebSocket}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))}},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1; +else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('