Added the remote web enhancement developed by Prince Samuel.
1.1 --- a/GUI/MainForm.Designer.cs Sun May 27 16:50:01 2012 +0000
1.2 +++ b/GUI/MainForm.Designer.cs Sun May 27 20:15:32 2012 +0000
1.3 @@ -75,6 +75,9 @@
1.4 this.fahrenheitMenuItem = new System.Windows.Forms.MenuItem();
1.5 this.MenuItem4 = new System.Windows.Forms.MenuItem();
1.6 this.hddMenuItem = new System.Windows.Forms.MenuItem();
1.7 + this.webMenuItem = new System.Windows.Forms.MenuItem();
1.8 + this.runWebServerMenuItem = new System.Windows.Forms.MenuItem();
1.9 + this.serverPortMenuItem = new System.Windows.Forms.MenuItem();
1.10 this.helpMenuItem = new System.Windows.Forms.MenuItem();
1.11 this.aboutMenuItem = new System.Windows.Forms.MenuItem();
1.12 this.treeContextMenu = new System.Windows.Forms.ContextMenu();
1.13 @@ -304,7 +307,8 @@
1.14 this.temperatureUnitsMenuItem,
1.15 this.plotLocationMenuItem,
1.16 this.MenuItem4,
1.17 - this.hddMenuItem});
1.18 + this.hddMenuItem,
1.19 + this.webMenuItem});
1.20 this.optionsMenuItem.Text = "Options";
1.21 //
1.22 // startMinMenuItem
1.23 @@ -361,6 +365,20 @@
1.24 //
1.25 this.hddMenuItem.Index = 8;
1.26 this.hddMenuItem.Text = "Read HDD sensors";
1.27 + //
1.28 + // webMenuItem
1.29 + //
1.30 + this.webMenuItem.Index = 9;
1.31 + this.webMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
1.32 + this.runWebServerMenuItem,
1.33 + this.serverPortMenuItem});
1.34 + this.webMenuItem.Text = "Remote Web Server";
1.35 + //
1.36 + // serverPortMenuItem
1.37 + //
1.38 + this.serverPortMenuItem.Index = 1;
1.39 + this.serverPortMenuItem.Text = "Port";
1.40 + this.serverPortMenuItem.Click += new System.EventHandler(this.serverPortMenuItem_Click);
1.41 //
1.42 // helpMenuItem
1.43 //
1.44 @@ -542,6 +560,9 @@
1.45 private System.Windows.Forms.MenuItem plotWindowMenuItem;
1.46 private System.Windows.Forms.MenuItem plotBottomMenuItem;
1.47 private System.Windows.Forms.MenuItem plotRightMenuItem;
1.48 + private System.Windows.Forms.MenuItem webMenuItem;
1.49 + private System.Windows.Forms.MenuItem runWebServerMenuItem;
1.50 + private System.Windows.Forms.MenuItem serverPortMenuItem;
1.51 }
1.52 }
1.53
2.1 --- a/GUI/MainForm.cs Sun May 27 16:50:01 2012 +0000
2.2 +++ b/GUI/MainForm.cs Sun May 27 20:15:32 2012 +0000
2.3 @@ -6,6 +6,7 @@
2.4
2.5 Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
2.6 Copyright (C) 2010 Paul Werelds <paul@werelds.net>
2.7 + Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
2.8
2.9 */
2.10
2.11 @@ -20,6 +21,7 @@
2.12 using Aga.Controls.Tree.NodeControls;
2.13 using OpenHardwareMonitor.Hardware;
2.14 using OpenHardwareMonitor.WMI;
2.15 +using OpenHardwareMonitor.Utilities;
2.16
2.17 namespace OpenHardwareMonitor.GUI {
2.18 public partial class MainForm : Form {
2.19 @@ -51,8 +53,10 @@
2.20 private UserOption readHddSensors;
2.21 private UserOption showGadget;
2.22 private UserRadioGroup plotLocation;
2.23 + private WmiProvider wmiProvider;
2.24
2.25 - private WmiProvider wmiProvider;
2.26 + private UserOption runWebServer;
2.27 + private HttpServer server;
2.28
2.29 private bool selectionDragging = false;
2.30
2.31 @@ -220,6 +224,18 @@
2.32 unitManager.TemperatureUnit == TemperatureUnit.Celsius;
2.33 fahrenheitMenuItem.Checked = !celsiusMenuItem.Checked;
2.34
2.35 + server = new HttpServer(root, this.settings.GetValue("listenerPort", 8085));
2.36 + runWebServer = new UserOption("runWebServerMenuItem", false,
2.37 + runWebServerMenuItem, settings);
2.38 + runWebServer.Changed += delegate(object sender, EventArgs e)
2.39 + {
2.40 + if (runWebServer.Value)
2.41 + runWebServer.Value = server.startHTTPListener();
2.42 + else
2.43 + server.stopHTTPListener();
2.44 + };
2.45 +
2.46 +
2.47 InitializePlotForm();
2.48
2.49 startupMenuItem.Visible = startupManager.IsAvailable;
2.50 @@ -239,6 +255,9 @@
2.51 // Make sure the settings are saved when the user logs off
2.52 Microsoft.Win32.SystemEvents.SessionEnded += delegate {
2.53 SaveConfiguration();
2.54 + if (runWebServer.Value)
2.55 + server.Quit();
2.56 +
2.57 };
2.58 }
2.59
2.60 @@ -440,6 +459,8 @@
2.61 settings.SetValue("treeView.Columns." + column.Header + ".Width",
2.62 column.Width);
2.63
2.64 + this.settings.SetValue("listenerPort", server.ListenerPort);
2.65 +
2.66 string fileName = Path.ChangeExtension(
2.67 System.Windows.Forms.Application.ExecutablePath, ".config");
2.68 try {
2.69 @@ -489,6 +510,8 @@
2.70 timer.Enabled = false;
2.71 computer.Close();
2.72 SaveConfiguration();
2.73 + if (runWebServer.Value)
2.74 + server.Quit();
2.75 systemTray.Dispose();
2.76 }
2.77
2.78 @@ -732,5 +755,14 @@
2.79 private void treeView_MouseUp(object sender, MouseEventArgs e) {
2.80 selectionDragging = false;
2.81 }
2.82 +
2.83 + private void serverPortMenuItem_Click(object sender, EventArgs e) {
2.84 + new PortForm(this).ShowDialog();
2.85 + }
2.86 +
2.87 + public HttpServer Server {
2.88 + get { return server; }
2.89 + }
2.90 +
2.91 }
2.92 }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/GUI/PortForm.Designer.cs Sun May 27 20:15:32 2012 +0000
3.3 @@ -0,0 +1,180 @@
3.4 +namespace OpenHardwareMonitor.GUI {
3.5 + partial class PortForm {
3.6 + /// <summary>
3.7 + /// Required designer variable.
3.8 + /// </summary>
3.9 + private System.ComponentModel.IContainer components = null;
3.10 +
3.11 + /// <summary>
3.12 + /// Clean up any resources being used.
3.13 + /// </summary>
3.14 + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
3.15 + protected override void Dispose(bool disposing) {
3.16 + if (disposing && (components != null)) {
3.17 + components.Dispose();
3.18 + }
3.19 + base.Dispose(disposing);
3.20 + }
3.21 +
3.22 + #region Windows Form Designer generated code
3.23 +
3.24 + /// <summary>
3.25 + /// Required method for Designer support - do not modify
3.26 + /// the contents of this method with the code editor.
3.27 + /// </summary>
3.28 + private void InitializeComponent() {
3.29 + this.portOKButton = new System.Windows.Forms.Button();
3.30 + this.portCancelButton = new System.Windows.Forms.Button();
3.31 + this.label1 = new System.Windows.Forms.Label();
3.32 + this.label2 = new System.Windows.Forms.Label();
3.33 + this.label3 = new System.Windows.Forms.Label();
3.34 + this.label4 = new System.Windows.Forms.Label();
3.35 + this.webServerLinkLabel = new System.Windows.Forms.LinkLabel();
3.36 + this.portNumericUpDn = new System.Windows.Forms.NumericUpDown();
3.37 + this.label5 = new System.Windows.Forms.Label();
3.38 + ((System.ComponentModel.ISupportInitialize)(this.portNumericUpDn)).BeginInit();
3.39 + this.SuspendLayout();
3.40 + //
3.41 + // portOKButton
3.42 + //
3.43 + this.portOKButton.Location = new System.Drawing.Point(244, 137);
3.44 + this.portOKButton.Name = "portOKButton";
3.45 + this.portOKButton.Size = new System.Drawing.Size(75, 23);
3.46 + this.portOKButton.TabIndex = 0;
3.47 + this.portOKButton.Text = "OK";
3.48 + this.portOKButton.UseVisualStyleBackColor = true;
3.49 + this.portOKButton.Click += new System.EventHandler(this.portOKButton_Click);
3.50 + //
3.51 + // portCancelButton
3.52 + //
3.53 + this.portCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
3.54 + this.portCancelButton.Location = new System.Drawing.Point(162, 137);
3.55 + this.portCancelButton.Name = "portCancelButton";
3.56 + this.portCancelButton.Size = new System.Drawing.Size(75, 23);
3.57 + this.portCancelButton.TabIndex = 1;
3.58 + this.portCancelButton.Text = "Cancel";
3.59 + this.portCancelButton.UseVisualStyleBackColor = true;
3.60 + this.portCancelButton.Click += new System.EventHandler(this.portCancelButton_Click);
3.61 + //
3.62 + // label1
3.63 + //
3.64 + this.label1.AutoSize = true;
3.65 + this.label1.Location = new System.Drawing.Point(13, 106);
3.66 + this.label1.Name = "label1";
3.67 + this.label1.Size = new System.Drawing.Size(377, 13);
3.68 + this.label1.TabIndex = 3;
3.69 + this.label1.Text = "Note: You will need to open the port in firewall settings of the operating system" +
3.70 + ".";
3.71 + //
3.72 + // label2
3.73 + //
3.74 + this.label2.AutoSize = true;
3.75 + this.label2.Location = new System.Drawing.Point(13, 9);
3.76 + this.label2.Name = "label2";
3.77 + this.label2.Size = new System.Drawing.Size(193, 13);
3.78 + this.label2.TabIndex = 4;
3.79 + this.label2.Text = "Port number for the remote web server:";
3.80 + //
3.81 + // label3
3.82 + //
3.83 + this.label3.AutoSize = true;
3.84 + this.label3.Location = new System.Drawing.Point(13, 39);
3.85 + this.label3.Name = "label3";
3.86 + this.label3.Size = new System.Drawing.Size(443, 13);
3.87 + this.label3.TabIndex = 5;
3.88 + this.label3.Text = "If the web server is running then it will need to be restarted for the port chang" +
3.89 + "e to take effect.";
3.90 + //
3.91 + // label4
3.92 + //
3.93 + this.label4.AutoSize = true;
3.94 + this.label4.Location = new System.Drawing.Point(13, 62);
3.95 + this.label4.Name = "label4";
3.96 + this.label4.Size = new System.Drawing.Size(262, 13);
3.97 + this.label4.TabIndex = 6;
3.98 + this.label4.Text = "The web server will be accessible from the browser at ";
3.99 + //
3.100 + // webServerLinkLabel
3.101 + //
3.102 + this.webServerLinkLabel.AutoSize = true;
3.103 + this.webServerLinkLabel.Location = new System.Drawing.Point(269, 62);
3.104 + this.webServerLinkLabel.Name = "webServerLinkLabel";
3.105 + this.webServerLinkLabel.Size = new System.Drawing.Size(55, 13);
3.106 + this.webServerLinkLabel.TabIndex = 7;
3.107 + this.webServerLinkLabel.TabStop = true;
3.108 + this.webServerLinkLabel.Text = "linkLabel1";
3.109 + this.webServerLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.webServerLinkLabel_LinkClicked);
3.110 + //
3.111 + // portNumericUpDn
3.112 + //
3.113 + this.portNumericUpDn.Location = new System.Drawing.Point(208, 7);
3.114 + this.portNumericUpDn.Maximum = new decimal(new int[] {
3.115 + 20000,
3.116 + 0,
3.117 + 0,
3.118 + 0});
3.119 + this.portNumericUpDn.Minimum = new decimal(new int[] {
3.120 + 8080,
3.121 + 0,
3.122 + 0,
3.123 + 0});
3.124 + this.portNumericUpDn.Name = "portNumericUpDn";
3.125 + this.portNumericUpDn.Size = new System.Drawing.Size(75, 20);
3.126 + this.portNumericUpDn.TabIndex = 8;
3.127 + this.portNumericUpDn.Value = new decimal(new int[] {
3.128 + 8080,
3.129 + 0,
3.130 + 0,
3.131 + 0});
3.132 + this.portNumericUpDn.ValueChanged += new System.EventHandler(this.portNumericUpDn_ValueChanged);
3.133 + //
3.134 + // label5
3.135 + //
3.136 + this.label5.AutoSize = true;
3.137 + this.label5.Location = new System.Drawing.Point(13, 84);
3.138 + this.label5.Name = "label5";
3.139 + this.label5.Size = new System.Drawing.Size(304, 13);
3.140 + this.label5.TabIndex = 9;
3.141 + this.label5.Text = "You will have to start the server by clicking Run from the menu.";
3.142 + //
3.143 + // PortForm
3.144 + //
3.145 + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
3.146 + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
3.147 + this.CancelButton = this.portCancelButton;
3.148 + this.ClientSize = new System.Drawing.Size(466, 170);
3.149 + this.Controls.Add(this.label5);
3.150 + this.Controls.Add(this.portNumericUpDn);
3.151 + this.Controls.Add(this.webServerLinkLabel);
3.152 + this.Controls.Add(this.label4);
3.153 + this.Controls.Add(this.label3);
3.154 + this.Controls.Add(this.label2);
3.155 + this.Controls.Add(this.label1);
3.156 + this.Controls.Add(this.portCancelButton);
3.157 + this.Controls.Add(this.portOKButton);
3.158 + this.MaximizeBox = false;
3.159 + this.MinimizeBox = false;
3.160 + this.Name = "PortForm";
3.161 + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
3.162 + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
3.163 + this.Text = "Set Port";
3.164 + this.Load += new System.EventHandler(this.PortForm_Load);
3.165 + ((System.ComponentModel.ISupportInitialize)(this.portNumericUpDn)).EndInit();
3.166 + this.ResumeLayout(false);
3.167 + this.PerformLayout();
3.168 +
3.169 + }
3.170 +
3.171 + #endregion
3.172 +
3.173 + private System.Windows.Forms.Button portOKButton;
3.174 + private System.Windows.Forms.Button portCancelButton;
3.175 + private System.Windows.Forms.Label label1;
3.176 + private System.Windows.Forms.Label label2;
3.177 + private System.Windows.Forms.Label label3;
3.178 + private System.Windows.Forms.Label label4;
3.179 + private System.Windows.Forms.LinkLabel webServerLinkLabel;
3.180 + private System.Windows.Forms.NumericUpDown portNumericUpDn;
3.181 + private System.Windows.Forms.Label label5;
3.182 + }
3.183 +}
3.184 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/GUI/PortForm.cs Sun May 27 20:15:32 2012 +0000
4.3 @@ -0,0 +1,77 @@
4.4 +/*
4.5 +
4.6 + This Source Code Form is subject to the terms of the Mozilla Public
4.7 + License, v. 2.0. If a copy of the MPL was not distributed with this
4.8 + file, You can obtain one at http://mozilla.org/MPL/2.0/.
4.9 +
4.10 + Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
4.11 +
4.12 +*/
4.13 +
4.14 +using System;
4.15 +using System.Collections.Generic;
4.16 +using System.ComponentModel;
4.17 +using System.Data;
4.18 +using System.Drawing;
4.19 +using System.Text;
4.20 +using System.Windows.Forms;
4.21 +using System.Net;
4.22 +using System.Net.Sockets;
4.23 +using System.Diagnostics;
4.24 +
4.25 +namespace OpenHardwareMonitor.GUI {
4.26 + public partial class PortForm : Form {
4.27 + private MainForm parent;
4.28 + private string localIP;
4.29 + public PortForm(MainForm m) {
4.30 + InitializeComponent();
4.31 + parent = m;
4.32 +
4.33 + localIP = getLocalIP();
4.34 + }
4.35 +
4.36 + private void portTextBox_TextChanged(object sender, EventArgs e) {
4.37 +
4.38 + }
4.39 +
4.40 + private string getLocalIP() {
4.41 + IPHostEntry host;
4.42 + string localIP = "?";
4.43 + host = Dns.GetHostEntry(Dns.GetHostName());
4.44 + foreach (IPAddress ip in host.AddressList) {
4.45 + if (ip.AddressFamily == AddressFamily.InterNetwork) {
4.46 + localIP = ip.ToString();
4.47 + }
4.48 + }
4.49 + return localIP;
4.50 + }
4.51 +
4.52 + private void portNumericUpDn_ValueChanged(object sender, EventArgs e) {
4.53 + string url = "http://" + localIP + ":" + portNumericUpDn.Value + "/";
4.54 + webServerLinkLabel.Text = url;
4.55 + webServerLinkLabel.Links.Remove(webServerLinkLabel.Links[0]);
4.56 + webServerLinkLabel.Links.Add(0, webServerLinkLabel.Text.Length, url);
4.57 + }
4.58 +
4.59 + private void portOKButton_Click(object sender, EventArgs e) {
4.60 + parent.Server.ListenerPort = (int)portNumericUpDn.Value;
4.61 + this.Close();
4.62 + }
4.63 +
4.64 + private void portCancelButton_Click(object sender, EventArgs e) {
4.65 + this.Close();
4.66 + }
4.67 +
4.68 + private void PortForm_Load(object sender, EventArgs e) {
4.69 + portNumericUpDn.Value = parent.Server.ListenerPort;
4.70 + portNumericUpDn_ValueChanged(null, null);
4.71 + }
4.72 +
4.73 + private void webServerLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
4.74 + try {
4.75 + Process.Start(new ProcessStartInfo(e.Link.LinkData.ToString()));
4.76 + } catch { }
4.77 + }
4.78 +
4.79 + }
4.80 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/GUI/PortForm.resx Sun May 27 20:15:32 2012 +0000
5.3 @@ -0,0 +1,120 @@
5.4 +<?xml version="1.0" encoding="utf-8"?>
5.5 +<root>
5.6 + <!--
5.7 + Microsoft ResX Schema
5.8 +
5.9 + Version 2.0
5.10 +
5.11 + The primary goals of this format is to allow a simple XML format
5.12 + that is mostly human readable. The generation and parsing of the
5.13 + various data types are done through the TypeConverter classes
5.14 + associated with the data types.
5.15 +
5.16 + Example:
5.17 +
5.18 + ... ado.net/XML headers & schema ...
5.19 + <resheader name="resmimetype">text/microsoft-resx</resheader>
5.20 + <resheader name="version">2.0</resheader>
5.21 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
5.22 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
5.23 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
5.24 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
5.25 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
5.26 + <value>[base64 mime encoded serialized .NET Framework object]</value>
5.27 + </data>
5.28 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
5.29 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
5.30 + <comment>This is a comment</comment>
5.31 + </data>
5.32 +
5.33 + There are any number of "resheader" rows that contain simple
5.34 + name/value pairs.
5.35 +
5.36 + Each data row contains a name, and value. The row also contains a
5.37 + type or mimetype. Type corresponds to a .NET class that support
5.38 + text/value conversion through the TypeConverter architecture.
5.39 + Classes that don't support this are serialized and stored with the
5.40 + mimetype set.
5.41 +
5.42 + The mimetype is used for serialized objects, and tells the
5.43 + ResXResourceReader how to depersist the object. This is currently not
5.44 + extensible. For a given mimetype the value must be set accordingly:
5.45 +
5.46 + Note - application/x-microsoft.net.object.binary.base64 is the format
5.47 + that the ResXResourceWriter will generate, however the reader can
5.48 + read any of the formats listed below.
5.49 +
5.50 + mimetype: application/x-microsoft.net.object.binary.base64
5.51 + value : The object must be serialized with
5.52 + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
5.53 + : and then encoded with base64 encoding.
5.54 +
5.55 + mimetype: application/x-microsoft.net.object.soap.base64
5.56 + value : The object must be serialized with
5.57 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
5.58 + : and then encoded with base64 encoding.
5.59 +
5.60 + mimetype: application/x-microsoft.net.object.bytearray.base64
5.61 + value : The object must be serialized into a byte array
5.62 + : using a System.ComponentModel.TypeConverter
5.63 + : and then encoded with base64 encoding.
5.64 + -->
5.65 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
5.66 + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
5.67 + <xsd:element name="root" msdata:IsDataSet="true">
5.68 + <xsd:complexType>
5.69 + <xsd:choice maxOccurs="unbounded">
5.70 + <xsd:element name="metadata">
5.71 + <xsd:complexType>
5.72 + <xsd:sequence>
5.73 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
5.74 + </xsd:sequence>
5.75 + <xsd:attribute name="name" use="required" type="xsd:string" />
5.76 + <xsd:attribute name="type" type="xsd:string" />
5.77 + <xsd:attribute name="mimetype" type="xsd:string" />
5.78 + <xsd:attribute ref="xml:space" />
5.79 + </xsd:complexType>
5.80 + </xsd:element>
5.81 + <xsd:element name="assembly">
5.82 + <xsd:complexType>
5.83 + <xsd:attribute name="alias" type="xsd:string" />
5.84 + <xsd:attribute name="name" type="xsd:string" />
5.85 + </xsd:complexType>
5.86 + </xsd:element>
5.87 + <xsd:element name="data">
5.88 + <xsd:complexType>
5.89 + <xsd:sequence>
5.90 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
5.91 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
5.92 + </xsd:sequence>
5.93 + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
5.94 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
5.95 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
5.96 + <xsd:attribute ref="xml:space" />
5.97 + </xsd:complexType>
5.98 + </xsd:element>
5.99 + <xsd:element name="resheader">
5.100 + <xsd:complexType>
5.101 + <xsd:sequence>
5.102 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
5.103 + </xsd:sequence>
5.104 + <xsd:attribute name="name" type="xsd:string" use="required" />
5.105 + </xsd:complexType>
5.106 + </xsd:element>
5.107 + </xsd:choice>
5.108 + </xsd:complexType>
5.109 + </xsd:element>
5.110 + </xsd:schema>
5.111 + <resheader name="resmimetype">
5.112 + <value>text/microsoft-resx</value>
5.113 + </resheader>
5.114 + <resheader name="version">
5.115 + <value>2.0</value>
5.116 + </resheader>
5.117 + <resheader name="reader">
5.118 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
5.119 + </resheader>
5.120 + <resheader name="writer">
5.121 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
5.122 + </resheader>
5.123 +</root>
5.124 \ No newline at end of file
6.1 --- a/Licenses/License.html Sun May 27 16:50:01 2012 +0000
6.2 +++ b/Licenses/License.html Sun May 27 20:15:32 2012 +0000
6.3 @@ -74,6 +74,8 @@
6.4 <ul>
6.5 <li><a href="#Aga.Controls">Aga.Controls License</a></li>
6.6 <li><a href="#WinRing0">WinRing0 License</a></li>
6.7 +<li><a href="#jQuery">jQuery License</a></li>
6.8 +<li><a href="#Knockout">Knockout License</a></li>
6.9 </ul>
6.10
6.11 <br/>
6.12 @@ -242,7 +244,7 @@
6.13
6.14 <hr/>
6.15
6.16 -<h1 id="WinRing0">WinRing0</h1>
6.17 +<h1 id="WinRing0">WinRing0 License</h1>
6.18 <p>
6.19 This license applies to the WinRing0 device drivers.
6.20 </p>
6.21 @@ -270,6 +272,66 @@
6.22 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6.23 </pre>
6.24
6.25 +<hr/>
6.26 +
6.27 +<h1 id="jQuery">jQuery License</h1>
6.28 +<p>
6.29 +This license applies to the jQuery JavaScript library.
6.30 +</p>
6.31 +<pre>
6.32 +Copyright (c) 2012 John Resig, http://jquery.com/
6.33 +
6.34 +Permission is hereby granted, free of charge, to any person obtaining
6.35 +a copy of this software and associated documentation files (the
6.36 +"Software"), to deal in the Software without restriction, including
6.37 +without limitation the rights to use, copy, modify, merge, publish,
6.38 +distribute, sublicense, and/or sell copies of the Software, and to
6.39 +permit persons to whom the Software is furnished to do so, subject to
6.40 +the following conditions:
6.41 +
6.42 +The above copyright notice and this permission notice shall be
6.43 +included in all copies or substantial portions of the Software.
6.44 +
6.45 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
6.46 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6.47 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
6.48 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
6.49 +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
6.50 +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
6.51 +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6.52 +</pre>
6.53 +
6.54 +<hr/>
6.55 +
6.56 +<h1 id="Knockout">Knockout License</h1>
6.57 +<p>
6.58 +This license applies to the Knockout JavaScript library.
6.59 +</p>
6.60 +<pre>
6.61 +Copyright (c) 2012 Steven Sanderson, Roy Jacobs
6.62 +
6.63 +Permission is hereby granted, free of charge, to any person obtaining
6.64 +a copy of this software and associated documentation files (the
6.65 +"Software"), to deal in the Software without restriction, including
6.66 +without limitation the rights to use, copy, modify, merge, publish,
6.67 +distribute, sublicense, and/or sell copies of the Software, and to
6.68 +permit persons to whom the Software is furnished to do so, subject to
6.69 +the following conditions:
6.70 +
6.71 +The above copyright notice and this permission notice shall be
6.72 +included in all copies or substantial portions of the Software.
6.73 +
6.74 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
6.75 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6.76 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
6.77 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
6.78 +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
6.79 +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
6.80 +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6.81 +</pre>
6.82 +
6.83 +
6.84 +
6.85 </div>
6.86 </div>
6.87
7.1 --- a/OpenHardwareMonitor.csproj Sun May 27 16:50:01 2012 +0000
7.2 +++ b/OpenHardwareMonitor.csproj Sun May 27 20:15:32 2012 +0000
7.3 @@ -60,6 +60,7 @@
7.4 <ItemGroup>
7.5 <Reference Include="System" />
7.6 <Reference Include="System.Configuration.Install" />
7.7 + <Reference Include="System.Data" />
7.8 <Reference Include="System.Drawing" />
7.9 <Reference Include="System.Management" />
7.10 <Reference Include="System.Windows.Forms" />
7.11 @@ -76,6 +77,12 @@
7.12 <Compile Include="GUI\PlotPanel.cs">
7.13 <SubType>UserControl</SubType>
7.14 </Compile>
7.15 + <Compile Include="GUI\PortForm.cs">
7.16 + <SubType>Form</SubType>
7.17 + </Compile>
7.18 + <Compile Include="GUI\PortForm.Designer.cs">
7.19 + <DependentUpon>PortForm.cs</DependentUpon>
7.20 + </Compile>
7.21 <Compile Include="GUI\ReportForm.cs">
7.22 <SubType>Form</SubType>
7.23 </Compile>
7.24 @@ -111,6 +118,7 @@
7.25 <Compile Include="GUI\UserOption.cs" />
7.26 <Compile Include="GUI\UserRadioGroup.cs" />
7.27 <Compile Include="Properties\AssemblyVersion.cs" />
7.28 + <Compile Include="Utilities\HttpServer.cs" />
7.29 <Compile Include="Utilities\PersistentSettings.cs" />
7.30 <Compile Include="Properties\AssemblyInfo.cs" />
7.31 <Compile Include="GUI\AboutBox.cs">
7.32 @@ -142,6 +150,9 @@
7.33 <DependentUpon>AboutBox.cs</DependentUpon>
7.34 <SubType>Designer</SubType>
7.35 </EmbeddedResource>
7.36 + <EmbeddedResource Include="GUI\PortForm.resx">
7.37 + <DependentUpon>PortForm.cs</DependentUpon>
7.38 + </EmbeddedResource>
7.39 <EmbeddedResource Include="Resources\ati.png">
7.40 </EmbeddedResource>
7.41 <EmbeddedResource Include="Resources\bigng.png" />
7.42 @@ -228,6 +239,49 @@
7.43 <ItemGroup>
7.44 <EmbeddedResource Include="Resources\factor.png" />
7.45 </ItemGroup>
7.46 + <ItemGroup>
7.47 + <EmbeddedResource Include="Resources\Web\js\jquery-ui-1.8.16.custom.min.js" />
7.48 + <EmbeddedResource Include="Resources\Web\js\jquery.tmpl.min.js" />
7.49 + <EmbeddedResource Include="Resources\Web\js\jquery.treeTable.min.js" />
7.50 + <EmbeddedResource Include="Resources\Web\js\ohm_web.js" />
7.51 + </ItemGroup>
7.52 + <ItemGroup>
7.53 + <EmbeddedResource Include="Resources\Web\images\toggle-collapse-dark.png" />
7.54 + <EmbeddedResource Include="Resources\Web\images\toggle-collapse-light.png" />
7.55 + <EmbeddedResource Include="Resources\Web\images\toggle-expand-dark.png" />
7.56 + <EmbeddedResource Include="Resources\Web\images\toggle-expand-light.png" />
7.57 + </ItemGroup>
7.58 + <ItemGroup>
7.59 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_flat_0_aaaaaa_40x100.png" />
7.60 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_55_fbf9ee_1x400.png" />
7.61 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_65_ffffff_1x400.png" />
7.62 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_75_dadada_1x400.png" />
7.63 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_75_e6e6e6_1x400.png" />
7.64 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_glass_75_ffffff_1x400.png" />
7.65 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_highlight-soft_75_cccccc_1x100.png" />
7.66 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-bg_inset-soft_95_fef1ec_1x100.png" />
7.67 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_222222_256x240.png" />
7.68 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_2e83ff_256x240.png" />
7.69 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_454545_256x240.png" />
7.70 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_888888_256x240.png" />
7.71 + <EmbeddedResource Include="Resources\Web\css\custom-theme\images\ui-icons_cd0a0a_256x240.png" />
7.72 + <EmbeddedResource Include="Resources\Web\css\custom-theme\jquery-ui-1.8.16.custom.css" />
7.73 + </ItemGroup>
7.74 + <ItemGroup>
7.75 + <EmbeddedResource Include="Resources\Web\css\jquery.treeTable.css" />
7.76 + <EmbeddedResource Include="Resources\Web\css\ohm_web.css" />
7.77 + </ItemGroup>
7.78 + <ItemGroup>
7.79 + <EmbeddedResource Include="Resources\Web\index.html" />
7.80 + </ItemGroup>
7.81 + <ItemGroup>
7.82 + <EmbeddedResource Include="Resources\Web\images\transparent.png" />
7.83 + </ItemGroup>
7.84 + <ItemGroup>
7.85 + <EmbeddedResource Include="Resources\Web\js\jquery-1.7.2.min.js" />
7.86 + <EmbeddedResource Include="Resources\Web\js\knockout-2.1.0.min.js" />
7.87 + <EmbeddedResource Include="Resources\Web\js\knockout.mapping-latest.min.js" />
7.88 + </ItemGroup>
7.89 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
7.90 <ProjectExtensions>
7.91 <VisualStudio AllowExistingFolder="true" />
8.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png has changed
9.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png has changed
10.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png has changed
11.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_glass_75_dadada_1x400.png has changed
12.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png has changed
13.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_glass_75_ffffff_1x400.png has changed
14.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png has changed
15.1 Binary file Resources/Web/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png has changed
16.1 Binary file Resources/Web/css/custom-theme/images/ui-icons_222222_256x240.png has changed
17.1 Binary file Resources/Web/css/custom-theme/images/ui-icons_2e83ff_256x240.png has changed
18.1 Binary file Resources/Web/css/custom-theme/images/ui-icons_454545_256x240.png has changed
19.1 Binary file Resources/Web/css/custom-theme/images/ui-icons_888888_256x240.png has changed
20.1 Binary file Resources/Web/css/custom-theme/images/ui-icons_cd0a0a_256x240.png has changed
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/Resources/Web/css/custom-theme/jquery-ui-1.8.16.custom.css Sun May 27 20:15:32 2012 +0000
21.3 @@ -0,0 +1,351 @@
21.4 +/*
21.5 + * jQuery UI CSS Framework 1.8.16
21.6 + *
21.7 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
21.8 + * Dual licensed under the MIT or GPL Version 2 licenses.
21.9 + * http://jquery.org/license
21.10 + *
21.11 + * http://docs.jquery.com/UI/Theming/API
21.12 + */
21.13 +
21.14 +/* Layout helpers
21.15 +----------------------------------*/
21.16 +.ui-helper-hidden { display: none; }
21.17 +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
21.18 +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
21.19 +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21.20 +.ui-helper-clearfix { display: inline-block; }
21.21 +/* required comment for clearfix to work in Opera \*/
21.22 +* html .ui-helper-clearfix { height:1%; }
21.23 +.ui-helper-clearfix { display:block; }
21.24 +/* end clearfix */
21.25 +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
21.26 +
21.27 +
21.28 +/* Interaction Cues
21.29 +----------------------------------*/
21.30 +.ui-state-disabled { cursor: default !important; }
21.31 +
21.32 +
21.33 +/* Icons
21.34 +----------------------------------*/
21.35 +
21.36 +/* states and images */
21.37 +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
21.38 +
21.39 +
21.40 +/* Misc visuals
21.41 +----------------------------------*/
21.42 +
21.43 +/* Overlays */
21.44 +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
21.45 +
21.46 +
21.47 +/*
21.48 + * jQuery UI CSS Framework 1.8.16
21.49 + *
21.50 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
21.51 + * Dual licensed under the MIT or GPL Version 2 licenses.
21.52 + * http://jquery.org/license
21.53 + *
21.54 + * http://docs.jquery.com/UI/Theming/API
21.55 + *
21.56 + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ctl=themeroller
21.57 + */
21.58 +
21.59 +
21.60 +/* Component containers
21.61 +----------------------------------*/
21.62 +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
21.63 +.ui-widget .ui-widget { font-size: 1em; }
21.64 +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
21.65 +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_75_ffffff_1x400.png) 50% 50% repeat-x; color: #222222; }
21.66 +.ui-widget-content a { color: #222222; }
21.67 +.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; }
21.68 +.ui-widget-header a { color: #222222; }
21.69 +
21.70 +/* Interaction states
21.71 +----------------------------------*/
21.72 +.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; }
21.73 +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
21.74 +.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; }
21.75 +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
21.76 +.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; }
21.77 +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
21.78 +.ui-widget :active { outline: none; }
21.79 +
21.80 +/* Interaction Cues
21.81 +----------------------------------*/
21.82 +.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; }
21.83 +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
21.84 +.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; }
21.85 +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
21.86 +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
21.87 +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
21.88 +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
21.89 +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
21.90 +
21.91 +/* Icons
21.92 +----------------------------------*/
21.93 +
21.94 +/* states and images */
21.95 +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
21.96 +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
21.97 +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
21.98 +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
21.99 +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
21.100 +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
21.101 +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
21.102 +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
21.103 +
21.104 +/* positioning */
21.105 +.ui-icon-carat-1-n { background-position: 0 0; }
21.106 +.ui-icon-carat-1-ne { background-position: -16px 0; }
21.107 +.ui-icon-carat-1-e { background-position: -32px 0; }
21.108 +.ui-icon-carat-1-se { background-position: -48px 0; }
21.109 +.ui-icon-carat-1-s { background-position: -64px 0; }
21.110 +.ui-icon-carat-1-sw { background-position: -80px 0; }
21.111 +.ui-icon-carat-1-w { background-position: -96px 0; }
21.112 +.ui-icon-carat-1-nw { background-position: -112px 0; }
21.113 +.ui-icon-carat-2-n-s { background-position: -128px 0; }
21.114 +.ui-icon-carat-2-e-w { background-position: -144px 0; }
21.115 +.ui-icon-triangle-1-n { background-position: 0 -16px; }
21.116 +.ui-icon-triangle-1-ne { background-position: -16px -16px; }
21.117 +.ui-icon-triangle-1-e { background-position: -32px -16px; }
21.118 +.ui-icon-triangle-1-se { background-position: -48px -16px; }
21.119 +.ui-icon-triangle-1-s { background-position: -64px -16px; }
21.120 +.ui-icon-triangle-1-sw { background-position: -80px -16px; }
21.121 +.ui-icon-triangle-1-w { background-position: -96px -16px; }
21.122 +.ui-icon-triangle-1-nw { background-position: -112px -16px; }
21.123 +.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
21.124 +.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
21.125 +.ui-icon-arrow-1-n { background-position: 0 -32px; }
21.126 +.ui-icon-arrow-1-ne { background-position: -16px -32px; }
21.127 +.ui-icon-arrow-1-e { background-position: -32px -32px; }
21.128 +.ui-icon-arrow-1-se { background-position: -48px -32px; }
21.129 +.ui-icon-arrow-1-s { background-position: -64px -32px; }
21.130 +.ui-icon-arrow-1-sw { background-position: -80px -32px; }
21.131 +.ui-icon-arrow-1-w { background-position: -96px -32px; }
21.132 +.ui-icon-arrow-1-nw { background-position: -112px -32px; }
21.133 +.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
21.134 +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
21.135 +.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
21.136 +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
21.137 +.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
21.138 +.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
21.139 +.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
21.140 +.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
21.141 +.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
21.142 +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
21.143 +.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
21.144 +.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
21.145 +.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
21.146 +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
21.147 +.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
21.148 +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
21.149 +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
21.150 +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
21.151 +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
21.152 +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
21.153 +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
21.154 +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
21.155 +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
21.156 +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
21.157 +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
21.158 +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
21.159 +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
21.160 +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
21.161 +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
21.162 +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
21.163 +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
21.164 +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
21.165 +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
21.166 +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
21.167 +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
21.168 +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
21.169 +.ui-icon-arrow-4 { background-position: 0 -80px; }
21.170 +.ui-icon-arrow-4-diag { background-position: -16px -80px; }
21.171 +.ui-icon-extlink { background-position: -32px -80px; }
21.172 +.ui-icon-newwin { background-position: -48px -80px; }
21.173 +.ui-icon-refresh { background-position: -64px -80px; }
21.174 +.ui-icon-shuffle { background-position: -80px -80px; }
21.175 +.ui-icon-transfer-e-w { background-position: -96px -80px; }
21.176 +.ui-icon-transferthick-e-w { background-position: -112px -80px; }
21.177 +.ui-icon-folder-collapsed { background-position: 0 -96px; }
21.178 +.ui-icon-folder-open { background-position: -16px -96px; }
21.179 +.ui-icon-document { background-position: -32px -96px; }
21.180 +.ui-icon-document-b { background-position: -48px -96px; }
21.181 +.ui-icon-note { background-position: -64px -96px; }
21.182 +.ui-icon-mail-closed { background-position: -80px -96px; }
21.183 +.ui-icon-mail-open { background-position: -96px -96px; }
21.184 +.ui-icon-suitcase { background-position: -112px -96px; }
21.185 +.ui-icon-comment { background-position: -128px -96px; }
21.186 +.ui-icon-person { background-position: -144px -96px; }
21.187 +.ui-icon-print { background-position: -160px -96px; }
21.188 +.ui-icon-trash { background-position: -176px -96px; }
21.189 +.ui-icon-locked { background-position: -192px -96px; }
21.190 +.ui-icon-unlocked { background-position: -208px -96px; }
21.191 +.ui-icon-bookmark { background-position: -224px -96px; }
21.192 +.ui-icon-tag { background-position: -240px -96px; }
21.193 +.ui-icon-home { background-position: 0 -112px; }
21.194 +.ui-icon-flag { background-position: -16px -112px; }
21.195 +.ui-icon-calendar { background-position: -32px -112px; }
21.196 +.ui-icon-cart { background-position: -48px -112px; }
21.197 +.ui-icon-pencil { background-position: -64px -112px; }
21.198 +.ui-icon-clock { background-position: -80px -112px; }
21.199 +.ui-icon-disk { background-position: -96px -112px; }
21.200 +.ui-icon-calculator { background-position: -112px -112px; }
21.201 +.ui-icon-zoomin { background-position: -128px -112px; }
21.202 +.ui-icon-zoomout { background-position: -144px -112px; }
21.203 +.ui-icon-search { background-position: -160px -112px; }
21.204 +.ui-icon-wrench { background-position: -176px -112px; }
21.205 +.ui-icon-gear { background-position: -192px -112px; }
21.206 +.ui-icon-heart { background-position: -208px -112px; }
21.207 +.ui-icon-star { background-position: -224px -112px; }
21.208 +.ui-icon-link { background-position: -240px -112px; }
21.209 +.ui-icon-cancel { background-position: 0 -128px; }
21.210 +.ui-icon-plus { background-position: -16px -128px; }
21.211 +.ui-icon-plusthick { background-position: -32px -128px; }
21.212 +.ui-icon-minus { background-position: -48px -128px; }
21.213 +.ui-icon-minusthick { background-position: -64px -128px; }
21.214 +.ui-icon-close { background-position: -80px -128px; }
21.215 +.ui-icon-closethick { background-position: -96px -128px; }
21.216 +.ui-icon-key { background-position: -112px -128px; }
21.217 +.ui-icon-lightbulb { background-position: -128px -128px; }
21.218 +.ui-icon-scissors { background-position: -144px -128px; }
21.219 +.ui-icon-clipboard { background-position: -160px -128px; }
21.220 +.ui-icon-copy { background-position: -176px -128px; }
21.221 +.ui-icon-contact { background-position: -192px -128px; }
21.222 +.ui-icon-image { background-position: -208px -128px; }
21.223 +.ui-icon-video { background-position: -224px -128px; }
21.224 +.ui-icon-script { background-position: -240px -128px; }
21.225 +.ui-icon-alert { background-position: 0 -144px; }
21.226 +.ui-icon-info { background-position: -16px -144px; }
21.227 +.ui-icon-notice { background-position: -32px -144px; }
21.228 +.ui-icon-help { background-position: -48px -144px; }
21.229 +.ui-icon-check { background-position: -64px -144px; }
21.230 +.ui-icon-bullet { background-position: -80px -144px; }
21.231 +.ui-icon-radio-off { background-position: -96px -144px; }
21.232 +.ui-icon-radio-on { background-position: -112px -144px; }
21.233 +.ui-icon-pin-w { background-position: -128px -144px; }
21.234 +.ui-icon-pin-s { background-position: -144px -144px; }
21.235 +.ui-icon-play { background-position: 0 -160px; }
21.236 +.ui-icon-pause { background-position: -16px -160px; }
21.237 +.ui-icon-seek-next { background-position: -32px -160px; }
21.238 +.ui-icon-seek-prev { background-position: -48px -160px; }
21.239 +.ui-icon-seek-end { background-position: -64px -160px; }
21.240 +.ui-icon-seek-start { background-position: -80px -160px; }
21.241 +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
21.242 +.ui-icon-seek-first { background-position: -80px -160px; }
21.243 +.ui-icon-stop { background-position: -96px -160px; }
21.244 +.ui-icon-eject { background-position: -112px -160px; }
21.245 +.ui-icon-volume-off { background-position: -128px -160px; }
21.246 +.ui-icon-volume-on { background-position: -144px -160px; }
21.247 +.ui-icon-power { background-position: 0 -176px; }
21.248 +.ui-icon-signal-diag { background-position: -16px -176px; }
21.249 +.ui-icon-signal { background-position: -32px -176px; }
21.250 +.ui-icon-battery-0 { background-position: -48px -176px; }
21.251 +.ui-icon-battery-1 { background-position: -64px -176px; }
21.252 +.ui-icon-battery-2 { background-position: -80px -176px; }
21.253 +.ui-icon-battery-3 { background-position: -96px -176px; }
21.254 +.ui-icon-circle-plus { background-position: 0 -192px; }
21.255 +.ui-icon-circle-minus { background-position: -16px -192px; }
21.256 +.ui-icon-circle-close { background-position: -32px -192px; }
21.257 +.ui-icon-circle-triangle-e { background-position: -48px -192px; }
21.258 +.ui-icon-circle-triangle-s { background-position: -64px -192px; }
21.259 +.ui-icon-circle-triangle-w { background-position: -80px -192px; }
21.260 +.ui-icon-circle-triangle-n { background-position: -96px -192px; }
21.261 +.ui-icon-circle-arrow-e { background-position: -112px -192px; }
21.262 +.ui-icon-circle-arrow-s { background-position: -128px -192px; }
21.263 +.ui-icon-circle-arrow-w { background-position: -144px -192px; }
21.264 +.ui-icon-circle-arrow-n { background-position: -160px -192px; }
21.265 +.ui-icon-circle-zoomin { background-position: -176px -192px; }
21.266 +.ui-icon-circle-zoomout { background-position: -192px -192px; }
21.267 +.ui-icon-circle-check { background-position: -208px -192px; }
21.268 +.ui-icon-circlesmall-plus { background-position: 0 -208px; }
21.269 +.ui-icon-circlesmall-minus { background-position: -16px -208px; }
21.270 +.ui-icon-circlesmall-close { background-position: -32px -208px; }
21.271 +.ui-icon-squaresmall-plus { background-position: -48px -208px; }
21.272 +.ui-icon-squaresmall-minus { background-position: -64px -208px; }
21.273 +.ui-icon-squaresmall-close { background-position: -80px -208px; }
21.274 +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
21.275 +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
21.276 +.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
21.277 +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
21.278 +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
21.279 +.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
21.280 +
21.281 +
21.282 +/* Misc visuals
21.283 +----------------------------------*/
21.284 +
21.285 +/* Corner radius */
21.286 +.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; }
21.287 +.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; }
21.288 +.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; }
21.289 +.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; }
21.290 +
21.291 +/* Overlays */
21.292 +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
21.293 +.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; }/*
21.294 + * jQuery UI Button 1.8.16
21.295 + *
21.296 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
21.297 + * Dual licensed under the MIT or GPL Version 2 licenses.
21.298 + * http://jquery.org/license
21.299 + *
21.300 + * http://docs.jquery.com/UI/Button#theming
21.301 + */
21.302 +.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 */
21.303 +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
21.304 +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
21.305 +.ui-button-icons-only { width: 3.4em; }
21.306 +button.ui-button-icons-only { width: 3.7em; }
21.307 +
21.308 +/*button text element */
21.309 +.ui-button .ui-button-text { display: block; line-height: 1.4; }
21.310 +.ui-button-text-only .ui-button-text { padding: .4em 1em; }
21.311 +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
21.312 +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
21.313 +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
21.314 +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
21.315 +/* no icon support for input elements, provide padding by default */
21.316 +input.ui-button { padding: .4em 1em; }
21.317 +
21.318 +/*button icon element(s) */
21.319 +.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; }
21.320 +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
21.321 +.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; }
21.322 +.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; }
21.323 +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
21.324 +
21.325 +/*button sets*/
21.326 +.ui-buttonset { margin-right: 7px; }
21.327 +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
21.328 +
21.329 +/* workarounds */
21.330 +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
21.331 +/*
21.332 + * jQuery UI Slider 1.8.16
21.333 + *
21.334 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
21.335 + * Dual licensed under the MIT or GPL Version 2 licenses.
21.336 + * http://jquery.org/license
21.337 + *
21.338 + * http://docs.jquery.com/UI/Slider#theming
21.339 + */
21.340 +.ui-slider { position: relative; text-align: left; }
21.341 +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
21.342 +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
21.343 +
21.344 +.ui-slider-horizontal { height: .8em; }
21.345 +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
21.346 +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
21.347 +.ui-slider-horizontal .ui-slider-range-min { left: 0; }
21.348 +.ui-slider-horizontal .ui-slider-range-max { right: 0; }
21.349 +
21.350 +.ui-slider-vertical { width: .8em; height: 100px; }
21.351 +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
21.352 +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
21.353 +.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
21.354 +.ui-slider-vertical .ui-slider-range-max { top: 0; }
21.355 \ No newline at end of file
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/Resources/Web/css/jquery.treeTable.css Sun May 27 20:15:32 2012 +0000
22.3 @@ -0,0 +1,47 @@
22.4 +/* jQuery treeTable stylesheet
22.5 + *
22.6 + * This file contains styles that are used to display the tree table. Each tree
22.7 + * table is assigned the +treeTable+ class.
22.8 + * ========================================================================= */
22.9 +
22.10 +/* jquery.treeTable.collapsible
22.11 + * ------------------------------------------------------------------------- */
22.12 +.treeTable tr td .expander {
22.13 + background-position: left center;
22.14 + background-repeat: no-repeat;
22.15 + cursor: pointer;
22.16 + padding: 0;
22.17 + zoom: 1; /* IE7 Hack */
22.18 +}
22.19 +
22.20 +.treeTable tr.collapsed td .expander {
22.21 + background-image: url(../images/toggle-expand-dark.png);
22.22 +}
22.23 +
22.24 +.treeTable tr.expanded td .expander {
22.25 + background-image: url(../images/toggle-collapse-dark.png);
22.26 +}
22.27 +
22.28 +/* jquery.treeTable.sortable
22.29 + * ------------------------------------------------------------------------- */
22.30 +.treeTable tr.selected, .treeTable tr.accept {
22.31 + background-color: #3875d7;
22.32 + color: #fff;
22.33 +}
22.34 +
22.35 +.treeTable tr.collapsed.selected td .expander, .treeTable tr.collapsed.accept td .expander {
22.36 + background-image: url(../images/toggle-expand-light.png);
22.37 +}
22.38 +
22.39 +.treeTable tr.expanded.selected td .expander, .treeTable tr.expanded.accept td .expander {
22.40 + background-image: url(../images/toggle-collapse-light.png);
22.41 +}
22.42 +
22.43 +.treeTable .ui-draggable-dragging {
22.44 + color: #000;
22.45 + z-index: 1;
22.46 +}
22.47 +
22.48 +/* Layout helper taken from jQuery UI. This way I don't have to require the
22.49 + * full jQuery UI CSS to be loaded. */
22.50 +.ui-helper-hidden { display: none; }
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/Resources/Web/css/ohm_web.css Sun May 27 20:15:32 2012 +0000
23.3 @@ -0,0 +1,39 @@
23.4 +body {
23.5 + font-size: 62.5%;
23.6 +}
23.7 +
23.8 +table
23.9 +{
23.10 + border-collapse:collapse;
23.11 +}
23.12 +
23.13 +table, tr
23.14 +{
23.15 + border: 1px solid #F0F0F0;
23.16 +}
23.17 +
23.18 +td
23.19 +{
23.20 + padding-right:10px;
23.21 +}
23.22 +
23.23 +/* Site
23.24 + -------------------------------- */
23.25 +
23.26 +body {
23.27 + font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
23.28 +}
23.29 +
23.30 +div.header {
23.31 + padding:12px;
23.32 + font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
23.33 +}
23.34 +
23.35 +div.main {
23.36 + clear:both;
23.37 + padding:12px;
23.38 + font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
23.39 + /*font-size: 1.3em;*/
23.40 + /*line-height: 1.4em;*/
23.41 +}
23.42 +
24.1 Binary file Resources/Web/images/toggle-collapse-dark.png has changed
25.1 Binary file Resources/Web/images/toggle-collapse-light.png has changed
26.1 Binary file Resources/Web/images/toggle-expand-dark.png has changed
27.1 Binary file Resources/Web/images/toggle-expand-light.png has changed
28.1 Binary file Resources/Web/images/transparent.png has changed
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/Resources/Web/index.html Sun May 27 20:15:32 2012 +0000
29.3 @@ -0,0 +1,61 @@
29.4 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
29.5 + - License, v. 2.0. If a copy of the MPL was not distributed with this
29.6 + - file, You can obtain one at http://mozilla.org/MPL/2.0/.
29.7 +
29.8 + - Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com> -->
29.9 +
29.10 +<html>
29.11 + <head>
29.12 + <title>Open Hardware Monitor - Web Version</title>
29.13 + <script type='text/javascript' src='js/jquery-1.7.2.min.js'></script>
29.14 + <script type='text/javascript' src='js/jquery.tmpl.min.js'></script>
29.15 + <script type='text/javascript' src='js/knockout-2.1.0.min.js'></script>
29.16 + <script type='text/javascript' src='js/knockout.mapping-latest.min.js'></script>
29.17 +
29.18 + <link href="css/jquery.treeTable.css" rel="stylesheet" type="text/css" />
29.19 + <script type='text/javascript' src='js/jquery.treeTable.min.js'></script>
29.20 +
29.21 + <link href="css/custom-theme/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
29.22 + <link href="css/ohm_web.css" rel="stylesheet" type="text/css" />
29.23 + <script type='text/javascript' src='js/jquery-ui-1.8.16.custom.min.js'></script>
29.24 + <style>
29.25 + #toolbar {
29.26 + padding: 10px 10px;
29.27 + }
29.28 + #slider {
29.29 + display: inline-block;
29.30 + width: 100px;
29.31 + }
29.32 + </style>
29.33 +
29.34 +
29.35 + <script type='text/javascript' src='js/ohm_web.js'></script>
29.36 +
29.37 + </head>
29.38 +
29.39 + <body>
29.40 +
29.41 + <div class="header">
29.42 +
29.43 + <span id="toolbar" class="ui-widget-header ui-corner-all">
29.44 + <button id="refresh" data-bind="click: update">Refresh</button>
29.45 + <input type="checkbox" id="auto_refresh" data-bind="checked: auto_refresh"/><label for="auto_refresh">Auto Refresh</label>
29.46 + <div id="slider"></div> <span for="auto_refresh" id="lbl"></span>
29.47 + </span>
29.48 + </div>
29.49 +
29.50 + <div class="main">
29.51 + <table data-bind="treeTable: flattened, treeOptions: { initialState: 'expanded', clickableNodeNames: true } ">
29.52 + <thead><td>Sensor</td><td>Min</td><td>Value</td><td>Max</td>
29.53 + <tbody data-bind="foreach: flattened">
29.54 + <tr data-bind="attr: { 'id': 'node-' + id(), 'class': parent.id()?'child-of-node-' + parent.id():'' }">
29.55 + <td data-bind="html: '<img src=' + ImageURL() + ' /> ' + Text()"></td>
29.56 + <td data-bind="text: Min"></td>
29.57 + <td data-bind="text: Value"></td>
29.58 + <td data-bind="text: Max"></td>
29.59 + </tr>
29.60 + </tbody>
29.61 + </table>
29.62 + </div>
29.63 + </body>
29.64 + </html>
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/Resources/Web/js/jquery-1.7.2.js Sun May 27 20:15:32 2012 +0000
30.3 @@ -0,0 +1,9404 @@
30.4 +/*!
30.5 + * jQuery JavaScript Library v1.7.2
30.6 + * http://jquery.com/
30.7 + *
30.8 + * Copyright 2011, John Resig
30.9 + * Dual licensed under the MIT or GPL Version 2 licenses.
30.10 + * http://jquery.org/license
30.11 + *
30.12 + * Includes Sizzle.js
30.13 + * http://sizzlejs.com/
30.14 + * Copyright 2011, The Dojo Foundation
30.15 + * Released under the MIT, BSD, and GPL Licenses.
30.16 + *
30.17 + * Date: Wed Mar 21 12:46:34 2012 -0700
30.18 + */
30.19 +(function( window, undefined ) {
30.20 +
30.21 +// Use the correct document accordingly with window argument (sandbox)
30.22 +var document = window.document,
30.23 + navigator = window.navigator,
30.24 + location = window.location;
30.25 +var jQuery = (function() {
30.26 +
30.27 +// Define a local copy of jQuery
30.28 +var jQuery = function( selector, context ) {
30.29 + // The jQuery object is actually just the init constructor 'enhanced'
30.30 + return new jQuery.fn.init( selector, context, rootjQuery );
30.31 + },
30.32 +
30.33 + // Map over jQuery in case of overwrite
30.34 + _jQuery = window.jQuery,
30.35 +
30.36 + // Map over the $ in case of overwrite
30.37 + _$ = window.$,
30.38 +
30.39 + // A central reference to the root jQuery(document)
30.40 + rootjQuery,
30.41 +
30.42 + // A simple way to check for HTML strings or ID strings
30.43 + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
30.44 + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
30.45 +
30.46 + // Check if a string has a non-whitespace character in it
30.47 + rnotwhite = /\S/,
30.48 +
30.49 + // Used for trimming whitespace
30.50 + trimLeft = /^\s+/,
30.51 + trimRight = /\s+$/,
30.52 +
30.53 + // Match a standalone tag
30.54 + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
30.55 +
30.56 + // JSON RegExp
30.57 + rvalidchars = /^[\],:{}\s]*$/,
30.58 + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
30.59 + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
30.60 + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
30.61 +
30.62 + // Useragent RegExp
30.63 + rwebkit = /(webkit)[ \/]([\w.]+)/,
30.64 + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
30.65 + rmsie = /(msie) ([\w.]+)/,
30.66 + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
30.67 +
30.68 + // Matches dashed string for camelizing
30.69 + rdashAlpha = /-([a-z]|[0-9])/ig,
30.70 + rmsPrefix = /^-ms-/,
30.71 +
30.72 + // Used by jQuery.camelCase as callback to replace()
30.73 + fcamelCase = function( all, letter ) {
30.74 + return ( letter + "" ).toUpperCase();
30.75 + },
30.76 +
30.77 + // Keep a UserAgent string for use with jQuery.browser
30.78 + userAgent = navigator.userAgent,
30.79 +
30.80 + // For matching the engine and version of the browser
30.81 + browserMatch,
30.82 +
30.83 + // The deferred used on DOM ready
30.84 + readyList,
30.85 +
30.86 + // The ready event handler
30.87 + DOMContentLoaded,
30.88 +
30.89 + // Save a reference to some core methods
30.90 + toString = Object.prototype.toString,
30.91 + hasOwn = Object.prototype.hasOwnProperty,
30.92 + push = Array.prototype.push,
30.93 + slice = Array.prototype.slice,
30.94 + trim = String.prototype.trim,
30.95 + indexOf = Array.prototype.indexOf,
30.96 +
30.97 + // [[Class]] -> type pairs
30.98 + class2type = {};
30.99 +
30.100 +jQuery.fn = jQuery.prototype = {
30.101 + constructor: jQuery,
30.102 + init: function( selector, context, rootjQuery ) {
30.103 + var match, elem, ret, doc;
30.104 +
30.105 + // Handle $(""), $(null), or $(undefined)
30.106 + if ( !selector ) {
30.107 + return this;
30.108 + }
30.109 +
30.110 + // Handle $(DOMElement)
30.111 + if ( selector.nodeType ) {
30.112 + this.context = this[0] = selector;
30.113 + this.length = 1;
30.114 + return this;
30.115 + }
30.116 +
30.117 + // The body element only exists once, optimize finding it
30.118 + if ( selector === "body" && !context && document.body ) {
30.119 + this.context = document;
30.120 + this[0] = document.body;
30.121 + this.selector = selector;
30.122 + this.length = 1;
30.123 + return this;
30.124 + }
30.125 +
30.126 + // Handle HTML strings
30.127 + if ( typeof selector === "string" ) {
30.128 + // Are we dealing with HTML string or an ID?
30.129 + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
30.130 + // Assume that strings that start and end with <> are HTML and skip the regex check
30.131 + match = [ null, selector, null ];
30.132 +
30.133 + } else {
30.134 + match = quickExpr.exec( selector );
30.135 + }
30.136 +
30.137 + // Verify a match, and that no context was specified for #id
30.138 + if ( match && (match[1] || !context) ) {
30.139 +
30.140 + // HANDLE: $(html) -> $(array)
30.141 + if ( match[1] ) {
30.142 + context = context instanceof jQuery ? context[0] : context;
30.143 + doc = ( context ? context.ownerDocument || context : document );
30.144 +
30.145 + // If a single string is passed in and it's a single tag
30.146 + // just do a createElement and skip the rest
30.147 + ret = rsingleTag.exec( selector );
30.148 +
30.149 + if ( ret ) {
30.150 + if ( jQuery.isPlainObject( context ) ) {
30.151 + selector = [ document.createElement( ret[1] ) ];
30.152 + jQuery.fn.attr.call( selector, context, true );
30.153 +
30.154 + } else {
30.155 + selector = [ doc.createElement( ret[1] ) ];
30.156 + }
30.157 +
30.158 + } else {
30.159 + ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
30.160 + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
30.161 + }
30.162 +
30.163 + return jQuery.merge( this, selector );
30.164 +
30.165 + // HANDLE: $("#id")
30.166 + } else {
30.167 + elem = document.getElementById( match[2] );
30.168 +
30.169 + // Check parentNode to catch when Blackberry 4.6 returns
30.170 + // nodes that are no longer in the document #6963
30.171 + if ( elem && elem.parentNode ) {
30.172 + // Handle the case where IE and Opera return items
30.173 + // by name instead of ID
30.174 + if ( elem.id !== match[2] ) {
30.175 + return rootjQuery.find( selector );
30.176 + }
30.177 +
30.178 + // Otherwise, we inject the element directly into the jQuery object
30.179 + this.length = 1;
30.180 + this[0] = elem;
30.181 + }
30.182 +
30.183 + this.context = document;
30.184 + this.selector = selector;
30.185 + return this;
30.186 + }
30.187 +
30.188 + // HANDLE: $(expr, $(...))
30.189 + } else if ( !context || context.jquery ) {
30.190 + return ( context || rootjQuery ).find( selector );
30.191 +
30.192 + // HANDLE: $(expr, context)
30.193 + // (which is just equivalent to: $(context).find(expr)
30.194 + } else {
30.195 + return this.constructor( context ).find( selector );
30.196 + }
30.197 +
30.198 + // HANDLE: $(function)
30.199 + // Shortcut for document ready
30.200 + } else if ( jQuery.isFunction( selector ) ) {
30.201 + return rootjQuery.ready( selector );
30.202 + }
30.203 +
30.204 + if ( selector.selector !== undefined ) {
30.205 + this.selector = selector.selector;
30.206 + this.context = selector.context;
30.207 + }
30.208 +
30.209 + return jQuery.makeArray( selector, this );
30.210 + },
30.211 +
30.212 + // Start with an empty selector
30.213 + selector: "",
30.214 +
30.215 + // The current version of jQuery being used
30.216 + jquery: "1.7.2",
30.217 +
30.218 + // The default length of a jQuery object is 0
30.219 + length: 0,
30.220 +
30.221 + // The number of elements contained in the matched element set
30.222 + size: function() {
30.223 + return this.length;
30.224 + },
30.225 +
30.226 + toArray: function() {
30.227 + return slice.call( this, 0 );
30.228 + },
30.229 +
30.230 + // Get the Nth element in the matched element set OR
30.231 + // Get the whole matched element set as a clean array
30.232 + get: function( num ) {
30.233 + return num == null ?
30.234 +
30.235 + // Return a 'clean' array
30.236 + this.toArray() :
30.237 +
30.238 + // Return just the object
30.239 + ( num < 0 ? this[ this.length + num ] : this[ num ] );
30.240 + },
30.241 +
30.242 + // Take an array of elements and push it onto the stack
30.243 + // (returning the new matched element set)
30.244 + pushStack: function( elems, name, selector ) {
30.245 + // Build a new jQuery matched element set
30.246 + var ret = this.constructor();
30.247 +
30.248 + if ( jQuery.isArray( elems ) ) {
30.249 + push.apply( ret, elems );
30.250 +
30.251 + } else {
30.252 + jQuery.merge( ret, elems );
30.253 + }
30.254 +
30.255 + // Add the old object onto the stack (as a reference)
30.256 + ret.prevObject = this;
30.257 +
30.258 + ret.context = this.context;
30.259 +
30.260 + if ( name === "find" ) {
30.261 + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
30.262 + } else if ( name ) {
30.263 + ret.selector = this.selector + "." + name + "(" + selector + ")";
30.264 + }
30.265 +
30.266 + // Return the newly-formed element set
30.267 + return ret;
30.268 + },
30.269 +
30.270 + // Execute a callback for every element in the matched set.
30.271 + // (You can seed the arguments with an array of args, but this is
30.272 + // only used internally.)
30.273 + each: function( callback, args ) {
30.274 + return jQuery.each( this, callback, args );
30.275 + },
30.276 +
30.277 + ready: function( fn ) {
30.278 + // Attach the listeners
30.279 + jQuery.bindReady();
30.280 +
30.281 + // Add the callback
30.282 + readyList.add( fn );
30.283 +
30.284 + return this;
30.285 + },
30.286 +
30.287 + eq: function( i ) {
30.288 + i = +i;
30.289 + return i === -1 ?
30.290 + this.slice( i ) :
30.291 + this.slice( i, i + 1 );
30.292 + },
30.293 +
30.294 + first: function() {
30.295 + return this.eq( 0 );
30.296 + },
30.297 +
30.298 + last: function() {
30.299 + return this.eq( -1 );
30.300 + },
30.301 +
30.302 + slice: function() {
30.303 + return this.pushStack( slice.apply( this, arguments ),
30.304 + "slice", slice.call(arguments).join(",") );
30.305 + },
30.306 +
30.307 + map: function( callback ) {
30.308 + return this.pushStack( jQuery.map(this, function( elem, i ) {
30.309 + return callback.call( elem, i, elem );
30.310 + }));
30.311 + },
30.312 +
30.313 + end: function() {
30.314 + return this.prevObject || this.constructor(null);
30.315 + },
30.316 +
30.317 + // For internal use only.
30.318 + // Behaves like an Array's method, not like a jQuery method.
30.319 + push: push,
30.320 + sort: [].sort,
30.321 + splice: [].splice
30.322 +};
30.323 +
30.324 +// Give the init function the jQuery prototype for later instantiation
30.325 +jQuery.fn.init.prototype = jQuery.fn;
30.326 +
30.327 +jQuery.extend = jQuery.fn.extend = function() {
30.328 + var options, name, src, copy, copyIsArray, clone,
30.329 + target = arguments[0] || {},
30.330 + i = 1,
30.331 + length = arguments.length,
30.332 + deep = false;
30.333 +
30.334 + // Handle a deep copy situation
30.335 + if ( typeof target === "boolean" ) {
30.336 + deep = target;
30.337 + target = arguments[1] || {};
30.338 + // skip the boolean and the target
30.339 + i = 2;
30.340 + }
30.341 +
30.342 + // Handle case when target is a string or something (possible in deep copy)
30.343 + if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
30.344 + target = {};
30.345 + }
30.346 +
30.347 + // extend jQuery itself if only one argument is passed
30.348 + if ( length === i ) {
30.349 + target = this;
30.350 + --i;
30.351 + }
30.352 +
30.353 + for ( ; i < length; i++ ) {
30.354 + // Only deal with non-null/undefined values
30.355 + if ( (options = arguments[ i ]) != null ) {
30.356 + // Extend the base object
30.357 + for ( name in options ) {
30.358 + src = target[ name ];
30.359 + copy = options[ name ];
30.360 +
30.361 + // Prevent never-ending loop
30.362 + if ( target === copy ) {
30.363 + continue;
30.364 + }
30.365 +
30.366 + // Recurse if we're merging plain objects or arrays
30.367 + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
30.368 + if ( copyIsArray ) {
30.369 + copyIsArray = false;
30.370 + clone = src && jQuery.isArray(src) ? src : [];
30.371 +
30.372 + } else {
30.373 + clone = src && jQuery.isPlainObject(src) ? src : {};
30.374 + }
30.375 +
30.376 + // Never move original objects, clone them
30.377 + target[ name ] = jQuery.extend( deep, clone, copy );
30.378 +
30.379 + // Don't bring in undefined values
30.380 + } else if ( copy !== undefined ) {
30.381 + target[ name ] = copy;
30.382 + }
30.383 + }
30.384 + }
30.385 + }
30.386 +
30.387 + // Return the modified object
30.388 + return target;
30.389 +};
30.390 +
30.391 +jQuery.extend({
30.392 + noConflict: function( deep ) {
30.393 + if ( window.$ === jQuery ) {
30.394 + window.$ = _$;
30.395 + }
30.396 +
30.397 + if ( deep && window.jQuery === jQuery ) {
30.398 + window.jQuery = _jQuery;
30.399 + }
30.400 +
30.401 + return jQuery;
30.402 + },
30.403 +
30.404 + // Is the DOM ready to be used? Set to true once it occurs.
30.405 + isReady: false,
30.406 +
30.407 + // A counter to track how many items to wait for before
30.408 + // the ready event fires. See #6781
30.409 + readyWait: 1,
30.410 +
30.411 + // Hold (or release) the ready event
30.412 + holdReady: function( hold ) {
30.413 + if ( hold ) {
30.414 + jQuery.readyWait++;
30.415 + } else {
30.416 + jQuery.ready( true );
30.417 + }
30.418 + },
30.419 +
30.420 + // Handle when the DOM is ready
30.421 + ready: function( wait ) {
30.422 + // Either a released hold or an DOMready/load event and not yet ready
30.423 + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
30.424 + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
30.425 + if ( !document.body ) {
30.426 + return setTimeout( jQuery.ready, 1 );
30.427 + }
30.428 +
30.429 + // Remember that the DOM is ready
30.430 + jQuery.isReady = true;
30.431 +
30.432 + // If a normal DOM Ready event fired, decrement, and wait if need be
30.433 + if ( wait !== true && --jQuery.readyWait > 0 ) {
30.434 + return;
30.435 + }
30.436 +
30.437 + // If there are functions bound, to execute
30.438 + readyList.fireWith( document, [ jQuery ] );
30.439 +
30.440 + // Trigger any bound ready events
30.441 + if ( jQuery.fn.trigger ) {
30.442 + jQuery( document ).trigger( "ready" ).off( "ready" );
30.443 + }
30.444 + }
30.445 + },
30.446 +
30.447 + bindReady: function() {
30.448 + if ( readyList ) {
30.449 + return;
30.450 + }
30.451 +
30.452 + readyList = jQuery.Callbacks( "once memory" );
30.453 +
30.454 + // Catch cases where $(document).ready() is called after the
30.455 + // browser event has already occurred.
30.456 + if ( document.readyState === "complete" ) {
30.457 + // Handle it asynchronously to allow scripts the opportunity to delay ready
30.458 + return setTimeout( jQuery.ready, 1 );
30.459 + }
30.460 +
30.461 + // Mozilla, Opera and webkit nightlies currently support this event
30.462 + if ( document.addEventListener ) {
30.463 + // Use the handy event callback
30.464 + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
30.465 +
30.466 + // A fallback to window.onload, that will always work
30.467 + window.addEventListener( "load", jQuery.ready, false );
30.468 +
30.469 + // If IE event model is used
30.470 + } else if ( document.attachEvent ) {
30.471 + // ensure firing before onload,
30.472 + // maybe late but safe also for iframes
30.473 + document.attachEvent( "onreadystatechange", DOMContentLoaded );
30.474 +
30.475 + // A fallback to window.onload, that will always work
30.476 + window.attachEvent( "onload", jQuery.ready );
30.477 +
30.478 + // If IE and not a frame
30.479 + // continually check to see if the document is ready
30.480 + var toplevel = false;
30.481 +
30.482 + try {
30.483 + toplevel = window.frameElement == null;
30.484 + } catch(e) {}
30.485 +
30.486 + if ( document.documentElement.doScroll && toplevel ) {
30.487 + doScrollCheck();
30.488 + }
30.489 + }
30.490 + },
30.491 +
30.492 + // See test/unit/core.js for details concerning isFunction.
30.493 + // Since version 1.3, DOM methods and functions like alert
30.494 + // aren't supported. They return false on IE (#2968).
30.495 + isFunction: function( obj ) {
30.496 + return jQuery.type(obj) === "function";
30.497 + },
30.498 +
30.499 + isArray: Array.isArray || function( obj ) {
30.500 + return jQuery.type(obj) === "array";
30.501 + },
30.502 +
30.503 + isWindow: function( obj ) {
30.504 + return obj != null && obj == obj.window;
30.505 + },
30.506 +
30.507 + isNumeric: function( obj ) {
30.508 + return !isNaN( parseFloat(obj) ) && isFinite( obj );
30.509 + },
30.510 +
30.511 + type: function( obj ) {
30.512 + return obj == null ?
30.513 + String( obj ) :
30.514 + class2type[ toString.call(obj) ] || "object";
30.515 + },
30.516 +
30.517 + isPlainObject: function( obj ) {
30.518 + // Must be an Object.
30.519 + // Because of IE, we also have to check the presence of the constructor property.
30.520 + // Make sure that DOM nodes and window objects don't pass through, as well
30.521 + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
30.522 + return false;
30.523 + }
30.524 +
30.525 + try {
30.526 + // Not own constructor property must be Object
30.527 + if ( obj.constructor &&
30.528 + !hasOwn.call(obj, "constructor") &&
30.529 + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
30.530 + return false;
30.531 + }
30.532 + } catch ( e ) {
30.533 + // IE8,9 Will throw exceptions on certain host objects #9897
30.534 + return false;
30.535 + }
30.536 +
30.537 + // Own properties are enumerated firstly, so to speed up,
30.538 + // if last one is own, then all properties are own.
30.539 +
30.540 + var key;
30.541 + for ( key in obj ) {}
30.542 +
30.543 + return key === undefined || hasOwn.call( obj, key );
30.544 + },
30.545 +
30.546 + isEmptyObject: function( obj ) {
30.547 + for ( var name in obj ) {
30.548 + return false;
30.549 + }
30.550 + return true;
30.551 + },
30.552 +
30.553 + error: function( msg ) {
30.554 + throw new Error( msg );
30.555 + },
30.556 +
30.557 + parseJSON: function( data ) {
30.558 + if ( typeof data !== "string" || !data ) {
30.559 + return null;
30.560 + }
30.561 +
30.562 + // Make sure leading/trailing whitespace is removed (IE can't handle it)
30.563 + data = jQuery.trim( data );
30.564 +
30.565 + // Attempt to parse using the native JSON parser first
30.566 + if ( window.JSON && window.JSON.parse ) {
30.567 + return window.JSON.parse( data );
30.568 + }
30.569 +
30.570 + // Make sure the incoming data is actual JSON
30.571 + // Logic borrowed from http://json.org/json2.js
30.572 + if ( rvalidchars.test( data.replace( rvalidescape, "@" )
30.573 + .replace( rvalidtokens, "]" )
30.574 + .replace( rvalidbraces, "")) ) {
30.575 +
30.576 + return ( new Function( "return " + data ) )();
30.577 +
30.578 + }
30.579 + jQuery.error( "Invalid JSON: " + data );
30.580 + },
30.581 +
30.582 + // Cross-browser xml parsing
30.583 + parseXML: function( data ) {
30.584 + if ( typeof data !== "string" || !data ) {
30.585 + return null;
30.586 + }
30.587 + var xml, tmp;
30.588 + try {
30.589 + if ( window.DOMParser ) { // Standard
30.590 + tmp = new DOMParser();
30.591 + xml = tmp.parseFromString( data , "text/xml" );
30.592 + } else { // IE
30.593 + xml = new ActiveXObject( "Microsoft.XMLDOM" );
30.594 + xml.async = "false";
30.595 + xml.loadXML( data );
30.596 + }
30.597 + } catch( e ) {
30.598 + xml = undefined;
30.599 + }
30.600 + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
30.601 + jQuery.error( "Invalid XML: " + data );
30.602 + }
30.603 + return xml;
30.604 + },
30.605 +
30.606 + noop: function() {},
30.607 +
30.608 + // Evaluates a script in a global context
30.609 + // Workarounds based on findings by Jim Driscoll
30.610 + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
30.611 + globalEval: function( data ) {
30.612 + if ( data && rnotwhite.test( data ) ) {
30.613 + // We use execScript on Internet Explorer
30.614 + // We use an anonymous function so that context is window
30.615 + // rather than jQuery in Firefox
30.616 + ( window.execScript || function( data ) {
30.617 + window[ "eval" ].call( window, data );
30.618 + } )( data );
30.619 + }
30.620 + },
30.621 +
30.622 + // Convert dashed to camelCase; used by the css and data modules
30.623 + // Microsoft forgot to hump their vendor prefix (#9572)
30.624 + camelCase: function( string ) {
30.625 + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
30.626 + },
30.627 +
30.628 + nodeName: function( elem, name ) {
30.629 + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
30.630 + },
30.631 +
30.632 + // args is for internal usage only
30.633 + each: function( object, callback, args ) {
30.634 + var name, i = 0,
30.635 + length = object.length,
30.636 + isObj = length === undefined || jQuery.isFunction( object );
30.637 +
30.638 + if ( args ) {
30.639 + if ( isObj ) {
30.640 + for ( name in object ) {
30.641 + if ( callback.apply( object[ name ], args ) === false ) {
30.642 + break;
30.643 + }
30.644 + }
30.645 + } else {
30.646 + for ( ; i < length; ) {
30.647 + if ( callback.apply( object[ i++ ], args ) === false ) {
30.648 + break;
30.649 + }
30.650 + }
30.651 + }
30.652 +
30.653 + // A special, fast, case for the most common use of each
30.654 + } else {
30.655 + if ( isObj ) {
30.656 + for ( name in object ) {
30.657 + if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
30.658 + break;
30.659 + }
30.660 + }
30.661 + } else {
30.662 + for ( ; i < length; ) {
30.663 + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
30.664 + break;
30.665 + }
30.666 + }
30.667 + }
30.668 + }
30.669 +
30.670 + return object;
30.671 + },
30.672 +
30.673 + // Use native String.trim function wherever possible
30.674 + trim: trim ?
30.675 + function( text ) {
30.676 + return text == null ?
30.677 + "" :
30.678 + trim.call( text );
30.679 + } :
30.680 +
30.681 + // Otherwise use our own trimming functionality
30.682 + function( text ) {
30.683 + return text == null ?
30.684 + "" :
30.685 + text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
30.686 + },
30.687 +
30.688 + // results is for internal usage only
30.689 + makeArray: function( array, results ) {
30.690 + var ret = results || [];
30.691 +
30.692 + if ( array != null ) {
30.693 + // The window, strings (and functions) also have 'length'
30.694 + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
30.695 + var type = jQuery.type( array );
30.696 +
30.697 + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
30.698 + push.call( ret, array );
30.699 + } else {
30.700 + jQuery.merge( ret, array );
30.701 + }
30.702 + }
30.703 +
30.704 + return ret;
30.705 + },
30.706 +
30.707 + inArray: function( elem, array, i ) {
30.708 + var len;
30.709 +
30.710 + if ( array ) {
30.711 + if ( indexOf ) {
30.712 + return indexOf.call( array, elem, i );
30.713 + }
30.714 +
30.715 + len = array.length;
30.716 + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
30.717 +
30.718 + for ( ; i < len; i++ ) {
30.719 + // Skip accessing in sparse arrays
30.720 + if ( i in array && array[ i ] === elem ) {
30.721 + return i;
30.722 + }
30.723 + }
30.724 + }
30.725 +
30.726 + return -1;
30.727 + },
30.728 +
30.729 + merge: function( first, second ) {
30.730 + var i = first.length,
30.731 + j = 0;
30.732 +
30.733 + if ( typeof second.length === "number" ) {
30.734 + for ( var l = second.length; j < l; j++ ) {
30.735 + first[ i++ ] = second[ j ];
30.736 + }
30.737 +
30.738 + } else {
30.739 + while ( second[j] !== undefined ) {
30.740 + first[ i++ ] = second[ j++ ];
30.741 + }
30.742 + }
30.743 +
30.744 + first.length = i;
30.745 +
30.746 + return first;
30.747 + },
30.748 +
30.749 + grep: function( elems, callback, inv ) {
30.750 + var ret = [], retVal;
30.751 + inv = !!inv;
30.752 +
30.753 + // Go through the array, only saving the items
30.754 + // that pass the validator function
30.755 + for ( var i = 0, length = elems.length; i < length; i++ ) {
30.756 + retVal = !!callback( elems[ i ], i );
30.757 + if ( inv !== retVal ) {
30.758 + ret.push( elems[ i ] );
30.759 + }
30.760 + }
30.761 +
30.762 + return ret;
30.763 + },
30.764 +
30.765 + // arg is for internal usage only
30.766 + map: function( elems, callback, arg ) {
30.767 + var value, key, ret = [],
30.768 + i = 0,
30.769 + length = elems.length,
30.770 + // jquery objects are treated as arrays
30.771 + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
30.772 +
30.773 + // Go through the array, translating each of the items to their
30.774 + if ( isArray ) {
30.775 + for ( ; i < length; i++ ) {
30.776 + value = callback( elems[ i ], i, arg );
30.777 +
30.778 + if ( value != null ) {
30.779 + ret[ ret.length ] = value;
30.780 + }
30.781 + }
30.782 +
30.783 + // Go through every key on the object,
30.784 + } else {
30.785 + for ( key in elems ) {
30.786 + value = callback( elems[ key ], key, arg );
30.787 +
30.788 + if ( value != null ) {
30.789 + ret[ ret.length ] = value;
30.790 + }
30.791 + }
30.792 + }
30.793 +
30.794 + // Flatten any nested arrays
30.795 + return ret.concat.apply( [], ret );
30.796 + },
30.797 +
30.798 + // A global GUID counter for objects
30.799 + guid: 1,
30.800 +
30.801 + // Bind a function to a context, optionally partially applying any
30.802 + // arguments.
30.803 + proxy: function( fn, context ) {
30.804 + if ( typeof context === "string" ) {
30.805 + var tmp = fn[ context ];
30.806 + context = fn;
30.807 + fn = tmp;
30.808 + }
30.809 +
30.810 + // Quick check to determine if target is callable, in the spec
30.811 + // this throws a TypeError, but we will just return undefined.
30.812 + if ( !jQuery.isFunction( fn ) ) {
30.813 + return undefined;
30.814 + }
30.815 +
30.816 + // Simulated bind
30.817 + var args = slice.call( arguments, 2 ),
30.818 + proxy = function() {
30.819 + return fn.apply( context, args.concat( slice.call( arguments ) ) );
30.820 + };
30.821 +
30.822 + // Set the guid of unique handler to the same of original handler, so it can be removed
30.823 + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
30.824 +
30.825 + return proxy;
30.826 + },
30.827 +
30.828 + // Mutifunctional method to get and set values to a collection
30.829 + // The value/s can optionally be executed if it's a function
30.830 + access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
30.831 + var exec,
30.832 + bulk = key == null,
30.833 + i = 0,
30.834 + length = elems.length;
30.835 +
30.836 + // Sets many values
30.837 + if ( key && typeof key === "object" ) {
30.838 + for ( i in key ) {
30.839 + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
30.840 + }
30.841 + chainable = 1;
30.842 +
30.843 + // Sets one value
30.844 + } else if ( value !== undefined ) {
30.845 + // Optionally, function values get executed if exec is true
30.846 + exec = pass === undefined && jQuery.isFunction( value );
30.847 +
30.848 + if ( bulk ) {
30.849 + // Bulk operations only iterate when executing function values
30.850 + if ( exec ) {
30.851 + exec = fn;
30.852 + fn = function( elem, key, value ) {
30.853 + return exec.call( jQuery( elem ), value );
30.854 + };
30.855 +
30.856 + // Otherwise they run against the entire set
30.857 + } else {
30.858 + fn.call( elems, value );
30.859 + fn = null;
30.860 + }
30.861 + }
30.862 +
30.863 + if ( fn ) {
30.864 + for (; i < length; i++ ) {
30.865 + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
30.866 + }
30.867 + }
30.868 +
30.869 + chainable = 1;
30.870 + }
30.871 +
30.872 + return chainable ?
30.873 + elems :
30.874 +
30.875 + // Gets
30.876 + bulk ?
30.877 + fn.call( elems ) :
30.878 + length ? fn( elems[0], key ) : emptyGet;
30.879 + },
30.880 +
30.881 + now: function() {
30.882 + return ( new Date() ).getTime();
30.883 + },
30.884 +
30.885 + // Use of jQuery.browser is frowned upon.
30.886 + // More details: http://docs.jquery.com/Utilities/jQuery.browser
30.887 + uaMatch: function( ua ) {
30.888 + ua = ua.toLowerCase();
30.889 +
30.890 + var match = rwebkit.exec( ua ) ||
30.891 + ropera.exec( ua ) ||
30.892 + rmsie.exec( ua ) ||
30.893 + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
30.894 + [];
30.895 +
30.896 + return { browser: match[1] || "", version: match[2] || "0" };
30.897 + },
30.898 +
30.899 + sub: function() {
30.900 + function jQuerySub( selector, context ) {
30.901 + return new jQuerySub.fn.init( selector, context );
30.902 + }
30.903 + jQuery.extend( true, jQuerySub, this );
30.904 + jQuerySub.superclass = this;
30.905 + jQuerySub.fn = jQuerySub.prototype = this();
30.906 + jQuerySub.fn.constructor = jQuerySub;
30.907 + jQuerySub.sub = this.sub;
30.908 + jQuerySub.fn.init = function init( selector, context ) {
30.909 + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
30.910 + context = jQuerySub( context );
30.911 + }
30.912 +
30.913 + return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
30.914 + };
30.915 + jQuerySub.fn.init.prototype = jQuerySub.fn;
30.916 + var rootjQuerySub = jQuerySub(document);
30.917 + return jQuerySub;
30.918 + },
30.919 +
30.920 + browser: {}
30.921 +});
30.922 +
30.923 +// Populate the class2type map
30.924 +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
30.925 + class2type[ "[object " + name + "]" ] = name.toLowerCase();
30.926 +});
30.927 +
30.928 +browserMatch = jQuery.uaMatch( userAgent );
30.929 +if ( browserMatch.browser ) {
30.930 + jQuery.browser[ browserMatch.browser ] = true;
30.931 + jQuery.browser.version = browserMatch.version;
30.932 +}
30.933 +
30.934 +// Deprecated, use jQuery.browser.webkit instead
30.935 +if ( jQuery.browser.webkit ) {
30.936 + jQuery.browser.safari = true;
30.937 +}
30.938 +
30.939 +// IE doesn't match non-breaking spaces with \s
30.940 +if ( rnotwhite.test( "\xA0" ) ) {
30.941 + trimLeft = /^[\s\xA0]+/;
30.942 + trimRight = /[\s\xA0]+$/;
30.943 +}
30.944 +
30.945 +// All jQuery objects should point back to these
30.946 +rootjQuery = jQuery(document);
30.947 +
30.948 +// Cleanup functions for the document ready method
30.949 +if ( document.addEventListener ) {
30.950 + DOMContentLoaded = function() {
30.951 + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
30.952 + jQuery.ready();
30.953 + };
30.954 +
30.955 +} else if ( document.attachEvent ) {
30.956 + DOMContentLoaded = function() {
30.957 + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
30.958 + if ( document.readyState === "complete" ) {
30.959 + document.detachEvent( "onreadystatechange", DOMContentLoaded );
30.960 + jQuery.ready();
30.961 + }
30.962 + };
30.963 +}
30.964 +
30.965 +// The DOM ready check for Internet Explorer
30.966 +function doScrollCheck() {
30.967 + if ( jQuery.isReady ) {
30.968 + return;
30.969 + }
30.970 +
30.971 + try {
30.972 + // If IE is used, use the trick by Diego Perini
30.973 + // http://javascript.nwbox.com/IEContentLoaded/
30.974 + document.documentElement.doScroll("left");
30.975 + } catch(e) {
30.976 + setTimeout( doScrollCheck, 1 );
30.977 + return;
30.978 + }
30.979 +
30.980 + // and execute any waiting functions
30.981 + jQuery.ready();
30.982 +}
30.983 +
30.984 +return jQuery;
30.985 +
30.986 +})();
30.987 +
30.988 +
30.989 +// String to Object flags format cache
30.990 +var flagsCache = {};
30.991 +
30.992 +// Convert String-formatted flags into Object-formatted ones and store in cache
30.993 +function createFlags( flags ) {
30.994 + var object = flagsCache[ flags ] = {},
30.995 + i, length;
30.996 + flags = flags.split( /\s+/ );
30.997 + for ( i = 0, length = flags.length; i < length; i++ ) {
30.998 + object[ flags[i] ] = true;
30.999 + }
30.1000 + return object;
30.1001 +}
30.1002 +
30.1003 +/*
30.1004 + * Create a callback list using the following parameters:
30.1005 + *
30.1006 + * flags: an optional list of space-separated flags that will change how
30.1007 + * the callback list behaves
30.1008 + *
30.1009 + * By default a callback list will act like an event callback list and can be
30.1010 + * "fired" multiple times.
30.1011 + *
30.1012 + * Possible flags:
30.1013 + *
30.1014 + * once: will ensure the callback list can only be fired once (like a Deferred)
30.1015 + *
30.1016 + * memory: will keep track of previous values and will call any callback added
30.1017 + * after the list has been fired right away with the latest "memorized"
30.1018 + * values (like a Deferred)
30.1019 + *
30.1020 + * unique: will ensure a callback can only be added once (no duplicate in the list)
30.1021 + *
30.1022 + * stopOnFalse: interrupt callings when a callback returns false
30.1023 + *
30.1024 + */
30.1025 +jQuery.Callbacks = function( flags ) {
30.1026 +
30.1027 + // Convert flags from String-formatted to Object-formatted
30.1028 + // (we check in cache first)
30.1029 + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
30.1030 +
30.1031 + var // Actual callback list
30.1032 + list = [],
30.1033 + // Stack of fire calls for repeatable lists
30.1034 + stack = [],
30.1035 + // Last fire value (for non-forgettable lists)
30.1036 + memory,
30.1037 + // Flag to know if list was already fired
30.1038 + fired,
30.1039 + // Flag to know if list is currently firing
30.1040 + firing,
30.1041 + // First callback to fire (used internally by add and fireWith)
30.1042 + firingStart,
30.1043 + // End of the loop when firing
30.1044 + firingLength,
30.1045 + // Index of currently firing callback (modified by remove if needed)
30.1046 + firingIndex,
30.1047 + // Add one or several callbacks to the list
30.1048 + add = function( args ) {
30.1049 + var i,
30.1050 + length,
30.1051 + elem,
30.1052 + type,
30.1053 + actual;
30.1054 + for ( i = 0, length = args.length; i < length; i++ ) {
30.1055 + elem = args[ i ];
30.1056 + type = jQuery.type( elem );
30.1057 + if ( type === "array" ) {
30.1058 + // Inspect recursively
30.1059 + add( elem );
30.1060 + } else if ( type === "function" ) {
30.1061 + // Add if not in unique mode and callback is not in
30.1062 + if ( !flags.unique || !self.has( elem ) ) {
30.1063 + list.push( elem );
30.1064 + }
30.1065 + }
30.1066 + }
30.1067 + },
30.1068 + // Fire callbacks
30.1069 + fire = function( context, args ) {
30.1070 + args = args || [];
30.1071 + memory = !flags.memory || [ context, args ];
30.1072 + fired = true;
30.1073 + firing = true;
30.1074 + firingIndex = firingStart || 0;
30.1075 + firingStart = 0;
30.1076 + firingLength = list.length;
30.1077 + for ( ; list && firingIndex < firingLength; firingIndex++ ) {
30.1078 + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
30.1079 + memory = true; // Mark as halted
30.1080 + break;
30.1081 + }
30.1082 + }
30.1083 + firing = false;
30.1084 + if ( list ) {
30.1085 + if ( !flags.once ) {
30.1086 + if ( stack && stack.length ) {
30.1087 + memory = stack.shift();
30.1088 + self.fireWith( memory[ 0 ], memory[ 1 ] );
30.1089 + }
30.1090 + } else if ( memory === true ) {
30.1091 + self.disable();
30.1092 + } else {
30.1093 + list = [];
30.1094 + }
30.1095 + }
30.1096 + },
30.1097 + // Actual Callbacks object
30.1098 + self = {
30.1099 + // Add a callback or a collection of callbacks to the list
30.1100 + add: function() {
30.1101 + if ( list ) {
30.1102 + var length = list.length;
30.1103 + add( arguments );
30.1104 + // Do we need to add the callbacks to the
30.1105 + // current firing batch?
30.1106 + if ( firing ) {
30.1107 + firingLength = list.length;
30.1108 + // With memory, if we're not firing then
30.1109 + // we should call right away, unless previous
30.1110 + // firing was halted (stopOnFalse)
30.1111 + } else if ( memory && memory !== true ) {
30.1112 + firingStart = length;
30.1113 + fire( memory[ 0 ], memory[ 1 ] );
30.1114 + }
30.1115 + }
30.1116 + return this;
30.1117 + },
30.1118 + // Remove a callback from the list
30.1119 + remove: function() {
30.1120 + if ( list ) {
30.1121 + var args = arguments,
30.1122 + argIndex = 0,
30.1123 + argLength = args.length;
30.1124 + for ( ; argIndex < argLength ; argIndex++ ) {
30.1125 + for ( var i = 0; i < list.length; i++ ) {
30.1126 + if ( args[ argIndex ] === list[ i ] ) {
30.1127 + // Handle firingIndex and firingLength
30.1128 + if ( firing ) {
30.1129 + if ( i <= firingLength ) {
30.1130 + firingLength--;
30.1131 + if ( i <= firingIndex ) {
30.1132 + firingIndex--;
30.1133 + }
30.1134 + }
30.1135 + }
30.1136 + // Remove the element
30.1137 + list.splice( i--, 1 );
30.1138 + // If we have some unicity property then
30.1139 + // we only need to do this once
30.1140 + if ( flags.unique ) {
30.1141 + break;
30.1142 + }
30.1143 + }
30.1144 + }
30.1145 + }
30.1146 + }
30.1147 + return this;
30.1148 + },
30.1149 + // Control if a given callback is in the list
30.1150 + has: function( fn ) {
30.1151 + if ( list ) {
30.1152 + var i = 0,
30.1153 + length = list.length;
30.1154 + for ( ; i < length; i++ ) {
30.1155 + if ( fn === list[ i ] ) {
30.1156 + return true;
30.1157 + }
30.1158 + }
30.1159 + }
30.1160 + return false;
30.1161 + },
30.1162 + // Remove all callbacks from the list
30.1163 + empty: function() {
30.1164 + list = [];
30.1165 + return this;
30.1166 + },
30.1167 + // Have the list do nothing anymore
30.1168 + disable: function() {
30.1169 + list = stack = memory = undefined;
30.1170 + return this;
30.1171 + },
30.1172 + // Is it disabled?
30.1173 + disabled: function() {
30.1174 + return !list;
30.1175 + },
30.1176 + // Lock the list in its current state
30.1177 + lock: function() {
30.1178 + stack = undefined;
30.1179 + if ( !memory || memory === true ) {
30.1180 + self.disable();
30.1181 + }
30.1182 + return this;
30.1183 + },
30.1184 + // Is it locked?
30.1185 + locked: function() {
30.1186 + return !stack;
30.1187 + },
30.1188 + // Call all callbacks with the given context and arguments
30.1189 + fireWith: function( context, args ) {
30.1190 + if ( stack ) {
30.1191 + if ( firing ) {
30.1192 + if ( !flags.once ) {
30.1193 + stack.push( [ context, args ] );
30.1194 + }
30.1195 + } else if ( !( flags.once && memory ) ) {
30.1196 + fire( context, args );
30.1197 + }
30.1198 + }
30.1199 + return this;
30.1200 + },
30.1201 + // Call all the callbacks with the given arguments
30.1202 + fire: function() {
30.1203 + self.fireWith( this, arguments );
30.1204 + return this;
30.1205 + },
30.1206 + // To know if the callbacks have already been called at least once
30.1207 + fired: function() {
30.1208 + return !!fired;
30.1209 + }
30.1210 + };
30.1211 +
30.1212 + return self;
30.1213 +};
30.1214 +
30.1215 +
30.1216 +
30.1217 +
30.1218 +var // Static reference to slice
30.1219 + sliceDeferred = [].slice;
30.1220 +
30.1221 +jQuery.extend({
30.1222 +
30.1223 + Deferred: function( func ) {
30.1224 + var doneList = jQuery.Callbacks( "once memory" ),
30.1225 + failList = jQuery.Callbacks( "once memory" ),
30.1226 + progressList = jQuery.Callbacks( "memory" ),
30.1227 + state = "pending",
30.1228 + lists = {
30.1229 + resolve: doneList,
30.1230 + reject: failList,
30.1231 + notify: progressList
30.1232 + },
30.1233 + promise = {
30.1234 + done: doneList.add,
30.1235 + fail: failList.add,
30.1236 + progress: progressList.add,
30.1237 +
30.1238 + state: function() {
30.1239 + return state;
30.1240 + },
30.1241 +
30.1242 + // Deprecated
30.1243 + isResolved: doneList.fired,
30.1244 + isRejected: failList.fired,
30.1245 +
30.1246 + then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
30.1247 + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
30.1248 + return this;
30.1249 + },
30.1250 + always: function() {
30.1251 + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
30.1252 + return this;
30.1253 + },
30.1254 + pipe: function( fnDone, fnFail, fnProgress ) {
30.1255 + return jQuery.Deferred(function( newDefer ) {
30.1256 + jQuery.each( {
30.1257 + done: [ fnDone, "resolve" ],
30.1258 + fail: [ fnFail, "reject" ],
30.1259 + progress: [ fnProgress, "notify" ]
30.1260 + }, function( handler, data ) {
30.1261 + var fn = data[ 0 ],
30.1262 + action = data[ 1 ],
30.1263 + returned;
30.1264 + if ( jQuery.isFunction( fn ) ) {
30.1265 + deferred[ handler ](function() {
30.1266 + returned = fn.apply( this, arguments );
30.1267 + if ( returned && jQuery.isFunction( returned.promise ) ) {
30.1268 + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
30.1269 + } else {
30.1270 + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
30.1271 + }
30.1272 + });
30.1273 + } else {
30.1274 + deferred[ handler ]( newDefer[ action ] );
30.1275 + }
30.1276 + });
30.1277 + }).promise();
30.1278 + },
30.1279 + // Get a promise for this deferred
30.1280 + // If obj is provided, the promise aspect is added to the object
30.1281 + promise: function( obj ) {
30.1282 + if ( obj == null ) {
30.1283 + obj = promise;
30.1284 + } else {
30.1285 + for ( var key in promise ) {
30.1286 + obj[ key ] = promise[ key ];
30.1287 + }
30.1288 + }
30.1289 + return obj;
30.1290 + }
30.1291 + },
30.1292 + deferred = promise.promise({}),
30.1293 + key;
30.1294 +
30.1295 + for ( key in lists ) {
30.1296 + deferred[ key ] = lists[ key ].fire;
30.1297 + deferred[ key + "With" ] = lists[ key ].fireWith;
30.1298 + }
30.1299 +
30.1300 + // Handle state
30.1301 + deferred.done( function() {
30.1302 + state = "resolved";
30.1303 + }, failList.disable, progressList.lock ).fail( function() {
30.1304 + state = "rejected";
30.1305 + }, doneList.disable, progressList.lock );
30.1306 +
30.1307 + // Call given func if any
30.1308 + if ( func ) {
30.1309 + func.call( deferred, deferred );
30.1310 + }
30.1311 +
30.1312 + // All done!
30.1313 + return deferred;
30.1314 + },
30.1315 +
30.1316 + // Deferred helper
30.1317 + when: function( firstParam ) {
30.1318 + var args = sliceDeferred.call( arguments, 0 ),
30.1319 + i = 0,
30.1320 + length = args.length,
30.1321 + pValues = new Array( length ),
30.1322 + count = length,
30.1323 + pCount = length,
30.1324 + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
30.1325 + firstParam :
30.1326 + jQuery.Deferred(),
30.1327 + promise = deferred.promise();
30.1328 + function resolveFunc( i ) {
30.1329 + return function( value ) {
30.1330 + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
30.1331 + if ( !( --count ) ) {
30.1332 + deferred.resolveWith( deferred, args );
30.1333 + }
30.1334 + };
30.1335 + }
30.1336 + function progressFunc( i ) {
30.1337 + return function( value ) {
30.1338 + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
30.1339 + deferred.notifyWith( promise, pValues );
30.1340 + };
30.1341 + }
30.1342 + if ( length > 1 ) {
30.1343 + for ( ; i < length; i++ ) {
30.1344 + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
30.1345 + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
30.1346 + } else {
30.1347 + --count;
30.1348 + }
30.1349 + }
30.1350 + if ( !count ) {
30.1351 + deferred.resolveWith( deferred, args );
30.1352 + }
30.1353 + } else if ( deferred !== firstParam ) {
30.1354 + deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
30.1355 + }
30.1356 + return promise;
30.1357 + }
30.1358 +});
30.1359 +
30.1360 +
30.1361 +
30.1362 +
30.1363 +jQuery.support = (function() {
30.1364 +
30.1365 + var support,
30.1366 + all,
30.1367 + a,
30.1368 + select,
30.1369 + opt,
30.1370 + input,
30.1371 + fragment,
30.1372 + tds,
30.1373 + events,
30.1374 + eventName,
30.1375 + i,
30.1376 + isSupported,
30.1377 + div = document.createElement( "div" ),
30.1378 + documentElement = document.documentElement;
30.1379 +
30.1380 + // Preliminary tests
30.1381 + div.setAttribute("className", "t");
30.1382 + div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
30.1383 +
30.1384 + all = div.getElementsByTagName( "*" );
30.1385 + a = div.getElementsByTagName( "a" )[ 0 ];
30.1386 +
30.1387 + // Can't get basic test support
30.1388 + if ( !all || !all.length || !a ) {
30.1389 + return {};
30.1390 + }
30.1391 +
30.1392 + // First batch of supports tests
30.1393 + select = document.createElement( "select" );
30.1394 + opt = select.appendChild( document.createElement("option") );
30.1395 + input = div.getElementsByTagName( "input" )[ 0 ];
30.1396 +
30.1397 + support = {
30.1398 + // IE strips leading whitespace when .innerHTML is used
30.1399 + leadingWhitespace: ( div.firstChild.nodeType === 3 ),
30.1400 +
30.1401 + // Make sure that tbody elements aren't automatically inserted
30.1402 + // IE will insert them into empty tables
30.1403 + tbody: !div.getElementsByTagName("tbody").length,
30.1404 +
30.1405 + // Make sure that link elements get serialized correctly by innerHTML
30.1406 + // This requires a wrapper element in IE
30.1407 + htmlSerialize: !!div.getElementsByTagName("link").length,
30.1408 +
30.1409 + // Get the style information from getAttribute
30.1410 + // (IE uses .cssText instead)
30.1411 + style: /top/.test( a.getAttribute("style") ),
30.1412 +
30.1413 + // Make sure that URLs aren't manipulated
30.1414 + // (IE normalizes it by default)
30.1415 + hrefNormalized: ( a.getAttribute("href") === "/a" ),
30.1416 +
30.1417 + // Make sure that element opacity exists
30.1418 + // (IE uses filter instead)
30.1419 + // Use a regex to work around a WebKit issue. See #5145
30.1420 + opacity: /^0.55/.test( a.style.opacity ),
30.1421 +
30.1422 + // Verify style float existence
30.1423 + // (IE uses styleFloat instead of cssFloat)
30.1424 + cssFloat: !!a.style.cssFloat,
30.1425 +
30.1426 + // Make sure that if no value is specified for a checkbox
30.1427 + // that it defaults to "on".
30.1428 + // (WebKit defaults to "" instead)
30.1429 + checkOn: ( input.value === "on" ),
30.1430 +
30.1431 + // Make sure that a selected-by-default option has a working selected property.
30.1432 + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
30.1433 + optSelected: opt.selected,
30.1434 +
30.1435 + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
30.1436 + getSetAttribute: div.className !== "t",
30.1437 +
30.1438 + // Tests for enctype support on a form(#6743)
30.1439 + enctype: !!document.createElement("form").enctype,
30.1440 +
30.1441 + // Makes sure cloning an html5 element does not cause problems
30.1442 + // Where outerHTML is undefined, this still works
30.1443 + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
30.1444 +
30.1445 + // Will be defined later
30.1446 + submitBubbles: true,
30.1447 + changeBubbles: true,
30.1448 + focusinBubbles: false,
30.1449 + deleteExpando: true,
30.1450 + noCloneEvent: true,
30.1451 + inlineBlockNeedsLayout: false,
30.1452 + shrinkWrapBlocks: false,
30.1453 + reliableMarginRight: true,
30.1454 + pixelMargin: true
30.1455 + };
30.1456 +
30.1457 + // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
30.1458 + jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
30.1459 +
30.1460 + // Make sure checked status is properly cloned
30.1461 + input.checked = true;
30.1462 + support.noCloneChecked = input.cloneNode( true ).checked;
30.1463 +
30.1464 + // Make sure that the options inside disabled selects aren't marked as disabled
30.1465 + // (WebKit marks them as disabled)
30.1466 + select.disabled = true;
30.1467 + support.optDisabled = !opt.disabled;
30.1468 +
30.1469 + // Test to see if it's possible to delete an expando from an element
30.1470 + // Fails in Internet Explorer
30.1471 + try {
30.1472 + delete div.test;
30.1473 + } catch( e ) {
30.1474 + support.deleteExpando = false;
30.1475 + }
30.1476 +
30.1477 + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
30.1478 + div.attachEvent( "onclick", function() {
30.1479 + // Cloning a node shouldn't copy over any
30.1480 + // bound event handlers (IE does this)
30.1481 + support.noCloneEvent = false;
30.1482 + });
30.1483 + div.cloneNode( true ).fireEvent( "onclick" );
30.1484 + }
30.1485 +
30.1486 + // Check if a radio maintains its value
30.1487 + // after being appended to the DOM
30.1488 + input = document.createElement("input");
30.1489 + input.value = "t";
30.1490 + input.setAttribute("type", "radio");
30.1491 + support.radioValue = input.value === "t";
30.1492 +
30.1493 + input.setAttribute("checked", "checked");
30.1494 +
30.1495 + // #11217 - WebKit loses check when the name is after the checked attribute
30.1496 + input.setAttribute( "name", "t" );
30.1497 +
30.1498 + div.appendChild( input );
30.1499 + fragment = document.createDocumentFragment();
30.1500 + fragment.appendChild( div.lastChild );
30.1501 +
30.1502 + // WebKit doesn't clone checked state correctly in fragments
30.1503 + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
30.1504 +
30.1505 + // Check if a disconnected checkbox will retain its checked
30.1506 + // value of true after appended to the DOM (IE6/7)
30.1507 + support.appendChecked = input.checked;
30.1508 +
30.1509 + fragment.removeChild( input );
30.1510 + fragment.appendChild( div );
30.1511 +
30.1512 + // Technique from Juriy Zaytsev
30.1513 + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
30.1514 + // We only care about the case where non-standard event systems
30.1515 + // are used, namely in IE. Short-circuiting here helps us to
30.1516 + // avoid an eval call (in setAttribute) which can cause CSP
30.1517 + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
30.1518 + if ( div.attachEvent ) {
30.1519 + for ( i in {
30.1520 + submit: 1,
30.1521 + change: 1,
30.1522 + focusin: 1
30.1523 + }) {
30.1524 + eventName = "on" + i;
30.1525 + isSupported = ( eventName in div );
30.1526 + if ( !isSupported ) {
30.1527 + div.setAttribute( eventName, "return;" );
30.1528 + isSupported = ( typeof div[ eventName ] === "function" );
30.1529 + }
30.1530 + support[ i + "Bubbles" ] = isSupported;
30.1531 + }
30.1532 + }
30.1533 +
30.1534 + fragment.removeChild( div );
30.1535 +
30.1536 + // Null elements to avoid leaks in IE
30.1537 + fragment = select = opt = div = input = null;
30.1538 +
30.1539 + // Run tests that need a body at doc ready
30.1540 + jQuery(function() {
30.1541 + var container, outer, inner, table, td, offsetSupport,
30.1542 + marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
30.1543 + paddingMarginBorderVisibility, paddingMarginBorder,
30.1544 + body = document.getElementsByTagName("body")[0];
30.1545 +
30.1546 + if ( !body ) {
30.1547 + // Return for frameset docs that don't have a body
30.1548 + return;
30.1549 + }
30.1550 +
30.1551 + conMarginTop = 1;
30.1552 + paddingMarginBorder = "padding:0;margin:0;border:";
30.1553 + positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
30.1554 + paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
30.1555 + style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
30.1556 + html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
30.1557 + "<table " + style + "' cellpadding='0' cellspacing='0'>" +
30.1558 + "<tr><td></td></tr></table>";
30.1559 +
30.1560 + container = document.createElement("div");
30.1561 + container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
30.1562 + body.insertBefore( container, body.firstChild );
30.1563 +
30.1564 + // Construct the test element
30.1565 + div = document.createElement("div");
30.1566 + container.appendChild( div );
30.1567 +
30.1568 + // Check if table cells still have offsetWidth/Height when they are set
30.1569 + // to display:none and there are still other visible table cells in a
30.1570 + // table row; if so, offsetWidth/Height are not reliable for use when
30.1571 + // determining if an element has been hidden directly using
30.1572 + // display:none (it is still safe to use offsets if a parent element is
30.1573 + // hidden; don safety goggles and see bug #4512 for more information).
30.1574 + // (only IE 8 fails this test)
30.1575 + div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
30.1576 + tds = div.getElementsByTagName( "td" );
30.1577 + isSupported = ( tds[ 0 ].offsetHeight === 0 );
30.1578 +
30.1579 + tds[ 0 ].style.display = "";
30.1580 + tds[ 1 ].style.display = "none";
30.1581 +
30.1582 + // Check if empty table cells still have offsetWidth/Height
30.1583 + // (IE <= 8 fail this test)
30.1584 + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
30.1585 +
30.1586 + // Check if div with explicit width and no margin-right incorrectly
30.1587 + // gets computed margin-right based on width of container. For more
30.1588 + // info see bug #3333
30.1589 + // Fails in WebKit before Feb 2011 nightlies
30.1590 + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
30.1591 + if ( window.getComputedStyle ) {
30.1592 + div.innerHTML = "";
30.1593 + marginDiv = document.createElement( "div" );
30.1594 + marginDiv.style.width = "0";
30.1595 + marginDiv.style.marginRight = "0";
30.1596 + div.style.width = "2px";
30.1597 + div.appendChild( marginDiv );
30.1598 + support.reliableMarginRight =
30.1599 + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
30.1600 + }
30.1601 +
30.1602 + if ( typeof div.style.zoom !== "undefined" ) {
30.1603 + // Check if natively block-level elements act like inline-block
30.1604 + // elements when setting their display to 'inline' and giving
30.1605 + // them layout
30.1606 + // (IE < 8 does this)
30.1607 + div.innerHTML = "";
30.1608 + div.style.width = div.style.padding = "1px";
30.1609 + div.style.border = 0;
30.1610 + div.style.overflow = "hidden";
30.1611 + div.style.display = "inline";
30.1612 + div.style.zoom = 1;
30.1613 + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
30.1614 +
30.1615 + // Check if elements with layout shrink-wrap their children
30.1616 + // (IE 6 does this)
30.1617 + div.style.display = "block";
30.1618 + div.style.overflow = "visible";
30.1619 + div.innerHTML = "<div style='width:5px;'></div>";
30.1620 + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
30.1621 + }
30.1622 +
30.1623 + div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
30.1624 + div.innerHTML = html;
30.1625 +
30.1626 + outer = div.firstChild;
30.1627 + inner = outer.firstChild;
30.1628 + td = outer.nextSibling.firstChild.firstChild;
30.1629 +
30.1630 + offsetSupport = {
30.1631 + doesNotAddBorder: ( inner.offsetTop !== 5 ),
30.1632 + doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
30.1633 + };
30.1634 +
30.1635 + inner.style.position = "fixed";
30.1636 + inner.style.top = "20px";
30.1637 +
30.1638 + // safari subtracts parent border width here which is 5px
30.1639 + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
30.1640 + inner.style.position = inner.style.top = "";
30.1641 +
30.1642 + outer.style.overflow = "hidden";
30.1643 + outer.style.position = "relative";
30.1644 +
30.1645 + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
30.1646 + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
30.1647 +
30.1648 + if ( window.getComputedStyle ) {
30.1649 + div.style.marginTop = "1%";
30.1650 + support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
30.1651 + }
30.1652 +
30.1653 + if ( typeof container.style.zoom !== "undefined" ) {
30.1654 + container.style.zoom = 1;
30.1655 + }
30.1656 +
30.1657 + body.removeChild( container );
30.1658 + marginDiv = div = container = null;
30.1659 +
30.1660 + jQuery.extend( support, offsetSupport );
30.1661 + });
30.1662 +
30.1663 + return support;
30.1664 +})();
30.1665 +
30.1666 +
30.1667 +
30.1668 +
30.1669 +var rbrace = /^(?:\{.*\}|\[.*\])$/,
30.1670 + rmultiDash = /([A-Z])/g;
30.1671 +
30.1672 +jQuery.extend({
30.1673 + cache: {},
30.1674 +
30.1675 + // Please use with caution
30.1676 + uuid: 0,
30.1677 +
30.1678 + // Unique for each copy of jQuery on the page
30.1679 + // Non-digits removed to match rinlinejQuery
30.1680 + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
30.1681 +
30.1682 + // The following elements throw uncatchable exceptions if you
30.1683 + // attempt to add expando properties to them.
30.1684 + noData: {
30.1685 + "embed": true,
30.1686 + // Ban all objects except for Flash (which handle expandos)
30.1687 + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
30.1688 + "applet": true
30.1689 + },
30.1690 +
30.1691 + hasData: function( elem ) {
30.1692 + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
30.1693 + return !!elem && !isEmptyDataObject( elem );
30.1694 + },
30.1695 +
30.1696 + data: function( elem, name, data, pvt /* Internal Use Only */ ) {
30.1697 + if ( !jQuery.acceptData( elem ) ) {
30.1698 + return;
30.1699 + }
30.1700 +
30.1701 + var privateCache, thisCache, ret,
30.1702 + internalKey = jQuery.expando,
30.1703 + getByName = typeof name === "string",
30.1704 +
30.1705 + // We have to handle DOM nodes and JS objects differently because IE6-7
30.1706 + // can't GC object references properly across the DOM-JS boundary
30.1707 + isNode = elem.nodeType,
30.1708 +
30.1709 + // Only DOM nodes need the global jQuery cache; JS object data is
30.1710 + // attached directly to the object so GC can occur automatically
30.1711 + cache = isNode ? jQuery.cache : elem,
30.1712 +
30.1713 + // Only defining an ID for JS objects if its cache already exists allows
30.1714 + // the code to shortcut on the same path as a DOM node with no cache
30.1715 + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
30.1716 + isEvents = name === "events";
30.1717 +
30.1718 + // Avoid doing any more work than we need to when trying to get data on an
30.1719 + // object that has no data at all
30.1720 + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
30.1721 + return;
30.1722 + }
30.1723 +
30.1724 + if ( !id ) {
30.1725 + // Only DOM nodes need a new unique ID for each element since their data
30.1726 + // ends up in the global cache
30.1727 + if ( isNode ) {
30.1728 + elem[ internalKey ] = id = ++jQuery.uuid;
30.1729 + } else {
30.1730 + id = internalKey;
30.1731 + }
30.1732 + }
30.1733 +
30.1734 + if ( !cache[ id ] ) {
30.1735 + cache[ id ] = {};
30.1736 +
30.1737 + // Avoids exposing jQuery metadata on plain JS objects when the object
30.1738 + // is serialized using JSON.stringify
30.1739 + if ( !isNode ) {
30.1740 + cache[ id ].toJSON = jQuery.noop;
30.1741 + }
30.1742 + }
30.1743 +
30.1744 + // An object can be passed to jQuery.data instead of a key/value pair; this gets
30.1745 + // shallow copied over onto the existing cache
30.1746 + if ( typeof name === "object" || typeof name === "function" ) {
30.1747 + if ( pvt ) {
30.1748 + cache[ id ] = jQuery.extend( cache[ id ], name );
30.1749 + } else {
30.1750 + cache[ id ].data = jQuery.extend( cache[ id ].data, name );
30.1751 + }
30.1752 + }
30.1753 +
30.1754 + privateCache = thisCache = cache[ id ];
30.1755 +
30.1756 + // jQuery data() is stored in a separate object inside the object's internal data
30.1757 + // cache in order to avoid key collisions between internal data and user-defined
30.1758 + // data.
30.1759 + if ( !pvt ) {
30.1760 + if ( !thisCache.data ) {
30.1761 + thisCache.data = {};
30.1762 + }
30.1763 +
30.1764 + thisCache = thisCache.data;
30.1765 + }
30.1766 +
30.1767 + if ( data !== undefined ) {
30.1768 + thisCache[ jQuery.camelCase( name ) ] = data;
30.1769 + }
30.1770 +
30.1771 + // Users should not attempt to inspect the internal events object using jQuery.data,
30.1772 + // it is undocumented and subject to change. But does anyone listen? No.
30.1773 + if ( isEvents && !thisCache[ name ] ) {
30.1774 + return privateCache.events;
30.1775 + }
30.1776 +
30.1777 + // Check for both converted-to-camel and non-converted data property names
30.1778 + // If a data property was specified
30.1779 + if ( getByName ) {
30.1780 +
30.1781 + // First Try to find as-is property data
30.1782 + ret = thisCache[ name ];
30.1783 +
30.1784 + // Test for null|undefined property data
30.1785 + if ( ret == null ) {
30.1786 +
30.1787 + // Try to find the camelCased property
30.1788 + ret = thisCache[ jQuery.camelCase( name ) ];
30.1789 + }
30.1790 + } else {
30.1791 + ret = thisCache;
30.1792 + }
30.1793 +
30.1794 + return ret;
30.1795 + },
30.1796 +
30.1797 + removeData: function( elem, name, pvt /* Internal Use Only */ ) {
30.1798 + if ( !jQuery.acceptData( elem ) ) {
30.1799 + return;
30.1800 + }
30.1801 +
30.1802 + var thisCache, i, l,
30.1803 +
30.1804 + // Reference to internal data cache key
30.1805 + internalKey = jQuery.expando,
30.1806 +
30.1807 + isNode = elem.nodeType,
30.1808 +
30.1809 + // See jQuery.data for more information
30.1810 + cache = isNode ? jQuery.cache : elem,
30.1811 +
30.1812 + // See jQuery.data for more information
30.1813 + id = isNode ? elem[ internalKey ] : internalKey;
30.1814 +
30.1815 + // If there is already no cache entry for this object, there is no
30.1816 + // purpose in continuing
30.1817 + if ( !cache[ id ] ) {
30.1818 + return;
30.1819 + }
30.1820 +
30.1821 + if ( name ) {
30.1822 +
30.1823 + thisCache = pvt ? cache[ id ] : cache[ id ].data;
30.1824 +
30.1825 + if ( thisCache ) {
30.1826 +
30.1827 + // Support array or space separated string names for data keys
30.1828 + if ( !jQuery.isArray( name ) ) {
30.1829 +
30.1830 + // try the string as a key before any manipulation
30.1831 + if ( name in thisCache ) {
30.1832 + name = [ name ];
30.1833 + } else {
30.1834 +
30.1835 + // split the camel cased version by spaces unless a key with the spaces exists
30.1836 + name = jQuery.camelCase( name );
30.1837 + if ( name in thisCache ) {
30.1838 + name = [ name ];
30.1839 + } else {
30.1840 + name = name.split( " " );
30.1841 + }
30.1842 + }
30.1843 + }
30.1844 +
30.1845 + for ( i = 0, l = name.length; i < l; i++ ) {
30.1846 + delete thisCache[ name[i] ];
30.1847 + }
30.1848 +
30.1849 + // If there is no data left in the cache, we want to continue
30.1850 + // and let the cache object itself get destroyed
30.1851 + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
30.1852 + return;
30.1853 + }
30.1854 + }
30.1855 + }
30.1856 +
30.1857 + // See jQuery.data for more information
30.1858 + if ( !pvt ) {
30.1859 + delete cache[ id ].data;
30.1860 +
30.1861 + // Don't destroy the parent cache unless the internal data object
30.1862 + // had been the only thing left in it
30.1863 + if ( !isEmptyDataObject(cache[ id ]) ) {
30.1864 + return;
30.1865 + }
30.1866 + }
30.1867 +
30.1868 + // Browsers that fail expando deletion also refuse to delete expandos on
30.1869 + // the window, but it will allow it on all other JS objects; other browsers
30.1870 + // don't care
30.1871 + // Ensure that `cache` is not a window object #10080
30.1872 + if ( jQuery.support.deleteExpando || !cache.setInterval ) {
30.1873 + delete cache[ id ];
30.1874 + } else {
30.1875 + cache[ id ] = null;
30.1876 + }
30.1877 +
30.1878 + // We destroyed the cache and need to eliminate the expando on the node to avoid
30.1879 + // false lookups in the cache for entries that no longer exist
30.1880 + if ( isNode ) {
30.1881 + // IE does not allow us to delete expando properties from nodes,
30.1882 + // nor does it have a removeAttribute function on Document nodes;
30.1883 + // we must handle all of these cases
30.1884 + if ( jQuery.support.deleteExpando ) {
30.1885 + delete elem[ internalKey ];
30.1886 + } else if ( elem.removeAttribute ) {
30.1887 + elem.removeAttribute( internalKey );
30.1888 + } else {
30.1889 + elem[ internalKey ] = null;
30.1890 + }
30.1891 + }
30.1892 + },
30.1893 +
30.1894 + // For internal use only.
30.1895 + _data: function( elem, name, data ) {
30.1896 + return jQuery.data( elem, name, data, true );
30.1897 + },
30.1898 +
30.1899 + // A method for determining if a DOM node can handle the data expando
30.1900 + acceptData: function( elem ) {
30.1901 + if ( elem.nodeName ) {
30.1902 + var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
30.1903 +
30.1904 + if ( match ) {
30.1905 + return !(match === true || elem.getAttribute("classid") !== match);
30.1906 + }
30.1907 + }
30.1908 +
30.1909 + return true;
30.1910 + }
30.1911 +});
30.1912 +
30.1913 +jQuery.fn.extend({
30.1914 + data: function( key, value ) {
30.1915 + var parts, part, attr, name, l,
30.1916 + elem = this[0],
30.1917 + i = 0,
30.1918 + data = null;
30.1919 +
30.1920 + // Gets all values
30.1921 + if ( key === undefined ) {
30.1922 + if ( this.length ) {
30.1923 + data = jQuery.data( elem );
30.1924 +
30.1925 + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
30.1926 + attr = elem.attributes;
30.1927 + for ( l = attr.length; i < l; i++ ) {
30.1928 + name = attr[i].name;
30.1929 +
30.1930 + if ( name.indexOf( "data-" ) === 0 ) {
30.1931 + name = jQuery.camelCase( name.substring(5) );
30.1932 +
30.1933 + dataAttr( elem, name, data[ name ] );
30.1934 + }
30.1935 + }
30.1936 + jQuery._data( elem, "parsedAttrs", true );
30.1937 + }
30.1938 + }
30.1939 +
30.1940 + return data;
30.1941 + }
30.1942 +
30.1943 + // Sets multiple values
30.1944 + if ( typeof key === "object" ) {
30.1945 + return this.each(function() {
30.1946 + jQuery.data( this, key );
30.1947 + });
30.1948 + }
30.1949 +
30.1950 + parts = key.split( ".", 2 );
30.1951 + parts[1] = parts[1] ? "." + parts[1] : "";
30.1952 + part = parts[1] + "!";
30.1953 +
30.1954 + return jQuery.access( this, function( value ) {
30.1955 +
30.1956 + if ( value === undefined ) {
30.1957 + data = this.triggerHandler( "getData" + part, [ parts[0] ] );
30.1958 +
30.1959 + // Try to fetch any internally stored data first
30.1960 + if ( data === undefined && elem ) {
30.1961 + data = jQuery.data( elem, key );
30.1962 + data = dataAttr( elem, key, data );
30.1963 + }
30.1964 +
30.1965 + return data === undefined && parts[1] ?
30.1966 + this.data( parts[0] ) :
30.1967 + data;
30.1968 + }
30.1969 +
30.1970 + parts[1] = value;
30.1971 + this.each(function() {
30.1972 + var self = jQuery( this );
30.1973 +
30.1974 + self.triggerHandler( "setData" + part, parts );
30.1975 + jQuery.data( this, key, value );
30.1976 + self.triggerHandler( "changeData" + part, parts );
30.1977 + });
30.1978 + }, null, value, arguments.length > 1, null, false );
30.1979 + },
30.1980 +
30.1981 + removeData: function( key ) {
30.1982 + return this.each(function() {
30.1983 + jQuery.removeData( this, key );
30.1984 + });
30.1985 + }
30.1986 +});
30.1987 +
30.1988 +function dataAttr( elem, key, data ) {
30.1989 + // If nothing was found internally, try to fetch any
30.1990 + // data from the HTML5 data-* attribute
30.1991 + if ( data === undefined && elem.nodeType === 1 ) {
30.1992 +
30.1993 + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
30.1994 +
30.1995 + data = elem.getAttribute( name );
30.1996 +
30.1997 + if ( typeof data === "string" ) {
30.1998 + try {
30.1999 + data = data === "true" ? true :
30.2000 + data === "false" ? false :
30.2001 + data === "null" ? null :
30.2002 + jQuery.isNumeric( data ) ? +data :
30.2003 + rbrace.test( data ) ? jQuery.parseJSON( data ) :
30.2004 + data;
30.2005 + } catch( e ) {}
30.2006 +
30.2007 + // Make sure we set the data so it isn't changed later
30.2008 + jQuery.data( elem, key, data );
30.2009 +
30.2010 + } else {
30.2011 + data = undefined;
30.2012 + }
30.2013 + }
30.2014 +
30.2015 + return data;
30.2016 +}
30.2017 +
30.2018 +// checks a cache object for emptiness
30.2019 +function isEmptyDataObject( obj ) {
30.2020 + for ( var name in obj ) {
30.2021 +
30.2022 + // if the public data object is empty, the private is still empty
30.2023 + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
30.2024 + continue;
30.2025 + }
30.2026 + if ( name !== "toJSON" ) {
30.2027 + return false;
30.2028 + }
30.2029 + }
30.2030 +
30.2031 + return true;
30.2032 +}
30.2033 +
30.2034 +
30.2035 +
30.2036 +
30.2037 +function handleQueueMarkDefer( elem, type, src ) {
30.2038 + var deferDataKey = type + "defer",
30.2039 + queueDataKey = type + "queue",
30.2040 + markDataKey = type + "mark",
30.2041 + defer = jQuery._data( elem, deferDataKey );
30.2042 + if ( defer &&
30.2043 + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
30.2044 + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
30.2045 + // Give room for hard-coded callbacks to fire first
30.2046 + // and eventually mark/queue something else on the element
30.2047 + setTimeout( function() {
30.2048 + if ( !jQuery._data( elem, queueDataKey ) &&
30.2049 + !jQuery._data( elem, markDataKey ) ) {
30.2050 + jQuery.removeData( elem, deferDataKey, true );
30.2051 + defer.fire();
30.2052 + }
30.2053 + }, 0 );
30.2054 + }
30.2055 +}
30.2056 +
30.2057 +jQuery.extend({
30.2058 +
30.2059 + _mark: function( elem, type ) {
30.2060 + if ( elem ) {
30.2061 + type = ( type || "fx" ) + "mark";
30.2062 + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
30.2063 + }
30.2064 + },
30.2065 +
30.2066 + _unmark: function( force, elem, type ) {
30.2067 + if ( force !== true ) {
30.2068 + type = elem;
30.2069 + elem = force;
30.2070 + force = false;
30.2071 + }
30.2072 + if ( elem ) {
30.2073 + type = type || "fx";
30.2074 + var key = type + "mark",
30.2075 + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
30.2076 + if ( count ) {
30.2077 + jQuery._data( elem, key, count );
30.2078 + } else {
30.2079 + jQuery.removeData( elem, key, true );
30.2080 + handleQueueMarkDefer( elem, type, "mark" );
30.2081 + }
30.2082 + }
30.2083 + },
30.2084 +
30.2085 + queue: function( elem, type, data ) {
30.2086 + var q;
30.2087 + if ( elem ) {
30.2088 + type = ( type || "fx" ) + "queue";
30.2089 + q = jQuery._data( elem, type );
30.2090 +
30.2091 + // Speed up dequeue by getting out quickly if this is just a lookup
30.2092 + if ( data ) {
30.2093 + if ( !q || jQuery.isArray(data) ) {
30.2094 + q = jQuery._data( elem, type, jQuery.makeArray(data) );
30.2095 + } else {
30.2096 + q.push( data );
30.2097 + }
30.2098 + }
30.2099 + return q || [];
30.2100 + }
30.2101 + },
30.2102 +
30.2103 + dequeue: function( elem, type ) {
30.2104 + type = type || "fx";
30.2105 +
30.2106 + var queue = jQuery.queue( elem, type ),
30.2107 + fn = queue.shift(),
30.2108 + hooks = {};
30.2109 +
30.2110 + // If the fx queue is dequeued, always remove the progress sentinel
30.2111 + if ( fn === "inprogress" ) {
30.2112 + fn = queue.shift();
30.2113 + }
30.2114 +
30.2115 + if ( fn ) {
30.2116 + // Add a progress sentinel to prevent the fx queue from being
30.2117 + // automatically dequeued
30.2118 + if ( type === "fx" ) {
30.2119 + queue.unshift( "inprogress" );
30.2120 + }
30.2121 +
30.2122 + jQuery._data( elem, type + ".run", hooks );
30.2123 + fn.call( elem, function() {
30.2124 + jQuery.dequeue( elem, type );
30.2125 + }, hooks );
30.2126 + }
30.2127 +
30.2128 + if ( !queue.length ) {
30.2129 + jQuery.removeData( elem, type + "queue " + type + ".run", true );
30.2130 + handleQueueMarkDefer( elem, type, "queue" );
30.2131 + }
30.2132 + }
30.2133 +});
30.2134 +
30.2135 +jQuery.fn.extend({
30.2136 + queue: function( type, data ) {
30.2137 + var setter = 2;
30.2138 +
30.2139 + if ( typeof type !== "string" ) {
30.2140 + data = type;
30.2141 + type = "fx";
30.2142 + setter--;
30.2143 + }
30.2144 +
30.2145 + if ( arguments.length < setter ) {
30.2146 + return jQuery.queue( this[0], type );
30.2147 + }
30.2148 +
30.2149 + return data === undefined ?
30.2150 + this :
30.2151 + this.each(function() {
30.2152 + var queue = jQuery.queue( this, type, data );
30.2153 +
30.2154 + if ( type === "fx" && queue[0] !== "inprogress" ) {
30.2155 + jQuery.dequeue( this, type );
30.2156 + }
30.2157 + });
30.2158 + },
30.2159 + dequeue: function( type ) {
30.2160 + return this.each(function() {
30.2161 + jQuery.dequeue( this, type );
30.2162 + });
30.2163 + },
30.2164 + // Based off of the plugin by Clint Helfers, with permission.
30.2165 + // http://blindsignals.com/index.php/2009/07/jquery-delay/
30.2166 + delay: function( time, type ) {
30.2167 + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
30.2168 + type = type || "fx";
30.2169 +
30.2170 + return this.queue( type, function( next, hooks ) {
30.2171 + var timeout = setTimeout( next, time );
30.2172 + hooks.stop = function() {
30.2173 + clearTimeout( timeout );
30.2174 + };
30.2175 + });
30.2176 + },
30.2177 + clearQueue: function( type ) {
30.2178 + return this.queue( type || "fx", [] );
30.2179 + },
30.2180 + // Get a promise resolved when queues of a certain type
30.2181 + // are emptied (fx is the type by default)
30.2182 + promise: function( type, object ) {
30.2183 + if ( typeof type !== "string" ) {
30.2184 + object = type;
30.2185 + type = undefined;
30.2186 + }
30.2187 + type = type || "fx";
30.2188 + var defer = jQuery.Deferred(),
30.2189 + elements = this,
30.2190 + i = elements.length,
30.2191 + count = 1,
30.2192 + deferDataKey = type + "defer",
30.2193 + queueDataKey = type + "queue",
30.2194 + markDataKey = type + "mark",
30.2195 + tmp;
30.2196 + function resolve() {
30.2197 + if ( !( --count ) ) {
30.2198 + defer.resolveWith( elements, [ elements ] );
30.2199 + }
30.2200 + }
30.2201 + while( i-- ) {
30.2202 + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
30.2203 + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
30.2204 + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
30.2205 + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
30.2206 + count++;
30.2207 + tmp.add( resolve );
30.2208 + }
30.2209 + }
30.2210 + resolve();
30.2211 + return defer.promise( object );
30.2212 + }
30.2213 +});
30.2214 +
30.2215 +
30.2216 +
30.2217 +
30.2218 +var rclass = /[\n\t\r]/g,
30.2219 + rspace = /\s+/,
30.2220 + rreturn = /\r/g,
30.2221 + rtype = /^(?:button|input)$/i,
30.2222 + rfocusable = /^(?:button|input|object|select|textarea)$/i,
30.2223 + rclickable = /^a(?:rea)?$/i,
30.2224 + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
30.2225 + getSetAttribute = jQuery.support.getSetAttribute,
30.2226 + nodeHook, boolHook, fixSpecified;
30.2227 +
30.2228 +jQuery.fn.extend({
30.2229 + attr: function( name, value ) {
30.2230 + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
30.2231 + },
30.2232 +
30.2233 + removeAttr: function( name ) {
30.2234 + return this.each(function() {
30.2235 + jQuery.removeAttr( this, name );
30.2236 + });
30.2237 + },
30.2238 +
30.2239 + prop: function( name, value ) {
30.2240 + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
30.2241 + },
30.2242 +
30.2243 + removeProp: function( name ) {
30.2244 + name = jQuery.propFix[ name ] || name;
30.2245 + return this.each(function() {
30.2246 + // try/catch handles cases where IE balks (such as removing a property on window)
30.2247 + try {
30.2248 + this[ name ] = undefined;
30.2249 + delete this[ name ];
30.2250 + } catch( e ) {}
30.2251 + });
30.2252 + },
30.2253 +
30.2254 + addClass: function( value ) {
30.2255 + var classNames, i, l, elem,
30.2256 + setClass, c, cl;
30.2257 +
30.2258 + if ( jQuery.isFunction( value ) ) {
30.2259 + return this.each(function( j ) {
30.2260 + jQuery( this ).addClass( value.call(this, j, this.className) );
30.2261 + });
30.2262 + }
30.2263 +
30.2264 + if ( value && typeof value === "string" ) {
30.2265 + classNames = value.split( rspace );
30.2266 +
30.2267 + for ( i = 0, l = this.length; i < l; i++ ) {
30.2268 + elem = this[ i ];
30.2269 +
30.2270 + if ( elem.nodeType === 1 ) {
30.2271 + if ( !elem.className && classNames.length === 1 ) {
30.2272 + elem.className = value;
30.2273 +
30.2274 + } else {
30.2275 + setClass = " " + elem.className + " ";
30.2276 +
30.2277 + for ( c = 0, cl = classNames.length; c < cl; c++ ) {
30.2278 + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
30.2279 + setClass += classNames[ c ] + " ";
30.2280 + }
30.2281 + }
30.2282 + elem.className = jQuery.trim( setClass );
30.2283 + }
30.2284 + }
30.2285 + }
30.2286 + }
30.2287 +
30.2288 + return this;
30.2289 + },
30.2290 +
30.2291 + removeClass: function( value ) {
30.2292 + var classNames, i, l, elem, className, c, cl;
30.2293 +
30.2294 + if ( jQuery.isFunction( value ) ) {
30.2295 + return this.each(function( j ) {
30.2296 + jQuery( this ).removeClass( value.call(this, j, this.className) );
30.2297 + });
30.2298 + }
30.2299 +
30.2300 + if ( (value && typeof value === "string") || value === undefined ) {
30.2301 + classNames = ( value || "" ).split( rspace );
30.2302 +
30.2303 + for ( i = 0, l = this.length; i < l; i++ ) {
30.2304 + elem = this[ i ];
30.2305 +
30.2306 + if ( elem.nodeType === 1 && elem.className ) {
30.2307 + if ( value ) {
30.2308 + className = (" " + elem.className + " ").replace( rclass, " " );
30.2309 + for ( c = 0, cl = classNames.length; c < cl; c++ ) {
30.2310 + className = className.replace(" " + classNames[ c ] + " ", " ");
30.2311 + }
30.2312 + elem.className = jQuery.trim( className );
30.2313 +
30.2314 + } else {
30.2315 + elem.className = "";
30.2316 + }
30.2317 + }
30.2318 + }
30.2319 + }
30.2320 +
30.2321 + return this;
30.2322 + },
30.2323 +
30.2324 + toggleClass: function( value, stateVal ) {
30.2325 + var type = typeof value,
30.2326 + isBool = typeof stateVal === "boolean";
30.2327 +
30.2328 + if ( jQuery.isFunction( value ) ) {
30.2329 + return this.each(function( i ) {
30.2330 + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
30.2331 + });
30.2332 + }
30.2333 +
30.2334 + return this.each(function() {
30.2335 + if ( type === "string" ) {
30.2336 + // toggle individual class names
30.2337 + var className,
30.2338 + i = 0,
30.2339 + self = jQuery( this ),
30.2340 + state = stateVal,
30.2341 + classNames = value.split( rspace );
30.2342 +
30.2343 + while ( (className = classNames[ i++ ]) ) {
30.2344 + // check each className given, space seperated list
30.2345 + state = isBool ? state : !self.hasClass( className );
30.2346 + self[ state ? "addClass" : "removeClass" ]( className );
30.2347 + }
30.2348 +
30.2349 + } else if ( type === "undefined" || type === "boolean" ) {
30.2350 + if ( this.className ) {
30.2351 + // store className if set
30.2352 + jQuery._data( this, "__className__", this.className );
30.2353 + }
30.2354 +
30.2355 + // toggle whole className
30.2356 + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
30.2357 + }
30.2358 + });
30.2359 + },
30.2360 +
30.2361 + hasClass: function( selector ) {
30.2362 + var className = " " + selector + " ",
30.2363 + i = 0,
30.2364 + l = this.length;
30.2365 + for ( ; i < l; i++ ) {
30.2366 + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
30.2367 + return true;
30.2368 + }
30.2369 + }
30.2370 +
30.2371 + return false;
30.2372 + },
30.2373 +
30.2374 + val: function( value ) {
30.2375 + var hooks, ret, isFunction,
30.2376 + elem = this[0];
30.2377 +
30.2378 + if ( !arguments.length ) {
30.2379 + if ( elem ) {
30.2380 + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
30.2381 +
30.2382 + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
30.2383 + return ret;
30.2384 + }
30.2385 +
30.2386 + ret = elem.value;
30.2387 +
30.2388 + return typeof ret === "string" ?
30.2389 + // handle most common string cases
30.2390 + ret.replace(rreturn, "") :
30.2391 + // handle cases where value is null/undef or number
30.2392 + ret == null ? "" : ret;
30.2393 + }
30.2394 +
30.2395 + return;
30.2396 + }
30.2397 +
30.2398 + isFunction = jQuery.isFunction( value );
30.2399 +
30.2400 + return this.each(function( i ) {
30.2401 + var self = jQuery(this), val;
30.2402 +
30.2403 + if ( this.nodeType !== 1 ) {
30.2404 + return;
30.2405 + }
30.2406 +
30.2407 + if ( isFunction ) {
30.2408 + val = value.call( this, i, self.val() );
30.2409 + } else {
30.2410 + val = value;
30.2411 + }
30.2412 +
30.2413 + // Treat null/undefined as ""; convert numbers to string
30.2414 + if ( val == null ) {
30.2415 + val = "";
30.2416 + } else if ( typeof val === "number" ) {
30.2417 + val += "";
30.2418 + } else if ( jQuery.isArray( val ) ) {
30.2419 + val = jQuery.map(val, function ( value ) {
30.2420 + return value == null ? "" : value + "";
30.2421 + });
30.2422 + }
30.2423 +
30.2424 + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
30.2425 +
30.2426 + // If set returns undefined, fall back to normal setting
30.2427 + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
30.2428 + this.value = val;
30.2429 + }
30.2430 + });
30.2431 + }
30.2432 +});
30.2433 +
30.2434 +jQuery.extend({
30.2435 + valHooks: {
30.2436 + option: {
30.2437 + get: function( elem ) {
30.2438 + // attributes.value is undefined in Blackberry 4.7 but
30.2439 + // uses .value. See #6932
30.2440 + var val = elem.attributes.value;
30.2441 + return !val || val.specified ? elem.value : elem.text;
30.2442 + }
30.2443 + },
30.2444 + select: {
30.2445 + get: function( elem ) {
30.2446 + var value, i, max, option,
30.2447 + index = elem.selectedIndex,
30.2448 + values = [],
30.2449 + options = elem.options,
30.2450 + one = elem.type === "select-one";
30.2451 +
30.2452 + // Nothing was selected
30.2453 + if ( index < 0 ) {
30.2454 + return null;
30.2455 + }
30.2456 +
30.2457 + // Loop through all the selected options
30.2458 + i = one ? index : 0;
30.2459 + max = one ? index + 1 : options.length;
30.2460 + for ( ; i < max; i++ ) {
30.2461 + option = options[ i ];
30.2462 +
30.2463 + // Don't return options that are disabled or in a disabled optgroup
30.2464 + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
30.2465 + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
30.2466 +
30.2467 + // Get the specific value for the option
30.2468 + value = jQuery( option ).val();
30.2469 +
30.2470 + // We don't need an array for one selects
30.2471 + if ( one ) {
30.2472 + return value;
30.2473 + }
30.2474 +
30.2475 + // Multi-Selects return an array
30.2476 + values.push( value );
30.2477 + }
30.2478 + }
30.2479 +
30.2480 + // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
30.2481 + if ( one && !values.length && options.length ) {
30.2482 + return jQuery( options[ index ] ).val();
30.2483 + }
30.2484 +
30.2485 + return values;
30.2486 + },
30.2487 +
30.2488 + set: function( elem, value ) {
30.2489 + var values = jQuery.makeArray( value );
30.2490 +
30.2491 + jQuery(elem).find("option").each(function() {
30.2492 + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
30.2493 + });
30.2494 +
30.2495 + if ( !values.length ) {
30.2496 + elem.selectedIndex = -1;
30.2497 + }
30.2498 + return values;
30.2499 + }
30.2500 + }
30.2501 + },
30.2502 +
30.2503 + attrFn: {
30.2504 + val: true,
30.2505 + css: true,
30.2506 + html: true,
30.2507 + text: true,
30.2508 + data: true,
30.2509 + width: true,
30.2510 + height: true,
30.2511 + offset: true
30.2512 + },
30.2513 +
30.2514 + attr: function( elem, name, value, pass ) {
30.2515 + var ret, hooks, notxml,
30.2516 + nType = elem.nodeType;
30.2517 +
30.2518 + // don't get/set attributes on text, comment and attribute nodes
30.2519 + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
30.2520 + return;
30.2521 + }
30.2522 +
30.2523 + if ( pass && name in jQuery.attrFn ) {
30.2524 + return jQuery( elem )[ name ]( value );
30.2525 + }
30.2526 +
30.2527 + // Fallback to prop when attributes are not supported
30.2528 + if ( typeof elem.getAttribute === "undefined" ) {
30.2529 + return jQuery.prop( elem, name, value );
30.2530 + }
30.2531 +
30.2532 + notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
30.2533 +
30.2534 + // All attributes are lowercase
30.2535 + // Grab necessary hook if one is defined
30.2536 + if ( notxml ) {
30.2537 + name = name.toLowerCase();
30.2538 + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
30.2539 + }
30.2540 +
30.2541 + if ( value !== undefined ) {
30.2542 +
30.2543 + if ( value === null ) {
30.2544 + jQuery.removeAttr( elem, name );
30.2545 + return;
30.2546 +
30.2547 + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
30.2548 + return ret;
30.2549 +
30.2550 + } else {
30.2551 + elem.setAttribute( name, "" + value );
30.2552 + return value;
30.2553 + }
30.2554 +
30.2555 + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
30.2556 + return ret;
30.2557 +
30.2558 + } else {
30.2559 +
30.2560 + ret = elem.getAttribute( name );
30.2561 +
30.2562 + // Non-existent attributes return null, we normalize to undefined
30.2563 + return ret === null ?
30.2564 + undefined :
30.2565 + ret;
30.2566 + }
30.2567 + },
30.2568 +
30.2569 + removeAttr: function( elem, value ) {
30.2570 + var propName, attrNames, name, l, isBool,
30.2571 + i = 0;
30.2572 +
30.2573 + if ( value && elem.nodeType === 1 ) {
30.2574 + attrNames = value.toLowerCase().split( rspace );
30.2575 + l = attrNames.length;
30.2576 +
30.2577 + for ( ; i < l; i++ ) {
30.2578 + name = attrNames[ i ];
30.2579 +
30.2580 + if ( name ) {
30.2581 + propName = jQuery.propFix[ name ] || name;
30.2582 + isBool = rboolean.test( name );
30.2583 +
30.2584 + // See #9699 for explanation of this approach (setting first, then removal)
30.2585 + // Do not do this for boolean attributes (see #10870)
30.2586 + if ( !isBool ) {
30.2587 + jQuery.attr( elem, name, "" );
30.2588 + }
30.2589 + elem.removeAttribute( getSetAttribute ? name : propName );
30.2590 +
30.2591 + // Set corresponding property to false for boolean attributes
30.2592 + if ( isBool && propName in elem ) {
30.2593 + elem[ propName ] = false;
30.2594 + }
30.2595 + }
30.2596 + }
30.2597 + }
30.2598 + },
30.2599 +
30.2600 + attrHooks: {
30.2601 + type: {
30.2602 + set: function( elem, value ) {
30.2603 + // We can't allow the type property to be changed (since it causes problems in IE)
30.2604 + if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
30.2605 + jQuery.error( "type property can't be changed" );
30.2606 + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
30.2607 + // Setting the type on a radio button after the value resets the value in IE6-9
30.2608 + // Reset value to it's default in case type is set after value
30.2609 + // This is for element creation
30.2610 + var val = elem.value;
30.2611 + elem.setAttribute( "type", value );
30.2612 + if ( val ) {
30.2613 + elem.value = val;
30.2614 + }
30.2615 + return value;
30.2616 + }
30.2617 + }
30.2618 + },
30.2619 + // Use the value property for back compat
30.2620 + // Use the nodeHook for button elements in IE6/7 (#1954)
30.2621 + value: {
30.2622 + get: function( elem, name ) {
30.2623 + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
30.2624 + return nodeHook.get( elem, name );
30.2625 + }
30.2626 + return name in elem ?
30.2627 + elem.value :
30.2628 + null;
30.2629 + },
30.2630 + set: function( elem, value, name ) {
30.2631 + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
30.2632 + return nodeHook.set( elem, value, name );
30.2633 + }
30.2634 + // Does not return so that setAttribute is also used
30.2635 + elem.value = value;
30.2636 + }
30.2637 + }
30.2638 + },
30.2639 +
30.2640 + propFix: {
30.2641 + tabindex: "tabIndex",
30.2642 + readonly: "readOnly",
30.2643 + "for": "htmlFor",
30.2644 + "class": "className",
30.2645 + maxlength: "maxLength",
30.2646 + cellspacing: "cellSpacing",
30.2647 + cellpadding: "cellPadding",
30.2648 + rowspan: "rowSpan",
30.2649 + colspan: "colSpan",
30.2650 + usemap: "useMap",
30.2651 + frameborder: "frameBorder",
30.2652 + contenteditable: "contentEditable"
30.2653 + },
30.2654 +
30.2655 + prop: function( elem, name, value ) {
30.2656 + var ret, hooks, notxml,
30.2657 + nType = elem.nodeType;
30.2658 +
30.2659 + // don't get/set properties on text, comment and attribute nodes
30.2660 + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
30.2661 + return;
30.2662 + }
30.2663 +
30.2664 + notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
30.2665 +
30.2666 + if ( notxml ) {
30.2667 + // Fix name and attach hooks
30.2668 + name = jQuery.propFix[ name ] || name;
30.2669 + hooks = jQuery.propHooks[ name ];
30.2670 + }
30.2671 +
30.2672 + if ( value !== undefined ) {
30.2673 + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
30.2674 + return ret;
30.2675 +
30.2676 + } else {
30.2677 + return ( elem[ name ] = value );
30.2678 + }
30.2679 +
30.2680 + } else {
30.2681 + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
30.2682 + return ret;
30.2683 +
30.2684 + } else {
30.2685 + return elem[ name ];
30.2686 + }
30.2687 + }
30.2688 + },
30.2689 +
30.2690 + propHooks: {
30.2691 + tabIndex: {
30.2692 + get: function( elem ) {
30.2693 + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
30.2694 + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
30.2695 + var attributeNode = elem.getAttributeNode("tabindex");
30.2696 +
30.2697 + return attributeNode && attributeNode.specified ?
30.2698 + parseInt( attributeNode.value, 10 ) :
30.2699 + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
30.2700 + 0 :
30.2701 + undefined;
30.2702 + }
30.2703 + }
30.2704 + }
30.2705 +});
30.2706 +
30.2707 +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
30.2708 +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
30.2709 +
30.2710 +// Hook for boolean attributes
30.2711 +boolHook = {
30.2712 + get: function( elem, name ) {
30.2713 + // Align boolean attributes with corresponding properties
30.2714 + // Fall back to attribute presence where some booleans are not supported
30.2715 + var attrNode,
30.2716 + property = jQuery.prop( elem, name );
30.2717 + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
30.2718 + name.toLowerCase() :
30.2719 + undefined;
30.2720 + },
30.2721 + set: function( elem, value, name ) {
30.2722 + var propName;
30.2723 + if ( value === false ) {
30.2724 + // Remove boolean attributes when set to false
30.2725 + jQuery.removeAttr( elem, name );
30.2726 + } else {
30.2727 + // value is true since we know at this point it's type boolean and not false
30.2728 + // Set boolean attributes to the same name and set the DOM property
30.2729 + propName = jQuery.propFix[ name ] || name;
30.2730 + if ( propName in elem ) {
30.2731 + // Only set the IDL specifically if it already exists on the element
30.2732 + elem[ propName ] = true;
30.2733 + }
30.2734 +
30.2735 + elem.setAttribute( name, name.toLowerCase() );
30.2736 + }
30.2737 + return name;
30.2738 + }
30.2739 +};
30.2740 +
30.2741 +// IE6/7 do not support getting/setting some attributes with get/setAttribute
30.2742 +if ( !getSetAttribute ) {
30.2743 +
30.2744 + fixSpecified = {
30.2745 + name: true,
30.2746 + id: true,
30.2747 + coords: true
30.2748 + };
30.2749 +
30.2750 + // Use this for any attribute in IE6/7
30.2751 + // This fixes almost every IE6/7 issue
30.2752 + nodeHook = jQuery.valHooks.button = {
30.2753 + get: function( elem, name ) {
30.2754 + var ret;
30.2755 + ret = elem.getAttributeNode( name );
30.2756 + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
30.2757 + ret.nodeValue :
30.2758 + undefined;
30.2759 + },
30.2760 + set: function( elem, value, name ) {
30.2761 + // Set the existing or create a new attribute node
30.2762 + var ret = elem.getAttributeNode( name );
30.2763 + if ( !ret ) {
30.2764 + ret = document.createAttribute( name );
30.2765 + elem.setAttributeNode( ret );
30.2766 + }
30.2767 + return ( ret.nodeValue = value + "" );
30.2768 + }
30.2769 + };
30.2770 +
30.2771 + // Apply the nodeHook to tabindex
30.2772 + jQuery.attrHooks.tabindex.set = nodeHook.set;
30.2773 +
30.2774 + // Set width and height to auto instead of 0 on empty string( Bug #8150 )
30.2775 + // This is for removals
30.2776 + jQuery.each([ "width", "height" ], function( i, name ) {
30.2777 + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
30.2778 + set: function( elem, value ) {
30.2779 + if ( value === "" ) {
30.2780 + elem.setAttribute( name, "auto" );
30.2781 + return value;
30.2782 + }
30.2783 + }
30.2784 + });
30.2785 + });
30.2786 +
30.2787 + // Set contenteditable to false on removals(#10429)
30.2788 + // Setting to empty string throws an error as an invalid value
30.2789 + jQuery.attrHooks.contenteditable = {
30.2790 + get: nodeHook.get,
30.2791 + set: function( elem, value, name ) {
30.2792 + if ( value === "" ) {
30.2793 + value = "false";
30.2794 + }
30.2795 + nodeHook.set( elem, value, name );
30.2796 + }
30.2797 + };
30.2798 +}
30.2799 +
30.2800 +
30.2801 +// Some attributes require a special call on IE
30.2802 +if ( !jQuery.support.hrefNormalized ) {
30.2803 + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
30.2804 + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
30.2805 + get: function( elem ) {
30.2806 + var ret = elem.getAttribute( name, 2 );
30.2807 + return ret === null ? undefined : ret;
30.2808 + }
30.2809 + });
30.2810 + });
30.2811 +}
30.2812 +
30.2813 +if ( !jQuery.support.style ) {
30.2814 + jQuery.attrHooks.style = {
30.2815 + get: function( elem ) {
30.2816 + // Return undefined in the case of empty string
30.2817 + // Normalize to lowercase since IE uppercases css property names
30.2818 + return elem.style.cssText.toLowerCase() || undefined;
30.2819 + },
30.2820 + set: function( elem, value ) {
30.2821 + return ( elem.style.cssText = "" + value );
30.2822 + }
30.2823 + };
30.2824 +}
30.2825 +
30.2826 +// Safari mis-reports the default selected property of an option
30.2827 +// Accessing the parent's selectedIndex property fixes it
30.2828 +if ( !jQuery.support.optSelected ) {
30.2829 + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
30.2830 + get: function( elem ) {
30.2831 + var parent = elem.parentNode;
30.2832 +
30.2833 + if ( parent ) {
30.2834 + parent.selectedIndex;
30.2835 +
30.2836 + // Make sure that it also works with optgroups, see #5701
30.2837 + if ( parent.parentNode ) {
30.2838 + parent.parentNode.selectedIndex;
30.2839 + }
30.2840 + }
30.2841 + return null;
30.2842 + }
30.2843 + });
30.2844 +}
30.2845 +
30.2846 +// IE6/7 call enctype encoding
30.2847 +if ( !jQuery.support.enctype ) {
30.2848 + jQuery.propFix.enctype = "encoding";
30.2849 +}
30.2850 +
30.2851 +// Radios and checkboxes getter/setter
30.2852 +if ( !jQuery.support.checkOn ) {
30.2853 + jQuery.each([ "radio", "checkbox" ], function() {
30.2854 + jQuery.valHooks[ this ] = {
30.2855 + get: function( elem ) {
30.2856 + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
30.2857 + return elem.getAttribute("value") === null ? "on" : elem.value;
30.2858 + }
30.2859 + };
30.2860 + });
30.2861 +}
30.2862 +jQuery.each([ "radio", "checkbox" ], function() {
30.2863 + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
30.2864 + set: function( elem, value ) {
30.2865 + if ( jQuery.isArray( value ) ) {
30.2866 + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
30.2867 + }
30.2868 + }
30.2869 + });
30.2870 +});
30.2871 +
30.2872 +
30.2873 +
30.2874 +
30.2875 +var rformElems = /^(?:textarea|input|select)$/i,
30.2876 + rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
30.2877 + rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
30.2878 + rkeyEvent = /^key/,
30.2879 + rmouseEvent = /^(?:mouse|contextmenu)|click/,
30.2880 + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
30.2881 + rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
30.2882 + quickParse = function( selector ) {
30.2883 + var quick = rquickIs.exec( selector );
30.2884 + if ( quick ) {
30.2885 + // 0 1 2 3
30.2886 + // [ _, tag, id, class ]
30.2887 + quick[1] = ( quick[1] || "" ).toLowerCase();
30.2888 + quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
30.2889 + }
30.2890 + return quick;
30.2891 + },
30.2892 + quickIs = function( elem, m ) {
30.2893 + var attrs = elem.attributes || {};
30.2894 + return (
30.2895 + (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
30.2896 + (!m[2] || (attrs.id || {}).value === m[2]) &&
30.2897 + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
30.2898 + );
30.2899 + },
30.2900 + hoverHack = function( events ) {
30.2901 + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
30.2902 + };
30.2903 +
30.2904 +/*
30.2905 + * Helper functions for managing events -- not part of the public interface.
30.2906 + * Props to Dean Edwards' addEvent library for many of the ideas.
30.2907 + */
30.2908 +jQuery.event = {
30.2909 +
30.2910 + add: function( elem, types, handler, data, selector ) {
30.2911 +
30.2912 + var elemData, eventHandle, events,
30.2913 + t, tns, type, namespaces, handleObj,
30.2914 + handleObjIn, quick, handlers, special;
30.2915 +
30.2916 + // Don't attach events to noData or text/comment nodes (allow plain objects tho)
30.2917 + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
30.2918 + return;
30.2919 + }
30.2920 +
30.2921 + // Caller can pass in an object of custom data in lieu of the handler
30.2922 + if ( handler.handler ) {
30.2923 + handleObjIn = handler;
30.2924 + handler = handleObjIn.handler;
30.2925 + selector = handleObjIn.selector;
30.2926 + }
30.2927 +
30.2928 + // Make sure that the handler has a unique ID, used to find/remove it later
30.2929 + if ( !handler.guid ) {
30.2930 + handler.guid = jQuery.guid++;
30.2931 + }
30.2932 +
30.2933 + // Init the element's event structure and main handler, if this is the first
30.2934 + events = elemData.events;
30.2935 + if ( !events ) {
30.2936 + elemData.events = events = {};
30.2937 + }
30.2938 + eventHandle = elemData.handle;
30.2939 + if ( !eventHandle ) {
30.2940 + elemData.handle = eventHandle = function( e ) {
30.2941 + // Discard the second event of a jQuery.event.trigger() and
30.2942 + // when an event is called after a page has unloaded
30.2943 + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
30.2944 + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
30.2945 + undefined;
30.2946 + };
30.2947 + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
30.2948 + eventHandle.elem = elem;
30.2949 + }
30.2950 +
30.2951 + // Handle multiple events separated by a space
30.2952 + // jQuery(...).bind("mouseover mouseout", fn);
30.2953 + types = jQuery.trim( hoverHack(types) ).split( " " );
30.2954 + for ( t = 0; t < types.length; t++ ) {
30.2955 +
30.2956 + tns = rtypenamespace.exec( types[t] ) || [];
30.2957 + type = tns[1];
30.2958 + namespaces = ( tns[2] || "" ).split( "." ).sort();
30.2959 +
30.2960 + // If event changes its type, use the special event handlers for the changed type
30.2961 + special = jQuery.event.special[ type ] || {};
30.2962 +
30.2963 + // If selector defined, determine special event api type, otherwise given type
30.2964 + type = ( selector ? special.delegateType : special.bindType ) || type;
30.2965 +
30.2966 + // Update special based on newly reset type
30.2967 + special = jQuery.event.special[ type ] || {};
30.2968 +
30.2969 + // handleObj is passed to all event handlers
30.2970 + handleObj = jQuery.extend({
30.2971 + type: type,
30.2972 + origType: tns[1],
30.2973 + data: data,
30.2974 + handler: handler,
30.2975 + guid: handler.guid,
30.2976 + selector: selector,
30.2977 + quick: selector && quickParse( selector ),
30.2978 + namespace: namespaces.join(".")
30.2979 + }, handleObjIn );
30.2980 +
30.2981 + // Init the event handler queue if we're the first
30.2982 + handlers = events[ type ];
30.2983 + if ( !handlers ) {
30.2984 + handlers = events[ type ] = [];
30.2985 + handlers.delegateCount = 0;
30.2986 +
30.2987 + // Only use addEventListener/attachEvent if the special events handler returns false
30.2988 + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
30.2989 + // Bind the global event handler to the element
30.2990 + if ( elem.addEventListener ) {
30.2991 + elem.addEventListener( type, eventHandle, false );
30.2992 +
30.2993 + } else if ( elem.attachEvent ) {
30.2994 + elem.attachEvent( "on" + type, eventHandle );
30.2995 + }
30.2996 + }
30.2997 + }
30.2998 +
30.2999 + if ( special.add ) {
30.3000 + special.add.call( elem, handleObj );
30.3001 +
30.3002 + if ( !handleObj.handler.guid ) {
30.3003 + handleObj.handler.guid = handler.guid;
30.3004 + }
30.3005 + }
30.3006 +
30.3007 + // Add to the element's handler list, delegates in front
30.3008 + if ( selector ) {
30.3009 + handlers.splice( handlers.delegateCount++, 0, handleObj );
30.3010 + } else {
30.3011 + handlers.push( handleObj );
30.3012 + }
30.3013 +
30.3014 + // Keep track of which events have ever been used, for event optimization
30.3015 + jQuery.event.global[ type ] = true;
30.3016 + }
30.3017 +
30.3018 + // Nullify elem to prevent memory leaks in IE
30.3019 + elem = null;
30.3020 + },
30.3021 +
30.3022 + global: {},
30.3023 +
30.3024 + // Detach an event or set of events from an element
30.3025 + remove: function( elem, types, handler, selector, mappedTypes ) {
30.3026 +
30.3027 + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
30.3028 + t, tns, type, origType, namespaces, origCount,
30.3029 + j, events, special, handle, eventType, handleObj;
30.3030 +
30.3031 + if ( !elemData || !(events = elemData.events) ) {
30.3032 + return;
30.3033 + }
30.3034 +
30.3035 + // Once for each type.namespace in types; type may be omitted
30.3036 + types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
30.3037 + for ( t = 0; t < types.length; t++ ) {
30.3038 + tns = rtypenamespace.exec( types[t] ) || [];
30.3039 + type = origType = tns[1];
30.3040 + namespaces = tns[2];
30.3041 +
30.3042 + // Unbind all events (on this namespace, if provided) for the element
30.3043 + if ( !type ) {
30.3044 + for ( type in events ) {
30.3045 + jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
30.3046 + }
30.3047 + continue;
30.3048 + }
30.3049 +
30.3050 + special = jQuery.event.special[ type ] || {};
30.3051 + type = ( selector? special.delegateType : special.bindType ) || type;
30.3052 + eventType = events[ type ] || [];
30.3053 + origCount = eventType.length;
30.3054 + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
30.3055 +
30.3056 + // Remove matching events
30.3057 + for ( j = 0; j < eventType.length; j++ ) {
30.3058 + handleObj = eventType[ j ];
30.3059 +
30.3060 + if ( ( mappedTypes || origType === handleObj.origType ) &&
30.3061 + ( !handler || handler.guid === handleObj.guid ) &&
30.3062 + ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
30.3063 + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
30.3064 + eventType.splice( j--, 1 );
30.3065 +
30.3066 + if ( handleObj.selector ) {
30.3067 + eventType.delegateCount--;
30.3068 + }
30.3069 + if ( special.remove ) {
30.3070 + special.remove.call( elem, handleObj );
30.3071 + }
30.3072 + }
30.3073 + }
30.3074 +
30.3075 + // Remove generic event handler if we removed something and no more handlers exist
30.3076 + // (avoids potential for endless recursion during removal of special event handlers)
30.3077 + if ( eventType.length === 0 && origCount !== eventType.length ) {
30.3078 + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
30.3079 + jQuery.removeEvent( elem, type, elemData.handle );
30.3080 + }
30.3081 +
30.3082 + delete events[ type ];
30.3083 + }
30.3084 + }
30.3085 +
30.3086 + // Remove the expando if it's no longer used
30.3087 + if ( jQuery.isEmptyObject( events ) ) {
30.3088 + handle = elemData.handle;
30.3089 + if ( handle ) {
30.3090 + handle.elem = null;
30.3091 + }
30.3092 +
30.3093 + // removeData also checks for emptiness and clears the expando if empty
30.3094 + // so use it instead of delete
30.3095 + jQuery.removeData( elem, [ "events", "handle" ], true );
30.3096 + }
30.3097 + },
30.3098 +
30.3099 + // Events that are safe to short-circuit if no handlers are attached.
30.3100 + // Native DOM events should not be added, they may have inline handlers.
30.3101 + customEvent: {
30.3102 + "getData": true,
30.3103 + "setData": true,
30.3104 + "changeData": true
30.3105 + },
30.3106 +
30.3107 + trigger: function( event, data, elem, onlyHandlers ) {
30.3108 + // Don't do events on text and comment nodes
30.3109 + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
30.3110 + return;
30.3111 + }
30.3112 +
30.3113 + // Event object or event type
30.3114 + var type = event.type || event,
30.3115 + namespaces = [],
30.3116 + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
30.3117 +
30.3118 + // focus/blur morphs to focusin/out; ensure we're not firing them right now
30.3119 + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
30.3120 + return;
30.3121 + }
30.3122 +
30.3123 + if ( type.indexOf( "!" ) >= 0 ) {
30.3124 + // Exclusive events trigger only for the exact event (no namespaces)
30.3125 + type = type.slice(0, -1);
30.3126 + exclusive = true;
30.3127 + }
30.3128 +
30.3129 + if ( type.indexOf( "." ) >= 0 ) {
30.3130 + // Namespaced trigger; create a regexp to match event type in handle()
30.3131 + namespaces = type.split(".");
30.3132 + type = namespaces.shift();
30.3133 + namespaces.sort();
30.3134 + }
30.3135 +
30.3136 + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
30.3137 + // No jQuery handlers for this event type, and it can't have inline handlers
30.3138 + return;
30.3139 + }
30.3140 +
30.3141 + // Caller can pass in an Event, Object, or just an event type string
30.3142 + event = typeof event === "object" ?
30.3143 + // jQuery.Event object
30.3144 + event[ jQuery.expando ] ? event :
30.3145 + // Object literal
30.3146 + new jQuery.Event( type, event ) :
30.3147 + // Just the event type (string)
30.3148 + new jQuery.Event( type );
30.3149 +
30.3150 + event.type = type;
30.3151 + event.isTrigger = true;
30.3152 + event.exclusive = exclusive;
30.3153 + event.namespace = namespaces.join( "." );
30.3154 + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
30.3155 + ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
30.3156 +
30.3157 + // Handle a global trigger
30.3158 + if ( !elem ) {
30.3159 +
30.3160 + // TODO: Stop taunting the data cache; remove global events and always attach to document
30.3161 + cache = jQuery.cache;
30.3162 + for ( i in cache ) {
30.3163 + if ( cache[ i ].events && cache[ i ].events[ type ] ) {
30.3164 + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
30.3165 + }
30.3166 + }
30.3167 + return;
30.3168 + }
30.3169 +
30.3170 + // Clean up the event in case it is being reused
30.3171 + event.result = undefined;
30.3172 + if ( !event.target ) {
30.3173 + event.target = elem;
30.3174 + }
30.3175 +
30.3176 + // Clone any incoming data and prepend the event, creating the handler arg list
30.3177 + data = data != null ? jQuery.makeArray( data ) : [];
30.3178 + data.unshift( event );
30.3179 +
30.3180 + // Allow special events to draw outside the lines
30.3181 + special = jQuery.event.special[ type ] || {};
30.3182 + if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
30.3183 + return;
30.3184 + }
30.3185 +
30.3186 + // Determine event propagation path in advance, per W3C events spec (#9951)
30.3187 + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
30.3188 + eventPath = [[ elem, special.bindType || type ]];
30.3189 + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
30.3190 +
30.3191 + bubbleType = special.delegateType || type;
30.3192 + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
30.3193 + old = null;
30.3194 + for ( ; cur; cur = cur.parentNode ) {
30.3195 + eventPath.push([ cur, bubbleType ]);
30.3196 + old = cur;
30.3197 + }
30.3198 +
30.3199 + // Only add window if we got to document (e.g., not plain obj or detached DOM)
30.3200 + if ( old && old === elem.ownerDocument ) {
30.3201 + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
30.3202 + }
30.3203 + }
30.3204 +
30.3205 + // Fire handlers on the event path
30.3206 + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
30.3207 +
30.3208 + cur = eventPath[i][0];
30.3209 + event.type = eventPath[i][1];
30.3210 +
30.3211 + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
30.3212 + if ( handle ) {
30.3213 + handle.apply( cur, data );
30.3214 + }
30.3215 + // Note that this is a bare JS function and not a jQuery handler
30.3216 + handle = ontype && cur[ ontype ];
30.3217 + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
30.3218 + event.preventDefault();
30.3219 + }
30.3220 + }
30.3221 + event.type = type;
30.3222 +
30.3223 + // If nobody prevented the default action, do it now
30.3224 + if ( !onlyHandlers && !event.isDefaultPrevented() ) {
30.3225 +
30.3226 + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
30.3227 + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
30.3228 +
30.3229 + // Call a native DOM method on the target with the same name name as the event.
30.3230 + // Can't use an .isFunction() check here because IE6/7 fails that test.
30.3231 + // Don't do default actions on window, that's where global variables be (#6170)
30.3232 + // IE<9 dies on focus/blur to hidden element (#1486)
30.3233 + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
30.3234 +
30.3235 + // Don't re-trigger an onFOO event when we call its FOO() method
30.3236 + old = elem[ ontype ];
30.3237 +
30.3238 + if ( old ) {
30.3239 + elem[ ontype ] = null;
30.3240 + }
30.3241 +
30.3242 + // Prevent re-triggering of the same event, since we already bubbled it above
30.3243 + jQuery.event.triggered = type;
30.3244 + elem[ type ]();
30.3245 + jQuery.event.triggered = undefined;
30.3246 +
30.3247 + if ( old ) {
30.3248 + elem[ ontype ] = old;
30.3249 + }
30.3250 + }
30.3251 + }
30.3252 + }
30.3253 +
30.3254 + return event.result;
30.3255 + },
30.3256 +
30.3257 + dispatch: function( event ) {
30.3258 +
30.3259 + // Make a writable jQuery.Event from the native event object
30.3260 + event = jQuery.event.fix( event || window.event );
30.3261 +
30.3262 + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
30.3263 + delegateCount = handlers.delegateCount,
30.3264 + args = [].slice.call( arguments, 0 ),
30.3265 + run_all = !event.exclusive && !event.namespace,
30.3266 + special = jQuery.event.special[ event.type ] || {},
30.3267 + handlerQueue = [],
30.3268 + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
30.3269 +
30.3270 + // Use the fix-ed jQuery.Event rather than the (read-only) native event
30.3271 + args[0] = event;
30.3272 + event.delegateTarget = this;
30.3273 +
30.3274 + // Call the preDispatch hook for the mapped type, and let it bail if desired
30.3275 + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
30.3276 + return;
30.3277 + }
30.3278 +
30.3279 + // Determine handlers that should run if there are delegated events
30.3280 + // Avoid non-left-click bubbling in Firefox (#3861)
30.3281 + if ( delegateCount && !(event.button && event.type === "click") ) {
30.3282 +
30.3283 + // Pregenerate a single jQuery object for reuse with .is()
30.3284 + jqcur = jQuery(this);
30.3285 + jqcur.context = this.ownerDocument || this;
30.3286 +
30.3287 + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
30.3288 +
30.3289 + // Don't process events on disabled elements (#6911, #8165)
30.3290 + if ( cur.disabled !== true ) {
30.3291 + selMatch = {};
30.3292 + matches = [];
30.3293 + jqcur[0] = cur;
30.3294 + for ( i = 0; i < delegateCount; i++ ) {
30.3295 + handleObj = handlers[ i ];
30.3296 + sel = handleObj.selector;
30.3297 +
30.3298 + if ( selMatch[ sel ] === undefined ) {
30.3299 + selMatch[ sel ] = (
30.3300 + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
30.3301 + );
30.3302 + }
30.3303 + if ( selMatch[ sel ] ) {
30.3304 + matches.push( handleObj );
30.3305 + }
30.3306 + }
30.3307 + if ( matches.length ) {
30.3308 + handlerQueue.push({ elem: cur, matches: matches });
30.3309 + }
30.3310 + }
30.3311 + }
30.3312 + }
30.3313 +
30.3314 + // Add the remaining (directly-bound) handlers
30.3315 + if ( handlers.length > delegateCount ) {
30.3316 + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
30.3317 + }
30.3318 +
30.3319 + // Run delegates first; they may want to stop propagation beneath us
30.3320 + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
30.3321 + matched = handlerQueue[ i ];
30.3322 + event.currentTarget = matched.elem;
30.3323 +
30.3324 + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
30.3325 + handleObj = matched.matches[ j ];
30.3326 +
30.3327 + // Triggered event must either 1) be non-exclusive and have no namespace, or
30.3328 + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
30.3329 + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
30.3330 +
30.3331 + event.data = handleObj.data;
30.3332 + event.handleObj = handleObj;
30.3333 +
30.3334 + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
30.3335 + .apply( matched.elem, args );
30.3336 +
30.3337 + if ( ret !== undefined ) {
30.3338 + event.result = ret;
30.3339 + if ( ret === false ) {
30.3340 + event.preventDefault();
30.3341 + event.stopPropagation();
30.3342 + }
30.3343 + }
30.3344 + }
30.3345 + }
30.3346 + }
30.3347 +
30.3348 + // Call the postDispatch hook for the mapped type
30.3349 + if ( special.postDispatch ) {
30.3350 + special.postDispatch.call( this, event );
30.3351 + }
30.3352 +
30.3353 + return event.result;
30.3354 + },
30.3355 +
30.3356 + // Includes some event props shared by KeyEvent and MouseEvent
30.3357 + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
30.3358 + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
30.3359 +
30.3360 + fixHooks: {},
30.3361 +
30.3362 + keyHooks: {
30.3363 + props: "char charCode key keyCode".split(" "),
30.3364 + filter: function( event, original ) {
30.3365 +
30.3366 + // Add which for key events
30.3367 + if ( event.which == null ) {
30.3368 + event.which = original.charCode != null ? original.charCode : original.keyCode;
30.3369 + }
30.3370 +
30.3371 + return event;
30.3372 + }
30.3373 + },
30.3374 +
30.3375 + mouseHooks: {
30.3376 + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
30.3377 + filter: function( event, original ) {
30.3378 + var eventDoc, doc, body,
30.3379 + button = original.button,
30.3380 + fromElement = original.fromElement;
30.3381 +
30.3382 + // Calculate pageX/Y if missing and clientX/Y available
30.3383 + if ( event.pageX == null && original.clientX != null ) {
30.3384 + eventDoc = event.target.ownerDocument || document;
30.3385 + doc = eventDoc.documentElement;
30.3386 + body = eventDoc.body;
30.3387 +
30.3388 + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
30.3389 + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
30.3390 + }
30.3391 +
30.3392 + // Add relatedTarget, if necessary
30.3393 + if ( !event.relatedTarget && fromElement ) {
30.3394 + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
30.3395 + }
30.3396 +
30.3397 + // Add which for click: 1 === left; 2 === middle; 3 === right
30.3398 + // Note: button is not normalized, so don't use it
30.3399 + if ( !event.which && button !== undefined ) {
30.3400 + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
30.3401 + }
30.3402 +
30.3403 + return event;
30.3404 + }
30.3405 + },
30.3406 +
30.3407 + fix: function( event ) {
30.3408 + if ( event[ jQuery.expando ] ) {
30.3409 + return event;
30.3410 + }
30.3411 +
30.3412 + // Create a writable copy of the event object and normalize some properties
30.3413 + var i, prop,
30.3414 + originalEvent = event,
30.3415 + fixHook = jQuery.event.fixHooks[ event.type ] || {},
30.3416 + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
30.3417 +
30.3418 + event = jQuery.Event( originalEvent );
30.3419 +
30.3420 + for ( i = copy.length; i; ) {
30.3421 + prop = copy[ --i ];
30.3422 + event[ prop ] = originalEvent[ prop ];
30.3423 + }
30.3424 +
30.3425 + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
30.3426 + if ( !event.target ) {
30.3427 + event.target = originalEvent.srcElement || document;
30.3428 + }
30.3429 +
30.3430 + // Target should not be a text node (#504, Safari)
30.3431 + if ( event.target.nodeType === 3 ) {
30.3432 + event.target = event.target.parentNode;
30.3433 + }
30.3434 +
30.3435 + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
30.3436 + if ( event.metaKey === undefined ) {
30.3437 + event.metaKey = event.ctrlKey;
30.3438 + }
30.3439 +
30.3440 + return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
30.3441 + },
30.3442 +
30.3443 + special: {
30.3444 + ready: {
30.3445 + // Make sure the ready event is setup
30.3446 + setup: jQuery.bindReady
30.3447 + },
30.3448 +
30.3449 + load: {
30.3450 + // Prevent triggered image.load events from bubbling to window.load
30.3451 + noBubble: true
30.3452 + },
30.3453 +
30.3454 + focus: {
30.3455 + delegateType: "focusin"
30.3456 + },
30.3457 + blur: {
30.3458 + delegateType: "focusout"
30.3459 + },
30.3460 +
30.3461 + beforeunload: {
30.3462 + setup: function( data, namespaces, eventHandle ) {
30.3463 + // We only want to do this special case on windows
30.3464 + if ( jQuery.isWindow( this ) ) {
30.3465 + this.onbeforeunload = eventHandle;
30.3466 + }
30.3467 + },
30.3468 +
30.3469 + teardown: function( namespaces, eventHandle ) {
30.3470 + if ( this.onbeforeunload === eventHandle ) {
30.3471 + this.onbeforeunload = null;
30.3472 + }
30.3473 + }
30.3474 + }
30.3475 + },
30.3476 +
30.3477 + simulate: function( type, elem, event, bubble ) {
30.3478 + // Piggyback on a donor event to simulate a different one.
30.3479 + // Fake originalEvent to avoid donor's stopPropagation, but if the
30.3480 + // simulated event prevents default then we do the same on the donor.
30.3481 + var e = jQuery.extend(
30.3482 + new jQuery.Event(),
30.3483 + event,
30.3484 + { type: type,
30.3485 + isSimulated: true,
30.3486 + originalEvent: {}
30.3487 + }
30.3488 + );
30.3489 + if ( bubble ) {
30.3490 + jQuery.event.trigger( e, null, elem );
30.3491 + } else {
30.3492 + jQuery.event.dispatch.call( elem, e );
30.3493 + }
30.3494 + if ( e.isDefaultPrevented() ) {
30.3495 + event.preventDefault();
30.3496 + }
30.3497 + }
30.3498 +};
30.3499 +
30.3500 +// Some plugins are using, but it's undocumented/deprecated and will be removed.
30.3501 +// The 1.7 special event interface should provide all the hooks needed now.
30.3502 +jQuery.event.handle = jQuery.event.dispatch;
30.3503 +
30.3504 +jQuery.removeEvent = document.removeEventListener ?
30.3505 + function( elem, type, handle ) {
30.3506 + if ( elem.removeEventListener ) {
30.3507 + elem.removeEventListener( type, handle, false );
30.3508 + }
30.3509 + } :
30.3510 + function( elem, type, handle ) {
30.3511 + if ( elem.detachEvent ) {
30.3512 + elem.detachEvent( "on" + type, handle );
30.3513 + }
30.3514 + };
30.3515 +
30.3516 +jQuery.Event = function( src, props ) {
30.3517 + // Allow instantiation without the 'new' keyword
30.3518 + if ( !(this instanceof jQuery.Event) ) {
30.3519 + return new jQuery.Event( src, props );
30.3520 + }
30.3521 +
30.3522 + // Event object
30.3523 + if ( src && src.type ) {
30.3524 + this.originalEvent = src;
30.3525 + this.type = src.type;
30.3526 +
30.3527 + // Events bubbling up the document may have been marked as prevented
30.3528 + // by a handler lower down the tree; reflect the correct value.
30.3529 + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
30.3530 + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
30.3531 +
30.3532 + // Event type
30.3533 + } else {
30.3534 + this.type = src;
30.3535 + }
30.3536 +
30.3537 + // Put explicitly provided properties onto the event object
30.3538 + if ( props ) {
30.3539 + jQuery.extend( this, props );
30.3540 + }
30.3541 +
30.3542 + // Create a timestamp if incoming event doesn't have one
30.3543 + this.timeStamp = src && src.timeStamp || jQuery.now();
30.3544 +
30.3545 + // Mark it as fixed
30.3546 + this[ jQuery.expando ] = true;
30.3547 +};
30.3548 +
30.3549 +function returnFalse() {
30.3550 + return false;
30.3551 +}
30.3552 +function returnTrue() {
30.3553 + return true;
30.3554 +}
30.3555 +
30.3556 +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
30.3557 +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
30.3558 +jQuery.Event.prototype = {
30.3559 + preventDefault: function() {
30.3560 + this.isDefaultPrevented = returnTrue;
30.3561 +
30.3562 + var e = this.originalEvent;
30.3563 + if ( !e ) {
30.3564 + return;
30.3565 + }
30.3566 +
30.3567 + // if preventDefault exists run it on the original event
30.3568 + if ( e.preventDefault ) {
30.3569 + e.preventDefault();
30.3570 +
30.3571 + // otherwise set the returnValue property of the original event to false (IE)
30.3572 + } else {
30.3573 + e.returnValue = false;
30.3574 + }
30.3575 + },
30.3576 + stopPropagation: function() {
30.3577 + this.isPropagationStopped = returnTrue;
30.3578 +
30.3579 + var e = this.originalEvent;
30.3580 + if ( !e ) {
30.3581 + return;
30.3582 + }
30.3583 + // if stopPropagation exists run it on the original event
30.3584 + if ( e.stopPropagation ) {
30.3585 + e.stopPropagation();
30.3586 + }
30.3587 + // otherwise set the cancelBubble property of the original event to true (IE)
30.3588 + e.cancelBubble = true;
30.3589 + },
30.3590 + stopImmediatePropagation: function() {
30.3591 + this.isImmediatePropagationStopped = returnTrue;
30.3592 + this.stopPropagation();
30.3593 + },
30.3594 + isDefaultPrevented: returnFalse,
30.3595 + isPropagationStopped: returnFalse,
30.3596 + isImmediatePropagationStopped: returnFalse
30.3597 +};
30.3598 +
30.3599 +// Create mouseenter/leave events using mouseover/out and event-time checks
30.3600 +jQuery.each({
30.3601 + mouseenter: "mouseover",
30.3602 + mouseleave: "mouseout"
30.3603 +}, function( orig, fix ) {
30.3604 + jQuery.event.special[ orig ] = {
30.3605 + delegateType: fix,
30.3606 + bindType: fix,
30.3607 +
30.3608 + handle: function( event ) {
30.3609 + var target = this,
30.3610 + related = event.relatedTarget,
30.3611 + handleObj = event.handleObj,
30.3612 + selector = handleObj.selector,
30.3613 + ret;
30.3614 +
30.3615 + // For mousenter/leave call the handler if related is outside the target.
30.3616 + // NB: No relatedTarget if the mouse left/entered the browser window
30.3617 + if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
30.3618 + event.type = handleObj.origType;
30.3619 + ret = handleObj.handler.apply( this, arguments );
30.3620 + event.type = fix;
30.3621 + }
30.3622 + return ret;
30.3623 + }
30.3624 + };
30.3625 +});
30.3626 +
30.3627 +// IE submit delegation
30.3628 +if ( !jQuery.support.submitBubbles ) {
30.3629 +
30.3630 + jQuery.event.special.submit = {
30.3631 + setup: function() {
30.3632 + // Only need this for delegated form submit events
30.3633 + if ( jQuery.nodeName( this, "form" ) ) {
30.3634 + return false;
30.3635 + }
30.3636 +
30.3637 + // Lazy-add a submit handler when a descendant form may potentially be submitted
30.3638 + jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
30.3639 + // Node name check avoids a VML-related crash in IE (#9807)
30.3640 + var elem = e.target,
30.3641 + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
30.3642 + if ( form && !form._submit_attached ) {
30.3643 + jQuery.event.add( form, "submit._submit", function( event ) {
30.3644 + event._submit_bubble = true;
30.3645 + });
30.3646 + form._submit_attached = true;
30.3647 + }
30.3648 + });
30.3649 + // return undefined since we don't need an event listener
30.3650 + },
30.3651 +
30.3652 + postDispatch: function( event ) {
30.3653 + // If form was submitted by the user, bubble the event up the tree
30.3654 + if ( event._submit_bubble ) {
30.3655 + delete event._submit_bubble;
30.3656 + if ( this.parentNode && !event.isTrigger ) {
30.3657 + jQuery.event.simulate( "submit", this.parentNode, event, true );
30.3658 + }
30.3659 + }
30.3660 + },
30.3661 +
30.3662 + teardown: function() {
30.3663 + // Only need this for delegated form submit events
30.3664 + if ( jQuery.nodeName( this, "form" ) ) {
30.3665 + return false;
30.3666 + }
30.3667 +
30.3668 + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
30.3669 + jQuery.event.remove( this, "._submit" );
30.3670 + }
30.3671 + };
30.3672 +}
30.3673 +
30.3674 +// IE change delegation and checkbox/radio fix
30.3675 +if ( !jQuery.support.changeBubbles ) {
30.3676 +
30.3677 + jQuery.event.special.change = {
30.3678 +
30.3679 + setup: function() {
30.3680 +
30.3681 + if ( rformElems.test( this.nodeName ) ) {
30.3682 + // IE doesn't fire change on a check/radio until blur; trigger it on click
30.3683 + // after a propertychange. Eat the blur-change in special.change.handle.
30.3684 + // This still fires onchange a second time for check/radio after blur.
30.3685 + if ( this.type === "checkbox" || this.type === "radio" ) {
30.3686 + jQuery.event.add( this, "propertychange._change", function( event ) {
30.3687 + if ( event.originalEvent.propertyName === "checked" ) {
30.3688 + this._just_changed = true;
30.3689 + }
30.3690 + });
30.3691 + jQuery.event.add( this, "click._change", function( event ) {
30.3692 + if ( this._just_changed && !event.isTrigger ) {
30.3693 + this._just_changed = false;
30.3694 + jQuery.event.simulate( "change", this, event, true );
30.3695 + }
30.3696 + });
30.3697 + }
30.3698 + return false;
30.3699 + }
30.3700 + // Delegated event; lazy-add a change handler on descendant inputs
30.3701 + jQuery.event.add( this, "beforeactivate._change", function( e ) {
30.3702 + var elem = e.target;
30.3703 +
30.3704 + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
30.3705 + jQuery.event.add( elem, "change._change", function( event ) {
30.3706 + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
30.3707 + jQuery.event.simulate( "change", this.parentNode, event, true );
30.3708 + }
30.3709 + });
30.3710 + elem._change_attached = true;
30.3711 + }
30.3712 + });
30.3713 + },
30.3714 +
30.3715 + handle: function( event ) {
30.3716 + var elem = event.target;
30.3717 +
30.3718 + // Swallow native change events from checkbox/radio, we already triggered them above
30.3719 + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
30.3720 + return event.handleObj.handler.apply( this, arguments );
30.3721 + }
30.3722 + },
30.3723 +
30.3724 + teardown: function() {
30.3725 + jQuery.event.remove( this, "._change" );
30.3726 +
30.3727 + return rformElems.test( this.nodeName );
30.3728 + }
30.3729 + };
30.3730 +}
30.3731 +
30.3732 +// Create "bubbling" focus and blur events
30.3733 +if ( !jQuery.support.focusinBubbles ) {
30.3734 + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
30.3735 +
30.3736 + // Attach a single capturing handler while someone wants focusin/focusout
30.3737 + var attaches = 0,
30.3738 + handler = function( event ) {
30.3739 + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
30.3740 + };
30.3741 +
30.3742 + jQuery.event.special[ fix ] = {
30.3743 + setup: function() {
30.3744 + if ( attaches++ === 0 ) {
30.3745 + document.addEventListener( orig, handler, true );
30.3746 + }
30.3747 + },
30.3748 + teardown: function() {
30.3749 + if ( --attaches === 0 ) {
30.3750 + document.removeEventListener( orig, handler, true );
30.3751 + }
30.3752 + }
30.3753 + };
30.3754 + });
30.3755 +}
30.3756 +
30.3757 +jQuery.fn.extend({
30.3758 +
30.3759 + on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
30.3760 + var origFn, type;
30.3761 +
30.3762 + // Types can be a map of types/handlers
30.3763 + if ( typeof types === "object" ) {
30.3764 + // ( types-Object, selector, data )
30.3765 + if ( typeof selector !== "string" ) { // && selector != null
30.3766 + // ( types-Object, data )
30.3767 + data = data || selector;
30.3768 + selector = undefined;
30.3769 + }
30.3770 + for ( type in types ) {
30.3771 + this.on( type, selector, data, types[ type ], one );
30.3772 + }
30.3773 + return this;
30.3774 + }
30.3775 +
30.3776 + if ( data == null && fn == null ) {
30.3777 + // ( types, fn )
30.3778 + fn = selector;
30.3779 + data = selector = undefined;
30.3780 + } else if ( fn == null ) {
30.3781 + if ( typeof selector === "string" ) {
30.3782 + // ( types, selector, fn )
30.3783 + fn = data;
30.3784 + data = undefined;
30.3785 + } else {
30.3786 + // ( types, data, fn )
30.3787 + fn = data;
30.3788 + data = selector;
30.3789 + selector = undefined;
30.3790 + }
30.3791 + }
30.3792 + if ( fn === false ) {
30.3793 + fn = returnFalse;
30.3794 + } else if ( !fn ) {
30.3795 + return this;
30.3796 + }
30.3797 +
30.3798 + if ( one === 1 ) {
30.3799 + origFn = fn;
30.3800 + fn = function( event ) {
30.3801 + // Can use an empty set, since event contains the info
30.3802 + jQuery().off( event );
30.3803 + return origFn.apply( this, arguments );
30.3804 + };
30.3805 + // Use same guid so caller can remove using origFn
30.3806 + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
30.3807 + }
30.3808 + return this.each( function() {
30.3809 + jQuery.event.add( this, types, fn, data, selector );
30.3810 + });
30.3811 + },
30.3812 + one: function( types, selector, data, fn ) {
30.3813 + return this.on( types, selector, data, fn, 1 );
30.3814 + },
30.3815 + off: function( types, selector, fn ) {
30.3816 + if ( types && types.preventDefault && types.handleObj ) {
30.3817 + // ( event ) dispatched jQuery.Event
30.3818 + var handleObj = types.handleObj;
30.3819 + jQuery( types.delegateTarget ).off(
30.3820 + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
30.3821 + handleObj.selector,
30.3822 + handleObj.handler
30.3823 + );
30.3824 + return this;
30.3825 + }
30.3826 + if ( typeof types === "object" ) {
30.3827 + // ( types-object [, selector] )
30.3828 + for ( var type in types ) {
30.3829 + this.off( type, selector, types[ type ] );
30.3830 + }
30.3831 + return this;
30.3832 + }
30.3833 + if ( selector === false || typeof selector === "function" ) {
30.3834 + // ( types [, fn] )
30.3835 + fn = selector;
30.3836 + selector = undefined;
30.3837 + }
30.3838 + if ( fn === false ) {
30.3839 + fn = returnFalse;
30.3840 + }
30.3841 + return this.each(function() {
30.3842 + jQuery.event.remove( this, types, fn, selector );
30.3843 + });
30.3844 + },
30.3845 +
30.3846 + bind: function( types, data, fn ) {
30.3847 + return this.on( types, null, data, fn );
30.3848 + },
30.3849 + unbind: function( types, fn ) {
30.3850 + return this.off( types, null, fn );
30.3851 + },
30.3852 +
30.3853 + live: function( types, data, fn ) {
30.3854 + jQuery( this.context ).on( types, this.selector, data, fn );
30.3855 + return this;
30.3856 + },
30.3857 + die: function( types, fn ) {
30.3858 + jQuery( this.context ).off( types, this.selector || "**", fn );
30.3859 + return this;
30.3860 + },
30.3861 +
30.3862 + delegate: function( selector, types, data, fn ) {
30.3863 + return this.on( types, selector, data, fn );
30.3864 + },
30.3865 + undelegate: function( selector, types, fn ) {
30.3866 + // ( namespace ) or ( selector, types [, fn] )
30.3867 + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
30.3868 + },
30.3869 +
30.3870 + trigger: function( type, data ) {
30.3871 + return this.each(function() {
30.3872 + jQuery.event.trigger( type, data, this );
30.3873 + });
30.3874 + },
30.3875 + triggerHandler: function( type, data ) {
30.3876 + if ( this[0] ) {
30.3877 + return jQuery.event.trigger( type, data, this[0], true );
30.3878 + }
30.3879 + },
30.3880 +
30.3881 + toggle: function( fn ) {
30.3882 + // Save reference to arguments for access in closure
30.3883 + var args = arguments,
30.3884 + guid = fn.guid || jQuery.guid++,
30.3885 + i = 0,
30.3886 + toggler = function( event ) {
30.3887 + // Figure out which function to execute
30.3888 + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
30.3889 + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
30.3890 +
30.3891 + // Make sure that clicks stop
30.3892 + event.preventDefault();
30.3893 +
30.3894 + // and execute the function
30.3895 + return args[ lastToggle ].apply( this, arguments ) || false;
30.3896 + };
30.3897 +
30.3898 + // link all the functions, so any of them can unbind this click handler
30.3899 + toggler.guid = guid;
30.3900 + while ( i < args.length ) {
30.3901 + args[ i++ ].guid = guid;
30.3902 + }
30.3903 +
30.3904 + return this.click( toggler );
30.3905 + },
30.3906 +
30.3907 + hover: function( fnOver, fnOut ) {
30.3908 + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
30.3909 + }
30.3910 +});
30.3911 +
30.3912 +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
30.3913 + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
30.3914 + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
30.3915 +
30.3916 + // Handle event binding
30.3917 + jQuery.fn[ name ] = function( data, fn ) {
30.3918 + if ( fn == null ) {
30.3919 + fn = data;
30.3920 + data = null;
30.3921 + }
30.3922 +
30.3923 + return arguments.length > 0 ?
30.3924 + this.on( name, null, data, fn ) :
30.3925 + this.trigger( name );
30.3926 + };
30.3927 +
30.3928 + if ( jQuery.attrFn ) {
30.3929 + jQuery.attrFn[ name ] = true;
30.3930 + }
30.3931 +
30.3932 + if ( rkeyEvent.test( name ) ) {
30.3933 + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
30.3934 + }
30.3935 +
30.3936 + if ( rmouseEvent.test( name ) ) {
30.3937 + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
30.3938 + }
30.3939 +});
30.3940 +
30.3941 +
30.3942 +
30.3943 +/*!
30.3944 + * Sizzle CSS Selector Engine
30.3945 + * Copyright 2011, The Dojo Foundation
30.3946 + * Released under the MIT, BSD, and GPL Licenses.
30.3947 + * More information: http://sizzlejs.com/
30.3948 + */
30.3949 +(function(){
30.3950 +
30.3951 +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
30.3952 + expando = "sizcache" + (Math.random() + '').replace('.', ''),
30.3953 + done = 0,
30.3954 + toString = Object.prototype.toString,
30.3955 + hasDuplicate = false,
30.3956 + baseHasDuplicate = true,
30.3957 + rBackslash = /\\/g,
30.3958 + rReturn = /\r\n/g,
30.3959 + rNonWord = /\W/;
30.3960 +
30.3961 +// Here we check if the JavaScript engine is using some sort of
30.3962 +// optimization where it does not always call our comparision
30.3963 +// function. If that is the case, discard the hasDuplicate value.
30.3964 +// Thus far that includes Google Chrome.
30.3965 +[0, 0].sort(function() {
30.3966 + baseHasDuplicate = false;
30.3967 + return 0;
30.3968 +});
30.3969 +
30.3970 +var Sizzle = function( selector, context, results, seed ) {
30.3971 + results = results || [];
30.3972 + context = context || document;
30.3973 +
30.3974 + var origContext = context;
30.3975 +
30.3976 + if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
30.3977 + return [];
30.3978 + }
30.3979 +
30.3980 + if ( !selector || typeof selector !== "string" ) {
30.3981 + return results;
30.3982 + }
30.3983 +
30.3984 + var m, set, checkSet, extra, ret, cur, pop, i,
30.3985 + prune = true,
30.3986 + contextXML = Sizzle.isXML( context ),
30.3987 + parts = [],
30.3988 + soFar = selector;
30.3989 +
30.3990 + // Reset the position of the chunker regexp (start from head)
30.3991 + do {
30.3992 + chunker.exec( "" );
30.3993 + m = chunker.exec( soFar );
30.3994 +
30.3995 + if ( m ) {
30.3996 + soFar = m[3];
30.3997 +
30.3998 + parts.push( m[1] );
30.3999 +
30.4000 + if ( m[2] ) {
30.4001 + extra = m[3];
30.4002 + break;
30.4003 + }
30.4004 + }
30.4005 + } while ( m );
30.4006 +
30.4007 + if ( parts.length > 1 && origPOS.exec( selector ) ) {
30.4008 +
30.4009 + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
30.4010 + set = posProcess( parts[0] + parts[1], context, seed );
30.4011 +
30.4012 + } else {
30.4013 + set = Expr.relative[ parts[0] ] ?
30.4014 + [ context ] :
30.4015 + Sizzle( parts.shift(), context );
30.4016 +
30.4017 + while ( parts.length ) {
30.4018 + selector = parts.shift();
30.4019 +
30.4020 + if ( Expr.relative[ selector ] ) {
30.4021 + selector += parts.shift();
30.4022 + }
30.4023 +
30.4024 + set = posProcess( selector, set, seed );
30.4025 + }
30.4026 + }
30.4027 +
30.4028 + } else {
30.4029 + // Take a shortcut and set the context if the root selector is an ID
30.4030 + // (but not if it'll be faster if the inner selector is an ID)
30.4031 + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
30.4032 + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
30.4033 +
30.4034 + ret = Sizzle.find( parts.shift(), context, contextXML );
30.4035 + context = ret.expr ?
30.4036 + Sizzle.filter( ret.expr, ret.set )[0] :
30.4037 + ret.set[0];
30.4038 + }
30.4039 +
30.4040 + if ( context ) {
30.4041 + ret = seed ?
30.4042 + { expr: parts.pop(), set: makeArray(seed) } :
30.4043 + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
30.4044 +
30.4045 + set = ret.expr ?
30.4046 + Sizzle.filter( ret.expr, ret.set ) :
30.4047 + ret.set;
30.4048 +
30.4049 + if ( parts.length > 0 ) {
30.4050 + checkSet = makeArray( set );
30.4051 +
30.4052 + } else {
30.4053 + prune = false;
30.4054 + }
30.4055 +
30.4056 + while ( parts.length ) {
30.4057 + cur = parts.pop();
30.4058 + pop = cur;
30.4059 +
30.4060 + if ( !Expr.relative[ cur ] ) {
30.4061 + cur = "";
30.4062 + } else {
30.4063 + pop = parts.pop();
30.4064 + }
30.4065 +
30.4066 + if ( pop == null ) {
30.4067 + pop = context;
30.4068 + }
30.4069 +
30.4070 + Expr.relative[ cur ]( checkSet, pop, contextXML );
30.4071 + }
30.4072 +
30.4073 + } else {
30.4074 + checkSet = parts = [];
30.4075 + }
30.4076 + }
30.4077 +
30.4078 + if ( !checkSet ) {
30.4079 + checkSet = set;
30.4080 + }
30.4081 +
30.4082 + if ( !checkSet ) {
30.4083 + Sizzle.error( cur || selector );
30.4084 + }
30.4085 +
30.4086 + if ( toString.call(checkSet) === "[object Array]" ) {
30.4087 + if ( !prune ) {
30.4088 + results.push.apply( results, checkSet );
30.4089 +
30.4090 + } else if ( context && context.nodeType === 1 ) {
30.4091 + for ( i = 0; checkSet[i] != null; i++ ) {
30.4092 + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
30.4093 + results.push( set[i] );
30.4094 + }
30.4095 + }
30.4096 +
30.4097 + } else {
30.4098 + for ( i = 0; checkSet[i] != null; i++ ) {
30.4099 + if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
30.4100 + results.push( set[i] );
30.4101 + }
30.4102 + }
30.4103 + }
30.4104 +
30.4105 + } else {
30.4106 + makeArray( checkSet, results );
30.4107 + }
30.4108 +
30.4109 + if ( extra ) {
30.4110 + Sizzle( extra, origContext, results, seed );
30.4111 + Sizzle.uniqueSort( results );
30.4112 + }
30.4113 +
30.4114 + return results;
30.4115 +};
30.4116 +
30.4117 +Sizzle.uniqueSort = function( results ) {
30.4118 + if ( sortOrder ) {
30.4119 + hasDuplicate = baseHasDuplicate;
30.4120 + results.sort( sortOrder );
30.4121 +
30.4122 + if ( hasDuplicate ) {
30.4123 + for ( var i = 1; i < results.length; i++ ) {
30.4124 + if ( results[i] === results[ i - 1 ] ) {
30.4125 + results.splice( i--, 1 );
30.4126 + }
30.4127 + }
30.4128 + }
30.4129 + }
30.4130 +
30.4131 + return results;
30.4132 +};
30.4133 +
30.4134 +Sizzle.matches = function( expr, set ) {
30.4135 + return Sizzle( expr, null, null, set );
30.4136 +};
30.4137 +
30.4138 +Sizzle.matchesSelector = function( node, expr ) {
30.4139 + return Sizzle( expr, null, null, [node] ).length > 0;
30.4140 +};
30.4141 +
30.4142 +Sizzle.find = function( expr, context, isXML ) {
30.4143 + var set, i, len, match, type, left;
30.4144 +
30.4145 + if ( !expr ) {
30.4146 + return [];
30.4147 + }
30.4148 +
30.4149 + for ( i = 0, len = Expr.order.length; i < len; i++ ) {
30.4150 + type = Expr.order[i];
30.4151 +
30.4152 + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
30.4153 + left = match[1];
30.4154 + match.splice( 1, 1 );
30.4155 +
30.4156 + if ( left.substr( left.length - 1 ) !== "\\" ) {
30.4157 + match[1] = (match[1] || "").replace( rBackslash, "" );
30.4158 + set = Expr.find[ type ]( match, context, isXML );
30.4159 +
30.4160 + if ( set != null ) {
30.4161 + expr = expr.replace( Expr.match[ type ], "" );
30.4162 + break;
30.4163 + }
30.4164 + }
30.4165 + }
30.4166 + }
30.4167 +
30.4168 + if ( !set ) {
30.4169 + set = typeof context.getElementsByTagName !== "undefined" ?
30.4170 + context.getElementsByTagName( "*" ) :
30.4171 + [];
30.4172 + }
30.4173 +
30.4174 + return { set: set, expr: expr };
30.4175 +};
30.4176 +
30.4177 +Sizzle.filter = function( expr, set, inplace, not ) {
30.4178 + var match, anyFound,
30.4179 + type, found, item, filter, left,
30.4180 + i, pass,
30.4181 + old = expr,
30.4182 + result = [],
30.4183 + curLoop = set,
30.4184 + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
30.4185 +
30.4186 + while ( expr && set.length ) {
30.4187 + for ( type in Expr.filter ) {
30.4188 + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
30.4189 + filter = Expr.filter[ type ];
30.4190 + left = match[1];
30.4191 +
30.4192 + anyFound = false;
30.4193 +
30.4194 + match.splice(1,1);
30.4195 +
30.4196 + if ( left.substr( left.length - 1 ) === "\\" ) {
30.4197 + continue;
30.4198 + }
30.4199 +
30.4200 + if ( curLoop === result ) {
30.4201 + result = [];
30.4202 + }
30.4203 +
30.4204 + if ( Expr.preFilter[ type ] ) {
30.4205 + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
30.4206 +
30.4207 + if ( !match ) {
30.4208 + anyFound = found = true;
30.4209 +
30.4210 + } else if ( match === true ) {
30.4211 + continue;
30.4212 + }
30.4213 + }
30.4214 +
30.4215 + if ( match ) {
30.4216 + for ( i = 0; (item = curLoop[i]) != null; i++ ) {
30.4217 + if ( item ) {
30.4218 + found = filter( item, match, i, curLoop );
30.4219 + pass = not ^ found;
30.4220 +
30.4221 + if ( inplace && found != null ) {
30.4222 + if ( pass ) {
30.4223 + anyFound = true;
30.4224 +
30.4225 + } else {
30.4226 + curLoop[i] = false;
30.4227 + }
30.4228 +
30.4229 + } else if ( pass ) {
30.4230 + result.push( item );
30.4231 + anyFound = true;
30.4232 + }
30.4233 + }
30.4234 + }
30.4235 + }
30.4236 +
30.4237 + if ( found !== undefined ) {
30.4238 + if ( !inplace ) {
30.4239 + curLoop = result;
30.4240 + }
30.4241 +
30.4242 + expr = expr.replace( Expr.match[ type ], "" );
30.4243 +
30.4244 + if ( !anyFound ) {
30.4245 + return [];
30.4246 + }
30.4247 +
30.4248 + break;
30.4249 + }
30.4250 + }
30.4251 + }
30.4252 +
30.4253 + // Improper expression
30.4254 + if ( expr === old ) {
30.4255 + if ( anyFound == null ) {
30.4256 + Sizzle.error( expr );
30.4257 +
30.4258 + } else {
30.4259 + break;
30.4260 + }
30.4261 + }
30.4262 +
30.4263 + old = expr;
30.4264 + }
30.4265 +
30.4266 + return curLoop;
30.4267 +};
30.4268 +
30.4269 +Sizzle.error = function( msg ) {
30.4270 + throw new Error( "Syntax error, unrecognized expression: " + msg );
30.4271 +};
30.4272 +
30.4273 +/**
30.4274 + * Utility function for retreiving the text value of an array of DOM nodes
30.4275 + * @param {Array|Element} elem
30.4276 + */
30.4277 +var getText = Sizzle.getText = function( elem ) {
30.4278 + var i, node,
30.4279 + nodeType = elem.nodeType,
30.4280 + ret = "";
30.4281 +
30.4282 + if ( nodeType ) {
30.4283 + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
30.4284 + // Use textContent || innerText for elements
30.4285 + if ( typeof elem.textContent === 'string' ) {
30.4286 + return elem.textContent;
30.4287 + } else if ( typeof elem.innerText === 'string' ) {
30.4288 + // Replace IE's carriage returns
30.4289 + return elem.innerText.replace( rReturn, '' );
30.4290 + } else {
30.4291 + // Traverse it's children
30.4292 + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
30.4293 + ret += getText( elem );
30.4294 + }
30.4295 + }
30.4296 + } else if ( nodeType === 3 || nodeType === 4 ) {
30.4297 + return elem.nodeValue;
30.4298 + }
30.4299 + } else {
30.4300 +
30.4301 + // If no nodeType, this is expected to be an array
30.4302 + for ( i = 0; (node = elem[i]); i++ ) {
30.4303 + // Do not traverse comment nodes
30.4304 + if ( node.nodeType !== 8 ) {
30.4305 + ret += getText( node );
30.4306 + }
30.4307 + }
30.4308 + }
30.4309 + return ret;
30.4310 +};
30.4311 +
30.4312 +var Expr = Sizzle.selectors = {
30.4313 + order: [ "ID", "NAME", "TAG" ],
30.4314 +
30.4315 + match: {
30.4316 + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
30.4317 + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
30.4318 + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
30.4319 + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
30.4320 + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
30.4321 + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
30.4322 + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
30.4323 + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
30.4324 + },
30.4325 +
30.4326 + leftMatch: {},
30.4327 +
30.4328 + attrMap: {
30.4329 + "class": "className",
30.4330 + "for": "htmlFor"
30.4331 + },
30.4332 +
30.4333 + attrHandle: {
30.4334 + href: function( elem ) {
30.4335 + return elem.getAttribute( "href" );
30.4336 + },
30.4337 + type: function( elem ) {
30.4338 + return elem.getAttribute( "type" );
30.4339 + }
30.4340 + },
30.4341 +
30.4342 + relative: {
30.4343 + "+": function(checkSet, part){
30.4344 + var isPartStr = typeof part === "string",
30.4345 + isTag = isPartStr && !rNonWord.test( part ),
30.4346 + isPartStrNotTag = isPartStr && !isTag;
30.4347 +
30.4348 + if ( isTag ) {
30.4349 + part = part.toLowerCase();
30.4350 + }
30.4351 +
30.4352 + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
30.4353 + if ( (elem = checkSet[i]) ) {
30.4354 + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
30.4355 +
30.4356 + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
30.4357 + elem || false :
30.4358 + elem === part;
30.4359 + }
30.4360 + }
30.4361 +
30.4362 + if ( isPartStrNotTag ) {
30.4363 + Sizzle.filter( part, checkSet, true );
30.4364 + }
30.4365 + },
30.4366 +
30.4367 + ">": function( checkSet, part ) {
30.4368 + var elem,
30.4369 + isPartStr = typeof part === "string",
30.4370 + i = 0,
30.4371 + l = checkSet.length;
30.4372 +
30.4373 + if ( isPartStr && !rNonWord.test( part ) ) {
30.4374 + part = part.toLowerCase();
30.4375 +
30.4376 + for ( ; i < l; i++ ) {
30.4377 + elem = checkSet[i];
30.4378 +
30.4379 + if ( elem ) {
30.4380 + var parent = elem.parentNode;
30.4381 + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
30.4382 + }
30.4383 + }
30.4384 +
30.4385 + } else {
30.4386 + for ( ; i < l; i++ ) {
30.4387 + elem = checkSet[i];
30.4388 +
30.4389 + if ( elem ) {
30.4390 + checkSet[i] = isPartStr ?
30.4391 + elem.parentNode :
30.4392 + elem.parentNode === part;
30.4393 + }
30.4394 + }
30.4395 +
30.4396 + if ( isPartStr ) {
30.4397 + Sizzle.filter( part, checkSet, true );
30.4398 + }
30.4399 + }
30.4400 + },
30.4401 +
30.4402 + "": function(checkSet, part, isXML){
30.4403 + var nodeCheck,
30.4404 + doneName = done++,
30.4405 + checkFn = dirCheck;
30.4406 +
30.4407 + if ( typeof part === "string" && !rNonWord.test( part ) ) {
30.4408 + part = part.toLowerCase();
30.4409 + nodeCheck = part;
30.4410 + checkFn = dirNodeCheck;
30.4411 + }
30.4412 +
30.4413 + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
30.4414 + },
30.4415 +
30.4416 + "~": function( checkSet, part, isXML ) {
30.4417 + var nodeCheck,
30.4418 + doneName = done++,
30.4419 + checkFn = dirCheck;
30.4420 +
30.4421 + if ( typeof part === "string" && !rNonWord.test( part ) ) {
30.4422 + part = part.toLowerCase();
30.4423 + nodeCheck = part;
30.4424 + checkFn = dirNodeCheck;
30.4425 + }
30.4426 +
30.4427 + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
30.4428 + }
30.4429 + },
30.4430 +
30.4431 + find: {
30.4432 + ID: function( match, context, isXML ) {
30.4433 + if ( typeof context.getElementById !== "undefined" && !isXML ) {
30.4434 + var m = context.getElementById(match[1]);
30.4435 + // Check parentNode to catch when Blackberry 4.6 returns
30.4436 + // nodes that are no longer in the document #6963
30.4437 + return m && m.parentNode ? [m] : [];
30.4438 + }
30.4439 + },
30.4440 +
30.4441 + NAME: function( match, context ) {
30.4442 + if ( typeof context.getElementsByName !== "undefined" ) {
30.4443 + var ret = [],
30.4444 + results = context.getElementsByName( match[1] );
30.4445 +
30.4446 + for ( var i = 0, l = results.length; i < l; i++ ) {
30.4447 + if ( results[i].getAttribute("name") === match[1] ) {
30.4448 + ret.push( results[i] );
30.4449 + }
30.4450 + }
30.4451 +
30.4452 + return ret.length === 0 ? null : ret;
30.4453 + }
30.4454 + },
30.4455 +
30.4456 + TAG: function( match, context ) {
30.4457 + if ( typeof context.getElementsByTagName !== "undefined" ) {
30.4458 + return context.getElementsByTagName( match[1] );
30.4459 + }
30.4460 + }
30.4461 + },
30.4462 + preFilter: {
30.4463 + CLASS: function( match, curLoop, inplace, result, not, isXML ) {
30.4464 + match = " " + match[1].replace( rBackslash, "" ) + " ";
30.4465 +
30.4466 + if ( isXML ) {
30.4467 + return match;
30.4468 + }
30.4469 +
30.4470 + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
30.4471 + if ( elem ) {
30.4472 + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
30.4473 + if ( !inplace ) {
30.4474 + result.push( elem );
30.4475 + }
30.4476 +
30.4477 + } else if ( inplace ) {
30.4478 + curLoop[i] = false;
30.4479 + }
30.4480 + }
30.4481 + }
30.4482 +
30.4483 + return false;
30.4484 + },
30.4485 +
30.4486 + ID: function( match ) {
30.4487 + return match[1].replace( rBackslash, "" );
30.4488 + },
30.4489 +
30.4490 + TAG: function( match, curLoop ) {
30.4491 + return match[1].replace( rBackslash, "" ).toLowerCase();
30.4492 + },
30.4493 +
30.4494 + CHILD: function( match ) {
30.4495 + if ( match[1] === "nth" ) {
30.4496 + if ( !match[2] ) {
30.4497 + Sizzle.error( match[0] );
30.4498 + }
30.4499 +
30.4500 + match[2] = match[2].replace(/^\+|\s*/g, '');
30.4501 +
30.4502 + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
30.4503 + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
30.4504 + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
30.4505 + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
30.4506 +
30.4507 + // calculate the numbers (first)n+(last) including if they are negative
30.4508 + match[2] = (test[1] + (test[2] || 1)) - 0;
30.4509 + match[3] = test[3] - 0;
30.4510 + }
30.4511 + else if ( match[2] ) {
30.4512 + Sizzle.error( match[0] );
30.4513 + }
30.4514 +
30.4515 + // TODO: Move to normal caching system
30.4516 + match[0] = done++;
30.4517 +
30.4518 + return match;
30.4519 + },
30.4520 +
30.4521 + ATTR: function( match, curLoop, inplace, result, not, isXML ) {
30.4522 + var name = match[1] = match[1].replace( rBackslash, "" );
30.4523 +
30.4524 + if ( !isXML && Expr.attrMap[name] ) {
30.4525 + match[1] = Expr.attrMap[name];
30.4526 + }
30.4527 +
30.4528 + // Handle if an un-quoted value was used
30.4529 + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
30.4530 +
30.4531 + if ( match[2] === "~=" ) {
30.4532 + match[4] = " " + match[4] + " ";
30.4533 + }
30.4534 +
30.4535 + return match;
30.4536 + },
30.4537 +
30.4538 + PSEUDO: function( match, curLoop, inplace, result, not ) {
30.4539 + if ( match[1] === "not" ) {
30.4540 + // If we're dealing with a complex expression, or a simple one
30.4541 + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
30.4542 + match[3] = Sizzle(match[3], null, null, curLoop);
30.4543 +
30.4544 + } else {
30.4545 + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
30.4546 +
30.4547 + if ( !inplace ) {
30.4548 + result.push.apply( result, ret );
30.4549 + }
30.4550 +
30.4551 + return false;
30.4552 + }
30.4553 +
30.4554 + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
30.4555 + return true;
30.4556 + }
30.4557 +
30.4558 + return match;
30.4559 + },
30.4560 +
30.4561 + POS: function( match ) {
30.4562 + match.unshift( true );
30.4563 +
30.4564 + return match;
30.4565 + }
30.4566 + },
30.4567 +
30.4568 + filters: {
30.4569 + enabled: function( elem ) {
30.4570 + return elem.disabled === false && elem.type !== "hidden";
30.4571 + },
30.4572 +
30.4573 + disabled: function( elem ) {
30.4574 + return elem.disabled === true;
30.4575 + },
30.4576 +
30.4577 + checked: function( elem ) {
30.4578 + return elem.checked === true;
30.4579 + },
30.4580 +
30.4581 + selected: function( elem ) {
30.4582 + // Accessing this property makes selected-by-default
30.4583 + // options in Safari work properly
30.4584 + if ( elem.parentNode ) {
30.4585 + elem.parentNode.selectedIndex;
30.4586 + }
30.4587 +
30.4588 + return elem.selected === true;
30.4589 + },
30.4590 +
30.4591 + parent: function( elem ) {
30.4592 + return !!elem.firstChild;
30.4593 + },
30.4594 +
30.4595 + empty: function( elem ) {
30.4596 + return !elem.firstChild;
30.4597 + },
30.4598 +
30.4599 + has: function( elem, i, match ) {
30.4600 + return !!Sizzle( match[3], elem ).length;
30.4601 + },
30.4602 +
30.4603 + header: function( elem ) {
30.4604 + return (/h\d/i).test( elem.nodeName );
30.4605 + },
30.4606 +
30.4607 + text: function( elem ) {
30.4608 + var attr = elem.getAttribute( "type" ), type = elem.type;
30.4609 + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
30.4610 + // use getAttribute instead to test this case
30.4611 + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
30.4612 + },
30.4613 +
30.4614 + radio: function( elem ) {
30.4615 + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
30.4616 + },
30.4617 +
30.4618 + checkbox: function( elem ) {
30.4619 + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
30.4620 + },
30.4621 +
30.4622 + file: function( elem ) {
30.4623 + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
30.4624 + },
30.4625 +
30.4626 + password: function( elem ) {
30.4627 + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
30.4628 + },
30.4629 +
30.4630 + submit: function( elem ) {
30.4631 + var name = elem.nodeName.toLowerCase();
30.4632 + return (name === "input" || name === "button") && "submit" === elem.type;
30.4633 + },
30.4634 +
30.4635 + image: function( elem ) {
30.4636 + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
30.4637 + },
30.4638 +
30.4639 + reset: function( elem ) {
30.4640 + var name = elem.nodeName.toLowerCase();
30.4641 + return (name === "input" || name === "button") && "reset" === elem.type;
30.4642 + },
30.4643 +
30.4644 + button: function( elem ) {
30.4645 + var name = elem.nodeName.toLowerCase();
30.4646 + return name === "input" && "button" === elem.type || name === "button";
30.4647 + },
30.4648 +
30.4649 + input: function( elem ) {
30.4650 + return (/input|select|textarea|button/i).test( elem.nodeName );
30.4651 + },
30.4652 +
30.4653 + focus: function( elem ) {
30.4654 + return elem === elem.ownerDocument.activeElement;
30.4655 + }
30.4656 + },
30.4657 + setFilters: {
30.4658 + first: function( elem, i ) {
30.4659 + return i === 0;
30.4660 + },
30.4661 +
30.4662 + last: function( elem, i, match, array ) {
30.4663 + return i === array.length - 1;
30.4664 + },
30.4665 +
30.4666 + even: function( elem, i ) {
30.4667 + return i % 2 === 0;
30.4668 + },
30.4669 +
30.4670 + odd: function( elem, i ) {
30.4671 + return i % 2 === 1;
30.4672 + },
30.4673 +
30.4674 + lt: function( elem, i, match ) {
30.4675 + return i < match[3] - 0;
30.4676 + },
30.4677 +
30.4678 + gt: function( elem, i, match ) {
30.4679 + return i > match[3] - 0;
30.4680 + },
30.4681 +
30.4682 + nth: function( elem, i, match ) {
30.4683 + return match[3] - 0 === i;
30.4684 + },
30.4685 +
30.4686 + eq: function( elem, i, match ) {
30.4687 + return match[3] - 0 === i;
30.4688 + }
30.4689 + },
30.4690 + filter: {
30.4691 + PSEUDO: function( elem, match, i, array ) {
30.4692 + var name = match[1],
30.4693 + filter = Expr.filters[ name ];
30.4694 +
30.4695 + if ( filter ) {
30.4696 + return filter( elem, i, match, array );
30.4697 +
30.4698 + } else if ( name === "contains" ) {
30.4699 + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
30.4700 +
30.4701 + } else if ( name === "not" ) {
30.4702 + var not = match[3];
30.4703 +
30.4704 + for ( var j = 0, l = not.length; j < l; j++ ) {
30.4705 + if ( not[j] === elem ) {
30.4706 + return false;
30.4707 + }
30.4708 + }
30.4709 +
30.4710 + return true;
30.4711 +
30.4712 + } else {
30.4713 + Sizzle.error( name );
30.4714 + }
30.4715 + },
30.4716 +
30.4717 + CHILD: function( elem, match ) {
30.4718 + var first, last,
30.4719 + doneName, parent, cache,
30.4720 + count, diff,
30.4721 + type = match[1],
30.4722 + node = elem;
30.4723 +
30.4724 + switch ( type ) {
30.4725 + case "only":
30.4726 + case "first":
30.4727 + while ( (node = node.previousSibling) ) {
30.4728 + if ( node.nodeType === 1 ) {
30.4729 + return false;
30.4730 + }
30.4731 + }
30.4732 +
30.4733 + if ( type === "first" ) {
30.4734 + return true;
30.4735 + }
30.4736 +
30.4737 + node = elem;
30.4738 +
30.4739 + /* falls through */
30.4740 + case "last":
30.4741 + while ( (node = node.nextSibling) ) {
30.4742 + if ( node.nodeType === 1 ) {
30.4743 + return false;
30.4744 + }
30.4745 + }
30.4746 +
30.4747 + return true;
30.4748 +
30.4749 + case "nth":
30.4750 + first = match[2];
30.4751 + last = match[3];
30.4752 +
30.4753 + if ( first === 1 && last === 0 ) {
30.4754 + return true;
30.4755 + }
30.4756 +
30.4757 + doneName = match[0];
30.4758 + parent = elem.parentNode;
30.4759 +
30.4760 + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
30.4761 + count = 0;
30.4762 +
30.4763 + for ( node = parent.firstChild; node; node = node.nextSibling ) {
30.4764 + if ( node.nodeType === 1 ) {
30.4765 + node.nodeIndex = ++count;
30.4766 + }
30.4767 + }
30.4768 +
30.4769 + parent[ expando ] = doneName;
30.4770 + }
30.4771 +
30.4772 + diff = elem.nodeIndex - last;
30.4773 +
30.4774 + if ( first === 0 ) {
30.4775 + return diff === 0;
30.4776 +
30.4777 + } else {
30.4778 + return ( diff % first === 0 && diff / first >= 0 );
30.4779 + }
30.4780 + }
30.4781 + },
30.4782 +
30.4783 + ID: function( elem, match ) {
30.4784 + return elem.nodeType === 1 && elem.getAttribute("id") === match;
30.4785 + },
30.4786 +
30.4787 + TAG: function( elem, match ) {
30.4788 + return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
30.4789 + },
30.4790 +
30.4791 + CLASS: function( elem, match ) {
30.4792 + return (" " + (elem.className || elem.getAttribute("class")) + " ")
30.4793 + .indexOf( match ) > -1;
30.4794 + },
30.4795 +
30.4796 + ATTR: function( elem, match ) {
30.4797 + var name = match[1],
30.4798 + result = Sizzle.attr ?
30.4799 + Sizzle.attr( elem, name ) :
30.4800 + Expr.attrHandle[ name ] ?
30.4801 + Expr.attrHandle[ name ]( elem ) :
30.4802 + elem[ name ] != null ?
30.4803 + elem[ name ] :
30.4804 + elem.getAttribute( name ),
30.4805 + value = result + "",
30.4806 + type = match[2],
30.4807 + check = match[4];
30.4808 +
30.4809 + return result == null ?
30.4810 + type === "!=" :
30.4811 + !type && Sizzle.attr ?
30.4812 + result != null :
30.4813 + type === "=" ?
30.4814 + value === check :
30.4815 + type === "*=" ?
30.4816 + value.indexOf(check) >= 0 :
30.4817 + type === "~=" ?
30.4818 + (" " + value + " ").indexOf(check) >= 0 :
30.4819 + !check ?
30.4820 + value && result !== false :
30.4821 + type === "!=" ?
30.4822 + value !== check :
30.4823 + type === "^=" ?
30.4824 + value.indexOf(check) === 0 :
30.4825 + type === "$=" ?
30.4826 + value.substr(value.length - check.length) === check :
30.4827 + type === "|=" ?
30.4828 + value === check || value.substr(0, check.length + 1) === check + "-" :
30.4829 + false;
30.4830 + },
30.4831 +
30.4832 + POS: function( elem, match, i, array ) {
30.4833 + var name = match[2],
30.4834 + filter = Expr.setFilters[ name ];
30.4835 +
30.4836 + if ( filter ) {
30.4837 + return filter( elem, i, match, array );
30.4838 + }
30.4839 + }
30.4840 + }
30.4841 +};
30.4842 +
30.4843 +var origPOS = Expr.match.POS,
30.4844 + fescape = function(all, num){
30.4845 + return "\\" + (num - 0 + 1);
30.4846 + };
30.4847 +
30.4848 +for ( var type in Expr.match ) {
30.4849 + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
30.4850 + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
30.4851 +}
30.4852 +// Expose origPOS
30.4853 +// "global" as in regardless of relation to brackets/parens
30.4854 +Expr.match.globalPOS = origPOS;
30.4855 +
30.4856 +var makeArray = function( array, results ) {
30.4857 + array = Array.prototype.slice.call( array, 0 );
30.4858 +
30.4859 + if ( results ) {
30.4860 + results.push.apply( results, array );
30.4861 + return results;
30.4862 + }
30.4863 +
30.4864 + return array;
30.4865 +};
30.4866 +
30.4867 +// Perform a simple check to determine if the browser is capable of
30.4868 +// converting a NodeList to an array using builtin methods.
30.4869 +// Also verifies that the returned array holds DOM nodes
30.4870 +// (which is not the case in the Blackberry browser)
30.4871 +try {
30.4872 + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
30.4873 +
30.4874 +// Provide a fallback method if it does not work
30.4875 +} catch( e ) {
30.4876 + makeArray = function( array, results ) {
30.4877 + var i = 0,
30.4878 + ret = results || [];
30.4879 +
30.4880 + if ( toString.call(array) === "[object Array]" ) {
30.4881 + Array.prototype.push.apply( ret, array );
30.4882 +
30.4883 + } else {
30.4884 + if ( typeof array.length === "number" ) {
30.4885 + for ( var l = array.length; i < l; i++ ) {
30.4886 + ret.push( array[i] );
30.4887 + }
30.4888 +
30.4889 + } else {
30.4890 + for ( ; array[i]; i++ ) {
30.4891 + ret.push( array[i] );
30.4892 + }
30.4893 + }
30.4894 + }
30.4895 +
30.4896 + return ret;
30.4897 + };
30.4898 +}
30.4899 +
30.4900 +var sortOrder, siblingCheck;
30.4901 +
30.4902 +if ( document.documentElement.compareDocumentPosition ) {
30.4903 + sortOrder = function( a, b ) {
30.4904 + if ( a === b ) {
30.4905 + hasDuplicate = true;
30.4906 + return 0;
30.4907 + }
30.4908 +
30.4909 + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
30.4910 + return a.compareDocumentPosition ? -1 : 1;
30.4911 + }
30.4912 +
30.4913 + return a.compareDocumentPosition(b) & 4 ? -1 : 1;
30.4914 + };
30.4915 +
30.4916 +} else {
30.4917 + sortOrder = function( a, b ) {
30.4918 + // The nodes are identical, we can exit early
30.4919 + if ( a === b ) {
30.4920 + hasDuplicate = true;
30.4921 + return 0;
30.4922 +
30.4923 + // Fallback to using sourceIndex (in IE) if it's available on both nodes
30.4924 + } else if ( a.sourceIndex && b.sourceIndex ) {
30.4925 + return a.sourceIndex - b.sourceIndex;
30.4926 + }
30.4927 +
30.4928 + var al, bl,
30.4929 + ap = [],
30.4930 + bp = [],
30.4931 + aup = a.parentNode,
30.4932 + bup = b.parentNode,
30.4933 + cur = aup;
30.4934 +
30.4935 + // If the nodes are siblings (or identical) we can do a quick check
30.4936 + if ( aup === bup ) {
30.4937 + return siblingCheck( a, b );
30.4938 +
30.4939 + // If no parents were found then the nodes are disconnected
30.4940 + } else if ( !aup ) {
30.4941 + return -1;
30.4942 +
30.4943 + } else if ( !bup ) {
30.4944 + return 1;
30.4945 + }
30.4946 +
30.4947 + // Otherwise they're somewhere else in the tree so we need
30.4948 + // to build up a full list of the parentNodes for comparison
30.4949 + while ( cur ) {
30.4950 + ap.unshift( cur );
30.4951 + cur = cur.parentNode;
30.4952 + }
30.4953 +
30.4954 + cur = bup;
30.4955 +
30.4956 + while ( cur ) {
30.4957 + bp.unshift( cur );
30.4958 + cur = cur.parentNode;
30.4959 + }
30.4960 +
30.4961 + al = ap.length;
30.4962 + bl = bp.length;
30.4963 +
30.4964 + // Start walking down the tree looking for a discrepancy
30.4965 + for ( var i = 0; i < al && i < bl; i++ ) {
30.4966 + if ( ap[i] !== bp[i] ) {
30.4967 + return siblingCheck( ap[i], bp[i] );
30.4968 + }
30.4969 + }
30.4970 +
30.4971 + // We ended someplace up the tree so do a sibling check
30.4972 + return i === al ?
30.4973 + siblingCheck( a, bp[i], -1 ) :
30.4974 + siblingCheck( ap[i], b, 1 );
30.4975 + };
30.4976 +
30.4977 + siblingCheck = function( a, b, ret ) {
30.4978 + if ( a === b ) {
30.4979 + return ret;
30.4980 + }
30.4981 +
30.4982 + var cur = a.nextSibling;
30.4983 +
30.4984 + while ( cur ) {
30.4985 + if ( cur === b ) {
30.4986 + return -1;
30.4987 + }
30.4988 +
30.4989 + cur = cur.nextSibling;
30.4990 + }
30.4991 +
30.4992 + return 1;
30.4993 + };
30.4994 +}
30.4995 +
30.4996 +// Check to see if the browser returns elements by name when
30.4997 +// querying by getElementById (and provide a workaround)
30.4998 +(function(){
30.4999 + // We're going to inject a fake input element with a specified name
30.5000 + var form = document.createElement("div"),
30.5001 + id = "script" + (new Date()).getTime(),
30.5002 + root = document.documentElement;
30.5003 +
30.5004 + form.innerHTML = "<a name='" + id + "'/>";
30.5005 +
30.5006 + // Inject it into the root element, check its status, and remove it quickly
30.5007 + root.insertBefore( form, root.firstChild );
30.5008 +
30.5009 + // The workaround has to do additional checks after a getElementById
30.5010 + // Which slows things down for other browsers (hence the branching)
30.5011 + if ( document.getElementById( id ) ) {
30.5012 + Expr.find.ID = function( match, context, isXML ) {
30.5013 + if ( typeof context.getElementById !== "undefined" && !isXML ) {
30.5014 + var m = context.getElementById(match[1]);
30.5015 +
30.5016 + return m ?
30.5017 + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
30.5018 + [m] :
30.5019 + undefined :
30.5020 + [];
30.5021 + }
30.5022 + };
30.5023 +
30.5024 + Expr.filter.ID = function( elem, match ) {
30.5025 + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
30.5026 +
30.5027 + return elem.nodeType === 1 && node && node.nodeValue === match;
30.5028 + };
30.5029 + }
30.5030 +
30.5031 + root.removeChild( form );
30.5032 +
30.5033 + // release memory in IE
30.5034 + root = form = null;
30.5035 +})();
30.5036 +
30.5037 +(function(){
30.5038 + // Check to see if the browser returns only elements
30.5039 + // when doing getElementsByTagName("*")
30.5040 +
30.5041 + // Create a fake element
30.5042 + var div = document.createElement("div");
30.5043 + div.appendChild( document.createComment("") );
30.5044 +
30.5045 + // Make sure no comments are found
30.5046 + if ( div.getElementsByTagName("*").length > 0 ) {
30.5047 + Expr.find.TAG = function( match, context ) {
30.5048 + var results = context.getElementsByTagName( match[1] );
30.5049 +
30.5050 + // Filter out possible comments
30.5051 + if ( match[1] === "*" ) {
30.5052 + var tmp = [];
30.5053 +
30.5054 + for ( var i = 0; results[i]; i++ ) {
30.5055 + if ( results[i].nodeType === 1 ) {
30.5056 + tmp.push( results[i] );
30.5057 + }
30.5058 + }
30.5059 +
30.5060 + results = tmp;
30.5061 + }
30.5062 +
30.5063 + return results;
30.5064 + };
30.5065 + }
30.5066 +
30.5067 + // Check to see if an attribute returns normalized href attributes
30.5068 + div.innerHTML = "<a href='#'></a>";
30.5069 +
30.5070 + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
30.5071 + div.firstChild.getAttribute("href") !== "#" ) {
30.5072 +
30.5073 + Expr.attrHandle.href = function( elem ) {
30.5074 + return elem.getAttribute( "href", 2 );
30.5075 + };
30.5076 + }
30.5077 +
30.5078 + // release memory in IE
30.5079 + div = null;
30.5080 +})();
30.5081 +
30.5082 +if ( document.querySelectorAll ) {
30.5083 + (function(){
30.5084 + var oldSizzle = Sizzle,
30.5085 + div = document.createElement("div"),
30.5086 + id = "__sizzle__";
30.5087 +
30.5088 + div.innerHTML = "<p class='TEST'></p>";
30.5089 +
30.5090 + // Safari can't handle uppercase or unicode characters when
30.5091 + // in quirks mode.
30.5092 + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
30.5093 + return;
30.5094 + }
30.5095 +
30.5096 + Sizzle = function( query, context, extra, seed ) {
30.5097 + context = context || document;
30.5098 +
30.5099 + // Only use querySelectorAll on non-XML documents
30.5100 + // (ID selectors don't work in non-HTML documents)
30.5101 + if ( !seed && !Sizzle.isXML(context) ) {
30.5102 + // See if we find a selector to speed up
30.5103 + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
30.5104 +
30.5105 + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
30.5106 + // Speed-up: Sizzle("TAG")
30.5107 + if ( match[1] ) {
30.5108 + return makeArray( context.getElementsByTagName( query ), extra );
30.5109 +
30.5110 + // Speed-up: Sizzle(".CLASS")
30.5111 + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
30.5112 + return makeArray( context.getElementsByClassName( match[2] ), extra );
30.5113 + }
30.5114 + }
30.5115 +
30.5116 + if ( context.nodeType === 9 ) {
30.5117 + // Speed-up: Sizzle("body")
30.5118 + // The body element only exists once, optimize finding it
30.5119 + if ( query === "body" && context.body ) {
30.5120 + return makeArray( [ context.body ], extra );
30.5121 +
30.5122 + // Speed-up: Sizzle("#ID")
30.5123 + } else if ( match && match[3] ) {
30.5124 + var elem = context.getElementById( match[3] );
30.5125 +
30.5126 + // Check parentNode to catch when Blackberry 4.6 returns
30.5127 + // nodes that are no longer in the document #6963
30.5128 + if ( elem && elem.parentNode ) {
30.5129 + // Handle the case where IE and Opera return items
30.5130 + // by name instead of ID
30.5131 + if ( elem.id === match[3] ) {
30.5132 + return makeArray( [ elem ], extra );
30.5133 + }
30.5134 +
30.5135 + } else {
30.5136 + return makeArray( [], extra );
30.5137 + }
30.5138 + }
30.5139 +
30.5140 + try {
30.5141 + return makeArray( context.querySelectorAll(query), extra );
30.5142 + } catch(qsaError) {}
30.5143 +
30.5144 + // qSA works strangely on Element-rooted queries
30.5145 + // We can work around this by specifying an extra ID on the root
30.5146 + // and working up from there (Thanks to Andrew Dupont for the technique)
30.5147 + // IE 8 doesn't work on object elements
30.5148 + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
30.5149 + var oldContext = context,
30.5150 + old = context.getAttribute( "id" ),
30.5151 + nid = old || id,
30.5152 + hasParent = context.parentNode,
30.5153 + relativeHierarchySelector = /^\s*[+~]/.test( query );
30.5154 +
30.5155 + if ( !old ) {
30.5156 + context.setAttribute( "id", nid );
30.5157 + } else {
30.5158 + nid = nid.replace( /'/g, "\\$&" );
30.5159 + }
30.5160 + if ( relativeHierarchySelector && hasParent ) {
30.5161 + context = context.parentNode;
30.5162 + }
30.5163 +
30.5164 + try {
30.5165 + if ( !relativeHierarchySelector || hasParent ) {
30.5166 + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
30.5167 + }
30.5168 +
30.5169 + } catch(pseudoError) {
30.5170 + } finally {
30.5171 + if ( !old ) {
30.5172 + oldContext.removeAttribute( "id" );
30.5173 + }
30.5174 + }
30.5175 + }
30.5176 + }
30.5177 +
30.5178 + return oldSizzle(query, context, extra, seed);
30.5179 + };
30.5180 +
30.5181 + for ( var prop in oldSizzle ) {
30.5182 + Sizzle[ prop ] = oldSizzle[ prop ];
30.5183 + }
30.5184 +
30.5185 + // release memory in IE
30.5186 + div = null;
30.5187 + })();
30.5188 +}
30.5189 +
30.5190 +(function(){
30.5191 + var html = document.documentElement,
30.5192 + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
30.5193 +
30.5194 + if ( matches ) {
30.5195 + // Check to see if it's possible to do matchesSelector
30.5196 + // on a disconnected node (IE 9 fails this)
30.5197 + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
30.5198 + pseudoWorks = false;
30.5199 +
30.5200 + try {
30.5201 + // This should fail with an exception
30.5202 + // Gecko does not error, returns false instead
30.5203 + matches.call( document.documentElement, "[test!='']:sizzle" );
30.5204 +
30.5205 + } catch( pseudoError ) {
30.5206 + pseudoWorks = true;
30.5207 + }
30.5208 +
30.5209 + Sizzle.matchesSelector = function( node, expr ) {
30.5210 + // Make sure that attribute selectors are quoted
30.5211 + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
30.5212 +
30.5213 + if ( !Sizzle.isXML( node ) ) {
30.5214 + try {
30.5215 + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
30.5216 + var ret = matches.call( node, expr );
30.5217 +
30.5218 + // IE 9's matchesSelector returns false on disconnected nodes
30.5219 + if ( ret || !disconnectedMatch ||
30.5220 + // As well, disconnected nodes are said to be in a document
30.5221 + // fragment in IE 9, so check for that
30.5222 + node.document && node.document.nodeType !== 11 ) {
30.5223 + return ret;
30.5224 + }
30.5225 + }
30.5226 + } catch(e) {}
30.5227 + }
30.5228 +
30.5229 + return Sizzle(expr, null, null, [node]).length > 0;
30.5230 + };
30.5231 + }
30.5232 +})();
30.5233 +
30.5234 +(function(){
30.5235 + var div = document.createElement("div");
30.5236 +
30.5237 + div.innerHTML = "<div class='test e'></div><div class='test'></div>";
30.5238 +
30.5239 + // Opera can't find a second classname (in 9.6)
30.5240 + // Also, make sure that getElementsByClassName actually exists
30.5241 + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
30.5242 + return;
30.5243 + }
30.5244 +
30.5245 + // Safari caches class attributes, doesn't catch changes (in 3.2)
30.5246 + div.lastChild.className = "e";
30.5247 +
30.5248 + if ( div.getElementsByClassName("e").length === 1 ) {
30.5249 + return;
30.5250 + }
30.5251 +
30.5252 + Expr.order.splice(1, 0, "CLASS");
30.5253 + Expr.find.CLASS = function( match, context, isXML ) {
30.5254 + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
30.5255 + return context.getElementsByClassName(match[1]);
30.5256 + }
30.5257 + };
30.5258 +
30.5259 + // release memory in IE
30.5260 + div = null;
30.5261 +})();
30.5262 +
30.5263 +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
30.5264 + for ( var i = 0, l = checkSet.length; i < l; i++ ) {
30.5265 + var elem = checkSet[i];
30.5266 +
30.5267 + if ( elem ) {
30.5268 + var match = false;
30.5269 +
30.5270 + elem = elem[dir];
30.5271 +
30.5272 + while ( elem ) {
30.5273 + if ( elem[ expando ] === doneName ) {
30.5274 + match = checkSet[elem.sizset];
30.5275 + break;
30.5276 + }
30.5277 +
30.5278 + if ( elem.nodeType === 1 && !isXML ){
30.5279 + elem[ expando ] = doneName;
30.5280 + elem.sizset = i;
30.5281 + }
30.5282 +
30.5283 + if ( elem.nodeName.toLowerCase() === cur ) {
30.5284 + match = elem;
30.5285 + break;
30.5286 + }
30.5287 +
30.5288 + elem = elem[dir];
30.5289 + }
30.5290 +
30.5291 + checkSet[i] = match;
30.5292 + }
30.5293 + }
30.5294 +}
30.5295 +
30.5296 +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
30.5297 + for ( var i = 0, l = checkSet.length; i < l; i++ ) {
30.5298 + var elem = checkSet[i];
30.5299 +
30.5300 + if ( elem ) {
30.5301 + var match = false;
30.5302 +
30.5303 + elem = elem[dir];
30.5304 +
30.5305 + while ( elem ) {
30.5306 + if ( elem[ expando ] === doneName ) {
30.5307 + match = checkSet[elem.sizset];
30.5308 + break;
30.5309 + }
30.5310 +
30.5311 + if ( elem.nodeType === 1 ) {
30.5312 + if ( !isXML ) {
30.5313 + elem[ expando ] = doneName;
30.5314 + elem.sizset = i;
30.5315 + }
30.5316 +
30.5317 + if ( typeof cur !== "string" ) {
30.5318 + if ( elem === cur ) {
30.5319 + match = true;
30.5320 + break;
30.5321 + }
30.5322 +
30.5323 + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
30.5324 + match = elem;
30.5325 + break;
30.5326 + }
30.5327 + }
30.5328 +
30.5329 + elem = elem[dir];
30.5330 + }
30.5331 +
30.5332 + checkSet[i] = match;
30.5333 + }
30.5334 + }
30.5335 +}
30.5336 +
30.5337 +if ( document.documentElement.contains ) {
30.5338 + Sizzle.contains = function( a, b ) {
30.5339 + return a !== b && (a.contains ? a.contains(b) : true);
30.5340 + };
30.5341 +
30.5342 +} else if ( document.documentElement.compareDocumentPosition ) {
30.5343 + Sizzle.contains = function( a, b ) {
30.5344 + return !!(a.compareDocumentPosition(b) & 16);
30.5345 + };
30.5346 +
30.5347 +} else {
30.5348 + Sizzle.contains = function() {
30.5349 + return false;
30.5350 + };
30.5351 +}
30.5352 +
30.5353 +Sizzle.isXML = function( elem ) {
30.5354 + // documentElement is verified for cases where it doesn't yet exist
30.5355 + // (such as loading iframes in IE - #4833)
30.5356 + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
30.5357 +
30.5358 + return documentElement ? documentElement.nodeName !== "HTML" : false;
30.5359 +};
30.5360 +
30.5361 +var posProcess = function( selector, context, seed ) {
30.5362 + var match,
30.5363 + tmpSet = [],
30.5364 + later = "",
30.5365 + root = context.nodeType ? [context] : context;
30.5366 +
30.5367 + // Position selectors must be done after the filter
30.5368 + // And so must :not(positional) so we move all PSEUDOs to the end
30.5369 + while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
30.5370 + later += match[0];
30.5371 + selector = selector.replace( Expr.match.PSEUDO, "" );
30.5372 + }
30.5373 +
30.5374 + selector = Expr.relative[selector] ? selector + "*" : selector;
30.5375 +
30.5376 + for ( var i = 0, l = root.length; i < l; i++ ) {
30.5377 + Sizzle( selector, root[i], tmpSet, seed );
30.5378 + }
30.5379 +
30.5380 + return Sizzle.filter( later, tmpSet );
30.5381 +};
30.5382 +
30.5383 +// EXPOSE
30.5384 +// Override sizzle attribute retrieval
30.5385 +Sizzle.attr = jQuery.attr;
30.5386 +Sizzle.selectors.attrMap = {};
30.5387 +jQuery.find = Sizzle;
30.5388 +jQuery.expr = Sizzle.selectors;
30.5389 +jQuery.expr[":"] = jQuery.expr.filters;
30.5390 +jQuery.unique = Sizzle.uniqueSort;
30.5391 +jQuery.text = Sizzle.getText;
30.5392 +jQuery.isXMLDoc = Sizzle.isXML;
30.5393 +jQuery.contains = Sizzle.contains;
30.5394 +
30.5395 +
30.5396 +})();
30.5397 +
30.5398 +
30.5399 +var runtil = /Until$/,
30.5400 + rparentsprev = /^(?:parents|prevUntil|prevAll)/,
30.5401 + // Note: This RegExp should be improved, or likely pulled from Sizzle
30.5402 + rmultiselector = /,/,
30.5403 + isSimple = /^.[^:#\[\.,]*$/,
30.5404 + slice = Array.prototype.slice,
30.5405 + POS = jQuery.expr.match.globalPOS,
30.5406 + // methods guaranteed to produce a unique set when starting from a unique set
30.5407 + guaranteedUnique = {
30.5408 + children: true,
30.5409 + contents: true,
30.5410 + next: true,
30.5411 + prev: true
30.5412 + };
30.5413 +
30.5414 +jQuery.fn.extend({
30.5415 + find: function( selector ) {
30.5416 + var self = this,
30.5417 + i, l;
30.5418 +
30.5419 + if ( typeof selector !== "string" ) {
30.5420 + return jQuery( selector ).filter(function() {
30.5421 + for ( i = 0, l = self.length; i < l; i++ ) {
30.5422 + if ( jQuery.contains( self[ i ], this ) ) {
30.5423 + return true;
30.5424 + }
30.5425 + }
30.5426 + });
30.5427 + }
30.5428 +
30.5429 + var ret = this.pushStack( "", "find", selector ),
30.5430 + length, n, r;
30.5431 +
30.5432 + for ( i = 0, l = this.length; i < l; i++ ) {
30.5433 + length = ret.length;
30.5434 + jQuery.find( selector, this[i], ret );
30.5435 +
30.5436 + if ( i > 0 ) {
30.5437 + // Make sure that the results are unique
30.5438 + for ( n = length; n < ret.length; n++ ) {
30.5439 + for ( r = 0; r < length; r++ ) {
30.5440 + if ( ret[r] === ret[n] ) {
30.5441 + ret.splice(n--, 1);
30.5442 + break;
30.5443 + }
30.5444 + }
30.5445 + }
30.5446 + }
30.5447 + }
30.5448 +
30.5449 + return ret;
30.5450 + },
30.5451 +
30.5452 + has: function( target ) {
30.5453 + var targets = jQuery( target );
30.5454 + return this.filter(function() {
30.5455 + for ( var i = 0, l = targets.length; i < l; i++ ) {
30.5456 + if ( jQuery.contains( this, targets[i] ) ) {
30.5457 + return true;
30.5458 + }
30.5459 + }
30.5460 + });
30.5461 + },
30.5462 +
30.5463 + not: function( selector ) {
30.5464 + return this.pushStack( winnow(this, selector, false), "not", selector);
30.5465 + },
30.5466 +
30.5467 + filter: function( selector ) {
30.5468 + return this.pushStack( winnow(this, selector, true), "filter", selector );
30.5469 + },
30.5470 +
30.5471 + is: function( selector ) {
30.5472 + return !!selector && (
30.5473 + typeof selector === "string" ?
30.5474 + // If this is a positional selector, check membership in the returned set
30.5475 + // so $("p:first").is("p:last") won't return true for a doc with two "p".
30.5476 + POS.test( selector ) ?
30.5477 + jQuery( selector, this.context ).index( this[0] ) >= 0 :
30.5478 + jQuery.filter( selector, this ).length > 0 :
30.5479 + this.filter( selector ).length > 0 );
30.5480 + },
30.5481 +
30.5482 + closest: function( selectors, context ) {
30.5483 + var ret = [], i, l, cur = this[0];
30.5484 +
30.5485 + // Array (deprecated as of jQuery 1.7)
30.5486 + if ( jQuery.isArray( selectors ) ) {
30.5487 + var level = 1;
30.5488 +
30.5489 + while ( cur && cur.ownerDocument && cur !== context ) {
30.5490 + for ( i = 0; i < selectors.length; i++ ) {
30.5491 +
30.5492 + if ( jQuery( cur ).is( selectors[ i ] ) ) {
30.5493 + ret.push({ selector: selectors[ i ], elem: cur, level: level });
30.5494 + }
30.5495 + }
30.5496 +
30.5497 + cur = cur.parentNode;
30.5498 + level++;
30.5499 + }
30.5500 +
30.5501 + return ret;
30.5502 + }
30.5503 +
30.5504 + // String
30.5505 + var pos = POS.test( selectors ) || typeof selectors !== "string" ?
30.5506 + jQuery( selectors, context || this.context ) :
30.5507 + 0;
30.5508 +
30.5509 + for ( i = 0, l = this.length; i < l; i++ ) {
30.5510 + cur = this[i];
30.5511 +
30.5512 + while ( cur ) {
30.5513 + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
30.5514 + ret.push( cur );
30.5515 + break;
30.5516 +
30.5517 + } else {
30.5518 + cur = cur.parentNode;
30.5519 + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
30.5520 + break;
30.5521 + }
30.5522 + }
30.5523 + }
30.5524 + }
30.5525 +
30.5526 + ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
30.5527 +
30.5528 + return this.pushStack( ret, "closest", selectors );
30.5529 + },
30.5530 +
30.5531 + // Determine the position of an element within
30.5532 + // the matched set of elements
30.5533 + index: function( elem ) {
30.5534 +
30.5535 + // No argument, return index in parent
30.5536 + if ( !elem ) {
30.5537 + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
30.5538 + }
30.5539 +
30.5540 + // index in selector
30.5541 + if ( typeof elem === "string" ) {
30.5542 + return jQuery.inArray( this[0], jQuery( elem ) );
30.5543 + }
30.5544 +
30.5545 + // Locate the position of the desired element
30.5546 + return jQuery.inArray(
30.5547 + // If it receives a jQuery object, the first element is used
30.5548 + elem.jquery ? elem[0] : elem, this );
30.5549 + },
30.5550 +
30.5551 + add: function( selector, context ) {
30.5552 + var set = typeof selector === "string" ?
30.5553 + jQuery( selector, context ) :
30.5554 + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
30.5555 + all = jQuery.merge( this.get(), set );
30.5556 +
30.5557 + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
30.5558 + all :
30.5559 + jQuery.unique( all ) );
30.5560 + },
30.5561 +
30.5562 + andSelf: function() {
30.5563 + return this.add( this.prevObject );
30.5564 + }
30.5565 +});
30.5566 +
30.5567 +// A painfully simple check to see if an element is disconnected
30.5568 +// from a document (should be improved, where feasible).
30.5569 +function isDisconnected( node ) {
30.5570 + return !node || !node.parentNode || node.parentNode.nodeType === 11;
30.5571 +}
30.5572 +
30.5573 +jQuery.each({
30.5574 + parent: function( elem ) {
30.5575 + var parent = elem.parentNode;
30.5576 + return parent && parent.nodeType !== 11 ? parent : null;
30.5577 + },
30.5578 + parents: function( elem ) {
30.5579 + return jQuery.dir( elem, "parentNode" );
30.5580 + },
30.5581 + parentsUntil: function( elem, i, until ) {
30.5582 + return jQuery.dir( elem, "parentNode", until );
30.5583 + },
30.5584 + next: function( elem ) {
30.5585 + return jQuery.nth( elem, 2, "nextSibling" );
30.5586 + },
30.5587 + prev: function( elem ) {
30.5588 + return jQuery.nth( elem, 2, "previousSibling" );
30.5589 + },
30.5590 + nextAll: function( elem ) {
30.5591 + return jQuery.dir( elem, "nextSibling" );
30.5592 + },
30.5593 + prevAll: function( elem ) {
30.5594 + return jQuery.dir( elem, "previousSibling" );
30.5595 + },
30.5596 + nextUntil: function( elem, i, until ) {
30.5597 + return jQuery.dir( elem, "nextSibling", until );
30.5598 + },
30.5599 + prevUntil: function( elem, i, until ) {
30.5600 + return jQuery.dir( elem, "previousSibling", until );
30.5601 + },
30.5602 + siblings: function( elem ) {
30.5603 + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
30.5604 + },
30.5605 + children: function( elem ) {
30.5606 + return jQuery.sibling( elem.firstChild );
30.5607 + },
30.5608 + contents: function( elem ) {
30.5609 + return jQuery.nodeName( elem, "iframe" ) ?
30.5610 + elem.contentDocument || elem.contentWindow.document :
30.5611 + jQuery.makeArray( elem.childNodes );
30.5612 + }
30.5613 +}, function( name, fn ) {
30.5614 + jQuery.fn[ name ] = function( until, selector ) {
30.5615 + var ret = jQuery.map( this, fn, until );
30.5616 +
30.5617 + if ( !runtil.test( name ) ) {
30.5618 + selector = until;
30.5619 + }
30.5620 +
30.5621 + if ( selector && typeof selector === "string" ) {
30.5622 + ret = jQuery.filter( selector, ret );
30.5623 + }
30.5624 +
30.5625 + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
30.5626 +
30.5627 + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
30.5628 + ret = ret.reverse();
30.5629 + }
30.5630 +
30.5631 + return this.pushStack( ret, name, slice.call( arguments ).join(",") );
30.5632 + };
30.5633 +});
30.5634 +
30.5635 +jQuery.extend({
30.5636 + filter: function( expr, elems, not ) {
30.5637 + if ( not ) {
30.5638 + expr = ":not(" + expr + ")";
30.5639 + }
30.5640 +
30.5641 + return elems.length === 1 ?
30.5642 + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
30.5643 + jQuery.find.matches(expr, elems);
30.5644 + },
30.5645 +
30.5646 + dir: function( elem, dir, until ) {
30.5647 + var matched = [],
30.5648 + cur = elem[ dir ];
30.5649 +
30.5650 + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
30.5651 + if ( cur.nodeType === 1 ) {
30.5652 + matched.push( cur );
30.5653 + }
30.5654 + cur = cur[dir];
30.5655 + }
30.5656 + return matched;
30.5657 + },
30.5658 +
30.5659 + nth: function( cur, result, dir, elem ) {
30.5660 + result = result || 1;
30.5661 + var num = 0;
30.5662 +
30.5663 + for ( ; cur; cur = cur[dir] ) {
30.5664 + if ( cur.nodeType === 1 && ++num === result ) {
30.5665 + break;
30.5666 + }
30.5667 + }
30.5668 +
30.5669 + return cur;
30.5670 + },
30.5671 +
30.5672 + sibling: function( n, elem ) {
30.5673 + var r = [];
30.5674 +
30.5675 + for ( ; n; n = n.nextSibling ) {
30.5676 + if ( n.nodeType === 1 && n !== elem ) {
30.5677 + r.push( n );
30.5678 + }
30.5679 + }
30.5680 +
30.5681 + return r;
30.5682 + }
30.5683 +});
30.5684 +
30.5685 +// Implement the identical functionality for filter and not
30.5686 +function winnow( elements, qualifier, keep ) {
30.5687 +
30.5688 + // Can't pass null or undefined to indexOf in Firefox 4
30.5689 + // Set to 0 to skip string check
30.5690 + qualifier = qualifier || 0;
30.5691 +
30.5692 + if ( jQuery.isFunction( qualifier ) ) {
30.5693 + return jQuery.grep(elements, function( elem, i ) {
30.5694 + var retVal = !!qualifier.call( elem, i, elem );
30.5695 + return retVal === keep;
30.5696 + });
30.5697 +
30.5698 + } else if ( qualifier.nodeType ) {
30.5699 + return jQuery.grep(elements, function( elem, i ) {
30.5700 + return ( elem === qualifier ) === keep;
30.5701 + });
30.5702 +
30.5703 + } else if ( typeof qualifier === "string" ) {
30.5704 + var filtered = jQuery.grep(elements, function( elem ) {
30.5705 + return elem.nodeType === 1;
30.5706 + });
30.5707 +
30.5708 + if ( isSimple.test( qualifier ) ) {
30.5709 + return jQuery.filter(qualifier, filtered, !keep);
30.5710 + } else {
30.5711 + qualifier = jQuery.filter( qualifier, filtered );
30.5712 + }
30.5713 + }
30.5714 +
30.5715 + return jQuery.grep(elements, function( elem, i ) {
30.5716 + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
30.5717 + });
30.5718 +}
30.5719 +
30.5720 +
30.5721 +
30.5722 +
30.5723 +function createSafeFragment( document ) {
30.5724 + var list = nodeNames.split( "|" ),
30.5725 + safeFrag = document.createDocumentFragment();
30.5726 +
30.5727 + if ( safeFrag.createElement ) {
30.5728 + while ( list.length ) {
30.5729 + safeFrag.createElement(
30.5730 + list.pop()
30.5731 + );
30.5732 + }
30.5733 + }
30.5734 + return safeFrag;
30.5735 +}
30.5736 +
30.5737 +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
30.5738 + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
30.5739 + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
30.5740 + rleadingWhitespace = /^\s+/,
30.5741 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
30.5742 + rtagName = /<([\w:]+)/,
30.5743 + rtbody = /<tbody/i,
30.5744 + rhtml = /<|&#?\w+;/,
30.5745 + rnoInnerhtml = /<(?:script|style)/i,
30.5746 + rnocache = /<(?:script|object|embed|option|style)/i,
30.5747 + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
30.5748 + // checked="checked" or checked
30.5749 + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
30.5750 + rscriptType = /\/(java|ecma)script/i,
30.5751 + rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
30.5752 + wrapMap = {
30.5753 + option: [ 1, "<select multiple='multiple'>", "</select>" ],
30.5754 + legend: [ 1, "<fieldset>", "</fieldset>" ],
30.5755 + thead: [ 1, "<table>", "</table>" ],
30.5756 + tr: [ 2, "<table><tbody>", "</tbody></table>" ],
30.5757 + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
30.5758 + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
30.5759 + area: [ 1, "<map>", "</map>" ],
30.5760 + _default: [ 0, "", "" ]
30.5761 + },
30.5762 + safeFragment = createSafeFragment( document );
30.5763 +
30.5764 +wrapMap.optgroup = wrapMap.option;
30.5765 +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
30.5766 +wrapMap.th = wrapMap.td;
30.5767 +
30.5768 +// IE can't serialize <link> and <script> tags normally
30.5769 +if ( !jQuery.support.htmlSerialize ) {
30.5770 + wrapMap._default = [ 1, "div<div>", "</div>" ];
30.5771 +}
30.5772 +
30.5773 +jQuery.fn.extend({
30.5774 + text: function( value ) {
30.5775 + return jQuery.access( this, function( value ) {
30.5776 + return value === undefined ?
30.5777 + jQuery.text( this ) :
30.5778 + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
30.5779 + }, null, value, arguments.length );
30.5780 + },
30.5781 +
30.5782 + wrapAll: function( html ) {
30.5783 + if ( jQuery.isFunction( html ) ) {
30.5784 + return this.each(function(i) {
30.5785 + jQuery(this).wrapAll( html.call(this, i) );
30.5786 + });
30.5787 + }
30.5788 +
30.5789 + if ( this[0] ) {
30.5790 + // The elements to wrap the target around
30.5791 + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
30.5792 +
30.5793 + if ( this[0].parentNode ) {
30.5794 + wrap.insertBefore( this[0] );
30.5795 + }
30.5796 +
30.5797 + wrap.map(function() {
30.5798 + var elem = this;
30.5799 +
30.5800 + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
30.5801 + elem = elem.firstChild;
30.5802 + }
30.5803 +
30.5804 + return elem;
30.5805 + }).append( this );
30.5806 + }
30.5807 +
30.5808 + return this;
30.5809 + },
30.5810 +
30.5811 + wrapInner: function( html ) {
30.5812 + if ( jQuery.isFunction( html ) ) {
30.5813 + return this.each(function(i) {
30.5814 + jQuery(this).wrapInner( html.call(this, i) );
30.5815 + });
30.5816 + }
30.5817 +
30.5818 + return this.each(function() {
30.5819 + var self = jQuery( this ),
30.5820 + contents = self.contents();
30.5821 +
30.5822 + if ( contents.length ) {
30.5823 + contents.wrapAll( html );
30.5824 +
30.5825 + } else {
30.5826 + self.append( html );
30.5827 + }
30.5828 + });
30.5829 + },
30.5830 +
30.5831 + wrap: function( html ) {
30.5832 + var isFunction = jQuery.isFunction( html );
30.5833 +
30.5834 + return this.each(function(i) {
30.5835 + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
30.5836 + });
30.5837 + },
30.5838 +
30.5839 + unwrap: function() {
30.5840 + return this.parent().each(function() {
30.5841 + if ( !jQuery.nodeName( this, "body" ) ) {
30.5842 + jQuery( this ).replaceWith( this.childNodes );
30.5843 + }
30.5844 + }).end();
30.5845 + },
30.5846 +
30.5847 + append: function() {
30.5848 + return this.domManip(arguments, true, function( elem ) {
30.5849 + if ( this.nodeType === 1 ) {
30.5850 + this.appendChild( elem );
30.5851 + }
30.5852 + });
30.5853 + },
30.5854 +
30.5855 + prepend: function() {
30.5856 + return this.domManip(arguments, true, function( elem ) {
30.5857 + if ( this.nodeType === 1 ) {
30.5858 + this.insertBefore( elem, this.firstChild );
30.5859 + }
30.5860 + });
30.5861 + },
30.5862 +
30.5863 + before: function() {
30.5864 + if ( this[0] && this[0].parentNode ) {
30.5865 + return this.domManip(arguments, false, function( elem ) {
30.5866 + this.parentNode.insertBefore( elem, this );
30.5867 + });
30.5868 + } else if ( arguments.length ) {
30.5869 + var set = jQuery.clean( arguments );
30.5870 + set.push.apply( set, this.toArray() );
30.5871 + return this.pushStack( set, "before", arguments );
30.5872 + }
30.5873 + },
30.5874 +
30.5875 + after: function() {
30.5876 + if ( this[0] && this[0].parentNode ) {
30.5877 + return this.domManip(arguments, false, function( elem ) {
30.5878 + this.parentNode.insertBefore( elem, this.nextSibling );
30.5879 + });
30.5880 + } else if ( arguments.length ) {
30.5881 + var set = this.pushStack( this, "after", arguments );
30.5882 + set.push.apply( set, jQuery.clean(arguments) );
30.5883 + return set;
30.5884 + }
30.5885 + },
30.5886 +
30.5887 + // keepData is for internal use only--do not document
30.5888 + remove: function( selector, keepData ) {
30.5889 + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
30.5890 + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
30.5891 + if ( !keepData && elem.nodeType === 1 ) {
30.5892 + jQuery.cleanData( elem.getElementsByTagName("*") );
30.5893 + jQuery.cleanData( [ elem ] );
30.5894 + }
30.5895 +
30.5896 + if ( elem.parentNode ) {
30.5897 + elem.parentNode.removeChild( elem );
30.5898 + }
30.5899 + }
30.5900 + }
30.5901 +
30.5902 + return this;
30.5903 + },
30.5904 +
30.5905 + empty: function() {
30.5906 + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
30.5907 + // Remove element nodes and prevent memory leaks
30.5908 + if ( elem.nodeType === 1 ) {
30.5909 + jQuery.cleanData( elem.getElementsByTagName("*") );
30.5910 + }
30.5911 +
30.5912 + // Remove any remaining nodes
30.5913 + while ( elem.firstChild ) {
30.5914 + elem.removeChild( elem.firstChild );
30.5915 + }
30.5916 + }
30.5917 +
30.5918 + return this;
30.5919 + },
30.5920 +
30.5921 + clone: function( dataAndEvents, deepDataAndEvents ) {
30.5922 + dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
30.5923 + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
30.5924 +
30.5925 + return this.map( function () {
30.5926 + return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
30.5927 + });
30.5928 + },
30.5929 +
30.5930 + html: function( value ) {
30.5931 + return jQuery.access( this, function( value ) {
30.5932 + var elem = this[0] || {},
30.5933 + i = 0,
30.5934 + l = this.length;
30.5935 +
30.5936 + if ( value === undefined ) {
30.5937 + return elem.nodeType === 1 ?
30.5938 + elem.innerHTML.replace( rinlinejQuery, "" ) :
30.5939 + null;
30.5940 + }
30.5941 +
30.5942 +
30.5943 + if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
30.5944 + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
30.5945 + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
30.5946 +
30.5947 + value = value.replace( rxhtmlTag, "<$1></$2>" );
30.5948 +
30.5949 + try {
30.5950 + for (; i < l; i++ ) {
30.5951 + // Remove element nodes and prevent memory leaks
30.5952 + elem = this[i] || {};
30.5953 + if ( elem.nodeType === 1 ) {
30.5954 + jQuery.cleanData( elem.getElementsByTagName( "*" ) );
30.5955 + elem.innerHTML = value;
30.5956 + }
30.5957 + }
30.5958 +
30.5959 + elem = 0;
30.5960 +
30.5961 + // If using innerHTML throws an exception, use the fallback method
30.5962 + } catch(e) {}
30.5963 + }
30.5964 +
30.5965 + if ( elem ) {
30.5966 + this.empty().append( value );
30.5967 + }
30.5968 + }, null, value, arguments.length );
30.5969 + },
30.5970 +
30.5971 + replaceWith: function( value ) {
30.5972 + if ( this[0] && this[0].parentNode ) {
30.5973 + // Make sure that the elements are removed from the DOM before they are inserted
30.5974 + // this can help fix replacing a parent with child elements
30.5975 + if ( jQuery.isFunction( value ) ) {
30.5976 + return this.each(function(i) {
30.5977 + var self = jQuery(this), old = self.html();
30.5978 + self.replaceWith( value.call( this, i, old ) );
30.5979 + });
30.5980 + }
30.5981 +
30.5982 + if ( typeof value !== "string" ) {
30.5983 + value = jQuery( value ).detach();
30.5984 + }
30.5985 +
30.5986 + return this.each(function() {
30.5987 + var next = this.nextSibling,
30.5988 + parent = this.parentNode;
30.5989 +
30.5990 + jQuery( this ).remove();
30.5991 +
30.5992 + if ( next ) {
30.5993 + jQuery(next).before( value );
30.5994 + } else {
30.5995 + jQuery(parent).append( value );
30.5996 + }
30.5997 + });
30.5998 + } else {
30.5999 + return this.length ?
30.6000 + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
30.6001 + this;
30.6002 + }
30.6003 + },
30.6004 +
30.6005 + detach: function( selector ) {
30.6006 + return this.remove( selector, true );
30.6007 + },
30.6008 +
30.6009 + domManip: function( args, table, callback ) {
30.6010 + var results, first, fragment, parent,
30.6011 + value = args[0],
30.6012 + scripts = [];
30.6013 +
30.6014 + // We can't cloneNode fragments that contain checked, in WebKit
30.6015 + if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
30.6016 + return this.each(function() {
30.6017 + jQuery(this).domManip( args, table, callback, true );
30.6018 + });
30.6019 + }
30.6020 +
30.6021 + if ( jQuery.isFunction(value) ) {
30.6022 + return this.each(function(i) {
30.6023 + var self = jQuery(this);
30.6024 + args[0] = value.call(this, i, table ? self.html() : undefined);
30.6025 + self.domManip( args, table, callback );
30.6026 + });
30.6027 + }
30.6028 +
30.6029 + if ( this[0] ) {
30.6030 + parent = value && value.parentNode;
30.6031 +
30.6032 + // If we're in a fragment, just use that instead of building a new one
30.6033 + if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
30.6034 + results = { fragment: parent };
30.6035 +
30.6036 + } else {
30.6037 + results = jQuery.buildFragment( args, this, scripts );
30.6038 + }
30.6039 +
30.6040 + fragment = results.fragment;
30.6041 +
30.6042 + if ( fragment.childNodes.length === 1 ) {
30.6043 + first = fragment = fragment.firstChild;
30.6044 + } else {
30.6045 + first = fragment.firstChild;
30.6046 + }
30.6047 +
30.6048 + if ( first ) {
30.6049 + table = table && jQuery.nodeName( first, "tr" );
30.6050 +
30.6051 + for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
30.6052 + callback.call(
30.6053 + table ?
30.6054 + root(this[i], first) :
30.6055 + this[i],
30.6056 + // Make sure that we do not leak memory by inadvertently discarding
30.6057 + // the original fragment (which might have attached data) instead of
30.6058 + // using it; in addition, use the original fragment object for the last
30.6059 + // item instead of first because it can end up being emptied incorrectly
30.6060 + // in certain situations (Bug #8070).
30.6061 + // Fragments from the fragment cache must always be cloned and never used
30.6062 + // in place.
30.6063 + results.cacheable || ( l > 1 && i < lastIndex ) ?
30.6064 + jQuery.clone( fragment, true, true ) :
30.6065 + fragment
30.6066 + );
30.6067 + }
30.6068 + }
30.6069 +
30.6070 + if ( scripts.length ) {
30.6071 + jQuery.each( scripts, function( i, elem ) {
30.6072 + if ( elem.src ) {
30.6073 + jQuery.ajax({
30.6074 + type: "GET",
30.6075 + global: false,
30.6076 + url: elem.src,
30.6077 + async: false,
30.6078 + dataType: "script"
30.6079 + });
30.6080 + } else {
30.6081 + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
30.6082 + }
30.6083 +
30.6084 + if ( elem.parentNode ) {
30.6085 + elem.parentNode.removeChild( elem );
30.6086 + }
30.6087 + });
30.6088 + }
30.6089 + }
30.6090 +
30.6091 + return this;
30.6092 + }
30.6093 +});
30.6094 +
30.6095 +function root( elem, cur ) {
30.6096 + return jQuery.nodeName(elem, "table") ?
30.6097 + (elem.getElementsByTagName("tbody")[0] ||
30.6098 + elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
30.6099 + elem;
30.6100 +}
30.6101 +
30.6102 +function cloneCopyEvent( src, dest ) {
30.6103 +
30.6104 + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
30.6105 + return;
30.6106 + }
30.6107 +
30.6108 + var type, i, l,
30.6109 + oldData = jQuery._data( src ),
30.6110 + curData = jQuery._data( dest, oldData ),
30.6111 + events = oldData.events;
30.6112 +
30.6113 + if ( events ) {
30.6114 + delete curData.handle;
30.6115 + curData.events = {};
30.6116 +
30.6117 + for ( type in events ) {
30.6118 + for ( i = 0, l = events[ type ].length; i < l; i++ ) {
30.6119 + jQuery.event.add( dest, type, events[ type ][ i ] );
30.6120 + }
30.6121 + }
30.6122 + }
30.6123 +
30.6124 + // make the cloned public data object a copy from the original
30.6125 + if ( curData.data ) {
30.6126 + curData.data = jQuery.extend( {}, curData.data );
30.6127 + }
30.6128 +}
30.6129 +
30.6130 +function cloneFixAttributes( src, dest ) {
30.6131 + var nodeName;
30.6132 +
30.6133 + // We do not need to do anything for non-Elements
30.6134 + if ( dest.nodeType !== 1 ) {
30.6135 + return;
30.6136 + }
30.6137 +
30.6138 + // clearAttributes removes the attributes, which we don't want,
30.6139 + // but also removes the attachEvent events, which we *do* want
30.6140 + if ( dest.clearAttributes ) {
30.6141 + dest.clearAttributes();
30.6142 + }
30.6143 +
30.6144 + // mergeAttributes, in contrast, only merges back on the
30.6145 + // original attributes, not the events
30.6146 + if ( dest.mergeAttributes ) {
30.6147 + dest.mergeAttributes( src );
30.6148 + }
30.6149 +
30.6150 + nodeName = dest.nodeName.toLowerCase();
30.6151 +
30.6152 + // IE6-8 fail to clone children inside object elements that use
30.6153 + // the proprietary classid attribute value (rather than the type
30.6154 + // attribute) to identify the type of content to display
30.6155 + if ( nodeName === "object" ) {
30.6156 + dest.outerHTML = src.outerHTML;
30.6157 +
30.6158 + } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
30.6159 + // IE6-8 fails to persist the checked state of a cloned checkbox
30.6160 + // or radio button. Worse, IE6-7 fail to give the cloned element
30.6161 + // a checked appearance if the defaultChecked value isn't also set
30.6162 + if ( src.checked ) {
30.6163 + dest.defaultChecked = dest.checked = src.checked;
30.6164 + }
30.6165 +
30.6166 + // IE6-7 get confused and end up setting the value of a cloned
30.6167 + // checkbox/radio button to an empty string instead of "on"
30.6168 + if ( dest.value !== src.value ) {
30.6169 + dest.value = src.value;
30.6170 + }
30.6171 +
30.6172 + // IE6-8 fails to return the selected option to the default selected
30.6173 + // state when cloning options
30.6174 + } else if ( nodeName === "option" ) {
30.6175 + dest.selected = src.defaultSelected;
30.6176 +
30.6177 + // IE6-8 fails to set the defaultValue to the correct value when
30.6178 + // cloning other types of input fields
30.6179 + } else if ( nodeName === "input" || nodeName === "textarea" ) {
30.6180 + dest.defaultValue = src.defaultValue;
30.6181 +
30.6182 + // IE blanks contents when cloning scripts
30.6183 + } else if ( nodeName === "script" && dest.text !== src.text ) {
30.6184 + dest.text = src.text;
30.6185 + }
30.6186 +
30.6187 + // Event data gets referenced instead of copied if the expando
30.6188 + // gets copied too
30.6189 + dest.removeAttribute( jQuery.expando );
30.6190 +
30.6191 + // Clear flags for bubbling special change/submit events, they must
30.6192 + // be reattached when the newly cloned events are first activated
30.6193 + dest.removeAttribute( "_submit_attached" );
30.6194 + dest.removeAttribute( "_change_attached" );
30.6195 +}
30.6196 +
30.6197 +jQuery.buildFragment = function( args, nodes, scripts ) {
30.6198 + var fragment, cacheable, cacheresults, doc,
30.6199 + first = args[ 0 ];
30.6200 +
30.6201 + // nodes may contain either an explicit document object,
30.6202 + // a jQuery collection or context object.
30.6203 + // If nodes[0] contains a valid object to assign to doc
30.6204 + if ( nodes && nodes[0] ) {
30.6205 + doc = nodes[0].ownerDocument || nodes[0];
30.6206 + }
30.6207 +
30.6208 + // Ensure that an attr object doesn't incorrectly stand in as a document object
30.6209 + // Chrome and Firefox seem to allow this to occur and will throw exception
30.6210 + // Fixes #8950
30.6211 + if ( !doc.createDocumentFragment ) {
30.6212 + doc = document;
30.6213 + }
30.6214 +
30.6215 + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
30.6216 + // Cloning options loses the selected state, so don't cache them
30.6217 + // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
30.6218 + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
30.6219 + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
30.6220 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
30.6221 + first.charAt(0) === "<" && !rnocache.test( first ) &&
30.6222 + (jQuery.support.checkClone || !rchecked.test( first )) &&
30.6223 + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
30.6224 +
30.6225 + cacheable = true;
30.6226 +
30.6227 + cacheresults = jQuery.fragments[ first ];
30.6228 + if ( cacheresults && cacheresults !== 1 ) {
30.6229 + fragment = cacheresults;
30.6230 + }
30.6231 + }
30.6232 +
30.6233 + if ( !fragment ) {
30.6234 + fragment = doc.createDocumentFragment();
30.6235 + jQuery.clean( args, doc, fragment, scripts );
30.6236 + }
30.6237 +
30.6238 + if ( cacheable ) {
30.6239 + jQuery.fragments[ first ] = cacheresults ? fragment : 1;
30.6240 + }
30.6241 +
30.6242 + return { fragment: fragment, cacheable: cacheable };
30.6243 +};
30.6244 +
30.6245 +jQuery.fragments = {};
30.6246 +
30.6247 +jQuery.each({
30.6248 + appendTo: "append",
30.6249 + prependTo: "prepend",
30.6250 + insertBefore: "before",
30.6251 + insertAfter: "after",
30.6252 + replaceAll: "replaceWith"
30.6253 +}, function( name, original ) {
30.6254 + jQuery.fn[ name ] = function( selector ) {
30.6255 + var ret = [],
30.6256 + insert = jQuery( selector ),
30.6257 + parent = this.length === 1 && this[0].parentNode;
30.6258 +
30.6259 + if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
30.6260 + insert[ original ]( this[0] );
30.6261 + return this;
30.6262 +
30.6263 + } else {
30.6264 + for ( var i = 0, l = insert.length; i < l; i++ ) {
30.6265 + var elems = ( i > 0 ? this.clone(true) : this ).get();
30.6266 + jQuery( insert[i] )[ original ]( elems );
30.6267 + ret = ret.concat( elems );
30.6268 + }
30.6269 +
30.6270 + return this.pushStack( ret, name, insert.selector );
30.6271 + }
30.6272 + };
30.6273 +});
30.6274 +
30.6275 +function getAll( elem ) {
30.6276 + if ( typeof elem.getElementsByTagName !== "undefined" ) {
30.6277 + return elem.getElementsByTagName( "*" );
30.6278 +
30.6279 + } else if ( typeof elem.querySelectorAll !== "undefined" ) {
30.6280 + return elem.querySelectorAll( "*" );
30.6281 +
30.6282 + } else {
30.6283 + return [];
30.6284 + }
30.6285 +}
30.6286 +
30.6287 +// Used in clean, fixes the defaultChecked property
30.6288 +function fixDefaultChecked( elem ) {
30.6289 + if ( elem.type === "checkbox" || elem.type === "radio" ) {
30.6290 + elem.defaultChecked = elem.checked;
30.6291 + }
30.6292 +}
30.6293 +// Finds all inputs and passes them to fixDefaultChecked
30.6294 +function findInputs( elem ) {
30.6295 + var nodeName = ( elem.nodeName || "" ).toLowerCase();
30.6296 + if ( nodeName === "input" ) {
30.6297 + fixDefaultChecked( elem );
30.6298 + // Skip scripts, get other children
30.6299 + } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
30.6300 + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
30.6301 + }
30.6302 +}
30.6303 +
30.6304 +// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
30.6305 +function shimCloneNode( elem ) {
30.6306 + var div = document.createElement( "div" );
30.6307 + safeFragment.appendChild( div );
30.6308 +
30.6309 + div.innerHTML = elem.outerHTML;
30.6310 + return div.firstChild;
30.6311 +}
30.6312 +
30.6313 +jQuery.extend({
30.6314 + clone: function( elem, dataAndEvents, deepDataAndEvents ) {
30.6315 + var srcElements,
30.6316 + destElements,
30.6317 + i,
30.6318 + // IE<=8 does not properly clone detached, unknown element nodes
30.6319 + clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
30.6320 + elem.cloneNode( true ) :
30.6321 + shimCloneNode( elem );
30.6322 +
30.6323 + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
30.6324 + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
30.6325 + // IE copies events bound via attachEvent when using cloneNode.
30.6326 + // Calling detachEvent on the clone will also remove the events
30.6327 + // from the original. In order to get around this, we use some
30.6328 + // proprietary methods to clear the events. Thanks to MooTools
30.6329 + // guys for this hotness.
30.6330 +
30.6331 + cloneFixAttributes( elem, clone );
30.6332 +
30.6333 + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
30.6334 + srcElements = getAll( elem );
30.6335 + destElements = getAll( clone );
30.6336 +
30.6337 + // Weird iteration because IE will replace the length property
30.6338 + // with an element if you are cloning the body and one of the
30.6339 + // elements on the page has a name or id of "length"
30.6340 + for ( i = 0; srcElements[i]; ++i ) {
30.6341 + // Ensure that the destination node is not null; Fixes #9587
30.6342 + if ( destElements[i] ) {
30.6343 + cloneFixAttributes( srcElements[i], destElements[i] );
30.6344 + }
30.6345 + }
30.6346 + }
30.6347 +
30.6348 + // Copy the events from the original to the clone
30.6349 + if ( dataAndEvents ) {
30.6350 + cloneCopyEvent( elem, clone );
30.6351 +
30.6352 + if ( deepDataAndEvents ) {
30.6353 + srcElements = getAll( elem );
30.6354 + destElements = getAll( clone );
30.6355 +
30.6356 + for ( i = 0; srcElements[i]; ++i ) {
30.6357 + cloneCopyEvent( srcElements[i], destElements[i] );
30.6358 + }
30.6359 + }
30.6360 + }
30.6361 +
30.6362 + srcElements = destElements = null;
30.6363 +
30.6364 + // Return the cloned set
30.6365 + return clone;
30.6366 + },
30.6367 +
30.6368 + clean: function( elems, context, fragment, scripts ) {
30.6369 + var checkScriptType, script, j,
30.6370 + ret = [];
30.6371 +
30.6372 + context = context || document;
30.6373 +
30.6374 + // !context.createElement fails in IE with an error but returns typeof 'object'
30.6375 + if ( typeof context.createElement === "undefined" ) {
30.6376 + context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
30.6377 + }
30.6378 +
30.6379 + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
30.6380 + if ( typeof elem === "number" ) {
30.6381 + elem += "";
30.6382 + }
30.6383 +
30.6384 + if ( !elem ) {
30.6385 + continue;
30.6386 + }
30.6387 +
30.6388 + // Convert html string into DOM nodes
30.6389 + if ( typeof elem === "string" ) {
30.6390 + if ( !rhtml.test( elem ) ) {
30.6391 + elem = context.createTextNode( elem );
30.6392 + } else {
30.6393 + // Fix "XHTML"-style tags in all browsers
30.6394 + elem = elem.replace(rxhtmlTag, "<$1></$2>");
30.6395 +
30.6396 + // Trim whitespace, otherwise indexOf won't work as expected
30.6397 + var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
30.6398 + wrap = wrapMap[ tag ] || wrapMap._default,
30.6399 + depth = wrap[0],
30.6400 + div = context.createElement("div"),
30.6401 + safeChildNodes = safeFragment.childNodes,
30.6402 + remove;
30.6403 +
30.6404 + // Append wrapper element to unknown element safe doc fragment
30.6405 + if ( context === document ) {
30.6406 + // Use the fragment we've already created for this document
30.6407 + safeFragment.appendChild( div );
30.6408 + } else {
30.6409 + // Use a fragment created with the owner document
30.6410 + createSafeFragment( context ).appendChild( div );
30.6411 + }
30.6412 +
30.6413 + // Go to html and back, then peel off extra wrappers
30.6414 + div.innerHTML = wrap[1] + elem + wrap[2];
30.6415 +
30.6416 + // Move to the right depth
30.6417 + while ( depth-- ) {
30.6418 + div = div.lastChild;
30.6419 + }
30.6420 +
30.6421 + // Remove IE's autoinserted <tbody> from table fragments
30.6422 + if ( !jQuery.support.tbody ) {
30.6423 +
30.6424 + // String was a <table>, *may* have spurious <tbody>
30.6425 + var hasBody = rtbody.test(elem),
30.6426 + tbody = tag === "table" && !hasBody ?
30.6427 + div.firstChild && div.firstChild.childNodes :
30.6428 +
30.6429 + // String was a bare <thead> or <tfoot>
30.6430 + wrap[1] === "<table>" && !hasBody ?
30.6431 + div.childNodes :
30.6432 + [];
30.6433 +
30.6434 + for ( j = tbody.length - 1; j >= 0 ; --j ) {
30.6435 + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
30.6436 + tbody[ j ].parentNode.removeChild( tbody[ j ] );
30.6437 + }
30.6438 + }
30.6439 + }
30.6440 +
30.6441 + // IE completely kills leading whitespace when innerHTML is used
30.6442 + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
30.6443 + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
30.6444 + }
30.6445 +
30.6446 + elem = div.childNodes;
30.6447 +
30.6448 + // Clear elements from DocumentFragment (safeFragment or otherwise)
30.6449 + // to avoid hoarding elements. Fixes #11356
30.6450 + if ( div ) {
30.6451 + div.parentNode.removeChild( div );
30.6452 +
30.6453 + // Guard against -1 index exceptions in FF3.6
30.6454 + if ( safeChildNodes.length > 0 ) {
30.6455 + remove = safeChildNodes[ safeChildNodes.length - 1 ];
30.6456 +
30.6457 + if ( remove && remove.parentNode ) {
30.6458 + remove.parentNode.removeChild( remove );
30.6459 + }
30.6460 + }
30.6461 + }
30.6462 + }
30.6463 + }
30.6464 +
30.6465 + // Resets defaultChecked for any radios and checkboxes
30.6466 + // about to be appended to the DOM in IE 6/7 (#8060)
30.6467 + var len;
30.6468 + if ( !jQuery.support.appendChecked ) {
30.6469 + if ( elem[0] && typeof (len = elem.length) === "number" ) {
30.6470 + for ( j = 0; j < len; j++ ) {
30.6471 + findInputs( elem[j] );
30.6472 + }
30.6473 + } else {
30.6474 + findInputs( elem );
30.6475 + }
30.6476 + }
30.6477 +
30.6478 + if ( elem.nodeType ) {
30.6479 + ret.push( elem );
30.6480 + } else {
30.6481 + ret = jQuery.merge( ret, elem );
30.6482 + }
30.6483 + }
30.6484 +
30.6485 + if ( fragment ) {
30.6486 + checkScriptType = function( elem ) {
30.6487 + return !elem.type || rscriptType.test( elem.type );
30.6488 + };
30.6489 + for ( i = 0; ret[i]; i++ ) {
30.6490 + script = ret[i];
30.6491 + if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
30.6492 + scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
30.6493 +
30.6494 + } else {
30.6495 + if ( script.nodeType === 1 ) {
30.6496 + var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
30.6497 +
30.6498 + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
30.6499 + }
30.6500 + fragment.appendChild( script );
30.6501 + }
30.6502 + }
30.6503 + }
30.6504 +
30.6505 + return ret;
30.6506 + },
30.6507 +
30.6508 + cleanData: function( elems ) {
30.6509 + var data, id,
30.6510 + cache = jQuery.cache,
30.6511 + special = jQuery.event.special,
30.6512 + deleteExpando = jQuery.support.deleteExpando;
30.6513 +
30.6514 + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
30.6515 + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
30.6516 + continue;
30.6517 + }
30.6518 +
30.6519 + id = elem[ jQuery.expando ];
30.6520 +
30.6521 + if ( id ) {
30.6522 + data = cache[ id ];
30.6523 +
30.6524 + if ( data && data.events ) {
30.6525 + for ( var type in data.events ) {
30.6526 + if ( special[ type ] ) {
30.6527 + jQuery.event.remove( elem, type );
30.6528 +
30.6529 + // This is a shortcut to avoid jQuery.event.remove's overhead
30.6530 + } else {
30.6531 + jQuery.removeEvent( elem, type, data.handle );
30.6532 + }
30.6533 + }
30.6534 +
30.6535 + // Null the DOM reference to avoid IE6/7/8 leak (#7054)
30.6536 + if ( data.handle ) {
30.6537 + data.handle.elem = null;
30.6538 + }
30.6539 + }
30.6540 +
30.6541 + if ( deleteExpando ) {
30.6542 + delete elem[ jQuery.expando ];
30.6543 +
30.6544 + } else if ( elem.removeAttribute ) {
30.6545 + elem.removeAttribute( jQuery.expando );
30.6546 + }
30.6547 +
30.6548 + delete cache[ id ];
30.6549 + }
30.6550 + }
30.6551 + }
30.6552 +});
30.6553 +
30.6554 +
30.6555 +
30.6556 +
30.6557 +var ralpha = /alpha\([^)]*\)/i,
30.6558 + ropacity = /opacity=([^)]*)/,
30.6559 + // fixed for IE9, see #8346
30.6560 + rupper = /([A-Z]|^ms)/g,
30.6561 + rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
30.6562 + rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
30.6563 + rrelNum = /^([\-+])=([\-+.\de]+)/,
30.6564 + rmargin = /^margin/,
30.6565 +
30.6566 + cssShow = { position: "absolute", visibility: "hidden", display: "block" },
30.6567 +
30.6568 + // order is important!
30.6569 + cssExpand = [ "Top", "Right", "Bottom", "Left" ],
30.6570 +
30.6571 + curCSS,
30.6572 +
30.6573 + getComputedStyle,
30.6574 + currentStyle;
30.6575 +
30.6576 +jQuery.fn.css = function( name, value ) {
30.6577 + return jQuery.access( this, function( elem, name, value ) {
30.6578 + return value !== undefined ?
30.6579 + jQuery.style( elem, name, value ) :
30.6580 + jQuery.css( elem, name );
30.6581 + }, name, value, arguments.length > 1 );
30.6582 +};
30.6583 +
30.6584 +jQuery.extend({
30.6585 + // Add in style property hooks for overriding the default
30.6586 + // behavior of getting and setting a style property
30.6587 + cssHooks: {
30.6588 + opacity: {
30.6589 + get: function( elem, computed ) {
30.6590 + if ( computed ) {
30.6591 + // We should always get a number back from opacity
30.6592 + var ret = curCSS( elem, "opacity" );
30.6593 + return ret === "" ? "1" : ret;
30.6594 +
30.6595 + } else {
30.6596 + return elem.style.opacity;
30.6597 + }
30.6598 + }
30.6599 + }
30.6600 + },
30.6601 +
30.6602 + // Exclude the following css properties to add px
30.6603 + cssNumber: {
30.6604 + "fillOpacity": true,
30.6605 + "fontWeight": true,
30.6606 + "lineHeight": true,
30.6607 + "opacity": true,
30.6608 + "orphans": true,
30.6609 + "widows": true,
30.6610 + "zIndex": true,
30.6611 + "zoom": true
30.6612 + },
30.6613 +
30.6614 + // Add in properties whose names you wish to fix before
30.6615 + // setting or getting the value
30.6616 + cssProps: {
30.6617 + // normalize float css property
30.6618 + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
30.6619 + },
30.6620 +
30.6621 + // Get and set the style property on a DOM Node
30.6622 + style: function( elem, name, value, extra ) {
30.6623 + // Don't set styles on text and comment nodes
30.6624 + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
30.6625 + return;
30.6626 + }
30.6627 +
30.6628 + // Make sure that we're working with the right name
30.6629 + var ret, type, origName = jQuery.camelCase( name ),
30.6630 + style = elem.style, hooks = jQuery.cssHooks[ origName ];
30.6631 +
30.6632 + name = jQuery.cssProps[ origName ] || origName;
30.6633 +
30.6634 + // Check if we're setting a value
30.6635 + if ( value !== undefined ) {
30.6636 + type = typeof value;
30.6637 +
30.6638 + // convert relative number strings (+= or -=) to relative numbers. #7345
30.6639 + if ( type === "string" && (ret = rrelNum.exec( value )) ) {
30.6640 + value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
30.6641 + // Fixes bug #9237
30.6642 + type = "number";
30.6643 + }
30.6644 +
30.6645 + // Make sure that NaN and null values aren't set. See: #7116
30.6646 + if ( value == null || type === "number" && isNaN( value ) ) {
30.6647 + return;
30.6648 + }
30.6649 +
30.6650 + // If a number was passed in, add 'px' to the (except for certain CSS properties)
30.6651 + if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
30.6652 + value += "px";
30.6653 + }
30.6654 +
30.6655 + // If a hook was provided, use that value, otherwise just set the specified value
30.6656 + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
30.6657 + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
30.6658 + // Fixes bug #5509
30.6659 + try {
30.6660 + style[ name ] = value;
30.6661 + } catch(e) {}
30.6662 + }
30.6663 +
30.6664 + } else {
30.6665 + // If a hook was provided get the non-computed value from there
30.6666 + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
30.6667 + return ret;
30.6668 + }
30.6669 +
30.6670 + // Otherwise just get the value from the style object
30.6671 + return style[ name ];
30.6672 + }
30.6673 + },
30.6674 +
30.6675 + css: function( elem, name, extra ) {
30.6676 + var ret, hooks;
30.6677 +
30.6678 + // Make sure that we're working with the right name
30.6679 + name = jQuery.camelCase( name );
30.6680 + hooks = jQuery.cssHooks[ name ];
30.6681 + name = jQuery.cssProps[ name ] || name;
30.6682 +
30.6683 + // cssFloat needs a special treatment
30.6684 + if ( name === "cssFloat" ) {
30.6685 + name = "float";
30.6686 + }
30.6687 +
30.6688 + // If a hook was provided get the computed value from there
30.6689 + if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
30.6690 + return ret;
30.6691 +
30.6692 + // Otherwise, if a way to get the computed value exists, use that
30.6693 + } else if ( curCSS ) {
30.6694 + return curCSS( elem, name );
30.6695 + }
30.6696 + },
30.6697 +
30.6698 + // A method for quickly swapping in/out CSS properties to get correct calculations
30.6699 + swap: function( elem, options, callback ) {
30.6700 + var old = {},
30.6701 + ret, name;
30.6702 +
30.6703 + // Remember the old values, and insert the new ones
30.6704 + for ( name in options ) {
30.6705 + old[ name ] = elem.style[ name ];
30.6706 + elem.style[ name ] = options[ name ];
30.6707 + }
30.6708 +
30.6709 + ret = callback.call( elem );
30.6710 +
30.6711 + // Revert the old values
30.6712 + for ( name in options ) {
30.6713 + elem.style[ name ] = old[ name ];
30.6714 + }
30.6715 +
30.6716 + return ret;
30.6717 + }
30.6718 +});
30.6719 +
30.6720 +// DEPRECATED in 1.3, Use jQuery.css() instead
30.6721 +jQuery.curCSS = jQuery.css;
30.6722 +
30.6723 +if ( document.defaultView && document.defaultView.getComputedStyle ) {
30.6724 + getComputedStyle = function( elem, name ) {
30.6725 + var ret, defaultView, computedStyle, width,
30.6726 + style = elem.style;
30.6727 +
30.6728 + name = name.replace( rupper, "-$1" ).toLowerCase();
30.6729 +
30.6730 + if ( (defaultView = elem.ownerDocument.defaultView) &&
30.6731 + (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
30.6732 +
30.6733 + ret = computedStyle.getPropertyValue( name );
30.6734 + if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
30.6735 + ret = jQuery.style( elem, name );
30.6736 + }
30.6737 + }
30.6738 +
30.6739 + // A tribute to the "awesome hack by Dean Edwards"
30.6740 + // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
30.6741 + // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
30.6742 + if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
30.6743 + width = style.width;
30.6744 + style.width = ret;
30.6745 + ret = computedStyle.width;
30.6746 + style.width = width;
30.6747 + }
30.6748 +
30.6749 + return ret;
30.6750 + };
30.6751 +}
30.6752 +
30.6753 +if ( document.documentElement.currentStyle ) {
30.6754 + currentStyle = function( elem, name ) {
30.6755 + var left, rsLeft, uncomputed,
30.6756 + ret = elem.currentStyle && elem.currentStyle[ name ],
30.6757 + style = elem.style;
30.6758 +
30.6759 + // Avoid setting ret to empty string here
30.6760 + // so we don't default to auto
30.6761 + if ( ret == null && style && (uncomputed = style[ name ]) ) {
30.6762 + ret = uncomputed;
30.6763 + }
30.6764 +
30.6765 + // From the awesome hack by Dean Edwards
30.6766 + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
30.6767 +
30.6768 + // If we're not dealing with a regular pixel number
30.6769 + // but a number that has a weird ending, we need to convert it to pixels
30.6770 + if ( rnumnonpx.test( ret ) ) {
30.6771 +
30.6772 + // Remember the original values
30.6773 + left = style.left;
30.6774 + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
30.6775 +
30.6776 + // Put in the new values to get a computed value out
30.6777 + if ( rsLeft ) {
30.6778 + elem.runtimeStyle.left = elem.currentStyle.left;
30.6779 + }
30.6780 + style.left = name === "fontSize" ? "1em" : ret;
30.6781 + ret = style.pixelLeft + "px";
30.6782 +
30.6783 + // Revert the changed values
30.6784 + style.left = left;
30.6785 + if ( rsLeft ) {
30.6786 + elem.runtimeStyle.left = rsLeft;
30.6787 + }
30.6788 + }
30.6789 +
30.6790 + return ret === "" ? "auto" : ret;
30.6791 + };
30.6792 +}
30.6793 +
30.6794 +curCSS = getComputedStyle || currentStyle;
30.6795 +
30.6796 +function getWidthOrHeight( elem, name, extra ) {
30.6797 +
30.6798 + // Start with offset property
30.6799 + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
30.6800 + i = name === "width" ? 1 : 0,
30.6801 + len = 4;
30.6802 +
30.6803 + if ( val > 0 ) {
30.6804 + if ( extra !== "border" ) {
30.6805 + for ( ; i < len; i += 2 ) {
30.6806 + if ( !extra ) {
30.6807 + val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
30.6808 + }
30.6809 + if ( extra === "margin" ) {
30.6810 + val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
30.6811 + } else {
30.6812 + val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
30.6813 + }
30.6814 + }
30.6815 + }
30.6816 +
30.6817 + return val + "px";
30.6818 + }
30.6819 +
30.6820 + // Fall back to computed then uncomputed css if necessary
30.6821 + val = curCSS( elem, name );
30.6822 + if ( val < 0 || val == null ) {
30.6823 + val = elem.style[ name ];
30.6824 + }
30.6825 +
30.6826 + // Computed unit is not pixels. Stop here and return.
30.6827 + if ( rnumnonpx.test(val) ) {
30.6828 + return val;
30.6829 + }
30.6830 +
30.6831 + // Normalize "", auto, and prepare for extra
30.6832 + val = parseFloat( val ) || 0;
30.6833 +
30.6834 + // Add padding, border, margin
30.6835 + if ( extra ) {
30.6836 + for ( ; i < len; i += 2 ) {
30.6837 + val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
30.6838 + if ( extra !== "padding" ) {
30.6839 + val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
30.6840 + }
30.6841 + if ( extra === "margin" ) {
30.6842 + val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
30.6843 + }
30.6844 + }
30.6845 + }
30.6846 +
30.6847 + return val + "px";
30.6848 +}
30.6849 +
30.6850 +jQuery.each([ "height", "width" ], function( i, name ) {
30.6851 + jQuery.cssHooks[ name ] = {
30.6852 + get: function( elem, computed, extra ) {
30.6853 + if ( computed ) {
30.6854 + if ( elem.offsetWidth !== 0 ) {
30.6855 + return getWidthOrHeight( elem, name, extra );
30.6856 + } else {
30.6857 + return jQuery.swap( elem, cssShow, function() {
30.6858 + return getWidthOrHeight( elem, name, extra );
30.6859 + });
30.6860 + }
30.6861 + }
30.6862 + },
30.6863 +
30.6864 + set: function( elem, value ) {
30.6865 + return rnum.test( value ) ?
30.6866 + value + "px" :
30.6867 + value;
30.6868 + }
30.6869 + };
30.6870 +});
30.6871 +
30.6872 +if ( !jQuery.support.opacity ) {
30.6873 + jQuery.cssHooks.opacity = {
30.6874 + get: function( elem, computed ) {
30.6875 + // IE uses filters for opacity
30.6876 + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
30.6877 + ( parseFloat( RegExp.$1 ) / 100 ) + "" :
30.6878 + computed ? "1" : "";
30.6879 + },
30.6880 +
30.6881 + set: function( elem, value ) {
30.6882 + var style = elem.style,
30.6883 + currentStyle = elem.currentStyle,
30.6884 + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
30.6885 + filter = currentStyle && currentStyle.filter || style.filter || "";
30.6886 +
30.6887 + // IE has trouble with opacity if it does not have layout
30.6888 + // Force it by setting the zoom level
30.6889 + style.zoom = 1;
30.6890 +
30.6891 + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
30.6892 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
30.6893 +
30.6894 + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
30.6895 + // if "filter:" is present at all, clearType is disabled, we want to avoid this
30.6896 + // style.removeAttribute is IE Only, but so apparently is this code path...
30.6897 + style.removeAttribute( "filter" );
30.6898 +
30.6899 + // if there there is no filter style applied in a css rule, we are done
30.6900 + if ( currentStyle && !currentStyle.filter ) {
30.6901 + return;
30.6902 + }
30.6903 + }
30.6904 +
30.6905 + // otherwise, set new filter values
30.6906 + style.filter = ralpha.test( filter ) ?
30.6907 + filter.replace( ralpha, opacity ) :
30.6908 + filter + " " + opacity;
30.6909 + }
30.6910 + };
30.6911 +}
30.6912 +
30.6913 +jQuery(function() {
30.6914 + // This hook cannot be added until DOM ready because the support test
30.6915 + // for it is not run until after DOM ready
30.6916 + if ( !jQuery.support.reliableMarginRight ) {
30.6917 + jQuery.cssHooks.marginRight = {
30.6918 + get: function( elem, computed ) {
30.6919 + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
30.6920 + // Work around by temporarily setting element display to inline-block
30.6921 + return jQuery.swap( elem, { "display": "inline-block" }, function() {
30.6922 + if ( computed ) {
30.6923 + return curCSS( elem, "margin-right" );
30.6924 + } else {
30.6925 + return elem.style.marginRight;
30.6926 + }
30.6927 + });
30.6928 + }
30.6929 + };
30.6930 + }
30.6931 +});
30.6932 +
30.6933 +if ( jQuery.expr && jQuery.expr.filters ) {
30.6934 + jQuery.expr.filters.hidden = function( elem ) {
30.6935 + var width = elem.offsetWidth,
30.6936 + height = elem.offsetHeight;
30.6937 +
30.6938 + return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
30.6939 + };
30.6940 +
30.6941 + jQuery.expr.filters.visible = function( elem ) {
30.6942 + return !jQuery.expr.filters.hidden( elem );
30.6943 + };
30.6944 +}
30.6945 +
30.6946 +// These hooks are used by animate to expand properties
30.6947 +jQuery.each({
30.6948 + margin: "",
30.6949 + padding: "",
30.6950 + border: "Width"
30.6951 +}, function( prefix, suffix ) {
30.6952 +
30.6953 + jQuery.cssHooks[ prefix + suffix ] = {
30.6954 + expand: function( value ) {
30.6955 + var i,
30.6956 +
30.6957 + // assumes a single number if not a string
30.6958 + parts = typeof value === "string" ? value.split(" ") : [ value ],
30.6959 + expanded = {};
30.6960 +
30.6961 + for ( i = 0; i < 4; i++ ) {
30.6962 + expanded[ prefix + cssExpand[ i ] + suffix ] =
30.6963 + parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
30.6964 + }
30.6965 +
30.6966 + return expanded;
30.6967 + }
30.6968 + };
30.6969 +});
30.6970 +
30.6971 +
30.6972 +
30.6973 +
30.6974 +var r20 = /%20/g,
30.6975 + rbracket = /\[\]$/,
30.6976 + rCRLF = /\r?\n/g,
30.6977 + rhash = /#.*$/,
30.6978 + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
30.6979 + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
30.6980 + // #7653, #8125, #8152: local protocol detection
30.6981 + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
30.6982 + rnoContent = /^(?:GET|HEAD)$/,
30.6983 + rprotocol = /^\/\//,
30.6984 + rquery = /\?/,
30.6985 + rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
30.6986 + rselectTextarea = /^(?:select|textarea)/i,
30.6987 + rspacesAjax = /\s+/,
30.6988 + rts = /([?&])_=[^&]*/,
30.6989 + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
30.6990 +
30.6991 + // Keep a copy of the old load method
30.6992 + _load = jQuery.fn.load,
30.6993 +
30.6994 + /* Prefilters
30.6995 + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
30.6996 + * 2) These are called:
30.6997 + * - BEFORE asking for a transport
30.6998 + * - AFTER param serialization (s.data is a string if s.processData is true)
30.6999 + * 3) key is the dataType
30.7000 + * 4) the catchall symbol "*" can be used
30.7001 + * 5) execution will start with transport dataType and THEN continue down to "*" if needed
30.7002 + */
30.7003 + prefilters = {},
30.7004 +
30.7005 + /* Transports bindings
30.7006 + * 1) key is the dataType
30.7007 + * 2) the catchall symbol "*" can be used
30.7008 + * 3) selection will start with transport dataType and THEN go to "*" if needed
30.7009 + */
30.7010 + transports = {},
30.7011 +
30.7012 + // Document location
30.7013 + ajaxLocation,
30.7014 +
30.7015 + // Document location segments
30.7016 + ajaxLocParts,
30.7017 +
30.7018 + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
30.7019 + allTypes = ["*/"] + ["*"];
30.7020 +
30.7021 +// #8138, IE may throw an exception when accessing
30.7022 +// a field from window.location if document.domain has been set
30.7023 +try {
30.7024 + ajaxLocation = location.href;
30.7025 +} catch( e ) {
30.7026 + // Use the href attribute of an A element
30.7027 + // since IE will modify it given document.location
30.7028 + ajaxLocation = document.createElement( "a" );
30.7029 + ajaxLocation.href = "";
30.7030 + ajaxLocation = ajaxLocation.href;
30.7031 +}
30.7032 +
30.7033 +// Segment location into parts
30.7034 +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
30.7035 +
30.7036 +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
30.7037 +function addToPrefiltersOrTransports( structure ) {
30.7038 +
30.7039 + // dataTypeExpression is optional and defaults to "*"
30.7040 + return function( dataTypeExpression, func ) {
30.7041 +
30.7042 + if ( typeof dataTypeExpression !== "string" ) {
30.7043 + func = dataTypeExpression;
30.7044 + dataTypeExpression = "*";
30.7045 + }
30.7046 +
30.7047 + if ( jQuery.isFunction( func ) ) {
30.7048 + var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
30.7049 + i = 0,
30.7050 + length = dataTypes.length,
30.7051 + dataType,
30.7052 + list,
30.7053 + placeBefore;
30.7054 +
30.7055 + // For each dataType in the dataTypeExpression
30.7056 + for ( ; i < length; i++ ) {
30.7057 + dataType = dataTypes[ i ];
30.7058 + // We control if we're asked to add before
30.7059 + // any existing element
30.7060 + placeBefore = /^\+/.test( dataType );
30.7061 + if ( placeBefore ) {
30.7062 + dataType = dataType.substr( 1 ) || "*";
30.7063 + }
30.7064 + list = structure[ dataType ] = structure[ dataType ] || [];
30.7065 + // then we add to the structure accordingly
30.7066 + list[ placeBefore ? "unshift" : "push" ]( func );
30.7067 + }
30.7068 + }
30.7069 + };
30.7070 +}
30.7071 +
30.7072 +// Base inspection function for prefilters and transports
30.7073 +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
30.7074 + dataType /* internal */, inspected /* internal */ ) {
30.7075 +
30.7076 + dataType = dataType || options.dataTypes[ 0 ];
30.7077 + inspected = inspected || {};
30.7078 +
30.7079 + inspected[ dataType ] = true;
30.7080 +
30.7081 + var list = structure[ dataType ],
30.7082 + i = 0,
30.7083 + length = list ? list.length : 0,
30.7084 + executeOnly = ( structure === prefilters ),
30.7085 + selection;
30.7086 +
30.7087 + for ( ; i < length && ( executeOnly || !selection ); i++ ) {
30.7088 + selection = list[ i ]( options, originalOptions, jqXHR );
30.7089 + // If we got redirected to another dataType
30.7090 + // we try there if executing only and not done already
30.7091 + if ( typeof selection === "string" ) {
30.7092 + if ( !executeOnly || inspected[ selection ] ) {
30.7093 + selection = undefined;
30.7094 + } else {
30.7095 + options.dataTypes.unshift( selection );
30.7096 + selection = inspectPrefiltersOrTransports(
30.7097 + structure, options, originalOptions, jqXHR, selection, inspected );
30.7098 + }
30.7099 + }
30.7100 + }
30.7101 + // If we're only executing or nothing was selected
30.7102 + // we try the catchall dataType if not done already
30.7103 + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
30.7104 + selection = inspectPrefiltersOrTransports(
30.7105 + structure, options, originalOptions, jqXHR, "*", inspected );
30.7106 + }
30.7107 + // unnecessary when only executing (prefilters)
30.7108 + // but it'll be ignored by the caller in that case
30.7109 + return selection;
30.7110 +}
30.7111 +
30.7112 +// A special extend for ajax options
30.7113 +// that takes "flat" options (not to be deep extended)
30.7114 +// Fixes #9887
30.7115 +function ajaxExtend( target, src ) {
30.7116 + var key, deep,
30.7117 + flatOptions = jQuery.ajaxSettings.flatOptions || {};
30.7118 + for ( key in src ) {
30.7119 + if ( src[ key ] !== undefined ) {
30.7120 + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
30.7121 + }
30.7122 + }
30.7123 + if ( deep ) {
30.7124 + jQuery.extend( true, target, deep );
30.7125 + }
30.7126 +}
30.7127 +
30.7128 +jQuery.fn.extend({
30.7129 + load: function( url, params, callback ) {
30.7130 + if ( typeof url !== "string" && _load ) {
30.7131 + return _load.apply( this, arguments );
30.7132 +
30.7133 + // Don't do a request if no elements are being requested
30.7134 + } else if ( !this.length ) {
30.7135 + return this;
30.7136 + }
30.7137 +
30.7138 + var off = url.indexOf( " " );
30.7139 + if ( off >= 0 ) {
30.7140 + var selector = url.slice( off, url.length );
30.7141 + url = url.slice( 0, off );
30.7142 + }
30.7143 +
30.7144 + // Default to a GET request
30.7145 + var type = "GET";
30.7146 +
30.7147 + // If the second parameter was provided
30.7148 + if ( params ) {
30.7149 + // If it's a function
30.7150 + if ( jQuery.isFunction( params ) ) {
30.7151 + // We assume that it's the callback
30.7152 + callback = params;
30.7153 + params = undefined;
30.7154 +
30.7155 + // Otherwise, build a param string
30.7156 + } else if ( typeof params === "object" ) {
30.7157 + params = jQuery.param( params, jQuery.ajaxSettings.traditional );
30.7158 + type = "POST";
30.7159 + }
30.7160 + }
30.7161 +
30.7162 + var self = this;
30.7163 +
30.7164 + // Request the remote document
30.7165 + jQuery.ajax({
30.7166 + url: url,
30.7167 + type: type,
30.7168 + dataType: "html",
30.7169 + data: params,
30.7170 + // Complete callback (responseText is used internally)
30.7171 + complete: function( jqXHR, status, responseText ) {
30.7172 + // Store the response as specified by the jqXHR object
30.7173 + responseText = jqXHR.responseText;
30.7174 + // If successful, inject the HTML into all the matched elements
30.7175 + if ( jqXHR.isResolved() ) {
30.7176 + // #4825: Get the actual response in case
30.7177 + // a dataFilter is present in ajaxSettings
30.7178 + jqXHR.done(function( r ) {
30.7179 + responseText = r;
30.7180 + });
30.7181 + // See if a selector was specified
30.7182 + self.html( selector ?
30.7183 + // Create a dummy div to hold the results
30.7184 + jQuery("<div>")
30.7185 + // inject the contents of the document in, removing the scripts
30.7186 + // to avoid any 'Permission Denied' errors in IE
30.7187 + .append(responseText.replace(rscript, ""))
30.7188 +
30.7189 + // Locate the specified elements
30.7190 + .find(selector) :
30.7191 +
30.7192 + // If not, just inject the full result
30.7193 + responseText );
30.7194 + }
30.7195 +
30.7196 + if ( callback ) {
30.7197 + self.each( callback, [ responseText, status, jqXHR ] );
30.7198 + }
30.7199 + }
30.7200 + });
30.7201 +
30.7202 + return this;
30.7203 + },
30.7204 +
30.7205 + serialize: function() {
30.7206 + return jQuery.param( this.serializeArray() );
30.7207 + },
30.7208 +
30.7209 + serializeArray: function() {
30.7210 + return this.map(function(){
30.7211 + return this.elements ? jQuery.makeArray( this.elements ) : this;
30.7212 + })
30.7213 + .filter(function(){
30.7214 + return this.name && !this.disabled &&
30.7215 + ( this.checked || rselectTextarea.test( this.nodeName ) ||
30.7216 + rinput.test( this.type ) );
30.7217 + })
30.7218 + .map(function( i, elem ){
30.7219 + var val = jQuery( this ).val();
30.7220 +
30.7221 + return val == null ?
30.7222 + null :
30.7223 + jQuery.isArray( val ) ?
30.7224 + jQuery.map( val, function( val, i ){
30.7225 + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
30.7226 + }) :
30.7227 + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
30.7228 + }).get();
30.7229 + }
30.7230 +});
30.7231 +
30.7232 +// Attach a bunch of functions for handling common AJAX events
30.7233 +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
30.7234 + jQuery.fn[ o ] = function( f ){
30.7235 + return this.on( o, f );
30.7236 + };
30.7237 +});
30.7238 +
30.7239 +jQuery.each( [ "get", "post" ], function( i, method ) {
30.7240 + jQuery[ method ] = function( url, data, callback, type ) {
30.7241 + // shift arguments if data argument was omitted
30.7242 + if ( jQuery.isFunction( data ) ) {
30.7243 + type = type || callback;
30.7244 + callback = data;
30.7245 + data = undefined;
30.7246 + }
30.7247 +
30.7248 + return jQuery.ajax({
30.7249 + type: method,
30.7250 + url: url,
30.7251 + data: data,
30.7252 + success: callback,
30.7253 + dataType: type
30.7254 + });
30.7255 + };
30.7256 +});
30.7257 +
30.7258 +jQuery.extend({
30.7259 +
30.7260 + getScript: function( url, callback ) {
30.7261 + return jQuery.get( url, undefined, callback, "script" );
30.7262 + },
30.7263 +
30.7264 + getJSON: function( url, data, callback ) {
30.7265 + return jQuery.get( url, data, callback, "json" );
30.7266 + },
30.7267 +
30.7268 + // Creates a full fledged settings object into target
30.7269 + // with both ajaxSettings and settings fields.
30.7270 + // If target is omitted, writes into ajaxSettings.
30.7271 + ajaxSetup: function( target, settings ) {
30.7272 + if ( settings ) {
30.7273 + // Building a settings object
30.7274 + ajaxExtend( target, jQuery.ajaxSettings );
30.7275 + } else {
30.7276 + // Extending ajaxSettings
30.7277 + settings = target;
30.7278 + target = jQuery.ajaxSettings;
30.7279 + }
30.7280 + ajaxExtend( target, settings );
30.7281 + return target;
30.7282 + },
30.7283 +
30.7284 + ajaxSettings: {
30.7285 + url: ajaxLocation,
30.7286 + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
30.7287 + global: true,
30.7288 + type: "GET",
30.7289 + contentType: "application/x-www-form-urlencoded; charset=UTF-8",
30.7290 + processData: true,
30.7291 + async: true,
30.7292 + /*
30.7293 + timeout: 0,
30.7294 + data: null,
30.7295 + dataType: null,
30.7296 + username: null,
30.7297 + password: null,
30.7298 + cache: null,
30.7299 + traditional: false,
30.7300 + headers: {},
30.7301 + */
30.7302 +
30.7303 + accepts: {
30.7304 + xml: "application/xml, text/xml",
30.7305 + html: "text/html",
30.7306 + text: "text/plain",
30.7307 + json: "application/json, text/javascript",
30.7308 + "*": allTypes
30.7309 + },
30.7310 +
30.7311 + contents: {
30.7312 + xml: /xml/,
30.7313 + html: /html/,
30.7314 + json: /json/
30.7315 + },
30.7316 +
30.7317 + responseFields: {
30.7318 + xml: "responseXML",
30.7319 + text: "responseText"
30.7320 + },
30.7321 +
30.7322 + // List of data converters
30.7323 + // 1) key format is "source_type destination_type" (a single space in-between)
30.7324 + // 2) the catchall symbol "*" can be used for source_type
30.7325 + converters: {
30.7326 +
30.7327 + // Convert anything to text
30.7328 + "* text": window.String,
30.7329 +
30.7330 + // Text to html (true = no transformation)
30.7331 + "text html": true,
30.7332 +
30.7333 + // Evaluate text as a json expression
30.7334 + "text json": jQuery.parseJSON,
30.7335 +
30.7336 + // Parse text as xml
30.7337 + "text xml": jQuery.parseXML
30.7338 + },
30.7339 +
30.7340 + // For options that shouldn't be deep extended:
30.7341 + // you can add your own custom options here if
30.7342 + // and when you create one that shouldn't be
30.7343 + // deep extended (see ajaxExtend)
30.7344 + flatOptions: {
30.7345 + context: true,
30.7346 + url: true
30.7347 + }
30.7348 + },
30.7349 +
30.7350 + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
30.7351 + ajaxTransport: addToPrefiltersOrTransports( transports ),
30.7352 +
30.7353 + // Main method
30.7354 + ajax: function( url, options ) {
30.7355 +
30.7356 + // If url is an object, simulate pre-1.5 signature
30.7357 + if ( typeof url === "object" ) {
30.7358 + options = url;
30.7359 + url = undefined;
30.7360 + }
30.7361 +
30.7362 + // Force options to be an object
30.7363 + options = options || {};
30.7364 +
30.7365 + var // Create the final options object
30.7366 + s = jQuery.ajaxSetup( {}, options ),
30.7367 + // Callbacks context
30.7368 + callbackContext = s.context || s,
30.7369 + // Context for global events
30.7370 + // It's the callbackContext if one was provided in the options
30.7371 + // and if it's a DOM node or a jQuery collection
30.7372 + globalEventContext = callbackContext !== s &&
30.7373 + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
30.7374 + jQuery( callbackContext ) : jQuery.event,
30.7375 + // Deferreds
30.7376 + deferred = jQuery.Deferred(),
30.7377 + completeDeferred = jQuery.Callbacks( "once memory" ),
30.7378 + // Status-dependent callbacks
30.7379 + statusCode = s.statusCode || {},
30.7380 + // ifModified key
30.7381 + ifModifiedKey,
30.7382 + // Headers (they are sent all at once)
30.7383 + requestHeaders = {},
30.7384 + requestHeadersNames = {},
30.7385 + // Response headers
30.7386 + responseHeadersString,
30.7387 + responseHeaders,
30.7388 + // transport
30.7389 + transport,
30.7390 + // timeout handle
30.7391 + timeoutTimer,
30.7392 + // Cross-domain detection vars
30.7393 + parts,
30.7394 + // The jqXHR state
30.7395 + state = 0,
30.7396 + // To know if global events are to be dispatched
30.7397 + fireGlobals,
30.7398 + // Loop variable
30.7399 + i,
30.7400 + // Fake xhr
30.7401 + jqXHR = {
30.7402 +
30.7403 + readyState: 0,
30.7404 +
30.7405 + // Caches the header
30.7406 + setRequestHeader: function( name, value ) {
30.7407 + if ( !state ) {
30.7408 + var lname = name.toLowerCase();
30.7409 + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
30.7410 + requestHeaders[ name ] = value;
30.7411 + }
30.7412 + return this;
30.7413 + },
30.7414 +
30.7415 + // Raw string
30.7416 + getAllResponseHeaders: function() {
30.7417 + return state === 2 ? responseHeadersString : null;
30.7418 + },
30.7419 +
30.7420 + // Builds headers hashtable if needed
30.7421 + getResponseHeader: function( key ) {
30.7422 + var match;
30.7423 + if ( state === 2 ) {
30.7424 + if ( !responseHeaders ) {
30.7425 + responseHeaders = {};
30.7426 + while( ( match = rheaders.exec( responseHeadersString ) ) ) {
30.7427 + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
30.7428 + }
30.7429 + }
30.7430 + match = responseHeaders[ key.toLowerCase() ];
30.7431 + }
30.7432 + return match === undefined ? null : match;
30.7433 + },
30.7434 +
30.7435 + // Overrides response content-type header
30.7436 + overrideMimeType: function( type ) {
30.7437 + if ( !state ) {
30.7438 + s.mimeType = type;
30.7439 + }
30.7440 + return this;
30.7441 + },
30.7442 +
30.7443 + // Cancel the request
30.7444 + abort: function( statusText ) {
30.7445 + statusText = statusText || "abort";
30.7446 + if ( transport ) {
30.7447 + transport.abort( statusText );
30.7448 + }
30.7449 + done( 0, statusText );
30.7450 + return this;
30.7451 + }
30.7452 + };
30.7453 +
30.7454 + // Callback for when everything is done
30.7455 + // It is defined here because jslint complains if it is declared
30.7456 + // at the end of the function (which would be more logical and readable)
30.7457 + function done( status, nativeStatusText, responses, headers ) {
30.7458 +
30.7459 + // Called once
30.7460 + if ( state === 2 ) {
30.7461 + return;
30.7462 + }
30.7463 +
30.7464 + // State is "done" now
30.7465 + state = 2;
30.7466 +
30.7467 + // Clear timeout if it exists
30.7468 + if ( timeoutTimer ) {
30.7469 + clearTimeout( timeoutTimer );
30.7470 + }
30.7471 +
30.7472 + // Dereference transport for early garbage collection
30.7473 + // (no matter how long the jqXHR object will be used)
30.7474 + transport = undefined;
30.7475 +
30.7476 + // Cache response headers
30.7477 + responseHeadersString = headers || "";
30.7478 +
30.7479 + // Set readyState
30.7480 + jqXHR.readyState = status > 0 ? 4 : 0;
30.7481 +
30.7482 + var isSuccess,
30.7483 + success,
30.7484 + error,
30.7485 + statusText = nativeStatusText,
30.7486 + response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
30.7487 + lastModified,
30.7488 + etag;
30.7489 +
30.7490 + // If successful, handle type chaining
30.7491 + if ( status >= 200 && status < 300 || status === 304 ) {
30.7492 +
30.7493 + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
30.7494 + if ( s.ifModified ) {
30.7495 +
30.7496 + if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
30.7497 + jQuery.lastModified[ ifModifiedKey ] = lastModified;
30.7498 + }
30.7499 + if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
30.7500 + jQuery.etag[ ifModifiedKey ] = etag;
30.7501 + }
30.7502 + }
30.7503 +
30.7504 + // If not modified
30.7505 + if ( status === 304 ) {
30.7506 +
30.7507 + statusText = "notmodified";
30.7508 + isSuccess = true;
30.7509 +
30.7510 + // If we have data
30.7511 + } else {
30.7512 +
30.7513 + try {
30.7514 + success = ajaxConvert( s, response );
30.7515 + statusText = "success";
30.7516 + isSuccess = true;
30.7517 + } catch(e) {
30.7518 + // We have a parsererror
30.7519 + statusText = "parsererror";
30.7520 + error = e;
30.7521 + }
30.7522 + }
30.7523 + } else {
30.7524 + // We extract error from statusText
30.7525 + // then normalize statusText and status for non-aborts
30.7526 + error = statusText;
30.7527 + if ( !statusText || status ) {
30.7528 + statusText = "error";
30.7529 + if ( status < 0 ) {
30.7530 + status = 0;
30.7531 + }
30.7532 + }
30.7533 + }
30.7534 +
30.7535 + // Set data for the fake xhr object
30.7536 + jqXHR.status = status;
30.7537 + jqXHR.statusText = "" + ( nativeStatusText || statusText );
30.7538 +
30.7539 + // Success/Error
30.7540 + if ( isSuccess ) {
30.7541 + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
30.7542 + } else {
30.7543 + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
30.7544 + }
30.7545 +
30.7546 + // Status-dependent callbacks
30.7547 + jqXHR.statusCode( statusCode );
30.7548 + statusCode = undefined;
30.7549 +
30.7550 + if ( fireGlobals ) {
30.7551 + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
30.7552 + [ jqXHR, s, isSuccess ? success : error ] );
30.7553 + }
30.7554 +
30.7555 + // Complete
30.7556 + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
30.7557 +
30.7558 + if ( fireGlobals ) {
30.7559 + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
30.7560 + // Handle the global AJAX counter
30.7561 + if ( !( --jQuery.active ) ) {
30.7562 + jQuery.event.trigger( "ajaxStop" );
30.7563 + }
30.7564 + }
30.7565 + }
30.7566 +
30.7567 + // Attach deferreds
30.7568 + deferred.promise( jqXHR );
30.7569 + jqXHR.success = jqXHR.done;
30.7570 + jqXHR.error = jqXHR.fail;
30.7571 + jqXHR.complete = completeDeferred.add;
30.7572 +
30.7573 + // Status-dependent callbacks
30.7574 + jqXHR.statusCode = function( map ) {
30.7575 + if ( map ) {
30.7576 + var tmp;
30.7577 + if ( state < 2 ) {
30.7578 + for ( tmp in map ) {
30.7579 + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
30.7580 + }
30.7581 + } else {
30.7582 + tmp = map[ jqXHR.status ];
30.7583 + jqXHR.then( tmp, tmp );
30.7584 + }
30.7585 + }
30.7586 + return this;
30.7587 + };
30.7588 +
30.7589 + // Remove hash character (#7531: and string promotion)
30.7590 + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
30.7591 + // We also use the url parameter if available
30.7592 + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
30.7593 +
30.7594 + // Extract dataTypes list
30.7595 + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
30.7596 +
30.7597 + // Determine if a cross-domain request is in order
30.7598 + if ( s.crossDomain == null ) {
30.7599 + parts = rurl.exec( s.url.toLowerCase() );
30.7600 + s.crossDomain = !!( parts &&
30.7601 + ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
30.7602 + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
30.7603 + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
30.7604 + );
30.7605 + }
30.7606 +
30.7607 + // Convert data if not already a string
30.7608 + if ( s.data && s.processData && typeof s.data !== "string" ) {
30.7609 + s.data = jQuery.param( s.data, s.traditional );
30.7610 + }
30.7611 +
30.7612 + // Apply prefilters
30.7613 + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
30.7614 +
30.7615 + // If request was aborted inside a prefilter, stop there
30.7616 + if ( state === 2 ) {
30.7617 + return false;
30.7618 + }
30.7619 +
30.7620 + // We can fire global events as of now if asked to
30.7621 + fireGlobals = s.global;
30.7622 +
30.7623 + // Uppercase the type
30.7624 + s.type = s.type.toUpperCase();
30.7625 +
30.7626 + // Determine if request has content
30.7627 + s.hasContent = !rnoContent.test( s.type );
30.7628 +
30.7629 + // Watch for a new set of requests
30.7630 + if ( fireGlobals && jQuery.active++ === 0 ) {
30.7631 + jQuery.event.trigger( "ajaxStart" );
30.7632 + }
30.7633 +
30.7634 + // More options handling for requests with no content
30.7635 + if ( !s.hasContent ) {
30.7636 +
30.7637 + // If data is available, append data to url
30.7638 + if ( s.data ) {
30.7639 + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
30.7640 + // #9682: remove data so that it's not used in an eventual retry
30.7641 + delete s.data;
30.7642 + }
30.7643 +
30.7644 + // Get ifModifiedKey before adding the anti-cache parameter
30.7645 + ifModifiedKey = s.url;
30.7646 +
30.7647 + // Add anti-cache in url if needed
30.7648 + if ( s.cache === false ) {
30.7649 +
30.7650 + var ts = jQuery.now(),
30.7651 + // try replacing _= if it is there
30.7652 + ret = s.url.replace( rts, "$1_=" + ts );
30.7653 +
30.7654 + // if nothing was replaced, add timestamp to the end
30.7655 + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
30.7656 + }
30.7657 + }
30.7658 +
30.7659 + // Set the correct header, if data is being sent
30.7660 + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
30.7661 + jqXHR.setRequestHeader( "Content-Type", s.contentType );
30.7662 + }
30.7663 +
30.7664 + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
30.7665 + if ( s.ifModified ) {
30.7666 + ifModifiedKey = ifModifiedKey || s.url;
30.7667 + if ( jQuery.lastModified[ ifModifiedKey ] ) {
30.7668 + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
30.7669 + }
30.7670 + if ( jQuery.etag[ ifModifiedKey ] ) {
30.7671 + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
30.7672 + }
30.7673 + }
30.7674 +
30.7675 + // Set the Accepts header for the server, depending on the dataType
30.7676 + jqXHR.setRequestHeader(
30.7677 + "Accept",
30.7678 + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
30.7679 + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
30.7680 + s.accepts[ "*" ]
30.7681 + );
30.7682 +
30.7683 + // Check for headers option
30.7684 + for ( i in s.headers ) {
30.7685 + jqXHR.setRequestHeader( i, s.headers[ i ] );
30.7686 + }
30.7687 +
30.7688 + // Allow custom headers/mimetypes and early abort
30.7689 + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
30.7690 + // Abort if not done already
30.7691 + jqXHR.abort();
30.7692 + return false;
30.7693 +
30.7694 + }
30.7695 +
30.7696 + // Install callbacks on deferreds
30.7697 + for ( i in { success: 1, error: 1, complete: 1 } ) {
30.7698 + jqXHR[ i ]( s[ i ] );
30.7699 + }
30.7700 +
30.7701 + // Get transport
30.7702 + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
30.7703 +
30.7704 + // If no transport, we auto-abort
30.7705 + if ( !transport ) {
30.7706 + done( -1, "No Transport" );
30.7707 + } else {
30.7708 + jqXHR.readyState = 1;
30.7709 + // Send global event
30.7710 + if ( fireGlobals ) {
30.7711 + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
30.7712 + }
30.7713 + // Timeout
30.7714 + if ( s.async && s.timeout > 0 ) {
30.7715 + timeoutTimer = setTimeout( function(){
30.7716 + jqXHR.abort( "timeout" );
30.7717 + }, s.timeout );
30.7718 + }
30.7719 +
30.7720 + try {
30.7721 + state = 1;
30.7722 + transport.send( requestHeaders, done );
30.7723 + } catch (e) {
30.7724 + // Propagate exception as error if not done
30.7725 + if ( state < 2 ) {
30.7726 + done( -1, e );
30.7727 + // Simply rethrow otherwise
30.7728 + } else {
30.7729 + throw e;
30.7730 + }
30.7731 + }
30.7732 + }
30.7733 +
30.7734 + return jqXHR;
30.7735 + },
30.7736 +
30.7737 + // Serialize an array of form elements or a set of
30.7738 + // key/values into a query string
30.7739 + param: function( a, traditional ) {
30.7740 + var s = [],
30.7741 + add = function( key, value ) {
30.7742 + // If value is a function, invoke it and return its value
30.7743 + value = jQuery.isFunction( value ) ? value() : value;
30.7744 + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
30.7745 + };
30.7746 +
30.7747 + // Set traditional to true for jQuery <= 1.3.2 behavior.
30.7748 + if ( traditional === undefined ) {
30.7749 + traditional = jQuery.ajaxSettings.traditional;
30.7750 + }
30.7751 +
30.7752 + // If an array was passed in, assume that it is an array of form elements.
30.7753 + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
30.7754 + // Serialize the form elements
30.7755 + jQuery.each( a, function() {
30.7756 + add( this.name, this.value );
30.7757 + });
30.7758 +
30.7759 + } else {
30.7760 + // If traditional, encode the "old" way (the way 1.3.2 or older
30.7761 + // did it), otherwise encode params recursively.
30.7762 + for ( var prefix in a ) {
30.7763 + buildParams( prefix, a[ prefix ], traditional, add );
30.7764 + }
30.7765 + }
30.7766 +
30.7767 + // Return the resulting serialization
30.7768 + return s.join( "&" ).replace( r20, "+" );
30.7769 + }
30.7770 +});
30.7771 +
30.7772 +function buildParams( prefix, obj, traditional, add ) {
30.7773 + if ( jQuery.isArray( obj ) ) {
30.7774 + // Serialize array item.
30.7775 + jQuery.each( obj, function( i, v ) {
30.7776 + if ( traditional || rbracket.test( prefix ) ) {
30.7777 + // Treat each array item as a scalar.
30.7778 + add( prefix, v );
30.7779 +
30.7780 + } else {
30.7781 + // If array item is non-scalar (array or object), encode its
30.7782 + // numeric index to resolve deserialization ambiguity issues.
30.7783 + // Note that rack (as of 1.0.0) can't currently deserialize
30.7784 + // nested arrays properly, and attempting to do so may cause
30.7785 + // a server error. Possible fixes are to modify rack's
30.7786 + // deserialization algorithm or to provide an option or flag
30.7787 + // to force array serialization to be shallow.
30.7788 + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
30.7789 + }
30.7790 + });
30.7791 +
30.7792 + } else if ( !traditional && jQuery.type( obj ) === "object" ) {
30.7793 + // Serialize object item.
30.7794 + for ( var name in obj ) {
30.7795 + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
30.7796 + }
30.7797 +
30.7798 + } else {
30.7799 + // Serialize scalar item.
30.7800 + add( prefix, obj );
30.7801 + }
30.7802 +}
30.7803 +
30.7804 +// This is still on the jQuery object... for now
30.7805 +// Want to move this to jQuery.ajax some day
30.7806 +jQuery.extend({
30.7807 +
30.7808 + // Counter for holding the number of active queries
30.7809 + active: 0,
30.7810 +
30.7811 + // Last-Modified header cache for next request
30.7812 + lastModified: {},
30.7813 + etag: {}
30.7814 +
30.7815 +});
30.7816 +
30.7817 +/* Handles responses to an ajax request:
30.7818 + * - sets all responseXXX fields accordingly
30.7819 + * - finds the right dataType (mediates between content-type and expected dataType)
30.7820 + * - returns the corresponding response
30.7821 + */
30.7822 +function ajaxHandleResponses( s, jqXHR, responses ) {
30.7823 +
30.7824 + var contents = s.contents,
30.7825 + dataTypes = s.dataTypes,
30.7826 + responseFields = s.responseFields,
30.7827 + ct,
30.7828 + type,
30.7829 + finalDataType,
30.7830 + firstDataType;
30.7831 +
30.7832 + // Fill responseXXX fields
30.7833 + for ( type in responseFields ) {
30.7834 + if ( type in responses ) {
30.7835 + jqXHR[ responseFields[type] ] = responses[ type ];
30.7836 + }
30.7837 + }
30.7838 +
30.7839 + // Remove auto dataType and get content-type in the process
30.7840 + while( dataTypes[ 0 ] === "*" ) {
30.7841 + dataTypes.shift();
30.7842 + if ( ct === undefined ) {
30.7843 + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
30.7844 + }
30.7845 + }
30.7846 +
30.7847 + // Check if we're dealing with a known content-type
30.7848 + if ( ct ) {
30.7849 + for ( type in contents ) {
30.7850 + if ( contents[ type ] && contents[ type ].test( ct ) ) {
30.7851 + dataTypes.unshift( type );
30.7852 + break;
30.7853 + }
30.7854 + }
30.7855 + }
30.7856 +
30.7857 + // Check to see if we have a response for the expected dataType
30.7858 + if ( dataTypes[ 0 ] in responses ) {
30.7859 + finalDataType = dataTypes[ 0 ];
30.7860 + } else {
30.7861 + // Try convertible dataTypes
30.7862 + for ( type in responses ) {
30.7863 + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
30.7864 + finalDataType = type;
30.7865 + break;
30.7866 + }
30.7867 + if ( !firstDataType ) {
30.7868 + firstDataType = type;
30.7869 + }
30.7870 + }
30.7871 + // Or just use first one
30.7872 + finalDataType = finalDataType || firstDataType;
30.7873 + }
30.7874 +
30.7875 + // If we found a dataType
30.7876 + // We add the dataType to the list if needed
30.7877 + // and return the corresponding response
30.7878 + if ( finalDataType ) {
30.7879 + if ( finalDataType !== dataTypes[ 0 ] ) {
30.7880 + dataTypes.unshift( finalDataType );
30.7881 + }
30.7882 + return responses[ finalDataType ];
30.7883 + }
30.7884 +}
30.7885 +
30.7886 +// Chain conversions given the request and the original response
30.7887 +function ajaxConvert( s, response ) {
30.7888 +
30.7889 + // Apply the dataFilter if provided
30.7890 + if ( s.dataFilter ) {
30.7891 + response = s.dataFilter( response, s.dataType );
30.7892 + }
30.7893 +
30.7894 + var dataTypes = s.dataTypes,
30.7895 + converters = {},
30.7896 + i,
30.7897 + key,
30.7898 + length = dataTypes.length,
30.7899 + tmp,
30.7900 + // Current and previous dataTypes
30.7901 + current = dataTypes[ 0 ],
30.7902 + prev,
30.7903 + // Conversion expression
30.7904 + conversion,
30.7905 + // Conversion function
30.7906 + conv,
30.7907 + // Conversion functions (transitive conversion)
30.7908 + conv1,
30.7909 + conv2;
30.7910 +
30.7911 + // For each dataType in the chain
30.7912 + for ( i = 1; i < length; i++ ) {
30.7913 +
30.7914 + // Create converters map
30.7915 + // with lowercased keys
30.7916 + if ( i === 1 ) {
30.7917 + for ( key in s.converters ) {
30.7918 + if ( typeof key === "string" ) {
30.7919 + converters[ key.toLowerCase() ] = s.converters[ key ];
30.7920 + }
30.7921 + }
30.7922 + }
30.7923 +
30.7924 + // Get the dataTypes
30.7925 + prev = current;
30.7926 + current = dataTypes[ i ];
30.7927 +
30.7928 + // If current is auto dataType, update it to prev
30.7929 + if ( current === "*" ) {
30.7930 + current = prev;
30.7931 + // If no auto and dataTypes are actually different
30.7932 + } else if ( prev !== "*" && prev !== current ) {
30.7933 +
30.7934 + // Get the converter
30.7935 + conversion = prev + " " + current;
30.7936 + conv = converters[ conversion ] || converters[ "* " + current ];
30.7937 +
30.7938 + // If there is no direct converter, search transitively
30.7939 + if ( !conv ) {
30.7940 + conv2 = undefined;
30.7941 + for ( conv1 in converters ) {
30.7942 + tmp = conv1.split( " " );
30.7943 + if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
30.7944 + conv2 = converters[ tmp[1] + " " + current ];
30.7945 + if ( conv2 ) {
30.7946 + conv1 = converters[ conv1 ];
30.7947 + if ( conv1 === true ) {
30.7948 + conv = conv2;
30.7949 + } else if ( conv2 === true ) {
30.7950 + conv = conv1;
30.7951 + }
30.7952 + break;
30.7953 + }
30.7954 + }
30.7955 + }
30.7956 + }
30.7957 + // If we found no converter, dispatch an error
30.7958 + if ( !( conv || conv2 ) ) {
30.7959 + jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
30.7960 + }
30.7961 + // If found converter is not an equivalence
30.7962 + if ( conv !== true ) {
30.7963 + // Convert with 1 or 2 converters accordingly
30.7964 + response = conv ? conv( response ) : conv2( conv1(response) );
30.7965 + }
30.7966 + }
30.7967 + }
30.7968 + return response;
30.7969 +}
30.7970 +
30.7971 +
30.7972 +
30.7973 +
30.7974 +var jsc = jQuery.now(),
30.7975 + jsre = /(\=)\?(&|$)|\?\?/i;
30.7976 +
30.7977 +// Default jsonp settings
30.7978 +jQuery.ajaxSetup({
30.7979 + jsonp: "callback",
30.7980 + jsonpCallback: function() {
30.7981 + return jQuery.expando + "_" + ( jsc++ );
30.7982 + }
30.7983 +});
30.7984 +
30.7985 +// Detect, normalize options and install callbacks for jsonp requests
30.7986 +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
30.7987 +
30.7988 + var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
30.7989 +
30.7990 + if ( s.dataTypes[ 0 ] === "jsonp" ||
30.7991 + s.jsonp !== false && ( jsre.test( s.url ) ||
30.7992 + inspectData && jsre.test( s.data ) ) ) {
30.7993 +
30.7994 + var responseContainer,
30.7995 + jsonpCallback = s.jsonpCallback =
30.7996 + jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
30.7997 + previous = window[ jsonpCallback ],
30.7998 + url = s.url,
30.7999 + data = s.data,
30.8000 + replace = "$1" + jsonpCallback + "$2";
30.8001 +
30.8002 + if ( s.jsonp !== false ) {
30.8003 + url = url.replace( jsre, replace );
30.8004 + if ( s.url === url ) {
30.8005 + if ( inspectData ) {
30.8006 + data = data.replace( jsre, replace );
30.8007 + }
30.8008 + if ( s.data === data ) {
30.8009 + // Add callback manually
30.8010 + url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
30.8011 + }
30.8012 + }
30.8013 + }
30.8014 +
30.8015 + s.url = url;
30.8016 + s.data = data;
30.8017 +
30.8018 + // Install callback
30.8019 + window[ jsonpCallback ] = function( response ) {
30.8020 + responseContainer = [ response ];
30.8021 + };
30.8022 +
30.8023 + // Clean-up function
30.8024 + jqXHR.always(function() {
30.8025 + // Set callback back to previous value
30.8026 + window[ jsonpCallback ] = previous;
30.8027 + // Call if it was a function and we have a response
30.8028 + if ( responseContainer && jQuery.isFunction( previous ) ) {
30.8029 + window[ jsonpCallback ]( responseContainer[ 0 ] );
30.8030 + }
30.8031 + });
30.8032 +
30.8033 + // Use data converter to retrieve json after script execution
30.8034 + s.converters["script json"] = function() {
30.8035 + if ( !responseContainer ) {
30.8036 + jQuery.error( jsonpCallback + " was not called" );
30.8037 + }
30.8038 + return responseContainer[ 0 ];
30.8039 + };
30.8040 +
30.8041 + // force json dataType
30.8042 + s.dataTypes[ 0 ] = "json";
30.8043 +
30.8044 + // Delegate to script
30.8045 + return "script";
30.8046 + }
30.8047 +});
30.8048 +
30.8049 +
30.8050 +
30.8051 +
30.8052 +// Install script dataType
30.8053 +jQuery.ajaxSetup({
30.8054 + accepts: {
30.8055 + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
30.8056 + },
30.8057 + contents: {
30.8058 + script: /javascript|ecmascript/
30.8059 + },
30.8060 + converters: {
30.8061 + "text script": function( text ) {
30.8062 + jQuery.globalEval( text );
30.8063 + return text;
30.8064 + }
30.8065 + }
30.8066 +});
30.8067 +
30.8068 +// Handle cache's special case and global
30.8069 +jQuery.ajaxPrefilter( "script", function( s ) {
30.8070 + if ( s.cache === undefined ) {
30.8071 + s.cache = false;
30.8072 + }
30.8073 + if ( s.crossDomain ) {
30.8074 + s.type = "GET";
30.8075 + s.global = false;
30.8076 + }
30.8077 +});
30.8078 +
30.8079 +// Bind script tag hack transport
30.8080 +jQuery.ajaxTransport( "script", function(s) {
30.8081 +
30.8082 + // This transport only deals with cross domain requests
30.8083 + if ( s.crossDomain ) {
30.8084 +
30.8085 + var script,
30.8086 + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
30.8087 +
30.8088 + return {
30.8089 +
30.8090 + send: function( _, callback ) {
30.8091 +
30.8092 + script = document.createElement( "script" );
30.8093 +
30.8094 + script.async = "async";
30.8095 +
30.8096 + if ( s.scriptCharset ) {
30.8097 + script.charset = s.scriptCharset;
30.8098 + }
30.8099 +
30.8100 + script.src = s.url;
30.8101 +
30.8102 + // Attach handlers for all browsers
30.8103 + script.onload = script.onreadystatechange = function( _, isAbort ) {
30.8104 +
30.8105 + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
30.8106 +
30.8107 + // Handle memory leak in IE
30.8108 + script.onload = script.onreadystatechange = null;
30.8109 +
30.8110 + // Remove the script
30.8111 + if ( head && script.parentNode ) {
30.8112 + head.removeChild( script );
30.8113 + }
30.8114 +
30.8115 + // Dereference the script
30.8116 + script = undefined;
30.8117 +
30.8118 + // Callback if not abort
30.8119 + if ( !isAbort ) {
30.8120 + callback( 200, "success" );
30.8121 + }
30.8122 + }
30.8123 + };
30.8124 + // Use insertBefore instead of appendChild to circumvent an IE6 bug.
30.8125 + // This arises when a base node is used (#2709 and #4378).
30.8126 + head.insertBefore( script, head.firstChild );
30.8127 + },
30.8128 +
30.8129 + abort: function() {
30.8130 + if ( script ) {
30.8131 + script.onload( 0, 1 );
30.8132 + }
30.8133 + }
30.8134 + };
30.8135 + }
30.8136 +});
30.8137 +
30.8138 +
30.8139 +
30.8140 +
30.8141 +var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
30.8142 + xhrOnUnloadAbort = window.ActiveXObject ? function() {
30.8143 + // Abort all pending requests
30.8144 + for ( var key in xhrCallbacks ) {
30.8145 + xhrCallbacks[ key ]( 0, 1 );
30.8146 + }
30.8147 + } : false,
30.8148 + xhrId = 0,
30.8149 + xhrCallbacks;
30.8150 +
30.8151 +// Functions to create xhrs
30.8152 +function createStandardXHR() {
30.8153 + try {
30.8154 + return new window.XMLHttpRequest();
30.8155 + } catch( e ) {}
30.8156 +}
30.8157 +
30.8158 +function createActiveXHR() {
30.8159 + try {
30.8160 + return new window.ActiveXObject( "Microsoft.XMLHTTP" );
30.8161 + } catch( e ) {}
30.8162 +}
30.8163 +
30.8164 +// Create the request object
30.8165 +// (This is still attached to ajaxSettings for backward compatibility)
30.8166 +jQuery.ajaxSettings.xhr = window.ActiveXObject ?
30.8167 + /* Microsoft failed to properly
30.8168 + * implement the XMLHttpRequest in IE7 (can't request local files),
30.8169 + * so we use the ActiveXObject when it is available
30.8170 + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
30.8171 + * we need a fallback.
30.8172 + */
30.8173 + function() {
30.8174 + return !this.isLocal && createStandardXHR() || createActiveXHR();
30.8175 + } :
30.8176 + // For all other browsers, use the standard XMLHttpRequest object
30.8177 + createStandardXHR;
30.8178 +
30.8179 +// Determine support properties
30.8180 +(function( xhr ) {
30.8181 + jQuery.extend( jQuery.support, {
30.8182 + ajax: !!xhr,
30.8183 + cors: !!xhr && ( "withCredentials" in xhr )
30.8184 + });
30.8185 +})( jQuery.ajaxSettings.xhr() );
30.8186 +
30.8187 +// Create transport if the browser can provide an xhr
30.8188 +if ( jQuery.support.ajax ) {
30.8189 +
30.8190 + jQuery.ajaxTransport(function( s ) {
30.8191 + // Cross domain only allowed if supported through XMLHttpRequest
30.8192 + if ( !s.crossDomain || jQuery.support.cors ) {
30.8193 +
30.8194 + var callback;
30.8195 +
30.8196 + return {
30.8197 + send: function( headers, complete ) {
30.8198 +
30.8199 + // Get a new xhr
30.8200 + var xhr = s.xhr(),
30.8201 + handle,
30.8202 + i;
30.8203 +
30.8204 + // Open the socket
30.8205 + // Passing null username, generates a login popup on Opera (#2865)
30.8206 + if ( s.username ) {
30.8207 + xhr.open( s.type, s.url, s.async, s.username, s.password );
30.8208 + } else {
30.8209 + xhr.open( s.type, s.url, s.async );
30.8210 + }
30.8211 +
30.8212 + // Apply custom fields if provided
30.8213 + if ( s.xhrFields ) {
30.8214 + for ( i in s.xhrFields ) {
30.8215 + xhr[ i ] = s.xhrFields[ i ];
30.8216 + }
30.8217 + }
30.8218 +
30.8219 + // Override mime type if needed
30.8220 + if ( s.mimeType && xhr.overrideMimeType ) {
30.8221 + xhr.overrideMimeType( s.mimeType );
30.8222 + }
30.8223 +
30.8224 + // X-Requested-With header
30.8225 + // For cross-domain requests, seeing as conditions for a preflight are
30.8226 + // akin to a jigsaw puzzle, we simply never set it to be sure.
30.8227 + // (it can always be set on a per-request basis or even using ajaxSetup)
30.8228 + // For same-domain requests, won't change header if already provided.
30.8229 + if ( !s.crossDomain && !headers["X-Requested-With"] ) {
30.8230 + headers[ "X-Requested-With" ] = "XMLHttpRequest";
30.8231 + }
30.8232 +
30.8233 + // Need an extra try/catch for cross domain requests in Firefox 3
30.8234 + try {
30.8235 + for ( i in headers ) {
30.8236 + xhr.setRequestHeader( i, headers[ i ] );
30.8237 + }
30.8238 + } catch( _ ) {}
30.8239 +
30.8240 + // Do send the request
30.8241 + // This may raise an exception which is actually
30.8242 + // handled in jQuery.ajax (so no try/catch here)
30.8243 + xhr.send( ( s.hasContent && s.data ) || null );
30.8244 +
30.8245 + // Listener
30.8246 + callback = function( _, isAbort ) {
30.8247 +
30.8248 + var status,
30.8249 + statusText,
30.8250 + responseHeaders,
30.8251 + responses,
30.8252 + xml;
30.8253 +
30.8254 + // Firefox throws exceptions when accessing properties
30.8255 + // of an xhr when a network error occured
30.8256 + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
30.8257 + try {
30.8258 +
30.8259 + // Was never called and is aborted or complete
30.8260 + if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
30.8261 +
30.8262 + // Only called once
30.8263 + callback = undefined;
30.8264 +
30.8265 + // Do not keep as active anymore
30.8266 + if ( handle ) {
30.8267 + xhr.onreadystatechange = jQuery.noop;
30.8268 + if ( xhrOnUnloadAbort ) {
30.8269 + delete xhrCallbacks[ handle ];
30.8270 + }
30.8271 + }
30.8272 +
30.8273 + // If it's an abort
30.8274 + if ( isAbort ) {
30.8275 + // Abort it manually if needed
30.8276 + if ( xhr.readyState !== 4 ) {
30.8277 + xhr.abort();
30.8278 + }
30.8279 + } else {
30.8280 + status = xhr.status;
30.8281 + responseHeaders = xhr.getAllResponseHeaders();
30.8282 + responses = {};
30.8283 + xml = xhr.responseXML;
30.8284 +
30.8285 + // Construct response list
30.8286 + if ( xml && xml.documentElement /* #4958 */ ) {
30.8287 + responses.xml = xml;
30.8288 + }
30.8289 +
30.8290 + // When requesting binary data, IE6-9 will throw an exception
30.8291 + // on any attempt to access responseText (#11426)
30.8292 + try {
30.8293 + responses.text = xhr.responseText;
30.8294 + } catch( _ ) {
30.8295 + }
30.8296 +
30.8297 + // Firefox throws an exception when accessing
30.8298 + // statusText for faulty cross-domain requests
30.8299 + try {
30.8300 + statusText = xhr.statusText;
30.8301 + } catch( e ) {
30.8302 + // We normalize with Webkit giving an empty statusText
30.8303 + statusText = "";
30.8304 + }
30.8305 +
30.8306 + // Filter status for non standard behaviors
30.8307 +
30.8308 + // If the request is local and we have data: assume a success
30.8309 + // (success with no data won't get notified, that's the best we
30.8310 + // can do given current implementations)
30.8311 + if ( !status && s.isLocal && !s.crossDomain ) {
30.8312 + status = responses.text ? 200 : 404;
30.8313 + // IE - #1450: sometimes returns 1223 when it should be 204
30.8314 + } else if ( status === 1223 ) {
30.8315 + status = 204;
30.8316 + }
30.8317 + }
30.8318 + }
30.8319 + } catch( firefoxAccessException ) {
30.8320 + if ( !isAbort ) {
30.8321 + complete( -1, firefoxAccessException );
30.8322 + }
30.8323 + }
30.8324 +
30.8325 + // Call complete if needed
30.8326 + if ( responses ) {
30.8327 + complete( status, statusText, responses, responseHeaders );
30.8328 + }
30.8329 + };
30.8330 +
30.8331 + // if we're in sync mode or it's in cache
30.8332 + // and has been retrieved directly (IE6 & IE7)
30.8333 + // we need to manually fire the callback
30.8334 + if ( !s.async || xhr.readyState === 4 ) {
30.8335 + callback();
30.8336 + } else {
30.8337 + handle = ++xhrId;
30.8338 + if ( xhrOnUnloadAbort ) {
30.8339 + // Create the active xhrs callbacks list if needed
30.8340 + // and attach the unload handler
30.8341 + if ( !xhrCallbacks ) {
30.8342 + xhrCallbacks = {};
30.8343 + jQuery( window ).unload( xhrOnUnloadAbort );
30.8344 + }
30.8345 + // Add to list of active xhrs callbacks
30.8346 + xhrCallbacks[ handle ] = callback;
30.8347 + }
30.8348 + xhr.onreadystatechange = callback;
30.8349 + }
30.8350 + },
30.8351 +
30.8352 + abort: function() {
30.8353 + if ( callback ) {
30.8354 + callback(0,1);
30.8355 + }
30.8356 + }
30.8357 + };
30.8358 + }
30.8359 + });
30.8360 +}
30.8361 +
30.8362 +
30.8363 +
30.8364 +
30.8365 +var elemdisplay = {},
30.8366 + iframe, iframeDoc,
30.8367 + rfxtypes = /^(?:toggle|show|hide)$/,
30.8368 + rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
30.8369 + timerId,
30.8370 + fxAttrs = [
30.8371 + // height animations
30.8372 + [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
30.8373 + // width animations
30.8374 + [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
30.8375 + // opacity animations
30.8376 + [ "opacity" ]
30.8377 + ],
30.8378 + fxNow;
30.8379 +
30.8380 +jQuery.fn.extend({
30.8381 + show: function( speed, easing, callback ) {
30.8382 + var elem, display;
30.8383 +
30.8384 + if ( speed || speed === 0 ) {
30.8385 + return this.animate( genFx("show", 3), speed, easing, callback );
30.8386 +
30.8387 + } else {
30.8388 + for ( var i = 0, j = this.length; i < j; i++ ) {
30.8389 + elem = this[ i ];
30.8390 +
30.8391 + if ( elem.style ) {
30.8392 + display = elem.style.display;
30.8393 +
30.8394 + // Reset the inline display of this element to learn if it is
30.8395 + // being hidden by cascaded rules or not
30.8396 + if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
30.8397 + display = elem.style.display = "";
30.8398 + }
30.8399 +
30.8400 + // Set elements which have been overridden with display: none
30.8401 + // in a stylesheet to whatever the default browser style is
30.8402 + // for such an element
30.8403 + if ( (display === "" && jQuery.css(elem, "display") === "none") ||
30.8404 + !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
30.8405 + jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
30.8406 + }
30.8407 + }
30.8408 + }
30.8409 +
30.8410 + // Set the display of most of the elements in a second loop
30.8411 + // to avoid the constant reflow
30.8412 + for ( i = 0; i < j; i++ ) {
30.8413 + elem = this[ i ];
30.8414 +
30.8415 + if ( elem.style ) {
30.8416 + display = elem.style.display;
30.8417 +
30.8418 + if ( display === "" || display === "none" ) {
30.8419 + elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
30.8420 + }
30.8421 + }
30.8422 + }
30.8423 +
30.8424 + return this;
30.8425 + }
30.8426 + },
30.8427 +
30.8428 + hide: function( speed, easing, callback ) {
30.8429 + if ( speed || speed === 0 ) {
30.8430 + return this.animate( genFx("hide", 3), speed, easing, callback);
30.8431 +
30.8432 + } else {
30.8433 + var elem, display,
30.8434 + i = 0,
30.8435 + j = this.length;
30.8436 +
30.8437 + for ( ; i < j; i++ ) {
30.8438 + elem = this[i];
30.8439 + if ( elem.style ) {
30.8440 + display = jQuery.css( elem, "display" );
30.8441 +
30.8442 + if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
30.8443 + jQuery._data( elem, "olddisplay", display );
30.8444 + }
30.8445 + }
30.8446 + }
30.8447 +
30.8448 + // Set the display of the elements in a second loop
30.8449 + // to avoid the constant reflow
30.8450 + for ( i = 0; i < j; i++ ) {
30.8451 + if ( this[i].style ) {
30.8452 + this[i].style.display = "none";
30.8453 + }
30.8454 + }
30.8455 +
30.8456 + return this;
30.8457 + }
30.8458 + },
30.8459 +
30.8460 + // Save the old toggle function
30.8461 + _toggle: jQuery.fn.toggle,
30.8462 +
30.8463 + toggle: function( fn, fn2, callback ) {
30.8464 + var bool = typeof fn === "boolean";
30.8465 +
30.8466 + if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
30.8467 + this._toggle.apply( this, arguments );
30.8468 +
30.8469 + } else if ( fn == null || bool ) {
30.8470 + this.each(function() {
30.8471 + var state = bool ? fn : jQuery(this).is(":hidden");
30.8472 + jQuery(this)[ state ? "show" : "hide" ]();
30.8473 + });
30.8474 +
30.8475 + } else {
30.8476 + this.animate(genFx("toggle", 3), fn, fn2, callback);
30.8477 + }
30.8478 +
30.8479 + return this;
30.8480 + },
30.8481 +
30.8482 + fadeTo: function( speed, to, easing, callback ) {
30.8483 + return this.filter(":hidden").css("opacity", 0).show().end()
30.8484 + .animate({opacity: to}, speed, easing, callback);
30.8485 + },
30.8486 +
30.8487 + animate: function( prop, speed, easing, callback ) {
30.8488 + var optall = jQuery.speed( speed, easing, callback );
30.8489 +
30.8490 + if ( jQuery.isEmptyObject( prop ) ) {
30.8491 + return this.each( optall.complete, [ false ] );
30.8492 + }
30.8493 +
30.8494 + // Do not change referenced properties as per-property easing will be lost
30.8495 + prop = jQuery.extend( {}, prop );
30.8496 +
30.8497 + function doAnimation() {
30.8498 + // XXX 'this' does not always have a nodeName when running the
30.8499 + // test suite
30.8500 +
30.8501 + if ( optall.queue === false ) {
30.8502 + jQuery._mark( this );
30.8503 + }
30.8504 +
30.8505 + var opt = jQuery.extend( {}, optall ),
30.8506 + isElement = this.nodeType === 1,
30.8507 + hidden = isElement && jQuery(this).is(":hidden"),
30.8508 + name, val, p, e, hooks, replace,
30.8509 + parts, start, end, unit,
30.8510 + method;
30.8511 +
30.8512 + // will store per property easing and be used to determine when an animation is complete
30.8513 + opt.animatedProperties = {};
30.8514 +
30.8515 + // first pass over propertys to expand / normalize
30.8516 + for ( p in prop ) {
30.8517 + name = jQuery.camelCase( p );
30.8518 + if ( p !== name ) {
30.8519 + prop[ name ] = prop[ p ];
30.8520 + delete prop[ p ];
30.8521 + }
30.8522 +
30.8523 + if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
30.8524 + replace = hooks.expand( prop[ name ] );
30.8525 + delete prop[ name ];
30.8526 +
30.8527 + // not quite $.extend, this wont overwrite keys already present.
30.8528 + // also - reusing 'p' from above because we have the correct "name"
30.8529 + for ( p in replace ) {
30.8530 + if ( ! ( p in prop ) ) {
30.8531 + prop[ p ] = replace[ p ];
30.8532 + }
30.8533 + }
30.8534 + }
30.8535 + }
30.8536 +
30.8537 + for ( name in prop ) {
30.8538 + val = prop[ name ];
30.8539 + // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
30.8540 + if ( jQuery.isArray( val ) ) {
30.8541 + opt.animatedProperties[ name ] = val[ 1 ];
30.8542 + val = prop[ name ] = val[ 0 ];
30.8543 + } else {
30.8544 + opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
30.8545 + }
30.8546 +
30.8547 + if ( val === "hide" && hidden || val === "show" && !hidden ) {
30.8548 + return opt.complete.call( this );
30.8549 + }
30.8550 +
30.8551 + if ( isElement && ( name === "height" || name === "width" ) ) {
30.8552 + // Make sure that nothing sneaks out
30.8553 + // Record all 3 overflow attributes because IE does not
30.8554 + // change the overflow attribute when overflowX and
30.8555 + // overflowY are set to the same value
30.8556 + opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
30.8557 +
30.8558 + // Set display property to inline-block for height/width
30.8559 + // animations on inline elements that are having width/height animated
30.8560 + if ( jQuery.css( this, "display" ) === "inline" &&
30.8561 + jQuery.css( this, "float" ) === "none" ) {
30.8562 +
30.8563 + // inline-level elements accept inline-block;
30.8564 + // block-level elements need to be inline with layout
30.8565 + if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
30.8566 + this.style.display = "inline-block";
30.8567 +
30.8568 + } else {
30.8569 + this.style.zoom = 1;
30.8570 + }
30.8571 + }
30.8572 + }
30.8573 + }
30.8574 +
30.8575 + if ( opt.overflow != null ) {
30.8576 + this.style.overflow = "hidden";
30.8577 + }
30.8578 +
30.8579 + for ( p in prop ) {
30.8580 + e = new jQuery.fx( this, opt, p );
30.8581 + val = prop[ p ];
30.8582 +
30.8583 + if ( rfxtypes.test( val ) ) {
30.8584 +
30.8585 + // Tracks whether to show or hide based on private
30.8586 + // data attached to the element
30.8587 + method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
30.8588 + if ( method ) {
30.8589 + jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
30.8590 + e[ method ]();
30.8591 + } else {
30.8592 + e[ val ]();
30.8593 + }
30.8594 +
30.8595 + } else {
30.8596 + parts = rfxnum.exec( val );
30.8597 + start = e.cur();
30.8598 +
30.8599 + if ( parts ) {
30.8600 + end = parseFloat( parts[2] );
30.8601 + unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
30.8602 +
30.8603 + // We need to compute starting value
30.8604 + if ( unit !== "px" ) {
30.8605 + jQuery.style( this, p, (end || 1) + unit);
30.8606 + start = ( (end || 1) / e.cur() ) * start;
30.8607 + jQuery.style( this, p, start + unit);
30.8608 + }
30.8609 +
30.8610 + // If a +=/-= token was provided, we're doing a relative animation
30.8611 + if ( parts[1] ) {
30.8612 + end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
30.8613 + }
30.8614 +
30.8615 + e.custom( start, end, unit );
30.8616 +
30.8617 + } else {
30.8618 + e.custom( start, val, "" );
30.8619 + }
30.8620 + }
30.8621 + }
30.8622 +
30.8623 + // For JS strict compliance
30.8624 + return true;
30.8625 + }
30.8626 +
30.8627 + return optall.queue === false ?
30.8628 + this.each( doAnimation ) :
30.8629 + this.queue( optall.queue, doAnimation );
30.8630 + },
30.8631 +
30.8632 + stop: function( type, clearQueue, gotoEnd ) {
30.8633 + if ( typeof type !== "string" ) {
30.8634 + gotoEnd = clearQueue;
30.8635 + clearQueue = type;
30.8636 + type = undefined;
30.8637 + }
30.8638 + if ( clearQueue && type !== false ) {
30.8639 + this.queue( type || "fx", [] );
30.8640 + }
30.8641 +
30.8642 + return this.each(function() {
30.8643 + var index,
30.8644 + hadTimers = false,
30.8645 + timers = jQuery.timers,
30.8646 + data = jQuery._data( this );
30.8647 +
30.8648 + // clear marker counters if we know they won't be
30.8649 + if ( !gotoEnd ) {
30.8650 + jQuery._unmark( true, this );
30.8651 + }
30.8652 +
30.8653 + function stopQueue( elem, data, index ) {
30.8654 + var hooks = data[ index ];
30.8655 + jQuery.removeData( elem, index, true );
30.8656 + hooks.stop( gotoEnd );
30.8657 + }
30.8658 +
30.8659 + if ( type == null ) {
30.8660 + for ( index in data ) {
30.8661 + if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
30.8662 + stopQueue( this, data, index );
30.8663 + }
30.8664 + }
30.8665 + } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
30.8666 + stopQueue( this, data, index );
30.8667 + }
30.8668 +
30.8669 + for ( index = timers.length; index--; ) {
30.8670 + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
30.8671 + if ( gotoEnd ) {
30.8672 +
30.8673 + // force the next step to be the last
30.8674 + timers[ index ]( true );
30.8675 + } else {
30.8676 + timers[ index ].saveState();
30.8677 + }
30.8678 + hadTimers = true;
30.8679 + timers.splice( index, 1 );
30.8680 + }
30.8681 + }
30.8682 +
30.8683 + // start the next in the queue if the last step wasn't forced
30.8684 + // timers currently will call their complete callbacks, which will dequeue
30.8685 + // but only if they were gotoEnd
30.8686 + if ( !( gotoEnd && hadTimers ) ) {
30.8687 + jQuery.dequeue( this, type );
30.8688 + }
30.8689 + });
30.8690 + }
30.8691 +
30.8692 +});
30.8693 +
30.8694 +// Animations created synchronously will run synchronously
30.8695 +function createFxNow() {
30.8696 + setTimeout( clearFxNow, 0 );
30.8697 + return ( fxNow = jQuery.now() );
30.8698 +}
30.8699 +
30.8700 +function clearFxNow() {
30.8701 + fxNow = undefined;
30.8702 +}
30.8703 +
30.8704 +// Generate parameters to create a standard animation
30.8705 +function genFx( type, num ) {
30.8706 + var obj = {};
30.8707 +
30.8708 + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
30.8709 + obj[ this ] = type;
30.8710 + });
30.8711 +
30.8712 + return obj;
30.8713 +}
30.8714 +
30.8715 +// Generate shortcuts for custom animations
30.8716 +jQuery.each({
30.8717 + slideDown: genFx( "show", 1 ),
30.8718 + slideUp: genFx( "hide", 1 ),
30.8719 + slideToggle: genFx( "toggle", 1 ),
30.8720 + fadeIn: { opacity: "show" },
30.8721 + fadeOut: { opacity: "hide" },
30.8722 + fadeToggle: { opacity: "toggle" }
30.8723 +}, function( name, props ) {
30.8724 + jQuery.fn[ name ] = function( speed, easing, callback ) {
30.8725 + return this.animate( props, speed, easing, callback );
30.8726 + };
30.8727 +});
30.8728 +
30.8729 +jQuery.extend({
30.8730 + speed: function( speed, easing, fn ) {
30.8731 + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
30.8732 + complete: fn || !fn && easing ||
30.8733 + jQuery.isFunction( speed ) && speed,
30.8734 + duration: speed,
30.8735 + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
30.8736 + };
30.8737 +
30.8738 + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
30.8739 + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
30.8740 +
30.8741 + // normalize opt.queue - true/undefined/null -> "fx"
30.8742 + if ( opt.queue == null || opt.queue === true ) {
30.8743 + opt.queue = "fx";
30.8744 + }
30.8745 +
30.8746 + // Queueing
30.8747 + opt.old = opt.complete;
30.8748 +
30.8749 + opt.complete = function( noUnmark ) {
30.8750 + if ( jQuery.isFunction( opt.old ) ) {
30.8751 + opt.old.call( this );
30.8752 + }
30.8753 +
30.8754 + if ( opt.queue ) {
30.8755 + jQuery.dequeue( this, opt.queue );
30.8756 + } else if ( noUnmark !== false ) {
30.8757 + jQuery._unmark( this );
30.8758 + }
30.8759 + };
30.8760 +
30.8761 + return opt;
30.8762 + },
30.8763 +
30.8764 + easing: {
30.8765 + linear: function( p ) {
30.8766 + return p;
30.8767 + },
30.8768 + swing: function( p ) {
30.8769 + return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
30.8770 + }
30.8771 + },
30.8772 +
30.8773 + timers: [],
30.8774 +
30.8775 + fx: function( elem, options, prop ) {
30.8776 + this.options = options;
30.8777 + this.elem = elem;
30.8778 + this.prop = prop;
30.8779 +
30.8780 + options.orig = options.orig || {};
30.8781 + }
30.8782 +
30.8783 +});
30.8784 +
30.8785 +jQuery.fx.prototype = {
30.8786 + // Simple function for setting a style value
30.8787 + update: function() {
30.8788 + if ( this.options.step ) {
30.8789 + this.options.step.call( this.elem, this.now, this );
30.8790 + }
30.8791 +
30.8792 + ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
30.8793 + },
30.8794 +
30.8795 + // Get the current size
30.8796 + cur: function() {
30.8797 + if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
30.8798 + return this.elem[ this.prop ];
30.8799 + }
30.8800 +
30.8801 + var parsed,
30.8802 + r = jQuery.css( this.elem, this.prop );
30.8803 + // Empty strings, null, undefined and "auto" are converted to 0,
30.8804 + // complex values such as "rotate(1rad)" are returned as is,
30.8805 + // simple values such as "10px" are parsed to Float.
30.8806 + return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
30.8807 + },
30.8808 +
30.8809 + // Start an animation from one number to another
30.8810 + custom: function( from, to, unit ) {
30.8811 + var self = this,
30.8812 + fx = jQuery.fx;
30.8813 +
30.8814 + this.startTime = fxNow || createFxNow();
30.8815 + this.end = to;
30.8816 + this.now = this.start = from;
30.8817 + this.pos = this.state = 0;
30.8818 + this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
30.8819 +
30.8820 + function t( gotoEnd ) {
30.8821 + return self.step( gotoEnd );
30.8822 + }
30.8823 +
30.8824 + t.queue = this.options.queue;
30.8825 + t.elem = this.elem;
30.8826 + t.saveState = function() {
30.8827 + if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
30.8828 + if ( self.options.hide ) {
30.8829 + jQuery._data( self.elem, "fxshow" + self.prop, self.start );
30.8830 + } else if ( self.options.show ) {
30.8831 + jQuery._data( self.elem, "fxshow" + self.prop, self.end );
30.8832 + }
30.8833 + }
30.8834 + };
30.8835 +
30.8836 + if ( t() && jQuery.timers.push(t) && !timerId ) {
30.8837 + timerId = setInterval( fx.tick, fx.interval );
30.8838 + }
30.8839 + },
30.8840 +
30.8841 + // Simple 'show' function
30.8842 + show: function() {
30.8843 + var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
30.8844 +
30.8845 + // Remember where we started, so that we can go back to it later
30.8846 + this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
30.8847 + this.options.show = true;
30.8848 +
30.8849 + // Begin the animation
30.8850 + // Make sure that we start at a small width/height to avoid any flash of content
30.8851 + if ( dataShow !== undefined ) {
30.8852 + // This show is picking up where a previous hide or show left off
30.8853 + this.custom( this.cur(), dataShow );
30.8854 + } else {
30.8855 + this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
30.8856 + }
30.8857 +
30.8858 + // Start by showing the element
30.8859 + jQuery( this.elem ).show();
30.8860 + },
30.8861 +
30.8862 + // Simple 'hide' function
30.8863 + hide: function() {
30.8864 + // Remember where we started, so that we can go back to it later
30.8865 + this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
30.8866 + this.options.hide = true;
30.8867 +
30.8868 + // Begin the animation
30.8869 + this.custom( this.cur(), 0 );
30.8870 + },
30.8871 +
30.8872 + // Each step of an animation
30.8873 + step: function( gotoEnd ) {
30.8874 + var p, n, complete,
30.8875 + t = fxNow || createFxNow(),
30.8876 + done = true,
30.8877 + elem = this.elem,
30.8878 + options = this.options;
30.8879 +
30.8880 + if ( gotoEnd || t >= options.duration + this.startTime ) {
30.8881 + this.now = this.end;
30.8882 + this.pos = this.state = 1;
30.8883 + this.update();
30.8884 +
30.8885 + options.animatedProperties[ this.prop ] = true;
30.8886 +
30.8887 + for ( p in options.animatedProperties ) {
30.8888 + if ( options.animatedProperties[ p ] !== true ) {
30.8889 + done = false;
30.8890 + }
30.8891 + }
30.8892 +
30.8893 + if ( done ) {
30.8894 + // Reset the overflow
30.8895 + if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
30.8896 +
30.8897 + jQuery.each( [ "", "X", "Y" ], function( index, value ) {
30.8898 + elem.style[ "overflow" + value ] = options.overflow[ index ];
30.8899 + });
30.8900 + }
30.8901 +
30.8902 + // Hide the element if the "hide" operation was done
30.8903 + if ( options.hide ) {
30.8904 + jQuery( elem ).hide();
30.8905 + }
30.8906 +
30.8907 + // Reset the properties, if the item has been hidden or shown
30.8908 + if ( options.hide || options.show ) {
30.8909 + for ( p in options.animatedProperties ) {
30.8910 + jQuery.style( elem, p, options.orig[ p ] );
30.8911 + jQuery.removeData( elem, "fxshow" + p, true );
30.8912 + // Toggle data is no longer needed
30.8913 + jQuery.removeData( elem, "toggle" + p, true );
30.8914 + }
30.8915 + }
30.8916 +
30.8917 + // Execute the complete function
30.8918 + // in the event that the complete function throws an exception
30.8919 + // we must ensure it won't be called twice. #5684
30.8920 +
30.8921 + complete = options.complete;
30.8922 + if ( complete ) {
30.8923 +
30.8924 + options.complete = false;
30.8925 + complete.call( elem );
30.8926 + }
30.8927 + }
30.8928 +
30.8929 + return false;
30.8930 +
30.8931 + } else {
30.8932 + // classical easing cannot be used with an Infinity duration
30.8933 + if ( options.duration == Infinity ) {
30.8934 + this.now = t;
30.8935 + } else {
30.8936 + n = t - this.startTime;
30.8937 + this.state = n / options.duration;
30.8938 +
30.8939 + // Perform the easing function, defaults to swing
30.8940 + this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
30.8941 + this.now = this.start + ( (this.end - this.start) * this.pos );
30.8942 + }
30.8943 + // Perform the next step of the animation
30.8944 + this.update();
30.8945 + }
30.8946 +
30.8947 + return true;
30.8948 + }
30.8949 +};
30.8950 +
30.8951 +jQuery.extend( jQuery.fx, {
30.8952 + tick: function() {
30.8953 + var timer,
30.8954 + timers = jQuery.timers,
30.8955 + i = 0;
30.8956 +
30.8957 + for ( ; i < timers.length; i++ ) {
30.8958 + timer = timers[ i ];
30.8959 + // Checks the timer has not already been removed
30.8960 + if ( !timer() && timers[ i ] === timer ) {
30.8961 + timers.splice( i--, 1 );
30.8962 + }
30.8963 + }
30.8964 +
30.8965 + if ( !timers.length ) {
30.8966 + jQuery.fx.stop();
30.8967 + }
30.8968 + },
30.8969 +
30.8970 + interval: 13,
30.8971 +
30.8972 + stop: function() {
30.8973 + clearInterval( timerId );
30.8974 + timerId = null;
30.8975 + },
30.8976 +
30.8977 + speeds: {
30.8978 + slow: 600,
30.8979 + fast: 200,
30.8980 + // Default speed
30.8981 + _default: 400
30.8982 + },
30.8983 +
30.8984 + step: {
30.8985 + opacity: function( fx ) {
30.8986 + jQuery.style( fx.elem, "opacity", fx.now );
30.8987 + },
30.8988 +
30.8989 + _default: function( fx ) {
30.8990 + if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
30.8991 + fx.elem.style[ fx.prop ] = fx.now + fx.unit;
30.8992 + } else {
30.8993 + fx.elem[ fx.prop ] = fx.now;
30.8994 + }
30.8995 + }
30.8996 + }
30.8997 +});
30.8998 +
30.8999 +// Ensure props that can't be negative don't go there on undershoot easing
30.9000 +jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
30.9001 + // exclude marginTop, marginLeft, marginBottom and marginRight from this list
30.9002 + if ( prop.indexOf( "margin" ) ) {
30.9003 + jQuery.fx.step[ prop ] = function( fx ) {
30.9004 + jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
30.9005 + };
30.9006 + }
30.9007 +});
30.9008 +
30.9009 +if ( jQuery.expr && jQuery.expr.filters ) {
30.9010 + jQuery.expr.filters.animated = function( elem ) {
30.9011 + return jQuery.grep(jQuery.timers, function( fn ) {
30.9012 + return elem === fn.elem;
30.9013 + }).length;
30.9014 + };
30.9015 +}
30.9016 +
30.9017 +// Try to restore the default display value of an element
30.9018 +function defaultDisplay( nodeName ) {
30.9019 +
30.9020 + if ( !elemdisplay[ nodeName ] ) {
30.9021 +
30.9022 + var body = document.body,
30.9023 + elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
30.9024 + display = elem.css( "display" );
30.9025 + elem.remove();
30.9026 +
30.9027 + // If the simple way fails,
30.9028 + // get element's real default display by attaching it to a temp iframe
30.9029 + if ( display === "none" || display === "" ) {
30.9030 + // No iframe to use yet, so create it
30.9031 + if ( !iframe ) {
30.9032 + iframe = document.createElement( "iframe" );
30.9033 + iframe.frameBorder = iframe.width = iframe.height = 0;
30.9034 + }
30.9035 +
30.9036 + body.appendChild( iframe );
30.9037 +
30.9038 + // Create a cacheable copy of the iframe document on first call.
30.9039 + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
30.9040 + // document to it; WebKit & Firefox won't allow reusing the iframe document.
30.9041 + if ( !iframeDoc || !iframe.createElement ) {
30.9042 + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
30.9043 + iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
30.9044 + iframeDoc.close();
30.9045 + }
30.9046 +
30.9047 + elem = iframeDoc.createElement( nodeName );
30.9048 +
30.9049 + iframeDoc.body.appendChild( elem );
30.9050 +
30.9051 + display = jQuery.css( elem, "display" );
30.9052 + body.removeChild( iframe );
30.9053 + }
30.9054 +
30.9055 + // Store the correct default display
30.9056 + elemdisplay[ nodeName ] = display;
30.9057 + }
30.9058 +
30.9059 + return elemdisplay[ nodeName ];
30.9060 +}
30.9061 +
30.9062 +
30.9063 +
30.9064 +
30.9065 +var getOffset,
30.9066 + rtable = /^t(?:able|d|h)$/i,
30.9067 + rroot = /^(?:body|html)$/i;
30.9068 +
30.9069 +if ( "getBoundingClientRect" in document.documentElement ) {
30.9070 + getOffset = function( elem, doc, docElem, box ) {
30.9071 + try {
30.9072 + box = elem.getBoundingClientRect();
30.9073 + } catch(e) {}
30.9074 +
30.9075 + // Make sure we're not dealing with a disconnected DOM node
30.9076 + if ( !box || !jQuery.contains( docElem, elem ) ) {
30.9077 + return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
30.9078 + }
30.9079 +
30.9080 + var body = doc.body,
30.9081 + win = getWindow( doc ),
30.9082 + clientTop = docElem.clientTop || body.clientTop || 0,
30.9083 + clientLeft = docElem.clientLeft || body.clientLeft || 0,
30.9084 + scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
30.9085 + scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
30.9086 + top = box.top + scrollTop - clientTop,
30.9087 + left = box.left + scrollLeft - clientLeft;
30.9088 +
30.9089 + return { top: top, left: left };
30.9090 + };
30.9091 +
30.9092 +} else {
30.9093 + getOffset = function( elem, doc, docElem ) {
30.9094 + var computedStyle,
30.9095 + offsetParent = elem.offsetParent,
30.9096 + prevOffsetParent = elem,
30.9097 + body = doc.body,
30.9098 + defaultView = doc.defaultView,
30.9099 + prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
30.9100 + top = elem.offsetTop,
30.9101 + left = elem.offsetLeft;
30.9102 +
30.9103 + while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
30.9104 + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
30.9105 + break;
30.9106 + }
30.9107 +
30.9108 + computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
30.9109 + top -= elem.scrollTop;
30.9110 + left -= elem.scrollLeft;
30.9111 +
30.9112 + if ( elem === offsetParent ) {
30.9113 + top += elem.offsetTop;
30.9114 + left += elem.offsetLeft;
30.9115 +
30.9116 + if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
30.9117 + top += parseFloat( computedStyle.borderTopWidth ) || 0;
30.9118 + left += parseFloat( computedStyle.borderLeftWidth ) || 0;
30.9119 + }
30.9120 +
30.9121 + prevOffsetParent = offsetParent;
30.9122 + offsetParent = elem.offsetParent;
30.9123 + }
30.9124 +
30.9125 + if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
30.9126 + top += parseFloat( computedStyle.borderTopWidth ) || 0;
30.9127 + left += parseFloat( computedStyle.borderLeftWidth ) || 0;
30.9128 + }
30.9129 +
30.9130 + prevComputedStyle = computedStyle;
30.9131 + }
30.9132 +
30.9133 + if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
30.9134 + top += body.offsetTop;
30.9135 + left += body.offsetLeft;
30.9136 + }
30.9137 +
30.9138 + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
30.9139 + top += Math.max( docElem.scrollTop, body.scrollTop );
30.9140 + left += Math.max( docElem.scrollLeft, body.scrollLeft );
30.9141 + }
30.9142 +
30.9143 + return { top: top, left: left };
30.9144 + };
30.9145 +}
30.9146 +
30.9147 +jQuery.fn.offset = function( options ) {
30.9148 + if ( arguments.length ) {
30.9149 + return options === undefined ?
30.9150 + this :
30.9151 + this.each(function( i ) {
30.9152 + jQuery.offset.setOffset( this, options, i );
30.9153 + });
30.9154 + }
30.9155 +
30.9156 + var elem = this[0],
30.9157 + doc = elem && elem.ownerDocument;
30.9158 +
30.9159 + if ( !doc ) {
30.9160 + return null;
30.9161 + }
30.9162 +
30.9163 + if ( elem === doc.body ) {
30.9164 + return jQuery.offset.bodyOffset( elem );
30.9165 + }
30.9166 +
30.9167 + return getOffset( elem, doc, doc.documentElement );
30.9168 +};
30.9169 +
30.9170 +jQuery.offset = {
30.9171 +
30.9172 + bodyOffset: function( body ) {
30.9173 + var top = body.offsetTop,
30.9174 + left = body.offsetLeft;
30.9175 +
30.9176 + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
30.9177 + top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
30.9178 + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
30.9179 + }
30.9180 +
30.9181 + return { top: top, left: left };
30.9182 + },
30.9183 +
30.9184 + setOffset: function( elem, options, i ) {
30.9185 + var position = jQuery.css( elem, "position" );
30.9186 +
30.9187 + // set position first, in-case top/left are set even on static elem
30.9188 + if ( position === "static" ) {
30.9189 + elem.style.position = "relative";
30.9190 + }
30.9191 +
30.9192 + var curElem = jQuery( elem ),
30.9193 + curOffset = curElem.offset(),
30.9194 + curCSSTop = jQuery.css( elem, "top" ),
30.9195 + curCSSLeft = jQuery.css( elem, "left" ),
30.9196 + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
30.9197 + props = {}, curPosition = {}, curTop, curLeft;
30.9198 +
30.9199 + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
30.9200 + if ( calculatePosition ) {
30.9201 + curPosition = curElem.position();
30.9202 + curTop = curPosition.top;
30.9203 + curLeft = curPosition.left;
30.9204 + } else {
30.9205 + curTop = parseFloat( curCSSTop ) || 0;
30.9206 + curLeft = parseFloat( curCSSLeft ) || 0;
30.9207 + }
30.9208 +
30.9209 + if ( jQuery.isFunction( options ) ) {
30.9210 + options = options.call( elem, i, curOffset );
30.9211 + }
30.9212 +
30.9213 + if ( options.top != null ) {
30.9214 + props.top = ( options.top - curOffset.top ) + curTop;
30.9215 + }
30.9216 + if ( options.left != null ) {
30.9217 + props.left = ( options.left - curOffset.left ) + curLeft;
30.9218 + }
30.9219 +
30.9220 + if ( "using" in options ) {
30.9221 + options.using.call( elem, props );
30.9222 + } else {
30.9223 + curElem.css( props );
30.9224 + }
30.9225 + }
30.9226 +};
30.9227 +
30.9228 +
30.9229 +jQuery.fn.extend({
30.9230 +
30.9231 + position: function() {
30.9232 + if ( !this[0] ) {
30.9233 + return null;
30.9234 + }
30.9235 +
30.9236 + var elem = this[0],
30.9237 +
30.9238 + // Get *real* offsetParent
30.9239 + offsetParent = this.offsetParent(),
30.9240 +
30.9241 + // Get correct offsets
30.9242 + offset = this.offset(),
30.9243 + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
30.9244 +
30.9245 + // Subtract element margins
30.9246 + // note: when an element has margin: auto the offsetLeft and marginLeft
30.9247 + // are the same in Safari causing offset.left to incorrectly be 0
30.9248 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
30.9249 + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
30.9250 +
30.9251 + // Add offsetParent borders
30.9252 + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
30.9253 + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
30.9254 +
30.9255 + // Subtract the two offsets
30.9256 + return {
30.9257 + top: offset.top - parentOffset.top,
30.9258 + left: offset.left - parentOffset.left
30.9259 + };
30.9260 + },
30.9261 +
30.9262 + offsetParent: function() {
30.9263 + return this.map(function() {
30.9264 + var offsetParent = this.offsetParent || document.body;
30.9265 + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
30.9266 + offsetParent = offsetParent.offsetParent;
30.9267 + }
30.9268 + return offsetParent;
30.9269 + });
30.9270 + }
30.9271 +});
30.9272 +
30.9273 +
30.9274 +// Create scrollLeft and scrollTop methods
30.9275 +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
30.9276 + var top = /Y/.test( prop );
30.9277 +
30.9278 + jQuery.fn[ method ] = function( val ) {
30.9279 + return jQuery.access( this, function( elem, method, val ) {
30.9280 + var win = getWindow( elem );
30.9281 +
30.9282 + if ( val === undefined ) {
30.9283 + return win ? (prop in win) ? win[ prop ] :
30.9284 + jQuery.support.boxModel && win.document.documentElement[ method ] ||
30.9285 + win.document.body[ method ] :
30.9286 + elem[ method ];
30.9287 + }
30.9288 +
30.9289 + if ( win ) {
30.9290 + win.scrollTo(
30.9291 + !top ? val : jQuery( win ).scrollLeft(),
30.9292 + top ? val : jQuery( win ).scrollTop()
30.9293 + );
30.9294 +
30.9295 + } else {
30.9296 + elem[ method ] = val;
30.9297 + }
30.9298 + }, method, val, arguments.length, null );
30.9299 + };
30.9300 +});
30.9301 +
30.9302 +function getWindow( elem ) {
30.9303 + return jQuery.isWindow( elem ) ?
30.9304 + elem :
30.9305 + elem.nodeType === 9 ?
30.9306 + elem.defaultView || elem.parentWindow :
30.9307 + false;
30.9308 +}
30.9309 +
30.9310 +
30.9311 +
30.9312 +
30.9313 +// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
30.9314 +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
30.9315 + var clientProp = "client" + name,
30.9316 + scrollProp = "scroll" + name,
30.9317 + offsetProp = "offset" + name;
30.9318 +
30.9319 + // innerHeight and innerWidth
30.9320 + jQuery.fn[ "inner" + name ] = function() {
30.9321 + var elem = this[0];
30.9322 + return elem ?
30.9323 + elem.style ?
30.9324 + parseFloat( jQuery.css( elem, type, "padding" ) ) :
30.9325 + this[ type ]() :
30.9326 + null;
30.9327 + };
30.9328 +
30.9329 + // outerHeight and outerWidth
30.9330 + jQuery.fn[ "outer" + name ] = function( margin ) {
30.9331 + var elem = this[0];
30.9332 + return elem ?
30.9333 + elem.style ?
30.9334 + parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
30.9335 + this[ type ]() :
30.9336 + null;
30.9337 + };
30.9338 +
30.9339 + jQuery.fn[ type ] = function( value ) {
30.9340 + return jQuery.access( this, function( elem, type, value ) {
30.9341 + var doc, docElemProp, orig, ret;
30.9342 +
30.9343 + if ( jQuery.isWindow( elem ) ) {
30.9344 + // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
30.9345 + doc = elem.document;
30.9346 + docElemProp = doc.documentElement[ clientProp ];
30.9347 + return jQuery.support.boxModel && docElemProp ||
30.9348 + doc.body && doc.body[ clientProp ] || docElemProp;
30.9349 + }
30.9350 +
30.9351 + // Get document width or height
30.9352 + if ( elem.nodeType === 9 ) {
30.9353 + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
30.9354 + doc = elem.documentElement;
30.9355 +
30.9356 + // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
30.9357 + // so we can't use max, as it'll choose the incorrect offset[Width/Height]
30.9358 + // instead we use the correct client[Width/Height]
30.9359 + // support:IE6
30.9360 + if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
30.9361 + return doc[ clientProp ];
30.9362 + }
30.9363 +
30.9364 + return Math.max(
30.9365 + elem.body[ scrollProp ], doc[ scrollProp ],
30.9366 + elem.body[ offsetProp ], doc[ offsetProp ]
30.9367 + );
30.9368 + }
30.9369 +
30.9370 + // Get width or height on the element
30.9371 + if ( value === undefined ) {
30.9372 + orig = jQuery.css( elem, type );
30.9373 + ret = parseFloat( orig );
30.9374 + return jQuery.isNumeric( ret ) ? ret : orig;
30.9375 + }
30.9376 +
30.9377 + // Set the width or height on the element
30.9378 + jQuery( elem ).css( type, value );
30.9379 + }, type, value, arguments.length, null );
30.9380 + };
30.9381 +});
30.9382 +
30.9383 +
30.9384 +
30.9385 +
30.9386 +// Expose jQuery to the global object
30.9387 +window.jQuery = window.$ = jQuery;
30.9388 +
30.9389 +// Expose jQuery as an AMD module, but only for AMD loaders that
30.9390 +// understand the issues with loading multiple versions of jQuery
30.9391 +// in a page that all might call define(). The loader will indicate
30.9392 +// they have special allowances for multiple jQuery versions by
30.9393 +// specifying define.amd.jQuery = true. Register as a named module,
30.9394 +// since jQuery can be concatenated with other files that may use define,
30.9395 +// but not use a proper concatenation script that understands anonymous
30.9396 +// AMD modules. A named AMD is safest and most robust way to register.
30.9397 +// Lowercase jquery is used because AMD module names are derived from
30.9398 +// file names, and jQuery is normally delivered in a lowercase file name.
30.9399 +// Do this after creating the global so that if an AMD module wants to call
30.9400 +// noConflict to hide this version of jQuery, it will work.
30.9401 +if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
30.9402 + define( "jquery", [], function () { return jQuery; } );
30.9403 +}
30.9404 +
30.9405 +
30.9406 +
30.9407 +})( window );
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/Resources/Web/js/jquery-1.7.2.min.js Sun May 27 20:15:32 2012 +0000
31.3 @@ -0,0 +1,4 @@
31.4 +/*! jQuery v1.7.2 jquery.com | jquery.org/license */
31.5 +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
31.6 +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
31.7 +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
31.8 \ No newline at end of file
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/Resources/Web/js/jquery-ui-1.8.16.custom.min.js Sun May 27 20:15:32 2012 +0000
32.3 @@ -0,0 +1,111 @@
32.4 +/*!
32.5 + * jQuery UI 1.8.16
32.6 + *
32.7 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
32.8 + * Dual licensed under the MIT or GPL Version 2 licenses.
32.9 + * http://jquery.org/license
32.10 + *
32.11 + * http://docs.jquery.com/UI
32.12 + */
32.13 +(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",
32.14 +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=
32.15 +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,
32.16 +"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":
32.17 +"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,
32.18 +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,
32.19 +"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])&&
32.20 +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)&&
32.21 +c.ui.isOverAxis(b,e,i)}})}})(jQuery);
32.22 +;/*!
32.23 + * jQuery UI Widget 1.8.16
32.24 + *
32.25 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
32.26 + * Dual licensed under the MIT or GPL Version 2 licenses.
32.27 + * http://jquery.org/license
32.28 + *
32.29 + * http://docs.jquery.com/UI/Widget
32.30 + */
32.31 +(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]=
32.32 +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)):
32.33 +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=
32.34 +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+
32.35 +"-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",
32.36 +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);
32.37 +;/*!
32.38 + * jQuery UI Mouse 1.8.16
32.39 + *
32.40 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
32.41 + * Dual licensed under the MIT or GPL Version 2 licenses.
32.42 + * http://jquery.org/license
32.43 + *
32.44 + * http://docs.jquery.com/UI/Mouse
32.45 + *
32.46 + * Depends:
32.47 + * jquery.ui.widget.js
32.48 + */
32.49 +(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("."+
32.50 +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=
32.51 +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&&
32.52 +!(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=
32.53 +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);
32.54 +;/*
32.55 + * jQuery UI Button 1.8.16
32.56 + *
32.57 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
32.58 + * Dual licensed under the MIT or GPL Version 2 licenses.
32.59 + * http://jquery.org/license
32.60 + *
32.61 + * http://docs.jquery.com/UI/Button
32.62 + *
32.63 + * Depends:
32.64 + * jquery.ui.core.js
32.65 + * jquery.ui.widget.js
32.66 + */
32.67 +(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!==
32.68 +"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");
32.69 +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=
32.70 +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");
32.71 +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||
32.72 +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===
32.73 +"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},
32.74 +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");
32.75 +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",
32.76 +"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"),
32.77 +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":
32.78 +"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")===
32.79 +"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");
32.80 +b.Widget.prototype.destroy.call(this)}})})(jQuery);
32.81 +;/*
32.82 + * jQuery UI Slider 1.8.16
32.83 + *
32.84 + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
32.85 + * Dual licensed under the MIT or GPL Version 2 licenses.
32.86 + * http://jquery.org/license
32.87 + *
32.88 + * http://docs.jquery.com/UI/Slider
32.89 + *
32.90 + * Depends:
32.91 + * jquery.ui.core.js
32.92 + * jquery.ui.mouse.js
32.93 + * jquery.ui.widget.js
32.94 + */
32.95 +(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-"+
32.96 +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>");
32.97 +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",
32.98 +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?
32.99 +(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-
32.100 +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();
32.101 +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;
32.102 +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=
32.103 +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=
32.104 +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);
32.105 +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});
32.106 +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=
32.107 +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):
32.108 +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();
32.109 +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];
32.110 +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=
32.111 +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-
32.112 +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+"%"},
32.113 +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);
32.114 +;
32.115 \ No newline at end of file
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/Resources/Web/js/jquery.tmpl.js Sun May 27 20:15:32 2012 +0000
33.3 @@ -0,0 +1,484 @@
33.4 +/*!
33.5 + * jQuery Templates Plugin 1.0.0pre
33.6 + * http://github.com/jquery/jquery-tmpl
33.7 + * Requires jQuery 1.4.2
33.8 + *
33.9 + * Copyright 2011, Software Freedom Conservancy, Inc.
33.10 + * Dual licensed under the MIT or GPL Version 2 licenses.
33.11 + * http://jquery.org/license
33.12 + */
33.13 +(function( jQuery, undefined ){
33.14 + var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
33.15 + newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = [];
33.16 +
33.17 + function newTmplItem( options, parentItem, fn, data ) {
33.18 + // Returns a template item data structure for a new rendered instance of a template (a 'template item').
33.19 + // The content field is a hierarchical array of strings and nested items (to be
33.20 + // removed and replaced by nodes field of dom elements, once inserted in DOM).
33.21 + var newItem = {
33.22 + data: data || (data === 0 || data === false) ? data : (parentItem ? parentItem.data : {}),
33.23 + _wrap: parentItem ? parentItem._wrap : null,
33.24 + tmpl: null,
33.25 + parent: parentItem || null,
33.26 + nodes: [],
33.27 + calls: tiCalls,
33.28 + nest: tiNest,
33.29 + wrap: tiWrap,
33.30 + html: tiHtml,
33.31 + update: tiUpdate
33.32 + };
33.33 + if ( options ) {
33.34 + jQuery.extend( newItem, options, { nodes: [], parent: parentItem });
33.35 + }
33.36 + if ( fn ) {
33.37 + // Build the hierarchical content to be used during insertion into DOM
33.38 + newItem.tmpl = fn;
33.39 + newItem._ctnt = newItem._ctnt || newItem.tmpl( jQuery, newItem );
33.40 + newItem.key = ++itemKey;
33.41 + // Keep track of new template item, until it is stored as jQuery Data on DOM element
33.42 + (stack.length ? wrappedItems : newTmplItems)[itemKey] = newItem;
33.43 + }
33.44 + return newItem;
33.45 + }
33.46 +
33.47 + // Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core).
33.48 + jQuery.each({
33.49 + appendTo: "append",
33.50 + prependTo: "prepend",
33.51 + insertBefore: "before",
33.52 + insertAfter: "after",
33.53 + replaceAll: "replaceWith"
33.54 + }, function( name, original ) {
33.55 + jQuery.fn[ name ] = function( selector ) {
33.56 + var ret = [], insert = jQuery( selector ), elems, i, l, tmplItems,
33.57 + parent = this.length === 1 && this[0].parentNode;
33.58 +
33.59 + appendToTmplItems = newTmplItems || {};
33.60 + if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
33.61 + insert[ original ]( this[0] );
33.62 + ret = this;
33.63 + } else {
33.64 + for ( i = 0, l = insert.length; i < l; i++ ) {
33.65 + cloneIndex = i;
33.66 + elems = (i > 0 ? this.clone(true) : this).get();
33.67 + jQuery( insert[i] )[ original ]( elems );
33.68 + ret = ret.concat( elems );
33.69 + }
33.70 + cloneIndex = 0;
33.71 + ret = this.pushStack( ret, name, insert.selector );
33.72 + }
33.73 + tmplItems = appendToTmplItems;
33.74 + appendToTmplItems = null;
33.75 + jQuery.tmpl.complete( tmplItems );
33.76 + return ret;
33.77 + };
33.78 + });
33.79 +
33.80 + jQuery.fn.extend({
33.81 + // Use first wrapped element as template markup.
33.82 + // Return wrapped set of template items, obtained by rendering template against data.
33.83 + tmpl: function( data, options, parentItem ) {
33.84 + return jQuery.tmpl( this[0], data, options, parentItem );
33.85 + },
33.86 +
33.87 + // Find which rendered template item the first wrapped DOM element belongs to
33.88 + tmplItem: function() {
33.89 + return jQuery.tmplItem( this[0] );
33.90 + },
33.91 +
33.92 + // Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template.
33.93 + template: function( name ) {
33.94 + return jQuery.template( name, this[0] );
33.95 + },
33.96 +
33.97 + domManip: function( args, table, callback, options ) {
33.98 + if ( args[0] && jQuery.isArray( args[0] )) {
33.99 + var dmArgs = jQuery.makeArray( arguments ), elems = args[0], elemsLength = elems.length, i = 0, tmplItem;
33.100 + while ( i < elemsLength && !(tmplItem = jQuery.data( elems[i++], "tmplItem" ))) {}
33.101 + if ( tmplItem && cloneIndex ) {
33.102 + dmArgs[2] = function( fragClone ) {
33.103 + // Handler called by oldManip when rendered template has been inserted into DOM.
33.104 + jQuery.tmpl.afterManip( this, fragClone, callback );
33.105 + };
33.106 + }
33.107 + oldManip.apply( this, dmArgs );
33.108 + } else {
33.109 + oldManip.apply( this, arguments );
33.110 + }
33.111 + cloneIndex = 0;
33.112 + if ( !appendToTmplItems ) {
33.113 + jQuery.tmpl.complete( newTmplItems );
33.114 + }
33.115 + return this;
33.116 + }
33.117 + });
33.118 +
33.119 + jQuery.extend({
33.120 + // Return wrapped set of template items, obtained by rendering template against data.
33.121 + tmpl: function( tmpl, data, options, parentItem ) {
33.122 + var ret, topLevel = !parentItem;
33.123 + if ( topLevel ) {
33.124 + // This is a top-level tmpl call (not from a nested template using {{tmpl}})
33.125 + parentItem = topTmplItem;
33.126 + tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl );
33.127 + wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level
33.128 + } else if ( !tmpl ) {
33.129 + // The template item is already associated with DOM - this is a refresh.
33.130 + // Re-evaluate rendered template for the parentItem
33.131 + tmpl = parentItem.tmpl;
33.132 + newTmplItems[parentItem.key] = parentItem;
33.133 + parentItem.nodes = [];
33.134 + if ( parentItem.wrapped ) {
33.135 + updateWrapped( parentItem, parentItem.wrapped );
33.136 + }
33.137 + // Rebuild, without creating a new template item
33.138 + return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) ));
33.139 + }
33.140 + if ( !tmpl ) {
33.141 + return []; // Could throw...
33.142 + }
33.143 + if ( typeof data === "function" ) {
33.144 + data = data.call( parentItem || {} );
33.145 + }
33.146 + if ( options && options.wrapped ) {
33.147 + updateWrapped( options, options.wrapped );
33.148 + }
33.149 + ret = jQuery.isArray( data ) ?
33.150 + jQuery.map( data, function( dataItem ) {
33.151 + return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null;
33.152 + }) :
33.153 + [ newTmplItem( options, parentItem, tmpl, data ) ];
33.154 + return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret;
33.155 + },
33.156 +
33.157 + // Return rendered template item for an element.
33.158 + tmplItem: function( elem ) {
33.159 + var tmplItem;
33.160 + if ( elem instanceof jQuery ) {
33.161 + elem = elem[0];
33.162 + }
33.163 + while ( elem && elem.nodeType === 1 && !(tmplItem = jQuery.data( elem, "tmplItem" )) && (elem = elem.parentNode) ) {}
33.164 + return tmplItem || topTmplItem;
33.165 + },
33.166 +
33.167 + // Set:
33.168 + // Use $.template( name, tmpl ) to cache a named template,
33.169 + // where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc.
33.170 + // Use $( "selector" ).template( name ) to provide access by name to a script block template declaration.
33.171 +
33.172 + // Get:
33.173 + // Use $.template( name ) to access a cached template.
33.174 + // Also $( selectorToScriptBlock ).template(), or $.template( null, templateString )
33.175 + // will return the compiled template, without adding a name reference.
33.176 + // If templateString includes at least one HTML tag, $.template( templateString ) is equivalent
33.177 + // to $.template( null, templateString )
33.178 + template: function( name, tmpl ) {
33.179 + if (tmpl) {
33.180 + // Compile template and associate with name
33.181 + if ( typeof tmpl === "string" ) {
33.182 + // This is an HTML string being passed directly in.
33.183 + tmpl = buildTmplFn( tmpl );
33.184 + } else if ( tmpl instanceof jQuery ) {
33.185 + tmpl = tmpl[0] || {};
33.186 + }
33.187 + if ( tmpl.nodeType ) {
33.188 + // If this is a template block, use cached copy, or generate tmpl function and cache.
33.189 + tmpl = jQuery.data( tmpl, "tmpl" ) || jQuery.data( tmpl, "tmpl", buildTmplFn( tmpl.innerHTML ));
33.190 + // 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.
33.191 + // This means that foo="${x}" will not work if the value of x includes white space: foo="${x}" -> foo=value of x.
33.192 + // To correct this, include space in tag: foo="${ x }" -> foo="value of x"
33.193 + }
33.194 + return typeof name === "string" ? (jQuery.template[name] = tmpl) : tmpl;
33.195 + }
33.196 + // Return named compiled template
33.197 + return name ? (typeof name !== "string" ? jQuery.template( null, name ):
33.198 + (jQuery.template[name] ||
33.199 + // If not in map, and not containing at least on HTML tag, treat as a selector.
33.200 + // (If integrated with core, use quickExpr.exec)
33.201 + jQuery.template( null, htmlExpr.test( name ) ? name : jQuery( name )))) : null;
33.202 + },
33.203 +
33.204 + encode: function( text ) {
33.205 + // Do HTML encoding replacing < > & and ' and " by corresponding entities.
33.206 + return ("" + text).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'");
33.207 + }
33.208 + });
33.209 +
33.210 + jQuery.extend( jQuery.tmpl, {
33.211 + tag: {
33.212 + "tmpl": {
33.213 + _default: { $2: "null" },
33.214 + open: "if($notnull_1){__=__.concat($item.nest($1,$2));}"
33.215 + // tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions)
33.216 + // This means that {{tmpl foo}} treats foo as a template (which IS a function).
33.217 + // Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}.
33.218 + },
33.219 + "wrap": {
33.220 + _default: { $2: "null" },
33.221 + open: "$item.calls(__,$1,$2);__=[];",
33.222 + close: "call=$item.calls();__=call._.concat($item.wrap(call,__));"
33.223 + },
33.224 + "each": {
33.225 + _default: { $2: "$index, $value" },
33.226 + open: "if($notnull_1){$.each($1a,function($2){with(this){",
33.227 + close: "}});}"
33.228 + },
33.229 + "if": {
33.230 + open: "if(($notnull_1) && $1a){",
33.231 + close: "}"
33.232 + },
33.233 + "else": {
33.234 + _default: { $1: "true" },
33.235 + open: "}else if(($notnull_1) && $1a){"
33.236 + },
33.237 + "html": {
33.238 + // Unecoded expression evaluation.
33.239 + open: "if($notnull_1){__.push($1a);}"
33.240 + },
33.241 + "=": {
33.242 + // Encoded expression evaluation. Abbreviated form is ${}.
33.243 + _default: { $1: "$data" },
33.244 + open: "if($notnull_1){__.push($.encode($1a));}"
33.245 + },
33.246 + "!": {
33.247 + // Comment tag. Skipped by parser
33.248 + open: ""
33.249 + }
33.250 + },
33.251 +
33.252 + // This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events
33.253 + complete: function( items ) {
33.254 + newTmplItems = {};
33.255 + },
33.256 +
33.257 + // Call this from code which overrides domManip, or equivalent
33.258 + // Manage cloning/storing template items etc.
33.259 + afterManip: function afterManip( elem, fragClone, callback ) {
33.260 + // Provides cloned fragment ready for fixup prior to and after insertion into DOM
33.261 + var content = fragClone.nodeType === 11 ?
33.262 + jQuery.makeArray(fragClone.childNodes) :
33.263 + fragClone.nodeType === 1 ? [fragClone] : [];
33.264 +
33.265 + // Return fragment to original caller (e.g. append) for DOM insertion
33.266 + callback.call( elem, fragClone );
33.267 +
33.268 + // Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data.
33.269 + storeTmplItems( content );
33.270 + cloneIndex++;
33.271 + }
33.272 + });
33.273 +
33.274 + //========================== Private helper functions, used by code above ==========================
33.275 +
33.276 + function build( tmplItem, nested, content ) {
33.277 + // Convert hierarchical content into flat string array
33.278 + // and finally return array of fragments ready for DOM insertion
33.279 + var frag, ret = content ? jQuery.map( content, function( item ) {
33.280 + return (typeof item === "string") ?
33.281 + // Insert template item annotations, to be converted to jQuery.data( "tmplItem" ) when elems are inserted into DOM.
33.282 + (tmplItem.key ? item.replace( /(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + tmplItmAtt + "=\"" + tmplItem.key + "\" $2" ) : item) :
33.283 + // This is a child template item. Build nested template.
33.284 + build( item, tmplItem, item._ctnt );
33.285 + }) :
33.286 + // 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()}}.
33.287 + tmplItem;
33.288 + if ( nested ) {
33.289 + return ret;
33.290 + }
33.291 +
33.292 + // top-level template
33.293 + ret = ret.join("");
33.294 +
33.295 + // Support templates which have initial or final text nodes, or consist only of text
33.296 + // Also support HTML entities within the HTML markup.
33.297 + ret.replace( /^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/, function( all, before, middle, after) {
33.298 + frag = jQuery( middle ).get();
33.299 +
33.300 + storeTmplItems( frag );
33.301 + if ( before ) {
33.302 + frag = unencode( before ).concat(frag);
33.303 + }
33.304 + if ( after ) {
33.305 + frag = frag.concat(unencode( after ));
33.306 + }
33.307 + });
33.308 + return frag ? frag : unencode( ret );
33.309 + }
33.310 +
33.311 + function unencode( text ) {
33.312 + // Use createElement, since createTextNode will not render HTML entities correctly
33.313 + var el = document.createElement( "div" );
33.314 + el.innerHTML = text;
33.315 + return jQuery.makeArray(el.childNodes);
33.316 + }
33.317 +
33.318 + // Generate a reusable function that will serve to render a template against data
33.319 + function buildTmplFn( markup ) {
33.320 + return new Function("jQuery","$item",
33.321 + // Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10).
33.322 + "var $=jQuery,call,__=[],$data=$item.data;" +
33.323 +
33.324 + // Introduce the data as local variables using with(){}
33.325 + "with($data){__.push('" +
33.326 +
33.327 + // Convert the template into pure JavaScript
33.328 + jQuery.trim(markup)
33.329 + .replace( /([\\'])/g, "\\$1" )
33.330 + .replace( /[\r\t\n]/g, " " )
33.331 + .replace( /\$\{([^\}]*)\}/g, "{{= $1}}" )
33.332 + .replace( /\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
33.333 + function( all, slash, type, fnargs, target, parens, args ) {
33.334 + var tag = jQuery.tmpl.tag[ type ], def, expr, exprAutoFnDetect;
33.335 + if ( !tag ) {
33.336 + throw "Unknown template tag: " + type;
33.337 + }
33.338 + def = tag._default || [];
33.339 + if ( parens && !/\w$/.test(target)) {
33.340 + target += parens;
33.341 + parens = "";
33.342 + }
33.343 + if ( target ) {
33.344 + target = unescape( target );
33.345 + args = args ? ("," + unescape( args ) + ")") : (parens ? ")" : "");
33.346 + // Support for target being things like a.toLowerCase();
33.347 + // In that case don't call with template item as 'this' pointer. Just evaluate...
33.348 + expr = parens ? (target.indexOf(".") > -1 ? target + unescape( parens ) : ("(" + target + ").call($item" + args)) : target;
33.349 + exprAutoFnDetect = parens ? expr : "(typeof(" + target + ")==='function'?(" + target + ").call($item):(" + target + "))";
33.350 + } else {
33.351 + exprAutoFnDetect = expr = def.$1 || "null";
33.352 + }
33.353 + fnargs = unescape( fnargs );
33.354 + return "');" +
33.355 + tag[ slash ? "close" : "open" ]
33.356 + .split( "$notnull_1" ).join( target ? "typeof(" + target + ")!=='undefined' && (" + target + ")!=null" : "true" )
33.357 + .split( "$1a" ).join( exprAutoFnDetect )
33.358 + .split( "$1" ).join( expr )
33.359 + .split( "$2" ).join( fnargs || def.$2 || "" ) +
33.360 + "__.push('";
33.361 + }) +
33.362 + "');}return __;"
33.363 + );
33.364 + }
33.365 + function updateWrapped( options, wrapped ) {
33.366 + // Build the wrapped content.
33.367 + options._wrap = build( options, true,
33.368 + // Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string.
33.369 + jQuery.isArray( wrapped ) ? wrapped : [htmlExpr.test( wrapped ) ? wrapped : jQuery( wrapped ).html()]
33.370 + ).join("");
33.371 + }
33.372 +
33.373 + function unescape( args ) {
33.374 + return args ? args.replace( /\\'/g, "'").replace(/\\\\/g, "\\" ) : null;
33.375 + }
33.376 + function outerHtml( elem ) {
33.377 + var div = document.createElement("div");
33.378 + div.appendChild( elem.cloneNode(true) );
33.379 + return div.innerHTML;
33.380 + }
33.381 +
33.382 + // Store template items in jQuery.data(), ensuring a unique tmplItem data data structure for each rendered template instance.
33.383 + function storeTmplItems( content ) {
33.384 + var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m;
33.385 + for ( i = 0, l = content.length; i < l; i++ ) {
33.386 + if ( (elem = content[i]).nodeType !== 1 ) {
33.387 + continue;
33.388 + }
33.389 + elems = elem.getElementsByTagName("*");
33.390 + for ( m = elems.length - 1; m >= 0; m-- ) {
33.391 + processItemKey( elems[m] );
33.392 + }
33.393 + processItemKey( elem );
33.394 + }
33.395 + function processItemKey( el ) {
33.396 + var pntKey, pntNode = el, pntItem, tmplItem, key;
33.397 + // Ensure that each rendered template inserted into the DOM has its own template item,
33.398 + if ( (key = el.getAttribute( tmplItmAtt ))) {
33.399 + while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { }
33.400 + if ( pntKey !== key ) {
33.401 + // The next ancestor with a _tmplitem expando is on a different key than this one.
33.402 + // So this is a top-level element within this template item
33.403 + // Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment.
33.404 + pntNode = pntNode.parentNode ? (pntNode.nodeType === 11 ? 0 : (pntNode.getAttribute( tmplItmAtt ) || 0)) : 0;
33.405 + if ( !(tmplItem = newTmplItems[key]) ) {
33.406 + // The item is for wrapped content, and was copied from the temporary parent wrappedItem.
33.407 + tmplItem = wrappedItems[key];
33.408 + tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode] );
33.409 + tmplItem.key = ++itemKey;
33.410 + newTmplItems[itemKey] = tmplItem;
33.411 + }
33.412 + if ( cloneIndex ) {
33.413 + cloneTmplItem( key );
33.414 + }
33.415 + }
33.416 + el.removeAttribute( tmplItmAtt );
33.417 + } else if ( cloneIndex && (tmplItem = jQuery.data( el, "tmplItem" )) ) {
33.418 + // This was a rendered element, cloned during append or appendTo etc.
33.419 + // TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem.
33.420 + cloneTmplItem( tmplItem.key );
33.421 + newTmplItems[tmplItem.key] = tmplItem;
33.422 + pntNode = jQuery.data( el.parentNode, "tmplItem" );
33.423 + pntNode = pntNode ? pntNode.key : 0;
33.424 + }
33.425 + if ( tmplItem ) {
33.426 + pntItem = tmplItem;
33.427 + // Find the template item of the parent element.
33.428 + // (Using !=, not !==, since pntItem.key is number, and pntNode may be a string)
33.429 + while ( pntItem && pntItem.key != pntNode ) {
33.430 + // Add this element as a top-level node for this rendered template item, as well as for any
33.431 + // ancestor items between this item and the item of its parent element
33.432 + pntItem.nodes.push( el );
33.433 + pntItem = pntItem.parent;
33.434 + }
33.435 + // Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering...
33.436 + delete tmplItem._ctnt;
33.437 + delete tmplItem._wrap;
33.438 + // Store template item as jQuery data on the element
33.439 + jQuery.data( el, "tmplItem", tmplItem );
33.440 + }
33.441 + function cloneTmplItem( key ) {
33.442 + key = key + keySuffix;
33.443 + tmplItem = newClonedItems[key] =
33.444 + (newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent ));
33.445 + }
33.446 + }
33.447 + }
33.448 +
33.449 + //---- Helper functions for template item ----
33.450 +
33.451 + function tiCalls( content, tmpl, data, options ) {
33.452 + if ( !content ) {
33.453 + return stack.pop();
33.454 + }
33.455 + stack.push({ _: content, tmpl: tmpl, item:this, data: data, options: options });
33.456 + }
33.457 +
33.458 + function tiNest( tmpl, data, options ) {
33.459 + // nested template, using {{tmpl}} tag
33.460 + return jQuery.tmpl( jQuery.template( tmpl ), data, options, this );
33.461 + }
33.462 +
33.463 + function tiWrap( call, wrapped ) {
33.464 + // nested template, using {{wrap}} tag
33.465 + var options = call.options || {};
33.466 + options.wrapped = wrapped;
33.467 + // Apply the template, which may incorporate wrapped content,
33.468 + return jQuery.tmpl( jQuery.template( call.tmpl ), call.data, options, call.item );
33.469 + }
33.470 +
33.471 + function tiHtml( filter, textOnly ) {
33.472 + var wrapped = this._wrap;
33.473 + return jQuery.map(
33.474 + jQuery( jQuery.isArray( wrapped ) ? wrapped.join("") : wrapped ).filter( filter || "*" ),
33.475 + function(e) {
33.476 + return textOnly ?
33.477 + e.innerText || e.textContent :
33.478 + e.outerHTML || outerHtml(e);
33.479 + });
33.480 + }
33.481 +
33.482 + function tiUpdate() {
33.483 + var coll = this.nodes;
33.484 + jQuery.tmpl( null, null, null, this).insertBefore( coll[0] );
33.485 + jQuery( coll ).remove();
33.486 + }
33.487 +})( jQuery );
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/Resources/Web/js/jquery.tmpl.min.js Sun May 27 20:15:32 2012 +0000
34.3 @@ -0,0 +1,10 @@
34.4 +/*
34.5 + * jQuery Templates Plugin 1.0.0pre
34.6 + * http://github.com/jquery/jquery-tmpl
34.7 + * Requires jQuery 1.4.2
34.8 + *
34.9 + * Copyright 2011, Software Freedom Conservancy, Inc.
34.10 + * Dual licensed under the MIT or GPL Version 2 licenses.
34.11 + * http://jquery.org/license
34.12 + */
34.13 +(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},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:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);
34.14 \ No newline at end of file
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/Resources/Web/js/jquery.treeTable.min.js Sun May 27 20:15:32 2012 +0000
35.3 @@ -0,0 +1,8 @@
35.4 +/*
35.5 + * jQuery treeTable Plugin VERSION
35.6 + * http://ludo.cubicphuse.nl/jquery-plugins/treeTable/doc/
35.7 + *
35.8 + * Copyright 2011, Ludo van den Boom
35.9 + * Dual licensed under the MIT or GPL Version 2 licenses.
35.10 + */
35.11 +(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)
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/Resources/Web/js/knockout-2.1.0.js Sun May 27 20:15:32 2012 +0000
36.3 @@ -0,0 +1,3443 @@
36.4 +// Knockout JavaScript library v2.1.0
36.5 +// (c) Steven Sanderson - http://knockoutjs.com/
36.6 +// License: MIT (http://www.opensource.org/licenses/mit-license.php)
36.7 +
36.8 +(function(window,document,navigator,undefined){
36.9 +var DEBUG=true;
36.10 +!function(factory) {
36.11 + // Support three module loading scenarios
36.12 + if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
36.13 + // [1] CommonJS/Node.js
36.14 + var target = module['exports'] || exports; // module.exports is for Node.js
36.15 + factory(target);
36.16 + } else if (typeof define === 'function' && define['amd']) {
36.17 + // [2] AMD anonymous module
36.18 + define(['exports'], factory);
36.19 + } else {
36.20 + // [3] No module loader (plain <script> tag) - put directly in global namespace
36.21 + factory(window['ko'] = {});
36.22 + }
36.23 +}(function(koExports){
36.24 +// Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler).
36.25 +// In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable.
36.26 +var ko = typeof koExports !== 'undefined' ? koExports : {};
36.27 +// Google Closure Compiler helpers (used only to make the minified file smaller)
36.28 +ko.exportSymbol = function(koPath, object) {
36.29 + var tokens = koPath.split(".");
36.30 +
36.31 + // In the future, "ko" may become distinct from "koExports" (so that non-exported objects are not reachable)
36.32 + // At that point, "target" would be set to: (typeof koExports !== "undefined" ? koExports : ko)
36.33 + var target = ko;
36.34 +
36.35 + for (var i = 0; i < tokens.length - 1; i++)
36.36 + target = target[tokens[i]];
36.37 + target[tokens[tokens.length - 1]] = object;
36.38 +};
36.39 +ko.exportProperty = function(owner, publicName, object) {
36.40 + owner[publicName] = object;
36.41 +};
36.42 +ko.version = "2.1.0";
36.43 +
36.44 +ko.exportSymbol('version', ko.version);
36.45 +ko.utils = new (function () {
36.46 + var stringTrimRegex = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
36.47 +
36.48 + // Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup)
36.49 + var knownEvents = {}, knownEventTypesByEventName = {};
36.50 + var keyEventTypeName = /Firefox\/2/i.test(navigator.userAgent) ? 'KeyboardEvent' : 'UIEvents';
36.51 + knownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress'];
36.52 + knownEvents['MouseEvents'] = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
36.53 + for (var eventType in knownEvents) {
36.54 + var knownEventsForType = knownEvents[eventType];
36.55 + if (knownEventsForType.length) {
36.56 + for (var i = 0, j = knownEventsForType.length; i < j; i++)
36.57 + knownEventTypesByEventName[knownEventsForType[i]] = eventType;
36.58 + }
36.59 + }
36.60 + var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406
36.61 +
36.62 + // Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)
36.63 + var ieVersion = (function() {
36.64 + var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');
36.65 +
36.66 + // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment
36.67 + while (
36.68 + div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',
36.69 + iElems[0]
36.70 + );
36.71 + return version > 4 ? version : undefined;
36.72 + }());
36.73 + var isIe6 = ieVersion === 6,
36.74 + isIe7 = ieVersion === 7;
36.75 +
36.76 + function isClickOnCheckableElement(element, eventType) {
36.77 + if ((ko.utils.tagNameLower(element) !== "input") || !element.type) return false;
36.78 + if (eventType.toLowerCase() != "click") return false;
36.79 + var inputType = element.type;
36.80 + return (inputType == "checkbox") || (inputType == "radio");
36.81 + }
36.82 +
36.83 + return {
36.84 + fieldsIncludedWithJsonPost: ['authenticity_token', /^__RequestVerificationToken(_.*)?$/],
36.85 +
36.86 + arrayForEach: function (array, action) {
36.87 + for (var i = 0, j = array.length; i < j; i++)
36.88 + action(array[i]);
36.89 + },
36.90 +
36.91 + arrayIndexOf: function (array, item) {
36.92 + if (typeof Array.prototype.indexOf == "function")
36.93 + return Array.prototype.indexOf.call(array, item);
36.94 + for (var i = 0, j = array.length; i < j; i++)
36.95 + if (array[i] === item)
36.96 + return i;
36.97 + return -1;
36.98 + },
36.99 +
36.100 + arrayFirst: function (array, predicate, predicateOwner) {
36.101 + for (var i = 0, j = array.length; i < j; i++)
36.102 + if (predicate.call(predicateOwner, array[i]))
36.103 + return array[i];
36.104 + return null;
36.105 + },
36.106 +
36.107 + arrayRemoveItem: function (array, itemToRemove) {
36.108 + var index = ko.utils.arrayIndexOf(array, itemToRemove);
36.109 + if (index >= 0)
36.110 + array.splice(index, 1);
36.111 + },
36.112 +
36.113 + arrayGetDistinctValues: function (array) {
36.114 + array = array || [];
36.115 + var result = [];
36.116 + for (var i = 0, j = array.length; i < j; i++) {
36.117 + if (ko.utils.arrayIndexOf(result, array[i]) < 0)
36.118 + result.push(array[i]);
36.119 + }
36.120 + return result;
36.121 + },
36.122 +
36.123 + arrayMap: function (array, mapping) {
36.124 + array = array || [];
36.125 + var result = [];
36.126 + for (var i = 0, j = array.length; i < j; i++)
36.127 + result.push(mapping(array[i]));
36.128 + return result;
36.129 + },
36.130 +
36.131 + arrayFilter: function (array, predicate) {
36.132 + array = array || [];
36.133 + var result = [];
36.134 + for (var i = 0, j = array.length; i < j; i++)
36.135 + if (predicate(array[i]))
36.136 + result.push(array[i]);
36.137 + return result;
36.138 + },
36.139 +
36.140 + arrayPushAll: function (array, valuesToPush) {
36.141 + if (valuesToPush instanceof Array)
36.142 + array.push.apply(array, valuesToPush);
36.143 + else
36.144 + for (var i = 0, j = valuesToPush.length; i < j; i++)
36.145 + array.push(valuesToPush[i]);
36.146 + return array;
36.147 + },
36.148 +
36.149 + extend: function (target, source) {
36.150 + if (source) {
36.151 + for(var prop in source) {
36.152 + if(source.hasOwnProperty(prop)) {
36.153 + target[prop] = source[prop];
36.154 + }
36.155 + }
36.156 + }
36.157 + return target;
36.158 + },
36.159 +
36.160 + emptyDomNode: function (domNode) {
36.161 + while (domNode.firstChild) {
36.162 + ko.removeNode(domNode.firstChild);
36.163 + }
36.164 + },
36.165 +
36.166 + moveCleanedNodesToContainerElement: function(nodes) {
36.167 + // Ensure it's a real array, as we're about to reparent the nodes and
36.168 + // we don't want the underlying collection to change while we're doing that.
36.169 + var nodesArray = ko.utils.makeArray(nodes);
36.170 +
36.171 + var container = document.createElement('div');
36.172 + for (var i = 0, j = nodesArray.length; i < j; i++) {
36.173 + ko.cleanNode(nodesArray[i]);
36.174 + container.appendChild(nodesArray[i]);
36.175 + }
36.176 + return container;
36.177 + },
36.178 +
36.179 + setDomNodeChildren: function (domNode, childNodes) {
36.180 + ko.utils.emptyDomNode(domNode);
36.181 + if (childNodes) {
36.182 + for (var i = 0, j = childNodes.length; i < j; i++)
36.183 + domNode.appendChild(childNodes[i]);
36.184 + }
36.185 + },
36.186 +
36.187 + replaceDomNodes: function (nodeToReplaceOrNodeArray, newNodesArray) {
36.188 + var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray;
36.189 + if (nodesToReplaceArray.length > 0) {
36.190 + var insertionPoint = nodesToReplaceArray[0];
36.191 + var parent = insertionPoint.parentNode;
36.192 + for (var i = 0, j = newNodesArray.length; i < j; i++)
36.193 + parent.insertBefore(newNodesArray[i], insertionPoint);
36.194 + for (var i = 0, j = nodesToReplaceArray.length; i < j; i++) {
36.195 + ko.removeNode(nodesToReplaceArray[i]);
36.196 + }
36.197 + }
36.198 + },
36.199 +
36.200 + setOptionNodeSelectionState: function (optionNode, isSelected) {
36.201 + // IE6 sometimes throws "unknown error" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser.
36.202 + if (navigator.userAgent.indexOf("MSIE 6") >= 0)
36.203 + optionNode.setAttribute("selected", isSelected);
36.204 + else
36.205 + optionNode.selected = isSelected;
36.206 + },
36.207 +
36.208 + stringTrim: function (string) {
36.209 + return (string || "").replace(stringTrimRegex, "");
36.210 + },
36.211 +
36.212 + stringTokenize: function (string, delimiter) {
36.213 + var result = [];
36.214 + var tokens = (string || "").split(delimiter);
36.215 + for (var i = 0, j = tokens.length; i < j; i++) {
36.216 + var trimmed = ko.utils.stringTrim(tokens[i]);
36.217 + if (trimmed !== "")
36.218 + result.push(trimmed);
36.219 + }
36.220 + return result;
36.221 + },
36.222 +
36.223 + stringStartsWith: function (string, startsWith) {
36.224 + string = string || "";
36.225 + if (startsWith.length > string.length)
36.226 + return false;
36.227 + return string.substring(0, startsWith.length) === startsWith;
36.228 + },
36.229 +
36.230 + buildEvalWithinScopeFunction: function (expression, scopeLevels) {
36.231 + // Build the source for a function that evaluates "expression"
36.232 + // For each scope variable, add an extra level of "with" nesting
36.233 + // Example result: with(sc[1]) { with(sc[0]) { return (expression) } }
36.234 + var functionBody = "return (" + expression + ")";
36.235 + for (var i = 0; i < scopeLevels; i++) {
36.236 + functionBody = "with(sc[" + i + "]) { " + functionBody + " } ";
36.237 + }
36.238 + return new Function("sc", functionBody);
36.239 + },
36.240 +
36.241 + domNodeIsContainedBy: function (node, containedByNode) {
36.242 + if (containedByNode.compareDocumentPosition)
36.243 + return (containedByNode.compareDocumentPosition(node) & 16) == 16;
36.244 + while (node != null) {
36.245 + if (node == containedByNode)
36.246 + return true;
36.247 + node = node.parentNode;
36.248 + }
36.249 + return false;
36.250 + },
36.251 +
36.252 + domNodeIsAttachedToDocument: function (node) {
36.253 + return ko.utils.domNodeIsContainedBy(node, node.ownerDocument);
36.254 + },
36.255 +
36.256 + tagNameLower: function(element) {
36.257 + // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.
36.258 + // Possible future optimization: If we know it's an element from an XHTML document (not HTML),
36.259 + // we don't need to do the .toLowerCase() as it will always be lower case anyway.
36.260 + return element && element.tagName && element.tagName.toLowerCase();
36.261 + },
36.262 +
36.263 + registerEventHandler: function (element, eventType, handler) {
36.264 + var mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType];
36.265 + if (!mustUseAttachEvent && typeof jQuery != "undefined") {
36.266 + if (isClickOnCheckableElement(element, eventType)) {
36.267 + // For click events on checkboxes, jQuery interferes with the event handling in an awkward way:
36.268 + // it toggles the element checked state *after* the click event handlers run, whereas native
36.269 + // click events toggle the checked state *before* the event handler.
36.270 + // Fix this by intecepting the handler and applying the correct checkedness before it runs.
36.271 + var originalHandler = handler;
36.272 + handler = function(event, eventData) {
36.273 + var jQuerySuppliedCheckedState = this.checked;
36.274 + if (eventData)
36.275 + this.checked = eventData.checkedStateBeforeEvent !== true;
36.276 + originalHandler.call(this, event);
36.277 + this.checked = jQuerySuppliedCheckedState; // Restore the state jQuery applied
36.278 + };
36.279 + }
36.280 + jQuery(element)['bind'](eventType, handler);
36.281 + } else if (!mustUseAttachEvent && typeof element.addEventListener == "function")
36.282 + element.addEventListener(eventType, handler, false);
36.283 + else if (typeof element.attachEvent != "undefined")
36.284 + element.attachEvent("on" + eventType, function (event) {
36.285 + handler.call(element, event);
36.286 + });
36.287 + else
36.288 + throw new Error("Browser doesn't support addEventListener or attachEvent");
36.289 + },
36.290 +
36.291 + triggerEvent: function (element, eventType) {
36.292 + if (!(element && element.nodeType))
36.293 + throw new Error("element must be a DOM node when calling triggerEvent");
36.294 +
36.295 + if (typeof jQuery != "undefined") {
36.296 + var eventData = [];
36.297 + if (isClickOnCheckableElement(element, eventType)) {
36.298 + // Work around the jQuery "click events on checkboxes" issue described above by storing the original checked state before triggering the handler
36.299 + eventData.push({ checkedStateBeforeEvent: element.checked });
36.300 + }
36.301 + jQuery(element)['trigger'](eventType, eventData);
36.302 + } else if (typeof document.createEvent == "function") {
36.303 + if (typeof element.dispatchEvent == "function") {
36.304 + var eventCategory = knownEventTypesByEventName[eventType] || "HTMLEvents";
36.305 + var event = document.createEvent(eventCategory);
36.306 + event.initEvent(eventType, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);
36.307 + element.dispatchEvent(event);
36.308 + }
36.309 + else
36.310 + throw new Error("The supplied element doesn't support dispatchEvent");
36.311 + } else if (typeof element.fireEvent != "undefined") {
36.312 + // Unlike other browsers, IE doesn't change the checked state of checkboxes/radiobuttons when you trigger their "click" event
36.313 + // so to make it consistent, we'll do it manually here
36.314 + if (isClickOnCheckableElement(element, eventType))
36.315 + element.checked = element.checked !== true;
36.316 + element.fireEvent("on" + eventType);
36.317 + }
36.318 + else
36.319 + throw new Error("Browser doesn't support triggering events");
36.320 + },
36.321 +
36.322 + unwrapObservable: function (value) {
36.323 + return ko.isObservable(value) ? value() : value;
36.324 + },
36.325 +
36.326 + toggleDomNodeCssClass: function (node, className, shouldHaveClass) {
36.327 + var currentClassNames = (node.className || "").split(/\s+/);
36.328 + var hasClass = ko.utils.arrayIndexOf(currentClassNames, className) >= 0;
36.329 +
36.330 + if (shouldHaveClass && !hasClass) {
36.331 + node.className += (currentClassNames[0] ? " " : "") + className;
36.332 + } else if (hasClass && !shouldHaveClass) {
36.333 + var newClassName = "";
36.334 + for (var i = 0; i < currentClassNames.length; i++)
36.335 + if (currentClassNames[i] != className)
36.336 + newClassName += currentClassNames[i] + " ";
36.337 + node.className = ko.utils.stringTrim(newClassName);
36.338 + }
36.339 + },
36.340 +
36.341 + setTextContent: function(element, textContent) {
36.342 + var value = ko.utils.unwrapObservable(textContent);
36.343 + if ((value === null) || (value === undefined))
36.344 + value = "";
36.345 +
36.346 + 'innerText' in element ? element.innerText = value
36.347 + : element.textContent = value;
36.348 +
36.349 + if (ieVersion >= 9) {
36.350 + // Believe it or not, this actually fixes an IE9 rendering bug
36.351 + // (See https://github.com/SteveSanderson/knockout/issues/209)
36.352 + element.style.display = element.style.display;
36.353 + }
36.354 + },
36.355 +
36.356 + ensureSelectElementIsRenderedCorrectly: function(selectElement) {
36.357 + // Workaround for IE9 rendering bug - it doesn't reliably display all the text in dynamically-added select boxes unless you force it to re-render by updating the width.
36.358 + // (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option)
36.359 + if (ieVersion >= 9) {
36.360 + var originalWidth = selectElement.style.width;
36.361 + selectElement.style.width = 0;
36.362 + selectElement.style.width = originalWidth;
36.363 + }
36.364 + },
36.365 +
36.366 + range: function (min, max) {
36.367 + min = ko.utils.unwrapObservable(min);
36.368 + max = ko.utils.unwrapObservable(max);
36.369 + var result = [];
36.370 + for (var i = min; i <= max; i++)
36.371 + result.push(i);
36.372 + return result;
36.373 + },
36.374 +
36.375 + makeArray: function(arrayLikeObject) {
36.376 + var result = [];
36.377 + for (var i = 0, j = arrayLikeObject.length; i < j; i++) {
36.378 + result.push(arrayLikeObject[i]);
36.379 + };
36.380 + return result;
36.381 + },
36.382 +
36.383 + isIe6 : isIe6,
36.384 + isIe7 : isIe7,
36.385 + ieVersion : ieVersion,
36.386 +
36.387 + getFormFields: function(form, fieldName) {
36.388 + var fields = ko.utils.makeArray(form.getElementsByTagName("input")).concat(ko.utils.makeArray(form.getElementsByTagName("textarea")));
36.389 + var isMatchingField = (typeof fieldName == 'string')
36.390 + ? function(field) { return field.name === fieldName }
36.391 + : function(field) { return fieldName.test(field.name) }; // Treat fieldName as regex or object containing predicate
36.392 + var matches = [];
36.393 + for (var i = fields.length - 1; i >= 0; i--) {
36.394 + if (isMatchingField(fields[i]))
36.395 + matches.push(fields[i]);
36.396 + };
36.397 + return matches;
36.398 + },
36.399 +
36.400 + parseJson: function (jsonString) {
36.401 + if (typeof jsonString == "string") {
36.402 + jsonString = ko.utils.stringTrim(jsonString);
36.403 + if (jsonString) {
36.404 + if (window.JSON && window.JSON.parse) // Use native parsing where available
36.405 + return window.JSON.parse(jsonString);
36.406 + return (new Function("return " + jsonString))(); // Fallback on less safe parsing for older browsers
36.407 + }
36.408 + }
36.409 + return null;
36.410 + },
36.411 +
36.412 + stringifyJson: function (data, replacer, space) { // replacer and space are optional
36.413 + if ((typeof JSON == "undefined") || (typeof JSON.stringify == "undefined"))
36.414 + throw new 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");
36.415 + return JSON.stringify(ko.utils.unwrapObservable(data), replacer, space);
36.416 + },
36.417 +
36.418 + postJson: function (urlOrForm, data, options) {
36.419 + options = options || {};
36.420 + var params = options['params'] || {};
36.421 + var includeFields = options['includeFields'] || this.fieldsIncludedWithJsonPost;
36.422 + var url = urlOrForm;
36.423 +
36.424 + // If we were given a form, use its 'action' URL and pick out any requested field values
36.425 + if((typeof urlOrForm == 'object') && (ko.utils.tagNameLower(urlOrForm) === "form")) {
36.426 + var originalForm = urlOrForm;
36.427 + url = originalForm.action;
36.428 + for (var i = includeFields.length - 1; i >= 0; i--) {
36.429 + var fields = ko.utils.getFormFields(originalForm, includeFields[i]);
36.430 + for (var j = fields.length - 1; j >= 0; j--)
36.431 + params[fields[j].name] = fields[j].value;
36.432 + }
36.433 + }
36.434 +
36.435 + data = ko.utils.unwrapObservable(data);
36.436 + var form = document.createElement("form");
36.437 + form.style.display = "none";
36.438 + form.action = url;
36.439 + form.method = "post";
36.440 + for (var key in data) {
36.441 + var input = document.createElement("input");
36.442 + input.name = key;
36.443 + input.value = ko.utils.stringifyJson(ko.utils.unwrapObservable(data[key]));
36.444 + form.appendChild(input);
36.445 + }
36.446 + for (var key in params) {
36.447 + var input = document.createElement("input");
36.448 + input.name = key;
36.449 + input.value = params[key];
36.450 + form.appendChild(input);
36.451 + }
36.452 + document.body.appendChild(form);
36.453 + options['submitter'] ? options['submitter'](form) : form.submit();
36.454 + setTimeout(function () { form.parentNode.removeChild(form); }, 0);
36.455 + }
36.456 + }
36.457 +})();
36.458 +
36.459 +ko.exportSymbol('utils', ko.utils);
36.460 +ko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach);
36.461 +ko.exportSymbol('utils.arrayFirst', ko.utils.arrayFirst);
36.462 +ko.exportSymbol('utils.arrayFilter', ko.utils.arrayFilter);
36.463 +ko.exportSymbol('utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues);
36.464 +ko.exportSymbol('utils.arrayIndexOf', ko.utils.arrayIndexOf);
36.465 +ko.exportSymbol('utils.arrayMap', ko.utils.arrayMap);
36.466 +ko.exportSymbol('utils.arrayPushAll', ko.utils.arrayPushAll);
36.467 +ko.exportSymbol('utils.arrayRemoveItem', ko.utils.arrayRemoveItem);
36.468 +ko.exportSymbol('utils.extend', ko.utils.extend);
36.469 +ko.exportSymbol('utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost);
36.470 +ko.exportSymbol('utils.getFormFields', ko.utils.getFormFields);
36.471 +ko.exportSymbol('utils.postJson', ko.utils.postJson);
36.472 +ko.exportSymbol('utils.parseJson', ko.utils.parseJson);
36.473 +ko.exportSymbol('utils.registerEventHandler', ko.utils.registerEventHandler);
36.474 +ko.exportSymbol('utils.stringifyJson', ko.utils.stringifyJson);
36.475 +ko.exportSymbol('utils.range', ko.utils.range);
36.476 +ko.exportSymbol('utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass);
36.477 +ko.exportSymbol('utils.triggerEvent', ko.utils.triggerEvent);
36.478 +ko.exportSymbol('utils.unwrapObservable', ko.utils.unwrapObservable);
36.479 +
36.480 +if (!Function.prototype['bind']) {
36.481 + // Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf)
36.482 + // In case the browser doesn't implement it natively, provide a JavaScript implementation. This implementation is based on the one in prototype.js
36.483 + Function.prototype['bind'] = function (object) {
36.484 + var originalFunction = this, args = Array.prototype.slice.call(arguments), object = args.shift();
36.485 + return function () {
36.486 + return originalFunction.apply(object, args.concat(Array.prototype.slice.call(arguments)));
36.487 + };
36.488 + };
36.489 +}
36.490 +
36.491 +ko.utils.domData = new (function () {
36.492 + var uniqueId = 0;
36.493 + var dataStoreKeyExpandoPropertyName = "__ko__" + (new Date).getTime();
36.494 + var dataStore = {};
36.495 + return {
36.496 + get: function (node, key) {
36.497 + var allDataForNode = ko.utils.domData.getAll(node, false);
36.498 + return allDataForNode === undefined ? undefined : allDataForNode[key];
36.499 + },
36.500 + set: function (node, key, value) {
36.501 + if (value === undefined) {
36.502 + // Make sure we don't actually create a new domData key if we are actually deleting a value
36.503 + if (ko.utils.domData.getAll(node, false) === undefined)
36.504 + return;
36.505 + }
36.506 + var allDataForNode = ko.utils.domData.getAll(node, true);
36.507 + allDataForNode[key] = value;
36.508 + },
36.509 + getAll: function (node, createIfNotFound) {
36.510 + var dataStoreKey = node[dataStoreKeyExpandoPropertyName];
36.511 + var hasExistingDataStore = dataStoreKey && (dataStoreKey !== "null");
36.512 + if (!hasExistingDataStore) {
36.513 + if (!createIfNotFound)
36.514 + return undefined;
36.515 + dataStoreKey = node[dataStoreKeyExpandoPropertyName] = "ko" + uniqueId++;
36.516 + dataStore[dataStoreKey] = {};
36.517 + }
36.518 + return dataStore[dataStoreKey];
36.519 + },
36.520 + clear: function (node) {
36.521 + var dataStoreKey = node[dataStoreKeyExpandoPropertyName];
36.522 + if (dataStoreKey) {
36.523 + delete dataStore[dataStoreKey];
36.524 + node[dataStoreKeyExpandoPropertyName] = null;
36.525 + }
36.526 + }
36.527 + }
36.528 +})();
36.529 +
36.530 +ko.exportSymbol('utils.domData', ko.utils.domData);
36.531 +ko.exportSymbol('utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully
36.532 +
36.533 +ko.utils.domNodeDisposal = new (function () {
36.534 + var domDataKey = "__ko_domNodeDisposal__" + (new Date).getTime();
36.535 + var cleanableNodeTypes = { 1: true, 8: true, 9: true }; // Element, Comment, Document
36.536 + var cleanableNodeTypesWithDescendants = { 1: true, 9: true }; // Element, Document
36.537 +
36.538 + function getDisposeCallbacksCollection(node, createIfNotFound) {
36.539 + var allDisposeCallbacks = ko.utils.domData.get(node, domDataKey);
36.540 + if ((allDisposeCallbacks === undefined) && createIfNotFound) {
36.541 + allDisposeCallbacks = [];
36.542 + ko.utils.domData.set(node, domDataKey, allDisposeCallbacks);
36.543 + }
36.544 + return allDisposeCallbacks;
36.545 + }
36.546 + function destroyCallbacksCollection(node) {
36.547 + ko.utils.domData.set(node, domDataKey, undefined);
36.548 + }
36.549 +
36.550 + function cleanSingleNode(node) {
36.551 + // Run all the dispose callbacks
36.552 + var callbacks = getDisposeCallbacksCollection(node, false);
36.553 + if (callbacks) {
36.554 + callbacks = callbacks.slice(0); // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)
36.555 + for (var i = 0; i < callbacks.length; i++)
36.556 + callbacks[i](node);
36.557 + }
36.558 +
36.559 + // Also erase the DOM data
36.560 + ko.utils.domData.clear(node);
36.561 +
36.562 + // Special support for jQuery here because it's so commonly used.
36.563 + // Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData
36.564 + // so notify it to tear down any resources associated with the node & descendants here.
36.565 + if ((typeof jQuery == "function") && (typeof jQuery['cleanData'] == "function"))
36.566 + jQuery['cleanData']([node]);
36.567 +
36.568 + // Also clear any immediate-child comment nodes, as these wouldn't have been found by
36.569 + // node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements)
36.570 + if (cleanableNodeTypesWithDescendants[node.nodeType])
36.571 + cleanImmediateCommentTypeChildren(node);
36.572 + }
36.573 +
36.574 + function cleanImmediateCommentTypeChildren(nodeWithChildren) {
36.575 + var child, nextChild = nodeWithChildren.firstChild;
36.576 + while (child = nextChild) {
36.577 + nextChild = child.nextSibling;
36.578 + if (child.nodeType === 8)
36.579 + cleanSingleNode(child);
36.580 + }
36.581 + }
36.582 +
36.583 + return {
36.584 + addDisposeCallback : function(node, callback) {
36.585 + if (typeof callback != "function")
36.586 + throw new Error("Callback must be a function");
36.587 + getDisposeCallbacksCollection(node, true).push(callback);
36.588 + },
36.589 +
36.590 + removeDisposeCallback : function(node, callback) {
36.591 + var callbacksCollection = getDisposeCallbacksCollection(node, false);
36.592 + if (callbacksCollection) {
36.593 + ko.utils.arrayRemoveItem(callbacksCollection, callback);
36.594 + if (callbacksCollection.length == 0)
36.595 + destroyCallbacksCollection(node);
36.596 + }
36.597 + },
36.598 +
36.599 + cleanNode : function(node) {
36.600 + // First clean this node, where applicable
36.601 + if (cleanableNodeTypes[node.nodeType]) {
36.602 + cleanSingleNode(node);
36.603 +
36.604 + // ... then its descendants, where applicable
36.605 + if (cleanableNodeTypesWithDescendants[node.nodeType]) {
36.606 + // Clone the descendants list in case it changes during iteration
36.607 + var descendants = [];
36.608 + ko.utils.arrayPushAll(descendants, node.getElementsByTagName("*"));
36.609 + for (var i = 0, j = descendants.length; i < j; i++)
36.610 + cleanSingleNode(descendants[i]);
36.611 + }
36.612 + }
36.613 + },
36.614 +
36.615 + removeNode : function(node) {
36.616 + ko.cleanNode(node);
36.617 + if (node.parentNode)
36.618 + node.parentNode.removeChild(node);
36.619 + }
36.620 + }
36.621 +})();
36.622 +ko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for convenience
36.623 +ko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience
36.624 +ko.exportSymbol('cleanNode', ko.cleanNode);
36.625 +ko.exportSymbol('removeNode', ko.removeNode);
36.626 +ko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal);
36.627 +ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);
36.628 +ko.exportSymbol('utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback);
36.629 +(function () {
36.630 + var leadingCommentRegex = /^(\s*)<!--(.*?)-->/;
36.631 +
36.632 + function simpleHtmlParse(html) {
36.633 + // Based on jQuery's "clean" function, but only accounting for table-related elements.
36.634 + // If you have referenced jQuery, this won't be used anyway - KO will use jQuery's "clean" function directly
36.635 +
36.636 + // Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of
36.637 + // a descendant node. For example: "<div><!-- mycomment -->abc</div>" will get parsed as "<div>abc</div>"
36.638 + // This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node
36.639 + // (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present.
36.640 +
36.641 + // Trim whitespace, otherwise indexOf won't work as expected
36.642 + var tags = ko.utils.stringTrim(html).toLowerCase(), div = document.createElement("div");
36.643 +
36.644 + // Finds the first match from the left column, and returns the corresponding "wrap" data from the right column
36.645 + var wrap = tags.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] ||
36.646 + !tags.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] ||
36.647 + (!tags.indexOf("<td") || !tags.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
36.648 + /* anything else */ [0, "", ""];
36.649 +
36.650 + // Go to html and back, then peel off extra wrappers
36.651 + // Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness.
36.652 + var markup = "ignored<div>" + wrap[1] + html + wrap[2] + "</div>";
36.653 + if (typeof window['innerShiv'] == "function") {
36.654 + div.appendChild(window['innerShiv'](markup));
36.655 + } else {
36.656 + div.innerHTML = markup;
36.657 + }
36.658 +
36.659 + // Move to the right depth
36.660 + while (wrap[0]--)
36.661 + div = div.lastChild;
36.662 +
36.663 + return ko.utils.makeArray(div.lastChild.childNodes);
36.664 + }
36.665 +
36.666 + function jQueryHtmlParse(html) {
36.667 + var elems = jQuery['clean']([html]);
36.668 +
36.669 + // As of jQuery 1.7.1, jQuery parses the HTML by appending it to some dummy parent nodes held in an in-memory document fragment.
36.670 + // Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time.
36.671 + // Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment.
36.672 + if (elems && elems[0]) {
36.673 + // Find the top-most parent element that's a direct child of a document fragment
36.674 + var elem = elems[0];
36.675 + while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */)
36.676 + elem = elem.parentNode;
36.677 + // ... then detach it
36.678 + if (elem.parentNode)
36.679 + elem.parentNode.removeChild(elem);
36.680 + }
36.681 +
36.682 + return elems;
36.683 + }
36.684 +
36.685 + ko.utils.parseHtmlFragment = function(html) {
36.686 + return typeof jQuery != 'undefined' ? jQueryHtmlParse(html) // As below, benefit from jQuery's optimisations where possible
36.687 + : simpleHtmlParse(html); // ... otherwise, this simple logic will do in most common cases.
36.688 + };
36.689 +
36.690 + ko.utils.setHtml = function(node, html) {
36.691 + ko.utils.emptyDomNode(node);
36.692 +
36.693 + if ((html !== null) && (html !== undefined)) {
36.694 + if (typeof html != 'string')
36.695 + html = html.toString();
36.696 +
36.697 + // jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,
36.698 + // for example <tr> elements which are not normally allowed to exist on their own.
36.699 + // If you've referenced jQuery we'll use that rather than duplicating its code.
36.700 + if (typeof jQuery != 'undefined') {
36.701 + jQuery(node)['html'](html);
36.702 + } else {
36.703 + // ... otherwise, use KO's own parsing logic.
36.704 + var parsedNodes = ko.utils.parseHtmlFragment(html);
36.705 + for (var i = 0; i < parsedNodes.length; i++)
36.706 + node.appendChild(parsedNodes[i]);
36.707 + }
36.708 + }
36.709 + };
36.710 +})();
36.711 +
36.712 +ko.exportSymbol('utils.parseHtmlFragment', ko.utils.parseHtmlFragment);
36.713 +ko.exportSymbol('utils.setHtml', ko.utils.setHtml);
36.714 +
36.715 +ko.memoization = (function () {
36.716 + var memos = {};
36.717 +
36.718 + function randomMax8HexChars() {
36.719 + return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);
36.720 + }
36.721 + function generateRandomId() {
36.722 + return randomMax8HexChars() + randomMax8HexChars();
36.723 + }
36.724 + function findMemoNodes(rootNode, appendToArray) {
36.725 + if (!rootNode)
36.726 + return;
36.727 + if (rootNode.nodeType == 8) {
36.728 + var memoId = ko.memoization.parseMemoText(rootNode.nodeValue);
36.729 + if (memoId != null)
36.730 + appendToArray.push({ domNode: rootNode, memoId: memoId });
36.731 + } else if (rootNode.nodeType == 1) {
36.732 + for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++)
36.733 + findMemoNodes(childNodes[i], appendToArray);
36.734 + }
36.735 + }
36.736 +
36.737 + return {
36.738 + memoize: function (callback) {
36.739 + if (typeof callback != "function")
36.740 + throw new Error("You can only pass a function to ko.memoization.memoize()");
36.741 + var memoId = generateRandomId();
36.742 + memos[memoId] = callback;
36.743 + return "<!--[ko_memo:" + memoId + "]-->";
36.744 + },
36.745 +
36.746 + unmemoize: function (memoId, callbackParams) {
36.747 + var callback = memos[memoId];
36.748 + if (callback === undefined)
36.749 + throw new Error("Couldn't find any memo with ID " + memoId + ". Perhaps it's already been unmemoized.");
36.750 + try {
36.751 + callback.apply(null, callbackParams || []);
36.752 + return true;
36.753 + }
36.754 + finally { delete memos[memoId]; }
36.755 + },
36.756 +
36.757 + unmemoizeDomNodeAndDescendants: function (domNode, extraCallbackParamsArray) {
36.758 + var memos = [];
36.759 + findMemoNodes(domNode, memos);
36.760 + for (var i = 0, j = memos.length; i < j; i++) {
36.761 + var node = memos[i].domNode;
36.762 + var combinedParams = [node];
36.763 + if (extraCallbackParamsArray)
36.764 + ko.utils.arrayPushAll(combinedParams, extraCallbackParamsArray);
36.765 + ko.memoization.unmemoize(memos[i].memoId, combinedParams);
36.766 + node.nodeValue = ""; // Neuter this node so we don't try to unmemoize it again
36.767 + if (node.parentNode)
36.768 + node.parentNode.removeChild(node); // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again)
36.769 + }
36.770 + },
36.771 +
36.772 + parseMemoText: function (memoText) {
36.773 + var match = memoText.match(/^\[ko_memo\:(.*?)\]$/);
36.774 + return match ? match[1] : null;
36.775 + }
36.776 + };
36.777 +})();
36.778 +
36.779 +ko.exportSymbol('memoization', ko.memoization);
36.780 +ko.exportSymbol('memoization.memoize', ko.memoization.memoize);
36.781 +ko.exportSymbol('memoization.unmemoize', ko.memoization.unmemoize);
36.782 +ko.exportSymbol('memoization.parseMemoText', ko.memoization.parseMemoText);
36.783 +ko.exportSymbol('memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants);
36.784 +ko.extenders = {
36.785 + 'throttle': function(target, timeout) {
36.786 + // Throttling means two things:
36.787 +
36.788 + // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies
36.789 + // notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate
36.790 + target['throttleEvaluation'] = timeout;
36.791 +
36.792 + // (2) For writable targets (observables, or writable dependent observables), we throttle *writes*
36.793 + // so the target cannot change value synchronously or faster than a certain rate
36.794 + var writeTimeoutInstance = null;
36.795 + return ko.dependentObservable({
36.796 + 'read': target,
36.797 + 'write': function(value) {
36.798 + clearTimeout(writeTimeoutInstance);
36.799 + writeTimeoutInstance = setTimeout(function() {
36.800 + target(value);
36.801 + }, timeout);
36.802 + }
36.803 + });
36.804 + },
36.805 +
36.806 + 'notify': function(target, notifyWhen) {
36.807 + target["equalityComparer"] = notifyWhen == "always"
36.808 + ? function() { return false } // Treat all values as not equal
36.809 + : ko.observable["fn"]["equalityComparer"];
36.810 + return target;
36.811 + }
36.812 +};
36.813 +
36.814 +function applyExtenders(requestedExtenders) {
36.815 + var target = this;
36.816 + if (requestedExtenders) {
36.817 + for (var key in requestedExtenders) {
36.818 + var extenderHandler = ko.extenders[key];
36.819 + if (typeof extenderHandler == 'function') {
36.820 + target = extenderHandler(target, requestedExtenders[key]);
36.821 + }
36.822 + }
36.823 + }
36.824 + return target;
36.825 +}
36.826 +
36.827 +ko.exportSymbol('extenders', ko.extenders);
36.828 +
36.829 +ko.subscription = function (target, callback, disposeCallback) {
36.830 + this.target = target;
36.831 + this.callback = callback;
36.832 + this.disposeCallback = disposeCallback;
36.833 + ko.exportProperty(this, 'dispose', this.dispose);
36.834 +};
36.835 +ko.subscription.prototype.dispose = function () {
36.836 + this.isDisposed = true;
36.837 + this.disposeCallback();
36.838 +};
36.839 +
36.840 +ko.subscribable = function () {
36.841 + this._subscriptions = {};
36.842 +
36.843 + ko.utils.extend(this, ko.subscribable['fn']);
36.844 + ko.exportProperty(this, 'subscribe', this.subscribe);
36.845 + ko.exportProperty(this, 'extend', this.extend);
36.846 + ko.exportProperty(this, 'getSubscriptionsCount', this.getSubscriptionsCount);
36.847 +}
36.848 +
36.849 +var defaultEvent = "change";
36.850 +
36.851 +ko.subscribable['fn'] = {
36.852 + subscribe: function (callback, callbackTarget, event) {
36.853 + event = event || defaultEvent;
36.854 + var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback;
36.855 +
36.856 + var subscription = new ko.subscription(this, boundCallback, function () {
36.857 + ko.utils.arrayRemoveItem(this._subscriptions[event], subscription);
36.858 + }.bind(this));
36.859 +
36.860 + if (!this._subscriptions[event])
36.861 + this._subscriptions[event] = [];
36.862 + this._subscriptions[event].push(subscription);
36.863 + return subscription;
36.864 + },
36.865 +
36.866 + "notifySubscribers": function (valueToNotify, event) {
36.867 + event = event || defaultEvent;
36.868 + if (this._subscriptions[event]) {
36.869 + ko.utils.arrayForEach(this._subscriptions[event].slice(0), function (subscription) {
36.870 + // In case a subscription was disposed during the arrayForEach cycle, check
36.871 + // for isDisposed on each subscription before invoking its callback
36.872 + if (subscription && (subscription.isDisposed !== true))
36.873 + subscription.callback(valueToNotify);
36.874 + });
36.875 + }
36.876 + },
36.877 +
36.878 + getSubscriptionsCount: function () {
36.879 + var total = 0;
36.880 + for (var eventName in this._subscriptions) {
36.881 + if (this._subscriptions.hasOwnProperty(eventName))
36.882 + total += this._subscriptions[eventName].length;
36.883 + }
36.884 + return total;
36.885 + },
36.886 +
36.887 + extend: applyExtenders
36.888 +};
36.889 +
36.890 +
36.891 +ko.isSubscribable = function (instance) {
36.892 + return typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function";
36.893 +};
36.894 +
36.895 +ko.exportSymbol('subscribable', ko.subscribable);
36.896 +ko.exportSymbol('isSubscribable', ko.isSubscribable);
36.897 +
36.898 +ko.dependencyDetection = (function () {
36.899 + var _frames = [];
36.900 +
36.901 + return {
36.902 + begin: function (callback) {
36.903 + _frames.push({ callback: callback, distinctDependencies:[] });
36.904 + },
36.905 +
36.906 + end: function () {
36.907 + _frames.pop();
36.908 + },
36.909 +
36.910 + registerDependency: function (subscribable) {
36.911 + if (!ko.isSubscribable(subscribable))
36.912 + throw new Error("Only subscribable things can act as dependencies");
36.913 + if (_frames.length > 0) {
36.914 + var topFrame = _frames[_frames.length - 1];
36.915 + if (ko.utils.arrayIndexOf(topFrame.distinctDependencies, subscribable) >= 0)
36.916 + return;
36.917 + topFrame.distinctDependencies.push(subscribable);
36.918 + topFrame.callback(subscribable);
36.919 + }
36.920 + }
36.921 + };
36.922 +})();
36.923 +var primitiveTypes = { 'undefined':true, 'boolean':true, 'number':true, 'string':true };
36.924 +
36.925 +ko.observable = function (initialValue) {
36.926 + var _latestValue = initialValue;
36.927 +
36.928 + function observable() {
36.929 + if (arguments.length > 0) {
36.930 + // Write
36.931 +
36.932 + // Ignore writes if the value hasn't changed
36.933 + if ((!observable['equalityComparer']) || !observable['equalityComparer'](_latestValue, arguments[0])) {
36.934 + observable.valueWillMutate();
36.935 + _latestValue = arguments[0];
36.936 + if (DEBUG) observable._latestValue = _latestValue;
36.937 + observable.valueHasMutated();
36.938 + }
36.939 + return this; // Permits chained assignments
36.940 + }
36.941 + else {
36.942 + // Read
36.943 + ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a "read" operation
36.944 + return _latestValue;
36.945 + }
36.946 + }
36.947 + if (DEBUG) observable._latestValue = _latestValue;
36.948 + ko.subscribable.call(observable);
36.949 + observable.valueHasMutated = function () { observable["notifySubscribers"](_latestValue); }
36.950 + observable.valueWillMutate = function () { observable["notifySubscribers"](_latestValue, "beforeChange"); }
36.951 + ko.utils.extend(observable, ko.observable['fn']);
36.952 +
36.953 + ko.exportProperty(observable, "valueHasMutated", observable.valueHasMutated);
36.954 + ko.exportProperty(observable, "valueWillMutate", observable.valueWillMutate);
36.955 +
36.956 + return observable;
36.957 +}
36.958 +
36.959 +ko.observable['fn'] = {
36.960 + "equalityComparer": function valuesArePrimitiveAndEqual(a, b) {
36.961 + var oldValueIsPrimitive = (a === null) || (typeof(a) in primitiveTypes);
36.962 + return oldValueIsPrimitive ? (a === b) : false;
36.963 + }
36.964 +};
36.965 +
36.966 +var protoProperty = ko.observable.protoProperty = "__ko_proto__";
36.967 +ko.observable['fn'][protoProperty] = ko.observable;
36.968 +
36.969 +ko.hasPrototype = function(instance, prototype) {
36.970 + if ((instance === null) || (instance === undefined) || (instance[protoProperty] === undefined)) return false;
36.971 + if (instance[protoProperty] === prototype) return true;
36.972 + return ko.hasPrototype(instance[protoProperty], prototype); // Walk the prototype chain
36.973 +};
36.974 +
36.975 +ko.isObservable = function (instance) {
36.976 + return ko.hasPrototype(instance, ko.observable);
36.977 +}
36.978 +ko.isWriteableObservable = function (instance) {
36.979 + // Observable
36.980 + if ((typeof instance == "function") && instance[protoProperty] === ko.observable)
36.981 + return true;
36.982 + // Writeable dependent observable
36.983 + if ((typeof instance == "function") && (instance[protoProperty] === ko.dependentObservable) && (instance.hasWriteFunction))
36.984 + return true;
36.985 + // Anything else
36.986 + return false;
36.987 +}
36.988 +
36.989 +
36.990 +ko.exportSymbol('observable', ko.observable);
36.991 +ko.exportSymbol('isObservable', ko.isObservable);
36.992 +ko.exportSymbol('isWriteableObservable', ko.isWriteableObservable);
36.993 +ko.observableArray = function (initialValues) {
36.994 + if (arguments.length == 0) {
36.995 + // Zero-parameter constructor initializes to empty array
36.996 + initialValues = [];
36.997 + }
36.998 + if ((initialValues !== null) && (initialValues !== undefined) && !('length' in initialValues))
36.999 + throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
36.1000 +
36.1001 + var result = ko.observable(initialValues);
36.1002 + ko.utils.extend(result, ko.observableArray['fn']);
36.1003 + return result;
36.1004 +}
36.1005 +
36.1006 +ko.observableArray['fn'] = {
36.1007 + 'remove': function (valueOrPredicate) {
36.1008 + var underlyingArray = this();
36.1009 + var removedValues = [];
36.1010 + var predicate = typeof valueOrPredicate == "function" ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
36.1011 + for (var i = 0; i < underlyingArray.length; i++) {
36.1012 + var value = underlyingArray[i];
36.1013 + if (predicate(value)) {
36.1014 + if (removedValues.length === 0) {
36.1015 + this.valueWillMutate();
36.1016 + }
36.1017 + removedValues.push(value);
36.1018 + underlyingArray.splice(i, 1);
36.1019 + i--;
36.1020 + }
36.1021 + }
36.1022 + if (removedValues.length) {
36.1023 + this.valueHasMutated();
36.1024 + }
36.1025 + return removedValues;
36.1026 + },
36.1027 +
36.1028 + 'removeAll': function (arrayOfValues) {
36.1029 + // If you passed zero args, we remove everything
36.1030 + if (arrayOfValues === undefined) {
36.1031 + var underlyingArray = this();
36.1032 + var allValues = underlyingArray.slice(0);
36.1033 + this.valueWillMutate();
36.1034 + underlyingArray.splice(0, underlyingArray.length);
36.1035 + this.valueHasMutated();
36.1036 + return allValues;
36.1037 + }
36.1038 + // If you passed an arg, we interpret it as an array of entries to remove
36.1039 + if (!arrayOfValues)
36.1040 + return [];
36.1041 + return this['remove'](function (value) {
36.1042 + return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;
36.1043 + });
36.1044 + },
36.1045 +
36.1046 + 'destroy': function (valueOrPredicate) {
36.1047 + var underlyingArray = this();
36.1048 + var predicate = typeof valueOrPredicate == "function" ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
36.1049 + this.valueWillMutate();
36.1050 + for (var i = underlyingArray.length - 1; i >= 0; i--) {
36.1051 + var value = underlyingArray[i];
36.1052 + if (predicate(value))
36.1053 + underlyingArray[i]["_destroy"] = true;
36.1054 + }
36.1055 + this.valueHasMutated();
36.1056 + },
36.1057 +
36.1058 + 'destroyAll': function (arrayOfValues) {
36.1059 + // If you passed zero args, we destroy everything
36.1060 + if (arrayOfValues === undefined)
36.1061 + return this['destroy'](function() { return true });
36.1062 +
36.1063 + // If you passed an arg, we interpret it as an array of entries to destroy
36.1064 + if (!arrayOfValues)
36.1065 + return [];
36.1066 + return this['destroy'](function (value) {
36.1067 + return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;
36.1068 + });
36.1069 + },
36.1070 +
36.1071 + 'indexOf': function (item) {
36.1072 + var underlyingArray = this();
36.1073 + return ko.utils.arrayIndexOf(underlyingArray, item);
36.1074 + },
36.1075 +
36.1076 + 'replace': function(oldItem, newItem) {
36.1077 + var index = this['indexOf'](oldItem);
36.1078 + if (index >= 0) {
36.1079 + this.valueWillMutate();
36.1080 + this()[index] = newItem;
36.1081 + this.valueHasMutated();
36.1082 + }
36.1083 + }
36.1084 +}
36.1085 +
36.1086 +// Populate ko.observableArray.fn with read/write functions from native arrays
36.1087 +ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) {
36.1088 + ko.observableArray['fn'][methodName] = function () {
36.1089 + var underlyingArray = this();
36.1090 + this.valueWillMutate();
36.1091 + var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);
36.1092 + this.valueHasMutated();
36.1093 + return methodCallResult;
36.1094 + };
36.1095 +});
36.1096 +
36.1097 +// Populate ko.observableArray.fn with read-only functions from native arrays
36.1098 +ko.utils.arrayForEach(["slice"], function (methodName) {
36.1099 + ko.observableArray['fn'][methodName] = function () {
36.1100 + var underlyingArray = this();
36.1101 + return underlyingArray[methodName].apply(underlyingArray, arguments);
36.1102 + };
36.1103 +});
36.1104 +
36.1105 +ko.exportSymbol('observableArray', ko.observableArray);
36.1106 +ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
36.1107 + var _latestValue,
36.1108 + _hasBeenEvaluated = false,
36.1109 + _isBeingEvaluated = false,
36.1110 + readFunction = evaluatorFunctionOrOptions;
36.1111 +
36.1112 + if (readFunction && typeof readFunction == "object") {
36.1113 + // Single-parameter syntax - everything is on this "options" param
36.1114 + options = readFunction;
36.1115 + readFunction = options["read"];
36.1116 + } else {
36.1117 + // Multi-parameter syntax - construct the options according to the params passed
36.1118 + options = options || {};
36.1119 + if (!readFunction)
36.1120 + readFunction = options["read"];
36.1121 + }
36.1122 + // By here, "options" is always non-null
36.1123 + if (typeof readFunction != "function")
36.1124 + throw new Error("Pass a function that returns the value of the ko.computed");
36.1125 +
36.1126 + var writeFunction = options["write"];
36.1127 + if (!evaluatorFunctionTarget)
36.1128 + evaluatorFunctionTarget = options["owner"];
36.1129 +
36.1130 + var _subscriptionsToDependencies = [];
36.1131 + function disposeAllSubscriptionsToDependencies() {
36.1132 + ko.utils.arrayForEach(_subscriptionsToDependencies, function (subscription) {
36.1133 + subscription.dispose();
36.1134 + });
36.1135 + _subscriptionsToDependencies = [];
36.1136 + }
36.1137 + var dispose = disposeAllSubscriptionsToDependencies;
36.1138 +
36.1139 + // Build "disposeWhenNodeIsRemoved" and "disposeWhenNodeIsRemovedCallback" option values
36.1140 + // (Note: "disposeWhenNodeIsRemoved" option both proactively disposes as soon as the node is removed using ko.removeNode(),
36.1141 + // plus adds a "disposeWhen" callback that, on each evaluation, disposes if the node was removed by some other means.)
36.1142 + var disposeWhenNodeIsRemoved = (typeof options["disposeWhenNodeIsRemoved"] == "object") ? options["disposeWhenNodeIsRemoved"] : null;
36.1143 + var disposeWhen = options["disposeWhen"] || function() { return false; };
36.1144 + if (disposeWhenNodeIsRemoved) {
36.1145 + dispose = function() {
36.1146 + ko.utils.domNodeDisposal.removeDisposeCallback(disposeWhenNodeIsRemoved, arguments.callee);
36.1147 + disposeAllSubscriptionsToDependencies();
36.1148 + };
36.1149 + ko.utils.domNodeDisposal.addDisposeCallback(disposeWhenNodeIsRemoved, dispose);
36.1150 + var existingDisposeWhenFunction = disposeWhen;
36.1151 + disposeWhen = function () {
36.1152 + return !ko.utils.domNodeIsAttachedToDocument(disposeWhenNodeIsRemoved) || existingDisposeWhenFunction();
36.1153 + }
36.1154 + }
36.1155 +
36.1156 + var evaluationTimeoutInstance = null;
36.1157 + function evaluatePossiblyAsync() {
36.1158 + var throttleEvaluationTimeout = dependentObservable['throttleEvaluation'];
36.1159 + if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) {
36.1160 + clearTimeout(evaluationTimeoutInstance);
36.1161 + evaluationTimeoutInstance = setTimeout(evaluateImmediate, throttleEvaluationTimeout);
36.1162 + } else
36.1163 + evaluateImmediate();
36.1164 + }
36.1165 +
36.1166 + function evaluateImmediate() {
36.1167 + if (_isBeingEvaluated) {
36.1168 + // If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.
36.1169 + // This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost
36.1170 + // certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing
36.1171 + // their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387
36.1172 + return;
36.1173 + }
36.1174 +
36.1175 + // Don't dispose on first evaluation, because the "disposeWhen" callback might
36.1176 + // e.g., dispose when the associated DOM element isn't in the doc, and it's not
36.1177 + // going to be in the doc until *after* the first evaluation
36.1178 + if (_hasBeenEvaluated && disposeWhen()) {
36.1179 + dispose();
36.1180 + return;
36.1181 + }
36.1182 +
36.1183 + _isBeingEvaluated = true;
36.1184 + try {
36.1185 + // Initially, we assume that none of the subscriptions are still being used (i.e., all are candidates for disposal).
36.1186 + // Then, during evaluation, we cross off any that are in fact still being used.
36.1187 + var disposalCandidates = ko.utils.arrayMap(_subscriptionsToDependencies, function(item) {return item.target;});
36.1188 +
36.1189 + ko.dependencyDetection.begin(function(subscribable) {
36.1190 + var inOld;
36.1191 + if ((inOld = ko.utils.arrayIndexOf(disposalCandidates, subscribable)) >= 0)
36.1192 + disposalCandidates[inOld] = undefined; // Don't want to dispose this subscription, as it's still being used
36.1193 + else
36.1194 + _subscriptionsToDependencies.push(subscribable.subscribe(evaluatePossiblyAsync)); // Brand new subscription - add it
36.1195 + });
36.1196 +
36.1197 + var newValue = readFunction.call(evaluatorFunctionTarget);
36.1198 +
36.1199 + // For each subscription no longer being used, remove it from the active subscriptions list and dispose it
36.1200 + for (var i = disposalCandidates.length - 1; i >= 0; i--) {
36.1201 + if (disposalCandidates[i])
36.1202 + _subscriptionsToDependencies.splice(i, 1)[0].dispose();
36.1203 + }
36.1204 + _hasBeenEvaluated = true;
36.1205 +
36.1206 + dependentObservable["notifySubscribers"](_latestValue, "beforeChange");
36.1207 + _latestValue = newValue;
36.1208 + if (DEBUG) dependentObservable._latestValue = _latestValue;
36.1209 + } finally {
36.1210 + ko.dependencyDetection.end();
36.1211 + }
36.1212 +
36.1213 + dependentObservable["notifySubscribers"](_latestValue);
36.1214 + _isBeingEvaluated = false;
36.1215 +
36.1216 + }
36.1217 +
36.1218 + function dependentObservable() {
36.1219 + if (arguments.length > 0) {
36.1220 + set.apply(dependentObservable, arguments);
36.1221 + } else {
36.1222 + return get();
36.1223 + }
36.1224 + }
36.1225 +
36.1226 + function set() {
36.1227 + if (typeof writeFunction === "function") {
36.1228 + // Writing a value
36.1229 + writeFunction.apply(evaluatorFunctionTarget, arguments);
36.1230 + } else {
36.1231 + throw new 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.");
36.1232 + }
36.1233 + }
36.1234 +
36.1235 + function get() {
36.1236 + // Reading the value
36.1237 + if (!_hasBeenEvaluated)
36.1238 + evaluateImmediate();
36.1239 + ko.dependencyDetection.registerDependency(dependentObservable);
36.1240 + return _latestValue;
36.1241 + }
36.1242 +
36.1243 + dependentObservable.getDependenciesCount = function () { return _subscriptionsToDependencies.length; };
36.1244 + dependentObservable.hasWriteFunction = typeof options["write"] === "function";
36.1245 + dependentObservable.dispose = function () { dispose(); };
36.1246 +
36.1247 + ko.subscribable.call(dependentObservable);
36.1248 + ko.utils.extend(dependentObservable, ko.dependentObservable['fn']);
36.1249 +
36.1250 + if (options['deferEvaluation'] !== true)
36.1251 + evaluateImmediate();
36.1252 +
36.1253 + ko.exportProperty(dependentObservable, 'dispose', dependentObservable.dispose);
36.1254 + ko.exportProperty(dependentObservable, 'getDependenciesCount', dependentObservable.getDependenciesCount);
36.1255 +
36.1256 + return dependentObservable;
36.1257 +};
36.1258 +
36.1259 +ko.isComputed = function(instance) {
36.1260 + return ko.hasPrototype(instance, ko.dependentObservable);
36.1261 +};
36.1262 +
36.1263 +var protoProp = ko.observable.protoProperty; // == "__ko_proto__"
36.1264 +ko.dependentObservable[protoProp] = ko.observable;
36.1265 +
36.1266 +ko.dependentObservable['fn'] = {};
36.1267 +ko.dependentObservable['fn'][protoProp] = ko.dependentObservable;
36.1268 +
36.1269 +ko.exportSymbol('dependentObservable', ko.dependentObservable);
36.1270 +ko.exportSymbol('computed', ko.dependentObservable); // Make "ko.computed" an alias for "ko.dependentObservable"
36.1271 +ko.exportSymbol('isComputed', ko.isComputed);
36.1272 +
36.1273 +(function() {
36.1274 + var maxNestedObservableDepth = 10; // Escape the (unlikely) pathalogical case where an observable's current value is itself (or similar reference cycle)
36.1275 +
36.1276 + ko.toJS = function(rootObject) {
36.1277 + if (arguments.length == 0)
36.1278 + throw new Error("When calling ko.toJS, pass the object you want to convert.");
36.1279 +
36.1280 + // We just unwrap everything at every level in the object graph
36.1281 + return mapJsObjectGraph(rootObject, function(valueToMap) {
36.1282 + // Loop because an observable's value might in turn be another observable wrapper
36.1283 + for (var i = 0; ko.isObservable(valueToMap) && (i < maxNestedObservableDepth); i++)
36.1284 + valueToMap = valueToMap();
36.1285 + return valueToMap;
36.1286 + });
36.1287 + };
36.1288 +
36.1289 + ko.toJSON = function(rootObject, replacer, space) { // replacer and space are optional
36.1290 + var plainJavaScriptObject = ko.toJS(rootObject);
36.1291 + return ko.utils.stringifyJson(plainJavaScriptObject, replacer, space);
36.1292 + };
36.1293 +
36.1294 + function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) {
36.1295 + visitedObjects = visitedObjects || new objectLookup();
36.1296 +
36.1297 + rootObject = mapInputCallback(rootObject);
36.1298 + var canHaveProperties = (typeof rootObject == "object") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date));
36.1299 + if (!canHaveProperties)
36.1300 + return rootObject;
36.1301 +
36.1302 + var outputProperties = rootObject instanceof Array ? [] : {};
36.1303 + visitedObjects.save(rootObject, outputProperties);
36.1304 +
36.1305 + visitPropertiesOrArrayEntries(rootObject, function(indexer) {
36.1306 + var propertyValue = mapInputCallback(rootObject[indexer]);
36.1307 +
36.1308 + switch (typeof propertyValue) {
36.1309 + case "boolean":
36.1310 + case "number":
36.1311 + case "string":
36.1312 + case "function":
36.1313 + outputProperties[indexer] = propertyValue;
36.1314 + break;
36.1315 + case "object":
36.1316 + case "undefined":
36.1317 + var previouslyMappedValue = visitedObjects.get(propertyValue);
36.1318 + outputProperties[indexer] = (previouslyMappedValue !== undefined)
36.1319 + ? previouslyMappedValue
36.1320 + : mapJsObjectGraph(propertyValue, mapInputCallback, visitedObjects);
36.1321 + break;
36.1322 + }
36.1323 + });
36.1324 +
36.1325 + return outputProperties;
36.1326 + }
36.1327 +
36.1328 + function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {
36.1329 + if (rootObject instanceof Array) {
36.1330 + for (var i = 0; i < rootObject.length; i++)
36.1331 + visitorCallback(i);
36.1332 +
36.1333 + // For arrays, also respect toJSON property for custom mappings (fixes #278)
36.1334 + if (typeof rootObject['toJSON'] == 'function')
36.1335 + visitorCallback('toJSON');
36.1336 + } else {
36.1337 + for (var propertyName in rootObject)
36.1338 + visitorCallback(propertyName);
36.1339 + }
36.1340 + };
36.1341 +
36.1342 + function objectLookup() {
36.1343 + var keys = [];
36.1344 + var values = [];
36.1345 + this.save = function(key, value) {
36.1346 + var existingIndex = ko.utils.arrayIndexOf(keys, key);
36.1347 + if (existingIndex >= 0)
36.1348 + values[existingIndex] = value;
36.1349 + else {
36.1350 + keys.push(key);
36.1351 + values.push(value);
36.1352 + }
36.1353 + };
36.1354 + this.get = function(key) {
36.1355 + var existingIndex = ko.utils.arrayIndexOf(keys, key);
36.1356 + return (existingIndex >= 0) ? values[existingIndex] : undefined;
36.1357 + };
36.1358 + };
36.1359 +})();
36.1360 +
36.1361 +ko.exportSymbol('toJS', ko.toJS);
36.1362 +ko.exportSymbol('toJSON', ko.toJSON);
36.1363 +(function () {
36.1364 + var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__';
36.1365 +
36.1366 + // Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values
36.1367 + // are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values
36.1368 + // that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.
36.1369 + ko.selectExtensions = {
36.1370 + readValue : function(element) {
36.1371 + switch (ko.utils.tagNameLower(element)) {
36.1372 + case 'option':
36.1373 + if (element[hasDomDataExpandoProperty] === true)
36.1374 + return ko.utils.domData.get(element, ko.bindingHandlers.options.optionValueDomDataKey);
36.1375 + return element.getAttribute("value");
36.1376 + case 'select':
36.1377 + return element.selectedIndex >= 0 ? ko.selectExtensions.readValue(element.options[element.selectedIndex]) : undefined;
36.1378 + default:
36.1379 + return element.value;
36.1380 + }
36.1381 + },
36.1382 +
36.1383 + writeValue: function(element, value) {
36.1384 + switch (ko.utils.tagNameLower(element)) {
36.1385 + case 'option':
36.1386 + switch(typeof value) {
36.1387 + case "string":
36.1388 + ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, undefined);
36.1389 + if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node
36.1390 + delete element[hasDomDataExpandoProperty];
36.1391 + }
36.1392 + element.value = value;
36.1393 + break;
36.1394 + default:
36.1395 + // Store arbitrary object using DomData
36.1396 + ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, value);
36.1397 + element[hasDomDataExpandoProperty] = true;
36.1398 +
36.1399 + // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.
36.1400 + element.value = typeof value === "number" ? value : "";
36.1401 + break;
36.1402 + }
36.1403 + break;
36.1404 + case 'select':
36.1405 + for (var i = element.options.length - 1; i >= 0; i--) {
36.1406 + if (ko.selectExtensions.readValue(element.options[i]) == value) {
36.1407 + element.selectedIndex = i;
36.1408 + break;
36.1409 + }
36.1410 + }
36.1411 + break;
36.1412 + default:
36.1413 + if ((value === null) || (value === undefined))
36.1414 + value = "";
36.1415 + element.value = value;
36.1416 + break;
36.1417 + }
36.1418 + }
36.1419 + };
36.1420 +})();
36.1421 +
36.1422 +ko.exportSymbol('selectExtensions', ko.selectExtensions);
36.1423 +ko.exportSymbol('selectExtensions.readValue', ko.selectExtensions.readValue);
36.1424 +ko.exportSymbol('selectExtensions.writeValue', ko.selectExtensions.writeValue);
36.1425 +
36.1426 +ko.jsonExpressionRewriting = (function () {
36.1427 + var restoreCapturedTokensRegex = /\@ko_token_(\d+)\@/g;
36.1428 + var javaScriptAssignmentTarget = /^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i;
36.1429 + var javaScriptReservedWords = ["true", "false"];
36.1430 +
36.1431 + function restoreTokens(string, tokens) {
36.1432 + var prevValue = null;
36.1433 + while (string != prevValue) { // Keep restoring tokens until it no longer makes a difference (they may be nested)
36.1434 + prevValue = string;
36.1435 + string = string.replace(restoreCapturedTokensRegex, function (match, tokenIndex) {
36.1436 + return tokens[tokenIndex];
36.1437 + });
36.1438 + }
36.1439 + return string;
36.1440 + }
36.1441 +
36.1442 + function isWriteableValue(expression) {
36.1443 + if (ko.utils.arrayIndexOf(javaScriptReservedWords, ko.utils.stringTrim(expression).toLowerCase()) >= 0)
36.1444 + return false;
36.1445 + return expression.match(javaScriptAssignmentTarget) !== null;
36.1446 + }
36.1447 +
36.1448 + function ensureQuoted(key) {
36.1449 + var trimmedKey = ko.utils.stringTrim(key);
36.1450 + switch (trimmedKey.length && trimmedKey.charAt(0)) {
36.1451 + case "'":
36.1452 + case '"':
36.1453 + return key;
36.1454 + default:
36.1455 + return "'" + trimmedKey + "'";
36.1456 + }
36.1457 + }
36.1458 +
36.1459 + return {
36.1460 + bindingRewriteValidators: [],
36.1461 +
36.1462 + parseObjectLiteral: function(objectLiteralString) {
36.1463 + // A full tokeniser+lexer would add too much weight to this library, so here's a simple parser
36.1464 + // that is sufficient just to split an object literal string into a set of top-level key-value pairs
36.1465 +
36.1466 + var str = ko.utils.stringTrim(objectLiteralString);
36.1467 + if (str.length < 3)
36.1468 + return [];
36.1469 + if (str.charAt(0) === "{")// Ignore any braces surrounding the whole object literal
36.1470 + str = str.substring(1, str.length - 1);
36.1471 +
36.1472 + // Pull out any string literals and regex literals
36.1473 + var tokens = [];
36.1474 + var tokenStart = null, tokenEndChar;
36.1475 + for (var position = 0; position < str.length; position++) {
36.1476 + var c = str.charAt(position);
36.1477 + if (tokenStart === null) {
36.1478 + switch (c) {
36.1479 + case '"':
36.1480 + case "'":
36.1481 + case "/":
36.1482 + tokenStart = position;
36.1483 + tokenEndChar = c;
36.1484 + break;
36.1485 + }
36.1486 + } else if ((c == tokenEndChar) && (str.charAt(position - 1) !== "\\")) {
36.1487 + var token = str.substring(tokenStart, position + 1);
36.1488 + tokens.push(token);
36.1489 + var replacement = "@ko_token_" + (tokens.length - 1) + "@";
36.1490 + str = str.substring(0, tokenStart) + replacement + str.substring(position + 1);
36.1491 + position -= (token.length - replacement.length);
36.1492 + tokenStart = null;
36.1493 + }
36.1494 + }
36.1495 +
36.1496 + // Next pull out balanced paren, brace, and bracket blocks
36.1497 + tokenStart = null;
36.1498 + tokenEndChar = null;
36.1499 + var tokenDepth = 0, tokenStartChar = null;
36.1500 + for (var position = 0; position < str.length; position++) {
36.1501 + var c = str.charAt(position);
36.1502 + if (tokenStart === null) {
36.1503 + switch (c) {
36.1504 + case "{": tokenStart = position; tokenStartChar = c;
36.1505 + tokenEndChar = "}";
36.1506 + break;
36.1507 + case "(": tokenStart = position; tokenStartChar = c;
36.1508 + tokenEndChar = ")";
36.1509 + break;
36.1510 + case "[": tokenStart = position; tokenStartChar = c;
36.1511 + tokenEndChar = "]";
36.1512 + break;
36.1513 + }
36.1514 + }
36.1515 +
36.1516 + if (c === tokenStartChar)
36.1517 + tokenDepth++;
36.1518 + else if (c === tokenEndChar) {
36.1519 + tokenDepth--;
36.1520 + if (tokenDepth === 0) {
36.1521 + var token = str.substring(tokenStart, position + 1);
36.1522 + tokens.push(token);
36.1523 + var replacement = "@ko_token_" + (tokens.length - 1) + "@";
36.1524 + str = str.substring(0, tokenStart) + replacement + str.substring(position + 1);
36.1525 + position -= (token.length - replacement.length);
36.1526 + tokenStart = null;
36.1527 + }
36.1528 + }
36.1529 + }
36.1530 +
36.1531 + // Now we can safely split on commas to get the key/value pairs
36.1532 + var result = [];
36.1533 + var keyValuePairs = str.split(",");
36.1534 + for (var i = 0, j = keyValuePairs.length; i < j; i++) {
36.1535 + var pair = keyValuePairs[i];
36.1536 + var colonPos = pair.indexOf(":");
36.1537 + if ((colonPos > 0) && (colonPos < pair.length - 1)) {
36.1538 + var key = pair.substring(0, colonPos);
36.1539 + var value = pair.substring(colonPos + 1);
36.1540 + result.push({ 'key': restoreTokens(key, tokens), 'value': restoreTokens(value, tokens) });
36.1541 + } else {
36.1542 + result.push({ 'unknown': restoreTokens(pair, tokens) });
36.1543 + }
36.1544 + }
36.1545 + return result;
36.1546 + },
36.1547 +
36.1548 + insertPropertyAccessorsIntoJson: function (objectLiteralStringOrKeyValueArray) {
36.1549 + var keyValueArray = typeof objectLiteralStringOrKeyValueArray === "string"
36.1550 + ? ko.jsonExpressionRewriting.parseObjectLiteral(objectLiteralStringOrKeyValueArray)
36.1551 + : objectLiteralStringOrKeyValueArray;
36.1552 + var resultStrings = [], propertyAccessorResultStrings = [];
36.1553 +
36.1554 + var keyValueEntry;
36.1555 + for (var i = 0; keyValueEntry = keyValueArray[i]; i++) {
36.1556 + if (resultStrings.length > 0)
36.1557 + resultStrings.push(",");
36.1558 +
36.1559 + if (keyValueEntry['key']) {
36.1560 + var quotedKey = ensureQuoted(keyValueEntry['key']), val = keyValueEntry['value'];
36.1561 + resultStrings.push(quotedKey);
36.1562 + resultStrings.push(":");
36.1563 + resultStrings.push(val);
36.1564 +
36.1565 + if (isWriteableValue(ko.utils.stringTrim(val))) {
36.1566 + if (propertyAccessorResultStrings.length > 0)
36.1567 + propertyAccessorResultStrings.push(", ");
36.1568 + propertyAccessorResultStrings.push(quotedKey + " : function(__ko_value) { " + val + " = __ko_value; }");
36.1569 + }
36.1570 + } else if (keyValueEntry['unknown']) {
36.1571 + resultStrings.push(keyValueEntry['unknown']);
36.1572 + }
36.1573 + }
36.1574 +
36.1575 + var combinedResult = resultStrings.join("");
36.1576 + if (propertyAccessorResultStrings.length > 0) {
36.1577 + var allPropertyAccessors = propertyAccessorResultStrings.join("");
36.1578 + combinedResult = combinedResult + ", '_ko_property_writers' : { " + allPropertyAccessors + " } ";
36.1579 + }
36.1580 +
36.1581 + return combinedResult;
36.1582 + },
36.1583 +
36.1584 + keyValueArrayContainsKey: function(keyValueArray, key) {
36.1585 + for (var i = 0; i < keyValueArray.length; i++)
36.1586 + if (ko.utils.stringTrim(keyValueArray[i]['key']) == key)
36.1587 + return true;
36.1588 + return false;
36.1589 + },
36.1590 +
36.1591 + // Internal, private KO utility for updating model properties from within bindings
36.1592 + // property: If the property being updated is (or might be) an observable, pass it here
36.1593 + // If it turns out to be a writable observable, it will be written to directly
36.1594 + // allBindingsAccessor: All bindings in the current execution context.
36.1595 + // This will be searched for a '_ko_property_writers' property in case you're writing to a non-observable
36.1596 + // key: The key identifying the property to be written. Example: for { hasFocus: myValue }, write to 'myValue' by specifying the key 'hasFocus'
36.1597 + // value: The value to be written
36.1598 + // checkIfDifferent: If true, and if the property being written is a writable observable, the value will only be written if
36.1599 + // it is !== existing value on that writable observable
36.1600 + writeValueToProperty: function(property, allBindingsAccessor, key, value, checkIfDifferent) {
36.1601 + if (!property || !ko.isWriteableObservable(property)) {
36.1602 + var propWriters = allBindingsAccessor()['_ko_property_writers'];
36.1603 + if (propWriters && propWriters[key])
36.1604 + propWriters[key](value);
36.1605 + } else if (!checkIfDifferent || property() !== value) {
36.1606 + property(value);
36.1607 + }
36.1608 + }
36.1609 + };
36.1610 +})();
36.1611 +
36.1612 +ko.exportSymbol('jsonExpressionRewriting', ko.jsonExpressionRewriting);
36.1613 +ko.exportSymbol('jsonExpressionRewriting.bindingRewriteValidators', ko.jsonExpressionRewriting.bindingRewriteValidators);
36.1614 +ko.exportSymbol('jsonExpressionRewriting.parseObjectLiteral', ko.jsonExpressionRewriting.parseObjectLiteral);
36.1615 +ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson);
36.1616 +(function() {
36.1617 + // "Virtual elements" is an abstraction on top of the usual DOM API which understands the notion that comment nodes
36.1618 + // may be used to represent hierarchy (in addition to the DOM's natural hierarchy).
36.1619 + // If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state
36.1620 + // of that virtual hierarchy
36.1621 + //
36.1622 + // The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)
36.1623 + // without having to scatter special cases all over the binding and templating code.
36.1624 +
36.1625 + // IE 9 cannot reliably read the "nodeValue" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186)
36.1626 + // but it does give them a nonstandard alternative property called "text" that it can read reliably. Other browsers don't have that property.
36.1627 + // So, use node.text where available, and node.nodeValue elsewhere
36.1628 + var commentNodesHaveTextProperty = document.createComment("test").text === "<!--test-->";
36.1629 +
36.1630 + var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*ko\s+(.*\:.*)\s*-->$/ : /^\s*ko\s+(.*\:.*)\s*$/;
36.1631 + var endCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*\/ko\s*-->$/ : /^\s*\/ko\s*$/;
36.1632 + var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true };
36.1633 +
36.1634 + function isStartComment(node) {
36.1635 + return (node.nodeType == 8) && (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex);
36.1636 + }
36.1637 +
36.1638 + function isEndComment(node) {
36.1639 + return (node.nodeType == 8) && (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(endCommentRegex);
36.1640 + }
36.1641 +
36.1642 + function getVirtualChildren(startComment, allowUnbalanced) {
36.1643 + var currentNode = startComment;
36.1644 + var depth = 1;
36.1645 + var children = [];
36.1646 + while (currentNode = currentNode.nextSibling) {
36.1647 + if (isEndComment(currentNode)) {
36.1648 + depth--;
36.1649 + if (depth === 0)
36.1650 + return children;
36.1651 + }
36.1652 +
36.1653 + children.push(currentNode);
36.1654 +
36.1655 + if (isStartComment(currentNode))
36.1656 + depth++;
36.1657 + }
36.1658 + if (!allowUnbalanced)
36.1659 + throw new Error("Cannot find closing comment tag to match: " + startComment.nodeValue);
36.1660 + return null;
36.1661 + }
36.1662 +
36.1663 + function getMatchingEndComment(startComment, allowUnbalanced) {
36.1664 + var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced);
36.1665 + if (allVirtualChildren) {
36.1666 + if (allVirtualChildren.length > 0)
36.1667 + return allVirtualChildren[allVirtualChildren.length - 1].nextSibling;
36.1668 + return startComment.nextSibling;
36.1669 + } else
36.1670 + return null; // Must have no matching end comment, and allowUnbalanced is true
36.1671 + }
36.1672 +
36.1673 + function getUnbalancedChildTags(node) {
36.1674 + // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>
36.1675 + // from <div>OK</div><!-- /ko --><!-- /ko -->, returns: <!-- /ko --><!-- /ko -->
36.1676 + var childNode = node.firstChild, captureRemaining = null;
36.1677 + if (childNode) {
36.1678 + do {
36.1679 + if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes
36.1680 + captureRemaining.push(childNode);
36.1681 + else if (isStartComment(childNode)) {
36.1682 + var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true);
36.1683 + if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set
36.1684 + childNode = matchingEndComment;
36.1685 + else
36.1686 + captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point
36.1687 + } else if (isEndComment(childNode)) {
36.1688 + captureRemaining = [childNode]; // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing
36.1689 + }
36.1690 + } while (childNode = childNode.nextSibling);
36.1691 + }
36.1692 + return captureRemaining;
36.1693 + }
36.1694 +
36.1695 + ko.virtualElements = {
36.1696 + allowedBindings: {},
36.1697 +
36.1698 + childNodes: function(node) {
36.1699 + return isStartComment(node) ? getVirtualChildren(node) : node.childNodes;
36.1700 + },
36.1701 +
36.1702 + emptyNode: function(node) {
36.1703 + if (!isStartComment(node))
36.1704 + ko.utils.emptyDomNode(node);
36.1705 + else {
36.1706 + var virtualChildren = ko.virtualElements.childNodes(node);
36.1707 + for (var i = 0, j = virtualChildren.length; i < j; i++)
36.1708 + ko.removeNode(virtualChildren[i]);
36.1709 + }
36.1710 + },
36.1711 +
36.1712 + setDomNodeChildren: function(node, childNodes) {
36.1713 + if (!isStartComment(node))
36.1714 + ko.utils.setDomNodeChildren(node, childNodes);
36.1715 + else {
36.1716 + ko.virtualElements.emptyNode(node);
36.1717 + var endCommentNode = node.nextSibling; // Must be the next sibling, as we just emptied the children
36.1718 + for (var i = 0, j = childNodes.length; i < j; i++)
36.1719 + endCommentNode.parentNode.insertBefore(childNodes[i], endCommentNode);
36.1720 + }
36.1721 + },
36.1722 +
36.1723 + prepend: function(containerNode, nodeToPrepend) {
36.1724 + if (!isStartComment(containerNode)) {
36.1725 + if (containerNode.firstChild)
36.1726 + containerNode.insertBefore(nodeToPrepend, containerNode.firstChild);
36.1727 + else
36.1728 + containerNode.appendChild(nodeToPrepend);
36.1729 + } else {
36.1730 + // Start comments must always have a parent and at least one following sibling (the end comment)
36.1731 + containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling);
36.1732 + }
36.1733 + },
36.1734 +
36.1735 + insertAfter: function(containerNode, nodeToInsert, insertAfterNode) {
36.1736 + if (!isStartComment(containerNode)) {
36.1737 + // Insert after insertion point
36.1738 + if (insertAfterNode.nextSibling)
36.1739 + containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
36.1740 + else
36.1741 + containerNode.appendChild(nodeToInsert);
36.1742 + } else {
36.1743 + // Children of start comments must always have a parent and at least one following sibling (the end comment)
36.1744 + containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
36.1745 + }
36.1746 + },
36.1747 +
36.1748 + firstChild: function(node) {
36.1749 + if (!isStartComment(node))
36.1750 + return node.firstChild;
36.1751 + if (!node.nextSibling || isEndComment(node.nextSibling))
36.1752 + return null;
36.1753 + return node.nextSibling;
36.1754 + },
36.1755 +
36.1756 + nextSibling: function(node) {
36.1757 + if (isStartComment(node))
36.1758 + node = getMatchingEndComment(node);
36.1759 + if (node.nextSibling && isEndComment(node.nextSibling))
36.1760 + return null;
36.1761 + return node.nextSibling;
36.1762 + },
36.1763 +
36.1764 + virtualNodeBindingValue: function(node) {
36.1765 + var regexMatch = isStartComment(node);
36.1766 + return regexMatch ? regexMatch[1] : null;
36.1767 + },
36.1768 +
36.1769 + normaliseVirtualElementDomStructure: function(elementVerified) {
36.1770 + // Workaround for https://github.com/SteveSanderson/knockout/issues/155
36.1771 + // (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes
36.1772 + // that are direct descendants of <ul> into the preceding <li>)
36.1773 + if (!htmlTagsWithOptionallyClosingChildren[ko.utils.tagNameLower(elementVerified)])
36.1774 + return;
36.1775 +
36.1776 + // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags
36.1777 + // must be intended to appear *after* that child, so move them there.
36.1778 + var childNode = elementVerified.firstChild;
36.1779 + if (childNode) {
36.1780 + do {
36.1781 + if (childNode.nodeType === 1) {
36.1782 + var unbalancedTags = getUnbalancedChildTags(childNode);
36.1783 + if (unbalancedTags) {
36.1784 + // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child
36.1785 + var nodeToInsertBefore = childNode.nextSibling;
36.1786 + for (var i = 0; i < unbalancedTags.length; i++) {
36.1787 + if (nodeToInsertBefore)
36.1788 + elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore);
36.1789 + else
36.1790 + elementVerified.appendChild(unbalancedTags[i]);
36.1791 + }
36.1792 + }
36.1793 + }
36.1794 + } while (childNode = childNode.nextSibling);
36.1795 + }
36.1796 + }
36.1797 + };
36.1798 +})();
36.1799 +ko.exportSymbol('virtualElements', ko.virtualElements);
36.1800 +ko.exportSymbol('virtualElements.allowedBindings', ko.virtualElements.allowedBindings);
36.1801 +ko.exportSymbol('virtualElements.emptyNode', ko.virtualElements.emptyNode);
36.1802 +//ko.exportSymbol('virtualElements.firstChild', ko.virtualElements.firstChild); // firstChild is not minified
36.1803 +ko.exportSymbol('virtualElements.insertAfter', ko.virtualElements.insertAfter);
36.1804 +//ko.exportSymbol('virtualElements.nextSibling', ko.virtualElements.nextSibling); // nextSibling is not minified
36.1805 +ko.exportSymbol('virtualElements.prepend', ko.virtualElements.prepend);
36.1806 +ko.exportSymbol('virtualElements.setDomNodeChildren', ko.virtualElements.setDomNodeChildren);
36.1807 +(function() {
36.1808 + var defaultBindingAttributeName = "data-bind";
36.1809 +
36.1810 + ko.bindingProvider = function() {
36.1811 + this.bindingCache = {};
36.1812 + };
36.1813 +
36.1814 + ko.utils.extend(ko.bindingProvider.prototype, {
36.1815 + 'nodeHasBindings': function(node) {
36.1816 + switch (node.nodeType) {
36.1817 + case 1: return node.getAttribute(defaultBindingAttributeName) != null; // Element
36.1818 + case 8: return ko.virtualElements.virtualNodeBindingValue(node) != null; // Comment node
36.1819 + default: return false;
36.1820 + }
36.1821 + },
36.1822 +
36.1823 + 'getBindings': function(node, bindingContext) {
36.1824 + var bindingsString = this['getBindingsString'](node, bindingContext);
36.1825 + return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext) : null;
36.1826 + },
36.1827 +
36.1828 + // The following function is only used internally by this default provider.
36.1829 + // It's not part of the interface definition for a general binding provider.
36.1830 + 'getBindingsString': function(node, bindingContext) {
36.1831 + switch (node.nodeType) {
36.1832 + case 1: return node.getAttribute(defaultBindingAttributeName); // Element
36.1833 + case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
36.1834 + default: return null;
36.1835 + }
36.1836 + },
36.1837 +
36.1838 + // The following function is only used internally by this default provider.
36.1839 + // It's not part of the interface definition for a general binding provider.
36.1840 + 'parseBindingsString': function(bindingsString, bindingContext) {
36.1841 + try {
36.1842 + var viewModel = bindingContext['$data'],
36.1843 + scopes = (typeof viewModel == 'object' && viewModel != null) ? [viewModel, bindingContext] : [bindingContext],
36.1844 + bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, scopes.length, this.bindingCache);
36.1845 + return bindingFunction(scopes);
36.1846 + } catch (ex) {
36.1847 + throw new Error("Unable to parse bindings.\nMessage: " + ex + ";\nBindings value: " + bindingsString);
36.1848 + }
36.1849 + }
36.1850 + });
36.1851 +
36.1852 + ko.bindingProvider['instance'] = new ko.bindingProvider();
36.1853 +
36.1854 + function createBindingsStringEvaluatorViaCache(bindingsString, scopesCount, cache) {
36.1855 + var cacheKey = scopesCount + '_' + bindingsString;
36.1856 + return cache[cacheKey]
36.1857 + || (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, scopesCount));
36.1858 + }
36.1859 +
36.1860 + function createBindingsStringEvaluator(bindingsString, scopesCount) {
36.1861 + var rewrittenBindings = " { " + ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson(bindingsString) + " } ";
36.1862 + return ko.utils.buildEvalWithinScopeFunction(rewrittenBindings, scopesCount);
36.1863 + }
36.1864 +})();
36.1865 +
36.1866 +ko.exportSymbol('bindingProvider', ko.bindingProvider);
36.1867 +(function () {
36.1868 + ko.bindingHandlers = {};
36.1869 +
36.1870 + ko.bindingContext = function(dataItem, parentBindingContext) {
36.1871 + if (parentBindingContext) {
36.1872 + ko.utils.extend(this, parentBindingContext); // Inherit $root and any custom properties
36.1873 + this['$parentContext'] = parentBindingContext;
36.1874 + this['$parent'] = parentBindingContext['$data'];
36.1875 + this['$parents'] = (parentBindingContext['$parents'] || []).slice(0);
36.1876 + this['$parents'].unshift(this['$parent']);
36.1877 + } else {
36.1878 + this['$parents'] = [];
36.1879 + this['$root'] = dataItem;
36.1880 + }
36.1881 + this['$data'] = dataItem;
36.1882 + }
36.1883 + ko.bindingContext.prototype['createChildContext'] = function (dataItem) {
36.1884 + return new ko.bindingContext(dataItem, this);
36.1885 + };
36.1886 + ko.bindingContext.prototype['extend'] = function(properties) {
36.1887 + var clone = ko.utils.extend(new ko.bindingContext(), this);
36.1888 + return ko.utils.extend(clone, properties);
36.1889 + };
36.1890 +
36.1891 + function validateThatBindingIsAllowedForVirtualElements(bindingName) {
36.1892 + var validator = ko.virtualElements.allowedBindings[bindingName];
36.1893 + if (!validator)
36.1894 + throw new Error("The binding '" + bindingName + "' cannot be used with virtual elements")
36.1895 + }
36.1896 +
36.1897 + function applyBindingsToDescendantsInternal (viewModel, elementOrVirtualElement, bindingContextsMayDifferFromDomParentElement) {
36.1898 + var currentChild, nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
36.1899 + while (currentChild = nextInQueue) {
36.1900 + // Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position
36.1901 + nextInQueue = ko.virtualElements.nextSibling(currentChild);
36.1902 + applyBindingsToNodeAndDescendantsInternal(viewModel, currentChild, bindingContextsMayDifferFromDomParentElement);
36.1903 + }
36.1904 + }
36.1905 +
36.1906 + function applyBindingsToNodeAndDescendantsInternal (viewModel, nodeVerified, bindingContextMayDifferFromDomParentElement) {
36.1907 + var shouldBindDescendants = true;
36.1908 +
36.1909 + // Perf optimisation: Apply bindings only if...
36.1910 + // (1) We need to store the binding context on this node (because it may differ from the DOM parent node's binding context)
36.1911 + // Note that we can't store binding contexts on non-elements (e.g., text nodes), as IE doesn't allow expando properties for those
36.1912 + // (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)
36.1913 + var isElement = (nodeVerified.nodeType === 1);
36.1914 + if (isElement) // Workaround IE <= 8 HTML parsing weirdness
36.1915 + ko.virtualElements.normaliseVirtualElementDomStructure(nodeVerified);
36.1916 +
36.1917 + var shouldApplyBindings = (isElement && bindingContextMayDifferFromDomParentElement) // Case (1)
36.1918 + || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified); // Case (2)
36.1919 + if (shouldApplyBindings)
36.1920 + shouldBindDescendants = applyBindingsToNodeInternal(nodeVerified, null, viewModel, bindingContextMayDifferFromDomParentElement).shouldBindDescendants;
36.1921 +
36.1922 + if (shouldBindDescendants) {
36.1923 + // We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So,
36.1924 + // * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode,
36.1925 + // hence bindingContextsMayDifferFromDomParentElement is false
36.1926 + // * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may
36.1927 + // skip over any number of intermediate virtual elements, any of which might define a custom binding context,
36.1928 + // hence bindingContextsMayDifferFromDomParentElement is true
36.1929 + applyBindingsToDescendantsInternal(viewModel, nodeVerified, /* bindingContextsMayDifferFromDomParentElement: */ !isElement);
36.1930 + }
36.1931 + }
36.1932 +
36.1933 + function applyBindingsToNodeInternal (node, bindings, viewModelOrBindingContext, bindingContextMayDifferFromDomParentElement) {
36.1934 + // Need to be sure that inits are only run once, and updates never run until all the inits have been run
36.1935 + var initPhase = 0; // 0 = before all inits, 1 = during inits, 2 = after all inits
36.1936 +
36.1937 + // Each time the dependentObservable is evaluated (after data changes),
36.1938 + // the binding attribute is reparsed so that it can pick out the correct
36.1939 + // model properties in the context of the changed data.
36.1940 + // DOM event callbacks need to be able to access this changed data,
36.1941 + // so we need a single parsedBindings variable (shared by all callbacks
36.1942 + // associated with this node's bindings) that all the closures can access.
36.1943 + var parsedBindings;
36.1944 + function makeValueAccessor(bindingKey) {
36.1945 + return function () { return parsedBindings[bindingKey] }
36.1946 + }
36.1947 + function parsedBindingsAccessor() {
36.1948 + return parsedBindings;
36.1949 + }
36.1950 +
36.1951 + var bindingHandlerThatControlsDescendantBindings;
36.1952 + ko.dependentObservable(
36.1953 + function () {
36.1954 + // Ensure we have a nonnull binding context to work with
36.1955 + var bindingContextInstance = viewModelOrBindingContext && (viewModelOrBindingContext instanceof ko.bindingContext)
36.1956 + ? viewModelOrBindingContext
36.1957 + : new ko.bindingContext(ko.utils.unwrapObservable(viewModelOrBindingContext));
36.1958 + var viewModel = bindingContextInstance['$data'];
36.1959 +
36.1960 + // Optimization: Don't store the binding context on this node if it's definitely the same as on node.parentNode, because
36.1961 + // we can easily recover it just by scanning up the node's ancestors in the DOM
36.1962 + // (note: here, parent node means "real DOM parent" not "virtual parent", as there's no O(1) way to find the virtual parent)
36.1963 + if (bindingContextMayDifferFromDomParentElement)
36.1964 + ko.storedBindingContextForNode(node, bindingContextInstance);
36.1965 +
36.1966 + // Use evaluatedBindings if given, otherwise fall back on asking the bindings provider to give us some bindings
36.1967 + var evaluatedBindings = (typeof bindings == "function") ? bindings() : bindings;
36.1968 + parsedBindings = evaluatedBindings || ko.bindingProvider['instance']['getBindings'](node, bindingContextInstance);
36.1969 +
36.1970 + if (parsedBindings) {
36.1971 + // First run all the inits, so bindings can register for notification on changes
36.1972 + if (initPhase === 0) {
36.1973 + initPhase = 1;
36.1974 + for (var bindingKey in parsedBindings) {
36.1975 + var binding = ko.bindingHandlers[bindingKey];
36.1976 + if (binding && node.nodeType === 8)
36.1977 + validateThatBindingIsAllowedForVirtualElements(bindingKey);
36.1978 +
36.1979 + if (binding && typeof binding["init"] == "function") {
36.1980 + var handlerInitFn = binding["init"];
36.1981 + var initResult = handlerInitFn(node, makeValueAccessor(bindingKey), parsedBindingsAccessor, viewModel, bindingContextInstance);
36.1982 +
36.1983 + // If this binding handler claims to control descendant bindings, make a note of this
36.1984 + if (initResult && initResult['controlsDescendantBindings']) {
36.1985 + if (bindingHandlerThatControlsDescendantBindings !== undefined)
36.1986 + throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
36.1987 + bindingHandlerThatControlsDescendantBindings = bindingKey;
36.1988 + }
36.1989 + }
36.1990 + }
36.1991 + initPhase = 2;
36.1992 + }
36.1993 +
36.1994 + // ... then run all the updates, which might trigger changes even on the first evaluation
36.1995 + if (initPhase === 2) {
36.1996 + for (var bindingKey in parsedBindings) {
36.1997 + var binding = ko.bindingHandlers[bindingKey];
36.1998 + if (binding && typeof binding["update"] == "function") {
36.1999 + var handlerUpdateFn = binding["update"];
36.2000 + handlerUpdateFn(node, makeValueAccessor(bindingKey), parsedBindingsAccessor, viewModel, bindingContextInstance);
36.2001 + }
36.2002 + }
36.2003 + }
36.2004 + }
36.2005 + },
36.2006 + null,
36.2007 + { 'disposeWhenNodeIsRemoved' : node }
36.2008 + );
36.2009 +
36.2010 + return {
36.2011 + shouldBindDescendants: bindingHandlerThatControlsDescendantBindings === undefined
36.2012 + };
36.2013 + };
36.2014 +
36.2015 + var storedBindingContextDomDataKey = "__ko_bindingContext__";
36.2016 + ko.storedBindingContextForNode = function (node, bindingContext) {
36.2017 + if (arguments.length == 2)
36.2018 + ko.utils.domData.set(node, storedBindingContextDomDataKey, bindingContext);
36.2019 + else
36.2020 + return ko.utils.domData.get(node, storedBindingContextDomDataKey);
36.2021 + }
36.2022 +
36.2023 + ko.applyBindingsToNode = function (node, bindings, viewModel) {
36.2024 + if (node.nodeType === 1) // If it's an element, workaround IE <= 8 HTML parsing weirdness
36.2025 + ko.virtualElements.normaliseVirtualElementDomStructure(node);
36.2026 + return applyBindingsToNodeInternal(node, bindings, viewModel, true);
36.2027 + };
36.2028 +
36.2029 + ko.applyBindingsToDescendants = function(viewModel, rootNode) {
36.2030 + if (rootNode.nodeType === 1 || rootNode.nodeType === 8)
36.2031 + applyBindingsToDescendantsInternal(viewModel, rootNode, true);
36.2032 + };
36.2033 +
36.2034 + ko.applyBindings = function (viewModel, rootNode) {
36.2035 + if (rootNode && (rootNode.nodeType !== 1) && (rootNode.nodeType !== 8))
36.2036 + throw new Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
36.2037 + rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional
36.2038 +
36.2039 + applyBindingsToNodeAndDescendantsInternal(viewModel, rootNode, true);
36.2040 + };
36.2041 +
36.2042 + // Retrieving binding context from arbitrary nodes
36.2043 + ko.contextFor = function(node) {
36.2044 + // We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them)
36.2045 + switch (node.nodeType) {
36.2046 + case 1:
36.2047 + case 8:
36.2048 + var context = ko.storedBindingContextForNode(node);
36.2049 + if (context) return context;
36.2050 + if (node.parentNode) return ko.contextFor(node.parentNode);
36.2051 + break;
36.2052 + }
36.2053 + return undefined;
36.2054 + };
36.2055 + ko.dataFor = function(node) {
36.2056 + var context = ko.contextFor(node);
36.2057 + return context ? context['$data'] : undefined;
36.2058 + };
36.2059 +
36.2060 + ko.exportSymbol('bindingHandlers', ko.bindingHandlers);
36.2061 + ko.exportSymbol('applyBindings', ko.applyBindings);
36.2062 + ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants);
36.2063 + ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode);
36.2064 + ko.exportSymbol('contextFor', ko.contextFor);
36.2065 + ko.exportSymbol('dataFor', ko.dataFor);
36.2066 +})();
36.2067 +// For certain common events (currently just 'click'), allow a simplified data-binding syntax
36.2068 +// e.g. click:handler instead of the usual full-length event:{click:handler}
36.2069 +var eventHandlersWithShortcuts = ['click'];
36.2070 +ko.utils.arrayForEach(eventHandlersWithShortcuts, function(eventName) {
36.2071 + ko.bindingHandlers[eventName] = {
36.2072 + 'init': function(element, valueAccessor, allBindingsAccessor, viewModel) {
36.2073 + var newValueAccessor = function () {
36.2074 + var result = {};
36.2075 + result[eventName] = valueAccessor();
36.2076 + return result;
36.2077 + };
36.2078 + return ko.bindingHandlers['event']['init'].call(this, element, newValueAccessor, allBindingsAccessor, viewModel);
36.2079 + }
36.2080 + }
36.2081 +});
36.2082 +
36.2083 +
36.2084 +ko.bindingHandlers['event'] = {
36.2085 + 'init' : function (element, valueAccessor, allBindingsAccessor, viewModel) {
36.2086 + var eventsToHandle = valueAccessor() || {};
36.2087 + for(var eventNameOutsideClosure in eventsToHandle) {
36.2088 + (function() {
36.2089 + var eventName = eventNameOutsideClosure; // Separate variable to be captured by event handler closure
36.2090 + if (typeof eventName == "string") {
36.2091 + ko.utils.registerEventHandler(element, eventName, function (event) {
36.2092 + var handlerReturnValue;
36.2093 + var handlerFunction = valueAccessor()[eventName];
36.2094 + if (!handlerFunction)
36.2095 + return;
36.2096 + var allBindings = allBindingsAccessor();
36.2097 +
36.2098 + try {
36.2099 + // Take all the event args, and prefix with the viewmodel
36.2100 + var argsForHandler = ko.utils.makeArray(arguments);
36.2101 + argsForHandler.unshift(viewModel);
36.2102 + handlerReturnValue = handlerFunction.apply(viewModel, argsForHandler);
36.2103 + } finally {
36.2104 + if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
36.2105 + if (event.preventDefault)
36.2106 + event.preventDefault();
36.2107 + else
36.2108 + event.returnValue = false;
36.2109 + }
36.2110 + }
36.2111 +
36.2112 + var bubble = allBindings[eventName + 'Bubble'] !== false;
36.2113 + if (!bubble) {
36.2114 + event.cancelBubble = true;
36.2115 + if (event.stopPropagation)
36.2116 + event.stopPropagation();
36.2117 + }
36.2118 + });
36.2119 + }
36.2120 + })();
36.2121 + }
36.2122 + }
36.2123 +};
36.2124 +
36.2125 +ko.bindingHandlers['submit'] = {
36.2126 + 'init': function (element, valueAccessor, allBindingsAccessor, viewModel) {
36.2127 + if (typeof valueAccessor() != "function")
36.2128 + throw new Error("The value for a submit binding must be a function");
36.2129 + ko.utils.registerEventHandler(element, "submit", function (event) {
36.2130 + var handlerReturnValue;
36.2131 + var value = valueAccessor();
36.2132 + try { handlerReturnValue = value.call(viewModel, element); }
36.2133 + finally {
36.2134 + if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
36.2135 + if (event.preventDefault)
36.2136 + event.preventDefault();
36.2137 + else
36.2138 + event.returnValue = false;
36.2139 + }
36.2140 + }
36.2141 + });
36.2142 + }
36.2143 +};
36.2144 +
36.2145 +ko.bindingHandlers['visible'] = {
36.2146 + 'update': function (element, valueAccessor) {
36.2147 + var value = ko.utils.unwrapObservable(valueAccessor());
36.2148 + var isCurrentlyVisible = !(element.style.display == "none");
36.2149 + if (value && !isCurrentlyVisible)
36.2150 + element.style.display = "";
36.2151 + else if ((!value) && isCurrentlyVisible)
36.2152 + element.style.display = "none";
36.2153 + }
36.2154 +}
36.2155 +
36.2156 +ko.bindingHandlers['enable'] = {
36.2157 + 'update': function (element, valueAccessor) {
36.2158 + var value = ko.utils.unwrapObservable(valueAccessor());
36.2159 + if (value && element.disabled)
36.2160 + element.removeAttribute("disabled");
36.2161 + else if ((!value) && (!element.disabled))
36.2162 + element.disabled = true;
36.2163 + }
36.2164 +};
36.2165 +
36.2166 +ko.bindingHandlers['disable'] = {
36.2167 + 'update': function (element, valueAccessor) {
36.2168 + ko.bindingHandlers['enable']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) });
36.2169 + }
36.2170 +};
36.2171 +
36.2172 +function ensureDropdownSelectionIsConsistentWithModelValue(element, modelValue, preferModelValue) {
36.2173 + if (preferModelValue) {
36.2174 + if (modelValue !== ko.selectExtensions.readValue(element))
36.2175 + ko.selectExtensions.writeValue(element, modelValue);
36.2176 + }
36.2177 +
36.2178 + // No matter which direction we're syncing in, we want the end result to be equality between dropdown value and model value.
36.2179 + // If they aren't equal, either we prefer the dropdown value, or the model value couldn't be represented, so either way,
36.2180 + // change the model value to match the dropdown.
36.2181 + if (modelValue !== ko.selectExtensions.readValue(element))
36.2182 + ko.utils.triggerEvent(element, "change");
36.2183 +};
36.2184 +
36.2185 +ko.bindingHandlers['value'] = {
36.2186 + 'init': function (element, valueAccessor, allBindingsAccessor) {
36.2187 + // Always catch "change" event; possibly other events too if asked
36.2188 + var eventsToCatch = ["change"];
36.2189 + var requestedEventsToCatch = allBindingsAccessor()["valueUpdate"];
36.2190 + if (requestedEventsToCatch) {
36.2191 + if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names
36.2192 + requestedEventsToCatch = [requestedEventsToCatch];
36.2193 + ko.utils.arrayPushAll(eventsToCatch, requestedEventsToCatch);
36.2194 + eventsToCatch = ko.utils.arrayGetDistinctValues(eventsToCatch);
36.2195 + }
36.2196 +
36.2197 + var valueUpdateHandler = function() {
36.2198 + var modelValue = valueAccessor();
36.2199 + var elementValue = ko.selectExtensions.readValue(element);
36.2200 + ko.jsonExpressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'value', elementValue, /* checkIfDifferent: */ true);
36.2201 + }
36.2202 +
36.2203 + // Workaround for https://github.com/SteveSanderson/knockout/issues/122
36.2204 + // IE doesn't fire "change" events on textboxes if the user selects a value from its autocomplete list
36.2205 + var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text"
36.2206 + && element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
36.2207 + if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
36.2208 + var propertyChangedFired = false;
36.2209 + ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
36.2210 + ko.utils.registerEventHandler(element, "blur", function() {
36.2211 + if (propertyChangedFired) {
36.2212 + propertyChangedFired = false;
36.2213 + valueUpdateHandler();
36.2214 + }
36.2215 + });
36.2216 + }
36.2217 +
36.2218 + ko.utils.arrayForEach(eventsToCatch, function(eventName) {
36.2219 + // The syntax "after<eventname>" means "run the handler asynchronously after the event"
36.2220 + // This is useful, for example, to catch "keydown" events after the browser has updated the control
36.2221 + // (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event)
36.2222 + var handler = valueUpdateHandler;
36.2223 + if (ko.utils.stringStartsWith(eventName, "after")) {
36.2224 + handler = function() { setTimeout(valueUpdateHandler, 0) };
36.2225 + eventName = eventName.substring("after".length);
36.2226 + }
36.2227 + ko.utils.registerEventHandler(element, eventName, handler);
36.2228 + });
36.2229 + },
36.2230 + 'update': function (element, valueAccessor) {
36.2231 + var valueIsSelectOption = ko.utils.tagNameLower(element) === "select";
36.2232 + var newValue = ko.utils.unwrapObservable(valueAccessor());
36.2233 + var elementValue = ko.selectExtensions.readValue(element);
36.2234 + var valueHasChanged = (newValue != elementValue);
36.2235 +
36.2236 + // JavaScript's 0 == "" behavious is unfortunate here as it prevents writing 0 to an empty text box (loose equality suggests the values are the same).
36.2237 + // We don't want to do a strict equality comparison as that is more confusing for developers in certain cases, so we specifically special case 0 != "" here.
36.2238 + if ((newValue === 0) && (elementValue !== 0) && (elementValue !== "0"))
36.2239 + valueHasChanged = true;
36.2240 +
36.2241 + if (valueHasChanged) {
36.2242 + var applyValueAction = function () { ko.selectExtensions.writeValue(element, newValue); };
36.2243 + applyValueAction();
36.2244 +
36.2245 + // Workaround for IE6 bug: It won't reliably apply values to SELECT nodes during the same execution thread
36.2246 + // right after you've changed the set of OPTION nodes on it. So for that node type, we'll schedule a second thread
36.2247 + // to apply the value as well.
36.2248 + var alsoApplyAsynchronously = valueIsSelectOption;
36.2249 + if (alsoApplyAsynchronously)
36.2250 + setTimeout(applyValueAction, 0);
36.2251 + }
36.2252 +
36.2253 + // If you try to set a model value that can't be represented in an already-populated dropdown, reject that change,
36.2254 + // because you're not allowed to have a model value that disagrees with a visible UI selection.
36.2255 + if (valueIsSelectOption && (element.length > 0))
36.2256 + ensureDropdownSelectionIsConsistentWithModelValue(element, newValue, /* preferModelValue */ false);
36.2257 + }
36.2258 +};
36.2259 +
36.2260 +ko.bindingHandlers['options'] = {
36.2261 + 'update': function (element, valueAccessor, allBindingsAccessor) {
36.2262 + if (ko.utils.tagNameLower(element) !== "select")
36.2263 + throw new Error("options binding applies only to SELECT elements");
36.2264 +
36.2265 + var selectWasPreviouslyEmpty = element.length == 0;
36.2266 + var previousSelectedValues = ko.utils.arrayMap(ko.utils.arrayFilter(element.childNodes, function (node) {
36.2267 + return node.tagName && (ko.utils.tagNameLower(node) === "option") && node.selected;
36.2268 + }), function (node) {
36.2269 + return ko.selectExtensions.readValue(node) || node.innerText || node.textContent;
36.2270 + });
36.2271 + var previousScrollTop = element.scrollTop;
36.2272 +
36.2273 + var value = ko.utils.unwrapObservable(valueAccessor());
36.2274 + var selectedValue = element.value;
36.2275 +
36.2276 + // Remove all existing <option>s.
36.2277 + // Need to use .remove() rather than .removeChild() for <option>s otherwise IE behaves oddly (https://github.com/SteveSanderson/knockout/issues/134)
36.2278 + while (element.length > 0) {
36.2279 + ko.cleanNode(element.options[0]);
36.2280 + element.remove(0);
36.2281 + }
36.2282 +
36.2283 + if (value) {
36.2284 + var allBindings = allBindingsAccessor();
36.2285 + if (typeof value.length != "number")
36.2286 + value = [value];
36.2287 + if (allBindings['optionsCaption']) {
36.2288 + var option = document.createElement("option");
36.2289 + ko.utils.setHtml(option, allBindings['optionsCaption']);
36.2290 + ko.selectExtensions.writeValue(option, undefined);
36.2291 + element.appendChild(option);
36.2292 + }
36.2293 + for (var i = 0, j = value.length; i < j; i++) {
36.2294 + var option = document.createElement("option");
36.2295 +
36.2296 + // Apply a value to the option element
36.2297 + var optionValue = typeof allBindings['optionsValue'] == "string" ? value[i][allBindings['optionsValue']] : value[i];
36.2298 + optionValue = ko.utils.unwrapObservable(optionValue);
36.2299 + ko.selectExtensions.writeValue(option, optionValue);
36.2300 +
36.2301 + // Apply some text to the option element
36.2302 + var optionsTextValue = allBindings['optionsText'];
36.2303 + var optionText;
36.2304 + if (typeof optionsTextValue == "function")
36.2305 + optionText = optionsTextValue(value[i]); // Given a function; run it against the data value
36.2306 + else if (typeof optionsTextValue == "string")
36.2307 + optionText = value[i][optionsTextValue]; // Given a string; treat it as a property name on the data value
36.2308 + else
36.2309 + optionText = optionValue; // Given no optionsText arg; use the data value itself
36.2310 + if ((optionText === null) || (optionText === undefined))
36.2311 + optionText = "";
36.2312 +
36.2313 + ko.utils.setTextContent(option, optionText);
36.2314 +
36.2315 + element.appendChild(option);
36.2316 + }
36.2317 +
36.2318 + // IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document.
36.2319 + // That's why we first added them without selection. Now it's time to set the selection.
36.2320 + var newOptions = element.getElementsByTagName("option");
36.2321 + var countSelectionsRetained = 0;
36.2322 + for (var i = 0, j = newOptions.length; i < j; i++) {
36.2323 + if (ko.utils.arrayIndexOf(previousSelectedValues, ko.selectExtensions.readValue(newOptions[i])) >= 0) {
36.2324 + ko.utils.setOptionNodeSelectionState(newOptions[i], true);
36.2325 + countSelectionsRetained++;
36.2326 + }
36.2327 + }
36.2328 +
36.2329 + element.scrollTop = previousScrollTop;
36.2330 +
36.2331 + if (selectWasPreviouslyEmpty && ('value' in allBindings)) {
36.2332 + // Ensure consistency between model value and selected option.
36.2333 + // If the dropdown is being populated for the first time here (or was otherwise previously empty),
36.2334 + // the dropdown selection state is meaningless, so we preserve the model value.
36.2335 + ensureDropdownSelectionIsConsistentWithModelValue(element, ko.utils.unwrapObservable(allBindings['value']), /* preferModelValue */ true);
36.2336 + }
36.2337 +
36.2338 + // Workaround for IE9 bug
36.2339 + ko.utils.ensureSelectElementIsRenderedCorrectly(element);
36.2340 + }
36.2341 + }
36.2342 +};
36.2343 +ko.bindingHandlers['options'].optionValueDomDataKey = '__ko.optionValueDomData__';
36.2344 +
36.2345 +ko.bindingHandlers['selectedOptions'] = {
36.2346 + getSelectedValuesFromSelectNode: function (selectNode) {
36.2347 + var result = [];
36.2348 + var nodes = selectNode.childNodes;
36.2349 + for (var i = 0, j = nodes.length; i < j; i++) {
36.2350 + var node = nodes[i], tagName = ko.utils.tagNameLower(node);
36.2351 + if (tagName == "option" && node.selected)
36.2352 + result.push(ko.selectExtensions.readValue(node));
36.2353 + else if (tagName == "optgroup") {
36.2354 + var selectedValuesFromOptGroup = ko.bindingHandlers['selectedOptions'].getSelectedValuesFromSelectNode(node);
36.2355 + Array.prototype.splice.apply(result, [result.length, 0].concat(selectedValuesFromOptGroup)); // Add new entries to existing 'result' instance
36.2356 + }
36.2357 + }
36.2358 + return result;
36.2359 + },
36.2360 + 'init': function (element, valueAccessor, allBindingsAccessor) {
36.2361 + ko.utils.registerEventHandler(element, "change", function () {
36.2362 + var value = valueAccessor();
36.2363 + var valueToWrite = ko.bindingHandlers['selectedOptions'].getSelectedValuesFromSelectNode(this);
36.2364 + ko.jsonExpressionRewriting.writeValueToProperty(value, allBindingsAccessor, 'value', valueToWrite);
36.2365 + });
36.2366 + },
36.2367 + 'update': function (element, valueAccessor) {
36.2368 + if (ko.utils.tagNameLower(element) != "select")
36.2369 + throw new Error("values binding applies only to SELECT elements");
36.2370 +
36.2371 + var newValue = ko.utils.unwrapObservable(valueAccessor());
36.2372 + if (newValue && typeof newValue.length == "number") {
36.2373 + var nodes = element.childNodes;
36.2374 + for (var i = 0, j = nodes.length; i < j; i++) {
36.2375 + var node = nodes[i];
36.2376 + if (ko.utils.tagNameLower(node) === "option")
36.2377 + ko.utils.setOptionNodeSelectionState(node, ko.utils.arrayIndexOf(newValue, ko.selectExtensions.readValue(node)) >= 0);
36.2378 + }
36.2379 + }
36.2380 + }
36.2381 +};
36.2382 +
36.2383 +ko.bindingHandlers['text'] = {
36.2384 + 'update': function (element, valueAccessor) {
36.2385 + ko.utils.setTextContent(element, valueAccessor());
36.2386 + }
36.2387 +};
36.2388 +
36.2389 +ko.bindingHandlers['html'] = {
36.2390 + 'init': function() {
36.2391 + // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
36.2392 + return { 'controlsDescendantBindings': true };
36.2393 + },
36.2394 + 'update': function (element, valueAccessor) {
36.2395 + var value = ko.utils.unwrapObservable(valueAccessor());
36.2396 + ko.utils.setHtml(element, value);
36.2397 + }
36.2398 +};
36.2399 +
36.2400 +ko.bindingHandlers['css'] = {
36.2401 + 'update': function (element, valueAccessor) {
36.2402 + var value = ko.utils.unwrapObservable(valueAccessor() || {});
36.2403 + for (var className in value) {
36.2404 + if (typeof className == "string") {
36.2405 + var shouldHaveClass = ko.utils.unwrapObservable(value[className]);
36.2406 + ko.utils.toggleDomNodeCssClass(element, className, shouldHaveClass);
36.2407 + }
36.2408 + }
36.2409 + }
36.2410 +};
36.2411 +
36.2412 +ko.bindingHandlers['style'] = {
36.2413 + 'update': function (element, valueAccessor) {
36.2414 + var value = ko.utils.unwrapObservable(valueAccessor() || {});
36.2415 + for (var styleName in value) {
36.2416 + if (typeof styleName == "string") {
36.2417 + var styleValue = ko.utils.unwrapObservable(value[styleName]);
36.2418 + element.style[styleName] = styleValue || ""; // Empty string removes the value, whereas null/undefined have no effect
36.2419 + }
36.2420 + }
36.2421 + }
36.2422 +};
36.2423 +
36.2424 +ko.bindingHandlers['uniqueName'] = {
36.2425 + 'init': function (element, valueAccessor) {
36.2426 + if (valueAccessor()) {
36.2427 + element.name = "ko_unique_" + (++ko.bindingHandlers['uniqueName'].currentIndex);
36.2428 +
36.2429 + // Workaround IE 6/7 issue
36.2430 + // - https://github.com/SteveSanderson/knockout/issues/197
36.2431 + // - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/
36.2432 + if (ko.utils.isIe6 || ko.utils.isIe7)
36.2433 + element.mergeAttributes(document.createElement("<input name='" + element.name + "'/>"), false);
36.2434 + }
36.2435 + }
36.2436 +};
36.2437 +ko.bindingHandlers['uniqueName'].currentIndex = 0;
36.2438 +
36.2439 +ko.bindingHandlers['checked'] = {
36.2440 + 'init': function (element, valueAccessor, allBindingsAccessor) {
36.2441 + var updateHandler = function() {
36.2442 + var valueToWrite;
36.2443 + if (element.type == "checkbox") {
36.2444 + valueToWrite = element.checked;
36.2445 + } else if ((element.type == "radio") && (element.checked)) {
36.2446 + valueToWrite = element.value;
36.2447 + } else {
36.2448 + return; // "checked" binding only responds to checkboxes and selected radio buttons
36.2449 + }
36.2450 +
36.2451 + var modelValue = valueAccessor();
36.2452 + if ((element.type == "checkbox") && (ko.utils.unwrapObservable(modelValue) instanceof Array)) {
36.2453 + // For checkboxes bound to an array, we add/remove the checkbox value to that array
36.2454 + // This works for both observable and non-observable arrays
36.2455 + var existingEntryIndex = ko.utils.arrayIndexOf(ko.utils.unwrapObservable(modelValue), element.value);
36.2456 + if (element.checked && (existingEntryIndex < 0))
36.2457 + modelValue.push(element.value);
36.2458 + else if ((!element.checked) && (existingEntryIndex >= 0))
36.2459 + modelValue.splice(existingEntryIndex, 1);
36.2460 + } else {
36.2461 + ko.jsonExpressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'checked', valueToWrite, true);
36.2462 + }
36.2463 + };
36.2464 + ko.utils.registerEventHandler(element, "click", updateHandler);
36.2465 +
36.2466 + // IE 6 won't allow radio buttons to be selected unless they have a name
36.2467 + if ((element.type == "radio") && !element.name)
36.2468 + ko.bindingHandlers['uniqueName']['init'](element, function() { return true });
36.2469 + },
36.2470 + 'update': function (element, valueAccessor) {
36.2471 + var value = ko.utils.unwrapObservable(valueAccessor());
36.2472 +
36.2473 + if (element.type == "checkbox") {
36.2474 + if (value instanceof Array) {
36.2475 + // When bound to an array, the checkbox being checked represents its value being present in that array
36.2476 + element.checked = ko.utils.arrayIndexOf(value, element.value) >= 0;
36.2477 + } else {
36.2478 + // When bound to anything other value (not an array), the checkbox being checked represents the value being trueish
36.2479 + element.checked = value;
36.2480 + }
36.2481 + } else if (element.type == "radio") {
36.2482 + element.checked = (element.value == value);
36.2483 + }
36.2484 + }
36.2485 +};
36.2486 +
36.2487 +var attrHtmlToJavascriptMap = { 'class': 'className', 'for': 'htmlFor' };
36.2488 +ko.bindingHandlers['attr'] = {
36.2489 + 'update': function(element, valueAccessor, allBindingsAccessor) {
36.2490 + var value = ko.utils.unwrapObservable(valueAccessor()) || {};
36.2491 + for (var attrName in value) {
36.2492 + if (typeof attrName == "string") {
36.2493 + var attrValue = ko.utils.unwrapObservable(value[attrName]);
36.2494 +
36.2495 + // To cover cases like "attr: { checked:someProp }", we want to remove the attribute entirely
36.2496 + // when someProp is a "no value"-like value (strictly null, false, or undefined)
36.2497 + // (because the absence of the "checked" attr is how to mark an element as not checked, etc.)
36.2498 + var toRemove = (attrValue === false) || (attrValue === null) || (attrValue === undefined);
36.2499 + if (toRemove)
36.2500 + element.removeAttribute(attrName);
36.2501 +
36.2502 + // In IE <= 7 and IE8 Quirks Mode, you have to use the Javascript property name instead of the
36.2503 + // HTML attribute name for certain attributes. IE8 Standards Mode supports the correct behavior,
36.2504 + // but instead of figuring out the mode, we'll just set the attribute through the Javascript
36.2505 + // property for IE <= 8.
36.2506 + if (ko.utils.ieVersion <= 8 && attrName in attrHtmlToJavascriptMap) {
36.2507 + attrName = attrHtmlToJavascriptMap[attrName];
36.2508 + if (toRemove)
36.2509 + element.removeAttribute(attrName);
36.2510 + else
36.2511 + element[attrName] = attrValue;
36.2512 + } else if (!toRemove) {
36.2513 + element.setAttribute(attrName, attrValue.toString());
36.2514 + }
36.2515 + }
36.2516 + }
36.2517 + }
36.2518 +};
36.2519 +
36.2520 +ko.bindingHandlers['hasfocus'] = {
36.2521 + 'init': function(element, valueAccessor, allBindingsAccessor) {
36.2522 + var writeValue = function(valueToWrite) {
36.2523 + var modelValue = valueAccessor();
36.2524 + ko.jsonExpressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'hasfocus', valueToWrite, true);
36.2525 + };
36.2526 + ko.utils.registerEventHandler(element, "focus", function() { writeValue(true) });
36.2527 + ko.utils.registerEventHandler(element, "focusin", function() { writeValue(true) }); // For IE
36.2528 + ko.utils.registerEventHandler(element, "blur", function() { writeValue(false) });
36.2529 + ko.utils.registerEventHandler(element, "focusout", function() { writeValue(false) }); // For IE
36.2530 + },
36.2531 + 'update': function(element, valueAccessor) {
36.2532 + var value = ko.utils.unwrapObservable(valueAccessor());
36.2533 + value ? element.focus() : element.blur();
36.2534 + ko.utils.triggerEvent(element, value ? "focusin" : "focusout"); // For IE, which doesn't reliably fire "focus" or "blur" events synchronously
36.2535 + }
36.2536 +};
36.2537 +
36.2538 +// "with: someExpression" is equivalent to "template: { if: someExpression, data: someExpression }"
36.2539 +ko.bindingHandlers['with'] = {
36.2540 + makeTemplateValueAccessor: function(valueAccessor) {
36.2541 + return function() { var value = valueAccessor(); return { 'if': value, 'data': value, 'templateEngine': ko.nativeTemplateEngine.instance } };
36.2542 + },
36.2543 + 'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2544 + return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['with'].makeTemplateValueAccessor(valueAccessor));
36.2545 + },
36.2546 + 'update': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2547 + return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['with'].makeTemplateValueAccessor(valueAccessor), allBindingsAccessor, viewModel, bindingContext);
36.2548 + }
36.2549 +};
36.2550 +ko.jsonExpressionRewriting.bindingRewriteValidators['with'] = false; // Can't rewrite control flow bindings
36.2551 +ko.virtualElements.allowedBindings['with'] = true;
36.2552 +
36.2553 +// "if: someExpression" is equivalent to "template: { if: someExpression }"
36.2554 +ko.bindingHandlers['if'] = {
36.2555 + makeTemplateValueAccessor: function(valueAccessor) {
36.2556 + return function() { return { 'if': valueAccessor(), 'templateEngine': ko.nativeTemplateEngine.instance } };
36.2557 + },
36.2558 + 'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2559 + return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['if'].makeTemplateValueAccessor(valueAccessor));
36.2560 + },
36.2561 + 'update': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2562 + return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['if'].makeTemplateValueAccessor(valueAccessor), allBindingsAccessor, viewModel, bindingContext);
36.2563 + }
36.2564 +};
36.2565 +ko.jsonExpressionRewriting.bindingRewriteValidators['if'] = false; // Can't rewrite control flow bindings
36.2566 +ko.virtualElements.allowedBindings['if'] = true;
36.2567 +
36.2568 +// "ifnot: someExpression" is equivalent to "template: { ifnot: someExpression }"
36.2569 +ko.bindingHandlers['ifnot'] = {
36.2570 + makeTemplateValueAccessor: function(valueAccessor) {
36.2571 + return function() { return { 'ifnot': valueAccessor(), 'templateEngine': ko.nativeTemplateEngine.instance } };
36.2572 + },
36.2573 + 'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2574 + return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['ifnot'].makeTemplateValueAccessor(valueAccessor));
36.2575 + },
36.2576 + 'update': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2577 + return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['ifnot'].makeTemplateValueAccessor(valueAccessor), allBindingsAccessor, viewModel, bindingContext);
36.2578 + }
36.2579 +};
36.2580 +ko.jsonExpressionRewriting.bindingRewriteValidators['ifnot'] = false; // Can't rewrite control flow bindings
36.2581 +ko.virtualElements.allowedBindings['ifnot'] = true;
36.2582 +
36.2583 +// "foreach: someExpression" is equivalent to "template: { foreach: someExpression }"
36.2584 +// "foreach: { data: someExpression, afterAdd: myfn }" is equivalent to "template: { foreach: someExpression, afterAdd: myfn }"
36.2585 +ko.bindingHandlers['foreach'] = {
36.2586 + makeTemplateValueAccessor: function(valueAccessor) {
36.2587 + return function() {
36.2588 + var bindingValue = ko.utils.unwrapObservable(valueAccessor());
36.2589 +
36.2590 + // If bindingValue is the array, just pass it on its own
36.2591 + if ((!bindingValue) || typeof bindingValue.length == "number")
36.2592 + return { 'foreach': bindingValue, 'templateEngine': ko.nativeTemplateEngine.instance };
36.2593 +
36.2594 + // If bindingValue.data is the array, preserve all relevant options
36.2595 + return {
36.2596 + 'foreach': bindingValue['data'],
36.2597 + 'includeDestroyed': bindingValue['includeDestroyed'],
36.2598 + 'afterAdd': bindingValue['afterAdd'],
36.2599 + 'beforeRemove': bindingValue['beforeRemove'],
36.2600 + 'afterRender': bindingValue['afterRender'],
36.2601 + 'templateEngine': ko.nativeTemplateEngine.instance
36.2602 + };
36.2603 + };
36.2604 + },
36.2605 + 'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2606 + return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));
36.2607 + },
36.2608 + 'update': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.2609 + return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindingsAccessor, viewModel, bindingContext);
36.2610 + }
36.2611 +};
36.2612 +ko.jsonExpressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings
36.2613 +ko.virtualElements.allowedBindings['foreach'] = true;
36.2614 +// If you want to make a custom template engine,
36.2615 +//
36.2616 +// [1] Inherit from this class (like ko.nativeTemplateEngine does)
36.2617 +// [2] Override 'renderTemplateSource', supplying a function with this signature:
36.2618 +//
36.2619 +// function (templateSource, bindingContext, options) {
36.2620 +// // - templateSource.text() is the text of the template you should render
36.2621 +// // - bindingContext.$data is the data you should pass into the template
36.2622 +// // - you might also want to make bindingContext.$parent, bindingContext.$parents,
36.2623 +// // and bindingContext.$root available in the template too
36.2624 +// // - options gives you access to any other properties set on "data-bind: { template: options }"
36.2625 +// //
36.2626 +// // Return value: an array of DOM nodes
36.2627 +// }
36.2628 +//
36.2629 +// [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature:
36.2630 +//
36.2631 +// function (script) {
36.2632 +// // Return value: Whatever syntax means "Evaluate the JavaScript statement 'script' and output the result"
36.2633 +// // For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }'
36.2634 +// }
36.2635 +//
36.2636 +// This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables.
36.2637 +// If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does)
36.2638 +// and then you don't need to override 'createJavaScriptEvaluatorBlock'.
36.2639 +
36.2640 +ko.templateEngine = function () { };
36.2641 +
36.2642 +ko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {
36.2643 + throw new Error("Override renderTemplateSource");
36.2644 +};
36.2645 +
36.2646 +ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) {
36.2647 + throw new Error("Override createJavaScriptEvaluatorBlock");
36.2648 +};
36.2649 +
36.2650 +ko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) {
36.2651 + // Named template
36.2652 + if (typeof template == "string") {
36.2653 + templateDocument = templateDocument || document;
36.2654 + var elem = templateDocument.getElementById(template);
36.2655 + if (!elem)
36.2656 + throw new Error("Cannot find template with ID " + template);
36.2657 + return new ko.templateSources.domElement(elem);
36.2658 + } else if ((template.nodeType == 1) || (template.nodeType == 8)) {
36.2659 + // Anonymous template
36.2660 + return new ko.templateSources.anonymousTemplate(template);
36.2661 + } else
36.2662 + throw new Error("Unknown template type: " + template);
36.2663 +};
36.2664 +
36.2665 +ko.templateEngine.prototype['renderTemplate'] = function (template, bindingContext, options, templateDocument) {
36.2666 + var templateSource = this['makeTemplateSource'](template, templateDocument);
36.2667 + return this['renderTemplateSource'](templateSource, bindingContext, options);
36.2668 +};
36.2669 +
36.2670 +ko.templateEngine.prototype['isTemplateRewritten'] = function (template, templateDocument) {
36.2671 + // Skip rewriting if requested
36.2672 + if (this['allowTemplateRewriting'] === false)
36.2673 + return true;
36.2674 +
36.2675 + // Perf optimisation - see below
36.2676 + var templateIsInExternalDocument = templateDocument && templateDocument != document;
36.2677 + if (!templateIsInExternalDocument && this.knownRewrittenTemplates && this.knownRewrittenTemplates[template])
36.2678 + return true;
36.2679 +
36.2680 + return this['makeTemplateSource'](template, templateDocument)['data']("isRewritten");
36.2681 +};
36.2682 +
36.2683 +ko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCallback, templateDocument) {
36.2684 + var templateSource = this['makeTemplateSource'](template, templateDocument);
36.2685 + var rewritten = rewriterCallback(templateSource['text']());
36.2686 + templateSource['text'](rewritten);
36.2687 + templateSource['data']("isRewritten", true);
36.2688 +
36.2689 + // Perf optimisation - for named templates, track which ones have been rewritten so we can
36.2690 + // answer 'isTemplateRewritten' *without* having to use getElementById (which is slow on IE < 8)
36.2691 + //
36.2692 + // Note that we only cache the status for templates in the main document, because caching on a per-doc
36.2693 + // basis complicates the implementation excessively. In a future version of KO, we will likely remove
36.2694 + // this 'isRewritten' cache entirely anyway, because the benefit is extremely minor and only applies
36.2695 + // to rewritable templates, which are pretty much deprecated since KO 2.0.
36.2696 + var templateIsInExternalDocument = templateDocument && templateDocument != document;
36.2697 + if (!templateIsInExternalDocument && typeof template == "string") {
36.2698 + this.knownRewrittenTemplates = this.knownRewrittenTemplates || {};
36.2699 + this.knownRewrittenTemplates[template] = true;
36.2700 + }
36.2701 +};
36.2702 +
36.2703 +ko.exportSymbol('templateEngine', ko.templateEngine);
36.2704 +
36.2705 +ko.templateRewriting = (function () {
36.2706 + var memoizeDataBindingAttributeSyntaxRegex = /(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi;
36.2707 + var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g;
36.2708 +
36.2709 + function validateDataBindValuesForRewriting(keyValueArray) {
36.2710 + var allValidators = ko.jsonExpressionRewriting.bindingRewriteValidators;
36.2711 + for (var i = 0; i < keyValueArray.length; i++) {
36.2712 + var key = keyValueArray[i]['key'];
36.2713 + if (allValidators.hasOwnProperty(key)) {
36.2714 + var validator = allValidators[key];
36.2715 +
36.2716 + if (typeof validator === "function") {
36.2717 + var possibleErrorMessage = validator(keyValueArray[i]['value']);
36.2718 + if (possibleErrorMessage)
36.2719 + throw new Error(possibleErrorMessage);
36.2720 + } else if (!validator) {
36.2721 + throw new Error("This template engine does not support the '" + key + "' binding within its templates");
36.2722 + }
36.2723 + }
36.2724 + }
36.2725 + }
36.2726 +
36.2727 + function constructMemoizedTagReplacement(dataBindAttributeValue, tagToRetain, templateEngine) {
36.2728 + var dataBindKeyValueArray = ko.jsonExpressionRewriting.parseObjectLiteral(dataBindAttributeValue);
36.2729 + validateDataBindValuesForRewriting(dataBindKeyValueArray);
36.2730 + var rewrittenDataBindAttributeValue = ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson(dataBindKeyValueArray);
36.2731 +
36.2732 + // For no obvious reason, Opera fails to evaluate rewrittenDataBindAttributeValue unless it's wrapped in an additional
36.2733 + // anonymous function, even though Opera's built-in debugger can evaluate it anyway. No other browser requires this
36.2734 + // extra indirection.
36.2735 + var applyBindingsToNextSiblingScript = "ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() { \
36.2736 + return (function() { return { " + rewrittenDataBindAttributeValue + " } })() \
36.2737 + })";
36.2738 + return templateEngine['createJavaScriptEvaluatorBlock'](applyBindingsToNextSiblingScript) + tagToRetain;
36.2739 + }
36.2740 +
36.2741 + return {
36.2742 + ensureTemplateIsRewritten: function (template, templateEngine, templateDocument) {
36.2743 + if (!templateEngine['isTemplateRewritten'](template, templateDocument))
36.2744 + templateEngine['rewriteTemplate'](template, function (htmlString) {
36.2745 + return ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine);
36.2746 + }, templateDocument);
36.2747 + },
36.2748 +
36.2749 + memoizeBindingAttributeSyntax: function (htmlString, templateEngine) {
36.2750 + return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, function () {
36.2751 + return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[6], /* tagToRetain: */ arguments[1], templateEngine);
36.2752 + }).replace(memoizeVirtualContainerBindingSyntaxRegex, function() {
36.2753 + return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[1], /* tagToRetain: */ "<!-- ko -->", templateEngine);
36.2754 + });
36.2755 + },
36.2756 +
36.2757 + applyMemoizedBindingsToNextSibling: function (bindings) {
36.2758 + return ko.memoization.memoize(function (domNode, bindingContext) {
36.2759 + if (domNode.nextSibling)
36.2760 + ko.applyBindingsToNode(domNode.nextSibling, bindings, bindingContext);
36.2761 + });
36.2762 + }
36.2763 + }
36.2764 +})();
36.2765 +
36.2766 +ko.exportSymbol('templateRewriting', ko.templateRewriting);
36.2767 +ko.exportSymbol('templateRewriting.applyMemoizedBindingsToNextSibling', ko.templateRewriting.applyMemoizedBindingsToNextSibling); // Exported only because it has to be referenced by string lookup from within rewritten template
36.2768 +(function() {
36.2769 + // A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving
36.2770 + // logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)
36.2771 + //
36.2772 + // Two are provided by default:
36.2773 + // 1. ko.templateSources.domElement - reads/writes the text content of an arbitrary DOM element
36.2774 + // 2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but
36.2775 + // without reading/writing the actual element text content, since it will be overwritten
36.2776 + // with the rendered template output.
36.2777 + // You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.
36.2778 + // Template sources need to have the following functions:
36.2779 + // text() - returns the template text from your storage location
36.2780 + // text(value) - writes the supplied template text to your storage location
36.2781 + // data(key) - reads values stored using data(key, value) - see below
36.2782 + // data(key, value) - associates "value" with this template and the key "key". Is used to store information like "isRewritten".
36.2783 + //
36.2784 + // Optionally, template sources can also have the following functions:
36.2785 + // nodes() - returns a DOM element containing the nodes of this template, where available
36.2786 + // nodes(value) - writes the given DOM element to your storage location
36.2787 + // If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()
36.2788 + // for improved speed. However, all templateSources must supply text() even if they don't supply nodes().
36.2789 + //
36.2790 + // Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were
36.2791 + // using and overriding "makeTemplateSource" to return an instance of your custom template source.
36.2792 +
36.2793 + ko.templateSources = {};
36.2794 +
36.2795 + // ---- ko.templateSources.domElement -----
36.2796 +
36.2797 + ko.templateSources.domElement = function(element) {
36.2798 + this.domElement = element;
36.2799 + }
36.2800 +
36.2801 + ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) {
36.2802 + var tagNameLower = ko.utils.tagNameLower(this.domElement),
36.2803 + elemContentsProperty = tagNameLower === "script" ? "text"
36.2804 + : tagNameLower === "textarea" ? "value"
36.2805 + : "innerHTML";
36.2806 +
36.2807 + if (arguments.length == 0) {
36.2808 + return this.domElement[elemContentsProperty];
36.2809 + } else {
36.2810 + var valueToWrite = arguments[0];
36.2811 + if (elemContentsProperty === "innerHTML")
36.2812 + ko.utils.setHtml(this.domElement, valueToWrite);
36.2813 + else
36.2814 + this.domElement[elemContentsProperty] = valueToWrite;
36.2815 + }
36.2816 + };
36.2817 +
36.2818 + ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {
36.2819 + if (arguments.length === 1) {
36.2820 + return ko.utils.domData.get(this.domElement, "templateSourceData_" + key);
36.2821 + } else {
36.2822 + ko.utils.domData.set(this.domElement, "templateSourceData_" + key, arguments[1]);
36.2823 + }
36.2824 + };
36.2825 +
36.2826 + // ---- ko.templateSources.anonymousTemplate -----
36.2827 + // Anonymous templates are normally saved/retrieved as DOM nodes through "nodes".
36.2828 + // For compatibility, you can also read "text"; it will be serialized from the nodes on demand.
36.2829 + // Writing to "text" is still supported, but then the template data will not be available as DOM nodes.
36.2830 +
36.2831 + var anonymousTemplatesDomDataKey = "__ko_anon_template__";
36.2832 + ko.templateSources.anonymousTemplate = function(element) {
36.2833 + this.domElement = element;
36.2834 + }
36.2835 + ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();
36.2836 + ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {
36.2837 + if (arguments.length == 0) {
36.2838 + var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
36.2839 + if (templateData.textData === undefined && templateData.containerData)
36.2840 + templateData.textData = templateData.containerData.innerHTML;
36.2841 + return templateData.textData;
36.2842 + } else {
36.2843 + var valueToWrite = arguments[0];
36.2844 + ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {textData: valueToWrite});
36.2845 + }
36.2846 + };
36.2847 + ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) {
36.2848 + if (arguments.length == 0) {
36.2849 + var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
36.2850 + return templateData.containerData;
36.2851 + } else {
36.2852 + var valueToWrite = arguments[0];
36.2853 + ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {containerData: valueToWrite});
36.2854 + }
36.2855 + };
36.2856 +
36.2857 + ko.exportSymbol('templateSources', ko.templateSources);
36.2858 + ko.exportSymbol('templateSources.domElement', ko.templateSources.domElement);
36.2859 + ko.exportSymbol('templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate);
36.2860 +})();
36.2861 +(function () {
36.2862 + var _templateEngine;
36.2863 + ko.setTemplateEngine = function (templateEngine) {
36.2864 + if ((templateEngine != undefined) && !(templateEngine instanceof ko.templateEngine))
36.2865 + throw new Error("templateEngine must inherit from ko.templateEngine");
36.2866 + _templateEngine = templateEngine;
36.2867 + }
36.2868 +
36.2869 + function invokeForEachNodeOrCommentInContinuousRange(firstNode, lastNode, action) {
36.2870 + var node, nextInQueue = firstNode, firstOutOfRangeNode = ko.virtualElements.nextSibling(lastNode);
36.2871 + while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) {
36.2872 + nextInQueue = ko.virtualElements.nextSibling(node);
36.2873 + if (node.nodeType === 1 || node.nodeType === 8)
36.2874 + action(node);
36.2875 + }
36.2876 + }
36.2877 +
36.2878 + function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext) {
36.2879 + // To be used on any nodes that have been rendered by a template and have been inserted into some parent element
36.2880 + // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because
36.2881 + // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,
36.2882 + // (1) Does a regular "applyBindings" to associate bindingContext with this node and to activate any non-memoized bindings
36.2883 + // (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)
36.2884 +
36.2885 + if (continuousNodeArray.length) {
36.2886 + var firstNode = continuousNodeArray[0], lastNode = continuousNodeArray[continuousNodeArray.length - 1];
36.2887 +
36.2888 + // Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
36.2889 + // whereas a regular applyBindings won't introduce new memoized nodes
36.2890 + invokeForEachNodeOrCommentInContinuousRange(firstNode, lastNode, function(node) {
36.2891 + ko.applyBindings(bindingContext, node);
36.2892 + });
36.2893 + invokeForEachNodeOrCommentInContinuousRange(firstNode, lastNode, function(node) {
36.2894 + ko.memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]);
36.2895 + });
36.2896 + }
36.2897 + }
36.2898 +
36.2899 + function getFirstNodeFromPossibleArray(nodeOrNodeArray) {
36.2900 + return nodeOrNodeArray.nodeType ? nodeOrNodeArray
36.2901 + : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0]
36.2902 + : null;
36.2903 + }
36.2904 +
36.2905 + function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {
36.2906 + options = options || {};
36.2907 + var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
36.2908 + var templateDocument = firstTargetNode && firstTargetNode.ownerDocument;
36.2909 + var templateEngineToUse = (options['templateEngine'] || _templateEngine);
36.2910 + ko.templateRewriting.ensureTemplateIsRewritten(template, templateEngineToUse, templateDocument);
36.2911 + var renderedNodesArray = templateEngineToUse['renderTemplate'](template, bindingContext, options, templateDocument);
36.2912 +
36.2913 + // Loosely check result is an array of DOM nodes
36.2914 + if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
36.2915 + throw new Error("Template engine must return an array of DOM nodes");
36.2916 +
36.2917 + var haveAddedNodesToParent = false;
36.2918 + switch (renderMode) {
36.2919 + case "replaceChildren":
36.2920 + ko.virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray);
36.2921 + haveAddedNodesToParent = true;
36.2922 + break;
36.2923 + case "replaceNode":
36.2924 + ko.utils.replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray);
36.2925 + haveAddedNodesToParent = true;
36.2926 + break;
36.2927 + case "ignoreTargetNode": break;
36.2928 + default:
36.2929 + throw new Error("Unknown renderMode: " + renderMode);
36.2930 + }
36.2931 +
36.2932 + if (haveAddedNodesToParent) {
36.2933 + activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext);
36.2934 + if (options['afterRender'])
36.2935 + options['afterRender'](renderedNodesArray, bindingContext['$data']);
36.2936 + }
36.2937 +
36.2938 + return renderedNodesArray;
36.2939 + }
36.2940 +
36.2941 + ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {
36.2942 + options = options || {};
36.2943 + if ((options['templateEngine'] || _templateEngine) == undefined)
36.2944 + throw new Error("Set a template engine before calling renderTemplate");
36.2945 + renderMode = renderMode || "replaceChildren";
36.2946 +
36.2947 + if (targetNodeOrNodeArray) {
36.2948 + var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
36.2949 +
36.2950 + var whenToDispose = function () { return (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation)
36.2951 + var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == "replaceNode") ? firstTargetNode.parentNode : firstTargetNode;
36.2952 +
36.2953 + return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes
36.2954 + function () {
36.2955 + // Ensure we've got a proper binding context to work with
36.2956 + var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))
36.2957 + ? dataOrBindingContext
36.2958 + : new ko.bindingContext(ko.utils.unwrapObservable(dataOrBindingContext));
36.2959 +
36.2960 + // Support selecting template as a function of the data being rendered
36.2961 + var templateName = typeof(template) == 'function' ? template(bindingContext['$data']) : template;
36.2962 +
36.2963 + var renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options);
36.2964 + if (renderMode == "replaceNode") {
36.2965 + targetNodeOrNodeArray = renderedNodesArray;
36.2966 + firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
36.2967 + }
36.2968 + },
36.2969 + null,
36.2970 + { 'disposeWhen': whenToDispose, 'disposeWhenNodeIsRemoved': activelyDisposeWhenNodeIsRemoved }
36.2971 + );
36.2972 + } else {
36.2973 + // We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node
36.2974 + return ko.memoization.memoize(function (domNode) {
36.2975 + ko.renderTemplate(template, dataOrBindingContext, options, domNode, "replaceNode");
36.2976 + });
36.2977 + }
36.2978 + };
36.2979 +
36.2980 + ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) {
36.2981 + // Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then
36.2982 + // activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.
36.2983 + var arrayItemContext;
36.2984 +
36.2985 + // This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode
36.2986 + var executeTemplateForArrayItem = function (arrayValue, index) {
36.2987 + // Support selecting template as a function of the data being rendered
36.2988 + var templateName = typeof(template) == 'function' ? template(arrayValue) : template;
36.2989 + arrayItemContext = parentBindingContext['createChildContext'](ko.utils.unwrapObservable(arrayValue));
36.2990 + arrayItemContext['$index'] = index;
36.2991 + return executeTemplate(null, "ignoreTargetNode", templateName, arrayItemContext, options);
36.2992 + }
36.2993 +
36.2994 + // This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode
36.2995 + var activateBindingsCallback = function(arrayValue, addedNodesArray, index) {
36.2996 + activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext);
36.2997 + if (options['afterRender'])
36.2998 + options['afterRender'](addedNodesArray, arrayValue);
36.2999 + };
36.3000 +
36.3001 + return ko.dependentObservable(function () {
36.3002 + var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || [];
36.3003 + if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
36.3004 + unwrappedArray = [unwrappedArray];
36.3005 +
36.3006 + // Filter out any entries marked as destroyed
36.3007 + var filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
36.3008 + return options['includeDestroyed'] || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
36.3009 + });
36.3010 +
36.3011 + ko.utils.setDomNodeChildrenFromArrayMapping(targetNode, filteredArray, executeTemplateForArrayItem, options, activateBindingsCallback);
36.3012 +
36.3013 + }, null, { 'disposeWhenNodeIsRemoved': targetNode });
36.3014 + };
36.3015 +
36.3016 + var templateSubscriptionDomDataKey = '__ko__templateSubscriptionDomDataKey__';
36.3017 + function disposeOldSubscriptionAndStoreNewOne(element, newSubscription) {
36.3018 + var oldSubscription = ko.utils.domData.get(element, templateSubscriptionDomDataKey);
36.3019 + if (oldSubscription && (typeof(oldSubscription.dispose) == 'function'))
36.3020 + oldSubscription.dispose();
36.3021 + ko.utils.domData.set(element, templateSubscriptionDomDataKey, newSubscription);
36.3022 + }
36.3023 +
36.3024 + ko.bindingHandlers['template'] = {
36.3025 + 'init': function(element, valueAccessor) {
36.3026 + // Support anonymous templates
36.3027 + var bindingValue = ko.utils.unwrapObservable(valueAccessor());
36.3028 + if ((typeof bindingValue != "string") && (!bindingValue['name']) && (element.nodeType == 1 || element.nodeType == 8)) {
36.3029 + // It's an anonymous template - store the element contents, then clear the element
36.3030 + var templateNodes = element.nodeType == 1 ? element.childNodes : ko.virtualElements.childNodes(element),
36.3031 + container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
36.3032 + new ko.templateSources.anonymousTemplate(element)['nodes'](container);
36.3033 + }
36.3034 + return { 'controlsDescendantBindings': true };
36.3035 + },
36.3036 + 'update': function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
36.3037 + var bindingValue = ko.utils.unwrapObservable(valueAccessor());
36.3038 + var templateName;
36.3039 + var shouldDisplay = true;
36.3040 +
36.3041 + if (typeof bindingValue == "string") {
36.3042 + templateName = bindingValue;
36.3043 + } else {
36.3044 + templateName = bindingValue['name'];
36.3045 +
36.3046 + // Support "if"/"ifnot" conditions
36.3047 + if ('if' in bindingValue)
36.3048 + shouldDisplay = shouldDisplay && ko.utils.unwrapObservable(bindingValue['if']);
36.3049 + if ('ifnot' in bindingValue)
36.3050 + shouldDisplay = shouldDisplay && !ko.utils.unwrapObservable(bindingValue['ifnot']);
36.3051 + }
36.3052 +
36.3053 + var templateSubscription = null;
36.3054 +
36.3055 + if ((typeof bindingValue === 'object') && ('foreach' in bindingValue)) { // Note: can't use 'in' operator on strings
36.3056 + // Render once for each data point (treating data set as empty if shouldDisplay==false)
36.3057 + var dataArray = (shouldDisplay && bindingValue['foreach']) || [];
36.3058 + templateSubscription = ko.renderTemplateForEach(templateName || element, dataArray, /* options: */ bindingValue, element, bindingContext);
36.3059 + } else {
36.3060 + if (shouldDisplay) {
36.3061 + // Render once for this single data point (or use the viewModel if no data was provided)
36.3062 + var innerBindingContext = (typeof bindingValue == 'object') && ('data' in bindingValue)
36.3063 + ? bindingContext['createChildContext'](ko.utils.unwrapObservable(bindingValue['data'])) // Given an explitit 'data' value, we create a child binding context for it
36.3064 + : bindingContext; // Given no explicit 'data' value, we retain the same binding context
36.3065 + templateSubscription = ko.renderTemplate(templateName || element, innerBindingContext, /* options: */ bindingValue, element);
36.3066 + } else
36.3067 + ko.virtualElements.emptyNode(element);
36.3068 + }
36.3069 +
36.3070 + // It only makes sense to have a single template subscription per element (otherwise which one should have its output displayed?)
36.3071 + disposeOldSubscriptionAndStoreNewOne(element, templateSubscription);
36.3072 + }
36.3073 + };
36.3074 +
36.3075 + // Anonymous templates can't be rewritten. Give a nice error message if you try to do it.
36.3076 + ko.jsonExpressionRewriting.bindingRewriteValidators['template'] = function(bindingValue) {
36.3077 + var parsedBindingValue = ko.jsonExpressionRewriting.parseObjectLiteral(bindingValue);
36.3078 +
36.3079 + if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown'])
36.3080 + return null; // It looks like a string literal, not an object literal, so treat it as a named template (which is allowed for rewriting)
36.3081 +
36.3082 + if (ko.jsonExpressionRewriting.keyValueArrayContainsKey(parsedBindingValue, "name"))
36.3083 + return null; // Named templates can be rewritten, so return "no error"
36.3084 + return "This template engine does not support anonymous templates nested within its templates";
36.3085 + };
36.3086 +
36.3087 + ko.virtualElements.allowedBindings['template'] = true;
36.3088 +})();
36.3089 +
36.3090 +ko.exportSymbol('setTemplateEngine', ko.setTemplateEngine);
36.3091 +ko.exportSymbol('renderTemplate', ko.renderTemplate);
36.3092 +
36.3093 +(function () {
36.3094 + // Simple calculation based on Levenshtein distance.
36.3095 + function calculateEditDistanceMatrix(oldArray, newArray, maxAllowedDistance) {
36.3096 + var distances = [];
36.3097 + for (var i = 0; i <= newArray.length; i++)
36.3098 + distances[i] = [];
36.3099 +
36.3100 + // Top row - transform old array into empty array via deletions
36.3101 + for (var i = 0, j = Math.min(oldArray.length, maxAllowedDistance); i <= j; i++)
36.3102 + distances[0][i] = i;
36.3103 +
36.3104 + // Left row - transform empty array into new array via additions
36.3105 + for (var i = 1, j = Math.min(newArray.length, maxAllowedDistance); i <= j; i++) {
36.3106 + distances[i][0] = i;
36.3107 + }
36.3108 +
36.3109 + // Fill out the body of the array
36.3110 + var oldIndex, oldIndexMax = oldArray.length, newIndex, newIndexMax = newArray.length;
36.3111 + var distanceViaAddition, distanceViaDeletion;
36.3112 + for (oldIndex = 1; oldIndex <= oldIndexMax; oldIndex++) {
36.3113 + var newIndexMinForRow = Math.max(1, oldIndex - maxAllowedDistance);
36.3114 + var newIndexMaxForRow = Math.min(newIndexMax, oldIndex + maxAllowedDistance);
36.3115 + for (newIndex = newIndexMinForRow; newIndex <= newIndexMaxForRow; newIndex++) {
36.3116 + if (oldArray[oldIndex - 1] === newArray[newIndex - 1])
36.3117 + distances[newIndex][oldIndex] = distances[newIndex - 1][oldIndex - 1];
36.3118 + else {
36.3119 + var northDistance = distances[newIndex - 1][oldIndex] === undefined ? Number.MAX_VALUE : distances[newIndex - 1][oldIndex] + 1;
36.3120 + var westDistance = distances[newIndex][oldIndex - 1] === undefined ? Number.MAX_VALUE : distances[newIndex][oldIndex - 1] + 1;
36.3121 + distances[newIndex][oldIndex] = Math.min(northDistance, westDistance);
36.3122 + }
36.3123 + }
36.3124 + }
36.3125 +
36.3126 + return distances;
36.3127 + }
36.3128 +
36.3129 + function findEditScriptFromEditDistanceMatrix(editDistanceMatrix, oldArray, newArray) {
36.3130 + var oldIndex = oldArray.length;
36.3131 + var newIndex = newArray.length;
36.3132 + var editScript = [];
36.3133 + var maxDistance = editDistanceMatrix[newIndex][oldIndex];
36.3134 + if (maxDistance === undefined)
36.3135 + return null; // maxAllowedDistance must be too small
36.3136 + while ((oldIndex > 0) || (newIndex > 0)) {
36.3137 + var me = editDistanceMatrix[newIndex][oldIndex];
36.3138 + var distanceViaAdd = (newIndex > 0) ? editDistanceMatrix[newIndex - 1][oldIndex] : maxDistance + 1;
36.3139 + var distanceViaDelete = (oldIndex > 0) ? editDistanceMatrix[newIndex][oldIndex - 1] : maxDistance + 1;
36.3140 + var distanceViaRetain = (newIndex > 0) && (oldIndex > 0) ? editDistanceMatrix[newIndex - 1][oldIndex - 1] : maxDistance + 1;
36.3141 + if ((distanceViaAdd === undefined) || (distanceViaAdd < me - 1)) distanceViaAdd = maxDistance + 1;
36.3142 + if ((distanceViaDelete === undefined) || (distanceViaDelete < me - 1)) distanceViaDelete = maxDistance + 1;
36.3143 + if (distanceViaRetain < me - 1) distanceViaRetain = maxDistance + 1;
36.3144 +
36.3145 + if ((distanceViaAdd <= distanceViaDelete) && (distanceViaAdd < distanceViaRetain)) {
36.3146 + editScript.push({ status: "added", value: newArray[newIndex - 1] });
36.3147 + newIndex--;
36.3148 + } else if ((distanceViaDelete < distanceViaAdd) && (distanceViaDelete < distanceViaRetain)) {
36.3149 + editScript.push({ status: "deleted", value: oldArray[oldIndex - 1] });
36.3150 + oldIndex--;
36.3151 + } else {
36.3152 + editScript.push({ status: "retained", value: oldArray[oldIndex - 1] });
36.3153 + newIndex--;
36.3154 + oldIndex--;
36.3155 + }
36.3156 + }
36.3157 + return editScript.reverse();
36.3158 + }
36.3159 +
36.3160 + ko.utils.compareArrays = function (oldArray, newArray, maxEditsToConsider) {
36.3161 + if (maxEditsToConsider === undefined) {
36.3162 + return ko.utils.compareArrays(oldArray, newArray, 1) // First consider likely case where there is at most one edit (very fast)
36.3163 + || ko.utils.compareArrays(oldArray, newArray, 10) // If that fails, account for a fair number of changes while still being fast
36.3164 + || ko.utils.compareArrays(oldArray, newArray, Number.MAX_VALUE); // Ultimately give the right answer, even though it may take a long time
36.3165 + } else {
36.3166 + oldArray = oldArray || [];
36.3167 + newArray = newArray || [];
36.3168 + var editDistanceMatrix = calculateEditDistanceMatrix(oldArray, newArray, maxEditsToConsider);
36.3169 + return findEditScriptFromEditDistanceMatrix(editDistanceMatrix, oldArray, newArray);
36.3170 + }
36.3171 + };
36.3172 +})();
36.3173 +
36.3174 +ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
36.3175 +
36.3176 +(function () {
36.3177 + // Objective:
36.3178 + // * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes,
36.3179 + // map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node
36.3180 + // * Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node
36.3181 + // so that its children is again the concatenation of the mappings of the array elements, but don't re-map any array elements that we
36.3182 + // previously mapped - retain those nodes, and just insert/delete other ones
36.3183 +
36.3184 + // "callbackAfterAddingNodes" will be invoked after any "mapping"-generated nodes are inserted into the container node
36.3185 + // You can use this, for example, to activate bindings on those nodes.
36.3186 +
36.3187 + function fixUpVirtualElements(contiguousNodeArray) {
36.3188 + // Ensures that contiguousNodeArray really *is* an array of contiguous siblings, even if some of the interior
36.3189 + // ones have changed since your array was first built (e.g., because your array contains virtual elements, and
36.3190 + // their virtual children changed when binding was applied to them).
36.3191 + // This is needed so that we can reliably remove or update the nodes corresponding to a given array item
36.3192 +
36.3193 + if (contiguousNodeArray.length > 2) {
36.3194 + // Build up the actual new contiguous node set
36.3195 + var current = contiguousNodeArray[0], last = contiguousNodeArray[contiguousNodeArray.length - 1], newContiguousSet = [current];
36.3196 + while (current !== last) {
36.3197 + current = current.nextSibling;
36.3198 + if (!current) // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario)
36.3199 + return;
36.3200 + newContiguousSet.push(current);
36.3201 + }
36.3202 +
36.3203 + // ... then mutate the input array to match this.
36.3204 + // (The following line replaces the contents of contiguousNodeArray with newContiguousSet)
36.3205 + Array.prototype.splice.apply(contiguousNodeArray, [0, contiguousNodeArray.length].concat(newContiguousSet));
36.3206 + }
36.3207 + }
36.3208 +
36.3209 + function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {
36.3210 + // Map this array value inside a dependentObservable so we re-map when any dependency changes
36.3211 + var mappedNodes = [];
36.3212 + var dependentObservable = ko.dependentObservable(function() {
36.3213 + var newMappedNodes = mapping(valueToMap, index) || [];
36.3214 +
36.3215 + // On subsequent evaluations, just replace the previously-inserted DOM nodes
36.3216 + if (mappedNodes.length > 0) {
36.3217 + fixUpVirtualElements(mappedNodes);
36.3218 + ko.utils.replaceDomNodes(mappedNodes, newMappedNodes);
36.3219 + if (callbackAfterAddingNodes)
36.3220 + callbackAfterAddingNodes(valueToMap, newMappedNodes);
36.3221 + }
36.3222 +
36.3223 + // Replace the contents of the mappedNodes array, thereby updating the record
36.3224 + // of which nodes would be deleted if valueToMap was itself later removed
36.3225 + mappedNodes.splice(0, mappedNodes.length);
36.3226 + ko.utils.arrayPushAll(mappedNodes, newMappedNodes);
36.3227 + }, null, { 'disposeWhenNodeIsRemoved': containerNode, 'disposeWhen': function() { return (mappedNodes.length == 0) || !ko.utils.domNodeIsAttachedToDocument(mappedNodes[0]) } });
36.3228 + return { mappedNodes : mappedNodes, dependentObservable : dependentObservable };
36.3229 + }
36.3230 +
36.3231 + var lastMappingResultDomDataKey = "setDomNodeChildrenFromArrayMapping_lastMappingResult";
36.3232 +
36.3233 + ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) {
36.3234 + // Compare the provided array against the previous one
36.3235 + array = array || [];
36.3236 + options = options || {};
36.3237 + var isFirstExecution = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) === undefined;
36.3238 + var lastMappingResult = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) || [];
36.3239 + var lastArray = ko.utils.arrayMap(lastMappingResult, function (x) { return x.arrayEntry; });
36.3240 + var editScript = ko.utils.compareArrays(lastArray, array);
36.3241 +
36.3242 + // Build the new mapping result
36.3243 + var newMappingResult = [];
36.3244 + var lastMappingResultIndex = 0;
36.3245 + var nodesToDelete = [];
36.3246 + var newMappingResultIndex = 0;
36.3247 + var nodesAdded = [];
36.3248 + var insertAfterNode = null;
36.3249 + for (var i = 0, j = editScript.length; i < j; i++) {
36.3250 + switch (editScript[i].status) {
36.3251 + case "retained":
36.3252 + // Just keep the information - don't touch the nodes
36.3253 + var dataToRetain = lastMappingResult[lastMappingResultIndex];
36.3254 + dataToRetain.indexObservable(newMappingResultIndex);
36.3255 + newMappingResultIndex = newMappingResult.push(dataToRetain);
36.3256 + if (dataToRetain.domNodes.length > 0)
36.3257 + insertAfterNode = dataToRetain.domNodes[dataToRetain.domNodes.length - 1];
36.3258 + lastMappingResultIndex++;
36.3259 + break;
36.3260 +
36.3261 + case "deleted":
36.3262 + // Stop tracking changes to the mapping for these nodes
36.3263 + lastMappingResult[lastMappingResultIndex].dependentObservable.dispose();
36.3264 +
36.3265 + // Queue these nodes for later removal
36.3266 + fixUpVirtualElements(lastMappingResult[lastMappingResultIndex].domNodes);
36.3267 + ko.utils.arrayForEach(lastMappingResult[lastMappingResultIndex].domNodes, function (node) {
36.3268 + nodesToDelete.push({
36.3269 + element: node,
36.3270 + index: i,
36.3271 + value: editScript[i].value
36.3272 + });
36.3273 + insertAfterNode = node;
36.3274 + });
36.3275 + lastMappingResultIndex++;
36.3276 + break;
36.3277 +
36.3278 + case "added":
36.3279 + var valueToMap = editScript[i].value;
36.3280 + var indexObservable = ko.observable(newMappingResultIndex);
36.3281 + var mapData = mapNodeAndRefreshWhenChanged(domNode, mapping, valueToMap, callbackAfterAddingNodes, indexObservable);
36.3282 + var mappedNodes = mapData.mappedNodes;
36.3283 +
36.3284 + // On the first evaluation, insert the nodes at the current insertion point
36.3285 + newMappingResultIndex = newMappingResult.push({
36.3286 + arrayEntry: editScript[i].value,
36.3287 + domNodes: mappedNodes,
36.3288 + dependentObservable: mapData.dependentObservable,
36.3289 + indexObservable: indexObservable
36.3290 + });
36.3291 + for (var nodeIndex = 0, nodeIndexMax = mappedNodes.length; nodeIndex < nodeIndexMax; nodeIndex++) {
36.3292 + var node = mappedNodes[nodeIndex];
36.3293 + nodesAdded.push({
36.3294 + element: node,
36.3295 + index: i,
36.3296 + value: editScript[i].value
36.3297 + });
36.3298 + if (insertAfterNode == null) {
36.3299 + // Insert "node" (the newly-created node) as domNode's first child
36.3300 + ko.virtualElements.prepend(domNode, node);
36.3301 + } else {
36.3302 + // Insert "node" into "domNode" immediately after "insertAfterNode"
36.3303 + ko.virtualElements.insertAfter(domNode, node, insertAfterNode);
36.3304 + }
36.3305 + insertAfterNode = node;
36.3306 + }
36.3307 + if (callbackAfterAddingNodes)
36.3308 + callbackAfterAddingNodes(valueToMap, mappedNodes, indexObservable);
36.3309 + break;
36.3310 + }
36.3311 + }
36.3312 +
36.3313 + ko.utils.arrayForEach(nodesToDelete, function (node) { ko.cleanNode(node.element) });
36.3314 +
36.3315 + var invokedBeforeRemoveCallback = false;
36.3316 + if (!isFirstExecution) {
36.3317 + if (options['afterAdd']) {
36.3318 + for (var i = 0; i < nodesAdded.length; i++)
36.3319 + options['afterAdd'](nodesAdded[i].element, nodesAdded[i].index, nodesAdded[i].value);
36.3320 + }
36.3321 + if (options['beforeRemove']) {
36.3322 + for (var i = 0; i < nodesToDelete.length; i++)
36.3323 + options['beforeRemove'](nodesToDelete[i].element, nodesToDelete[i].index, nodesToDelete[i].value);
36.3324 + invokedBeforeRemoveCallback = true;
36.3325 + }
36.3326 + }
36.3327 + if (!invokedBeforeRemoveCallback && nodesToDelete.length) {
36.3328 + for (var i = 0; i < nodesToDelete.length; i++) {
36.3329 + var element = nodesToDelete[i].element;
36.3330 + if (element.parentNode)
36.3331 + element.parentNode.removeChild(element);
36.3332 + }
36.3333 + }
36.3334 +
36.3335 + // Store a copy of the array items we just considered so we can difference it next time
36.3336 + ko.utils.domData.set(domNode, lastMappingResultDomDataKey, newMappingResult);
36.3337 + }
36.3338 +})();
36.3339 +
36.3340 +ko.exportSymbol('utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping);
36.3341 +ko.nativeTemplateEngine = function () {
36.3342 + this['allowTemplateRewriting'] = false;
36.3343 +}
36.3344 +
36.3345 +ko.nativeTemplateEngine.prototype = new ko.templateEngine();
36.3346 +ko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {
36.3347 + var useNodesIfAvailable = !(ko.utils.ieVersion < 9), // IE<9 cloneNode doesn't work properly
36.3348 + templateNodesFunc = useNodesIfAvailable ? templateSource['nodes'] : null,
36.3349 + templateNodes = templateNodesFunc ? templateSource['nodes']() : null;
36.3350 +
36.3351 + if (templateNodes) {
36.3352 + return ko.utils.makeArray(templateNodes.cloneNode(true).childNodes);
36.3353 + } else {
36.3354 + var templateText = templateSource['text']();
36.3355 + return ko.utils.parseHtmlFragment(templateText);
36.3356 + }
36.3357 +};
36.3358 +
36.3359 +ko.nativeTemplateEngine.instance = new ko.nativeTemplateEngine();
36.3360 +ko.setTemplateEngine(ko.nativeTemplateEngine.instance);
36.3361 +
36.3362 +ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);
36.3363 +(function() {
36.3364 + ko.jqueryTmplTemplateEngine = function () {
36.3365 + // Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl
36.3366 + // doesn't expose a version number, so we have to infer it.
36.3367 + // Note that as of Knockout 1.3, we only support jQuery.tmpl 1.0.0pre and later,
36.3368 + // which KO internally refers to as version "2", so older versions are no longer detected.
36.3369 + var jQueryTmplVersion = this.jQueryTmplVersion = (function() {
36.3370 + if ((typeof(jQuery) == "undefined") || !(jQuery['tmpl']))
36.3371 + return 0;
36.3372 + // Since it exposes no official version number, we use our own numbering system. To be updated as jquery-tmpl evolves.
36.3373 + try {
36.3374 + if (jQuery['tmpl']['tag']['tmpl']['open'].toString().indexOf('__') >= 0) {
36.3375 + // Since 1.0.0pre, custom tags should append markup to an array called "__"
36.3376 + return 2; // Final version of jquery.tmpl
36.3377 + }
36.3378 + } catch(ex) { /* Apparently not the version we were looking for */ }
36.3379 +
36.3380 + return 1; // Any older version that we don't support
36.3381 + })();
36.3382 +
36.3383 + function ensureHasReferencedJQueryTemplates() {
36.3384 + if (jQueryTmplVersion < 2)
36.3385 + throw new Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");
36.3386 + }
36.3387 +
36.3388 + function executeTemplate(compiledTemplate, data, jQueryTemplateOptions) {
36.3389 + return jQuery['tmpl'](compiledTemplate, data, jQueryTemplateOptions);
36.3390 + }
36.3391 +
36.3392 + this['renderTemplateSource'] = function(templateSource, bindingContext, options) {
36.3393 + options = options || {};
36.3394 + ensureHasReferencedJQueryTemplates();
36.3395 +
36.3396 + // Ensure we have stored a precompiled version of this template (don't want to reparse on every render)
36.3397 + var precompiled = templateSource['data']('precompiled');
36.3398 + if (!precompiled) {
36.3399 + var templateText = templateSource['text']() || "";
36.3400 + // Wrap in "with($whatever.koBindingContext) { ... }"
36.3401 + templateText = "{{ko_with $item.koBindingContext}}" + templateText + "{{/ko_with}}";
36.3402 +
36.3403 + precompiled = jQuery['template'](null, templateText);
36.3404 + templateSource['data']('precompiled', precompiled);
36.3405 + }
36.3406 +
36.3407 + var data = [bindingContext['$data']]; // Prewrap the data in an array to stop jquery.tmpl from trying to unwrap any arrays
36.3408 + var jQueryTemplateOptions = jQuery['extend']({ 'koBindingContext': bindingContext }, options['templateOptions']);
36.3409 +
36.3410 + var resultNodes = executeTemplate(precompiled, data, jQueryTemplateOptions);
36.3411 + resultNodes['appendTo'](document.createElement("div")); // Using "appendTo" forces jQuery/jQuery.tmpl to perform necessary cleanup work
36.3412 +
36.3413 + jQuery['fragments'] = {}; // Clear jQuery's fragment cache to avoid a memory leak after a large number of template renders
36.3414 + return resultNodes;
36.3415 + };
36.3416 +
36.3417 + this['createJavaScriptEvaluatorBlock'] = function(script) {
36.3418 + return "{{ko_code ((function() { return " + script + " })()) }}";
36.3419 + };
36.3420 +
36.3421 + this['addTemplate'] = function(templateName, templateMarkup) {
36.3422 + document.write("<script type='text/html' id='" + templateName + "'>" + templateMarkup + "</script>");
36.3423 + };
36.3424 +
36.3425 + if (jQueryTmplVersion > 0) {
36.3426 + jQuery['tmpl']['tag']['ko_code'] = {
36.3427 + open: "__.push($1 || '');"
36.3428 + };
36.3429 + jQuery['tmpl']['tag']['ko_with'] = {
36.3430 + open: "with($1) {",
36.3431 + close: "} "
36.3432 + };
36.3433 + }
36.3434 + };
36.3435 +
36.3436 + ko.jqueryTmplTemplateEngine.prototype = new ko.templateEngine();
36.3437 +
36.3438 + // Use this one by default *only if jquery.tmpl is referenced*
36.3439 + var jqueryTmplTemplateEngineInstance = new ko.jqueryTmplTemplateEngine();
36.3440 + if (jqueryTmplTemplateEngineInstance.jQueryTmplVersion > 0)
36.3441 + ko.setTemplateEngine(jqueryTmplTemplateEngineInstance);
36.3442 +
36.3443 + ko.exportSymbol('jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine);
36.3444 +})();
36.3445 +});
36.3446 +})(window,document,navigator);
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/Resources/Web/js/knockout-2.1.0.min.js Sun May 27 20:15:32 2012 +0000
37.3 @@ -0,0 +1,86 @@
37.4 +// Knockout JavaScript library v2.1.0
37.5 +// (c) Steven Sanderson - http://knockoutjs.com/
37.6 +// License: MIT (http://www.opensource.org/licenses/mit-license.php)
37.7 +
37.8 +(function(window,document,navigator,undefined){
37.9 +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)?
37.10 +"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(_.*)?$/],
37.11 +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=[],
37.12 +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]),
37.13 +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<
37.14 +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()},
37.15 +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"));
37.16 +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)?
37.17 +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},
37.18 +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,
37.19 +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]),
37.20 +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);
37.21 +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);
37.22 +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,
37.23 +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&&
37.24 +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])}},
37.25 +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&&
37.26 +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};
37.27 +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<
37.28 +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&&
37.29 +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;
37.30 +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,
37.31 +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:[]})},
37.32 +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,
37.33 +"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",
37.34 +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(),
37.35 +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(),
37.36 +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=
37.37 +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."))}
37.38 +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()};
37.39 +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]=
37.40 +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=
37.41 +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,
37.42 +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=
37.43 +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-
37.44 +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,
37.45 +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);
37.46 +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",
37.47 +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*--\>$/:
37.48 +/^\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)},
37.49 +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=
37.50 +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")!=
37.51 +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: "+
37.52 +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"==
37.53 +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"==
37.54 +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,
37.55 +"__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)}};
37.56 +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=
37.57 +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=
37.58 +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&&
37.59 +("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,
37.60 +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,
37.61 +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)}}};
37.62 +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"));
37.63 +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;
37.64 +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),
37.65 +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&&
37.66 +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}}},
37.67 +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}}},
37.68 +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))},
37.69 +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==
37.70 +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",
37.71 +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)+
37.72 +" } })() })";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,
37.73 +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_"+
37.74 +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]})};
37.75 +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||
37.76 +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"));
37.77 +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,
37.78 +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&&
37.79 +(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__"))&&
37.80 +"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]=
37.81 +[];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=
37.82 +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)||
37.83 +[];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=
37.84 +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,
37.85 +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;
37.86 +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");
37.87 +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=
37.88 +{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;
37.89 +})(window,document,navigator);
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/Resources/Web/js/knockout.mapping-latest.js Sun May 27 20:15:32 2012 +0000
38.3 @@ -0,0 +1,687 @@
38.4 +// Knockout Mapping plugin v2.1.2
38.5 +// (c) 2012 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/
38.6 +// License: MIT (http://www.opensource.org/licenses/mit-license.php)
38.7 +
38.8 +(function (factory) {
38.9 + // Module systems magic dance.
38.10 +
38.11 + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
38.12 + // CommonJS or Node: hard-coded dependency on "knockout"
38.13 + factory(require("knockout"), exports);
38.14 + } else if (typeof define === "function" && define["amd"]) {
38.15 + // AMD anonymous module with hard-coded dependency on "knockout"
38.16 + define(["knockout", "exports"], factory);
38.17 + } else {
38.18 + // <script> tag: use the global `ko` object, attaching a `mapping` property
38.19 + factory(ko, ko.mapping = {});
38.20 + }
38.21 +}(function (ko, exports) {
38.22 + var DEBUG=true;
38.23 + var mappingProperty = "__ko_mapping__";
38.24 + var realKoDependentObservable = ko.dependentObservable;
38.25 + var mappingNesting = 0;
38.26 + var dependentObservables;
38.27 + var visitedObjects;
38.28 +
38.29 + var _defaultOptions = {
38.30 + include: ["_destroy"],
38.31 + ignore: [],
38.32 + copy: []
38.33 + };
38.34 + var defaultOptions = _defaultOptions;
38.35 +
38.36 + exports.isMapped = function (viewModel) {
38.37 + var unwrapped = ko.utils.unwrapObservable(viewModel);
38.38 + return unwrapped && unwrapped[mappingProperty];
38.39 + }
38.40 +
38.41 + exports.fromJS = function (jsObject /*, inputOptions, target*/ ) {
38.42 + if (arguments.length == 0) throw new Error("When calling ko.fromJS, pass the object you want to convert.");
38.43 +
38.44 + // When mapping is completed, even with an exception, reset the nesting level
38.45 + window.setTimeout(function () {
38.46 + mappingNesting = 0;
38.47 + }, 0);
38.48 +
38.49 + if (!mappingNesting++) {
38.50 + dependentObservables = [];
38.51 + visitedObjects = new objectLookup();
38.52 + }
38.53 +
38.54 + var options;
38.55 + var target;
38.56 +
38.57 + if (arguments.length == 2) {
38.58 + if (arguments[1][mappingProperty]) {
38.59 + target = arguments[1];
38.60 + } else {
38.61 + options = arguments[1];
38.62 + }
38.63 + }
38.64 + if (arguments.length == 3) {
38.65 + options = arguments[1];
38.66 + target = arguments[2];
38.67 + }
38.68 +
38.69 + if (target) {
38.70 + options = mergeOptions(target[mappingProperty], options);
38.71 + } else {
38.72 + options = mergeOptions(options);
38.73 + }
38.74 + options.mappedProperties = options.mappedProperties || {};
38.75 +
38.76 + var result = updateViewModel(target, jsObject, options);
38.77 + if (target) {
38.78 + result = target;
38.79 + }
38.80 +
38.81 + // Evaluate any dependent observables that were proxied.
38.82 + // Do this in a timeout to defer execution. Basically, any user code that explicitly looks up the DO will perform the first evaluation. Otherwise,
38.83 + // it will be done by this code.
38.84 + if (!--mappingNesting) {
38.85 + window.setTimeout(function () {
38.86 + while (dependentObservables.length) {
38.87 + var DO = dependentObservables.pop();
38.88 + if (DO) DO();
38.89 + }
38.90 + }, 0);
38.91 + }
38.92 +
38.93 + // Save any new mapping options in the view model, so that updateFromJS can use them later.
38.94 + result[mappingProperty] = mergeOptions(result[mappingProperty], options);
38.95 +
38.96 + return result;
38.97 + };
38.98 +
38.99 + exports.fromJSON = function (jsonString /*, options, target*/ ) {
38.100 + var parsed = ko.utils.parseJson(jsonString);
38.101 + arguments[0] = parsed;
38.102 + return exports.fromJS.apply(this, arguments);
38.103 + };
38.104 +
38.105 + exports.updateFromJS = function (viewModel) {
38.106 + throw new Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!");
38.107 + };
38.108 +
38.109 + exports.updateFromJSON = function (viewModel) {
38.110 + throw new Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!");
38.111 + };
38.112 +
38.113 + exports.toJS = function (rootObject, options) {
38.114 + if (arguments.length == 0) throw new Error("When calling ko.mapping.toJS, pass the object you want to convert.");
38.115 + // Merge in the options used in fromJS
38.116 + options = mergeOptions(rootObject[mappingProperty], options);
38.117 +
38.118 + // We just unwrap everything at every level in the object graph
38.119 + return visitModel(rootObject, function (x) {
38.120 + return ko.utils.unwrapObservable(x)
38.121 + }, options);
38.122 + };
38.123 +
38.124 + exports.toJSON = function (rootObject, options) {
38.125 + var plainJavaScriptObject = exports.toJS(rootObject, options);
38.126 + return ko.utils.stringifyJson(plainJavaScriptObject);
38.127 + };
38.128 +
38.129 + exports.visitModel = function (rootObject, callback, options) {
38.130 + if (arguments.length == 0) throw new Error("When calling ko.mapping.visitModel, pass the object you want to visit.");
38.131 + // Merge in the options used in fromJS
38.132 + options = mergeOptions(rootObject[mappingProperty], options);
38.133 +
38.134 + return visitModel(rootObject, callback, options);
38.135 + };
38.136 +
38.137 + exports.defaultOptions = function () {
38.138 + if (arguments.length > 0) {
38.139 + defaultOptions = arguments[0];
38.140 + } else {
38.141 + return defaultOptions;
38.142 + }
38.143 + };
38.144 +
38.145 + exports.resetDefaultOptions = function () {
38.146 + defaultOptions = {
38.147 + include: _defaultOptions.include.slice(0),
38.148 + ignore: _defaultOptions.ignore.slice(0),
38.149 + copy: _defaultOptions.copy.slice(0)
38.150 + };
38.151 + };
38.152 +
38.153 + exports.getType = function(x) {
38.154 + if ((x) && (typeof (x) === "object")) {
38.155 + if (x.constructor == (new Date).constructor) return "date";
38.156 + if (x.constructor == (new Array).constructor) return "array";
38.157 + }
38.158 + return typeof x;
38.159 + }
38.160 +
38.161 + function extendOptionsArray(distArray, sourceArray) {
38.162 + return ko.utils.arrayGetDistinctValues(
38.163 + ko.utils.arrayPushAll(distArray, sourceArray)
38.164 + );
38.165 + }
38.166 +
38.167 + function extendOptionsObject(target, options) {
38.168 + var type = exports.getType,
38.169 + name, special = { "include": true, "ignore": true, "copy": true },
38.170 + t, o, i = 1, l = arguments.length;
38.171 + if (type(target) !== "object") {
38.172 + target = {};
38.173 + }
38.174 + for (; i < l; i++) {
38.175 + options = arguments[i];
38.176 + if (type(options) !== "object") {
38.177 + options = {};
38.178 + }
38.179 + for (name in options) {
38.180 + t = target[name]; o = options[name];
38.181 + if (name !== "constructor" && special[name] && type(o) !== "array") {
38.182 + if (type(o) !== "string") {
38.183 + throw new Error("ko.mapping.defaultOptions()." + name + " should be an array or string.");
38.184 + }
38.185 + o = [o];
38.186 + }
38.187 + switch (type(o)) {
38.188 + case "object": // Recurse
38.189 + t = type(t) === "object" ? t : {};
38.190 + target[name] = extendOptionsObject(t, o);
38.191 + break;
38.192 + case "array":
38.193 + t = type(t) === "array" ? t : [];
38.194 + target[name] = extendOptionsArray(t, o);
38.195 + break;
38.196 + default:
38.197 + target[name] = o;
38.198 + }
38.199 + }
38.200 + }
38.201 + return target;
38.202 + }
38.203 +
38.204 + function mergeOptions() {
38.205 + var options = ko.utils.arrayPushAll([{}, defaultOptions], arguments); // Always use empty object as target to avoid changing default options
38.206 + options = extendOptionsObject.apply(this, options);
38.207 + return options;
38.208 + }
38.209 +
38.210 + // When using a 'create' callback, we proxy the dependent observable so that it doesn't immediately evaluate on creation.
38.211 + // The reason is that the dependent observables in the user-specified callback may contain references to properties that have not been mapped yet.
38.212 + function withProxyDependentObservable(dependentObservables, callback) {
38.213 + var localDO = ko.dependentObservable;
38.214 + ko.dependentObservable = function (read, owner, options) {
38.215 + options = options || {};
38.216 +
38.217 + if (read && typeof read == "object") { // mirrors condition in knockout implementation of DO's
38.218 + options = read;
38.219 + }
38.220 +
38.221 + var realDeferEvaluation = options.deferEvaluation;
38.222 +
38.223 + var isRemoved = false;
38.224 +
38.225 + // We wrap the original dependent observable so that we can remove it from the 'dependentObservables' list we need to evaluate after mapping has
38.226 + // completed if the user already evaluated the DO themselves in the meantime.
38.227 + var wrap = function (DO) {
38.228 + var wrapped = realKoDependentObservable({
38.229 + read: function () {
38.230 + if (!isRemoved) {
38.231 + ko.utils.arrayRemoveItem(dependentObservables, DO);
38.232 + isRemoved = true;
38.233 + }
38.234 + return DO.apply(DO, arguments);
38.235 + },
38.236 + write: function (val) {
38.237 + return DO(val);
38.238 + },
38.239 + deferEvaluation: true
38.240 + });
38.241 + if(DEBUG) wrapped._wrapper = true;
38.242 + return wrapped;
38.243 + };
38.244 +
38.245 + options.deferEvaluation = true; // will either set for just options, or both read/options.
38.246 + var realDependentObservable = new realKoDependentObservable(read, owner, options);
38.247 +
38.248 + if (!realDeferEvaluation) {
38.249 + realDependentObservable = wrap(realDependentObservable);
38.250 + dependentObservables.push(realDependentObservable);
38.251 + }
38.252 +
38.253 + return realDependentObservable;
38.254 + }
38.255 + ko.dependentObservable.fn = realKoDependentObservable.fn;
38.256 + ko.computed = ko.dependentObservable;
38.257 + var result = callback();
38.258 + ko.dependentObservable = localDO;
38.259 + ko.computed = ko.dependentObservable;
38.260 + return result;
38.261 + }
38.262 +
38.263 + function updateViewModel(mappedRootObject, rootObject, options, parentName, parent, parentPropertyName) {
38.264 + var isArray = ko.utils.unwrapObservable(rootObject) instanceof Array;
38.265 +
38.266 + // If nested object was already mapped previously, take the options from it
38.267 + if (parentName !== undefined && exports.isMapped(mappedRootObject)) {
38.268 + options = ko.utils.unwrapObservable(mappedRootObject)[mappingProperty];
38.269 + parentName = "";
38.270 + parentPropertyName = "";
38.271 + }
38.272 +
38.273 + parentName = parentName || "";
38.274 + parentPropertyName = parentPropertyName || "";
38.275 +
38.276 + var callbackParams = {
38.277 + data: rootObject,
38.278 + parent: parent
38.279 + };
38.280 +
38.281 + var getCallback = function (name) {
38.282 + var callback;
38.283 + if (parentName === "") {
38.284 + callback = options[name];
38.285 + } else if (callback = options[parentName]) {
38.286 + callback = callback[name]
38.287 + }
38.288 + return callback;
38.289 + };
38.290 +
38.291 + var hasCreateCallback = function () {
38.292 + return getCallback("create") instanceof Function;
38.293 + };
38.294 +
38.295 + var createCallback = function (data) {
38.296 + return withProxyDependentObservable(dependentObservables, function () {
38.297 + return getCallback("create")({
38.298 + data: data || callbackParams.data,
38.299 + parent: callbackParams.parent
38.300 + });
38.301 + });
38.302 + };
38.303 +
38.304 + var hasUpdateCallback = function () {
38.305 + return getCallback("update") instanceof Function;
38.306 + };
38.307 +
38.308 + var updateCallback = function (obj, data) {
38.309 + var params = {
38.310 + data: data || callbackParams.data,
38.311 + parent: callbackParams.parent,
38.312 + target: ko.utils.unwrapObservable(obj)
38.313 + };
38.314 +
38.315 + if (ko.isWriteableObservable(obj)) {
38.316 + params.observable = obj;
38.317 + }
38.318 +
38.319 + return getCallback("update")(params);
38.320 + }
38.321 +
38.322 + var alreadyMapped = visitedObjects.get(rootObject);
38.323 + if (alreadyMapped) {
38.324 + return alreadyMapped;
38.325 + }
38.326 +
38.327 + if (!isArray) {
38.328 + // For atomic types, do a direct update on the observable
38.329 + if (!canHaveProperties(rootObject)) {
38.330 + switch (exports.getType(rootObject)) {
38.331 + case "function":
38.332 + if (hasUpdateCallback()) {
38.333 + if (ko.isWriteableObservable(rootObject)) {
38.334 + rootObject(updateCallback(rootObject));
38.335 + mappedRootObject = rootObject;
38.336 + } else {
38.337 + mappedRootObject = updateCallback(rootObject);
38.338 + }
38.339 + } else {
38.340 + mappedRootObject = rootObject;
38.341 + }
38.342 + break;
38.343 + default:
38.344 + if (ko.isWriteableObservable(mappedRootObject)) {
38.345 + if (hasUpdateCallback()) {
38.346 + mappedRootObject(updateCallback(mappedRootObject));
38.347 + } else {
38.348 + mappedRootObject(ko.utils.unwrapObservable(rootObject));
38.349 + }
38.350 + } else {
38.351 + if (hasCreateCallback()) {
38.352 + mappedRootObject = createCallback();
38.353 + } else {
38.354 + mappedRootObject = ko.observable(ko.utils.unwrapObservable(rootObject));
38.355 + }
38.356 +
38.357 + if (hasUpdateCallback()) {
38.358 + mappedRootObject(updateCallback(mappedRootObject));
38.359 + }
38.360 + }
38.361 + break;
38.362 + }
38.363 +
38.364 + } else {
38.365 + mappedRootObject = ko.utils.unwrapObservable(mappedRootObject);
38.366 + if (!mappedRootObject) {
38.367 + if (hasCreateCallback()) {
38.368 + var result = createCallback();
38.369 +
38.370 + if (hasUpdateCallback()) {
38.371 + result = updateCallback(result);
38.372 + }
38.373 +
38.374 + return result;
38.375 + } else {
38.376 + if (hasUpdateCallback()) {
38.377 + return updateCallback(result);
38.378 + }
38.379 +
38.380 + mappedRootObject = {};
38.381 + }
38.382 + }
38.383 +
38.384 + if (hasUpdateCallback()) {
38.385 + mappedRootObject = updateCallback(mappedRootObject);
38.386 + }
38.387 +
38.388 + visitedObjects.save(rootObject, mappedRootObject);
38.389 +
38.390 + // For non-atomic types, visit all properties and update recursively
38.391 + visitPropertiesOrArrayEntries(rootObject, function (indexer) {
38.392 + var fullPropertyName = getPropertyName(parentPropertyName, rootObject, indexer);
38.393 +
38.394 + if (ko.utils.arrayIndexOf(options.ignore, fullPropertyName) != -1) {
38.395 + return;
38.396 + }
38.397 +
38.398 + if (ko.utils.arrayIndexOf(options.copy, fullPropertyName) != -1) {
38.399 + mappedRootObject[indexer] = rootObject[indexer];
38.400 + return;
38.401 + }
38.402 +
38.403 + // In case we are adding an already mapped property, fill it with the previously mapped property value to prevent recursion.
38.404 + // If this is a property that was generated by fromJS, we should use the options specified there
38.405 + var prevMappedProperty = visitedObjects.get(rootObject[indexer]);
38.406 + var value = prevMappedProperty || updateViewModel(mappedRootObject[indexer], rootObject[indexer], options, indexer, mappedRootObject, fullPropertyName);
38.407 +
38.408 + if (ko.isWriteableObservable(mappedRootObject[indexer])) {
38.409 + mappedRootObject[indexer](ko.utils.unwrapObservable(value));
38.410 + } else {
38.411 + mappedRootObject[indexer] = value;
38.412 + }
38.413 +
38.414 + options.mappedProperties[fullPropertyName] = true;
38.415 + });
38.416 + }
38.417 + } else {
38.418 + var changes = [];
38.419 +
38.420 + var hasKeyCallback = getCallback("key") instanceof Function;
38.421 + var keyCallback = hasKeyCallback ? getCallback("key") : function (x) {
38.422 + return x;
38.423 + };
38.424 + if (!ko.isObservable(mappedRootObject)) {
38.425 + // When creating the new observable array, also add a bunch of utility functions that take the 'key' of the array items into account.
38.426 + mappedRootObject = ko.observableArray([]);
38.427 +
38.428 + mappedRootObject.mappedRemove = function (valueOrPredicate) {
38.429 + var predicate = typeof valueOrPredicate == "function" ? valueOrPredicate : function (value) {
38.430 + return value === keyCallback(valueOrPredicate);
38.431 + };
38.432 + return mappedRootObject.remove(function (item) {
38.433 + return predicate(keyCallback(item));
38.434 + });
38.435 + }
38.436 +
38.437 + mappedRootObject.mappedRemoveAll = function (arrayOfValues) {
38.438 + var arrayOfKeys = filterArrayByKey(arrayOfValues, keyCallback);
38.439 + return mappedRootObject.remove(function (item) {
38.440 + return ko.utils.arrayIndexOf(arrayOfKeys, keyCallback(item)) != -1;
38.441 + });
38.442 + }
38.443 +
38.444 + mappedRootObject.mappedDestroy = function (valueOrPredicate) {
38.445 + var predicate = typeof valueOrPredicate == "function" ? valueOrPredicate : function (value) {
38.446 + return value === keyCallback(valueOrPredicate);
38.447 + };
38.448 + return mappedRootObject.destroy(function (item) {
38.449 + return predicate(keyCallback(item));
38.450 + });
38.451 + }
38.452 +
38.453 + mappedRootObject.mappedDestroyAll = function (arrayOfValues) {
38.454 + var arrayOfKeys = filterArrayByKey(arrayOfValues, keyCallback);
38.455 + return mappedRootObject.destroy(function (item) {
38.456 + return ko.utils.arrayIndexOf(arrayOfKeys, keyCallback(item)) != -1;
38.457 + });
38.458 + }
38.459 +
38.460 + mappedRootObject.mappedIndexOf = function (item) {
38.461 + var keys = filterArrayByKey(mappedRootObject(), keyCallback);
38.462 + var key = keyCallback(item);
38.463 + return ko.utils.arrayIndexOf(keys, key);
38.464 + }
38.465 +
38.466 + mappedRootObject.mappedCreate = function (value) {
38.467 + if (mappedRootObject.mappedIndexOf(value) !== -1) {
38.468 + throw new Error("There already is an object with the key that you specified.");
38.469 + }
38.470 +
38.471 + var item = hasCreateCallback() ? createCallback(value) : value;
38.472 + if (hasUpdateCallback()) {
38.473 + var newValue = updateCallback(item, value);
38.474 + if (ko.isWriteableObservable(item)) {
38.475 + item(newValue);
38.476 + } else {
38.477 + item = newValue;
38.478 + }
38.479 + }
38.480 + mappedRootObject.push(item);
38.481 + return item;
38.482 + }
38.483 + }
38.484 +
38.485 + var currentArrayKeys = filterArrayByKey(ko.utils.unwrapObservable(mappedRootObject), keyCallback).sort();
38.486 + var newArrayKeys = filterArrayByKey(rootObject, keyCallback);
38.487 + if (hasKeyCallback) newArrayKeys.sort();
38.488 + var editScript = ko.utils.compareArrays(currentArrayKeys, newArrayKeys);
38.489 +
38.490 + var ignoreIndexOf = {};
38.491 +
38.492 + var newContents = [];
38.493 + for (var i = 0, j = editScript.length; i < j; i++) {
38.494 + var key = editScript[i];
38.495 + var mappedItem;
38.496 + var fullPropertyName = getPropertyName(parentPropertyName, rootObject, i);
38.497 + switch (key.status) {
38.498 + case "added":
38.499 + var item = getItemByKey(ko.utils.unwrapObservable(rootObject), key.value, keyCallback);
38.500 + mappedItem = updateViewModel(undefined, item, options, parentName, mappedRootObject, fullPropertyName);
38.501 + if(!hasCreateCallback()) {
38.502 + mappedItem = ko.utils.unwrapObservable(mappedItem);
38.503 + }
38.504 +
38.505 + var index = ignorableIndexOf(ko.utils.unwrapObservable(rootObject), item, ignoreIndexOf);
38.506 + newContents[index] = mappedItem;
38.507 + ignoreIndexOf[index] = true;
38.508 + break;
38.509 + case "retained":
38.510 + var item = getItemByKey(ko.utils.unwrapObservable(rootObject), key.value, keyCallback);
38.511 + mappedItem = getItemByKey(mappedRootObject, key.value, keyCallback);
38.512 + updateViewModel(mappedItem, item, options, parentName, mappedRootObject, fullPropertyName);
38.513 +
38.514 + var index = ignorableIndexOf(ko.utils.unwrapObservable(rootObject), item, ignoreIndexOf);
38.515 + newContents[index] = mappedItem;
38.516 + ignoreIndexOf[index] = true;
38.517 + break;
38.518 + case "deleted":
38.519 + mappedItem = getItemByKey(mappedRootObject, key.value, keyCallback);
38.520 + break;
38.521 + }
38.522 +
38.523 + changes.push({
38.524 + event: key.status,
38.525 + item: mappedItem
38.526 + });
38.527 + }
38.528 +
38.529 + mappedRootObject(newContents);
38.530 +
38.531 + var arrayChangedCallback = getCallback("arrayChanged");
38.532 + if (arrayChangedCallback instanceof Function) {
38.533 + ko.utils.arrayForEach(changes, function (change) {
38.534 + arrayChangedCallback(change.event, change.item);
38.535 + });
38.536 + }
38.537 + }
38.538 +
38.539 + return mappedRootObject;
38.540 + }
38.541 +
38.542 + function ignorableIndexOf(array, item, ignoreIndices) {
38.543 + for (var i = 0, j = array.length; i < j; i++) {
38.544 + if (ignoreIndices[i] === true) continue;
38.545 + if (array[i] === item) return i;
38.546 + }
38.547 + return null;
38.548 + }
38.549 +
38.550 + function mapKey(item, callback) {
38.551 + var mappedItem;
38.552 + if (callback) mappedItem = callback(item);
38.553 + if (exports.getType(mappedItem) === "undefined") mappedItem = item;
38.554 +
38.555 + return ko.utils.unwrapObservable(mappedItem);
38.556 + }
38.557 +
38.558 + function getItemByKey(array, key, callback) {
38.559 + var filtered = ko.utils.arrayFilter(ko.utils.unwrapObservable(array), function (item) {
38.560 + return mapKey(item, callback) === key;
38.561 + });
38.562 +
38.563 + if (filtered.length == 0) throw new Error("When calling ko.update*, the key '" + key + "' was not found!");
38.564 + if ((filtered.length > 1) && (canHaveProperties(filtered[0]))) throw new Error("When calling ko.update*, the key '" + key + "' was not unique!");
38.565 +
38.566 + return filtered[0];
38.567 + }
38.568 +
38.569 + function filterArrayByKey(array, callback) {
38.570 + return ko.utils.arrayMap(ko.utils.unwrapObservable(array), function (item) {
38.571 + if (callback) {
38.572 + return mapKey(item, callback);
38.573 + } else {
38.574 + return item;
38.575 + }
38.576 + });
38.577 + }
38.578 +
38.579 + function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {
38.580 + if (rootObject instanceof Array) {
38.581 + for (var i = 0; i < rootObject.length; i++)
38.582 + visitorCallback(i);
38.583 + } else {
38.584 + for (var propertyName in rootObject)
38.585 + visitorCallback(propertyName);
38.586 + }
38.587 + };
38.588 +
38.589 + function canHaveProperties(object) {
38.590 + var type = exports.getType(object);
38.591 + return (type === "object" || type === "array") && (object !== null) && (type !== "undefined");
38.592 + }
38.593 +
38.594 + // Based on the parentName, this creates a fully classified name of a property
38.595 +
38.596 + function getPropertyName(parentName, parent, indexer) {
38.597 + var propertyName = parentName || "";
38.598 + if (parent instanceof Array) {
38.599 + if (parentName) {
38.600 + propertyName += "[" + indexer + "]";
38.601 + }
38.602 + } else {
38.603 + if (parentName) {
38.604 + propertyName += ".";
38.605 + }
38.606 + propertyName += indexer;
38.607 + }
38.608 + return propertyName;
38.609 + }
38.610 +
38.611 + function visitModel(rootObject, callback, options, parentName, fullParentName) {
38.612 + // If nested object was already mapped previously, take the options from it
38.613 + if (parentName !== undefined && exports.isMapped(rootObject)) {
38.614 + //options = ko.utils.unwrapObservable(rootObject)[mappingProperty];
38.615 + options = mergeOptions(ko.utils.unwrapObservable(rootObject)[mappingProperty], options);
38.616 + parentName = "";
38.617 + }
38.618 +
38.619 + if (parentName === undefined) { // the first call
38.620 + visitedObjects = new objectLookup();
38.621 + }
38.622 +
38.623 + parentName = parentName || "";
38.624 +
38.625 + var mappedRootObject;
38.626 + var unwrappedRootObject = ko.utils.unwrapObservable(rootObject);
38.627 + if (!canHaveProperties(unwrappedRootObject)) {
38.628 + return callback(rootObject, fullParentName);
38.629 + } else {
38.630 + // Only do a callback, but ignore the results
38.631 + callback(rootObject, fullParentName);
38.632 + mappedRootObject = unwrappedRootObject instanceof Array ? [] : {};
38.633 + }
38.634 +
38.635 + visitedObjects.save(rootObject, mappedRootObject);
38.636 +
38.637 + var origFullParentName = fullParentName;
38.638 + visitPropertiesOrArrayEntries(unwrappedRootObject, function (indexer) {
38.639 + if (options.ignore && ko.utils.arrayIndexOf(options.ignore, indexer) != -1) return;
38.640 +
38.641 + var propertyValue = unwrappedRootObject[indexer];
38.642 + var fullPropertyName = getPropertyName(parentName, unwrappedRootObject, indexer);
38.643 +
38.644 + // If we don't want to explicitly copy the unmapped property...
38.645 + if (ko.utils.arrayIndexOf(options.copy, indexer) === -1) {
38.646 + // ...find out if it's a property we want to explicitly include
38.647 + if (ko.utils.arrayIndexOf(options.include, indexer) === -1) {
38.648 + // Options contains all the properties that were part of the original object.
38.649 + // 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.
38.650 + if (options.mappedProperties && !options.mappedProperties[fullPropertyName] && !(unwrappedRootObject instanceof Array)) {
38.651 + return;
38.652 + }
38.653 + }
38.654 + }
38.655 +
38.656 + fullParentName = getPropertyName(origFullParentName, unwrappedRootObject, indexer);
38.657 +
38.658 + var propertyType = exports.getType(ko.utils.unwrapObservable(propertyValue));
38.659 + switch (propertyType) {
38.660 + case "object":
38.661 + case "array":
38.662 + case "undefined":
38.663 + var previouslyMappedValue = visitedObjects.get(propertyValue);
38.664 + mappedRootObject[indexer] = (exports.getType(previouslyMappedValue) !== "undefined") ? previouslyMappedValue : visitModel(propertyValue, callback, options, fullPropertyName, fullParentName);
38.665 + break;
38.666 + default:
38.667 + mappedRootObject[indexer] = callback(propertyValue, fullParentName);
38.668 + }
38.669 + });
38.670 +
38.671 + return mappedRootObject;
38.672 + }
38.673 +
38.674 + function objectLookup() {
38.675 + var keys = [];
38.676 + var values = [];
38.677 + this.save = function (key, value) {
38.678 + var existingIndex = ko.utils.arrayIndexOf(keys, key);
38.679 + if (existingIndex >= 0) values[existingIndex] = value;
38.680 + else {
38.681 + keys.push(key);
38.682 + values.push(value);
38.683 + }
38.684 + };
38.685 + this.get = function (key) {
38.686 + var existingIndex = ko.utils.arrayIndexOf(keys, key);
38.687 + return (existingIndex >= 0) ? values[existingIndex] : undefined;
38.688 + };
38.689 + };
38.690 +}));
38.691 \ No newline at end of file
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/Resources/Web/js/knockout.mapping-latest.min.js Sun May 27 20:15:32 2012 +0000
39.3 @@ -0,0 +1,19 @@
39.4 +// Knockout Mapping plugin v2.1.2
39.5 +// (c) 2012 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/
39.6 +// License: MIT (http://www.opensource.org/licenses/mit-license.php)
39.7 +
39.8 +(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()."+
39.9 +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||
39.10 +(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;
39.11 +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)||
39.12 +(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,
39.13 +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=
39.14 +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);
39.15 +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)?
39.16 +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!");
39.17 +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,
39.18 +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=
39.19 +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.");
39.20 +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!");
39.21 +};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.");
39.22 +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}});
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/Resources/Web/js/ohm_web.js Sun May 27 20:15:32 2012 +0000
40.3 @@ -0,0 +1,116 @@
40.4 +/*
40.5 +
40.6 + This Source Code Form is subject to the terms of the Mozilla Public
40.7 + License, v. 2.0. If a copy of the MPL was not distributed with this
40.8 + file, You can obtain one at http://mozilla.org/MPL/2.0/.
40.9 +
40.10 + Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
40.11 +
40.12 +*/
40.13 +
40.14 +ko.bindingHandlers.treeTable = {
40.15 + update: function(element, valueAccessor, allBindingsAccessor) {
40.16 + var dependency = ko.utils.unwrapObservable(valueAccessor()),
40.17 + options = ko.toJS(allBindingsAccessor().treeOptions || {});
40.18 +
40.19 + setTimeout(function() { $(element).treeTable(options); }, 0);
40.20 + }
40.21 +};
40.22 +
40.23 +var node = function(config, parent) {
40.24 + this.parent = parent;
40.25 + var _this = this;
40.26 +
40.27 + var mappingOptions = {
40.28 + Children : {
40.29 + create: function(args) {
40.30 + return new node(args.data, _this);
40.31 + }
40.32 + ,
40.33 + key: function(data) {
40.34 + return ko.utils.unwrapObservable(data.id);
40.35 + }
40.36 + }
40.37 + };
40.38 +
40.39 + ko.mapping.fromJS(config, mappingOptions, this);
40.40 +}
40.41 +
40.42 +$(function(){
40.43 + $.getJSON('data.json', function(data) {
40.44 + viewModel = new node(data, undefined);
40.45 +
40.46 + (function() {
40.47 + function flattenChildren(children, result) {
40.48 + ko.utils.arrayForEach(children(), function(child) {
40.49 + result.push(child);
40.50 + if (child.Children) {
40.51 + flattenChildren(child.Children, result);
40.52 + }
40.53 + });
40.54 + }
40.55 +
40.56 + viewModel.flattened = ko.dependentObservable(function() {
40.57 + var result = []; //root node
40.58 +
40.59 + if (viewModel.Children) {
40.60 + flattenChildren(viewModel.Children, result);
40.61 + }
40.62 +
40.63 + return result;
40.64 + });
40.65 +
40.66 + viewModel.update = function() {
40.67 + $.getJSON('data.json', function(data) {
40.68 + ko.mapping.fromJS(data, {}, viewModel);
40.69 + });
40.70 + }
40.71 +
40.72 + viewModel.rate = 3000; //milliseconds
40.73 + viewModel.timer = {};
40.74 +
40.75 + viewModel.startAuto = function (){
40.76 + viewModel.timer = setInterval(viewModel.update, viewModel.rate);
40.77 + }
40.78 +
40.79 + viewModel.stopAuto = function (){
40.80 + clearInterval(viewModel.timer);
40.81 + }
40.82 +
40.83 + viewModel.auto_refresh = ko.observable(false);
40.84 + viewModel.toggleAuto = ko.dependentObservable(function() {
40.85 + if (viewModel.auto_refresh())
40.86 + viewModel.startAuto();
40.87 + else
40.88 + viewModel.stopAuto();
40.89 + }, viewModel);
40.90 +
40.91 + })();
40.92 +
40.93 + ko.applyBindings(viewModel);
40.94 + $("#tree").treeTable({
40.95 + initialState: "expanded",
40.96 + clickableNodeNames: true
40.97 + });
40.98 + });
40.99 + $( "#refresh" ).button();
40.100 + $( "#auto_refresh" ).button();
40.101 + $( "#slider" ).slider({
40.102 + value:3,
40.103 + min: 1,
40.104 + max: 10,
40.105 + slide: function( event, ui ) {
40.106 + viewModel.rate = ui.value * 1000;
40.107 + if (viewModel.auto_refresh()) {
40.108 + //reset the timer
40.109 + viewModel.stopAuto();
40.110 + viewModel.startAuto();
40.111 + }
40.112 + $( "#lbl" ).text( ui.value + "s");
40.113 + }
40.114 + });
40.115 + $( "#lbl" ).text( $( "#slider" ).slider( "value" ) + "s");
40.116 +
40.117 +});
40.118 +
40.119 +
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/Utilities/HttpServer.cs Sun May 27 20:15:32 2012 +0000
41.3 @@ -0,0 +1,371 @@
41.4 +/*
41.5 +
41.6 + This Source Code Form is subject to the terms of the Mozilla Public
41.7 + License, v. 2.0. If a copy of the MPL was not distributed with this
41.8 + file, You can obtain one at http://mozilla.org/MPL/2.0/.
41.9 +
41.10 + Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
41.11 +
41.12 +*/
41.13 +
41.14 +using System;
41.15 +using System.Collections.Generic;
41.16 +using System.Text;
41.17 +using System.Net;
41.18 +using System.Threading;
41.19 +using System.IO;
41.20 +using OpenHardwareMonitor.GUI;
41.21 +using OpenHardwareMonitor.Hardware;
41.22 +using System.Reflection;
41.23 +using System.Drawing;
41.24 +using System.Drawing.Imaging;
41.25 +
41.26 +namespace OpenHardwareMonitor.Utilities
41.27 +{
41.28 + public class HttpServer
41.29 + {
41.30 + private HttpListener listener;
41.31 + private int listenerPort, nodeCount;
41.32 + private Thread listenerThread;
41.33 + private Node root;
41.34 +
41.35 + public HttpServer(Node r, int p)
41.36 + {
41.37 + root = r;
41.38 + listenerPort = p;
41.39 + //JSON node count.
41.40 + nodeCount = 0;
41.41 + listener = new HttpListener();
41.42 + }
41.43 +
41.44 + public Boolean startHTTPListener()
41.45 + {
41.46 + try
41.47 + {
41.48 + if (listener.IsListening)
41.49 + return true;
41.50 +
41.51 + string prefix = "http://+:" + listenerPort + "/";
41.52 + listener.Prefixes.Clear();
41.53 + listener.Prefixes.Add(prefix);
41.54 + listener.Start();
41.55 +
41.56 + if (listenerThread == null)
41.57 + {
41.58 + listenerThread = new Thread(HandleRequests);
41.59 + listenerThread.Start();
41.60 + }
41.61 + }
41.62 + catch (Exception e)
41.63 + {
41.64 + return false;
41.65 + }
41.66 +
41.67 + return true;
41.68 + }
41.69 +
41.70 + public Boolean stopHTTPListener()
41.71 + {
41.72 + try
41.73 + {
41.74 + listenerThread.Abort();
41.75 + listener.Stop();
41.76 + listenerThread = null;
41.77 + }
41.78 + catch (System.Net.HttpListenerException e)
41.79 + {
41.80 + }
41.81 + catch (System.Threading.ThreadAbortException e)
41.82 + {
41.83 + }
41.84 + catch (System.NullReferenceException e)
41.85 + {
41.86 + }
41.87 + catch (Exception e)
41.88 + {
41.89 + }
41.90 + return true;
41.91 + }
41.92 +
41.93 + public void HandleRequests()
41.94 + {
41.95 +
41.96 + while (listener.IsListening)
41.97 + {
41.98 + var context = listener.BeginGetContext(new AsyncCallback(ListenerCallback), listener);
41.99 + context.AsyncWaitHandle.WaitOne();
41.100 + }
41.101 + }
41.102 +
41.103 + public void ListenerCallback(IAsyncResult result)
41.104 + {
41.105 + HttpListener listener = (HttpListener)result.AsyncState;
41.106 + if (listener == null || !listener.IsListening)
41.107 + return;
41.108 + // Call EndGetContext to complete the asynchronous operation.
41.109 + HttpListenerContext context = listener.EndGetContext(result);
41.110 + HttpListenerRequest request = context.Request;
41.111 +
41.112 + var requestedFile = request.RawUrl.Substring(1);
41.113 + if (requestedFile == "data.json")
41.114 + {
41.115 + sendJSON(context);
41.116 + return;
41.117 + }
41.118 +
41.119 + if (requestedFile.Contains("images_icon"))
41.120 + {
41.121 + serveResourceImage(context, requestedFile.Replace("images_icon/", ""));
41.122 + return;
41.123 + }
41.124 +
41.125 + //default file to be served
41.126 + if (string.IsNullOrEmpty(requestedFile))
41.127 + requestedFile = "index.html";
41.128 +
41.129 + string[] splits = requestedFile.Split('.');
41.130 + string ext = splits[splits.Length - 1];
41.131 + serveResourceFile(context, "Web." + requestedFile.Replace('/', '.'), ext);
41.132 + }
41.133 +
41.134 + private void serveResourceFile(HttpListenerContext context ,string name, string ext) {
41.135 +
41.136 + //hack! resource names do not support the hyphen
41.137 + name = "OpenHardwareMonitor.Resources." + name.Replace("custom-theme", "custom_theme");
41.138 +
41.139 + string[] names =
41.140 + Assembly.GetExecutingAssembly().GetManifestResourceNames();
41.141 + for (int i = 0; i < names.Length; i++) {
41.142 + if (names[i].Replace('\\', '.') == name) {
41.143 + using (Stream stream = Assembly.GetExecutingAssembly().
41.144 + GetManifestResourceStream(names[i])) {
41.145 + context.Response.ContentType = getcontentType("." + ext);
41.146 + context.Response.ContentLength64 = stream.Length;
41.147 + byte[] buffer = new byte[512 * 1024];
41.148 + int len;
41.149 + while ((len = stream.Read(buffer, 0, buffer.Length)) > 0)
41.150 + {
41.151 + context.Response.OutputStream.Write(buffer, 0, len);
41.152 + }
41.153 + context.Response.OutputStream.Close();
41.154 + }
41.155 + return;
41.156 + }
41.157 + }
41.158 + context.Response.OutputStream.Close();
41.159 + context.Response.StatusCode = 404;
41.160 + context.Response.Close();
41.161 + }
41.162 +
41.163 + private void serveResourceImage(HttpListenerContext context ,string name) {
41.164 + name = "OpenHardwareMonitor.Resources." + name;
41.165 +
41.166 + string[] names =
41.167 + Assembly.GetExecutingAssembly().GetManifestResourceNames();
41.168 + for (int i = 0; i < names.Length; i++) {
41.169 + if (names[i].Replace('\\', '.') == name) {
41.170 + using (Stream stream = Assembly.GetExecutingAssembly().
41.171 + GetManifestResourceStream(names[i])) {
41.172 +
41.173 + Image image = Image.FromStream(stream);
41.174 + context.Response.ContentType = "image/png";
41.175 + using (MemoryStream ms = new MemoryStream())
41.176 + {
41.177 + image.Save(ms, ImageFormat.Png);
41.178 + ms.WriteTo(context.Response.OutputStream);
41.179 + }
41.180 + context.Response.OutputStream.Close();
41.181 + image.Dispose();
41.182 + return;
41.183 + }
41.184 + }
41.185 + }
41.186 + context.Response.OutputStream.Close();
41.187 + context.Response.StatusCode = 404;
41.188 + context.Response.Close();
41.189 + }
41.190 +
41.191 + private void sendJSON(HttpListenerContext context)
41.192 + {
41.193 +
41.194 + string JSON = "{\"id\": 0, \"Text\": \"Sensor\", \"Children\": [";
41.195 + nodeCount = 1;
41.196 + JSON += generateJSON(root);
41.197 + JSON += "]";
41.198 + JSON += ", \"Min\": \"Min\"";
41.199 + JSON += ", \"Value\": \"Value\"";
41.200 + JSON += ", \"Max\": \"Max\"";
41.201 + JSON += ", \"ImageURL\": \"\"";
41.202 + JSON += "}";
41.203 +
41.204 + var responseContent = JSON;
41.205 + byte[] buffer = Encoding.UTF8.GetBytes(responseContent);
41.206 +
41.207 + context.Response.ContentLength64 = buffer.Length;
41.208 + context.Response.ContentType = "application/json";
41.209 +
41.210 + Stream outputStream = context.Response.OutputStream;
41.211 + outputStream.Write(buffer, 0, buffer.Length);
41.212 + outputStream.Close();
41.213 +
41.214 + }
41.215 +
41.216 + private string generateJSON(Node n)
41.217 + {
41.218 + string JSON = "{\"id\": " + nodeCount + ", \"Text\": \"" + n.Text + "\", \"Children\": [";
41.219 + nodeCount++;
41.220 +
41.221 + foreach (Node child in n.Nodes)
41.222 + JSON += generateJSON(child) + ", ";
41.223 + if (JSON.EndsWith(", "))
41.224 + JSON = JSON.Remove(JSON.LastIndexOf(","));
41.225 + JSON += "]";
41.226 +
41.227 + if (n is SensorNode)
41.228 + {
41.229 + JSON += ", \"Min\": \"" + ((SensorNode)n).Min + "\"";
41.230 + JSON += ", \"Value\": \"" + ((SensorNode)n).Value + "\"";
41.231 + JSON += ", \"Max\": \"" + ((SensorNode)n).Max + "\"";
41.232 + JSON += ", \"ImageURL\": \"images/transparent.png\"";
41.233 + }
41.234 + else if (n is HardwareNode)
41.235 + {
41.236 + JSON += ", \"Min\": \"\"";
41.237 + JSON += ", \"Value\": \"\"";
41.238 + JSON += ", \"Max\": \"\"";
41.239 + JSON += ", \"ImageURL\": \"images_icon/" + getHardwareImageFile((HardwareNode)n) + "\"";
41.240 + }
41.241 + else if (n is TypeNode)
41.242 + {
41.243 + JSON += ", \"Min\": \"\"";
41.244 + JSON += ", \"Value\": \"\"";
41.245 + JSON += ", \"Max\": \"\"";
41.246 + JSON += ", \"ImageURL\": \"images_icon/" + getTypeImageFile((TypeNode)n) + "\"";
41.247 + }
41.248 + else
41.249 + {
41.250 + JSON += ", \"Min\": \"\"";
41.251 + JSON += ", \"Value\": \"\"";
41.252 + JSON += ", \"Max\": \"\"";
41.253 + JSON += ", \"ImageURL\": \"images_icon/computer.png\"";
41.254 + }
41.255 +
41.256 + JSON += "}";
41.257 + return JSON;
41.258 + }
41.259 +
41.260 + private static void returnFile(HttpListenerContext context, string filePath)
41.261 + {
41.262 + context.Response.ContentType = getcontentType(Path.GetExtension(filePath));
41.263 + const int bufferSize = 1024 * 512; //512KB
41.264 + var buffer = new byte[bufferSize];
41.265 + using (var fs = File.OpenRead(filePath))
41.266 + {
41.267 +
41.268 + context.Response.ContentLength64 = fs.Length;
41.269 + int read;
41.270 + while ((read = fs.Read(buffer, 0, buffer.Length)) > 0)
41.271 + context.Response.OutputStream.Write(buffer, 0, read);
41.272 + }
41.273 +
41.274 + context.Response.OutputStream.Close();
41.275 + }
41.276 +
41.277 + private static string getcontentType(string extension)
41.278 + {
41.279 + switch (extension)
41.280 + {
41.281 + case ".avi": return "video/x-msvideo";
41.282 + case ".css": return "text/css";
41.283 + case ".doc": return "application/msword";
41.284 + case ".gif": return "image/gif";
41.285 + case ".htm":
41.286 + case ".html": return "text/html";
41.287 + case ".jpg":
41.288 + case ".jpeg": return "image/jpeg";
41.289 + case ".js": return "application/x-javascript";
41.290 + case ".mp3": return "audio/mpeg";
41.291 + case ".png": return "image/png";
41.292 + case ".pdf": return "application/pdf";
41.293 + case ".ppt": return "application/vnd.ms-powerpoint";
41.294 + case ".zip": return "application/zip";
41.295 + case ".txt": return "text/plain";
41.296 + default: return "application/octet-stream";
41.297 + }
41.298 + }
41.299 +
41.300 + private static string getHardwareImageFile(HardwareNode hn)
41.301 + {
41.302 +
41.303 + switch (hn.Hardware.HardwareType)
41.304 + {
41.305 + case HardwareType.CPU:
41.306 + return "cpu.png";
41.307 + case HardwareType.GpuNvidia:
41.308 + return "nvidia.png";
41.309 + case HardwareType.GpuAti:
41.310 + return "ati.png";
41.311 + case HardwareType.HDD:
41.312 + return "hdd.png";
41.313 + case HardwareType.Heatmaster:
41.314 + return "bigng.png";
41.315 + case HardwareType.Mainboard:
41.316 + return "mainboard.png";
41.317 + case HardwareType.SuperIO:
41.318 + return "chip.png";
41.319 + case HardwareType.TBalancer:
41.320 + return "bigng.png";
41.321 + default:
41.322 + return "cpu.png";
41.323 + }
41.324 +
41.325 + }
41.326 +
41.327 + private static string getTypeImageFile(TypeNode tn)
41.328 + {
41.329 +
41.330 + switch (tn.SensorType)
41.331 + {
41.332 + case SensorType.Voltage:
41.333 + return "voltage.png";
41.334 + case SensorType.Clock:
41.335 + return "clock.png";
41.336 + case SensorType.Load:
41.337 + return "load.png";
41.338 + case SensorType.Temperature:
41.339 + return "temperature.png";
41.340 + case SensorType.Fan:
41.341 + return "fan.png";
41.342 + case SensorType.Flow:
41.343 + return "flow.png";
41.344 + case SensorType.Control:
41.345 + return "control.png";
41.346 + case SensorType.Level:
41.347 + return "level.png";
41.348 + case SensorType.Power:
41.349 + return "power.png";
41.350 + default:
41.351 + return "power.png";
41.352 + }
41.353 +
41.354 + }
41.355 +
41.356 + public int ListenerPort
41.357 + {
41.358 + get { return listenerPort; }
41.359 + set { listenerPort = value; }
41.360 + }
41.361 +
41.362 + ~HttpServer()
41.363 + {
41.364 + stopHTTPListener();
41.365 + listener.Abort();
41.366 + }
41.367 +
41.368 + public void Quit()
41.369 + {
41.370 + stopHTTPListener();
41.371 + listener.Abort();
41.372 + }
41.373 + }
41.374 +}