9?@G_-#tO#r|MX=tdAMCltM
zNrp(Y5fXjI1lL!U~cGlKME
bB7+$WS~vi$=+j#hlmPa&&Ng+{K8gPV1K=+O
diff --git a/Theme/menu_view.php b/Theme/menu_view.php
deleted file mode 100644
index 8f00d0b..0000000
--- a/Theme/menu_view.php
+++ /dev/null
@@ -1,98 +0,0 @@
-"Log In", 'path'=>"user/login", 'order' => -1 );
-?>
-
-
diff --git a/Theme/style.css b/Theme/style.css
deleted file mode 100644
index b008bbf..0000000
--- a/Theme/style.css
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
-All Emoncms code is released under the GNU Affero General Public License.
-See COPYRIGHT.txt and LICENSE.txt.
-
----------------------------------------------------------------------
-Emoncms - open source energy visualisation
-Part of the OpenEnergyMonitor project:
-http://openenergymonitor.org
-
-*/
-
-:root {
- --app-color: #ff2712;;
-}
-
-#bound {
- max-width:1200px;
- height: auto;
- text-align: left;
- background-color:#fff;
-
- padding:30px;
- margin-top:10px;
-}
-
-html, body {
- height: 100%;
- font-family: 'Ubuntu', sans-serif;
- background-color:#EEECE5;
- padding:0px;
- margin:0px;
-}
-#wrap {
- min-height: 100%;
- height: auto !important;
- height: 100%;
- /* Negative indent footer by it's height */
- margin: 0 auto -40px;
-}
-
-#login-form input[type="text"], #login-form input[type="password"] {
- width: 94%;
-}
-
-#push, #footer {
- height: 30px;
-}
-#footer {
- background-color: #f5f5f5;
- text-align: center;
- font-size: 13px;
- font-weight: bold;
- padding-top:10px;
-}
-#footer a {
- color: #77b4d9;
- text-decoration: none;
-}
-#footer span {
- color:#999;
-}
-#submenu {
- width:100%;
- background-color:#ddd;
- height:27px;
-}
-#topspacer {
- padding-top: 42px;
-}
-
-div#account {
- width:230px;
-}
-
-.account-item {
- margin-bottom:10px;
-}
-
-input[type=text][class=variable-name-edit] {
- margin-bottom:0px;
-}
-
-
-/* Copied from custom theme */
-
-h1 {
- color: var(--app-color);
-}
-
-h3 {
- color: var(--app-color);
- font-size:20px;
- line-height: 22px;
-}
-
-hr {
- background: var(--app-color);
- border: 0; height: 1px;
- margin:0px;
-}
-
-a {
- text-decoration: none;
- color:#000;
-}
-
-a:hover {
- text-decoration: none;
- color: var(--app-color);
-}
-
-#left-pane {
- width:340px;
- float:left;
-}
-
-#right-pane {
- width: auto;
- min-width:720px;
- max-width:1280px;
- overflow: hidden;
-}
-
-.side-block {
- background-color:#fff;
- padding:20px;
- margin:10px;
-
-}
-
-.side-block-2 {
- background-color:#fff;
- margin:10px;
-}
-
-.main-block {
- width:100%;
- height: auto;
- text-align: left;
- background-color:#fff;
-
- margin-top:10px;
-}
-
-
-#create-new {
- background-color:rgb(230,230,230);
- padding:10px;
- padding-left:20px;
- margin:10px;
- color:rgb(100,100,100);
- font-size: 14px;
-}
-
-.scenario-nav {
- padding:5px;
- font-size:16px;
-}
-
-.scenario-nav-heading {
- padding-top:20px;
- padding-bottom:5px;
- font-size:14px;
- font-weight:bold;
- color:#555;
-}
-
-input[type="checkbox"] {
- padding:0px;
- margin:0px;
-}
-
-/* ------------------------ */
-
-body .modal {
- /* new custom width */
- width: 1080px;
- /* must be half of the width, minus scrollbar on the left (30px) */
- margin-left: -540px;
-}
-.modal-body {
- max-height: 800px;
-}
-
-#gallery i{
- vertical-align:top;
- cursor:pointer;
-}
-
-@media (min-width: 768px) and (max-width: 979px) {
- #topspacer {
- margin-top:-20px;
- padding-top: 0px;
- }
-}
-/* Lastly, apply responsive CSS fixes as necessary */
- @media (max-width: 767px) {
- #submenu, #footer {
- margin-left: -20px;
- margin-right: -20px;
- padding-left: 20px;
- padding-right: 20px;
- }
- #topspacer {
- margin-top:-20px;
- padding-top: 0px;
- }
-}
-
- #topgraphic #measures-costs{
- text-align:right;
- margin-top:-60px
- }
-
diff --git a/Theme/theme.php b/Theme/theme.php
deleted file mode 100644
index 1993bd5..0000000
--- a/Theme/theme.php
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/core.php b/core.php
index 0b9fbcb..c512bf4 100644
--- a/core.php
+++ b/core.php
@@ -46,7 +46,7 @@ function db_check($mysqli,$database)
function controller($controller_name)
{
- $output = array('content'=>'');
+ $output = array('content'=>"#UNDEFINED#");
if ($controller_name)
{
@@ -58,11 +58,9 @@ function controller($controller_name)
$domain = "messages";
bindtextdomain($domain, "Modules/".$controller_name."/locale");
bind_textdomain_codeset($domain, 'UTF-8');
-
-
textdomain($domain);
- require $controllerScript;
+ require_once $controllerScript;
$output = $controller();
}
}
@@ -120,7 +118,7 @@ function load_db_schema()
$dir = scandir("Modules");
for ($i=2; $i$menu_left, 'right'=>$menu_right, 'dropdown'=>$menu_dropdown);
+ return array('dashboard'=>$menu_dashboard, 'left'=>$menu_left, 'dropdown'=>$menu_dropdown, 'dropdownconfig'=>$menu_dropdown_config, 'right'=>$menu_right);
}
-// Menu sort by order
-function menu_sort($a,$b) {
- return $a['order']>$b['order'];
-}
diff --git a/default.settings.php b/default.settings.php
index 0cbf070..36824dc 100644
--- a/default.settings.php
+++ b/default.settings.php
@@ -1,4 +1,5 @@
"oemreport", 'fullname'=>"OEM Report")
);
- /*
- Database connection settings
+//1 #### Mysql database settings
+ $server = "localhost";
+ $database = "emoncms";
+ $username = "_DB_USER_";
+ $password = "_DB_PASSWORD_";
+ $port = "3306";
+ // Skip database setup test - set to false once database has been setup.
+ $dbtest = true;
- */
- $username = "user";
- $password = "pass";
- $server = "localhost";
- $database = "db";
+//2 #### Redis
+ $redis_enabled = false;
+ $redis_server = array( 'host' => 'localhost',
+ 'port' => 6379,
+ 'auth' => '',
+ 'prefix' => 'emoncms');
- $redis_enabled = true;
-
+
+//3 #### MQTT
+ // The 'subscriber' topic format is rx/* - where * is the emoncms input node number.
+ // The 'publisher' topic format is user selectable from the 'Publish to MQTT' input process, for example power/solar
+ $mqtt_enabled = false; // Activate MQTT by changing to true
+ $mqtt_server = array( 'host' => 'localhost',
+ 'port' => 1883,
+ 'user' => '',
+ 'password' => '',
+ 'basetopic'=> 'emon'
+ );
+
+
+//4 #### Engine settings
$feed_settings = array(
+ // Supported engines. Uncommented engines will not be available for user to create a new feed using it. Existing feeds with a hidden engine still work.
+ // Place a ',' as the first character on all uncommented engines lines but first.
+ // If using emoncms in low-write mode, ensure that PHPFIWA is disabled by removing the leading //, from the PHPFIWA entry
+ 'engines_hidden'=>array(
+ //Engine::MYSQL // 0 Mysql traditional
+ //Engine::MYSQLMEMORY // 8 Mysql with MEMORY tables on RAM. All data is lost on shutdown
+ //Engine::PHPTIMESERIES // 2
+ //,Engine::PHPFINA // 5
+ //,Engine::PHPFIWA // 6
+ //,Engine::CASSANDRA // 10 Apache Cassandra
+ ),
+
+ // Redis Low-write mode
+ 'redisbuffer'=>array(
+ 'enabled' => false // If enabled is true, requires redis enabled and feedwriter service running
+ ,'sleep' => 600 // Number of seconds to wait before write buffer to disk - user selectable option
+ ),
+
+ 'csvdownloadlimit_mb' => 25, // Max csv download size in MB
+
+ // Engines working folder. Default is /var/lib/phpfiwa,phpfina,phptimeseries
+ // On windows or shared hosting you will likely need to specify a different data directory--
+ // Make sure that emoncms has write permission's to the datadirectory folders
'phpfiwa'=>array(
- 'datadir'=>'/var/lib/phpfiwa/'
+ 'datadir' => '/var/lib/phpfiwa/'
),
'phpfina'=>array(
- 'datadir'=>'/var/lib/phpfina/'
+ 'datadir' => '/var/lib/phpfina/'
),
'phptimeseries'=>array(
- 'datadir'=>'/var/lib/phptimeseries/'
+ 'datadir' => '/var/lib/phptimeseries/'
+ ),
+ 'cassandra'=>array(
+ 'keyspace' => 'emoncms'
)
);
+
+ // For use with emoncms module that require installation in home directory
+ // $homedir = "/home/username";
- // (OPTIONAL) Used by password reset feature
- $smtp_email_settings = array(
- 'host'=>"",
- 'username'=>"",
- 'password'=>"",
- 'from'=>array('' => '')
- );
+ // Max number of allowed different inputs per user. For limiting garbage rf data
+ $max_node_id_limit = 32;
- // To enable / disable password reset set to either true / false
- // default value of " _ENABLE_PASSWORD_RESET_ " required for .deb only
- // uncomment 1 of the 2 following lines & comment out the 3rd line.
- // $enable_password_reset = true;
- // $enable_password_reset = false;
- $enable_password_reset = false;
- /*
+//5 #### User Interface settings
+ // Theme location (folder located under Theme/, and must have the same structure as the basic one)
+ $theme = "basic";
+ // Theme colour options: "standard", "blue", "sun"
+ $themecolor = "blue";
+
+ // Favicon filenme in Theme/$theme
+ $favicon = "favicon.png";
+
+ // Use full screen width
+ $fullwidth = true;
+
+ // Main menu collapses on lower screen widths
+ $menucollapses = false;
+
+ // Enable multi user emoncms.
+ // If set to false, emoncms will automatically remove the register form and
+ // ability to create further users after the first user has been created
+ $enable_multi_user = false;
- Default router settings - in absence of stated path
+ // Enable remember me feature
+ $enable_rememberme = true;
- */
+ // Allow user to reset his password
+ $enable_password_reset = false;
+
+ // (OPTIONAL) Email SMTP, used for password reset or other email functions
+ $smtp_email_settings = array(
+ 'host'=>"smtp.gmail.com",
+ 'port'=>"465", // 25, 465, 587
+ 'from'=>array('noreply@emoncms.org' => 'EmonCMS'),
+ // comment lines below that dont apply
+ 'encryption'=>"ssl", // ssl, tls
+ 'username'=>"yourusername@gmail.com",
+ 'password'=>"yourpassword"
+ );
// Default controller and action if none are specified and user is anonymous
$default_controller = "user";
$default_action = "login";
// Default controller and action if none are specified and user is logged in
- $default_controller_auth = "assessment";
+ $default_controller_auth = "feed";
$default_action_auth = "list";
-
+
// Public profile functionality
- $public_profile_enabled = TRUE;
+ // Allows http://yourdomain.com/[username]/[dash alias] or ?id=[dash id]
+ // Alternative to http://yourdomain.com/dashboard/view?id=[dash id]
+ // Add optional '&embed=1' in the end to remove header and footer
+ $public_profile_enabled = true;
$public_profile_controller = "dashboard";
$public_profile_action = "view";
- /*
+ // Default feed viewer: "vis/auto?feedid=" or "graph/" - requires module https://github.com/emoncms/graph
+ $feedviewpath = "vis/auto?feedid=";
- Other
- */
+//6 #### Other settings
+ // Log file configuration
+ $log_enabled = true;
+ // On windows or shared hosting you will likely need to specify a different logfile directory
+ $log_filename = '/var/log/emoncms.log';
+ // Log Level: 1=INFO, 2=WARN, 3=ERROR
+ $log_level = 2;
- // Theme location
- $theme = "basic";
+ // If installed on Emonpi, allow admin menu tools
+ $allow_emonpi_admin = false;
- // Error processing
- $display_errors = TRUE;
+ //experimental feature for virtual feeds average, default is true, set to false to activate average agregation with all data points, will be slower
+ $data_sampling = false;
- // Allow user register in emoncms
- $allowusersregister = FALSE;
-
- // Enable remember me feature - needs more testing
- $enable_rememberme = TRUE;
-
- // Skip database setup test - set to false once database has been setup.
- $dbtest = TRUE;
-
- // Log4PHP configuration
- $log4php_configPath = 'logconfig.xml';
+ // Show all fatal PHP errors
+ $display_errors = true;
// CSV export options for the number of decimal_places, decimal_place_separator and field_separator
// The thousands separator is not used (specified as "nothing")
// NOTE: don't make $csv_decimal_place_separator == $csv_field_separator
// Adjust as appropriate for your location
-
// number of decimal places
$csv_decimal_places = 2;
@@ -104,3 +172,9 @@
// field separator
$csv_field_separator = ",";
+
+ // set true on docker installations
+ $allow_config_env_vars = false;
+
+ // Dont change - developer updates this when the config format changes
+ $config_file_version = "10";
diff --git a/index.php b/index.php
index 09d7e2d..5161fc0 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,4 @@
info($_GET['q']);
// 2) Database
- $mysqli = @new mysqli($server,$username,$password,$database);
-
- if (class_exists('Redis') && $redis_enabled) {
+ if ($redis_enabled) {
$redis = new Redis();
- $connected = $redis->connect("127.0.0.1");
- if (!$connected) {
- echo "Can't connect to redis database, it may be that redis-server is not installed or started see readme for redis installation"; die;
+ $connected = $redis->connect($redis_server['host'], $redis_server['port']);
+ if (!$connected) { echo "Can't connect to redis at ".$redis_server['host'].":".$redis_server['port']." , it may be that redis-server is not installed or started see readme for redis installation"; die; }
+ if (!empty($redis_server['prefix'])) $redis->setOption(Redis::OPT_PREFIX, $redis_server['prefix']);
+ if (!empty($redis_server['auth'])) {
+ if (!$redis->auth($redis_server['auth'])) {
+ echo "Can't connect to redis at ".$redis_server['host'].", autentication failed"; die;
+ }
}
} else {
$redis = false;
}
+
+ $mqtt = false;
+
+ # Check MySQL PHP modules are loaded
+ if (!extension_loaded('mysql') && !extension_loaded('mysqli')){
+ echo "Your PHP installation appears to be missing the MySQL extension(s) which are required by Emoncms. See /php-info.php (restricted to local access)"; die;
+ }
+ # Check Gettext PHP module is loaded
+ if (!extension_loaded('gettext')){
+ echo "Your PHP installation appears to be missing the gettext extension which is required by Emoncms. See /php-info.php (restricted to local access)"; die;
+ }
+
+ $mysqli = @new mysqli($server,$username,$password,$database,$port);
if ( $mysqli->connect_error ) {
echo "Can't connect to database, please verify credentials/configuration in settings.php ";
if ( $display_errors ) {
@@ -48,6 +63,8 @@
}
die();
}
+ // Set charset to utf8
+ $mysqli->set_charset("utf8");
if (!$mysqli->connect_error && $dbtest==true) {
require "Lib/dbschemasetup.php";
@@ -55,52 +72,118 @@
}
// 3) User sessions
- require "Modules/user/rememberme_model.php";
- $rememberme = new Rememberme($mysqli);
require("Modules/user/user_model.php");
- $user = new User($mysqli,$redis,$rememberme);
-
- if (isset($_GET['apikey']))
- {
- $session = $user->apikey_session($_GET['apikey']);
- }
- elseif (isset($_POST['apikey']))
- {
- $session = $user->apikey_session($_POST['apikey']);
+ $user = new User($mysqli,$redis);
+ $apikey = false;
+ $devicekey = false;
+ if (isset($_GET['apikey'])) {
+ $apikey = $_GET['apikey'];
+ } else if (isset($_POST['apikey'])) {
+ $apikey = $_POST['apikey'];
+ } else if (isset($_GET['devicekey'])) {
+ $devicekey = $_GET['devicekey'];
+ } else if (isset($_POST['devicekey'])) {
+ $devicekey = $_POST['devicekey'];
+ } else if (isset($_SERVER["HTTP_AUTHORIZATION"])) {
+ // Support passing apikey on Authorization header per rfc6750, like example:
+ // GET /resource HTTP/1.1
+ // Host: server.example.com
+ // Authorization: Bearer THE_API_KEY_HERE
+
+ if (isset($_SERVER["CONTENT_TYPE"]) && $_SERVER["CONTENT_TYPE"]=="aes128cbc") {
+ // If content_type is AES128CBC
+ } else {
+ $apikey = str_replace('Bearer ', '', $_SERVER["HTTP_AUTHORIZATION"]);
+ }
}
- else
- {
+
+ $device = false;
+ if ($apikey) {
+ $session = $user->apikey_session($apikey);
+ if (empty($session)) {
+ header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized");
+ header('WWW-Authenticate: Bearer realm="API KEY", error="invalid_apikey", error_description="Invalid API key"');
+ print "Invalid API key";
+ $log->error("Invalid API key '" . $apikey. "'");
+ exit();
+ }
+ } else if ($devicekey && (@include "Modules/device/device_model.php")) {
+ $device = new Device($mysqli,$redis);
+ $session = $device->devicekey_session($devicekey);
+ if (empty($session)) {
+ header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized");
+ header('WWW-Authenticate: Bearer realm="Device KEY", error="invalid_devicekey", error_description="Invalid device key"');
+ print "Invalid device key";
+ $log->error("Invalid device key '" . $devicekey. "'");
+ exit();
+ }
+ } else {
$session = $user->emon_session_start();
}
-
+
// 4) Language
if (!isset($session['lang'])) $session['lang']='';
set_emoncms_lang($session['lang']);
// 5) Get route and load controller
- $route = new Route(get('q'));
+ $route = new Route(get('q'), server('DOCUMENT_ROOT'), server('REQUEST_METHOD'));
+
+ // Load get/post/encrypted parameters - only used by input/post and input/bulk API's
+ $param = new Param($route,$user);
+
+ // --------------------------------------------------------------------------------------
+ // Special routes
+
+ // Return brief device descriptor for hub detection
+ if ($route->controller=="describe") { header('Content-Type: text'); echo "emonbase"; die; }
if (get('embed')==1) $embed = 1; else $embed = 0;
// If no route specified use defaults
- if (!$route->controller && !$route->action)
+ if ($route->isRouteNotDefined())
{
- // Non authenticated defaults
- if (!$session['read'])
- {
+ // EmonPi Setup Wizard
+ if ($allow_emonpi_admin) {
+ if (file_exists("Modules/setup")) {
+ require "Modules/setup/setup_model.php";
+ $setup = new Setup($mysqli);
+ if ($setup->status()=="unconfigured") {
+ $default_controller = "setup";
+ $default_action = "";
+ // Provide special setup access to WIFI module functions
+ $_SESSION['setup_access'] = true;
+ }
+ }
+ }
+
+ if (!isset($session['read']) || (isset($session['read']) && !$session['read'])) {
+ // Non authenticated defaults
$route->controller = $default_controller;
$route->action = $default_action;
- }
- else // Authenticated defaults
- {
- $route->controller = $default_controller_auth;
- $route->action = $default_action_auth;
+ $route->subaction = "";
+ } else {
+ if (isset($session["startingpage"]) && $session["startingpage"]!="") {
+ header('Location: '.$session["startingpage"]);
+ die;
+ } else {
+ // Authenticated defaults
+ $route->controller = $default_controller_auth;
+ $route->action = $default_action_auth;
+ $route->subaction = "";
+ }
}
}
-
- if ($route->controller == 'input' && $route->action == 'post') $route->format = 'json';
+
+ if ($devicekey && !($route->controller == 'input' && ($route->action == 'bulk' || $route->action == 'post'))) {
+ header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized");
+ print "Unauthorized. Device key autentication only permits input post or bulk actions";
+ $log->error("Unauthorized. Device key autentication only permits input post or bulk actions");
+ exit();
+ }
+
if ($route->controller == 'input' && $route->action == 'bulk') $route->format = 'json';
+ else if ($route->controller == 'input' && $route->action == 'post') $route->format = 'json';
// 6) Load the main page controller
$output = controller($route->controller);
@@ -108,7 +191,7 @@
// If no controller of this name - then try username
// need to actually test if there isnt a controller rather than if no content
// is returned from the controller.
- if (!$output['content'] && $public_profile_enabled && $route->controller!='admin')
+ if ($output['content'] == "#UNDEFINED#" && $public_profile_enabled && $route->controller!='admin')
{
$userid = $user->get_id($route->controller);
if ($userid) {
@@ -117,37 +200,79 @@
$session['username'] = $route->controller;
$session['read'] = 1;
$session['profile'] = 1;
+ $route->controller = $public_profile_controller;
$route->action = $public_profile_action;
- $output = controller($public_profile_controller);
+ $output = controller($route->controller);
+
+ // catch "username/graph" and redirect to the graphs module if no dashboard called "graph" exists
+ if ($output["content"]=="" && $route->subaction=="graph") {
+ $route->controller = "graph";
+ $route->action = "";
+ $_GET['userid'] = $userid;
+ $output = controller($route->controller);
+ }
}
}
-
- $theme = "assessment";
- if ($route->controller=="input") $theme = "monitor";
- if ($route->controller=="feed") $theme = "monitor";
- if ($route->controller=="vis") $theme = "monitor";
- if ($route->controller=="dashboard") $theme = "monitor";
-
+
+ // If no controller found or nothing is returned, give friendly error
+ if ($output['content'] === "#UNDEFINED#") {
+ header($_SERVER["SERVER_PROTOCOL"]." 406 Not Acceptable");
+ $output['content'] = "URI not acceptable. No controller '" . $route->controller . "'. (" . $route->action . "/" . $route->subaction .")";
+ }
+
+ // If not authenticated and no ouput, asks for login
+ if ($output['content'] == "" && (!isset($session['read']) || (isset($session['read']) && !$session['read']))) {
+ $route->controller = "user";
+ $route->action = "login";
+ $route->subaction = "";
+ $output = controller($route->controller);
+ }
+
+ $output['route'] = $route;
+ $output['session'] = $session;
+
// 7) Output
if ($route->format == 'json')
{
- header('Content-Type: application/json');
if ($route->controller=='time') {
+ header('Content-Type: text');
print $output['content'];
} elseif ($route->controller=='input' && $route->action=='post') {
+ header('Content-Type: text');
print $output['content'];
} elseif ($route->controller=='input' && $route->action=='bulk') {
+ header('Content-Type: text');
print $output['content'];
} else {
+ header('Content-Type: application/json');
print json_encode($output['content']);
}
}
-
- if ($route->format == 'html')
+ else if ($route->format == 'html')
{
- $menu = load_menu();
-
- $output['mainmenu'] = view("Theme/menu_view.php", array());
- if ($embed == 0) print view("Theme/theme.php", $output);
- if ($embed == 1) print view("Theme/embed.php", $output);
+ // Select the theme
+ $themeDir = "Theme/" . $theme . "/";
+ if ($embed == 1) {
+ print view($themeDir . "embed.php", $output);
+ } else {
+ $menu = load_menu();
+ $output['mainmenu'] = view($themeDir . "menu_view.php", array());
+ print view($themeDir . "theme.php", $output);
+ }
+ }
+ else if ($route->format == 'text')
+ {
+ header('Content-Type: text');
+ print $output['content'];
}
+ else {
+ header($_SERVER["SERVER_PROTOCOL"]." 406 Not Acceptable");
+ print "URI not acceptable. Unknown format '".$route->format."'.";
+ }
+
+ $ltime = microtime(true) - $ltime;
+
+ // if ($session['userid']>0) {
+ // $redis->incr("user:postcount:".$session['userid']);
+ // $redis->incrbyfloat("user:reqtime:".$session['userid'],$ltime);
+ // }
diff --git a/locale.php b/locale.php
index 1dce0b5..d9bd1bb 100644
--- a/locale.php
+++ b/locale.php
@@ -74,17 +74,28 @@ function set_lang($language)
if (isset($language[0]))
{
- if ($language[0] == 'es') $language[0]='es_ES';
- elseif ($language[0] == 'fr') $language[0]='fr_FR';
+ $lang=$language[0];
+
+ switch($lang) {
+ case 'cy': $lang='cy_GB'; break;
+ case 'da': $lang='da_DK'; break;
+ case 'en': $lang='en_EN'; break;
+ case 'es': $lang='es_ES'; break;
+ case 'fr': $lang='fr_FR'; break;
+ case 'it': $lang='it_IT'; break;
+ case 'nl': $lang='nl_NL'; break;
+ //case 'nl': $lang='nl_BE'; break; //to do??
+ default : $lang='en_EN';
+ }
- set_lang_by_user($language[0]);
+ set_lang_by_user($lang);
}
}
function set_lang_by_user($lang)
{
- putenv("LC_ALL=$lang");
- setlocale(LC_ALL,$lang);
+ putenv("LC_ALL=$lang".'.UTF8');
+ setlocale(LC_ALL,$lang.'.UTF8');
}
function set_emoncms_lang($lang)
diff --git a/logconfig.xml b/logconfig.xml
index 6369d8f..46b7b92 100644
--- a/logconfig.xml
+++ b/logconfig.xml
@@ -1,9 +1,9 @@
-
+
-
-
+
+
diff --git a/process_settings.php b/process_settings.php
index 98f117e..e884d34 100644
--- a/process_settings.php
+++ b/process_settings.php
@@ -20,27 +20,118 @@
// Load settings.php
require_once('settings.php');
- $error_out = "";
+ if (!isset($allow_config_env_vars)) $allow_config_env_vars = false;
+ if ($allow_config_env_vars) {
+ /*
+ Load settings from environment variables
+
+ Environment settings override settings.php and defaults,
+ and allow you to run multiple variants of the same
+ installation (e.g. for testing).
+ */
+
+ //1 #### Mysql database settings
+ if (isset($_ENV["EMONCMS_MYSQL_HOST"])) $server = $_ENV["EMONCMS_MYSQL_HOST"];
+ if (isset($_ENV["EMONCMS_MYSQL_DATABASE"])) $database = $_ENV["EMONCMS_MYSQL_DATABASE"];
+ if (isset($_ENV["EMONCMS_MYSQL_USER"])) $username = $_ENV["EMONCMS_MYSQL_USER"];
+ if (isset($_ENV["EMONCMS_MYSQL_PASSWORD"])) $password = $_ENV["EMONCMS_MYSQL_PASSWORD"];
+ if (isset($_ENV["EMONCMS_MYSQL_PORT"])) $port = $_ENV["EMONCMS_MYSQL_PORT"];
+
+ //2 #### redis
+ // create the array if it's not already been done
+ if (!isset($redis_server)) $redis_server = array();
+
+ if (isset($_ENV["EMONCMS_REDIS_ENABLED"])) $redis_enabled = $_ENV["EMONCMS_REDIS_ENABLED"] === 'true';
+ if (isset($_ENV["EMONCMS_REDIS_HOST"])) $redis_server['host'] = $_ENV["EMONCMS_REDIS_HOST"];
+ if (isset($_ENV["EMONCMS_REDIS_PORT"])) $redis_server['port'] = $_ENV["EMONCMS_REDIS_PORT"];
+ if (isset($_ENV["EMONCMS_REDIS_AUTH"])) $redis_server['auth'] = $_ENV["EMONCMS_REDIS_AUTH"];
+ if (isset($_ENV["EMONCMS_REDIS_PREFIX"])) $redis_server['prefix'] = $_ENV["EMONCMS_REDIS_PREFIX"];
+
+ //3 #### MQTT
+ // create the array if it's not already been done
+ if (!isset($mqtt_server)) $mqtt_server = array();
+ if (isset($_ENV["EMONCMS_MQTT_ENABLED"])) $mqtt_enabled = $_ENV["EMONCMS_MQTT_ENABLED"] === 'true';
+
+ if (isset($_ENV["EMONCMS_MQTT_HOST"])) $redis_server['host'] = $_ENV["EMONCMS_MQTT_HOST"];
+ if (isset($_ENV["EMONCMS_MQTT_PORT"])) $redis_server['port'] = $_ENV["EMONCMS_MQTT_PORT"];
+ if (isset($_ENV["EMONCMS_MQTT_USER"])) $redis_server['user'] = $_ENV["EMONCMS_MQTT_USER"];
+ if (isset($_ENV["EMONCMS_MQTT_PASSWORD"])) $redis_server['password'] = $_ENV["EMONCMS_MQTT_PASSWORD"];
+ if (isset($_ENV["EMONCMS_MQTT_BASETOPIC"])) $redis_server['basetopic'] = $_ENV["EMONCMS_MQTT_BASETOPIC"];
+ }
+ // Validate settings are complete
+
+ $error_out = "";
+
+ if (!isset($config_file_version) || $config_file_version < 9) $error_out .= 'settings.php config file has new settings for this version. Copy default.settings.php to settings.php and modify the later.
';
if (!isset($username) || $username=="") $error_out .= 'missing setting: $username
';
if (!isset($password)) $error_out .= 'missing setting: $password
';
if (!isset($server) || $server=="") $error_out .= 'missing setting: $server
';
if (!isset($database) || $database=="") $error_out .= 'missing setting: $database
';
if ($enable_password_reset && !isset($smtp_email_settings)) $error_out .= 'missing setting: $smtp_email_settings
';
-
- if (!isset($assessment_admin_users)) $assessment_admin_users = array(1);
- if (!isset($redis_enabled)) $redis_enabled = true;
-
+ if (!isset($log_enabled)) $error_out .= "missing setting: log_enabled
";
+ if (!isset($log_level)) $log_level=2; //default to warning log level
+
+ if (!isset($redis_enabled)) $redis_enabled = false;
+ if ($redis_enabled) {
+ if (!class_exists('Redis')) $error_out .= "redis enabled but not installed, check setting: redis_enabled
";
+ if (!isset($redis_server['host'])) $error_out .= "redis server not configured, check setting: redis_server.host
";
+ if (!isset($redis_server['port'])) $error_out .= "redis server not configured, check setting: redis_server.port
";
+ if (!isset($redis_server['auth'])) $error_out .= "redis server not configured, check setting: redis_server.auth
";
+ if (!isset($redis_server['prefix'])) $error_out .= "redis server not configured, check setting: redis_server.prefix
";
+ if (!empty($redis_server['prefix'])) $redis_server['prefix'] = $redis_server['prefix'] . ":";
+ if (!isset($feed_settings['redisbuffer']['enabled'])) $feed_settings['redisbuffer'] = array('enabled'=>false);
+ if (!$feed_settings['redisbuffer']['sleep']) $feed_settings['redisbuffer']['sleep'] = 60;
+ if ((int)$feed_settings['redisbuffer']['sleep'] < 1) $error_out .= "buffered writing sleep interval must be > 0, check settings: settings['redisbuffer']['sleep']";
+ } else {
+ if ($feed_settings['redisbuffer']['enabled']) $error_out .= "
buffered writing requires redis but its disabled, check settings: settings['redisbuffer']['enabled'], redis_enabled";
+ }
+
+ /*
+ if (!isset($mqtt_enabled)) $mqtt_enabled = false;
+ if ($mqtt_enabled) {
+ if (!isset($mqtt_server['host'])) $error_out .= "
mqtt server not configured, check setting: mqtt_server
";
+ if (!isset($mqtt_server['port'])) $mqtt_server['port'] = 1883;
+ if (!isset($mqtt_server['user'])) $mqtt_server['user'] = null;
+ if (!isset($mqtt_server['password'])) $mqtt_server['password'] = null;
+ if (!isset($mqtt_server['basetopic'])) $mqtt_server['basetopic'] = "nodes";
+ }
+
+ if (!isset($feed_settings)) $feed_settings = array();
+ if (!isset($feed_settings['phpfiwa'])) $error_out .= "feed setting for phpfiwa is not configured, check settings: settings['phpfiwa']";
+ if (!isset($feed_settings['phpfina'])) $error_out .= "
feed setting for phpfina is not configured, check settings: settings['phpfina']";
+ if (!isset($feed_settings['phptimeseries'])) $error_out .= "
feed setting for phptimeseries is not configured, check settings: settings['phptimeseries']";
+ if (!isset($feed_settings['redisbuffer'])) $error_out .= "
feed setting for redisbuffer is not configured, check settings: settings['redisbuffer']";
+ if (!isset($feed_settings['engines_hidden'])) $error_out .= "
feed setting for engines_hidden is not configured, check settings: settings['engines_hidden']";
+
+ if (!isset($feed_settings['csvdownloadlimit_mb'])) $feed_settings['csvdownloadlimit_mb'] = 10; // default
+ if (!isset($data_sampling)) $data_sampling = true; // default
+ */
+ if (!isset($fullwidth)) $fullwidth = false;
+ if (!isset($menucollapses)) $menucollapses = true;
+ if (!isset($favicon)) $favicon = "favicon.png";
+
+ if (!isset($csv_decimal_places) || $csv_decimal_places=="") $csv_decimal_places = 2;
+ if (!isset($csv_decimal_place_separator) || $csv_decimal_place_separator=="") $csv_decimal_place_separator = '.';
+ if (!isset($csv_field_separator) || $csv_field_separator=="") $csv_field_separator = ',';
+
+ if ($csv_decimal_place_separator == $csv_field_separator) $error_out .= '
settings incorrect: $csv_decimal_place_separator==$csv_field_separator
';
+
+ if (!isset($assessment_admin_users)) $assessment_admin_users = array(1);
+
+ if (!isset($homedir)) $homedir = "/home/pi";
+ if ($homedir!="/home/pi" && !is_dir($homedir)) $error_out .= "homedir is not configured or directory does not exists, check settings: homedir";
+
if ($error_out!="") {
echo "
";
echo "
settings.php file error ";
echo $error_out;
- echo "
To fix check that the settings are set in settings.php or try re-creating your settings.php file from default.settings.php template
";
+ echo "
To fix, check that the settings are set in settings.php or try re-creating your settings.php file from default.settings.php template
";
echo "
";
die;
}
-
+
// Set display errors
if (isset($display_errors) && ($display_errors)) {
diff --git a/route.php b/route.php
index 8b41187..c110acd 100644
--- a/route.php
+++ b/route.php
@@ -17,17 +17,52 @@
class Route
{
+ /**
+ * @var string
+ */
public $controller = '';
+
+ /**
+ * @var string
+ */
public $action = '';
+
+ /**
+ * @var string
+ */
public $subaction = '';
- public $format = "html";
- public function __construct($q)
+ /**
+ * @var string
+ */
+ public $subaction2 = '';
+
+ /**
+ * @var string
+ */
+ public $method = 'GET';
+
+ /**
+ * @var string
+ */
+ public $format = 'html';
+
+ /**
+ * @param string $q
+ * @param string $documentRoot
+ * @param string $requestMethod
+ */
+ public function __construct($q, $documentRoot, $requestMethod)
{
- $this->decode($q);
+ $this->decode($q, $documentRoot, $requestMethod);
}
- public function decode($q)
+ /**
+ * @param string $q
+ * @param string $documentRoot
+ * @param string $requestMethod
+ */
+ public function decode($q, $documentRoot, $requestMethod)
{
// filter out the applications relative root
@@ -43,12 +78,12 @@ public function decode($q)
// for example this will perform the following:
// Running at root: str_replace('/var/www', '', '/var/www') => ''
// Running at subdirectory: str_replace('/var/www', '', '/var/www/emoncms') => '/emoncms'
- $relativeApplicationPath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $absolutePath);
+ $relativeApplicationPath = str_replace($documentRoot, '', $absolutePath);
// Next up we will need to remove the '/emoncms' from the route path '/emoncms/user/view'
// str_replace('/emoncms', '', '/emoncms/user/view') => '/user/view'
// running at root path it will just perform nothing: str_replace('', '', '/emoncms/user/view') so it can be skipped
- if ( !empty($relativeApplicationPath) ) {
+ if (!empty($relativeApplicationPath)) {
$q = str_replace($relativeApplicationPath, '', $q);
}
@@ -62,13 +97,36 @@ public function decode($q)
$args = preg_split('/[\/]/', $q);
// get format (part of last argument after . i.e view.json)
- $lastarg = sizeof($args) - 1;
- $lastarg_split = preg_split('/[.]/', $args[$lastarg]);
- if (count($lastarg_split) > 1) { $this->format = $lastarg_split[1]; }
- $args[$lastarg] = $lastarg_split[0];
-
- if (count($args) > 0) { $this->controller = $args[0]; }
- if (count($args) > 1) { $this->action = $args[1]; }
- if (count($args) > 2) { $this->subaction = $args[2]; }
+ $lastArgIndex = sizeof($args) - 1;
+ $lastArgSplit = preg_split('/[.]/', $args[$lastArgIndex]);
+ if (count($lastArgSplit) > 1) {
+ $this->format = $lastArgSplit[1];
+ }
+ $args[$lastArgIndex] = $lastArgSplit[0];
+
+ if (count($args) > 0) {
+ $this->controller = $args[0];
+ }
+ if (count($args) > 1) {
+ $this->action = $args[1];
+ }
+ if (count($args) > 2) {
+ $this->subaction = $args[2];
+ }
+ if (count($args) > 3) {
+ $this->subaction2 = $args[3];
+ }
+
+ if (in_array($requestMethod, ['POST', 'DELETE', 'PUT'])) {
+ $this->method = $requestMethod;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function isRouteNotDefined()
+ {
+ return empty($this->controller) && empty($this->action);
}
}
From ee051311d68c9a228994746b3a24c2b70c1eceb4 Mon Sep 17 00:00:00 2001
From: TrystanLea
Date: Sun, 25 Feb 2018 09:39:33 +0000
Subject: [PATCH 002/108] emoncms9 update
---
Lib/EmonLogger.php | 72 +
Lib/email.php | 76 +
Lib/flot/API.md | 1498 +++++++++++++++++
Lib/flot/FAQ.md | 75 +
Lib/flot/Makefile | 12 +
Lib/flot/NEWS.md | 1026 +++++++++++
Lib/flot/PLUGINS.md | 143 ++
Lib/flot/date.format.min.js | 1 +
Lib/flot/jquery.flot.togglelegend.js | 135 ++
Lib/flot/jquery.flot.togglelegend.min.js | 1 +
Lib/flot/jquery.flot.touch.js | 462 +++++
Lib/flot/jquery.flot.touch.min.js | 10 +
Lib/flot/plugin/saveAsImage/README.md | 51 +
.../saveAsImage/jquery.flot.saveAsImage.js | 169 ++
Lib/flot/plugin/saveAsImage/lib/base64.js | 111 ++
.../plugin/saveAsImage/lib/canvas2image.js | 235 +++
Lib/jquery-1.11.3.min.js | 5 +
Lib/listjs/COPYRIGHT.txt | 24 +
Lib/listjs/LICENSE.txt | 619 +++++++
Lib/listjs/example.html | 52 +
Lib/listjs/listjs.md | 416 +++++
Lib/misc/clipboard.js | 64 +
Lib/misc/qrcode.js | 614 +++++++
Lib/phpMQTT.php | 412 +++++
Lib/tablejs/COPYRIGHT.txt | 25 +
Lib/tablejs/LICENSE.txt | 619 +++++++
Lib/tablejs/editable.html | 51 +
Lib/tablejs/event.html | 70 +
Lib/tablejs/example.html | 45 +
Lib/tablejs/expandtables.html | 91 +
Lib/tablejs/grouped.html | 47 +
Lib/tablejs/iconbutton.html | 56 +
.../locale/de_DE/LC_MESSAGES/messages.mo | Bin 0 -> 2105 bytes
.../locale/de_DE/LC_MESSAGES/messages.po | 123 ++
.../locale/et_EE/LC_MESSAGES/messages.mo | Bin 0 -> 2379 bytes
.../locale/et_EE/LC_MESSAGES/messages.po | 122 ++
.../locale/it_IT/LC_MESSAGES/messages.mo | Bin 0 -> 2392 bytes
.../locale/it_IT/LC_MESSAGES/messages.po | 122 ++
Modules/admin/module.json | 4 +
Modules/user/images/appstore.png | Bin 0 -> 8888 bytes
Modules/user/images/en-play-badge.png | Bin 0 -> 4290 bytes
.../user/locale/de_DE/LC_MESSAGES/messages.mo | Bin 0 -> 4383 bytes
.../user/locale/de_DE/LC_MESSAGES/messages.po | 323 ++++
.../user/locale/et_EE/LC_MESSAGES/messages.mo | Bin 0 -> 4781 bytes
.../user/locale/et_EE/LC_MESSAGES/messages.po | 275 +++
Modules/user/module.json | 4 +
Modules/user/profile/language_country.json | 437 +++++
Theme/basic/ajax-loader.gif | Bin 0 -> 4663 bytes
Theme/basic/embed.php | 32 +
Theme/basic/emon-blue.css | 279 +++
Theme/basic/emon-standard.css | 121 ++
Theme/basic/emon-sun.css | 159 ++
Theme/basic/emoncms logo off.png | Bin 0 -> 751 bytes
Theme/basic/emoncms-logo.png | Bin 0 -> 1418 bytes
Theme/basic/favicon.png | Bin 0 -> 2386 bytes
Theme/basic/favicon_emonpi.png | Bin 0 -> 3954 bytes
Theme/basic/ios_load.png | Bin 0 -> 14266 bytes
Theme/basic/logo_login.png | Bin 0 -> 10385 bytes
Theme/basic/logo_normal.png | Bin 0 -> 1846 bytes
Theme/basic/menu_view.php | 143 ++
Theme/basic/theme.php | 207 +++
param.php | 113 ++
php-info.php | 3 +
63 files changed, 9754 insertions(+)
create mode 100644 Lib/EmonLogger.php
create mode 100644 Lib/email.php
create mode 100644 Lib/flot/API.md
create mode 100644 Lib/flot/FAQ.md
create mode 100644 Lib/flot/Makefile
create mode 100644 Lib/flot/NEWS.md
create mode 100644 Lib/flot/PLUGINS.md
create mode 100644 Lib/flot/date.format.min.js
create mode 100644 Lib/flot/jquery.flot.togglelegend.js
create mode 100644 Lib/flot/jquery.flot.togglelegend.min.js
create mode 100644 Lib/flot/jquery.flot.touch.js
create mode 100644 Lib/flot/jquery.flot.touch.min.js
create mode 100644 Lib/flot/plugin/saveAsImage/README.md
create mode 100644 Lib/flot/plugin/saveAsImage/jquery.flot.saveAsImage.js
create mode 100644 Lib/flot/plugin/saveAsImage/lib/base64.js
create mode 100644 Lib/flot/plugin/saveAsImage/lib/canvas2image.js
create mode 100644 Lib/jquery-1.11.3.min.js
create mode 100644 Lib/listjs/COPYRIGHT.txt
create mode 100644 Lib/listjs/LICENSE.txt
create mode 100644 Lib/listjs/example.html
create mode 100644 Lib/listjs/listjs.md
create mode 100644 Lib/misc/clipboard.js
create mode 100644 Lib/misc/qrcode.js
create mode 100644 Lib/phpMQTT.php
create mode 100644 Lib/tablejs/COPYRIGHT.txt
create mode 100644 Lib/tablejs/LICENSE.txt
create mode 100644 Lib/tablejs/editable.html
create mode 100644 Lib/tablejs/event.html
create mode 100644 Lib/tablejs/example.html
create mode 100644 Lib/tablejs/expandtables.html
create mode 100644 Lib/tablejs/grouped.html
create mode 100644 Lib/tablejs/iconbutton.html
create mode 100644 Modules/admin/locale/de_DE/LC_MESSAGES/messages.mo
create mode 100644 Modules/admin/locale/de_DE/LC_MESSAGES/messages.po
create mode 100644 Modules/admin/locale/et_EE/LC_MESSAGES/messages.mo
create mode 100644 Modules/admin/locale/et_EE/LC_MESSAGES/messages.po
create mode 100644 Modules/admin/locale/it_IT/LC_MESSAGES/messages.mo
create mode 100644 Modules/admin/locale/it_IT/LC_MESSAGES/messages.po
create mode 100644 Modules/admin/module.json
create mode 100644 Modules/user/images/appstore.png
create mode 100644 Modules/user/images/en-play-badge.png
create mode 100644 Modules/user/locale/de_DE/LC_MESSAGES/messages.mo
create mode 100644 Modules/user/locale/de_DE/LC_MESSAGES/messages.po
create mode 100644 Modules/user/locale/et_EE/LC_MESSAGES/messages.mo
create mode 100644 Modules/user/locale/et_EE/LC_MESSAGES/messages.po
create mode 100644 Modules/user/module.json
create mode 100644 Modules/user/profile/language_country.json
create mode 100644 Theme/basic/ajax-loader.gif
create mode 100644 Theme/basic/embed.php
create mode 100644 Theme/basic/emon-blue.css
create mode 100644 Theme/basic/emon-standard.css
create mode 100644 Theme/basic/emon-sun.css
create mode 100644 Theme/basic/emoncms logo off.png
create mode 100644 Theme/basic/emoncms-logo.png
create mode 100644 Theme/basic/favicon.png
create mode 100644 Theme/basic/favicon_emonpi.png
create mode 100644 Theme/basic/ios_load.png
create mode 100644 Theme/basic/logo_login.png
create mode 100644 Theme/basic/logo_normal.png
create mode 100644 Theme/basic/menu_view.php
create mode 100644 Theme/basic/theme.php
create mode 100644 param.php
create mode 100755 php-info.php
diff --git a/Lib/EmonLogger.php b/Lib/EmonLogger.php
new file mode 100644
index 0000000..114dc31
--- /dev/null
+++ b/Lib/EmonLogger.php
@@ -0,0 +1,72 @@
+logenabled = false;
+ }
+ else if ($log_filename) {
+ if ($log_level) $this->log_level = $log_level;
+ $this->logfile = $log_filename;
+ $this->caller = basename($clientFileName);
+ if (!file_exists($this->logfile))
+ {
+ $fh = @fopen($this->logfile,"a");
+ @fclose($fh);
+ }
+ if (is_writable($this->logfile)) $this->logenabled = true;
+ }
+ }
+
+ public function info ($message){
+ if ($this->log_level <= 1) $this->write("INFO",$message);
+ }
+
+ public function warn ($message){
+ if ($this->log_level <= 2) $this->write("WARN",$message);
+ }
+
+ public function error ($message){
+ if ($this->log_level <= 3) $this->write("ERROR",$message);
+ }
+
+ private function write($type,$message){
+ if (!$this->logenabled) return;
+
+ $now = microtime(true);
+ $micro = sprintf("%03d",($now - ($now >> 0)) * 1000);
+ $now = DateTime::createFromFormat('U', (int)$now); // Only use UTC for logs
+ $now = $now->format("Y-m-d H:i:s").".$micro";
+ // Clear log file if more than 256MB (temporary solution)
+ if (filesize($this->logfile)>(1024*1024*256)) {
+ $fh = @fopen($this->logfile,"w");
+ @fclose($fh);
+ }
+ if ($fh = @fopen($this->logfile,"a")) {
+ @fwrite($fh,$now."|$type|$this->caller|".$message."\n");
+ @fclose($fh);
+ }
+ }
+
+}
diff --git a/Lib/email.php b/Lib/email.php
new file mode 100644
index 0000000..da58ad1
--- /dev/null
+++ b/Lib/email.php
@@ -0,0 +1,76 @@
+log = new EmonLogger(__FILE__);
+
+ $this->message = null;
+ // include SwiftMailer. path from a PEAR install,
+ $this->have_swift = @include_once ("swift_required.php");
+ // path from module lib
+ if (!$this->have_swift) {
+ $this->have_swift = @include_once ("Lib/swiftmailer/swift_required.php");
+ }
+ if ($this->have_swift){
+ $this->message = Swift_Message::newInstance();
+ $this->message->setFrom($smtp_email_settings['from']);
+ }
+ }
+
+ function check(){
+ if (!$this->have_swift){
+ $this->log->error("check() Could not find SwiftMailer, email functions are ignored.");
+ return false;
+ }
+ return true;
+ }
+
+ function from($from) {
+ if ($this.check()) $this->message->setFrom($from);
+ }
+
+ function to($to) {
+ if ($this->check()) $this->message->setTo($to);
+ }
+
+ function subject($subject) {
+ if ($this->check()) $this->message->setSubject($subject);
+ }
+
+ function body($body,$type='text/html') {
+ if ($this->check()) $this->message->setBody($body, $type);
+ }
+
+ function attach($filepath, $contentType = null) {
+ if ($this->check()) $this->message->attach(Swift_Attachment::fromPath($filepath,$contentType));
+ }
+
+ function send(){
+ global $smtp_email_settings;
+ if ($this->check()) {
+ try {
+ $transport = Swift_SmtpTransport::newInstance($smtp_email_settings['host'], $smtp_email_settings['port']);
+ if (isset($smtp_email_settings['encryption'])) $transport->setEncryption($smtp_email_settings['encryption']);
+ if (isset($smtp_email_settings['username'])) $transport->setUsername($smtp_email_settings['username']);
+ if (isset($smtp_email_settings['password'])) $transport->setPassword($smtp_email_settings['password']);
+
+ $mailer = Swift_Mailer::newInstance($transport);
+ $mailer->send($this->message);
+ } catch(Exception $e) {
+ return array('success'=>false, 'message'=>$e->getMessage());
+ }
+ return array('success'=>true, 'message'=>"");
+ } else
+ {
+ return array('success'=>false, 'message'=>"Could not find SwiftMailer, email not sent.");
+ }
+ }
+
+}
diff --git a/Lib/flot/API.md b/Lib/flot/API.md
new file mode 100644
index 0000000..cd3927b
--- /dev/null
+++ b/Lib/flot/API.md
@@ -0,0 +1,1498 @@
+# Flot Reference #
+
+**Table of Contents**
+
+[Introduction](#introduction)
+| [Data Format](#data-format)
+| [Plot Options](#plot-options)
+| [Customizing the legend](#customizing-the-legend)
+| [Customizing the axes](#customizing-the-axes)
+| [Multiple axes](#multiple-axes)
+| [Time series data](#time-series-data)
+| [Customizing the data series](#customizing-the-data-series)
+| [Customizing the grid](#customizing-the-grid)
+| [Specifying gradients](#specifying-gradients)
+| [Plot Methods](#plot-methods)
+| [Hooks](#hooks)
+| [Plugins](#plugins)
+| [Version number](#version-number)
+
+---
+
+## Introduction ##
+
+Consider a call to the plot function:
+
+```js
+var plot = $.plot(placeholder, data, options)
+```
+
+The placeholder is a jQuery object or DOM element or jQuery expression
+that the plot will be put into. This placeholder needs to have its
+width and height set as explained in the [README](README.md) (go read that now if
+you haven't, it's short). The plot will modify some properties of the
+placeholder so it's recommended you simply pass in a div that you
+don't use for anything else. Make sure you check any fancy styling
+you apply to the div, e.g. background images have been reported to be a
+problem on IE 7.
+
+The plot function can also be used as a jQuery chainable property. This form
+naturally can't return the plot object directly, but you can still access it
+via the 'plot' data key, like this:
+
+```js
+var plot = $("#placeholder").plot(data, options).data("plot");
+```
+
+The format of the data is documented below, as is the available
+options. The plot object returned from the call has some methods you
+can call. These are documented separately below.
+
+Note that in general Flot gives no guarantees if you change any of the
+objects you pass in to the plot function or get out of it since
+they're not necessarily deep-copied.
+
+
+## Data Format ##
+
+The data is an array of data series:
+
+```js
+[ series1, series2, ... ]
+```
+
+A series can either be raw data or an object with properties. The raw
+data format is an array of points:
+
+```js
+[ [x1, y1], [x2, y2], ... ]
+```
+
+E.g.
+
+```js
+[ [1, 3], [2, 14.01], [3.5, 3.14] ]
+```
+
+Note that to simplify the internal logic in Flot both the x and y
+values must be numbers (even if specifying time series, see below for
+how to do this). This is a common problem because you might retrieve
+data from the database and serialize them directly to JSON without
+noticing the wrong type. If you're getting mysterious errors, double
+check that you're inputting numbers and not strings.
+
+If a null is specified as a point or if one of the coordinates is null
+or couldn't be converted to a number, the point is ignored when
+drawing. As a special case, a null value for lines is interpreted as a
+line segment end, i.e. the points before and after the null value are
+not connected.
+
+Lines and points take two coordinates. For filled lines and bars, you
+can specify a third coordinate which is the bottom of the filled
+area/bar (defaults to 0).
+
+The format of a single series object is as follows:
+
+```js
+{
+ color: color or number
+ data: rawdata
+ label: string
+ lines: specific lines options
+ bars: specific bars options
+ points: specific points options
+ xaxis: number
+ yaxis: number
+ clickable: boolean
+ hoverable: boolean
+ shadowSize: number
+ highlightColor: color or number
+}
+```
+
+You don't have to specify any of them except the data, the rest are
+options that will get default values. Typically you'd only specify
+label and data, like this:
+
+```js
+{
+ label: "y = 3",
+ data: [[0, 3], [10, 3]]
+}
+```
+
+The label is used for the legend, if you don't specify one, the series
+will not show up in the legend.
+
+If you don't specify color, the series will get a color from the
+auto-generated colors. The color is either a CSS color specification
+(like "rgb(255, 100, 123)") or an integer that specifies which of
+auto-generated colors to select, e.g. 0 will get color no. 0, etc.
+
+The latter is mostly useful if you let the user add and remove series,
+in which case you can hard-code the color index to prevent the colors
+from jumping around between the series.
+
+The "xaxis" and "yaxis" options specify which axis to use. The axes
+are numbered from 1 (default), so { yaxis: 2} means that the series
+should be plotted against the second y axis.
+
+"clickable" and "hoverable" can be set to false to disable
+interactivity for specific series if interactivity is turned on in
+the plot, see below.
+
+The rest of the options are all documented below as they are the same
+as the default options passed in via the options parameter in the plot
+command. When you specify them for a specific data series, they will
+override the default options for the plot for that data series.
+
+Here's a complete example of a simple data specification:
+
+```js
+[ { label: "Foo", data: [ [10, 1], [17, -14], [30, 5] ] },
+ { label: "Bar", data: [ [11, 13], [19, 11], [30, -7] ] }
+]
+```
+
+
+## Plot Options ##
+
+All options are completely optional. They are documented individually
+below, to change them you just specify them in an object, e.g.
+
+```js
+var options = {
+ series: {
+ lines: { show: true },
+ points: { show: true }
+ }
+};
+
+$.plot(placeholder, data, options);
+```
+
+
+## Customizing the legend ##
+
+```js
+legend: {
+ show: boolean
+ labelFormatter: null or (fn: string, series object -> string)
+ labelBoxBorderColor: color
+ noColumns: number
+ position: "ne" or "nw" or "se" or "sw"
+ margin: number of pixels or [x margin, y margin]
+ backgroundColor: null or color
+ backgroundOpacity: number between 0 and 1
+ container: null or jQuery object/DOM element/jQuery expression
+ sorted: null/false, true, "ascending", "descending", "reverse", or a comparator
+}
+```
+
+The legend is generated as a table with the data series labels and
+small label boxes with the color of the series. If you want to format
+the labels in some way, e.g. make them to links, you can pass in a
+function for "labelFormatter". Here's an example that makes them
+clickable:
+
+```js
+labelFormatter: function(label, series) {
+ // series is the series object for the label
+ return '' + label + ' ';
+}
+```
+
+To prevent a series from showing up in the legend, simply have the function
+return null.
+
+"noColumns" is the number of columns to divide the legend table into.
+"position" specifies the overall placement of the legend within the
+plot (top-right, top-left, etc.) and margin the distance to the plot
+edge (this can be either a number or an array of two numbers like [x,
+y]). "backgroundColor" and "backgroundOpacity" specifies the
+background. The default is a partly transparent auto-detected
+background.
+
+If you want the legend to appear somewhere else in the DOM, you can
+specify "container" as a jQuery object/expression to put the legend
+table into. The "position" and "margin" etc. options will then be
+ignored. Note that Flot will overwrite the contents of the container.
+
+Legend entries appear in the same order as their series by default. If "sorted"
+is "reverse" then they appear in the opposite order from their series. To sort
+them alphabetically, you can specify true, "ascending" or "descending", where
+true and "ascending" are equivalent.
+
+You can also provide your own comparator function that accepts two
+objects with "label" and "color" properties, and returns zero if they
+are equal, a positive value if the first is greater than the second,
+and a negative value if the first is less than the second.
+
+```js
+sorted: function(a, b) {
+ // sort alphabetically in ascending order
+ return a.label == b.label ? 0 : (
+ a.label > b.label ? 1 : -1
+ )
+}
+```
+
+
+## Customizing the axes ##
+
+```js
+xaxis, yaxis: {
+ show: null or true/false
+ position: "bottom" or "top" or "left" or "right"
+ mode: null or "time" ("time" requires jquery.flot.time.js plugin)
+ timezone: null, "browser" or timezone (only makes sense for mode: "time")
+
+ color: null or color spec
+ tickColor: null or color spec
+ font: null or font spec object
+
+ min: null or number
+ max: null or number
+ autoscaleMargin: null or number
+
+ transform: null or fn: number -> number
+ inverseTransform: null or fn: number -> number
+
+ ticks: null or number or ticks array or (fn: axis -> ticks array)
+ tickSize: number or array
+ minTickSize: number or array
+ tickFormatter: (fn: number, object -> string) or string
+ tickDecimals: null or number
+
+ labelWidth: null or number
+ labelHeight: null or number
+ reserveSpace: null or true
+
+ tickLength: null or number
+
+ alignTicksWithAxis: null or number
+}
+```
+
+All axes have the same kind of options. The following describes how to
+configure one axis, see below for what to do if you've got more than
+one x axis or y axis.
+
+If you don't set the "show" option (i.e. it is null), visibility is
+auto-detected, i.e. the axis will show up if there's data associated
+with it. You can override this by setting the "show" option to true or
+false.
+
+The "position" option specifies where the axis is placed, bottom or
+top for x axes, left or right for y axes. The "mode" option determines
+how the data is interpreted, the default of null means as decimal
+numbers. Use "time" for time series data; see the time series data
+section. The time plugin (jquery.flot.time.js) is required for time
+series support.
+
+The "color" option determines the color of the line and ticks for the axis, and
+defaults to the grid color with transparency. For more fine-grained control you
+can also set the color of the ticks separately with "tickColor".
+
+You can customize the font and color used to draw the axis tick labels with CSS
+or directly via the "font" option. When "font" is null - the default - each
+tick label is given the 'flot-tick-label' class. For compatibility with Flot
+0.7 and earlier the labels are also given the 'tickLabel' class, but this is
+deprecated and scheduled to be removed with the release of version 1.0.0.
+
+To enable more granular control over styles, labels are divided between a set
+of text containers, with each holding the labels for one axis. These containers
+are given the classes 'flot-[x|y]-axis', and 'flot-[x|y]#-axis', where '#' is
+the number of the axis when there are multiple axes. For example, the x-axis
+labels for a simple plot with only a single x-axis might look like this:
+
+```html
+
+```
+
+For direct control over label styles you can also provide "font" as an object
+with this format:
+
+```js
+{
+ size: 11,
+ lineHeight: 13,
+ style: "italic",
+ weight: "bold",
+ family: "sans-serif",
+ variant: "small-caps",
+ color: "#545454"
+}
+```
+
+The size and lineHeight must be expressed in pixels; CSS units such as 'em'
+or 'smaller' are not allowed.
+
+The options "min"/"max" are the precise minimum/maximum value on the
+scale. If you don't specify either of them, a value will automatically
+be chosen based on the minimum/maximum data values. Note that Flot
+always examines all the data values you feed to it, even if a
+restriction on another axis may make some of them invisible (this
+makes interactive use more stable).
+
+The "autoscaleMargin" is a bit esoteric: it's the fraction of margin
+that the scaling algorithm will add to avoid that the outermost points
+ends up on the grid border. Note that this margin is only applied when
+a min or max value is not explicitly set. If a margin is specified,
+the plot will furthermore extend the axis end-point to the nearest
+whole tick. The default value is "null" for the x axes and 0.02 for y
+axes which seems appropriate for most cases.
+
+"transform" and "inverseTransform" are callbacks you can put in to
+change the way the data is drawn. You can design a function to
+compress or expand certain parts of the axis non-linearly, e.g.
+suppress weekends or compress far away points with a logarithm or some
+other means. When Flot draws the plot, each value is first put through
+the transform function. Here's an example, the x axis can be turned
+into a natural logarithm axis with the following code:
+
+```js
+xaxis: {
+ transform: function (v) { return Math.log(v); },
+ inverseTransform: function (v) { return Math.exp(v); }
+}
+```
+
+Similarly, for reversing the y axis so the values appear in inverse
+order:
+
+```js
+yaxis: {
+ transform: function (v) { return -v; },
+ inverseTransform: function (v) { return -v; }
+}
+```
+
+Note that for finding extrema, Flot assumes that the transform
+function does not reorder values (it should be monotone).
+
+The inverseTransform is simply the inverse of the transform function
+(so v == inverseTransform(transform(v)) for all relevant v). It is
+required for converting from canvas coordinates to data coordinates,
+e.g. for a mouse interaction where a certain pixel is clicked. If you
+don't use any interactive features of Flot, you may not need it.
+
+
+The rest of the options deal with the ticks.
+
+If you don't specify any ticks, a tick generator algorithm will make
+some for you. The algorithm has two passes. It first estimates how
+many ticks would be reasonable and uses this number to compute a nice
+round tick interval size. Then it generates the ticks.
+
+You can specify how many ticks the algorithm aims for by setting
+"ticks" to a number. The algorithm always tries to generate reasonably
+round tick values so even if you ask for three ticks, you might get
+five if that fits better with the rounding. If you don't want any
+ticks at all, set "ticks" to 0 or an empty array.
+
+Another option is to skip the rounding part and directly set the tick
+interval size with "tickSize". If you set it to 2, you'll get ticks at
+2, 4, 6, etc. Alternatively, you can specify that you just don't want
+ticks at a size less than a specific tick size with "minTickSize".
+Note that for time series, the format is an array like [2, "month"],
+see the next section.
+
+If you want to completely override the tick algorithm, you can specify
+an array for "ticks", either like this:
+
+```js
+ticks: [0, 1.2, 2.4]
+```
+
+Or like this where the labels are also customized:
+
+```js
+ticks: [[0, "zero"], [1.2, "one mark"], [2.4, "two marks"]]
+```
+
+You can mix the two if you like.
+
+For extra flexibility you can specify a function as the "ticks"
+parameter. The function will be called with an object with the axis
+min and max and should return a ticks array. Here's a simplistic tick
+generator that spits out intervals of pi, suitable for use on the x
+axis for trigonometric functions:
+
+```js
+function piTickGenerator(axis) {
+ var res = [], i = Math.floor(axis.min / Math.PI);
+ do {
+ var v = i * Math.PI;
+ res.push([v, i + "\u03c0"]);
+ ++i;
+ } while (v < axis.max);
+ return res;
+}
+```
+
+You can control how the ticks look like with "tickDecimals", the
+number of decimals to display (default is auto-detected).
+
+Alternatively, for ultimate control over how ticks are formatted you can
+provide a function to "tickFormatter". The function is passed two
+parameters, the tick value and an axis object with information, and
+should return a string. The default formatter looks like this:
+
+```js
+function formatter(val, axis) {
+ return val.toFixed(axis.tickDecimals);
+}
+```
+
+The axis object has "min" and "max" with the range of the axis,
+"tickDecimals" with the number of decimals to round the value to and
+"tickSize" with the size of the interval between ticks as calculated
+by the automatic axis scaling algorithm (or specified by you). Here's
+an example of a custom formatter:
+
+```js
+function suffixFormatter(val, axis) {
+ if (val > 1000000)
+ return (val / 1000000).toFixed(axis.tickDecimals) + " MB";
+ else if (val > 1000)
+ return (val / 1000).toFixed(axis.tickDecimals) + " kB";
+ else
+ return val.toFixed(axis.tickDecimals) + " B";
+}
+```
+
+"labelWidth" and "labelHeight" specifies a fixed size of the tick
+labels in pixels. They're useful in case you need to align several
+plots. "reserveSpace" means that even if an axis isn't shown, Flot
+should reserve space for it - it is useful in combination with
+labelWidth and labelHeight for aligning multi-axis charts.
+
+"tickLength" is the length of the tick lines in pixels. By default, the
+innermost axes will have ticks that extend all across the plot, while
+any extra axes use small ticks. A value of null means use the default,
+while a number means small ticks of that length - set it to 0 to hide
+the lines completely.
+
+If you set "alignTicksWithAxis" to the number of another axis, e.g.
+alignTicksWithAxis: 1, Flot will ensure that the autogenerated ticks
+of this axis are aligned with the ticks of the other axis. This may
+improve the looks, e.g. if you have one y axis to the left and one to
+the right, because the grid lines will then match the ticks in both
+ends. The trade-off is that the forced ticks won't necessarily be at
+natural places.
+
+
+## Multiple axes ##
+
+If you need more than one x axis or y axis, you need to specify for
+each data series which axis they are to use, as described under the
+format of the data series, e.g. { data: [...], yaxis: 2 } specifies
+that a series should be plotted against the second y axis.
+
+To actually configure that axis, you can't use the xaxis/yaxis options
+directly - instead there are two arrays in the options:
+
+```js
+xaxes: []
+yaxes: []
+```
+
+Here's an example of configuring a single x axis and two y axes (we
+can leave options of the first y axis empty as the defaults are fine):
+
+```js
+{
+ xaxes: [ { position: "top" } ],
+ yaxes: [ { }, { position: "right", min: 20 } ]
+}
+```
+
+The arrays get their default values from the xaxis/yaxis settings, so
+say you want to have all y axes start at zero, you can simply specify
+yaxis: { min: 0 } instead of adding a min parameter to all the axes.
+
+Generally, the various interfaces in Flot dealing with data points
+either accept an xaxis/yaxis parameter to specify which axis number to
+use (starting from 1), or lets you specify the coordinate directly as
+x2/x3/... or x2axis/x3axis/... instead of "x" or "xaxis".
+
+
+## Time series data ##
+
+Please note that it is now required to include the time plugin,
+jquery.flot.time.js, for time series support.
+
+Time series are a bit more difficult than scalar data because
+calendars don't follow a simple base 10 system. For many cases, Flot
+abstracts most of this away, but it can still be a bit difficult to
+get the data into Flot. So we'll first discuss the data format.
+
+The time series support in Flot is based on Javascript timestamps,
+i.e. everywhere a time value is expected or handed over, a Javascript
+timestamp number is used. This is a number, not a Date object. A
+Javascript timestamp is the number of milliseconds since January 1,
+1970 00:00:00 UTC. This is almost the same as Unix timestamps, except it's
+in milliseconds, so remember to multiply by 1000!
+
+You can see a timestamp like this
+
+```js
+alert((new Date()).getTime())
+```
+
+There are different schools of thought when it comes to display of
+timestamps. Many will want the timestamps to be displayed according to
+a certain time zone, usually the time zone in which the data has been
+produced. Some want the localized experience, where the timestamps are
+displayed according to the local time of the visitor. Flot supports
+both. Optionally you can include a third-party library to get
+additional timezone support.
+
+Default behavior is that Flot always displays timestamps according to
+UTC. The reason being that the core Javascript Date object does not
+support other fixed time zones. Often your data is at another time
+zone, so it may take a little bit of tweaking to work around this
+limitation.
+
+The easiest way to think about it is to pretend that the data
+production time zone is UTC, even if it isn't. So if you have a
+datapoint at 2002-02-20 08:00, you can generate a timestamp for eight
+o'clock UTC even if it really happened eight o'clock UTC+0200.
+
+In PHP you can get an appropriate timestamp with:
+
+```php
+strtotime("2002-02-20 UTC") * 1000
+```
+
+In Python you can get it with something like:
+
+```python
+calendar.timegm(datetime_object.timetuple()) * 1000
+```
+In Ruby you can get it using the `#to_i` method on the
+[`Time`](http://apidock.com/ruby/Time/to_i) object. If you're using the
+`active_support` gem (default for Ruby on Rails applications) `#to_i` is also
+available on the `DateTime` and `ActiveSupport::TimeWithZone` objects. You
+simply need to multiply the result by 1000:
+
+```ruby
+Time.now.to_i * 1000 # => 1383582043000
+# ActiveSupport examples:
+DateTime.now.to_i * 1000 # => 1383582043000
+ActiveSupport::TimeZone.new('Asia/Shanghai').now.to_i * 1000
+# => 1383582043000
+```
+
+In .NET you can get it with something like:
+
+```aspx
+public static int GetJavascriptTimestamp(System.DateTime input)
+{
+ System.TimeSpan span = new System.TimeSpan(System.DateTime.Parse("1/1/1970").Ticks);
+ System.DateTime time = input.Subtract(span);
+ return (long)(time.Ticks / 10000);
+}
+```
+
+Javascript also has some support for parsing date strings, so it is
+possible to generate the timestamps manually client-side.
+
+If you've already got the real UTC timestamp, it's too late to use the
+pretend trick described above. But you can fix up the timestamps by
+adding the time zone offset, e.g. for UTC+0200 you would add 2 hours
+to the UTC timestamp you got. Then it'll look right on the plot. Most
+programming environments have some means of getting the timezone
+offset for a specific date (note that you need to get the offset for
+each individual timestamp to account for daylight savings).
+
+The alternative with core Javascript is to interpret the timestamps
+according to the time zone that the visitor is in, which means that
+the ticks will shift with the time zone and daylight savings of each
+visitor. This behavior is enabled by setting the axis option
+"timezone" to the value "browser".
+
+If you need more time zone functionality than this, there is still
+another option. If you include the "timezone-js" library
+ in the page and set axis.timezone
+to a value recognized by said library, Flot will use timezone-js to
+interpret the timestamps according to that time zone.
+
+Once you've gotten the timestamps into the data and specified "time"
+as the axis mode, Flot will automatically generate relevant ticks and
+format them. As always, you can tweak the ticks via the "ticks" option
+- just remember that the values should be timestamps (numbers), not
+Date objects.
+
+Tick generation and formatting can also be controlled separately
+through the following axis options:
+
+```js
+minTickSize: array
+timeformat: null or format string
+monthNames: null or array of size 12 of strings
+dayNames: null or array of size 7 of strings
+twelveHourClock: boolean
+```
+
+Here "timeformat" is a format string to use. You might use it like
+this:
+
+```js
+xaxis: {
+ mode: "time",
+ timeformat: "%Y/%m/%d"
+}
+```
+
+This will result in tick labels like "2000/12/24". A subset of the
+standard strftime specifiers are supported (plus the nonstandard %q):
+
+```js
+%a: weekday name (customizable)
+%b: month name (customizable)
+%d: day of month, zero-padded (01-31)
+%e: day of month, space-padded ( 1-31)
+%H: hours, 24-hour time, zero-padded (00-23)
+%I: hours, 12-hour time, zero-padded (01-12)
+%m: month, zero-padded (01-12)
+%M: minutes, zero-padded (00-59)
+%q: quarter (1-4)
+%S: seconds, zero-padded (00-59)
+%y: year (two digits)
+%Y: year (four digits)
+%p: am/pm
+%P: AM/PM (uppercase version of %p)
+%w: weekday as number (0-6, 0 being Sunday)
+```
+
+Flot 0.8 switched from %h to the standard %H hours specifier. The %h specifier
+is still available, for backwards-compatibility, but is deprecated and
+scheduled to be removed permanently with the release of version 1.0.
+
+You can customize the month names with the "monthNames" option. For
+instance, for Danish you might specify:
+
+```js
+monthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]
+```
+
+Similarly you can customize the weekday names with the "dayNames"
+option. An example in French:
+
+```js
+dayNames: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"]
+```
+
+If you set "twelveHourClock" to true, the autogenerated timestamps
+will use 12 hour AM/PM timestamps instead of 24 hour. This only
+applies if you have not set "timeformat". Use the "%I" and "%p" or
+"%P" options if you want to build your own format string with 12-hour
+times.
+
+If the Date object has a strftime property (and it is a function), it
+will be used instead of the built-in formatter. Thus you can include
+a strftime library such as http://hacks.bluesmoon.info/strftime/ for
+more powerful date/time formatting.
+
+If everything else fails, you can control the formatting by specifying
+a custom tick formatter function as usual. Here's a simple example
+which will format December 24 as 24/12:
+
+```js
+tickFormatter: function (val, axis) {
+ var d = new Date(val);
+ return d.getUTCDate() + "/" + (d.getUTCMonth() + 1);
+}
+```
+
+Note that for the time mode "tickSize" and "minTickSize" are a bit
+special in that they are arrays on the form "[value, unit]" where unit
+is one of "second", "minute", "hour", "day", "month" and "year". So
+you can specify
+
+```js
+minTickSize: [1, "month"]
+```
+
+to get a tick interval size of at least 1 month and correspondingly,
+if axis.tickSize is [2, "day"] in the tick formatter, the ticks have
+been produced with two days in-between.
+
+
+## Customizing the data series ##
+
+```js
+series: {
+ lines, points, bars: {
+ show: boolean
+ lineWidth: number
+ fill: boolean or number
+ fillColor: null or color/gradient
+ }
+
+ lines, bars: {
+ zero: boolean
+ }
+
+ points: {
+ radius: number
+ symbol: "circle" or function
+ }
+
+ bars: {
+ barWidth: number
+ align: "left", "right" or "center"
+ horizontal: boolean
+ }
+
+ lines: {
+ steps: boolean
+ }
+
+ shadowSize: number
+ highlightColor: color or number
+}
+
+colors: [ color1, color2, ... ]
+```
+
+The options inside "series: {}" are copied to each of the series. So
+you can specify that all series should have bars by putting it in the
+global options, or override it for individual series by specifying
+bars in a particular the series object in the array of data.
+
+The most important options are "lines", "points" and "bars" that
+specify whether and how lines, points and bars should be shown for
+each data series. In case you don't specify anything at all, Flot will
+default to showing lines (you can turn this off with
+lines: { show: false }). You can specify the various types
+independently of each other, and Flot will happily draw each of them
+in turn (this is probably only useful for lines and points), e.g.
+
+```js
+var options = {
+ series: {
+ lines: { show: true, fill: true, fillColor: "rgba(255, 255, 255, 0.8)" },
+ points: { show: true, fill: false }
+ }
+};
+```
+
+"lineWidth" is the thickness of the line or outline in pixels. You can
+set it to 0 to prevent a line or outline from being drawn; this will
+also hide the shadow.
+
+"fill" is whether the shape should be filled. For lines, this produces
+area graphs. You can use "fillColor" to specify the color of the fill.
+If "fillColor" evaluates to false (default for everything except
+points which are filled with white), the fill color is auto-set to the
+color of the data series. You can adjust the opacity of the fill by
+setting fill to a number between 0 (fully transparent) and 1 (fully
+opaque).
+
+For bars, fillColor can be a gradient, see the gradient documentation
+below. "barWidth" is the width of the bars in units of the x axis (or
+the y axis if "horizontal" is true), contrary to most other measures
+that are specified in pixels. For instance, for time series the unit
+is milliseconds so 24 * 60 * 60 * 1000 produces bars with the width of
+a day. "align" specifies whether a bar should be left-aligned
+(default), right-aligned or centered on top of the value it represents.
+When "horizontal" is on, the bars are drawn horizontally, i.e. from the
+y axis instead of the x axis; note that the bar end points are still
+defined in the same way so you'll probably want to swap the
+coordinates if you've been plotting vertical bars first.
+
+Area and bar charts normally start from zero, regardless of the data's range.
+This is because they convey information through size, and starting from a
+different value would distort their meaning. In cases where the fill is purely
+for decorative purposes, however, "zero" allows you to override this behavior.
+It defaults to true for filled lines and bars; setting it to false tells the
+series to use the same automatic scaling as an un-filled line.
+
+For lines, "steps" specifies whether two adjacent data points are
+connected with a straight (possibly diagonal) line or with first a
+horizontal and then a vertical line. Note that this transforms the
+data by adding extra points.
+
+For points, you can specify the radius and the symbol. The only
+built-in symbol type is circles, for other types you can use a plugin
+or define them yourself by specifying a callback:
+
+```js
+function cross(ctx, x, y, radius, shadow) {
+ var size = radius * Math.sqrt(Math.PI) / 2;
+ ctx.moveTo(x - size, y - size);
+ ctx.lineTo(x + size, y + size);
+ ctx.moveTo(x - size, y + size);
+ ctx.lineTo(x + size, y - size);
+}
+```
+
+The parameters are the drawing context, x and y coordinates of the
+center of the point, a radius which corresponds to what the circle
+would have used and whether the call is to draw a shadow (due to
+limited canvas support, shadows are currently faked through extra
+draws). It's good practice to ensure that the area covered by the
+symbol is the same as for the circle with the given radius, this
+ensures that all symbols have approximately the same visual weight.
+
+"shadowSize" is the default size of shadows in pixels. Set it to 0 to
+remove shadows.
+
+"highlightColor" is the default color of the translucent overlay used
+to highlight the series when the mouse hovers over it.
+
+The "colors" array specifies a default color theme to get colors for
+the data series from. You can specify as many colors as you like, like
+this:
+
+```js
+colors: ["#d18b2c", "#dba255", "#919733"]
+```
+
+If there are more data series than colors, Flot will try to generate
+extra colors by lightening and darkening colors in the theme.
+
+
+## Customizing the grid ##
+
+```js
+grid: {
+ show: boolean
+ aboveData: boolean
+ color: color
+ backgroundColor: color/gradient or null
+ margin: number or margin object
+ labelMargin: number
+ axisMargin: number
+ markings: array of markings or (fn: axes -> array of markings)
+ borderWidth: number or object with "top", "right", "bottom" and "left" properties with different widths
+ borderColor: color or null or object with "top", "right", "bottom" and "left" properties with different colors
+ minBorderMargin: number or null
+ clickable: boolean
+ hoverable: boolean
+ autoHighlight: boolean
+ mouseActiveRadius: number
+}
+
+interaction: {
+ redrawOverlayInterval: number or -1
+}
+```
+
+The grid is the thing with the axes and a number of ticks. Many of the
+things in the grid are configured under the individual axes, but not
+all. "color" is the color of the grid itself whereas "backgroundColor"
+specifies the background color inside the grid area, here null means
+that the background is transparent. You can also set a gradient, see
+the gradient documentation below.
+
+You can turn off the whole grid including tick labels by setting
+"show" to false. "aboveData" determines whether the grid is drawn
+above the data or below (below is default).
+
+"margin" is the space in pixels between the canvas edge and the grid,
+which can be either a number or an object with individual margins for
+each side, in the form:
+
+```js
+margin: {
+ top: top margin in pixels
+ left: left margin in pixels
+ bottom: bottom margin in pixels
+ right: right margin in pixels
+}
+```
+
+"labelMargin" is the space in pixels between tick labels and axis
+line, and "axisMargin" is the space in pixels between axes when there
+are two next to each other.
+
+"borderWidth" is the width of the border around the plot. Set it to 0
+to disable the border. Set it to an object with "top", "right",
+"bottom" and "left" properties to use different widths. You can
+also set "borderColor" if you want the border to have a different color
+than the grid lines. Set it to an object with "top", "right", "bottom"
+and "left" properties to use different colors. "minBorderMargin" controls
+the default minimum margin around the border - it's used to make sure
+that points aren't accidentally clipped by the canvas edge so by default
+the value is computed from the point radius.
+
+"markings" is used to draw simple lines and rectangular areas in the
+background of the plot. You can either specify an array of ranges on
+the form { xaxis: { from, to }, yaxis: { from, to } } (with multiple
+axes, you can specify coordinates for other axes instead, e.g. as
+x2axis/x3axis/...) or with a function that returns such an array given
+the axes for the plot in an object as the first parameter.
+
+You can set the color of markings by specifying "color" in the ranges
+object. Here's an example array:
+
+```js
+markings: [ { xaxis: { from: 0, to: 2 }, yaxis: { from: 10, to: 10 }, color: "#bb0000" }, ... ]
+```
+
+If you leave out one of the values, that value is assumed to go to the
+border of the plot. So for example if you only specify { xaxis: {
+from: 0, to: 2 } } it means an area that extends from the top to the
+bottom of the plot in the x range 0-2.
+
+A line is drawn if from and to are the same, e.g.
+
+```js
+markings: [ { yaxis: { from: 1, to: 1 } }, ... ]
+```
+
+would draw a line parallel to the x axis at y = 1. You can control the
+line width with "lineWidth" in the range object.
+
+An example function that makes vertical stripes might look like this:
+
+```js
+markings: function (axes) {
+ var markings = [];
+ for (var x = Math.floor(axes.xaxis.min); x < axes.xaxis.max; x += 2)
+ markings.push({ xaxis: { from: x, to: x + 1 } });
+ return markings;
+}
+```
+
+If you set "clickable" to true, the plot will listen for click events
+on the plot area and fire a "plotclick" event on the placeholder with
+a position and a nearby data item object as parameters. The coordinates
+are available both in the unit of the axes (not in pixels) and in
+global screen coordinates.
+
+Likewise, if you set "hoverable" to true, the plot will listen for
+mouse move events on the plot area and fire a "plothover" event with
+the same parameters as the "plotclick" event. If "autoHighlight" is
+true (the default), nearby data items are highlighted automatically.
+If needed, you can disable highlighting and control it yourself with
+the highlight/unhighlight plot methods described elsewhere.
+
+You can use "plotclick" and "plothover" events like this:
+
+```js
+$.plot($("#placeholder"), [ d ], { grid: { clickable: true } });
+
+$("#placeholder").bind("plotclick", function (event, pos, item) {
+ alert("You clicked at " + pos.x + ", " + pos.y);
+ // axis coordinates for other axes, if present, are in pos.x2, pos.x3, ...
+ // if you need global screen coordinates, they are pos.pageX, pos.pageY
+
+ if (item) {
+ highlight(item.series, item.datapoint);
+ alert("You clicked a point!");
+ }
+});
+```
+
+The item object in this example is either null or a nearby object on the form:
+
+```js
+item: {
+ datapoint: the point, e.g. [0, 2]
+ dataIndex: the index of the point in the data array
+ series: the series object
+ seriesIndex: the index of the series
+ pageX, pageY: the global screen coordinates of the point
+}
+```
+
+For instance, if you have specified the data like this
+
+```js
+$.plot($("#placeholder"), [ { label: "Foo", data: [[0, 10], [7, 3]] } ], ...);
+```
+
+and the mouse is near the point (7, 3), "datapoint" is [7, 3],
+"dataIndex" will be 1, "series" is a normalized series object with
+among other things the "Foo" label in series.label and the color in
+series.color, and "seriesIndex" is 0. Note that plugins and options
+that transform the data can shift the indexes from what you specified
+in the original data array.
+
+If you use the above events to update some other information and want
+to clear out that info in case the mouse goes away, you'll probably
+also need to listen to "mouseout" events on the placeholder div.
+
+"mouseActiveRadius" specifies how far the mouse can be from an item
+and still activate it. If there are two or more points within this
+radius, Flot chooses the closest item. For bars, the top-most bar
+(from the latest specified data series) is chosen.
+
+If you want to disable interactivity for a specific data series, you
+can set "hoverable" and "clickable" to false in the options for that
+series, like this:
+
+```js
+{ data: [...], label: "Foo", clickable: false }
+```
+
+"redrawOverlayInterval" specifies the maximum time to delay a redraw
+of interactive things (this works as a rate limiting device). The
+default is capped to 60 frames per second. You can set it to -1 to
+disable the rate limiting.
+
+
+## Specifying gradients ##
+
+A gradient is specified like this:
+
+```js
+{ colors: [ color1, color2, ... ] }
+```
+
+For instance, you might specify a background on the grid going from
+black to gray like this:
+
+```js
+grid: {
+ backgroundColor: { colors: ["#000", "#999"] }
+}
+```
+
+For the series you can specify the gradient as an object that
+specifies the scaling of the brightness and the opacity of the series
+color, e.g.
+
+```js
+{ colors: [{ opacity: 0.8 }, { brightness: 0.6, opacity: 0.8 } ] }
+```
+
+where the first color simply has its alpha scaled, whereas the second
+is also darkened. For instance, for bars the following makes the bars
+gradually disappear, without outline:
+
+```js
+bars: {
+ show: true,
+ lineWidth: 0,
+ fill: true,
+ fillColor: { colors: [ { opacity: 0.8 }, { opacity: 0.1 } ] }
+}
+```
+
+Flot currently only supports vertical gradients drawn from top to
+bottom because that's what works with IE.
+
+
+## Plot Methods ##
+
+The Plot object returned from the plot function has some methods you
+can call:
+
+ - highlight(series, datapoint)
+
+ Highlight a specific datapoint in the data series. You can either
+ specify the actual objects, e.g. if you got them from a
+ "plotclick" event, or you can specify the indices, e.g.
+ highlight(1, 3) to highlight the fourth point in the second series
+ (remember, zero-based indexing).
+
+ - unhighlight(series, datapoint) or unhighlight()
+
+ Remove the highlighting of the point, same parameters as
+ highlight.
+
+ If you call unhighlight with no parameters, e.g. as
+ plot.unhighlight(), all current highlights are removed.
+
+ - setData(data)
+
+ You can use this to reset the data used. Note that axis scaling,
+ ticks, legend etc. will not be recomputed (use setupGrid() to do
+ that). You'll probably want to call draw() afterwards.
+
+ You can use this function to speed up redrawing a small plot if
+ you know that the axes won't change. Put in the new data with
+ setData(newdata), call draw(), and you're good to go. Note that
+ for large datasets, almost all the time is consumed in draw()
+ plotting the data so in this case don't bother.
+
+ - setupGrid()
+
+ Recalculate and set axis scaling, ticks, legend etc.
+
+ Note that because of the drawing model of the canvas, this
+ function will immediately redraw (actually reinsert in the DOM)
+ the labels and the legend, but not the actual tick lines because
+ they're drawn on the canvas. You need to call draw() to get the
+ canvas redrawn.
+
+ - draw()
+
+ Redraws the plot canvas.
+
+ - triggerRedrawOverlay()
+
+ Schedules an update of an overlay canvas used for drawing
+ interactive things like a selection and point highlights. This
+ is mostly useful for writing plugins. The redraw doesn't happen
+ immediately, instead a timer is set to catch multiple successive
+ redraws (e.g. from a mousemove). You can get to the overlay by
+ setting up a drawOverlay hook.
+
+ - width()/height()
+
+ Gets the width and height of the plotting area inside the grid.
+ This is smaller than the canvas or placeholder dimensions as some
+ extra space is needed (e.g. for labels).
+
+ - offset()
+
+ Returns the offset of the plotting area inside the grid relative
+ to the document, useful for instance for calculating mouse
+ positions (event.pageX/Y minus this offset is the pixel position
+ inside the plot).
+
+ - pointOffset({ x: xpos, y: ypos })
+
+ Returns the calculated offset of the data point at (x, y) in data
+ space within the placeholder div. If you are working with multiple
+ axes, you can specify the x and y axis references, e.g.
+
+ ```js
+ o = pointOffset({ x: xpos, y: ypos, xaxis: 2, yaxis: 3 })
+ // o.left and o.top now contains the offset within the div
+ ````
+
+ - resize()
+
+ Tells Flot to resize the drawing canvas to the size of the
+ placeholder. You need to run setupGrid() and draw() afterwards as
+ canvas resizing is a destructive operation. This is used
+ internally by the resize plugin.
+
+ - shutdown()
+
+ Cleans up any event handlers Flot has currently registered. This
+ is used internally.
+
+There are also some members that let you peek inside the internal
+workings of Flot which is useful in some cases. Note that if you change
+something in the objects returned, you're changing the objects used by
+Flot to keep track of its state, so be careful.
+
+ - getData()
+
+ Returns an array of the data series currently used in normalized
+ form with missing settings filled in according to the global
+ options. So for instance to find out what color Flot has assigned
+ to the data series, you could do this:
+
+ ```js
+ var series = plot.getData();
+ for (var i = 0; i < series.length; ++i)
+ alert(series[i].color);
+ ```
+
+ A notable other interesting field besides color is datapoints
+ which has a field "points" with the normalized data points in a
+ flat array (the field "pointsize" is the increment in the flat
+ array to get to the next point so for a dataset consisting only of
+ (x,y) pairs it would be 2).
+
+ - getAxes()
+
+ Gets an object with the axes. The axes are returned as the
+ attributes of the object, so for instance getAxes().xaxis is the
+ x axis.
+
+ Various things are stuffed inside an axis object, e.g. you could
+ use getAxes().xaxis.ticks to find out what the ticks are for the
+ xaxis. Two other useful attributes are p2c and c2p, functions for
+ transforming from data point space to the canvas plot space and
+ back. Both returns values that are offset with the plot offset.
+ Check the Flot source code for the complete set of attributes (or
+ output an axis with console.log() and inspect it).
+
+ With multiple axes, the extra axes are returned as x2axis, x3axis,
+ etc., e.g. getAxes().y2axis is the second y axis. You can check
+ y2axis.used to see whether the axis is associated with any data
+ points and y2axis.show to see if it is currently shown.
+
+ - getPlaceholder()
+
+ Returns placeholder that the plot was put into. This can be useful
+ for plugins for adding DOM elements or firing events.
+
+ - getCanvas()
+
+ Returns the canvas used for drawing in case you need to hack on it
+ yourself. You'll probably need to get the plot offset too.
+
+ - getPlotOffset()
+
+ Gets the offset that the grid has within the canvas as an object
+ with distances from the canvas edges as "left", "right", "top",
+ "bottom". I.e., if you draw a circle on the canvas with the center
+ placed at (left, top), its center will be at the top-most, left
+ corner of the grid.
+
+ - getOptions()
+
+ Gets the options for the plot, normalized, with default values
+ filled in. You get a reference to actual values used by Flot, so
+ if you modify the values in here, Flot will use the new values.
+ If you change something, you probably have to call draw() or
+ setupGrid() or triggerRedrawOverlay() to see the change.
+
+
+## Hooks ##
+
+In addition to the public methods, the Plot object also has some hooks
+that can be used to modify the plotting process. You can install a
+callback function at various points in the process, the function then
+gets access to the internal data structures in Flot.
+
+Here's an overview of the phases Flot goes through:
+
+ 1. Plugin initialization, parsing options
+
+ 2. Constructing the canvases used for drawing
+
+ 3. Set data: parsing data specification, calculating colors,
+ copying raw data points into internal format,
+ normalizing them, finding max/min for axis auto-scaling
+
+ 4. Grid setup: calculating axis spacing, ticks, inserting tick
+ labels, the legend
+
+ 5. Draw: drawing the grid, drawing each of the series in turn
+
+ 6. Setting up event handling for interactive features
+
+ 7. Responding to events, if any
+
+ 8. Shutdown: this mostly happens in case a plot is overwritten
+
+Each hook is simply a function which is put in the appropriate array.
+You can add them through the "hooks" option, and they are also available
+after the plot is constructed as the "hooks" attribute on the returned
+plot object, e.g.
+
+```js
+ // define a simple draw hook
+ function hellohook(plot, canvascontext) { alert("hello!"); };
+
+ // pass it in, in an array since we might want to specify several
+ var plot = $.plot(placeholder, data, { hooks: { draw: [hellohook] } });
+
+ // we can now find it again in plot.hooks.draw[0] unless a plugin
+ // has added other hooks
+```
+
+The available hooks are described below. All hook callbacks get the
+plot object as first parameter. You can find some examples of defined
+hooks in the plugins bundled with Flot.
+
+ - processOptions [phase 1]
+
+ ```function(plot, options)```
+
+ Called after Flot has parsed and merged options. Useful in the
+ instance where customizations beyond simple merging of default
+ values is needed. A plugin might use it to detect that it has been
+ enabled and then turn on or off other options.
+
+
+ - processRawData [phase 3]
+
+ ```function(plot, series, data, datapoints)```
+
+ Called before Flot copies and normalizes the raw data for the given
+ series. If the function fills in datapoints.points with normalized
+ points and sets datapoints.pointsize to the size of the points,
+ Flot will skip the copying/normalization step for this series.
+
+ In any case, you might be interested in setting datapoints.format,
+ an array of objects for specifying how a point is normalized and
+ how it interferes with axis scaling. It accepts the following options:
+
+ ```js
+ {
+ x, y: boolean,
+ number: boolean,
+ required: boolean,
+ defaultValue: value,
+ autoscale: boolean
+ }
+ ```
+
+ "x" and "y" specify whether the value is plotted against the x or y axis,
+ and is currently used only to calculate axis min-max ranges. The default
+ format array, for example, looks like this:
+
+ ```js
+ [
+ { x: true, number: true, required: true },
+ { y: true, number: true, required: true }
+ ]
+ ```
+
+ This indicates that a point, i.e. [0, 25], consists of two values, with the
+ first being plotted on the x axis and the second on the y axis.
+
+ If "number" is true, then the value must be numeric, and is set to null if
+ it cannot be converted to a number.
+
+ "defaultValue" provides a fallback in case the original value is null. This
+ is for instance handy for bars, where one can omit the third coordinate
+ (the bottom of the bar), which then defaults to zero.
+
+ If "required" is true, then the value must exist (be non-null) for the
+ point as a whole to be valid. If no value is provided, then the entire
+ point is cleared out with nulls, turning it into a gap in the series.
+
+ "autoscale" determines whether the value is considered when calculating an
+ automatic min-max range for the axes that the value is plotted against.
+
+ - processDatapoints [phase 3]
+
+ ```function(plot, series, datapoints)```
+
+ Called after normalization of the given series but before finding
+ min/max of the data points. This hook is useful for implementing data
+ transformations. "datapoints" contains the normalized data points in
+ a flat array as datapoints.points with the size of a single point
+ given in datapoints.pointsize. Here's a simple transform that
+ multiplies all y coordinates by 2:
+
+ ```js
+ function multiply(plot, series, datapoints) {
+ var points = datapoints.points, ps = datapoints.pointsize;
+ for (var i = 0; i < points.length; i += ps)
+ points[i + 1] *= 2;
+ }
+ ```
+
+ Note that you must leave datapoints in a good condition as Flot
+ doesn't check it or do any normalization on it afterwards.
+
+ - processOffset [phase 4]
+
+ ```function(plot, offset)```
+
+ Called after Flot has initialized the plot's offset, but before it
+ draws any axes or plot elements. This hook is useful for customizing
+ the margins between the grid and the edge of the canvas. "offset" is
+ an object with attributes "top", "bottom", "left" and "right",
+ corresponding to the margins on the four sides of the plot.
+
+ - drawBackground [phase 5]
+
+ ```function(plot, canvascontext)```
+
+ Called before all other drawing operations. Used to draw backgrounds
+ or other custom elements before the plot or axes have been drawn.
+
+ - drawSeries [phase 5]
+
+ ```function(plot, canvascontext, series)```
+
+ Hook for custom drawing of a single series. Called just before the
+ standard drawing routine has been called in the loop that draws
+ each series.
+
+ - draw [phase 5]
+
+ ```function(plot, canvascontext)```
+
+ Hook for drawing on the canvas. Called after the grid is drawn
+ (unless it's disabled or grid.aboveData is set) and the series have
+ been plotted (in case any points, lines or bars have been turned
+ on). For examples of how to draw things, look at the source code.
+
+ - bindEvents [phase 6]
+
+ ```function(plot, eventHolder)```
+
+ Called after Flot has setup its event handlers. Should set any
+ necessary event handlers on eventHolder, a jQuery object with the
+ canvas, e.g.
+
+ ```js
+ function (plot, eventHolder) {
+ eventHolder.mousedown(function (e) {
+ alert("You pressed the mouse at " + e.pageX + " " + e.pageY);
+ });
+ }
+ ```
+
+ Interesting events include click, mousemove, mouseup/down. You can
+ use all jQuery events. Usually, the event handlers will update the
+ state by drawing something (add a drawOverlay hook and call
+ triggerRedrawOverlay) or firing an externally visible event for
+ user code. See the crosshair plugin for an example.
+
+ Currently, eventHolder actually contains both the static canvas
+ used for the plot itself and the overlay canvas used for
+ interactive features because some versions of IE get the stacking
+ order wrong. The hook only gets one event, though (either for the
+ overlay or for the static canvas).
+
+ Note that custom plot events generated by Flot are not generated on
+ eventHolder, but on the div placeholder supplied as the first
+ argument to the plot call. You can get that with
+ plot.getPlaceholder() - that's probably also the one you should use
+ if you need to fire a custom event.
+
+ - drawOverlay [phase 7]
+
+ ```function (plot, canvascontext)```
+
+ The drawOverlay hook is used for interactive things that need a
+ canvas to draw on. The model currently used by Flot works the way
+ that an extra overlay canvas is positioned on top of the static
+ canvas. This overlay is cleared and then completely redrawn
+ whenever something interesting happens. This hook is called when
+ the overlay canvas is to be redrawn.
+
+ "canvascontext" is the 2D context of the overlay canvas. You can
+ use this to draw things. You'll most likely need some of the
+ metrics computed by Flot, e.g. plot.width()/plot.height(). See the
+ crosshair plugin for an example.
+
+ - shutdown [phase 8]
+
+ ```function (plot, eventHolder)```
+
+ Run when plot.shutdown() is called, which usually only happens in
+ case a plot is overwritten by a new plot. If you're writing a
+ plugin that adds extra DOM elements or event handlers, you should
+ add a callback to clean up after you. Take a look at the section in
+ the [PLUGINS](PLUGINS.md) document for more info.
+
+
+## Plugins ##
+
+Plugins extend the functionality of Flot. To use a plugin, simply
+include its Javascript file after Flot in the HTML page.
+
+If you're worried about download size/latency, you can concatenate all
+the plugins you use, and Flot itself for that matter, into one big file
+(make sure you get the order right), then optionally run it through a
+Javascript minifier such as YUI Compressor.
+
+Here's a brief explanation of how the plugin plumbings work:
+
+Each plugin registers itself in the global array $.plot.plugins. When
+you make a new plot object with $.plot, Flot goes through this array
+calling the "init" function of each plugin and merging default options
+from the "option" attribute of the plugin. The init function gets a
+reference to the plot object created and uses this to register hooks
+and add new public methods if needed.
+
+See the [PLUGINS](PLUGINS.md) document for details on how to write a plugin. As the
+above description hints, it's actually pretty easy.
+
+
+## Version number ##
+
+The version number of Flot is available in ```$.plot.version```.
diff --git a/Lib/flot/FAQ.md b/Lib/flot/FAQ.md
new file mode 100644
index 0000000..9131e04
--- /dev/null
+++ b/Lib/flot/FAQ.md
@@ -0,0 +1,75 @@
+## Frequently asked questions ##
+
+#### How much data can Flot cope with? ####
+
+Flot will happily draw everything you send to it so the answer
+depends on the browser. The excanvas emulation used for IE (built with
+VML) makes IE by far the slowest browser so be sure to test with that
+if IE users are in your target group (for large plots in IE, you can
+also check out Flashcanvas which may be faster).
+
+1000 points is not a problem, but as soon as you start having more
+points than the pixel width, you should probably start thinking about
+downsampling/aggregation as this is near the resolution limit of the
+chart anyway. If you downsample server-side, you also save bandwidth.
+
+
+#### Flot isn't working when I'm using JSON data as source! ####
+
+Actually, Flot loves JSON data, you just got the format wrong.
+Double check that you're not inputting strings instead of numbers,
+like [["0", "-2.13"], ["5", "4.3"]]. This is most common mistake, and
+the error might not show up immediately because Javascript can do some
+conversion automatically.
+
+
+#### Can I export the graph? ####
+
+You can grab the image rendered by the canvas element used by Flot
+as a PNG or JPEG (remember to set a background). Note that it won't
+include anything not drawn in the canvas (such as the legend). And it
+doesn't work with excanvas which uses VML, but you could try
+Flashcanvas.
+
+
+#### The bars are all tiny in time mode? ####
+
+It's not really possible to determine the bar width automatically.
+So you have to set the width with the barWidth option which is NOT in
+pixels, but in the units of the x axis (or the y axis for horizontal
+bars). For time mode that's milliseconds so the default value of 1
+makes the bars 1 millisecond wide.
+
+
+#### Can I use Flot with libraries like Mootools or Prototype? ####
+
+Yes, Flot supports it out of the box and it's easy! Just use jQuery
+instead of $, e.g. call jQuery.plot instead of $.plot and use
+jQuery(something) instead of $(something). As a convenience, you can
+put in a DOM element for the graph placeholder where the examples and
+the API documentation are using jQuery objects.
+
+Depending on how you include jQuery, you may have to add one line of
+code to prevent jQuery from overwriting functions from the other
+libraries, see the documentation in jQuery ("Using jQuery with other
+libraries") for details.
+
+
+#### Flot doesn't work with [insert name of Javascript UI framework]! ####
+
+Flot is using standard HTML to make charts. If this is not working,
+it's probably because the framework you're using is doing something
+weird with the DOM or with the CSS that is interfering with Flot.
+
+A common problem is that there's display:none on a container until the
+user does something. Many tab widgets work this way, and there's
+nothing wrong with it - you just can't call Flot inside a display:none
+container as explained in the README so you need to hold off the Flot
+call until the container is actually displayed (or use
+visibility:hidden instead of display:none or move the container
+off-screen).
+
+If you find there's a specific thing we can do to Flot to help, feel
+free to submit a bug report. Otherwise, you're welcome to ask for help
+on the forum/mailing list, but please don't submit a bug report to
+Flot.
diff --git a/Lib/flot/Makefile b/Lib/flot/Makefile
new file mode 100644
index 0000000..2e070d0
--- /dev/null
+++ b/Lib/flot/Makefile
@@ -0,0 +1,12 @@
+# Makefile for generating minified files
+
+.PHONY: all
+
+# we cheat and process all .js files instead of an exhaustive list
+all: $(patsubst %.js,%.min.js,$(filter-out %.min.js,$(wildcard *.js)))
+
+%.min.js: %.js
+ yui-compressor $< -o $@
+
+test:
+ ./node_modules/.bin/jshint *jquery.flot.js
diff --git a/Lib/flot/NEWS.md b/Lib/flot/NEWS.md
new file mode 100644
index 0000000..ad0303d
--- /dev/null
+++ b/Lib/flot/NEWS.md
@@ -0,0 +1,1026 @@
+## Flot 0.8.3 ##
+
+### Changes ###
+
+- Updated example code to avoid encouraging unnecessary re-plots.
+ (patch by soenter, pull request #1221)
+
+### Bug fixes ###
+
+ - Added a work-around to disable the allocation of extra space for first and
+ last axis ticks, allowing plots to span the full width of their container.
+ A proper solution for this bug will be implemented in the 0.9 release.
+ (reported by Josh Pigford and andig, issue #1212, pull request #1290)
+
+ - Fixed a regression introduced in 0.8.1, where the last tick label would
+ sometimes wrap rather than extending the plot's offset to create space.
+ (reported by Elite Gamer, issue #1283)
+
+ - Fixed a regression introduced in 0.8.2, where the resize plugin would use
+ unexpectedly high amounts of CPU even when idle.
+ (reported by tommie, issue #1277, pull request #1289)
+
+ - Fixed the selection example to work with jQuery 1.9.x and later.
+ (reported by EGLadona and dmfalke, issue #1250, pull request #1285)
+
+ - Added a detach shim to fix support for jQuery versions earlier than 1.4.x.
+ (reported by ngavard, issue #1240, pull request #1286)
+
+ - Fixed a rare 'Uncaught TypeError' when using the resize plugin in IE 7/8.
+ (reported by tleish, issue #1265, pull request #1289)
+
+ - Fixed zoom constraints to apply only in the direction of the zoom.
+ (patch by Neil Katin, issue #1204, pull request #1205)
+
+ - Markings lines are no longer blurry when drawn on pixel boundaries.
+ (reported by btccointicker and Rouillard, issue #1210)
+
+ - Don't discard original pie data-series values when combining slices.
+ (patch by Phil Tsarik, pull request #1238)
+
+ - Fixed broken auto-scale behavior when using deprecated [x|y]2axis options.
+ (reported by jorese, issue #1228, pull request #1284)
+
+ - Exposed the dateGenerator function on the plot object, as it used to be
+ before time-mode was moved into a separate plugin.
+ (patch by Paolo Valleri, pull request #1028)
+
+
+## Flot 0.8.2 ##
+
+### Changes ###
+
+ - Added a plot.destroy method as a way to free memory when emptying the plot
+ placeholder and then re-using it for some other purpose.
+ (patch by Thodoris Greasidis, issue #1129, pull request #1130)
+
+ - Added a table of contents and PLUGINS link to the API documentation.
+ (patches by Brian Peiris, pull requests #1064 and #1127)
+
+ - Added Ruby code examples for time conversion.
+ (patch by Mike Połtyn, pull request #1182)
+
+ - Minor improvements to API.md and README.md.
+ (patches by Patrik Ragnarsson, pull requests #1085 and #1086)
+
+ - Updated inlined jQuery Resize to the latest version to fix errors.
+ (reported by Matthew Sabol and sloker, issues #997 ad #1081)
+
+### Bug fixes ###
+
+ - Fixed an unexpected change in behavior that resulted in duplicate tick
+ labels when using a plugin, like flot-tickrotor, that overrode tick labels.
+ (patch by Mark Cote, pull request #1091)
+
+ - Fixed a regression from 0.7 where axis labels were given the wrong width,
+ causing them to overlap at certain scales and ignore the labelWidth option.
+ (patch by Benjamin Gram, pull request #1177)
+
+ - Fixed a bug where the second axis in an xaxes/yaxes array incorrectly had
+ its 'innermost' property set to false or undefined, even if it was on the
+ other side of the plot from the first axis. This resulted in the axis bar
+ being visible when it shouldn't have been, which was especially obvious
+ when the grid had a left/right border width of zero.
+ (reported by Teq1, fix researched by ryleyb, issue #1056)
+
+ - Fixed an error when using a placeholder that has no font-size property.
+ (patch by Craig Oldford, pull request #1135)
+
+ - Fixed a regression from 0.7 where nulls at the end of a series were ignored
+ for purposes of determing the range of the x-axis.
+ (reported by Munsifali Rashid, issue #1095)
+
+ - If a font size is provided, base the default lineHeight on that size rather
+ that the font size of the plot placeholder, which may be very different.
+ (reported by Daniel Hoffmann Bernardes, issue #1131, pull request #1199)
+
+ - Fix broken highlighting for right-aligned bars.
+ (reported by BeWiBu and Mihai Stanciu, issues #975 and #1093, with further
+ assistance by Eric Byers, pull request #1120)
+
+ - Prevent white circles from sometimes showing up inside of pie charts.
+ (reported by Pierre Dubois and Jack Klink, issues #1128 and #1073)
+
+ - Label formatting no longer breaks when a page contains multiple pie charts.
+ (reported by Brend Wanders, issue #1055)
+
+ - When using multiple axes on opposite sides of the plot, the innermost axis
+ coming later in the list no longer has its bar drawn incorrectly.
+ (reported by ryleyb, issue #1056)
+
+ - When removing series labels and redrawing the plot, the legend now updates
+ correctly even when using an external container.
+ (patch by Luis Silva, issue #1159, pull request #1160)
+
+ - The pie plugin no longer ignores the value of the left offset option.
+ (reported by melanker, issue #1136)
+
+ - Fixed a regression from 0.7, where extra padding was added unnecessarily to
+ sides of the plot where there was no last tick label.
+ (reported by sknob001, issue #1048, pull request #1200)
+
+ - Fixed incorrect tooltip behavior in the interacting example.
+ (patch by cleroux, issue #686, pull request #1074)
+
+ - Fixed an error in CSS color extraction with elements outside the DOM.
+ (patch by execjosh, pull request #1084)
+
+ - Fixed :not selector error when using jQuery without Sizzle.
+ (patch by Anthony Ryan, pull request #1180)
+
+ - Worked around a browser issue that caused bars to appear un-filled.
+ (reported by irbian, issue #915)
+
+## Flot 0.8.1 ##
+
+### Bug fixes ###
+
+ - Fixed a regression in the time plugin, introduced in 0.8, that caused dates
+ to align to the minute rather than to the highest appropriate unit. This
+ caused many x-axes in 0.8 to have different ticks than they did in 0.7.
+ (reported by Tom Sheppard, patch by Daniel Shapiro, issue #1017, pull
+ request #1023)
+
+ - Fixed a regression in text rendering, introduced in 0.8, that caused axis
+ labels with the same text as another label on the same axis to disappear.
+ More generally, it's again possible to have the same text in two locations.
+ (issue #1032)
+
+ - Fixed a regression in text rendering, introduced in 0.8, where axis labels
+ were no longer assigned an explicit width, and their text could not wrap.
+ (reported by sabregreen, issue #1019)
+
+ - Fixed a regression in the pie plugin, introduced in 0.8, that prevented it
+ from accepting data in the format '[[x, y]]'.
+ (patch by Nicolas Morel, pull request #1024)
+
+ - The 'zero' series option and 'autoscale' format option are no longer
+ ignored when the series contains a null value.
+ (reported by Daniel Shapiro, issue #1033)
+
+ - Avoid triggering the time-mode plugin exception when there are zero series.
+ (reported by Daniel Rothig, patch by Mark Raymond, issue #1016)
+
+ - When a custom color palette has fewer colors than the default palette, Flot
+ no longer fills out the colors with the remainder of the default.
+ (patch by goorpy, issue #1031, pull request #1034)
+
+ - Fixed missing update for bar highlights after a zoom or other redraw.
+ (reported by Paolo Valleri, issue #1030)
+
+ - Fixed compatibility with jQuery versions earlier than 1.7.
+ (patch by Lee Willis, issue #1027, pull request #1027)
+
+ - The mouse wheel no longer scrolls the page when using the navigate plugin.
+ (patch by vird, pull request #1020)
+
+ - Fixed missing semicolons in the core library.
+ (reported by Michal Zglinski)
+
+
+## Flot 0.8.0 ##
+
+### API changes ###
+
+Support for time series has been moved into a plugin, jquery.flot.time.js.
+This results in less code if time series are not used. The functionality
+remains the same (plus timezone support, as described below); however, the
+plugin must be included if axis.mode is set to "time".
+
+When the axis mode is "time", the axis option "timezone" can be set to null,
+"browser", or a particular timezone (e.g. "America/New_York") to control how
+the dates are displayed. If null, the dates are displayed as UTC. If
+"browser", the dates are displayed in the time zone of the user's browser.
+
+Date/time formatting has changed and now follows a proper subset of the
+standard strftime specifiers, plus one nonstandard specifier for quarters.
+Additionally, if a strftime function is found in the Date object's prototype,
+it will be used instead of the built-in formatter.
+
+Axis tick labels now use the class 'flot-tick-label' instead of 'tickLabel'.
+The text containers for each axis now use the classes 'flot-[x|y]-axis' and
+'flot-[x|y]#-axis' instead of '[x|y]Axis' and '[x|y]#Axis'. For compatibility
+with Flot 0.7 and earlier text will continue to use the old classes as well,
+but they are considered deprecated and will be removed in a future version.
+
+In previous versions the axis 'color' option was used to set the color of tick
+marks and their label text. It now controls the color of the axis line, which
+previously could not be changed separately, and continues to act as a default
+for the tick-mark color. The color of tick label text is now set either by
+overriding the 'flot-tick-label' CSS rule or via the axis 'font' option.
+
+A new plugin, jquery.flot.canvas.js, allows axis tick labels to be rendered
+directly to the canvas, rather than using HTML elements. This feature can be
+toggled with a simple option, making it easy to create interactive plots in the
+browser using HTML, then re-render them to canvas for export as an image.
+
+The plugin tries to remain as faithful as possible to the original HTML render,
+and goes so far as to automatically extract styles from CSS, to avoid having to
+provide a separate set of styles when rendering to canvas. Due to limitations
+of the canvas text API, the plugin cannot reproduce certain features, including
+HTML markup embedded in labels, and advanced text styles such as 'em' units.
+
+The plugin requires support for canvas text, which may not be present in some
+older browsers, even if they support the canvas tag itself. To use the plugin
+with these browsers try using a shim such as canvas-text or FlashCanvas.
+
+The base and overlay canvas are now using the CSS classes "flot-base" and
+"flot-overlay" to prevent accidental clashes (issue 540).
+
+### Changes ###
+
+ - Addition of nonstandard %q specifier to date/time formatting. (patch
+ by risicle, issue 49)
+
+ - Date/time formatting follows proper subset of strftime specifiers, and
+ support added for Date.prototype.strftime, if found. (patch by Mark Cote,
+ issues 419 and 558)
+
+ - Fixed display of year ticks. (patch by Mark Cote, issue 195)
+
+ - Support for time series moved to plugin. (patch by Mark Cote)
+
+ - Display time series in different time zones. (patch by Knut Forkalsrud,
+ issue 141)
+
+ - Added a canvas plugin to enable rendering axis tick labels to the canvas.
+ (sponsored by YCharts.com, implementation by Ole Laursen and David Schnur)
+
+ - Support for setting the interval between redraws of the overlay canvas with
+ redrawOverlayInterval. (suggested in issue 185)
+
+ - Support for multiple thresholds in thresholds plugin. (patch by Arnaud
+ Bellec, issue 523)
+
+ - Support for plotting categories/textual data directly with new categories
+ plugin.
+
+ - Tick generators now get the whole axis rather than just min/max.
+
+ - Added processOffset and drawBackground hooks. (suggested in issue 639)
+
+ - Added a grid "margin" option to set the space between the canvas edge and
+ the grid.
+
+ - Prevent the pie example page from generating single-slice pies. (patch by
+ Shane Reustle)
+
+ - In addition to "left" and "center", bars now recognize "right" as an
+ alignment option. (patch by Michael Mayer, issue 520)
+
+ - Switched from toFixed to a much faster default tickFormatter. (patch by
+ Clemens Stolle)
+
+ - Added to a more helpful error when using a time-mode axis without including
+ the flot.time plugin. (patch by Yael Elmatad)
+
+ - Added a legend "sorted" option to control sorting of legend entries
+ independent of their series order. (patch by Tom Cleaveland)
+
+ - Added a series "highlightColor" option to control the color of the
+ translucent overlay that identifies the dataset when the mouse hovers over
+ it. (patch by Eric Wendelin and Nate Abele, issues 168 and 299)
+
+ - Added a plugin jquery.flot.errorbars, with an accompanying example, that
+ adds the ability to plot error bars, commonly used in many kinds of
+ statistical data visualizations. (patch by Rui Pereira, issue 215)
+
+ - The legend now omits entries whose labelFormatter returns null. (patch by
+ Tom Cleaveland, Christopher Lambert, and Simon Strandgaard)
+
+ - Added support for high pixel density (retina) displays, resulting in much
+ crisper charts on such devices. (patch by Olivier Guerriat, additional
+ fixes by Julien Thomas, maimairel, and Lau Bech Lauritzen)
+
+ - Added the ability to control pie shadow position and alpha via a new pie
+ 'shadow' option. (patch by Julien Thomas, pull request #78)
+
+ - Added the ability to set width and color for individual sides of the grid.
+ (patch by Ara Anjargolian, additional fixes by Karl Swedberg, pull requests #855
+ and #880)
+
+ - The selection plugin's getSelection now returns null when the selection
+ has been cleared. (patch by Nick Campbell, pull request #852)
+
+ - Added a new option called 'zero' to bars and filled lines series, to control
+ whether the y-axis minimum is scaled to fit the data or set to zero.
+ (patch by David Schnur, issues #316, #529, and #856, pull request #911)
+
+ - The plot function is now also a jQuery chainable property.
+ (patch by David Schnur, issues #734 and #816, pull request #953)
+
+ - When only a single pie slice is beneath the combine threshold it is no longer
+ replaced by an 'other' slice. (suggested by Devin Bayer, issue #638)
+
+ - Added lineJoin and minSize options to the selection plugin to control the
+ corner style and minimum size of the selection, respectively.
+ (patch by Ruth Linehan, pull request #963)
+
+### Bug fixes ###
+
+ - Fix problem with null values and pie plugin. (patch by gcruxifix,
+ issue 500)
+
+ - Fix problem with threshold plugin and bars. (based on patch by
+ kaarlenkaski, issue 348)
+
+ - Fix axis box calculations so the boxes include the outermost part of the
+ labels too.
+
+ - Fix problem with event clicking and hovering in IE 8 by updating Excanvas
+ and removing previous work-around. (test case by Ara Anjargolian)
+
+ - Fix issues with blurry 1px border when some measures aren't integer.
+ (reported by Ara Anjargolian)
+
+ - Fix bug with formats in the data processor. (reported by Peter Hull,
+ issue 534)
+
+ - Prevent i from being declared global in extractRange. (reported by
+ Alexander Obukhov, issue 627)
+
+ - Throw errors in a more cross-browser-compatible manner. (patch by
+ Eddie Kay)
+
+ - Prevent pie slice outlines from being drawn when the stroke width is zero.
+ (reported by Chris Minett, issue 585)
+
+ - Updated the navigate plugin's inline copy of jquery.mousewheel to fix
+ Webkit zoom problems. (reported by Hau Nguyen, issue 685)
+
+ - Axis labels no longer appear as decimals rather than integers in certain
+ cases. (patch by Clemens Stolle, issue 541)
+
+ - Automatic color generation no longer produces only whites and blacks when
+ there are many series. (patch by David Schnur and Tom Cleaveland)
+
+ - Fixed an error when custom tick labels weren't provided as strings. (patch
+ by Shad Downey)
+
+ - Prevented the local insertSteps and fmt variables from becoming global.
+ (first reported by Marc Bennewitz and Szymon Barglowski, patch by Nick
+ Campbell, issues #825 and #831, pull request #851)
+
+ - Prevented several threshold plugin variables from becoming global. (patch
+ by Lasse Dahl Ebert)
+
+ - Fixed various jQuery 1.8 compatibility issues. (issues #814 and #819,
+ pull request #877)
+
+ - Pie charts with a slice equal to or approaching 100% of the pie no longer
+ appear invisible. (patch by David Schnur, issues #444, #658, #726, #824
+ and #850, pull request #879)
+
+ - Prevented several local variables from becoming global. (patch by aaa707)
+
+ - Ensure that the overlay and primary canvases remain aligned. (issue #670,
+ pull request #901)
+
+ - Added support for jQuery 1.9 by removing and replacing uses of $.browser.
+ (analysis and patch by Anthony Ryan, pull request #905)
+
+ - Pie charts no longer disappear when redrawn during a resize or update.
+ (reported by Julien Bec, issue #656, pull request #910)
+
+ - Avoided floating-point precision errors when calculating pie percentages.
+ (patch by James Ward, pull request #918)
+
+ - Fixed compatibility with jQuery 1.2.6, which has no 'mouseleave' shortcut.
+ (reported by Bevan, original pull request #920, replaced by direct patch)
+
+ - Fixed sub-pixel rendering issues with crosshair and selection lines.
+ (patches by alanayoub and Daniel Shapiro, pull requests #17 and #925)
+
+ - Fixed rendering issues when using the threshold plugin with several series.
+ (patch by Ivan Novikov, pull request #934)
+
+ - Pie charts no longer disappear when redrawn after calling setData().
+ (reported by zengge1984 and pareeohnos, issues #810 and #945)
+
+ - Added a work-around for the problem where points with a lineWidth of zero
+ still showed up with a visible line. (reported by SalvoSav, issue #842,
+ patch by Jamie Hamel-Smith, pull request #937)
+
+ - Pie charts now accept values in string form, like other plot types.
+ (reported by laerdal.no, issue #534)
+
+ - Avoid rounding errors in the threshold plugin.
+ (reported by jerikojerk, issue #895)
+
+ - Fixed an error when using the navigate plugin with jQuery 1.9.x or later.
+ (reported by Paolo Valleri, issue #964)
+
+ - Fixed inconsistencies between the highlight and unhighlight functions.
+ (reported by djamshed, issue #987)
+
+ - Fixed recalculation of tickSize and tickDecimals on calls to setupGrid.
+ (patch by thecountofzero, pull request #861, issues #860, #1000)
+
+
+## Flot 0.7 ##
+
+### API changes ###
+
+Multiple axes support. Code using dual axes should be changed from using
+x2axis/y2axis in the options to using an array (although backwards-
+compatibility hooks are in place). For instance,
+
+```js
+{
+ xaxis: { ... }, x2axis: { ... },
+ yaxis: { ... }, y2axis: { ... }
+}
+```
+
+becomes
+
+```js
+{
+ xaxes: [ { ... }, { ... } ],
+ yaxes: [ { ... }, { ... } ]
+}
+```
+
+Note that if you're just using one axis, continue to use the xaxis/yaxis
+directly (it now sets the default settings for the arrays). Plugins touching
+the axes must be ported to take the extra axes into account, check the source
+to see some examples.
+
+A related change is that the visibility of axes is now auto-detected. So if
+you were relying on an axis to show up even without any data in the chart, you
+now need to set the axis "show" option explicitly.
+
+"tickColor" on the grid options is now deprecated in favour of a corresponding
+option on the axes, so:
+
+```js
+{ grid: { tickColor: "#000" }}
+```
+
+becomes
+
+```js
+{ xaxis: { tickColor: "#000"}, yaxis: { tickColor: "#000"} }
+```
+
+But if you just configure a base color Flot will now autogenerate a tick color
+by adding transparency. Backwards-compatibility hooks are in place.
+
+Final note: now that IE 9 is coming out with canvas support, you may want to
+adapt the excanvas include to skip loading it in IE 9 (the examples have been
+adapted thanks to Ryley Breiddal). An alternative to excanvas using Flash has
+also surfaced, if your graphs are slow in IE, you may want to give it a spin:
+
+ http://code.google.com/p/flashcanvas/
+
+### Changes ###
+
+ - Support for specifying a bottom for each point for line charts when filling
+ them, this means that an arbitrary bottom can be used instead of just the x
+ axis. (based on patches patiently provided by Roman V. Prikhodchenko)
+
+ - New fillbetween plugin that can compute a bottom for a series from another
+ series, useful for filling areas between lines.
+
+ See new example percentiles.html for a use case.
+
+ - More predictable handling of gaps for the stacking plugin, now all
+ undefined ranges are skipped.
+
+ - Stacking plugin can stack horizontal bar charts.
+
+ - Navigate plugin now redraws the plot while panning instead of only after
+ the fact. (raised by lastthemy, issue 235)
+
+ Can be disabled by setting the pan.frameRate option to null.
+
+ - Date formatter now accepts %0m and %0d to get a zero-padded month or day.
+ (issue raised by Maximillian Dornseif)
+
+ - Revamped internals to support an unlimited number of axes, not just dual.
+ (sponsored by Flight Data Services, www.flightdataservices.com)
+
+ - New setting on axes, "tickLength", to control the size of ticks or turn
+ them off without turning off the labels.
+
+ - Axis labels are now put in container divs with classes, for instance labels
+ in the x axes can be reached via ".xAxis .tickLabel".
+
+ - Support for setting the color of an axis. (sponsored by Flight Data
+ Services, www.flightdataservices.com)
+
+ - Tick color is now auto-generated as the base color with some transparency,
+ unless you override it.
+
+ - Support for aligning ticks in the axes with "alignTicksWithAxis" to ensure
+ that they appear next to each other rather than in between, at the expense
+ of possibly awkward tick steps. (sponsored by Flight Data Services,
+ www.flightdataservices.com)
+
+ - Support for customizing the point type through a callback when plotting
+ points and new symbol plugin with some predefined point types. (sponsored
+ by Utility Data Corporation)
+
+ - Resize plugin for automatically redrawing when the placeholder changes
+ size, e.g. on window resizes. (sponsored by Novus Partners)
+
+ A resize() method has been added to plot object facilitate this.
+
+ - Support Infinity/-Infinity for plotting asymptotes by hacking it into
+ +/-Number.MAX_VALUE. (reported by rabaea.mircea)
+
+ - Support for restricting navigate plugin to not pan/zoom an axis. (based on
+ patch by kkaefer)
+
+ - Support for providing the drag cursor for the navigate plugin as an option.
+ (based on patch by Kelly T. Moore)
+
+ - Options for controlling whether an axis is shown or not (suggestion by Timo
+ Tuominen) and whether to reserve space for it even if it isn't shown.
+
+ - New attribute $.plot.version with the Flot version as a string.
+
+ - The version comment is now included in the minified jquery.flot.min.js.
+
+ - New options.grid.minBorderMargin for adjusting the minimum margin provided
+ around the border (based on patch by corani, issue 188).
+
+ - Refactor replot behaviour so Flot tries to reuse the existing canvas,
+ adding shutdown() methods to the plot. (based on patch by Ryley Breiddal,
+ issue 269)
+
+ This prevents a memory leak in Chrome and hopefully makes replotting faster
+ for those who are using $.plot instead of .setData()/.draw(). Also update
+ jQuery to 1.5.1 to prevent IE leaks fixed in jQuery.
+
+ - New real-time line chart example.
+
+ - New hooks: drawSeries, shutdown.
+
+### Bug fixes ###
+
+ - Fixed problem with findNearbyItem and bars on top of each other. (reported
+ by ragingchikn, issue 242)
+
+ - Fixed problem with ticks and the border. (based on patch from
+ ultimatehustler69, issue 236)
+
+ - Fixed problem with plugins adding options to the series objects.
+
+ - Fixed a problem introduced in 0.6 with specifying a gradient with:
+
+ ```{brightness: x, opacity: y }```
+
+ - Don't use $.browser.msie, check for getContext on the created canvas element
+ instead and try to use excanvas if it's not found.
+
+ Fixes IE 9 compatibility.
+
+ - highlight(s, index) was looking up the point in the original s.data instead
+ of in the computed datapoints array, which breaks with plugins that modify
+ the datapoints, such as the stacking plugin. (reported by curlypaul924,
+ issue 316)
+
+ - More robust handling of axis from data passed in from getData(). (reported)
+ by Morgan)
+
+ - Fixed problem with turning off bar outline. (fix by Jordi Castells,
+ issue 253)
+
+ - Check the selection passed into setSelection in the selection
+ plugin, to guard against errors when synchronizing plots (fix by Lau
+ Bech Lauritzen).
+
+ - Fix bug in crosshair code with mouseout resetting the crosshair even
+ if it is locked (fix by Lau Bech Lauritzen and Banko Adam).
+
+ - Fix bug with points plotting using line width from lines rather than
+ points.
+
+ - Fix bug with passing non-array 0 data (for plugins that don't expect
+ arrays, patch by vpapp1).
+
+ - Fix errors in JSON in examples so they work with jQuery 1.4.2
+ (fix reported by honestbleeps, issue 357).
+
+ - Fix bug with tooltip in interacting.html, this makes the tooltip
+ much smoother (fix by bdkahn). Fix related bug inside highlighting
+ handler in Flot.
+
+ - Use closure trick to make inline colorhelpers plugin respect
+ jQuery.noConflict(true), renaming the global jQuery object (reported
+ by Nick Stielau).
+
+ - Listen for mouseleave events and fire a plothover event with empty
+ item when it occurs to drop highlights when the mouse leaves the
+ plot (reported by by outspirit).
+
+ - Fix bug with using aboveData with a background (reported by
+ amitayd).
+
+ - Fix possible excanvas leak (report and suggested fix by tom9729).
+
+ - Fix bug with backwards compatibility for shadowSize = 0 (report and
+ suggested fix by aspinak).
+
+ - Adapt examples to skip loading excanvas (fix by Ryley Breiddal).
+
+ - Fix bug that prevent a simple f(x) = -x transform from working
+ correctly (fix by Mike, issue 263).
+
+ - Fix bug in restoring cursor in navigate plugin (reported by Matteo
+ Gattanini, issue 395).
+
+ - Fix bug in picking items when transform/inverseTransform is in use
+ (reported by Ofri Raviv, and patches and analysis by Jan and Tom
+ Paton, issue 334 and 467).
+
+ - Fix problem with unaligned ticks and hover/click events caused by
+ padding on the placeholder by hardcoding the placeholder padding to
+ 0 (reported by adityadineshsaxena, Matt Sommer, Daniel Atos and some
+ other people, issue 301).
+
+ - Update colorhelpers plugin to avoid dying when trying to parse an
+ invalid string (reported by cadavor, issue 483).
+
+
+
+## Flot 0.6 ##
+
+### API changes ###
+
+Selection support has been moved to a plugin. Thus if you're passing
+selection: { mode: something }, you MUST include the file
+jquery.flot.selection.js after jquery.flot.js. This reduces the size of
+base Flot and makes it easier to customize the selection as well as
+improving code clarity. The change is based on a patch from andershol.
+
+In the global options specified in the $.plot command, "lines", "points",
+"bars" and "shadowSize" have been moved to a sub-object called "series":
+
+```js
+$.plot(placeholder, data, { lines: { show: true }})
+```
+
+should be changed to
+
+```js
+ $.plot(placeholder, data, { series: { lines: { show: true }}})
+```
+
+All future series-specific options will go into this sub-object to
+simplify plugin writing. Backward-compatibility code is in place, so
+old code should not break.
+
+"plothover" no longer provides the original data point, but instead a
+normalized one, since there may be no corresponding original point.
+
+Due to a bug in previous versions of jQuery, you now need at least
+jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some improvements
+in event handling speed.
+
+## Changes ##
+
+ - Added support for disabling interactivity for specific data series.
+ (request from Ronald Schouten and Steve Upton)
+
+ - Flot now calls $() on the placeholder and optional legend container passed
+ in so you can specify DOM elements or CSS expressions to make it easier to
+ use Flot with libraries like Prototype or Mootools or through raw JSON from
+ Ajax responses.
+
+ - A new "plotselecting" event is now emitted while the user is making a
+ selection.
+
+ - The "plothover" event is now emitted immediately instead of at most 10
+ times per second, you'll have to put in a setTimeout yourself if you're
+ doing something really expensive on this event.
+
+ - The built-in date formatter can now be accessed as $.plot.formatDate(...)
+ (suggestion by Matt Manela) and even replaced.
+
+ - Added "borderColor" option to the grid. (patches from Amaury Chamayou and
+ Mike R. Williamson)
+
+ - Added support for gradient backgrounds for the grid. (based on patch from
+ Amaury Chamayou, issue 90)
+
+ The "setting options" example provides a demonstration.
+
+ - Gradient bars. (suggestion by stefpet)
+
+ - Added a "plotunselected" event which is triggered when the selection is
+ removed, see "selection" example. (suggestion by Meda Ugo)
+
+ - The option legend.margin can now specify horizontal and vertical margins
+ independently. (suggestion by someone who's annoyed)
+
+ - Data passed into Flot is now copied to a new canonical format to enable
+ further processing before it hits the drawing routines. As a side-effect,
+ this should make Flot more robust in the face of bad data. (issue 112)
+
+ - Step-wise charting: line charts have a new option "steps" that when set to
+ true connects the points with horizontal/vertical steps instead of diagonal
+ lines.
+
+ - The legend labelFormatter now passes the series in addition to just the
+ label. (suggestion by Vincent Lemeltier)
+
+ - Horizontal bars (based on patch by Jason LeBrun).
+
+ - Support for partial bars by specifying a third coordinate, i.e. they don't
+ have to start from the axis. This can be used to make stacked bars.
+
+ - New option to disable the (grid.show).
+
+ - Added pointOffset method for converting a point in data space to an offset
+ within the placeholder.
+
+ - Plugin system: register an init method in the $.flot.plugins array to get
+ started, see PLUGINS.txt for details on how to write plugins (it's easy).
+ There are also some extra methods to enable access to internal state.
+
+ - Hooks: you can register functions that are called while Flot is crunching
+ the data and doing the plot. This can be used to modify Flot without
+ changing the source, useful for writing plugins. Some hooks are defined,
+ more are likely to come.
+
+ - Threshold plugin: you can set a threshold and a color, and the data points
+ below that threshold will then get the color. Useful for marking data
+ below 0, for instance.
+
+ - Stack plugin: you can specify a stack key for each series to have them
+ summed. This is useful for drawing additive/cumulative graphs with bars and
+ (currently unfilled) lines.
+
+ - Crosshairs plugin: trace the mouse position on the axes, enable with
+ crosshair: { mode: "x"} (see the new tracking example for a use).
+
+ - Image plugin: plot prerendered images.
+
+ - Navigation plugin for panning and zooming a plot.
+
+ - More configurable grid.
+
+ - Axis transformation support, useful for non-linear plots, e.g. log axes and
+ compressed time axes (like omitting weekends).
+
+ - Support for twelve-hour date formatting (patch by Forrest Aldridge).
+
+ - The color parsing code in Flot has been cleaned up and split out so it's
+ now available as a separate jQuery plugin. It's included inline in the Flot
+ source to make dependency managing easier. This also makes it really easy
+ to use the color helpers in Flot plugins.
+
+## Bug fixes ##
+
+ - Fixed two corner-case bugs when drawing filled curves. (report and analysis
+ by Joshua Varner)
+
+ - Fix auto-adjustment code when setting min to 0 for an axis where the
+ dataset is completely flat on that axis. (report by chovy)
+
+ - Fixed a bug with passing in data from getData to setData when the secondary
+ axes are used. (reported by nperelman, issue 65)
+
+ - Fixed so that it is possible to turn lines off when no other chart type is
+ shown (based on problem reported by Glenn Vanderburg), and fixed so that
+ setting lineWidth to 0 also hides the shadow. (based on problem reported by
+ Sergio Nunes)
+
+ - Updated mousemove position expression to the latest from jQuery. (reported
+ by meyuchas)
+
+ - Use CSS borders instead of background in legend. (issues 25 and 45)
+
+ - Explicitly convert axis min/max to numbers.
+
+ - Fixed a bug with drawing marking lines with different colors. (reported by
+ Khurram)
+
+ - Fixed a bug with returning y2 values in the selection event. (fix by
+ exists, issue 75)
+
+ - Only set position relative on placeholder if it hasn't already a position
+ different from static. (reported by kyberneticist, issue 95)
+
+ - Don't round markings to prevent sub-pixel problems. (reported by
+ Dan Lipsitt)
+
+ - Make the grid border act similarly to a regular CSS border, i.e. prevent
+ it from overlapping the plot itself. This also fixes a problem with anti-
+ aliasing when the width is 1 pixel. (reported by Anthony Ettinger)
+
+ - Imported version 3 of excanvas and fixed two issues with the newer version.
+ Hopefully, this will make Flot work with IE8. (nudge by Fabien Menager,
+ further analysis by Booink, issue 133)
+
+ - Changed the shadow code for lines to hopefully look a bit better with
+ vertical lines.
+
+ - Round tick positions to avoid possible problems with fractions. (suggestion
+ by Fred, issue 130)
+
+ - Made the heuristic for determining how many ticks to aim for a bit smarter.
+
+ - Fix for uneven axis margins (report and patch by Paul Kienzle) and snapping
+ to ticks. (report and patch by lifthrasiir)
+
+ - Fixed bug with slicing in findNearbyItems. (patch by zollman)
+
+ - Make heuristic for x axis label widths more dynamic. (patch by
+ rickinhethuis)
+
+ - Make sure points on top take precedence when finding nearby points when
+ hovering. (reported by didroe, issue 224)
+
+
+
+## Flot 0.5 ##
+
+Timestamps are now in UTC. Also "selected" event -> becomes "plotselected"
+with new data, the parameters for setSelection are now different (but
+backwards compatibility hooks are in place), coloredAreas becomes markings
+with a new interface (but backwards compatibility hooks are in place).
+
+### API changes ###
+
+Timestamps in time mode are now displayed according to UTC instead of the time
+zone of the visitor. This affects the way the timestamps should be input;
+you'll probably have to offset the timestamps according to your local time
+zone. It also affects any custom date handling code (which basically now
+should use the equivalent UTC date mehods, e.g. .setUTCMonth() instead of
+.setMonth().
+
+Markings, previously coloredAreas, are now specified as ranges on the axes,
+like ```{ xaxis: { from: 0, to: 10 }}```. Furthermore with markings you can
+now draw horizontal/vertical lines by setting from and to to the same
+coordinate. (idea from line support patch by by Ryan Funduk)
+
+Interactivity: added a new "plothover" event and this and the "plotclick"
+event now returns the closest data item (based on patch by /david, patch by
+Mark Byers for bar support). See the revamped "interacting with the data"
+example for some hints on what you can do.
+
+Highlighting: you can now highlight points and datapoints are autohighlighted
+when you hover over them (if hovering is turned on).
+
+Support for dual axis has been added (based on patch by someone who's annoyed
+and /david). For each data series you can specify which axes it belongs to,
+and there are two more axes, x2axis and y2axis, to customize. This affects the
+"selected" event which has been renamed to "plotselected" and spews out
+```{ xaxis: { from: -10, to: 20 } ... },``` setSelection in which the
+parameters are on a new form (backwards compatible hooks are in place so old
+code shouldn't break) and markings (formerly coloredAreas).
+
+## Changes ##
+
+ - Added support for specifying the size of tick labels (axis.labelWidth,
+ axis.labelHeight). Useful for specifying a max label size to keep multiple
+ plots aligned.
+
+ - The "fill" option can now be a number that specifies the opacity of the
+ fill.
+
+ - You can now specify a coordinate as null (like [2, null]) and Flot will
+ take the other coordinate into account when scaling the axes. (based on
+ patch by joebno)
+
+ - New option for bars "align". Set it to "center" to center the bars on the
+ value they represent.
+
+ - setSelection now takes a second parameter which you can use to prevent the
+ method from firing the "plotselected" handler.
+
+ - Improved the handling of axis auto-scaling with bars.
+
+## Bug fixes ##
+
+ - Fixed a bug in calculating spacing around the plot. (reported by
+ timothytoe)
+
+ - Fixed a bug in finding max values for all-negative data sets.
+
+ - Prevent the possibility of eternal looping in tick calculations.
+
+ - Fixed a bug when borderWidth is set to 0. (reported by Rob/sanchothefat)
+
+ - Fixed a bug with drawing bars extending below 0. (reported by James Hewitt,
+ patch by Ryan Funduk).
+
+ - Fixed a bug with line widths of bars. (reported by MikeM)
+
+ - Fixed a bug with 'nw' and 'sw' legend positions.
+
+ - Fixed a bug with multi-line x-axis tick labels. (reported by Luca Ciano,
+ IE-fix help by Savage Zhang)
+
+ - Using the "container" option in legend now overwrites the container element
+ instead of just appending to it, fixing the infinite legend bug. (reported
+ by several people, fix by Brad Dewey)
+
+
+
+## Flot 0.4 ##
+
+### API changes ###
+
+Deprecated axis.noTicks in favor of just specifying the number as axis.ticks.
+So ```xaxis: { noTicks: 10 }``` becomes ```xaxis: { ticks: 10 }```.
+
+Time series support. Specify axis.mode: "time", put in Javascript timestamps
+as data, and Flot will automatically spit out sensible ticks. Take a look at
+the two new examples. The format can be customized with axis.timeformat and
+axis.monthNames, or if that fails with axis.tickFormatter.
+
+Support for colored background areas via grid.coloredAreas. Specify an array
+of { x1, y1, x2, y2 } objects or a function that returns these given
+{ xmin, xmax, ymin, ymax }.
+
+More members on the plot object (report by Chris Davies and others).
+"getData" for inspecting the assigned settings on data series (e.g. color) and
+"setData", "setupGrid" and "draw" for updating the contents without a total
+replot.
+
+The default number of ticks to aim for is now dependent on the size of the
+plot in pixels. Support for customizing tick interval sizes directly with
+axis.minTickSize and axis.tickSize.
+
+Cleaned up the automatic axis scaling algorithm and fixed how it interacts
+with ticks. Also fixed a couple of tick-related corner case bugs (one reported
+by mainstreetmark, another reported by timothytoe).
+
+The option axis.tickFormatter now takes a function with two parameters, the
+second parameter is an optional object with information about the axis. It has
+min, max, tickDecimals, tickSize.
+
+## Changes ##
+
+ - Added support for segmented lines. (based on patch from Michael MacDonald)
+
+ - Added support for ignoring null and bad values. (suggestion from Nick
+ Konidaris and joshwaihi)
+
+ - Added support for changing the border width. (thanks to joebno and safoo)
+
+ - Label colors can be changed via CSS by selecting the tickLabel class.
+
+## Bug fixes ##
+
+ - Fixed a bug in handling single-item bar series. (reported by Emil Filipov)
+
+ - Fixed erratic behaviour when interacting with the plot with IE 7. (reported
+ by Lau Bech Lauritzen).
+
+ - Prevent IE/Safari text selection when selecting stuff on the canvas.
+
+
+
+## Flot 0.3 ##
+
+This is mostly a quick-fix release because jquery.js wasn't included in the
+previous zip/tarball.
+
+## Changes ##
+
+ - Include jquery.js in the zip/tarball.
+
+ - Support clicking on the plot. Turn it on with grid: { clickable: true },
+ then you get a "plotclick" event on the graph placeholder with the position
+ in units of the plot.
+
+## Bug fixes ##
+
+ - Fixed a bug in dealing with data where min = max. (thanks to Michael
+ Messinides)
+
+
+
+## Flot 0.2 ##
+
+The API should now be fully documented.
+
+### API changes ###
+
+Moved labelMargin option to grid from x/yaxis.
+
+## Changes ##
+
+ - Added support for putting a background behind the default legend. The
+ default is the partly transparent background color. Added backgroundColor
+ and backgroundOpacity to the legend options to control this.
+
+ - The ticks options can now be a callback function that takes one parameter,
+ an object with the attributes min and max. The function should return a
+ ticks array.
+
+ - Added labelFormatter option in legend, useful for turning the legend
+ labels into links.
+
+ - Reduced the size of the code. (patch by Guy Fraser)
+
+
+
+## Flot 0.1 ##
+
+First public release.
diff --git a/Lib/flot/PLUGINS.md b/Lib/flot/PLUGINS.md
new file mode 100644
index 0000000..b5bf300
--- /dev/null
+++ b/Lib/flot/PLUGINS.md
@@ -0,0 +1,143 @@
+## Writing plugins ##
+
+All you need to do to make a new plugin is creating an init function
+and a set of options (if needed), stuffing it into an object and
+putting it in the $.plot.plugins array. For example:
+
+```js
+function myCoolPluginInit(plot) {
+ plot.coolstring = "Hello!";
+};
+
+$.plot.plugins.push({ init: myCoolPluginInit, options: { ... } });
+
+// if $.plot is called, it will return a plot object with the
+// attribute "coolstring"
+```
+
+Now, given that the plugin might run in many different places, it's
+a good idea to avoid leaking names. The usual trick here is wrap the
+above lines in an anonymous function which is called immediately, like
+this: (function () { inner code ... })(). To make it even more robust
+in case $ is not bound to jQuery but some other Javascript library, we
+can write it as
+
+```js
+(function ($) {
+ // plugin definition
+ // ...
+})(jQuery);
+```
+
+There's a complete example below, but you should also check out the
+plugins bundled with Flot.
+
+
+## Complete example ##
+
+Here is a simple debug plugin which alerts each of the series in the
+plot. It has a single option that control whether it is enabled and
+how much info to output:
+
+```js
+(function ($) {
+ function init(plot) {
+ var debugLevel = 1;
+
+ function checkDebugEnabled(plot, options) {
+ if (options.debug) {
+ debugLevel = options.debug;
+ plot.hooks.processDatapoints.push(alertSeries);
+ }
+ }
+
+ function alertSeries(plot, series, datapoints) {
+ var msg = "series " + series.label;
+ if (debugLevel > 1) {
+ msg += " with " + series.data.length + " points";
+ alert(msg);
+ }
+ }
+
+ plot.hooks.processOptions.push(checkDebugEnabled);
+ }
+
+ var options = { debug: 0 };
+
+ $.plot.plugins.push({
+ init: init,
+ options: options,
+ name: "simpledebug",
+ version: "0.1"
+ });
+})(jQuery);
+```
+
+We also define "name" and "version". It's not used by Flot, but might
+be helpful for other plugins in resolving dependencies.
+
+Put the above in a file named "jquery.flot.debug.js", include it in an
+HTML page and then it can be used with:
+
+```js
+ $.plot($("#placeholder"), [...], { debug: 2 });
+```
+
+This simple plugin illustrates a couple of points:
+
+ - It uses the anonymous function trick to avoid name pollution.
+ - It can be enabled/disabled through an option.
+ - Variables in the init function can be used to store plot-specific
+ state between the hooks.
+
+The two last points are important because there may be multiple plots
+on the same page, and you'd want to make sure they are not mixed up.
+
+
+## Shutting down a plugin ##
+
+Each plot object has a shutdown hook which is run when plot.shutdown()
+is called. This usually mostly happens in case another plot is made on
+top of an existing one.
+
+The purpose of the hook is to give you a chance to unbind any event
+handlers you've registered and remove any extra DOM things you've
+inserted.
+
+The problem with event handlers is that you can have registered a
+handler which is run in some point in the future, e.g. with
+setTimeout(). Meanwhile, the plot may have been shutdown and removed,
+but because your event handler is still referencing it, it can't be
+garbage collected yet, and worse, if your handler eventually runs, it
+may overwrite stuff on a completely different plot.
+
+
+## Some hints on the options ##
+
+Plugins should always support appropriate options to enable/disable
+them because the plugin user may have several plots on the same page
+where only one should use the plugin. In most cases it's probably a
+good idea if the plugin is turned off rather than on per default, just
+like most of the powerful features in Flot.
+
+If the plugin needs options that are specific to each series, like the
+points or lines options in core Flot, you can put them in "series" in
+the options object, e.g.
+
+```js
+var options = {
+ series: {
+ downsample: {
+ algorithm: null,
+ maxpoints: 1000
+ }
+ }
+}
+```
+
+Then they will be copied by Flot into each series, providing default
+values in case none are specified.
+
+Think hard and long about naming the options. These names are going to
+be public API, and code is going to depend on them if the plugin is
+successful.
diff --git a/Lib/flot/date.format.min.js b/Lib/flot/date.format.min.js
new file mode 100644
index 0000000..66bd630
--- /dev/null
+++ b/Lib/flot/date.format.min.js
@@ -0,0 +1 @@
+var dateFormat=function(){var t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,e=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,a=/[^-+\dA-Z]/g,m=function(t,e){for(t=String(t),e=e||2;t.length99?Math.round(c/10):c),t:12>l?"a":"p",tt:12>l?"am":"pm",T:12>l?"A":"P",TT:12>l?"AM":"PM",Z:r?"UTC":(String(d).match(e)||[""]).pop().replace(a,""),o:(g>0?"-":"+")+m(100*Math.floor(Math.abs(g)/60)+Math.abs(g)%60,4),S:["th","st","nd","rd"][i%10>3?0:(i%100-i%10!=10)*i%10]};return n.replace(t,function(t){return t in S?S[t]:t.slice(1,t.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},Date.prototype.format=function(t,e){return dateFormat(this,t,e)};
\ No newline at end of file
diff --git a/Lib/flot/jquery.flot.togglelegend.js b/Lib/flot/jquery.flot.togglelegend.js
new file mode 100644
index 0000000..d0e10c3
--- /dev/null
+++ b/Lib/flot/jquery.flot.togglelegend.js
@@ -0,0 +1,135 @@
+/*
+
+ Allows series to be toggled using their entries in the chart legend.
+ Supports series groups.
+
+ TODO:
+ * Disable visual feedback (usually so dev can implement their own)
+
+ History:
+ 0.3 - 7 Mar 2013 -> jamesinc https://github.com/jamesinc/flot/commit/20f899cf4257f91860068f6ecae9871d6d00cde3
+ 0.5 - 1 Feb 2015 -> software-monkey refactor
+
+ */
+
+(function ( $ ) {
+ var options = {
+ legend: {
+ toggle: false // set to true in plot options to enable
+ },
+ toggle: {
+ scale: "visible" // scale y-axis to only "visible" series or "all" series
+ }
+ },
+ toggle = function ( el, plot, datasets ) {
+ var cell,
+ row,
+ index,
+ isCell = el.is("td"),
+ toggleState = $(plot.getPlaceholder()).data("togglestate");
+ if ( isCell || (el.parents("td").length) ) {
+ cell = ( isCell ? el : el.parents("td") );
+ row = cell.parent();
+ index = row.index();
+
+ // Check if the line is already hidden and toggle accordingly
+ if ( toggleState.has(index) ) {
+ datasets[index].data = datasets[index].hiddenData;
+ delete datasets[index].hiddenData;
+ toggleState['delete'](index); // workaround for https://github.com/yui/yuicompressor/issues/122
+ restoreLegendEntry(row);
+ } else {
+ datasets[index].hiddenData = datasets[index].data;
+ datasets[index].data = [];
+ toggleState.add(index);
+ hideLegendEntry(row);
+ }
+
+ $(plot.getPlaceholder()).data("togglestate", toggleState);
+
+ redraw(plot, datasets);
+ }
+ },
+ hideLegendEntry = function ( entry ) {
+ entry.data("legendopacity", entry.css("opacity"));
+ entry.css("opacity", "0.40");
+ },
+ restoreLegendEntry = function ( entry ) {
+ entry.css("opacity", entry.data("legendopacity"));
+ },
+ redraw = function ( plot, datasets ) {
+ plot.setData(datasets);
+ if ( plot.getOptions().toggle.scale == "visible" ) {
+ plot.setupGrid();
+ }
+ plot.draw();
+ },
+ setupToggle = function ( plot ) {
+ plot.hooks.drawSeries.push(function ( plot, canvascontext, series ) {
+ var datasets = plot.getData(),
+ toggleState = $(plot.getPlaceholder()).data("togglestate"),
+ changed = false;
+
+ for ( var i = 0; i < datasets.length; i++ ) {
+ // Keep hidden series hidden when graph is redrawn (e.g. from zooming)
+ if ( toggleState.has(i) && datasets[i].hiddenData === undefined ) {
+ datasets[i].hiddenData = datasets[i].data;
+ datasets[i].data = [];
+ changed = true;
+ }
+ }
+
+ if ( changed ) {
+ redraw(plot, datasets);
+ }
+ });
+
+ plot.hooks.legendInserted.push(function ( plot, legend ) {
+ var cells = legend.find("td"),
+ datasets = plot.getData(),
+ toggleState = $(plot.getPlaceholder()).data("togglestate");
+
+ // Update the legend if there are hidden series
+ for ( var i = 0; i < cells.length; i += 2 ) {
+ if ( toggleState.has(i / 2) ) {
+ hideLegendEntry($(cells[i]).parent());
+ }
+ }
+
+ legend
+ .unbind("click.flot")
+ .bind("selectstart", function ( e ) {
+ e.preventDefault();
+ return false;
+
+ })
+ .bind("click.flot", function ( e ) {
+ toggle($(e.target), plot, datasets);
+
+ })
+ .find("td").css("cursor", "pointer");
+ });
+ },
+ init = function ( plot ) {
+ var toggleState = $(plot.getPlaceholder()).data("togglestate");
+
+ if ( typeof toggleState === 'undefined' ) {
+ toggleState = new Set();
+ $(plot.getPlaceholder()).data("togglestate", toggleState);
+ }
+
+ plot.hooks.processOptions.push(function ( plot, options ) {
+ if ( options.legend.toggle ) {
+ setupToggle(plot);
+ }
+ });
+ };
+
+ $.plot.plugins.push({
+ init: init,
+ options: options,
+ name: 'toggleLegend',
+ version: '0.5'
+ });
+
+}(jQuery));
diff --git a/Lib/flot/jquery.flot.togglelegend.min.js b/Lib/flot/jquery.flot.togglelegend.min.js
new file mode 100644
index 0000000..7b1ff35
--- /dev/null
+++ b/Lib/flot/jquery.flot.togglelegend.min.js
@@ -0,0 +1 @@
+(function(e){var b={legend:{toggle:false},toggle:{scale:"visible"}},a=function(n,o,m){var i,p,l,j=n.is("td"),k=e(o.getPlaceholder()).data("togglestate");if(j||(n.parents("td").length)){i=(j?n:n.parents("td"));p=i.parent();l=p.index();if(k.has(l)){m[l].data=m[l].hiddenData;delete m[l].hiddenData;k["delete"](l);d(p)}else{m[l].hiddenData=m[l].data;m[l].data=[];k.add(l);c(p)}e(o.getPlaceholder()).data("togglestate",k);h(o,m)}},c=function(i){i.data("legendopacity",i.css("opacity"));i.css("opacity","0.40")},d=function(i){i.css("opacity",i.data("legendopacity"))},h=function(j,i){j.setData(i);if(j.getOptions().toggle.scale=="visible"){j.setupGrid()}j.draw()},f=function(i){i.hooks.drawSeries.push(function(o,k,m){var n=o.getData(),j=e(o.getPlaceholder()).data("togglestate"),p=false;for(var l=0;l rect.x + rect.width) {
+ startTouchPosition.x = rect.x + rect.width;
+ }
+
+ if (startTouchPosition.y < rect.y) {
+ startTouchPosition.y = rect.y;
+ }
+ else if (startTouchPosition.y > rect.y + rect.height) {
+ startTouchPosition.y = rect.y + rect.height;
+ }
+
+ scaleOrigin = {
+ x: Math.round((startTouchPosition.x / rect.width) * 100),
+ y: Math.round((startTouchPosition.y / rect.height) * 100)
+ };
+
+ if (options.touch.css) {
+ placeholder.css('transform-origin', scaleOrigin.x + '% ' + scaleOrigin.y + '%');
+ }
+
+ placeholder.trigger("touchstarted", [ startTouchPosition ]);
+ // return false to prevent touch scrolling.
+ return false;
+ });
+
+ placeholder.bind('touchmove', function(evt) {
+ var options = plot.getOptions();
+ var touches = evt.originalEvent.touches;
+ var position, distance, delta;
+
+ if (isPanning && touches.length === 1) {
+ position = {
+ x: touches[0].pageX,
+ y: touches[0].pageY
+ };
+ delta = {
+ x: lastTouchPosition.x - position.x,
+ y: lastTouchPosition.y - position.y
+ };
+
+ // transform via the delta
+ pan(delta);
+
+ lastTouchPosition = position;
+ lastTouchDistance = 0;
+ }
+ else if (isZooming && touches.length === 2) {
+ distance = Math.sqrt(Math.pow(touches[1].pageX - touches[0].pageX, 2) + Math.pow(touches[1].pageY - touches[0].pageY, 2));
+ position = {
+ x: (touches[0].pageX + touches[1].pageX) / 2,
+ y: (touches[0].pageY + touches[1].pageY) / 2
+ };
+ delta = distance - lastTouchDistance;
+
+ // scale via the delta
+ scale(delta);
+
+ lastTouchPosition = position;
+ lastTouchDistance = distance;
+ }
+
+ if (!options.touch.css) { // no css updates
+ var now = new Date().getTime(),
+ framedelay = now - lastRedraw; // ms for each update
+ if (framedelay > 50) {
+ lastRedraw = now;
+ window.requestAnimationFrame(redraw);
+ }
+ }
+ });
+
+ placeholder.bind('touchend', function(evt) {
+ var placeholder = plot.getPlaceholder();
+ var options = plot.getOptions();
+ var touches = evt.originalEvent.changedTouches;
+
+ // reset the tap counter
+ tapTimer = setTimeout(function() { tapNum = 0; }, options.touch.dbltapThreshold);
+ // check if tap or dbltap
+ if (isPanning && touches.length === 1 && (tapTimestamp + options.touch.tapThreshold) - getTimestamp() >= 0 &&
+ startTouchPosition.x >= lastTouchPosition.x - options.touch.tapPrecision &&
+ startTouchPosition.x <= lastTouchPosition.x + options.touch.tapPrecision &&
+ startTouchPosition.y >= lastTouchPosition.y - options.touch.tapPrecision &&
+ startTouchPosition.y <= lastTouchPosition.y + options.touch.tapPrecision)
+ {
+ //Fire plugin Tap event
+ if (tapNum === 2) {
+ placeholder.trigger("dbltap", [ lastTouchPosition ]);
+ } else {
+ placeholder.trigger("tap", [ lastTouchPosition ]);
+ }
+
+ if (options.touch.simulClick) {
+ // Simulate mouse click event
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent
+ var simulatedEvent = new MouseEvent("click", {
+ bubbles: true,
+ cancelable: true,
+ view: window,
+ detail: tapNum, // num of clicks
+ screenX: touches[0].screenX,
+ screenY: touches[0].screenY,
+ clientX: touches[0].clientX,
+ clientY: touches[0].clientY,
+ button: 0 // left mouse button
+ });
+ touches[0].target.dispatchEvent(simulatedEvent);
+ }
+ }
+ else
+ {
+ var r = {};
+ c1 = { x: 0, y: 0};
+ c2 = { x: plot.width(), y: plot.height()};
+ $.each(plot.getAxes(), function (name, axis) {
+ if (axis.used) {
+ var p1 = axis.c2p(c1[axis.direction]), p2 = axis.c2p(c2[axis.direction]);
+ r[name] = { from: Math.min(p1, p2), to: Math.max(p1, p2) };
+ }
+ });
+
+ eventdelayTouchEnded = setTimeout(function(){ placeholder.trigger("touchended", [ r ]); }, options.touch.delayTouchEnded);
+ }
+
+ isPanning = false;
+ isZooming = false;
+ lastTouchPosition = { x: -1, y: -1 };
+ startTouchPosition = lastTouchPosition;
+ lastTouchDistance = 0;
+ relativeOffset = { x: 0, y: 0 };
+ relativeScale = 1.0;
+ scaleOrigin = { x: 50, y: 50 };
+
+ if (options.touch.css) {
+ placeholder.css({
+ 'transform': 'translate(' + relativeOffset.x + 'px,' + relativeOffset.y + 'px) scale(' + relativeScale + ')',
+ 'transform-origin': scaleOrigin.x + '% ' + scaleOrigin.y + '%'
+ });
+ }
+
+
+ });
+
+ }
+
+ function redraw() {
+ var options = plot.getOptions();
+ updateAxesMinMax();
+
+ if (typeof options.touch.callback == 'function') {
+ options.touch.callback();
+ }
+ else {
+ plot.setupGrid();
+ plot.draw();
+ }
+ }
+
+
+ function updateAxesMinMax() {
+ var options = plot.getOptions();
+
+ // Apply the pan.
+ if (relativeOffset.x !== 0 || relativeOffset.y !== 0) {
+ $.each(plot.getAxes(), function(index, axis) {
+ if (axis.direction === options.touch.pan.toLowerCase() || options.touch.pan.toLowerCase() == 'xy') {
+ var min = axis.c2p(axis.p2c(axis.touch.min) - relativeOffset[axis.direction]);
+ var max = axis.c2p(axis.p2c(axis.touch.max) - relativeOffset[axis.direction]);
+
+ axis.options.min = min;
+ axis.options.max = max;
+ }
+ });
+ }
+
+ // Apply the scale.
+ if (relativeScale !== 1.0) {
+ var width = plot.width();
+ var height = plot.height();
+ var scaleOriginPixel = {
+ x: Math.round((scaleOrigin.x / 100) * width),
+ y: Math.round((scaleOrigin.y / 100) * height)
+ };
+ var range = {
+ x: {
+ min: scaleOriginPixel.x - (scaleOrigin.x / 100) * width / relativeScale,
+ max: scaleOriginPixel.x + (1 - (scaleOrigin.x / 100)) * width / relativeScale
+ },
+ y: {
+ min: scaleOriginPixel.y - (scaleOrigin.y / 100) * height / relativeScale,
+ max: scaleOriginPixel.y + (1 - (scaleOrigin.y / 100)) * height / relativeScale
+ }
+ };
+
+ $.each(plot.getAxes(), function(index, axis) {
+ if (axis.direction === options.touch.scale.toLowerCase() || options.touch.scale.toLowerCase() == 'xy') {
+ var min = axis.c2p(range[axis.direction].min);
+ var max = axis.c2p(range[axis.direction].max);
+
+ if (min > max) {
+ var temp = min;
+ min = max;
+ max = temp;
+ }
+
+ axis.options.min = min;
+ axis.options.max = max;
+ }
+ });
+ }
+ }
+
+
+
+ function processDatapoints(plot, series, datapoints) {
+ if (window.devicePixelRatio) {
+ var placeholder = plot.getPlaceholder();
+ placeholder.children('canvas').each(function(index, canvas) {
+ var context = canvas.getContext('2d');
+ var width = $(canvas).attr('width');
+ var height = $(canvas).attr('height');
+
+ $(canvas).attr('width', width * window.devicePixelRatio);
+ $(canvas).attr('height', height * window.devicePixelRatio);
+ $(canvas).css('width', width + 'px');
+ $(canvas).css('height', height + 'px');
+
+ context.scale(window.devicePixelRatio, window.devicePixelRatio);
+ });
+ }
+ }
+
+ function shutdown(plot, eventHolder) {
+ var placeholder = plot.getPlaceholder();
+ placeholder.unbind('touchstart').unbind('touchmove').unbind('touchend');
+ }
+
+ plot.hooks.processOptions.push(processOptions);
+ plot.hooks.bindEvents.push(bindEvents);
+ //plot.hooks.processDatapoints.push(processDatapoints); // For retina, slow on android
+ plot.hooks.shutdown.push(shutdown);
+ }
+
+ $.plot.plugins.push({
+ init: init,
+ options: {
+ touch: {
+ pan: 'xy', // what axis pan work
+ scale: 'xy', // what axis zoom work
+ css: false, // use css instead of redraw the graph (ugly!)
+ autoWidth: false,
+ autoHeight: false,
+ delayTouchEnded: 500, // delay in ms before touchended event is fired if no more touches
+ callback: null, // other plot draw callback
+ simulClick: true, // plugin will generate Mouse click event to brwoser on tap or double tap
+ tapThreshold:150, // range of time where a tap event could be detected
+ dbltapThreshold:200, // delay needed to detect a double tap
+ tapPrecision:60/2 // tap events boundaries ( 60px square by default )
+ }
+ },
+ name: 'touch',
+ version: '3.0'
+ });
+})(jQuery);
diff --git a/Lib/flot/jquery.flot.touch.min.js b/Lib/flot/jquery.flot.touch.min.js
new file mode 100644
index 0000000..e593d93
--- /dev/null
+++ b/Lib/flot/jquery.flot.touch.min.js
@@ -0,0 +1,10 @@
+/* jquery.flot.touch 3
+Plugin for Flot version 0.8.3.
+Allows to use touch for pan / zoom and simulate tap, double tap as mouse clicks so other plugins can work as usual with a touch device.
+
+https://github.com/chaveiro/flot.touch
+
+Copyright (c) 2015 Chaveiro - Licensed under the MIT license.
+
+*/
+(function($){function init(plot){$.support.touch="ontouchend" in document;if(!$.support.touch){return}var isPanning=false;var isZooming=false;var lastTouchPosition={x:-1,y:-1};var startTouchPosition=lastTouchPosition;var lastTouchDistance=0;var relativeOffset={x:0,y:0};var relativeScale=1;var scaleOrigin={x:50,y:50};var lastRedraw=new Date().getTime();var eventdelayTouchEnded;var tapNum=0;var tapTimer,tapTimestamp;function pan(delta){var placeholder=plot.getPlaceholder();var options=plot.getOptions();relativeOffset.x-=delta.x;relativeOffset.y-=delta.y;if(!options.touch.css){return}switch(options.touch.pan.toLowerCase()){case"x":placeholder.css("transform","translateX("+relativeOffset.x+"px)");break;case"y":placeholder.css("transform","translateY("+relativeOffset.y+"px)");break;default:placeholder.css("transform","translate("+relativeOffset.x+"px,"+relativeOffset.y+"px)");break}}function scale(delta){var placeholder=plot.getPlaceholder();var options=plot.getOptions();relativeScale*=1+(delta/100);if(!options.touch.css){return}switch(options.touch.scale.toLowerCase()){case"x":placeholder.css("transform","scaleX("+relativeScale+")");break;case"y":placeholder.css("transform","scaleY("+relativeScale+")");break;default:placeholder.css("transform","scale("+relativeScale+")");break}}function processOptions(plot,options){var placeholder=plot.getPlaceholder();var options=plot.getOptions();if(options.touch.autoWidth){placeholder.css("width","100%")}if(options.touch.autoHeight){var placeholderParent=placeholder.parent();var height=0;placeholderParent.siblings().each(function(){height-=$(this).outerHeight()});height-=parseInt(placeholderParent.css("padding-top"),10);height-=parseInt(placeholderParent.css("padding-bottom"),10);height+=window.innerHeight;placeholder.css("height",(height<=0)?100:height+"px")}}function getTimestamp(){return new Date().getTime()}function bindEvents(plot,eventHolder){var placeholder=plot.getPlaceholder();var options=plot.getOptions();if(options.touch.css){placeholder.parent("div").css({overflow:"hidden"})}placeholder.bind("touchstart",function(evt){clearTimeout(eventdelayTouchEnded);var touches=evt.originalEvent.touches;var placeholder=plot.getPlaceholder();var options=plot.getOptions();$.each(plot.getAxes(),function(index,axis){if(axis.direction===options.touch.scale.toLowerCase()||options.touch.scale.toLowerCase()=="xy"){axis.touch={min:axis.min,max:axis.max}}});tapTimestamp=getTimestamp();if(touches.length===1){isPanning=true;lastTouchPosition={x:touches[0].pageX,y:touches[0].pageY};lastTouchDistance=0;tapNum++}else{if(touches.length===2){isZooming=true;lastTouchPosition={x:(touches[0].pageX+touches[1].pageX)/2,y:(touches[0].pageY+touches[1].pageY)/2};lastTouchDistance=Math.sqrt(Math.pow(touches[1].pageX-touches[0].pageX,2)+Math.pow(touches[1].pageY-touches[0].pageY,2))}}var offset=placeholder.offset();var rect={x:offset.left,y:offset.top,width:placeholder.width(),height:placeholder.height()};startTouchPosition={x:lastTouchPosition.x,y:lastTouchPosition.y};if(startTouchPosition.xrect.x+rect.width){startTouchPosition.x=rect.x+rect.width}}if(startTouchPosition.yrect.y+rect.height){startTouchPosition.y=rect.y+rect.height}}scaleOrigin={x:Math.round((startTouchPosition.x/rect.width)*100),y:Math.round((startTouchPosition.y/rect.height)*100)};if(options.touch.css){placeholder.css("transform-origin",scaleOrigin.x+"% "+scaleOrigin.y+"%")}placeholder.trigger("touchstarted",[startTouchPosition]);return false});placeholder.bind("touchmove",function(evt){var options=plot.getOptions();var touches=evt.originalEvent.touches;var position,distance,delta;if(isPanning&&touches.length===1){position={x:touches[0].pageX,y:touches[0].pageY};delta={x:lastTouchPosition.x-position.x,y:lastTouchPosition.y-position.y};pan(delta);lastTouchPosition=position;lastTouchDistance=0}else{if(isZooming&&touches.length===2){distance=Math.sqrt(Math.pow(touches[1].pageX-touches[0].pageX,2)+Math.pow(touches[1].pageY-touches[0].pageY,2));position={x:(touches[0].pageX+touches[1].pageX)/2,y:(touches[0].pageY+touches[1].pageY)/2};delta=distance-lastTouchDistance;scale(delta);lastTouchPosition=position;lastTouchDistance=distance}}if(!options.touch.css){var now=new Date().getTime(),framedelay=now-lastRedraw;if(framedelay>50){lastRedraw=now;window.requestAnimationFrame(redraw)}}});placeholder.bind("touchend",function(evt){var placeholder=plot.getPlaceholder();var options=plot.getOptions();var touches=evt.originalEvent.changedTouches;tapTimer=setTimeout(function(){tapNum=0},options.touch.dbltapThreshold);if(isPanning&&touches.length===1&&(tapTimestamp+options.touch.tapThreshold)-getTimestamp()>=0&&startTouchPosition.x>=lastTouchPosition.x-options.touch.tapPrecision&&startTouchPosition.x<=lastTouchPosition.x+options.touch.tapPrecision&&startTouchPosition.y>=lastTouchPosition.y-options.touch.tapPrecision&&startTouchPosition.y<=lastTouchPosition.y+options.touch.tapPrecision){if(tapNum===2){placeholder.trigger("dbltap",[lastTouchPosition])}else{placeholder.trigger("tap",[lastTouchPosition])}if(options.touch.simulClick){var simulatedEvent=new MouseEvent("click",{bubbles:true,cancelable:true,view:window,detail:tapNum,screenX:touches[0].screenX,screenY:touches[0].screenY,clientX:touches[0].clientX,clientY:touches[0].clientY,button:0});touches[0].target.dispatchEvent(simulatedEvent)}}else{var r={};c1={x:0,y:0};c2={x:plot.width(),y:plot.height()};$.each(plot.getAxes(),function(name,axis){if(axis.used){var p1=axis.c2p(c1[axis.direction]),p2=axis.c2p(c2[axis.direction]);r[name]={from:Math.min(p1,p2),to:Math.max(p1,p2)}}});eventdelayTouchEnded=setTimeout(function(){placeholder.trigger("touchended",[r])},options.touch.delayTouchEnded)}isPanning=false;isZooming=false;lastTouchPosition={x:-1,y:-1};startTouchPosition=lastTouchPosition;lastTouchDistance=0;relativeOffset={x:0,y:0};relativeScale=1;scaleOrigin={x:50,y:50};if(options.touch.css){placeholder.css({transform:"translate("+relativeOffset.x+"px,"+relativeOffset.y+"px) scale("+relativeScale+")","transform-origin":scaleOrigin.x+"% "+scaleOrigin.y+"%"})}})}function redraw(){var options=plot.getOptions();updateAxesMinMax();if(typeof options.touch.callback=="function"){options.touch.callback()}else{plot.setupGrid();plot.draw()}}function updateAxesMinMax(){var options=plot.getOptions();if(relativeOffset.x!==0||relativeOffset.y!==0){$.each(plot.getAxes(),function(index,axis){if(axis.direction===options.touch.pan.toLowerCase()||options.touch.pan.toLowerCase()=="xy"){var min=axis.c2p(axis.p2c(axis.touch.min)-relativeOffset[axis.direction]);var max=axis.c2p(axis.p2c(axis.touch.max)-relativeOffset[axis.direction]);axis.options.min=min;axis.options.max=max}})}if(relativeScale!==1){var width=plot.width();var height=plot.height();var scaleOriginPixel={x:Math.round((scaleOrigin.x/100)*width),y:Math.round((scaleOrigin.y/100)*height)};var range={x:{min:scaleOriginPixel.x-(scaleOrigin.x/100)*width/relativeScale,max:scaleOriginPixel.x+(1-(scaleOrigin.x/100))*width/relativeScale},y:{min:scaleOriginPixel.y-(scaleOrigin.y/100)*height/relativeScale,max:scaleOriginPixel.y+(1-(scaleOrigin.y/100))*height/relativeScale}};$.each(plot.getAxes(),function(index,axis){if(axis.direction===options.touch.scale.toLowerCase()||options.touch.scale.toLowerCase()=="xy"){var min=axis.c2p(range[axis.direction].min);var max=axis.c2p(range[axis.direction].max);if(min>max){var temp=min;min=max;max=temp}axis.options.min=min;axis.options.max=max}})}}function processDatapoints(plot,series,datapoints){if(window.devicePixelRatio){var placeholder=plot.getPlaceholder();placeholder.children("canvas").each(function(index,canvas){var context=canvas.getContext("2d");var width=$(canvas).attr("width");var height=$(canvas).attr("height");$(canvas).attr("width",width*window.devicePixelRatio);$(canvas).attr("height",height*window.devicePixelRatio);$(canvas).css("width",width+"px");$(canvas).css("height",height+"px");context.scale(window.devicePixelRatio,window.devicePixelRatio)})}}function shutdown(plot,eventHolder){var placeholder=plot.getPlaceholder();placeholder.unbind("touchstart").unbind("touchmove").unbind("touchend")}plot.hooks.processOptions.push(processOptions);plot.hooks.bindEvents.push(bindEvents);plot.hooks.shutdown.push(shutdown)}$.plot.plugins.push({init:init,options:{touch:{pan:"xy",scale:"xy",css:false,autoWidth:false,autoHeight:false,delayTouchEnded:500,callback:null,simulClick:true,tapThreshold:150,dbltapThreshold:200,tapPrecision:60/2}},name:"touch",version:"3.0"})})(jQuery);
\ No newline at end of file
diff --git a/Lib/flot/plugin/saveAsImage/README.md b/Lib/flot/plugin/saveAsImage/README.md
new file mode 100644
index 0000000..95c20b1
--- /dev/null
+++ b/Lib/flot/plugin/saveAsImage/README.md
@@ -0,0 +1,51 @@
+canvasAsImage.js
+================
+
+Reference this file in your header of which page you are using canvas, then when you right click on your canvas, a context menu would appeared and gave you a option to save your drawings on canvas as image to your local disk.
+
+##Online examples:##
+http://zizhujy.com/GraphWorld
+
+jquery.flot.saveAsImage.js
+==========================
+
+Flot plugin that adds a function to allow user save the current graph as an image by right clicking on the graph and then choose "Save image as ..." to local disk.
+
+Copyright (c) 2013 http://zizhujy.com.
+Licensed under the MIT license.
+
+##Screen shot:##
+http://zizhujy.com/blog/post/2013/07/02/A-Flot-plugin-for-saving-canvas-image-to-local-disk.aspx
+
+##Installation and usage:##
+```html
+bower install flot.saveasimage
+
+
+
+
+
+ Now you are all set. Right click on your flot canvas, you will see the "Save image as ..." option.
+
+Online examples:
+ http://zizhujy.com/FunctionGrapher is using it, you can try right clicking on the function graphs and
+ you will see you can save the image to local disk.
+
+Dependencies:
+ This plugin references the base64.js and canvas2image.js.
+
+Customizations:
+ The default behavior of this plugin is dynamically creating an image from the flot canvas, and then puts the
+ image above the flot canvas. If you want to add some css effects on to the dynamically created image, you can
+ apply whatever css styles on to it, only remember to make sure the css class name is set correspondingly by
+ the options object of this plugin. You can also customize the image format through this options object:
+
+ options: {
+ imageClassName: "canvas-image",
+ imageFormat: "png"
+ }
+
+*/
+
+; (function ($, Canvas2Image) {
+ var imageCreated = null;
+ var mergedCanvas = null;
+ var theClasses = null;
+
+ function init(plot, classes) {
+ theClasses = classes;
+ plot.hooks.bindEvents.push(bindEvents);
+ plot.hooks.shutdown.push(shutdown);
+
+ function bindEvents(plot, eventHolder) {
+ eventHolder.mousedown(onMouseDown);
+ }
+
+ function shutdown(plot, eventHolder) {
+ eventHolder.unbind("mousedown", onMouseDown);
+ }
+
+ function onMouseDown(e) {
+ if (e.button == 2) {
+ // Open an API in Canvas2Image, in case you would need to call
+ // it to delete the dynamically created image.
+ //Canvas2Image.deleteStaleCanvasImage = deleteStaleCanvasImage;
+ deleteStaleCanvasImage(plot, mergedCanvas);
+ mergedCanvas = mergeCanvases(plot);
+ createImageFromCanvas(mergedCanvas, plot, plot.getOptions().imageFormat);
+ // For ubuntu chrome:
+ setTimeout(function () { deleteStaleCanvasImage(plot, mergedCanvas); }, 500);
+ }
+ }
+ }
+
+ function onMouseUp(plot) {
+ setTimeout(function () { deleteStaleCanvasImage(plot, mergedCanvas); }, 100);
+ }
+
+ function deleteStaleCanvasImage(plot, mergedCanvas) {
+ //$(plot.getCanvas()).parent().find("img." + plot.getOptions().imageClassName).unbind("mouseup", onMouseUp).remove();
+ $(imageCreated).unbind("mouseup", onMouseUp).remove();
+ if (!!mergedCanvas) {
+ $(mergedCanvas).remove();
+ }
+ $(".mergedCanvas").remove();
+ }
+
+ function mergeCanvases(plot) {
+
+ var theMergedCanvas = plot.getCanvas();
+
+ if (!!theClasses) {
+ theMergedCanvas = new theClasses.Canvas("mergedCanvas", plot.getPlaceholder());
+ var mergedContext = theMergedCanvas.context;
+ var plotCanvas = plot.getCanvas();
+
+ theMergedCanvas.element.height = plotCanvas.height;
+ theMergedCanvas.element.width = plotCanvas.width;
+
+ mergedContext.restore();
+
+ $(theMergedCanvas).css({
+ "visibility": "hidden",
+ "z-index": "-100",
+ "position": "absolute"
+ });
+
+ var $canvases = $(plot.getPlaceholder()).find("canvas").not('.mergedCanvas');
+ $canvases.each(function(index, canvas) {
+ mergedContext.drawImage(canvas, 0, 0);
+ });
+
+ return theMergedCanvas.element;
+ }
+
+ return theMergedCanvas;
+ }
+
+ function createImageFromCanvas(canvas, plot, format) {
+ if (!canvas) {
+ canvas = plot.getCanvas();
+ }
+
+ var img = null;
+ switch (format.toLowerCase()) {
+ case "png":
+ img = Canvas2Image.saveAsPNG(canvas, format);
+ break;
+ case "bmp":
+ img = Canvas2Image.saveAsBMP(canvas, format);
+ break;
+ case "jpeg":
+ img = Canvas2Image.saveAsJPEG(canvas, format);
+ break;
+ default:
+ break;
+ }
+
+ if (!img) {
+ img = Canvas2Image.saveAsPNG(canvas, "png");
+ }
+
+ if (!img) {
+ img = Canvas2Image.saveAsPNG(canvas, "bmp");
+ }
+
+ if (!img) {
+ img = Canvas2Image.saveAsJPEG(canvas, "jpeg");
+ }
+
+ if (!img) {
+ alert(plot.getOptions().notSupportMessage || "Oh Sorry, but this browser is not capable of creating image files, please use PRINT SCREEN key instead!");
+ return false;
+ }
+
+ $(img).attr("class", plot.getOptions().imageClassName);
+ $(img).css({ "border": $(canvas).css("border"), "z-index": "9999", "position": "absolute" });
+ $(img).insertBefore($(canvas));
+ $(img).mouseup(plot, onMouseUp);
+
+ imageCreated = img;
+ }
+
+ var options = {
+ imageClassName: "canvas-image",
+ imageFormat: "png"
+ };
+
+ $.plot.plugins.push({
+ init: init,
+ options: options,
+ name: 'saveAsImage',
+ version: '1.6'
+ });
+
+})(jQuery, Canvas2Image);
diff --git a/Lib/flot/plugin/saveAsImage/lib/base64.js b/Lib/flot/plugin/saveAsImage/lib/base64.js
new file mode 100644
index 0000000..a12dfc8
--- /dev/null
+++ b/Lib/flot/plugin/saveAsImage/lib/base64.js
@@ -0,0 +1,111 @@
+/* Copyright (C) 1999 Masanao Izumo
+* Version: 1.0
+* LastModified: Dec 25 1999
+* This library is free. You can redistribute it and/or modify it.
+*/
+
+/*
+* Interfaces:
+* b64 = base64encode(data);
+* data = base64decode(b64);
+*/
+
+(function () {
+
+ var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ var base64DecodeChars = new Array(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
+ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
+ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
+
+ function base64encode(str) {
+ var out, i, len;
+ var c1, c2, c3;
+
+ len = str.length;
+ i = 0;
+ out = "";
+ while (i < len) {
+ c1 = str.charCodeAt(i++) & 0xff;
+ if (i == len) {
+ out += base64EncodeChars.charAt(c1 >> 2);
+ out += base64EncodeChars.charAt((c1 & 0x3) << 4);
+ out += "==";
+ break;
+ }
+ c2 = str.charCodeAt(i++);
+ if (i == len) {
+ out += base64EncodeChars.charAt(c1 >> 2);
+ out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
+ out += base64EncodeChars.charAt((c2 & 0xF) << 2);
+ out += "=";
+ break;
+ }
+ c3 = str.charCodeAt(i++);
+ out += base64EncodeChars.charAt(c1 >> 2);
+ out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
+ out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
+ out += base64EncodeChars.charAt(c3 & 0x3F);
+ }
+ return out;
+ }
+
+ function base64decode(str) {
+ var c1, c2, c3, c4;
+ var i, len, out;
+
+ len = str.length;
+ i = 0;
+ out = "";
+ while (i < len) {
+ /* c1 */
+ do {
+ c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
+ } while (i < len && c1 == -1);
+ if (c1 == -1)
+ break;
+
+ /* c2 */
+ do {
+ c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
+ } while (i < len && c2 == -1);
+ if (c2 == -1)
+ break;
+
+ out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
+
+ /* c3 */
+ do {
+ c3 = str.charCodeAt(i++) & 0xff;
+ if (c3 == 61)
+ return out;
+ c3 = base64DecodeChars[c3];
+ } while (i < len && c3 == -1);
+ if (c3 == -1)
+ break;
+
+ out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
+
+ /* c4 */
+ do {
+ c4 = str.charCodeAt(i++) & 0xff;
+ if (c4 == 61)
+ return out;
+ c4 = base64DecodeChars[c4];
+ } while (i < len && c4 == -1);
+ if (c4 == -1)
+ break;
+ out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
+ }
+ return out;
+ }
+
+ if (!window.btoa) window.btoa = base64encode;
+ if (!window.atob) window.atob = base64decode;
+
+})();
\ No newline at end of file
diff --git a/Lib/flot/plugin/saveAsImage/lib/canvas2image.js b/Lib/flot/plugin/saveAsImage/lib/canvas2image.js
new file mode 100644
index 0000000..09a01a0
--- /dev/null
+++ b/Lib/flot/plugin/saveAsImage/lib/canvas2image.js
@@ -0,0 +1,235 @@
+/*
+* Canvas2Image v0.1
+* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk
+* MIT License [http://www.opensource.org/licenses/mit-license.php]
+*/
+
+var Canvas2Image = (function () {
+
+ // check if we have canvas support
+ var bHasCanvas = false;
+ var oCanvas = document.createElement("canvas");
+ if (!!oCanvas.getContext && !!oCanvas.getContext("2d")) {
+ bHasCanvas = true;
+ }
+
+ // no canvas, bail out.
+ if (!bHasCanvas) {
+ return {
+ saveAsBMP: function () { },
+ saveAsPNG: function () { },
+ saveAsJPEG: function () { }
+ }
+ }
+
+ var bHasImageData = !!oCanvas.getContext && !!oCanvas.getContext("2d").getImageData;
+ var bHasDataURL = !!(oCanvas.toDataURL);
+ var bHasBase64 = !!(window.btoa);
+
+ var strDownloadMime = "image/octet-stream";
+
+ // ok, we're good
+ var readCanvasData = function (oCanvas) {
+ var iWidth = parseInt(oCanvas.width);
+ var iHeight = parseInt(oCanvas.height);
+ return oCanvas.getContext("2d").getImageData(0, 0, iWidth, iHeight);
+ }
+
+ // base64 encodes either a string or an array of charcodes
+ var encodeData = function (data) {
+ var strData = "";
+ if (typeof data == "string") {
+ strData = data;
+ } else {
+ var aData = data;
+ for (var i = 0; i < aData.length; i++) {
+ strData += String.fromCharCode(aData[i]);
+ }
+ }
+ return btoa(strData);
+ }
+
+ // creates a base64 encoded string containing BMP data
+ // takes an imagedata object as argument
+ var createBMP = function (oData) {
+ var aHeader = [];
+
+ var iWidth = oData.width;
+ var iHeight = oData.height;
+
+ aHeader.push(0x42); // magic 1
+ aHeader.push(0x4D);
+
+ var iFileSize = iWidth * iHeight * 3 + 54; // total header size = 54 bytes
+ aHeader.push(iFileSize % 256); iFileSize = Math.floor(iFileSize / 256);
+ aHeader.push(iFileSize % 256); iFileSize = Math.floor(iFileSize / 256);
+ aHeader.push(iFileSize % 256); iFileSize = Math.floor(iFileSize / 256);
+ aHeader.push(iFileSize % 256);
+
+ aHeader.push(0); // reserved
+ aHeader.push(0);
+ aHeader.push(0); // reserved
+ aHeader.push(0);
+
+ aHeader.push(54); // dataoffset
+ aHeader.push(0);
+ aHeader.push(0);
+ aHeader.push(0);
+
+ var aInfoHeader = [];
+ aInfoHeader.push(40); // info header size
+ aInfoHeader.push(0);
+ aInfoHeader.push(0);
+ aInfoHeader.push(0);
+
+ var iImageWidth = iWidth;
+ aInfoHeader.push(iImageWidth % 256); iImageWidth = Math.floor(iImageWidth / 256);
+ aInfoHeader.push(iImageWidth % 256); iImageWidth = Math.floor(iImageWidth / 256);
+ aInfoHeader.push(iImageWidth % 256); iImageWidth = Math.floor(iImageWidth / 256);
+ aInfoHeader.push(iImageWidth % 256);
+
+ var iImageHeight = iHeight;
+ aInfoHeader.push(iImageHeight % 256); iImageHeight = Math.floor(iImageHeight / 256);
+ aInfoHeader.push(iImageHeight % 256); iImageHeight = Math.floor(iImageHeight / 256);
+ aInfoHeader.push(iImageHeight % 256); iImageHeight = Math.floor(iImageHeight / 256);
+ aInfoHeader.push(iImageHeight % 256);
+
+ aInfoHeader.push(1); // num of planes
+ aInfoHeader.push(0);
+
+ aInfoHeader.push(24); // num of bits per pixel
+ aInfoHeader.push(0);
+
+ aInfoHeader.push(0); // compression = none
+ aInfoHeader.push(0);
+ aInfoHeader.push(0);
+ aInfoHeader.push(0);
+
+ var iDataSize = iWidth * iHeight * 3;
+ aInfoHeader.push(iDataSize % 256); iDataSize = Math.floor(iDataSize / 256);
+ aInfoHeader.push(iDataSize % 256); iDataSize = Math.floor(iDataSize / 256);
+ aInfoHeader.push(iDataSize % 256); iDataSize = Math.floor(iDataSize / 256);
+ aInfoHeader.push(iDataSize % 256);
+
+ for (var i = 0; i < 16; i++) {
+ aInfoHeader.push(0); // these bytes not used
+ }
+
+ var iPadding = (4 - ((iWidth * 3) % 4)) % 4;
+
+ var aImgData = oData.data;
+
+ var strPixelData = "";
+ var y = iHeight;
+ do {
+ var iOffsetY = iWidth * (y - 1) * 4;
+ var strPixelRow = "";
+ for (var x = 0; x < iWidth; x++) {
+ var iOffsetX = 4 * x;
+
+ strPixelRow += String.fromCharCode(aImgData[iOffsetY + iOffsetX + 2]);
+ strPixelRow += String.fromCharCode(aImgData[iOffsetY + iOffsetX + 1]);
+ strPixelRow += String.fromCharCode(aImgData[iOffsetY + iOffsetX]);
+ }
+ for (var c = 0; c < iPadding; c++) {
+ strPixelRow += String.fromCharCode(0);
+ }
+ strPixelData += strPixelRow;
+ } while (--y);
+
+ var strEncoded = encodeData(aHeader.concat(aInfoHeader)) + encodeData(strPixelData);
+
+ return strEncoded;
+ }
+
+
+ // sends the generated file to the client
+ var saveFile = function (strData) {
+ document.location.href = strData;
+ }
+
+ var makeDataURI = function (strData, strMime) {
+ return "data:" + strMime + ";base64," + strData;
+ }
+
+ // generates a object containing the imagedata
+ var makeImageObject = function (strSource) {
+ var oImgElement = document.createElement("img");
+ oImgElement.src = strSource;
+ return oImgElement;
+ }
+
+ var scaleCanvas = function (oCanvas, iWidth, iHeight) {
+ if (iWidth && iHeight) {
+ var oSaveCanvas = document.createElement("canvas");
+ oSaveCanvas.width = iWidth;
+ oSaveCanvas.height = iHeight;
+ oSaveCanvas.style.width = iWidth + "px";
+ oSaveCanvas.style.height = iHeight + "px";
+
+ var oSaveCtx = oSaveCanvas.getContext("2d");
+
+ oSaveCtx.drawImage(oCanvas, 0, 0, oCanvas.width, oCanvas.height, 0, 0, iWidth, iHeight);
+ return oSaveCanvas;
+ }
+ return oCanvas;
+ }
+
+ return {
+
+ saveAsPNG: function (oCanvas, bReturnImg, iWidth, iHeight) {
+ if (!bHasDataURL) {
+ return false;
+ }
+ var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight);
+ var strData = oScaledCanvas.toDataURL("image/png");
+ if (bReturnImg) {
+ return makeImageObject(strData);
+ } else {
+ saveFile(strData.replace("image/png", strDownloadMime));
+ }
+ return true;
+ },
+
+ saveAsJPEG: function (oCanvas, bReturnImg, iWidth, iHeight) {
+ if (!bHasDataURL) {
+ return false;
+ }
+
+ var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight);
+ var strMime = "image/jpeg";
+ var strData = oScaledCanvas.toDataURL(strMime);
+
+ // check if browser actually supports jpeg by looking for the mime type in the data uri.
+ // if not, return false
+ if (strData.indexOf(strMime) != 5) {
+ return false;
+ }
+
+ if (bReturnImg) {
+ return makeImageObject(strData);
+ } else {
+ saveFile(strData.replace(strMime, strDownloadMime));
+ }
+ return true;
+ },
+
+ saveAsBMP: function (oCanvas, bReturnImg, iWidth, iHeight) {
+ if (!(bHasImageData && bHasBase64)) {
+ return false;
+ }
+
+ var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight);
+
+ var oData = readCanvasData(oScaledCanvas);
+ var strImgData = createBMP(oData);
+ if (bReturnImg) {
+ return makeImageObject(makeDataURI(strImgData, "image/bmp"));
+ } else {
+ saveFile(makeDataURI(strImgData, strDownloadMime));
+ }
+ return true;
+ }
+ };
+
+})();
\ No newline at end of file
diff --git a/Lib/jquery-1.11.3.min.js b/Lib/jquery-1.11.3.min.js
new file mode 100644
index 0000000..0f60b7b
--- /dev/null
+++ b/Lib/jquery-1.11.3.min.js
@@ -0,0 +1,5 @@
+/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML=" ",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML=" ","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML=" ",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
+
+return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" a ",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML=" ",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h ]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""," "],legend:[1,""," "],area:[1,""," "],param:[1,""," "],thead:[1,""],tr:[2,""],col:[2,""],td:[3,""],_default:k.htmlSerialize?[0,"",""]:[1,"X","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" a ",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
+return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();ca ",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
diff --git a/Lib/listjs/COPYRIGHT.txt b/Lib/listjs/COPYRIGHT.txt
new file mode 100644
index 0000000..c01e0a5
--- /dev/null
+++ b/Lib/listjs/COPYRIGHT.txt
@@ -0,0 +1,24 @@
+ list.js - jquery javascript based dynamic list library
+ Part of the openenergymonitor.org project
+
+ Copyright (C) 2013 Trystan Lea
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or any later version.
+
+ This program 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 Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
.
+
+ Contact:
+
+ Trystan Lea
+ trystan.lea@gmail.com
+ http://openenergymonitor.org
+
diff --git a/Lib/listjs/LICENSE.txt b/Lib/listjs/LICENSE.txt
new file mode 100644
index 0000000..4ec8c3f
--- /dev/null
+++ b/Lib/listjs/LICENSE.txt
@@ -0,0 +1,619 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
diff --git a/Lib/listjs/example.html b/Lib/listjs/example.html
new file mode 100644
index 0000000..71fd68c
--- /dev/null
+++ b/Lib/listjs/example.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
My Account
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ gravatar
+
+
+
+
+
+
+
+ name
+ Trystan Lea
+
+
+
+
+ location
+ North Wales
+
+
+
+
+ timezone
+ UTC +2:00
+
+
+
+ language
+ English
+
+
+
+ bio
+
+
+
+
+
+
+We can use jquery selectors to edit the above html:
+
+ $("tr[field="+field+"] td[type=name]").html(field);
+ $("tr[field="+field+"] td[type=value]").html(data[field]);
+
+The data object that stores all the data to make this looks like this:
+
+ var data = {
+ gravatar: 'trystan.lea@googlemail.com',
+ name:'Trystan Lea',
+ location: 'North Wales',
+ language:'English',
+ bio:''
+ };
+
+The first thing to notice is that generating the html from the data object should be pretty straight forward which would allow us to avoid writing all the html out:
+
+ var html = '';
+ for (field in data)
+ {
+ html += '';
+ html += ' '+field+' ';
+ html += ' '+data[field]+' ';
+ html += ' ';
+ html += ' ';
+ }
+ html += '
';
+ $("#table").html(html);
+
+As you can see the gravatar is not displayed using the above code, the user email is just inserted straight without conversion and so instead of just outputing
+
+ html += ' '+data[field]+' ';
+
+we need a way of outputing different things depending on the field type.
+
+The idea that was adopted for table.js was to create a fieldtypes data object that handled what to show on draw, edit and save for each field type.
+
+Here's the draw actions for each datatype we need for the profile view:
+
+ var fieldtypes = {
+
+ 'text':
+ {
+ 'draw':function(value) {return value}
+ },
+
+ 'timezone':
+ {
+ 'draw':function(value) { if (value>=0) sign = '+'; return "UTC "+sign+value+":00"; }
+ },
+
+ 'gravatar':
+ {
+ 'draw':function(value) { return " " }
+ }
+
+ };
+
+We can then in place of:
+
+ html += ' '+data[field]+' ';
+
+call
+
+ html += ' '+fieldtypes[fields[field].type].draw(data[field])+' ';
+
+We also need a defenition of the type of each field
+
+ var fields = {
+ 'gravatar':{'type':'gravatar'},
+ 'name':{'type':'text'},
+ 'location':{'type':'text'},
+ 'timezone':{'type':'timezone'},
+ 'language':{'type':'text'},
+ 'bio':{'type':'text'}
+ }
+
+We are now ready to implement editing:
+
+### Hover show edit icon
+
+A neat little visual feature:
+
+ // Show edit button only on hover
+ $("tr").hover(
+ function() {
+ $(this).find("td:last > i").show();
+ },
+ function() {
+ $(this).find("td:last > i").hide();
+ }
+ );
+
+Next we need to create an event that fires when a particular field's edit button is pressed:
+
+ $("td[type=edit]").click(function() {
+ var field = $(this).parent().attr('field');
+ // Do on edit stuff here to field: field
+ });
+
+Lets start by just showing a text box for each option:
+
+ $("tr[field="+field+"] td[type=value]").html(" ");
+
+Lets now make use of our field types object and create an edit type for each field type. The timezone edit type requires a drop down select box of all the timezone options.
+
+First we tell our on edit event to get the edit html from the fieldtypes object:
+
+ $("tr[field="+field+"] td[type=value]").html(fieldtypes[fields[field].type].edit(data[field]));
+
+and then we add edit types to the field types object:
+
+ var fieldtypes = {
+
+ 'text':
+ {
+ 'draw':function(value) {return value},
+ 'edit':function(value) { return " " }
+ },
+
+ 'timezone':
+ {
+ 'draw':function(value) { if (value>=0) sign = '+'; return "UTC "+sign+value+":00"; },
+ 'edit':function(value)
+ {
+ var options = '';
+ for (var i=-12; i<=14; i++) {
+ var selected = ""; if (value == i) selected = 'selected';
+ if (i>=0) sign = '+';
+ options += "UTC "+sign+i+":00 ";
+ }
+ return ""+options+" ";
+ }
+ },
+
+ 'gravatar':
+ {
+ 'draw':function(value) { return " " },
+ 'edit':function(value) { return " " }
+ }
+
+ };
+
+## Saving fields
+
+Adding a save button, we want a save button to appear when the edit button has been clicked and the field is in edit mode.
+
+The idea is that the td type edit has a action attribute that we toggle to indicate the action that should happen when we next click on td:
+
+ $("td[type=edit]").click(function() {
+ var action = $(this).attr('action');
+ var field = $(this).parent().attr('field');
+
+ if (action=='edit')
+ {
+ $("tr[field="+field+"] td[type=value]").html(fieldtypes[fields[field].type].edit(data[field]));
+ $(this).html("Save ");
+ $(this).attr('action','save');
+ }
+ });
+
+As in the case of draw and edit were going to use the fieldtype again to determine how to fetch the data from the html for saving:
+
+ var fieldtypes = {
+
+ 'text':
+ {
+ 'draw':function(value) { return value},
+ 'edit':function(value) { return " " },
+ 'save':function(field) { return $('tr[field='+field+'] td[type=value] input').val();}
+ },
+
+ 'timezone':
+ {
+ 'draw':function(value) { if (value>=0) sign = '+'; return "UTC "+sign+value+":00"; },
+ 'edit':function(value)
+ {
+ var options = '';
+ for (var i=-12; i<=14; i++) {
+ var selected = ""; if (value == i) selected = 'selected';
+ if (i>=0) sign = '+';
+ options += "UTC "+sign+i+":00 ";
+ }
+ return ""+options+" ";
+ },
+ 'save':function(field) { return $('tr[field='+field+'] td[type=value] select').val();}
+ },
+
+ 'gravatar':
+ {
+ 'draw':function(value) { return " " },
+ 'edit':function(value) { return " " },
+ 'save':function(field) { return $('tr[field='+field+'] td[type=value] input').val();}
+ }
+
+ };
+
+and then for our save action:
+
+ $("td[type=edit]").click(function() {
+ var action = $(this).attr('action');
+ var field = $(this).parent().attr('field');
+
+ if (action=='edit')
+ {
+ $("tr[field="+field+"] td[type=value]").html(fieldtypes[fields[field].type].edit(data[field]));
+ $(this).html("Save ");
+ $(this).attr('action','save');
+ }
+
+ if (action=='save')
+ {
+ data[field] = fieldtypes[fields[field].type].save(field);
+ $("tr[field="+field+"] td[type=value]").html(fieldtypes[fields[field].type].draw(data[field]));
+ $(this).html(" ");
+ $(this).attr('action','edit');
+ }
+ });
+
+The only thing that's left now is to get the data from the server and save it, but before we do that lets package up the above code in a nice library. Server side interface is separate from the list gui.
+
+## Complete list.js:
+
+ var list = {
+
+ 'data':{},
+ 'fields':{},
+ 'element':"#table",
+
+ 'init':function()
+ {
+ var html = '';
+ for (field in list.fields)
+ {
+ html += '';
+ html += ' '+field+' ';
+ html += ' '+list.fieldtypes[list.fields[field].type].draw(list.data[field])+' ';
+ html += ' ';
+ html += ' ';
+ }
+ html += '
';
+ $(list.element).html(html);
+
+ $(list.element+" td[type=edit]").click(function() {
+ var action = $(this).attr('action');
+ var field = $(this).parent().attr('field');
+
+ if (action=='edit')
+ {
+ $(list.element+" tr[field="+field+"] td[type=value]").html(list.fieldtypes[list.fields[field].type].edit(field,list.data[field]));
+ $(this).html("Save ");
+ $(this).attr('action','save');
+ }
+
+ if (action=='save')
+ {
+ list.data[field] = list.fieldtypes[list.fields[field].type].save(field);
+ $(list.element+" tr[field="+field+"] td[type=value]").html(list.fieldtypes[list.fields[field].type].draw(list.data[field]));
+ $(this).html(" ");
+ $(this).attr('action','edit');
+ $(list.element).trigger("onSave",[]);
+ }
+ });
+
+ // Show edit button only on hover
+ $(list.element+" tr").hover(
+ function() {
+ $(this).find("td:last > i").show();
+ },
+ function() {
+ $(this).find("td:last > i").hide();
+ }
+ );
+ },
+
+ 'fieldtypes':
+ {
+ 'text':
+ {
+ 'draw':function(value) { return value},
+ 'edit':function(field,value) { return " " },
+ 'save':function(field) { return $(list.element+' tr[field='+field+'] td[type=value] input').val();}
+ },
+
+ 'select':
+ {
+ 'draw':function(value) { return value },
+ 'edit':function(field,value)
+ {
+ var options = '';
+ for (i in list.fields[field].options)
+ {
+ var selected = ""; if (list.fields[field].options[i] == value) selected = 'selected';
+ options += ""+list.fields[field].options[i]+" ";
+ }
+ return ""+options+" ";
+ },
+ 'save':function(field) { return $(list.element+' tr[field='+field+'] td[type=value] select').val();}
+ },
+
+ 'timezone':
+ {
+ 'draw':function(value) { if (value>=0) sign = '+'; return "UTC "+sign+value+":00"; },
+ 'edit':function(field,value)
+ {
+ var options = '';
+ for (var i=-12; i<=14; i++) {
+ var selected = ""; if (value == i) selected = 'selected';
+ if (i>=0) sign = '+';
+ options += "UTC "+sign+i+":00 ";
+ }
+ return ""+options+" ";
+ },
+ 'save':function(field) { return $(list.element+' tr[field='+field+'] td[type=value] select').val();}
+ },
+
+ 'gravatar':
+ {
+ 'draw':function(value) { return " " },
+ 'edit':function(field,value) { return " " },
+ 'save':function(field) { return $(list.element+' tr[field='+field+'] td[type=value] input').val();}
+ }
+ }
+ }
+
+## Using it
+
+
+
+
+
+
+
+
+
+
+
My Account
+
+
+
+
+
+
+
+
diff --git a/Lib/misc/clipboard.js b/Lib/misc/clipboard.js
new file mode 100644
index 0000000..c7f06f4
--- /dev/null
+++ b/Lib/misc/clipboard.js
@@ -0,0 +1,64 @@
+function copyToClipboardMsg(elem, msgElem) {
+ var succeed = copyToClipboard(elem);
+ var msg;
+ if (!succeed) {
+ msg = "Copy not supported by this browser."
+ } else {
+ msg = "API key copied to the clipboard."
+ }
+ if (typeof msgElem === "string") {
+ msgElem = document.getElementById(msgElem);
+ }
+ msgElem.innerHTML = msg;
+ setTimeout(function() {
+ msgElem.innerHTML = "";
+ }, 2000);
+}
+function copyToClipboard(elem) {
+ // create hidden text element, if it doesn't already exist
+ var targetId = "_hiddenCopyText_";
+ var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
+ var origSelectionStart, origSelectionEnd;
+ if (isInput) {
+ // can just use the original source element for the selection and copy
+ target = elem;
+ origSelectionStart = elem.selectionStart;
+ origSelectionEnd = elem.selectionEnd;
+ } else {
+ // must use a temporary form element for the selection and copy
+ target = document.getElementById(targetId);
+ if (!target) {
+ var target = document.createElement("textarea");
+ target.style.position = "absolute";
+ target.style.left = "-9999px";
+ target.style.top = "0";
+ target.id = targetId;
+ document.body.appendChild(target);
+ }
+ target.textContent = elem.textContent;
+ }
+ // select the content
+ var currentFocus = document.activeElement;
+ target.focus();
+ target.setSelectionRange(0, target.value.length);
+ // copy the selection
+ var succeed;
+ try {
+ succeed = document.execCommand("copy");
+ } catch(e) {
+ succeed = false;
+ }
+ // restore original focus
+ if (currentFocus && typeof currentFocus.focus === "function") {
+ currentFocus.focus();
+ }
+
+ if (isInput) {
+ // restore prior selection
+ elem.setSelectionRange(origSelectionStart, origSelectionEnd);
+ } else {
+ // clear temporary content
+ target.textContent = "";
+ }
+ return succeed;
+}
diff --git a/Lib/misc/qrcode.js b/Lib/misc/qrcode.js
new file mode 100644
index 0000000..5507c15
--- /dev/null
+++ b/Lib/misc/qrcode.js
@@ -0,0 +1,614 @@
+/**
+ * @fileoverview
+ * - Using the 'QRCode for Javascript library'
+ * - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
+ * - this library has no dependencies.
+ *
+ * @author davidshimjs
+ * @see http://www.d-project.com/
+ * @see http://jeromeetienne.github.com/jquery-qrcode/
+ */
+var QRCode;
+
+(function () {
+ //---------------------------------------------------------------------
+ // QRCode for JavaScript
+ //
+ // Copyright (c) 2009 Kazuhiko Arase
+ //
+ // URL: http://www.d-project.com/
+ //
+ // Licensed under the MIT license:
+ // http://www.opensource.org/licenses/mit-license.php
+ //
+ // The word "QR Code" is registered trademark of
+ // DENSO WAVE INCORPORATED
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
+ //
+ //---------------------------------------------------------------------
+ function QR8bitByte(data) {
+ this.mode = QRMode.MODE_8BIT_BYTE;
+ this.data = data;
+ this.parsedData = [];
+
+ // Added to support UTF-8 Characters
+ for (var i = 0, l = this.data.length; i < l; i++) {
+ var byteArray = [];
+ var code = this.data.charCodeAt(i);
+
+ if (code > 0x10000) {
+ byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
+ byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
+ byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
+ byteArray[3] = 0x80 | (code & 0x3F);
+ } else if (code > 0x800) {
+ byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
+ byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
+ byteArray[2] = 0x80 | (code & 0x3F);
+ } else if (code > 0x80) {
+ byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
+ byteArray[1] = 0x80 | (code & 0x3F);
+ } else {
+ byteArray[0] = code;
+ }
+
+ this.parsedData.push(byteArray);
+ }
+
+ this.parsedData = Array.prototype.concat.apply([], this.parsedData);
+
+ if (this.parsedData.length != this.data.length) {
+ this.parsedData.unshift(191);
+ this.parsedData.unshift(187);
+ this.parsedData.unshift(239);
+ }
+ }
+
+ QR8bitByte.prototype = {
+ getLength: function (buffer) {
+ return this.parsedData.length;
+ },
+ write: function (buffer) {
+ for (var i = 0, l = this.parsedData.length; i < l; i++) {
+ buffer.put(this.parsedData[i], 8);
+ }
+ }
+ };
+
+ function QRCodeModel(typeNumber, errorCorrectLevel) {
+ this.typeNumber = typeNumber;
+ this.errorCorrectLevel = errorCorrectLevel;
+ this.modules = null;
+ this.moduleCount = 0;
+ this.dataCache = null;
+ this.dataList = [];
+ }
+
+ QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);}
+ return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);}
+ if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}
+ this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
+ return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
+ for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}
+ for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}
+ this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);}
+ var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}
+ this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}
+ row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error("code length overflow. ("
+ +buffer.getLengthInBits()
+ +">"
+ +totalDataCount*8
+ +")");}
+ if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}
+ while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}
+ while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}
+ buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}
+ buffer.put(QRCodeModel.PAD1,8);}
+ return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}}
+ var totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}
+ return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}
+ return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}
+ return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}}
+ for(var row=0;row=256){n-=255;}
+ return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}
+ if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}
+ this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];
+
+ function _isSupportCanvas() {
+ return typeof CanvasRenderingContext2D != "undefined";
+ }
+
+ // android 2.x doesn't support Data-URI spec
+ function _getAndroid() {
+ var android = false;
+ var sAgent = navigator.userAgent;
+
+ if (/android/i.test(sAgent)) { // android
+ android = true;
+ var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
+
+ if (aMat && aMat[1]) {
+ android = parseFloat(aMat[1]);
+ }
+ }
+
+ return android;
+ }
+
+ var svgDrawer = (function() {
+
+ var Drawing = function (el, htOption) {
+ this._el = el;
+ this._htOption = htOption;
+ };
+
+ Drawing.prototype.draw = function (oQRCode) {
+ var _htOption = this._htOption;
+ var _el = this._el;
+ var nCount = oQRCode.getModuleCount();
+ var nWidth = Math.floor(_htOption.width / nCount);
+ var nHeight = Math.floor(_htOption.height / nCount);
+
+ this.clear();
+
+ function makeSVG(tag, attrs) {
+ var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
+ for (var k in attrs)
+ if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
+ return el;
+ }
+
+ var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight});
+ svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
+ _el.appendChild(svg);
+
+ svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"}));
+ svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"}));
+
+ for (var row = 0; row < nCount; row++) {
+ for (var col = 0; col < nCount; col++) {
+ if (oQRCode.isDark(row, col)) {
+ var child = makeSVG("use", {"x": String(col), "y": String(row)});
+ child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
+ svg.appendChild(child);
+ }
+ }
+ }
+ };
+ Drawing.prototype.clear = function () {
+ while (this._el.hasChildNodes())
+ this._el.removeChild(this._el.lastChild);
+ };
+ return Drawing;
+ })();
+
+ var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
+
+ // Drawing in DOM by using Table tag
+ var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
+ var Drawing = function (el, htOption) {
+ this._el = el;
+ this._htOption = htOption;
+ };
+
+ /**
+ * Draw the QRCode
+ *
+ * @param {QRCode} oQRCode
+ */
+ Drawing.prototype.draw = function (oQRCode) {
+ var _htOption = this._htOption;
+ var _el = this._el;
+ var nCount = oQRCode.getModuleCount();
+ var nWidth = Math.floor(_htOption.width / nCount);
+ var nHeight = Math.floor(_htOption.height / nCount);
+ var aHTML = [''];
+
+ for (var row = 0; row < nCount; row++) {
+ aHTML.push('');
+
+ for (var col = 0; col < nCount; col++) {
+ aHTML.push(' ');
+ }
+
+ aHTML.push(' ');
+ }
+
+ aHTML.push('
');
+ _el.innerHTML = aHTML.join('');
+
+ // Fix the margin values as real size.
+ var elTable = _el.childNodes[0];
+ var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
+ var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
+
+ if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
+ elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
+ }
+ };
+
+ /**
+ * Clear the QRCode
+ */
+ Drawing.prototype.clear = function () {
+ this._el.innerHTML = '';
+ };
+
+ return Drawing;
+ })() : (function () { // Drawing in Canvas
+ function _onMakeImage() {
+ this._elImage.src = this._elCanvas.toDataURL("image/png");
+ this._elImage.style.display = "block";
+ this._elCanvas.style.display = "none";
+ }
+
+ // Android 2.1 bug workaround
+ // http://code.google.com/p/android/issues/detail?id=5141
+ if (this._android && this._android <= 2.1) {
+ var factor = 1 / window.devicePixelRatio;
+ var drawImage = CanvasRenderingContext2D.prototype.drawImage;
+ CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
+ if (("nodeName" in image) && /img/i.test(image.nodeName)) {
+ for (var i = arguments.length - 1; i >= 1; i--) {
+ arguments[i] = arguments[i] * factor;
+ }
+ } else if (typeof dw == "undefined") {
+ arguments[1] *= factor;
+ arguments[2] *= factor;
+ arguments[3] *= factor;
+ arguments[4] *= factor;
+ }
+
+ drawImage.apply(this, arguments);
+ };
+ }
+
+ /**
+ * Check whether the user's browser supports Data URI or not
+ *
+ * @private
+ * @param {Function} fSuccess Occurs if it supports Data URI
+ * @param {Function} fFail Occurs if it doesn't support Data URI
+ */
+ function _safeSetDataURI(fSuccess, fFail) {
+ var self = this;
+ self._fFail = fFail;
+ self._fSuccess = fSuccess;
+
+ // Check it just once
+ if (self._bSupportDataURI === null) {
+ var el = document.createElement("img");
+ var fOnError = function() {
+ self._bSupportDataURI = false;
+
+ if (self._fFail) {
+ self._fFail.call(self);
+ }
+ };
+ var fOnSuccess = function() {
+ self._bSupportDataURI = true;
+
+ if (self._fSuccess) {
+ self._fSuccess.call(self);
+ }
+ };
+
+ el.onabort = fOnError;
+ el.onerror = fOnError;
+ el.onload = fOnSuccess;
+ el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
+ return;
+ } else if (self._bSupportDataURI === true && self._fSuccess) {
+ self._fSuccess.call(self);
+ } else if (self._bSupportDataURI === false && self._fFail) {
+ self._fFail.call(self);
+ }
+ };
+
+ /**
+ * Drawing QRCode by using canvas
+ *
+ * @constructor
+ * @param {HTMLElement} el
+ * @param {Object} htOption QRCode Options
+ */
+ var Drawing = function (el, htOption) {
+ this._bIsPainted = false;
+ this._android = _getAndroid();
+
+ this._htOption = htOption;
+ this._elCanvas = document.createElement("canvas");
+ this._elCanvas.width = htOption.width;
+ this._elCanvas.height = htOption.height;
+ el.appendChild(this._elCanvas);
+ this._el = el;
+ this._oContext = this._elCanvas.getContext("2d");
+ this._bIsPainted = false;
+ this._elImage = document.createElement("img");
+ this._elImage.alt = "Scan me!";
+ this._elImage.style.display = "none";
+ this._el.appendChild(this._elImage);
+ this._bSupportDataURI = null;
+ };
+
+ /**
+ * Draw the QRCode
+ *
+ * @param {QRCode} oQRCode
+ */
+ Drawing.prototype.draw = function (oQRCode) {
+ var _elImage = this._elImage;
+ var _oContext = this._oContext;
+ var _htOption = this._htOption;
+
+ var nCount = oQRCode.getModuleCount();
+ var nWidth = _htOption.width / nCount;
+ var nHeight = _htOption.height / nCount;
+ var nRoundedWidth = Math.round(nWidth);
+ var nRoundedHeight = Math.round(nHeight);
+
+ _elImage.style.display = "none";
+ this.clear();
+
+ for (var row = 0; row < nCount; row++) {
+ for (var col = 0; col < nCount; col++) {
+ var bIsDark = oQRCode.isDark(row, col);
+ var nLeft = col * nWidth;
+ var nTop = row * nHeight;
+ _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
+ _oContext.lineWidth = 1;
+ _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
+ _oContext.fillRect(nLeft, nTop, nWidth, nHeight);
+
+ // 안티 앨리어싱 방지 처리
+ _oContext.strokeRect(
+ Math.floor(nLeft) + 0.5,
+ Math.floor(nTop) + 0.5,
+ nRoundedWidth,
+ nRoundedHeight
+ );
+
+ _oContext.strokeRect(
+ Math.ceil(nLeft) - 0.5,
+ Math.ceil(nTop) - 0.5,
+ nRoundedWidth,
+ nRoundedHeight
+ );
+ }
+ }
+
+ this._bIsPainted = true;
+ };
+
+ /**
+ * Make the image from Canvas if the browser supports Data URI.
+ */
+ Drawing.prototype.makeImage = function () {
+ if (this._bIsPainted) {
+ _safeSetDataURI.call(this, _onMakeImage);
+ }
+ };
+
+ /**
+ * Return whether the QRCode is painted or not
+ *
+ * @return {Boolean}
+ */
+ Drawing.prototype.isPainted = function () {
+ return this._bIsPainted;
+ };
+
+ /**
+ * Clear the QRCode
+ */
+ Drawing.prototype.clear = function () {
+ this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
+ this._bIsPainted = false;
+ };
+
+ /**
+ * @private
+ * @param {Number} nNumber
+ */
+ Drawing.prototype.round = function (nNumber) {
+ if (!nNumber) {
+ return nNumber;
+ }
+
+ return Math.floor(nNumber * 1000) / 1000;
+ };
+
+ return Drawing;
+ })();
+
+ /**
+ * Get the type by string length
+ *
+ * @private
+ * @param {String} sText
+ * @param {Number} nCorrectLevel
+ * @return {Number} type
+ */
+ function _getTypeNumber(sText, nCorrectLevel) {
+ var nType = 1;
+ var length = _getUTF8Length(sText);
+
+ for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
+ var nLimit = 0;
+
+ switch (nCorrectLevel) {
+ case QRErrorCorrectLevel.L :
+ nLimit = QRCodeLimitLength[i][0];
+ break;
+ case QRErrorCorrectLevel.M :
+ nLimit = QRCodeLimitLength[i][1];
+ break;
+ case QRErrorCorrectLevel.Q :
+ nLimit = QRCodeLimitLength[i][2];
+ break;
+ case QRErrorCorrectLevel.H :
+ nLimit = QRCodeLimitLength[i][3];
+ break;
+ }
+
+ if (length <= nLimit) {
+ break;
+ } else {
+ nType++;
+ }
+ }
+
+ if (nType > QRCodeLimitLength.length) {
+ throw new Error("Too long data");
+ }
+
+ return nType;
+ }
+
+ function _getUTF8Length(sText) {
+ var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
+ return replacedText.length + (replacedText.length != sText ? 3 : 0);
+ }
+
+ /**
+ * @class QRCode
+ * @constructor
+ * @example
+ * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
+ *
+ * @example
+ * var oQRCode = new QRCode("test", {
+ * text : "http://naver.com",
+ * width : 128,
+ * height : 128
+ * });
+ *
+ * oQRCode.clear(); // Clear the QRCode.
+ * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode.
+ *
+ * @param {HTMLElement|String} el target element or 'id' attribute of element.
+ * @param {Object|String} vOption
+ * @param {String} vOption.text QRCode link data
+ * @param {Number} [vOption.width=256]
+ * @param {Number} [vOption.height=256]
+ * @param {String} [vOption.colorDark="#000000"]
+ * @param {String} [vOption.colorLight="#ffffff"]
+ * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H]
+ */
+ QRCode = function (el, vOption) {
+ this._htOption = {
+ width : 256,
+ height : 256,
+ typeNumber : 4,
+ colorDark : "#000000",
+ colorLight : "#ffffff",
+ correctLevel : QRErrorCorrectLevel.H
+ };
+
+ if (typeof vOption === 'string') {
+ vOption = {
+ text : vOption
+ };
+ }
+
+ // Overwrites options
+ if (vOption) {
+ for (var i in vOption) {
+ this._htOption[i] = vOption[i];
+ }
+ }
+
+ if (typeof el == "string") {
+ el = document.getElementById(el);
+ }
+
+ if (this._htOption.useSVG) {
+ Drawing = svgDrawer;
+ }
+
+ this._android = _getAndroid();
+ this._el = el;
+ this._oQRCode = null;
+ this._oDrawing = new Drawing(this._el, this._htOption);
+
+ if (this._htOption.text) {
+ this.makeCode(this._htOption.text);
+ }
+ };
+
+ /**
+ * Make the QRCode
+ *
+ * @param {String} sText link data
+ */
+ QRCode.prototype.makeCode = function (sText) {
+ this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
+ this._oQRCode.addData(sText);
+ this._oQRCode.make();
+ this._el.title = sText;
+ this._oDrawing.draw(this._oQRCode);
+ this.makeImage();
+ };
+
+ /**
+ * Make the Image from Canvas element
+ * - It occurs automatically
+ * - Android below 3 doesn't support Data-URI spec.
+ *
+ * @private
+ */
+ QRCode.prototype.makeImage = function () {
+ if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
+ this._oDrawing.makeImage();
+ }
+ };
+
+ /**
+ * Clear the QRCode
+ */
+ QRCode.prototype.clear = function () {
+ this._oDrawing.clear();
+ };
+
+ /**
+ * @name QRCode.CorrectLevel
+ */
+ QRCode.CorrectLevel = QRErrorCorrectLevel;
+})();
diff --git a/Lib/phpMQTT.php b/Lib/phpMQTT.php
new file mode 100644
index 0000000..dc9906d
--- /dev/null
+++ b/Lib/phpMQTT.php
@@ -0,0 +1,412 @@
+broker($address, $port, $clientid);
+ }
+
+ /* sets the broker details */
+ function broker($address, $port, $clientid){
+ $this->address = $address;
+ $this->port = $port;
+ $this->clientid = $clientid;
+ }
+
+ function connect_auto($clean = true, $will = NULL, $username = NULL, $password = NULL){
+ while($this->connect($clean, $will, $username, $password)==false){
+ sleep(10);
+ }
+ return true;
+ }
+
+ /* connects to the broker
+ inputs: $clean: should the client send a clean session flag */
+ function connect($clean = true, $will = NULL, $username = NULL, $password = NULL){
+
+ if($will) $this->will = $will;
+ if($username) $this->username = $username;
+ if($password) $this->password = $password;
+
+ $address = gethostbyname($this->address);
+ $this->socket = fsockopen($address, $this->port, $errno, $errstr, 60);
+
+ if (!$this->socket ) {
+ if($this->debug) error_log("fsockopen() $errno, $errstr \n");
+ return false;
+ }
+
+ stream_set_timeout($this->socket, 5);
+ stream_set_blocking($this->socket, 0);
+
+ $i = 0;
+ $buffer = "";
+
+ $buffer .= chr(0x00); $i++;
+ $buffer .= chr(0x06); $i++;
+ $buffer .= chr(0x4d); $i++;
+ $buffer .= chr(0x51); $i++;
+ $buffer .= chr(0x49); $i++;
+ $buffer .= chr(0x73); $i++;
+ $buffer .= chr(0x64); $i++;
+ $buffer .= chr(0x70); $i++;
+ $buffer .= chr(0x03); $i++;
+
+ //No Will
+ $var = 0;
+ if($clean) $var+=2;
+
+ //Add will info to header
+ if($this->will != NULL){
+ $var += 4; // Set will flag
+ $var += ($this->will['qos'] << 3); //Set will qos
+ if($this->will['retain']) $var += 32; //Set will retain
+ }
+
+ if($this->username != NULL) $var += 128; //Add username to header
+ if($this->password != NULL) $var += 64; //Add password to header
+
+ $buffer .= chr($var); $i++;
+
+ //Keep alive
+ $buffer .= chr($this->keepalive >> 8); $i++;
+ $buffer .= chr($this->keepalive & 0xff); $i++;
+
+ $buffer .= $this->strwritestring($this->clientid,$i);
+
+ //Adding will to payload
+ if($this->will != NULL){
+ $buffer .= $this->strwritestring($this->will['topic'],$i);
+ $buffer .= $this->strwritestring($this->will['content'],$i);
+ }
+
+ if($this->username) $buffer .= $this->strwritestring($this->username,$i);
+ if($this->password) $buffer .= $this->strwritestring($this->password,$i);
+
+ $head = " ";
+ $head{0} = chr(0x10);
+ $head{1} = chr($i);
+
+ fwrite($this->socket, $head, 2);
+ fwrite($this->socket, $buffer);
+
+ $string = $this->read(4);
+
+ if(ord($string{0})>>4 == 2 && $string{3} == chr(0)){
+ if($this->debug) echo "Connected to Broker\n";
+ }else{
+ error_log(sprintf("Connection failed! (Error: 0x%02x 0x%02x)\n",
+ ord($string{0}),ord($string{3})));
+ return false;
+ }
+
+ $this->timesinceping = time();
+
+ return true;
+ }
+
+ /* read: reads in so many bytes */
+ function read($int = 8192, $nb = false){
+
+ // print_r(socket_get_status($this->socket));
+
+ $string="";
+ $togo = $int;
+
+ if($nb){
+ return fread($this->socket, $togo);
+ }
+
+ while (!feof($this->socket) && $togo>0) {
+ $fread = fread($this->socket, $togo);
+ $string .= $fread;
+ $togo = $int - strlen($string);
+ }
+
+
+
+
+ return $string;
+ }
+
+ /* subscribe: subscribes to topics */
+ function subscribe($topics, $qos = 0){
+ $i = 0;
+ $buffer = "";
+ $id = $this->msgid;
+ $buffer .= chr($id >> 8); $i++;
+ $buffer .= chr($id % 256); $i++;
+
+ foreach($topics as $key => $topic){
+ $buffer .= $this->strwritestring($key,$i);
+ $buffer .= chr($topic["qos"]); $i++;
+ $this->topics[$key] = $topic;
+ }
+
+ $cmd = 0x80;
+ //$qos
+ $cmd += ($qos << 1);
+
+
+ $head = chr($cmd);
+ $head .= chr($i);
+
+ fwrite($this->socket, $head, 2);
+ fwrite($this->socket, $buffer, $i);
+ $string = $this->read(2);
+
+ $bytes = ord(substr($string,1,1));
+ $string = $this->read($bytes);
+ }
+
+ /* ping: sends a keep alive ping */
+ function ping(){
+ $head = " ";
+ $head = chr(0xc0);
+ $head .= chr(0x00);
+ fwrite($this->socket, $head, 2);
+ if($this->debug) echo "ping sent\n";
+ }
+
+ /* disconnect: sends a proper disconect cmd */
+ function disconnect(){
+ $head = " ";
+ $head{0} = chr(0xe0);
+ $head{1} = chr(0x00);
+ fwrite($this->socket, $head, 2);
+ }
+
+ /* close: sends a proper disconect, then closes the socket */
+ function close(){
+ $this->disconnect();
+ fclose($this->socket);
+ }
+
+ /* publish: publishes $content on a $topic */
+ function publish($topic, $content, $qos = 0, $retain = 0){
+
+ $i = 0;
+ $buffer = "";
+
+ $buffer .= $this->strwritestring($topic,$i);
+
+ //$buffer .= $this->strwritestring($content,$i);
+
+ if($qos){
+ $id = $this->msgid++;
+ $buffer .= chr($id >> 8); $i++;
+ $buffer .= chr($id % 256); $i++;
+ }
+
+ $buffer .= $content;
+ $i+=strlen($content);
+
+
+ $head = " ";
+ $cmd = 0x30;
+ if($qos) $cmd += $qos << 1;
+ if($retain) $cmd += 1;
+
+ $head{0} = chr($cmd);
+ $head .= $this->setmsglength($i);
+
+ fwrite($this->socket, $head, strlen($head));
+ fwrite($this->socket, $buffer, $i);
+
+ }
+
+ /* message: processes a recieved topic */
+ function message($msg){
+ $tlen = (ord($msg{0})<<8) + ord($msg{1});
+ $topic = substr($msg,2,$tlen);
+ $msg = substr($msg,($tlen+2));
+ $found = 0;
+ foreach($this->topics as $key=>$top){
+ if( preg_match("/^".str_replace("#",".*",
+ str_replace("+","[^\/]*",
+ str_replace("/","\/",
+ str_replace("$",'\$',
+ $key))))."$/",$topic) ){
+ if(is_callable($top['function'])){
+ call_user_func($top['function'],$topic,$msg);
+ $found = 1;
+ }
+ }
+ }
+
+ if($this->debug && !$found) echo "msg recieved but no match in subscriptions\n";
+ }
+
+ /* proc: the processing loop for an "allways on" client
+ set true when you are doing other stuff in the loop good for watching something else at the same time */
+ function proc( $loop = true){
+
+ if(1){
+ $sockets = array($this->socket);
+ $w = $e = NULL;
+ $cmd = 0;
+
+ //$byte = fgetc($this->socket);
+ if(feof($this->socket)){
+ if($this->debug) echo "eof receive going to reconnect for good measure\n";
+ fclose($this->socket);
+ $this->connect_auto(false);
+ if(count($this->topics))
+ $this->subscribe($this->topics);
+ }
+
+ $byte = $this->read(1, true);
+
+ if(!strlen($byte)){
+ if($loop){
+ usleep(100000);
+ }
+
+ }else{
+
+ $cmd = (int)(ord($byte)/16);
+ if($this->debug) echo "Recevid: $cmd\n";
+
+ $multiplier = 1;
+ $value = 0;
+ do{
+ $digit = ord($this->read(1));
+ $value += ($digit & 127) * $multiplier;
+ $multiplier *= 128;
+ }while (($digit & 128) != 0);
+
+ if($this->debug) echo "Fetching: $value\n";
+
+ if($value)
+ $string = $this->read($value,"fetch");
+
+ if($cmd){
+ switch($cmd){
+ case 3:
+ $this->message($string);
+ break;
+ }
+
+ $this->timesinceping = time();
+ }
+ }
+
+ if($this->timesinceping < (time() - $this->keepalive )){
+ if($this->debug) echo "not found something so ping\n";
+ $this->ping();
+ }
+
+
+ if($this->timesinceping<(time()-($this->keepalive*2))){
+ if($this->debug) echo "not seen a package in a while, disconnecting\n";
+ fclose($this->socket);
+ $this->connect_auto(false);
+ if(count($this->topics))
+ $this->subscribe($this->topics);
+ }
+
+ }
+ return 1;
+ }
+
+ /* getmsglength: */
+ function getmsglength(&$msg, &$i){
+
+ $multiplier = 1;
+ $value = 0 ;
+ do{
+ $digit = ord($msg{$i});
+ $value += ($digit & 127) * $multiplier;
+ $multiplier *= 128;
+ $i++;
+ }while (($digit & 128) != 0);
+
+ return $value;
+ }
+
+
+ /* setmsglength: */
+ function setmsglength($len){
+ $string = "";
+ do{
+ $digit = $len % 128;
+ $len = $len >> 7;
+ // if there are more digits to encode, set the top bit of this digit
+ if ( $len > 0 )
+ $digit = ($digit | 0x80);
+ $string .= chr($digit);
+ }while ( $len > 0 );
+ return $string;
+ }
+
+ /* strwritestring: writes a string to a buffer */
+ function strwritestring($str, &$i){
+ $ret = " ";
+ $len = strlen($str);
+ $msb = $len >> 8;
+ $lsb = $len % 256;
+ $ret = chr($msb);
+ $ret .= chr($lsb);
+ $ret .= $str;
+ $i += ($len+2);
+ return $ret;
+ }
+
+ function printstr($string){
+ $strlen = strlen($string);
+ for($j=0;$j<$strlen;$j++){
+ $num = ord($string{$j});
+ if($num > 31)
+ $chr = $string{$j}; else $chr = " ";
+ printf("%4d: %08b : 0x%02x : %s \n",$j,$num,$num,$chr);
+ }
+ }
+}
+
+?>
diff --git a/Lib/tablejs/COPYRIGHT.txt b/Lib/tablejs/COPYRIGHT.txt
new file mode 100644
index 0000000..264cdf4
--- /dev/null
+++ b/Lib/tablejs/COPYRIGHT.txt
@@ -0,0 +1,25 @@
+ table.js - jquery javascript based dynamic table library
+ Part of the openenergymonitor.org project
+
+ Copyright (C) 2013 Trystan Lea
+
+ 2016-12-20 - Expanded tables by : Nuno Chaveiro nchaveiro(a)gmail.com
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or any later version.
+
+ This program 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 Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ Contact:
+
+ Trystan Lea
+ trystan.lea@gmail.com
+ http://openenergymonitor.org
\ No newline at end of file
diff --git a/Lib/tablejs/LICENSE.txt b/Lib/tablejs/LICENSE.txt
new file mode 100644
index 0000000..4ec8c3f
--- /dev/null
+++ b/Lib/tablejs/LICENSE.txt
@@ -0,0 +1,619 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
diff --git a/Lib/tablejs/editable.html b/Lib/tablejs/editable.html
new file mode 100644
index 0000000..f0c9469
--- /dev/null
+++ b/Lib/tablejs/editable.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
table.js: edit and delete
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
table.js: basic list view
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
table.js: icon button
+
+
+
+
+
+9B9qVZ@Rm>Ufo?kpPl(ip`FM3
z3f_BoFXH{^5q!{o03QQ?1TTO;fzN=yfiHo7f-iy>PAPR6?0_P_58_cDjZsmH-3@Gkf^cn16fd={L+;?v-HQ1o8}e}U~wP5(3&i+^W8iRCi*
zGI$+)0o(^)0}UwazXoAieFMG^ehWgC`V|!aeg`f102Kf16SaSzfuE!Q1^66z3QmcC
z=fJ1IOQ87K!3XYD4Js;ISW?-Lb<$+rxShq1#4Anwf4GVLC-FXyS9FVi(vX_UW(z!r
zSK?C3NuHYeoBF_xN{^3@V_TZw)pAi}BZ>#w^x3P`0mnn?Sx3Fng@H&Hi4K@q(?K6<
z&y;$MQLrTAG#&RG%3`*WCv6h)L5I>qH*~7?T&J1ZNYqA;be0j6QyMsLq}bCTXZD!<
z03SQVybhGJHl9YdbYg8{zcNL!b&lhZjoRv#&RN~EVUU`B<(gI7rGXAOt9w<@5{Arj
zZcUu~*=9U7@G{F}Mw8)V%573+OvnI2tXv;2nYvI1)>b>1&vg}s+Npw7yJE7?eWoP!
zMW#o-iqw{&Cm$6?A2lQQqB@jX^$FJNn7nzn@q1Zd)0KuHq{dfPz
z`T6d`8?SffIvof`+kBLY)_=+^(A;8oezBIjseOoc9nMFlgLPec$Cr80la0Ktjp0eR
zo$y<&n>gMjb|uA1!l}4%`vx_CVj)SH
zrZ$ICD~5p>$!CYV6*!E`hV(pwpimmMk|Og`lN{V7BbN(nP^Ox?(Zn@dPi@rIqdL`<
zoTp8xAGn#w4wX5MkeRws*9|e%WaU3g$Xd!MvpbT1tFz%?o09a&S
A=>Px#
literal 0
HcmV?d00001
diff --git a/Modules/admin/locale/de_DE/LC_MESSAGES/messages.po b/Modules/admin/locale/de_DE/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..da12c46
--- /dev/null
+++ b/Modules/admin/locale/de_DE/LC_MESSAGES/messages.po
@@ -0,0 +1,123 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: emoncms3\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-02-02 22:36+0100\n"
+"PO-Revision-Date: 2015-02-03 14:24+0100\n"
+"Last-Translator: @sumpfing \n"
+"Language-Team: @sumpfing \n"
+"Language: de_DE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
+"X-Poedit-Basepath: .\n"
+"X-Generator: Poedit 1.5.4\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+"X-Poedit-SearchPath-0: ../../..\n"
+
+#: ../../../userlist_view.php:32
+msgid "Id"
+msgstr "Id"
+
+#: ../../../userlist_view.php:33
+msgid "Username"
+msgstr "Benutzername"
+
+#: ../../../userlist_view.php:34
+msgid "Email"
+msgstr "Email"
+
+#: ../../../admin_menu.php:7
+msgid "Admin"
+msgstr "Admin"
+
+#: ../../../admin_main_view.php:10 ../../../admin_main_view.php:14
+msgid "Users"
+msgstr "Benutzer"
+
+#: ../../../admin_main_view.php:11
+msgid "Administer user accounts"
+msgstr "Benutzerkonten verwalten"
+
+#: ../../../admin_main_view.php:19 ../../../update_view.php:29
+msgid "Update database"
+msgstr "Datenbankupdate"
+
+#: ../../../admin_main_view.php:20
+msgid ""
+"Run this after updating emoncms, after installing a new module or to check "
+"emoncms database status."
+msgstr ""
+"Bitte starten nach einem emoncms Update, nach Installation eines Moduls oder "
+"um den Datenbankstatus zu prüfen."
+
+#: ../../../admin_main_view.php:23
+msgid "Update & check"
+msgstr "Update & prüfen"
+
+#: ../../../admin_db_view.php:1
+msgid "Database setup, update and status check"
+msgstr "Datenbanksetup, Update und Status prüfen"
+
+#: ../../../admin_db_view.php:2
+msgid ""
+"This page displays the output of the database setup and update process which "
+"checks the database requirements of each module installed and enter any new "
+"table or fields if required."
+msgstr ""
+"Diese Seite zeigt die Ausgabe des Datenbanksetup und Updateprozess der die "
+"Datenbankanforderungen von jedem installieren Modul."
+
+#: ../../../admin_db_view.php:3
+msgid ""
+"If all the item statuses below show ok that means your database is setup "
+"correctly."
+msgstr ""
+"Wenn alle Statusanzeigen OK zeigen ist die Datenbank korrekt eingerichtet."
+
+#: ../../../admin_db_view.php:7
+msgid "Schema item"
+msgstr "Schema item"
+
+#: ../../../admin_db_view.php:7
+msgid "Name"
+msgstr "Name"
+
+#: ../../../admin_db_view.php:7
+msgid "Status"
+msgstr "Status"
+
+#: ../../../update_view.php:37
+msgid "Apply changes"
+msgstr "Änderungen zuweisen"
+
+#: ../../../update_view.php:44
+msgid "Check for further updates"
+msgstr "Auf weitere Updates prüfen"
+
+#: ../../../update_view.php:51
+msgid "Database is up to date "
+msgstr "Datenbank ist aktuell"
+
+#: ../../../update_view.php:51
+msgid "Nothing to do"
+msgstr "Nichts zu tun"
+
+#~ msgid "en_EN"
+#~ msgstr "English"
+
+#~ msgid "es_ES"
+#~ msgstr "Spanish"
+
+#~ msgid "nl_BE"
+#~ msgstr "Dutch (Belgium)"
+
+#~ msgid "nl_NL"
+#~ msgstr "Dutch (Netherlands)"
+
+#~ msgid "fr_FR"
+#~ msgstr "French"
+
+#~ msgid "AUTODETECTLANGUAGE"
+#~ msgstr "Use language browser"
diff --git a/Modules/admin/locale/et_EE/LC_MESSAGES/messages.mo b/Modules/admin/locale/et_EE/LC_MESSAGES/messages.mo
new file mode 100644
index 0000000000000000000000000000000000000000..f5ecfdab40e53f905a387e5fbff5544e62608c1a
GIT binary patch
literal 2379
zcmY+EOOG2x5XTz`FY``#N=OtCp4oA1Dg
z`oa|n2`LvM5ILb-xFMlP91xck5)xk_;u~<{1Hiv##&$BAncwtds{U2g-G3iH_N~D6
zBA%D=+`;n(o}2gKg{yJD5D$V)kmsBOp8)&dOW^0=3*aI67I+=x`M-jXg1>{f#h-X>
zgMWd?z*in9?VJRMXt%(}z#HI0;E&*K@F(y|a2G#41sd=X@Jo>WdmYs+
z-+})ihMOS&|22$04}K3G2Y&`Ro};S&4tN^ve?i>hbr@qk?}BXqEch9?3c{qg0dm|w
zfCl^pWIwM#96m)8`~zGCPk{e{PlG3rl*hr7Am^uv7u#P0F-2SeS^s5_OTe1>VlC{K
zwX+}2#r&$_)=@UdbUL2lRw!f>*9-baZUMp1`q3FEqrl~=NIQobizcN
z@~xd$8RZTyIUL&Dcqck(8qa7rk!Gx%xHwV6h(F|r}O+>=g`cIYE-
ziTi2U@08Eem1;go6O!}N=MJ`EQ*;xlW3hR4d(he1>TZb5P;8D!#xcPSX|IxMzH+pu
zVtYVtf|rdjEpmXY6;Oq;N_@n`LU~<5^u?m5CBpt)FN!E<{>!EjO?M*>Y5b
z&jInMN~{?sZl&ti272R|M`*yJ2NOMvMSIrk}cuyzcmm_M8_
zR!l){jhJDL^fSAUIs}_x@JZR-rf!*KTCE>aK*eIL^*qPtDX?{>SjE1Ork%UGKAM(v_S
zG7Y@VQpon|(4R(ewOK>PWQH=X?+h*l=a=(X)ktMQ*9>il)zzl+d)n7N4K6FAvQlo}
zs!)4s*3Z|^Vx(*aA7Z>@Jx&F4HSJ$ce&f4<-
zo|+xlEOcAQMVoflc5$nZCZUF&bjDZn%Pz|8&3KV5;P#Ce!948iz6kI
z9EA8t#-XH0y4=fs86i#9=}=sgkun%a@*JxOXHO`47|SfS8q$Z_Ql4W*?zHHbFj0Fb
z5?Moq5gbcu*{x{;Cpork@r$H=I9wRRUStPebc56a{m$m)&eld}uv45iyg=iFNMLiN8bM^(#C-HLi;k>
zL`FE!=E8It2!x07?sQov#daAYs3=ww6&?K+k15Kha_?RPMQF$$XSFH`divT!Z^PnO-K`P+GX&A;~#Lfs*h`0!{@FZ8Dk>kP%
oY>J%5I>PzHYvta;&-)hH5WQ*<8m`K`5elWN(+bDczMP2v0drTP*#H0l
literal 0
HcmV?d00001
diff --git a/Modules/admin/locale/et_EE/LC_MESSAGES/messages.po b/Modules/admin/locale/et_EE/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..9553cdc
--- /dev/null
+++ b/Modules/admin/locale/et_EE/LC_MESSAGES/messages.po
@@ -0,0 +1,122 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Emoncms 9.x - Admin\n"
+"POT-Creation-Date: 2015-02-04 02:27+0100\n"
+"PO-Revision-Date: 2015-11-09 21:44+0200\n"
+"Last-Translator: Kristo Kaasan \n"
+"Language-Team: Environ\n"
+"Language: et_EE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.6\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-KeywordsList: _;__;_e;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
+"X-Poedit-SearchPath-0: ../../..\n"
+
+#: ../../../admin_db_view.php:1
+msgid "Database setup, update and status check"
+msgstr "Andmebaasi haldus, uuenda ja kontrolli staatust"
+
+#: ../../../admin_db_view.php:2
+msgid ""
+"This page displays the output of the database setup and update process which "
+"checks the database requirements of each module installed and enter any new "
+"table or fields if required."
+msgstr ""
+"See lehekülg kuvab andmebaasi seadistust ja uuenduse protsessi väljundit, "
+"mis kontrollib andmebaasi tingimusi iga paigaldatud mooduli kohta ja "
+"sisestab uue tabeli või välja, kui see on vajalik."
+
+#: ../../../admin_db_view.php:3
+msgid ""
+"If all the item statuses below show ok that means your database is setup "
+"correctly."
+msgstr ""
+"Kui kõik elementide seisundid allpool on korras, siis on andmebaas "
+"seadistatud korrektselt."
+
+#: ../../../admin_db_view.php:7
+msgid "Schema item"
+msgstr "Andmebaasi osa"
+
+#: ../../../admin_db_view.php:7
+msgid "Name"
+msgstr "Nimi"
+
+#: ../../../admin_db_view.php:7
+msgid "Status"
+msgstr "Seisund"
+
+#: ../../../admin_main_view.php:6
+msgid "version"
+msgstr "versioon"
+
+#: ../../../admin_main_view.php:10 ../../../admin_main_view.php:14
+msgid "Users"
+msgstr "Kasutajad"
+
+#: ../../../admin_main_view.php:11
+msgid "Administer user accounts"
+msgstr "Halda kasutajakontosid"
+
+#: ../../../admin_main_view.php:19 ../../../update_view.php:29
+msgid "Update database"
+msgstr "Uuenda andmebaas"
+
+#: ../../../admin_main_view.php:20
+msgid ""
+"Run this after updating emoncms, after installing a new module or to check "
+"emoncms database status."
+msgstr ""
+"Käivita see peale emoncms uuendamist, peale uue mooduli paigaldamist või "
+"kontrollimaks andmebaasi seisukorda"
+
+#: ../../../admin_main_view.php:23
+msgid "Update & check"
+msgstr "Uuenda ja kontrolli"
+
+#: ../../../admin_main_view.php:27
+msgid "INSTALLED"
+msgstr "PAIGALDATUD"
+
+#: ../../../admin_main_view.php:27
+msgid "yes"
+msgstr "jah"
+
+#: ../../../admin_main_view.php:27
+msgid "no"
+msgstr "ei"
+
+#: ../../../admin_menu.php:7
+msgid "Admin"
+msgstr "Administraator"
+
+#: ../../../update_view.php:37
+msgid "Apply changes"
+msgstr "Rakenda muudatused"
+
+#: ../../../update_view.php:44
+msgid "Check for further updates"
+msgstr "Kontrolli teisi uuendusi"
+
+#: ../../../update_view.php:51
+msgid "Database is up to date "
+msgstr "Andmebaas on ajakohane"
+
+#: ../../../update_view.php:51
+msgid "Nothing to do"
+msgstr "Ei ole vaja midagi teha"
+
+#: ../../../userlist_view.php:32
+msgid "Id"
+msgstr "Id"
+
+#: ../../../userlist_view.php:33
+msgid "Username"
+msgstr "Kasutajanimi"
+
+#: ../../../userlist_view.php:34
+msgid "Email"
+msgstr "E-post"
diff --git a/Modules/admin/locale/it_IT/LC_MESSAGES/messages.mo b/Modules/admin/locale/it_IT/LC_MESSAGES/messages.mo
new file mode 100644
index 0000000000000000000000000000000000000000..1c0784b265b978febd0d319475ff4386c5ac250a
GIT binary patch
literal 2392
zcmaKtO>Y}T7{>=FZ|0>?-X#zZQlX$`w|3Mvk<$QanpPHW8yW|3BAV=u?V-Cf%g(G*
z_rR44NEH%@Lr-ui+z}iQ7cQ0h4G`ihaNz^+e`eQqdST_=-_Fj=^FELNK6d0Af$L@5
zuj2j-_nWwHKY$0W_Jcw^40b?XvjRQ^ZiBCYpMWocH^39%Es)p$3O)}04&o>7;;{qX
z1CM~OKUB*(4kj2cgHM3pf{%dTgFk~mf=`2c*mM*$;A7zDAnW-8Wcgo#kAk;AY!Tmq
z|Gr+SPSfcEdLysfbW42DSiOit~=la
z{G}PkFpl@HgZIEq@Okhkg28%^gY4&75URv^kmdJ4_N(8FcR^0Ui@5pXJ*@W_Zr01O
zm|bk=3$p>p{=XePwl)a
zsd9M8B(at8PHYrKHl<`N%}6=1IabMa8rqVERq4mPx=5wR%mwM?zI2MT!#DDl_&Y7W
zJLRilsaa3bq~yHxm4j@^6kEB}ndn{F8Eo|XTNgwx6}=(JEF-8P?N#2aSB~~oW)H}X
z@vzr1FFoZ-8b?!Gm8^GeNl;3OElZX7Y#NIzGFRe?^uMAz^N#0qMW0Hu};Rd`dYwzOQ}Aqbg6QMG_pJ;v9K|^
zaYm&f5m><~H`Cx3qF1{$)GA9I=^-_u(pc<ZQ>~_2({a)lsI^_;lQ+h(bBGwyzGN%~Bx|)&W+@LoXP6_5f^8i*!3Pw)nX-1?;#