Added the remote web enhancement developed by Prince Samuel.
23
GUI/MainForm.Designer.cs
generated
@ -75,6 +75,9 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.fahrenheitMenuItem = new System.Windows.Forms.MenuItem();
|
this.fahrenheitMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
this.MenuItem4 = new System.Windows.Forms.MenuItem();
|
this.MenuItem4 = new System.Windows.Forms.MenuItem();
|
||||||
this.hddMenuItem = new System.Windows.Forms.MenuItem();
|
this.hddMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
|
this.webMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
|
this.runWebServerMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
|
this.serverPortMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
this.helpMenuItem = new System.Windows.Forms.MenuItem();
|
this.helpMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
this.aboutMenuItem = new System.Windows.Forms.MenuItem();
|
this.aboutMenuItem = new System.Windows.Forms.MenuItem();
|
||||||
this.treeContextMenu = new System.Windows.Forms.ContextMenu();
|
this.treeContextMenu = new System.Windows.Forms.ContextMenu();
|
||||||
@ -304,7 +307,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.temperatureUnitsMenuItem,
|
this.temperatureUnitsMenuItem,
|
||||||
this.plotLocationMenuItem,
|
this.plotLocationMenuItem,
|
||||||
this.MenuItem4,
|
this.MenuItem4,
|
||||||
this.hddMenuItem});
|
this.hddMenuItem,
|
||||||
|
this.webMenuItem});
|
||||||
this.optionsMenuItem.Text = "Options";
|
this.optionsMenuItem.Text = "Options";
|
||||||
//
|
//
|
||||||
// startMinMenuItem
|
// startMinMenuItem
|
||||||
@ -361,6 +365,20 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
//
|
//
|
||||||
this.hddMenuItem.Index = 8;
|
this.hddMenuItem.Index = 8;
|
||||||
this.hddMenuItem.Text = "Read HDD sensors";
|
this.hddMenuItem.Text = "Read HDD sensors";
|
||||||
|
//
|
||||||
|
// webMenuItem
|
||||||
|
//
|
||||||
|
this.webMenuItem.Index = 9;
|
||||||
|
this.webMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
||||||
|
this.runWebServerMenuItem,
|
||||||
|
this.serverPortMenuItem});
|
||||||
|
this.webMenuItem.Text = "Remote Web Server";
|
||||||
|
//
|
||||||
|
// serverPortMenuItem
|
||||||
|
//
|
||||||
|
this.serverPortMenuItem.Index = 1;
|
||||||
|
this.serverPortMenuItem.Text = "Port";
|
||||||
|
this.serverPortMenuItem.Click += new System.EventHandler(this.serverPortMenuItem_Click);
|
||||||
//
|
//
|
||||||
// helpMenuItem
|
// helpMenuItem
|
||||||
//
|
//
|
||||||
@ -542,6 +560,9 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private System.Windows.Forms.MenuItem plotWindowMenuItem;
|
private System.Windows.Forms.MenuItem plotWindowMenuItem;
|
||||||
private System.Windows.Forms.MenuItem plotBottomMenuItem;
|
private System.Windows.Forms.MenuItem plotBottomMenuItem;
|
||||||
private System.Windows.Forms.MenuItem plotRightMenuItem;
|
private System.Windows.Forms.MenuItem plotRightMenuItem;
|
||||||
|
private System.Windows.Forms.MenuItem webMenuItem;
|
||||||
|
private System.Windows.Forms.MenuItem runWebServerMenuItem;
|
||||||
|
private System.Windows.Forms.MenuItem serverPortMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
|
Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
|
||||||
Copyright (C) 2010 Paul Werelds <paul@werelds.net>
|
Copyright (C) 2010 Paul Werelds <paul@werelds.net>
|
||||||
|
Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ using Aga.Controls.Tree;
|
|||||||
using Aga.Controls.Tree.NodeControls;
|
using Aga.Controls.Tree.NodeControls;
|
||||||
using OpenHardwareMonitor.Hardware;
|
using OpenHardwareMonitor.Hardware;
|
||||||
using OpenHardwareMonitor.WMI;
|
using OpenHardwareMonitor.WMI;
|
||||||
|
using OpenHardwareMonitor.Utilities;
|
||||||
|
|
||||||
namespace OpenHardwareMonitor.GUI {
|
namespace OpenHardwareMonitor.GUI {
|
||||||
public partial class MainForm : Form {
|
public partial class MainForm : Form {
|
||||||
@ -51,9 +53,11 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private UserOption readHddSensors;
|
private UserOption readHddSensors;
|
||||||
private UserOption showGadget;
|
private UserOption showGadget;
|
||||||
private UserRadioGroup plotLocation;
|
private UserRadioGroup plotLocation;
|
||||||
|
|
||||||
private WmiProvider wmiProvider;
|
private WmiProvider wmiProvider;
|
||||||
|
|
||||||
|
private UserOption runWebServer;
|
||||||
|
private HttpServer server;
|
||||||
|
|
||||||
private bool selectionDragging = false;
|
private bool selectionDragging = false;
|
||||||
|
|
||||||
public MainForm() {
|
public MainForm() {
|
||||||
@ -220,6 +224,18 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
unitManager.TemperatureUnit == TemperatureUnit.Celsius;
|
unitManager.TemperatureUnit == TemperatureUnit.Celsius;
|
||||||
fahrenheitMenuItem.Checked = !celsiusMenuItem.Checked;
|
fahrenheitMenuItem.Checked = !celsiusMenuItem.Checked;
|
||||||
|
|
||||||
|
server = new HttpServer(root, this.settings.GetValue("listenerPort", 8085));
|
||||||
|
runWebServer = new UserOption("runWebServerMenuItem", false,
|
||||||
|
runWebServerMenuItem, settings);
|
||||||
|
runWebServer.Changed += delegate(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (runWebServer.Value)
|
||||||
|
runWebServer.Value = server.startHTTPListener();
|
||||||
|
else
|
||||||
|
server.stopHTTPListener();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
InitializePlotForm();
|
InitializePlotForm();
|
||||||
|
|
||||||
startupMenuItem.Visible = startupManager.IsAvailable;
|
startupMenuItem.Visible = startupManager.IsAvailable;
|
||||||
@ -239,6 +255,9 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
// Make sure the settings are saved when the user logs off
|
// Make sure the settings are saved when the user logs off
|
||||||
Microsoft.Win32.SystemEvents.SessionEnded += delegate {
|
Microsoft.Win32.SystemEvents.SessionEnded += delegate {
|
||||||
SaveConfiguration();
|
SaveConfiguration();
|
||||||
|
if (runWebServer.Value)
|
||||||
|
server.Quit();
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,6 +459,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
settings.SetValue("treeView.Columns." + column.Header + ".Width",
|
settings.SetValue("treeView.Columns." + column.Header + ".Width",
|
||||||
column.Width);
|
column.Width);
|
||||||
|
|
||||||
|
this.settings.SetValue("listenerPort", server.ListenerPort);
|
||||||
|
|
||||||
string fileName = Path.ChangeExtension(
|
string fileName = Path.ChangeExtension(
|
||||||
System.Windows.Forms.Application.ExecutablePath, ".config");
|
System.Windows.Forms.Application.ExecutablePath, ".config");
|
||||||
try {
|
try {
|
||||||
@ -489,6 +510,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
timer.Enabled = false;
|
timer.Enabled = false;
|
||||||
computer.Close();
|
computer.Close();
|
||||||
SaveConfiguration();
|
SaveConfiguration();
|
||||||
|
if (runWebServer.Value)
|
||||||
|
server.Quit();
|
||||||
systemTray.Dispose();
|
systemTray.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,5 +755,14 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private void treeView_MouseUp(object sender, MouseEventArgs e) {
|
private void treeView_MouseUp(object sender, MouseEventArgs e) {
|
||||||
selectionDragging = false;
|
selectionDragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void serverPortMenuItem_Click(object sender, EventArgs e) {
|
||||||
|
new PortForm(this).ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HttpServer Server {
|
||||||
|
get { return server; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
180
GUI/PortForm.Designer.cs
generated
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
namespace OpenHardwareMonitor.GUI {
|
||||||
|
partial class PortForm {
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
if (disposing && (components != null)) {
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent() {
|
||||||
|
this.portOKButton = new System.Windows.Forms.Button();
|
||||||
|
this.portCancelButton = new System.Windows.Forms.Button();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.webServerLinkLabel = new System.Windows.Forms.LinkLabel();
|
||||||
|
this.portNumericUpDn = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.portNumericUpDn)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// portOKButton
|
||||||
|
//
|
||||||
|
this.portOKButton.Location = new System.Drawing.Point(244, 137);
|
||||||
|
this.portOKButton.Name = "portOKButton";
|
||||||
|
this.portOKButton.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.portOKButton.TabIndex = 0;
|
||||||
|
this.portOKButton.Text = "OK";
|
||||||
|
this.portOKButton.UseVisualStyleBackColor = true;
|
||||||
|
this.portOKButton.Click += new System.EventHandler(this.portOKButton_Click);
|
||||||
|
//
|
||||||
|
// portCancelButton
|
||||||
|
//
|
||||||
|
this.portCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
|
this.portCancelButton.Location = new System.Drawing.Point(162, 137);
|
||||||
|
this.portCancelButton.Name = "portCancelButton";
|
||||||
|
this.portCancelButton.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.portCancelButton.TabIndex = 1;
|
||||||
|
this.portCancelButton.Text = "Cancel";
|
||||||
|
this.portCancelButton.UseVisualStyleBackColor = true;
|
||||||
|
this.portCancelButton.Click += new System.EventHandler(this.portCancelButton_Click);
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(13, 106);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(377, 13);
|
||||||
|
this.label1.TabIndex = 3;
|
||||||
|
this.label1.Text = "Note: You will need to open the port in firewall settings of the operating system" +
|
||||||
|
".";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(13, 9);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(193, 13);
|
||||||
|
this.label2.TabIndex = 4;
|
||||||
|
this.label2.Text = "Port number for the remote web server:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(13, 39);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(443, 13);
|
||||||
|
this.label3.TabIndex = 5;
|
||||||
|
this.label3.Text = "If the web server is running then it will need to be restarted for the port chang" +
|
||||||
|
"e to take effect.";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(13, 62);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(262, 13);
|
||||||
|
this.label4.TabIndex = 6;
|
||||||
|
this.label4.Text = "The web server will be accessible from the browser at ";
|
||||||
|
//
|
||||||
|
// webServerLinkLabel
|
||||||
|
//
|
||||||
|
this.webServerLinkLabel.AutoSize = true;
|
||||||
|
this.webServerLinkLabel.Location = new System.Drawing.Point(269, 62);
|
||||||
|
this.webServerLinkLabel.Name = "webServerLinkLabel";
|
||||||
|
this.webServerLinkLabel.Size = new System.Drawing.Size(55, 13);
|
||||||
|
this.webServerLinkLabel.TabIndex = 7;
|
||||||
|
this.webServerLinkLabel.TabStop = true;
|
||||||
|
this.webServerLinkLabel.Text = "linkLabel1";
|
||||||
|
this.webServerLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.webServerLinkLabel_LinkClicked);
|
||||||
|
//
|
||||||
|
// portNumericUpDn
|
||||||
|
//
|
||||||
|
this.portNumericUpDn.Location = new System.Drawing.Point(208, 7);
|
||||||
|
this.portNumericUpDn.Maximum = new decimal(new int[] {
|
||||||
|
20000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.portNumericUpDn.Minimum = new decimal(new int[] {
|
||||||
|
8080,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.portNumericUpDn.Name = "portNumericUpDn";
|
||||||
|
this.portNumericUpDn.Size = new System.Drawing.Size(75, 20);
|
||||||
|
this.portNumericUpDn.TabIndex = 8;
|
||||||
|
this.portNumericUpDn.Value = new decimal(new int[] {
|
||||||
|
8080,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.portNumericUpDn.ValueChanged += new System.EventHandler(this.portNumericUpDn_ValueChanged);
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(13, 84);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(304, 13);
|
||||||
|
this.label5.TabIndex = 9;
|
||||||
|
this.label5.Text = "You will have to start the server by clicking Run from the menu.";
|
||||||
|
//
|
||||||
|
// PortForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.CancelButton = this.portCancelButton;
|
||||||
|
this.ClientSize = new System.Drawing.Size(466, 170);
|
||||||
|
this.Controls.Add(this.label5);
|
||||||
|
this.Controls.Add(this.portNumericUpDn);
|
||||||
|
this.Controls.Add(this.webServerLinkLabel);
|
||||||
|
this.Controls.Add(this.label4);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.portCancelButton);
|
||||||
|
this.Controls.Add(this.portOKButton);
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "PortForm";
|
||||||
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "Set Port";
|
||||||
|
this.Load += new System.EventHandler(this.PortForm_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.portNumericUpDn)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button portOKButton;
|
||||||
|
private System.Windows.Forms.Button portCancelButton;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.LinkLabel webServerLinkLabel;
|
||||||
|
private System.Windows.Forms.NumericUpDown portNumericUpDn;
|
||||||
|
private System.Windows.Forms.Label label5;
|
||||||
|
}
|
||||||
|
}
|
77
GUI/PortForm.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace OpenHardwareMonitor.GUI {
|
||||||
|
public partial class PortForm : Form {
|
||||||
|
private MainForm parent;
|
||||||
|
private string localIP;
|
||||||
|
public PortForm(MainForm m) {
|
||||||
|
InitializeComponent();
|
||||||
|
parent = m;
|
||||||
|
|
||||||
|
localIP = getLocalIP();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void portTextBox_TextChanged(object sender, EventArgs e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private string getLocalIP() {
|
||||||
|
IPHostEntry host;
|
||||||
|
string localIP = "?";
|
||||||
|
host = Dns.GetHostEntry(Dns.GetHostName());
|
||||||
|
foreach (IPAddress ip in host.AddressList) {
|
||||||
|
if (ip.AddressFamily == AddressFamily.InterNetwork) {
|
||||||
|
localIP = ip.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return localIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void portNumericUpDn_ValueChanged(object sender, EventArgs e) {
|
||||||
|
string url = "http://" + localIP + ":" + portNumericUpDn.Value + "/";
|
||||||
|
webServerLinkLabel.Text = url;
|
||||||
|
webServerLinkLabel.Links.Remove(webServerLinkLabel.Links[0]);
|
||||||
|
webServerLinkLabel.Links.Add(0, webServerLinkLabel.Text.Length, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void portOKButton_Click(object sender, EventArgs e) {
|
||||||
|
parent.Server.ListenerPort = (int)portNumericUpDn.Value;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void portCancelButton_Click(object sender, EventArgs e) {
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PortForm_Load(object sender, EventArgs e) {
|
||||||
|
portNumericUpDn.Value = parent.Server.ListenerPort;
|
||||||
|
portNumericUpDn_ValueChanged(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void webServerLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||||
|
try {
|
||||||
|
Process.Start(new ProcessStartInfo(e.Link.LinkData.ToString()));
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
GUI/PortForm.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -74,6 +74,8 @@ The remainder of the software which is not under the Mozilla Public License 2.0
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="#Aga.Controls">Aga.Controls License</a></li>
|
<li><a href="#Aga.Controls">Aga.Controls License</a></li>
|
||||||
<li><a href="#WinRing0">WinRing0 License</a></li>
|
<li><a href="#WinRing0">WinRing0 License</a></li>
|
||||||
|
<li><a href="#jQuery">jQuery License</a></li>
|
||||||
|
<li><a href="#Knockout">Knockout License</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
@ -242,7 +244,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<h1 id="WinRing0">WinRing0</h1>
|
<h1 id="WinRing0">WinRing0 License</h1>
|
||||||
<p>
|
<p>
|
||||||
This license applies to the WinRing0 device drivers.
|
This license applies to the WinRing0 device drivers.
|
||||||
</p>
|
</p>
|
||||||
@ -270,6 +272,66 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<h1 id="jQuery">jQuery License</h1>
|
||||||
|
<p>
|
||||||
|
This license applies to the jQuery JavaScript library.
|
||||||
|
</p>
|
||||||
|
<pre>
|
||||||
|
Copyright (c) 2012 John Resig, http://jquery.com/
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<h1 id="Knockout">Knockout License</h1>
|
||||||
|
<p>
|
||||||
|
This license applies to the Knockout JavaScript library.
|
||||||
|
</p>
|
||||||
|
<pre>
|
||||||
|
Copyright (c) 2012 Steven Sanderson, Roy Jacobs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration.Install" />
|
<Reference Include="System.Configuration.Install" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Management" />
|
<Reference Include="System.Management" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
@ -76,6 +77,12 @@
|
|||||||
<Compile Include="GUI\PlotPanel.cs">
|
<Compile Include="GUI\PlotPanel.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="GUI\PortForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="GUI\PortForm.Designer.cs">
|
||||||
|
<DependentUpon>PortForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="GUI\ReportForm.cs">
|
<Compile Include="GUI\ReportForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -111,6 +118,7 @@
|
|||||||
<Compile Include="GUI\UserOption.cs" />
|
<Compile Include="GUI\UserOption.cs" />
|
||||||
<Compile Include="GUI\UserRadioGroup.cs" />
|
<Compile Include="GUI\UserRadioGroup.cs" />
|
||||||
<Compile Include="Properties\AssemblyVersion.cs" />
|
<Compile Include="Properties\AssemblyVersion.cs" />
|
||||||
|
<Compile Include="Utilities\HttpServer.cs" />
|
||||||
<Compile Include="Utilities\PersistentSettings.cs" />
|
<Compile Include="Utilities\PersistentSettings.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="GUI\AboutBox.cs">
|
<Compile Include="GUI\AboutBox.cs">
|
||||||
@ -142,6 +150,9 @@
|
|||||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="GUI\PortForm.resx">
|
||||||
|
<DependentUpon>PortForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Resources\ati.png">
|
<EmbeddedResource Include="Resources\ati.png">
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Resources\bigng.png" />
|
<EmbeddedResource Include="Resources\bigng.png" />
|
||||||
@ -228,6 +239,49 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Resources\factor.png" />
|
<EmbeddedResource Include="Resources\factor.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\jquery-ui-1.8.16.custom.min.js" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\jquery.tmpl.min.js" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\jquery.treeTable.min.js" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\ohm_web.js" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\images\toggle-collapse-dark.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\images\toggle-collapse-light.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\images\toggle-expand-dark.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\images\toggle-expand-light.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_flat_0_aaaaaa_40x100.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_55_fbf9ee_1x400.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_65_ffffff_1x400.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_75_dadada_1x400.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_75_e6e6e6_1x400.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_75_ffffff_1x400.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_highlight-soft_75_cccccc_1x100.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_inset-soft_95_fef1ec_1x100.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_222222_256x240.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_2e83ff_256x240.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_454545_256x240.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_888888_256x240.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_cd0a0a_256x240.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\custom-theme\jquery-ui-1.8.16.custom.css" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\jquery.treeTable.css" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\css\ohm_web.css" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\index.html" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\images\transparent.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\jquery-1.7.2.min.js" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\knockout-2.1.0.min.js" />
|
||||||
|
<EmbeddedResource Include="Resources\Web\js\knockout.mapping-latest.min.js" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio AllowExistingFolder="true" />
|
<VisualStudio AllowExistingFolder="true" />
|
||||||
|
After Width: | Height: | Size: 180 B |
After Width: | Height: | Size: 120 B |
After Width: | Height: | Size: 105 B |
After Width: | Height: | Size: 111 B |
After Width: | Height: | Size: 110 B |
After Width: | Height: | Size: 107 B |
After Width: | Height: | Size: 101 B |
After Width: | Height: | Size: 123 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
351
Resources/Web/css/custom-theme/jquery-ui-1.8.16.custom.css
vendored
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
/*
|
||||||
|
* jQuery UI CSS Framework 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Theming/API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Layout helpers
|
||||||
|
----------------------------------*/
|
||||||
|
.ui-helper-hidden { display: none; }
|
||||||
|
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
||||||
|
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
||||||
|
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||||
|
.ui-helper-clearfix { display: inline-block; }
|
||||||
|
/* required comment for clearfix to work in Opera \*/
|
||||||
|
* html .ui-helper-clearfix { height:1%; }
|
||||||
|
.ui-helper-clearfix { display:block; }
|
||||||
|
/* end clearfix */
|
||||||
|
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
||||||
|
|
||||||
|
|
||||||
|
/* Interaction Cues
|
||||||
|
----------------------------------*/
|
||||||
|
.ui-state-disabled { cursor: default !important; }
|
||||||
|
|
||||||
|
|
||||||
|
/* Icons
|
||||||
|
----------------------------------*/
|
||||||
|
|
||||||
|
/* states and images */
|
||||||
|
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
||||||
|
|
||||||
|
|
||||||
|
/* Misc visuals
|
||||||
|
----------------------------------*/
|
||||||
|
|
||||||
|
/* Overlays */
|
||||||
|
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* jQuery UI CSS Framework 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Theming/API
|
||||||
|
*
|
||||||
|
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ctl=themeroller
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Component containers
|
||||||
|
----------------------------------*/
|
||||||
|
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
|
||||||
|
.ui-widget .ui-widget { font-size: 1em; }
|
||||||
|
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
|
||||||
|
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_75_ffffff_1x400.png) 50% 50% repeat-x; color: #222222; }
|
||||||
|
.ui-widget-content a { color: #222222; }
|
||||||
|
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
||||||
|
.ui-widget-header a { color: #222222; }
|
||||||
|
|
||||||
|
/* Interaction states
|
||||||
|
----------------------------------*/
|
||||||
|
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
|
||||||
|
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
|
||||||
|
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
||||||
|
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
|
||||||
|
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
||||||
|
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
|
||||||
|
.ui-widget :active { outline: none; }
|
||||||
|
|
||||||
|
/* Interaction Cues
|
||||||
|
----------------------------------*/
|
||||||
|
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
|
||||||
|
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
||||||
|
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; }
|
||||||
|
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
|
||||||
|
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
|
||||||
|
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
||||||
|
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
||||||
|
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
||||||
|
|
||||||
|
/* Icons
|
||||||
|
----------------------------------*/
|
||||||
|
|
||||||
|
/* states and images */
|
||||||
|
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
|
||||||
|
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
||||||
|
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
||||||
|
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
|
||||||
|
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
||||||
|
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
||||||
|
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
|
||||||
|
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
|
||||||
|
|
||||||
|
/* positioning */
|
||||||
|
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||||
|
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
||||||
|
.ui-icon-carat-1-e { background-position: -32px 0; }
|
||||||
|
.ui-icon-carat-1-se { background-position: -48px 0; }
|
||||||
|
.ui-icon-carat-1-s { background-position: -64px 0; }
|
||||||
|
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
||||||
|
.ui-icon-carat-1-w { background-position: -96px 0; }
|
||||||
|
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
||||||
|
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
||||||
|
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
||||||
|
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
||||||
|
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
||||||
|
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
||||||
|
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
||||||
|
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
||||||
|
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
||||||
|
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
||||||
|
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
||||||
|
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
||||||
|
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
||||||
|
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
||||||
|
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
||||||
|
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
||||||
|
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
||||||
|
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
||||||
|
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
||||||
|
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
||||||
|
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
||||||
|
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
||||||
|
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
||||||
|
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
||||||
|
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
||||||
|
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
||||||
|
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
||||||
|
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
||||||
|
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
||||||
|
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
||||||
|
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
||||||
|
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
||||||
|
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
||||||
|
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
||||||
|
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
||||||
|
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
||||||
|
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
||||||
|
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
||||||
|
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
||||||
|
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
||||||
|
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
||||||
|
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
||||||
|
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
||||||
|
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
||||||
|
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
||||||
|
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
||||||
|
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
||||||
|
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
||||||
|
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
||||||
|
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
||||||
|
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
||||||
|
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
||||||
|
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
||||||
|
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
||||||
|
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
||||||
|
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
||||||
|
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
||||||
|
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
||||||
|
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
||||||
|
.ui-icon-extlink { background-position: -32px -80px; }
|
||||||
|
.ui-icon-newwin { background-position: -48px -80px; }
|
||||||
|
.ui-icon-refresh { background-position: -64px -80px; }
|
||||||
|
.ui-icon-shuffle { background-position: -80px -80px; }
|
||||||
|
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
||||||
|
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
||||||
|
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
||||||
|
.ui-icon-folder-open { background-position: -16px -96px; }
|
||||||
|
.ui-icon-document { background-position: -32px -96px; }
|
||||||
|
.ui-icon-document-b { background-position: -48px -96px; }
|
||||||
|
.ui-icon-note { background-position: -64px -96px; }
|
||||||
|
.ui-icon-mail-closed { background-position: -80px -96px; }
|
||||||
|
.ui-icon-mail-open { background-position: -96px -96px; }
|
||||||
|
.ui-icon-suitcase { background-position: -112px -96px; }
|
||||||
|
.ui-icon-comment { background-position: -128px -96px; }
|
||||||
|
.ui-icon-person { background-position: -144px -96px; }
|
||||||
|
.ui-icon-print { background-position: -160px -96px; }
|
||||||
|
.ui-icon-trash { background-position: -176px -96px; }
|
||||||
|
.ui-icon-locked { background-position: -192px -96px; }
|
||||||
|
.ui-icon-unlocked { background-position: -208px -96px; }
|
||||||
|
.ui-icon-bookmark { background-position: -224px -96px; }
|
||||||
|
.ui-icon-tag { background-position: -240px -96px; }
|
||||||
|
.ui-icon-home { background-position: 0 -112px; }
|
||||||
|
.ui-icon-flag { background-position: -16px -112px; }
|
||||||
|
.ui-icon-calendar { background-position: -32px -112px; }
|
||||||
|
.ui-icon-cart { background-position: -48px -112px; }
|
||||||
|
.ui-icon-pencil { background-position: -64px -112px; }
|
||||||
|
.ui-icon-clock { background-position: -80px -112px; }
|
||||||
|
.ui-icon-disk { background-position: -96px -112px; }
|
||||||
|
.ui-icon-calculator { background-position: -112px -112px; }
|
||||||
|
.ui-icon-zoomin { background-position: -128px -112px; }
|
||||||
|
.ui-icon-zoomout { background-position: -144px -112px; }
|
||||||
|
.ui-icon-search { background-position: -160px -112px; }
|
||||||
|
.ui-icon-wrench { background-position: -176px -112px; }
|
||||||
|
.ui-icon-gear { background-position: -192px -112px; }
|
||||||
|
.ui-icon-heart { background-position: -208px -112px; }
|
||||||
|
.ui-icon-star { background-position: -224px -112px; }
|
||||||
|
.ui-icon-link { background-position: -240px -112px; }
|
||||||
|
.ui-icon-cancel { background-position: 0 -128px; }
|
||||||
|
.ui-icon-plus { background-position: -16px -128px; }
|
||||||
|
.ui-icon-plusthick { background-position: -32px -128px; }
|
||||||
|
.ui-icon-minus { background-position: -48px -128px; }
|
||||||
|
.ui-icon-minusthick { background-position: -64px -128px; }
|
||||||
|
.ui-icon-close { background-position: -80px -128px; }
|
||||||
|
.ui-icon-closethick { background-position: -96px -128px; }
|
||||||
|
.ui-icon-key { background-position: -112px -128px; }
|
||||||
|
.ui-icon-lightbulb { background-position: -128px -128px; }
|
||||||
|
.ui-icon-scissors { background-position: -144px -128px; }
|
||||||
|
.ui-icon-clipboard { background-position: -160px -128px; }
|
||||||
|
.ui-icon-copy { background-position: -176px -128px; }
|
||||||
|
.ui-icon-contact { background-position: -192px -128px; }
|
||||||
|
.ui-icon-image { background-position: -208px -128px; }
|
||||||
|
.ui-icon-video { background-position: -224px -128px; }
|
||||||
|
.ui-icon-script { background-position: -240px -128px; }
|
||||||
|
.ui-icon-alert { background-position: 0 -144px; }
|
||||||
|
.ui-icon-info { background-position: -16px -144px; }
|
||||||
|
.ui-icon-notice { background-position: -32px -144px; }
|
||||||
|
.ui-icon-help { background-position: -48px -144px; }
|
||||||
|
.ui-icon-check { background-position: -64px -144px; }
|
||||||
|
.ui-icon-bullet { background-position: -80px -144px; }
|
||||||
|
.ui-icon-radio-off { background-position: -96px -144px; }
|
||||||
|
.ui-icon-radio-on { background-position: -112px -144px; }
|
||||||
|
.ui-icon-pin-w { background-position: -128px -144px; }
|
||||||
|
.ui-icon-pin-s { background-position: -144px -144px; }
|
||||||
|
.ui-icon-play { background-position: 0 -160px; }
|
||||||
|
.ui-icon-pause { background-position: -16px -160px; }
|
||||||
|
.ui-icon-seek-next { background-position: -32px -160px; }
|
||||||
|
.ui-icon-seek-prev { background-position: -48px -160px; }
|
||||||
|
.ui-icon-seek-end { background-position: -64px -160px; }
|
||||||
|
.ui-icon-seek-start { background-position: -80px -160px; }
|
||||||
|
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
||||||
|
.ui-icon-seek-first { background-position: -80px -160px; }
|
||||||
|
.ui-icon-stop { background-position: -96px -160px; }
|
||||||
|
.ui-icon-eject { background-position: -112px -160px; }
|
||||||
|
.ui-icon-volume-off { background-position: -128px -160px; }
|
||||||
|
.ui-icon-volume-on { background-position: -144px -160px; }
|
||||||
|
.ui-icon-power { background-position: 0 -176px; }
|
||||||
|
.ui-icon-signal-diag { background-position: -16px -176px; }
|
||||||
|
.ui-icon-signal { background-position: -32px -176px; }
|
||||||
|
.ui-icon-battery-0 { background-position: -48px -176px; }
|
||||||
|
.ui-icon-battery-1 { background-position: -64px -176px; }
|
||||||
|
.ui-icon-battery-2 { background-position: -80px -176px; }
|
||||||
|
.ui-icon-battery-3 { background-position: -96px -176px; }
|
||||||
|
.ui-icon-circle-plus { background-position: 0 -192px; }
|
||||||
|
.ui-icon-circle-minus { background-position: -16px -192px; }
|
||||||
|
.ui-icon-circle-close { background-position: -32px -192px; }
|
||||||
|
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
||||||
|
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
||||||
|
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
||||||
|
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
||||||
|
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
||||||
|
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
||||||
|
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
||||||
|
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
||||||
|
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
||||||
|
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
||||||
|
.ui-icon-circle-check { background-position: -208px -192px; }
|
||||||
|
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
||||||
|
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
||||||
|
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
||||||
|
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
||||||
|
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
||||||
|
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
||||||
|
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
||||||
|
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
||||||
|
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
||||||
|
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
||||||
|
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
||||||
|
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
||||||
|
|
||||||
|
|
||||||
|
/* Misc visuals
|
||||||
|
----------------------------------*/
|
||||||
|
|
||||||
|
/* Corner radius */
|
||||||
|
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
||||||
|
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
||||||
|
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
||||||
|
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
||||||
|
|
||||||
|
/* Overlays */
|
||||||
|
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
||||||
|
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
|
||||||
|
* jQuery UI Button 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Button#theming
|
||||||
|
*/
|
||||||
|
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
||||||
|
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
||||||
|
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
||||||
|
.ui-button-icons-only { width: 3.4em; }
|
||||||
|
button.ui-button-icons-only { width: 3.7em; }
|
||||||
|
|
||||||
|
/*button text element */
|
||||||
|
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
||||||
|
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
||||||
|
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
||||||
|
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
||||||
|
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
||||||
|
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
||||||
|
/* no icon support for input elements, provide padding by default */
|
||||||
|
input.ui-button { padding: .4em 1em; }
|
||||||
|
|
||||||
|
/*button icon element(s) */
|
||||||
|
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
||||||
|
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
||||||
|
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
||||||
|
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||||
|
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||||
|
|
||||||
|
/*button sets*/
|
||||||
|
.ui-buttonset { margin-right: 7px; }
|
||||||
|
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
|
||||||
|
|
||||||
|
/* workarounds */
|
||||||
|
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
||||||
|
/*
|
||||||
|
* jQuery UI Slider 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Slider#theming
|
||||||
|
*/
|
||||||
|
.ui-slider { position: relative; text-align: left; }
|
||||||
|
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
||||||
|
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
||||||
|
|
||||||
|
.ui-slider-horizontal { height: .8em; }
|
||||||
|
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
||||||
|
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
||||||
|
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
||||||
|
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
||||||
|
|
||||||
|
.ui-slider-vertical { width: .8em; height: 100px; }
|
||||||
|
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
||||||
|
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
||||||
|
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
||||||
|
.ui-slider-vertical .ui-slider-range-max { top: 0; }
|
47
Resources/Web/css/jquery.treeTable.css
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/* jQuery treeTable stylesheet
|
||||||
|
*
|
||||||
|
* This file contains styles that are used to display the tree table. Each tree
|
||||||
|
* table is assigned the +treeTable+ class.
|
||||||
|
* ========================================================================= */
|
||||||
|
|
||||||
|
/* jquery.treeTable.collapsible
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
.treeTable tr td .expander {
|
||||||
|
background-position: left center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
zoom: 1; /* IE7 Hack */
|
||||||
|
}
|
||||||
|
|
||||||
|
.treeTable tr.collapsed td .expander {
|
||||||
|
background-image: url(../images/toggle-expand-dark.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.treeTable tr.expanded td .expander {
|
||||||
|
background-image: url(../images/toggle-collapse-dark.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* jquery.treeTable.sortable
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
.treeTable tr.selected, .treeTable tr.accept {
|
||||||
|
background-color: #3875d7;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.treeTable tr.collapsed.selected td .expander, .treeTable tr.collapsed.accept td .expander {
|
||||||
|
background-image: url(../images/toggle-expand-light.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.treeTable tr.expanded.selected td .expander, .treeTable tr.expanded.accept td .expander {
|
||||||
|
background-image: url(../images/toggle-collapse-light.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.treeTable .ui-draggable-dragging {
|
||||||
|
color: #000;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Layout helper taken from jQuery UI. This way I don't have to require the
|
||||||
|
* full jQuery UI CSS to be loaded. */
|
||||||
|
.ui-helper-hidden { display: none; }
|
39
Resources/Web/css/ohm_web.css
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
body {
|
||||||
|
font-size: 62.5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table
|
||||||
|
{
|
||||||
|
border-collapse:collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
table, tr
|
||||||
|
{
|
||||||
|
border: 1px solid #F0F0F0;
|
||||||
|
}
|
||||||
|
|
||||||
|
td
|
||||||
|
{
|
||||||
|
padding-right:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Site
|
||||||
|
-------------------------------- */
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
|
||||||
|
}
|
||||||
|
|
||||||
|
div.header {
|
||||||
|
padding:12px;
|
||||||
|
font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
|
||||||
|
}
|
||||||
|
|
||||||
|
div.main {
|
||||||
|
clear:both;
|
||||||
|
padding:12px;
|
||||||
|
font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
|
||||||
|
/*font-size: 1.3em;*/
|
||||||
|
/*line-height: 1.4em;*/
|
||||||
|
}
|
||||||
|
|
BIN
Resources/Web/images/toggle-collapse-dark.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
Resources/Web/images/toggle-collapse-light.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
Resources/Web/images/toggle-expand-dark.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
Resources/Web/images/toggle-expand-light.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
Resources/Web/images/transparent.png
Normal file
After Width: | Height: | Size: 97 B |
61
Resources/Web/index.html
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
- Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com> -->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Open Hardware Monitor - Web Version</title>
|
||||||
|
<script type='text/javascript' src='js/jquery-1.7.2.min.js'></script>
|
||||||
|
<script type='text/javascript' src='js/jquery.tmpl.min.js'></script>
|
||||||
|
<script type='text/javascript' src='js/knockout-2.1.0.min.js'></script>
|
||||||
|
<script type='text/javascript' src='js/knockout.mapping-latest.min.js'></script>
|
||||||
|
|
||||||
|
<link href="css/jquery.treeTable.css" rel="stylesheet" type="text/css" />
|
||||||
|
<script type='text/javascript' src='js/jquery.treeTable.min.js'></script>
|
||||||
|
|
||||||
|
<link href="css/custom-theme/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="css/ohm_web.css" rel="stylesheet" type="text/css" />
|
||||||
|
<script type='text/javascript' src='js/jquery-ui-1.8.16.custom.min.js'></script>
|
||||||
|
<style>
|
||||||
|
#toolbar {
|
||||||
|
padding: 10px 10px;
|
||||||
|
}
|
||||||
|
#slider {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script type='text/javascript' src='js/ohm_web.js'></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
|
||||||
|
<span id="toolbar" class="ui-widget-header ui-corner-all">
|
||||||
|
<button id="refresh" data-bind="click: update">Refresh</button>
|
||||||
|
<input type="checkbox" id="auto_refresh" data-bind="checked: auto_refresh"/><label for="auto_refresh">Auto Refresh</label>
|
||||||
|
<div id="slider"></div> <span for="auto_refresh" id="lbl"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main">
|
||||||
|
<table data-bind="treeTable: flattened, treeOptions: { initialState: 'expanded', clickableNodeNames: true } ">
|
||||||
|
<thead><td>Sensor</td><td>Min</td><td>Value</td><td>Max</td>
|
||||||
|
<tbody data-bind="foreach: flattened">
|
||||||
|
<tr data-bind="attr: { 'id': 'node-' + id(), 'class': parent.id()?'child-of-node-' + parent.id():'' }">
|
||||||
|
<td data-bind="html: '<img src=' + ImageURL() + ' /> ' + Text()"></td>
|
||||||
|
<td data-bind="text: Min"></td>
|
||||||
|
<td data-bind="text: Value"></td>
|
||||||
|
<td data-bind="text: Max"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
9404
Resources/Web/js/jquery-1.7.2.js
vendored
Normal file
4
Resources/Web/js/jquery-1.7.2.min.js
vendored
Normal file
111
Resources/Web/js/jquery-ui-1.8.16.custom.min.js
vendored
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*!
|
||||||
|
* jQuery UI 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI
|
||||||
|
*/
|
||||||
|
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
|
||||||
|
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
|
||||||
|
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
|
||||||
|
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
|
||||||
|
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
|
||||||
|
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
|
||||||
|
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
|
||||||
|
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
|
||||||
|
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
|
||||||
|
;/*!
|
||||||
|
* jQuery UI Widget 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Widget
|
||||||
|
*/
|
||||||
|
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
|
||||||
|
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
|
||||||
|
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
|
||||||
|
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
|
||||||
|
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
|
||||||
|
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
|
||||||
|
;/*!
|
||||||
|
* jQuery UI Mouse 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Mouse
|
||||||
|
*
|
||||||
|
* Depends:
|
||||||
|
* jquery.ui.widget.js
|
||||||
|
*/
|
||||||
|
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
|
||||||
|
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
|
||||||
|
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
|
||||||
|
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
|
||||||
|
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
|
||||||
|
;/*
|
||||||
|
* jQuery UI Button 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Button
|
||||||
|
*
|
||||||
|
* Depends:
|
||||||
|
* jquery.ui.core.js
|
||||||
|
* jquery.ui.widget.js
|
||||||
|
*/
|
||||||
|
(function(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!==
|
||||||
|
"boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover");
|
||||||
|
this===h&&b(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||b(this).removeClass(f)}).bind("click.button",function(d){if(c.disabled){d.preventDefault();d.stopImmediatePropagation()}});this.element.bind("focus.button",function(){a.buttonElement.addClass("ui-state-focus")}).bind("blur.button",function(){a.buttonElement.removeClass("ui-state-focus")});if(e){this.element.bind("change.button",function(){g||a.refresh()});this.buttonElement.bind("mousedown.button",function(d){if(!c.disabled){g=
|
||||||
|
false;i=d.pageX;j=d.pageY}}).bind("mouseup.button",function(d){if(!c.disabled)if(i!==d.pageX||j!==d.pageY)g=true})}if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).toggleClass("ui-state-active");a.buttonElement.attr("aria-pressed",a.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).addClass("ui-state-active");a.buttonElement.attr("aria-pressed","true");
|
||||||
|
var d=a.element[0];k(d).not(d).map(function(){return b(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;b(this).addClass("ui-state-active");h=this;b(document).one("mouseup",function(){h=null})}).bind("mouseup.button",function(){if(c.disabled)return false;b(this).removeClass("ui-state-active")}).bind("keydown.button",function(d){if(c.disabled)return false;if(d.keyCode==b.ui.keyCode.SPACE||
|
||||||
|
d.keyCode==b.ui.keyCode.ENTER)b(this).addClass("ui-state-active")}).bind("keyup.button",function(){b(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(d){d.keyCode===b.ui.keyCode.SPACE&&b(this).click()})}this._setOption("disabled",c.disabled);this._resetButton()},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type===
|
||||||
|
"radio"){var a=this.element.parents().filter(":last"),c="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(c);if(!this.buttonElement.length){a=a.length?a.siblings():this.element.siblings();this.buttonElement=a.filter(c);if(!this.buttonElement.length)this.buttonElement=a.find(c)}this.element.addClass("ui-helper-hidden-accessible");(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",a)}else this.buttonElement=this.element},
|
||||||
|
widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());this.hasTitle||this.buttonElement.removeAttr("title");
|
||||||
|
b.Widget.prototype.destroy.call(this)},_setOption:function(a,c){b.Widget.prototype._setOption.apply(this,arguments);if(a==="disabled")c?this.element.propAttr("disabled",true):this.element.propAttr("disabled",false);else this._resetButton()},refresh:function(){var a=this.element.is(":disabled");a!==this.options.disabled&&this._setOption("disabled",a);if(this.type==="radio")k(this.element[0]).each(function(){b(this).is(":checked")?b(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
|
||||||
|
"true"):b(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false")},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var a=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),
|
||||||
|
c=b("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+e.primary+"'></span>");e.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+e.secondary+"'></span>");if(!this.options.text){d.push(f?"ui-button-icons-only":
|
||||||
|
"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")===
|
||||||
|
"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");
|
||||||
|
b.Widget.prototype.destroy.call(this)}})})(jQuery);
|
||||||
|
;/*
|
||||||
|
* jQuery UI Slider 1.8.16
|
||||||
|
*
|
||||||
|
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*
|
||||||
|
* http://docs.jquery.com/UI/Slider
|
||||||
|
*
|
||||||
|
* Depends:
|
||||||
|
* jquery.ui.core.js
|
||||||
|
* jquery.ui.mouse.js
|
||||||
|
* jquery.ui.widget.js
|
||||||
|
*/
|
||||||
|
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
|
||||||
|
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
|
||||||
|
this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
|
||||||
|
g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
|
||||||
|
(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
|
||||||
|
m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
|
||||||
|
return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
|
||||||
|
this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
|
||||||
|
this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
|
||||||
|
this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
|
||||||
|
c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
|
||||||
|
a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
|
||||||
|
this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
|
||||||
|
this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
|
||||||
|
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
|
||||||
|
return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
|
||||||
|
this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
|
||||||
|
g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
|
||||||
|
b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);
|
||||||
|
;
|
484
Resources/Web/js/jquery.tmpl.js
Normal file
@ -0,0 +1,484 @@
|
|||||||
|
/*!
|
||||||
|
* jQuery Templates Plugin 1.0.0pre
|
||||||
|
* http://github.com/jquery/jquery-tmpl
|
||||||
|
* Requires jQuery 1.4.2
|
||||||
|
*
|
||||||
|
* Copyright 2011, Software Freedom Conservancy, Inc.
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
* http://jquery.org/license
|
||||||
|
*/
|
||||||
|
(function( jQuery, undefined ){
|
||||||
|
var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
|
||||||
|
newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = [];
|
||||||
|
|
||||||
|
function newTmplItem( options, parentItem, fn, data ) {
|
||||||
|
// Returns a template item data structure for a new rendered instance of a template (a 'template item').
|
||||||
|
// The content field is a hierarchical array of strings and nested items (to be
|
||||||
|
// removed and replaced by nodes field of dom elements, once inserted in DOM).
|
||||||
|
var newItem = {
|
||||||
|
data: data || (data === 0 || data === false) ? data : (parentItem ? parentItem.data : {}),
|
||||||
|
_wrap: parentItem ? parentItem._wrap : null,
|
||||||
|
tmpl: null,
|
||||||
|
parent: parentItem || null,
|
||||||
|
nodes: [],
|
||||||
|
calls: tiCalls,
|
||||||
|
nest: tiNest,
|
||||||
|
wrap: tiWrap,
|
||||||
|
html: tiHtml,
|
||||||
|
update: tiUpdate
|
||||||
|
};
|
||||||
|
if ( options ) {
|
||||||
|
jQuery.extend( newItem, options, { nodes: [], parent: parentItem });
|
||||||
|
}
|
||||||
|
if ( fn ) {
|
||||||
|
// Build the hierarchical content to be used during insertion into DOM
|
||||||
|
newItem.tmpl = fn;
|
||||||
|
newItem._ctnt = newItem._ctnt || newItem.tmpl( jQuery, newItem );
|
||||||
|
newItem.key = ++itemKey;
|
||||||
|
// Keep track of new template item, until it is stored as jQuery Data on DOM element
|
||||||
|
(stack.length ? wrappedItems : newTmplItems)[itemKey] = newItem;
|
||||||
|
}
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core).
|
||||||
|
jQuery.each({
|
||||||
|
appendTo: "append",
|
||||||
|
prependTo: "prepend",
|
||||||
|
insertBefore: "before",
|
||||||
|
insertAfter: "after",
|
||||||
|
replaceAll: "replaceWith"
|
||||||
|
}, function( name, original ) {
|
||||||
|
jQuery.fn[ name ] = function( selector ) {
|
||||||
|
var ret = [], insert = jQuery( selector ), elems, i, l, tmplItems,
|
||||||
|
parent = this.length === 1 && this[0].parentNode;
|
||||||
|
|
||||||
|
appendToTmplItems = newTmplItems || {};
|
||||||
|
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
|
||||||
|
insert[ original ]( this[0] );
|
||||||
|
ret = this;
|
||||||
|
} else {
|
||||||
|
for ( i = 0, l = insert.length; i < l; i++ ) {
|
||||||
|
cloneIndex = i;
|
||||||
|
elems = (i > 0 ? this.clone(true) : this).get();
|
||||||
|
jQuery( insert[i] )[ original ]( elems );
|
||||||
|
ret = ret.concat( elems );
|
||||||
|
}
|
||||||
|
cloneIndex = 0;
|
||||||
|
ret = this.pushStack( ret, name, insert.selector );
|
||||||
|
}
|
||||||
|
tmplItems = appendToTmplItems;
|
||||||
|
appendToTmplItems = null;
|
||||||
|
jQuery.tmpl.complete( tmplItems );
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.fn.extend({
|
||||||
|
// Use first wrapped element as template markup.
|
||||||
|
// Return wrapped set of template items, obtained by rendering template against data.
|
||||||
|
tmpl: function( data, options, parentItem ) {
|
||||||
|
return jQuery.tmpl( this[0], data, options, parentItem );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Find which rendered template item the first wrapped DOM element belongs to
|
||||||
|
tmplItem: function() {
|
||||||
|
return jQuery.tmplItem( this[0] );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template.
|
||||||
|
template: function( name ) {
|
||||||
|
return jQuery.template( name, this[0] );
|
||||||
|
},
|
||||||
|
|
||||||
|
domManip: function( args, table, callback, options ) {
|
||||||
|
if ( args[0] && jQuery.isArray( args[0] )) {
|
||||||
|
var dmArgs = jQuery.makeArray( arguments ), elems = args[0], elemsLength = elems.length, i = 0, tmplItem;
|
||||||
|
while ( i < elemsLength && !(tmplItem = jQuery.data( elems[i++], "tmplItem" ))) {}
|
||||||
|
if ( tmplItem && cloneIndex ) {
|
||||||
|
dmArgs[2] = function( fragClone ) {
|
||||||
|
// Handler called by oldManip when rendered template has been inserted into DOM.
|
||||||
|
jQuery.tmpl.afterManip( this, fragClone, callback );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
oldManip.apply( this, dmArgs );
|
||||||
|
} else {
|
||||||
|
oldManip.apply( this, arguments );
|
||||||
|
}
|
||||||
|
cloneIndex = 0;
|
||||||
|
if ( !appendToTmplItems ) {
|
||||||
|
jQuery.tmpl.complete( newTmplItems );
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.extend({
|
||||||
|
// Return wrapped set of template items, obtained by rendering template against data.
|
||||||
|
tmpl: function( tmpl, data, options, parentItem ) {
|
||||||
|
var ret, topLevel = !parentItem;
|
||||||
|
if ( topLevel ) {
|
||||||
|
// This is a top-level tmpl call (not from a nested template using {{tmpl}})
|
||||||
|
parentItem = topTmplItem;
|
||||||
|
tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl );
|
||||||
|
wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level
|
||||||
|
} else if ( !tmpl ) {
|
||||||
|
// The template item is already associated with DOM - this is a refresh.
|
||||||
|
// Re-evaluate rendered template for the parentItem
|
||||||
|
tmpl = parentItem.tmpl;
|
||||||
|
newTmplItems[parentItem.key] = parentItem;
|
||||||
|
parentItem.nodes = [];
|
||||||
|
if ( parentItem.wrapped ) {
|
||||||
|
updateWrapped( parentItem, parentItem.wrapped );
|
||||||
|
}
|
||||||
|
// Rebuild, without creating a new template item
|
||||||
|
return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) ));
|
||||||
|
}
|
||||||
|
if ( !tmpl ) {
|
||||||
|
return []; // Could throw...
|
||||||
|
}
|
||||||
|
if ( typeof data === "function" ) {
|
||||||
|
data = data.call( parentItem || {} );
|
||||||
|
}
|
||||||
|
if ( options && options.wrapped ) {
|
||||||
|
updateWrapped( options, options.wrapped );
|
||||||
|
}
|
||||||
|
ret = jQuery.isArray( data ) ?
|
||||||
|
jQuery.map( data, function( dataItem ) {
|
||||||
|
return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null;
|
||||||
|
}) :
|
||||||
|
[ newTmplItem( options, parentItem, tmpl, data ) ];
|
||||||
|
return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Return rendered template item for an element.
|
||||||
|
tmplItem: function( elem ) {
|
||||||
|
var tmplItem;
|
||||||
|
if ( elem instanceof jQuery ) {
|
||||||
|
elem = elem[0];
|
||||||
|
}
|
||||||
|
while ( elem && elem.nodeType === 1 && !(tmplItem = jQuery.data( elem, "tmplItem" )) && (elem = elem.parentNode) ) {}
|
||||||
|
return tmplItem || topTmplItem;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set:
|
||||||
|
// Use $.template( name, tmpl ) to cache a named template,
|
||||||
|
// where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc.
|
||||||
|
// Use $( "selector" ).template( name ) to provide access by name to a script block template declaration.
|
||||||
|
|
||||||
|
// Get:
|
||||||
|
// Use $.template( name ) to access a cached template.
|
||||||
|
// Also $( selectorToScriptBlock ).template(), or $.template( null, templateString )
|
||||||
|
// will return the compiled template, without adding a name reference.
|
||||||
|
// If templateString includes at least one HTML tag, $.template( templateString ) is equivalent
|
||||||
|
// to $.template( null, templateString )
|
||||||
|
template: function( name, tmpl ) {
|
||||||
|
if (tmpl) {
|
||||||
|
// Compile template and associate with name
|
||||||
|
if ( typeof tmpl === "string" ) {
|
||||||
|
// This is an HTML string being passed directly in.
|
||||||
|
tmpl = buildTmplFn( tmpl );
|
||||||
|
} else if ( tmpl instanceof jQuery ) {
|
||||||
|
tmpl = tmpl[0] || {};
|
||||||
|
}
|
||||||
|
if ( tmpl.nodeType ) {
|
||||||
|
// If this is a template block, use cached copy, or generate tmpl function and cache.
|
||||||
|
tmpl = jQuery.data( tmpl, "tmpl" ) || jQuery.data( tmpl, "tmpl", buildTmplFn( tmpl.innerHTML ));
|
||||||
|
// Issue: In IE, if the container element is not a script block, the innerHTML will remove quotes from attribute values whenever the value does not include white space.
|
||||||
|
// This means that foo="${x}" will not work if the value of x includes white space: foo="${x}" -> foo=value of x.
|
||||||
|
// To correct this, include space in tag: foo="${ x }" -> foo="value of x"
|
||||||
|
}
|
||||||
|
return typeof name === "string" ? (jQuery.template[name] = tmpl) : tmpl;
|
||||||
|
}
|
||||||
|
// Return named compiled template
|
||||||
|
return name ? (typeof name !== "string" ? jQuery.template( null, name ):
|
||||||
|
(jQuery.template[name] ||
|
||||||
|
// If not in map, and not containing at least on HTML tag, treat as a selector.
|
||||||
|
// (If integrated with core, use quickExpr.exec)
|
||||||
|
jQuery.template( null, htmlExpr.test( name ) ? name : jQuery( name )))) : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
encode: function( text ) {
|
||||||
|
// Do HTML encoding replacing < > & and ' and " by corresponding entities.
|
||||||
|
return ("" + text).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.extend( jQuery.tmpl, {
|
||||||
|
tag: {
|
||||||
|
"tmpl": {
|
||||||
|
_default: { $2: "null" },
|
||||||
|
open: "if($notnull_1){__=__.concat($item.nest($1,$2));}"
|
||||||
|
// tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions)
|
||||||
|
// This means that {{tmpl foo}} treats foo as a template (which IS a function).
|
||||||
|
// Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}.
|
||||||
|
},
|
||||||
|
"wrap": {
|
||||||
|
_default: { $2: "null" },
|
||||||
|
open: "$item.calls(__,$1,$2);__=[];",
|
||||||
|
close: "call=$item.calls();__=call._.concat($item.wrap(call,__));"
|
||||||
|
},
|
||||||
|
"each": {
|
||||||
|
_default: { $2: "$index, $value" },
|
||||||
|
open: "if($notnull_1){$.each($1a,function($2){with(this){",
|
||||||
|
close: "}});}"
|
||||||
|
},
|
||||||
|
"if": {
|
||||||
|
open: "if(($notnull_1) && $1a){",
|
||||||
|
close: "}"
|
||||||
|
},
|
||||||
|
"else": {
|
||||||
|
_default: { $1: "true" },
|
||||||
|
open: "}else if(($notnull_1) && $1a){"
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
// Unecoded expression evaluation.
|
||||||
|
open: "if($notnull_1){__.push($1a);}"
|
||||||
|
},
|
||||||
|
"=": {
|
||||||
|
// Encoded expression evaluation. Abbreviated form is ${}.
|
||||||
|
_default: { $1: "$data" },
|
||||||
|
open: "if($notnull_1){__.push($.encode($1a));}"
|
||||||
|
},
|
||||||
|
"!": {
|
||||||
|
// Comment tag. Skipped by parser
|
||||||
|
open: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events
|
||||||
|
complete: function( items ) {
|
||||||
|
newTmplItems = {};
|
||||||
|
},
|
||||||
|
|
||||||
|
// Call this from code which overrides domManip, or equivalent
|
||||||
|
// Manage cloning/storing template items etc.
|
||||||
|
afterManip: function afterManip( elem, fragClone, callback ) {
|
||||||
|
// Provides cloned fragment ready for fixup prior to and after insertion into DOM
|
||||||
|
var content = fragClone.nodeType === 11 ?
|
||||||
|
jQuery.makeArray(fragClone.childNodes) :
|
||||||
|
fragClone.nodeType === 1 ? [fragClone] : [];
|
||||||
|
|
||||||
|
// Return fragment to original caller (e.g. append) for DOM insertion
|
||||||
|
callback.call( elem, fragClone );
|
||||||
|
|
||||||
|
// Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data.
|
||||||
|
storeTmplItems( content );
|
||||||
|
cloneIndex++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//========================== Private helper functions, used by code above ==========================
|
||||||
|
|
||||||
|
function build( tmplItem, nested, content ) {
|
||||||
|
// Convert hierarchical content into flat string array
|
||||||
|
// and finally return array of fragments ready for DOM insertion
|
||||||
|
var frag, ret = content ? jQuery.map( content, function( item ) {
|
||||||
|
return (typeof item === "string") ?
|
||||||
|
// Insert template item annotations, to be converted to jQuery.data( "tmplItem" ) when elems are inserted into DOM.
|
||||||
|
(tmplItem.key ? item.replace( /(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + tmplItmAtt + "=\"" + tmplItem.key + "\" $2" ) : item) :
|
||||||
|
// This is a child template item. Build nested template.
|
||||||
|
build( item, tmplItem, item._ctnt );
|
||||||
|
}) :
|
||||||
|
// If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {{html $item.html()}}.
|
||||||
|
tmplItem;
|
||||||
|
if ( nested ) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// top-level template
|
||||||
|
ret = ret.join("");
|
||||||
|
|
||||||
|
// Support templates which have initial or final text nodes, or consist only of text
|
||||||
|
// Also support HTML entities within the HTML markup.
|
||||||
|
ret.replace( /^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/, function( all, before, middle, after) {
|
||||||
|
frag = jQuery( middle ).get();
|
||||||
|
|
||||||
|
storeTmplItems( frag );
|
||||||
|
if ( before ) {
|
||||||
|
frag = unencode( before ).concat(frag);
|
||||||
|
}
|
||||||
|
if ( after ) {
|
||||||
|
frag = frag.concat(unencode( after ));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return frag ? frag : unencode( ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
function unencode( text ) {
|
||||||
|
// Use createElement, since createTextNode will not render HTML entities correctly
|
||||||
|
var el = document.createElement( "div" );
|
||||||
|
el.innerHTML = text;
|
||||||
|
return jQuery.makeArray(el.childNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a reusable function that will serve to render a template against data
|
||||||
|
function buildTmplFn( markup ) {
|
||||||
|
return new Function("jQuery","$item",
|
||||||
|
// Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10).
|
||||||
|
"var $=jQuery,call,__=[],$data=$item.data;" +
|
||||||
|
|
||||||
|
// Introduce the data as local variables using with(){}
|
||||||
|
"with($data){__.push('" +
|
||||||
|
|
||||||
|
// Convert the template into pure JavaScript
|
||||||
|
jQuery.trim(markup)
|
||||||
|
.replace( /([\\'])/g, "\\$1" )
|
||||||
|
.replace( /[\r\t\n]/g, " " )
|
||||||
|
.replace( /\$\{([^\}]*)\}/g, "{{= $1}}" )
|
||||||
|
.replace( /\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
|
||||||
|
function( all, slash, type, fnargs, target, parens, args ) {
|
||||||
|
var tag = jQuery.tmpl.tag[ type ], def, expr, exprAutoFnDetect;
|
||||||
|
if ( !tag ) {
|
||||||
|
throw "Unknown template tag: " + type;
|
||||||
|
}
|
||||||
|
def = tag._default || [];
|
||||||
|
if ( parens && !/\w$/.test(target)) {
|
||||||
|
target += parens;
|
||||||
|
parens = "";
|
||||||
|
}
|
||||||
|
if ( target ) {
|
||||||
|
target = unescape( target );
|
||||||
|
args = args ? ("," + unescape( args ) + ")") : (parens ? ")" : "");
|
||||||
|
// Support for target being things like a.toLowerCase();
|
||||||
|
// In that case don't call with template item as 'this' pointer. Just evaluate...
|
||||||
|
expr = parens ? (target.indexOf(".") > -1 ? target + unescape( parens ) : ("(" + target + ").call($item" + args)) : target;
|
||||||
|
exprAutoFnDetect = parens ? expr : "(typeof(" + target + ")==='function'?(" + target + ").call($item):(" + target + "))";
|
||||||
|
} else {
|
||||||
|
exprAutoFnDetect = expr = def.$1 || "null";
|
||||||
|
}
|
||||||
|
fnargs = unescape( fnargs );
|
||||||
|
return "');" +
|
||||||
|
tag[ slash ? "close" : "open" ]
|
||||||
|
.split( "$notnull_1" ).join( target ? "typeof(" + target + ")!=='undefined' && (" + target + ")!=null" : "true" )
|
||||||
|
.split( "$1a" ).join( exprAutoFnDetect )
|
||||||
|
.split( "$1" ).join( expr )
|
||||||
|
.split( "$2" ).join( fnargs || def.$2 || "" ) +
|
||||||
|
"__.push('";
|
||||||
|
}) +
|
||||||
|
"');}return __;"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function updateWrapped( options, wrapped ) {
|
||||||
|
// Build the wrapped content.
|
||||||
|
options._wrap = build( options, true,
|
||||||
|
// Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string.
|
||||||
|
jQuery.isArray( wrapped ) ? wrapped : [htmlExpr.test( wrapped ) ? wrapped : jQuery( wrapped ).html()]
|
||||||
|
).join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
function unescape( args ) {
|
||||||
|
return args ? args.replace( /\\'/g, "'").replace(/\\\\/g, "\\" ) : null;
|
||||||
|
}
|
||||||
|
function outerHtml( elem ) {
|
||||||
|
var div = document.createElement("div");
|
||||||
|
div.appendChild( elem.cloneNode(true) );
|
||||||
|
return div.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store template items in jQuery.data(), ensuring a unique tmplItem data data structure for each rendered template instance.
|
||||||
|
function storeTmplItems( content ) {
|
||||||
|
var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m;
|
||||||
|
for ( i = 0, l = content.length; i < l; i++ ) {
|
||||||
|
if ( (elem = content[i]).nodeType !== 1 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
elems = elem.getElementsByTagName("*");
|
||||||
|
for ( m = elems.length - 1; m >= 0; m-- ) {
|
||||||
|
processItemKey( elems[m] );
|
||||||
|
}
|
||||||
|
processItemKey( elem );
|
||||||
|
}
|
||||||
|
function processItemKey( el ) {
|
||||||
|
var pntKey, pntNode = el, pntItem, tmplItem, key;
|
||||||
|
// Ensure that each rendered template inserted into the DOM has its own template item,
|
||||||
|
if ( (key = el.getAttribute( tmplItmAtt ))) {
|
||||||
|
while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { }
|
||||||
|
if ( pntKey !== key ) {
|
||||||
|
// The next ancestor with a _tmplitem expando is on a different key than this one.
|
||||||
|
// So this is a top-level element within this template item
|
||||||
|
// Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment.
|
||||||
|
pntNode = pntNode.parentNode ? (pntNode.nodeType === 11 ? 0 : (pntNode.getAttribute( tmplItmAtt ) || 0)) : 0;
|
||||||
|
if ( !(tmplItem = newTmplItems[key]) ) {
|
||||||
|
// The item is for wrapped content, and was copied from the temporary parent wrappedItem.
|
||||||
|
tmplItem = wrappedItems[key];
|
||||||
|
tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode] );
|
||||||
|
tmplItem.key = ++itemKey;
|
||||||
|
newTmplItems[itemKey] = tmplItem;
|
||||||
|
}
|
||||||
|
if ( cloneIndex ) {
|
||||||
|
cloneTmplItem( key );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
el.removeAttribute( tmplItmAtt );
|
||||||
|
} else if ( cloneIndex && (tmplItem = jQuery.data( el, "tmplItem" )) ) {
|
||||||
|
// This was a rendered element, cloned during append or appendTo etc.
|
||||||
|
// TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem.
|
||||||
|
cloneTmplItem( tmplItem.key );
|
||||||
|
newTmplItems[tmplItem.key] = tmplItem;
|
||||||
|
pntNode = jQuery.data( el.parentNode, "tmplItem" );
|
||||||
|
pntNode = pntNode ? pntNode.key : 0;
|
||||||
|
}
|
||||||
|
if ( tmplItem ) {
|
||||||
|
pntItem = tmplItem;
|
||||||
|
// Find the template item of the parent element.
|
||||||
|
// (Using !=, not !==, since pntItem.key is number, and pntNode may be a string)
|
||||||
|
while ( pntItem && pntItem.key != pntNode ) {
|
||||||
|
// Add this element as a top-level node for this rendered template item, as well as for any
|
||||||
|
// ancestor items between this item and the item of its parent element
|
||||||
|
pntItem.nodes.push( el );
|
||||||
|
pntItem = pntItem.parent;
|
||||||
|
}
|
||||||
|
// Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering...
|
||||||
|
delete tmplItem._ctnt;
|
||||||
|
delete tmplItem._wrap;
|
||||||
|
// Store template item as jQuery data on the element
|
||||||
|
jQuery.data( el, "tmplItem", tmplItem );
|
||||||
|
}
|
||||||
|
function cloneTmplItem( key ) {
|
||||||
|
key = key + keySuffix;
|
||||||
|
tmplItem = newClonedItems[key] =
|
||||||
|
(newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---- Helper functions for template item ----
|
||||||
|
|
||||||
|
function tiCalls( content, tmpl, data, options ) {
|
||||||
|
if ( !content ) {
|
||||||
|
return stack.pop();
|
||||||
|
}
|
||||||
|
stack.push({ _: content, tmpl: tmpl, item:this, data: data, options: options });
|
||||||
|
}
|
||||||
|
|
||||||
|
function tiNest( tmpl, data, options ) {
|
||||||
|
// nested template, using {{tmpl}} tag
|
||||||
|
return jQuery.tmpl( jQuery.template( tmpl ), data, options, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
function tiWrap( call, wrapped ) {
|
||||||
|
// nested template, using {{wrap}} tag
|
||||||
|
var options = call.options || {};
|
||||||
|
options.wrapped = wrapped;
|
||||||
|
// Apply the template, which may incorporate wrapped content,
|
||||||
|
return jQuery.tmpl( jQuery.template( call.tmpl ), call.data, options, call.item );
|
||||||
|
}
|
||||||
|
|
||||||
|
function tiHtml( filter, textOnly ) {
|
||||||
|
var wrapped = this._wrap;
|
||||||
|
return jQuery.map(
|
||||||
|
jQuery( jQuery.isArray( wrapped ) ? wrapped.join("") : wrapped ).filter( filter || "*" ),
|
||||||
|
function(e) {
|
||||||
|
return textOnly ?
|
||||||
|
e.innerText || e.textContent :
|
||||||
|
e.outerHTML || outerHtml(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function tiUpdate() {
|
||||||
|
var coll = this.nodes;
|
||||||
|
jQuery.tmpl( null, null, null, this).insertBefore( coll[0] );
|
||||||
|
jQuery( coll ).remove();
|
||||||
|
}
|
||||||
|
})( jQuery );
|
10
Resources/Web/js/jquery.tmpl.min.js
vendored
Normal file
8
Resources/Web/js/jquery.treeTable.min.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* jQuery treeTable Plugin VERSION
|
||||||
|
* http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/
|
||||||
|
*
|
||||||
|
* Copyright 2011, Ludo van den Boom
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
*/
|
||||||
|
(function(a){function j(c){var d=c[0].className.split(" ");for(var e=0;e<d.length;e++)if(d[e].match(b.childPrefix))return a(c).siblings("#"+d[e].substring(b.childPrefix.length));return null}function i(b,c){b.insertAfter(c),e(b).reverse().each(function(){i(a(this),b[0])})}function h(c){if(!c.hasClass("initialized")){c.addClass("initialized");var d=e(c);!c.hasClass("parent")&&d.length>0&&c.addClass("parent");if(c.hasClass("parent")){var g=a(c.children("td")[b.treeColumn]),h=f(g)+b.indent;d.each(function(){a(this).children("td")[b.treeColumn].style.paddingLeft=h+"px"});if(b.expandable){g.prepend('<span style="margin-left: -'+b.indent+"px; padding-left: "+b.indent+'px" class="expander"></span>'),a(g[0].firstChild).click(function(){c.toggleBranch()}),b.clickableNodeNames&&(g[0].style.cursor="pointer",a(g).click(function(a){a.target.className!="expander"&&c.toggleBranch()}));if(b.persist){var i=b.persistCookiePrefix+c.attr("id");a.cookie(i)=="true"&&c.addClass("expanded")}!c.hasClass("expanded")&&!c.hasClass("collapsed")&&c.addClass(b.initialState),c.hasClass("expanded")&&c.expand()}}}}function g(c,d){var h=a(c.children("td")[b.treeColumn]);h[0].style.paddingLeft=f(h)+d+"px",e(c).each(function(){g(a(this),d)})}function f(a){var b=parseInt(a[0].style.paddingLeft,10);return isNaN(b)?c:b}function e(c){return a(c).siblings("tr."+b.childPrefix+c[0].id)}function d(a){var b=[];while(a=j(a))b[b.length]=a[0];return b}var b,c;a.fn.treeTable=function(d){b=a.extend({},a.fn.treeTable.defaults,d);return this.each(function(){a(this).addClass("treeTable").find("tbody tr").each(function(){if(!a(this).hasClass("initialized")){var d=a(this)[0].className.search(b.childPrefix)==-1;d&&isNaN(c)&&(c=parseInt(a(a(this).children("td")[b.treeColumn]).css("padding-left"),10)),!d&&b.expandable&&b.initialState=="collapsed"&&a(this).addClass("ui-helper-hidden"),(!b.expandable||d)&&h(a(this))}})})},a.fn.treeTable.defaults={childPrefix:"child-of-",clickableNodeNames:!1,expandable:!0,indent:19,initialState:"collapsed",onNodeShow:null,treeColumn:0,persist:!1,persistCookiePrefix:"treeTable_"},a.fn.collapse=function(){a(this).addClass("collapsed"),e(a(this)).each(function(){a(this).hasClass("collapsed")||a(this).collapse(),a(this).addClass("ui-helper-hidden")});return this},a.fn.expand=function(){a(this).removeClass("collapsed").addClass("expanded"),e(a(this)).each(function(){h(a(this)),a(this).is(".expanded.parent")&&a(this).expand(),a(this).removeClass("ui-helper-hidden"),a.isFunction(b.onNodeShow)&&b.onNodeShow.call()});return this},a.fn.reveal=function(){a(d(a(this)).reverse()).each(function(){h(a(this)),a(this).expand().show()});return this},a.fn.appendBranchTo=function(c){var e=a(this),f=j(e),h=a.map(d(a(c)),function(a){return a.id});a.inArray(e[0].id,h)==-1&&(!f||c.id!=f[0].id)&&c.id!=e[0].id&&(g(e,d(e).length*b.indent*-1),f&&e.removeClass(b.childPrefix+f[0].id),e.addClass(b.childPrefix+c.id),i(e,c),g(e,d(e).length*b.indent));return this},a.fn.reverse=function(){return this.pushStack(this.get().reverse(),arguments)},a.fn.toggleBranch=function(){a(this).hasClass("collapsed")?a(this).expand():a(this).removeClass("expanded").collapse();if(b.persist){var c=b.persistCookiePrefix+a(this).attr("id");a.cookie(c,a(this).hasClass("expanded")?"true":null)}return this}})(jQuery)
|
3443
Resources/Web/js/knockout-2.1.0.js
vendored
Normal file
86
Resources/Web/js/knockout-2.1.0.min.js
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// Knockout JavaScript library v2.1.0
|
||||||
|
// (c) Steven Sanderson - http://knockoutjs.com/
|
||||||
|
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
|
||||||
|
(function(window,document,navigator,undefined){
|
||||||
|
function m(w){throw w;}var n=void 0,p=!0,s=null,t=!1;function A(w){return function(){return w}};function E(w){function B(b,c,d){d&&c!==a.k.r(b)&&a.k.S(b,c);c!==a.k.r(b)&&a.a.va(b,"change")}var a="undefined"!==typeof w?w:{};a.b=function(b,c){for(var d=b.split("."),f=a,g=0;g<d.length-1;g++)f=f[d[g]];f[d[d.length-1]]=c};a.B=function(a,c,d){a[c]=d};a.version="2.1.0";a.b("version",a.version);a.a=new function(){function b(b,c){if("input"!==a.a.o(b)||!b.type||"click"!=c.toLowerCase())return t;var e=b.type;return"checkbox"==e||"radio"==e}var c=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,d={},f={};d[/Firefox\/2/i.test(navigator.userAgent)?
|
||||||
|
"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];d.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");for(var g in d){var e=d[g];if(e.length)for(var h=0,j=e.length;h<j;h++)f[e[h]]=g}var k={propertychange:p},i=function(){for(var a=3,b=document.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="<\!--[if gt IE "+ ++a+"]><i></i><![endif]--\>",c[0];);return 4<a?a:n}();return{Ca:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],
|
||||||
|
v:function(a,b){for(var c=0,e=a.length;c<e;c++)b(a[c])},j:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var c=0,e=a.length;c<e;c++)if(a[c]===b)return c;return-1},ab:function(a,b,c){for(var e=0,f=a.length;e<f;e++)if(b.call(c,a[e]))return a[e];return s},ba:function(b,c){var e=a.a.j(b,c);0<=e&&b.splice(e,1)},za:function(b){for(var b=b||[],c=[],e=0,f=b.length;e<f;e++)0>a.a.j(c,b[e])&&c.push(b[e]);return c},T:function(a,b){for(var a=a||[],c=[],
|
||||||
|
e=0,f=a.length;e<f;e++)c.push(b(a[e]));return c},aa:function(a,b){for(var a=a||[],c=[],e=0,f=a.length;e<f;e++)b(a[e])&&c.push(a[e]);return c},N:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,e=b.length;c<e;c++)a.push(b[c]);return a},extend:function(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a},ga:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},Ab:function(b){for(var b=a.a.L(b),c=document.createElement("div"),e=0,f=b.length;e<f;e++)a.F(b[e]),
|
||||||
|
c.appendChild(b[e]);return c},X:function(b,c){a.a.ga(b);if(c)for(var e=0,f=c.length;e<f;e++)b.appendChild(c[e])},Na:function(b,c){var e=b.nodeType?[b]:b;if(0<e.length){for(var f=e[0],d=f.parentNode,g=0,h=c.length;g<h;g++)d.insertBefore(c[g],f);g=0;for(h=e.length;g<h;g++)a.removeNode(e[g])}},Pa:function(a,b){0<=navigator.userAgent.indexOf("MSIE 6")?a.setAttribute("selected",b):a.selected=b},w:function(a){return(a||"").replace(c,"")},Ib:function(b,c){for(var e=[],f=(b||"").split(c),g=0,d=f.length;g<
|
||||||
|
d;g++){var h=a.a.w(f[g]);""!==h&&e.push(h)}return e},Hb:function(a,b){a=a||"";return b.length>a.length?t:a.substring(0,b.length)===b},eb:function(a,b){for(var c="return ("+a+")",e=0;e<b;e++)c="with(sc["+e+"]) { "+c+" } ";return new Function("sc",c)},kb:function(a,b){if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a!=s;){if(a==b)return p;a=a.parentNode}return t},fa:function(b){return a.a.kb(b,b.ownerDocument)},o:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},
|
||||||
|
n:function(a,c,e){var f=i&&k[c];if(!f&&"undefined"!=typeof jQuery){if(b(a,c))var g=e,e=function(a,b){var c=this.checked;b&&(this.checked=b.fb!==p);g.call(this,a);this.checked=c};jQuery(a).bind(c,e)}else!f&&"function"==typeof a.addEventListener?a.addEventListener(c,e,t):"undefined"!=typeof a.attachEvent?a.attachEvent("on"+c,function(b){e.call(a,b)}):m(Error("Browser doesn't support addEventListener or attachEvent"))},va:function(a,c){(!a||!a.nodeType)&&m(Error("element must be a DOM node when calling triggerEvent"));
|
||||||
|
if("undefined"!=typeof jQuery){var e=[];b(a,c)&&e.push({fb:a.checked});jQuery(a).trigger(c,e)}else"function"==typeof document.createEvent?"function"==typeof a.dispatchEvent?(e=document.createEvent(f[c]||"HTMLEvents"),e.initEvent(c,p,p,window,0,0,0,0,0,t,t,t,t,0,a),a.dispatchEvent(e)):m(Error("The supplied element doesn't support dispatchEvent")):"undefined"!=typeof a.fireEvent?(b(a,c)&&(a.checked=a.checked!==p),a.fireEvent("on"+c)):m(Error("Browser doesn't support triggering events"))},d:function(b){return a.la(b)?
|
||||||
|
b():b},Ua:function(b,c,e){var f=(b.className||"").split(/\s+/),g=0<=a.a.j(f,c);if(e&&!g)b.className+=(f[0]?" ":"")+c;else if(g&&!e){e="";for(g=0;g<f.length;g++)f[g]!=c&&(e+=f[g]+" ");b.className=a.a.w(e)}},Qa:function(b,c){var e=a.a.d(c);if(e===s||e===n)e="";"innerText"in b?b.innerText=e:b.textContent=e;9<=i&&(b.style.display=b.style.display)},lb:function(a){if(9<=i){var b=a.style.width;a.style.width=0;a.style.width=b}},Eb:function(b,e){for(var b=a.a.d(b),e=a.a.d(e),c=[],f=b;f<=e;f++)c.push(f);return c},
|
||||||
|
L:function(a){for(var b=[],e=0,c=a.length;e<c;e++)b.push(a[e]);return b},tb:6===i,ub:7===i,ja:i,Da:function(b,e){for(var c=a.a.L(b.getElementsByTagName("input")).concat(a.a.L(b.getElementsByTagName("textarea"))),f="string"==typeof e?function(a){return a.name===e}:function(a){return e.test(a.name)},g=[],d=c.length-1;0<=d;d--)f(c[d])&&g.push(c[d]);return g},Bb:function(b){return"string"==typeof b&&(b=a.a.w(b))?window.JSON&&window.JSON.parse?window.JSON.parse(b):(new Function("return "+b))():s},sa:function(b,
|
||||||
|
e,c){("undefined"==typeof JSON||"undefined"==typeof JSON.stringify)&&m(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"));return JSON.stringify(a.a.d(b),e,c)},Cb:function(b,e,c){var c=c||{},f=c.params||{},g=c.includeFields||this.Ca,d=b;if("object"==typeof b&&"form"===a.a.o(b))for(var d=b.action,h=g.length-1;0<=h;h--)for(var k=a.a.Da(b,g[h]),
|
||||||
|
j=k.length-1;0<=j;j--)f[k[j].name]=k[j].value;var e=a.a.d(e),i=document.createElement("form");i.style.display="none";i.action=d;i.method="post";for(var z in e)b=document.createElement("input"),b.name=z,b.value=a.a.sa(a.a.d(e[z])),i.appendChild(b);for(z in f)b=document.createElement("input"),b.name=z,b.value=f[z],i.appendChild(b);document.body.appendChild(i);c.submitter?c.submitter(i):i.submit();setTimeout(function(){i.parentNode.removeChild(i)},0)}}};a.b("utils",a.a);a.b("utils.arrayForEach",a.a.v);
|
||||||
|
a.b("utils.arrayFirst",a.a.ab);a.b("utils.arrayFilter",a.a.aa);a.b("utils.arrayGetDistinctValues",a.a.za);a.b("utils.arrayIndexOf",a.a.j);a.b("utils.arrayMap",a.a.T);a.b("utils.arrayPushAll",a.a.N);a.b("utils.arrayRemoveItem",a.a.ba);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",a.a.Ca);a.b("utils.getFormFields",a.a.Da);a.b("utils.postJson",a.a.Cb);a.b("utils.parseJson",a.a.Bb);a.b("utils.registerEventHandler",a.a.n);a.b("utils.stringifyJson",a.a.sa);a.b("utils.range",a.a.Eb);
|
||||||
|
a.b("utils.toggleDomNodeCssClass",a.a.Ua);a.b("utils.triggerEvent",a.a.va);a.b("utils.unwrapObservable",a.a.d);Function.prototype.bind||(Function.prototype.bind=function(a){var c=this,d=Array.prototype.slice.call(arguments),a=d.shift();return function(){return c.apply(a,d.concat(Array.prototype.slice.call(arguments)))}});a.a.f=new function(){var b=0,c="__ko__"+(new Date).getTime(),d={};return{get:function(b,c){var e=a.a.f.getAll(b,t);return e===n?n:e[c]},set:function(b,c,e){e===n&&a.a.f.getAll(b,
|
||||||
|
t)===n||(a.a.f.getAll(b,p)[c]=e)},getAll:function(a,g){var e=a[c];if(!(e&&"null"!==e)){if(!g)return;e=a[c]="ko"+b++;d[e]={}}return d[e]},clear:function(a){var b=a[c];b&&(delete d[b],a[c]=s)}}};a.b("utils.domData",a.a.f);a.b("utils.domData.clear",a.a.f.clear);a.a.G=new function(){function b(b,c){var f=a.a.f.get(b,d);f===n&&c&&(f=[],a.a.f.set(b,d,f));return f}function c(e){var f=b(e,t);if(f)for(var f=f.slice(0),d=0;d<f.length;d++)f[d](e);a.a.f.clear(e);"function"==typeof jQuery&&"function"==typeof jQuery.cleanData&&
|
||||||
|
jQuery.cleanData([e]);if(g[e.nodeType])for(f=e.firstChild;e=f;)f=e.nextSibling,8===e.nodeType&&c(e)}var d="__ko_domNodeDisposal__"+(new Date).getTime(),f={1:p,8:p,9:p},g={1:p,9:p};return{wa:function(a,c){"function"!=typeof c&&m(Error("Callback must be a function"));b(a,p).push(c)},Ma:function(c,f){var g=b(c,t);g&&(a.a.ba(g,f),0==g.length&&a.a.f.set(c,d,n))},F:function(b){if(f[b.nodeType]&&(c(b),g[b.nodeType])){var d=[];a.a.N(d,b.getElementsByTagName("*"));for(var b=0,j=d.length;b<j;b++)c(d[b])}},
|
||||||
|
removeNode:function(b){a.F(b);b.parentNode&&b.parentNode.removeChild(b)}}};a.F=a.a.G.F;a.removeNode=a.a.G.removeNode;a.b("cleanNode",a.F);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.G);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.G.wa);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.G.Ma);(function(){a.a.pa=function(b){var c;if("undefined"!=typeof jQuery){if((c=jQuery.clean([b]))&&c[0]){for(b=c[0];b.parentNode&&11!==b.parentNode.nodeType;)b=b.parentNode;b.parentNode&&
|
||||||
|
b.parentNode.removeChild(b)}}else{var d=a.a.w(b).toLowerCase();c=document.createElement("div");d=d.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!d.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!d.indexOf("<td")||!d.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];b="ignored<div>"+d[1]+b+d[2]+"</div>";for("function"==typeof window.innerShiv?c.appendChild(window.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.L(c.lastChild.childNodes)}return c};
|
||||||
|
a.a.Y=function(b,c){a.a.ga(b);if(c!==s&&c!==n)if("string"!=typeof c&&(c=c.toString()),"undefined"!=typeof jQuery)jQuery(b).html(c);else for(var d=a.a.pa(c),f=0;f<d.length;f++)b.appendChild(d[f])}})();a.b("utils.parseHtmlFragment",a.a.pa);a.b("utils.setHtml",a.a.Y);a.s=function(){function b(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)}function c(b,g){if(b)if(8==b.nodeType){var e=a.s.Ja(b.nodeValue);e!=s&&g.push({jb:b,yb:e})}else if(1==b.nodeType)for(var e=0,d=b.childNodes,j=d.length;e<
|
||||||
|
j;e++)c(d[e],g)}var d={};return{na:function(a){"function"!=typeof a&&m(Error("You can only pass a function to ko.memoization.memoize()"));var c=b()+b();d[c]=a;return"<\!--[ko_memo:"+c+"]--\>"},Va:function(a,b){var c=d[a];c===n&&m(Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized."));try{return c.apply(s,b||[]),p}finally{delete d[a]}},Wa:function(b,d){var e=[];c(b,e);for(var h=0,j=e.length;h<j;h++){var k=e[h].jb,i=[k];d&&a.a.N(i,d);a.s.Va(e[h].yb,i);k.nodeValue="";k.parentNode&&
|
||||||
|
k.parentNode.removeChild(k)}},Ja:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:s}}}();a.b("memoization",a.s);a.b("memoization.memoize",a.s.na);a.b("memoization.unmemoize",a.s.Va);a.b("memoization.parseMemoText",a.s.Ja);a.b("memoization.unmemoizeDomNodeAndDescendants",a.s.Wa);a.Ba={throttle:function(b,c){b.throttleEvaluation=c;var d=s;return a.h({read:b,write:function(a){clearTimeout(d);d=setTimeout(function(){b(a)},c)}})},notify:function(b,c){b.equalityComparer="always"==c?A(t):a.m.fn.equalityComparer;
|
||||||
|
return b}};a.b("extenders",a.Ba);a.Sa=function(b,c,d){this.target=b;this.ca=c;this.ib=d;a.B(this,"dispose",this.A)};a.Sa.prototype.A=function(){this.sb=p;this.ib()};a.R=function(){this.u={};a.a.extend(this,a.R.fn);a.B(this,"subscribe",this.ta);a.B(this,"extend",this.extend);a.B(this,"getSubscriptionsCount",this.ob)};a.R.fn={ta:function(b,c,d){var d=d||"change",b=c?b.bind(c):b,f=new a.Sa(this,b,function(){a.a.ba(this.u[d],f)}.bind(this));this.u[d]||(this.u[d]=[]);this.u[d].push(f);return f},notifySubscribers:function(b,
|
||||||
|
c){c=c||"change";this.u[c]&&a.a.v(this.u[c].slice(0),function(a){a&&a.sb!==p&&a.ca(b)})},ob:function(){var a=0,c;for(c in this.u)this.u.hasOwnProperty(c)&&(a+=this.u[c].length);return a},extend:function(b){var c=this;if(b)for(var d in b){var f=a.Ba[d];"function"==typeof f&&(c=f(c,b[d]))}return c}};a.Ga=function(a){return"function"==typeof a.ta&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.R);a.b("isSubscribable",a.Ga);a.U=function(){var b=[];return{bb:function(a){b.push({ca:a,Aa:[]})},
|
||||||
|
end:function(){b.pop()},La:function(c){a.Ga(c)||m(Error("Only subscribable things can act as dependencies"));if(0<b.length){var d=b[b.length-1];0<=a.a.j(d.Aa,c)||(d.Aa.push(c),d.ca(c))}}}}();var G={undefined:p,"boolean":p,number:p,string:p};a.m=function(b){function c(){if(0<arguments.length){if(!c.equalityComparer||!c.equalityComparer(d,arguments[0]))c.I(),d=arguments[0],c.H();return this}a.U.La(c);return d}var d=b;a.R.call(c);c.H=function(){c.notifySubscribers(d)};c.I=function(){c.notifySubscribers(d,
|
||||||
|
"beforeChange")};a.a.extend(c,a.m.fn);a.B(c,"valueHasMutated",c.H);a.B(c,"valueWillMutate",c.I);return c};a.m.fn={equalityComparer:function(a,c){return a===s||typeof a in G?a===c:t}};var x=a.m.Db="__ko_proto__";a.m.fn[x]=a.m;a.ia=function(b,c){return b===s||b===n||b[x]===n?t:b[x]===c?p:a.ia(b[x],c)};a.la=function(b){return a.ia(b,a.m)};a.Ha=function(b){return"function"==typeof b&&b[x]===a.m||"function"==typeof b&&b[x]===a.h&&b.pb?p:t};a.b("observable",a.m);a.b("isObservable",a.la);a.b("isWriteableObservable",
|
||||||
|
a.Ha);a.Q=function(b){0==arguments.length&&(b=[]);b!==s&&(b!==n&&!("length"in b))&&m(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));var c=a.m(b);a.a.extend(c,a.Q.fn);return c};a.Q.fn={remove:function(a){for(var c=this(),d=[],f="function"==typeof a?a:function(c){return c===a},g=0;g<c.length;g++){var e=c[g];f(e)&&(0===d.length&&this.I(),d.push(e),c.splice(g,1),g--)}d.length&&this.H();return d},removeAll:function(b){if(b===n){var c=this(),
|
||||||
|
d=c.slice(0);this.I();c.splice(0,c.length);this.H();return d}return!b?[]:this.remove(function(c){return 0<=a.a.j(b,c)})},destroy:function(a){var c=this(),d="function"==typeof a?a:function(c){return c===a};this.I();for(var f=c.length-1;0<=f;f--)d(c[f])&&(c[f]._destroy=p);this.H()},destroyAll:function(b){return b===n?this.destroy(A(p)):!b?[]:this.destroy(function(c){return 0<=a.a.j(b,c)})},indexOf:function(b){var c=this();return a.a.j(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.I(),
|
||||||
|
this()[d]=c,this.H())}};a.a.v("pop push reverse shift sort splice unshift".split(" "),function(b){a.Q.fn[b]=function(){var a=this();this.I();a=a[b].apply(a,arguments);this.H();return a}});a.a.v(["slice"],function(b){a.Q.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b("observableArray",a.Q);a.h=function(b,c,d){function f(){a.a.v(v,function(a){a.A()});v=[]}function g(){var a=h.throttleEvaluation;a&&0<=a?(clearTimeout(x),x=setTimeout(e,a)):e()}function e(){if(!l)if(i&&w())u();else{l=
|
||||||
|
p;try{var b=a.a.T(v,function(a){return a.target});a.U.bb(function(c){var e;0<=(e=a.a.j(b,c))?b[e]=n:v.push(c.ta(g))});for(var e=q.call(c),f=b.length-1;0<=f;f--)b[f]&&v.splice(f,1)[0].A();i=p;h.notifySubscribers(k,"beforeChange");k=e}finally{a.U.end()}h.notifySubscribers(k);l=t}}function h(){if(0<arguments.length)j.apply(h,arguments);else return i||e(),a.U.La(h),k}function j(){"function"===typeof o?o.apply(c,arguments):m(Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."))}
|
||||||
|
var k,i=t,l=t,q=b;q&&"object"==typeof q?(d=q,q=d.read):(d=d||{},q||(q=d.read));"function"!=typeof q&&m(Error("Pass a function that returns the value of the ko.computed"));var o=d.write;c||(c=d.owner);var v=[],u=f,r="object"==typeof d.disposeWhenNodeIsRemoved?d.disposeWhenNodeIsRemoved:s,w=d.disposeWhen||A(t);if(r){u=function(){a.a.G.Ma(r,arguments.callee);f()};a.a.G.wa(r,u);var y=w,w=function(){return!a.a.fa(r)||y()}}var x=s;h.nb=function(){return v.length};h.pb="function"===typeof d.write;h.A=function(){u()};
|
||||||
|
a.R.call(h);a.a.extend(h,a.h.fn);d.deferEvaluation!==p&&e();a.B(h,"dispose",h.A);a.B(h,"getDependenciesCount",h.nb);return h};a.rb=function(b){return a.ia(b,a.h)};w=a.m.Db;a.h[w]=a.m;a.h.fn={};a.h.fn[w]=a.h;a.b("dependentObservable",a.h);a.b("computed",a.h);a.b("isComputed",a.rb);(function(){function b(a,g,e){e=e||new d;a=g(a);if(!("object"==typeof a&&a!==s&&a!==n&&!(a instanceof Date)))return a;var h=a instanceof Array?[]:{};e.save(a,h);c(a,function(c){var d=g(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":h[c]=
|
||||||
|
d;break;case "object":case "undefined":var i=e.get(d);h[c]=i!==n?i:b(d,g,e)}});return h}function c(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);"function"==typeof a.toJSON&&b("toJSON")}else for(c in a)b(c)}function d(){var b=[],c=[];this.save=function(e,d){var j=a.a.j(b,e);0<=j?c[j]=d:(b.push(e),c.push(d))};this.get=function(e){e=a.a.j(b,e);return 0<=e?c[e]:n}}a.Ta=function(c){0==arguments.length&&m(Error("When calling ko.toJS, pass the object you want to convert."));return b(c,function(b){for(var c=
|
||||||
|
0;a.la(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b,c,e){b=a.Ta(b);return a.a.sa(b,c,e)}})();a.b("toJS",a.Ta);a.b("toJSON",a.toJSON);(function(){a.k={r:function(b){switch(a.a.o(b)){case "option":return b.__ko__hasDomDataOptionValue__===p?a.a.f.get(b,a.c.options.oa):b.getAttribute("value");case "select":return 0<=b.selectedIndex?a.k.r(b.options[b.selectedIndex]):n;default:return b.value}},S:function(b,c){switch(a.a.o(b)){case "option":switch(typeof c){case "string":a.a.f.set(b,a.c.options.oa,
|
||||||
|
n);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.f.set(b,a.c.options.oa,c),b.__ko__hasDomDataOptionValue__=p,b.value="number"===typeof c?c:""}break;case "select":for(var d=b.options.length-1;0<=d;d--)if(a.k.r(b.options[d])==c){b.selectedIndex=d;break}break;default:if(c===s||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.k);a.b("selectExtensions.readValue",a.k.r);a.b("selectExtensions.writeValue",a.k.S);a.g=function(){function b(a,b){for(var d=
|
||||||
|
s;a!=d;)d=a,a=a.replace(c,function(a,c){return b[c]});return a}var c=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,f=["true","false"];return{D:[],W:function(c){var e=a.a.w(c);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var c=[],d=s,f,k=0;k<e.length;k++){var i=e.charAt(k);if(d===s)switch(i){case '"':case "'":case "/":d=k,f=i}else if(i==f&&"\\"!==e.charAt(k-1)){i=e.substring(d,k+1);c.push(i);var l="@ko_token_"+(c.length-
|
||||||
|
1)+"@",e=e.substring(0,d)+l+e.substring(k+1),k=k-(i.length-l.length),d=s}}f=d=s;for(var q=0,o=s,k=0;k<e.length;k++){i=e.charAt(k);if(d===s)switch(i){case "{":d=k;o=i;f="}";break;case "(":d=k;o=i;f=")";break;case "[":d=k,o=i,f="]"}i===o?q++:i===f&&(q--,0===q&&(i=e.substring(d,k+1),c.push(i),l="@ko_token_"+(c.length-1)+"@",e=e.substring(0,d)+l+e.substring(k+1),k-=i.length-l.length,d=s))}f=[];e=e.split(",");d=0;for(k=e.length;d<k;d++)q=e[d],o=q.indexOf(":"),0<o&&o<q.length-1?(i=q.substring(o+1),f.push({key:b(q.substring(0,
|
||||||
|
o),c),value:b(i,c)})):f.push({unknown:b(q,c)});return f},ka:function(b){for(var c="string"===typeof b?a.g.W(b):b,h=[],b=[],j,k=0;j=c[k];k++)if(0<h.length&&h.push(","),j.key){var i;a:{i=j.key;var l=a.a.w(i);switch(l.length&&l.charAt(0)){case "'":case '"':break a;default:i="'"+l+"'"}}j=j.value;h.push(i);h.push(":");h.push(j);l=a.a.w(j);if(0<=a.a.j(f,a.a.w(l).toLowerCase())?0:l.match(d)!==s)0<b.length&&b.push(", "),b.push(i+" : function(__ko_value) { "+j+" = __ko_value; }")}else j.unknown&&h.push(j.unknown);
|
||||||
|
c=h.join("");0<b.length&&(c=c+", '_ko_property_writers' : { "+b.join("")+" } ");return c},wb:function(b,c){for(var d=0;d<b.length;d++)if(a.a.w(b[d].key)==c)return p;return t},$:function(b,c,d,f,k){if(!b||!a.Ha(b)){if((b=c()._ko_property_writers)&&b[d])b[d](f)}else(!k||b()!==f)&&b(f)}}}();a.b("jsonExpressionRewriting",a.g);a.b("jsonExpressionRewriting.bindingRewriteValidators",a.g.D);a.b("jsonExpressionRewriting.parseObjectLiteral",a.g.W);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",
|
||||||
|
a.g.ka);(function(){function b(a){return 8==a.nodeType&&(g?a.text:a.nodeValue).match(e)}function c(a){return 8==a.nodeType&&(g?a.text:a.nodeValue).match(h)}function d(a,e){for(var d=a,f=1,g=[];d=d.nextSibling;){if(c(d)&&(f--,0===f))return g;g.push(d);b(d)&&f++}e||m(Error("Cannot find closing comment tag to match: "+a.nodeValue));return s}function f(a,b){var c=d(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:s}var g="<\!--test--\>"===document.createComment("test").text,e=g?/^<\!--\s*ko\s+(.*\:.*)\s*--\>$/:
|
||||||
|
/^\s*ko\s+(.*\:.*)\s*$/,h=g?/^<\!--\s*\/ko\s*--\>$/:/^\s*\/ko\s*$/,j={ul:p,ol:p};a.e={C:{},childNodes:function(a){return b(a)?d(a):a.childNodes},ha:function(c){if(b(c))for(var c=a.e.childNodes(c),e=0,d=c.length;e<d;e++)a.removeNode(c[e]);else a.a.ga(c)},X:function(c,e){if(b(c)){a.e.ha(c);for(var d=c.nextSibling,f=0,g=e.length;f<g;f++)d.parentNode.insertBefore(e[f],d)}else a.a.X(c,e)},Ka:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},
|
||||||
|
Fa:function(a,c,e){b(a)?a.parentNode.insertBefore(c,e.nextSibling):e.nextSibling?a.insertBefore(c,e.nextSibling):a.appendChild(c)},firstChild:function(a){return!b(a)?a.firstChild:!a.nextSibling||c(a.nextSibling)?s:a.nextSibling},nextSibling:function(a){b(a)&&(a=f(a));return a.nextSibling&&c(a.nextSibling)?s:a.nextSibling},Xa:function(a){return(a=b(a))?a[1]:s},Ia:function(e){if(j[a.a.o(e)]){var d=e.firstChild;if(d){do if(1===d.nodeType){var g;g=d.firstChild;var h=s;if(g){do if(h)h.push(g);else if(b(g)){var o=
|
||||||
|
f(g,p);o?g=o:h=[g]}else c(g)&&(h=[g]);while(g=g.nextSibling)}if(g=h){h=d.nextSibling;for(o=0;o<g.length;o++)h?e.insertBefore(g[o],h):e.appendChild(g[o])}}while(d=d.nextSibling)}}}}})();a.b("virtualElements",a.e);a.b("virtualElements.allowedBindings",a.e.C);a.b("virtualElements.emptyNode",a.e.ha);a.b("virtualElements.insertAfter",a.e.Fa);a.b("virtualElements.prepend",a.e.Ka);a.b("virtualElements.setDomNodeChildren",a.e.X);(function(){a.J=function(){this.cb={}};a.a.extend(a.J.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind")!=
|
||||||
|
s;case 8:return a.e.Xa(b)!=s;default:return t}},getBindings:function(a,c){var d=this.getBindingsString(a,c);return d?this.parseBindingsString(d,c):s},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.e.Xa(b);default:return s}},parseBindingsString:function(b,c){try{var d=c.$data,d="object"==typeof d&&d!=s?[d,c]:[c],f=d.length,g=this.cb,e=f+"_"+b,h;if(!(h=g[e])){var j=" { "+a.g.ka(b)+" } ";h=g[e]=a.a.eb(j,f)}return h(d)}catch(k){m(Error("Unable to parse bindings.\nMessage: "+
|
||||||
|
k+";\nBindings value: "+b))}}});a.J.instance=new a.J})();a.b("bindingProvider",a.J);(function(){function b(b,d,e){for(var h=a.e.firstChild(d);d=h;)h=a.e.nextSibling(d),c(b,d,e)}function c(c,g,e){var h=p,j=1===g.nodeType;j&&a.e.Ia(g);if(j&&e||a.J.instance.nodeHasBindings(g))h=d(g,s,c,e).Gb;h&&b(c,g,!j)}function d(b,c,e,d){function j(a){return function(){return l[a]}}function k(){return l}var i=0,l,q;a.h(function(){var o=e&&e instanceof a.z?e:new a.z(a.a.d(e)),v=o.$data;d&&a.Ra(b,o);if(l=("function"==
|
||||||
|
typeof c?c():c)||a.J.instance.getBindings(b,o)){if(0===i){i=1;for(var u in l){var r=a.c[u];r&&8===b.nodeType&&!a.e.C[u]&&m(Error("The binding '"+u+"' cannot be used with virtual elements"));if(r&&"function"==typeof r.init&&(r=(0,r.init)(b,j(u),k,v,o))&&r.controlsDescendantBindings)q!==n&&m(Error("Multiple bindings ("+q+" and "+u+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.")),q=u}i=2}if(2===i)for(u in l)(r=a.c[u])&&"function"==
|
||||||
|
typeof r.update&&(0,r.update)(b,j(u),k,v,o)}},s,{disposeWhenNodeIsRemoved:b});return{Gb:q===n}}a.c={};a.z=function(b,c){c?(a.a.extend(this,c),this.$parentContext=c,this.$parent=c.$data,this.$parents=(c.$parents||[]).slice(0),this.$parents.unshift(this.$parent)):(this.$parents=[],this.$root=b);this.$data=b};a.z.prototype.createChildContext=function(b){return new a.z(b,this)};a.z.prototype.extend=function(b){var c=a.a.extend(new a.z,this);return a.a.extend(c,b)};a.Ra=function(b,c){if(2==arguments.length)a.a.f.set(b,
|
||||||
|
"__ko_bindingContext__",c);else return a.a.f.get(b,"__ko_bindingContext__")};a.ya=function(b,c,e){1===b.nodeType&&a.e.Ia(b);return d(b,c,e,p)};a.Ya=function(a,c){(1===c.nodeType||8===c.nodeType)&&b(a,c,p)};a.xa=function(a,b){b&&(1!==b.nodeType&&8!==b.nodeType)&&m(Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node"));b=b||window.document.body;c(a,b,p)};a.ea=function(b){switch(b.nodeType){case 1:case 8:var c=a.Ra(b);if(c)return c;if(b.parentNode)return a.ea(b.parentNode)}};
|
||||||
|
a.hb=function(b){return(b=a.ea(b))?b.$data:n};a.b("bindingHandlers",a.c);a.b("applyBindings",a.xa);a.b("applyBindingsToDescendants",a.Ya);a.b("applyBindingsToNode",a.ya);a.b("contextFor",a.ea);a.b("dataFor",a.hb)})();a.a.v(["click"],function(b){a.c[b]={init:function(c,d,f,g){return a.c.event.init.call(this,c,function(){var a={};a[b]=d();return a},f,g)}}});a.c.event={init:function(b,c,d,f){var g=c()||{},e;for(e in g)(function(){var g=e;"string"==typeof g&&a.a.n(b,g,function(b){var e,i=c()[g];if(i){var l=
|
||||||
|
d();try{var q=a.a.L(arguments);q.unshift(f);e=i.apply(f,q)}finally{e!==p&&(b.preventDefault?b.preventDefault():b.returnValue=t)}l[g+"Bubble"]===t&&(b.cancelBubble=p,b.stopPropagation&&b.stopPropagation())}})})()}};a.c.submit={init:function(b,c,d,f){"function"!=typeof c()&&m(Error("The value for a submit binding must be a function"));a.a.n(b,"submit",function(a){var e,d=c();try{e=d.call(f,b)}finally{e!==p&&(a.preventDefault?a.preventDefault():a.returnValue=t)}})}};a.c.visible={update:function(b,c){var d=
|
||||||
|
a.a.d(c()),f="none"!=b.style.display;d&&!f?b.style.display="":!d&&f&&(b.style.display="none")}};a.c.enable={update:function(b,c){var d=a.a.d(c());d&&b.disabled?b.removeAttribute("disabled"):!d&&!b.disabled&&(b.disabled=p)}};a.c.disable={update:function(b,c){a.c.enable.update(b,function(){return!a.a.d(c())})}};a.c.value={init:function(b,c,d){function f(){var e=c(),f=a.k.r(b);a.g.$(e,d,"value",f,p)}var g=["change"],e=d().valueUpdate;e&&("string"==typeof e&&(e=[e]),a.a.N(g,e),g=a.a.za(g));if(a.a.ja&&
|
||||||
|
("input"==b.tagName.toLowerCase()&&"text"==b.type&&"off"!=b.autocomplete&&(!b.form||"off"!=b.form.autocomplete))&&-1==a.a.j(g,"propertychange")){var h=t;a.a.n(b,"propertychange",function(){h=p});a.a.n(b,"blur",function(){if(h){h=t;f()}})}a.a.v(g,function(c){var e=f;if(a.a.Hb(c,"after")){e=function(){setTimeout(f,0)};c=c.substring(5)}a.a.n(b,c,e)})},update:function(b,c){var d="select"===a.a.o(b),f=a.a.d(c()),g=a.k.r(b),e=f!=g;0===f&&(0!==g&&"0"!==g)&&(e=p);e&&(g=function(){a.k.S(b,f)},g(),d&&setTimeout(g,
|
||||||
|
0));d&&0<b.length&&B(b,f,t)}};a.c.options={update:function(b,c,d){"select"!==a.a.o(b)&&m(Error("options binding applies only to SELECT elements"));for(var f=0==b.length,g=a.a.T(a.a.aa(b.childNodes,function(b){return b.tagName&&"option"===a.a.o(b)&&b.selected}),function(b){return a.k.r(b)||b.innerText||b.textContent}),e=b.scrollTop,h=a.a.d(c());0<b.length;)a.F(b.options[0]),b.remove(0);if(h){d=d();"number"!=typeof h.length&&(h=[h]);if(d.optionsCaption){var j=document.createElement("option");a.a.Y(j,
|
||||||
|
d.optionsCaption);a.k.S(j,n);b.appendChild(j)}for(var c=0,k=h.length;c<k;c++){var j=document.createElement("option"),i="string"==typeof d.optionsValue?h[c][d.optionsValue]:h[c],i=a.a.d(i);a.k.S(j,i);var l=d.optionsText,i="function"==typeof l?l(h[c]):"string"==typeof l?h[c][l]:i;if(i===s||i===n)i="";a.a.Qa(j,i);b.appendChild(j)}h=b.getElementsByTagName("option");c=j=0;for(k=h.length;c<k;c++)0<=a.a.j(g,a.k.r(h[c]))&&(a.a.Pa(h[c],p),j++);b.scrollTop=e;f&&"value"in d&&B(b,a.a.d(d.value),p);a.a.lb(b)}}};
|
||||||
|
a.c.options.oa="__ko.optionValueDomData__";a.c.selectedOptions={Ea:function(b){for(var c=[],b=b.childNodes,d=0,f=b.length;d<f;d++){var g=b[d],e=a.a.o(g);"option"==e&&g.selected?c.push(a.k.r(g)):"optgroup"==e&&(g=a.c.selectedOptions.Ea(g),Array.prototype.splice.apply(c,[c.length,0].concat(g)))}return c},init:function(b,c,d){a.a.n(b,"change",function(){var b=c(),g=a.c.selectedOptions.Ea(this);a.g.$(b,d,"value",g)})},update:function(b,c){"select"!=a.a.o(b)&&m(Error("values binding applies only to SELECT elements"));
|
||||||
|
var d=a.a.d(c());if(d&&"number"==typeof d.length)for(var f=b.childNodes,g=0,e=f.length;g<e;g++){var h=f[g];"option"===a.a.o(h)&&a.a.Pa(h,0<=a.a.j(d,a.k.r(h)))}}};a.c.text={update:function(b,c){a.a.Qa(b,c())}};a.c.html={init:function(){return{controlsDescendantBindings:p}},update:function(b,c){var d=a.a.d(c());a.a.Y(b,d)}};a.c.css={update:function(b,c){var d=a.a.d(c()||{}),f;for(f in d)if("string"==typeof f){var g=a.a.d(d[f]);a.a.Ua(b,f,g)}}};a.c.style={update:function(b,c){var d=a.a.d(c()||{}),f;
|
||||||
|
for(f in d)if("string"==typeof f){var g=a.a.d(d[f]);b.style[f]=g||""}}};a.c.uniqueName={init:function(b,c){c()&&(b.name="ko_unique_"+ ++a.c.uniqueName.gb,(a.a.tb||a.a.ub)&&b.mergeAttributes(document.createElement("<input name='"+b.name+"'/>"),t))}};a.c.uniqueName.gb=0;a.c.checked={init:function(b,c,d){a.a.n(b,"click",function(){var f;if("checkbox"==b.type)f=b.checked;else if("radio"==b.type&&b.checked)f=b.value;else return;var g=c();"checkbox"==b.type&&a.a.d(g)instanceof Array?(f=a.a.j(a.a.d(g),b.value),
|
||||||
|
b.checked&&0>f?g.push(b.value):!b.checked&&0<=f&&g.splice(f,1)):a.g.$(g,d,"checked",f,p)});"radio"==b.type&&!b.name&&a.c.uniqueName.init(b,A(p))},update:function(b,c){var d=a.a.d(c());"checkbox"==b.type?b.checked=d instanceof Array?0<=a.a.j(d,b.value):d:"radio"==b.type&&(b.checked=b.value==d)}};var F={"class":"className","for":"htmlFor"};a.c.attr={update:function(b,c){var d=a.a.d(c())||{},f;for(f in d)if("string"==typeof f){var g=a.a.d(d[f]),e=g===t||g===s||g===n;e&&b.removeAttribute(f);8>=a.a.ja&&
|
||||||
|
f in F?(f=F[f],e?b.removeAttribute(f):b[f]=g):e||b.setAttribute(f,g.toString())}}};a.c.hasfocus={init:function(b,c,d){function f(b){var e=c();a.g.$(e,d,"hasfocus",b,p)}a.a.n(b,"focus",function(){f(p)});a.a.n(b,"focusin",function(){f(p)});a.a.n(b,"blur",function(){f(t)});a.a.n(b,"focusout",function(){f(t)})},update:function(b,c){var d=a.a.d(c());d?b.focus():b.blur();a.a.va(b,d?"focusin":"focusout")}};a.c["with"]={p:function(b){return function(){var c=b();return{"if":c,data:c,templateEngine:a.q.K}}},
|
||||||
|
init:function(b,c){return a.c.template.init(b,a.c["with"].p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c["with"].p(c),d,f,g)}};a.g.D["with"]=t;a.e.C["with"]=p;a.c["if"]={p:function(b){return function(){return{"if":b(),templateEngine:a.q.K}}},init:function(b,c){return a.c.template.init(b,a.c["if"].p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c["if"].p(c),d,f,g)}};a.g.D["if"]=t;a.e.C["if"]=p;a.c.ifnot={p:function(b){return function(){return{ifnot:b(),templateEngine:a.q.K}}},
|
||||||
|
init:function(b,c){return a.c.template.init(b,a.c.ifnot.p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c.ifnot.p(c),d,f,g)}};a.g.D.ifnot=t;a.e.C.ifnot=p;a.c.foreach={p:function(b){return function(){var c=a.a.d(b());return!c||"number"==typeof c.length?{foreach:c,templateEngine:a.q.K}:{foreach:c.data,includeDestroyed:c.includeDestroyed,afterAdd:c.afterAdd,beforeRemove:c.beforeRemove,afterRender:c.afterRender,templateEngine:a.q.K}}},init:function(b,c){return a.c.template.init(b,a.c.foreach.p(c))},
|
||||||
|
update:function(b,c,d,f,g){return a.c.template.update(b,a.c.foreach.p(c),d,f,g)}};a.g.D.foreach=t;a.e.C.foreach=p;a.t=function(){};a.t.prototype.renderTemplateSource=function(){m(Error("Override renderTemplateSource"))};a.t.prototype.createJavaScriptEvaluatorBlock=function(){m(Error("Override createJavaScriptEvaluatorBlock"))};a.t.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){var c=c||document,d=c.getElementById(b);d||m(Error("Cannot find template with ID "+b));return new a.l.i(d)}if(1==
|
||||||
|
b.nodeType||8==b.nodeType)return new a.l.M(b);m(Error("Unknown template type: "+b))};a.t.prototype.renderTemplate=function(a,c,d,f){return this.renderTemplateSource(this.makeTemplateSource(a,f),c,d)};a.t.prototype.isTemplateRewritten=function(a,c){return this.allowTemplateRewriting===t||!(c&&c!=document)&&this.V&&this.V[a]?p:this.makeTemplateSource(a,c).data("isRewritten")};a.t.prototype.rewriteTemplate=function(a,c,d){var f=this.makeTemplateSource(a,d),c=c(f.text());f.text(c);f.data("isRewritten",
|
||||||
|
p);!(d&&d!=document)&&"string"==typeof a&&(this.V=this.V||{},this.V[a]=p)};a.b("templateEngine",a.t);a.Z=function(){function b(b,c,e){for(var b=a.g.W(b),d=a.g.D,j=0;j<b.length;j++){var k=b[j].key;if(d.hasOwnProperty(k)){var i=d[k];"function"===typeof i?(k=i(b[j].value))&&m(Error(k)):i||m(Error("This template engine does not support the '"+k+"' binding within its templates"))}}b="ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() { return (function() { return { "+a.g.ka(b)+
|
||||||
|
" } })() })";return e.createJavaScriptEvaluatorBlock(b)+c}var c=/(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi,d=/<\!--\s*ko\b\s*([\s\S]*?)\s*--\>/g;return{mb:function(b,c,e){c.isTemplateRewritten(b,e)||c.rewriteTemplate(b,function(b){return a.Z.zb(b,c)},e)},zb:function(a,g){return a.replace(c,function(a,c,d,f,i,l,q){return b(q,c,g)}).replace(d,function(a,c){return b(c,"<\!-- ko --\>",g)})},Za:function(b){return a.s.na(function(c,
|
||||||
|
e){c.nextSibling&&a.ya(c.nextSibling,b,e)})}}}();a.b("templateRewriting",a.Z);a.b("templateRewriting.applyMemoizedBindingsToNextSibling",a.Z.Za);(function(){a.l={};a.l.i=function(a){this.i=a};a.l.i.prototype.text=function(){var b=a.a.o(this.i),b="script"===b?"text":"textarea"===b?"value":"innerHTML";if(0==arguments.length)return this.i[b];var c=arguments[0];"innerHTML"===b?a.a.Y(this.i,c):this.i[b]=c};a.l.i.prototype.data=function(b){if(1===arguments.length)return a.a.f.get(this.i,"templateSourceData_"+
|
||||||
|
b);a.a.f.set(this.i,"templateSourceData_"+b,arguments[1])};a.l.M=function(a){this.i=a};a.l.M.prototype=new a.l.i;a.l.M.prototype.text=function(){if(0==arguments.length){var b=a.a.f.get(this.i,"__ko_anon_template__")||{};b.ua===n&&b.da&&(b.ua=b.da.innerHTML);return b.ua}a.a.f.set(this.i,"__ko_anon_template__",{ua:arguments[0]})};a.l.i.prototype.nodes=function(){if(0==arguments.length)return(a.a.f.get(this.i,"__ko_anon_template__")||{}).da;a.a.f.set(this.i,"__ko_anon_template__",{da:arguments[0]})};
|
||||||
|
a.b("templateSources",a.l);a.b("templateSources.domElement",a.l.i);a.b("templateSources.anonymousTemplate",a.l.M)})();(function(){function b(b,c,d){for(var f,c=a.e.nextSibling(c);b&&(f=b)!==c;)b=a.e.nextSibling(f),(1===f.nodeType||8===f.nodeType)&&d(f)}function c(c,d){if(c.length){var f=c[0],g=c[c.length-1];b(f,g,function(b){a.xa(d,b)});b(f,g,function(b){a.s.Wa(b,[d])})}}function d(a){return a.nodeType?a:0<a.length?a[0]:s}function f(b,f,j,k,i){var i=i||{},l=b&&d(b),l=l&&l.ownerDocument,q=i.templateEngine||
|
||||||
|
g;a.Z.mb(j,q,l);j=q.renderTemplate(j,k,i,l);("number"!=typeof j.length||0<j.length&&"number"!=typeof j[0].nodeType)&&m(Error("Template engine must return an array of DOM nodes"));l=t;switch(f){case "replaceChildren":a.e.X(b,j);l=p;break;case "replaceNode":a.a.Na(b,j);l=p;break;case "ignoreTargetNode":break;default:m(Error("Unknown renderMode: "+f))}l&&(c(j,k),i.afterRender&&i.afterRender(j,k.$data));return j}var g;a.ra=function(b){b!=n&&!(b instanceof a.t)&&m(Error("templateEngine must inherit from ko.templateEngine"));
|
||||||
|
g=b};a.qa=function(b,c,j,k,i){j=j||{};(j.templateEngine||g)==n&&m(Error("Set a template engine before calling renderTemplate"));i=i||"replaceChildren";if(k){var l=d(k);return a.h(function(){var g=c&&c instanceof a.z?c:new a.z(a.a.d(c)),o="function"==typeof b?b(g.$data):b,g=f(k,i,o,g,j);"replaceNode"==i&&(k=g,l=d(k))},s,{disposeWhen:function(){return!l||!a.a.fa(l)},disposeWhenNodeIsRemoved:l&&"replaceNode"==i?l.parentNode:l})}return a.s.na(function(d){a.qa(b,c,j,d,"replaceNode")})};a.Fb=function(b,
|
||||||
|
d,g,k,i){function l(a,b){c(b,o);g.afterRender&&g.afterRender(b,a)}function q(c,d){var h="function"==typeof b?b(c):b;o=i.createChildContext(a.a.d(c));o.$index=d;return f(s,"ignoreTargetNode",h,o,g)}var o;return a.h(function(){var b=a.a.d(d)||[];"undefined"==typeof b.length&&(b=[b]);b=a.a.aa(b,function(b){return g.includeDestroyed||b===n||b===s||!a.a.d(b._destroy)});a.a.Oa(k,b,q,g,l)},s,{disposeWhenNodeIsRemoved:k})};a.c.template={init:function(b,c){var d=a.a.d(c());if("string"!=typeof d&&!d.name&&
|
||||||
|
(1==b.nodeType||8==b.nodeType))d=1==b.nodeType?b.childNodes:a.e.childNodes(b),d=a.a.Ab(d),(new a.l.M(b)).nodes(d);return{controlsDescendantBindings:p}},update:function(b,c,d,f,g){c=a.a.d(c());f=p;"string"==typeof c?d=c:(d=c.name,"if"in c&&(f=f&&a.a.d(c["if"])),"ifnot"in c&&(f=f&&!a.a.d(c.ifnot)));var l=s;"object"===typeof c&&"foreach"in c?l=a.Fb(d||b,f&&c.foreach||[],c,b,g):f?(g="object"==typeof c&&"data"in c?g.createChildContext(a.a.d(c.data)):g,l=a.qa(d||b,g,c,b)):a.e.ha(b);g=l;(c=a.a.f.get(b,"__ko__templateSubscriptionDomDataKey__"))&&
|
||||||
|
"function"==typeof c.A&&c.A();a.a.f.set(b,"__ko__templateSubscriptionDomDataKey__",g)}};a.g.D.template=function(b){b=a.g.W(b);return 1==b.length&&b[0].unknown||a.g.wb(b,"name")?s:"This template engine does not support anonymous templates nested within its templates"};a.e.C.template=p})();a.b("setTemplateEngine",a.ra);a.b("renderTemplate",a.qa);(function(){a.a.O=function(b,c,d){if(d===n)return a.a.O(b,c,1)||a.a.O(b,c,10)||a.a.O(b,c,Number.MAX_VALUE);for(var b=b||[],c=c||[],f=b,g=c,e=[],h=0;h<=g.length;h++)e[h]=
|
||||||
|
[];for(var h=0,j=Math.min(f.length,d);h<=j;h++)e[0][h]=h;h=1;for(j=Math.min(g.length,d);h<=j;h++)e[h][0]=h;for(var j=f.length,k,i=g.length,h=1;h<=j;h++){k=Math.max(1,h-d);for(var l=Math.min(i,h+d);k<=l;k++)e[k][h]=f[h-1]===g[k-1]?e[k-1][h-1]:Math.min(e[k-1][h]===n?Number.MAX_VALUE:e[k-1][h]+1,e[k][h-1]===n?Number.MAX_VALUE:e[k][h-1]+1)}d=b.length;f=c.length;g=[];h=e[f][d];if(h===n)e=s;else{for(;0<d||0<f;){j=e[f][d];i=0<f?e[f-1][d]:h+1;l=0<d?e[f][d-1]:h+1;k=0<f&&0<d?e[f-1][d-1]:h+1;if(i===n||i<j-1)i=
|
||||||
|
h+1;if(l===n||l<j-1)l=h+1;k<j-1&&(k=h+1);i<=l&&i<k?(g.push({status:"added",value:c[f-1]}),f--):(l<i&&l<k?g.push({status:"deleted",value:b[d-1]}):(g.push({status:"retained",value:b[d-1]}),f--),d--)}e=g.reverse()}return e}})();a.b("utils.compareArrays",a.a.O);(function(){function b(a){if(2<a.length){for(var b=a[0],c=a[a.length-1],e=[b];b!==c;){b=b.nextSibling;if(!b)return;e.push(b)}Array.prototype.splice.apply(a,[0,a.length].concat(e))}}function c(c,f,g,e,h){var j=[],c=a.h(function(){var c=f(g,h)||
|
||||||
|
[];0<j.length&&(b(j),a.a.Na(j,c),e&&e(g,c));j.splice(0,j.length);a.a.N(j,c)},s,{disposeWhenNodeIsRemoved:c,disposeWhen:function(){return 0==j.length||!a.a.fa(j[0])}});return{xb:j,h:c}}a.a.Oa=function(d,f,g,e,h){for(var f=f||[],e=e||{},j=a.a.f.get(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult")===n,k=a.a.f.get(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult")||[],i=a.a.T(k,function(a){return a.$a}),l=a.a.O(i,f),f=[],q=0,o=[],v=0,i=[],u=s,r=0,w=l.length;r<w;r++)switch(l[r].status){case "retained":var y=
|
||||||
|
k[q];y.qb(v);v=f.push(y);0<y.P.length&&(u=y.P[y.P.length-1]);q++;break;case "deleted":k[q].h.A();b(k[q].P);a.a.v(k[q].P,function(a){o.push({element:a,index:r,value:l[r].value});u=a});q++;break;case "added":for(var y=l[r].value,x=a.m(v),v=c(d,g,y,h,x),C=v.xb,v=f.push({$a:l[r].value,P:C,h:v.h,qb:x}),z=0,B=C.length;z<B;z++){var D=C[z];i.push({element:D,index:r,value:l[r].value});u==s?a.e.Ka(d,D):a.e.Fa(d,D,u);u=D}h&&h(y,C,x)}a.a.v(o,function(b){a.F(b.element)});g=t;if(!j){if(e.afterAdd)for(r=0;r<i.length;r++)e.afterAdd(i[r].element,
|
||||||
|
i[r].index,i[r].value);if(e.beforeRemove){for(r=0;r<o.length;r++)e.beforeRemove(o[r].element,o[r].index,o[r].value);g=p}}if(!g&&o.length)for(r=0;r<o.length;r++)e=o[r].element,e.parentNode&&e.parentNode.removeChild(e);a.a.f.set(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult",f)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.Oa);a.q=function(){this.allowTemplateRewriting=t};a.q.prototype=new a.t;a.q.prototype.renderTemplateSource=function(b){var c=!(9>a.a.ja)&&b.nodes?b.nodes():s;
|
||||||
|
if(c)return a.a.L(c.cloneNode(p).childNodes);b=b.text();return a.a.pa(b)};a.q.K=new a.q;a.ra(a.q.K);a.b("nativeTemplateEngine",a.q);(function(){a.ma=function(){var a=this.vb=function(){if("undefined"==typeof jQuery||!jQuery.tmpl)return 0;try{if(0<=jQuery.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,f,g){g=g||{};2>a&&m(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));var e=b.data("precompiled");
|
||||||
|
e||(e=b.text()||"",e=jQuery.template(s,"{{ko_with $item.koBindingContext}}"+e+"{{/ko_with}}"),b.data("precompiled",e));b=[f.$data];f=jQuery.extend({koBindingContext:f},g.templateOptions);f=jQuery.tmpl(e,b,f);f.appendTo(document.createElement("div"));jQuery.fragments={};return f};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){document.write("<script type='text/html' id='"+a+"'>"+b+"<\/script>")};0<a&&(jQuery.tmpl.tag.ko_code=
|
||||||
|
{open:"__.push($1 || '');"},jQuery.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.ma.prototype=new a.t;var b=new a.ma;0<b.vb&&a.ra(b);a.b("jqueryTmplTemplateEngine",a.ma)})()}"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?E(module.exports||exports):"function"===typeof define&&define.amd?define(["exports"],E):E(window.ko={});p;
|
||||||
|
})(window,document,navigator);
|
687
Resources/Web/js/knockout.mapping-latest.js
Normal file
@ -0,0 +1,687 @@
|
|||||||
|
// Knockout Mapping plugin v2.1.2
|
||||||
|
// (c) 2012 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/
|
||||||
|
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
|
||||||
|
(function (factory) {
|
||||||
|
// Module systems magic dance.
|
||||||
|
|
||||||
|
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
|
||||||
|
// CommonJS or Node: hard-coded dependency on "knockout"
|
||||||
|
factory(require("knockout"), exports);
|
||||||
|
} else if (typeof define === "function" && define["amd"]) {
|
||||||
|
// AMD anonymous module with hard-coded dependency on "knockout"
|
||||||
|
define(["knockout", "exports"], factory);
|
||||||
|
} else {
|
||||||
|
// <script> tag: use the global `ko` object, attaching a `mapping` property
|
||||||
|
factory(ko, ko.mapping = {});
|
||||||
|
}
|
||||||
|
}(function (ko, exports) {
|
||||||
|
var DEBUG=true;
|
||||||
|
var mappingProperty = "__ko_mapping__";
|
||||||
|
var realKoDependentObservable = ko.dependentObservable;
|
||||||
|
var mappingNesting = 0;
|
||||||
|
var dependentObservables;
|
||||||
|
var visitedObjects;
|
||||||
|
|
||||||
|
var _defaultOptions = {
|
||||||
|
include: ["_destroy"],
|
||||||
|
ignore: [],
|
||||||
|
copy: []
|
||||||
|
};
|
||||||
|
var defaultOptions = _defaultOptions;
|
||||||
|
|
||||||
|
exports.isMapped = function (viewModel) {
|
||||||
|
var unwrapped = ko.utils.unwrapObservable(viewModel);
|
||||||
|
return unwrapped && unwrapped[mappingProperty];
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.fromJS = function (jsObject /*, inputOptions, target*/ ) {
|
||||||
|
if (arguments.length == 0) throw new Error("When calling ko.fromJS, pass the object you want to convert.");
|
||||||
|
|
||||||
|
// When mapping is completed, even with an exception, reset the nesting level
|
||||||
|
window.setTimeout(function () {
|
||||||
|
mappingNesting = 0;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
if (!mappingNesting++) {
|
||||||
|
dependentObservables = [];
|
||||||
|
visitedObjects = new objectLookup();
|
||||||
|
}
|
||||||
|
|
||||||
|
var options;
|
||||||
|
var target;
|
||||||
|
|
||||||
|
if (arguments.length == 2) {
|
||||||
|
if (arguments[1][mappingProperty]) {
|
||||||
|
target = arguments[1];
|
||||||
|
} else {
|
||||||
|
options = arguments[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (arguments.length == 3) {
|
||||||
|
options = arguments[1];
|
||||||
|
target = arguments[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target) {
|
||||||
|
options = mergeOptions(target[mappingProperty], options);
|
||||||
|
} else {
|
||||||
|
options = mergeOptions(options);
|
||||||
|
}
|
||||||
|
options.mappedProperties = options.mappedProperties || {};
|
||||||
|
|
||||||
|
var result = updateViewModel(target, jsObject, options);
|
||||||
|
if (target) {
|
||||||
|
result = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Evaluate any dependent observables that were proxied.
|
||||||
|
// Do this in a timeout to defer execution. Basically, any user code that explicitly looks up the DO will perform the first evaluation. Otherwise,
|
||||||
|
// it will be done by this code.
|
||||||
|
if (!--mappingNesting) {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
while (dependentObservables.length) {
|
||||||
|
var DO = dependentObservables.pop();
|
||||||
|
if (DO) DO();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save any new mapping options in the view model, so that updateFromJS can use them later.
|
||||||
|
result[mappingProperty] = mergeOptions(result[mappingProperty], options);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.fromJSON = function (jsonString /*, options, target*/ ) {
|
||||||
|
var parsed = ko.utils.parseJson(jsonString);
|
||||||
|
arguments[0] = parsed;
|
||||||
|
return exports.fromJS.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.updateFromJS = function (viewModel) {
|
||||||
|
throw new Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.updateFromJSON = function (viewModel) {
|
||||||
|
throw new Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.toJS = function (rootObject, options) {
|
||||||
|
if (arguments.length == 0) throw new Error("When calling ko.mapping.toJS, pass the object you want to convert.");
|
||||||
|
// Merge in the options used in fromJS
|
||||||
|
options = mergeOptions(rootObject[mappingProperty], options);
|
||||||
|
|
||||||
|
// We just unwrap everything at every level in the object graph
|
||||||
|
return visitModel(rootObject, function (x) {
|
||||||
|
return ko.utils.unwrapObservable(x)
|
||||||
|
}, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.toJSON = function (rootObject, options) {
|
||||||
|
var plainJavaScriptObject = exports.toJS(rootObject, options);
|
||||||
|
return ko.utils.stringifyJson(plainJavaScriptObject);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.visitModel = function (rootObject, callback, options) {
|
||||||
|
if (arguments.length == 0) throw new Error("When calling ko.mapping.visitModel, pass the object you want to visit.");
|
||||||
|
// Merge in the options used in fromJS
|
||||||
|
options = mergeOptions(rootObject[mappingProperty], options);
|
||||||
|
|
||||||
|
return visitModel(rootObject, callback, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.defaultOptions = function () {
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
defaultOptions = arguments[0];
|
||||||
|
} else {
|
||||||
|
return defaultOptions;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.resetDefaultOptions = function () {
|
||||||
|
defaultOptions = {
|
||||||
|
include: _defaultOptions.include.slice(0),
|
||||||
|
ignore: _defaultOptions.ignore.slice(0),
|
||||||
|
copy: _defaultOptions.copy.slice(0)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getType = function(x) {
|
||||||
|
if ((x) && (typeof (x) === "object")) {
|
||||||
|
if (x.constructor == (new Date).constructor) return "date";
|
||||||
|
if (x.constructor == (new Array).constructor) return "array";
|
||||||
|
}
|
||||||
|
return typeof x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extendOptionsArray(distArray, sourceArray) {
|
||||||
|
return ko.utils.arrayGetDistinctValues(
|
||||||
|
ko.utils.arrayPushAll(distArray, sourceArray)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function extendOptionsObject(target, options) {
|
||||||
|
var type = exports.getType,
|
||||||
|
name, special = { "include": true, "ignore": true, "copy": true },
|
||||||
|
t, o, i = 1, l = arguments.length;
|
||||||
|
if (type(target) !== "object") {
|
||||||
|
target = {};
|
||||||
|
}
|
||||||
|
for (; i < l; i++) {
|
||||||
|
options = arguments[i];
|
||||||
|
if (type(options) !== "object") {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
for (name in options) {
|
||||||
|
t = target[name]; o = options[name];
|
||||||
|
if (name !== "constructor" && special[name] && type(o) !== "array") {
|
||||||
|
if (type(o) !== "string") {
|
||||||
|
throw new Error("ko.mapping.defaultOptions()." + name + " should be an array or string.");
|
||||||
|
}
|
||||||
|
o = [o];
|
||||||
|
}
|
||||||
|
switch (type(o)) {
|
||||||
|
case "object": // Recurse
|
||||||
|
t = type(t) === "object" ? t : {};
|
||||||
|
target[name] = extendOptionsObject(t, o);
|
||||||
|
break;
|
||||||
|
case "array":
|
||||||
|
t = type(t) === "array" ? t : [];
|
||||||
|
target[name] = extendOptionsArray(t, o);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
target[name] = o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeOptions() {
|
||||||
|
var options = ko.utils.arrayPushAll([{}, defaultOptions], arguments); // Always use empty object as target to avoid changing default options
|
||||||
|
options = extendOptionsObject.apply(this, options);
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When using a 'create' callback, we proxy the dependent observable so that it doesn't immediately evaluate on creation.
|
||||||
|
// The reason is that the dependent observables in the user-specified callback may contain references to properties that have not been mapped yet.
|
||||||
|
function withProxyDependentObservable(dependentObservables, callback) {
|
||||||
|
var localDO = ko.dependentObservable;
|
||||||
|
ko.dependentObservable = function (read, owner, options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
if (read && typeof read == "object") { // mirrors condition in knockout implementation of DO's
|
||||||
|
options = read;
|
||||||
|
}
|
||||||
|
|
||||||
|
var realDeferEvaluation = options.deferEvaluation;
|
||||||
|
|
||||||
|
var isRemoved = false;
|
||||||
|
|
||||||
|
// We wrap the original dependent observable so that we can remove it from the 'dependentObservables' list we need to evaluate after mapping has
|
||||||
|
// completed if the user already evaluated the DO themselves in the meantime.
|
||||||
|
var wrap = function (DO) {
|
||||||
|
var wrapped = realKoDependentObservable({
|
||||||
|
read: function () {
|
||||||
|
if (!isRemoved) {
|
||||||
|
ko.utils.arrayRemoveItem(dependentObservables, DO);
|
||||||
|
isRemoved = true;
|
||||||
|
}
|
||||||
|
return DO.apply(DO, arguments);
|
||||||
|
},
|
||||||
|
write: function (val) {
|
||||||
|
return DO(val);
|
||||||
|
},
|
||||||
|
deferEvaluation: true
|
||||||
|
});
|
||||||
|
if(DEBUG) wrapped._wrapper = true;
|
||||||
|
return wrapped;
|
||||||
|
};
|
||||||
|
|
||||||
|
options.deferEvaluation = true; // will either set for just options, or both read/options.
|
||||||
|
var realDependentObservable = new realKoDependentObservable(read, owner, options);
|
||||||
|
|
||||||
|
if (!realDeferEvaluation) {
|
||||||
|
realDependentObservable = wrap(realDependentObservable);
|
||||||
|
dependentObservables.push(realDependentObservable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return realDependentObservable;
|
||||||
|
}
|
||||||
|
ko.dependentObservable.fn = realKoDependentObservable.fn;
|
||||||
|
ko.computed = ko.dependentObservable;
|
||||||
|
var result = callback();
|
||||||
|
ko.dependentObservable = localDO;
|
||||||
|
ko.computed = ko.dependentObservable;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateViewModel(mappedRootObject, rootObject, options, parentName, parent, parentPropertyName) {
|
||||||
|
var isArray = ko.utils.unwrapObservable(rootObject) instanceof Array;
|
||||||
|
|
||||||
|
// If nested object was already mapped previously, take the options from it
|
||||||
|
if (parentName !== undefined && exports.isMapped(mappedRootObject)) {
|
||||||
|
options = ko.utils.unwrapObservable(mappedRootObject)[mappingProperty];
|
||||||
|
parentName = "";
|
||||||
|
parentPropertyName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
parentName = parentName || "";
|
||||||
|
parentPropertyName = parentPropertyName || "";
|
||||||
|
|
||||||
|
var callbackParams = {
|
||||||
|
data: rootObject,
|
||||||
|
parent: parent
|
||||||
|
};
|
||||||
|
|
||||||
|
var getCallback = function (name) {
|
||||||
|
var callback;
|
||||||
|
if (parentName === "") {
|
||||||
|
callback = options[name];
|
||||||
|
} else if (callback = options[parentName]) {
|
||||||
|
callback = callback[name]
|
||||||
|
}
|
||||||
|
return callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
var hasCreateCallback = function () {
|
||||||
|
return getCallback("create") instanceof Function;
|
||||||
|
};
|
||||||
|
|
||||||
|
var createCallback = function (data) {
|
||||||
|
return withProxyDependentObservable(dependentObservables, function () {
|
||||||
|
return getCallback("create")({
|
||||||
|
data: data || callbackParams.data,
|
||||||
|
parent: callbackParams.parent
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var hasUpdateCallback = function () {
|
||||||
|
return getCallback("update") instanceof Function;
|
||||||
|
};
|
||||||
|
|
||||||
|
var updateCallback = function (obj, data) {
|
||||||
|
var params = {
|
||||||
|
data: data || callbackParams.data,
|
||||||
|
parent: callbackParams.parent,
|
||||||
|
target: ko.utils.unwrapObservable(obj)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ko.isWriteableObservable(obj)) {
|
||||||
|
params.observable = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getCallback("update")(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
var alreadyMapped = visitedObjects.get(rootObject);
|
||||||
|
if (alreadyMapped) {
|
||||||
|
return alreadyMapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isArray) {
|
||||||
|
// For atomic types, do a direct update on the observable
|
||||||
|
if (!canHaveProperties(rootObject)) {
|
||||||
|
switch (exports.getType(rootObject)) {
|
||||||
|
case "function":
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
if (ko.isWriteableObservable(rootObject)) {
|
||||||
|
rootObject(updateCallback(rootObject));
|
||||||
|
mappedRootObject = rootObject;
|
||||||
|
} else {
|
||||||
|
mappedRootObject = updateCallback(rootObject);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mappedRootObject = rootObject;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (ko.isWriteableObservable(mappedRootObject)) {
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
mappedRootObject(updateCallback(mappedRootObject));
|
||||||
|
} else {
|
||||||
|
mappedRootObject(ko.utils.unwrapObservable(rootObject));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (hasCreateCallback()) {
|
||||||
|
mappedRootObject = createCallback();
|
||||||
|
} else {
|
||||||
|
mappedRootObject = ko.observable(ko.utils.unwrapObservable(rootObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
mappedRootObject(updateCallback(mappedRootObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mappedRootObject = ko.utils.unwrapObservable(mappedRootObject);
|
||||||
|
if (!mappedRootObject) {
|
||||||
|
if (hasCreateCallback()) {
|
||||||
|
var result = createCallback();
|
||||||
|
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
result = updateCallback(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
return updateCallback(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
mappedRootObject = updateCallback(mappedRootObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
visitedObjects.save(rootObject, mappedRootObject);
|
||||||
|
|
||||||
|
// For non-atomic types, visit all properties and update recursively
|
||||||
|
visitPropertiesOrArrayEntries(rootObject, function (indexer) {
|
||||||
|
var fullPropertyName = getPropertyName(parentPropertyName, rootObject, indexer);
|
||||||
|
|
||||||
|
if (ko.utils.arrayIndexOf(options.ignore, fullPropertyName) != -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ko.utils.arrayIndexOf(options.copy, fullPropertyName) != -1) {
|
||||||
|
mappedRootObject[indexer] = rootObject[indexer];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case we are adding an already mapped property, fill it with the previously mapped property value to prevent recursion.
|
||||||
|
// If this is a property that was generated by fromJS, we should use the options specified there
|
||||||
|
var prevMappedProperty = visitedObjects.get(rootObject[indexer]);
|
||||||
|
var value = prevMappedProperty || updateViewModel(mappedRootObject[indexer], rootObject[indexer], options, indexer, mappedRootObject, fullPropertyName);
|
||||||
|
|
||||||
|
if (ko.isWriteableObservable(mappedRootObject[indexer])) {
|
||||||
|
mappedRootObject[indexer](ko.utils.unwrapObservable(value));
|
||||||
|
} else {
|
||||||
|
mappedRootObject[indexer] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
options.mappedProperties[fullPropertyName] = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var changes = [];
|
||||||
|
|
||||||
|
var hasKeyCallback = getCallback("key") instanceof Function;
|
||||||
|
var keyCallback = hasKeyCallback ? getCallback("key") : function (x) {
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
if (!ko.isObservable(mappedRootObject)) {
|
||||||
|
// When creating the new observable array, also add a bunch of utility functions that take the 'key' of the array items into account.
|
||||||
|
mappedRootObject = ko.observableArray([]);
|
||||||
|
|
||||||
|
mappedRootObject.mappedRemove = function (valueOrPredicate) {
|
||||||
|
var predicate = typeof valueOrPredicate == "function" ? valueOrPredicate : function (value) {
|
||||||
|
return value === keyCallback(valueOrPredicate);
|
||||||
|
};
|
||||||
|
return mappedRootObject.remove(function (item) {
|
||||||
|
return predicate(keyCallback(item));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject.mappedRemoveAll = function (arrayOfValues) {
|
||||||
|
var arrayOfKeys = filterArrayByKey(arrayOfValues, keyCallback);
|
||||||
|
return mappedRootObject.remove(function (item) {
|
||||||
|
return ko.utils.arrayIndexOf(arrayOfKeys, keyCallback(item)) != -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject.mappedDestroy = function (valueOrPredicate) {
|
||||||
|
var predicate = typeof valueOrPredicate == "function" ? valueOrPredicate : function (value) {
|
||||||
|
return value === keyCallback(valueOrPredicate);
|
||||||
|
};
|
||||||
|
return mappedRootObject.destroy(function (item) {
|
||||||
|
return predicate(keyCallback(item));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject.mappedDestroyAll = function (arrayOfValues) {
|
||||||
|
var arrayOfKeys = filterArrayByKey(arrayOfValues, keyCallback);
|
||||||
|
return mappedRootObject.destroy(function (item) {
|
||||||
|
return ko.utils.arrayIndexOf(arrayOfKeys, keyCallback(item)) != -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject.mappedIndexOf = function (item) {
|
||||||
|
var keys = filterArrayByKey(mappedRootObject(), keyCallback);
|
||||||
|
var key = keyCallback(item);
|
||||||
|
return ko.utils.arrayIndexOf(keys, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject.mappedCreate = function (value) {
|
||||||
|
if (mappedRootObject.mappedIndexOf(value) !== -1) {
|
||||||
|
throw new Error("There already is an object with the key that you specified.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var item = hasCreateCallback() ? createCallback(value) : value;
|
||||||
|
if (hasUpdateCallback()) {
|
||||||
|
var newValue = updateCallback(item, value);
|
||||||
|
if (ko.isWriteableObservable(item)) {
|
||||||
|
item(newValue);
|
||||||
|
} else {
|
||||||
|
item = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mappedRootObject.push(item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentArrayKeys = filterArrayByKey(ko.utils.unwrapObservable(mappedRootObject), keyCallback).sort();
|
||||||
|
var newArrayKeys = filterArrayByKey(rootObject, keyCallback);
|
||||||
|
if (hasKeyCallback) newArrayKeys.sort();
|
||||||
|
var editScript = ko.utils.compareArrays(currentArrayKeys, newArrayKeys);
|
||||||
|
|
||||||
|
var ignoreIndexOf = {};
|
||||||
|
|
||||||
|
var newContents = [];
|
||||||
|
for (var i = 0, j = editScript.length; i < j; i++) {
|
||||||
|
var key = editScript[i];
|
||||||
|
var mappedItem;
|
||||||
|
var fullPropertyName = getPropertyName(parentPropertyName, rootObject, i);
|
||||||
|
switch (key.status) {
|
||||||
|
case "added":
|
||||||
|
var item = getItemByKey(ko.utils.unwrapObservable(rootObject), key.value, keyCallback);
|
||||||
|
mappedItem = updateViewModel(undefined, item, options, parentName, mappedRootObject, fullPropertyName);
|
||||||
|
if(!hasCreateCallback()) {
|
||||||
|
mappedItem = ko.utils.unwrapObservable(mappedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = ignorableIndexOf(ko.utils.unwrapObservable(rootObject), item, ignoreIndexOf);
|
||||||
|
newContents[index] = mappedItem;
|
||||||
|
ignoreIndexOf[index] = true;
|
||||||
|
break;
|
||||||
|
case "retained":
|
||||||
|
var item = getItemByKey(ko.utils.unwrapObservable(rootObject), key.value, keyCallback);
|
||||||
|
mappedItem = getItemByKey(mappedRootObject, key.value, keyCallback);
|
||||||
|
updateViewModel(mappedItem, item, options, parentName, mappedRootObject, fullPropertyName);
|
||||||
|
|
||||||
|
var index = ignorableIndexOf(ko.utils.unwrapObservable(rootObject), item, ignoreIndexOf);
|
||||||
|
newContents[index] = mappedItem;
|
||||||
|
ignoreIndexOf[index] = true;
|
||||||
|
break;
|
||||||
|
case "deleted":
|
||||||
|
mappedItem = getItemByKey(mappedRootObject, key.value, keyCallback);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
changes.push({
|
||||||
|
event: key.status,
|
||||||
|
item: mappedItem
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedRootObject(newContents);
|
||||||
|
|
||||||
|
var arrayChangedCallback = getCallback("arrayChanged");
|
||||||
|
if (arrayChangedCallback instanceof Function) {
|
||||||
|
ko.utils.arrayForEach(changes, function (change) {
|
||||||
|
arrayChangedCallback(change.event, change.item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mappedRootObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ignorableIndexOf(array, item, ignoreIndices) {
|
||||||
|
for (var i = 0, j = array.length; i < j; i++) {
|
||||||
|
if (ignoreIndices[i] === true) continue;
|
||||||
|
if (array[i] === item) return i;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapKey(item, callback) {
|
||||||
|
var mappedItem;
|
||||||
|
if (callback) mappedItem = callback(item);
|
||||||
|
if (exports.getType(mappedItem) === "undefined") mappedItem = item;
|
||||||
|
|
||||||
|
return ko.utils.unwrapObservable(mappedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemByKey(array, key, callback) {
|
||||||
|
var filtered = ko.utils.arrayFilter(ko.utils.unwrapObservable(array), function (item) {
|
||||||
|
return mapKey(item, callback) === key;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (filtered.length == 0) throw new Error("When calling ko.update*, the key '" + key + "' was not found!");
|
||||||
|
if ((filtered.length > 1) && (canHaveProperties(filtered[0]))) throw new Error("When calling ko.update*, the key '" + key + "' was not unique!");
|
||||||
|
|
||||||
|
return filtered[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterArrayByKey(array, callback) {
|
||||||
|
return ko.utils.arrayMap(ko.utils.unwrapObservable(array), function (item) {
|
||||||
|
if (callback) {
|
||||||
|
return mapKey(item, callback);
|
||||||
|
} else {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {
|
||||||
|
if (rootObject instanceof Array) {
|
||||||
|
for (var i = 0; i < rootObject.length; i++)
|
||||||
|
visitorCallback(i);
|
||||||
|
} else {
|
||||||
|
for (var propertyName in rootObject)
|
||||||
|
visitorCallback(propertyName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function canHaveProperties(object) {
|
||||||
|
var type = exports.getType(object);
|
||||||
|
return (type === "object" || type === "array") && (object !== null) && (type !== "undefined");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Based on the parentName, this creates a fully classified name of a property
|
||||||
|
|
||||||
|
function getPropertyName(parentName, parent, indexer) {
|
||||||
|
var propertyName = parentName || "";
|
||||||
|
if (parent instanceof Array) {
|
||||||
|
if (parentName) {
|
||||||
|
propertyName += "[" + indexer + "]";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (parentName) {
|
||||||
|
propertyName += ".";
|
||||||
|
}
|
||||||
|
propertyName += indexer;
|
||||||
|
}
|
||||||
|
return propertyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
function visitModel(rootObject, callback, options, parentName, fullParentName) {
|
||||||
|
// If nested object was already mapped previously, take the options from it
|
||||||
|
if (parentName !== undefined && exports.isMapped(rootObject)) {
|
||||||
|
//options = ko.utils.unwrapObservable(rootObject)[mappingProperty];
|
||||||
|
options = mergeOptions(ko.utils.unwrapObservable(rootObject)[mappingProperty], options);
|
||||||
|
parentName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentName === undefined) { // the first call
|
||||||
|
visitedObjects = new objectLookup();
|
||||||
|
}
|
||||||
|
|
||||||
|
parentName = parentName || "";
|
||||||
|
|
||||||
|
var mappedRootObject;
|
||||||
|
var unwrappedRootObject = ko.utils.unwrapObservable(rootObject);
|
||||||
|
if (!canHaveProperties(unwrappedRootObject)) {
|
||||||
|
return callback(rootObject, fullParentName);
|
||||||
|
} else {
|
||||||
|
// Only do a callback, but ignore the results
|
||||||
|
callback(rootObject, fullParentName);
|
||||||
|
mappedRootObject = unwrappedRootObject instanceof Array ? [] : {};
|
||||||
|
}
|
||||||
|
|
||||||
|
visitedObjects.save(rootObject, mappedRootObject);
|
||||||
|
|
||||||
|
var origFullParentName = fullParentName;
|
||||||
|
visitPropertiesOrArrayEntries(unwrappedRootObject, function (indexer) {
|
||||||
|
if (options.ignore && ko.utils.arrayIndexOf(options.ignore, indexer) != -1) return;
|
||||||
|
|
||||||
|
var propertyValue = unwrappedRootObject[indexer];
|
||||||
|
var fullPropertyName = getPropertyName(parentName, unwrappedRootObject, indexer);
|
||||||
|
|
||||||
|
// If we don't want to explicitly copy the unmapped property...
|
||||||
|
if (ko.utils.arrayIndexOf(options.copy, indexer) === -1) {
|
||||||
|
// ...find out if it's a property we want to explicitly include
|
||||||
|
if (ko.utils.arrayIndexOf(options.include, indexer) === -1) {
|
||||||
|
// Options contains all the properties that were part of the original object.
|
||||||
|
// If a property does not exist, and it is not because it is part of an array (e.g. "myProp[3]"), then it should not be unmapped.
|
||||||
|
if (options.mappedProperties && !options.mappedProperties[fullPropertyName] && !(unwrappedRootObject instanceof Array)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fullParentName = getPropertyName(origFullParentName, unwrappedRootObject, indexer);
|
||||||
|
|
||||||
|
var propertyType = exports.getType(ko.utils.unwrapObservable(propertyValue));
|
||||||
|
switch (propertyType) {
|
||||||
|
case "object":
|
||||||
|
case "array":
|
||||||
|
case "undefined":
|
||||||
|
var previouslyMappedValue = visitedObjects.get(propertyValue);
|
||||||
|
mappedRootObject[indexer] = (exports.getType(previouslyMappedValue) !== "undefined") ? previouslyMappedValue : visitModel(propertyValue, callback, options, fullPropertyName, fullParentName);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mappedRootObject[indexer] = callback(propertyValue, fullParentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return mappedRootObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectLookup() {
|
||||||
|
var keys = [];
|
||||||
|
var values = [];
|
||||||
|
this.save = function (key, value) {
|
||||||
|
var existingIndex = ko.utils.arrayIndexOf(keys, key);
|
||||||
|
if (existingIndex >= 0) values[existingIndex] = value;
|
||||||
|
else {
|
||||||
|
keys.push(key);
|
||||||
|
values.push(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.get = function (key) {
|
||||||
|
var existingIndex = ko.utils.arrayIndexOf(keys, key);
|
||||||
|
return (existingIndex >= 0) ? values[existingIndex] : undefined;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
19
Resources/Web/js/knockout.mapping-latest.min.js
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Knockout Mapping plugin v2.1.2
|
||||||
|
// (c) 2012 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/
|
||||||
|
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
|
||||||
|
(function(e){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?e(require("knockout"),exports):"function"===typeof define&&define.amd?define(["knockout","exports"],e):e(ko,ko.mapping={})})(function(e,f){function J(a,b){var c=f.getType,d,l={include:!0,ignore:!0,copy:!0},h,g,k=1,p=arguments.length;for("object"!==c(a)&&(a={});k<p;k++)for(d in b=arguments[k],"object"!==c(b)&&(b={}),b){h=a[d];g=b[d];if("constructor"!==d&&l[d]&&"array"!==c(g)){if("string"!==c(g))throw Error("ko.mapping.defaultOptions()."+
|
||||||
|
d+" should be an array or string.");g=[g]}switch(c(g)){case "object":h="object"===c(h)?h:{};a[d]=J(h,g);break;case "array":h="array"===c(h)?h:[];a[d]=e.utils.arrayGetDistinctValues(e.utils.arrayPushAll(h,g));break;default:a[d]=g}}return a}function i(){var a=e.utils.arrayPushAll([{},q],arguments);return a=J.apply(this,a)}function O(a,b){var c=e.dependentObservable;e.dependentObservable=function(b,c,d){d=d||{};b&&"object"==typeof b&&(d=b);var f=d.deferEvaluation,p=!1,z=function(b){return w({read:function(){p||
|
||||||
|
(e.utils.arrayRemoveItem(a,b),p=!0);return b.apply(b,arguments)},write:function(a){return b(a)},deferEvaluation:!0})};d.deferEvaluation=!0;b=new w(b,c,d);f||(b=z(b),a.push(b));return b};e.dependentObservable.fn=w.fn;e.computed=e.dependentObservable;var d=b();e.dependentObservable=c;e.computed=e.dependentObservable;return d}function C(a,b,c,d,l,h){var g=e.utils.unwrapObservable(b)instanceof Array;void 0!==d&&f.isMapped(a)&&(c=e.utils.unwrapObservable(a)[r],h=d="");var d=d||"",h=h||"",k=function(a){var b;
|
||||||
|
if(d==="")b=c[a];else if(b=c[d])b=b[a];return b},p=function(){return k("create")instanceof Function},z=function(a){return O(D,function(){return k("create")({data:a||b,parent:l})})},o=function(){return k("update")instanceof Function},m=function(a,c){var d={data:c||b,parent:l,target:e.utils.unwrapObservable(a)};if(e.isWriteableObservable(a))d.observable=a;return k("update")(d)},v=u.get(b);if(v)return v;if(g){var g=[],j=(v=k("key")instanceof Function)?k("key"):function(a){return a};e.isObservable(a)||
|
||||||
|
(a=e.observableArray([]),a.mappedRemove=function(b){var c=typeof b=="function"?b:function(a){return a===j(b)};return a.remove(function(a){return c(j(a))})},a.mappedRemoveAll=function(b){var c=A(b,j);return a.remove(function(a){return e.utils.arrayIndexOf(c,j(a))!=-1})},a.mappedDestroy=function(b){var c=typeof b=="function"?b:function(a){return a===j(b)};return a.destroy(function(a){return c(j(a))})},a.mappedDestroyAll=function(b){var c=A(b,j);return a.destroy(function(a){return e.utils.arrayIndexOf(c,
|
||||||
|
j(a))!=-1})},a.mappedIndexOf=function(b){var c=A(a(),j),b=j(b);return e.utils.arrayIndexOf(c,b)},a.mappedCreate=function(b){if(a.mappedIndexOf(b)!==-1)throw Error("There already is an object with the key that you specified.");var c=p()?z(b):b;if(o()){b=m(c,b);e.isWriteableObservable(c)?c(b):c=b}a.push(c);return c});var n=A(e.utils.unwrapObservable(a),j).sort(),i=A(b,j);v&&i.sort();for(var v=e.utils.compareArrays(n,i),n={},i=[],q=0,y=v.length;q<y;q++){var x=v[q],s,t=E(h,b,q);switch(x.status){case "added":var B=
|
||||||
|
F(e.utils.unwrapObservable(b),x.value,j);s=C(void 0,B,c,d,a,t);p()||(s=e.utils.unwrapObservable(s));t=K(e.utils.unwrapObservable(b),B,n);i[t]=s;n[t]=!0;break;case "retained":B=F(e.utils.unwrapObservable(b),x.value,j);s=F(a,x.value,j);C(s,B,c,d,a,t);t=K(e.utils.unwrapObservable(b),B,n);i[t]=s;n[t]=!0;break;case "deleted":s=F(a,x.value,j)}g.push({event:x.status,item:s})}a(i);var w=k("arrayChanged");w instanceof Function&&e.utils.arrayForEach(g,function(a){w(a.event,a.item)})}else if(G(b)){a=e.utils.unwrapObservable(a);
|
||||||
|
if(!a){if(p())return n=z(),o()&&(n=m(n)),n;if(o())return m(n);a={}}o()&&(a=m(a));u.save(b,a);L(b,function(d){var f=E(h,b,d);if(e.utils.arrayIndexOf(c.ignore,f)==-1)if(e.utils.arrayIndexOf(c.copy,f)!=-1)a[d]=b[d];else{var g=u.get(b[d])||C(a[d],b[d],c,d,a,f);if(e.isWriteableObservable(a[d]))a[d](e.utils.unwrapObservable(g));else a[d]=g;c.mappedProperties[f]=true}})}else switch(f.getType(b)){case "function":o()?e.isWriteableObservable(b)?(b(m(b)),a=b):a=m(b):a=b;break;default:e.isWriteableObservable(a)?
|
||||||
|
o()?a(m(a)):a(e.utils.unwrapObservable(b)):(a=p()?z():e.observable(e.utils.unwrapObservable(b)),o()&&a(m(a)))}return a}function K(a,b,c){for(var d=0,e=a.length;d<e;d++)if(!0!==c[d]&&a[d]===b)return d;return null}function M(a,b){var c;b&&(c=b(a));"undefined"===f.getType(c)&&(c=a);return e.utils.unwrapObservable(c)}function F(a,b,c){a=e.utils.arrayFilter(e.utils.unwrapObservable(a),function(a){return M(a,c)===b});if(0==a.length)throw Error("When calling ko.update*, the key '"+b+"' was not found!");
|
||||||
|
if(1<a.length&&G(a[0]))throw Error("When calling ko.update*, the key '"+b+"' was not unique!");return a[0]}function A(a,b){return e.utils.arrayMap(e.utils.unwrapObservable(a),function(a){return b?M(a,b):a})}function L(a,b){if(a instanceof Array)for(var c=0;c<a.length;c++)b(c);else for(c in a)b(c)}function G(a){var b=f.getType(a);return("object"===b||"array"===b)&&null!==a&&"undefined"!==b}function E(a,b,c){var d=a||"";b instanceof Array?a&&(d+="["+c+"]"):(a&&(d+="."),d+=c);return d}function H(a,b,
|
||||||
|
c,d,l){void 0!==d&&f.isMapped(a)&&(c=i(e.utils.unwrapObservable(a)[r],c),d="");void 0===d&&(u=new N);var d=d||"",h,g=e.utils.unwrapObservable(a);if(!G(g))return b(a,l);b(a,l);h=g instanceof Array?[]:{};u.save(a,h);var k=l;L(g,function(a){if(!(c.ignore&&e.utils.arrayIndexOf(c.ignore,a)!=-1)){var i=g[a],o=E(d,g,a);if(!(e.utils.arrayIndexOf(c.copy,a)===-1&&e.utils.arrayIndexOf(c.include,a)===-1&&c.mappedProperties&&!c.mappedProperties[o]&&!(g instanceof Array))){l=E(k,g,a);switch(f.getType(e.utils.unwrapObservable(i))){case "object":case "array":case "undefined":var m=
|
||||||
|
u.get(i);h[a]=f.getType(m)!=="undefined"?m:H(i,b,c,o,l);break;default:h[a]=b(i,l)}}}});return h}function N(){var a=[],b=[];this.save=function(c,d){var f=e.utils.arrayIndexOf(a,c);0<=f?b[f]=d:(a.push(c),b.push(d))};this.get=function(c){c=e.utils.arrayIndexOf(a,c);return 0<=c?b[c]:void 0}}var r="__ko_mapping__",w=e.dependentObservable,I=0,D,u,y={include:["_destroy"],ignore:[],copy:[]},q=y;f.isMapped=function(a){return(a=e.utils.unwrapObservable(a))&&a[r]};f.fromJS=function(a){if(0==arguments.length)throw Error("When calling ko.fromJS, pass the object you want to convert.");
|
||||||
|
window.setTimeout(function(){I=0},0);I++||(D=[],u=new N);var b,c;2==arguments.length&&(arguments[1][r]?c=arguments[1]:b=arguments[1]);3==arguments.length&&(b=arguments[1],c=arguments[2]);b=c?i(c[r],b):i(b);b.mappedProperties=b.mappedProperties||{};var d=C(c,a,b);c&&(d=c);--I||window.setTimeout(function(){for(;D.length;){var a=D.pop();a&&a()}},0);d[r]=i(d[r],b);return d};f.fromJSON=function(a){var b=e.utils.parseJson(a);arguments[0]=b;return f.fromJS.apply(this,arguments)};f.updateFromJS=function(){throw Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!");
|
||||||
|
};f.updateFromJSON=function(){throw Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!");};f.toJS=function(a,b){if(0==arguments.length)throw Error("When calling ko.mapping.toJS, pass the object you want to convert.");b=i(a[r],b);return H(a,function(a){return e.utils.unwrapObservable(a)},b)};f.toJSON=function(a,b){var c=f.toJS(a,b);return e.utils.stringifyJson(c)};f.visitModel=function(a,b,c){if(0==arguments.length)throw Error("When calling ko.mapping.visitModel, pass the object you want to visit.");
|
||||||
|
c=i(a[r],c);return H(a,b,c)};f.defaultOptions=function(){if(0<arguments.length)q=arguments[0];else return q};f.resetDefaultOptions=function(){q={include:y.include.slice(0),ignore:y.ignore.slice(0),copy:y.copy.slice(0)}};f.getType=function(a){if(a&&"object"===typeof a){if(a.constructor==(new Date).constructor)return"date";if(a.constructor==[].constructor)return"array"}return typeof a}});
|
116
Resources/Web/js/ohm_web.js
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
ko.bindingHandlers.treeTable = {
|
||||||
|
update: function(element, valueAccessor, allBindingsAccessor) {
|
||||||
|
var dependency = ko.utils.unwrapObservable(valueAccessor()),
|
||||||
|
options = ko.toJS(allBindingsAccessor().treeOptions || {});
|
||||||
|
|
||||||
|
setTimeout(function() { $(element).treeTable(options); }, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var node = function(config, parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var mappingOptions = {
|
||||||
|
Children : {
|
||||||
|
create: function(args) {
|
||||||
|
return new node(args.data, _this);
|
||||||
|
}
|
||||||
|
,
|
||||||
|
key: function(data) {
|
||||||
|
return ko.utils.unwrapObservable(data.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ko.mapping.fromJS(config, mappingOptions, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$.getJSON('data.json', function(data) {
|
||||||
|
viewModel = new node(data, undefined);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
function flattenChildren(children, result) {
|
||||||
|
ko.utils.arrayForEach(children(), function(child) {
|
||||||
|
result.push(child);
|
||||||
|
if (child.Children) {
|
||||||
|
flattenChildren(child.Children, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.flattened = ko.dependentObservable(function() {
|
||||||
|
var result = []; //root node
|
||||||
|
|
||||||
|
if (viewModel.Children) {
|
||||||
|
flattenChildren(viewModel.Children, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
viewModel.update = function() {
|
||||||
|
$.getJSON('data.json', function(data) {
|
||||||
|
ko.mapping.fromJS(data, {}, viewModel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.rate = 3000; //milliseconds
|
||||||
|
viewModel.timer = {};
|
||||||
|
|
||||||
|
viewModel.startAuto = function (){
|
||||||
|
viewModel.timer = setInterval(viewModel.update, viewModel.rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.stopAuto = function (){
|
||||||
|
clearInterval(viewModel.timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.auto_refresh = ko.observable(false);
|
||||||
|
viewModel.toggleAuto = ko.dependentObservable(function() {
|
||||||
|
if (viewModel.auto_refresh())
|
||||||
|
viewModel.startAuto();
|
||||||
|
else
|
||||||
|
viewModel.stopAuto();
|
||||||
|
}, viewModel);
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
ko.applyBindings(viewModel);
|
||||||
|
$("#tree").treeTable({
|
||||||
|
initialState: "expanded",
|
||||||
|
clickableNodeNames: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$( "#refresh" ).button();
|
||||||
|
$( "#auto_refresh" ).button();
|
||||||
|
$( "#slider" ).slider({
|
||||||
|
value:3,
|
||||||
|
min: 1,
|
||||||
|
max: 10,
|
||||||
|
slide: function( event, ui ) {
|
||||||
|
viewModel.rate = ui.value * 1000;
|
||||||
|
if (viewModel.auto_refresh()) {
|
||||||
|
//reset the timer
|
||||||
|
viewModel.stopAuto();
|
||||||
|
viewModel.startAuto();
|
||||||
|
}
|
||||||
|
$( "#lbl" ).text( ui.value + "s");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#lbl" ).text( $( "#slider" ).slider( "value" ) + "s");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
371
Utilities/HttpServer.cs
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
|
using System.IO;
|
||||||
|
using OpenHardwareMonitor.GUI;
|
||||||
|
using OpenHardwareMonitor.Hardware;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
|
||||||
|
namespace OpenHardwareMonitor.Utilities
|
||||||
|
{
|
||||||
|
public class HttpServer
|
||||||
|
{
|
||||||
|
private HttpListener listener;
|
||||||
|
private int listenerPort, nodeCount;
|
||||||
|
private Thread listenerThread;
|
||||||
|
private Node root;
|
||||||
|
|
||||||
|
public HttpServer(Node r, int p)
|
||||||
|
{
|
||||||
|
root = r;
|
||||||
|
listenerPort = p;
|
||||||
|
//JSON node count.
|
||||||
|
nodeCount = 0;
|
||||||
|
listener = new HttpListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean startHTTPListener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (listener.IsListening)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
string prefix = "http://+:" + listenerPort + "/";
|
||||||
|
listener.Prefixes.Clear();
|
||||||
|
listener.Prefixes.Add(prefix);
|
||||||
|
listener.Start();
|
||||||
|
|
||||||
|
if (listenerThread == null)
|
||||||
|
{
|
||||||
|
listenerThread = new Thread(HandleRequests);
|
||||||
|
listenerThread.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean stopHTTPListener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
listenerThread.Abort();
|
||||||
|
listener.Stop();
|
||||||
|
listenerThread = null;
|
||||||
|
}
|
||||||
|
catch (System.Net.HttpListenerException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (System.Threading.ThreadAbortException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (System.NullReferenceException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleRequests()
|
||||||
|
{
|
||||||
|
|
||||||
|
while (listener.IsListening)
|
||||||
|
{
|
||||||
|
var context = listener.BeginGetContext(new AsyncCallback(ListenerCallback), listener);
|
||||||
|
context.AsyncWaitHandle.WaitOne();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ListenerCallback(IAsyncResult result)
|
||||||
|
{
|
||||||
|
HttpListener listener = (HttpListener)result.AsyncState;
|
||||||
|
if (listener == null || !listener.IsListening)
|
||||||
|
return;
|
||||||
|
// Call EndGetContext to complete the asynchronous operation.
|
||||||
|
HttpListenerContext context = listener.EndGetContext(result);
|
||||||
|
HttpListenerRequest request = context.Request;
|
||||||
|
|
||||||
|
var requestedFile = request.RawUrl.Substring(1);
|
||||||
|
if (requestedFile == "data.json")
|
||||||
|
{
|
||||||
|
sendJSON(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestedFile.Contains("images_icon"))
|
||||||
|
{
|
||||||
|
serveResourceImage(context, requestedFile.Replace("images_icon/", ""));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//default file to be served
|
||||||
|
if (string.IsNullOrEmpty(requestedFile))
|
||||||
|
requestedFile = "index.html";
|
||||||
|
|
||||||
|
string[] splits = requestedFile.Split('.');
|
||||||
|
string ext = splits[splits.Length - 1];
|
||||||
|
serveResourceFile(context, "Web." + requestedFile.Replace('/', '.'), ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void serveResourceFile(HttpListenerContext context ,string name, string ext) {
|
||||||
|
|
||||||
|
//hack! resource names do not support the hyphen
|
||||||
|
name = "OpenHardwareMonitor.Resources." + name.Replace("custom-theme", "custom_theme");
|
||||||
|
|
||||||
|
string[] names =
|
||||||
|
Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
|
for (int i = 0; i < names.Length; i++) {
|
||||||
|
if (names[i].Replace('\\', '.') == name) {
|
||||||
|
using (Stream stream = Assembly.GetExecutingAssembly().
|
||||||
|
GetManifestResourceStream(names[i])) {
|
||||||
|
context.Response.ContentType = getcontentType("." + ext);
|
||||||
|
context.Response.ContentLength64 = stream.Length;
|
||||||
|
byte[] buffer = new byte[512 * 1024];
|
||||||
|
int len;
|
||||||
|
while ((len = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
|
{
|
||||||
|
context.Response.OutputStream.Write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
context.Response.OutputStream.Close();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.Response.OutputStream.Close();
|
||||||
|
context.Response.StatusCode = 404;
|
||||||
|
context.Response.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void serveResourceImage(HttpListenerContext context ,string name) {
|
||||||
|
name = "OpenHardwareMonitor.Resources." + name;
|
||||||
|
|
||||||
|
string[] names =
|
||||||
|
Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
|
for (int i = 0; i < names.Length; i++) {
|
||||||
|
if (names[i].Replace('\\', '.') == name) {
|
||||||
|
using (Stream stream = Assembly.GetExecutingAssembly().
|
||||||
|
GetManifestResourceStream(names[i])) {
|
||||||
|
|
||||||
|
Image image = Image.FromStream(stream);
|
||||||
|
context.Response.ContentType = "image/png";
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
image.Save(ms, ImageFormat.Png);
|
||||||
|
ms.WriteTo(context.Response.OutputStream);
|
||||||
|
}
|
||||||
|
context.Response.OutputStream.Close();
|
||||||
|
image.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.Response.OutputStream.Close();
|
||||||
|
context.Response.StatusCode = 404;
|
||||||
|
context.Response.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendJSON(HttpListenerContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
string JSON = "{\"id\": 0, \"Text\": \"Sensor\", \"Children\": [";
|
||||||
|
nodeCount = 1;
|
||||||
|
JSON += generateJSON(root);
|
||||||
|
JSON += "]";
|
||||||
|
JSON += ", \"Min\": \"Min\"";
|
||||||
|
JSON += ", \"Value\": \"Value\"";
|
||||||
|
JSON += ", \"Max\": \"Max\"";
|
||||||
|
JSON += ", \"ImageURL\": \"\"";
|
||||||
|
JSON += "}";
|
||||||
|
|
||||||
|
var responseContent = JSON;
|
||||||
|
byte[] buffer = Encoding.UTF8.GetBytes(responseContent);
|
||||||
|
|
||||||
|
context.Response.ContentLength64 = buffer.Length;
|
||||||
|
context.Response.ContentType = "application/json";
|
||||||
|
|
||||||
|
Stream outputStream = context.Response.OutputStream;
|
||||||
|
outputStream.Write(buffer, 0, buffer.Length);
|
||||||
|
outputStream.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private string generateJSON(Node n)
|
||||||
|
{
|
||||||
|
string JSON = "{\"id\": " + nodeCount + ", \"Text\": \"" + n.Text + "\", \"Children\": [";
|
||||||
|
nodeCount++;
|
||||||
|
|
||||||
|
foreach (Node child in n.Nodes)
|
||||||
|
JSON += generateJSON(child) + ", ";
|
||||||
|
if (JSON.EndsWith(", "))
|
||||||
|
JSON = JSON.Remove(JSON.LastIndexOf(","));
|
||||||
|
JSON += "]";
|
||||||
|
|
||||||
|
if (n is SensorNode)
|
||||||
|
{
|
||||||
|
JSON += ", \"Min\": \"" + ((SensorNode)n).Min + "\"";
|
||||||
|
JSON += ", \"Value\": \"" + ((SensorNode)n).Value + "\"";
|
||||||
|
JSON += ", \"Max\": \"" + ((SensorNode)n).Max + "\"";
|
||||||
|
JSON += ", \"ImageURL\": \"images/transparent.png\"";
|
||||||
|
}
|
||||||
|
else if (n is HardwareNode)
|
||||||
|
{
|
||||||
|
JSON += ", \"Min\": \"\"";
|
||||||
|
JSON += ", \"Value\": \"\"";
|
||||||
|
JSON += ", \"Max\": \"\"";
|
||||||
|
JSON += ", \"ImageURL\": \"images_icon/" + getHardwareImageFile((HardwareNode)n) + "\"";
|
||||||
|
}
|
||||||
|
else if (n is TypeNode)
|
||||||
|
{
|
||||||
|
JSON += ", \"Min\": \"\"";
|
||||||
|
JSON += ", \"Value\": \"\"";
|
||||||
|
JSON += ", \"Max\": \"\"";
|
||||||
|
JSON += ", \"ImageURL\": \"images_icon/" + getTypeImageFile((TypeNode)n) + "\"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JSON += ", \"Min\": \"\"";
|
||||||
|
JSON += ", \"Value\": \"\"";
|
||||||
|
JSON += ", \"Max\": \"\"";
|
||||||
|
JSON += ", \"ImageURL\": \"images_icon/computer.png\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
JSON += "}";
|
||||||
|
return JSON;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void returnFile(HttpListenerContext context, string filePath)
|
||||||
|
{
|
||||||
|
context.Response.ContentType = getcontentType(Path.GetExtension(filePath));
|
||||||
|
const int bufferSize = 1024 * 512; //512KB
|
||||||
|
var buffer = new byte[bufferSize];
|
||||||
|
using (var fs = File.OpenRead(filePath))
|
||||||
|
{
|
||||||
|
|
||||||
|
context.Response.ContentLength64 = fs.Length;
|
||||||
|
int read;
|
||||||
|
while ((read = fs.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
|
context.Response.OutputStream.Write(buffer, 0, read);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.OutputStream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string getcontentType(string extension)
|
||||||
|
{
|
||||||
|
switch (extension)
|
||||||
|
{
|
||||||
|
case ".avi": return "video/x-msvideo";
|
||||||
|
case ".css": return "text/css";
|
||||||
|
case ".doc": return "application/msword";
|
||||||
|
case ".gif": return "image/gif";
|
||||||
|
case ".htm":
|
||||||
|
case ".html": return "text/html";
|
||||||
|
case ".jpg":
|
||||||
|
case ".jpeg": return "image/jpeg";
|
||||||
|
case ".js": return "application/x-javascript";
|
||||||
|
case ".mp3": return "audio/mpeg";
|
||||||
|
case ".png": return "image/png";
|
||||||
|
case ".pdf": return "application/pdf";
|
||||||
|
case ".ppt": return "application/vnd.ms-powerpoint";
|
||||||
|
case ".zip": return "application/zip";
|
||||||
|
case ".txt": return "text/plain";
|
||||||
|
default: return "application/octet-stream";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string getHardwareImageFile(HardwareNode hn)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (hn.Hardware.HardwareType)
|
||||||
|
{
|
||||||
|
case HardwareType.CPU:
|
||||||
|
return "cpu.png";
|
||||||
|
case HardwareType.GpuNvidia:
|
||||||
|
return "nvidia.png";
|
||||||
|
case HardwareType.GpuAti:
|
||||||
|
return "ati.png";
|
||||||
|
case HardwareType.HDD:
|
||||||
|
return "hdd.png";
|
||||||
|
case HardwareType.Heatmaster:
|
||||||
|
return "bigng.png";
|
||||||
|
case HardwareType.Mainboard:
|
||||||
|
return "mainboard.png";
|
||||||
|
case HardwareType.SuperIO:
|
||||||
|
return "chip.png";
|
||||||
|
case HardwareType.TBalancer:
|
||||||
|
return "bigng.png";
|
||||||
|
default:
|
||||||
|
return "cpu.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string getTypeImageFile(TypeNode tn)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (tn.SensorType)
|
||||||
|
{
|
||||||
|
case SensorType.Voltage:
|
||||||
|
return "voltage.png";
|
||||||
|
case SensorType.Clock:
|
||||||
|
return "clock.png";
|
||||||
|
case SensorType.Load:
|
||||||
|
return "load.png";
|
||||||
|
case SensorType.Temperature:
|
||||||
|
return "temperature.png";
|
||||||
|
case SensorType.Fan:
|
||||||
|
return "fan.png";
|
||||||
|
case SensorType.Flow:
|
||||||
|
return "flow.png";
|
||||||
|
case SensorType.Control:
|
||||||
|
return "control.png";
|
||||||
|
case SensorType.Level:
|
||||||
|
return "level.png";
|
||||||
|
case SensorType.Power:
|
||||||
|
return "power.png";
|
||||||
|
default:
|
||||||
|
return "power.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ListenerPort
|
||||||
|
{
|
||||||
|
get { return listenerPort; }
|
||||||
|
set { listenerPort = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
~HttpServer()
|
||||||
|
{
|
||||||
|
stopHTTPListener();
|
||||||
|
listener.Abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Quit()
|
||||||
|
{
|
||||||
|
stopHTTPListener();
|
||||||
|
listener.Abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|