Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-10042: Delete old deprecated Admin UI

Jan Høydahl21384b5b215a
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 92e8d8d2628..3237fde391b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -161,6 +161,8 @@ Other Changes
* SOLR-10414: RecoveryStrategy is now a Runnable instead of a Thread. (Tomás Fernández Löbbe)
+* SOLR-10042: Delete old deprecated Admin UI, leaving the AngularJS UI the only one supported (janhoy)
+
================== 6.7.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/NOTICE.txt b/solr/NOTICE.txt
index 54babbb9f23..d1f4e2fa2ed 100644
--- a/solr/NOTICE.txt
+++ b/solr/NOTICE.txt
@@ -25,15 +25,9 @@ Copyright (c) 2012, Michael Bostock, https://github.com/mbostock/d3
This product includes the highlight.js Javascript library created by Ivan Sagalaev
Copyright (c) 2006, Ivan Sagalaev, https://github.com/isagalaev/highlight.js
-This product includes the ZeroClipboard.js Javascript library created by Jon Rohan, James M. Greene
-Copyright (c) 2012 Jon Rohan, James M. Greene, https://github.com/zeroclipboard/ZeroClipboard
-
This product includes the Chosen Javascript library created by Patrick Filler
Copyright (c) 2011-2014 by Harvest, https://github.com/harvesthq/chosen
-This product includes jquery.ajaxfileupload.js Javascript library created by Jordan Feldstein
-Copyright (c) 2011 Jordan Feldstein, https://github.com/jfeldstein/jQuery.AjaxFileUpload.js
-
This product includes jquery.blockUI.js Javascript library created by Mike Alsup
Copyright (c) 2007-2014 M. Alsup https://github.com/malsup/blockui/
@@ -43,18 +37,12 @@ Copyright (c) 2013-2014 Klaus Hartl, https://github.com/carhartl/jquery-cookie
This product includes jquery.form Javascript library created by Mike Alsup
Copyright 2006-2014 (c) M. Alsup, https://github.com/malsup/form/
-This product includes the jstree Javascript library created by Ivan Bozhanov
+This product includes the jquery.jstree.js Javascript library created by Ivan Bozhanov
Copyright (c) 2013-2014 Ivan Bozhanov, https://github.com/vakata/jstree
-This product includes the Sammy.js Javascript library created by Aaron Quint
-Copyright (c) 2008 Aaron Quint, Quirkey NYC, LLC, https://github.com/quirkey/sammy
-
This product includes jquery.timeago.js Javascript library by Ryan McGeary
Copyright (c) 2008-2014, Ryan McGeary, https://github.com/rmm5t/jquery-timeago
-This product includes linker.js Javascript library created by Michalis Tzikas & Vasilis Lolos
-Copyright (C) 2011 by Michalis Tzikas & Vasilis Lolos, https://github.com/lolos/jquery-Linker/
-
This product includes require.js Javascript library created by James Burke
Copyright (C) 2010-2014 James Burke, https://github.com/jrburke/requirejs
diff --git a/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java b/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
index 133bc63284d..c17412fe860 100644
--- a/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
+++ b/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
@@ -42,6 +42,7 @@ import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.plugin.SolrCoreAware;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
diff --git a/solr/contrib/velocity/src/resources/velocity/head.vm b/solr/contrib/velocity/src/resources/velocity/head.vm
index 38e5f0c13cd..40592941d62 100644
--- a/solr/contrib/velocity/src/resources/velocity/head.vm
+++ b/solr/contrib/velocity/src/resources/velocity/head.vm
@@ -9,7 +9,7 @@
<link rel="icon" type="image/x-icon" href="#{url_root}/img/favicon.ico"/>
<link rel="shortcut icon" type="image/x-icon" href="#{url_root}/img/favicon.ico"/>
- <script type="text/javascript" src="#{url_root}/js/lib/jquery-1.7.2.min.js"></script>
+ <script type="text/javascript" src="#{url_root}/libs/jquery-1.7.2.min.js"></script>
<style>
#admin{
diff --git a/solr/example/files/conf/velocity/head.vm b/solr/example/files/conf/velocity/head.vm
index 1b3aec9434d..3c98747aca0 100644
--- a/solr/example/files/conf/velocity/head.vm
+++ b/solr/example/files/conf/velocity/head.vm
@@ -5,7 +5,7 @@
<link rel="icon" type="image/x-icon" href="#{url_root}/img/favicon.ico"/>
<link rel="shortcut icon" type="image/x-icon" href="#{url_root}/img/favicon.ico"/>
-<script type="text/javascript" src="#{url_root}/js/lib/jquery-1.7.2.min.js"></script>
+<script type="text/javascript" src="#{url_root}/libs/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="#{url_for_solr}/admin/file?file=/velocity/js/jquery.tx3-tag-cloud.js&contentType=text/javascript"></script>
<script type="text/javascript" src="#{url_for_solr}/admin/file?file=/velocity/js/dropit.js&contentType=text/javascript"></script>
<script type="text/javascript" src="#{url_for_solr}/admin/file?file=/velocity/js/jquery.autocomplete.js&contentType=text/javascript"></script>
diff --git a/solr/licenses/javacscript-natural-sort-NOTICE.txt b/solr/licenses/javacscript-natural-sort-NOTICE.txt
deleted file mode 100644
index 576048b0045..00000000000
--- a/solr/licenses/javacscript-natural-sort-NOTICE.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-javascript-natural-sort is a javascript library for sorting data with embedded
-numbers naturally, the way a human would expect.
-https://github.com/jarinudom/naturalSort.js
-
-javascript-natural-sort is licensed under the MIT license.
\ No newline at end of file
diff --git a/solr/licenses/javascript-natural-sort-LICENSE-MIT.txt b/solr/licenses/javascript-natural-sort-LICENSE-MIT.txt
deleted file mode 100644
index e7a4eb16287..00000000000
--- a/solr/licenses/javascript-natural-sort-LICENSE-MIT.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2011 Jim Palmer and other contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/velocity/head.vm b/solr/server/solr/configsets/sample_techproducts_configs/conf/velocity/head.vm
index f1ff5c30c98..15dc0e8172f 100644
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/velocity/head.vm
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/velocity/head.vm
@@ -6,7 +6,7 @@
<title>#param('title')</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
- <script type="text/javascript" src="#{url_root}/js/lib/jquery-1.7.2.min.js"></script>
+ <script type="text/javascript" src="#{url_root}/libs/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="#{url_for_solr}/admin/file?file=/velocity/main.css&contentType=text/css"/>
<link rel="stylesheet" href="#{url_for_solr}/admin/file?file=/velocity/jquery.autocomplete.css&contentType=text/css" type="text/css" />
<link rel="icon" type="image/x-icon" href="#{url_root}/img/favicon.ico"/>
diff --git a/solr/webapp/web/WEB-INF/web.xml b/solr/webapp/web/WEB-INF/web.xml
index 5ebce106b32..a4dc2338583 100644
--- a/solr/webapp/web/WEB-INF/web.xml
+++ b/solr/webapp/web/WEB-INF/web.xml
@@ -139,11 +139,6 @@
<url-pattern>/logging</url-pattern>
</servlet-mapping>
- <servlet-mapping>
- <servlet-name>LoadAdminUI</servlet-name>
- <url-pattern>/old.html</url-pattern>
- </servlet-mapping>
-
<servlet-mapping>
<servlet-name>LoadAdminUI</servlet-name>
<url-pattern>/index.html</url-pattern>
diff --git a/solr/webapp/web/WEB-INF/weblogic.xml b/solr/webapp/web/WEB-INF/weblogic.xml
deleted file mode 100644
index 43809eea47b..00000000000
--- a/solr/webapp/web/WEB-INF/weblogic.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<weblogic-web-app
- xmlns="http://www.bea.com/ns/weblogic/90"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
-
- <container-descriptor>
- <filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled>
- </container-descriptor>
-
-</weblogic-web-app>
-
diff --git a/solr/webapp/web/css/styles/java-properties.css b/solr/webapp/web/css/angular/java-properties.css
similarity index 100%
rename from solr/webapp/web/css/styles/java-properties.css
rename to solr/webapp/web/css/angular/java-properties.css
diff --git a/solr/webapp/web/css/chosen.css b/solr/webapp/web/css/chosen.css
deleted file mode 100644
index 127b3c2f51a..00000000000
--- a/solr/webapp/web/css/chosen.css
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
-
-Chosen
-
-- by Patrick Filler for Harvest http://getharvest.com
-- Copyright (c) 2011-2013 by Harvest
-
-Available for use under the MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/* @group Base */
-.chzn-container {
- font-size: 13px;
- position: relative;
- display: inline-block;
- zoom: 1;
- *display: inline;
-}
-.chzn-container .chzn-drop {
- background: #fff;
- border: 1px solid #aaa;
- border-top: 0;
- position: absolute;
- top: 29px;
- left: 0;
- -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
- -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
- -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
- box-shadow : 0 4px 5px rgba(0,0,0,.15);
- z-index: 999;
-}
-/* @end */
-
-/* @group Single Chosen */
-.chzn-container-single .chzn-single {
- background-color: #ffffff;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
- background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -ms-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- -webkit-border-radius: 5px;
- -moz-border-radius : 5px;
- border-radius : 5px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
- border: 1px solid #aaaaaa;
- -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- display: block;
- overflow: hidden;
- white-space: nowrap;
- position: relative;
- height: 23px;
- line-height: 24px;
- padding: 0 0 0 8px;
- color: #444444;
- text-decoration: none;
-}
-.chzn-container-single .chzn-default {
- color: #999;
-}
-.chzn-container-single .chzn-single span {
- margin-right: 26px;
- display: block;
- overflow: hidden;
- white-space: nowrap;
- -o-text-overflow: ellipsis;
- -ms-text-overflow: ellipsis;
- text-overflow: ellipsis;
-}
-.chzn-container-single .chzn-single abbr {
- display: block;
- position: absolute;
- right: 26px;
- top: 6px;
- width: 12px;
- height: 13px;
- font-size: 1px;
- background: url(../img/chosen-sprite.png) right top no-repeat;
-}
-.chzn-container-single .chzn-single abbr:hover {
- background-position: right -11px;
-}
-.chzn-container-single .chzn-single div {
- position: absolute;
- right: 0;
- top: 0;
- display: block;
- height: 100%;
- width: 18px;
-}
-.chzn-container-single .chzn-single div b {
- background: url('../img/chosen-sprite.png') no-repeat 0 0;
- display: block;
- width: 100%;
- height: 100%;
-}
-.chzn-container-single .chzn-search {
- padding: 3px 4px;
- position: relative;
- margin: 0;
- white-space: nowrap;
- z-index: 1010;
-}
-.chzn-container-single .chzn-search input {
- background: #fff url('../img/chosen-sprite.png') no-repeat 100% -22px;
- background: url('../img/chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background: url('../img/chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- margin: 1px 0;
- padding: 4px 20px 4px 5px;
- outline: 0;
- border: 1px solid #aaa;
- font-family: sans-serif;
- font-size: 1em;
-}
-.chzn-container-single .chzn-drop {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius : 0 0 4px 4px;
- border-radius : 0 0 4px 4px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
-}
-/* @end */
-
-.chzn-container-single-nosearch .chzn-search input {
- position: absolute;
- left: -9000px;
-}
-
-/* @group Multi Chosen */
-.chzn-container-multi .chzn-choices {
- background-color: #fff;
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- border: 1px solid #aaa;
- margin: 0;
- padding: 0;
- cursor: text;
- overflow: hidden;
- height: auto !important;
- height: 1%;
- position: relative;
-}
-.chzn-container-multi .chzn-choices li {
- float: left;
- list-style: none;
-}
-.chzn-container-multi .chzn-choices .search-field {
- white-space: nowrap;
- margin: 0;
- padding: 0;
-}
-.chzn-container-multi .chzn-choices .search-field input {
- color: #666;
- background: transparent !important;
- border: 0 !important;
- font-family: sans-serif;
- font-size: 100%;
- height: 15px;
- padding: 5px;
- margin: 1px 0;
- outline: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow : none;
- -o-box-shadow : none;
- box-shadow : none;
-}
-.chzn-container-multi .chzn-choices .search-field .default {
- color: #999;
-}
-.chzn-container-multi .chzn-choices .search-choice {
- -webkit-border-radius: 3px;
- -moz-border-radius : 3px;
- border-radius : 3px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
- background-color: #e4e4e4;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- color: #333;
- border: 1px solid #aaaaaa;
- line-height: 13px;
- padding: 3px 20px 3px 5px;
- margin: 3px 0 3px 5px;
- position: relative;
- cursor: default;
-}
-.chzn-container-multi .chzn-choices .search-choice-focus {
- background: #d4d4d4;
-}
-.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
- display: block;
- position: absolute;
- right: 3px;
- top: 4px;
- width: 12px;
- height: 13px;
- font-size: 1px;
- background: url(../img/chosen-sprite.png) right top no-repeat;
-}
-.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
- background-position: right -11px;
-}
-.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
- background-position: right -11px;
-}
-/* @end */
-
-/* @group Results */
-.chzn-container .chzn-results {
- margin: 0 4px 4px 0;
- max-height: 240px;
- padding: 0 0 0 4px;
- position: relative;
- overflow-x: hidden;
- overflow-y: auto;
-}
-.chzn-container-multi .chzn-results {
- margin: -1px 0 0;
- padding: 0;
-}
-.chzn-container .chzn-results li {
- display: none;
- line-height: 15px;
- padding: 5px 6px;
- margin: 0;
- list-style: none;
-}
-.chzn-container .chzn-results .active-result {
- cursor: pointer;
- display: list-item;
-}
-.chzn-container .chzn-results .highlighted {
- background-color: #3875d7;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
- background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -ms-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- color: #fff;
-}
-.chzn-container .chzn-results li em {
- background: #feffde;
- font-style: normal;
-}
-.chzn-container .chzn-results .highlighted em {
- background: transparent;
-}
-.chzn-container .chzn-results .no-results {
- background: #f4f4f4;
- display: list-item;
-}
-.chzn-container .chzn-results .group-result {
- cursor: default;
- color: #999;
- font-weight: bold;
-}
-.chzn-container .chzn-results .group-option {
- padding-left: 15px;
-}
-.chzn-container-multi .chzn-drop .result-selected {
- display: none;
-}
-.chzn-container .chzn-results-scroll {
- background: white;
- margin: 0 4px;
- position: absolute;
- text-align: center;
- width: 321px; /* This should by dynamic with js */
- z-index: 1;
-}
-.chzn-container .chzn-results-scroll span {
- display: inline-block;
- height: 17px;
- text-indent: -5000px;
- width: 9px;
-}
-.chzn-container .chzn-results-scroll-down {
- bottom: 0;
-}
-.chzn-container .chzn-results-scroll-down span {
- background: url('../img/chosen-sprite.png') no-repeat -4px -3px;
-}
-.chzn-container .chzn-results-scroll-up span {
- background: url('../img/chosen-sprite.png') no-repeat -22px -3px;
-}
-/* @end */
-
-/* @group Active */
-.chzn-container-active .chzn-single {
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
- box-shadow : 0 0 5px rgba(0,0,0,.3);
- border: 1px solid #5897fb;
-}
-.chzn-container-active .chzn-single-with-drop {
- border: 1px solid #aaa;
- -webkit-box-shadow: 0 1px 0 #fff inset;
- -moz-box-shadow : 0 1px 0 #fff inset;
- -o-box-shadow : 0 1px 0 #fff inset;
- box-shadow : 0 1px 0 #fff inset;
- background-color: #eee;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
- background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -ms-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- -webkit-border-bottom-left-radius : 0;
- -webkit-border-bottom-right-radius: 0;
- -moz-border-radius-bottomleft : 0;
- -moz-border-radius-bottomright: 0;
- border-bottom-left-radius : 0;
- border-bottom-right-radius: 0;
-}
-.chzn-container-active .chzn-single-with-drop div {
- background: transparent;
- border-left: none;
-}
-.chzn-container-active .chzn-single-with-drop div b {
- background-position: -18px 1px;
-}
-.chzn-container-active .chzn-choices {
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
- box-shadow : 0 0 5px rgba(0,0,0,.3);
- border: 1px solid #5897fb;
-}
-.chzn-container-active .chzn-choices .search-field input {
- color: #111 !important;
-}
-/* @end */
-
-/* @group Disabled Support */
-.chzn-disabled {
- cursor: default;
- opacity:0.5 !important;
-}
-.chzn-disabled .chzn-single {
- cursor: default;
-}
-.chzn-disabled .chzn-choices .search-choice .search-choice-close {
- cursor: default;
-}
-
-/* @group Right to Left */
-.chzn-rtl { text-align: right; }
-.chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
-.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
-
-.chzn-rtl .chzn-single div { left: 3px; right: auto; }
-.chzn-rtl .chzn-single abbr {
- left: 26px;
- right: auto;
-}
-.chzn-rtl .chzn-choices .search-field input { direction: rtl; }
-.chzn-rtl .chzn-choices li { float: right; }
-.chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
-.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;}
-.chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
-.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
-.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
-.chzn-rtl .chzn-search input {
- background: #fff url('../img/chosen-sprite.png') no-repeat -38px -22px;
- background: url('../img/chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background: url('../img/chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('../img/chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- padding: 4px 5px 4px 20px;
- direction: rtl;
-}
-/* @end */
diff --git a/solr/webapp/web/css/styles/analysis.css b/solr/webapp/web/css/styles/analysis.css
deleted file mode 100644
index 2273f4fee03..00000000000
--- a/solr/webapp/web/css/styles/analysis.css
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #analysis-holder
-{
- background-image: url( ../../img/div.gif );
- background-position: 50% 0;
- background-repeat: repeat-y;
-}
-
-#content #analysis #field-analysis
-{
- margin-bottom: 0;
-}
-
-#content #analysis #field-analysis .content
-{
- padding-bottom: 0;
-}
-
-#content #analysis .settings-holder
-{
- clear: both;
- padding-top: 15px;
-}
-
-#content #analysis .settings
-{
- background-color: #fff;
- border-top: 1px solid #fafafa;
- border-bottom: 1px solid #fafafa;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-#content #analysis .settings select.loader
-{
- background-position: 3px 50%;
- padding-left: 21px;
-}
-
-#content #analysis .settings select optgroup
-{
- font-style: normal;
- padding: 5px;
-}
-
-#content #analysis .settings select option
-{
- padding-left: 10px;
-}
-
-#content #analysis .settings #tor_schema
-{
- background-image: url( ../../img/ico/question-white.png );
- background-position: 0 50%;
- color: #c0c0c0;
- margin-left: 5px;
- padding-left: 21px;
-}
-
-#content #analysis .settings #tor_schema:hover
-{
- background-image: url( ../../img/ico/question.png );
-}
-
-#content #analysis .settings #tor_schema span
-{
- display: none;
-}
-
-#content #analysis .settings #tor_schema:hover span
-{
- display: inline;
-}
-
-#content #analysis .settings .buttons
-{
- float: right;
- width: 47%;
-}
-
-#content #analysis .settings button
-{
- float: right;
-}
-
-#content #analysis .settings button span
-{
- background-image: url( ../../img/ico/funnel.png );
-}
-
-#content #analysis .settings .verbose_output
-{
- float: left;
- width: auto;
-}
-
-#content #analysis .settings .verbose_output a
-{
- background-image: url( ../../img/ico/ui-check-box-uncheck.png );
- background-position: 0 50%;
- color: #999;
- display: block;
- padding-left: 21px;
-}
-
-#content #analysis .settings .verbose_output.active a
-{
- background-image: url( ../../img/ico/ui-check-box.png );
-}
-
-#content #analysis .index label,
-#content #analysis .query label
-{
- display: block;
-}
-
-#content #analysis .index textarea,
-#content #analysis .query textarea
-{
- display: block;
- width: 100%;
-}
-
-#content #analysis .index
-{
- float: left;
- margin-right: 0.5%;
- min-width: 47%;
- max-width: 99%;
-}
-
-#content #analysis .query
-{
- float: right;
- margin-left: 0.5%;
- min-width: 47%;
- max-width: 99%;
-}
-
-#content #analysis .analysis-error
-{
- background-color: #f00;
- background-image: url( ../../img/ico/construction.png );
- background-position: 10px 50%;
- color: #fff;
- display: none;
- font-weight: bold;
- margin-bottom: 20px;
- padding: 10px;
- padding-left: 35px;
-}
-
-#content #analysis .analysis-error .head a
-{
- color: #fff;
- cursor: auto;
-}
-
-#content #analysis #analysis-result
-{
- overflow: auto;
-}
-
-#content #analysis #analysis-result .index,
-#content #analysis #analysis-result .query
-{
- background-color: #fff;
- padding-top: 20px;
-}
-
-#content #analysis #analysis-result table
-{
- border-collapse: collapse;
-}
-
-#content #analysis #analysis-result td
-{
- vertical-align: top;
- white-space: nowrap;
-}
-
-#content #analysis #analysis-result td.part.analyzer div,
-#content #analysis #analysis-result td.part.spacer .holder,
-#content #analysis #analysis-result td td td
-{
- padding-top: 1px;
- padding-bottom: 1px;
-}
-
-#content #analysis #analysis-result td.legend,
-#content #analysis #analysis-result td.data tr.verbose_output
-{
- display: none;
-}
-
-#content #analysis #analysis-result.verbose_output td.legend
-{
- display: table-cell;
-}
-
-#content #analysis #analysis-result.verbose_output td.data tr.verbose_output
-{
- display: table-row;
-}
-
-#content #analysis #analysis-result .match
-{
- background-color: #e9eff7;
- background-color: #f2f2ff;
-}
-
-#content #analysis #analysis-result td.part
-{
- padding-bottom: 10px;
-}
-
-#content #analysis #analysis-result td.part.analyzer div
-{
- border-right: 1px solid #f0f0f0;
- padding-right: 10px;
-}
-
-#content #analysis #analysis-result td.part.analyzer abbr
-{
- color: #c0c0c0;
-}
-
-#content #analysis #analysis-result td.part.legend .holder,
-#content #analysis #analysis-result td.part.data .holder
-{
- padding-left: 10px;
- padding-right: 10px;
- border-right: 1px solid #c0c0c0;
-}
-
-#content #analysis #analysis-result td.part.legend td
-{
- color: #c0c0c0;
-}
-
-#content #analysis #analysis-result td.part.legend .holder
-{
- border-right-color: #f0f0f0;
-}
-
-#content #analysis #analysis-result td.part.data:last-child .holder
-{
- padding-right: 0;
- border-right: 0;
-}
-
-#content #analysis #analysis-result td.details
-{
- padding-left: 10px;
- padding-right: 10px;
- border-left: 1px solid #f0f0f0;
- border-right: 1px solid #f0f0f0;
-}
-
-#content #analysis #analysis-result td.details:first-child
-{
- padding-left: 0;
- border-left: 0;
-}
-
-#content #analysis #analysis-result td.details:last-child
-{
- padding-right: 0;
- border-right: 0;
-}
-
-#content #analysis #analysis-result td.details tr.empty td
-{
- color: #f0f0f0;
-}
-
-#content #analysis #analysis-result td.details tr.raw_bytes td
-{
- letter-spacing: -1px;
-}
-
-#content #analysis #analysis-result .part table table td
-{
- border-top: 1px solid #f0f0f0;
-}
-
-#content #analysis #analysis-result .part table table tr:first-child td
-{
- border-top: 0;
-}
-
-#content #analysis #field-analysis h2 { background-image: url( ../../img/ico/receipt.png ); }
-#content #analysis .analysis-result h2 { background-image: url( ../../img/ico/receipt-invoice.png ); }
diff --git a/solr/webapp/web/css/styles/cloud.css b/solr/webapp/web/css/styles/cloud.css
deleted file mode 100644
index 65b58157f87..00000000000
--- a/solr/webapp/web/css/styles/cloud.css
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #cloud
-{
- position: relative;
-}
-
-#content #cloud #frame .content
-{
- display: none;
-}
-
-#content #cloud .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #cloud #error
-{
- background-color: #f00;
- background-image: url( ../../img/ico/construction.png );
- background-position: 10px 12px;
- color: #fff;
- font-weight: bold;
- margin-bottom: 20px;
- padding: 10px;
- padding-left: 35px;
-}
-
-#content #cloud #error .msg
-{
- font-style: italic;
- font-weight: normal;
- margin-top: 10px;
-}
-
-#content #cloud #debug
-{
- background-color: #fff;
- box-shadow: 0px 0px 10px #c0c0c0;
- -moz-box-shadow: 0px 0px 10px #c0c0c0;
- -webkit-box-shadow: 0px 0px 10px #c0c0c0;
- display: none;
- padding: 20px;
- position: absolute;
- left: 50px;
- top: 10px;
-}
-
-#content #cloud #debug ul
-{
- margin-bottom: 5px;
-}
-
-#content #cloud #debug ul a
-{
- background-position: 4px 50%;
- border-right: 0;
- display: block;
- padding: 2px 4px;
- padding-left: 25px;
-}
-
-#content #cloud #debug ul a:hover,
-#content #cloud #debug ul a.hover
-{
- background-color: #f0f0f0;
-}
-
-#content #cloud #debug .clipboard
-{
- float: left;
- position: relative;
-}
-
-#content #cloud #debug .clipboard a
-{
- background-image: url( ../../img/ico/clipboard-paste.png );
- z-index: 98;
-}
-
-#content #cloud #debug .clipboard a:hover,
-#content #cloud #debug .clipboard a.hover,
-#content #cloud #debug .clipboard.copied a
-{
- background-image: url( ../../img/ico/clipboard-paste-document-text.png );
-}
-
-#content #cloud #debug .close
-{
- float: right;
-}
-
-#content #cloud #debug .close a
-{
- background-image: url( ../../img/ico/cross-0.png );
- padding-left: 21px;
-}
-
-#content #cloud #debug .close a:hover
-{
- background-image: url( ../../img/ico/cross-1.png );
-}
-
-#content #cloud #debug .debug
-{
- border: 1px solid #f0f0f0;
- max-height: 350px;
- overflow: auto;
- padding: 5px;
- width: 500px;
-}
-
-#content #cloud #debug .debug .loader
-{
- background-position: 5px 50%;
- display: block;
- padding: 10px 26px;
-}
-
-#content #cloud .content
-{
- padding-left: 0;
- padding-right: 0;
-}
-
-#content #cloud .content.show
-{
- background-image: url( ../../img/div.gif );
- background-repeat: repeat-y;
- background-position: 31% 0;
-}
-
-#content #cloud #tree
-{
- float: left;
- width: 30%;
-}
-
-#content #cloud .show #tree
-{
- overflow: hidden;
-}
-
-#content #cloud #file-content
-{
- display: none;
- float: right;
- position: relative;
- width: 68%;
- min-height: 100px
-}
-
-#content #cloud .show #file-content
-{
- display: block;
-}
-
-#content #cloud #file-content .close
-{
- background-image: url( ../../img/ico/cross-0.png );
- background-position: 50% 50%;
- display: block;
- height: 20px;
- position: absolute;
- right: 0;
- top: 0;
- width: 20px;
-}
-
-#content #cloud #file-content .close:hover
-{
- background-image: url( ../../img/ico/cross-1.png );
-}
-
-#content #cloud #file-content .close span
-{
- display: none;
-}
-
-#content #cloud #file-content #data
-{
- border-top: 1px solid #c0c0c0;
- margin-top: 10px;
- padding-top: 10px;
-}
-
-#content #cloud #file-content #data pre
-{
- display: block;
- max-height: 600px;
- overflow: auto;
-}
-
-#content #cloud #file-content #data em
-{
- color: #c0c0c0;
-}
-
-#content #cloud #file-content #prop
-{
-}
-
-#content #cloud #file-content li
-{
- padding-top: 3px;
- padding-bottom: 3px;
-}
-
-#content #cloud #file-content li.odd
-{
- background-color: #F8F8F8;
-}
-
-#content #cloud #file-content li dt
-{
- float: left;
- width: 19%;
-}
-
-#content #cloud #file-content li dd
-{
- float: right;
- width: 80%;
-}
-
-/* tree */
-
-#content #cloud #legend
-{
- border: 1px solid #f0f0f0;
- padding: 10px;
- position: absolute;
- right: 0;
- bottom: 0;
-}
-
-#content #cloud #legend li
-{
- padding-left: 15px;
- position: relative;
-}
-
-#content #cloud #legend li svg
-{
- position: absolute;
- left: 0;
- top: 2px;
-}
-
-#content #graph-content
-{
- min-height: 400px;
-}
-
-#content #graph-content .node
-{
- fill: #333;
-}
-
-#content #cloud #legend circle,
-#content #graph-content .node circle
-{
- fill: #fff;
- stroke: #c0c0c0;
- stroke-width: 1.5px;
-}
-
-#content #graph-content .node.lvl-3 text
-{
- cursor: pointer;
-}
-
-#content #graph-content .node.lvl-3:hover circle
-{
- stroke: #000 !important;
-}
-
-#content #graph-content .node.lvl-3:hover text
-{
- fill: #000 !important;
-}
-
-#content #graph-content .link
-{
- fill: none;
- stroke: #e0e0e0;
- stroke-width: 1.5px;
-}
-
-#content #cloud #legend .gone circle,
-#content #graph-content .node.gone circle,
-#content #graph-content .link.gone
-{
- stroke: #f0f0f0;
-}
-
-#content #graph-content .node.gone text
-{
- fill: #f0f0f0;
-}
-
-#content #cloud #legend ul .gone
-{
- color: #e0e0e0;
-}
-
-#content #cloud #legend .recovery_failed,
-#content #cloud #legend .recovery_failed circle,
-#content #graph-content .node.recovery_failed circle
-{
- color: #C43C35;
- stroke: #C43C35;
-}
-
-#content #graph-content .node.recovery_failed text
-{
- fill: #C43C35;
-}
-
-#content #cloud #legend .down,
-#content #cloud #legend .down circle,
-#content #graph-content .node.down circle
-{
- color: #c48f00;
- stroke: #c48f00;
-}
-
-#content #graph-content .node.down text
-{
- fill: #c48f00;
-}
-
-#content #cloud #legend .recovering,
-#content #cloud #legend .recovering circle,
-#content #graph-content .node.recovering circle
-{
- color: #d5dd00;
- stroke: #d5dd00;
-}
-
-#content #graph-content .node.recovering text
-{
- fill: #d5dd00;
-}
-
-#content #cloud #legend .active,
-#content #cloud #legend .active circle,
-#content #graph-content .node.active circle
-{
- color: #57A957;
- stroke: #57A957;
-}
-
-#content #graph-content .node.active text
-{
- fill: #57A957;
-}
-
-#content #cloud #legend .leader circle,
-#content #graph-content .node.leader circle
-{
- fill: #000;
-}
-
-#content #cloud #legend .leader circle
-{
- stroke: #fff;
-}
-
-#content #graph-content .link.lvl-2,
-#content #graph-content .link.leader
-{
- stroke: #c0c0c0;
-}
-
-#content #graph-content .node.lvl-0 circle
-{
- stroke: #fff;
-}
-
-#content #graph-content .link.lvl-1
-{
- stroke: #fff;
-}
-
-#cloudGraphPaging
-{
- display: inline-block,
- padding-top: 15px,
- padding-bottom: 15px
-}
\ No newline at end of file
diff --git a/solr/webapp/web/css/styles/common.css b/solr/webapp/web/css/styles/common.css
deleted file mode 100644
index 6c0a9fbcba3..00000000000
--- a/solr/webapp/web/css/styles/common.css
+++ /dev/null
@@ -1,731 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-*
-{
- background-repeat: no-repeat;
- margin: 0;
- padding: 0;
-}
-
-body, h1, h2, h3, h4, h5, h6, a, button, input, select, option, textarea, th, td
-{
- color: #333;
- font: 12px/1.6em "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
-}
-
-body
-{
- padding: 30px;
- text-align: center;
-}
-
-a, button
-{
- cursor: pointer;
-}
-
-input, select, textarea
-{
- border: 1px solid #c0c0c0;
- padding: 2px;
-}
-
-input[readonly=readonly]
-{
- border-color: #f0f0f0;
-}
-
-button
-{
- background-color: #e6e6e6;
- background-repeat: no-repeat;
- background-image: -webkit-gradient( linear, 0 0, 0 100%, from( #ffffff ), color-stop( 25%, #ffffff ), to( #e6e6e6 ) );
- background-image: -webkit-linear-gradient( #ffffff, #ffffff 25%, #e6e6e6 );
- background-image: -moz-linear-gradient( top, #ffffff, #ffffff 25%, #e6e6e6 );
- background-image: -ms-linear-gradient( #ffffff, #ffffff 25%, #e6e6e6 );
- background-image: -o-linear-gradient( #ffffff, #ffffff 25%, #e6e6e6 );
- background-image: linear-gradient( #ffffff, #ffffff 25%, #e6e6e6 );
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0 );
- border: 1px solid #ccc;
- border-bottom-color: #bbb;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- -khtml-border-radius: 4px;
- border-radius: 4px;
- -webkit-box-shadow: inset 0 1px 0 rgba( 255, 255, 255, 0.2 ), 0 1px 2px rgba( 0, 0, 0, 0.05 );
- -moz-box-shadow: inset 0 1px 0 rgba( 255, 255, 255, 0.2 ), 0 1px 2px rgba( 0, 0, 0, 0.05 );
- box-shadow: inset 0 1px 0 rgba( 255, 255, 255, 0.2 ), 0 1px 2px rgba( 0, 0, 0, 0.05 );
- color: #333;
- cursor: pointer;
- display: inline-block;
- padding: 4px 7px 5px;
- overflow: visible;
- text-shadow: 0 1px 1px rgba( 255, 255, 255, 0.75 );
- -webkit-transition: 0.1s linear background-image;
- -moz-transition: 0.1s linear background-image;
- -ms-transition: 0.1s linear background-image;
- -o-transition: 0.1s linear background-image;
- transition: 0.1s linear background-image;
-}
-
-button span
-{
- background-position: 0 50%;
- display: block;
- padding-left: 21px;
-}
-
-button[type=submit], button.primary
-{
- background-color: #0064cd;
- background-repeat: repeat-x;
- background-image: -khtml-gradient( linear, left top, left bottom, from( #049cdb ), to( #0064cd ) );
- background-image: -moz-linear-gradient( top, #049cdb, #0064cd );
- background-image: -ms-linear-gradient( top, #049cdb, #0064cd );
- background-image: -webkit-gradient( linear, left top, left bottom, color-stop( 0%, #049cdb ), color-stop( 100%, #0064cd ) );
- background-image: -webkit-linear-gradient( top, #049cdb, #0064cd );
- background-image: -o-linear-gradient( top, #049cdb, #0064cd );
- background-image: linear-gradient( top, #049cdb, #0064cd );
- border-color: #0064cd #0064cd #003f81;
- border-color: rgba( 0, 0, 0, 0.1 ) rgba( 0, 0, 0, 0.1 ) rgba( 0, 0, 0, 0.25 );
- color: #ffffff;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0 );
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-}
-
-button.success
-{
- background-color: #57a957;
- background-repeat: repeat-x;
- background-image: -khtml-gradient( linear, left top, left bottom, from( #62c462 ), to( #57a957 ) );
- background-image: -moz-linear-gradient( top, #62c462, #57a957 );
- background-image: -ms-linear-gradient( top, #62c462, #57a957 );
- background-image: -webkit-gradient( linear, left top, left bottom, color-stop( 0%, #62c462 ), color-stop( 100%, #57a957 ) );
- background-image: -webkit-linear-gradient( top, #62c462, #57a957 );
- background-image: -o-linear-gradient( top, #62c462, #57a957 );
- background-image: linear-gradient( top, #62c462, #57a957 );
- border-color: #57a957 #57a957 #3d773d;
- border-color: rgba( 0, 0, 0, 0.1 ) rgba( 0, 0, 0, 0.1 ) rgba( 0, 0, 0, 0.25 );
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#62c462', endColorstr='#57a957', GradientType=0 );
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba( 0, 0, 0, 0.25 );
-}
-
-button.warn
-{
- background-color: #c43c35;
- background-repeat: repeat-x;
- background-image: -khtml-gradient( linear, left top, left bottom, from( #ee5f5b ), to( #c43c35 ) );
- background-image: -moz-linear-gradient( top, #ee5f5b, #c43c35 );
- background-image: -ms-linear-gradient( top, #ee5f5b, #c43c35 );
- background-image: -webkit-gradient( linear, left top, left bottom, color-stop( 0%, #ee5f5b ), color-stop( 100%, #c43c35 ) );
- background-image: -webkit-linear-gradient( top, #ee5f5b, #c43c35 );
- background-image: -o-linear-gradient( top, #ee5f5b, #c43c35 );
- background-image: linear-gradient( top, #ee5f5b, #c43c35 );
- border-color: #c43c35 #c43c35 #882a25;
- border-color: rgba( 0, 0, 0, 0.1 ) rgba( 0, 0, 0, 0.1 ) rgba( 0, 0, 0, 0.25 );
- color: #ffffff;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0 );
- text-shadow: 0 -1px 0 rgba( 0, 0, 0, 0.25 );
-}
-
-a
-{
- text-decoration: none;
-}
-
-pre
-{
- color: #333;
- text-align: left;
-}
-
-abbr
-{
- cursor: help;
-}
-
-ul
-{
- list-style: none;
-}
-
-.clearfix:after { clear: both; content: "."; display: block; font-size: 0; height: 0; visibility: hidden; }
-.clearfix { display: block; }
-
-.loader
-{
- background-image: url( ../../img/loader.gif ) !important;
-}
-
-.loader-light
-{
- background-image: url( ../../img/loader-light.gif ) !important;
-}
-
-#wrapper
-{
- position: relative;
- margin: 0 auto;
- margin-bottom: 30px;
- text-align: left;
-}
-
-#header
-{
- padding-bottom: 10px;
- position: fixed;
- z-index: 42;
-}
-
-.scroll #header
-{
- position: absolute;
-}
-
-#header #solr
-{
- background-image: url( ../../img/solr.svg );
- background-size: 128px;
- display: block;
- height: 78px;
- width: 150px;
-}
-
-#header #solr span
-{
- display: none;
-}
-
-#main
-{
- min-width: 750px;
- position: relative;
-}
-
-#main.error
-{
- border: 0;
- min-height: 0;
- padding-top: 20px;
-}
-
-#main.error .message
-{
- background-color: #f00;
- background-image: url( ../../img/ico/construction.png );
- background-position: 10px 50%;
- color: #fff;
- font-weight: bold;
- margin-left: 150px;
- margin-bottom: 20px;
- padding: 10px;
- padding-left: 35px;
-}
-
-#main.error .code
-{
- border: 1px solid #c0c0c0;
- padding: 5px;
-}
-
-#meta
-{
- position: absolute;
- bottom: -26px;
- right: 0;
-}
-
-#meta li
-{
- float: left;
-}
-
-#meta li a
-{
- background-position: 10px 50%;
- display: block;
- height: 25px;
- line-height: 25px;
- padding-left: 31px;
- padding-right: 10px;
-}
-
-#meta li a:hover
-{
- background-color: #f0f0f0;
-}
-
-#meta .documentation a { background-image: url( ../../img/ico/document-text.png ); }
-#meta .issues a { background-image: url( ../../img/ico/bug.png ); }
-#meta .irc a { background-image: url( ../../img/ico/users.png ); }
-#meta .mailinglist a { background-image: url( ../../img/ico/mail.png ); }
-#meta .wiki-query-syntax a { background-image: url( ../../img/ico/script-code.png ); }
-
-#environment
-{
- background-image: url( ../../img/ico/box.png );
- background-position: 5px 50%;
- display: none;
- font-weight: bold;
- margin-top: 10px;
- padding: 5px 10px;
- padding-left: 26px;
-}
-
-.has-environment #environment
-{
- display: block;
-}
-
-#environment.prod
-{
- background-color: #c37f7f;
- color: #fff;
-}
-
-#environment.test
-{
- background-color: #f5f5b2;
-}
-
-#environment.dev
-{
- background-color: #cce7cc;
-}
-
-#init-failures
-{
- border: 1px solid #f00;
- display: none;
- margin-left: 150px;
- margin-bottom: 20px;
-}
-
-#init-failures h2,
-#init-failures ul,
-#init-failures p
-{
- padding: 10px;
-}
-
-#init-failures h2
-{
- background-color: #f00;
- color: #fff;
- font-weight: bold;
-}
-
-#init-failures p
-{
- color: #c0c0c0;
- padding-top: 0;
-}
-
-#content-wrapper
-{
- margin-left: 150px;
- border: 1px solid #c0c0c0;
- min-height: 500px;
-}
-
-#content
-{
- padding: 10px;
-}
-
-#content > .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content iframe
-{
- border: 0;
- display: block;
- min-height: 400px;
- width: 100%;
-}
-
-#content .block
-{
- margin-bottom: 10px;
-}
-
-#content .block h2
-{
- background-color: #fafafa;
- background-position: 5px 50%;
- border-bottom: 1px solid #f0f0f0;
- font-weight: bold;
- padding: 5px;
- padding-left: 26px;
-}
-
-#content .block.disabled,
-#content .block.disabled h2
-{
- color: #c0c0c0;
-}
-
-#content .block .message,
-#content .block .content
-{
- padding: 5px;
-}
-
-#content .block .message
-{
- display: none;
-}
-
-/* syntax */
-
-pre.syntax
-{
- overflow: auto;
-}
-
-pre.syntax code
-{
- display: block;
- color: #000;
-}
-
-pre.syntax .comment,
-pre.syntax .template_comment,
-pre.syntax .diff .header,
-pre.syntax .javadoc
-{
- color: #998;
- font-style: italic;
-}
-
-pre.syntax .keyword,
-pre.syntax .css .rule .keyword,
-pre.syntax .winutils,
-pre.syntax .javascript .title,
-pre.syntax .lisp .title,
-pre.syntax .subst
-{
- color: #000;
- font-weight: bold;
-}
-
-pre.syntax .number,
-pre.syntax .hexcolor
-{
- color: #40a070;
-}
-
-pre.syntax.language-json .number
-{
- color: blue;
-}
-
-pre.syntax.language-json .literal
-{
- color: firebrick;
-}
-
-pre.syntax .string,
-pre.syntax .tag .value,
-pre.syntax .phpdoc,
-pre.syntax .tex .formula
-{
- color: #d14;
-}
-
-pre.syntax.language-json .string
-{
- color: green;
-}
-
-pre.syntax .title,
-pre.syntax .id
-{
- color: #900;
- font-weight: bold;
-}
-
-pre.syntax .javascript .title,
-pre.syntax .lisp .title,
-pre.syntax .subst
-{
- font-weight: normal;
-}
-
-pre.syntax .class .title,
-pre.syntax .tex .command
-{
- color: #458;
- font-weight: bold;
-}
-
-pre.syntax .tag,
-pre.syntax .css .keyword,
-pre.syntax .html .keyword,
-pre.syntax .tag .title,
-pre.syntax .django .tag .keyword
-{
- color: #000080;
- font-weight: normal;
-}
-
-pre.syntax .attribute,
-pre.syntax .variable,
-pre.syntax .instancevar,
-pre.syntax .lisp .body
-{
- color: #008080;
-}
-
-pre.syntax.language-json .attribute
-{
- color: black;
- font-weight: bold;
-}
-
-pre.syntax .regexp
-{
- color: #009926;
-}
-
-pre.syntax .class
-{
- color: #458;
- font-weight: bold;
-}
-
-pre.syntax .symbol,
-pre.syntax .ruby .symbol .string,
-pre.syntax .ruby .symbol .keyword,
-pre.syntax .ruby .symbol .keymethods,
-pre.syntax .lisp .keyword,
-pre.syntax .tex .special
-{
- color: #990073;
-}
-
-pre.syntax .builtin,
-pre.syntax .built_in,
-pre.syntax .lisp .title
-{
- color: #0086b3;
-}
-
-pre.syntax .preprocessor,
-pre.syntax .pi,
-pre.syntax .doctype,
-pre.syntax .shebang,
-pre.syntax .cdata
-{
- color: #999;
- font-weight: bold;
-}
-
-pre.syntax .deletion
-{
- background: #fdd;
-}
-
-pre.syntax .addition
-{
- background: #dfd;
-}
-
-pre.syntax .diff .change
-{
- background: #0086b3;
-}
-
-pre.syntax .chunk
-{
- color: #aaa;
-}
-
-pre.syntax .tex .formula
-{
- opacity: 0.5;
-}
-
-#content .tree li,
-#content .tree ins
-{
- background-color: transparent;
- background-image: url( ../../img/tree.png );
- background-repeat: no-repeat;
-}
-
-#content .tree li
-{
- background-position: -54px 0;
- background-repeat: repeat-y;
- line-height: 22px;
-}
-
-#content .tree li.jstree-last
-{
- background:transparent;
-}
-
-#content .tree .jstree-open > ins
-{
- background-position: -36px 0;
-}
-
-#content .tree .jstree-closed > ins
-{
- background-position: -18px 0;
-}
-
-#content .tree .jstree-leaf > ins
-{
- background-position: 0 0;
-}
-
-#content .tree .jstree-hovered
-{
- background:#e7f4f9; border:1px solid #d8f0fa; padding:0 2px 0 1px;
-}
-
-#content .tree .jstree-clicked
-{
- background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px;
-}
-
-#content .tree a.active
-{
- background-color: #f0f0f0;
- color: #00f;
-}
-
-#content .tree a .jstree-icon
-{
- background-image: url( ../../img/ico/folder.png );
-}
-
-#content .tree .jstree-leaf a .jstree-icon
-{
- background-image: url( ../../img/ico/document-text.png );
-}
-
-#content .tree .jstree-search
-{
- font-style:italic;
-}
-
-#content .tree a.jstree-search
-{
- color:aqua;
-}
-
-#connection_status
-{
- display: none;
- padding: 30px;
-}
-
-#connection_status span
-{
- background-image: url( ../../img/ico/network-status-busy.png );
- background-position: 0 50%;
- color: #800;
- padding-left: 26px;
-}
-
-#connection_status.online span,
-#connection_status.online span a
-{
- color: #080;
-}
-
-#connection_status.online span
-{
- background-image: url( ../../img/ico/network-status.png );
-}
-
-#connection_status.online span a
-{
- text-decoration: underline;
-}
-
-#connection_status.online span a:hover
-{
- text-decoration: none;
-}
-
-#content .address-bar
-{
- margin-bottom: 10px;
- background-image: url( ../../img/ico/ui-address-bar.png );
- background-position: 5px 50%;
- border: 1px solid #f0f0f0;
- box-shadow: 1px 1px 0 #f0f0f0;
- -moz-box-shadow: 1px 1px 0 #f0f0f0;
- -webkit-box-shadow: 1px 1px 0 #f0f0f0;
- color: #c0c0c0;
- display: block;
- overflow: hidden;
- padding: 5px;
- padding-left: 26px;
- white-space: nowrap;
-}
-
-#content .address-bar:focus,
-#content .address-bar:hover
-{
- border-color: #c0c0c0;
- box-shadow: 1px 1px 0 #d8d8d8;
- -moz-box-shadow: 1px 1px 0 #d8d8d8;
- -webkit-box-shadow: 1px 1px 0 #d8d8d8;
- color: #333;
-}
-
-.other-ui-link {
- margin: 0px;
- position: absolute;
- right: 0px;
- top: -20px;
-}
-
-.other-ui-link span.help {
- background-image: url( ../../img/ico/information-white.png );
- right: 0px;
- padding-left: 16px;
-}
-.other-ui-link a.ul {
- text-decoration: underline;
-}
-
-.old-ui-warning {
- position: absolute;
- right: 0px;
- top: -20px;
- align: center;
- color: red;
- font-weight: bold;
-}
-.old-ui-warning a.ul {
- color: red;
- font-weight: bold;
- text-decoration: underline;
-}
diff --git a/solr/webapp/web/css/styles/cores.css b/solr/webapp/web/css/styles/cores.css
deleted file mode 100644
index 6a305883fb7..00000000000
--- a/solr/webapp/web/css/styles/cores.css
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #cores
-{
- position: relative;
-}
-
-#content #cores #ui-block
-{
- background-color: #fff;
- height: 200px;
- display: none;
- position: absolute;
- left: -5px;
- top: 35px;
- width: 500px;
-}
-
-#content #cores.empty .requires-core
-{
- display: none;
-}
-
-#content #cores #frame
-{
- float: right;
- width: 86%;
-}
-
-#content #cores #navigation
-{
- padding-top: 50px;
- width: 12%;
-}
-
-#content #cores #navigation a
-{
- padding-left: 5px;
-}
-
-#content #cores #frame .actions
-{
- margin-bottom: 20px;
- min-height: 30px;
-}
-
-#content #cores .actions div.action
-{
- width: 300px;
-}
-
-#content #cores .actions div.action .cloud
-{
- display: none;
-}
-
-#content #cores .actions form .directory-note
-{
- background-image: url( ../../img/ico/information-white.png );
- background-position: 22% 1px;
- color: #c0c0c0;
-}
-
-#content #cores .actions form .error
-{
- background-image: url( ../../img/ico/cross-button.png );
- background-position: 22% 1px;
- color: #c00;
- font-weight: bold;
- display: none;
-}
-
-#content #cores .actions form p
-{
- padding-bottom: 8px;
-}
-
-#content #cores .actions form label
-{
- float: left;
- padding-top: 3px;
- padding-bottom: 3px;
- text-align: right;
- width: 25%;
-}
-
-#content #cores .actions form input,
-#content #cores .actions form select,
-#content #cores .actions form .buttons,
-#content #cores .actions form .note span
-{
- float: right;
- width: 71%;
-}
-
-#content #cores .actions form .note span
-{
- padding-left: 3px;
- padding-right: 3px;
-}
-
-#content #cores .actions form .buttons
-{
- padding-top: 10px;
-}
-
-#content #cores .actions form button.submit
-{
- margin-right: 20px;
-}
-
-#content #cores .actions form button.submit span
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #cores .actions form button.reset span
-{
- background-image: url( ../../img/ico/cross.png );
-}
-
-#content #cores .actions #add
-{
- left: 0;
- position: absolute;
-}
-
-#content #cores .actions #add span
-{
- background-image: url( ../../img/ico/plus-button.png );
-}
-
-#content #cores .actions #unload
-{
- margin-right: 20px;
-}
-
-#content #cores .actions #unload span
-{
- background-image: url( ../../img/ico/cross.png );
-}
-
-#content #cores .actions #reload span
-{
- background-image: url( ../../img/ico/arrow-circle.png );
-}
-
-#content #cores .actions #rename span
-{
- background-image: url( ../../img/ico/ui-text-field-select.png );
-}
-
-#content #cores .actions #swap span
-{
- background-image: url( ../../img/ico/arrow-switch.png );
-}
-
-#content #cores .actions #optimize
-{
- display: none;
-}
-
-#content #cores .actions #optimize span
-{
- background-image: url( ../../img/ico/hammer-screwdriver.png );
-}
-
-#content #cores .actions div.action
-{
- background-color: #fff;
- border: 1px solid #f0f0f0;
- box-shadow: 5px 5px 10px #c0c0c0;
- -moz-box-shadow: 5px 5px 10px #c0c0c0;
- -webkit-box-shadow: 5px 5px 10px #c0c0c0;
- display: none;
- position: absolute;
- left: -50px;
- top: 40px;
- padding: 10px;
-}
-
-#content #cores #data #core-data h2 { background-image: url( ../../img/ico/box.png ); }
-#content #cores #data #index-data h2 { background-image: url( ../../img/ico/chart.png ); }
-
-#content #cores #data #index-data
-{
- margin-top: 10px;
-}
-
-#content #cores #data li
-{
- padding-bottom: 3px;
- padding-top: 3px;
-}
-
-#content #cores #data li.odd
-{
- background-color: #f8f8f8;
-}
-
-#content #cores #data li dt
-{
- float: left;
- width: 17%;
-}
-
-#content #cores #data li dd
-{
- float: right;
- width: 82%;
-}
-
-#content #cores #data li dd.ico
-{
- background-image: url( ../../img/ico/slash.png );
- height: 20px;
-}
-
-#content #cores #data li dd.ico.ico-1
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #cores #data li dd.ico span
-{
- display: none;
-}
diff --git a/solr/webapp/web/css/styles/dashboard.css b/solr/webapp/web/css/styles/dashboard.css
deleted file mode 100644
index 8d8fd972124..00000000000
--- a/solr/webapp/web/css/styles/dashboard.css
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #dashboard .block
-{
- background-image: none;
- width: 49%;
-}
-
-#content #dashboard .fieldlist
-{
- float: left;
-}
-
-#content #dashboard .fieldlist dt,
-#content #dashboard .fieldlist dd
-{
- display: block;
- float: left;
-}
-
-#content #dashboard .fieldlist dt
-{
- clear: left;
- margin-right: 2%;
- text-align: right;
- width: 23%;
-}
-
-#content #dashboard .fieldlist dd
-{
- width: 74%;
-}
-
-#content #dashboard .fieldlist .index_optimized
-{
- margin-top: 10px;
-}
-
-#content #dashboard .fieldlist .ico
-{
- background-image: url( ../../img/ico/slash.png );
- height: 20px;
-}
-
-#content #dashboard .fieldlist .ico.ico-1
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #dashboard .fieldlist .ico span
-{
- display: none;
-}
-
-#content #dashboard #statistics .index_optimized.value a
-{
- display: none;
-}
-
-#content #dashboard #statistics .index_optimized.value.ico-0 a
-{
- background-color: #f0f0f0;
- background-image: url( ../../img/ico/hammer-screwdriver.png );
- background-position: 5px 50%;
- border: 1px solid #c0c0c0;
- display: block;
- float: left;
- margin-left: 50px;
- padding: 1px 5px;
- padding-left: 26px;
-}
-
-#content #dashboard #statistics .index_has-deletions
-{
- display: none;
-}
-
-#content #dashboard #statistics .index_has-deletions.value.ico-0
-{
- background-image: url( ../../img/ico/tick-red.png );
-}
-
-#content #dashboard #replication
-{
- float: left;
-}
-
-#content #dashboard #replication .is-replicating
-{
- background-position: 99% 50%;
- display: block;
-}
-
-#content #dashboard #replication #details table thead td span
-{
- display: none;
-}
-
-#content #dashboard #instance
-{
- float: right;
-}
-
-#content #dashboard #instance .dir_impl
-{
- margin-top: 10px;
-}
-
-#content #dashboard #admin-extra
-{
- float: left;
-}
-
-#content #dashboard #healthcheck
-{
- float: right;
-}
-
-#content #dashboard #healthcheck .ico
-{
- background-image: url( ../../img/ico/slash.png );
- height: 20px;
- padding-left: 20px;
- width: 60%;
-}
-
-#content #dashboard #healthcheck .ico.ico-1
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #dashboard #system h2 { background-image: url( ../../img/ico/server.png ); }
-#content #dashboard #statistics h2 { background-image: url( ../../img/ico/chart.png ); }
-#content #dashboard #replication h2 { background-image: url( ../../img/ico/node.png ); }
-#content #dashboard #replication.master h2 { background-image: url( ../../img/ico/node-master.png ); }
-#content #dashboard #replication.slave h2 { background-image: url( ../../img/ico/node-slave.png ); }
-#content #dashboard #instance h2 { background-image: url( ../../img/ico/server.png ); }
-#content #dashboard #admin-extra h2 { background-image: url( ../../img/ico/plus-button.png ); }
\ No newline at end of file
diff --git a/solr/webapp/web/css/styles/dataimport.css b/solr/webapp/web/css/styles/dataimport.css
deleted file mode 100644
index 0ec196d53d7..00000000000
--- a/solr/webapp/web/css/styles/dataimport.css
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #dataimport
-{
- background-image: url( ../../img/div.gif );
- background-position: 21% 0;
- background-repeat: repeat-y;
-}
-
-#content #dataimport #frame
-{
- float: right;
- width: 78%;
-}
-
-#content #dataimport #form
-{
- float: left;
- width: 20%;
-}
-
-#content #dataimport #form #navigation
-{
- border-right: 0;
-}
-
-#content #dataimport #form #navigation a
-{
- background-image: url( ../../img/ico/status-offline.png );
-}
-
-#content #dataimport #form #navigation .current a
-{
- background-image: url( ../../img/ico/status.png );
-}
-
-#content #dataimport #form form
-{
- display: none;
- border-top: 1px solid #f0f0f0;
- margin-top: 10px;
- padding-top: 5px;
-}
-
-#content #dataimport.error #form form
-{
- display: none !important;
-}
-
-#content #dataimport #form label
-{
- cursor: pointer;
- display: block;
- margin-top: 5px;
-}
-
-#content #dataimport #form input,
-#content #dataimport #form select,
-#content #dataimport #form textarea
-{
- margin-bottom: 2px;
- width: 100%;
-}
-
-#content #dataimport #form input
-{
- width: 98%;
-}
-
-#content #dataimport #form button
-{
- margin-top: 10px;
-}
-
-#content #dataimport #form .execute span
-{
- background-image: url( ../../img/ico/document-import.png );
-}
-
-#content #dataimport #form .refresh-status span
-{
- background-image: url( ../../img/ico/arrow-circle.png );
-}
-
-#content #dataimport #form .refresh-status span.success
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #dataimport #form #start
-{
- float: left;
- width: 47%;
-}
-
-#content #dataimport #form #rows
-{
- float: right;
- width: 47%;
-}
-
-#content #dataimport #form .checkbox input
-{
- margin-bottom: 0;
- width: auto;
-}
-
-#content #dataimport #form #auto-refresh-status
-{
- margin-top: 20px;
-}
-
-#content #dataimport #form #auto-refresh-status a
-{
- background-image: url( ../../img/ico/ui-check-box-uncheck.png );
- background-position: 0 50%;
- color: #c0c0c0;
- display: block;
- padding-left: 21px;
-}
-
-#content #dataimport #form #auto-refresh-status a.on,
-#content #dataimport #form #auto-refresh-status a:hover
-{
- color: #333;
-}
-
-#content #dataimport #form #auto-refresh-status a.on
-{
- background-image: url( ../../img/ico/ui-check-box.png );
-}
-
-#content #dataimport #current_state
-{
- padding: 10px;
- margin-bottom: 20px;
-}
-
-#content #dataimport.error #current_state
-{
- display: none !important;
-}
-
-#content #dataimport #current_state .last_update,
-#content #dataimport #current_state .info
-{
- display: block;
- padding-left: 21px;
-}
-
-#content #dataimport #current_state .last_update
-{
- color: #c0c0c0;
- font-size: 11px;
-}
-
-#content #dataimport #current_state .info
-{
- background-position: 0 1px;
- position: relative;
-}
-
-#content #dataimport #current_state .info .details span
-{
- color: #c0c0c0;
-}
-
-#content #dataimport #current_state .info .abort-import
-{
- display: none;
- position: absolute;
- right: 0px;
- top: 0px;
-}
-
-#content #dataimport #current_state .info .abort-import span
-{
- background-image: url( ../../img/ico/cross.png );
-}
-
-#content #dataimport #current_state .info .abort-import.success span
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #dataimport #current_state.indexing
-{
- background-color: #f9f9f9;
-}
-
-#content #dataimport #current_state.indexing .info
-{
- background-image: url( ../../img/ico/hourglass.png );
-}
-
-#content #dataimport #current_state.indexing .info .abort-import
-{
- display: block;
-}
-
-#content #dataimport #current_state.success
-{
- background-color: #e6f3e6;
-}
-
-#content #dataimport #current_state.success .info
-{
- background-image: url( ../../img/ico/tick-circle.png );
-}
-
-#content #dataimport #current_state.success .info strong
-{
- color: #080;
-}
-
-#content #dataimport #current_state.aborted
-{
- background-color: #f3e6e6;
-}
-
-#content #dataimport #current_state.aborted .info
-{
- background-image: url( ../../img/ico/slash.png );
-}
-
-#content #dataimport #current_state.aborted .info strong
-{
- color: #800;
-}
-
-#content #dataimport #current_state.failure
-{
- background-color: #f3e6e6;
-}
-
-#content #dataimport #current_state.failure .info
-{
- background-image: url( ../../img/ico/cross-button.png );
-}
-
-#content #dataimport #current_state.failure .info strong
-{
- color: #800;
-}
-
-#content #dataimport #current_state.idle
-{
- background-color: #e6e6ff;
-}
-
-#content #dataimport #current_state.idle .info
-{
- background-image: url( ../../img/ico/information.png );
-}
-
-#content #dataimport #error
-{
- background-color: #f00;
- background-image: url( ../../img/ico/construction.png );
- background-position: 10px 50%;
- color: #fff;
- display: none;
- font-weight: bold;
- margin-bottom: 20px;
- padding: 10px;
- padding-left: 35px;
-}
-
-#content #dataimport .block h2
-{
- border-color: #c0c0c0;
- padding-left: 5px;
- position: relative;
-}
-
-#content #dataimport .block.hidden h2
-{
- border-color: #fafafa;
-}
-
-#content #dataimport .block h2 a.toggle
-{
- background-image: url( ../../img/ico/toggle-small.png );
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #dataimport .block.hidden h2 a.toggle
-{
- background-image: url( ../../img/ico/toggle-small-expand.png );
-}
-
-#content #dataimport #config h2 a.r
-{
- background-position: 3px 50%;
- display: block;
- float: right;
- margin-left: 10px;
- padding-left: 24px;
- padding-right: 3px;
-}
-
-#content #dataimport #config h2 a.reload_config
-{
- background-image: url( ../../img/ico/arrow-circle.png );
-}
-
-#content #dataimport #config h2 a.reload_config.success
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #dataimport #config h2 a.reload_config.error
-{
- background-image: url( ../../img/ico/slash.png );
-}
-
-#content #dataimport #config h2 a.debug_mode
-{
- background-image: url( ../../img/ico/hammer.png );
- color: #c0c0c0;
-}
-
-#content #dataimport #config.debug_mode h2 a.debug_mode
-{
- background-color: #ff0;
- background-image: url( ../../img/ico/hammer-screwdriver.png );
- color: #333;
-}
-
-#content #dataimport .block.hidden .content
-{
- display: none;
-}
-
-#content #dataimport #config .content
-{
- padding: 5px 2px;
-}
-
-#content #dataimport #dataimport_config .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #dataimport #dataimport_config .formatted
-{
- border: 1px solid #fff;
- display: block;
- padding: 2px;
-}
-
-#content #dataimport .debug_mode #dataimport_config .formatted
-{
- display: none;
-}
-
-#content #dataimport #dataimport_config .editable
-{
- display: none;
-}
-
-#content #dataimport .debug_mode #dataimport_config .editable
-{
- display: block;
-}
-
-#content #dataimport #dataimport_config .editable textarea
-{
- font-family: monospace;
- height: 120px;
- min-height: 60px;
- width: 100%;
-}
-
-#content #dataimport #debug_response
-{
- display: none;
-}
-
-#content #dataimport #debug_response em
-{
- color: #c0c0c0;
- font-style: normal;
-}
diff --git a/solr/webapp/web/css/styles/documents.css b/solr/webapp/web/css/styles/documents.css
deleted file mode 100644
index 18c4efc384c..00000000000
--- a/solr/webapp/web/css/styles/documents.css
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #documents
-{
- background-image: url( ../../img/div.gif );
- background-position: 45% 0;
- background-repeat: repeat-y;
-}
-
-#content #documents #form
-{
- float: left;
- /*width: 21%;*/
-}
-
-#content #documents #form label
-{
- cursor: pointer;
- display: block;
- margin-top: 5px;
-}
-
-#content #documents #form input,
-#content #documents #form select,
-#content #documents #form textarea
-{
- margin-bottom: 2px;
- /*width: 100%;*/
-}
-
-#content #documents #form input,
-#content #documents #form textarea
-{
- margin-bottom: 2px;
- /*width: 98%;*/
-}
-
-#content #documents #form #start
-{
- float: left;
- /*width: 45%;*/
-}
-
-#content #documents #form #rows
-{
- float: right;
- /* width: 45%;*/
-}
-
-#content #documents #form .checkbox input
-{
- margin-bottom: 0;
- width: auto;
-}
-
-#content #documents #form fieldset,
-#content #documents #form .optional.expanded
-{
- border: 1px solid #fff;
- border-top: 1px solid #c0c0c0;
- margin-bottom: 5px;
-}
-
-#content #documents #form fieldset.common
-{
- margin-top: 10px;
-}
-
-#content #documents #form fieldset legend,
-#content #documents #form .optional.expanded legend
-{
- display: block;
- margin-left: 10px;
- padding: 0px 5px;
-}
-
-#content #documents #form fieldset legend label
-{
- margin-top: 0;
-}
-
-#content #documents #form fieldset .fieldset
-{
- border-bottom: 1px solid #f0f0f0;
- margin-bottom: 5px;
- padding-bottom: 10px;
-}
-
-#content #documents #form .optional
-{
- border: 0;
-}
-
-#content #documents #form .optional .fieldset
-{
- display: none;
-}
-
-#content #documents #form .optional legend
-{
- margin-left: 0;
- padding-left: 0;
-}
-
-#content #documents #form .optional.expanded .fieldset
-{
- display: block;
-}
-
-#content #documents #file-upload{
- display: none;
-}
-
-#content #documents #result
-{
- display: none;
- float: right;
- width: 54%;
-}
-
-#content #documents #result #url
-{
- margin-bottom: 10px;
- background-image: url( ../../img/ico/ui-address-bar.png );
- background-position: 5px 50%;
- border: 1px solid #f0f0f0;
- box-shadow: 1px 1px 0 #f0f0f0;
- -moz-box-shadow: 1px 1px 0 #f0f0f0;
- -webkit-box-shadow: 1px 1px 0 #f0f0f0;
- color: #c0c0c0;
- display: block;
- overflow: hidden;
- padding: 5px;
- padding-left: 26px;
- white-space: nowrap;
-}
-
-#content #documents #result #url:focus,
-#content #documents #result #url:hover
-{
- border-color: #c0c0c0;
- box-shadow: 1px 1px 0 #d8d8d8;
- -moz-box-shadow: 1px 1px 0 #d8d8d8;
- -webkit-box-shadow: 1px 1px 0 #d8d8d8;
- color: #333;
-}
-
-#content #documents #result #response
-{
-}
-
-#content #documents #result #response pre
-{
- padding-left: 20px;
-}
-
-.description{
- font-weight: bold;
-}
-
-#upload-only{
- display: none;
-}
-
-#document-type{
- padding-bottom: 5px;
-}
-
-#wizard{
- display: none;
-}
-
-#wizard-fields div{
- padding-top: 5px;
- padding-bottom: 5px;
-}
-
-#wiz-field-data, #wiz-field-data span{
- vertical-align: top;
-}
diff --git a/solr/webapp/web/css/styles/files.css b/solr/webapp/web/css/styles/files.css
deleted file mode 100644
index 792cc31fe6f..00000000000
--- a/solr/webapp/web/css/styles/files.css
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #files #tree-holder
-{
- float: left;
- width: 20%;
-}
-
-#content #files #tree-holder li
-{
- overflow: hidden;
-}
-
-#content #files form .buttons button
-{
- float: right;
-}
-
-#content #files #file-content
-{
- display: none;
- float: right;
- position: relative;
- width: 78%;
- min-height: 100px
-}
-
-#content #files .show #file-content
-{
- display: block;
-}
-
-#content #files #file-content .response
-{
- border: 1px solid transparent;
- padding: 2px;
-}
\ No newline at end of file
diff --git a/solr/webapp/web/css/styles/index.css b/solr/webapp/web/css/styles/index.css
deleted file mode 100644
index 288e040a2ab..00000000000
--- a/solr/webapp/web/css/styles/index.css
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #index .bar-desc
-{
- color: #c0c0c0;
- font-weight: normal;
- margin-left: 10px;
- white-space: pre;
-}
-
-#content #index .bar-holder
-{
- box-shadow: 5px 5px 10px #c0c0c0;
- -moz-box-shadow: 5px 5px 10px #c0c0c0;
- -webkit-box-shadow: 5px 5px 10px #c0c0c0;
- height: 35px;
-}
-
-#content #index .bar-holder .bar
-{
- height: 100%;
- position: relative;
-}
-
-#content #index .bar-holder div .val
-{
- border-right: 1px solid #f00;
- display: block;
- padding-right: 5px;
- position: absolute;
- right: 0;
- top: 35px;
- white-space: nowrap;
-}
-
-#content #index .bar-holder .bar-max.bar
-{
- background-color: #f0f0f0;
-}
-
-#content #index .bar-holder .bar-max.val
-{
- border-color: #f0f0f0;
- color: #d6d6d6;
-}
-
-#content #index .bar-holder .bar-total.bar
-{
- background-color: #c0c0c0;
-}
-
-#content #index .bar-holder .bar-total.val
-{
- border-color: #c0c0c0;
- color: #c0c0c0;
-}
-
-#content #index .bar-holder .bar-used.bar
-{
- background-color: #969696;
-}
-
-#content #index .bar-holder .bar-used.val
-{
- border-color: #969696;
- color: #969696;
-}
-
-#content #index .bar-holder.bar-lvl-2 .bar-max.val { padding-top: 25px; }
-#content #index .bar-holder.bar-lvl-2 .bar-total.val { padding-top: 5px; }
-#content #index .bar-holder.bar-lvl-2 { margin-bottom: 45px; }
-
-#content #index .bar-holder.bar-lvl-3 .bar-max.val { padding-top: 45px; }
-#content #index .bar-holder.bar-lvl-3 .bar-total.val { padding-top: 25px; }
-#content #index .bar-holder.bar-lvl-3 .bar-used.val { padding-top: 5px; }
-#content #index .bar-holder.bar-lvl-3 { margin-bottom: 65px; }
-
-#content #index .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #index .index-left
-{
- float: left;
- width: 55%;
-}
-
-#content #index .index-right
-{
- float: right;
- width: 40%;
-}
-
-#content #index .data li
-{
- display: none;
- padding-top: 3px;
- padding-bottom: 3px;
-}
-
-#content #index .data li dt
-{
- float: left;
- white-space: nowrap;
- width: 20%;
-}
-
-#content #index .data li dd
-{
- float: right;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- width: 80%
-}
-
-#content #index .data li dd.odd
-{
- color: #999;
-}
-
-#content #index .data dt span
-{
- background-position: 1px 50%;
- display: block;
- padding-left: 22px;
-}
-
-#content #index #instance h2 { background-image: url( ../../img/ico/server.png ); }
-#content #index #instance .start_time dt span { background-image: url( ../../img/ico/clock-select.png ); }
-
-#content #index #versions h2 { background-image: url( ../../img/ico/property.png ); }
-#content #index #versions .solr span { background-image: url( ../../img/solr-ico.png ); }
-#content #index #versions .lucene span { background-image: url( ../../img/lucene-ico.png ); }
-
-#content #index #jvm h2 { background-image: url( ../../img/ico/jar.png ); }
-#content #index #jvm .jvm_version dt span { background-image: url( ../../img/ico/jar.png ); }
-#content #index #jvm .processors dt span { background-image: url( ../../img/ico/processor.png ); }
-#content #index #jvm .command_line_args dt span { background-image: url( ../../img/ico/terminal.png ); }
-
-#content #index #system h2 { background-image: url( ../../img/ico/system-monitor.png ); }
-
-#content #index #system
-{
- position: relative;
-}
-
-#content #index #system .reload
-{
- background-image: url( ../../img/ico/arrow-circle.png );
- background-position: 50% 50%;
- display: block;
- height: 30px;
- position: absolute;
- right: 0;
- top: 0;
- width: 30px;
-}
-
-#content #index #system .reload.loader
-{
- padding-left: 0;
-}
-
-#content #index #system .reload span
-{
- display: none;
-}
-
-#content #index #system .content p
-{
- margin-top: 10px;
- margin-bottom: 5px;
-}
-
-#content #index #system .content .no-info
-{
- color: #c0c0c0;
- display: none;
- font-style: italic;
-}
-
-#content #index #jvm-memory h2 { background-image: url( ../../img/ico/memory.png ); }
-
-#content #index #jvm-memory-bar
-{
- margin-top: 20px;
-}
diff --git a/solr/webapp/web/css/styles/logging.css b/solr/webapp/web/css/styles/logging.css
deleted file mode 100644
index 6d309575de7..00000000000
--- a/solr/webapp/web/css/styles/logging.css
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #logging .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #logging .block h2
-{
- background-image: url( ../../img/ico/document-text.png );
- margin-bottom: 10px;
-}
-
-#content #logging .block h2 span span
-{
- color: #c0c0c0;
- font-weight: normal;
- margin-left: 10px;
-}
-
-#content #logging #viewer
-{
- position: relative;
-}
-
-#content #logging #viewer time
-{
- white-space: pre;
-}
-
-#content #logging #viewer #footer
-{
- margin-top: 20px;
-}
-
-#content #logging #viewer #state
-{
- background-position: 0 50%;
- float: left;
- color: #c0c0c0;
- padding-left: 21px;
- width: 45%;
-}
-
-#content #logging #viewer #date-format
-{
- float: right;
-}
-
-#content #logging #viewer #date-format a
-{
- background-image: url( ../../img/ico/ui-check-box-uncheck.png );
- background-position: 0 50%;
- color: #c0c0c0;
- display: block;
- padding-left: 21px;
-}
-
-#content #logging #viewer #date-format a:hover
-{
- color: #008;
-}
-
-#content #logging #viewer #date-format a.on
-{
- background-image: url( ../../img/ico/ui-check-box.png );
- color: #333;
-}
-
-#content #logging #viewer table
-{
- border-collapse: collapse;
- width: 100%;
-}
-
-#content #logging #viewer th,
-#content #logging #viewer td a,
-#content #logging #viewer tbody .trace td
-{
- padding: 3px 10px;
-}
-
-#content #logging #viewer td
-{
- vertical-align: top;
-}
-
-#content #logging #viewer td a
-{
- display: block;
-}
-
-#content #logging #viewer thead th
-{
- font-weight: bold;
- text-align: left;
-}
-
-#content #logging #viewer tbody td,
-#content #logging #viewer tfoot td
-{
- border-top: 1px solid #f0f0f0;
-}
-
-#content #logging #viewer thead th.message
-{
- width:100%;
-}
-
-#content #logging #viewer tbody td.span a
-{
- padding-left: 0;
- padding-right: 0;
-}
-
-#content #logging #viewer tbody span
-{
- display: block;
- padding-left: 10px;
- padding-right: 10px;
-}
-
-#content #logging #viewer tbody .level-info .level span { background-color: #ebf5eb; }
-#content #logging #viewer tbody .level-warning span { background-color: #FFD930; }
-#content #logging #viewer tbody .level-severe span { background-color: #c43c35; color: #fff; }
-
-#content #logging #viewer tbody .level-debug span { background-color: #ebf5eb; }
-#content #logging #viewer tbody .level-warn span { background-color: #FFD930; }
-#content #logging #viewer tbody .level-error span { background-color: #FF6130; }
-#content #logging #viewer tbody .level-fatal span { background-color: #c43c35; }
-
-#content #logging #viewer tbody .has-trace a
-{
- cursor: pointer;
-}
-
-#content #logging #viewer tbody .has-trace a:hover
-{
- color: #008;
-}
-
-#content #logging #viewer tbody .has-trace .message a
-{
- background-image: url( ../../img/ico/information.png );
- background-position: 100% 50%;
- display: block;
- padding-right: 21px;
-}
-
-#content #logging #viewer tbody .has-trace.open .message a
-{
- background-image: url( ../../img/ico/information-white.png );
-}
-
-#content #logging #viewer tbody .trace
-{
- display: none;
-}
-
-#content #logging #viewer tbody .trace td
-{
- border-top: 0;
- color: #c0c0c0;
-}
-
-#content #logging #viewer .has-data tfoot
-{
- display: none;
-}
-
-#content #logging #viewer tfoot td
-{
- color: #c0c0c0;
-}
-
-#content #logging .jstree > li
-{
- margin-left: 0;
-}
-
-#content #logging .jstree li
-{
- position: relative;
-}
-
-#content #logging .jstree .level-finest { background-color: #d5e5fc; }
-#content #logging .jstree .level-fine { background-color: #d5fafc; }
-#content #logging .jstree .level-config { background-color: #e6fded; }
-#content #logging .jstree .level-info { background-color: #fafcd7; }
-#content #logging .jstree .level-warning { background-color: #fcecd5; }
-#content #logging .jstree .level-severe { background-color: #fcdcda; }
-#content #logging .jstree .level-off { background-color: #ffffff; }
-
-/* Log4j */
-#content #logging .jstree .level-all { background-color: #9EDAFF; }
-#content #logging .jstree .level-trace { background-color: #d5e5fc; }
-#content #logging .jstree .level-debug { background-color: #d5fafc; }
-#content #logging .jstree .level-warn { background-color: #e6fded; }
-#content #logging .jstree .level-error { background-color: #fcecd5; }
-#content #logging .jstree .level-fatal { background-color: #fcdcda; }
-
-
-#content #logging .jstree a
-{
- height: 17px;
- line-height: 17px;
- padding: 0;
- width: 90%;
-}
-
-#content #logging .jstree a:hover
-{
- color: #008;
-}
-
-#content #logging .jstree a span.ns
-{
- display: none;
-}
-
-#content #logging.ns .jstree a span.ns
-{
- display: inline;
-}
-
-#content #logging .jstree a span.name
-{
- background-position: 100% 50%;
- cursor: pointer;
- padding-right: 21px;
-}
-
-#content #logging .jstree a span.name em
-{
- color: #f00;
- font-style: normal;
- text-transform: uppercase;
-}
-
-#content #logging .jstree a.trigger.set
-{
- font-weight: bold;
-}
-
-#content #logging .jstree a:hover span.name
-{
- background-image: url( ../../img/ico/pencil-small.png );
-}
-
-#content #logging .jstree .selector-holder
-{
- position: absolute;
- top: -2px;
- z-index: 700;
-}
-
-#content #logging .jstree .selector-holder.open
-{
- background-color: #fff;
- margin-left: -19px;
- z-index: 800;
-}
-
-#content #logging .jstree li .selector-holder { left: 440px; }
-#content #logging .jstree li li .selector-holder { left: 422px; }
-#content #logging .jstree li li li .selector-holder { left: 404px; }
-#content #logging .jstree li li li li .selector-holder { left: 386px; }
-#content #logging .jstree li li li li li .selector-holder { left: 368px; }
-#content #logging .jstree li li li li li li .selector-holder { left: 350px; }
-#content #logging .jstree li li li li li li li .selector-holder { left: 332px; }
-#content #logging .jstree li li li li li li li li .selector-holder { left: 314px; }
-
-#content #logging .jstree .selector
-{
- border: 1px solid transparent;
- position: relative;
-}
-
-#content #logging .jstree .open .selector
-{
- border-color: #f0f0f0;
- box-shadow: 5px 5px 10px #c0c0c0;
- -moz-box-shadow: 5px 5px 10px #c0c0c0;
- -webkit-box-shadow: 5px 5px 10px #c0c0c0;
-}
-
-#content #logging .jstree .selector a
-{
- display: block;
- padding: 2px;
- width: auto;
-}
-
-#content #logging .jstree .selector .close
-{
- display: none;
-}
-
-#content #logging .jstree .open .selector .close
-{
- background-image: url( ../../img/ico/cross-0.png );
- background-position: 50% 50%;
- display: block;
- position: absolute;
- right: -25px;
- top: 0;
- width: 20px;
-}
-
-#content #logging .jstree .open .selector .close:hover
-{
- background-image: url( ../../img/ico/cross-1.png );
-}
-
-#content #logging .jstree .open .selector .close span
-{
- display: none;
-}
-
-#content #logging .jstree .open .selector a.trigger
-{
- display: none;
-}
-
-#content #logging .jstree .selector ul
-{
- display: none;
-}
-
-#content #logging .jstree .open .selector ul
-{
- display: block;
-}
-
-#content #logging .jstree .selector ul li
-{
- background: none;
- margin-left: 0;
-}
-
-#content #logging .jstree .selector ul li a
-{
- background-image: url( ../../img/ico/ui-radio-button-uncheck.png );
- background-position: 2px 50%;
- padding-left: 21px;
-}
-
-#content #logging .jstree .selector ul li a.level
-{
- background-color: #f0f0f0;
-}
-
-#content #logging .jstree .selector ul li a:hover
-{
- background-image: url( ../../img/ico/ui-radio-button.png );
-}
-
-#content #logging .jstree .selector li.unset
-{
- border-top: 1px solid #f0f0f0;
-}
-
-#content #logging .jstree .selector li.unset a
-{
- background-image: url( ../../img/ico/cross-0.png );
- background-position: 4px 50%;
-}
-
-#content #logging .jstree .selector li.unset a:hover
-{
- background-image: url( ../../img/ico/cross-1.png );
- color: #800;
-}
diff --git a/solr/webapp/web/css/styles/menu.css b/solr/webapp/web/css/styles/menu.css
deleted file mode 100644
index f4fa68f8f21..00000000000
--- a/solr/webapp/web/css/styles/menu.css
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#menu-wrapper
-{
- position: fixed;
- top: 120px;
- width: 150px;
-}
-
-.scroll #menu-wrapper
-{
- position: absolute;
- top: 90px;
-}
-
-.has-environment #menu-wrapper
-{
- top: 160px;
-}
-
-#menu-wrapper a
-{
- display: block;
- padding: 4px 2px;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-#core-selector
-{
- margin-top: 20px;
- padding-right: 10px;
-}
-
-#core-selector a
-{
- padding: 0;
- padding-left: 8px;
-}
-
-#core-selector select
-{
- width: 100%;
-}
-
-#core-selector #has-no-cores
-{
- display: none;
-}
-
-#core-selector #has-no-cores a
-{
- background-image: url( ../../img/ico/database--plus.png );
-}
-
-#core-selector #has-no-cores span
-{
- color: #c0c0c0;
- display: block;
-}
-
-#menu-wrapper .active p
-{
- background-color: #fafafa;
- border-color: #c0c0c0;
-}
-
-#menu-wrapper p a,
-#menu a
-{
- background-position: 5px 50%;
- padding-left: 26px;
- padding-top: 5px;
- padding-bottom: 5px;
-}
-
-#menu-wrapper p a:hover
-{
- background-color: #f0f0f0;
-}
-
-#menu-wrapper .active p a
-{
- background-color: #c0c0c0;
- font-weight: bold;
-}
-
-#menu p.loader
-{
- background-position: 5px 50%;
- color: #c0c0c0;
- margin-top: 5px;
- padding-left: 26px;
-}
-
-#menu p a small
-{
- color: #b5b5b5;
- font-weight: normal;
-}
-
-#menu p a small span.txt
-{
- display: none;
-}
-
-#menu p a small:hover span.txt
-{
- display: inline;
-}
-
-#menu .busy
-{
- border-right-color: #f6f5d9;
-}
-
-#menu .busy p a
-{
- background-color: #f6f5d9;
- background-image: url( ../../img/ico/status-away.png );
-}
-
-#menu .offline
-{
- border-right-color: #eccfcf;
-}
-
-#menu .offline p a
-{
- background-color: #eccfcf;
- background-image: url( ../../img/ico/status-busy.png );
-}
-
-#menu .online
-{
- border-right-color: #cfecd3;
-}
-
-#menu .online p a
-{
- background-color: #cfecd3;
- background-image: url( ../../img/ico/status.png );
-}
-
-#menu .ping small
-{
- color: #000
-}
-
-#menu li
-{
- border-bottom: 1px solid #f0f0f0;
-}
-
-#menu li:last-child
-{
- border-bottom: 0;
-}
-
-#menu li.optional
-{
- display: none;
-}
-
-#core-menu p
-{
- border-top: 1px solid #f0f0f0;
-}
-
-#core-menu li:first-child p
-{
- border-top: 0;
-}
-
-#core-menu p a
-{
- background-image: url( ../../img/ico/status-offline.png );
-}
-
-#core-menu .active p a
-{
- background-image: url( ../../img/ico/box.png );
-}
-
-#core-menu ul,
-#menu ul
-{
- display: none;
- padding-top: 5px;
- padding-bottom: 10px;
-}
-
-#core-menu .active ul,
-#menu .active ul
-{
- display: block;
-}
-
-#menu ul li
-{
- border-bottom: 0;
-}
-
-#core-menu ul li a,
-#menu ul li a
-{
- background-position: 7px 50%;
- border-bottom: 1px solid #f0f0f0;
- color: #bbb;
- margin-left: 15px;
- padding-left: 26px;
-}
-
-#core-menu ul li:last-child a,
-#menu ul li:last-child a
-{
- border-bottom: 0;
-}
-
-#core-menu ul li a:hover,
-#menu ul li a:hover
-{
- background-color: #f0f0f0;
- color: #333;
-}
-
-#core-menu ul li.active a,
-#menu ul li.active a
-{
- background-color: #d0d0d0;
- border-color: #d0d0d0;
- color: #333;
-}
-
-#menu #index.global p a { background-image: url( ../../img/ico/dashboard.png ); }
-
-#menu #logging.global p a { background-image: url( ../../img/ico/inbox-document-text.png ); }
-#menu #logging.global .level a { background-image: url( ../../img/ico/gear.png ); }
-
-#menu #java-properties.global p a { background-image: url( ../../img/ico/jar.png ); }
-
-#menu #threads.global p a { background-image: url( ../../img/ico/ui-accordion.png ); }
-
-#menu #cores.global p a { background-image: url( ../../img/ico/databases.png ); }
-
-#menu #cloud.global p a { background-image: url( ../../img/ico/network-cloud.png ); }
-#menu #cloud.global .tree a { background-image: url( ../../img/ico/folder-tree.png ); }
-#menu #cloud.global .graph a { background-image: url( ../../img/ico/molecule.png ); }
-#menu #cloud.global .rgraph a { background-image: url( ../../img/ico/asterisk.png ); }
-#menu #cloud.global .dump a { background-image: url( ../../img/ico/download-cloud.png ); }
-
-#core-menu .ping.error a
-{
-
- background-color: #ffcccc;
- background-image: url( ../../img/ico/system-monitor--exclamation.png );
- border-color: #ffcccc;
- cursor: help;
-}
-
-#core-menu .overview a { background-image: url( ../../img/ico/home.png ); }
-#core-menu .query a { background-image: url( ../../img/ico/magnifier.png ); }
-#core-menu .analysis a { background-image: url( ../../img/ico/funnel.png ); }
-#core-menu .documents a { background-image: url( ../../img/ico/documents-stack.png ); }
-#core-menu .files a { background-image: url( ../../img/ico/folder.png ); }
-#core-menu .schema-browser a { background-image: url( ../../img/ico/book-open-text.png ); }
-#core-menu .replication a { background-image: url( ../../img/ico/node.png ); }
-#core-menu .distribution a { background-image: url( ../../img/ico/node-select.png ); }
-#core-menu .ping a { background-image: url( ../../img/ico/system-monitor.png ); }
-#core-menu .logging a { background-image: url( ../../img/ico/inbox-document-text.png ); }
-#core-menu .plugins a { background-image: url( ../../img/ico/block.png ); }
-#core-menu .dataimport a { background-image: url( ../../img/ico/document-import.png ); }
-#core-menu .segments a { background-image: url( ../../img/ico/construction.png ); }
-
-
-#content #navigation
-{
- border-right: 1px solid #e0e0e0;
-}
-
-#content #navigation a
-{
- display: block;
- padding: 4px 2px;
-}
-
-#content #navigation .current
-{
- border-color: #e0e0e0;
-}
-
-#content #navigation a
-{
- background-position: 5px 50%;
- padding-left: 26px;
- padding-top: 5px;
- padding-bottom: 5px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-#content #navigation a:hover
-{
- background-color: #f0f0f0;
-}
-
-#content #navigation .current a
-{
- background-color: #e0e0e0;
- font-weight: bold;
-}
diff --git a/solr/webapp/web/css/styles/plugins.css b/solr/webapp/web/css/styles/plugins.css
deleted file mode 100644
index f8ea76934ff..00000000000
--- a/solr/webapp/web/css/styles/plugins.css
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #plugins #navigation
-{
- width: 20%;
-}
-
-#content #plugins #navigation .cache a { background-image: url( ../../img/ico/disk-black.png ); }
-#content #plugins #navigation .core a { background-image: url( ../../img/ico/wooden-box.png ); }
-#content #plugins #navigation .other a { background-image: url( ../../img/ico/zone.png ); }
-#content #plugins #navigation .highlighting a { background-image: url( ../../img/ico/highlighter-text.png ); }
-#content #plugins #navigation .updatehandler a{ background-image: url( ../../img/ico/arrow-circle.png ); }
-#content #plugins #navigation .queryhandler a { background-image: url( ../../img/ico/magnifier.png ); }
-#content #plugins #navigation .queryparser a { background-image: url( ../../img/ico/asterisk.png ); }
-
-#content #plugins #navigation .PLUGINCHANGES { margin-top: 20px; }
-#content #plugins #navigation .PLUGINCHANGES a { background-image: url( ../../img/ico/eye.png ); }
-#content #plugins #navigation .RELOAD a { background-image: url( ../../img/ico/arrow-circle.png ); }
-
-
-#content #plugins #navigation a
-{
- position: relative;
-}
-
-#content #plugins #navigation a span
-{
- background-color: #bba500;
- border-radius: 5px;
- color: #fff;
- font-size: 10px;
- font-weight: normal;
- line-height: 1.4em;
- padding-left: 4px;
- padding-right: 4px;
- position: absolute;
- right: 5px;
- top: 7px;
-}
-
-#content #plugins #frame
-{
- float: right;
- width: 78%;
-}
-
-#content #plugins #frame .entry
-{
- margin-bottom: 10px;
-}
-
-#content #plugins #frame .entry:last-child
-{
- margin-bottom: 0;
-}
-
-#content #plugins #frame .entry a
-{
- background-image: url( ../../img/ico/chevron-small-expand.png );
- background-position: 0 50%;
- display: block;
- font-weight: bold;
- padding-left: 21px;
-}
-
-#content #plugins #frame .entry.changed a span
-{
- color: #bba500;
-}
-
-#content #plugins #frame .entry.expanded a
-{
- background-image: url( ../../img/ico/chevron-small.png );
-}
-
-#content #plugins #frame .entry.expanded ul
-{
- display: block;
-}
-
-#content #plugins #frame .entry ul
-{
- border-left: 9px solid #f0f3ff;
- display: none;
- margin-left: 3px;
- padding-top: 5px;
- padding-left: 10px;
-}
-
-#content #plugins #frame .entry li
-{
- padding-top: 2px;
- padding-bottom: 2px;
-}
-
-#content #plugins #frame .entry li.stats
-{
- border-top: 1px solid #c0c0c0;
- margin-top: 5px;
- padding-top: 5px;
-}
-
-#content #plugins #frame .entry li.odd
-{
- background-color: #f8f8f8;
-}
-
-#content #plugins #frame .entry dt,
-#content #plugins #frame .entry .stats span
-{
- float: left;
- width: 11%;
-}
-
-#content #plugins #frame .entry dd,
-#content #plugins #frame .entry .stats ul
-{
- float: right;
- width: 88%;
-}
-
-#content #plugins #frame .entry .stats ul
-{
- border-left: 0;
- margin: 0;
- padding: 0;
-}
-
-#content #plugins #frame .entry .stats dt
-{
- width: 27%;
-}
-
-#content #plugins #frame .entry .stats dd
-{
- width: 72%;
-}
-
-#content #plugins #frame .entry.expanded a.linker {
- background-image: none;
- background-position: 0 0;
- display: inline;
- font-weight: normal;
- padding:0px;
-}
-
-#content #plugins #frame .entry.expanded a.linker:hover {
- background-color:#F0F3FF;
-}
-
-#recording
-{
- display: none;
-}
-
-#recording .wrapper
-{
- padding: 30px;
-}
-
-#recording p
-{
- background-position: 0 50%;
- float: left;
- padding-left: 21px;
- padding-top: 7px;
- padding-bottom: 7px;
-}
-
-#recording button
-{
- float: right;
-}
-
-#recording button span
-{
- background-image: url( ../../img/ico/new-text.png );
-}
diff --git a/solr/webapp/web/css/styles/query.css b/solr/webapp/web/css/styles/query.css
deleted file mode 100644
index 9fd79139461..00000000000
--- a/solr/webapp/web/css/styles/query.css
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #query
-{
- background-image: url( ../../img/div.gif );
- background-position: 22% 0;
- background-repeat: repeat-y;
-}
-
-#content #query #form
-{
- float: left;
- width: 21%;
-}
-
-#content #query #form label
-{
- cursor: pointer;
- display: block;
- margin-top: 5px;
-}
-
-#content #query #form input,
-#content #query #form select,
-#content #query #form textarea
-{
- margin-bottom: 2px;
- width: 100%;
-}
-
-#content #query #form input,
-#content #query #form textarea
-{
- width: 98%;
-}
-
-#content #query #form .multiple input
-{
- float: left;
- width: 80%
-}
-
-#content #query #form .multiple .buttons
-{
- float: right;
- width: 16%;
-}
-
-
-#content #query #form .multiple a
-{
- background-position: 50% 50%;
- display: block;
- height: 25px;
- width: 49%;
-}
-
-#content #query #form .multiple a span
-{
- display: none;
-}
-
-#content #query #form .multiple a.add
-{
- background-image: url( ../../img/ico/plus-button.png );
- float: right;
-}
-
-#content #query #form .multiple a.rem
-{
- background-image: url( ../../img/ico/minus-button.png );
- float: left;
-}
-
-#content #query #form #start
-{
- float: left;
- width: 45%;
-}
-
-#content #query #form #rows
-{
- float: right;
- width: 45%;
-}
-
-#content #query #form .checkbox input
-{
- margin-bottom: 0;
- width: auto;
-}
-
-#content #query #form fieldset,
-#content #query #form .optional.expanded
-{
- border: 1px solid #fff;
- border-top: 1px solid #c0c0c0;
- margin-bottom: 5px;
-}
-
-#content #query #form fieldset.common
-{
- margin-top: 10px;
-}
-
-#content #query #form fieldset legend,
-#content #query #form .optional.expanded legend
-{
- display: block;
- margin-left: 10px;
- padding: 0px 5px;
-}
-
-#content #query #form fieldset legend label
-{
- margin-top: 0;
-}
-
-#content #query #form fieldset .fieldset
-{
- border-bottom: 1px solid #f0f0f0;
- margin-bottom: 5px;
- padding-bottom: 10px;
-}
-
-#content #query #form .optional
-{
- border: 0;
-}
-
-#content #query #form .optional .fieldset
-{
- display: none;
-}
-
-#content #query #form .optional legend
-{
- margin-left: 0;
- padding-left: 0;
-}
-
-#content #query #form .optional.expanded .fieldset
-{
- display: block;
-}
-
-#content #query #result
-{
- display: none;
- float: right;
- width: 77%;
-}
-
-#content #query #result #response
-{
-}
diff --git a/solr/webapp/web/css/styles/replication.css b/solr/webapp/web/css/styles/replication.css
deleted file mode 100644
index 7379504642c..00000000000
--- a/solr/webapp/web/css/styles/replication.css
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #replication
-{
- background-image: url( ../../img/div.gif );
- background-position: 21% 0;
- background-repeat: repeat-y;
-}
-
-#content #replication #frame
-{
- float: right;
- width: 78%;
-}
-
-#content #replication #navigation
-{
- border-right: 0;
- float: left;
- width: 20%;
-}
-
-#content #replication #error
-{
- background-color: #f00;
- background-image: url( ../../img/ico/construction.png );
- background-position: 10px 50%;
- color: #fff;
- display: none;
- font-weight: bold;
- margin-bottom: 20px;
- padding: 10px;
- padding-left: 35px;
-}
-
-#content #replication .block
-{
- border-bottom: 1px solid #c0c0c0;
- margin-bottom: 20px;
- padding-bottom: 20px;
-}
-
-#content #replication .block.last
-{
- border-bottom: 0;
-}
-
-#content #replication .masterOnly,
-#content #replication .slaveOnly
-{
- display: none;
-}
-
-#content #replication.master .masterOnly
-{
- display: block;
-}
-
-#content #replication.slave .slaveOnly
-{
- display: block;
-}
-
-#content #replication .replicating
-{
- display: none;
-}
-
-#content #replication.replicating .replicating
-{
- display: block;
-}
-
-#content #replication #progress
-{
- padding-bottom: 80px;
- position: relative;
-}
-
-#content #replication #progress .info
-{
- padding: 5px;
-}
-
-#content #replication #progress #start
-{
- margin-left: 100px;
- border-left: 1px solid #c0c0c0;
-}
-
-#content #replication #progress #bar
-{
- background-color: #f0f0f0;
- margin-left: 100px;
- margin-right: 100px;
- position: relative;
-}
-
-#content #replication #progress #bar #bar-info,
-#content #replication #progress #bar #eta
-{
- position: absolute;
- right: -100px;
- width: 100px;
-}
-
-#content #replication #progress #bar #bar-info
-{
- border-left: 1px solid #f0f0f0;
- margin-top: 30px;
-}
-
-#content #replication #progress #eta .info
-{
- color: #c0c0c0;
- height: 30px;
- line-height: 30px;
- padding-top: 0;
- padding-bottom: 0;
-}
-
-#content #replication #progress #speed
-{
- color: #c0c0c0;
- position: absolute;
- right: 100px;
- top: 0;
-}
-
-#content #replication #progress #bar #done
-{
- background-color: #c0c0c0;
- box-shadow: 5px 5px 10px #c0c0c0;
- -moz-box-shadow: 5px 5px 10px #c0c0c0;
- -webkit-box-shadow: 5px 5px 10px #c0c0c0;
- height: 30px;
- position: relative;
-}
-
-#content #replication #progress #bar #done .percent
-{
- font-weight: bold;
- height: 30px;
- line-height: 30px;
- padding-left: 5px;
- padding-right: 5px;
- position: absolute;
- right: 0;
- text-align: right;
-}
-
-#content #replication #progress #bar #done #done-info
-{
- border-right: 1px solid #c0c0c0;
- position: absolute;
- right: 0;
- margin-top: 30px;
- text-align: right;
- width: 100px;
-}
-
-#content #replication #progress #bar #done #done-info .percent
-{
- font-weight: bold;
-}
-
-#content #replication .block .label,
-#content #replication #current-file .file,
-#content #replication #current-file .progress,
-#content #replication #iterations .iterations
-{
- float: left;
-}
-
-#content #replication .block .label
-{
- width: 100px;
-}
-
-#content #replication .block .label span
-{
- display: block;
- padding-left: 21px;
-}
-
-#content #replication #current-file
-{
- border-top: 1px solid #f0f0f0;
- margin-top: 10px;
- padding-top: 10px;
-}
-
-#content #replication #current-file .progress
-{
- color: #c0c0c0;
- margin-left: 20px;
-}
-
-#content #replication #iterations .label span
-{
- background-image: url( ../../img/ico/node-design.png );
-}
-
-#content #replication #iterations .iterations li
-{
- background-position: 100% 50%;
- display: none;
- padding-right: 21px;
-}
-
-#content #replication #iterations .iterations.expanded li
-{
- display: block;
-}
-
-#content #replication #iterations .iterations .latest
-{
- display: block;
-}
-
-#content #replication #iterations .iterations .replicated
-{
- color: #80c480;
-}
-
-#content #replication #iterations .iterations ul:hover .replicated,
-#content #replication #iterations .iterations .replicated.latest
-{
- color: #080;
-}
-
-#content #replication #iterations .iterations .replicated.latest
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #replication #iterations .iterations .failed
-{
- color: #c48080;
-}
-
-#content #replication #iterations .iterations ul:hover .failed,
-#content #replication #iterations .iterations .failed.latest
-{
- color: #800;
-}
-
-#content #replication #iterations .iterations .failed.latest
-{
- background-image: url( ../../img/ico/cross.png );
-}
-
-#content #replication #iterations .iterations a
-{
- border-top: 1px solid #f0f0f0;
- display: none;
- margin-top: 2px;
- padding-top: 2px;
-}
-
-#content #replication #iterations .iterations a span
-{
- background-position: 0 50%;
- color: #c0c0c0;
- display: none;
- padding-left: 21px;
-}
-
-#content #replication #iterations .iterations a span.expand
-{
- background-image: url( ../../img/ico/chevron-small-expand.png );
- display: block;
-}
-
-#content #replication #iterations .iterations.expanded a span.expand
-{
- display: none;
-}
-
-#content #replication #iterations .iterations.expanded a span.collapse
-{
- background-image: url( ../../img/ico/chevron-small.png );
- display: block;
-}
-
-#content #replication #details table
-{
- margin-left: 20px;
- border-collapse: collapse;
-}
-
-#content #replication #details table th
-{
- text-align: left;
-}
-
-#content #replication.slave #details table .slaveOnly
-{
- display: table-row;
-}
-
-#content #replication #details table thead th
-{
- color: #c0c0c0;
-}
-
-#content #replication #details table thead th,
-#content #replication #details table tbody td
-{
- padding-right: 20px;
-}
-
-#content #replication #details table thead td,
-#content #replication #details table thead th,
-#content #replication #details table tbody th,
-#content #replication #details table tbody td div
-{
- padding-top: 3px;
- padding-bottom: 3px;
-}
-
-#content #replication #details table tbody td,
-#content #replication #details table tbody th
-{
- border-top: 1px solid #f0f0f0;
-}
-
-#content #replication #details table thead td
-{
- width: 100px;
-}
-
-#content #replication #details table thead td span
-{
- background-image: url( ../../img/ico/clipboard-list.png );
- background-position: 0 50%;
- display: block;
- padding-left: 21px;
-}
-
-#content #replication #details table tbody th
-{
- padding-right: 10px;
- text-align: right;
- white-space: nowrap;
-}
-
-#content #replication #details table tbody .size
-{
- text-align: right;
- white-space: nowrap;
-}
-
-#content #replication #details table tbody .generation div
-{
- text-align: center;
-}
-
-#content #replication #details table tbody .diff div
-{
- background-color: #fcfcc9;
- padding-left: 1px;
- padding-right: 1px;
-}
-
-#content #replication .settings .label span
-{
- background-image: url( ../../img/ico/hammer-screwdriver.png );
-}
-
-#content #replication .settings ul,
-#content #replication .settings dl dt,
-#content #replication .settings dl dd
-{
- float: left;
-}
-
-#content #replication .settings ul li
-{
- border-top: 1px solid #f0f0f0;
- display: none;
- padding-top: 3px;
- padding-top: 3px;
-}
-
-#content #replication .settings ul li:first-child
-{
- border-top: 0;
- padding-top: 0;
-}
-
-#content #replication .settings dl dt
-{
- clear: left;
- margin-right: 5px;
- width: 120px;
-}
-
-#content #replication .settings dl .ico
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #replication .settings dl .ico.ico-0
-{
- background-image: url( ../../img/ico/slash.png );
-}
-
-#content #replication .settings dl .ico.ico-1
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #replication .timer
-{
- box-shadow: 5px 5px 10px #c0c0c0;
- -moz-box-shadow: 5px 5px 10px #c0c0c0;
- -webkit-box-shadow: 5px 5px 10px #c0c0c0;
- display: none;
- margin-bottom: 20px;
- padding: 10px;
-}
-
-#content #replication .timer p,
-#content #replication .timer small
-{
- padding-left: 21px;
-}
-
-#content #replication .timer p
-{
- background-image: url( ../../img/ico/clock-select-remain.png );
- background-position: 0 50%;
-}
-
-#content #replication .timer p .approx
-{
- color: #c0c0c0;
- margin-right: 1px;
-}
-
-#content #replication .timer p .tick
-{
- font-weight: bold;
-}
-
-#content #replication .timer small
-{
- color: #c0c0c0;
- display: none;
-}
-
-#content #replication #navigation button
-{
- display: block;
- margin-bottom: 10px;
-}
-
-#content #replication #navigation button.optional
-{
- display: none;
-}
-
-#content #replication #navigation .replicate-now span
-{
- background-image: url( ../../img/ico/document-convert.png );
-}
-
-#content #replication #navigation .abort-replication span
-{
- background-image: url( ../../img/ico/hand.png );
-}
-
-#content #replication #navigation .disable-polling span
-{
- background-image: url( ../../img/ico/cross.png );
-}
-
-#content #replication #navigation .enable-polling span
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #replication #navigation .disable-replication span
-{
- background-image: url( ../../img/ico/cross.png );
-}
-
-#content #replication #navigation .enable-replication span
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #replication #navigation .refresh-status span
-{
- background-image: url( ../../img/ico/arrow-circle.png );
-}
diff --git a/solr/webapp/web/css/styles/schema-browser.css b/solr/webapp/web/css/styles/schema-browser.css
deleted file mode 100644
index e43de40120a..00000000000
--- a/solr/webapp/web/css/styles/schema-browser.css
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #schema-browser .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #schema-browser.loaded
-{
- background-image: url( ../../img/div.gif );
- background-position: 21% 0;
- background-repeat: repeat-y;
-}
-
-#content #schema-browser #data
-{
- float: right;
- width: 78%;
-}
-
-#content #schema-browser #related
-{
- float: left;
- width: 20%;
-}
-
-#content #schema-browser #related select
-{
- width: 100%;
-}
-
-#content #schema-browser #related select optgroup
-{
- font-style: normal;
- padding: 5px;
-}
-
-#content #schema-browser #related select option
-{
- padding-left: 10px;
-}
-
-#content #schema-browser #related #f-df-t
-{
- border-bottom: 1px solid #f0f0f0;
- padding-bottom: 15px;
-}
-
-#content #schema-browser #related .ukf-dsf dt
-{
- display: none;
-}
-
-#content #schema-browser #related dl
-{
- margin-top: 15px;
-}
-
-#content #schema-browser #related dl dt,
-#content #schema-browser #related dl dd a
-{
- color: #c0c0c0;
-}
-
-#content #schema-browser #related dl dt
-{
- font-weight: bold;
- margin-top: 5px;
-}
-
-#content #schema-browser #related dl dd a
-{
- display: block;
- padding-left: 10px;
-}
-
-#content #schema-browser #related dl dd a:hover
-{
- background-color: #f8f8f8;
-}
-
-#content #schema-browser #related .field .field,
-#content #schema-browser #related .field .field a,
-#content #schema-browser #related .dynamic-field .dynamic-field,
-#content #schema-browser #related .dynamic-field .dynamic-field a,
-#content #schema-browser #related .type .type,
-#content #schema-browser #related .type .type a,
-#content #schema-browser #related .active,
-#content #schema-browser #related .active a
-{
- color: #333;
-}
-
-#content #schema-browser #related .copyfield,
-#content #schema-browser #related .copyfield a
-{
- color: #666;
-}
-
-#content #schema-browser #data
-{
- display: none;
-}
-
-#content #schema-browser #data #index dt
-{
- display: none;
- float: left;
- margin-right: 5px;
- width: 150px;
-}
-
-#content #schema-browser #data #field .field-options
-{
- margin-bottom: 10px;
-}
-
-#content #schema-browser #data #field .field-options .head h2
-{
- padding-left: 5px;
-}
-
-#content #schema-browser #data #field .partial
-{
- display: none;
-}
-
-#content #schema-browser #data #field .partial p
-{
- background-image: url( ../../img/ico/exclamation-button.png );
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #schema-browser #data #field .field-options .options dt,
-#content #schema-browser #data #field .field-options .options dd
-{
- float: left;
-}
-
-#content #schema-browser #data #field .field-options .options dt
-{
- clear: left;
- display: none;
- margin-right: 5px;
- width: 100px;
-}
-
-#content #schema-browser #data #field .field-options .flags
-{
- margin-top: 10px;
- margin-bottom: 20px;
-}
-
-#content #schema-browser #data #field .field-options .flags thead td
-{
- color: #c0c0c0;
- padding-right: 5px;
- width: 100px;
-}
-
-#content #schema-browser #data #field .field-options .flags tbody td,
-#content #schema-browser #data #field .field-options .flags th
-{
- padding: 2px 5px;
-}
-
-#content #schema-browser #data #field .field-options .flags thead td,
-#content #schema-browser #data #field .field-options .flags tbody th
-{
- padding-left: 0;
-}
-
-#content #schema-browser #data #field .field-options .flags thead th,
-#content #schema-browser #data #field .field-options .flags tbody td
-{
- border-left: 1px solid #f0f0f0;
-}
-
-#content #schema-browser #data #field .field-options .flags tbody th,
-#content #schema-browser #data #field .field-options .flags tbody td
-{
- border-top: 1px solid #f0f0f0;
-}
-
-#content #schema-browser #data #field .field-options .flags tbody .check
-{
- background-color: #fafdfa;
- background-image: url( ../../img/ico/tick.png );
- background-position: 50% 50%;
- text-align: center;
-}
-
-#content #schema-browser #data #field .field-options .flags tbody .check span
-{
- display: none;
-}
-
-#content #schema-browser #data #field .field-options .flags tbody .text
-{
- color: #c0c0c0;
-}
-
-#content #schema-browser #data #field .field-options .analyzer,
-#content #schema-browser #data #field .field-options .analyzer li,
-#content #schema-browser #data #field .field-options .analyzer ul,
-#content #schema-browser #data #field .field-options .analyzer ul li
-{
- display: none;
-}
-
-#content #schema-browser #data #field .field-options .analyzer p,
-#content #schema-browser #data #field .field-options .analyzer dl
-{
- float: left;
-}
-
-#content #schema-browser #data #field .field-options .analyzer p
-{
- margin-right: 5px;
- text-align: right;
- width: 125px;
- white-space: pre;
-}
-
-#content #schema-browser #data #field .field-options .analyzer p a
-{
- cursor: auto;
-}
-
-#content #schema-browser #data #field .field-options .analyzer p a.analysis
-{
- cursor: pointer;
- display: block;
-}
-
-#content #schema-browser #data #field .field-options .analyzer p a.analysis span
-{
- background-image: url( ../../img/ico/question-white.png );
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer p a.analysis:hover span
-{
- background-image: url( ../../img/ico/question.png );
- color: #008;
-}
-
-#content #schema-browser #data #field .field-options .analyzer a
-{
- cursor: auto;
-}
-
-#content #schema-browser #data #field .field-options .analyzer .toggle
-{
- background-image: url( ../../img/ico/chevron-small-expand.png );
- background-position: 100% 50%;
- cursor: pointer;
- display: block;
- padding-right: 21px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer .open .toggle
-{
- background-image: url( ../../img/ico/chevron-small.png );
-}
-
-#content #schema-browser #data #field .field-options .analyzer li
-{
- border-top: 1px solid #f0f0f0;
- margin-top: 10px;
- padding-top: 10px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul
-{
- clear: left;
- display: none;
- margin-left: 55px;
- padding-top: 5px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer .open ul
-{
- display: block;
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul li
-{
- border-top: 1px solid #f8f8f8;
- margin-top: 5px;
- padding-top: 5px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul p
-{
- color: #999;
- margin-right: 5px;
- text-align: right;
- width: 70px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul dd
-{
- margin-left: 20px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul dd
-{
- background-image: url( ../../img/ico/document-list.png );
- background-position: 0 50%;
- color: #c0c0c0;
- padding-left: 21px;
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul dd.ico-0
-{
- background-image: url( ../../img/ico/slash.png );
-}
-
-#content #schema-browser #data #field .field-options .analyzer ul dd.ico-1
-{
- background-image: url( ../../img/ico/tick.png );
-}
-
-#content #schema-browser #data #field .head
-{
- margin-bottom: 5px;
-}
-
-#content #schema-browser #data #field .terminfo-holder
-{
- border-top: 1px solid #c0c0c0;
- padding-top: 10px;
-}
-
-#content #schema-browser #data #field .terminfo-holder .trigger
-{
- float: left;
- width: 140px;
-}
-
-#content #schema-browser #data #field .terminfo-holder .trigger button span
-{
- background-image: url( ../../img/ico/information.png );
-}
-
-#content #schema-browser #data #field .terminfo-holder .status
-{
- border-left: 1px solid #f0f0f0;
- display: none;
- float: left;
- padding-left: 20px;
- padding-right: 20px;
-}
-
-#content #schema-browser #data #field .terminfo-holder.disabled .trigger button span
-{
- background-image: url( ../../img/ico/prohibition.png );
-}
-
-#content #schema-browser #data #field .terminfo-holder.disabled .status
-{
- display: block;
-}
-
-#content #schema-browser #data #field .terminfo-holder .trigger .autoload
-{
- display: none;
-}
-
-#content #schema-browser #data #field .terminfo-holder.loaded .trigger .autoload
-{
- background-image: url( ../../img/ico/ui-check-box-uncheck.png );
- background-position: 0 50%;
- color: #c0c0c0;
- display: block;
- margin-top: 10px;
- padding-left: 21px;
-}
-
-#content #schema-browser #data #field .terminfo-holder .trigger .autoload:hover
-{
- color: #008;
-}
-
-#content #schema-browser #data #field .terminfo-holder .trigger .autoload.on
-{
- background-image: url( ../../img/ico/ui-check-box.png );
- color: #333;
-}
-
-#content #schema-browser #data #field .topterms-holder,
-#content #schema-browser #data #field .histogram-holder
-{
- border-left: 1px solid #f0f0f0;
- display: none;
- float: left;
- padding-left: 20px;
- padding-right: 20px;
-}
-
-#content #schema-browser #data #field .topterms-holder .head input
-{
- height: 18px;
- line-height: 16px;
- text-align: right;
- width: 30px;
-}
-
-#content #schema-browser #data #field .topterms-holder .head .max-holder
-{
- color: #c0c0c0;
-}
-
-#content #schema-browser #data #field .topterms-holder .head .max-holder:hover .max
-{
- color: #008;
-}
-
-#content #schema-browser #data #field .topterms-holder .head #query_link
-{
- background-image: url( ../../img/ico/question-white.png );
- background-position: 0 50%;
- color: #c0c0c0;
- padding-left: 21px;
- margin-left: 5px;
-}
-
-#content #schema-browser #data #field .topterms-holder .head #query_link:hover
-{
- background-image: url( ../../img/ico/question.png );
-}
-
-
-#content #schema-browser #data #field .topterms-holder .head #query_link span
-{
- visibility: hidden;
-}
-
-#content #schema-browser #data #field .topterms-holder .head #query_link:hover span
-{
- visibility: visible;
-}
-
-#content #schema-browser .topterms-holder li
-{
- border-top: 1px solid #999;
- margin-bottom: 5px;
-}
-
-/* possible overwrite with inline style */
-#content #schema-browser .topterms-holder li p
-{
- background-color: #999;
- color: #fff;
- float: left;
-}
-
-#content #schema-browser .topterms-holder li p span
-{
- display: block;
- padding-right: 2px;
- text-align: right;
-}
-
-/* possible overwrite with inline style */
-#content #schema-browser .topterms-holder li ul
-{
- margin-left: 30px;
-}
-
-#content #schema-browser .topterms-holder li li
-{
- border-top: 0;
- margin-bottom: 0;
- white-space: nowrap;
-}
-
-#content #schema-browser .topterms-holder li li.odd
-{
- background-color: #f0f0f0;
-}
-
-#content #schema-browser .topterms-holder li li a
-{
- display: block;
- padding-left: 2px;
- padding-right: 2px;
-}
-
-#content #schema-browser .topterms-holder li li a:hover
-{
- background-color: #c0c0c0;
-}
-
-#content #schema-browser #data #field .histogram-holder ul
-{
- margin-left: 25px;
-}
-
-#content #schema-browser #data #field .histogram-holder li
-{
- margin-bottom: 2px;
- position: relative;
- width: 150px;
-}
-
-#content #schema-browser #data #field .histogram-holder li.odd
-{
- background-color: #f0f0f0;
-}
-
-#content #schema-browser #data #field .histogram-holder li dl,
-#content #schema-browser #data #field .histogram-holder li dt
-{
- padding-top: 1px;
- padding-bottom: 1px;
-}
-
-#content #schema-browser #data #field .histogram-holder li dl
-{
- background-color: #c0c0c0;
- min-width: 1px;
-}
-
-#content #schema-browser #data #field .histogram-holder li dt
-{
- color: #a0a0a0;
- position: absolute;
- overflow: hidden;
- left: -25px;
- top: 0px;
-}
-
-#content #schema-browser #data #field .histogram-holder li dt span
-{
- display: block;
- padding-right: 4px;
- text-align: right;
-}
-
-#content #schema-browser #data #field .histogram-holder li dd
-{
- clear: left;
- float: left;
- margin-left: 2px;
- white-space: nowrap;
-}
-
-#content #schema-browser #data #field .histogram-holder li:hover dl
-{
- background-color: #b0b0b0;
-}
-
-#content #schema-browser #data #field .histogram-holder li:hover dt
-{
- color: #333;
-}
diff --git a/solr/webapp/web/css/styles/segments.css b/solr/webapp/web/css/styles/segments.css
deleted file mode 100644
index 820f882e5ba..00000000000
--- a/solr/webapp/web/css/styles/segments.css
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #segments .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #segments .reload
-{
- background-image: url( ../../img/ico/arrow-circle.png );
- background-position: 50% 50%;
- display: block;
- height: 30px;
- position: absolute;
- right: 10px;
- top: 10px;
- width: 30px;
-}
-
-#content #segments .reload.loader
-{
- padding-left: 0;
-}
-
-#content #segments .reload span
-{
- display: none;
-}
-
-#content #segments #result
-{
- width: 77%;
-}
-
-#content #segments #result #response
-{
- margin-left: 25px;
-}
-
-#content #segments .segments-holder ul {
- margin-left: 25px;
-}
-#content #segments .segments-holder li {
- margin-bottom: 2px;
- position: relative;
- width: 100%;
-}
-
-#content #segments .segments-holder li .toolitp {
- display: none;
- background: #C8C8C8;
- position: absolute;
- z-index: 1000;
- width:220px;
- height:120px;
- margin-left: 100%;
- opacity: .8;
- padding: 5px;
- border: 1px solid;
- border-radius: 5px;
-}
-
-#content #segments .segments-holder li .toolitp .label {
- float: left;
- width: 20%;
- opacity: 1;
-}
-
-#content #segments .segments-holder li:hover .toolitp {
- display:block;
-}
-
-#content #segments .segments-holder li dl,
-#content #segments .segments-holder li dt {
- padding-bottom: 1px;
- padding-top: 1px;
-}
-#content #segments .segments-holder li dl {
- min-width: 1px;
-}
-#content #segments .segments-holder li dt {
- color: #a0a0a0;
- left: -45px;
- overflow: hidden;
- position: absolute;
- top: 0;
-}
-#content #segments .segments-holder li dt div {
- display: block;
- padding-right: 4px;
- text-align: right;
-}
-#content #segments .segments-holder li dd {
- clear: left;
- float: left;
- margin-left: 2px;
- white-space: nowrap;
- width: 100%;
-}
-
-#content #segments .segments-holder li dd div.deleted {
- background-color: #808080;
- padding-left: 5px;
-}
-
-#content #segments .segments-holder li dd div.live {
- background-color: #DDDDDD;
- float: left;
-}
-
-#content #segments .segments-holder li dd div.start {
- float: left;
- width: 20%;
-}
-
-#content #segments .segments-holder li dd div.end {
- text-align: right;
-}
-
-.merge-candidate {
- background-color: #FFC9F9 !important;
-}
-
-#content #segments .segments-holder li dd div.w5 {
- width: 20%;
- float: left;
-}
\ No newline at end of file
diff --git a/solr/webapp/web/css/styles/threads.css b/solr/webapp/web/css/styles/threads.css
deleted file mode 100644
index c3cb698bee1..00000000000
--- a/solr/webapp/web/css/styles/threads.css
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-*/
-
-#content #threads .loader
-{
- background-position: 0 50%;
- padding-left: 21px;
-}
-
-#content #threads #thread-dump table
-{
- border-collapse: collapse;
- width: 100%;
-}
-
-#content #threads #thread-dump table .spacer,
-#content #threads #thread-dump tbody .state
-{
- background-color: #fff;
-}
-
-#content #threads #thread-dump table th,
-#content #threads #thread-dump table td
-{
- padding: 5px 3px;
- vertical-align: top;
-}
-
-#content #threads #thread-dump thead th
-{
- background-color: #c8c8c8;
- font-weight: bold;
- text-align: left;
-}
-
-#content #threads #thread-dump thead th.name
-{
- width: 85%;
-}
-
-#content #threads #thread-dump thead th.time
-{
- text-align: right;
- width: 15%;
-}
-
-#content #threads #thread-dump tbody .odd
-{
- background-color: #f0f0f0;
-}
-
-#content #threads #thread-dump tbody .RUNNABLE a
-{
- background-image: url( ../../img/ico/tick-circle.png );
-}
-
-#content #threads #thread-dump tbody .WAITING a,
-#content #threads #thread-dump tbody .TIMED_WAITING a
-{
- background-image: url( ../../img/ico/hourglass.png );
-}
-
-#content #threads #thread-dump tbody .WAITING.lock a,
-#content #threads #thread-dump tbody .TIMED_WAITING.lock a
-{
- background-image: url( ../../img/ico/hourglass--exclamation.png );
-}
-
-#content #threads #thread-dump tbody .name a
-{
- background-position: 0 50%;
- cursor: auto;
- display: block;
- padding-left: 21px;
-}
-
-#content #threads #thread-dump tbody .stacktrace .name a
-{
- cursor: pointer;
-}
-
-#content #threads #thread-dump tbody .stacktrace .name a span
-{
- background-image: url( ../../img/ico/chevron-small-expand.png );
- background-position: 100% 50%;
- padding-right: 21px;
-}
-
-#content #threads #thread-dump tbody .stacktrace.open .name a span
-{
- background-image: url( ../../img/ico/chevron-small.png );
-}
-
-#content #threads #thread-dump tbody .name p
-{
- background-image: url( ../../img/ico/arrow-000-small.png );
- background-position: 0 50%;
- color: #c0c0c0;
- font-size: 11px;
- margin-left: 21px;
- padding-left: 21px;
-}
-
-#content #threads #thread-dump tbody .name div
-{
- border-top: 1px solid #c0c0c0;
- display: none;
- margin-left: 21px;
- margin-top: 5px;
- padding-top: 5px;
-}
-
-#content #threads #thread-dump tbody .open .name div
-{
- display: block;
-}
-
-#content #threads #thread-dump tbody .name ul
-{
- list-style-type: disc;
- margin-left: 0.7em;
- padding-left: 0.7em;
-}
-
-#content #threads #thread-dump tbody .time
-{
- text-align: right;
-}
-
-#content #threads #thread-dump tbody .details
-{
- display: none;
-}
-
-#content #threads .controls
-{
- padding-top: 5px;
- padding-bottom: 5px;
-}
-
-#content #threads .controls a
-{
- background-image: url( ../../img/ico/chevron-small-expand.png );
- padding-left: 21px;
-}
-
-#content #threads.expanded .controls a
-{
- background-image: url( ../../img/ico/chevron-small.png );
-}
-
-#content #threads.expanded .controls .expand,
-#content #threads.collapsed .controls .collapse
-{
- display: none;
-}
diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.html
index 2e01906756d..923d1f1d504 100644
--- a/solr/webapp/web/index.html
+++ b/solr/webapp/web/index.html
@@ -32,7 +32,7 @@ limitations under the License.
<link rel="stylesheet" type="text/css" href="css/angular/dataimport.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/files.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/index.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/java-properties.css?_=${version}">
+ <link rel="stylesheet" type="text/css" href="css/angular/java-properties.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/logging.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/menu.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/plugins.css?_=${version}">
@@ -123,10 +123,6 @@ limitations under the License.
<div class="exception">{{exception.msg}}</div>
</div>
- <div class="other-ui-link">
- Use <a class="ul" href="/solr/old.html">original UI</a><a target="_blank" href="http://wiki.apache.org/solr/AngularUI">&nbsp;<span class="help"></span></a>
- </div>
-
<div id="content-wrapper">
<div ng-view id="content">
@@ -151,7 +147,7 @@ limitations under the License.
<li class="tree" ng-class="{active:page=='cloud-tree'}"><a href="#/~cloud?view=tree">Tree</a></li>
<li class="graph" ng-class="{active:page=='cloud-graph'}"><a href="#/~cloud">Graph</a></li>
<li class="rgraph" ng-class="{active:page=='cloud-rgraph'}"><a href="#/~cloud?view=rgraph">Graph (Radial)</a></li>
- <li class="dump" ng-class="{active:page=='cloud-dump'}"><a ng-click="dumpCloud()">Dump</a></li>
+ <!--<li class="dump" ng-class="{active:page=='cloud-dump'}"><a ng-click="dumpCloud()">Dump</a></li>-->
</ul>
</li>
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index e86b55feee0..c4ebef504b8 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -465,88 +465,6 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $
});
-(function(window, angular, undefined) {
- 'use strict';
-
- angular.module('ngClipboard', []).
- provider('ngClip', function() {
- var self = this;
- this.path = '//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.1.6/ZeroClipboard.swf';
- return {
- setPath: function(newPath) {
- self.path = newPath;
- },
- setConfig: function(config) {
- self.config = config;
- },
- $get: function() {
- return {
- path: self.path,
- config: self.config
- };
- }
- };
- }).
- run(['ngClip', function(ngClip) {
- var config = {
- swfPath: ngClip.path,
- trustedDomains: ["*"],
- allowScriptAccess: "always",
- forceHandCursor: true,
- };
- ZeroClipboard.config(angular.extend(config,ngClip.config || {}));
- }]).
- directive('clipCopy', ['ngClip', function (ngClip) {
- return {
- scope: {
- clipCopy: '&',
- clipClick: '&',
- clipClickFallback: '&'
- },
- restrict: 'A',
- link: function (scope, element, attrs) {
- // Bind a fallback function if flash is unavailable
- if (ZeroClipboard.isFlashUnusable()) {
- element.bind('click', function($event) {
- // Execute the expression with local variables `$event` and `copy`
- scope.$apply(scope.clipClickFallback({
- $event: $event,
- copy: scope.$eval(scope.clipCopy)
- }));
- });
-
- return;
- }
-
- // Create the client object
- var client = new ZeroClipboard(element);
- if (attrs.clipCopy === "") {
- scope.clipCopy = function(scope) {
- return element[0].previousElementSibling.innerText;
- };
- }
- client.on( 'ready', function(readyEvent) {
-
- client.on('copy', function (event) {
- var clipboard = event.clipboardData;
- clipboard.setData(attrs.clipCopyMimeType || 'text/plain', scope.$eval(scope.clipCopy));
- });
-
- client.on( 'aftercopy', function(event) {
- if (angular.isDefined(attrs.clipClick)) {
- scope.$apply(scope.clipClick);
- }
- });
-
- scope.$on('$destroy', function() {
- client.destroy();
- });
- });
- }
- };
- }]);
-})(window, window.angular);
-
/* THE BELOW CODE IS TAKEN FROM js/scripts/app.js, AND STILL REQUIRES INTEGRATING
diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.js
index aeaf5d3d89a..3636d8059b2 100644
--- a/solr/webapp/web/js/angular/controllers/cloud.js
+++ b/solr/webapp/web/js/angular/controllers/cloud.js
@@ -458,101 +458,3 @@ solrAdminApp.directive('graph', function(Constants) {
}
};
})
-
-/*
-
-========================
-var init_debug = function( cloud_element )
-{
- var debug_element = $( '#debug', cloud_element );
- var debug_button = $( '#menu #cloud .dump a' );
-
- var clipboard_element = $( '.clipboard', debug_element );
- var clipboard_button = $( 'a', clipboard_element );
-
- $( '.clipboard', debug_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- return false;
- }
- );
-
- url : app.config.solr_path + '/zookeeper?wt=json&dump=true',
- ZeroClipboard.setMoviePath( 'img/ZeroClipboard.swf' );
-
- clipboard_client = new ZeroClipboard.Client();
-
- clipboard_client.addEventListener
- (
- 'load',
- function( client )
- {
- }
- );
-
- clipboard_client.addEventListener
- (
- 'complete',
- function( client, text )
- {
- clipboard_element
- .addClass( 'copied' );
-
- clipboard_button
- .data( 'text', clipboard_button.text() )
- .text( clipboard_button.data( 'copied' ) );
- }
- );
- },
- success : function( response, text_status, xhr )
- {
- clipboard_client.glue
- (
- clipboard_element.get(0),
- clipboard_button.get(0)
- );
-
- clipboard_client.setText( response.replace( /\\/g, '\\\\' ) );
-
- $( '.debug', debug_element )
- .removeClass( 'loader' )
- .text( response );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
- )
- .die( 'hide' )
- .live
- (
- 'hide',
- function( event )
- {
- $( '.debug', debug_element )
- .empty();
-
- clipboard_element
- .removeClass( 'copied' );
-
- clipboard_button
- .data( 'copied', clipboard_button.text() )
- .text( clipboard_button.data( 'text' ) );
-
- clipboard_client.destroy();
-
- debug_element.hide();
- }
- );
-};
-
-*/
diff --git a/solr/webapp/web/js/lib/ZeroClipboard.js b/solr/webapp/web/js/lib/ZeroClipboard.js
deleted file mode 100644
index a521be8adcd..00000000000
--- a/solr/webapp/web/js/lib/ZeroClipboard.js
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
-
-The MIT License (MIT)
-Copyright (c) 2012 Jon Rohan, James M. Greene,
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-// Simple Set Clipboard System
-// Author: Joseph Huckaby
-
-var ZeroClipboard = {
-
- version: "1.0.7",
- clients: {}, // registered upload clients on page, indexed by id
- moviePath: 'ZeroClipboard.swf', // URL to movie
- nextId: 1, // ID of next movie
-
- $: function(thingy) {
- // simple DOM lookup utility function
- if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
- if (!thingy.addClass) {
- // extend element with a few useful methods
- thingy.hide = function() { this.style.display = 'none'; };
- thingy.show = function() { this.style.display = ''; };
- thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
- thingy.removeClass = function(name) {
- var classes = this.className.split(/\s+/);
- var idx = -1;
- for (var k = 0; k < classes.length; k++) {
- if (classes[k] == name) { idx = k; k = classes.length; }
- }
- if (idx > -1) {
- classes.splice( idx, 1 );
- this.className = classes.join(' ');
- }
- return this;
- };
- thingy.hasClass = function(name) {
- return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
- };
- }
- return thingy;
- },
-
- setMoviePath: function(path) {
- // set path to ZeroClipboard.swf
- this.moviePath = path;
- },
-
- dispatch: function(id, eventName, args) {
- // receive event from flash movie, send to client
- var client = this.clients[id];
- if (client) {
- client.receiveEvent(eventName, args);
- }
- },
-
- register: function(id, client) {
- // register new client to receive events
- this.clients[id] = client;
- },
-
- getDOMObjectPosition: function(obj, stopObj) {
- // get absolute coordinates for dom element
- var info = {
- left: 0,
- top: 0,
- width: obj.width ? obj.width : obj.offsetWidth,
- height: obj.height ? obj.height : obj.offsetHeight
- };
-
- while (obj && (obj != stopObj)) {
- info.left += obj.offsetLeft;
- info.top += obj.offsetTop;
- obj = obj.offsetParent;
- }
-
- return info;
- },
-
- Client: function(elem) {
- // constructor for new simple upload client
- this.handlers = {};
-
- // unique ID
- this.id = ZeroClipboard.nextId++;
- this.movieId = 'ZeroClipboardMovie_' + this.id;
-
- // register client with singleton to receive flash events
- ZeroClipboard.register(this.id, this);
-
- // create movie
- if (elem) this.glue(elem);
- }
-};
-
-ZeroClipboard.Client.prototype = {
-
- id: 0, // unique ID for us
- ready: false, // whether movie is ready to receive events or not
- movie: null, // reference to movie object
- clipText: '', // text to copy to clipboard
- handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
- cssEffects: true, // enable CSS mouse effects on dom container
- handlers: null, // user event handlers
-
- glue: function(elem, appendElem, stylesToAdd) {
- // glue to DOM element
- // elem can be ID or actual DOM element object
- this.domElement = ZeroClipboard.$(elem);
-
- // float just above object, or zIndex 99 if dom element isn't set
- var zIndex = 99;
- if (this.domElement.style.zIndex) {
- zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
- }
-
- if (typeof(appendElem) == 'string') {
- appendElem = ZeroClipboard.$(appendElem);
- }
- else if (typeof(appendElem) == 'undefined') {
- appendElem = document.getElementsByTagName('body')[0];
- }
-
- // find X/Y position of domElement
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
-
- // create floating DIV above element
- this.div = document.createElement('div');
- var style = this.div.style;
- style.position = 'absolute';
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- style.width = '' + box.width + 'px';
- style.height = '' + box.height + 'px';
- style.zIndex = zIndex;
-
- style.left = '0px';
- style.top = '0px';
-
- if (typeof(stylesToAdd) == 'object') {
- for (addedStyle in stylesToAdd) {
- style[addedStyle] = stylesToAdd[addedStyle];
- }
- }
-
- // style.backgroundColor = '#f00'; // debug
-
- appendElem.appendChild(this.div);
-
- this.div.innerHTML = this.getHTML( box.width, box.height );
- },
-
- getHTML: function(width, height) {
- // return HTML for movie
- var html = '';
- var flashvars = 'id=' + this.id +
- '&width=' + width +
- '&height=' + height;
-
- if (navigator.userAgent.match(/MSIE/)) {
- // IE gets an OBJECT tag
- var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
- html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
- }
- else {
- // all other browsers get an EMBED tag
- html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
- }
- return html;
- },
-
- hide: function() {
- // temporarily hide floater offscreen
- if (this.div) {
- this.div.style.left = '-2000px';
- }
- },
-
- show: function() {
- // show ourselves after a call to hide()
- this.reposition();
- },
-
- destroy: function() {
- // destroy control and floater
- if (this.domElement && this.div) {
- this.hide();
- this.div.innerHTML = '';
-
- var body = document.getElementsByTagName('body')[0];
- try { body.removeChild( this.div ); } catch(e) {;}
-
- this.domElement = null;
- this.div = null;
- }
- },
-
- reposition: function(elem) {
- // reposition our floating div, optionally to new container
- // warning: container CANNOT change size, only position
- if (elem) {
- this.domElement = ZeroClipboard.$(elem);
- if (!this.domElement) this.hide();
- }
-
- console.debug( this.domElement, this.div );
-
- if (this.domElement && this.div) {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
- console.debug( box );
- var style = this.div.style;
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- }
- },
-
- setText: function(newText) {
- // set text to be copied to clipboard
- this.clipText = newText;
- if (this.ready) this.movie.setText(newText);
- },
-
- addEventListener: function(eventName, func) {
- // add user event listener for event
- // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
- if (!this.handlers[eventName]) this.handlers[eventName] = [];
- this.handlers[eventName].push(func);
- },
-
- setHandCursor: function(enabled) {
- // enable hand cursor (true), or default arrow cursor (false)
- this.handCursorEnabled = enabled;
- if (this.ready) this.movie.setHandCursor(enabled);
- },
-
- setCSSEffects: function(enabled) {
- // enable or disable CSS effects on DOM container
- this.cssEffects = !!enabled;
- },
-
- receiveEvent: function(eventName, args) {
- // receive event from flash
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
-
- // special behavior for certain events
- switch (eventName) {
- case 'load':
- // movie claims it is ready, but in IE this isn't always the case...
- // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
- this.movie = document.getElementById(this.movieId);
- if (!this.movie) {
- var self = this;
- setTimeout( function() { self.receiveEvent('load', null); }, 1 );
- return;
- }
-
- // firefox on pc needs a "kick" in order to set these in certain cases
- if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
- var self = this;
- setTimeout( function() { self.receiveEvent('load', null); }, 100 );
- this.ready = true;
- return;
- }
-
- this.ready = true;
- this.movie.setText( this.clipText );
- this.movie.setHandCursor( this.handCursorEnabled );
- break;
-
- case 'mouseover':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('hover');
- if (this.recoverActive) this.domElement.addClass('active');
- }
- break;
-
- case 'mouseout':
- if (this.domElement && this.cssEffects) {
- this.recoverActive = false;
- if (this.domElement.hasClass('active')) {
- this.domElement.removeClass('active');
- this.recoverActive = true;
- }
- this.domElement.removeClass('hover');
- }
- break;
-
- case 'mousedown':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('active');
- }
- break;
-
- case 'mouseup':
- if (this.domElement && this.cssEffects) {
- this.domElement.removeClass('active');
- this.recoverActive = false;
- }
- break;
- } // switch eventName
-
- if (this.handlers[eventName]) {
- for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
- var func = this.handlers[eventName][idx];
-
- if (typeof(func) == 'function') {
- // actual function reference
- func(this, args);
- }
- else if ((typeof(func) == 'object') && (func.length == 2)) {
- // PHP style object + method, i.e. [myObject, 'myMethod']
- func[0][ func[1] ](this, args);
- }
- else if (typeof(func) == 'string') {
- // name of function
- window[func](this, args);
- }
- } // foreach event handler defined
- } // user defined handler for event
- }
-
-};
diff --git a/solr/webapp/web/js/lib/chosen.js b/solr/webapp/web/js/lib/chosen.js
deleted file mode 100644
index bf250a24c70..00000000000
--- a/solr/webapp/web/js/lib/chosen.js
+++ /dev/null
@@ -1,982 +0,0 @@
-/*
-
-Chosen
-
-- by Patrick Filler for Harvest http://getharvest.com
-- Copyright (c) 2011-2013 by Harvest
-
-Available for use under the MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-// Chosen, a Select Box Enhancer for jQuery and Protoype
-// by Patrick Filler for Harvest, http://getharvest.com
-//
-// Version 0.9.8
-// Full source at https://github.com/harvesthq/chosen
-// Copyright (c) 2011 Harvest http://getharvest.com
-
-// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
-// This file is generated by `cake build`, do not edit it by hand.
-(function() {
- var SelectParser;
-
- SelectParser = (function() {
-
- function SelectParser() {
- this.options_index = 0;
- this.parsed = [];
- }
-
- SelectParser.prototype.add_node = function(child) {
- if (child.nodeName === "OPTGROUP") {
- return this.add_group(child);
- } else {
- return this.add_option(child);
- }
- };
-
- SelectParser.prototype.add_group = function(group) {
- var group_position, option, _i, _len, _ref, _results;
- group_position = this.parsed.length;
- this.parsed.push({
- array_index: group_position,
- group: true,
- label: group.label,
- children: 0,
- disabled: group.disabled
- });
- _ref = group.childNodes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- option = _ref[_i];
- _results.push(this.add_option(option, group_position, group.disabled));
- }
- return _results;
- };
-
- SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
- if (option.nodeName === "OPTION") {
- if (option.text !== "") {
- if (group_position != null) this.parsed[group_position].children += 1;
- this.parsed.push({
- array_index: this.parsed.length,
- options_index: this.options_index,
- value: option.value,
- text: option.text,
- html: option.innerHTML,
- selected: option.selected,
- disabled: group_disabled === true ? group_disabled : option.disabled,
- group_array_index: group_position,
- classes: option.className,
- style: option.style.cssText
- });
- } else {
- this.parsed.push({
- array_index: this.parsed.length,
- options_index: this.options_index,
- empty: true
- });
- }
- return this.options_index += 1;
- }
- };
-
- return SelectParser;
-
- })();
-
- SelectParser.select_to_array = function(select) {
- var child, parser, _i, _len, _ref;
- parser = new SelectParser();
- _ref = select.childNodes;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- child = _ref[_i];
- parser.add_node(child);
- }
- return parser.parsed;
- };
-
- this.SelectParser = SelectParser;
-
-}).call(this);
-
-/*
-Chosen source: generate output using 'cake build'
-Copyright (c) 2011 by Harvest
-*/
-
-(function() {
- var AbstractChosen, root;
-
- root = this;
-
- AbstractChosen = (function() {
-
- function AbstractChosen(form_field, options) {
- this.form_field = form_field;
- this.options = options != null ? options : {};
- this.set_default_values();
- this.is_multiple = this.form_field.multiple;
- this.default_text_default = this.is_multiple ? "Select Some Options" : "Select an Option";
- this.setup();
- this.set_up_html();
- this.register_observers();
- this.finish_setup();
- }
-
- AbstractChosen.prototype.set_default_values = function() {
- var _this = this;
- this.click_test_action = function(evt) {
- return _this.test_active_click(evt);
- };
- this.activate_action = function(evt) {
- return _this.activate_field(evt);
- };
- this.active_field = false;
- this.mouse_on_container = false;
- this.results_showing = false;
- this.result_highlighted = null;
- this.result_single_selected = null;
- this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
- this.disable_search_threshold = this.options.disable_search_threshold || 0;
- this.search_contains = this.options.search_contains || false;
- this.choices = 0;
- return this.results_none_found = this.options.no_results_text || "No results match";
- };
-
- AbstractChosen.prototype.mouse_enter = function() {
- return this.mouse_on_container = true;
- };
-
- AbstractChosen.prototype.mouse_leave = function() {
- return this.mouse_on_container = false;
- };
-
- AbstractChosen.prototype.input_focus = function(evt) {
- var _this = this;
- if (!this.active_field) {
- return setTimeout((function() {
- return _this.container_mousedown();
- }), 50);
- }
- };
-
- AbstractChosen.prototype.input_blur = function(evt) {
- var _this = this;
- if (!this.mouse_on_container) {
- this.active_field = false;
- return setTimeout((function() {
- return _this.blur_test();
- }), 100);
- }
- };
-
- AbstractChosen.prototype.result_add_option = function(option) {
- var classes, style;
- if (!option.disabled) {
- option.dom_id = this.container_id + "_o_" + option.array_index;
- classes = option.selected && this.is_multiple ? [] : ["active-result"];
- if (option.selected) classes.push("result-selected");
- if (option.group_array_index != null) classes.push("group-option");
- if (option.classes !== "") classes.push(option.classes);
- style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
- return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
- } else {
- return "";
- }
- };
-
- AbstractChosen.prototype.results_update_field = function() {
- this.result_clear_highlight();
- this.result_single_selected = null;
- return this.results_build();
- };
-
- AbstractChosen.prototype.results_toggle = function() {
- if (this.results_showing) {
- return this.results_hide();
- } else {
- return this.results_show();
- }
- };
-
- AbstractChosen.prototype.results_search = function(evt) {
- if (this.results_showing) {
- return this.winnow_results();
- } else {
- return this.results_show();
- }
- };
-
- AbstractChosen.prototype.keyup_checker = function(evt) {
- var stroke, _ref;
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
- this.search_field_scale();
- switch (stroke) {
- case 8:
- if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
- return this.keydown_backstroke();
- } else if (!this.pending_backstroke) {
- this.result_clear_highlight();
- return this.results_search();
- }
- break;
- case 13:
- evt.preventDefault();
- if (this.results_showing) return this.result_select(evt);
- break;
- case 27:
- if (this.results_showing) this.results_hide();
- return true;
- case 9:
- case 38:
- case 40:
- case 16:
- case 91:
- case 17:
- break;
- default:
- return this.results_search();
- }
- };
-
- AbstractChosen.prototype.generate_field_id = function() {
- var new_id;
- new_id = this.generate_random_id();
- this.form_field.id = new_id;
- return new_id;
- };
-
- AbstractChosen.prototype.generate_random_char = function() {
- var chars, newchar, rand;
- chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
- rand = Math.floor(Math.random() * chars.length);
- return newchar = chars.substring(rand, rand + 1);
- };
-
- return AbstractChosen;
-
- })();
-
- root.AbstractChosen = AbstractChosen;
-
-}).call(this);
-
-/*
-Chosen source: generate output using 'cake build'
-Copyright (c) 2011 by Harvest
-*/
-
-(function() {
- var $, Chosen, get_side_border_padding, root,
- __hasProp = Object.prototype.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
-
- root = this;
-
- $ = jQuery;
-
- $.fn.extend({
- chosen: function(options) {
- if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
- return this;
- }
- return $(this).each(function(input_field) {
- if (!($(this)).hasClass("chzn-done")) return new Chosen(this, options);
- });
- }
- });
-
- Chosen = (function(_super) {
-
- __extends(Chosen, _super);
-
- function Chosen() {
- Chosen.__super__.constructor.apply(this, arguments);
- }
-
- Chosen.prototype.setup = function() {
- this.form_field_jq = $(this.form_field);
- return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
- };
-
- Chosen.prototype.finish_setup = function() {
- return this.form_field_jq.addClass("chzn-done");
- };
-
- Chosen.prototype.set_up_html = function() {
- var container_div, dd_top, dd_width, sf_width;
- this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
- this.container_id += "_chzn";
- this.f_width = this.form_field_jq.outerWidth();
- this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
- container_div = $("<div />", {
- id: this.container_id,
- "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
- style: 'width: ' + this.f_width + 'px;'
- });
- if (this.is_multiple) {
- container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
- } else {
- container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="search" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
- }
- this.form_field_jq.hide().after(container_div);
- this.container = $('#' + this.container_id);
- this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
- this.dropdown = this.container.find('div.chzn-drop').first();
- dd_top = this.container.height();
- dd_width = this.f_width - get_side_border_padding(this.dropdown);
- this.dropdown.css({
- "width": dd_width + "px",
- "top": dd_top + "px"
- });
- this.search_field = this.container.find('input').first();
- this.search_results = this.container.find('ul.chzn-results').first();
- this.search_field_scale();
- this.search_no_results = this.container.find('li.no-results').first();
- if (this.is_multiple) {
- this.search_choices = this.container.find('ul.chzn-choices').first();
- this.search_container = this.container.find('li.search-field').first();
- } else {
- this.search_container = this.container.find('div.chzn-search').first();
- this.selected_item = this.container.find('.chzn-single').first();
- sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
- sf_width = dd_width - get_side_border_padding(this.search_container);
- this.search_field.css({
- "width": sf_width + "px"
- });
- }
- this.results_build();
- this.set_tab_index();
- return this.form_field_jq.trigger("liszt:ready", {
- chosen: this
- });
- };
-
- Chosen.prototype.register_observers = function() {
- var _this = this;
- this.container.mousedown(function(evt) {
- return _this.container_mousedown(evt);
- });
- this.container.mouseup(function(evt) {
- return _this.container_mouseup(evt);
- });
- this.container.mouseenter(function(evt) {
- return _this.mouse_enter(evt);
- });
- this.container.mouseleave(function(evt) {
- return _this.mouse_leave(evt);
- });
- this.search_results.mouseup(function(evt) {
- return _this.search_results_mouseup(evt);
- });
- this.search_results.mouseover(function(evt) {
- return _this.search_results_mouseover(evt);
- });
- this.search_results.mouseout(function(evt) {
- return _this.search_results_mouseout(evt);
- });
- this.form_field_jq.bind("liszt:updated", function(evt) {
- return _this.results_update_field(evt);
- });
- this.search_field.blur(function(evt) {
- return _this.input_blur(evt);
- });
- this.search_field.keyup(function(evt) {
- return _this.keyup_checker(evt);
- });
- this.search_field.keydown(function(evt) {
- return _this.keydown_checker(evt);
- });
- if (this.is_multiple) {
- this.search_choices.click(function(evt) {
- return _this.choices_click(evt);
- });
- return this.search_field.focus(function(evt) {
- return _this.input_focus(evt);
- });
- } else {
- return this.container.click(function(evt) {
- return evt.preventDefault();
- });
- }
- };
-
- Chosen.prototype.search_field_disabled = function() {
- this.is_disabled = this.form_field_jq[0].disabled;
- if (this.is_disabled) {
- this.container.addClass('chzn-disabled');
- this.search_field[0].disabled = true;
- if (!this.is_multiple) {
- this.selected_item.unbind("focus", this.activate_action);
- }
- return this.close_field();
- } else {
- this.container.removeClass('chzn-disabled');
- this.search_field[0].disabled = false;
- if (!this.is_multiple) {
- return this.selected_item.bind("focus", this.activate_action);
- }
- }
- };
-
- Chosen.prototype.container_mousedown = function(evt) {
- var target_closelink;
- if (!this.is_disabled) {
- target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
- if (evt && evt.type === "mousedown" && !this.results_showing) {
- evt.stopPropagation();
- }
- if (!this.pending_destroy_click && !target_closelink) {
- if (!this.active_field) {
- if (this.is_multiple) this.search_field.val("");
- $(document).click(this.click_test_action);
- this.results_show();
- } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
- evt.preventDefault();
- this.results_toggle();
- }
- return this.activate_field();
- } else {
- return this.pending_destroy_click = false;
- }
- }
- };
-
- Chosen.prototype.container_mouseup = function(evt) {
- if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
- };
-
- Chosen.prototype.blur_test = function(evt) {
- if (!this.active_field && this.container.hasClass("chzn-container-active")) {
- return this.close_field();
- }
- };
-
- Chosen.prototype.close_field = function() {
- $(document).unbind("click", this.click_test_action);
- if (!this.is_multiple) {
- this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
- this.search_field.attr("tabindex", -1);
- }
- this.active_field = false;
- this.results_hide();
- this.container.removeClass("chzn-container-active");
- this.winnow_results_clear();
- this.clear_backstroke();
- this.show_search_field_default();
- return this.search_field_scale();
- };
-
- Chosen.prototype.activate_field = function() {
- if (!this.is_multiple && !this.active_field) {
- this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
- this.selected_item.attr("tabindex", -1);
- }
- this.container.addClass("chzn-container-active");
- this.active_field = true;
- this.search_field.val(this.search_field.val());
- return this.search_field.focus();
- };
-
- Chosen.prototype.test_active_click = function(evt) {
- if ($(evt.target).parents('#' + this.container_id).length) {
- return this.active_field = true;
- } else {
- return this.close_field();
- }
- };
-
- Chosen.prototype.results_build = function() {
- var content, data, _i, _len, _ref;
- this.parsing = true;
- this.results_data = root.SelectParser.select_to_array(this.form_field);
- if (this.is_multiple && this.choices > 0) {
- this.search_choices.find("li.search-choice").remove();
- this.choices = 0;
- } else if (!this.is_multiple) {
- this.selected_item.find("span").text(this.default_text);
- if (this.form_field.options.length <= this.disable_search_threshold) {
- this.container.addClass("chzn-container-single-nosearch");
- } else {
- this.container.removeClass("chzn-container-single-nosearch");
- }
- }
- content = '';
- _ref = this.results_data;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- data = _ref[_i];
- if (data.group) {
- content += this.result_add_group(data);
- } else if (!data.empty) {
- content += this.result_add_option(data);
- if (data.selected && this.is_multiple) {
- this.choice_build(data);
- } else if (data.selected && !this.is_multiple) {
- this.selected_item.removeClass("chzn-default").find("span").text(data.text);
- if (this.allow_single_deselect) this.single_deselect_control_build();
- }
- }
- }
- this.search_field_disabled();
- this.show_search_field_default();
- this.search_field_scale();
- this.search_results.html(content);
- return this.parsing = false;
- };
-
- Chosen.prototype.result_add_group = function(group) {
- if (!group.disabled) {
- group.dom_id = this.container_id + "_g_" + group.array_index;
- return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
- } else {
- return "";
- }
- };
-
- Chosen.prototype.result_do_highlight = function(el) {
- var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
- if (el.length) {
- this.result_clear_highlight();
- this.result_highlight = el;
- this.result_highlight.addClass("highlighted");
- maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
- visible_top = this.search_results.scrollTop();
- visible_bottom = maxHeight + visible_top;
- high_top = this.result_highlight.position().top + this.search_results.scrollTop();
- high_bottom = high_top + this.result_highlight.outerHeight();
- if (high_bottom >= visible_bottom) {
- return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
- } else if (high_top < visible_top) {
- return this.search_results.scrollTop(high_top);
- }
- }
- };
-
- Chosen.prototype.result_clear_highlight = function() {
- if (this.result_highlight) this.result_highlight.removeClass("highlighted");
- return this.result_highlight = null;
- };
-
- Chosen.prototype.results_show = function() {
- var dd_top;
- if (!this.is_multiple) {
- this.selected_item.addClass("chzn-single-with-drop");
- if (this.result_single_selected) {
- this.result_do_highlight(this.result_single_selected);
- }
- }
- dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
- this.dropdown.css({
- "top": dd_top + "px",
- "left": 0
- });
- this.results_showing = true;
- this.search_field.focus();
- this.search_field.val(this.search_field.val());
- return this.winnow_results();
- };
-
- Chosen.prototype.results_hide = function() {
- if (!this.is_multiple) {
- this.selected_item.removeClass("chzn-single-with-drop");
- }
- this.result_clear_highlight();
- this.dropdown.css({
- "left": "-9000px"
- });
- return this.results_showing = false;
- };
-
- Chosen.prototype.set_tab_index = function(el) {
- var ti;
- if (this.form_field_jq.attr("tabindex")) {
- ti = this.form_field_jq.attr("tabindex");
- this.form_field_jq.attr("tabindex", -1);
- if (this.is_multiple) {
- return this.search_field.attr("tabindex", ti);
- } else {
- this.selected_item.attr("tabindex", ti);
- return this.search_field.attr("tabindex", -1);
- }
- }
- };
-
- Chosen.prototype.show_search_field_default = function() {
- if (this.is_multiple && this.choices < 1 && !this.active_field) {
- this.search_field.val(this.default_text);
- return this.search_field.addClass("default");
- } else {
- this.search_field.val("");
- return this.search_field.removeClass("default");
- }
- };
-
- Chosen.prototype.search_results_mouseup = function(evt) {
- var target;
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
- if (target.length) {
- this.result_highlight = target;
- return this.result_select(evt);
- }
- };
-
- Chosen.prototype.search_results_mouseover = function(evt) {
- var target;
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
- if (target) return this.result_do_highlight(target);
- };
-
- Chosen.prototype.search_results_mouseout = function(evt) {
- if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
- return this.result_clear_highlight();
- }
- };
-
- Chosen.prototype.choices_click = function(evt) {
- evt.preventDefault();
- if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
- return this.results_show();
- }
- };
-
- Chosen.prototype.choice_build = function(item) {
- var choice_id, link,
- _this = this;
- choice_id = this.container_id + "_c_" + item.array_index;
- this.choices += 1;
- this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
- link = $('#' + choice_id).find("a").first();
- return link.click(function(evt) {
- return _this.choice_destroy_link_click(evt);
- });
- };
-
- Chosen.prototype.choice_destroy_link_click = function(evt) {
- evt.preventDefault();
- if (!this.is_disabled) {
- this.pending_destroy_click = true;
- return this.choice_destroy($(evt.target));
- } else {
- return evt.stopPropagation;
- }
- };
-
- Chosen.prototype.choice_destroy = function(link) {
- this.choices -= 1;
- this.show_search_field_default();
- if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
- this.results_hide();
- }
- this.result_deselect(link.attr("rel"));
- return link.parents('li').first().remove();
- };
-
- Chosen.prototype.results_reset = function(evt) {
- this.form_field.options[0].selected = true;
- this.selected_item.find("span").text(this.default_text);
- if (!this.is_multiple) this.selected_item.addClass("chzn-default");
- this.show_search_field_default();
- $(evt.target).remove();
- this.form_field_jq.trigger("change");
- if (this.active_field) return this.results_hide();
- };
-
- Chosen.prototype.result_select = function(evt) {
- var high, high_id, item, position;
- if (this.result_highlight) {
- high = this.result_highlight;
- high_id = high.attr("id");
- this.result_clear_highlight();
- if (this.is_multiple) {
- this.result_deactivate(high);
- } else {
- this.search_results.find(".result-selected").removeClass("result-selected");
- this.result_single_selected = high;
- this.selected_item.removeClass("chzn-default");
- }
- high.addClass("result-selected");
- position = high_id.substr(high_id.lastIndexOf("_") + 1);
- item = this.results_data[position];
- item.selected = true;
- this.form_field.options[item.options_index].selected = true;
- if (this.is_multiple) {
- this.choice_build(item);
- } else {
- this.selected_item.find("span").first().text(item.text);
- if (this.allow_single_deselect) this.single_deselect_control_build();
- }
- if (!(evt.metaKey && this.is_multiple)) this.results_hide();
- this.search_field.val("");
- this.form_field_jq.trigger("change");
- return this.search_field_scale();
- }
- };
-
- Chosen.prototype.result_activate = function(el) {
- return el.addClass("active-result");
- };
-
- Chosen.prototype.result_deactivate = function(el) {
- return el.removeClass("active-result");
- };
-
- Chosen.prototype.result_deselect = function(pos) {
- var result, result_data;
- result_data = this.results_data[pos];
- result_data.selected = false;
- this.form_field.options[result_data.options_index].selected = false;
- result = $("#" + this.container_id + "_o_" + pos);
- result.removeClass("result-selected").addClass("active-result").show();
- this.result_clear_highlight();
- this.winnow_results();
- this.form_field_jq.trigger("change");
- return this.search_field_scale();
- };
-
- Chosen.prototype.single_deselect_control_build = function() {
- if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
- return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
- }
- };
-
- Chosen.prototype.winnow_results = function() {
- var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
- this.no_results_clear();
- results = 0;
- searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
- regexAnchor = this.search_contains ? "" : "^";
- regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
- zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
- _ref = this.results_data;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- option = _ref[_i];
- if (!option.disabled && !option.empty) {
- if (option.group) {
- $('#' + option.dom_id).css('display', 'none');
- } else if (!(this.is_multiple && option.selected)) {
- found = false;
- result_id = option.dom_id;
- result = $("#" + result_id);
- if (regex.test(option.html)) {
- found = true;
- results += 1;
- } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
- parts = option.html.replace(/\[|\]/g, "").split(" ");
- if (parts.length) {
- for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
- part = parts[_j];
- if (regex.test(part)) {
- found = true;
- results += 1;
- }
- }
- }
- }
- if (found) {
- if (searchText.length) {
- startpos = option.html.search(zregex);
- text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
- text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
- } else {
- text = option.html;
- }
- result.html(text);
- this.result_activate(result);
- if (option.group_array_index != null) {
- $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
- }
- } else {
- if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
- this.result_clear_highlight();
- }
- this.result_deactivate(result);
- }
- }
- }
- }
- if (results < 1 && searchText.length) {
- return this.no_results(searchText);
- } else {
- return this.winnow_results_set_highlight();
- }
- };
-
- Chosen.prototype.winnow_results_clear = function() {
- var li, lis, _i, _len, _results;
- this.search_field.val("");
- lis = this.search_results.find("li");
- _results = [];
- for (_i = 0, _len = lis.length; _i < _len; _i++) {
- li = lis[_i];
- li = $(li);
- if (li.hasClass("group-result")) {
- _results.push(li.css('display', 'auto'));
- } else if (!this.is_multiple || !li.hasClass("result-selected")) {
- _results.push(this.result_activate(li));
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
-
- Chosen.prototype.winnow_results_set_highlight = function() {
- var do_high, selected_results;
- if (!this.result_highlight) {
- selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
- do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
- if (do_high != null) return this.result_do_highlight(do_high);
- }
- };
-
- Chosen.prototype.no_results = function(terms) {
- var no_results_html;
- no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
- no_results_html.find("span").first().html(terms);
- return this.search_results.append(no_results_html);
- };
-
- Chosen.prototype.no_results_clear = function() {
- return this.search_results.find(".no-results").remove();
- };
-
- Chosen.prototype.keydown_arrow = function() {
- var first_active, next_sib;
- if (!this.result_highlight) {
- first_active = this.search_results.find("li.active-result").first();
- if (first_active) this.result_do_highlight($(first_active));
- } else if (this.results_showing) {
- next_sib = this.result_highlight.nextAll("li.active-result").first();
- if (next_sib) this.result_do_highlight(next_sib);
- }
- if (!this.results_showing) return this.results_show();
- };
-
- Chosen.prototype.keyup_arrow = function() {
- var prev_sibs;
- if (!this.results_showing && !this.is_multiple) {
- return this.results_show();
- } else if (this.result_highlight) {
- prev_sibs = this.result_highlight.prevAll("li.active-result");
- if (prev_sibs.length) {
- return this.result_do_highlight(prev_sibs.first());
- } else {
- if (this.choices > 0) this.results_hide();
- return this.result_clear_highlight();
- }
- }
- };
-
- Chosen.prototype.keydown_backstroke = function() {
- if (this.pending_backstroke) {
- this.choice_destroy(this.pending_backstroke.find("a").first());
- return this.clear_backstroke();
- } else {
- this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
- return this.pending_backstroke.addClass("search-choice-focus");
- }
- };
-
- Chosen.prototype.clear_backstroke = function() {
- if (this.pending_backstroke) {
- this.pending_backstroke.removeClass("search-choice-focus");
- }
- return this.pending_backstroke = null;
- };
-
- Chosen.prototype.keydown_checker = function(evt) {
- var stroke, _ref;
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
- this.search_field_scale();
- if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke();
- switch (stroke) {
- case 8:
- this.backstroke_length = this.search_field.val().length;
- break;
- case 9:
- if (this.results_showing && !this.is_multiple) this.result_select(evt);
- this.mouse_on_container = false;
- break;
- case 13:
- evt.preventDefault();
- break;
- case 38:
- evt.preventDefault();
- this.keyup_arrow();
- break;
- case 40:
- this.keydown_arrow();
- break;
- }
- };
-
- Chosen.prototype.search_field_scale = function() {
- var dd_top, div, h, style, style_block, styles, w, _i, _len;
- if (this.is_multiple) {
- h = 0;
- w = 0;
- style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
- styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
- for (_i = 0, _len = styles.length; _i < _len; _i++) {
- style = styles[_i];
- style_block += style + ":" + this.search_field.css(style) + ";";
- }
- div = $('<div />', {
- 'style': style_block
- });
- div.text(this.search_field.val());
- $('body').append(div);
- w = div.width() + 25;
- div.remove();
- if (w > this.f_width - 10) w = this.f_width - 10;
- this.search_field.css({
- 'width': w + 'px'
- });
- dd_top = this.container.height();
- return this.dropdown.css({
- "top": dd_top + "px"
- });
- }
- };
-
- Chosen.prototype.generate_random_id = function() {
- var string;
- string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
- while ($("#" + string).length > 0) {
- string += this.generate_random_char();
- }
- return string;
- };
-
- return Chosen;
-
- })(AbstractChosen);
-
- get_side_border_padding = function(elmt) {
- var side_border_padding;
- return side_border_padding = elmt.outerWidth() - elmt.width();
- };
-
- root.get_side_border_padding = get_side_border_padding;
-
-}).call(this);
diff --git a/solr/webapp/web/js/lib/console.js b/solr/webapp/web/js/lib/console.js
deleted file mode 100644
index ef91c0871bd..00000000000
--- a/solr/webapp/web/js/lib/console.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-window.console = window.console || {};
-
-var names = ["log", "debug", "info", "warn", "error",
- "assert", "dir", "dirxml", "group", "groupEnd", "time",
- "timeEnd", "count", "trace", "profile", "profileEnd"];
-
-var i = 0;
-var l = names.length;
-for( i = 0; i < l; i++ )
-{
- window.console[names[i]] = window.console[names[i]] || function() {};
-}
diff --git a/solr/webapp/web/js/lib/d3.js b/solr/webapp/web/js/lib/d3.js
deleted file mode 100644
index 50156035b09..00000000000
--- a/solr/webapp/web/js/lib/d3.js
+++ /dev/null
@@ -1,9373 +0,0 @@
-/*
-
-Copyright (c) 2013, Michael Bostock
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* The name Michael Bostock may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-(function(){if (!Date.now) Date.now = function() {
- return +new Date;
-};
-try {
- document.createElement("div").style.setProperty("opacity", 0, "");
-} catch (error) {
- var d3_style_prototype = CSSStyleDeclaration.prototype,
- d3_style_setProperty = d3_style_prototype.setProperty;
- d3_style_prototype.setProperty = function(name, value, priority) {
- d3_style_setProperty.call(this, name, value + "", priority);
- };
-}
-d3 = {version: "2.8.1"}; // semver
-function d3_class(ctor, properties) {
- try {
- for (var key in properties) {
- Object.defineProperty(ctor.prototype, key, {
- value: properties[key],
- enumerable: false
- });
- }
- } catch (e) {
- ctor.prototype = properties;
- }
-}
-var d3_array = d3_arraySlice; // conversion for NodeLists
-
-function d3_arrayCopy(pseudoarray) {
- var i = -1, n = pseudoarray.length, array = [];
- while (++i < n) array.push(pseudoarray[i]);
- return array;
-}
-
-function d3_arraySlice(pseudoarray) {
- return Array.prototype.slice.call(pseudoarray);
-}
-
-try {
- d3_array(document.documentElement.childNodes)[0].nodeType;
-} catch(e) {
- d3_array = d3_arrayCopy;
-}
-
-var d3_arraySubclass = [].__proto__?
-
-// Until ECMAScript supports array subclassing, prototype injection works well.
-function(array, prototype) {
- array.__proto__ = prototype;
-}:
-
-// And if your browser doesn't support __proto__, we'll use direct extension.
-function(array, prototype) {
- for (var property in prototype) array[property] = prototype[property];
-};
-d3.map = function(object) {
- var map = new d3_Map;
- for (var key in object) map.set(key, object[key]);
- return map;
-};
-
-function d3_Map() {}
-
-d3_class(d3_Map, {
- has: function(key) {
- return d3_map_prefix + key in this;
- },
- get: function(key) {
- return this[d3_map_prefix + key];
- },
- set: function(key, value) {
- return this[d3_map_prefix + key] = value;
- },
- remove: function(key) {
- key = d3_map_prefix + key;
- return key in this && delete this[key];
- },
- keys: function() {
- var keys = [];
- this.forEach(function(key) { keys.push(key); });
- return keys;
- },
- values: function() {
- var values = [];
- this.forEach(function(key, value) { values.push(value); });
- return values;
- },
- entries: function() {
- var entries = [];
- this.forEach(function(key, value) { entries.push({key: key, value: value}); });
- return entries;
- },
- forEach: function(f) {
- for (var key in this) {
- if (key.charCodeAt(0) === d3_map_prefixCode) {
- f.call(this, key.substring(1), this[key]);
- }
- }
- }
-});
-
-var d3_map_prefix = "\0", // prevent collision with built-ins
- d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
-function d3_this() {
- return this;
-}
-d3.functor = function(v) {
- return typeof v === "function" ? v : function() { return v; };
-};
-// Copies a variable number of methods from source to target.
-d3.rebind = function(target, source) {
- var i = 1, n = arguments.length, method;
- while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
- return target;
-};
-
-// Method is assumed to be a standard D3 getter-setter:
-// If passed with no arguments, gets the value.
-// If passed with arguments, sets the value and returns the target.
-function d3_rebind(target, source, method) {
- return function() {
- var value = method.apply(source, arguments);
- return arguments.length ? target : value;
- };
-}
-d3.ascending = function(a, b) {
- return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
-};
-d3.descending = function(a, b) {
- return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
-};
-d3.mean = function(array, f) {
- var n = array.length,
- a,
- m = 0,
- i = -1,
- j = 0;
- if (arguments.length === 1) {
- while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
- } else {
- while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
- }
- return j ? m : undefined;
-};
-d3.median = function(array, f) {
- if (arguments.length > 1) array = array.map(f);
- array = array.filter(d3_number);
- return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
-};
-d3.min = function(array, f) {
- var i = -1,
- n = array.length,
- a,
- b;
- if (arguments.length === 1) {
- while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
- while (++i < n) if ((b = array[i]) != null && a > b) a = b;
- } else {
- while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
- }
- return a;
-};
-d3.max = function(array, f) {
- var i = -1,
- n = array.length,
- a,
- b;
- if (arguments.length === 1) {
- while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
- while (++i < n) if ((b = array[i]) != null && b > a) a = b;
- } else {
- while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
- }
- return a;
-};
-d3.extent = function(array, f) {
- var i = -1,
- n = array.length,
- a,
- b,
- c;
- if (arguments.length === 1) {
- while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
- while (++i < n) if ((b = array[i]) != null) {
- if (a > b) a = b;
- if (c < b) c = b;
- }
- } else {
- while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
- if (a > b) a = b;
- if (c < b) c = b;
- }
- }
- return [a, c];
-};
-d3.random = {
- normal: function(mean, deviation) {
- if (arguments.length < 2) deviation = 1;
- if (arguments.length < 1) mean = 0;
- return function() {
- var x, y, r;
- do {
- x = Math.random() * 2 - 1;
- y = Math.random() * 2 - 1;
- r = x * x + y * y;
- } while (!r || r > 1);
- return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
- };
- }
-};
-function d3_number(x) {
- return x != null && !isNaN(x);
-}
-d3.sum = function(array, f) {
- var s = 0,
- n = array.length,
- a,
- i = -1;
-
- if (arguments.length === 1) {
- while (++i < n) if (!isNaN(a = +array[i])) s += a;
- } else {
- while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
- }
-
- return s;
-};
-// R-7 per <http://en.wikipedia.org/wiki/Quantile>
-d3.quantile = function(values, p) {
- var H = (values.length - 1) * p + 1,
- h = Math.floor(H),
- v = values[h - 1],
- e = H - h;
- return e ? v + e * (values[h] - v) : v;
-};
-d3.transpose = function(matrix) {
- return d3.zip.apply(d3, matrix);
-};
-d3.zip = function() {
- if (!(n = arguments.length)) return [];
- for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
- for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) {
- zip[j] = arguments[j][i];
- }
- }
- return zips;
-};
-
-function d3_zipLength(d) {
- return d.length;
-}
-d3.bisector = function(f) {
- return {
- left: function(a, x, lo, hi) {
- if (arguments.length < 3) lo = 0;
- if (arguments.length < 4) hi = a.length;
- while (lo < hi) {
- var mid = lo + hi >> 1;
- if (f.call(a, a[mid], mid) < x) lo = mid + 1;
- else hi = mid;
- }
- return lo;
- },
- right: function(a, x, lo, hi) {
- if (arguments.length < 3) lo = 0;
- if (arguments.length < 4) hi = a.length;
- while (lo < hi) {
- var mid = lo + hi >> 1;
- if (x < f.call(a, a[mid], mid)) hi = mid;
- else lo = mid + 1;
- }
- return lo;
- }
- };
-};
-
-var d3_bisector = d3.bisector(function(d) { return d; });
-d3.bisectLeft = d3_bisector.left;
-d3.bisect = d3.bisectRight = d3_bisector.right;
-d3.first = function(array, f) {
- var i = 0,
- n = array.length,
- a = array[0],
- b;
- if (arguments.length === 1) f = d3.ascending;
- while (++i < n) {
- if (f.call(array, a, b = array[i]) > 0) {
- a = b;
- }
- }
- return a;
-};
-d3.last = function(array, f) {
- var i = 0,
- n = array.length,
- a = array[0],
- b;
- if (arguments.length === 1) f = d3.ascending;
- while (++i < n) {
- if (f.call(array, a, b = array[i]) <= 0) {
- a = b;
- }
- }
- return a;
-};
-d3.nest = function() {
- var nest = {},
- keys = [],
- sortKeys = [],
- sortValues,
- rollup;
-
- function map(array, depth) {
- if (depth >= keys.length) return rollup
- ? rollup.call(nest, array) : (sortValues
- ? array.sort(sortValues)
- : array);
-
- var i = -1,
- n = array.length,
- key = keys[depth++],
- keyValue,
- object,
- valuesByKey = new d3_Map,
- values,
- o = {};
-
- while (++i < n) {
- if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
- values.push(object);
- } else {
- valuesByKey.set(keyValue, [object]);
- }
- }
-
- valuesByKey.forEach(function(keyValue) {
- o[keyValue] = map(valuesByKey.get(keyValue), depth);
- });
-
- return o;
- }
-
- function entries(map, depth) {
- if (depth >= keys.length) return map;
-
- var a = [],
- sortKey = sortKeys[depth++],
- key;
-
- for (key in map) {
- a.push({key: key, values: entries(map[key], depth)});
- }
-
- if (sortKey) a.sort(function(a, b) {
- return sortKey(a.key, b.key);
- });
-
- return a;
- }
-
- nest.map = function(array) {
- return map(array, 0);
- };
-
- nest.entries = function(array) {
- return entries(map(array, 0), 0);
- };
-
- nest.key = function(d) {
- keys.push(d);
- return nest;
- };
-
- // Specifies the order for the most-recently specified key.
- // Note: only applies to entries. Map keys are unordered!
- nest.sortKeys = function(order) {
- sortKeys[keys.length - 1] = order;
- return nest;
- };
-
- // Specifies the order for leaf values.
- // Applies to both maps and entries array.
- nest.sortValues = function(order) {
- sortValues = order;
- return nest;
- };
-
- nest.rollup = function(f) {
- rollup = f;
- return nest;
- };
-
- return nest;
-};
-d3.keys = function(map) {
- var keys = [];
- for (var key in map) keys.push(key);
- return keys;
-};
-d3.values = function(map) {
- var values = [];
- for (var key in map) values.push(map[key]);
- return values;
-};
-d3.entries = function(map) {
- var entries = [];
- for (var key in map) entries.push({key: key, value: map[key]});
- return entries;
-};
-d3.permute = function(array, indexes) {
- var permutes = [],
- i = -1,
- n = indexes.length;
- while (++i < n) permutes[i] = array[indexes[i]];
- return permutes;
-};
-d3.merge = function(arrays) {
- return Array.prototype.concat.apply([], arrays);
-};
-d3.split = function(array, f) {
- var arrays = [],
- values = [],
- value,
- i = -1,
- n = array.length;
- if (arguments.length < 2) f = d3_splitter;
- while (++i < n) {
- if (f.call(values, value = array[i], i)) {
- values = [];
- } else {
- if (!values.length) arrays.push(values);
- values.push(value);
- }
- }
- return arrays;
-};
-
-function d3_splitter(d) {
- return d == null;
-}
-function d3_collapse(s) {
- return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
-}
-d3.range = function(start, stop, step) {
- if (arguments.length < 3) {
- step = 1;
- if (arguments.length < 2) {
- stop = start;
- start = 0;
- }
- }
- if ((stop - start) / step === Infinity) throw new Error("infinite range");
- var range = [],
- k = d3_range_integerScale(Math.abs(step)),
- i = -1,
- j;
- start *= k, stop *= k, step *= k;
- if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
- else while ((j = start + step * ++i) < stop) range.push(j / k);
- return range;
-};
-
-function d3_range_integerScale(x) {
- var k = 1;
- while (x * k % 1) k *= 10;
- return k;
-}
-d3.requote = function(s) {
- return s.replace(d3_requote_re, "\\$&");
-};
-
-var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
-d3.round = function(x, n) {
- return n
- ? Math.round(x * (n = Math.pow(10, n))) / n
- : Math.round(x);
-};
-d3.xhr = function(url, mime, callback) {
- var req = new XMLHttpRequest;
- if (arguments.length < 3) callback = mime, mime = null;
- else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
- req.open("GET", url, true);
- if (mime) req.setRequestHeader("Accept", mime);
- req.onreadystatechange = function() {
- if (req.readyState === 4) callback(req.status < 300 ? req : null);
- };
- req.send(null);
-};
-d3.text = function(url, mime, callback) {
- function ready(req) {
- callback(req && req.responseText);
- }
- if (arguments.length < 3) {
- callback = mime;
- mime = null;
- }
- d3.xhr(url, mime, ready);
-};
-d3.json = function(url, callback) {
- d3.text(url, "application/json", function(text) {
- callback(text ? JSON.parse(text) : null);
- });
-};
-d3.html = function(url, callback) {
- d3.text(url, "text/html", function(text) {
- if (text != null) { // Treat empty string as valid HTML.
- var range = document.createRange();
- range.selectNode(document.body);
- text = range.createContextualFragment(text);
- }
- callback(text);
- });
-};
-d3.xml = function(url, mime, callback) {
- function ready(req) {
- callback(req && req.responseXML);
- }
- if (arguments.length < 3) {
- callback = mime;
- mime = null;
- }
- d3.xhr(url, mime, ready);
-};
-var d3_nsPrefix = {
- svg: "http://www.w3.org/2000/svg",
- xhtml: "http://www.w3.org/1999/xhtml",
- xlink: "http://www.w3.org/1999/xlink",
- xml: "http://www.w3.org/XML/1998/namespace",
- xmlns: "http://www.w3.org/2000/xmlns/"
-};
-
-d3.ns = {
- prefix: d3_nsPrefix,
- qualify: function(name) {
- var i = name.indexOf(":"),
- prefix = name;
- if (i >= 0) {
- prefix = name.substring(0, i);
- name = name.substring(i + 1);
- }
- return d3_nsPrefix.hasOwnProperty(prefix)
- ? {space: d3_nsPrefix[prefix], local: name}
- : name;
- }
-};
-d3.dispatch = function() {
- var dispatch = new d3_dispatch,
- i = -1,
- n = arguments.length;
- while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
- return dispatch;
-};
-
-function d3_dispatch() {}
-
-d3_dispatch.prototype.on = function(type, listener) {
- var i = type.indexOf("."),
- name = "";
-
- // Extract optional namespace, e.g., "click.foo"
- if (i > 0) {
- name = type.substring(i + 1);
- type = type.substring(0, i);
- }
-
- return arguments.length < 2
- ? this[type].on(name)
- : this[type].on(name, listener);
-};
-
-function d3_dispatch_event(dispatch) {
- var listeners = [],
- listenerByName = new d3_Map;
-
- function event() {
- var z = listeners, // defensive reference
- i = -1,
- n = z.length,
- l;
- while (++i < n) if (l = z[i].on) l.apply(this, arguments);
- return dispatch;
- }
-
- event.on = function(name, listener) {
- var l = listenerByName.get(name),
- i;
-
- // return the current listener, if any
- if (arguments.length < 2) return l && l.on;
-
- // remove the old listener, if any (with copy-on-write)
- if (l) {
- l.on = null;
- listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
- listenerByName.remove(name);
- }
-
- // add the new listener, if any
- if (listener) listeners.push(listenerByName.set(name, {on: listener}));
-
- return dispatch;
- };
-
- return event;
-}
-// TODO align
-d3.format = function(specifier) {
- var match = d3_format_re.exec(specifier),
- fill = match[1] || " ",
- sign = match[3] || "",
- zfill = match[5],
- width = +match[6],
- comma = match[7],
- precision = match[8],
- type = match[9],
- scale = 1,
- suffix = "",
- integer = false;
-
- if (precision) precision = +precision.substring(1);
-
- if (zfill) {
- fill = "0"; // TODO align = "=";
- if (comma) width -= Math.floor((width - 1) / 4);
- }
-
- switch (type) {
- case "n": comma = true; type = "g"; break;
- case "%": scale = 100; suffix = "%"; type = "f"; break;
- case "p": scale = 100; suffix = "%"; type = "r"; break;
- case "d": integer = true; precision = 0; break;
- case "s": scale = -1; type = "r"; break;
- }
-
- // If no precision is specified for r, fallback to general notation.
- if (type == "r" && !precision) type = "g";
-
- type = d3_format_types.get(type) || d3_format_typeDefault;
-
- return function(value) {
-
- // Return the empty string for floats formatted as ints.
- if (integer && (value % 1)) return "";
-
- // Convert negative to positive, and record the sign prefix.
- var negative = (value < 0) && (value = -value) ? "\u2212" : sign;
-
- // Apply the scale, computing it from the value's exponent for si format.
- if (scale < 0) {
- var prefix = d3.formatPrefix(value, precision);
- value *= prefix.scale;
- suffix = prefix.symbol;
- } else {
- value *= scale;
- }
-
- // Convert to the desired precision.
- value = type(value, precision);
-
- // If the fill character is 0, the sign and group is applied after the fill.
- if (zfill) {
- var length = value.length + negative.length;
- if (length < width) value = new Array(width - length + 1).join(fill) + value;
- if (comma) value = d3_format_group(value);
- value = negative + value;
- }
-
- // Otherwise (e.g., space-filling), the sign and group is applied before.
- else {
- if (comma) value = d3_format_group(value);
- value = negative + value;
- var length = value.length;
- if (length < width) value = new Array(width - length + 1).join(fill) + value;
- }
-
- return value + suffix;
- };
-};
-
-// [[fill]align][sign][#][0][width][,][.precision][type]
-var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
-
-var d3_format_types = d3.map({
- g: function(x, p) { return x.toPrecision(p); },
- e: function(x, p) { return x.toExponential(p); },
- f: function(x, p) { return x.toFixed(p); },
- r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); }
-});
-
-function d3_format_precision(x, p) {
- return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
-}
-
-function d3_format_typeDefault(x) {
- return x + "";
-}
-
-// Apply comma grouping for thousands.
-function d3_format_group(value) {
- var i = value.lastIndexOf("."),
- f = i >= 0 ? value.substring(i) : (i = value.length, ""),
- t = [];
- while (i > 0) t.push(value.substring(i -= 3, i + 3));
- return t.reverse().join(",") + f;
-}
-var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
-
-d3.formatPrefix = function(value, precision) {
- var i = 0;
- if (value) {
- if (value < 0) value *= -1;
- if (precision) value = d3.round(value, d3_format_precision(value, precision));
- i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
- i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
- }
- return d3_formatPrefixes[8 + i / 3];
-};
-
-function d3_formatPrefix(d, i) {
- return {
- scale: Math.pow(10, (8 - i) * 3),
- symbol: d
- };
-}
-
-/*
- * TERMS OF USE - EASING EQUATIONS
- *
- * Open source under the BSD License.
- *
- * Copyright 2001 Robert Penner
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * - Neither the name of the author nor the names of contributors may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-var d3_ease_quad = d3_ease_poly(2),
- d3_ease_cubic = d3_ease_poly(3),
- d3_ease_default = function() { return d3_ease_identity; };
-
-var d3_ease = d3.map({
- linear: d3_ease_default,
- poly: d3_ease_poly,
- quad: function() { return d3_ease_quad; },
- cubic: function() { return d3_ease_cubic; },
- sin: function() { return d3_ease_sin; },
- exp: function() { return d3_ease_exp; },
- circle: function() { return d3_ease_circle; },
- elastic: d3_ease_elastic,
- back: d3_ease_back,
- bounce: function() { return d3_ease_bounce; }
-});
-
-var d3_ease_mode = d3.map({
- "in": d3_ease_identity,
- "out": d3_ease_reverse,
- "in-out": d3_ease_reflect,
- "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
-});
-
-d3.ease = function(name) {
- var i = name.indexOf("-"),
- t = i >= 0 ? name.substring(0, i) : name,
- m = i >= 0 ? name.substring(i + 1) : "in";
- t = d3_ease.get(t) || d3_ease_default;
- m = d3_ease_mode.get(m) || d3_ease_identity;
- return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
-};
-
-function d3_ease_clamp(f) {
- return function(t) {
- return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
- };
-}
-
-function d3_ease_reverse(f) {
- return function(t) {
- return 1 - f(1 - t);
- };
-}
-
-function d3_ease_reflect(f) {
- return function(t) {
- return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
- };
-}
-
-function d3_ease_identity(t) {
- return t;
-}
-
-function d3_ease_poly(e) {
- return function(t) {
- return Math.pow(t, e);
- };
-}
-
-function d3_ease_sin(t) {
- return 1 - Math.cos(t * Math.PI / 2);
-}
-
-function d3_ease_exp(t) {
- return Math.pow(2, 10 * (t - 1));
-}
-
-function d3_ease_circle(t) {
- return 1 - Math.sqrt(1 - t * t);
-}
-
-function d3_ease_elastic(a, p) {
- var s;
- if (arguments.length < 2) p = 0.45;
- if (arguments.length < 1) { a = 1; s = p / 4; }
- else s = p / (2 * Math.PI) * Math.asin(1 / a);
- return function(t) {
- return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
- };
-}
-
-function d3_ease_back(s) {
- if (!s) s = 1.70158;
- return function(t) {
- return t * t * ((s + 1) * t - s);
- };
-}
-
-function d3_ease_bounce(t) {
- return t < 1 / 2.75 ? 7.5625 * t * t
- : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75
- : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375
- : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
-}
-d3.event = null;
-
-function d3_eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
-}
-
-function d3_eventSource() {
- var e = d3.event, s;
- while (s = e.sourceEvent) e = s;
- return e;
-}
-
-// Like d3.dispatch, but for custom events abstracting native UI events. These
-// events have a target component (such as a brush), a target element (such as
-// the svg:g element containing the brush) and the standard arguments `d` (the
-// target element's data) and `i` (the selection index of the target element).
-function d3_eventDispatch(target) {
- var dispatch = new d3_dispatch,
- i = 0,
- n = arguments.length;
-
- while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
-
- // Creates a dispatch context for the specified `thiz` (typically, the target
- // DOM element that received the source event) and `argumentz` (typically, the
- // data `d` and index `i` of the target element). The returned function can be
- // used to dispatch an event to any registered listeners; the function takes a
- // single argument as input, being the event to dispatch. The event must have
- // a "type" attribute which corresponds to a type registered in the
- // constructor. This context will automatically populate the "sourceEvent" and
- // "target" attributes of the event, as well as setting the `d3.event` global
- // for the duration of the notification.
- dispatch.of = function(thiz, argumentz) {
- return function(e1) {
- try {
- var e0 =
- e1.sourceEvent = d3.event;
- e1.target = target;
- d3.event = e1;
- dispatch[e1.type].apply(thiz, argumentz);
- } finally {
- d3.event = e0;
- }
- };
- };
-
- return dispatch;
-}
-d3.interpolate = function(a, b) {
- var i = d3.interpolators.length, f;
- while (--i >= 0 && !(f = d3.interpolators[i](a, b)));
- return f;
-};
-
-d3.interpolateNumber = function(a, b) {
- b -= a;
- return function(t) { return a + b * t; };
-};
-
-d3.interpolateRound = function(a, b) {
- b -= a;
- return function(t) { return Math.round(a + b * t); };
-};
-
-d3.interpolateString = function(a, b) {
- var m, // current match
- i, // current index
- j, // current index (for coallescing)
- s0 = 0, // start index of current string prefix
- s1 = 0, // end index of current string prefix
- s = [], // string constants and placeholders
- q = [], // number interpolators
- n, // q.length
- o;
-
- // Reset our regular expression!
- d3_interpolate_number.lastIndex = 0;
-
- // Find all numbers in b.
- for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
- if (m.index) s.push(b.substring(s0, s1 = m.index));
- q.push({i: s.length, x: m[0]});
- s.push(null);
- s0 = d3_interpolate_number.lastIndex;
- }
- if (s0 < b.length) s.push(b.substring(s0));
-
- // Find all numbers in a.
- for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
- o = q[i];
- if (o.x == m[0]) { // The numbers match, so coallesce.
- if (o.i) {
- if (s[o.i + 1] == null) { // This match is followed by another number.
- s[o.i - 1] += o.x;
- s.splice(o.i, 1);
- for (j = i + 1; j < n; ++j) q[j].i--;
- } else { // This match is followed by a string, so coallesce twice.
- s[o.i - 1] += o.x + s[o.i + 1];
- s.splice(o.i, 2);
- for (j = i + 1; j < n; ++j) q[j].i -= 2;
- }
- } else {
- if (s[o.i + 1] == null) { // This match is followed by another number.
- s[o.i] = o.x;
- } else { // This match is followed by a string, so coallesce twice.
- s[o.i] = o.x + s[o.i + 1];
- s.splice(o.i + 1, 1);
- for (j = i + 1; j < n; ++j) q[j].i--;
- }
- }
- q.splice(i, 1);
- n--;
- i--;
- } else {
- o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
- }
- }
-
- // Remove any numbers in b not found in a.
- while (i < n) {
- o = q.pop();
- if (s[o.i + 1] == null) { // This match is followed by another number.
- s[o.i] = o.x;
- } else { // This match is followed by a string, so coallesce twice.
- s[o.i] = o.x + s[o.i + 1];
- s.splice(o.i + 1, 1);
- }
- n--;
- }
-
- // Special optimization for only a single match.
- if (s.length === 1) {
- return s[0] == null ? q[0].x : function() { return b; };
- }
-
- // Otherwise, interpolate each of the numbers and rejoin the string.
- return function(t) {
- for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
- return s.join("");
- };
-};
-
-d3.interpolateTransform = function(a, b) {
- var s = [], // string constants and placeholders
- q = [], // number interpolators
- n,
- A = d3.transform(a),
- B = d3.transform(b),
- ta = A.translate,
- tb = B.translate,
- ra = A.rotate,
- rb = B.rotate,
- wa = A.skew,
- wb = B.skew,
- ka = A.scale,
- kb = B.scale;
-
- if (ta[0] != tb[0] || ta[1] != tb[1]) {
- s.push("translate(", null, ",", null, ")");
- q.push({i: 1, x: d3.interpolateNumber(ta[0], tb[0])}, {i: 3, x: d3.interpolateNumber(ta[1], tb[1])});
- } else if (tb[0] || tb[1]) {
- s.push("translate(" + tb + ")");
- } else {
- s.push("");
- }
-
- if (ra != rb) {
- q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb)});
- } else if (rb) {
- s.push(s.pop() + "rotate(" + rb + ")");
- }
-
- if (wa != wb) {
- q.push({i: s.push(s.pop() + "skewX(", null, ")") - 2, x: d3.interpolateNumber(wa, wb)});
- } else if (wb) {
- s.push(s.pop() + "skewX(" + wb + ")");
- }
-
- if (ka[0] != kb[0] || ka[1] != kb[1]) {
- n = s.push(s.pop() + "scale(", null, ",", null, ")");
- q.push({i: n - 4, x: d3.interpolateNumber(ka[0], kb[0])}, {i: n - 2, x: d3.interpolateNumber(ka[1], kb[1])});
- } else if (kb[0] != 1 || kb[1] != 1) {
- s.push(s.pop() + "scale(" + kb + ")");
- }
-
- n = q.length;
- return function(t) {
- var i = -1, o;
- while (++i < n) s[(o = q[i]).i] = o.x(t);
- return s.join("");
- };
-};
-
-d3.interpolateRgb = function(a, b) {
- a = d3.rgb(a);
- b = d3.rgb(b);
- var ar = a.r,
- ag = a.g,
- ab = a.b,
- br = b.r - ar,
- bg = b.g - ag,
- bb = b.b - ab;
- return function(t) {
- return "#"
- + d3_rgb_hex(Math.round(ar + br * t))
- + d3_rgb_hex(Math.round(ag + bg * t))
- + d3_rgb_hex(Math.round(ab + bb * t));
- };
-};
-
-// interpolates HSL space, but outputs RGB string (for compatibility)
-d3.interpolateHsl = function(a, b) {
- a = d3.hsl(a);
- b = d3.hsl(b);
- var h0 = a.h,
- s0 = a.s,
- l0 = a.l,
- h1 = b.h - h0,
- s1 = b.s - s0,
- l1 = b.l - l0;
- return function(t) {
- return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();
- };
-};
-
-d3.interpolateArray = function(a, b) {
- var x = [],
- c = [],
- na = a.length,
- nb = b.length,
- n0 = Math.min(a.length, b.length),
- i;
- for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
- for (; i < na; ++i) c[i] = a[i];
- for (; i < nb; ++i) c[i] = b[i];
- return function(t) {
- for (i = 0; i < n0; ++i) c[i] = x[i](t);
- return c;
- };
-};
-
-d3.interpolateObject = function(a, b) {
- var i = {},
- c = {},
- k;
- for (k in a) {
- if (k in b) {
- i[k] = d3_interpolateByName(k)(a[k], b[k]);
- } else {
- c[k] = a[k];
- }
- }
- for (k in b) {
- if (!(k in a)) {
- c[k] = b[k];
- }
- }
- return function(t) {
- for (k in i) c[k] = i[k](t);
- return c;
- };
-}
-
-var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;
-
-function d3_interpolateByName(n) {
- return n == "transform"
- ? d3.interpolateTransform
- : d3.interpolate;
-}
-
-d3.interpolators = [
- d3.interpolateObject,
- function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); },
- function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); },
- function(a, b) { return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); },
- function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); }
-];
-function d3_uninterpolateNumber(a, b) {
- b = b - (a = +a) ? 1 / (b - a) : 0;
- return function(x) { return (x - a) * b; };
-}
-
-function d3_uninterpolateClamp(a, b) {
- b = b - (a = +a) ? 1 / (b - a) : 0;
- return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); };
-}
-d3.rgb = function(r, g, b) {
- return arguments.length === 1
- ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b)
- : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
- : d3_rgb(~~r, ~~g, ~~b);
-};
-
-function d3_rgb(r, g, b) {
- return new d3_Rgb(r, g, b);
-}
-
-function d3_Rgb(r, g, b) {
- this.r = r;
- this.g = g;
- this.b = b;
-}
-
-d3_Rgb.prototype.brighter = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- var r = this.r,
- g = this.g,
- b = this.b,
- i = 30;
- if (!r && !g && !b) return d3_rgb(i, i, i);
- if (r && r < i) r = i;
- if (g && g < i) g = i;
- if (b && b < i) b = i;
- return d3_rgb(
- Math.min(255, Math.floor(r / k)),
- Math.min(255, Math.floor(g / k)),
- Math.min(255, Math.floor(b / k)));
-};
-
-d3_Rgb.prototype.darker = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- return d3_rgb(
- Math.floor(k * this.r),
- Math.floor(k * this.g),
- Math.floor(k * this.b));
-};
-
-d3_Rgb.prototype.hsl = function() {
- return d3_rgb_hsl(this.r, this.g, this.b);
-};
-
-d3_Rgb.prototype.toString = function() {
- return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
-};
-
-function d3_rgb_hex(v) {
- return v < 0x10
- ? "0" + Math.max(0, v).toString(16)
- : Math.min(255, v).toString(16);
-}
-
-function d3_rgb_parse(format, rgb, hsl) {
- var r = 0, // red channel; int in [0, 255]
- g = 0, // green channel; int in [0, 255]
- b = 0, // blue channel; int in [0, 255]
- m1, // CSS color specification match
- m2, // CSS color specification type (e.g., rgb)
- name;
-
- /* Handle hsl, rgb. */
- m1 = /([a-z]+)\((.*)\)/i.exec(format);
- if (m1) {
- m2 = m1[2].split(",");
- switch (m1[1]) {
- case "hsl": {
- return hsl(
- parseFloat(m2[0]), // degrees
- parseFloat(m2[1]) / 100, // percentage
- parseFloat(m2[2]) / 100 // percentage
- );
- }
- case "rgb": {
- return rgb(
- d3_rgb_parseNumber(m2[0]),
- d3_rgb_parseNumber(m2[1]),
- d3_rgb_parseNumber(m2[2])
- );
- }
- }
- }
-
- /* Named colors. */
- if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
-
- /* Hexadecimal colors: #rgb and #rrggbb. */
- if (format != null && format.charAt(0) === "#") {
- if (format.length === 4) {
- r = format.charAt(1); r += r;
- g = format.charAt(2); g += g;
- b = format.charAt(3); b += b;
- } else if (format.length === 7) {
- r = format.substring(1, 3);
- g = format.substring(3, 5);
- b = format.substring(5, 7);
- }
- r = parseInt(r, 16);
- g = parseInt(g, 16);
- b = parseInt(b, 16);
- }
-
- return rgb(r, g, b);
-}
-
-function d3_rgb_hsl(r, g, b) {
- var min = Math.min(r /= 255, g /= 255, b /= 255),
- max = Math.max(r, g, b),
- d = max - min,
- h,
- s,
- l = (max + min) / 2;
- if (d) {
- s = l < .5 ? d / (max + min) : d / (2 - max - min);
- if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
- else if (g == max) h = (b - r) / d + 2;
- else h = (r - g) / d + 4;
- h *= 60;
- } else {
- s = h = 0;
- }
- return d3_hsl(h, s, l);
-}
-
-function d3_rgb_parseNumber(c) { // either integer or percentage
- var f = parseFloat(c);
- return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
-}
-
-var d3_rgb_names = d3.map({
- aliceblue: "#f0f8ff",
- antiquewhite: "#faebd7",
- aqua: "#00ffff",
- aquamarine: "#7fffd4",
- azure: "#f0ffff",
- beige: "#f5f5dc",
- bisque: "#ffe4c4",
- black: "#000000",
- blanchedalmond: "#ffebcd",
- blue: "#0000ff",
- blueviolet: "#8a2be2",
- brown: "#a52a2a",
- burlywood: "#deb887",
- cadetblue: "#5f9ea0",
- chartreuse: "#7fff00",
- chocolate: "#d2691e",
- coral: "#ff7f50",
- cornflowerblue: "#6495ed",
- cornsilk: "#fff8dc",
- crimson: "#dc143c",
- cyan: "#00ffff",
- darkblue: "#00008b",
- darkcyan: "#008b8b",
- darkgoldenrod: "#b8860b",
- darkgray: "#a9a9a9",
- darkgreen: "#006400",
- darkgrey: "#a9a9a9",
- darkkhaki: "#bdb76b",
- darkmagenta: "#8b008b",
- darkolivegreen: "#556b2f",
- darkorange: "#ff8c00",
- darkorchid: "#9932cc",
- darkred: "#8b0000",
- darksalmon: "#e9967a",
- darkseagreen: "#8fbc8f",
- darkslateblue: "#483d8b",
- darkslategray: "#2f4f4f",
- darkslategrey: "#2f4f4f",
- darkturquoise: "#00ced1",
- darkviolet: "#9400d3",
- deeppink: "#ff1493",
- deepskyblue: "#00bfff",
- dimgray: "#696969",
- dimgrey: "#696969",
- dodgerblue: "#1e90ff",
- firebrick: "#b22222",
- floralwhite: "#fffaf0",
- forestgreen: "#228b22",
- fuchsia: "#ff00ff",
- gainsboro: "#dcdcdc",
- ghostwhite: "#f8f8ff",
- gold: "#ffd700",
- goldenrod: "#daa520",
- gray: "#808080",
- green: "#008000",
- greenyellow: "#adff2f",
- grey: "#808080",
- honeydew: "#f0fff0",
- hotpink: "#ff69b4",
- indianred: "#cd5c5c",
- indigo: "#4b0082",
- ivory: "#fffff0",
- khaki: "#f0e68c",
- lavender: "#e6e6fa",
- lavenderblush: "#fff0f5",
- lawngreen: "#7cfc00",
- lemonchiffon: "#fffacd",
- lightblue: "#add8e6",
- lightcoral: "#f08080",
- lightcyan: "#e0ffff",
- lightgoldenrodyellow: "#fafad2",
- lightgray: "#d3d3d3",
- lightgreen: "#90ee90",
- lightgrey: "#d3d3d3",
- lightpink: "#ffb6c1",
- lightsalmon: "#ffa07a",
- lightseagreen: "#20b2aa",
- lightskyblue: "#87cefa",
- lightslategray: "#778899",
- lightslategrey: "#778899",
- lightsteelblue: "#b0c4de",
- lightyellow: "#ffffe0",
- lime: "#00ff00",
- limegreen: "#32cd32",
- linen: "#faf0e6",
- magenta: "#ff00ff",
- maroon: "#800000",
- mediumaquamarine: "#66cdaa",
- mediumblue: "#0000cd",
- mediumorchid: "#ba55d3",
- mediumpurple: "#9370db",
- mediumseagreen: "#3cb371",
- mediumslateblue: "#7b68ee",
- mediumspringgreen: "#00fa9a",
- mediumturquoise: "#48d1cc",
- mediumvioletred: "#c71585",
- midnightblue: "#191970",
- mintcream: "#f5fffa",
- mistyrose: "#ffe4e1",
- moccasin: "#ffe4b5",
- navajowhite: "#ffdead",
- navy: "#000080",
- oldlace: "#fdf5e6",
- olive: "#808000",
- olivedrab: "#6b8e23",
- orange: "#ffa500",
- orangered: "#ff4500",
- orchid: "#da70d6",
- palegoldenrod: "#eee8aa",
- palegreen: "#98fb98",
- paleturquoise: "#afeeee",
- palevioletred: "#db7093",
- papayawhip: "#ffefd5",
- peachpuff: "#ffdab9",
- peru: "#cd853f",
- pink: "#ffc0cb",
- plum: "#dda0dd",
- powderblue: "#b0e0e6",
- purple: "#800080",
- red: "#ff0000",
- rosybrown: "#bc8f8f",
- royalblue: "#4169e1",
- saddlebrown: "#8b4513",
- salmon: "#fa8072",
- sandybrown: "#f4a460",
- seagreen: "#2e8b57",
- seashell: "#fff5ee",
- sienna: "#a0522d",
- silver: "#c0c0c0",
- skyblue: "#87ceeb",
- slateblue: "#6a5acd",
- slategray: "#708090",
- slategrey: "#708090",
- snow: "#fffafa",
- springgreen: "#00ff7f",
- steelblue: "#4682b4",
- tan: "#d2b48c",
- teal: "#008080",
- thistle: "#d8bfd8",
- tomato: "#ff6347",
- turquoise: "#40e0d0",
- violet: "#ee82ee",
- wheat: "#f5deb3",
- white: "#ffffff",
- whitesmoke: "#f5f5f5",
- yellow: "#ffff00",
- yellowgreen: "#9acd32"
-});
-
-d3_rgb_names.forEach(function(key, value) {
- d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
-});
-d3.hsl = function(h, s, l) {
- return arguments.length === 1
- ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l)
- : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
- : d3_hsl(+h, +s, +l);
-};
-
-function d3_hsl(h, s, l) {
- return new d3_Hsl(h, s, l);
-}
-
-function d3_Hsl(h, s, l) {
- this.h = h;
- this.s = s;
- this.l = l;
-}
-
-d3_Hsl.prototype.brighter = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- return d3_hsl(this.h, this.s, this.l / k);
-};
-
-d3_Hsl.prototype.darker = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- return d3_hsl(this.h, this.s, k * this.l);
-};
-
-d3_Hsl.prototype.rgb = function() {
- return d3_hsl_rgb(this.h, this.s, this.l);
-};
-
-d3_Hsl.prototype.toString = function() {
- return this.rgb().toString();
-};
-
-function d3_hsl_rgb(h, s, l) {
- var m1,
- m2;
-
- /* Some simple corrections for h, s and l. */
- h = h % 360; if (h < 0) h += 360;
- s = s < 0 ? 0 : s > 1 ? 1 : s;
- l = l < 0 ? 0 : l > 1 ? 1 : l;
-
- /* From FvD 13.37, CSS Color Module Level 3 */
- m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
- m1 = 2 * l - m2;
-
- function v(h) {
- if (h > 360) h -= 360;
- else if (h < 0) h += 360;
- if (h < 60) return m1 + (m2 - m1) * h / 60;
- if (h < 180) return m2;
- if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
- return m1;
- }
-
- function vv(h) {
- return Math.round(v(h) * 255);
- }
-
- return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
-}
-function d3_selection(groups) {
- d3_arraySubclass(groups, d3_selectionPrototype);
- return groups;
-}
-
-var d3_select = function(s, n) { return n.querySelector(s); },
- d3_selectAll = function(s, n) { return n.querySelectorAll(s); },
- d3_selectRoot = document.documentElement,
- d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector,
- d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); };
-
-// Prefer Sizzle, if available.
-if (typeof Sizzle === "function") {
- d3_select = function(s, n) { return Sizzle(s, n)[0]; };
- d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
- d3_selectMatches = Sizzle.matchesSelector;
-}
-
-var d3_selectionPrototype = [];
-
-d3.selection = function() {
- return d3_selectionRoot;
-};
-
-d3.selection.prototype = d3_selectionPrototype;
-d3_selectionPrototype.select = function(selector) {
- var subgroups = [],
- subgroup,
- subnode,
- group,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- subgroups.push(subgroup = []);
- subgroup.parentNode = (group = this[j]).parentNode;
- for (var i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subgroup.push(subnode = selector.call(node, node.__data__, i));
- if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
- } else {
- subgroup.push(null);
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-
-function d3_selection_selector(selector) {
- return function() {
- return d3_select(selector, this);
- };
-}
-d3_selectionPrototype.selectAll = function(selector) {
- var subgroups = [],
- subgroup,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
- subgroup.parentNode = node;
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-
-function d3_selection_selectorAll(selector) {
- return function() {
- return d3_selectAll(selector, this);
- };
-}
-d3_selectionPrototype.attr = function(name, value) {
- name = d3.ns.qualify(name);
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) {
- var node = this.node();
- return name.local
- ? node.getAttributeNS(name.space, name.local)
- : node.getAttribute(name);
- }
-
- function attrNull() {
- this.removeAttribute(name);
- }
-
- function attrNullNS() {
- this.removeAttributeNS(name.space, name.local);
- }
-
- function attrConstant() {
- this.setAttribute(name, value);
- }
-
- function attrConstantNS() {
- this.setAttributeNS(name.space, name.local, value);
- }
-
- function attrFunction() {
- var x = value.apply(this, arguments);
- if (x == null) this.removeAttribute(name);
- else this.setAttribute(name, x);
- }
-
- function attrFunctionNS() {
- var x = value.apply(this, arguments);
- if (x == null) this.removeAttributeNS(name.space, name.local);
- else this.setAttributeNS(name.space, name.local, x);
- }
-
- return this.each(value == null
- ? (name.local ? attrNullNS : attrNull) : (typeof value === "function"
- ? (name.local ? attrFunctionNS : attrFunction)
- : (name.local ? attrConstantNS : attrConstant)));
-};
-d3_selectionPrototype.classed = function(name, value) {
- var names = name.split(d3_selection_classedWhitespace),
- n = names.length,
- i = -1;
- if (arguments.length > 1) {
- while (++i < n) d3_selection_classed.call(this, names[i], value);
- return this;
- } else {
- while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false;
- return true;
- }
-};
-
-var d3_selection_classedWhitespace = /\s+/g;
-
-function d3_selection_classed(name, value) {
- var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) {
- var node = this.node();
- if (c = node.classList) return c.contains(name);
- var c = node.className;
- re.lastIndex = 0;
- return re.test(c.baseVal != null ? c.baseVal : c);
- }
-
- function classedAdd() {
- if (c = this.classList) return c.add(name);
- var c = this.className,
- cb = c.baseVal != null,
- cv = cb ? c.baseVal : c;
- re.lastIndex = 0;
- if (!re.test(cv)) {
- cv = d3_collapse(cv + " " + name);
- if (cb) c.baseVal = cv;
- else this.className = cv;
- }
- }
-
- function classedRemove() {
- if (c = this.classList) return c.remove(name);
- var c = this.className,
- cb = c.baseVal != null,
- cv = cb ? c.baseVal : c;
- cv = d3_collapse(cv.replace(re, " "));
- if (cb) c.baseVal = cv;
- else this.className = cv;
- }
-
- function classedFunction() {
- (value.apply(this, arguments)
- ? classedAdd
- : classedRemove).call(this);
- }
-
- return this.each(typeof value === "function"
- ? classedFunction : value
- ? classedAdd
- : classedRemove);
-}
-d3_selectionPrototype.style = function(name, value, priority) {
- if (arguments.length < 3) priority = "";
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) return window
- .getComputedStyle(this.node(), null)
- .getPropertyValue(name);
-
- function styleNull() {
- this.style.removeProperty(name);
- }
-
- function styleConstant() {
- this.style.setProperty(name, value, priority);
- }
-
- function styleFunction() {
- var x = value.apply(this, arguments);
- if (x == null) this.style.removeProperty(name);
- else this.style.setProperty(name, x, priority);
- }
-
- return this.each(value == null
- ? styleNull : (typeof value === "function"
- ? styleFunction : styleConstant));
-};
-d3_selectionPrototype.property = function(name, value) {
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) return this.node()[name];
-
- function propertyNull() {
- delete this[name];
- }
-
- function propertyConstant() {
- this[name] = value;
- }
-
- function propertyFunction() {
- var x = value.apply(this, arguments);
- if (x == null) delete this[name];
- else this[name] = x;
- }
-
- return this.each(value == null
- ? propertyNull : (typeof value === "function"
- ? propertyFunction : propertyConstant));
-};
-d3_selectionPrototype.text = function(value) {
- return arguments.length < 1
- ? this.node().textContent : this.each(typeof value === "function"
- ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
- ? function() { this.textContent = ""; }
- : function() { this.textContent = value; });
-};
-d3_selectionPrototype.html = function(value) {
- return arguments.length < 1
- ? this.node().innerHTML : this.each(typeof value === "function"
- ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
- ? function() { this.innerHTML = ""; }
- : function() { this.innerHTML = value; });
-};
-// TODO append(node)?
-// TODO append(function)?
-d3_selectionPrototype.append = function(name) {
- name = d3.ns.qualify(name);
-
- function append() {
- return this.appendChild(document.createElementNS(this.namespaceURI, name));
- }
-
- function appendNS() {
- return this.appendChild(document.createElementNS(name.space, name.local));
- }
-
- return this.select(name.local ? appendNS : append);
-};
-// TODO insert(node, function)?
-// TODO insert(function, string)?
-// TODO insert(function, function)?
-d3_selectionPrototype.insert = function(name, before) {
- name = d3.ns.qualify(name);
-
- function insert() {
- return this.insertBefore(
- document.createElementNS(this.namespaceURI, name),
- d3_select(before, this));
- }
-
- function insertNS() {
- return this.insertBefore(
- document.createElementNS(name.space, name.local),
- d3_select(before, this));
- }
-
- return this.select(name.local ? insertNS : insert);
-};
-// TODO remove(selector)?
-// TODO remove(node)?
-// TODO remove(function)?
-d3_selectionPrototype.remove = function() {
- return this.each(function() {
- var parent = this.parentNode;
- if (parent) parent.removeChild(this);
- });
-};
-d3_selectionPrototype.data = function(value, key) {
- var i = -1,
- n = this.length,
- group,
- node;
-
- // If no value is specified, return the first value.
- if (!arguments.length) {
- value = new Array(n = (group = this[0]).length);
- while (++i < n) {
- if (node = group[i]) {
- value[i] = node.__data__;
- }
- }
- return value;
- }
-
- function bind(group, groupData) {
- var i,
- n = group.length,
- m = groupData.length,
- n0 = Math.min(n, m),
- n1 = Math.max(n, m),
- updateNodes = [],
- enterNodes = [],
- exitNodes = [],
- node,
- nodeData;
-
- if (key) {
- var nodeByKeyValue = new d3_Map,
- keyValues = [],
- keyValue,
- j = groupData.length;
-
- for (i = -1; ++i < n;) {
- keyValue = key.call(node = group[i], node.__data__, i);
- if (nodeByKeyValue.has(keyValue)) {
- exitNodes[j++] = node; // duplicate key
- } else {
- nodeByKeyValue.set(keyValue, node);
- }
- keyValues.push(keyValue);
- }
-
- for (i = -1; ++i < m;) {
- keyValue = key.call(groupData, nodeData = groupData[i], i)
- if (nodeByKeyValue.has(keyValue)) {
- updateNodes[i] = node = nodeByKeyValue.get(keyValue);
- node.__data__ = nodeData;
- enterNodes[i] = exitNodes[i] = null;
- } else {
- enterNodes[i] = d3_selection_dataNode(nodeData);
- updateNodes[i] = exitNodes[i] = null;
- }
- nodeByKeyValue.remove(keyValue);
- }
-
- for (i = -1; ++i < n;) {
- if (nodeByKeyValue.has(keyValues[i])) {
- exitNodes[i] = group[i];
- }
- }
- } else {
- for (i = -1; ++i < n0;) {
- node = group[i];
- nodeData = groupData[i];
- if (node) {
- node.__data__ = nodeData;
- updateNodes[i] = node;
- enterNodes[i] = exitNodes[i] = null;
- } else {
- enterNodes[i] = d3_selection_dataNode(nodeData);
- updateNodes[i] = exitNodes[i] = null;
- }
- }
- for (; i < m; ++i) {
- enterNodes[i] = d3_selection_dataNode(groupData[i]);
- updateNodes[i] = exitNodes[i] = null;
- }
- for (; i < n1; ++i) {
- exitNodes[i] = group[i];
- enterNodes[i] = updateNodes[i] = null;
- }
- }
-
- enterNodes.update
- = updateNodes;
-
- enterNodes.parentNode
- = updateNodes.parentNode
- = exitNodes.parentNode
- = group.parentNode;
-
- enter.push(enterNodes);
- update.push(updateNodes);
- exit.push(exitNodes);
- }
-
- var enter = d3_selection_enter([]),
- update = d3_selection([]),
- exit = d3_selection([]);
-
- if (typeof value === "function") {
- while (++i < n) {
- bind(group = this[i], value.call(group, group.parentNode.__data__, i));
- }
- } else {
- while (++i < n) {
- bind(group = this[i], value);
- }
- }
-
- update.enter = function() { return enter; };
- update.exit = function() { return exit; };
- return update;
-};
-
-function d3_selection_dataNode(data) {
- return {__data__: data};
-}
-d3_selectionPrototype.datum =
-d3_selectionPrototype.map = function(value) {
- return arguments.length < 1
- ? this.property("__data__")
- : this.property("__data__", value);
-};
-d3_selectionPrototype.filter = function(filter) {
- var subgroups = [],
- subgroup,
- group,
- node;
-
- if (typeof filter !== "function") filter = d3_selection_filter(filter);
-
- for (var j = 0, m = this.length; j < m; j++) {
- subgroups.push(subgroup = []);
- subgroup.parentNode = (group = this[j]).parentNode;
- for (var i = 0, n = group.length; i < n; i++) {
- if ((node = group[i]) && filter.call(node, node.__data__, i)) {
- subgroup.push(node);
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-
-function d3_selection_filter(selector) {
- return function() {
- return d3_selectMatches(this, selector);
- };
-}
-d3_selectionPrototype.order = function() {
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
- if (node = group[i]) {
- if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
- next = node;
- }
- }
- }
- return this;
-};
-d3_selectionPrototype.sort = function(comparator) {
- comparator = d3_selection_sortComparator.apply(this, arguments);
- for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator);
- return this.order();
-};
-
-function d3_selection_sortComparator(comparator) {
- if (!arguments.length) comparator = d3.ascending;
- return function(a, b) {
- return comparator(a && a.__data__, b && b.__data__);
- };
-}
-// type can be namespaced, e.g., "click.foo"
-// listener can be null for removal
-d3_selectionPrototype.on = function(type, listener, capture) {
- if (arguments.length < 3) capture = false;
-
- // parse the type specifier
- var name = "__on" + type, i = type.indexOf(".");
- if (i > 0) type = type.substring(0, i);
-
- // if called with only one argument, return the current listener
- if (arguments.length < 2) return (i = this.node()[name]) && i._;
-
- // remove the old event listener, and add the new event listener
- return this.each(function(d, i) {
- var node = this,
- o = node[name];
-
- // remove the old listener, if any (using the previously-set capture)
- if (o) {
- node.removeEventListener(type, o, o.$);
- delete node[name];
- }
-
- // add the new listener, if any (remembering the capture flag)
- if (listener) {
- node.addEventListener(type, node[name] = l, l.$ = capture);
- l._ = listener; // stash the unwrapped listener for get
- }
-
- // wrapped event listener that preserves i
- function l(e) {
- var o = d3.event; // Events can be reentrant (e.g., focus).
- d3.event = e;
- try {
- listener.call(node, node.__data__, i);
- } finally {
- d3.event = o;
- }
- }
- });
-};
-d3_selectionPrototype.each = function(callback) {
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- var node = group[i];
- if (node) callback.call(node, node.__data__, i, j);
- }
- }
- return this;
-};
-//
-// Note: assigning to the arguments array simultaneously changes the value of
-// the corresponding argument!
-//
-// TODO The `this` argument probably shouldn't be the first argument to the
-// callback, anyway, since it's redundant. However, that will require a major
-// version bump due to backwards compatibility, so I'm not changing it right
-// away.
-//
-d3_selectionPrototype.call = function(callback) {
- callback.apply(this, (arguments[0] = this, arguments));
- return this;
-};
-d3_selectionPrototype.empty = function() {
- return !this.node();
-};
-d3_selectionPrototype.node = function(callback) {
- for (var j = 0, m = this.length; j < m; j++) {
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- var node = group[i];
- if (node) return node;
- }
- }
- return null;
-};
-d3_selectionPrototype.transition = function() {
- var subgroups = [],
- subgroup,
- node;
-
- for (var j = -1, m = this.length; ++j < m;) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- subgroup.push((node = group[i]) ? {node: node, delay: d3_transitionDelay, duration: d3_transitionDuration} : null);
- }
- }
-
- return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
-};
-var d3_selectionRoot = d3_selection([[document]]);
-
-d3_selectionRoot[0].parentNode = d3_selectRoot;
-
-// TODO fast singleton implementation!
-// TODO select(function)
-d3.select = function(selector) {
- return typeof selector === "string"
- ? d3_selectionRoot.select(selector)
- : d3_selection([[selector]]); // assume node
-};
-
-// TODO selectAll(function)
-d3.selectAll = function(selector) {
- return typeof selector === "string"
- ? d3_selectionRoot.selectAll(selector)
- : d3_selection([d3_array(selector)]); // assume node[]
-};
-function d3_selection_enter(selection) {
- d3_arraySubclass(selection, d3_selection_enterPrototype);
- return selection;
-}
-
-var d3_selection_enterPrototype = [];
-
-d3.selection.enter = d3_selection_enter;
-d3.selection.enter.prototype = d3_selection_enterPrototype;
-
-d3_selection_enterPrototype.append = d3_selectionPrototype.append;
-d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
-d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
-d3_selection_enterPrototype.node = d3_selectionPrototype.node;
-d3_selection_enterPrototype.select = function(selector) {
- var subgroups = [],
- subgroup,
- subnode,
- upgroup,
- group,
- node;
-
- for (var j = -1, m = this.length; ++j < m;) {
- upgroup = (group = this[j]).update;
- subgroups.push(subgroup = []);
- subgroup.parentNode = group.parentNode;
- for (var i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
- subnode.__data__ = node.__data__;
- } else {
- subgroup.push(null);
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-function d3_transition(groups, id, time) {
- d3_arraySubclass(groups, d3_transitionPrototype);
-
- var tweens = new d3_Map,
- event = d3.dispatch("start", "end"),
- ease = d3_transitionEase;
-
- groups.id = id;
-
- groups.time = time;
-
- groups.tween = function(name, tween) {
- if (arguments.length < 2) return tweens.get(name);
- if (tween == null) tweens.remove(name);
- else tweens.set(name, tween);
- return groups;
- };
-
- groups.ease = function(value) {
- if (!arguments.length) return ease;
- ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
- return groups;
- };
-
- groups.each = function(type, listener) {
- if (arguments.length < 2) return d3_transition_each.call(groups, type);
- event.on(type, listener);
- return groups;
- };
-
- d3.timer(function(elapsed) {
- groups.each(function(d, i, j) {
- var tweened = [],
- node = this,
- delay = groups[j][i].delay,
- duration = groups[j][i].duration,
- lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0});
-
- ++lock.count;
-
- delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
-
- function start(elapsed) {
- if (lock.active > id) return stop();
- lock.active = id;
-
- tweens.forEach(function(key, value) {
- if (tween = value.call(node, d, i)) {
- tweened.push(tween);
- }
- });
-
- event.start.call(node, d, i);
- if (!tick(elapsed)) d3.timer(tick, 0, time);
- return 1;
- }
-
- function tick(elapsed) {
- if (lock.active !== id) return stop();
-
- var t = (elapsed - delay) / duration,
- e = ease(t),
- n = tweened.length;
-
- while (n > 0) {
- tweened[--n].call(node, e);
- }
-
- if (t >= 1) {
- stop();
- d3_transitionId = id;
- event.end.call(node, d, i);
- d3_transitionId = 0;
- return 1;
- }
- }
-
- function stop() {
- if (!--lock.count) delete node.__transition__;
- return 1;
- }
- });
- return 1;
- }, 0, time);
-
- return groups;
-}
-
-var d3_transitionRemove = {};
-
-function d3_transitionNull(d, i, a) {
- return a != "" && d3_transitionRemove;
-}
-
-function d3_transitionTween(name, b) {
- var interpolate = d3_interpolateByName(name);
-
- function transitionFunction(d, i, a) {
- var v = b.call(this, d, i);
- return v == null
- ? a != "" && d3_transitionRemove
- : a != v && interpolate(a, v);
- }
-
- function transitionString(d, i, a) {
- return a != b && interpolate(a, b);
- }
-
- return typeof b === "function" ? transitionFunction
- : b == null ? d3_transitionNull
- : (b += "", transitionString);
-}
-
-var d3_transitionPrototype = [],
- d3_transitionNextId = 0,
- d3_transitionId = 0,
- d3_transitionDefaultDelay = 0,
- d3_transitionDefaultDuration = 250,
- d3_transitionDefaultEase = d3.ease("cubic-in-out"),
- d3_transitionDelay = d3_transitionDefaultDelay,
- d3_transitionDuration = d3_transitionDefaultDuration,
- d3_transitionEase = d3_transitionDefaultEase;
-
-d3_transitionPrototype.call = d3_selectionPrototype.call;
-
-d3.transition = function(selection) {
- return arguments.length
- ? (d3_transitionId ? selection.transition() : selection)
- : d3_selectionRoot.transition();
-};
-
-d3.transition.prototype = d3_transitionPrototype;
-d3_transitionPrototype.select = function(selector) {
- var subgroups = [],
- subgroup,
- subnode,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
- if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
- subgroup.push({node: subnode, delay: node.delay, duration: node.duration});
- } else {
- subgroup.push(null);
- }
- }
- }
-
- return d3_transition(subgroups, this.id, this.time).ease(this.ease());
-};
-d3_transitionPrototype.selectAll = function(selector) {
- var subgroups = [],
- subgroup,
- subnodes,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subnodes = selector.call(node.node, node.node.__data__, i);
- subgroups.push(subgroup = []);
- for (var k = -1, o = subnodes.length; ++k < o;) {
- subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration});
- }
- }
- }
- }
-
- return d3_transition(subgroups, this.id, this.time).ease(this.ease());
-};
-d3_transitionPrototype.attr = function(name, value) {
- return this.attrTween(name, d3_transitionTween(name, value));
-};
-
-d3_transitionPrototype.attrTween = function(nameNS, tween) {
- var name = d3.ns.qualify(nameNS);
-
- function attrTween(d, i) {
- var f = tween.call(this, d, i, this.getAttribute(name));
- return f === d3_transitionRemove
- ? (this.removeAttribute(name), null)
- : f && function(t) { this.setAttribute(name, f(t)); };
- }
-
- function attrTweenNS(d, i) {
- var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
- return f === d3_transitionRemove
- ? (this.removeAttributeNS(name.space, name.local), null)
- : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); };
- }
-
- return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
-};
-d3_transitionPrototype.style = function(name, value, priority) {
- if (arguments.length < 3) priority = "";
- return this.styleTween(name, d3_transitionTween(name, value), priority);
-};
-
-d3_transitionPrototype.styleTween = function(name, tween, priority) {
- if (arguments.length < 3) priority = "";
- return this.tween("style." + name, function(d, i) {
- var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
- return f === d3_transitionRemove
- ? (this.style.removeProperty(name), null)
- : f && function(t) { this.style.setProperty(name, f(t), priority); };
- });
-};
-d3_transitionPrototype.text = function(value) {
- return this.tween("text", function(d, i) {
- this.textContent = typeof value === "function"
- ? value.call(this, d, i)
- : value;
- });
-};
-d3_transitionPrototype.remove = function() {
- return this.each("end.transition", function() {
- var p;
- if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
- });
-};
-d3_transitionPrototype.delay = function(value) {
- var groups = this;
- return groups.each(typeof value === "function"
- ? function(d, i, j) { groups[j][i].delay = value.apply(this, arguments) | 0; }
- : (value = value | 0, function(d, i, j) { groups[j][i].delay = value; }));
-};
-d3_transitionPrototype.duration = function(value) {
- var groups = this;
- return groups.each(typeof value === "function"
- ? function(d, i, j) { groups[j][i].duration = Math.max(1, value.apply(this, arguments) | 0); }
- : (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; }));
-};
-function d3_transition_each(callback) {
- var id = d3_transitionId,
- ease = d3_transitionEase,
- delay = d3_transitionDelay,
- duration = d3_transitionDuration;
-
- d3_transitionId = this.id;
- d3_transitionEase = this.ease();
- for (var j = 0, m = this.length; j < m; j++) {
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- var node = group[i];
- if (node) {
- d3_transitionDelay = this[j][i].delay;
- d3_transitionDuration = this[j][i].duration;
- callback.call(node = node.node, node.__data__, i, j);
- }
- }
- }
-
- d3_transitionId = id;
- d3_transitionEase = ease;
- d3_transitionDelay = delay;
- d3_transitionDuration = duration;
- return this;
-}
-d3_transitionPrototype.transition = function() {
- return this.select(d3_this);
-};
-var d3_timer_queue = null,
- d3_timer_interval, // is an interval (or frame) active?
- d3_timer_timeout; // is a timeout active?
-
-// The timer will continue to fire until callback returns true.
-d3.timer = function(callback, delay, then) {
- var found = false,
- t0,
- t1 = d3_timer_queue;
-
- if (arguments.length < 3) {
- if (arguments.length < 2) delay = 0;
- else if (!isFinite(delay)) return;
- then = Date.now();
- }
-
- // See if the callback's already in the queue.
- while (t1) {
- if (t1.callback === callback) {
- t1.then = then;
- t1.delay = delay;
- found = true;
- break;
- }
- t0 = t1;
- t1 = t1.next;
- }
-
- // Otherwise, add the callback to the queue.
- if (!found) d3_timer_queue = {
- callback: callback,
- then: then,
- delay: delay,
- next: d3_timer_queue
- };
-
- // Start animatin'!
- if (!d3_timer_interval) {
- d3_timer_timeout = clearTimeout(d3_timer_timeout);
- d3_timer_interval = 1;
- d3_timer_frame(d3_timer_step);
- }
-}
-
-function d3_timer_step() {
- var elapsed,
- now = Date.now(),
- t1 = d3_timer_queue;
-
- while (t1) {
- elapsed = now - t1.then;
- if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
- t1 = t1.next;
- }
-
- var delay = d3_timer_flush() - now;
- if (delay > 24) {
- if (isFinite(delay)) {
- clearTimeout(d3_timer_timeout);
- d3_timer_timeout = setTimeout(d3_timer_step, delay);
- }
- d3_timer_interval = 0;
- } else {
- d3_timer_interval = 1;
- d3_timer_frame(d3_timer_step);
- }
-}
-
-d3.timer.flush = function() {
- var elapsed,
- now = Date.now(),
- t1 = d3_timer_queue;
-
- while (t1) {
- elapsed = now - t1.then;
- if (!t1.delay) t1.flush = t1.callback(elapsed);
- t1 = t1.next;
- }
-
- d3_timer_flush();
-};
-
-// Flush after callbacks, to avoid concurrent queue modification.
-function d3_timer_flush() {
- var t0 = null,
- t1 = d3_timer_queue,
- then = Infinity;
- while (t1) {
- if (t1.flush) {
- t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
- } else {
- then = Math.min(then, t1.then + t1.delay);
- t1 = (t0 = t1).next;
- }
- }
- return then;
-}
-
-var d3_timer_frame = window.requestAnimationFrame
- || window.webkitRequestAnimationFrame
- || window.mozRequestAnimationFrame
- || window.oRequestAnimationFrame
- || window.msRequestAnimationFrame
- || function(callback) { setTimeout(callback, 17); };
-d3.transform = function(string) {
- var g = document.createElementNS(d3.ns.prefix.svg, "g"),
- identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
- return (d3.transform = function(string) {
- g.setAttribute("transform", string);
- var t = g.transform.baseVal.consolidate();
- return new d3_transform(t ? t.matrix : identity);
- })(string);
-};
-
-// Compute x-scale and normalize the first row.
-// Compute shear and make second row orthogonal to first.
-// Compute y-scale and normalize the second row.
-// Finally, compute the rotation.
-function d3_transform(m) {
- var r0 = [m.a, m.b],
- r1 = [m.c, m.d],
- kx = d3_transformNormalize(r0),
- kz = d3_transformDot(r0, r1),
- ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
- if (r0[0] * r1[1] < r1[0] * r0[1]) {
- r0[0] *= -1;
- r0[1] *= -1;
- kx *= -1;
- kz *= -1;
- }
- this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
- this.translate = [m.e, m.f];
- this.scale = [kx, ky];
- this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
-};
-
-d3_transform.prototype.toString = function() {
- return "translate(" + this.translate
- + ")rotate(" + this.rotate
- + ")skewX(" + this.skew
- + ")scale(" + this.scale
- + ")";
-};
-
-function d3_transformDot(a, b) {
- return a[0] * b[0] + a[1] * b[1];
-}
-
-function d3_transformNormalize(a) {
- var k = Math.sqrt(d3_transformDot(a, a));
- if (k) {
- a[0] /= k;
- a[1] /= k;
- }
- return k;
-}
-
-function d3_transformCombine(a, b, k) {
- a[0] += k * b[0];
- a[1] += k * b[1];
- return a;
-}
-
-var d3_transformDegrees = 180 / Math.PI;
-d3.mouse = function(container) {
- return d3_mousePoint(container, d3_eventSource());
-};
-
-// https://bugs.webkit.org/show_bug.cgi?id=44083
-var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
-
-function d3_mousePoint(container, e) {
- var svg = container.ownerSVGElement || container;
- if (svg.createSVGPoint) {
- var point = svg.createSVGPoint();
- if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
- svg = d3.select(document.body)
- .append("svg")
- .style("position", "absolute")
- .style("top", 0)
- .style("left", 0);
- var ctm = svg[0][0].getScreenCTM();
- d3_mouse_bug44083 = !(ctm.f || ctm.e);
- svg.remove();
- }
- if (d3_mouse_bug44083) {
- point.x = e.pageX;
- point.y = e.pageY;
- } else {
- point.x = e.clientX;
- point.y = e.clientY;
- }
- point = point.matrixTransform(container.getScreenCTM().inverse());
- return [point.x, point.y];
- }
- var rect = container.getBoundingClientRect();
- return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];
-};
-d3.touches = function(container, touches) {
- if (arguments.length < 2) touches = d3_eventSource().touches;
- return touches ? d3_array(touches).map(function(touch) {
- var point = d3_mousePoint(container, touch);
- point.identifier = touch.identifier;
- return point;
- }) : [];
-};
-function d3_noop() {}
-d3.scale = {};
-
-function d3_scaleExtent(domain) {
- var start = domain[0], stop = domain[domain.length - 1];
- return start < stop ? [start, stop] : [stop, start];
-}
-
-function d3_scaleRange(scale) {
- return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
-}
-function d3_scale_nice(domain, nice) {
- var i0 = 0,
- i1 = domain.length - 1,
- x0 = domain[i0],
- x1 = domain[i1],
- dx;
-
- if (x1 < x0) {
- dx = i0; i0 = i1; i1 = dx;
- dx = x0; x0 = x1; x1 = dx;
- }
-
- if (dx = x1 - x0) {
- nice = nice(dx);
- domain[i0] = nice.floor(x0);
- domain[i1] = nice.ceil(x1);
- }
-
- return domain;
-}
-
-function d3_scale_niceDefault() {
- return Math;
-}
-d3.scale.linear = function() {
- return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false);
-};
-
-function d3_scale_linear(domain, range, interpolate, clamp) {
- var output,
- input;
-
- function rescale() {
- var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear,
- uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
- output = linear(domain, range, uninterpolate, interpolate);
- input = linear(range, domain, uninterpolate, d3.interpolate);
- return scale;
- }
-
- function scale(x) {
- return output(x);
- }
-
- // Note: requires range is coercible to number!
- scale.invert = function(y) {
- return input(y);
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x.map(Number);
- return rescale();
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
-
- scale.rangeRound = function(x) {
- return scale.range(x).interpolate(d3.interpolateRound);
- };
-
- scale.clamp = function(x) {
- if (!arguments.length) return clamp;
- clamp = x;
- return rescale();
- };
-
- scale.interpolate = function(x) {
- if (!arguments.length) return interpolate;
- interpolate = x;
- return rescale();
- };
-
- scale.ticks = function(m) {
- return d3_scale_linearTicks(domain, m);
- };
-
- scale.tickFormat = function(m) {
- return d3_scale_linearTickFormat(domain, m);
- };
-
- scale.nice = function() {
- d3_scale_nice(domain, d3_scale_linearNice);
- return rescale();
- };
-
- scale.copy = function() {
- return d3_scale_linear(domain, range, interpolate, clamp);
- };
-
- return rescale();
-}
-
-function d3_scale_linearRebind(scale, linear) {
- return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
-}
-
-function d3_scale_linearNice(dx) {
- dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
- return {
- floor: function(x) { return Math.floor(x / dx) * dx; },
- ceil: function(x) { return Math.ceil(x / dx) * dx; }
- };
-}
-
-function d3_scale_linearTickRange(domain, m) {
- var extent = d3_scaleExtent(domain),
- span = extent[1] - extent[0],
- step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
- err = m / span * step;
-
- // Filter ticks to get closer to the desired count.
- if (err <= .15) step *= 10;
- else if (err <= .35) step *= 5;
- else if (err <= .75) step *= 2;
-
- // Round start and stop values to step interval.
- extent[0] = Math.ceil(extent[0] / step) * step;
- extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive
- extent[2] = step;
- return extent;
-}
-
-function d3_scale_linearTicks(domain, m) {
- return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
-}
-
-function d3_scale_linearTickFormat(domain, m) {
- return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
-}
-function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
- var u = uninterpolate(domain[0], domain[1]),
- i = interpolate(range[0], range[1]);
- return function(x) {
- return i(u(x));
- };
-}
-function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
- var u = [],
- i = [],
- j = 0,
- k = Math.min(domain.length, range.length) - 1;
-
- // Handle descending domains.
- if (domain[k] < domain[0]) {
- domain = domain.slice().reverse();
- range = range.slice().reverse();
- }
-
- while (++j <= k) {
- u.push(uninterpolate(domain[j - 1], domain[j]));
- i.push(interpolate(range[j - 1], range[j]));
- }
-
- return function(x) {
- var j = d3.bisect(domain, x, 1, k) - 1;
- return i[j](u[j](x));
- };
-}
-d3.scale.log = function() {
- return d3_scale_log(d3.scale.linear(), d3_scale_logp);
-};
-
-function d3_scale_log(linear, log) {
- var pow = log.pow;
-
- function scale(x) {
- return linear(log(x));
- }
-
- scale.invert = function(x) {
- return pow(linear.invert(x));
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(pow);
- log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
- pow = log.pow;
- linear.domain(x.map(log));
- return scale;
- };
-
- scale.nice = function() {
- linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
- return scale;
- };
-
- scale.ticks = function() {
- var extent = d3_scaleExtent(linear.domain()),
- ticks = [];
- if (extent.every(isFinite)) {
- var i = Math.floor(extent[0]),
- j = Math.ceil(extent[1]),
- u = pow(extent[0]),
- v = pow(extent[1]);
- if (log === d3_scale_logn) {
- ticks.push(pow(i));
- for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
- } else {
- for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
- ticks.push(pow(i));
- }
- for (i = 0; ticks[i] < u; i++) {} // strip small values
- for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
- ticks = ticks.slice(i, j);
- }
- return ticks;
- };
-
- scale.tickFormat = function(n, format) {
- if (arguments.length < 2) format = d3_scale_logFormat;
- if (arguments.length < 1) return format;
- var k = n / scale.ticks().length,
- f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
- e;
- return function(d) {
- return d / pow(f(log(d) + e)) < k ? format(d) : "";
- };
- };
-
- scale.copy = function() {
- return d3_scale_log(linear.copy(), log);
- };
-
- return d3_scale_linearRebind(scale, linear);
-}
-
-var d3_scale_logFormat = d3.format(".0e");
-
-function d3_scale_logp(x) {
- return Math.log(x < 0 ? 0 : x) / Math.LN10;
-}
-
-function d3_scale_logn(x) {
- return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
-}
-
-d3_scale_logp.pow = function(x) {
- return Math.pow(10, x);
-};
-
-d3_scale_logn.pow = function(x) {
- return -Math.pow(10, -x);
-};
-d3.scale.pow = function() {
- return d3_scale_pow(d3.scale.linear(), 1);
-};
-
-function d3_scale_pow(linear, exponent) {
- var powp = d3_scale_powPow(exponent),
- powb = d3_scale_powPow(1 / exponent);
-
- function scale(x) {
- return linear(powp(x));
- }
-
- scale.invert = function(x) {
- return powb(linear.invert(x));
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(powb);
- linear.domain(x.map(powp));
- return scale;
- };
-
- scale.ticks = function(m) {
- return d3_scale_linearTicks(scale.domain(), m);
- };
-
- scale.tickFormat = function(m) {
- return d3_scale_linearTickFormat(scale.domain(), m);
- };
-
- scale.nice = function() {
- return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
- };
-
- scale.exponent = function(x) {
- if (!arguments.length) return exponent;
- var domain = scale.domain();
- powp = d3_scale_powPow(exponent = x);
- powb = d3_scale_powPow(1 / exponent);
- return scale.domain(domain);
- };
-
- scale.copy = function() {
- return d3_scale_pow(linear.copy(), exponent);
- };
-
- return d3_scale_linearRebind(scale, linear);
-}
-
-function d3_scale_powPow(e) {
- return function(x) {
- return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
- };
-}
-d3.scale.sqrt = function() {
- return d3.scale.pow().exponent(.5);
-};
-d3.scale.ordinal = function() {
- return d3_scale_ordinal([], {t: "range", x: []});
-};
-
-function d3_scale_ordinal(domain, ranger) {
- var index,
- range,
- rangeBand;
-
- function scale(x) {
- return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
- }
-
- function steps(start, step) {
- return d3.range(domain.length).map(function(i) { return start + step * i; });
- }
-
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = [];
- index = new d3_Map;
- var i = -1, n = x.length, xi;
- while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
- return scale[ranger.t](ranger.x, ranger.p);
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- rangeBand = 0;
- ranger = {t: "range", x: x};
- return scale;
- };
-
- scale.rangePoints = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var start = x[0],
- stop = x[1],
- step = (stop - start) / (domain.length - 1 + padding);
- range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
- rangeBand = 0;
- ranger = {t: "rangePoints", x: x, p: padding};
- return scale;
- };
-
- scale.rangeBands = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var reverse = x[1] < x[0],
- start = x[reverse - 0],
- stop = x[1 - reverse],
- step = (stop - start) / (domain.length + padding);
- range = steps(start + step * padding, step);
- if (reverse) range.reverse();
- rangeBand = step * (1 - padding);
- ranger = {t: "rangeBands", x: x, p: padding};
- return scale;
- };
-
- scale.rangeRoundBands = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var reverse = x[1] < x[0],
- start = x[reverse - 0],
- stop = x[1 - reverse],
- step = Math.floor((stop - start) / (domain.length + padding)),
- error = stop - start - (domain.length - padding) * step;
- range = steps(start + Math.round(error / 2), step);
- if (reverse) range.reverse();
- rangeBand = Math.round(step * (1 - padding));
- ranger = {t: "rangeRoundBands", x: x, p: padding};
- return scale;
- };
-
- scale.rangeBand = function() {
- return rangeBand;
- };
-
- scale.rangeExtent = function() {
- return d3_scaleExtent(ranger.x);
- };
-
- scale.copy = function() {
- return d3_scale_ordinal(domain, ranger);
- };
-
- return scale.domain(domain);
-}
-/*
- * This product includes color specifications and designs developed by Cynthia
- * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
- */
-
-d3.scale.category10 = function() {
- return d3.scale.ordinal().range(d3_category10);
-};
-
-d3.scale.category20 = function() {
- return d3.scale.ordinal().range(d3_category20);
-};
-
-d3.scale.category20b = function() {
- return d3.scale.ordinal().range(d3_category20b);
-};
-
-d3.scale.category20c = function() {
- return d3.scale.ordinal().range(d3_category20c);
-};
-
-var d3_category10 = [
- "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
- "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
-];
-
-var d3_category20 = [
- "#1f77b4", "#aec7e8",
- "#ff7f0e", "#ffbb78",
- "#2ca02c", "#98df8a",
- "#d62728", "#ff9896",
- "#9467bd", "#c5b0d5",
- "#8c564b", "#c49c94",
- "#e377c2", "#f7b6d2",
- "#7f7f7f", "#c7c7c7",
- "#bcbd22", "#dbdb8d",
- "#17becf", "#9edae5"
-];
-
-var d3_category20b = [
- "#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
- "#637939", "#8ca252", "#b5cf6b", "#cedb9c",
- "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
- "#843c39", "#ad494a", "#d6616b", "#e7969c",
- "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
-];
-
-var d3_category20c = [
- "#3182bd", "#6baed6", "#9ecae1", "#c6dbef",
- "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2",
- "#31a354", "#74c476", "#a1d99b", "#c7e9c0",
- "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb",
- "#636363", "#969696", "#bdbdbd", "#d9d9d9"
-];
-d3.scale.quantile = function() {
- return d3_scale_quantile([], []);
-};
-
-function d3_scale_quantile(domain, range) {
- var thresholds;
-
- function rescale() {
- var k = 0,
- n = domain.length,
- q = range.length;
- thresholds = [];
- while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
- return scale;
- }
-
- function scale(x) {
- if (isNaN(x = +x)) return NaN;
- return range[d3.bisect(thresholds, x)];
- }
-
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending);
- return rescale();
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
-
- scale.quantiles = function() {
- return thresholds;
- };
-
- scale.copy = function() {
- return d3_scale_quantile(domain, range); // copy on write!
- };
-
- return rescale();
-}
-d3.scale.quantize = function() {
- return d3_scale_quantize(0, 1, [0, 1]);
-};
-
-function d3_scale_quantize(x0, x1, range) {
- var kx, i;
-
- function scale(x) {
- return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
- }
-
- function rescale() {
- kx = range.length / (x1 - x0);
- i = range.length - 1;
- return scale;
- }
-
- scale.domain = function(x) {
- if (!arguments.length) return [x0, x1];
- x0 = +x[0];
- x1 = +x[x.length - 1];
- return rescale();
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
-
- scale.copy = function() {
- return d3_scale_quantize(x0, x1, range); // copy on write
- };
-
- return rescale();
-}
-d3.scale.identity = function() {
- return d3_scale_identity([0, 1]);
-};
-
-function d3_scale_identity(domain) {
-
- function identity(x) { return +x; }
-
- identity.invert = identity;
-
- identity.domain = identity.range = function(x) {
- if (!arguments.length) return domain;
- domain = x.map(identity);
- return identity;
- };
-
- identity.ticks = function(m) {
- return d3_scale_linearTicks(domain, m);
- };
-
- identity.tickFormat = function(m) {
- return d3_scale_linearTickFormat(domain, m);
- };
-
- identity.copy = function() {
- return d3_scale_identity(domain);
- };
-
- return identity;
-}
-d3.svg = {};
-d3.svg.arc = function() {
- var innerRadius = d3_svg_arcInnerRadius,
- outerRadius = d3_svg_arcOuterRadius,
- startAngle = d3_svg_arcStartAngle,
- endAngle = d3_svg_arcEndAngle;
-
- function arc() {
- var r0 = innerRadius.apply(this, arguments),
- r1 = outerRadius.apply(this, arguments),
- a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset,
- a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset,
- da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0),
- df = da < Math.PI ? "0" : "1",
- c0 = Math.cos(a0),
- s0 = Math.sin(a0),
- c1 = Math.cos(a1),
- s1 = Math.sin(a1);
- return da >= d3_svg_arcMax
- ? (r0
- ? "M0," + r1
- + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
- + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
- + "M0," + r0
- + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0)
- + "A" + r0 + "," + r0 + " 0 1,0 0," + r0
- + "Z"
- : "M0," + r1
- + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
- + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
- + "Z")
- : (r0
- ? "M" + r1 * c0 + "," + r1 * s0
- + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
- + "L" + r0 * c1 + "," + r0 * s1
- + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0
- + "Z"
- : "M" + r1 * c0 + "," + r1 * s0
- + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
- + "L0,0"
- + "Z");
- }
-
- arc.innerRadius = function(v) {
- if (!arguments.length) return innerRadius;
- innerRadius = d3.functor(v);
- return arc;
- };
-
- arc.outerRadius = function(v) {
- if (!arguments.length) return outerRadius;
- outerRadius = d3.functor(v);
- return arc;
- };
-
- arc.startAngle = function(v) {
- if (!arguments.length) return startAngle;
- startAngle = d3.functor(v);
- return arc;
- };
-
- arc.endAngle = function(v) {
- if (!arguments.length) return endAngle;
- endAngle = d3.functor(v);
- return arc;
- };
-
- arc.centroid = function() {
- var r = (innerRadius.apply(this, arguments)
- + outerRadius.apply(this, arguments)) / 2,
- a = (startAngle.apply(this, arguments)
- + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
- return [Math.cos(a) * r, Math.sin(a) * r];
- };
-
- return arc;
-};
-
-var d3_svg_arcOffset = -Math.PI / 2,
- d3_svg_arcMax = 2 * Math.PI - 1e-6;
-
-function d3_svg_arcInnerRadius(d) {
- return d.innerRadius;
-}
-
-function d3_svg_arcOuterRadius(d) {
- return d.outerRadius;
-}
-
-function d3_svg_arcStartAngle(d) {
- return d.startAngle;
-}
-
-function d3_svg_arcEndAngle(d) {
- return d.endAngle;
-}
-function d3_svg_line(projection) {
- var x = d3_svg_lineX,
- y = d3_svg_lineY,
- interpolate = d3_svg_lineInterpolatorDefault,
- interpolator = d3_svg_lineInterpolators.get(interpolate),
- tension = .7;
-
- function line(d) {
- return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension);
- }
-
- line.x = function(v) {
- if (!arguments.length) return x;
- x = v;
- return line;
- };
-
- line.y = function(v) {
- if (!arguments.length) return y;
- y = v;
- return line;
- };
-
- line.interpolate = function(v) {
- if (!arguments.length) return interpolate;
- if (!d3_svg_lineInterpolators.has(v += "")) v = d3_svg_lineInterpolatorDefault;
- interpolator = d3_svg_lineInterpolators.get(interpolate = v);
- return line;
- };
-
- line.tension = function(v) {
- if (!arguments.length) return tension;
- tension = v;
- return line;
- };
-
- return line;
-}
-
-d3.svg.line = function() {
- return d3_svg_line(Object);
-};
-
-// Converts the specified array of data into an array of points
-// (x-y tuples), by evaluating the specified `x` and `y` functions on each
-// data point. The `this` context of the evaluated functions is the specified
-// "self" object; each function is passed the current datum and index.
-function d3_svg_linePoints(self, d, x, y) {
- var points = [],
- i = -1,
- n = d.length,
- fx = typeof x === "function",
- fy = typeof y === "function",
- value;
- if (fx && fy) {
- while (++i < n) points.push([
- x.call(self, value = d[i], i),
- y.call(self, value, i)
- ]);
- } else if (fx) {
- while (++i < n) points.push([x.call(self, d[i], i), y]);
- } else if (fy) {
- while (++i < n) points.push([x, y.call(self, d[i], i)]);
- } else {
- while (++i < n) points.push([x, y]);
- }
- return points;
-}
-
-// The default `x` property, which references d[0].
-function d3_svg_lineX(d) {
- return d[0];
-}
-
-// The default `y` property, which references d[1].
-function d3_svg_lineY(d) {
- return d[1];
-}
-
-var d3_svg_lineInterpolatorDefault = "linear";
-
-// The various interpolators supported by the `line` class.
-var d3_svg_lineInterpolators = d3.map({
- "linear": d3_svg_lineLinear,
- "step-before": d3_svg_lineStepBefore,
- "step-after": d3_svg_lineStepAfter,
- "basis": d3_svg_lineBasis,
- "basis-open": d3_svg_lineBasisOpen,
- "basis-closed": d3_svg_lineBasisClosed,
- "bundle": d3_svg_lineBundle,
- "cardinal": d3_svg_lineCardinal,
- "cardinal-open": d3_svg_lineCardinalOpen,
- "cardinal-closed": d3_svg_lineCardinalClosed,
- "monotone": d3_svg_lineMonotone
-});
-
-// Linear interpolation; generates "L" commands.
-function d3_svg_lineLinear(points) {
- var i = 0,
- n = points.length,
- p = points[0],
- path = [p[0], ",", p[1]];
- while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]);
- return path.join("");
-}
-
-// Step interpolation; generates "H" and "V" commands.
-function d3_svg_lineStepBefore(points) {
- var i = 0,
- n = points.length,
- p = points[0],
- path = [p[0], ",", p[1]];
- while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
- return path.join("");
-}
-
-// Step interpolation; generates "H" and "V" commands.
-function d3_svg_lineStepAfter(points) {
- var i = 0,
- n = points.length,
- p = points[0],
- path = [p[0], ",", p[1]];
- while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
- return path.join("");
-}
-
-// Open cardinal spline interpolation; generates "C" commands.
-function d3_svg_lineCardinalOpen(points, tension) {
- return points.length < 4
- ? d3_svg_lineLinear(points)
- : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1),
- d3_svg_lineCardinalTangents(points, tension));
-}
-
-// Closed cardinal spline interpolation; generates "C" commands.
-function d3_svg_lineCardinalClosed(points, tension) {
- return points.length < 3
- ? d3_svg_lineLinear(points)
- : points[0] + d3_svg_lineHermite((points.push(points[0]), points),
- d3_svg_lineCardinalTangents([points[points.length - 2]]
- .concat(points, [points[1]]), tension));
-}
-
-// Cardinal spline interpolation; generates "C" commands.
-function d3_svg_lineCardinal(points, tension, closed) {
- return points.length < 3
- ? d3_svg_lineLinear(points)
- : points[0] + d3_svg_lineHermite(points,
- d3_svg_lineCardinalTangents(points, tension));
-}
-
-// Hermite spline construction; generates "C" commands.
-function d3_svg_lineHermite(points, tangents) {
- if (tangents.length < 1
- || (points.length != tangents.length
- && points.length != tangents.length + 2)) {
- return d3_svg_lineLinear(points);
- }
-
- var quad = points.length != tangents.length,
- path = "",
- p0 = points[0],
- p = points[1],
- t0 = tangents[0],
- t = t0,
- pi = 1;
-
- if (quad) {
- path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3)
- + "," + p[0] + "," + p[1];
- p0 = points[1];
- pi = 2;
- }
-
- if (tangents.length > 1) {
- t = tangents[1];
- p = points[pi];
- pi++;
- path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1])
- + "," + (p[0] - t[0]) + "," + (p[1] - t[1])
- + "," + p[0] + "," + p[1];
- for (var i = 2; i < tangents.length; i++, pi++) {
- p = points[pi];
- t = tangents[i];
- path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1])
- + "," + p[0] + "," + p[1];
- }
- }
-
- if (quad) {
- var lp = points[pi];
- path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3)
- + "," + lp[0] + "," + lp[1];
- }
-
- return path;
-}
-
-// Generates tangents for a cardinal spline.
-function d3_svg_lineCardinalTangents(points, tension) {
- var tangents = [],
- a = (1 - tension) / 2,
- p0,
- p1 = points[0],
- p2 = points[1],
- i = 1,
- n = points.length;
- while (++i < n) {
- p0 = p1;
- p1 = p2;
- p2 = points[i];
- tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
- }
- return tangents;
-}
-
-// B-spline interpolation; generates "C" commands.
-function d3_svg_lineBasis(points) {
- if (points.length < 3) return d3_svg_lineLinear(points);
- var i = 1,
- n = points.length,
- pi = points[0],
- x0 = pi[0],
- y0 = pi[1],
- px = [x0, x0, x0, (pi = points[1])[0]],
- py = [y0, y0, y0, pi[1]],
- path = [x0, ",", y0];
- d3_svg_lineBasisBezier(path, px, py);
- while (++i < n) {
- pi = points[i];
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- i = -1;
- while (++i < 2) {
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
-}
-
-// Open B-spline interpolation; generates "C" commands.
-function d3_svg_lineBasisOpen(points) {
- if (points.length < 4) return d3_svg_lineLinear(points);
- var path = [],
- i = -1,
- n = points.length,
- pi,
- px = [0],
- py = [0];
- while (++i < 3) {
- pi = points[i];
- px.push(pi[0]);
- py.push(pi[1]);
- }
- path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px)
- + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
- --i; while (++i < n) {
- pi = points[i];
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
-}
-
-// Closed B-spline interpolation; generates "C" commands.
-function d3_svg_lineBasisClosed(points) {
- var path,
- i = -1,
- n = points.length,
- m = n + 4,
- pi,
- px = [],
- py = [];
- while (++i < 4) {
- pi = points[i % n];
- px.push(pi[0]);
- py.push(pi[1]);
- }
- path = [
- d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",",
- d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)
- ];
- --i; while (++i < m) {
- pi = points[i % n];
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
-}
-
-function d3_svg_lineBundle(points, tension) {
- var n = points.length - 1,
- x0 = points[0][0],
- y0 = points[0][1],
- dx = points[n][0] - x0,
- dy = points[n][1] - y0,
- i = -1,
- p,
- t;
- while (++i <= n) {
- p = points[i];
- t = i / n;
- p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
- p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
- }
- return d3_svg_lineBasis(points);
-}
-
-// Returns the dot product of the given four-element vectors.
-function d3_svg_lineDot4(a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
-}
-
-// Matrix to transform basis (b-spline) control points to bezier
-// control points. Derived from FvD 11.2.8.
-var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0],
- d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0],
- d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6];
-
-// Pushes a "C" Bézier curve onto the specified path array, given the
-// two specified four-element arrays which define the control points.
-function d3_svg_lineBasisBezier(path, x, y) {
- path.push(
- "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
-}
-
-// Computes the slope from points p0 to p1.
-function d3_svg_lineSlope(p0, p1) {
- return (p1[1] - p0[1]) / (p1[0] - p0[0]);
-}
-
-// Compute three-point differences for the given points.
-// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference
-function d3_svg_lineFiniteDifferences(points) {
- var i = 0,
- j = points.length - 1,
- m = [],
- p0 = points[0],
- p1 = points[1],
- d = m[0] = d3_svg_lineSlope(p0, p1);
- while (++i < j) {
- m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]));
- }
- m[i] = d;
- return m;
-}
-
-// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite
-// interpolation. Returns an array of tangent vectors. For details, see
-// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation
-function d3_svg_lineMonotoneTangents(points) {
- var tangents = [],
- d,
- a,
- b,
- s,
- m = d3_svg_lineFiniteDifferences(points),
- i = -1,
- j = points.length - 1;
-
- // The first two steps are done by computing finite-differences:
- // 1. Compute the slopes of the secant lines between successive points.
- // 2. Initialize the tangents at every point as the average of the secants.
-
- // Then, for each segment…
- while (++i < j) {
- d = d3_svg_lineSlope(points[i], points[i + 1]);
-
- // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set
- // mk = m{k + 1} = 0 as the spline connecting these points must be flat to
- // preserve monotonicity. Ignore step 4 and 5 for those k.
-
- if (Math.abs(d) < 1e-6) {
- m[i] = m[i + 1] = 0;
- } else {
- // 4. Let ak = mk / dk and bk = m{k + 1} / dk.
- a = m[i] / d;
- b = m[i + 1] / d;
-
- // 5. Prevent overshoot and ensure monotonicity by restricting the
- // magnitude of vector <ak, bk> to a circle of radius 3.
- s = a * a + b * b;
- if (s > 9) {
- s = d * 3 / Math.sqrt(s);
- m[i] = s * a;
- m[i + 1] = s * b;
- }
- }
- }
-
- // Compute the normalized tangent vector from the slopes. Note that if x is
- // not monotonic, it's possible that the slope will be infinite, so we protect
- // against NaN by setting the coordinate to zero.
- i = -1; while (++i <= j) {
- s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0])
- / (6 * (1 + m[i] * m[i]));
- tangents.push([s || 0, m[i] * s || 0]);
- }
-
- return tangents;
-}
-
-function d3_svg_lineMonotone(points) {
- return points.length < 3
- ? d3_svg_lineLinear(points)
- : points[0] +
- d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
-}
-d3.svg.line.radial = function() {
- var line = d3_svg_line(d3_svg_lineRadial);
- line.radius = line.x, delete line.x;
- line.angle = line.y, delete line.y;
- return line;
-};
-
-function d3_svg_lineRadial(points) {
- var point,
- i = -1,
- n = points.length,
- r,
- a;
- while (++i < n) {
- point = points[i];
- r = point[0];
- a = point[1] + d3_svg_arcOffset;
- point[0] = r * Math.cos(a);
- point[1] = r * Math.sin(a);
- }
- return points;
-}
-function d3_svg_area(projection) {
- var x0 = d3_svg_lineX,
- x1 = d3_svg_lineX,
- y0 = 0,
- y1 = d3_svg_lineY,
- interpolate,
- i0,
- i1,
- tension = .7;
-
- function area(d) {
- if (d.length < 1) return null;
- var points0 = d3_svg_linePoints(this, d, x0, y0),
- points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1);
- return "M" + i0(projection(points1), tension)
- + "L" + i1(projection(points0.reverse()), tension)
- + "Z";
- }
-
- area.x = function(x) {
- if (!arguments.length) return x1;
- x0 = x1 = x;
- return area;
- };
-
- area.x0 = function(x) {
- if (!arguments.length) return x0;
- x0 = x;
- return area;
- };
-
- area.x1 = function(x) {
- if (!arguments.length) return x1;
- x1 = x;
- return area;
- };
-
- area.y = function(y) {
- if (!arguments.length) return y1;
- y0 = y1 = y;
- return area;
- };
-
- area.y0 = function(y) {
- if (!arguments.length) return y0;
- y0 = y;
- return area;
- };
-
- area.y1 = function(y) {
- if (!arguments.length) return y1;
- y1 = y;
- return area;
- };
-
- area.interpolate = function(x) {
- if (!arguments.length) return interpolate;
- if (!d3_svg_lineInterpolators.has(x += "")) x = d3_svg_lineInterpolatorDefault;
- i0 = d3_svg_lineInterpolators.get(interpolate = x);
- i1 = i0.reverse || i0;
- return area;
- };
-
- area.tension = function(x) {
- if (!arguments.length) return tension;
- tension = x;
- return area;
- };
-
- return area.interpolate("linear");
-}
-
-d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
-d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
-
-d3.svg.area = function() {
- return d3_svg_area(Object);
-};
-
-function d3_svg_areaX(points) {
- return function(d, i) {
- return points[i][0];
- };
-}
-
-function d3_svg_areaY(points) {
- return function(d, i) {
- return points[i][1];
- };
-}
-d3.svg.area.radial = function() {
- var area = d3_svg_area(d3_svg_lineRadial);
- area.radius = area.x, delete area.x;
- area.innerRadius = area.x0, delete area.x0;
- area.outerRadius = area.x1, delete area.x1;
- area.angle = area.y, delete area.y;
- area.startAngle = area.y0, delete area.y0;
- area.endAngle = area.y1, delete area.y1;
- return area;
-};
-d3.svg.chord = function() {
- var source = d3_svg_chordSource,
- target = d3_svg_chordTarget,
- radius = d3_svg_chordRadius,
- startAngle = d3_svg_arcStartAngle,
- endAngle = d3_svg_arcEndAngle;
-
- // TODO Allow control point to be customized.
-
- function chord(d, i) {
- var s = subgroup(this, source, d, i),
- t = subgroup(this, target, d, i);
- return "M" + s.p0
- + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
- ? curve(s.r, s.p1, s.r, s.p0)
- : curve(s.r, s.p1, t.r, t.p0)
- + arc(t.r, t.p1, t.a1 - t.a0)
- + curve(t.r, t.p1, s.r, s.p0))
- + "Z";
- }
-
- function subgroup(self, f, d, i) {
- var subgroup = f.call(self, d, i),
- r = radius.call(self, subgroup, i),
- a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset,
- a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
- return {
- r: r,
- a0: a0,
- a1: a1,
- p0: [r * Math.cos(a0), r * Math.sin(a0)],
- p1: [r * Math.cos(a1), r * Math.sin(a1)]
- };
- }
-
- function equals(a, b) {
- return a.a0 == b.a0 && a.a1 == b.a1;
- }
-
- function arc(r, p, a) {
- return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
- }
-
- function curve(r0, p0, r1, p1) {
- return "Q 0,0 " + p1;
- }
-
- chord.radius = function(v) {
- if (!arguments.length) return radius;
- radius = d3.functor(v);
- return chord;
- };
-
- chord.source = function(v) {
- if (!arguments.length) return source;
- source = d3.functor(v);
- return chord;
- };
-
- chord.target = function(v) {
- if (!arguments.length) return target;
- target = d3.functor(v);
- return chord;
- };
-
- chord.startAngle = function(v) {
- if (!arguments.length) return startAngle;
- startAngle = d3.functor(v);
- return chord;
- };
-
- chord.endAngle = function(v) {
- if (!arguments.length) return endAngle;
- endAngle = d3.functor(v);
- return chord;
- };
-
- return chord;
-};
-
-function d3_svg_chordSource(d) {
- return d.source;
-}
-
-function d3_svg_chordTarget(d) {
- return d.target;
-}
-
-function d3_svg_chordRadius(d) {
- return d.radius;
-}
-
-function d3_svg_chordStartAngle(d) {
- return d.startAngle;
-}
-
-function d3_svg_chordEndAngle(d) {
- return d.endAngle;
-}
-d3.svg.diagonal = function() {
- var source = d3_svg_chordSource,
- target = d3_svg_chordTarget,
- projection = d3_svg_diagonalProjection;
-
- function diagonal(d, i) {
- var p0 = source.call(this, d, i),
- p3 = target.call(this, d, i),
- m = (p0.y + p3.y) / 2,
- p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3];
- p = p.map(projection);
- return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
- }
-
- diagonal.source = function(x) {
- if (!arguments.length) return source;
- source = d3.functor(x);
- return diagonal;
- };
-
- diagonal.target = function(x) {
- if (!arguments.length) return target;
- target = d3.functor(x);
- return diagonal;
- };
-
- diagonal.projection = function(x) {
- if (!arguments.length) return projection;
- projection = x;
- return diagonal;
- };
-
- return diagonal;
-};
-
-function d3_svg_diagonalProjection(d) {
- return [d.x, d.y];
-}
-d3.svg.diagonal.radial = function() {
- var diagonal = d3.svg.diagonal(),
- projection = d3_svg_diagonalProjection,
- projection_ = diagonal.projection;
-
- diagonal.projection = function(x) {
- return arguments.length
- ? projection_(d3_svg_diagonalRadialProjection(projection = x))
- : projection;
- };
-
- return diagonal;
-};
-
-function d3_svg_diagonalRadialProjection(projection) {
- return function() {
- var d = projection.apply(this, arguments),
- r = d[0],
- a = d[1] + d3_svg_arcOffset;
- return [r * Math.cos(a), r * Math.sin(a)];
- };
-}
-d3.svg.mouse = d3.mouse;
-d3.svg.touches = d3.touches;
-d3.svg.symbol = function() {
- var type = d3_svg_symbolType,
- size = d3_svg_symbolSize;
-
- function symbol(d, i) {
- return (d3_svg_symbols.get(type.call(this, d, i))
- || d3_svg_symbolCircle)
- (size.call(this, d, i));
- }
-
- symbol.type = function(x) {
- if (!arguments.length) return type;
- type = d3.functor(x);
- return symbol;
- };
-
- // size of symbol in square pixels
- symbol.size = function(x) {
- if (!arguments.length) return size;
- size = d3.functor(x);
- return symbol;
- };
-
- return symbol;
-};
-
-function d3_svg_symbolSize() {
- return 64;
-}
-
-function d3_svg_symbolType() {
- return "circle";
-}
-
-function d3_svg_symbolCircle(size) {
- var r = Math.sqrt(size / Math.PI);
- return "M0," + r
- + "A" + r + "," + r + " 0 1,1 0," + (-r)
- + "A" + r + "," + r + " 0 1,1 0," + r
- + "Z";
-}
-
-// TODO cross-diagonal?
-var d3_svg_symbols = d3.map({
- "circle": d3_svg_symbolCircle,
- "cross": function(size) {
- var r = Math.sqrt(size / 5) / 2;
- return "M" + -3 * r + "," + -r
- + "H" + -r
- + "V" + -3 * r
- + "H" + r
- + "V" + -r
- + "H" + 3 * r
- + "V" + r
- + "H" + r
- + "V" + 3 * r
- + "H" + -r
- + "V" + r
- + "H" + -3 * r
- + "Z";
- },
- "diamond": function(size) {
- var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)),
- rx = ry * d3_svg_symbolTan30;
- return "M0," + -ry
- + "L" + rx + ",0"
- + " 0," + ry
- + " " + -rx + ",0"
- + "Z";
- },
- "square": function(size) {
- var r = Math.sqrt(size) / 2;
- return "M" + -r + "," + -r
- + "L" + r + "," + -r
- + " " + r + "," + r
- + " " + -r + "," + r
- + "Z";
- },
- "triangle-down": function(size) {
- var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
- ry = rx * d3_svg_symbolSqrt3 / 2;
- return "M0," + ry
- + "L" + rx +"," + -ry
- + " " + -rx + "," + -ry
- + "Z";
- },
- "triangle-up": function(size) {
- var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
- ry = rx * d3_svg_symbolSqrt3 / 2;
- return "M0," + -ry
- + "L" + rx +"," + ry
- + " " + -rx + "," + ry
- + "Z";
- }
-});
-
-d3.svg.symbolTypes = d3_svg_symbols.keys();
-
-var d3_svg_symbolSqrt3 = Math.sqrt(3),
- d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
-d3.svg.axis = function() {
- var scale = d3.scale.linear(),
- orient = "bottom",
- tickMajorSize = 6,
- tickMinorSize = 6,
- tickEndSize = 6,
- tickPadding = 3,
- tickArguments_ = [10],
- tickValues = null,
- tickFormat_,
- tickSubdivide = 0;
-
- function axis(g) {
- g.each(function() {
- var g = d3.select(this);
-
- // Ticks, or domain values for ordinal scales.
- var ticks = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain()) : tickValues,
- tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
-
- // Minor ticks.
- var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
- subtick = g.selectAll(".minor").data(subticks, String),
- subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
- subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(),
- subtickUpdate = d3.transition(subtick).style("opacity", 1);
-
- // Major ticks.
- var tick = g.selectAll("g").data(ticks, String),
- tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
- tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(),
- tickUpdate = d3.transition(tick).style("opacity", 1),
- tickTransform;
-
- // Domain.
- var range = d3_scaleRange(scale),
- path = g.selectAll(".domain").data([0]),
- pathEnter = path.enter().append("path").attr("class", "domain"),
- pathUpdate = d3.transition(path);
-
- // Stash a snapshot of the new scale, and retrieve the old snapshot.
- var scale1 = scale.copy(),
- scale0 = this.__chart__ || scale1;
- this.__chart__ = scale1;
-
- tickEnter.append("line").attr("class", "tick");
- tickEnter.append("text");
- tickUpdate.select("text").text(tickFormat);
-
- switch (orient) {
- case "bottom": {
- tickTransform = d3_svg_axisX;
- subtickEnter.attr("y2", tickMinorSize);
- subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
- tickEnter.select("line").attr("y2", tickMajorSize);
- tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding);
- tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
- tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
- pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
- break;
- }
- case "top": {
- tickTransform = d3_svg_axisX;
- subtickEnter.attr("y2", -tickMinorSize);
- subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
- tickEnter.select("line").attr("y2", -tickMajorSize);
- tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
- tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
- tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
- pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
- break;
- }
- case "left": {
- tickTransform = d3_svg_axisY;
- subtickEnter.attr("x2", -tickMinorSize);
- subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
- tickEnter.select("line").attr("x2", -tickMajorSize);
- tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
- tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
- tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
- pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
- break;
- }
- case "right": {
- tickTransform = d3_svg_axisY;
- subtickEnter.attr("x2", tickMinorSize);
- subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
- tickEnter.select("line").attr("x2", tickMajorSize);
- tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding);
- tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
- tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
- pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
- break;
- }
- }
-
- // For quantitative scales:
- // - enter new ticks from the old scale
- // - exit old ticks to the new scale
- if (scale.ticks) {
- tickEnter.call(tickTransform, scale0);
- tickUpdate.call(tickTransform, scale1);
- tickExit.call(tickTransform, scale1);
- subtickEnter.call(tickTransform, scale0);
- subtickUpdate.call(tickTransform, scale1);
- subtickExit.call(tickTransform, scale1);
- }
-
- // For ordinal scales:
- // - any entering ticks are undefined in the old scale
- // - any exiting ticks are undefined in the new scale
- // Therefore, we only need to transition updating ticks.
- else {
- var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; };
- tickEnter.call(tickTransform, x);
- tickUpdate.call(tickTransform, x);
- }
- });
- }
-
- axis.scale = function(x) {
- if (!arguments.length) return scale;
- scale = x;
- return axis;
- };
-
- axis.orient = function(x) {
- if (!arguments.length) return orient;
- orient = x;
- return axis;
- };
-
- axis.ticks = function() {
- if (!arguments.length) return tickArguments_;
- tickArguments_ = arguments;
- return axis;
- };
-
- axis.tickValues = function(x) {
- if (!arguments.length) return tickValues;
- tickValues = x;
- return axis;
- };
-
- axis.tickFormat = function(x) {
- if (!arguments.length) return tickFormat_;
- tickFormat_ = x;
- return axis;
- };
-
- axis.tickSize = function(x, y, z) {
- if (!arguments.length) return tickMajorSize;
- var n = arguments.length - 1;
- tickMajorSize = +x;
- tickMinorSize = n > 1 ? +y : tickMajorSize;
- tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
- return axis;
- };
-
- axis.tickPadding = function(x) {
- if (!arguments.length) return tickPadding;
- tickPadding = +x;
- return axis;
- };
-
- axis.tickSubdivide = function(x) {
- if (!arguments.length) return tickSubdivide;
- tickSubdivide = +x;
- return axis;
- };
-
- return axis;
-};
-
-function d3_svg_axisX(selection, x) {
- selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; });
-}
-
-function d3_svg_axisY(selection, y) {
- selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; });
-}
-
-function d3_svg_axisSubdivide(scale, ticks, m) {
- subticks = [];
- if (m && ticks.length > 1) {
- var extent = d3_scaleExtent(scale.domain()),
- subticks,
- i = -1,
- n = ticks.length,
- d = (ticks[1] - ticks[0]) / ++m,
- j,
- v;
- while (++i < n) {
- for (j = m; --j > 0;) {
- if ((v = +ticks[i] - j * d) >= extent[0]) {
- subticks.push(v);
- }
- }
- }
- for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) {
- subticks.push(v);
- }
- }
- return subticks;
-}
-d3.svg.brush = function() {
- var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"),
- x = null, // x-scale, optional
- y = null, // y-scale, optional
- resizes = d3_svg_brushResizes[0],
- extent = [[0, 0], [0, 0]], // [x0, y0], [x1, y1], in pixels (integers)
- extentDomain; // the extent in data space, lazily created
-
- function brush(g) {
- g.each(function() {
- var g = d3.select(this),
- bg = g.selectAll(".background").data([0]),
- fg = g.selectAll(".extent").data([0]),
- tz = g.selectAll(".resize").data(resizes, String),
- e;
-
- // Prepare the brush container for events.
- g
- .style("pointer-events", "all")
- .on("mousedown.brush", brushstart)
- .on("touchstart.brush", brushstart);
-
- // An invisible, mouseable area for starting a new brush.
- bg.enter().append("rect")
- .attr("class", "background")
- .style("visibility", "hidden")
- .style("cursor", "crosshair");
-
- // The visible brush extent; style this as you like!
- fg.enter().append("rect")
- .attr("class", "extent")
- .style("cursor", "move");
-
- // More invisible rects for resizing the extent.
- tz.enter().append("g")
- .attr("class", function(d) { return "resize " + d; })
- .style("cursor", function(d) { return d3_svg_brushCursor[d]; })
- .append("rect")
- .attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; })
- .attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; })
- .attr("width", 6)
- .attr("height", 6)
- .style("visibility", "hidden");
-
- // Show or hide the resizers.
- tz.style("display", brush.empty() ? "none" : null);
-
- // Remove any superfluous resizers.
- tz.exit().remove();
-
- // Initialize the background to fill the defined range.
- // If the range isn't defined, you can post-process.
- if (x) {
- e = d3_scaleRange(x);
- bg.attr("x", e[0]).attr("width", e[1] - e[0]);
- redrawX(g);
- }
- if (y) {
- e = d3_scaleRange(y);
- bg.attr("y", e[0]).attr("height", e[1] - e[0]);
- redrawY(g);
- }
- redraw(g);
- });
- }
-
- function redraw(g) {
- g.selectAll(".resize").attr("transform", function(d) {
- return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
- });
- }
-
- function redrawX(g) {
- g.select(".extent").attr("x", extent[0][0]);
- g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
- }
-
- function redrawY(g) {
- g.select(".extent").attr("y", extent[0][1]);
- g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
- }
-
- function brushstart() {
- var target = this,
- eventTarget = d3.select(d3.event.target),
- event_ = event.of(target, arguments),
- g = d3.select(target),
- resizing = eventTarget.datum(),
- resizingX = !/^(n|s)$/.test(resizing) && x,
- resizingY = !/^(e|w)$/.test(resizing) && y,
- dragging = eventTarget.classed("extent"),
- center,
- origin = mouse(),
- offset;
-
- var w = d3.select(window)
- .on("mousemove.brush", brushmove)
- .on("mouseup.brush", brushend)
- .on("touchmove.brush", brushmove)
- .on("touchend.brush", brushend)
- .on("keydown.brush", keydown)
- .on("keyup.brush", keyup);
-
- // If the extent was clicked on, drag rather than brush;
- // store the point between the mouse and extent origin instead.
- if (dragging) {
- origin[0] = extent[0][0] - origin[0];
- origin[1] = extent[0][1] - origin[1];
- }
-
- // If a resizer was clicked on, record which side is to be resized.
- // Also, set the origin to the opposite side.
- else if (resizing) {
- var ex = +/w$/.test(resizing),
- ey = +/^n/.test(resizing);
- offset = [extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1]];
- origin[0] = extent[ex][0];
- origin[1] = extent[ey][1];
- }
-
- // If the ALT key is down when starting a brush, the center is at the mouse.
- else if (d3.event.altKey) center = origin.slice();
-
- // Propagate the active cursor to the body for the drag duration.
- g.style("pointer-events", "none").selectAll(".resize").style("display", null);
- d3.select("body").style("cursor", eventTarget.style("cursor"));
-
- // Notify listeners.
- event_({type: "brushstart"});
- brushmove();
- d3_eventCancel();
-
- function mouse() {
- var touches = d3.event.changedTouches;
- return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
- }
-
- function keydown() {
- if (d3.event.keyCode == 32) {
- if (!dragging) {
- center = null;
- origin[0] -= extent[1][0];
- origin[1] -= extent[1][1];
- dragging = 2;
- }
- d3_eventCancel();
- }
- }
-
- function keyup() {
- if (d3.event.keyCode == 32 && dragging == 2) {
- origin[0] += extent[1][0];
- origin[1] += extent[1][1];
- dragging = 0;
- d3_eventCancel();
- }
- }
-
- function brushmove() {
- var point = mouse(),
- moved = false;
-
- // Preserve the offset for thick resizers.
- if (offset) {
- point[0] += offset[0];
- point[1] += offset[1];
- }
-
- if (!dragging) {
-
- // If needed, determine the center from the current extent.
- if (d3.event.altKey) {
- if (!center) center = [(extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2];
-
- // Update the origin, for when the ALT key is released.
- origin[0] = extent[+(point[0] < center[0])][0];
- origin[1] = extent[+(point[1] < center[1])][1];
- }
-
- // When the ALT key is released, we clear the center.
- else center = null;
- }
-
- // Update the brush extent for each dimension.
- if (resizingX && move1(point, x, 0)) {
- redrawX(g);
- moved = true;
- }
- if (resizingY && move1(point, y, 1)) {
- redrawY(g);
- moved = true;
- }
-
- // Final redraw and notify listeners.
- if (moved) {
- redraw(g);
- event_({type: "brush", mode: dragging ? "move" : "resize"});
- }
- }
-
- function move1(point, scale, i) {
- var range = d3_scaleRange(scale),
- r0 = range[0],
- r1 = range[1],
- position = origin[i],
- size = extent[1][i] - extent[0][i],
- min,
- max;
-
- // When dragging, reduce the range by the extent size and position.
- if (dragging) {
- r0 -= position;
- r1 -= size + position;
- }
-
- // Clamp the point so that the extent fits within the range extent.
- min = Math.max(r0, Math.min(r1, point[i]));
-
- // Compute the new extent bounds.
- if (dragging) {
- max = (min += position) + size;
- } else {
-
- // If the ALT key is pressed, then preserve the center of the extent.
- if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
-
- // Compute the min and max of the position and point.
- if (position < min) {
- max = min;
- min = position;
- } else {
- max = position;
- }
- }
-
- // Update the stored bounds.
- if (extent[0][i] !== min || extent[1][i] !== max) {
- extentDomain = null;
- extent[0][i] = min;
- extent[1][i] = max;
- return true;
- }
- }
-
- function brushend() {
- brushmove();
-
- // reset the cursor styles
- g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
- d3.select("body").style("cursor", null);
-
- w .on("mousemove.brush", null)
- .on("mouseup.brush", null)
- .on("touchmove.brush", null)
- .on("touchend.brush", null)
- .on("keydown.brush", null)
- .on("keyup.brush", null);
-
- event_({type: "brushend"});
- d3_eventCancel();
- }
- }
-
- brush.x = function(z) {
- if (!arguments.length) return x;
- x = z;
- resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
- return brush;
- };
-
- brush.y = function(z) {
- if (!arguments.length) return y;
- y = z;
- resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
- return brush;
- };
-
- brush.extent = function(z) {
- var x0, x1, y0, y1, t;
-
- // Invert the pixel extent to data-space.
- if (!arguments.length) {
- z = extentDomain || extent;
- if (x) {
- x0 = z[0][0], x1 = z[1][0];
- if (!extentDomain) {
- x0 = extent[0][0], x1 = extent[1][0];
- if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
- if (x1 < x0) t = x0, x0 = x1, x1 = t;
- }
- }
- if (y) {
- y0 = z[0][1], y1 = z[1][1];
- if (!extentDomain) {
- y0 = extent[0][1], y1 = extent[1][1];
- if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
- if (y1 < y0) t = y0, y0 = y1, y1 = t;
- }
- }
- return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
- }
-
- // Scale the data-space extent to pixels.
- extentDomain = [[0, 0], [0, 0]];
- if (x) {
- x0 = z[0], x1 = z[1];
- if (y) x0 = x0[0], x1 = x1[0];
- extentDomain[0][0] = x0, extentDomain[1][0] = x1;
- if (x.invert) x0 = x(x0), x1 = x(x1);
- if (x1 < x0) t = x0, x0 = x1, x1 = t;
- extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
- }
- if (y) {
- y0 = z[0], y1 = z[1];
- if (x) y0 = y0[1], y1 = y1[1];
- extentDomain[0][1] = y0, extentDomain[1][1] = y1;
- if (y.invert) y0 = y(y0), y1 = y(y1);
- if (y1 < y0) t = y0, y0 = y1, y1 = t;
- extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
- }
-
- return brush;
- };
-
- brush.clear = function() {
- extentDomain = null;
- extent[0][0] =
- extent[0][1] =
- extent[1][0] =
- extent[1][1] = 0;
- return brush;
- };
-
- brush.empty = function() {
- return (x && extent[0][0] === extent[1][0])
- || (y && extent[0][1] === extent[1][1]);
- };
-
- return d3.rebind(brush, event, "on");
-};
-
-var d3_svg_brushCursor = {
- n: "ns-resize",
- e: "ew-resize",
- s: "ns-resize",
- w: "ew-resize",
- nw: "nwse-resize",
- ne: "nesw-resize",
- se: "nwse-resize",
- sw: "nesw-resize"
-};
-
-var d3_svg_brushResizes = [
- ["n", "e", "s", "w", "nw", "ne", "se", "sw"],
- ["e", "w"],
- ["n", "s"],
- []
-];
-d3.behavior = {};
-// TODO Track touch points by identifier.
-
-d3.behavior.drag = function() {
- var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"),
- origin = null;
-
- function drag() {
- this.on("mousedown.drag", mousedown)
- .on("touchstart.drag", mousedown);
- }
-
- function mousedown() {
- var target = this,
- event_ = event.of(target, arguments),
- eventTarget = d3.event.target,
- offset,
- origin_ = point(),
- moved = 0;
-
- var w = d3.select(window)
- .on("mousemove.drag", dragmove)
- .on("touchmove.drag", dragmove)
- .on("mouseup.drag", dragend, true)
- .on("touchend.drag", dragend, true);
-
- if (origin) {
- offset = origin.apply(target, arguments);
- offset = [offset.x - origin_[0], offset.y - origin_[1]];
- } else {
- offset = [0, 0];
- }
-
- event_({type: "dragstart"});
-
- function point() {
- var p = target.parentNode,
- t = d3.event.changedTouches;
- return t ? d3.touches(p, t)[0] : d3.mouse(p);
- }
-
- function dragmove() {
- if (!target.parentNode) return dragend(); // target removed from DOM
-
- var p = point(),
- dx = p[0] - origin_[0],
- dy = p[1] - origin_[1];
-
- moved |= dx | dy;
- origin_ = p;
- d3_eventCancel();
-
- event_({type: "drag", x: p[0] + offset[0], y: p[1] + offset[1], dx: dx, dy: dy});
- }
-
- function dragend() {
- event_({type: "dragend"});
-
- // if moved, prevent the mouseup (and possibly click) from propagating
- if (moved) {
- d3_eventCancel();
- if (d3.event.target === eventTarget) w.on("click.drag", click, true);
- }
-
- w .on("mousemove.drag", null)
- .on("touchmove.drag", null)
- .on("mouseup.drag", null)
- .on("touchend.drag", null);
- }
-
- // prevent the subsequent click from propagating (e.g., for anchors)
- function click() {
- d3_eventCancel();
- w.on("click.drag", null);
- }
- }
-
- drag.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- return drag;
- };
-
- return d3.rebind(drag, event, "on");
-};
-d3.behavior.zoom = function() {
- var translate = [0, 0],
- translate0, // translate when we started zooming (to avoid drift)
- scale = 1,
- scale0, // scale when we started touching
- scaleExtent = d3_behavior_zoomInfinity,
- event = d3_eventDispatch(zoom, "zoom"),
- x0,
- x1,
- y0,
- y1,
- touchtime; // time of last touchstart (to detect double-tap)
-
- function zoom() {
- this
- .on("mousedown.zoom", mousedown)
- .on("mousewheel.zoom", mousewheel)
- .on("mousemove.zoom", mousemove)
- .on("DOMMouseScroll.zoom", mousewheel)
- .on("dblclick.zoom", dblclick)
- .on("touchstart.zoom", touchstart)
- .on("touchmove.zoom", touchmove)
- .on("touchend.zoom", touchstart);
- }
-
- zoom.translate = function(x) {
- if (!arguments.length) return translate;
- translate = x.map(Number);
- return zoom;
- };
-
- zoom.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return zoom;
- };
-
- zoom.scaleExtent = function(x) {
- if (!arguments.length) return scaleExtent;
- scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
- return zoom;
- };
-
- zoom.x = function(z) {
- if (!arguments.length) return x1;
- x1 = z;
- x0 = z.copy();
- return zoom;
- };
-
- zoom.y = function(z) {
- if (!arguments.length) return y1;
- y1 = z;
- y0 = z.copy();
- return zoom;
- };
-
- function location(p) {
- return [(p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale];
- }
-
- function point(l) {
- return [l[0] * scale + translate[0], l[1] * scale + translate[1]];
- }
-
- function scaleTo(s) {
- scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
- }
-
- function translateTo(p, l) {
- l = point(l);
- translate[0] += p[0] - l[0];
- translate[1] += p[1] - l[1];
- }
-
- function dispatch(event) {
- if (x1) x1.domain(x0.range().map(function(x) { return (x - translate[0]) / scale; }).map(x0.invert));
- if (y1) y1.domain(y0.range().map(function(y) { return (y - translate[1]) / scale; }).map(y0.invert));
- d3.event.preventDefault();
- event({type: "zoom", scale: scale, translate: translate});
- }
-
- function mousedown() {
- var target = this,
- event_ = event.of(target, arguments),
- eventTarget = d3.event.target,
- moved = 0,
- w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup),
- l = location(d3.mouse(target));
-
- window.focus();
- d3_eventCancel();
-
- function mousemove() {
- moved = 1;
- translateTo(d3.mouse(target), l);
- dispatch(event_);
- }
-
- function mouseup() {
- if (moved) d3_eventCancel();
- w.on("mousemove.zoom", null).on("mouseup.zoom", null);
- if (moved && d3.event.target === eventTarget) w.on("click.zoom", click);
- }
-
- function click() {
- d3_eventCancel();
- w.on("click.zoom", null);
- }
- }
-
- function mousewheel() {
- if (!translate0) translate0 = location(d3.mouse(this));
- scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
- translateTo(d3.mouse(this), translate0);
- dispatch(event.of(this, arguments));
- }
-
- function mousemove() {
- translate0 = null;
- }
-
- function dblclick() {
- var p = d3.mouse(this), l = location(p);
- scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
- translateTo(p, l);
- dispatch(event.of(this, arguments));
- }
-
- function touchstart() {
- var touches = d3.touches(this),
- now = Date.now();
-
- scale0 = scale;
- translate0 = {};
- touches.forEach(function(t) { translate0[t.identifier] = location(t); });
- d3_eventCancel();
-
- if ((touches.length === 1) && (now - touchtime < 500)) { // dbltap
- var p = touches[0], l = location(touches[0]);
- scaleTo(scale * 2);
- translateTo(p, l);
- dispatch(event.of(this, arguments));
- }
- touchtime = now;
- }
-
- function touchmove() {
- var touches = d3.touches(this),
- p0 = touches[0],
- l0 = translate0[p0.identifier];
- if (p1 = touches[1]) {
- var p1, l1 = translate0[p1.identifier];
- p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
- l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
- scaleTo(d3.event.scale * scale0);
- }
- translateTo(p0, l0);
- dispatch(event.of(this, arguments));
- }
-
- return d3.rebind(zoom, event, "on");
-};
-
-var d3_behavior_zoomDiv, // for interpreting mousewheel events
- d3_behavior_zoomInfinity = [0, Infinity]; // default scale extent
-
-function d3_behavior_zoomDelta() {
-
- // mousewheel events are totally broken!
- // https://bugs.webkit.org/show_bug.cgi?id=40441
- // not only that, but Chrome and Safari differ in re. to acceleration!
- if (!d3_behavior_zoomDiv) {
- d3_behavior_zoomDiv = d3.select("body").append("div")
- .style("visibility", "hidden")
- .style("top", 0)
- .style("height", 0)
- .style("width", 0)
- .style("overflow-y", "scroll")
- .append("div")
- .style("height", "2000px")
- .node().parentNode;
- }
-
- var e = d3.event, delta;
- try {
- d3_behavior_zoomDiv.scrollTop = 1000;
- d3_behavior_zoomDiv.dispatchEvent(e);
- delta = 1000 - d3_behavior_zoomDiv.scrollTop;
- } catch (error) {
- delta = e.wheelDelta || (-e.detail * 5);
- }
-
- return delta;
-}
-d3.layout = {};
-// Implements hierarchical edge bundling using Holten's algorithm. For each
-// input link, a path is computed that travels through the tree, up the parent
-// hierarchy to the least common ancestor, and then back down to the destination
-// node. Each path is simply an array of nodes.
-d3.layout.bundle = function() {
- return function(links) {
- var paths = [],
- i = -1,
- n = links.length;
- while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
- return paths;
- };
-};
-
-function d3_layout_bundlePath(link) {
- var start = link.source,
- end = link.target,
- lca = d3_layout_bundleLeastCommonAncestor(start, end),
- points = [start];
- while (start !== lca) {
- start = start.parent;
- points.push(start);
- }
- var k = points.length;
- while (end !== lca) {
- points.splice(k, 0, end);
- end = end.parent;
- }
- return points;
-}
-
-function d3_layout_bundleAncestors(node) {
- var ancestors = [],
- parent = node.parent;
- while (parent != null) {
- ancestors.push(node);
- node = parent;
- parent = parent.parent;
- }
- ancestors.push(node);
- return ancestors;
-}
-
-function d3_layout_bundleLeastCommonAncestor(a, b) {
- if (a === b) return a;
- var aNodes = d3_layout_bundleAncestors(a),
- bNodes = d3_layout_bundleAncestors(b),
- aNode = aNodes.pop(),
- bNode = bNodes.pop(),
- sharedNode = null;
- while (aNode === bNode) {
- sharedNode = aNode;
- aNode = aNodes.pop();
- bNode = bNodes.pop();
- }
- return sharedNode;
-}
-d3.layout.chord = function() {
- var chord = {},
- chords,
- groups,
- matrix,
- n,
- padding = 0,
- sortGroups,
- sortSubgroups,
- sortChords;
-
- function relayout() {
- var subgroups = {},
- groupSums = [],
- groupIndex = d3.range(n),
- subgroupIndex = [],
- k,
- x,
- x0,
- i,
- j;
-
- chords = [];
- groups = [];
-
- // Compute the sum.
- k = 0, i = -1; while (++i < n) {
- x = 0, j = -1; while (++j < n) {
- x += matrix[i][j];
- }
- groupSums.push(x);
- subgroupIndex.push(d3.range(n));
- k += x;
- }
-
- // Sort groups…
- if (sortGroups) {
- groupIndex.sort(function(a, b) {
- return sortGroups(groupSums[a], groupSums[b]);
- });
- }
-
- // Sort subgroups…
- if (sortSubgroups) {
- subgroupIndex.forEach(function(d, i) {
- d.sort(function(a, b) {
- return sortSubgroups(matrix[i][a], matrix[i][b]);
- });
- });
- }
-
- // Convert the sum to scaling factor for [0, 2pi].
- // TODO Allow start and end angle to be specified.
- // TODO Allow padding to be specified as percentage?
- k = (2 * Math.PI - padding * n) / k;
-
- // Compute the start and end angle for each group and subgroup.
- // Note: Opera has a bug reordering object literal properties!
- x = 0, i = -1; while (++i < n) {
- x0 = x, j = -1; while (++j < n) {
- var di = groupIndex[i],
- dj = subgroupIndex[di][j],
- v = matrix[di][dj],
- a0 = x,
- a1 = x += v * k;
- subgroups[di + "-" + dj] = {
- index: di,
- subindex: dj,
- startAngle: a0,
- endAngle: a1,
- value: v
- };
- }
- groups.push({
- index: di,
- startAngle: x0,
- endAngle: x,
- value: (x - x0) / k
- });
- x += padding;
- }
-
- // Generate chords for each (non-empty) subgroup-subgroup link.
- i = -1; while (++i < n) {
- j = i - 1; while (++j < n) {
- var source = subgroups[i + "-" + j],
- target = subgroups[j + "-" + i];
- if (source.value || target.value) {
- chords.push(source.value < target.value
- ? {source: target, target: source}
- : {source: source, target: target});
- }
- }
- }
-
- if (sortChords) resort();
- }
-
- function resort() {
- chords.sort(function(a, b) {
- return sortChords(
- (a.source.value + a.target.value) / 2,
- (b.source.value + b.target.value) / 2);
- });
- }
-
- chord.matrix = function(x) {
- if (!arguments.length) return matrix;
- n = (matrix = x) && matrix.length;
- chords = groups = null;
- return chord;
- };
-
- chord.padding = function(x) {
- if (!arguments.length) return padding;
- padding = x;
- chords = groups = null;
- return chord;
- };
-
- chord.sortGroups = function(x) {
- if (!arguments.length) return sortGroups;
- sortGroups = x;
- chords = groups = null;
- return chord;
- };
-
- chord.sortSubgroups = function(x) {
- if (!arguments.length) return sortSubgroups;
- sortSubgroups = x;
- chords = null;
- return chord;
- };
-
- chord.sortChords = function(x) {
- if (!arguments.length) return sortChords;
- sortChords = x;
- if (chords) resort();
- return chord;
- };
-
- chord.chords = function() {
- if (!chords) relayout();
- return chords;
- };
-
- chord.groups = function() {
- if (!groups) relayout();
- return groups;
- };
-
- return chord;
-};
-// A rudimentary force layout using Gauss-Seidel.
-d3.layout.force = function() {
- var force = {},
- event = d3.dispatch("start", "tick", "end"),
- size = [1, 1],
- drag,
- alpha,
- friction = .9,
- linkDistance = d3_layout_forceLinkDistance,
- linkStrength = d3_layout_forceLinkStrength,
- charge = -30,
- gravity = .1,
- theta = .8,
- interval,
- nodes = [],
- links = [],
- distances,
- strengths,
- charges;
-
- function repulse(node) {
- return function(quad, x1, y1, x2, y2) {
- if (quad.point !== node) {
- var dx = quad.cx - node.x,
- dy = quad.cy - node.y,
- dn = 1 / Math.sqrt(dx * dx + dy * dy);
-
- /* Barnes-Hut criterion. */
- if ((x2 - x1) * dn < theta) {
- var k = quad.charge * dn * dn;
- node.px -= dx * k;
- node.py -= dy * k;
- return true;
- }
-
- if (quad.point && isFinite(dn)) {
- var k = quad.pointCharge * dn * dn;
- node.px -= dx * k;
- node.py -= dy * k;
- }
- }
- return !quad.charge;
- };
- }
-
- force.tick = function() {
- // simulated annealing, basically
- if ((alpha *= .99) < .005) {
- event.end({type: "end", alpha: alpha = 0});
- return true;
- }
-
- var n = nodes.length,
- m = links.length,
- q,
- i, // current index
- o, // current object
- s, // current source
- t, // current target
- l, // current distance
- k, // current force
- x, // x-distance
- y; // y-distance
-
- // gauss-seidel relaxation for links
- for (i = 0; i < m; ++i) {
- o = links[i];
- s = o.source;
- t = o.target;
- x = t.x - s.x;
- y = t.y - s.y;
- if (l = (x * x + y * y)) {
- l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
- x *= l;
- y *= l;
- t.x -= x * (k = s.weight / (t.weight + s.weight));
- t.y -= y * k;
- s.x += x * (k = 1 - k);
- s.y += y * k;
- }
- }
-
- // apply gravity forces
- if (k = alpha * gravity) {
- x = size[0] / 2;
- y = size[1] / 2;
- i = -1; if (k) while (++i < n) {
- o = nodes[i];
- o.x += (x - o.x) * k;
- o.y += (y - o.y) * k;
- }
- }
-
- // compute quadtree center of mass and apply charge forces
- if (charge) {
- d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
- i = -1; while (++i < n) {
- if (!(o = nodes[i]).fixed) {
- q.visit(repulse(o));
- }
- }
- }
-
- // position verlet integration
- i = -1; while (++i < n) {
- o = nodes[i];
- if (o.fixed) {
- o.x = o.px;
- o.y = o.py;
- } else {
- o.x -= (o.px - (o.px = o.x)) * friction;
- o.y -= (o.py - (o.py = o.y)) * friction;
- }
- }
-
- event.tick({type: "tick", alpha: alpha});
- };
-
- force.nodes = function(x) {
- if (!arguments.length) return nodes;
- nodes = x;
- return force;
- };
-
- force.links = function(x) {
- if (!arguments.length) return links;
- links = x;
- return force;
- };
-
- force.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return force;
- };
-
- force.linkDistance = function(x) {
- if (!arguments.length) return linkDistance;
- linkDistance = d3.functor(x);
- return force;
- };
-
- // For backwards-compatibility.
- force.distance = force.linkDistance;
-
- force.linkStrength = function(x) {
- if (!arguments.length) return linkStrength;
- linkStrength = d3.functor(x);
- return force;
- };
-
- force.friction = function(x) {
- if (!arguments.length) return friction;
- friction = x;
- return force;
- };
-
- force.charge = function(x) {
- if (!arguments.length) return charge;
- charge = typeof x === "function" ? x : +x;
- return force;
- };
-
- force.gravity = function(x) {
- if (!arguments.length) return gravity;
- gravity = x;
- return force;
- };
-
- force.theta = function(x) {
- if (!arguments.length) return theta;
- theta = x;
- return force;
- };
-
- force.alpha = function(x) {
- if (!arguments.length) return alpha;
-
- if (alpha) { // if we're already running
- if (x > 0) alpha = x; // we might keep it hot
- else alpha = 0; // or, next tick will dispatch "end"
- } else if (x > 0) { // otherwise, fire it up!
- event.start({type: "start", alpha: alpha = x});
- d3.timer(force.tick);
- }
-
- return force;
- };
-
- force.start = function() {
- var i,
- j,
- n = nodes.length,
- m = links.length,
- w = size[0],
- h = size[1],
- neighbors,
- o;
-
- for (i = 0; i < n; ++i) {
- (o = nodes[i]).index = i;
- o.weight = 0;
- }
-
- distances = [];
- strengths = [];
- for (i = 0; i < m; ++i) {
- o = links[i];
- if (typeof o.source == "number") o.source = nodes[o.source];
- if (typeof o.target == "number") o.target = nodes[o.target];
- distances[i] = linkDistance.call(this, o, i);
- strengths[i] = linkStrength.call(this, o, i);
- ++o.source.weight;
- ++o.target.weight;
- }
-
- for (i = 0; i < n; ++i) {
- o = nodes[i];
- if (isNaN(o.x)) o.x = position("x", w);
- if (isNaN(o.y)) o.y = position("y", h);
- if (isNaN(o.px)) o.px = o.x;
- if (isNaN(o.py)) o.py = o.y;
- }
-
- charges = [];
- if (typeof charge === "function") {
- for (i = 0; i < n; ++i) {
- charges[i] = +charge.call(this, nodes[i], i);
- }
- } else {
- for (i = 0; i < n; ++i) {
- charges[i] = charge;
- }
- }
-
- // initialize node position based on first neighbor
- function position(dimension, size) {
- var neighbors = neighbor(i),
- j = -1,
- m = neighbors.length,
- x;
- while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
- return Math.random() * size;
- }
-
- // initialize neighbors lazily
- function neighbor() {
- if (!neighbors) {
- neighbors = [];
- for (j = 0; j < n; ++j) {
- neighbors[j] = [];
- }
- for (j = 0; j < m; ++j) {
- var o = links[j];
- neighbors[o.source.index].push(o.target);
- neighbors[o.target.index].push(o.source);
- }
- }
- return neighbors[i];
- }
-
- return force.resume();
- };
-
- force.resume = function() {
- return force.alpha(.1);
- };
-
- force.stop = function() {
- return force.alpha(0);
- };
-
- // use `node.call(force.drag)` to make nodes draggable
- force.drag = function() {
- if (!drag) drag = d3.behavior.drag()
- .origin(Object)
- .on("dragstart", dragstart)
- .on("drag", d3_layout_forceDrag)
- .on("dragend", d3_layout_forceDragEnd);
-
- this.on("mouseover.force", d3_layout_forceDragOver)
- .on("mouseout.force", d3_layout_forceDragOut)
- .call(drag);
- };
-
- function dragstart(d) {
- d3_layout_forceDragOver(d3_layout_forceDragNode = d);
- d3_layout_forceDragForce = force;
- }
-
- return d3.rebind(force, event, "on");
-};
-
-var d3_layout_forceDragForce,
- d3_layout_forceDragNode;
-
-function d3_layout_forceDragOver(d) {
- d.fixed |= 2;
-}
-
-function d3_layout_forceDragOut(d) {
- if (d !== d3_layout_forceDragNode) d.fixed &= 1;
-}
-
-function d3_layout_forceDragEnd() {
- d3_layout_forceDragNode.fixed &= 1;
- d3_layout_forceDragForce = d3_layout_forceDragNode = null;
-}
-
-function d3_layout_forceDrag() {
- d3_layout_forceDragNode.px = d3.event.x;
- d3_layout_forceDragNode.py = d3.event.y;
- d3_layout_forceDragForce.resume(); // restart annealing
-}
-
-function d3_layout_forceAccumulate(quad, alpha, charges) {
- var cx = 0,
- cy = 0;
- quad.charge = 0;
- if (!quad.leaf) {
- var nodes = quad.nodes,
- n = nodes.length,
- i = -1,
- c;
- while (++i < n) {
- c = nodes[i];
- if (c == null) continue;
- d3_layout_forceAccumulate(c, alpha, charges);
- quad.charge += c.charge;
- cx += c.charge * c.cx;
- cy += c.charge * c.cy;
- }
- }
- if (quad.point) {
- // jitter internal nodes that are coincident
- if (!quad.leaf) {
- quad.point.x += Math.random() - .5;
- quad.point.y += Math.random() - .5;
- }
- var k = alpha * charges[quad.point.index];
- quad.charge += quad.pointCharge = k;
- cx += k * quad.point.x;
- cy += k * quad.point.y;
- }
- quad.cx = cx / quad.charge;
- quad.cy = cy / quad.charge;
-}
-
-function d3_layout_forceLinkDistance(link) {
- return 20;
-}
-
-function d3_layout_forceLinkStrength(link) {
- return 1;
-}
-d3.layout.partition = function() {
- var hierarchy = d3.layout.hierarchy(),
- size = [1, 1]; // width, height
-
- function position(node, x, dx, dy) {
- var children = node.children;
- node.x = x;
- node.y = node.depth * dy;
- node.dx = dx;
- node.dy = dy;
- if (children && (n = children.length)) {
- var i = -1,
- n,
- c,
- d;
- dx = node.value ? dx / node.value : 0;
- while (++i < n) {
- position(c = children[i], x, d = c.value * dx, dy);
- x += d;
- }
- }
- }
-
- function depth(node) {
- var children = node.children,
- d = 0;
- if (children && (n = children.length)) {
- var i = -1,
- n;
- while (++i < n) d = Math.max(d, depth(children[i]));
- }
- return 1 + d;
- }
-
- function partition(d, i) {
- var nodes = hierarchy.call(this, d, i);
- position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
- return nodes;
- }
-
- partition.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return partition;
- };
-
- return d3_layout_hierarchyRebind(partition, hierarchy);
-};
-d3.layout.pie = function() {
- var value = Number,
- sort = d3_layout_pieSortByValue,
- startAngle = 0,
- endAngle = 2 * Math.PI;
-
- function pie(data, i) {
-
- // Compute the numeric values for each data element.
- var values = data.map(function(d, i) { return +value.call(pie, d, i); });
-
- // Compute the start angle.
- var a = +(typeof startAngle === "function"
- ? startAngle.apply(this, arguments)
- : startAngle);
-
- // Compute the angular scale factor: from value to radians.
- var k = ((typeof endAngle === "function"
- ? endAngle.apply(this, arguments)
- : endAngle) - startAngle)
- / d3.sum(values);
-
- // Optionally sort the data.
- var index = d3.range(data.length);
- if (sort != null) index.sort(sort === d3_layout_pieSortByValue
- ? function(i, j) { return values[j] - values[i]; }
- : function(i, j) { return sort(data[i], data[j]); });
-
- // Compute the arcs!
- // They are stored in the original data's order.
- var arcs = [];
- index.forEach(function(i) {
- arcs[i] = {
- data: data[i],
- value: d = values[i],
- startAngle: a,
- endAngle: a += d * k
- };
- });
- return arcs;
- }
-
- /**
- * Specifies the value function *x*, which returns a nonnegative numeric value
- * for each datum. The default value function is `Number`. The value function
- * is passed two arguments: the current datum and the current index.
- */
- pie.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return pie;
- };
-
- /**
- * Specifies a sort comparison operator *x*. The comparator is passed two data
- * elements from the data array, a and b; it returns a negative value if a is
- * less than b, a positive value if a is greater than b, and zero if a equals
- * b.
- */
- pie.sort = function(x) {
- if (!arguments.length) return sort;
- sort = x;
- return pie;
- };
-
- /**
- * Specifies the overall start angle of the pie chart. Defaults to 0. The
- * start angle can be specified either as a constant or as a function; in the
- * case of a function, it is evaluated once per array (as opposed to per
- * element).
- */
- pie.startAngle = function(x) {
- if (!arguments.length) return startAngle;
- startAngle = x;
- return pie;
- };
-
- /**
- * Specifies the overall end angle of the pie chart. Defaults to 2π. The
- * end angle can be specified either as a constant or as a function; in the
- * case of a function, it is evaluated once per array (as opposed to per
- * element).
- */
- pie.endAngle = function(x) {
- if (!arguments.length) return endAngle;
- endAngle = x;
- return pie;
- };
-
- return pie;
-};
-
-var d3_layout_pieSortByValue = {};
-// data is two-dimensional array of x,y; we populate y0
-d3.layout.stack = function() {
- var values = Object,
- order = d3_layout_stackOrderDefault,
- offset = d3_layout_stackOffsetZero,
- out = d3_layout_stackOut,
- x = d3_layout_stackX,
- y = d3_layout_stackY;
-
- function stack(data, index) {
-
- // Convert series to canonical two-dimensional representation.
- var series = data.map(function(d, i) {
- return values.call(stack, d, i);
- });
-
- // Convert each series to canonical [[x,y]] representation.
- var points = series.map(function(d, i) {
- return d.map(function(v, i) {
- return [x.call(stack, v, i), y.call(stack, v, i)];
- });
- });
-
- // Compute the order of series, and permute them.
- var orders = order.call(stack, points, index);
- series = d3.permute(series, orders);
- points = d3.permute(points, orders);
-
- // Compute the baseline…
- var offsets = offset.call(stack, points, index);
-
- // And propagate it to other series.
- var n = series.length,
- m = series[0].length,
- i,
- j,
- o;
- for (j = 0; j < m; ++j) {
- out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
- for (i = 1; i < n; ++i) {
- out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
- }
- }
-
- return data;
- }
-
- stack.values = function(x) {
- if (!arguments.length) return values;
- values = x;
- return stack;
- };
-
- stack.order = function(x) {
- if (!arguments.length) return order;
- order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
- return stack;
- };
-
- stack.offset = function(x) {
- if (!arguments.length) return offset;
- offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
- return stack;
- };
-
- stack.x = function(z) {
- if (!arguments.length) return x;
- x = z;
- return stack;
- };
-
- stack.y = function(z) {
- if (!arguments.length) return y;
- y = z;
- return stack;
- };
-
- stack.out = function(z) {
- if (!arguments.length) return out;
- out = z;
- return stack;
- };
-
- return stack;
-}
-
-function d3_layout_stackX(d) {
- return d.x;
-}
-
-function d3_layout_stackY(d) {
- return d.y;
-}
-
-function d3_layout_stackOut(d, y0, y) {
- d.y0 = y0;
- d.y = y;
-}
-
-var d3_layout_stackOrders = d3.map({
-
- "inside-out": function(data) {
- var n = data.length,
- i,
- j,
- max = data.map(d3_layout_stackMaxIndex),
- sums = data.map(d3_layout_stackReduceSum),
- index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
- top = 0,
- bottom = 0,
- tops = [],
- bottoms = [];
- for (i = 0; i < n; ++i) {
- j = index[i];
- if (top < bottom) {
- top += sums[j];
- tops.push(j);
- } else {
- bottom += sums[j];
- bottoms.push(j);
- }
- }
- return bottoms.reverse().concat(tops);
- },
-
- "reverse": function(data) {
- return d3.range(data.length).reverse();
- },
-
- "default": d3_layout_stackOrderDefault
-
-});
-
-var d3_layout_stackOffsets = d3.map({
-
- "silhouette": function(data) {
- var n = data.length,
- m = data[0].length,
- sums = [],
- max = 0,
- i,
- j,
- o,
- y0 = [];
- for (j = 0; j < m; ++j) {
- for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
- if (o > max) max = o;
- sums.push(o);
- }
- for (j = 0; j < m; ++j) {
- y0[j] = (max - sums[j]) / 2;
- }
- return y0;
- },
-
- "wiggle": function(data) {
- var n = data.length,
- x = data[0],
- m = x.length,
- max = 0,
- i,
- j,
- k,
- s1,
- s2,
- s3,
- dx,
- o,
- o0,
- y0 = [];
- y0[0] = o = o0 = 0;
- for (j = 1; j < m; ++j) {
- for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
- for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
- for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
- s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
- }
- s2 += s3 * data[i][j][1];
- }
- y0[j] = o -= s1 ? s2 / s1 * dx : 0;
- if (o < o0) o0 = o;
- }
- for (j = 0; j < m; ++j) y0[j] -= o0;
- return y0;
- },
-
- "expand": function(data) {
- var n = data.length,
- m = data[0].length,
- k = 1 / n,
- i,
- j,
- o,
- y0 = [];
- for (j = 0; j < m; ++j) {
- for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
- if (o) for (i = 0; i < n; i++) data[i][j][1] /= o;
- else for (i = 0; i < n; i++) data[i][j][1] = k;
- }
- for (j = 0; j < m; ++j) y0[j] = 0;
- return y0;
- },
-
- "zero": d3_layout_stackOffsetZero
-
-});
-
-function d3_layout_stackOrderDefault(data) {
- return d3.range(data.length);
-}
-
-function d3_layout_stackOffsetZero(data) {
- var j = -1,
- m = data[0].length,
- y0 = [];
- while (++j < m) y0[j] = 0;
- return y0;
-}
-
-function d3_layout_stackMaxIndex(array) {
- var i = 1,
- j = 0,
- v = array[0][1],
- k,
- n = array.length;
- for (; i < n; ++i) {
- if ((k = array[i][1]) > v) {
- j = i;
- v = k;
- }
- }
- return j;
-}
-
-function d3_layout_stackReduceSum(d) {
- return d.reduce(d3_layout_stackSum, 0);
-}
-
-function d3_layout_stackSum(p, d) {
- return p + d[1];
-}
-d3.layout.histogram = function() {
- var frequency = true,
- valuer = Number,
- ranger = d3_layout_histogramRange,
- binner = d3_layout_histogramBinSturges;
-
- function histogram(data, i) {
- var bins = [],
- values = data.map(valuer, this),
- range = ranger.call(this, values, i),
- thresholds = binner.call(this, range, values, i),
- bin,
- i = -1,
- n = values.length,
- m = thresholds.length - 1,
- k = frequency ? 1 : 1 / n,
- x;
-
- // Initialize the bins.
- while (++i < m) {
- bin = bins[i] = [];
- bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
- bin.y = 0;
- }
-
- // Fill the bins, ignoring values outside the range.
- i = -1; while(++i < n) {
- x = values[i];
- if ((x >= range[0]) && (x <= range[1])) {
- bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
- bin.y += k;
- bin.push(data[i]);
- }
- }
-
- return bins;
- }
-
- // Specifies how to extract a value from the associated data. The default
- // value function is `Number`, which is equivalent to the identity function.
- histogram.value = function(x) {
- if (!arguments.length) return valuer;
- valuer = x;
- return histogram;
- };
-
- // Specifies the range of the histogram. Values outside the specified range
- // will be ignored. The argument `x` may be specified either as a two-element
- // array representing the minimum and maximum value of the range, or as a
- // function that returns the range given the array of values and the current
- // index `i`. The default range is the extent (minimum and maximum) of the
- // values.
- histogram.range = function(x) {
- if (!arguments.length) return ranger;
- ranger = d3.functor(x);
- return histogram;
- };
-
- // Specifies how to bin values in the histogram. The argument `x` may be
- // specified as a number, in which case the range of values will be split
- // uniformly into the given number of bins. Or, `x` may be an array of
- // threshold values, defining the bins; the specified array must contain the
- // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x`
- // may be a function which is evaluated, being passed the range, the array of
- // values, and the current index `i`, returning an array of thresholds. The
- // default bin function will divide the values into uniform bins using
- // Sturges' formula.
- histogram.bins = function(x) {
- if (!arguments.length) return binner;
- binner = typeof x === "number"
- ? function(range) { return d3_layout_histogramBinFixed(range, x); }
- : d3.functor(x);
- return histogram;
- };
-
- // Specifies whether the histogram's `y` value is a count (frequency) or a
- // probability (density). The default value is true.
- histogram.frequency = function(x) {
- if (!arguments.length) return frequency;
- frequency = !!x;
- return histogram;
- };
-
- return histogram;
-};
-
-function d3_layout_histogramBinSturges(range, values) {
- return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
-}
-
-function d3_layout_histogramBinFixed(range, n) {
- var x = -1,
- b = +range[0],
- m = (range[1] - b) / n,
- f = [];
- while (++x <= n) f[x] = m * x + b;
- return f;
-}
-
-function d3_layout_histogramRange(values) {
- return [d3.min(values), d3.max(values)];
-}
-d3.layout.hierarchy = function() {
- var sort = d3_layout_hierarchySort,
- children = d3_layout_hierarchyChildren,
- value = d3_layout_hierarchyValue;
-
- // Recursively compute the node depth and value.
- // Also converts the data representation into a standard hierarchy structure.
- function recurse(data, depth, nodes) {
- var childs = children.call(hierarchy, data, depth),
- node = d3_layout_hierarchyInline ? data : {data: data};
- node.depth = depth;
- nodes.push(node);
- if (childs && (n = childs.length)) {
- var i = -1,
- n,
- c = node.children = [],
- v = 0,
- j = depth + 1;
- while (++i < n) {
- d = recurse(childs[i], j, nodes);
- d.parent = node;
- c.push(d);
- v += d.value;
- }
- if (sort) c.sort(sort);
- if (value) node.value = v;
- } else if (value) {
- node.value = +value.call(hierarchy, data, depth) || 0;
- }
- return node;
- }
-
- // Recursively re-evaluates the node value.
- function revalue(node, depth) {
- var children = node.children,
- v = 0;
- if (children && (n = children.length)) {
- var i = -1,
- n,
- j = depth + 1;
- while (++i < n) v += revalue(children[i], j);
- } else if (value) {
- v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
- }
- if (value) node.value = v;
- return v;
- }
-
- function hierarchy(d) {
- var nodes = [];
- recurse(d, 0, nodes);
- return nodes;
- }
-
- hierarchy.sort = function(x) {
- if (!arguments.length) return sort;
- sort = x;
- return hierarchy;
- };
-
- hierarchy.children = function(x) {
- if (!arguments.length) return children;
- children = x;
- return hierarchy;
- };
-
- hierarchy.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return hierarchy;
- };
-
- // Re-evaluates the `value` property for the specified hierarchy.
- hierarchy.revalue = function(root) {
- revalue(root, 0);
- return root;
- };
-
- return hierarchy;
-};
-
-// A method assignment helper for hierarchy subclasses.
-function d3_layout_hierarchyRebind(object, hierarchy) {
- d3.rebind(object, hierarchy, "sort", "children", "value");
-
- // Add an alias for links, for convenience.
- object.links = d3_layout_hierarchyLinks;
-
- // If the new API is used, enabling inlining.
- object.nodes = function(d) {
- d3_layout_hierarchyInline = true;
- return (object.nodes = object)(d);
- };
-
- return object;
-}
-
-function d3_layout_hierarchyChildren(d) {
- return d.children;
-}
-
-function d3_layout_hierarchyValue(d) {
- return d.value;
-}
-
-function d3_layout_hierarchySort(a, b) {
- return b.value - a.value;
-}
-
-// Returns an array source+target objects for the specified nodes.
-function d3_layout_hierarchyLinks(nodes) {
- return d3.merge(nodes.map(function(parent) {
- return (parent.children || []).map(function(child) {
- return {source: parent, target: child};
- });
- }));
-}
-
-// For backwards-compatibility, don't enable inlining by default.
-var d3_layout_hierarchyInline = false;
-d3.layout.pack = function() {
- var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort),
- size = [1, 1];
-
- function pack(d, i) {
- var nodes = hierarchy.call(this, d, i),
- root = nodes[0];
-
- // Recursively compute the layout.
- root.x = 0;
- root.y = 0;
- d3_layout_packTree(root);
-
- // Scale the layout to fit the requested size.
- var w = size[0],
- h = size[1],
- k = 1 / Math.max(2 * root.r / w, 2 * root.r / h);
- d3_layout_packTransform(root, w / 2, h / 2, k);
-
- return nodes;
- }
-
- pack.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return pack;
- };
-
- return d3_layout_hierarchyRebind(pack, hierarchy);
-};
-
-function d3_layout_packSort(a, b) {
- return a.value - b.value;
-}
-
-function d3_layout_packInsert(a, b) {
- var c = a._pack_next;
- a._pack_next = b;
- b._pack_prev = a;
- b._pack_next = c;
- c._pack_prev = b;
-}
-
-function d3_layout_packSplice(a, b) {
- a._pack_next = b;
- b._pack_prev = a;
-}
-
-function d3_layout_packIntersects(a, b) {
- var dx = b.x - a.x,
- dy = b.y - a.y,
- dr = a.r + b.r;
- return dr * dr - dx * dx - dy * dy > .001; // within epsilon
-}
-
-function d3_layout_packCircle(nodes) {
- var xMin = Infinity,
- xMax = -Infinity,
- yMin = Infinity,
- yMax = -Infinity,
- n = nodes.length,
- a, b, c, j, k;
-
- function bound(node) {
- xMin = Math.min(node.x - node.r, xMin);
- xMax = Math.max(node.x + node.r, xMax);
- yMin = Math.min(node.y - node.r, yMin);
- yMax = Math.max(node.y + node.r, yMax);
- }
-
- // Create node links.
- nodes.forEach(d3_layout_packLink);
-
- // Create first node.
- a = nodes[0];
- a.x = -a.r;
- a.y = 0;
- bound(a);
-
- // Create second node.
- if (n > 1) {
- b = nodes[1];
- b.x = b.r;
- b.y = 0;
- bound(b);
-
- // Create third node and build chain.
- if (n > 2) {
- c = nodes[2];
- d3_layout_packPlace(a, b, c);
- bound(c);
- d3_layout_packInsert(a, c);
- a._pack_prev = c;
- d3_layout_packInsert(c, b);
- b = a._pack_next;
-
- // Now iterate through the rest.
- for (var i = 3; i < n; i++) {
- d3_layout_packPlace(a, b, c = nodes[i]);
-
- // Search for the closest intersection.
- var isect = 0, s1 = 1, s2 = 1;
- for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
- if (d3_layout_packIntersects(j, c)) {
- isect = 1;
- break;
- }
- }
- if (isect == 1) {
- for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
- if (d3_layout_packIntersects(k, c)) {
- break;
- }
- }
- }
-
- // Update node chain.
- if (isect) {
- if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j);
- else d3_layout_packSplice(a = k, b);
- i--;
- } else {
- d3_layout_packInsert(a, c);
- b = c;
- bound(c);
- }
- }
- }
- }
-
- // Re-center the circles and return the encompassing radius.
- var cx = (xMin + xMax) / 2,
- cy = (yMin + yMax) / 2,
- cr = 0;
- for (var i = 0; i < n; i++) {
- var node = nodes[i];
- node.x -= cx;
- node.y -= cy;
- cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y));
- }
-
- // Remove node links.
- nodes.forEach(d3_layout_packUnlink);
-
- return cr;
-}
-
-function d3_layout_packLink(node) {
- node._pack_next = node._pack_prev = node;
-}
-
-function d3_layout_packUnlink(node) {
- delete node._pack_next;
- delete node._pack_prev;
-}
-
-function d3_layout_packTree(node) {
- var children = node.children;
- if (children && children.length) {
- children.forEach(d3_layout_packTree);
- node.r = d3_layout_packCircle(children);
- } else {
- node.r = Math.sqrt(node.value);
- }
-}
-
-function d3_layout_packTransform(node, x, y, k) {
- var children = node.children;
- node.x = (x += k * node.x);
- node.y = (y += k * node.y);
- node.r *= k;
- if (children) {
- var i = -1, n = children.length;
- while (++i < n) d3_layout_packTransform(children[i], x, y, k);
- }
-}
-
-function d3_layout_packPlace(a, b, c) {
- var db = a.r + c.r,
- dx = b.x - a.x,
- dy = b.y - a.y;
- if (db && (dx || dy)) {
- var da = b.r + c.r,
- dc = Math.sqrt(dx * dx + dy * dy),
- cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))),
- theta = Math.acos(cos),
- x = cos * (db /= dc),
- y = Math.sin(theta) * db;
- c.x = a.x + x * dx + y * dy;
- c.y = a.y + x * dy - y * dx;
- } else {
- c.x = a.x + db;
- c.y = a.y;
- }
-}
-// Implements a hierarchical layout using the cluster (or dendrogram)
-// algorithm.
-d3.layout.cluster = function() {
- var hierarchy = d3.layout.hierarchy().sort(null).value(null),
- separation = d3_layout_treeSeparation,
- size = [1, 1]; // width, height
-
- function cluster(d, i) {
- var nodes = hierarchy.call(this, d, i),
- root = nodes[0],
- previousNode,
- x = 0,
- kx,
- ky;
-
- // First walk, computing the initial x & y values.
- d3_layout_treeVisitAfter(root, function(node) {
- var children = node.children;
- if (children && children.length) {
- node.x = d3_layout_clusterX(children);
- node.y = d3_layout_clusterY(children);
- } else {
- node.x = previousNode ? x += separation(node, previousNode) : 0;
- node.y = 0;
- previousNode = node;
- }
- });
-
- // Compute the left-most, right-most, and depth-most nodes for extents.
- var left = d3_layout_clusterLeft(root),
- right = d3_layout_clusterRight(root),
- x0 = left.x - separation(left, right) / 2,
- x1 = right.x + separation(right, left) / 2;
-
- // Second walk, normalizing x & y to the desired size.
- d3_layout_treeVisitAfter(root, function(node) {
- node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
- });
-
- return nodes;
- }
-
- cluster.separation = function(x) {
- if (!arguments.length) return separation;
- separation = x;
- return cluster;
- };
-
- cluster.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return cluster;
- };
-
- return d3_layout_hierarchyRebind(cluster, hierarchy);
-};
-
-function d3_layout_clusterY(children) {
- return 1 + d3.max(children, function(child) {
- return child.y;
- });
-}
-
-function d3_layout_clusterX(children) {
- return children.reduce(function(x, child) {
- return x + child.x;
- }, 0) / children.length;
-}
-
-function d3_layout_clusterLeft(node) {
- var children = node.children;
- return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
-}
-
-function d3_layout_clusterRight(node) {
- var children = node.children, n;
- return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
-}
-// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
-d3.layout.tree = function() {
- var hierarchy = d3.layout.hierarchy().sort(null).value(null),
- separation = d3_layout_treeSeparation,
- size = [1, 1]; // width, height
-
- function tree(d, i) {
- var nodes = hierarchy.call(this, d, i),
- root = nodes[0];
-
- function firstWalk(node, previousSibling) {
- var children = node.children,
- layout = node._tree;
- if (children && (n = children.length)) {
- var n,
- firstChild = children[0],
- previousChild,
- ancestor = firstChild,
- child,
- i = -1;
- while (++i < n) {
- child = children[i];
- firstWalk(child, previousChild);
- ancestor = apportion(child, previousChild, ancestor);
- previousChild = child;
- }
- d3_layout_treeShift(node);
- var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
- if (previousSibling) {
- layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
- layout.mod = layout.prelim - midpoint;
- } else {
- layout.prelim = midpoint;
- }
- } else {
- if (previousSibling) {
- layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
- }
- }
- }
-
- function secondWalk(node, x) {
- node.x = node._tree.prelim + x;
- var children = node.children;
- if (children && (n = children.length)) {
- var i = -1,
- n;
- x += node._tree.mod;
- while (++i < n) {
- secondWalk(children[i], x);
- }
- }
- }
-
- function apportion(node, previousSibling, ancestor) {
- if (previousSibling) {
- var vip = node,
- vop = node,
- vim = previousSibling,
- vom = node.parent.children[0],
- sip = vip._tree.mod,
- sop = vop._tree.mod,
- sim = vim._tree.mod,
- som = vom._tree.mod,
- shift;
- while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
- vom = d3_layout_treeLeft(vom);
- vop = d3_layout_treeRight(vop);
- vop._tree.ancestor = node;
- shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
- if (shift > 0) {
- d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
- sip += shift;
- sop += shift;
- }
- sim += vim._tree.mod;
- sip += vip._tree.mod;
- som += vom._tree.mod;
- sop += vop._tree.mod;
- }
- if (vim && !d3_layout_treeRight(vop)) {
- vop._tree.thread = vim;
- vop._tree.mod += sim - sop;
- }
- if (vip && !d3_layout_treeLeft(vom)) {
- vom._tree.thread = vip;
- vom._tree.mod += sip - som;
- ancestor = node;
- }
- }
- return ancestor;
- }
-
- // Initialize temporary layout variables.
- d3_layout_treeVisitAfter(root, function(node, previousSibling) {
- node._tree = {
- ancestor: node,
- prelim: 0,
- mod: 0,
- change: 0,
- shift: 0,
- number: previousSibling ? previousSibling._tree.number + 1 : 0
- };
- });
-
- // Compute the layout using Buchheim et al.'s algorithm.
- firstWalk(root);
- secondWalk(root, -root._tree.prelim);
-
- // Compute the left-most, right-most, and depth-most nodes for extents.
- var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost),
- right = d3_layout_treeSearch(root, d3_layout_treeRightmost),
- deep = d3_layout_treeSearch(root, d3_layout_treeDeepest),
- x0 = left.x - separation(left, right) / 2,
- x1 = right.x + separation(right, left) / 2,
- y1 = deep.depth || 1;
-
- // Clear temporary layout variables; transform x and y.
- d3_layout_treeVisitAfter(root, function(node) {
- node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = node.depth / y1 * size[1];
- delete node._tree;
- });
-
- return nodes;
- }
-
- tree.separation = function(x) {
- if (!arguments.length) return separation;
- separation = x;
- return tree;
- };
-
- tree.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return tree;
- };
-
- return d3_layout_hierarchyRebind(tree, hierarchy);
-};
-
-function d3_layout_treeSeparation(a, b) {
- return a.parent == b.parent ? 1 : 2;
-}
-
-// function d3_layout_treeSeparationRadial(a, b) {
-// return (a.parent == b.parent ? 1 : 2) / a.depth;
-// }
-
-function d3_layout_treeLeft(node) {
- var children = node.children;
- return children && children.length ? children[0] : node._tree.thread;
-}
-
-function d3_layout_treeRight(node) {
- var children = node.children,
- n;
- return children && (n = children.length) ? children[n - 1] : node._tree.thread;
-}
-
-function d3_layout_treeSearch(node, compare) {
- var children = node.children;
- if (children && (n = children.length)) {
- var child,
- n,
- i = -1;
- while (++i < n) {
- if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
- node = child;
- }
- }
- }
- return node;
-}
-
-function d3_layout_treeRightmost(a, b) {
- return a.x - b.x;
-}
-
-function d3_layout_treeLeftmost(a, b) {
- return b.x - a.x;
-}
-
-function d3_layout_treeDeepest(a, b) {
- return a.depth - b.depth;
-}
-
-function d3_layout_treeVisitAfter(node, callback) {
- function visit(node, previousSibling) {
- var children = node.children;
- if (children && (n = children.length)) {
- var child,
- previousChild = null,
- i = -1,
- n;
- while (++i < n) {
- child = children[i];
- visit(child, previousChild);
- previousChild = child;
- }
- }
- callback(node, previousSibling);
- }
- visit(node, null);
-}
-
-function d3_layout_treeShift(node) {
- var shift = 0,
- change = 0,
- children = node.children,
- i = children.length,
- child;
- while (--i >= 0) {
- child = children[i]._tree;
- child.prelim += shift;
- child.mod += shift;
- shift += child.shift + (change += child.change);
- }
-}
-
-function d3_layout_treeMove(ancestor, node, shift) {
- ancestor = ancestor._tree;
- node = node._tree;
- var change = shift / (node.number - ancestor.number);
- ancestor.change += change;
- node.change -= change;
- node.shift += shift;
- node.prelim += shift;
- node.mod += shift;
-}
-
-function d3_layout_treeAncestor(vim, node, ancestor) {
- return vim._tree.ancestor.parent == node.parent
- ? vim._tree.ancestor
- : ancestor;
-}
-// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
-// Modified to support a target aspect ratio by Jeff Heer
-d3.layout.treemap = function() {
- var hierarchy = d3.layout.hierarchy(),
- round = Math.round,
- size = [1, 1], // width, height
- padding = null,
- pad = d3_layout_treemapPadNull,
- sticky = false,
- stickies,
- ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio
-
- // Compute the area for each child based on value & scale.
- function scale(children, k) {
- var i = -1,
- n = children.length,
- child,
- area;
- while (++i < n) {
- area = (child = children[i]).value * (k < 0 ? 0 : k);
- child.area = isNaN(area) || area <= 0 ? 0 : area;
- }
- }
-
- // Recursively arranges the specified node's children into squarified rows.
- function squarify(node) {
- var children = node.children;
- if (children && children.length) {
- var rect = pad(node),
- row = [],
- remaining = children.slice(), // copy-on-write
- child,
- best = Infinity, // the best row score so far
- score, // the current row score
- u = Math.min(rect.dx, rect.dy), // initial orientation
- n;
- scale(remaining, rect.dx * rect.dy / node.value);
- row.area = 0;
- while ((n = remaining.length) > 0) {
- row.push(child = remaining[n - 1]);
- row.area += child.area;
- if ((score = worst(row, u)) <= best) { // continue with this orientation
- remaining.pop();
- best = score;
- } else { // abort, and try a different orientation
- row.area -= row.pop().area;
- position(row, u, rect, false);
- u = Math.min(rect.dx, rect.dy);
- row.length = row.area = 0;
- best = Infinity;
- }
- }
- if (row.length) {
- position(row, u, rect, true);
- row.length = row.area = 0;
- }
- children.forEach(squarify);
- }
- }
-
- // Recursively resizes the specified node's children into existing rows.
- // Preserves the existing layout!
- function stickify(node) {
- var children = node.children;
- if (children && children.length) {
- var rect = pad(node),
- remaining = children.slice(), // copy-on-write
- child,
- row = [];
- scale(remaining, rect.dx * rect.dy / node.value);
- row.area = 0;
- while (child = remaining.pop()) {
- row.push(child);
- row.area += child.area;
- if (child.z != null) {
- position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
- row.length = row.area = 0;
- }
- }
- children.forEach(stickify);
- }
- }
-
- // Computes the score for the specified row, as the worst aspect ratio.
- function worst(row, u) {
- var s = row.area,
- r,
- rmax = 0,
- rmin = Infinity,
- i = -1,
- n = row.length;
- while (++i < n) {
- if (!(r = row[i].area)) continue;
- if (r < rmin) rmin = r;
- if (r > rmax) rmax = r;
- }
- s *= s;
- u *= u;
- return s
- ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio))
- : Infinity;
- }
-
- // Positions the specified row of nodes. Modifies `rect`.
- function position(row, u, rect, flush) {
- var i = -1,
- n = row.length,
- x = rect.x,
- y = rect.y,
- v = u ? round(row.area / u) : 0,
- o;
- if (u == rect.dx) { // horizontal subdivision
- if (flush || v > rect.dy) v = rect.dy; // over+underflow
- while (++i < n) {
- o = row[i];
- o.x = x;
- o.y = y;
- o.dy = v;
- x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
- }
- o.z = true;
- o.dx += rect.x + rect.dx - x; // rounding error
- rect.y += v;
- rect.dy -= v;
- } else { // vertical subdivision
- if (flush || v > rect.dx) v = rect.dx; // over+underflow
- while (++i < n) {
- o = row[i];
- o.x = x;
- o.y = y;
- o.dx = v;
- y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
- }
- o.z = false;
- o.dy += rect.y + rect.dy - y; // rounding error
- rect.x += v;
- rect.dx -= v;
- }
- }
-
- function treemap(d) {
- var nodes = stickies || hierarchy(d),
- root = nodes[0];
- root.x = 0;
- root.y = 0;
- root.dx = size[0];
- root.dy = size[1];
- if (stickies) hierarchy.revalue(root);
- scale([root], root.dx * root.dy / root.value);
- (stickies ? stickify : squarify)(root);
- if (sticky) stickies = nodes;
- return nodes;
- }
-
- treemap.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return treemap;
- };
-
- treemap.padding = function(x) {
- if (!arguments.length) return padding;
-
- function padFunction(node) {
- var p = x.call(treemap, node, node.depth);
- return p == null
- ? d3_layout_treemapPadNull(node)
- : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p);
- }
-
- function padConstant(node) {
- return d3_layout_treemapPad(node, x);
- }
-
- var type;
- pad = (padding = x) == null ? d3_layout_treemapPadNull
- : (type = typeof x) === "function" ? padFunction
- : type === "number" ? (x = [x, x, x, x], padConstant)
- : padConstant;
- return treemap;
- };
-
- treemap.round = function(x) {
- if (!arguments.length) return round != Number;
- round = x ? Math.round : Number;
- return treemap;
- };
-
- treemap.sticky = function(x) {
- if (!arguments.length) return sticky;
- sticky = x;
- stickies = null;
- return treemap;
- };
-
- treemap.ratio = function(x) {
- if (!arguments.length) return ratio;
- ratio = x;
- return treemap;
- };
-
- return d3_layout_hierarchyRebind(treemap, hierarchy);
-};
-
-function d3_layout_treemapPadNull(node) {
- return {x: node.x, y: node.y, dx: node.dx, dy: node.dy};
-}
-
-function d3_layout_treemapPad(node, padding) {
- var x = node.x + padding[3],
- y = node.y + padding[0],
- dx = node.dx - padding[1] - padding[3],
- dy = node.dy - padding[0] - padding[2];
- if (dx < 0) { x += dx / 2; dx = 0; }
- if (dy < 0) { y += dy / 2; dy = 0; }
- return {x: x, y: y, dx: dx, dy: dy};
-}
-d3.csv = function(url, callback) {
- d3.text(url, "text/csv", function(text) {
- callback(text && d3.csv.parse(text));
- });
-};
-d3.csv.parse = function(text) {
- var header;
- return d3.csv.parseRows(text, function(row, i) {
- if (i) {
- var o = {}, j = -1, m = header.length;
- while (++j < m) o[header[j]] = row[j];
- return o;
- } else {
- header = row;
- return null;
- }
- });
-};
-
-d3.csv.parseRows = function(text, f) {
- var EOL = {}, // sentinel value for end-of-line
- EOF = {}, // sentinel value for end-of-file
- rows = [], // output rows
- re = /\r\n|[,\r\n]/g, // field separator regex
- n = 0, // the current line number
- t, // the current token
- eol; // is the current token followed by EOL?
-
- re.lastIndex = 0; // work-around bug in FF 3.6
-
- /** @private Returns the next token. */
- function token() {
- if (re.lastIndex >= text.length) return EOF; // special case: end of file
- if (eol) { eol = false; return EOL; } // special case: end of line
-
- // special case: quotes
- var j = re.lastIndex;
- if (text.charCodeAt(j) === 34) {
- var i = j;
- while (i++ < text.length) {
- if (text.charCodeAt(i) === 34) {
- if (text.charCodeAt(i + 1) !== 34) break;
- i++;
- }
- }
- re.lastIndex = i + 2;
- var c = text.charCodeAt(i + 1);
- if (c === 13) {
- eol = true;
- if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
- } else if (c === 10) {
- eol = true;
- }
- return text.substring(j + 1, i).replace(/""/g, "\"");
- }
-
- // common case
- var m = re.exec(text);
- if (m) {
- eol = m[0].charCodeAt(0) !== 44;
- return text.substring(j, m.index);
- }
- re.lastIndex = text.length;
- return text.substring(j);
- }
-
- while ((t = token()) !== EOF) {
- var a = [];
- while ((t !== EOL) && (t !== EOF)) {
- a.push(t);
- t = token();
- }
- if (f && !(a = f(a, n++))) continue;
- rows.push(a);
- }
-
- return rows;
-};
-d3.csv.format = function(rows) {
- return rows.map(d3_csv_formatRow).join("\n");
-};
-
-function d3_csv_formatRow(row) {
- return row.map(d3_csv_formatValue).join(",");
-}
-
-function d3_csv_formatValue(text) {
- return /[",\n]/.test(text)
- ? "\"" + text.replace(/\"/g, "\"\"") + "\""
- : text;
-}
-d3.geo = {};
-
-var d3_geo_radians = Math.PI / 180;
-// TODO clip input coordinates on opposite hemisphere
-d3.geo.azimuthal = function() {
- var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea
- origin,
- scale = 200,
- translate = [480, 250],
- x0,
- y0,
- cy0,
- sy0;
-
- function azimuthal(coordinates) {
- var x1 = coordinates[0] * d3_geo_radians - x0,
- y1 = coordinates[1] * d3_geo_radians,
- cx1 = Math.cos(x1),
- sx1 = Math.sin(x1),
- cy1 = Math.cos(y1),
- sy1 = Math.sin(y1),
- cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null,
- c,
- k = mode === "stereographic" ? 1 / (1 + cc)
- : mode === "gnomonic" ? 1 / cc
- : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0)
- : mode === "equalarea" ? Math.sqrt(2 / (1 + cc))
- : 1,
- x = k * cy1 * sx1,
- y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
- return [
- scale * x + translate[0],
- scale * y + translate[1]
- ];
- }
-
- azimuthal.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale,
- p = Math.sqrt(x * x + y * y),
- c = mode === "stereographic" ? 2 * Math.atan(p)
- : mode === "gnomonic" ? Math.atan(p)
- : mode === "equidistant" ? p
- : mode === "equalarea" ? 2 * Math.asin(.5 * p)
- : Math.asin(p),
- sc = Math.sin(c),
- cc = Math.cos(c);
- return [
- (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians,
- Math.asin(cc * sy0 - (p ? (y * sc * cy0) / p : 0)) / d3_geo_radians
- ];
- };
-
- azimuthal.mode = function(x) {
- if (!arguments.length) return mode;
- mode = x + "";
- return azimuthal;
- };
-
- azimuthal.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- x0 = origin[0] * d3_geo_radians;
- y0 = origin[1] * d3_geo_radians;
- cy0 = Math.cos(y0);
- sy0 = Math.sin(y0);
- return azimuthal;
- };
-
- azimuthal.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return azimuthal;
- };
-
- azimuthal.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return azimuthal;
- };
-
- return azimuthal.origin([0, 0]);
-};
-// Derived from Tom Carden's Albers implementation for Protovis.
-// http://gist.github.com/476238
-// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html
-
-d3.geo.albers = function() {
- var origin = [-98, 38],
- parallels = [29.5, 45.5],
- scale = 1000,
- translate = [480, 250],
- lng0, // d3_geo_radians * origin[0]
- n,
- C,
- p0;
-
- function albers(coordinates) {
- var t = n * (d3_geo_radians * coordinates[0] - lng0),
- p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
- return [
- scale * p * Math.sin(t) + translate[0],
- scale * (p * Math.cos(t) - p0) + translate[1]
- ];
- }
-
- albers.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale,
- p0y = p0 + y,
- t = Math.atan2(x, p0y),
- p = Math.sqrt(x * x + p0y * p0y);
- return [
- (lng0 + t / n) / d3_geo_radians,
- Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians
- ];
- };
-
- function reload() {
- var phi1 = d3_geo_radians * parallels[0],
- phi2 = d3_geo_radians * parallels[1],
- lat0 = d3_geo_radians * origin[1],
- s = Math.sin(phi1),
- c = Math.cos(phi1);
- lng0 = d3_geo_radians * origin[0];
- n = .5 * (s + Math.sin(phi2));
- C = c * c + 2 * n * s;
- p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
- return albers;
- }
-
- albers.origin = function(x) {
- if (!arguments.length) return origin;
- origin = [+x[0], +x[1]];
- return reload();
- };
-
- albers.parallels = function(x) {
- if (!arguments.length) return parallels;
- parallels = [+x[0], +x[1]];
- return reload();
- };
-
- albers.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return albers;
- };
-
- albers.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return albers;
- };
-
- return reload();
-};
-
-// A composite projection for the United States, 960x500. The set of standard
-// parallels for each region comes from USGS, which is published here:
-// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
-// TODO allow the composite projection to be rescaled?
-d3.geo.albersUsa = function() {
- var lower48 = d3.geo.albers();
-
- var alaska = d3.geo.albers()
- .origin([-160, 60])
- .parallels([55, 65]);
-
- var hawaii = d3.geo.albers()
- .origin([-160, 20])
- .parallels([8, 18]);
-
- var puertoRico = d3.geo.albers()
- .origin([-60, 10])
- .parallels([8, 18]);
-
- function albersUsa(coordinates) {
- var lon = coordinates[0],
- lat = coordinates[1];
- return (lat > 50 ? alaska
- : lon < -140 ? hawaii
- : lat < 21 ? puertoRico
- : lower48)(coordinates);
- }
-
- albersUsa.scale = function(x) {
- if (!arguments.length) return lower48.scale();
- lower48.scale(x);
- alaska.scale(x * .6);
- hawaii.scale(x);
- puertoRico.scale(x * 1.5);
- return albersUsa.translate(lower48.translate());
- };
-
- albersUsa.translate = function(x) {
- if (!arguments.length) return lower48.translate();
- var dz = lower48.scale() / 1000,
- dx = x[0],
- dy = x[1];
- lower48.translate(x);
- alaska.translate([dx - 400 * dz, dy + 170 * dz]);
- hawaii.translate([dx - 190 * dz, dy + 200 * dz]);
- puertoRico.translate([dx + 580 * dz, dy + 430 * dz]);
- return albersUsa;
- };
-
- return albersUsa.scale(lower48.scale());
-};
-d3.geo.bonne = function() {
- var scale = 200,
- translate = [480, 250],
- x0, // origin longitude in radians
- y0, // origin latitude in radians
- y1, // parallel latitude in radians
- c1; // cot(y1)
-
- function bonne(coordinates) {
- var x = coordinates[0] * d3_geo_radians - x0,
- y = coordinates[1] * d3_geo_radians - y0;
- if (y1) {
- var p = c1 + y1 - y, E = x * Math.cos(y) / p;
- x = p * Math.sin(E);
- y = p * Math.cos(E) - c1;
- } else {
- x *= Math.cos(y);
- y *= -1;
- }
- return [
- scale * x + translate[0],
- scale * y + translate[1]
- ];
- }
-
- bonne.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale;
- if (y1) {
- var c = c1 + y, p = Math.sqrt(x * x + c * c);
- y = c1 + y1 - p;
- x = x0 + p * Math.atan2(x, c) / Math.cos(y);
- } else {
- y *= -1;
- x /= Math.cos(y);
- }
- return [
- x / d3_geo_radians,
- y / d3_geo_radians
- ];
- };
-
- // 90° for Werner, 0° for Sinusoidal
- bonne.parallel = function(x) {
- if (!arguments.length) return y1 / d3_geo_radians;
- c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
- return bonne;
- };
-
- bonne.origin = function(x) {
- if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians];
- x0 = x[0] * d3_geo_radians;
- y0 = x[1] * d3_geo_radians;
- return bonne;
- };
-
- bonne.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return bonne;
- };
-
- bonne.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return bonne;
- };
-
- return bonne.origin([0, 0]).parallel(45);
-};
-d3.geo.equirectangular = function() {
- var scale = 500,
- translate = [480, 250];
-
- function equirectangular(coordinates) {
- var x = coordinates[0] / 360,
- y = -coordinates[1] / 360;
- return [
- scale * x + translate[0],
- scale * y + translate[1]
- ];
- }
-
- equirectangular.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale;
- return [
- 360 * x,
- -360 * y
- ];
- };
-
- equirectangular.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return equirectangular;
- };
-
- equirectangular.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return equirectangular;
- };
-
- return equirectangular;
-};
-d3.geo.mercator = function() {
- var scale = 500,
- translate = [480, 250];
-
- function mercator(coordinates) {
- var x = coordinates[0] / 360,
- y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
- return [
- scale * x + translate[0],
- scale * Math.max(-.5, Math.min(.5, y)) + translate[1]
- ];
- }
-
- mercator.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale;
- return [
- 360 * x,
- 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90
- ];
- };
-
- mercator.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return mercator;
- };
-
- mercator.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return mercator;
- };
-
- return mercator;
-};
-function d3_geo_type(types, defaultValue) {
- return function(object) {
- return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
- };
-}
-/**
- * Returns a function that, given a GeoJSON object (e.g., a feature), returns
- * the corresponding SVG path. The function can be customized by overriding the
- * projection. Point features are mapped to circles with a default radius of
- * 4.5px; the radius can be specified either as a constant or a function that
- * is evaluated per object.
- */
-d3.geo.path = function() {
- var pointRadius = 4.5,
- pointCircle = d3_path_circle(pointRadius),
- projection = d3.geo.albersUsa();
-
- function path(d, i) {
- if (typeof pointRadius === "function") {
- pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
- }
- return pathType(d) || null;
- }
-
- function project(coordinates) {
- return projection(coordinates).join(",");
- }
-
- var pathType = d3_geo_type({
-
- FeatureCollection: function(o) {
- var path = [],
- features = o.features,
- i = -1, // features.index
- n = features.length;
- while (++i < n) path.push(pathType(features[i].geometry));
- return path.join("");
- },
-
- Feature: function(o) {
- return pathType(o.geometry);
- },
-
- Point: function(o) {
- return "M" + project(o.coordinates) + pointCircle;
- },
-
- MultiPoint: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length;
- while (++i < n) path.push("M", project(coordinates[i]), pointCircle);
- return path.join("");
- },
-
- LineString: function(o) {
- var path = ["M"],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length;
- while (++i < n) path.push(project(coordinates[i]), "L");
- path.pop();
- return path.join("");
- },
-
- MultiLineString: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length,
- subcoordinates, // coordinates[i]
- j, // subcoordinates.index
- m; // subcoordinates.length
- while (++i < n) {
- subcoordinates = coordinates[i];
- j = -1;
- m = subcoordinates.length;
- path.push("M");
- while (++j < m) path.push(project(subcoordinates[j]), "L");
- path.pop();
- }
- return path.join("");
- },
-
- Polygon: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length,
- subcoordinates, // coordinates[i]
- j, // subcoordinates.index
- m; // subcoordinates.length
- while (++i < n) {
- subcoordinates = coordinates[i];
- j = -1;
- if ((m = subcoordinates.length - 1) > 0) {
- path.push("M");
- while (++j < m) path.push(project(subcoordinates[j]), "L");
- path[path.length - 1] = "Z";
- }
- }
- return path.join("");
- },
-
- MultiPolygon: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates index
- n = coordinates.length,
- subcoordinates, // coordinates[i]
- j, // subcoordinates index
- m, // subcoordinates.length
- subsubcoordinates, // subcoordinates[j]
- k, // subsubcoordinates index
- p; // subsubcoordinates.length
- while (++i < n) {
- subcoordinates = coordinates[i];
- j = -1;
- m = subcoordinates.length;
- while (++j < m) {
- subsubcoordinates = subcoordinates[j];
- k = -1;
- if ((p = subsubcoordinates.length - 1) > 0) {
- path.push("M");
- while (++k < p) path.push(project(subsubcoordinates[k]), "L");
- path[path.length - 1] = "Z";
- }
- }
- }
- return path.join("");
- },
-
- GeometryCollection: function(o) {
- var path = [],
- geometries = o.geometries,
- i = -1, // geometries index
- n = geometries.length;
- while (++i < n) path.push(pathType(geometries[i]));
- return path.join("");
- }
-
- });
-
- var areaType = path.area = d3_geo_type({
-
- FeatureCollection: function(o) {
- var area = 0,
- features = o.features,
- i = -1, // features.index
- n = features.length;
- while (++i < n) area += areaType(features[i]);
- return area;
- },
-
- Feature: function(o) {
- return areaType(o.geometry);
- },
-
- Polygon: function(o) {
- return polygonArea(o.coordinates);
- },
-
- MultiPolygon: function(o) {
- var sum = 0,
- coordinates = o.coordinates,
- i = -1, // coordinates index
- n = coordinates.length;
- while (++i < n) sum += polygonArea(coordinates[i]);
- return sum;
- },
-
- GeometryCollection: function(o) {
- var sum = 0,
- geometries = o.geometries,
- i = -1, // geometries index
- n = geometries.length;
- while (++i < n) sum += areaType(geometries[i]);
- return sum;
- }
-
- }, 0);
-
- function polygonArea(coordinates) {
- var sum = area(coordinates[0]), // exterior ring
- i = 0, // coordinates.index
- n = coordinates.length;
- while (++i < n) sum -= area(coordinates[i]); // holes
- return sum;
- }
-
- function polygonCentroid(coordinates) {
- var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring
- area = polygon.area(),
- centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1),
- x = centroid[0],
- y = centroid[1],
- z = area,
- i = 0, // coordinates index
- n = coordinates.length;
- while (++i < n) {
- polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes
- area = polygon.area();
- centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
- x -= centroid[0];
- y -= centroid[1];
- z -= area;
- }
- return [x, y, 6 * z]; // weighted centroid
- }
-
- var centroidType = path.centroid = d3_geo_type({
-
- // TODO FeatureCollection
- // TODO Point
- // TODO MultiPoint
- // TODO LineString
- // TODO MultiLineString
- // TODO GeometryCollection
-
- Feature: function(o) {
- return centroidType(o.geometry);
- },
-
- Polygon: function(o) {
- var centroid = polygonCentroid(o.coordinates);
- return [centroid[0] / centroid[2], centroid[1] / centroid[2]];
- },
-
- MultiPolygon: function(o) {
- var area = 0,
- coordinates = o.coordinates,
- centroid,
- x = 0,
- y = 0,
- z = 0,
- i = -1, // coordinates index
- n = coordinates.length;
- while (++i < n) {
- centroid = polygonCentroid(coordinates[i]);
- x += centroid[0];
- y += centroid[1];
- z += centroid[2];
- }
- return [x / z, y / z];
- }
-
- });
-
- function area(coordinates) {
- return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
- }
-
- path.projection = function(x) {
- projection = x;
- return path;
- };
-
- path.pointRadius = function(x) {
- if (typeof x === "function") pointRadius = x;
- else {
- pointRadius = +x;
- pointCircle = d3_path_circle(pointRadius);
- }
- return path;
- };
-
- return path;
-};
-
-function d3_path_circle(radius) {
- return "m0," + radius
- + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius)
- + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius)
- + "z";
-}
-/**
- * Given a GeoJSON object, returns the corresponding bounding box. The bounding
- * box is represented by a two-dimensional array: [[left, bottom], [right,
- * top]], where left is the minimum longitude, bottom is the minimum latitude,
- * right is maximum longitude, and top is the maximum latitude.
- */
-d3.geo.bounds = function(feature) {
- var left = Infinity,
- bottom = Infinity,
- right = -Infinity,
- top = -Infinity;
- d3_geo_bounds(feature, function(x, y) {
- if (x < left) left = x;
- if (x > right) right = x;
- if (y < bottom) bottom = y;
- if (y > top) top = y;
- });
- return [[left, bottom], [right, top]];
-};
-
-function d3_geo_bounds(o, f) {
- if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
-}
-
-var d3_geo_boundsTypes = {
- Feature: d3_geo_boundsFeature,
- FeatureCollection: d3_geo_boundsFeatureCollection,
- GeometryCollection: d3_geo_boundsGeometryCollection,
- LineString: d3_geo_boundsLineString,
- MultiLineString: d3_geo_boundsMultiLineString,
- MultiPoint: d3_geo_boundsLineString,
- MultiPolygon: d3_geo_boundsMultiPolygon,
- Point: d3_geo_boundsPoint,
- Polygon: d3_geo_boundsPolygon
-};
-
-function d3_geo_boundsFeature(o, f) {
- d3_geo_bounds(o.geometry, f);
-}
-
-function d3_geo_boundsFeatureCollection(o, f) {
- for (var a = o.features, i = 0, n = a.length; i < n; i++) {
- d3_geo_bounds(a[i].geometry, f);
- }
-}
-
-function d3_geo_boundsGeometryCollection(o, f) {
- for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
- d3_geo_bounds(a[i], f);
- }
-}
-
-function d3_geo_boundsLineString(o, f) {
- for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
- f.apply(null, a[i]);
- }
-}
-
-function d3_geo_boundsMultiLineString(o, f) {
- for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
- for (var b = a[i], j = 0, m = b.length; j < m; j++) {
- f.apply(null, b[j]);
- }
- }
-}
-
-function d3_geo_boundsMultiPolygon(o, f) {
- for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
- for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
- f.apply(null, b[j]);
- }
- }
-}
-
-function d3_geo_boundsPoint(o, f) {
- f.apply(null, o.coordinates);
-}
-
-function d3_geo_boundsPolygon(o, f) {
- for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
- f.apply(null, a[i]);
- }
-}
-// TODO breakAtDateLine?
-
-d3.geo.circle = function() {
- var origin = [0, 0],
- degrees = 90 - 1e-2,
- radians = degrees * d3_geo_radians,
- arc = d3.geo.greatArc().target(Object);
-
- function circle() {
- // TODO render a circle as a Polygon
- }
-
- function visible(point) {
- return arc.distance(point) < radians;
- }
-
- circle.clip = function(d) {
- arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin);
- return clipType(d);
- };
-
- var clipType = d3_geo_type({
-
- FeatureCollection: function(o) {
- var features = o.features.map(clipType).filter(Object);
- return features && (o = Object.create(o), o.features = features, o);
- },
-
- Feature: function(o) {
- var geometry = clipType(o.geometry);
- return geometry && (o = Object.create(o), o.geometry = geometry, o);
- },
-
- Point: function(o) {
- return visible(o.coordinates) && o;
- },
-
- MultiPoint: function(o) {
- var coordinates = o.coordinates.filter(visible);
- return coordinates.length && {
- type: o.type,
- coordinates: coordinates
- };
- },
-
- LineString: function(o) {
- var coordinates = clip(o.coordinates);
- return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- MultiLineString: function(o) {
- var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; });
- return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- Polygon: function(o) {
- var coordinates = o.coordinates.map(clip);
- return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- MultiPolygon: function(o) {
- var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; });
- return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- GeometryCollection: function(o) {
- var geometries = o.geometries.map(clipType).filter(Object);
- return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
- }
-
- });
-
- function clip(coordinates) {
- var i = -1,
- n = coordinates.length,
- clipped = [],
- p0,
- p1,
- p2,
- d0,
- d1;
-
- while (++i < n) {
- d1 = arc.distance(p2 = coordinates[i]);
- if (d1 < radians) {
- if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
- clipped.push(p2);
- p0 = p1 = null;
- } else {
- p1 = p2;
- if (!p0 && clipped.length) {
- clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
- p0 = p1;
- }
- }
- d0 = d1;
- }
-
- if (p1 && clipped.length) {
- d1 = arc.distance(p2 = clipped[0]);
- clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
- }
-
- return resample(clipped);
- }
-
- // Resample coordinates, creating great arcs between each.
- function resample(coordinates) {
- var i = 0,
- n = coordinates.length,
- j,
- m,
- resampled = n ? [coordinates[0]] : coordinates,
- resamples,
- origin = arc.source();
-
- while (++i < n) {
- resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
- for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]);
- }
-
- arc.source(origin);
- return resampled;
- }
-
- circle.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- return circle;
- };
-
- circle.angle = function(x) {
- if (!arguments.length) return degrees;
- radians = (degrees = +x) * d3_geo_radians;
- return circle;
- };
-
- // Precision is specified in degrees.
- circle.precision = function(x) {
- if (!arguments.length) return arc.precision();
- arc.precision(x);
- return circle;
- };
-
- return circle;
-}
-d3.geo.greatArc = function() {
- var source = d3_geo_greatArcSource,
- target = d3_geo_greatArcTarget,
- precision = 6 * d3_geo_radians;
-
- function greatArc() {
- var a = typeof source === "function" ? source.apply(this, arguments) : source,
- b = typeof target === "function" ? target.apply(this, arguments) : target,
- i = d3_geo_greatArcInterpolate(a, b),
- dt = precision / i.d,
- t = 0,
- coordinates = [a];
- while ((t += dt) < 1) coordinates.push(i(t));
- coordinates.push(b);
- return {
- type: "LineString",
- coordinates: coordinates
- };
- }
-
- // Length returned in radians; multiply by radius for distance.
- greatArc.distance = function() {
- var a = typeof source === "function" ? source.apply(this, arguments) : source,
- b = typeof target === "function" ? target.apply(this, arguments) : target;
- return d3_geo_greatArcInterpolate(a, b).d;
- };
-
- greatArc.source = function(x) {
- if (!arguments.length) return source;
- source = x;
- return greatArc;
- };
-
- greatArc.target = function(x) {
- if (!arguments.length) return target;
- target = x;
- return greatArc;
- };
-
- // Precision is specified in degrees.
- greatArc.precision = function(x) {
- if (!arguments.length) return precision / d3_geo_radians;
- precision = x * d3_geo_radians;
- return greatArc;
- };
-
- return greatArc;
-};
-
-function d3_geo_greatArcSource(d) {
- return d.source;
-}
-
-function d3_geo_greatArcTarget(d) {
- return d.target;
-}
-
-function d3_geo_greatArcInterpolate(a, b) {
- var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0),
- y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0),
- x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1),
- y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1),
- d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))),
- sd = Math.sin(d);
-
- // From http://williams.best.vwh.net/avform.htm#Intermediate
- function interpolate(t) {
- var A = Math.sin(d - (t *= d)) / sd,
- B = Math.sin(t) / sd,
- x = A * cy0 * cx0 + B * cy1 * cx1,
- y = A * cy0 * sx0 + B * cy1 * sx1,
- z = A * sy0 + B * sy1;
- return [
- Math.atan2(y, x) / d3_geo_radians,
- Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians
- ];
- }
-
- return interpolate;
-}
-d3.geo.greatCircle = d3.geo.circle;
-d3.geom = {};
-/**
- * Computes a contour for a given input grid function using the <a
- * href="http://en.wikipedia.org/wiki/Marching_squares">marching
- * squares</a> algorithm. Returns the contour polygon as an array of points.
- *
- * @param grid a two-input function(x, y) that returns true for values
- * inside the contour and false for values outside the contour.
- * @param start an optional starting point [x, y] on the grid.
- * @returns polygon [[x1, y1], [x2, y2], …]
- */
-d3.geom.contour = function(grid, start) {
- var s = start || d3_geom_contourStart(grid), // starting point
- c = [], // contour polygon
- x = s[0], // current x position
- y = s[1], // current y position
- dx = 0, // next x direction
- dy = 0, // next y direction
- pdx = NaN, // previous x direction
- pdy = NaN, // previous y direction
- i = 0;
-
- do {
- // determine marching squares index
- i = 0;
- if (grid(x-1, y-1)) i += 1;
- if (grid(x, y-1)) i += 2;
- if (grid(x-1, y )) i += 4;
- if (grid(x, y )) i += 8;
-
- // determine next direction
- if (i === 6) {
- dx = pdy === -1 ? -1 : 1;
- dy = 0;
- } else if (i === 9) {
- dx = 0;
- dy = pdx === 1 ? -1 : 1;
- } else {
- dx = d3_geom_contourDx[i];
- dy = d3_geom_contourDy[i];
- }
-
- // update contour polygon
- if (dx != pdx && dy != pdy) {
- c.push([x, y]);
- pdx = dx;
- pdy = dy;
- }
-
- x += dx;
- y += dy;
- } while (s[0] != x || s[1] != y);
-
- return c;
-};
-
-// lookup tables for marching directions
-var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
- d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
-
-function d3_geom_contourStart(grid) {
- var x = 0,
- y = 0;
-
- // search for a starting point; begin at origin
- // and proceed along outward-expanding diagonals
- while (true) {
- if (grid(x,y)) {
- return [x,y];
- }
- if (x === 0) {
- x = y + 1;
- y = 0;
- } else {
- x = x - 1;
- y = y + 1;
- }
- }
-}
-/**
- * Computes the 2D convex hull of a set of points using Graham's scanning
- * algorithm. The algorithm has been implemented as described in Cormen,
- * Leiserson, and Rivest's Introduction to Algorithms. The running time of
- * this algorithm is O(n log n), where n is the number of input points.
- *
- * @param vertices [[x1, y1], [x2, y2], …]
- * @returns polygon [[x1, y1], [x2, y2], …]
- */
-d3.geom.hull = function(vertices) {
- if (vertices.length < 3) return [];
-
- var len = vertices.length,
- plen = len - 1,
- points = [],
- stack = [],
- i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
-
- // find the starting ref point: leftmost point with the minimum y coord
- for (i=1; i<len; ++i) {
- if (vertices[i][1] < vertices[h][1]) {
- h = i;
- } else if (vertices[i][1] == vertices[h][1]) {
- h = (vertices[i][0] < vertices[h][0] ? i : h);
- }
- }
-
- // calculate polar angles from ref point and sort
- for (i=0; i<len; ++i) {
- if (i === h) continue;
- y1 = vertices[i][1] - vertices[h][1];
- x1 = vertices[i][0] - vertices[h][0];
- points.push({angle: Math.atan2(y1, x1), index: i});
- }
- points.sort(function(a, b) { return a.angle - b.angle; });
-
- // toss out duplicate angles
- a = points[0].angle;
- v = points[0].index;
- u = 0;
- for (i=1; i<plen; ++i) {
- j = points[i].index;
- if (a == points[i].angle) {
- // keep angle for point most distant from the reference
- x1 = vertices[v][0] - vertices[h][0];
- y1 = vertices[v][1] - vertices[h][1];
- x2 = vertices[j][0] - vertices[h][0];
- y2 = vertices[j][1] - vertices[h][1];
- if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) {
- points[i].index = -1;
- } else {
- points[u].index = -1;
- a = points[i].angle;
- u = i;
- v = j;
- }
- } else {
- a = points[i].angle;
- u = i;
- v = j;
- }
- }
-
- // initialize the stack
- stack.push(h);
- for (i=0, j=0; i<2; ++j) {
- if (points[j].index !== -1) {
- stack.push(points[j].index);
- i++;
- }
- }
- sp = stack.length;
-
- // do graham's scan
- for (; j<plen; ++j) {
- if (points[j].index === -1) continue; // skip tossed out points
- while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) {
- --sp;
- }
- stack[sp++] = points[j].index;
- }
-
- // construct the hull
- var poly = [];
- for (i=0; i<sp; ++i) {
- poly.push(vertices[stack[i]]);
- }
- return poly;
-}
-
-// are three points in counter-clockwise order?
-function d3_geom_hullCCW(i1, i2, i3, v) {
- var t, a, b, c, d, e, f;
- t = v[i1]; a = t[0]; b = t[1];
- t = v[i2]; c = t[0]; d = t[1];
- t = v[i3]; e = t[0]; f = t[1];
- return ((f-b)*(c-a) - (d-b)*(e-a)) > 0;
-}
-// Note: requires coordinates to be counterclockwise and convex!
-d3.geom.polygon = function(coordinates) {
-
- coordinates.area = function() {
- var i = 0,
- n = coordinates.length,
- a = coordinates[n - 1][0] * coordinates[0][1],
- b = coordinates[n - 1][1] * coordinates[0][0];
- while (++i < n) {
- a += coordinates[i - 1][0] * coordinates[i][1];
- b += coordinates[i - 1][1] * coordinates[i][0];
- }
- return (b - a) * .5;
- };
-
- coordinates.centroid = function(k) {
- var i = -1,
- n = coordinates.length,
- x = 0,
- y = 0,
- a,
- b = coordinates[n - 1],
- c;
- if (!arguments.length) k = -1 / (6 * coordinates.area());
- while (++i < n) {
- a = b;
- b = coordinates[i];
- c = a[0] * b[1] - b[0] * a[1];
- x += (a[0] + b[0]) * c;
- y += (a[1] + b[1]) * c;
- }
- return [x * k, y * k];
- };
-
- // The Sutherland-Hodgman clipping algorithm.
- coordinates.clip = function(subject) {
- var input,
- i = -1,
- n = coordinates.length,
- j,
- m,
- a = coordinates[n - 1],
- b,
- c,
- d;
- while (++i < n) {
- input = subject.slice();
- subject.length = 0;
- b = coordinates[i];
- c = input[(m = input.length) - 1];
- j = -1;
- while (++j < m) {
- d = input[j];
- if (d3_geom_polygonInside(d, a, b)) {
- if (!d3_geom_polygonInside(c, a, b)) {
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
- }
- subject.push(d);
- } else if (d3_geom_polygonInside(c, a, b)) {
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
- }
- c = d;
- }
- a = b;
- }
- return subject;
- };
-
- return coordinates;
-};
-
-function d3_geom_polygonInside(p, a, b) {
- return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
-}
-
-// Intersect two infinite lines cd and ab.
-function d3_geom_polygonIntersect(c, d, a, b) {
- var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
- y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
- x13 = x1 - x3,
- x21 = x2 - x1,
- x43 = x4 - x3,
- y13 = y1 - y3,
- y21 = y2 - y1,
- y43 = y4 - y3,
- ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
- return [x1 + ua * x21, y1 + ua * y21];
-}
-// Adapted from Nicolas Garcia Belmonte's JIT implementation:
-// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
-// http://blog.thejit.org/assets/voronoijs/voronoi.js
-// See lib/jit/LICENSE for details.
-
-// Notes:
-//
-// This implementation does not clip the returned polygons, so if you want to
-// clip them to a particular shape you will need to do that either in SVG or by
-// post-processing with d3.geom.polygon's clip method.
-//
-// If any vertices are coincident or have NaN positions, the behavior of this
-// method is undefined. Most likely invalid polygons will be returned. You
-// should filter invalid points, and consolidate coincident points, before
-// computing the tessellation.
-
-/**
- * @param vertices [[x1, y1], [x2, y2], …]
- * @returns polygons [[[x1, y1], [x2, y2], …], …]
- */
-d3.geom.voronoi = function(vertices) {
- var polygons = vertices.map(function() { return []; });
-
- d3_voronoi_tessellate(vertices, function(e) {
- var s1,
- s2,
- x1,
- x2,
- y1,
- y2;
- if (e.a === 1 && e.b >= 0) {
- s1 = e.ep.r;
- s2 = e.ep.l;
- } else {
- s1 = e.ep.l;
- s2 = e.ep.r;
- }
- if (e.a === 1) {
- y1 = s1 ? s1.y : -1e6;
- x1 = e.c - e.b * y1;
- y2 = s2 ? s2.y : 1e6;
- x2 = e.c - e.b * y2;
- } else {
- x1 = s1 ? s1.x : -1e6;
- y1 = e.c - e.a * x1;
- x2 = s2 ? s2.x : 1e6;
- y2 = e.c - e.a * x2;
- }
- var v1 = [x1, y1],
- v2 = [x2, y2];
- polygons[e.region.l.index].push(v1, v2);
- polygons[e.region.r.index].push(v1, v2);
- });
-
- // Reconnect the polygon segments into counterclockwise loops.
- return polygons.map(function(polygon, i) {
- var cx = vertices[i][0],
- cy = vertices[i][1];
- polygon.forEach(function(v) {
- v.angle = Math.atan2(v[0] - cx, v[1] - cy);
- });
- return polygon.sort(function(a, b) {
- return a.angle - b.angle;
- }).filter(function(d, i) {
- return !i || (d.angle - polygon[i - 1].angle > 1e-10);
- });
- });
-};
-
-var d3_voronoi_opposite = {"l": "r", "r": "l"};
-
-function d3_voronoi_tessellate(vertices, callback) {
-
- var Sites = {
- list: vertices
- .map(function(v, i) {
- return {
- index: i,
- x: v[0],
- y: v[1]
- };
- })
- .sort(function(a, b) {
- return a.y < b.y ? -1
- : a.y > b.y ? 1
- : a.x < b.x ? -1
- : a.x > b.x ? 1
- : 0;
- }),
- bottomSite: null
- };
-
- var EdgeList = {
- list: [],
- leftEnd: null,
- rightEnd: null,
-
- init: function() {
- EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
- EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
- EdgeList.leftEnd.r = EdgeList.rightEnd;
- EdgeList.rightEnd.l = EdgeList.leftEnd;
- EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
- },
-
- createHalfEdge: function(edge, side) {
- return {
- edge: edge,
- side: side,
- vertex: null,
- "l": null,
- "r": null
- };
- },
-
- insert: function(lb, he) {
- he.l = lb;
- he.r = lb.r;
- lb.r.l = he;
- lb.r = he;
- },
-
- leftBound: function(p) {
- var he = EdgeList.leftEnd;
- do {
- he = he.r;
- } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
- he = he.l;
- return he;
- },
-
- del: function(he) {
- he.l.r = he.r;
- he.r.l = he.l;
- he.edge = null;
- },
-
- right: function(he) {
- return he.r;
- },
-
- left: function(he) {
- return he.l;
- },
-
- leftRegion: function(he) {
- return he.edge == null
- ? Sites.bottomSite
- : he.edge.region[he.side];
- },
-
- rightRegion: function(he) {
- return he.edge == null
- ? Sites.bottomSite
- : he.edge.region[d3_voronoi_opposite[he.side]];
- }
- };
-
- var Geom = {
-
- bisect: function(s1, s2) {
- var newEdge = {
- region: {"l": s1, "r": s2},
- ep: {"l": null, "r": null}
- };
-
- var dx = s2.x - s1.x,
- dy = s2.y - s1.y,
- adx = dx > 0 ? dx : -dx,
- ady = dy > 0 ? dy : -dy;
-
- newEdge.c = s1.x * dx + s1.y * dy
- + (dx * dx + dy * dy) * .5;
-
- if (adx > ady) {
- newEdge.a = 1;
- newEdge.b = dy / dx;
- newEdge.c /= dx;
- } else {
- newEdge.b = 1;
- newEdge.a = dx / dy;
- newEdge.c /= dy;
- }
-
- return newEdge;
- },
-
- intersect: function(el1, el2) {
- var e1 = el1.edge,
- e2 = el2.edge;
- if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
- return null;
- }
- var d = (e1.a * e2.b) - (e1.b * e2.a);
- if (Math.abs(d) < 1e-10) {
- return null;
- }
- var xint = (e1.c * e2.b - e2.c * e1.b) / d,
- yint = (e2.c * e1.a - e1.c * e2.a) / d,
- e1r = e1.region.r,
- e2r = e2.region.r,
- el,
- e;
- if ((e1r.y < e2r.y) ||
- (e1r.y == e2r.y && e1r.x < e2r.x)) {
- el = el1;
- e = e1;
- } else {
- el = el2;
- e = e2;
- }
- var rightOfSite = (xint >= e.region.r.x);
- if ((rightOfSite && (el.side === "l")) ||
- (!rightOfSite && (el.side === "r"))) {
- return null;
- }
- return {
- x: xint,
- y: yint
- };
- },
-
- rightOf: function(he, p) {
- var e = he.edge,
- topsite = e.region.r,
- rightOfSite = (p.x > topsite.x);
-
- if (rightOfSite && (he.side === "l")) {
- return 1;
- }
- if (!rightOfSite && (he.side === "r")) {
- return 0;
- }
- if (e.a === 1) {
- var dyp = p.y - topsite.y,
- dxp = p.x - topsite.x,
- fast = 0,
- above = 0;
-
- if ((!rightOfSite && (e.b < 0)) ||
- (rightOfSite && (e.b >= 0))) {
- above = fast = (dyp >= e.b * dxp);
- } else {
- above = ((p.x + p.y * e.b) > e.c);
- if (e.b < 0) {
- above = !above;
- }
- if (!above) {
- fast = 1;
- }
- }
- if (!fast) {
- var dxs = topsite.x - e.region.l.x;
- above = (e.b * (dxp * dxp - dyp * dyp)) <
- (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
-
- if (e.b < 0) {
- above = !above;
- }
- }
- } else /* e.b == 1 */ {
- var yl = e.c - e.a * p.x,
- t1 = p.y - yl,
- t2 = p.x - topsite.x,
- t3 = yl - topsite.y;
-
- above = (t1 * t1) > (t2 * t2 + t3 * t3);
- }
- return he.side === "l" ? above : !above;
- },
-
- endPoint: function(edge, side, site) {
- edge.ep[side] = site;
- if (!edge.ep[d3_voronoi_opposite[side]]) return;
- callback(edge);
- },
-
- distance: function(s, t) {
- var dx = s.x - t.x,
- dy = s.y - t.y;
- return Math.sqrt(dx * dx + dy * dy);
- }
- };
-
- var EventQueue = {
- list: [],
-
- insert: function(he, site, offset) {
- he.vertex = site;
- he.ystar = site.y + offset;
- for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) {
- var next = list[i];
- if (he.ystar > next.ystar ||
- (he.ystar == next.ystar &&
- site.x > next.vertex.x)) {
- continue;
- } else {
- break;
- }
- }
- list.splice(i, 0, he);
- },
-
- del: function(he) {
- for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {}
- ls.splice(i, 1);
- },
-
- empty: function() { return EventQueue.list.length === 0; },
-
- nextEvent: function(he) {
- for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) {
- if (ls[i] == he) return ls[i+1];
- }
- return null;
- },
-
- min: function() {
- var elem = EventQueue.list[0];
- return {
- x: elem.vertex.x,
- y: elem.ystar
- };
- },
-
- extractMin: function() {
- return EventQueue.list.shift();
- }
- };
-
- EdgeList.init();
- Sites.bottomSite = Sites.list.shift();
-
- var newSite = Sites.list.shift(), newIntStar;
- var lbnd, rbnd, llbnd, rrbnd, bisector;
- var bot, top, temp, p, v;
- var e, pm;
-
- while (true) {
- if (!EventQueue.empty()) {
- newIntStar = EventQueue.min();
- }
- if (newSite && (EventQueue.empty()
- || newSite.y < newIntStar.y
- || (newSite.y == newIntStar.y
- && newSite.x < newIntStar.x))) { //new site is smallest
- lbnd = EdgeList.leftBound(newSite);
- rbnd = EdgeList.right(lbnd);
- bot = EdgeList.rightRegion(lbnd);
- e = Geom.bisect(bot, newSite);
- bisector = EdgeList.createHalfEdge(e, "l");
- EdgeList.insert(lbnd, bisector);
- p = Geom.intersect(lbnd, bisector);
- if (p) {
- EventQueue.del(lbnd);
- EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
- }
- lbnd = bisector;
- bisector = EdgeList.createHalfEdge(e, "r");
- EdgeList.insert(lbnd, bisector);
- p = Geom.intersect(bisector, rbnd);
- if (p) {
- EventQueue.insert(bisector, p, Geom.distance(p, newSite));
- }
- newSite = Sites.list.shift();
- } else if (!EventQueue.empty()) { //intersection is smallest
- lbnd = EventQueue.extractMin();
- llbnd = EdgeList.left(lbnd);
- rbnd = EdgeList.right(lbnd);
- rrbnd = EdgeList.right(rbnd);
- bot = EdgeList.leftRegion(lbnd);
- top = EdgeList.rightRegion(rbnd);
- v = lbnd.vertex;
- Geom.endPoint(lbnd.edge, lbnd.side, v);
- Geom.endPoint(rbnd.edge, rbnd.side, v);
- EdgeList.del(lbnd);
- EventQueue.del(rbnd);
- EdgeList.del(rbnd);
- pm = "l";
- if (bot.y > top.y) {
- temp = bot;
- bot = top;
- top = temp;
- pm = "r";
- }
- e = Geom.bisect(bot, top);
- bisector = EdgeList.createHalfEdge(e, pm);
- EdgeList.insert(llbnd, bisector);
- Geom.endPoint(e, d3_voronoi_opposite[pm], v);
- p = Geom.intersect(llbnd, bisector);
- if (p) {
- EventQueue.del(llbnd);
- EventQueue.insert(llbnd, p, Geom.distance(p, bot));
- }
- p = Geom.intersect(bisector, rrbnd);
- if (p) {
- EventQueue.insert(bisector, p, Geom.distance(p, bot));
- }
- } else {
- break;
- }
- }//end while
-
- for (lbnd = EdgeList.right(EdgeList.leftEnd);
- lbnd != EdgeList.rightEnd;
- lbnd = EdgeList.right(lbnd)) {
- callback(lbnd.edge);
- }
-}
-/**
-* @param vertices [[x1, y1], [x2, y2], …]
-* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …]
- */
-d3.geom.delaunay = function(vertices) {
- var edges = vertices.map(function() { return []; }),
- triangles = [];
-
- // Use the Voronoi tessellation to determine Delaunay edges.
- d3_voronoi_tessellate(vertices, function(e) {
- edges[e.region.l.index].push(vertices[e.region.r.index]);
- });
-
- // Reconnect the edges into counterclockwise triangles.
- edges.forEach(function(edge, i) {
- var v = vertices[i],
- cx = v[0],
- cy = v[1];
- edge.forEach(function(v) {
- v.angle = Math.atan2(v[0] - cx, v[1] - cy);
- });
- edge.sort(function(a, b) {
- return a.angle - b.angle;
- });
- for (var j = 0, m = edge.length - 1; j < m; j++) {
- triangles.push([v, edge[j], edge[j + 1]]);
- }
- });
-
- return triangles;
-};
-// Constructs a new quadtree for the specified array of points. A quadtree is a
-// two-dimensional recursive spatial subdivision. This implementation uses
-// square partitions, dividing each square into four equally-sized squares. Each
-// point exists in a unique node; if multiple points are in the same position,
-// some points may be stored on internal nodes rather than leaf nodes. Quadtrees
-// can be used to accelerate various spatial operations, such as the Barnes-Hut
-// approximation for computing n-body forces, or collision detection.
-d3.geom.quadtree = function(points, x1, y1, x2, y2) {
- var p,
- i = -1,
- n = points.length;
-
- // Type conversion for deprecated API.
- if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
-
- // Allow bounds to be specified explicitly.
- if (arguments.length < 5) {
- if (arguments.length === 3) {
- y2 = x2 = y1;
- y1 = x1;
- } else {
- x1 = y1 = Infinity;
- x2 = y2 = -Infinity;
-
- // Compute bounds.
- while (++i < n) {
- p = points[i];
- if (p.x < x1) x1 = p.x;
- if (p.y < y1) y1 = p.y;
- if (p.x > x2) x2 = p.x;
- if (p.y > y2) y2 = p.y;
- }
-
- // Squarify the bounds.
- var dx = x2 - x1,
- dy = y2 - y1;
- if (dx > dy) y2 = y1 + dx;
- else x2 = x1 + dy;
- }
- }
-
- // Recursively inserts the specified point p at the node n or one of its
- // descendants. The bounds are defined by [x1, x2] and [y1, y2].
- function insert(n, p, x1, y1, x2, y2) {
- if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points
- if (n.leaf) {
- var v = n.point;
- if (v) {
- // If the point at this leaf node is at the same position as the new
- // point we are adding, we leave the point associated with the
- // internal node while adding the new point to a child node. This
- // avoids infinite recursion.
- if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) {
- insertChild(n, p, x1, y1, x2, y2);
- } else {
- n.point = null;
- insertChild(n, v, x1, y1, x2, y2);
- insertChild(n, p, x1, y1, x2, y2);
- }
- } else {
- n.point = p;
- }
- } else {
- insertChild(n, p, x1, y1, x2, y2);
- }
- }
-
- // Recursively inserts the specified point p into a descendant of node n. The
- // bounds are defined by [x1, x2] and [y1, y2].
- function insertChild(n, p, x1, y1, x2, y2) {
- // Compute the split point, and the quadrant in which to insert p.
- var sx = (x1 + x2) * .5,
- sy = (y1 + y2) * .5,
- right = p.x >= sx,
- bottom = p.y >= sy,
- i = (bottom << 1) + right;
-
- // Recursively insert into the child node.
- n.leaf = false;
- n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
-
- // Update the bounds as we recurse.
- if (right) x1 = sx; else x2 = sx;
- if (bottom) y1 = sy; else y2 = sy;
- insert(n, p, x1, y1, x2, y2);
- }
-
- // Create the root node.
- var root = d3_geom_quadtreeNode();
-
- root.add = function(p) {
- insert(root, p, x1, y1, x2, y2);
- };
-
- root.visit = function(f) {
- d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
- };
-
- // Insert all points.
- points.forEach(root.add);
- return root;
-};
-
-function d3_geom_quadtreeNode() {
- return {
- leaf: true,
- nodes: [],
- point: null
- };
-}
-
-function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
- if (!f(node, x1, y1, x2, y2)) {
- var sx = (x1 + x2) * .5,
- sy = (y1 + y2) * .5,
- children = node.nodes;
- if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
- if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
- if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
- if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
- }
-}
-
-function d3_geom_quadtreePoint(p) {
- return {
- x: p[0],
- y: p[1]
- };
-}
-d3.time = {};
-
-var d3_time = Date;
-
-function d3_time_utc() {
- this._ = new Date(arguments.length > 1
- ? Date.UTC.apply(this, arguments)
- : arguments[0]);
-}
-
-d3_time_utc.prototype = {
- getDate: function() { return this._.getUTCDate(); },
- getDay: function() { return this._.getUTCDay(); },
- getFullYear: function() { return this._.getUTCFullYear(); },
- getHours: function() { return this._.getUTCHours(); },
- getMilliseconds: function() { return this._.getUTCMilliseconds(); },
- getMinutes: function() { return this._.getUTCMinutes(); },
- getMonth: function() { return this._.getUTCMonth(); },
- getSeconds: function() { return this._.getUTCSeconds(); },
- getTime: function() { return this._.getTime(); },
- getTimezoneOffset: function() { return 0; },
- valueOf: function() { return this._.valueOf(); },
- setDate: function() { d3_time_prototype.setUTCDate.apply(this._, arguments); },
- setDay: function() { d3_time_prototype.setUTCDay.apply(this._, arguments); },
- setFullYear: function() { d3_time_prototype.setUTCFullYear.apply(this._, arguments); },
- setHours: function() { d3_time_prototype.setUTCHours.apply(this._, arguments); },
- setMilliseconds: function() { d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); },
- setMinutes: function() { d3_time_prototype.setUTCMinutes.apply(this._, arguments); },
- setMonth: function() { d3_time_prototype.setUTCMonth.apply(this._, arguments); },
- setSeconds: function() { d3_time_prototype.setUTCSeconds.apply(this._, arguments); },
- setTime: function() { d3_time_prototype.setTime.apply(this._, arguments); }
-};
-
-var d3_time_prototype = Date.prototype;
-d3.time.format = function(template) {
- var n = template.length;
-
- function format(date) {
- var string = [],
- i = -1,
- j = 0,
- c,
- f;
- while (++i < n) {
- if (template.charCodeAt(i) == 37) {
- string.push(
- template.substring(j, i),
- (f = d3_time_formats[c = template.charAt(++i)])
- ? f(date) : c);
- j = i + 1;
- }
- }
- string.push(template.substring(j, i));
- return string.join("");
- }
-
- format.parse = function(string) {
- var d = {y: 1900, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0},
- i = d3_time_parse(d, template, string, 0);
- if (i != string.length) return null;
-
- // The am-pm flag is 0 for AM, and 1 for PM.
- if ("p" in d) d.H = d.H % 12 + d.p * 12;
-
- var date = new d3_time();
- date.setFullYear(d.y, d.m, d.d);
- date.setHours(d.H, d.M, d.S, d.L);
- return date;
- };
-
- format.toString = function() {
- return template;
- };
-
- return format;
-};
-
-function d3_time_parse(date, template, string, j) {
- var c,
- p,
- i = 0,
- n = template.length,
- m = string.length;
- while (i < n) {
- if (j >= m) return -1;
- c = template.charCodeAt(i++);
- if (c == 37) {
- p = d3_time_parsers[template.charAt(i++)];
- if (!p || ((j = p(date, string, j)) < 0)) return -1;
- } else if (c != string.charCodeAt(j++)) {
- return -1;
- }
- }
- return j;
-}
-
-var d3_time_zfill2 = d3.format("02d"),
- d3_time_zfill3 = d3.format("03d"),
- d3_time_zfill4 = d3.format("04d"),
- d3_time_sfill2 = d3.format("2d");
-
-var d3_time_formats = {
- a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); },
- A: function(d) { return d3_time_weekdays[d.getDay()]; },
- b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); },
- B: function(d) { return d3_time_months[d.getMonth()]; },
- c: d3.time.format("%a %b %e %H:%M:%S %Y"),
- d: function(d) { return d3_time_zfill2(d.getDate()); },
- e: function(d) { return d3_time_sfill2(d.getDate()); },
- H: function(d) { return d3_time_zfill2(d.getHours()); },
- I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); },
- j: function(d) { return d3_time_zfill3(1 + d3.time.dayOfYear(d)); },
- L: function(d) { return d3_time_zfill3(d.getMilliseconds()); },
- m: function(d) { return d3_time_zfill2(d.getMonth() + 1); },
- M: function(d) { return d3_time_zfill2(d.getMinutes()); },
- p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; },
- S: function(d) { return d3_time_zfill2(d.getSeconds()); },
- U: function(d) { return d3_time_zfill2(d3.time.sundayOfYear(d)); },
- w: function(d) { return d.getDay(); },
- W: function(d) { return d3_time_zfill2(d3.time.mondayOfYear(d)); },
- x: d3.time.format("%m/%d/%y"),
- X: d3.time.format("%H:%M:%S"),
- y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); },
- Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); },
- Z: d3_time_zone,
- "%": function(d) { return "%"; }
-};
-
-var d3_time_parsers = {
- a: d3_time_parseWeekdayAbbrev,
- A: d3_time_parseWeekday,
- b: d3_time_parseMonthAbbrev,
- B: d3_time_parseMonth,
- c: d3_time_parseLocaleFull,
- d: d3_time_parseDay,
- e: d3_time_parseDay,
- H: d3_time_parseHour24,
- I: d3_time_parseHour24,
- // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; },
- L: d3_time_parseMilliseconds,
- m: d3_time_parseMonthNumber,
- M: d3_time_parseMinutes,
- p: d3_time_parseAmPm,
- S: d3_time_parseSeconds,
- // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; },
- // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; },
- // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; },
- x: d3_time_parseLocaleDate,
- X: d3_time_parseLocaleTime,
- y: d3_time_parseYear,
- Y: d3_time_parseFullYear
- // ,
- // Z: function(d, s, i) { /*TODO time zone */ return i; },
- // "%": function(d, s, i) { /*TODO literal % */ return i; }
-};
-
-// Note: weekday is validated, but does not set the date.
-function d3_time_parseWeekdayAbbrev(date, string, i) {
- return d3_time_weekdayAbbrevRe.test(string.substring(i, i += 3)) ? i : -1;
-}
-
-// Note: weekday is validated, but does not set the date.
-function d3_time_parseWeekday(date, string, i) {
- d3_time_weekdayRe.lastIndex = 0;
- var n = d3_time_weekdayRe.exec(string.substring(i, i + 10));
- return n ? i += n[0].length : -1;
-}
-
-var d3_time_weekdayAbbrevRe = /^(?:sun|mon|tue|wed|thu|fri|sat)/i,
- d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;
- d3_time_weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
-
-function d3_time_parseMonthAbbrev(date, string, i) {
- var n = d3_time_monthAbbrevLookup.get(string.substring(i, i += 3).toLowerCase());
- return n == null ? -1 : (date.m = n, i);
-}
-
-var d3_time_monthAbbrevLookup = d3.map({
- jan: 0,
- feb: 1,
- mar: 2,
- apr: 3,
- may: 4,
- jun: 5,
- jul: 6,
- aug: 7,
- sep: 8,
- oct: 9,
- nov: 10,
- dec: 11
-});
-
-function d3_time_parseMonth(date, string, i) {
- d3_time_monthRe.lastIndex = 0;
- var n = d3_time_monthRe.exec(string.substring(i, i + 12));
- return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
-}
-
-var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;
-
-var d3_time_monthLookup = d3.map({
- january: 0,
- february: 1,
- march: 2,
- april: 3,
- may: 4,
- june: 5,
- july: 6,
- august: 7,
- september: 8,
- october: 9,
- november: 10,
- december: 11
-});
-
-var d3_time_months = [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
-];
-
-function d3_time_parseLocaleFull(date, string, i) {
- return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
-}
-
-function d3_time_parseLocaleDate(date, string, i) {
- return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
-}
-
-function d3_time_parseLocaleTime(date, string, i) {
- return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
-}
-
-function d3_time_parseFullYear(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 4));
- return n ? (date.y = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseYear(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.y = d3_time_century() + +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_century() {
- return ~~(new Date().getFullYear() / 1000) * 1000;
-}
-
-function d3_time_parseMonthNumber(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
-}
-
-function d3_time_parseDay(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.d = +n[0], i += n[0].length) : -1;
-}
-
-// Note: we don't validate that the hour is in the range [0,23] or [1,12].
-function d3_time_parseHour24(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.H = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseMinutes(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.M = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseSeconds(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.S = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseMilliseconds(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 3));
- return n ? (date.L = +n[0], i += n[0].length) : -1;
-}
-
-// Note: we don't look at the next directive.
-var d3_time_numberRe = /\s*\d+/;
-
-function d3_time_parseAmPm(date, string, i) {
- var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
- return n == null ? -1 : (date.p = n, i);
-}
-
-var d3_time_amPmLookup = d3.map({
- am: 0,
- pm: 1
-});
-
-// TODO table of time zone offset names?
-function d3_time_zone(d) {
- var z = d.getTimezoneOffset(),
- zs = z > 0 ? "-" : "+",
- zh = ~~(Math.abs(z) / 60),
- zm = Math.abs(z) % 60;
- return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
-}
-d3.time.format.utc = function(template) {
- var local = d3.time.format(template);
-
- function format(date) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time();
- utc._ = date;
- return local(utc);
- } finally {
- d3_time = Date;
- }
- }
-
- format.parse = function(string) {
- try {
- d3_time = d3_time_utc;
- var date = local.parse(string);
- return date && date._;
- } finally {
- d3_time = Date;
- }
- };
-
- format.toString = local.toString;
-
- return format;
-};
-var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
-
-d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
-
-function d3_time_formatIsoNative(date) {
- return date.toISOString();
-}
-
-d3_time_formatIsoNative.parse = function(string) {
- return new Date(string);
-};
-
-d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
-function d3_time_interval(local, step, number) {
-
- function round(date) {
- var d0 = local(date), d1 = offset(d0, 1);
- return date - d0 < d1 - date ? d0 : d1;
- }
-
- function ceil(date) {
- step(date = local(new d3_time(date - 1)), 1);
- return date;
- }
-
- function offset(date, k) {
- step(date = new d3_time(+date), k);
- return date;
- }
-
- function range(t0, t1, dt) {
- var time = ceil(t0), times = [];
- if (dt > 1) {
- while (time < t1) {
- if (!(number(time) % dt)) times.push(new Date(+time));
- step(time, 1);
- }
- } else {
- while (time < t1) times.push(new Date(+time)), step(time, 1);
- }
- return times;
- }
-
- function range_utc(t0, t1, dt) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time_utc();
- utc._ = t0;
- return range(utc, t1, dt);
- } finally {
- d3_time = Date;
- }
- }
-
- local.floor = local;
- local.round = round;
- local.ceil = ceil;
- local.offset = offset;
- local.range = range;
-
- var utc = local.utc = d3_time_interval_utc(local);
- utc.floor = utc;
- utc.round = d3_time_interval_utc(round);
- utc.ceil = d3_time_interval_utc(ceil);
- utc.offset = d3_time_interval_utc(offset);
- utc.range = range_utc;
-
- return local;
-}
-
-function d3_time_interval_utc(method) {
- return function(date, k) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time_utc();
- utc._ = date;
- return method(utc, k)._;
- } finally {
- d3_time = Date;
- }
- };
-}
-d3.time.second = d3_time_interval(function(date) {
- return new d3_time(Math.floor(date / 1e3) * 1e3);
-}, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 1e3); // DST breaks setSeconds
-}, function(date) {
- return date.getSeconds();
-});
-
-d3.time.seconds = d3.time.second.range;
-d3.time.seconds.utc = d3.time.second.utc.range;
-d3.time.minute = d3_time_interval(function(date) {
- return new d3_time(Math.floor(date / 6e4) * 6e4);
-}, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 6e4); // DST breaks setMinutes
-}, function(date) {
- return date.getMinutes();
-});
-
-d3.time.minutes = d3.time.minute.range;
-d3.time.minutes.utc = d3.time.minute.utc.range;
-d3.time.hour = d3_time_interval(function(date) {
- var timezone = date.getTimezoneOffset() / 60;
- return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
-}, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 36e5); // DST breaks setHours
-}, function(date) {
- return date.getHours();
-});
-
-d3.time.hours = d3.time.hour.range;
-d3.time.hours.utc = d3.time.hour.utc.range;
-d3.time.day = d3_time_interval(function(date) {
- return new d3_time(date.getFullYear(), date.getMonth(), date.getDate());
-}, function(date, offset) {
- date.setDate(date.getDate() + offset);
-}, function(date) {
- return date.getDate() - 1;
-});
-
-d3.time.days = d3.time.day.range;
-d3.time.days.utc = d3.time.day.utc.range;
-
-d3.time.dayOfYear = function(date) {
- var year = d3.time.year(date);
- return Math.floor((date - year) / 864e5 - (date.getTimezoneOffset() - year.getTimezoneOffset()) / 1440);
-};
-d3_time_weekdays.forEach(function(day, i) {
- day = day.toLowerCase();
- i = 7 - i;
-
- var interval = d3.time[day] = d3_time_interval(function(date) {
- (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
- return date;
- }, function(date, offset) {
- date.setDate(date.getDate() + Math.floor(offset) * 7);
- }, function(date) {
- var day = d3.time.year(date).getDay();
- return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
- });
-
- d3.time[day + "s"] = interval.range;
- d3.time[day + "s"].utc = interval.utc.range;
-
- d3.time[day + "OfYear"] = function(date) {
- var day = d3.time.year(date).getDay();
- return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
- };
-});
-
-d3.time.week = d3.time.sunday;
-d3.time.weeks = d3.time.sunday.range;
-d3.time.weeks.utc = d3.time.sunday.utc.range;
-d3.time.weekOfYear = d3.time.sundayOfYear;
-d3.time.month = d3_time_interval(function(date) {
- return new d3_time(date.getFullYear(), date.getMonth(), 1);
-}, function(date, offset) {
- date.setMonth(date.getMonth() + offset);
-}, function(date) {
- return date.getMonth();
-});
-
-d3.time.months = d3.time.month.range;
-d3.time.months.utc = d3.time.month.utc.range;
-d3.time.year = d3_time_interval(function(date) {
- return new d3_time(date.getFullYear(), 0, 1);
-}, function(date, offset) {
- date.setFullYear(date.getFullYear() + offset);
-}, function(date) {
- return date.getFullYear();
-});
-
-d3.time.years = d3.time.year.range;
-d3.time.years.utc = d3.time.year.utc.range;
-function d3_time_scale(linear, methods, format) {
-
- function scale(x) {
- return linear(x);
- }
-
- scale.invert = function(x) {
- return d3_time_scaleDate(linear.invert(x));
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
- linear.domain(x);
- return scale;
- };
-
- scale.nice = function(m) {
- var extent = d3_time_scaleExtent(scale.domain());
- return scale.domain([m.floor(extent[0]), m.ceil(extent[1])]);
- };
-
- scale.ticks = function(m, k) {
- var extent = d3_time_scaleExtent(scale.domain());
- if (typeof m !== "function") {
- var span = extent[1] - extent[0],
- target = span / m,
- i = d3.bisect(d3_time_scaleSteps, target);
- if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
- if (!i) return linear.ticks(m).map(d3_time_scaleDate);
- if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
- m = methods[i];
- k = m[1];
- m = m[0].range;
- }
- return m(extent[0], new Date(+extent[1] + 1), k); // inclusive upper bound
- };
-
- scale.tickFormat = function() {
- return format;
- };
-
- scale.copy = function() {
- return d3_time_scale(linear.copy(), methods, format);
- };
-
- // TOOD expose d3_scale_linear_rebind?
- return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
-}
-
-// TODO expose d3_scaleExtent?
-function d3_time_scaleExtent(domain) {
- var start = domain[0], stop = domain[domain.length - 1];
- return start < stop ? [start, stop] : [stop, start];
-}
-
-function d3_time_scaleDate(t) {
- return new Date(t);
-}
-
-function d3_time_scaleFormat(formats) {
- return function(date) {
- var i = formats.length - 1, f = formats[i];
- while (!f[1](date)) f = formats[--i];
- return f[0](date);
- };
-}
-
-function d3_time_scaleSetYear(y) {
- var d = new Date(y, 0, 1);
- d.setFullYear(y); // Y2K fail
- return d;
-}
-
-function d3_time_scaleGetYear(d) {
- var y = d.getFullYear(),
- d0 = d3_time_scaleSetYear(y),
- d1 = d3_time_scaleSetYear(y + 1);
- return y + (d - d0) / (d1 - d0);
-}
-
-var d3_time_scaleSteps = [
- 1e3, // 1-second
- 5e3, // 5-second
- 15e3, // 15-second
- 3e4, // 30-second
- 6e4, // 1-minute
- 3e5, // 5-minute
- 9e5, // 15-minute
- 18e5, // 30-minute
- 36e5, // 1-hour
- 108e5, // 3-hour
- 216e5, // 6-hour
- 432e5, // 12-hour
- 864e5, // 1-day
- 1728e5, // 2-day
- 6048e5, // 1-week
- 2592e6, // 1-month
- 7776e6, // 3-month
- 31536e6 // 1-year
-];
-
-var d3_time_scaleLocalMethods = [
- [d3.time.second, 1],
- [d3.time.second, 5],
- [d3.time.second, 15],
- [d3.time.second, 30],
- [d3.time.minute, 1],
- [d3.time.minute, 5],
- [d3.time.minute, 15],
- [d3.time.minute, 30],
- [d3.time.hour, 1],
- [d3.time.hour, 3],
- [d3.time.hour, 6],
- [d3.time.hour, 12],
- [d3.time.day, 1],
- [d3.time.day, 2],
- [d3.time.week, 1],
- [d3.time.month, 1],
- [d3.time.month, 3],
- [d3.time.year, 1]
-];
-
-var d3_time_scaleLocalFormats = [
- [d3.time.format("%Y"), function(d) { return true; }],
- [d3.time.format("%B"), function(d) { return d.getMonth(); }],
- [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }],
- [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }],
- [d3.time.format("%I %p"), function(d) { return d.getHours(); }],
- [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }],
- [d3.time.format(":%S"), function(d) { return d.getSeconds(); }],
- [d3.time.format(".%L"), function(d) { return d.getMilliseconds(); }]
-];
-
-var d3_time_scaleLinear = d3.scale.linear(),
- d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
-
-d3_time_scaleLocalMethods.year = function(extent, m) {
- return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
-};
-
-d3.time.scale = function() {
- return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
-};
-var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
- return [m[0].utc, m[1]];
-});
-
-var d3_time_scaleUTCFormats = [
- [d3.time.format.utc("%Y"), function(d) { return true; }],
- [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }],
- [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }],
- [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }],
- [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }],
- [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }],
- [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds(); }],
- [d3.time.format.utc(".%L"), function(d) { return d.getUTCMilliseconds(); }]
-];
-
-var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
-
-function d3_time_scaleUTCSetYear(y) {
- var d = new Date(Date.UTC(y, 0, 1));
- d.setUTCFullYear(y); // Y2K fail
- return d;
-}
-
-function d3_time_scaleUTCGetYear(d) {
- var y = d.getUTCFullYear(),
- d0 = d3_time_scaleUTCSetYear(y),
- d1 = d3_time_scaleUTCSetYear(y + 1);
- return y + (d - d0) / (d1 - d0);
-}
-
-d3_time_scaleUTCMethods.year = function(extent, m) {
- return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
-};
-
-d3.time.scale.utc = function() {
- return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
-};
-})();
diff --git a/solr/webapp/web/js/lib/highlight.js b/solr/webapp/web/js/lib/highlight.js
deleted file mode 100644
index 527c3406719..00000000000
--- a/solr/webapp/web/js/lib/highlight.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-Copyright (c) 2006, Ivan Sagalaev
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of highlight.js nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(x,v,w){var p=0;var y="";var r=[];function t(){if(x.length&&v.length){if(x[0].offset!=v[0].offset){return(x[0].offset<v[0].offset)?x:v}else{return v[0].event=="start"?x:v}}else{return x.length?x:v}}function s(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}return"<"+A.nodeName+Array.prototype.map.call(A.attributes,z).join("")+">"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q<r.length){y+=s(r[q]);q++}}}}return y+l(w.substr(p))}function f(q){function o(s,r){return RegExp(s,"m"+(q.cI?"i":"")+(r?"g":""))}function p(y,w){if(y.compiled){return}y.compiled=true;var s=[];if(y.k){var r={};function z(A,t){t.split(" ").forEach(function(B){var C=B.split("|");r[C[0]]=[A,C[1]?Number(C[1]):1];s.push(C[0])})}y.lR=o(y.l||hljs.IR,true);if(typeof y.k=="string"){z("keyword",y.k)}else{for(var x in y.k){if(!y.k.hasOwnProperty(x)){continue}z(x,y.k[x])}}y.k=r}if(w){if(y.bWK){y.b="\\b("+s.join("|")+")\\s"}y.bR=o(y.b?y.b:"\\B|\\b");if(!y.e&&!y.eW){y.e="\\B|\\b"}if(y.e){y.eR=o(y.e)}y.tE=y.e||"";if(y.eW&&w.tE){y.tE+=(y.e?"|":"")+w.tE}}if(y.i){y.iR=o(y.i)}if(y.r===undefined){y.r=1}if(!y.c){y.c=[]}for(var v=0;v<y.c.length;v++){if(y.c[v]=="self"){y.c[v]=y}p(y.c[v],y)}if(y.starts){p(y.starts,w)}var u=[];for(var v=0;v<y.c.length;v++){u.push(y.c[v].b)}if(y.tE){u.push(y.tE)}if(y.i){u.push(y.i)}y.t=u.length?o(u.join("|"),true):{exec:function(t){return null}}}p(q)}function d(D,E){function o(r,M){for(var L=0;L<M.c.length;L++){var K=M.c[L].bR.exec(r);if(K&&K.index==0){return M.c[L]}}}function s(K,r){if(K.e&&K.eR.test(r)){return K}if(K.eW){return s(K.parent,r)}}function t(r,K){return K.i&&K.iR.test(r)}function y(L,r){var K=F.cI?r[0].toLowerCase():r[0];return L.k.hasOwnProperty(K)&&L.k[K]}function G(){var K=l(w);if(!A.k){return K}var r="";var N=0;A.lR.lastIndex=0;var L=A.lR.exec(K);while(L){r+=K.substr(N,L.index-N);var M=y(A,L);if(M){v+=M[1];r+='<span class="'+M[0]+'">'+L[0]+"</span>"}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+="</span>"}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",i:"\\n",c:[{b:"\\\\/"}]},{b:"<",e:">;",sL:"xml"}],r:0},{cN:"function",bWK:true,e:"{",k:"function",c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[a.CLCM,a.CBLCLM],i:"[\"'\\(]"}],i:"\\[|%"}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler.+?;",eW:true},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:"^(>>>|\\.\\.\\.) "};var c=[{cN:"string",b:"(u|b)?r?'''",e:"'''",c:[f],r:10},{cN:"string",b:'(u|b)?r?"""',e:'"""',c:[f],r:10},{cN:"string",b:"(u|r|ur)'",e:"'",c:[a.BE],r:10},{cN:"string",b:'(u|r|ur)"',e:'"',c:[a.BE],r:10},{cN:"string",b:"(b|br)'",e:"'",c:[a.BE]},{cN:"string",b:'(b|br)"',e:'"',c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:":",i:"[${=;\\n]",c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10",built_in:"None True False Ellipsis NotImplemented"},i:"(</|->|\\?)",c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:"@",e:"$"},{b:"\\b(print|exec)\\("}])}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);
diff --git a/solr/webapp/web/js/lib/jquery.ajaxfileupload.js b/solr/webapp/web/js/lib/jquery.ajaxfileupload.js
deleted file mode 100644
index 272976af86d..00000000000
--- a/solr/webapp/web/js/lib/jquery.ajaxfileupload.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-* Copyright (c) 2011 Jordan Feldstein
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Original code from: https://github.com/jfeldstein/jQuery.AjaxFileUpload.js https://github.com/jfeldstein/jQuery.AjaxFileUpload.js/commit/9dd56b4161cbed138287d3ae29a476bb59eb5fc4
-// All modifications are BSD licensed
-// GSI: Modifications made to support immediate upload
-/*
- //
- // - Ajaxifies an individual <input type="file">
- // - Files are sandboxed. Doesn't matter how many, or where they are, on the page.
- // - Allows for extra parameters to be included with the file
- // - onStart callback can cancel the upload by returning false
- */
-
-
-(function ($) {
- $.fn.ajaxfileupload = function (options) {
- var settings = {
- params: {},
- action: '',
- onStart: function () {
- console.log('starting upload');
- console.log(this);
- },
- onComplete: function (response) {
- console.log('got response: ');
- console.log(response);
- console.log(this);
- },
- onCancel: function () {
- console.log('cancelling: ');
- console.log(this);
- },
- validate_extensions: true,
- valid_extensions: ['gif', 'png', 'jpg', 'jpeg'],
- submit_button: null,
- upload_now: false
- };
-
- var uploading_file = false;
-
- if (options) {
- $.extend(settings, options);
- }
-
-
- // 'this' is a jQuery collection of one or more (hopefully)
- // file elements, but doesn't check for this yet
- return this.each(function () {
- var $element = $(this);
- /*
- // Internal handler that tries to parse the response
- // and clean up after ourselves.
- */
- var handleResponse = function (loadedFrame, element) {
- var response, responseStr = loadedFrame.contentWindow.document.body.innerHTML;
- try {
- //response = $.parseJSON($.trim(responseStr));
- response = JSON.parse(responseStr);
- } catch (e) {
- response = responseStr;
- }
-
- // Tear-down the wrapper form
- element.siblings().remove();
- element.unwrap();
-
- uploading_file = false;
-
- // Pass back to the user
- settings.onComplete.apply(element, [response, settings.params]);
- };
- /*
- // Wraps element in a <form> tag, and inserts hidden inputs for each
- // key:value pair in settings.params so they can be sent along with
- // the upload. Then, creates an iframe that the whole thing is
- // uploaded through.
- */
- var wrapElement = function (element) {
- // Create an iframe to submit through, using a semi-unique ID
- var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000)
- $('body').after('<iframe width="0" height="0" style="display:none;" name="' + frame_id + '" id="' + frame_id + '"/>');
- $('#' + frame_id).load(function () {
- handleResponse(this, element);
- });
- console.log("settings.action: " + settings.action);
- // Wrap it in a form
- element.wrap(function () {
- return '<form action="' + settings.action + '" method="POST" enctype="multipart/form-data" target="' + frame_id + '" />'
- })
- // Insert <input type='hidden'>'s for each param
- .before(function () {
- var key, html = '';
- for (key in settings.params) {
- var paramVal = settings.params[key];
- if (typeof paramVal === 'function') {
- paramVal = paramVal();
- }
- html += '<input type="hidden" name="' + key + '" value="' + paramVal + '" />';
- }
- return html;
- });
- }
-
- var upload_file = function () {
- if ($element.val() == '') return settings.onCancel.apply($element, [settings.params]);
-
- // make sure extension is valid
- var ext = $element.val().split('.').pop().toLowerCase();
- if (true === settings.validate_extensions && $.inArray(ext, settings.valid_extensions) == -1) {
- // Pass back to the user
- settings.onComplete.apply($element, [
- {status: false, message: 'The select file type is invalid. File must be ' + settings.valid_extensions.join(', ') + '.'},
- settings.params
- ]);
- } else {
- uploading_file = true;
-
- // Creates the form, extra inputs and iframe used to
- // submit / upload the file
- wrapElement($element);
-
- // Call user-supplied (or default) onStart(), setting
- // its this context to the file DOM element
- var ret = settings.onStart.apply($element, [settings.params]);
-
- // let onStart have the option to cancel the upload
- if (ret !== false) {
- $element.parent('form').submit(function (e) {
- e.stopPropagation();
- }).submit();
- }
- }
- };
- if (settings.upload_now) {
- if (!uploading_file) {
- console.log("uploading now");
- upload_file();
- }
- }
- // Skip elements that are already setup. May replace this
- // with uninit() later, to allow updating that settings
- if ($element.data('ajaxUploader-setup') === true) return;
-
- /*
- $element.change(function () {
- // since a new image was selected, reset the marker
- uploading_file = false;
-
- // only update the file from here if we haven't assigned a submit button
- if (settings.submit_button == null) {
- console.log("uploading");
- upload_file();
- }
- });
- //*/
-
- if (settings.submit_button == null) {
- // do nothing
- } else {
- settings.submit_button.click(function () {
- console.log("uploading: " + uploading_file);
- // only attempt to upload file if we're not uploading
- if (!uploading_file) {
- upload_file();
- }
- });
- }
-
-
- // Mark this element as setup
- $element.data('ajaxUploader-setup', true);
-
-
- });
- }
-})(jQuery)
\ No newline at end of file
diff --git a/solr/webapp/web/js/lib/jquery.blockUI.js b/solr/webapp/web/js/lib/jquery.blockUI.js
deleted file mode 100644
index 675990758b2..00000000000
--- a/solr/webapp/web/js/lib/jquery.blockUI.js
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/*!
- * jQuery blockUI plugin
- * Version 2.39 (23-MAY-2011)
- * @requires jQuery v1.2.3 or later
- *
- * Examples at: http://malsup.com/jquery/block/
- * Copyright (c) 2007-2010 M. Alsup
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Thanks to Amir-Hossein Sobhi for some excellent contributions!
- */
-
-;(function($) {
-
-if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
- alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
- return;
-}
-
-$.fn._fadeIn = $.fn.fadeIn;
-
-var noOp = function() {};
-
-// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
-// retarded userAgent strings on Vista)
-var mode = document.documentMode || 0;
-var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
-var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
-
-// global $ methods for blocking/unblocking the entire page
-$.blockUI = function(opts) { install(window, opts); };
-$.unblockUI = function(opts) { remove(window, opts); };
-
-// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
-$.growlUI = function(title, message, timeout, onClose) {
- var $m = $('<div class="growlUI"></div>');
- if (title) $m.append('<h1>'+title+'</h1>');
- if (message) $m.append('<h2>'+message+'</h2>');
- if (timeout == undefined) timeout = 3000;
- $.blockUI({
- message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
- timeout: timeout, showOverlay: false,
- onUnblock: onClose,
- css: $.blockUI.defaults.growlCSS
- });
-};
-
-// plugin method for blocking element content
-$.fn.block = function(opts) {
- return this.unblock({ fadeOut: 0 }).each(function() {
- if ($.css(this,'position') == 'static')
- this.style.position = 'relative';
- if ($.browser.msie)
- this.style.zoom = 1; // force 'hasLayout'
- install(this, opts);
- });
-};
-
-// plugin method for unblocking element content
-$.fn.unblock = function(opts) {
- return this.each(function() {
- remove(this, opts);
- });
-};
-
-$.blockUI.version = 2.39; // 2nd generation blocking at no extra cost!
-
-// override these in your code to change the default behavior and style
-$.blockUI.defaults = {
- // message displayed when blocking (use null for no message)
- message: '<h1>Please wait...</h1>',
-
- title: null, // title string; only used when theme == true
- draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
-
- theme: false, // set to true to use with jQuery UI themes
-
- // styles for the message when blocking; if you wish to disable
- // these and use an external stylesheet then do this in your code:
- // $.blockUI.defaults.css = {};
- css: {
- padding: 0,
- margin: 0,
- width: '30%',
- top: '40%',
- left: '35%',
- textAlign: 'center',
- color: '#000',
- border: '3px solid #aaa',
- backgroundColor:'#fff',
- cursor: 'wait'
- },
-
- // minimal style set used when themes are used
- themedCSS: {
- width: '30%',
- top: '40%',
- left: '35%'
- },
-
- // styles for the overlay
- overlayCSS: {
- backgroundColor: '#000',
- opacity: 0.6,
- cursor: 'wait'
- },
-
- // styles applied when using $.growlUI
- growlCSS: {
- width: '350px',
- top: '10px',
- left: '',
- right: '10px',
- border: 'none',
- padding: '5px',
- opacity: 0.6,
- cursor: 'default',
- color: '#fff',
- backgroundColor: '#000',
- '-webkit-border-radius': '10px',
- '-moz-border-radius': '10px',
- 'border-radius': '10px'
- },
-
- // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
- // (hat tip to Jorge H. N. de Vasconcelos)
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
-
- // force usage of iframe in non-IE browsers (handy for blocking applets)
- forceIframe: false,
-
- // z-index for the blocking overlay
- baseZ: 1000,
-
- // set these to true to have the message automatically centered
- centerX: true, // <-- only effects element blocking (page block controlled via css above)
- centerY: true,
-
- // allow body element to be stetched in ie6; this makes blocking look better
- // on "short" pages. disable if you wish to prevent changes to the body height
- allowBodyStretch: true,
-
- // enable if you want key and mouse events to be disabled for content that is blocked
- bindEvents: true,
-
- // be default blockUI will supress tab navigation from leaving blocking content
- // (if bindEvents is true)
- constrainTabKey: true,
-
- // fadeIn time in millis; set to 0 to disable fadeIn on block
- fadeIn: 200,
-
- // fadeOut time in millis; set to 0 to disable fadeOut on unblock
- fadeOut: 400,
-
- // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
- timeout: 0,
-
- // disable if you don't want to show the overlay
- showOverlay: true,
-
- // if true, focus will be placed in the first available input field when
- // page blocking
- focusInput: true,
-
- // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
- applyPlatformOpacityRules: true,
-
- // callback method invoked when fadeIn has completed and blocking message is visible
- onBlock: null,
-
- // callback method invoked when unblocking has completed; the callback is
- // passed the element that has been unblocked (which is the window object for page
- // blocks) and the options that were passed to the unblock call:
- // onUnblock(element, options)
- onUnblock: null,
-
- // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
- quirksmodeOffsetHack: 4,
-
- // class name of the message block
- blockMsgClass: 'blockMsg'
-};
-
-// private data and functions follow...
-
-var pageBlock = null;
-var pageBlockEls = [];
-
-function install(el, opts) {
- var full = (el == window);
- var msg = opts && opts.message !== undefined ? opts.message : undefined;
- opts = $.extend({}, $.blockUI.defaults, opts || {});
- opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
- var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
- var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
- msg = msg === undefined ? opts.message : msg;
-
- // remove the current block (if there is one)
- if (full && pageBlock)
- remove(window, {fadeOut:0});
-
- // if an existing element is being used as the blocking content then we capture
- // its current place in the DOM (and current display style) so we can restore
- // it when we unblock
- if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
- var node = msg.jquery ? msg[0] : msg;
- var data = {};
- $(el).data('blockUI.history', data);
- data.el = node;
- data.parent = node.parentNode;
- data.display = node.style.display;
- data.position = node.style.position;
- if (data.parent)
- data.parent.removeChild(node);
- }
-
- $(el).data('blockUI.onUnblock', opts.onUnblock);
- var z = opts.baseZ;
-
- // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
- // layer1 is the iframe layer which is used to supress bleed through of underlying content
- // layer2 is the overlay layer which has opacity and a wait cursor (by default)
- // layer3 is the message content that is displayed while blocking
-
- var lyr1 = ($.browser.msie || opts.forceIframe)
- ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
- : $('<div class="blockUI" style="display:none"></div>');
-
- var lyr2 = opts.theme
- ? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>')
- : $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
-
- var lyr3, s;
- if (opts.theme && full) {
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">' +
- '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
- '<div class="ui-widget-content ui-dialog-content"></div>' +
- '</div>';
- }
- else if (opts.theme) {
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">' +
- '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
- '<div class="ui-widget-content ui-dialog-content"></div>' +
- '</div>';
- }
- else if (full) {
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
- }
- else {
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
- }
- lyr3 = $(s);
-
- // if we have a message, style it
- if (msg) {
- if (opts.theme) {
- lyr3.css(themedCSS);
- lyr3.addClass('ui-widget-content');
- }
- else
- lyr3.css(css);
- }
-
- // style the overlay
- if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))))
- lyr2.css(opts.overlayCSS);
- lyr2.css('position', full ? 'fixed' : 'absolute');
-
- // make iframe layer transparent in IE
- if ($.browser.msie || opts.forceIframe)
- lyr1.css('opacity',0.0);
-
- //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
- var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
- $.each(layers, function() {
- this.appendTo($par);
- });
-
- if (opts.theme && opts.draggable && $.fn.draggable) {
- lyr3.draggable({
- handle: '.ui-dialog-titlebar',
- cancel: 'li'
- });
- }
-
- // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
- var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
- if (ie6 || expr) {
- // give body 100% height
- if (full && opts.allowBodyStretch && $.boxModel)
- $('html,body').css('height','100%');
-
- // fix ie6 issue when blocked element has a border width
- if ((ie6 || !$.boxModel) && !full) {
- var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
- var fixT = t ? '(0 - '+t+')' : 0;
- var fixL = l ? '(0 - '+l+')' : 0;
- }
-
- // simulate fixed position
- $.each([lyr1,lyr2,lyr3], function(i,o) {
- var s = o[0].style;
- s.position = 'absolute';
- if (i < 2) {
- full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
- : s.setExpression('height','this.parentNode.offsetHeight + "px"');
- full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
- : s.setExpression('width','this.parentNode.offsetWidth + "px"');
- if (fixL) s.setExpression('left', fixL);
- if (fixT) s.setExpression('top', fixT);
- }
- else if (opts.centerY) {
- if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
- s.marginTop = 0;
- }
- else if (!opts.centerY && full) {
- var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
- var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
- s.setExpression('top',expression);
- }
- });
- }
-
- // show the message
- if (msg) {
- if (opts.theme)
- lyr3.find('.ui-widget-content').append(msg);
- else
- lyr3.append(msg);
- if (msg.jquery || msg.nodeType)
- $(msg).show();
- }
-
- if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
- lyr1.show(); // opacity is zero
- if (opts.fadeIn) {
- var cb = opts.onBlock ? opts.onBlock : noOp;
- var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
- var cb2 = msg ? cb : noOp;
- if (opts.showOverlay)
- lyr2._fadeIn(opts.fadeIn, cb1);
- if (msg)
- lyr3._fadeIn(opts.fadeIn, cb2);
- }
- else {
- if (opts.showOverlay)
- lyr2.show();
- if (msg)
- lyr3.show();
- if (opts.onBlock)
- opts.onBlock();
- }
-
- // bind key and mouse events
- bind(1, el, opts);
-
- if (full) {
- pageBlock = lyr3[0];
- pageBlockEls = $(':input:enabled:visible',pageBlock);
- if (opts.focusInput)
- setTimeout(focus, 20);
- }
- else
- center(lyr3[0], opts.centerX, opts.centerY);
-
- if (opts.timeout) {
- // auto-unblock
- var to = setTimeout(function() {
- full ? $.unblockUI(opts) : $(el).unblock(opts);
- }, opts.timeout);
- $(el).data('blockUI.timeout', to);
- }
-};
-
-// remove the block
-function remove(el, opts) {
- var full = (el == window);
- var $el = $(el);
- var data = $el.data('blockUI.history');
- var to = $el.data('blockUI.timeout');
- if (to) {
- clearTimeout(to);
- $el.removeData('blockUI.timeout');
- }
- opts = $.extend({}, $.blockUI.defaults, opts || {});
- bind(0, el, opts); // unbind events
-
- if (opts.onUnblock === null) {
- opts.onUnblock = $el.data('blockUI.onUnblock');
- $el.removeData('blockUI.onUnblock');
- }
-
- var els;
- if (full) // crazy selector to handle odd field errors in ie6/7
- els = $('body').children().filter('.blockUI').add('body > .blockUI');
- else
- els = $('.blockUI', el);
-
- if (full)
- pageBlock = pageBlockEls = null;
-
- if (opts.fadeOut) {
- els.fadeOut(opts.fadeOut);
- setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
- }
- else
- reset(els, data, opts, el);
-};
-
-// move blocking element back into the DOM where it started
-function reset(els,data,opts,el) {
- els.each(function(i,o) {
- // remove via DOM calls so we don't lose event handlers
- if (this.parentNode)
- this.parentNode.removeChild(this);
- });
-
- if (data && data.el) {
- data.el.style.display = data.display;
- data.el.style.position = data.position;
- if (data.parent)
- data.parent.appendChild(data.el);
- $(el).removeData('blockUI.history');
- }
-
- if (typeof opts.onUnblock == 'function')
- opts.onUnblock(el,opts);
-};
-
-// bind/unbind the handler
-function bind(b, el, opts) {
- var full = el == window, $el = $(el);
-
- // don't bother unbinding if there is nothing to unbind
- if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
- return;
- if (!full)
- $el.data('blockUI.isBlocked', b);
-
- // don't bind events when overlay is not in use or if bindEvents is false
- if (!opts.bindEvents || (b && !opts.showOverlay))
- return;
-
- // bind anchors and inputs for mouse and key events
- var events = 'mousedown mouseup keydown keypress';
- b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
-
-// former impl...
-// var $e = $('a,:input');
-// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
-};
-
-// event handler to suppress keyboard/mouse events when blocking
-function handler(e) {
- // allow tab navigation (conditionally)
- if (e.keyCode && e.keyCode == 9) {
- if (pageBlock && e.data.constrainTabKey) {
- var els = pageBlockEls;
- var fwd = !e.shiftKey && e.target === els[els.length-1];
- var back = e.shiftKey && e.target === els[0];
- if (fwd || back) {
- setTimeout(function(){focus(back)},10);
- return false;
- }
- }
- }
- var opts = e.data;
- // allow events within the message content
- if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
- return true;
-
- // allow events for content that is not being blocked
- return $(e.target).parents().children().filter('div.blockUI').length == 0;
-};
-
-function focus(back) {
- if (!pageBlockEls)
- return;
- var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
- if (e)
- e.focus();
-};
-
-function center(el, x, y) {
- var p = el.parentNode, s = el.style;
- var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
- var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
- if (x) s.left = l > 0 ? (l+'px') : '0';
- if (y) s.top = t > 0 ? (t+'px') : '0';
-};
-
-function sz(el, p) {
- return parseInt($.css(el,p))||0;
-};
-
-})(jQuery);
diff --git a/solr/webapp/web/js/lib/jquery.cookie.js b/solr/webapp/web/js/lib/jquery.cookie.js
deleted file mode 100644
index 03079a54e6d..00000000000
--- a/solr/webapp/web/js/lib/jquery.cookie.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/*!
- * jQuery Cookie Plugin
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2011, Klaus Hartl
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.opensource.org/licenses/GPL-2.0
- */
-(function($) {
- $.cookie = function(key, value, options) {
-
- // key and at least value given, set cookie...
- if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
- options = $.extend({}, options);
-
- if (value === null || value === undefined) {
- options.expires = -1;
- }
-
- if (typeof options.expires === 'number') {
- var days = options.expires, t = options.expires = new Date();
- t.setDate(t.getDate() + days);
- }
-
- value = String(value);
-
- return (document.cookie = [
- encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
- options.path ? '; path=' + options.path : '',
- options.domain ? '; domain=' + options.domain : '',
- options.secure ? '; secure' : ''
- ].join(''));
- }
-
- // key and possibly options given, get cookie...
- options = value || {};
- var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
-
- var pairs = document.cookie.split('; ');
- for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
- if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
- }
- return null;
- };
-})(jQuery);
diff --git a/solr/webapp/web/js/lib/jquery.form.js b/solr/webapp/web/js/lib/jquery.form.js
deleted file mode 100644
index 114affc67d4..00000000000
--- a/solr/webapp/web/js/lib/jquery.form.js
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/*!
- * jQuery Form Plugin
- * version: 2.47 (04-SEP-2010)
- * @requires jQuery v1.3.2 or later
- *
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-;(function($) {
-
-/*
- Usage Note:
- -----------
- Do not use both ajaxSubmit and ajaxForm on the same form. These
- functions are intended to be exclusive. Use ajaxSubmit if you want
- to bind your own submit handler to the form. For example,
-
- $(document).ready(function() {
- $('#myForm').bind('submit', function() {
- $(this).ajaxSubmit({
- target: '#output'
- });
- return false; // <-- important!
- });
- });
-
- Use ajaxForm when you want the plugin to manage all the event binding
- for you. For example,
-
- $(document).ready(function() {
- $('#myForm').ajaxForm({
- target: '#output'
- });
- });
-
- When using ajaxForm, the ajaxSubmit function will be invoked for you
- at the appropriate time.
-*/
-
-/**
- * ajaxSubmit() provides a mechanism for immediately submitting
- * an HTML form using AJAX.
- */
-$.fn.ajaxSubmit = function(options) {
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
- if (!this.length) {
- log('ajaxSubmit: skipping submit process - no element selected');
- return this;
- }
-
- if (typeof options == 'function') {
- options = { success: options };
- }
-
- var url = $.trim(this.attr('action'));
- if (url) {
- // clean url (don't include hash vaue)
- url = (url.match(/^([^#]+)/)||[])[1];
- }
- url = url || window.location.href || '';
-
- options = $.extend(true, {
- url: url,
- type: this.attr('method') || 'GET',
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
- }, options);
-
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- this.trigger('form-pre-serialize', [this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
- return this;
- }
-
- // provide opportunity to alter form data before it is serialized
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
- return this;
- }
-
- var n,v,a = this.formToArray(options.semantic);
- if (options.data) {
- options.extraData = options.data;
- for (n in options.data) {
- if(options.data[n] instanceof Array) {
- for (var k in options.data[n]) {
- a.push( { name: n, value: options.data[n][k] } );
- }
- }
- else {
- v = options.data[n];
- v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
- a.push( { name: n, value: v } );
- }
- }
- }
-
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
- return this;
- }
-
- // fire vetoable 'validate' event
- this.trigger('form-submit-validate', [a, this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
- return this;
- }
-
- var q = $.param(a);
-
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else {
- options.data = q; // data is the query string for 'post'
- }
-
- var $form = this, callbacks = [];
- if (options.resetForm) {
- callbacks.push(function() { $form.resetForm(); });
- }
- if (options.clearForm) {
- callbacks.push(function() { $form.clearForm(); });
- }
-
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function(){};
- callbacks.push(function(data) {
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
- $(options.target)[fn](data).each(oldSuccess, arguments);
- });
- }
- else if (options.success) {
- callbacks.push(options.success);
- }
-
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
- var context = options.context || options; // jQuery 1.4+ supports scope context
- for (var i=0, max=callbacks.length; i < max; i++) {
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
- }
- };
-
- // are there files to upload?
- var fileInputs = $('input:file', this).length > 0;
- var mp = 'multipart/form-data';
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
-
- // options.iframe allows user to force iframe mode
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
- if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if (options.closeKeepAlive) {
- $.get(options.closeKeepAlive, fileUpload);
- }
- else {
- fileUpload();
- }
- }
- else {
- $.ajax(options);
- }
-
- // fire 'notify' event
- this.trigger('form-submit-notify', [this, options]);
- return this;
-
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUpload() {
- var form = $form[0];
-
- if ($(':input[name=submit],:input[id=submit]', form).length) {
- // if there is an input with a name or id of 'submit' then we won't be
- // able to invoke the submit fn on the form (at least not x-browser)
- alert('Error: Form elements must not have name or id of "submit".');
- return;
- }
-
- var s = $.extend(true, {}, $.ajaxSettings, options);
- s.context = s.context || s;
- var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
- window[fn] = function() {
- var f = $io.data('form-plugin-onload');
- if (f) {
- f();
- window[fn] = undefined;
- try { delete window[fn]; } catch(e){}
- }
- }
- var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" onload="window[\'_\'+this.id]()" />');
- var io = $io[0];
-
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
-
- var xhr = { // mock object
- aborted: 0,
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function() {},
- getResponseHeader: function() {},
- setRequestHeader: function() {},
- abort: function() {
- this.aborted = 1;
- $io.attr('src', s.iframeSrc); // abort op in progress
- }
- };
-
- var g = s.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && ! $.active++) {
- $.event.trigger("ajaxStart");
- }
- if (g) {
- $.event.trigger("ajaxSend", [xhr, s]);
- }
-
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
- if (s.global) {
- $.active--;
- }
- return;
- }
- if (xhr.aborted) {
- return;
- }
-
- var cbInvoked = false;
- var timedOut = 0;
-
- // add submitting element to data if we know it
- var sub = form.clk;
- if (sub) {
- var n = sub.name;
- if (n && !sub.disabled) {
- s.extraData = s.extraData || {};
- s.extraData[n] = sub.value;
- if (sub.type == "image") {
- s.extraData[n+'.x'] = form.clk_x;
- s.extraData[n+'.y'] = form.clk_y;
- }
- }
- }
-
- // take a breath so that pending repaints get some cpu time before the upload starts
- function doSubmit() {
- // make sure form attrs are set
- var t = $form.attr('target'), a = $form.attr('action');
-
- // update form attrs in IE friendly way
- form.setAttribute('target',id);
- if (form.getAttribute('method') != 'POST') {
- form.setAttribute('method', 'POST');
- }
- if (form.getAttribute('action') != s.url) {
- form.setAttribute('action', s.url);
- }
-
- // ie borks in some cases when setting encoding
- if (! s.skipEncodingOverride) {
- $form.attr({
- encoding: 'multipart/form-data',
- enctype: 'multipart/form-data'
- });
- }
-
- // support timout
- if (s.timeout) {
- setTimeout(function() { timedOut = true; cb(); }, s.timeout);
- }
-
- // add "extra" data to form if provided in options
- var extraInputs = [];
- try {
- if (s.extraData) {
- for (var n in s.extraData) {
- extraInputs.push(
- $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
- .appendTo(form)[0]);
- }
- }
-
- // add iframe to doc and submit the form
- $io.appendTo('body');
- $io.data('form-plugin-onload', cb);
- form.submit();
- }
- finally {
- // reset attrs and remove "extra" input elements
- form.setAttribute('action',a);
- if(t) {
- form.setAttribute('target', t);
- } else {
- $form.removeAttr('target');
- }
- $(extraInputs).remove();
- }
- }
-
- if (s.forceSync) {
- doSubmit();
- }
- else {
- setTimeout(doSubmit, 10); // this lets dom updates render
- }
-
- var data, doc, domCheckCount = 50;
-
- function cb() {
- if (cbInvoked) {
- return;
- }
-
- $io.removeData('form-plugin-onload');
-
- var ok = true;
- try {
- if (timedOut) {
- throw 'timeout';
- }
- // extract the server response from the iframe
- doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
-
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
- log('isXml='+isXml);
- if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
- if (--domCheckCount) {
- // in some browsers (Opera) the iframe DOM is not always traversable when
- // the onload callback fires, so we loop a bit to accommodate
- log('requeing onLoad callback, DOM not available');
- setTimeout(cb, 250);
- return;
- }
- // let this fall through because server response could be an empty document
- //log('Could not access iframe DOM after mutiple tries.');
- //throw 'DOMException: not available';
- }
-
- //log('response detected');
- cbInvoked = true;
- xhr.responseText = doc.documentElement ? doc.documentElement.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
- xhr.getResponseHeader = function(header){
- var headers = {'content-type': s.dataType};
- return headers[header];
- };
-
- var scr = /(json|script)/.test(s.dataType);
- if (scr || s.textarea) {
- // see if user embedded response in textarea
- var ta = doc.getElementsByTagName('textarea')[0];
- if (ta) {
- xhr.responseText = ta.value;
- }
- else if (scr) {
- // account for browsers injecting pre around json response
- var pre = doc.getElementsByTagName('pre')[0];
- if (pre) {
- xhr.responseText = pre.innerHTML;
- }
- }
- }
- else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
- xhr.responseXML = toXml(xhr.responseText);
- }
- data = $.httpData(xhr, s.dataType);
- }
- catch(e){
- log('error caught:',e);
- ok = false;
- xhr.error = e;
- $.handleError(s, xhr, 'error', e);
- }
-
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (ok) {
- s.success.call(s.context, data, 'success', xhr);
- if (g) {
- $.event.trigger("ajaxSuccess", [xhr, s]);
- }
- }
- if (g) {
- $.event.trigger("ajaxComplete", [xhr, s]);
- }
- if (g && ! --$.active) {
- $.event.trigger("ajaxStop");
- }
- if (s.complete) {
- s.complete.call(s.context, xhr, ok ? 'success' : 'error');
- }
-
- // clean up
- setTimeout(function() {
- $io.removeData('form-plugin-onload');
- $io.remove();
- xhr.responseXML = null;
- }, 100);
- }
-
- function toXml(s, doc) {
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else {
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- }
- return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
- }
- }
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */
-$.fn.ajaxForm = function(options) {
- // in jQuery 1.3+ we can fix mistakes with the ready state
- if (this.length === 0) {
- var o = { s: this.selector, c: this.context };
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing ajaxForm');
- $(function() {
- $(o.s,o.c).ajaxForm(options);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
- e.preventDefault();
- $(this).ajaxSubmit(options);
- }
- }).bind('click.form-plugin', function(e) {
- var target = e.target;
- var $el = $(target);
- if (!($el.is(":submit,input:image"))) {
- // is this a child element of the submit el? (ex: a span within a button)
- var t = $el.closest(':submit');
- if (t.length == 0) {
- return;
- }
- target = t[0];
- }
- var form = this;
- form.clk = target;
- if (target.type == 'image') {
- if (e.offsetX != undefined) {
- form.clk_x = e.offsetX;
- form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
- var offset = $el.offset();
- form.clk_x = e.pageX - offset.left;
- form.clk_y = e.pageY - offset.top;
- } else {
- form.clk_x = e.pageX - target.offsetLeft;
- form.clk_y = e.pageY - target.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
- });
-};
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
-$.fn.ajaxFormUnbind = function() {
- return this.unbind('submit.form-plugin click.form-plugin');
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
-$.fn.formToArray = function(semantic) {
- var a = [];
- if (this.length === 0) {
- return a;
- }
-
- var form = this[0];
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- if (!els) {
- return a;
- }
-
- var i,j,n,v,el;
- for(i=0, max=els.length; i < max; i++) {
- el = els[i];
- n = el.name;
- if (!n) {
- continue;
- }
-
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if(!el.disabled && form.clk == el) {
- a.push({name: n, value: $(el).val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- continue;
- }
-
- v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- for(j=0, jmax=v.length; j < jmax; j++) {
- a.push({name: n, value: v[j]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: n, value: v});
- }
- }
-
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle it here
- var $input = $(form.clk), input = $input[0];
- n = input.name;
- if (n && !input.disabled && input.type == 'image') {
- a.push({name: n, value: $input.val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- }
- return a;
-};
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- */
-$.fn.formSerialize = function(semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
-};
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&amp;name2=value2
- */
-$.fn.fieldSerialize = function(successful) {
- var a = [];
- this.each(function() {
- var n = this.name;
- if (!n) {
- return;
- }
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i=0,max=v.length; i < max; i++) {
- a.push({name: n, value: v[i]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: this.name, value: v});
- }
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
-};
-
-/**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- * <form><fieldset>
- * <input name="A" type="text" />
- * <input name="A" type="text" />
- * <input name="B" type="checkbox" value="B1" />
- * <input name="B" type="checkbox" value="B2"/>
- * <input name="C" type="radio" value="C1" />
- * <input name="C" type="radio" value="C2" />
- * </fieldset></form>
- *
- * var v = $(':text').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $(':checkbox').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $(':radio').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- */
-$.fn.fieldValue = function(successful) {
- for (var val=[], i=0, max=this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
- continue;
- }
- v.constructor == Array ? $.merge(val, v) : val.push(v);
- }
- return val;
-};
-
-/**
- * Returns the value of the field element.
- */
-$.fieldValue = function(el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (successful === undefined) {
- successful = true;
- }
-
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1)) {
- return null;
- }
-
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) {
- return null;
- }
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index+1 : ops.length);
- for(var i=(one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- var v = op.value;
- if (!v) { // extra pain for IE...
- v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
- }
- if (one) {
- return v;
- }
- a.push(v);
- }
- }
- return a;
- }
- return $(el).val();
-};
-
-/**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- */
-$.fn.clearForm = function() {
- return this.each(function() {
- $('input,select,textarea', this).clearFields();
- });
-};
-
-/**
- * Clears the selected form elements.
- */
-$.fn.clearFields = $.fn.clearInputs = function() {
- return this.each(function() {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (t == 'text' || t == 'password' || tag == 'textarea') {
- this.value = '';
- }
- else if (t == 'checkbox' || t == 'radio') {
- this.checked = false;
- }
- else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- });
-};
-
-/**
- * Resets the form data. Causes all form elements to be reset to their original value.
- */
-$.fn.resetForm = function() {
- return this.each(function() {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
- this.reset();
- }
- });
-};
-
-/**
- * Enables or disables any matching elements.
- */
-$.fn.enable = function(b) {
- if (b === undefined) {
- b = true;
- }
- return this.each(function() {
- this.disabled = !b;
- });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
-$.fn.selected = function(select) {
- if (select === undefined) {
- select = true;
- }
- return this.each(function() {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio') {
- this.checked = select;
- }
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').selected(false);
- }
- this.selected = select;
- }
- });
-};
-
-// helper fn for console logging
-// set $.fn.ajaxSubmit.debug to true to enable debug logging
-function log() {
- if ($.fn.ajaxSubmit.debug) {
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
- if (window.console && window.console.log) {
- window.console.log(msg);
- }
- else if (window.opera && window.opera.postError) {
- window.opera.postError(msg);
- }
- }
-};
-
-})(jQuery);
diff --git a/solr/webapp/web/js/lib/jquery.jstree.js b/solr/webapp/web/js/lib/jquery.jstree.js
deleted file mode 100644
index 50c176790c1..00000000000
--- a/solr/webapp/web/js/lib/jquery.jstree.js
+++ /dev/null
@@ -1,3534 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/*
- * jsTree 1.0-rc1
- * http://jstree.com/
- *
- * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
- *
- * Dual licensed under the MIT and GPL licenses (same as jQuery):
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Date: 2010-07-01 10:51:11 +0300 (четв, 01 юли 2010) $
- * Revision: 191 $
- */
-
-/*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
-/*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
-
-"use strict";
-// Common functions not related to jsTree
-// decided to move them to a `vakata` "namespace"
-(function ($) {
- $.vakata = {};
- // CSS related functions
- $.vakata.css = {
- get_css : function(rule_name, delete_flag, sheet) {
- rule_name = rule_name.toLowerCase();
- var css_rules = sheet.cssRules || sheet.rules,
- j = 0;
- do {
- if(css_rules.length && j > css_rules.length + 5) { return false; }
- if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
- if(delete_flag === true) {
- if(sheet.removeRule) { sheet.removeRule(j); }
- if(sheet.deleteRule) { sheet.deleteRule(j); }
- return true;
- }
- else { return css_rules[j]; }
- }
- }
- while (css_rules[++j]);
- return false;
- },
- add_css : function(rule_name, sheet) {
- if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
- if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
- return $.vakata.css.get_css(rule_name);
- },
- remove_css : function(rule_name, sheet) {
- return $.vakata.css.get_css(rule_name, true, sheet);
- },
- add_sheet : function(opts) {
- var tmp;
- if(opts.str) {
- tmp = document.createElement("style");
- tmp.setAttribute('type',"text/css");
- if(tmp.styleSheet) {
- document.getElementsByTagName("head")[0].appendChild(tmp);
- tmp.styleSheet.cssText = opts.str;
- }
- else {
- tmp.appendChild(document.createTextNode(opts.str));
- document.getElementsByTagName("head")[0].appendChild(tmp);
- }
- return tmp.sheet || tmp.styleSheet;
- }
- if(opts.url) {
- if(document.createStyleSheet) {
- try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
- }
- else {
- tmp = document.createElement('link');
- tmp.rel = 'stylesheet';
- tmp.type = 'text/css';
- tmp.media = "all";
- tmp.href = opts.url;
- document.getElementsByTagName("head")[0].appendChild(tmp);
- return tmp.styleSheet;
- }
- }
- }
- };
-})(jQuery);
-
-/*
- * jsTree core 1.0
- */
-(function ($) {
- // private variables
- var instances = [], // instance array (used by $.jstree.reference/create/focused)
- focused_instance = -1, // the index in the instance array of the currently focused instance
- plugins = {}, // list of included plugins
- prepared_move = {}, // for the move plugin
- is_ie6 = false;
-
- // jQuery plugin wrapper (thanks to jquery UI widget function)
- $.fn.jstree = function (settings) {
- var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
- args = Array.prototype.slice.call(arguments, 1),
- returnValue = this;
-
- // extend settings and allow for multiple hashes and metadata
- if(!isMethodCall && $.meta) { args.push($.metadata.get(this).jstree); }
- settings = !isMethodCall && args.length ? $.extend.apply(null, [true, settings].concat(args)) : settings;
- // block calls to "private" methods
- if(isMethodCall && settings.substring(0, 1) == '_') { return returnValue; }
-
- // if a method call execute the method on all selected instances
- if(isMethodCall) {
- this.each(function() {
- var instance = instances[$.data(this, "jstree-instance-id")],
- methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
- if(typeof methodValue !== "undefined" && (settings.indexOf("is_" === 0) || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
- });
- }
- else {
- this.each(function() {
- var instance_id = $.data(this, "jstree-instance-id"),
- s = false;
- // if an instance already exists, destroy it first
- if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
- // push a new empty object to the instances array
- instance_id = parseInt(instances.push({}),10) - 1;
- // store the jstree instance id to the container element
- $.data(this, "jstree-instance-id", instance_id);
- // clean up all plugins
- if(!settings) { settings = {}; }
- settings.plugins = $.isArray(settings.plugins) ? settings.plugins : $.jstree.defaults.plugins;
- if($.inArray("core", settings.plugins) === -1) { settings.plugins.unshift("core"); }
-
- // only unique plugins (NOT WORKING)
- // settings.plugins = settings.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
-
- // extend defaults with passed data
- s = $.extend(true, {}, $.jstree.defaults, settings);
- s.plugins = settings.plugins;
- $.each(plugins, function (i, val) { if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } });
- // push the new object to the instances array (at the same time set the default classes to the container) and init
- instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
- // init all activated plugins for this instance
- $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
- $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
- // initialize the instance
- instances[instance_id].init();
- });
- }
- // return the jquery selection (or if it was a method call that returned a value - the returned value)
- return returnValue;
- };
- // object to store exposed functions and objects
- $.jstree = {
- defaults : {
- plugins : []
- },
- _focused : function () { return instances[focused_instance] || null; },
- _reference : function (needle) {
- // get by instance id
- if(instances[needle]) { return instances[needle]; }
- // get by DOM (if still no luck - return null
- var o = $(needle);
- if(!o.length && typeof needle === "string") { o = $("#" + needle); }
- if(!o.length) { return null; }
- return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
- },
- _instance : function (index, container, settings) {
- // for plugins to store data in
- this.data = { core : {} };
- this.get_settings = function () { return $.extend(true, {}, settings); };
- this._get_settings = function () { return settings; };
- this.get_index = function () { return index; };
- this.get_container = function () { return container; };
- this._set_settings = function (s) {
- settings = $.extend(true, {}, settings, s);
- };
- },
- _fn : { },
- plugin : function (pname, pdata) {
- pdata = $.extend({}, {
- __init : $.noop,
- __destroy : $.noop,
- _fn : {},
- defaults : false
- }, pdata);
- plugins[pname] = pdata;
-
- $.jstree.defaults[pname] = pdata.defaults;
- $.each(pdata._fn, function (i, val) {
- val.plugin = pname;
- val.old = $.jstree._fn[i];
- $.jstree._fn[i] = function () {
- var rslt,
- func = val,
- args = Array.prototype.slice.call(arguments),
- evnt = new $.Event("before.jstree"),
- rlbk = false;
-
- // Check if function belongs to the included plugins of this instance
- do {
- if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
- func = func.old;
- } while(func);
- if(!func) { return; }
-
- // a chance to stop execution (or change arguments):
- // * just bind to jstree.before
- // * check the additional data object (func property)
- // * call event.stopImmediatePropagation()
- // * return false (or an array of arguments)
- rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args });
- if(rslt === false) { return; }
- if(typeof rslt !== "undefined") { args = rslt; }
-
- // context and function to trigger events, then finally call the function
- if(i.indexOf("_") === 0) {
- rslt = func.apply(this, args);
- }
- else {
- rslt = func.apply(
- $.extend({}, this, {
- __callback : function (data) {
- this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
- },
- __rollback : function () {
- rlbk = this.get_rollback();
- return rlbk;
- },
- __call_old : function (replace_arguments) {
- return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
- }
- }), args);
- }
-
- // return the result
- return rslt;
- };
- $.jstree._fn[i].old = val.old;
- $.jstree._fn[i].plugin = pname;
- });
- },
- rollback : function (rb) {
- if(rb) {
- if(!$.isArray(rb)) { rb = [ rb ]; }
- $.each(rb, function (i, val) {
- instances[val.i].set_rollback(val.h, val.d);
- });
- }
- }
- };
- // set the prototype for all instances
- $.jstree._fn = $.jstree._instance.prototype = {};
-
- // css functions - used internally
-
- // load the css when DOM is ready
- $(function() {
- // code is copied form jQuery ($.browser is deprecated + there is a bug in IE)
- var u = navigator.userAgent.toLowerCase(),
- v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
- css_string = '' +
- '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
- '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } ' +
- '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
- '.jstree > ul > li { margin-left:0px; } ' +
- '.jstree-rtl > ul > li { margin-right:0px; } ' +
- '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
- '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
- '.jstree a:focus { outline: none; } ' +
- '.jstree a > ins { height:16px; width:16px; } ' +
- '.jstree a > .jstree-icon { margin-right:3px; } ' +
- '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
- 'li.jstree-open > ul { display:block; } ' +
- 'li.jstree-closed > ul { display:none; } ';
- // Correct IE 6 (does not support the > CSS selector)
- if(/msie/.test(u) && parseInt(v, 10) == 6) {
- is_ie6 = true;
- css_string += '' +
- '.jstree li { height:18px; margin-left:0; margin-right:0; } ' +
- '.jstree li li { margin-left:18px; } ' +
- '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +
- 'li.jstree-open ul { display:block; } ' +
- 'li.jstree-closed ul { display:none !important; } ' +
- '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +
- '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +
- '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
- }
- // Correct IE 7 (shifts anchor nodes onhover)
- if(/msie/.test(u) && parseInt(v, 10) == 7) {
- css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
- }
- $.vakata.css.add_sheet({ str : css_string });
- });
-
- // core functions (open, close, create, update, delete)
- $.jstree.plugin("core", {
- __init : function () {
- this.data.core.to_open = $.map($.makeArray(this.get_settings().core.initially_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
- },
- defaults : {
- html_titles : false,
- animation : 500,
- initially_open : [],
- rtl : false,
- strings : {
- loading : "Loading ...",
- new_node : "New node"
- }
- },
- _fn : {
- init : function () {
- this.set_focus();
- if(this._get_settings().core.rtl) {
- this.get_container().addClass("jstree-rtl").css("direction", "rtl");
- }
- this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>" + this._get_settings().core.strings.loading + "</a></li></ul>");
- this.data.core.li_height = this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height() || 18;
-
- this.get_container()
- .delegate("li > ins", "click.jstree", $.proxy(function (event) {
- var trgt = $(event.target);
- if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
- }, this))
- .bind("mousedown.jstree", $.proxy(function () {
- this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
- }, this))
- .bind("dblclick.jstree", function (event) {
- var sel;
- if(document.selection && document.selection.empty) { document.selection.empty(); }
- else {
- if(window.getSelection) {
- sel = window.getSelection();
- try {
- sel.removeAllRanges();
- sel.collapse();
- } catch (err) { }
- }
- }
- });
- this.__callback();
- this.load_node(-1, function () { this.loaded(); this.reopen(); });
- },
- destroy : function () {
- var i,
- n = this.get_index(),
- s = this._get_settings(),
- _this = this;
-
- $.each(s.plugins, function (i, val) {
- try { plugins[val].__destroy.apply(_this); } catch(err) { }
- });
- this.__callback();
- // set focus to another instance if this one is focused
- if(this.is_focused()) {
- for(i in instances) {
- if(instances.hasOwnProperty(i) && i != n) {
- instances[i].set_focus();
- break;
- }
- }
- }
- // if no other instance found
- if(n === focused_instance) { focused_instance = -1; }
- // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
- this.get_container()
- .unbind(".jstree")
- .undelegate(".jstree")
- .removeData("jstree-instance-id")
- .find("[class^='jstree']")
- .andSelf()
- .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
- // remove the actual data
- instances[n] = null;
- delete instances[n];
- },
- save_opened : function () {
- var _this = this;
- this.data.core.to_open = [];
- this.get_container().find(".jstree-open").each(function () {
- _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'));
- });
- this.__callback(_this.data.core.to_open);
- },
- reopen : function (is_callback) {
- var _this = this,
- done = true,
- current = [],
- remaining = [];
- if(!is_callback) { this.data.core.reopen = false; this.data.core.refreshing = true; }
- if(this.data.core.to_open.length) {
- $.each(this.data.core.to_open, function (i, val) {
- if(val == "#") { return true; }
- if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
- else { remaining.push(val); }
- });
- if(current.length) {
- this.data.core.to_open = remaining;
- $.each(current, function (i, val) {
- _this.open_node(val, function () { _this.reopen(true); }, true);
- });
- done = false;
- }
- }
- if(done) {
- // TODO: find a more elegant approach to syncronizing returning requests
- if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
- this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
- this.data.core.refreshing = false;
- }
- },
- refresh : function (obj) {
- var _this = this;
- this.save_opened();
- if(!obj) { obj = -1; }
- obj = this._get_node(obj);
- if(!obj) { obj = -1; }
- if(obj !== -1) { obj.children("UL").remove(); }
- this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reopen(); });
- },
- // Dummy function to fire after the first load (so that there is a jstree.loaded event)
- loaded : function () {
- this.__callback();
- },
- // deal with focus
- set_focus : function () {
- var f = $.jstree._focused();
- if(f && f !== this) {
- f.get_container().removeClass("jstree-focused");
- }
- if(f !== this) {
- this.get_container().addClass("jstree-focused");
- focused_instance = this.get_index();
- }
- this.__callback();
- },
- is_focused : function () {
- return focused_instance == this.get_index();
- },
-
- // traverse
- _get_node : function (obj) {
- var $obj = $(obj, this.get_container());
- if($obj.is(".jstree") || obj == -1) { return -1; }
- $obj = $obj.closest("li", this.get_container());
- return $obj.length ? $obj : false;
- },
- _get_next : function (obj, strict) {
- obj = this._get_node(obj);
- if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
- if(!obj.length) { return false; }
- if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
-
- if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
- else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
- else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
- },
- _get_prev : function (obj, strict) {
- obj = this._get_node(obj);
- if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
- if(!obj.length) { return false; }
- if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
-
- if(obj.prev("li").length) {
- obj = obj.prev("li").eq(0);
- while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
- return obj;
- }
- else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
- },
- _get_parent : function (obj) {
- obj = this._get_node(obj);
- if(obj == -1 || !obj.length) { return false; }
- var o = obj.parentsUntil(".jstree", "li:eq(0)");
- return o.length ? o : -1;
- },
- _get_children : function (obj) {
- obj = this._get_node(obj);
- if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
- if(!obj.length) { return false; }
- return obj.children("ul:eq(0)").children("li");
- },
- get_path : function (obj, id_mode) {
- var p = [],
- _this = this;
- obj = this._get_node(obj);
- if(obj === -1 || !obj || !obj.length) { return false; }
- obj.parentsUntil(".jstree", "li").each(function () {
- p.push( id_mode ? this.id : _this.get_text(this) );
- });
- p.reverse();
- p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
- return p;
- },
-
- is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
- is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
- is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
- // open/close
- open_node : function (obj, callback, skip_animation) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
- var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
- t = this;
- if(!this._is_loaded(obj)) {
- obj.children("a").addClass("jstree-loading");
- this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
- }
- else {
- if(s) { obj.children("ul").css("display","none"); }
- obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
- if(s) { obj.children("ul").stop(true).slideDown(s, function () { this.style.display = ""; }); }
- this.__callback({ "obj" : obj });
- if(callback) { callback.call(); }
- }
- },
- close_node : function (obj, skip_animation) {
- obj = this._get_node(obj);
- var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation;
- if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
- if(s) { obj.children("ul").attr("style","display:block !important"); }
- obj.removeClass("jstree-open").addClass("jstree-closed");
- if(s) { obj.children("ul").stop(true).slideUp(s, function () { this.style.display = ""; }); }
- this.__callback({ "obj" : obj });
- },
- toggle_node : function (obj) {
- obj = this._get_node(obj);
- if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
- if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
- },
- open_all : function (obj, original_obj) {
- obj = obj ? this._get_node(obj) : this.get_container();
- if(!obj || obj === -1) { obj = this.get_container(); }
- if(original_obj) {
- obj = obj.find("li.jstree-closed");
- }
- else {
- original_obj = obj;
- if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
- else { obj = obj.find("li.jstree-closed"); }
- }
- var _this = this;
- obj.each(function () {
- var __this = this;
- if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, original_obj); }, true); }
- else { _this.open_node(this, false, true); }
- });
- // so that callback is fired AFTER all nodes are open
- if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
- },
- close_all : function (obj) {
- var _this = this;
- obj = obj ? this._get_node(obj) : this.get_container();
- if(!obj || obj === -1) { obj = this.get_container(); }
- obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this); });
- this.__callback({ "obj" : obj });
- },
- clean_node : function (obj) {
- obj = obj && obj != -1 ? $(obj) : this.get_container();
- obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
- obj.removeClass("jstree-last")
- .filter("li:last-child").addClass("jstree-last").end()
- .filter(":has(li)")
- .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
- obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
- this.__callback({ "obj" : obj });
- },
- // rollback
- get_rollback : function () {
- this.__callback();
- return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
- },
- set_rollback : function (html, data) {
- this.get_container().empty().append(html);
- this.data = data;
- this.__callback();
- },
- // Dummy functions to be overwritten by any datastore plugin included
- load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
- _is_loaded : function (obj) { return true; },
-
- // Basic operations: create
- create_node : function (obj, position, js, callback, is_loaded) {
- obj = this._get_node(obj);
- position = typeof position === "undefined" ? "last" : position;
- var d = $("<li>"),
- s = this._get_settings().core,
- tmp;
-
- if(obj !== -1 && !obj.length) { return false; }
- if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
-
- this.__rollback();
-
- if(typeof js === "string") { js = { "data" : js }; }
- if(!js) { js = {}; }
- if(js.attr) { d.attr(js.attr); }
- if(js.state) { d.addClass("jstree-" + js.state); }
- if(!js.data) { js.data = s.strings.new_node; }
- if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
- $.each(js.data, function (i, m) {
- tmp = $("<a>");
- if($.isFunction(m)) { m = m.call(this, js); }
- if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
- else {
- if(!m.attr) { m.attr = {}; }
- if(!m.attr.href) { m.attr.href = '#'; }
- tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
- if(m.language) { tmp.addClass(m.language); }
- }
- tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
- if(m.icon) {
- if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
- else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
- }
- d.append(tmp);
- });
- d.prepend("<ins class='jstree-icon'>&#160;</ins>");
- if(obj === -1) {
- obj = this.get_container();
- if(position === "before") { position = "first"; }
- if(position === "after") { position = "last"; }
- }
- switch(position) {
- case "before": obj.before(d); tmp = this._get_parent(obj); break;
- case "after" : obj.after(d); tmp = this._get_parent(obj); break;
- case "inside":
- case "first" :
- if(!obj.children("ul").length) { obj.append("<ul>"); }
- obj.children("ul").prepend(d);
- tmp = obj;
- break;
- case "last":
- if(!obj.children("ul").length) { obj.append("<ul>"); }
- obj.children("ul").append(d);
- tmp = obj;
- break;
- default:
- if(!obj.children("ul").length) { obj.append("<ul>"); }
- if(!position) { position = 0; }
- tmp = obj.children("ul").children("li").eq(position);
- if(tmp.length) { tmp.before(d); }
- else { obj.children("ul").append(d); }
- tmp = obj;
- break;
- }
- if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
- this.clean_node(tmp);
- this.__callback({ "obj" : d, "parent" : tmp });
- if(callback) { callback.call(this, d); }
- return d;
- },
- // Basic operations: rename (deal with text)
- get_text : function (obj) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- var s = this._get_settings().core.html_titles;
- obj = obj.children("a:eq(0)");
- if(s) {
- obj = obj.clone();
- obj.children("INS").remove();
- return obj.html();
- }
- else {
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
- return obj.nodeValue;
- }
- },
- set_text : function (obj, val) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- obj = obj.children("a:eq(0)");
- if(this._get_settings().core.html_titles) {
- var tmp = obj.children("INS").clone();
- obj.html(val).prepend(tmp);
- this.__callback({ "obj" : obj, "name" : val });
- return true;
- }
- else {
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
- this.__callback({ "obj" : obj, "name" : val });
- return (obj.nodeValue = val);
- }
- },
- rename_node : function (obj, val) {
- obj = this._get_node(obj);
- this.__rollback();
- if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
- },
- // Basic operations: deleting nodes
- delete_node : function (obj) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- this.__rollback();
- var p = this._get_parent(obj), prev = this._get_prev(obj);
- obj = obj.remove();
- if(p !== -1 && p.find("> ul > li").length === 0) {
- p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
- }
- this.clean_node(p);
- this.__callback({ "obj" : obj, "prev" : prev });
- return obj;
- },
- prepare_move : function (o, r, pos, cb, is_cb) {
- var p = {};
-
- p.ot = $.jstree._reference(p.o) || this;
- p.o = p.ot._get_node(o);
- p.r = r === - 1 ? -1 : this._get_node(r);
- p.p = (typeof p === "undefined") ? "last" : pos; // TODO: move to a setting
- if(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {
- this.__callback(prepared_move);
- if(cb) { cb.call(this, prepared_move); }
- return;
- }
- p.ot = $.jstree._reference(p.o) || this;
- p.rt = r === -1 ? p.ot : $.jstree._reference(p.r) || this;
- if(p.r === -1) {
- p.cr = -1;
- switch(p.p) {
- case "first":
- case "before":
- case "inside":
- p.cp = 0;
- break;
- case "after":
- case "last":
- p.cp = p.rt.get_container().find(" > ul > li").length;
- break;
- default:
- p.cp = p.p;
- break;
- }
- }
- else {
- if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
- return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
- }
- switch(p.p) {
- case "before":
- p.cp = p.r.index();
- p.cr = p.rt._get_parent(p.r);
- break;
- case "after":
- p.cp = p.r.index() + 1;
- p.cr = p.rt._get_parent(p.r);
- break;
- case "inside":
- case "first":
- p.cp = 0;
- p.cr = p.r;
- break;
- case "last":
- p.cp = p.r.find(" > ul > li").length;
- p.cr = p.r;
- break;
- default:
- p.cp = p.p;
- p.cr = p.r;
- break;
- }
- }
- p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
- p.op = p.ot._get_parent(p.o);
- p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
-
- prepared_move = p;
- this.__callback(prepared_move);
- if(cb) { cb.call(this, prepared_move); }
- },
- check_move : function () {
- var obj = prepared_move, ret = true;
- if(obj.or[0] === obj.o[0]) { return false; }
- obj.o.each(function () {
- if(obj.r.parentsUntil(".jstree").andSelf().filter("li").index(this) !== -1) { ret = false; return false; }
- });
- return ret;
- },
- move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
- if(!is_prepared) {
- return this.prepare_move(obj, ref, position, function (p) {
- this.move_node(p, false, false, is_copy, true, skip_check);
- });
- }
- if(!skip_check && !this.check_move()) { return false; }
-
- this.__rollback();
- var o = false;
- if(is_copy) {
- o = obj.o.clone();
- o.find("*[id]").andSelf().each(function () {
- if(this.id) { this.id = "copy_" + this.id; }
- });
- }
- else { o = obj.o; }
-
- if(obj.or.length) { obj.or.before(o); }
- else {
- if(!obj.np.children("ul").length) { $("<ul>").appendTo(obj.np); }
- obj.np.children("ul:eq(0)").append(o);
- }
-
- try {
- obj.ot.clean_node(obj.op);
- obj.rt.clean_node(obj.np);
- if(!obj.op.find("> ul > li").length) {
- obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
- }
- } catch (e) { }
-
- if(is_copy) {
- prepared_move.cy = true;
- prepared_move.oc = o;
- }
- this.__callback(prepared_move);
- return prepared_move;
- },
- _get_move : function () { return prepared_move; }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree ui plugin 1.0
- * This plugins handles selecting/deselecting/hovering/dehovering nodes
- */
-(function ($) {
- $.jstree.plugin("ui", {
- __init : function () {
- this.data.ui.selected = $();
- this.data.ui.last_selected = false;
- this.data.ui.hovered = null;
- this.data.ui.to_select = this.get_settings().ui.initially_select;
-
- this.get_container()
- .delegate("a", "click.jstree", $.proxy(function (event) {
- event.preventDefault();
- this.select_node(event.currentTarget, true, event);
- }, this))
- .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
- this.hover_node(event.target);
- }, this))
- .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
- this.dehover_node(event.target);
- }, this))
- .bind("reopen.jstree", $.proxy(function () {
- this.reselect();
- }, this))
- .bind("get_rollback.jstree", $.proxy(function () {
- this.dehover_node();
- this.save_selected();
- }, this))
- .bind("set_rollback.jstree", $.proxy(function () {
- this.reselect();
- }, this))
- .bind("close_node.jstree", $.proxy(function (event, data) {
- var s = this._get_settings().ui,
- obj = this._get_node(data.rslt.obj),
- clk = (obj && obj.length) ? obj.children("ul").find(".jstree-clicked") : $(),
- _this = this;
- if(s.selected_parent_close === false || !clk.length) { return; }
- clk.each(function () {
- _this.deselect_node(this);
- if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
- });
- }, this))
- .bind("delete_node.jstree", $.proxy(function (event, data) {
- var s = this._get_settings().ui.select_prev_on_delete,
- obj = this._get_node(data.rslt.obj),
- clk = (obj && obj.length) ? obj.find(".jstree-clicked") : [],
- _this = this;
- clk.each(function () { _this.deselect_node(this); });
- if(s && clk.length) { this.select_node(data.rslt.prev); }
- }, this))
- .bind("move_node.jstree", $.proxy(function (event, data) {
- if(data.rslt.cy) {
- data.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked");
- }
- }, this));
- },
- defaults : {
- select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
- select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
- selected_parent_close : "select_parent", // false, "deselect", "select_parent"
- select_prev_on_delete : true,
- disable_selecting_children : false,
- initially_select : []
- },
- _fn : {
- _get_node : function (obj, allow_multiple) {
- if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
- var $obj = $(obj, this.get_container());
- if($obj.is(".jstree") || obj == -1) { return -1; }
- $obj = $obj.closest("li", this.get_container());
- return $obj.length ? $obj : false;
- },
- save_selected : function () {
- var _this = this;
- this.data.ui.to_select = [];
- this.data.ui.selected.each(function () { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/')); });
- this.__callback(this.data.ui.to_select);
- },
- reselect : function () {
- var _this = this,
- s = this.data.ui.to_select;
- s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
- this.deselect_all();
- $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
- this.__callback();
- },
- refresh : function (obj) {
- this.save_selected();
- return this.__call_old();
- },
- hover_node : function (obj) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
- if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
- this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
- this.__callback({ "obj" : obj });
- },
- dehover_node : function () {
- var obj = this.data.ui.hovered, p;
- if(!obj || !obj.length) { return false; }
- p = obj.children("a").removeClass("jstree-hovered").parent();
- if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
- this.__callback({ "obj" : obj });
- },
- select_node : function (obj, check, e) {
- obj = this._get_node(obj);
- if(obj == -1 || !obj || !obj.length) { return false; }
- var s = this._get_settings().ui,
- is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
- is_selected = this.is_selected(obj),
- proceed = true;
- if(check) {
- if(s.disable_selecting_children && is_multiple && obj.parents("li", this.get_container()).children(".jstree-clicked").length) {
- return false;
- }
- proceed = false;
- switch(!0) {
- case (is_selected && !is_multiple):
- this.deselect_all();
- is_selected = false;
- proceed = true;
- break;
- case (!is_selected && !is_multiple):
- if(s.select_limit == -1 || s.select_limit > 0) {
- this.deselect_all();
- proceed = true;
- }
- break;
- case (is_selected && is_multiple):
- this.deselect_node(obj);
- break;
- case (!is_selected && is_multiple):
- if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
- proceed = true;
- }
- break;
- }
- }
- if(proceed && !is_selected) {
- obj.children("a").addClass("jstree-clicked");
- this.data.ui.selected = this.data.ui.selected.add(obj);
- this.data.ui.last_selected = obj;
- this.__callback({ "obj" : obj });
- }
- },
- deselect_node : function (obj) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- if(this.is_selected(obj)) {
- obj.children("a").removeClass("jstree-clicked");
- this.data.ui.selected = this.data.ui.selected.not(obj);
- if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
- this.__callback({ "obj" : obj });
- }
- },
- toggle_select : function (obj) {
- obj = this._get_node(obj);
- if(!obj.length) { return false; }
- if(this.is_selected(obj)) { this.deselect_node(obj); }
- else { this.select_node(obj); }
- },
- is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
- get_selected : function (context) {
- return context ? $(context).find(".jstree-clicked").parent() : this.data.ui.selected;
- },
- deselect_all : function (context) {
- if(context) { $(context).find(".jstree-clicked").removeClass("jstree-clicked"); }
- else { this.get_container().find(".jstree-clicked").removeClass("jstree-clicked"); }
- this.data.ui.selected = $([]);
- this.data.ui.last_selected = false;
- this.__callback();
- }
- }
- });
- // include the selection plugin by default
- $.jstree.defaults.plugins.push("ui");
-})(jQuery);
-//*/
-
-/*
- * jsTree CRRM plugin 1.0
- * Handles creating/renaming/removing/moving nodes by user interaction.
- */
-(function ($) {
- $.jstree.plugin("crrm", {
- __init : function () {
- this.get_container()
- .bind("move_node.jstree", $.proxy(function (e, data) {
- if(this._get_settings().crrm.move.open_onmove) {
- var t = this;
- data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
- t.open_node(this, false, true);
- });
- }
- }, this));
- },
- defaults : {
- input_width_limit : 200,
- move : {
- always_copy : false, // false, true or "multitree"
- open_onmove : true,
- default_position : "last",
- check_move : function (m) { return true; }
- }
- },
- _fn : {
- _show_input : function (obj, callback) {
- obj = this._get_node(obj);
- var rtl = this._get_settings().core.rtl,
- w = this._get_settings().crrm.input_width_limit,
- w1 = obj.children("ins").width(),
- w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
- t = this.get_text(obj),
- h1 = $("<div>", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
- h2 = obj.css("position","relative").append(
- $("<input>", {
- "value" : t,
- // "size" : t.length,
- "css" : {
- "padding" : "0",
- "border" : "1px solid silver",
- "position" : "absolute",
- "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
- "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
- "top" : "0px",
- "height" : (this.data.core.li_height - 2) + "px",
- "lineHeight" : (this.data.core.li_height - 2) + "px",
- "width" : "150px" // will be set a bit further down
- },
- "blur" : $.proxy(function () {
- var i = obj.children("input"),
- v = i.val();
- if(v === "") { v = t; }
- i.remove(); // rollback purposes
- this.set_text(obj,t); // rollback purposes
- this.rename_node(obj, v);
- callback.call(this, obj, v, t);
- obj.css("position","");
- }, this),
- "keyup" : function (event) {
- var key = event.keyCode || event.which;
- if(key == 27) { this.value = t; this.blur(); return; }
- else if(key == 13) { this.blur(); return; }
- else {
- h2.width(Math.min(h1.text("pW" + this.value).width(),w));
- }
- }
- })
- ).children("input");
- this.set_text(obj, "");
- h1.css({
- fontFamily : h2.css('fontFamily') || '',
- fontSize : h2.css('fontSize') || '',
- fontWeight : h2.css('fontWeight') || '',
- fontStyle : h2.css('fontStyle') || '',
- fontStretch : h2.css('fontStretch') || '',
- fontVariant : h2.css('fontVariant') || '',
- letterSpacing : h2.css('letterSpacing') || '',
- wordSpacing : h2.css('wordSpacing') || ''
- });
- h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
- },
- rename : function (obj) {
- obj = this._get_node(obj);
- this.__rollback();
- var f = this.__callback;
- this._show_input(obj, function (obj, new_name, old_name) {
- f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
- });
- },
- create : function (obj, position, js, callback, skip_rename) {
- var t, _this = this;
- obj = this._get_node(obj);
- if(!obj) { obj = -1; }
- this.__rollback();
- t = this.create_node(obj, position, js, function (t) {
- var p = this._get_parent(t),
- pos = $(t).index();
- if(callback) { callback.call(this, t); }
- if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
- if(!skip_rename) {
- this._show_input(t, function (obj, new_name, old_name) {
- _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
- });
- }
- else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
- });
- return t;
- },
- remove : function (obj) {
- obj = this._get_node(obj, true);
- this.__rollback();
- this.delete_node(obj);
- this.__callback({ "obj" : obj });
- },
- check_move : function () {
- if(!this.__call_old()) { return false; }
- var s = this._get_settings().crrm.move;
- if(!s.check_move.call(this, this._get_move())) { return false; }
- return true;
- },
- move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
- var s = this._get_settings().crrm.move;
- if(!is_prepared) {
- if(!position) { position = s.default_position; }
- if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
- return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
- }
- // if the move is already prepared
- if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
- is_copy = true;
- }
- this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
- },
-
- cut : function (obj) {
- obj = this._get_node(obj);
- this.data.crrm.cp_nodes = false;
- this.data.crrm.ct_nodes = false;
- if(!obj || !obj.length) { return false; }
- this.data.crrm.ct_nodes = obj;
- },
- copy : function (obj) {
- obj = this._get_node(obj);
- this.data.crrm.cp_nodes = false;
- this.data.crrm.ct_nodes = false;
- if(!obj || !obj.length) { return false; }
- this.data.crrm.cp_nodes = obj;
- },
- paste : function (obj) {
- obj = this._get_node(obj);
- if(!obj || !obj.length) { return false; }
- if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
- if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); }
- if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
- this.data.crrm.cp_nodes = false;
- this.data.crrm.ct_nodes = false;
- }
- }
- });
- // include the crr plugin by default
- $.jstree.defaults.plugins.push("crrm");
-})(jQuery);
-
-/*
- * jsTree themes plugin 1.0
- * Handles loading and setting themes, as well as detecting path to themes, etc.
- */
-(function ($) {
- var themes_loaded = [];
- // this variable stores the path to the themes folder - if left as false - it will be autodetected
- $.jstree._themes = false;
- $.jstree.plugin("themes", {
- __init : function () {
- this.get_container()
- .bind("init.jstree", $.proxy(function () {
- var s = this._get_settings().themes;
- this.data.themes.dots = s.dots;
- this.data.themes.icons = s.icons;
- //alert(s.dots);
- this.set_theme(s.theme, s.url);
- }, this))
- .bind("loaded.jstree", $.proxy(function () {
- // bound here too, as simple HTML tree's won't honor dots & icons otherwise
- if(!this.data.themes.dots) { this.hide_dots(); }
- else { this.show_dots(); }
- if(!this.data.themes.icons) { this.hide_icons(); }
- else { this.show_icons(); }
- }, this));
- },
- defaults : {
- theme : "default",
- url : false,
- dots : true,
- icons : true
- },
- _fn : {
- set_theme : function (theme_name, theme_url) {
- if(!theme_name) { return false; }
- if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
- if($.inArray(theme_url, themes_loaded) == -1) {
- $.vakata.css.add_sheet({ "url" : theme_url, "rel" : "jstree" });
- themes_loaded.push(theme_url);
- }
- if(this.data.themes.theme != theme_name) {
- this.get_container().removeClass('jstree-' + this.data.themes.theme);
- this.data.themes.theme = theme_name;
- }
- this.get_container().addClass('jstree-' + theme_name);
- if(!this.data.themes.dots) { this.hide_dots(); }
- else { this.show_dots(); }
- if(!this.data.themes.icons) { this.hide_icons(); }
- else { this.show_icons(); }
- this.__callback();
- },
- get_theme : function () { return this.data.themes.theme; },
-
- show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
- hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
- toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
-
- show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
- hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
- toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
- }
- });
- // autodetect themes path
- $(function () {
- if($.jstree._themes === false) {
- $("script").each(function () {
- if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
- $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
- return false;
- }
- });
- }
- if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
- });
- // include the themes plugin by default
- $.jstree.defaults.plugins.push("themes");
-})(jQuery);
-//*/
-
-/*
- * jsTree hotkeys plugin 1.0
- * Enables keyboard navigation for all tree instances
- * Depends on the jstree ui & jquery hotkeys plugins
- */
-(function ($) {
- var bound = [];
- function exec(i, event) {
- var f = $.jstree._focused(), tmp;
- if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
- tmp = f._get_settings().hotkeys[i];
- if(tmp) { return tmp.call(f, event); }
- }
- }
- $.jstree.plugin("hotkeys", {
- __init : function () {
- if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
- if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
- $.each(this._get_settings().hotkeys, function (i, val) {
- if($.inArray(i, bound) == -1) {
- $(document).bind("keydown", i, function (event) { return exec(i, event); });
- bound.push(i);
- }
- });
- this.enable_hotkeys();
- },
- defaults : {
- "up" : function () {
- var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
- this.hover_node(this._get_prev(o));
- return false;
- },
- "down" : function () {
- var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
- this.hover_node(this._get_next(o));
- return false;
- },
- "left" : function () {
- var o = this.data.ui.hovered || this.data.ui.last_selected;
- if(o) {
- if(o.hasClass("jstree-open")) { this.close_node(o); }
- else { this.hover_node(this._get_prev(o)); }
- }
- return false;
- },
- "right" : function () {
- var o = this.data.ui.hovered || this.data.ui.last_selected;
- if(o && o.length) {
- if(o.hasClass("jstree-closed")) { this.open_node(o); }
- else { this.hover_node(this._get_next(o)); }
- }
- return false;
- },
- "space" : function () {
- if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
- return false;
- },
- "ctrl+space" : function (event) {
- event.type = "click";
- if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
- return false;
- },
- "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
- "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
- },
- _fn : {
- enable_hotkeys : function () {
- this.data.hotkeys.enabled = true;
- },
- disable_hotkeys : function () {
- this.data.hotkeys.enabled = false;
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree JSON 1.0
- * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
- */
-(function ($) {
- $.jstree.plugin("json_data", {
- defaults : {
- data : false,
- ajax : false,
- correct_state : true,
- progressive_render : false
- },
- _fn : {
- load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
- _is_loaded : function (obj) {
- var s = this._get_settings().json_data, d;
- obj = this._get_node(obj);
- if(obj && obj !== -1 && s.progressive_render && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
- d = this._parse_json(obj.data("jstree-children"));
- if(d) {
- obj.append(d);
- $.removeData(obj, "jstree-children");
- }
- this.clean_node(obj);
- return true;
- }
- return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
- },
- load_node_json : function (obj, s_call, e_call) {
- var s = this.get_settings().json_data, d,
- error_func = function () {},
- success_func = function () {};
- obj = this._get_node(obj);
- if(obj && obj !== -1) {
- if(obj.data("jstree-is-loading")) { return; }
- else { obj.data("jstree-is-loading",true); }
- }
- switch(!0) {
- case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
- case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
- if(!obj || obj == -1) {
- d = this._parse_json(s.data);
- if(d) {
- this.get_container().children("ul").empty().append(d.children());
- this.clean_node();
- }
- else {
- if(s.correct_state) { this.get_container().children("ul").empty(); }
- }
- }
- if(s_call) { s_call.call(this); }
- break;
- case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
- error_func = function (x, t, e) {
- var ef = this.get_settings().json_data.ajax.error;
- if(ef) { ef.call(this, x, t, e); }
- if(obj != -1 && obj.length) {
- obj.children(".jstree-loading").removeClass("jstree-loading");
- obj.data("jstree-is-loading",false);
- if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
- }
- else {
- if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
- }
- if(e_call) { e_call.call(this); }
- };
- success_func = function (d, t, x) {
- var sf = this.get_settings().json_data.ajax.success;
- if(sf) { d = sf.call(this,d,t,x) || d; }
- if(d === "" || (!$.isArray(d) && !$.isPlainObject(d))) {
- return error_func.call(this, x, t, "");
- }
- d = this._parse_json(d);
- if(d) {
- if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
- else { obj.append(d).children(".jstree-loading").removeClass("jstree-loading"); obj.data("jstree-is-loading",false); }
- this.clean_node(obj);
- if(s_call) { s_call.call(this); }
- }
- else {
- if(obj === -1 || !obj) {
- if(s.correct_state) {
- this.get_container().children("ul").empty();
- if(s_call) { s_call.call(this); }
- }
- }
- else {
- obj.children(".jstree-loading").removeClass("jstree-loading");
- obj.data("jstree-is-loading",false);
- if(s.correct_state) {
- obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
- if(s_call) { s_call.call(this); }
- }
- }
- }
- };
- s.ajax.context = this;
- s.ajax.error = error_func;
- s.ajax.success = success_func;
- if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
- $.ajax(s.ajax);
- break;
- }
- },
- _parse_json : function (js, is_callback) {
- var d = false,
- p = this._get_settings(),
- s = p.json_data,
- t = p.core.html_titles,
- tmp, i, j, ul1, ul2;
-
- if(!js) { return d; }
- if($.isFunction(js)) {
- js = js.call(this);
- }
- if($.isArray(js)) {
- d = $();
- if(!js.length) { return false; }
- for(i = 0, j = js.length; i < j; i++) {
- tmp = this._parse_json(js[i], true);
- if(tmp.length) { d = d.add(tmp); }
- }
- }
- else {
- if(typeof js == "string") { js = { data : js }; }
- if(!js.data && js.data !== "") { return d; }
- d = $("<li>");
- if(js.attr) { d.attr(js.attr); }
- if(js.metadata) { d.data("jstree", js.metadata); }
- if(js.state) { d.addClass("jstree-" + js.state); }
- if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
- $.each(js.data, function (i, m) {
- tmp = $("<a>");
- if($.isFunction(m)) { m = m.call(this, js); }
- if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
- else {
- if(!m.attr) { m.attr = {}; }
- if(!m.attr.href) { m.attr.href = '#'; }
- tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
- if(m.language) { tmp.addClass(m.language); }
- }
- tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
- if(!m.icon && js.icon) { m.icon = js.icon; }
- if(m.icon) {
- if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
- else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
- }
- d.append(tmp);
- });
- d.prepend("<ins class='jstree-icon'>&#160;</ins>");
- if(js.children) {
- if(s.progressive_render && js.state !== "open") {
- d.addClass("jstree-closed").data("jstree-children", js.children);
- }
- else {
- if($.isFunction(js.children)) {
- js.children = js.children.call(this, js);
- }
- if($.isArray(js.children) && js.children.length) {
- tmp = this._parse_json(js.children, true);
- if(tmp.length) {
- ul2 = $("<ul>");
- ul2.append(tmp);
- d.append(ul2);
- }
- }
- }
- }
- }
- if(!is_callback) {
- ul1 = $("<ul>");
- ul1.append(d);
- d = ul1;
- }
- return d;
- },
- get_json : function (obj, li_attr, a_attr, is_callback) {
- var result = [],
- s = this._get_settings(),
- _this = this,
- tmp1, tmp2, li, a, t, lang;
- obj = this._get_node(obj);
- if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
- li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
- if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
- a_attr = $.isArray(a_attr) ? a_attr : [ ];
-
- obj.each(function () {
- li = $(this);
- tmp1 = { data : [] };
- if(li_attr.length) { tmp1.attr = { }; }
- $.each(li_attr, function (i, v) {
- tmp2 = li.attr(v);
- if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*|$/ig,'').length) {
- tmp1.attr[v] = tmp2.replace(/jstree[^ ]*|$/ig,'');
- }
- });
- if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
- if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
- a = li.children("a");
- a.each(function () {
- t = $(this);
- if(
- a_attr.length ||
- $.inArray("languages", s.plugins) !== -1 ||
- t.children("ins").get(0).style.backgroundImage.length ||
- (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
- ) {
- lang = false;
- if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
- $.each(s.languages, function (l, lv) {
- if(t.hasClass(lv)) {
- lang = lv;
- return false;
- }
- });
- }
- tmp2 = { attr : { }, title : _this.get_text(t, lang) };
- $.each(a_attr, function (k, z) {
- tmp1.attr[z] = (t.attr(z) || "").replace(/jstree[^ ]*|$/ig,'');
- });
- $.each(s.languages, function (k, z) {
- if(t.hasClass(z)) { tmp2.language = z; return true; }
- });
- if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
- tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"");
- }
- if(t.children("ins").get(0).style.backgroundImage.length) {
- tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
- }
- }
- else {
- tmp2 = _this.get_text(t);
- }
- if(a.length > 1) { tmp1.data.push(tmp2); }
- else { tmp1.data = tmp2; }
- });
- li = li.find("> ul > li");
- if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
- result.push(tmp1);
- });
- return result;
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree languages plugin 1.0
- * Adds support for multiple language versions in one tree
- * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
- * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
- */
-(function ($) {
- $.jstree.plugin("languages", {
- __init : function () { this._load_css(); },
- defaults : [],
- _fn : {
- set_lang : function (i) {
- var langs = this._get_settings().languages,
- st = false,
- selector = ".jstree-" + this.get_index() + ' a';
- if(!$.isArray(langs) || langs.length === 0) { return false; }
- if($.inArray(i,langs) == -1) {
- if(!!langs[i]) { i = langs[i]; }
- else { return false; }
- }
- if(i == this.data.languages.current_language) { return true; }
- st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
- if(st !== false) { st.style.display = "none"; }
- st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
- if(st !== false) { st.style.display = ""; }
- this.data.languages.current_language = i;
- this.__callback(i);
- return true;
- },
- get_lang : function () {
- return this.data.languages.current_language;
- },
- get_text : function (obj, lang) {
- obj = this._get_node(obj) || this.data.ui.last_selected;
- if(!obj.size()) { return false; }
- var langs = this._get_settings().languages,
- s = this._get_settings().core.html_titles;
- if($.isArray(langs) && langs.length) {
- lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
- obj = obj.children("a." + lang);
- }
- else { obj = obj.children("a:eq(0)"); }
- if(s) {
- obj = obj.clone();
- obj.children("INS").remove();
- return obj.html();
- }
- else {
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
- return obj.nodeValue;
- }
- },
- set_text : function (obj, val, lang) {
- obj = this._get_node(obj) || this.data.ui.last_selected;
- if(!obj.size()) { return false; }
- var langs = this._get_settings().languages,
- s = this._get_settings().core.html_titles,
- tmp;
- if($.isArray(langs) && langs.length) {
- lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
- obj = obj.children("a." + lang);
- }
- else { obj = obj.children("a:eq(0)"); }
- if(s) {
- tmp = obj.children("INS").clone();
- obj.html(val).prepend(tmp);
- this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
- return true;
- }
- else {
- obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
- this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
- return (obj.nodeValue = val);
- }
- },
- _load_css : function () {
- var langs = this._get_settings().languages,
- str = "/* languages css */",
- selector = ".jstree-" + this.get_index() + ' a',
- ln;
- if($.isArray(langs) && langs.length) {
- this.data.languages.current_language = langs[0];
- for(ln = 0; ln < langs.length; ln++) {
- str += selector + "." + langs[ln] + " {";
- if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
- str += " } ";
- }
- this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str });
- }
- },
- create_node : function (obj, position, js, callback) {
- var t = this.__call_old(true, obj, position, js, function (t) {
- var langs = this._get_settings().languages,
- a = t.children("a"),
- ln;
- if($.isArray(langs) && langs.length) {
- for(ln = 0; ln < langs.length; ln++) {
- if(!a.is("." + langs[ln])) {
- t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
- }
- }
- a.not("." + langs.join(", .")).remove();
- }
- if(callback) { callback.call(this, t); }
- });
- return t;
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree cookies plugin 1.0
- * Stores the currently opened/selected nodes in a cookie and then restores them
- * Depends on the jquery.cookie plugin
- */
-(function ($) {
- $.jstree.plugin("cookies", {
- __init : function () {
- if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
-
- var s = this._get_settings().cookies,
- tmp;
- if(!!s.save_opened) {
- tmp = $.cookie(s.save_opened);
- if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
- }
- if(!!s.save_selected) {
- tmp = $.cookie(s.save_selected);
- if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
- }
- this.get_container()
- .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
- this.get_container()
- .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
- if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
- }, this));
- }, this));
- },
- defaults : {
- save_opened : "jstree_open",
- save_selected : "jstree_select",
- auto_save : true,
- cookie_options : {}
- },
- _fn : {
- save_cookie : function (c) {
- if(this.data.core.refreshing) { return; }
- var s = this._get_settings().cookies;
- if(!c) { // if called manually and not by event
- if(s.save_opened) {
- this.save_opened();
- $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
- }
- if(s.save_selected && this.data.ui) {
- this.save_selected();
- $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
- }
- return;
- }
- switch(c) {
- case "open_node":
- case "close_node":
- if(!!s.save_opened) {
- this.save_opened();
- $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
- }
- break;
- case "select_node":
- case "deselect_node":
- if(!!s.save_selected && this.data.ui) {
- this.save_selected();
- $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
- }
- break;
- }
- }
- }
- });
- // include cookies by default
- $.jstree.defaults.plugins.push("cookies");
-})(jQuery);
-//*/
-
-/*
- * jsTree sort plugin 1.0
- * Sorts items alphabetically (or using any other function)
- */
-(function ($) {
- $.jstree.plugin("sort", {
- __init : function () {
- this.get_container()
- .bind("load_node.jstree", $.proxy(function (e, data) {
- var obj = this._get_node(data.rslt.obj);
- obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
- this.sort(obj);
- }, this))
- .bind("rename_node.jstree", $.proxy(function (e, data) {
- this.sort(data.rslt.obj.parent());
- }, this))
- .bind("move_node.jstree", $.proxy(function (e, data) {
- var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
- this.sort(m.children("ul"));
- }, this));
- },
- defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
- _fn : {
- sort : function (obj) {
- var s = this._get_settings().sort,
- t = this;
- obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
- obj.find("> li > ul").each(function() { t.sort($(this)); });
- this.clean_node(obj);
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree DND plugin 1.0
- * Drag and drop plugin for moving/copying nodes
- */
-(function ($) {
- var o = false,
- r = false,
- m = false,
- sli = false,
- sti = false,
- dir1 = false,
- dir2 = false;
- $.vakata.dnd = {
- is_down : false,
- is_drag : false,
- helper : false,
- scroll_spd : 10,
- init_x : 0,
- init_y : 0,
- threshold : 5,
- user_data : {},
-
- drag_start : function (e, data, html) {
- if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
- try {
- e.currentTarget.unselectable = "on";
- e.currentTarget.onselectstart = function() { return false; };
- if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
- } catch(err) { }
- $.vakata.dnd.init_x = e.pageX;
- $.vakata.dnd.init_y = e.pageY;
- $.vakata.dnd.user_data = data;
- $.vakata.dnd.is_down = true;
- $.vakata.dnd.helper = $("<div id='vakata-dragged'>").html(html).css("opacity", "0.75");
- $(document).bind("mousemove", $.vakata.dnd.drag);
- $(document).bind("mouseup", $.vakata.dnd.drag_stop);
- return false;
- },
- drag : function (e) {
- if(!$.vakata.dnd.is_down) { return; }
- if(!$.vakata.dnd.is_drag) {
- if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
- $.vakata.dnd.helper.appendTo("body");
- $.vakata.dnd.is_drag = true;
- $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
- }
- else { return; }
- }
-
- // maybe use a scrolling parent element instead of document?
- if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
- var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
- if(e.pageY - t < 20) {
- if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
- if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
- }
- else {
- if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
- }
- if($(window).height() - (e.pageY - t) < 20) {
- if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
- if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
- }
- else {
- if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
- }
-
- if(e.pageX - l < 20) {
- if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
- if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
- }
- else {
- if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
- }
- if($(window).width() - (e.pageX - l) < 20) {
- if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
- if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
- }
- else {
- if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
- }
- }
-
- $.vakata.dnd.helper.css({ left : (e.pageX + 5) + "px", top : (e.pageY + 10) + "px" });
- $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
- },
- drag_stop : function (e) {
- $(document).unbind("mousemove", $.vakata.dnd.drag);
- $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
- $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
- $.vakata.dnd.helper.remove();
- $.vakata.dnd.init_x = 0;
- $.vakata.dnd.init_y = 0;
- $.vakata.dnd.user_data = {};
- $.vakata.dnd.is_down = false;
- $.vakata.dnd.is_drag = false;
- }
- };
- $(function() {
- var css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';
- $.vakata.css.add_sheet({ str : css_string });
- });
-
- $.jstree.plugin("dnd", {
- __init : function () {
- this.data.dnd = {
- active : false,
- after : false,
- inside : false,
- before : false,
- off : false,
- prepared : false,
- w : 0,
- to1 : false,
- to2 : false,
- cof : false,
- cw : false,
- ch : false,
- i1 : false,
- i2 : false
- };
- this.get_container()
- .bind("mouseenter.jstree", $.proxy(function () {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && this.data.themes) {
- m.attr("class", "jstree-" + this.data.themes.theme);
- $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
- }
- }, this))
- .bind("mouseleave.jstree", $.proxy(function () {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
- }
- }, this))
- .bind("mousemove.jstree", $.proxy(function (e) {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
- var cnt = this.get_container()[0];
-
- // Horizontal scroll
- if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
- this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
- }
- else if(e.pageX - 24 < this.data.dnd.cof.left) {
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
- this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
- }
- else {
- if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
- }
-
- // Vertical scroll
- if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
- this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
- }
- else if(e.pageY - 24 < this.data.dnd.cof.top) {
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
- this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
- }
- else {
- if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
- }
-
- }
- }, this))
- .delegate("a", "mousedown.jstree", $.proxy(function (e) {
- if(e.which === 1) {
- this.start_drag(e.currentTarget, e);
- return false;
- }
- }, this))
- .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
- this.dnd_enter(e.currentTarget);
- }
- }, this))
- .delegate("a", "mousemove.jstree", $.proxy(function (e) {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
- if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
- this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
- if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
- this.dnd_show();
- }
- }, this))
- .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
- this.data.dnd.after = false;
- this.data.dnd.before = false;
- this.data.dnd.inside = false;
- $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
- m.hide();
- if(r && r[0] === e.target.parentNode) {
- if(this.data.dnd.to1) {
- clearTimeout(this.data.dnd.to1);
- this.data.dnd.to1 = false;
- }
- if(this.data.dnd.to2) {
- clearTimeout(this.data.dnd.to2);
- this.data.dnd.to2 = false;
- }
- }
- }
- }, this))
- .delegate("a", "mouseup.jstree", $.proxy(function (e) {
- if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
- this.dnd_finish(e);
- }
- }, this));
-
- $(document)
- .bind("drag_stop.vakata", $.proxy(function () {
- this.data.dnd.after = false;
- this.data.dnd.before = false;
- this.data.dnd.inside = false;
- this.data.dnd.off = false;
- this.data.dnd.prepared = false;
- this.data.dnd.w = false;
- this.data.dnd.to1 = false;
- this.data.dnd.to2 = false;
- this.data.dnd.active = false;
- this.data.dnd.foreign = false;
- if(m) { m.css({ "top" : "-2000px" }); }
- }, this))
- .bind("drag_start.vakata", $.proxy(function (e, data) {
- if(data.data.jstree) {
- var et = $(data.event.target);
- if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
- this.dnd_enter(et);
- }
- }
- }, this));
-
- var s = this._get_settings().dnd;
- if(s.drag_target) {
- $(document)
- .delegate(s.drag_target, "mousedown.jstree", $.proxy(function (e) {
- o = e.target;
- $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
- if(this.data.themes) {
- m.attr("class", "jstree-" + this.data.themes.theme);
- $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
- }
- $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
- var cnt = this.get_container();
- this.data.dnd.cof = cnt.offset();
- this.data.dnd.cw = parseInt(cnt.width(),10);
- this.data.dnd.ch = parseInt(cnt.height(),10);
- this.data.dnd.foreign = true;
- return false;
- }, this));
- }
- if(s.drop_target) {
- $(document)
- .delegate(s.drop_target, "mouseenter.jstree", $.proxy(function (e) {
- if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target) })) {
- $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
- }
- }, this))
- .delegate(s.drop_target, "mouseleave.jstree", $.proxy(function (e) {
- if(this.data.dnd.active) {
- $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
- }
- }, this))
- .delegate(s.drop_target, "mouseup.jstree", $.proxy(function (e) {
- if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
- this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target) });
- }
- }, this));
- }
- },
- defaults : {
- copy_modifier : "ctrl",
- check_timeout : 200,
- open_timeout : 500,
- drop_target : ".jstree-drop",
- drop_check : function (data) { return true; },
- drop_finish : $.noop,
- drag_target : ".jstree-draggable",
- drag_finish : $.noop,
- drag_check : function (data) { return { after : false, before : false, inside : true }; }
- },
- _fn : {
- dnd_prepare : function () {
- if(!r || !r.length) { return; }
- this.data.dnd.off = r.offset();
- if(this._get_settings().core.rtl) {
- this.data.dnd.off.right = this.data.dnd.off.left + r.width();
- }
- if(this.data.dnd.foreign) {
- var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
- this.data.dnd.after = a.after;
- this.data.dnd.before = a.before;
- this.data.dnd.inside = a.inside;
- this.data.dnd.prepared = true;
- return this.dnd_show();
- }
- this.prepare_move(o, r, "before");
- this.data.dnd.before = this.check_move();
- this.prepare_move(o, r, "after");
- this.data.dnd.after = this.check_move();
- if(this._is_loaded(r)) {
- this.prepare_move(o, r, "inside");
- this.data.dnd.inside = this.check_move();
- }
- else {
- this.data.dnd.inside = false;
- }
- this.data.dnd.prepared = true;
- return this.dnd_show();
- },
- dnd_show : function () {
- if(!this.data.dnd.prepared) { return; }
- var o = ["before","inside","after"],
- r = false,
- rtl = this._get_settings().core.rtl,
- pos;
- if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
- else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
- o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
- }
- else { o = ["after","inside","before"]; }
- $.each(o, $.proxy(function (i, val) {
- if(this.data.dnd[val]) {
- $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
- r = val;
- return false;
- }
- }, this));
- if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
-
- pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
- switch(r) {
- case "before":
- m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
- break;
- case "after":
- m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 7) + "px" }).show();
- break;
- case "inside":
- m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
- break;
- default:
- m.hide();
- break;
- }
- return r;
- },
- dnd_open : function () {
- this.data.dnd.to2 = false;
- this.open_node(r, $.proxy(this.dnd_prepare,this), true);
- },
- dnd_finish : function (e) {
- if(this.data.dnd.foreign) {
- if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
- this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r });
- }
- }
- else {
- this.dnd_prepare();
- this.move_node(o, r, this.dnd_show(), e[this._get_settings().dnd.copy_modifier + "Key"]);
- }
- o = false;
- r = false;
- m.hide();
- },
- dnd_enter : function (obj) {
- var s = this._get_settings().dnd;
- this.data.dnd.prepared = false;
- r = this._get_node(obj);
- if(s.check_timeout) {
- // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
- if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
- this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
- }
- else {
- this.dnd_prepare();
- }
- if(s.open_timeout) {
- if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
- if(r && r.length && r.hasClass("jstree-closed")) {
- // if the node is closed - open it, then recalculate
- this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
- }
- }
- else {
- if(r && r.length && r.hasClass("jstree-closed")) {
- this.dnd_open();
- }
- }
- },
- start_drag : function (obj, e) {
- o = this._get_node(obj);
- if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
- $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + (o.length > 1 ? "Multiple selection" : this.get_text(o)) );
- if(this.data.themes) {
- m.attr("class", "jstree-" + this.data.themes.theme);
- $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
- }
- var cnt = this.get_container();
- this.data.dnd.cof = cnt.children("ul").offset();
- this.data.dnd.cw = parseInt(cnt.width(),10);
- this.data.dnd.ch = parseInt(cnt.height(),10);
- this.data.dnd.active = true;
- }
- }
- });
- $(function() {
- var css_string = '' +
- '#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; } ' +
- '#vakata-dragged .jstree-ok { background:green; } ' +
- '#vakata-dragged .jstree-invalid { background:red; } ' +
- '#jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:silver; } ';
- $.vakata.css.add_sheet({ str : css_string });
- m = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
- $(document).bind("drag_start.vakata", function (e, data) {
- if(data.data.jstree) {
- m.show();
- }
- });
- $(document).bind("drag_stop.vakata", function (e, data) {
- if(data.data.jstree) { m.hide(); }
- });
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree checkbox plugin 1.0
- * Inserts checkboxes in front of every node
- * Depends on the ui plugin
- * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
- */
-(function ($) {
- $.jstree.plugin("checkbox", {
- __init : function () {
- this.select_node = this.deselect_node = this.deselect_all = $.noop;
- this.get_selected = this.get_checked;
-
- this.get_container()
- .bind("open_node.jstree create_node.jstree clean_node.jstree", $.proxy(function (e, data) {
- this._prepare_checkboxes(data.rslt.obj);
- }, this))
- .bind("loaded.jstree", $.proxy(function (e) {
- this._prepare_checkboxes();
- }, this))
- .delegate("a", "click.jstree", $.proxy(function (e) {
- if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
- else { this.check_node(e.target); }
- if(this.data.ui) { this.save_selected(); }
- if(this.data.cookies) { this.save_cookie("select_node"); }
- e.preventDefault();
- }, this));
- },
- __destroy : function () {
- this.get_container().find(".jstree-checkbox").remove();
- },
- _fn : {
- _prepare_checkboxes : function (obj) {
- obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj);
- var c, _this = this, t;
- obj.each(function () {
- t = $(this);
- c = t.is("li") && t.hasClass("jstree-checked") ? "jstree-checked" : "jstree-unchecked";
- t.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(c);
- });
- if(obj.is("li")) { this._repair_state(obj); }
- else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
- },
- change_state : function (obj, state) {
- obj = this._get_node(obj);
- state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
- if(state) { obj.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); }
- else {
- obj.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
- if(this.data.ui) { this.data.ui.last_selected = obj; }
- this.data.checkbox.last_selected = obj;
- }
- obj.parentsUntil(".jstree", "li").each(function () {
- var $this = $(this);
- if(state) {
- if($this.children("ul").children(".jstree-checked, .jstree-undetermined").length) {
- $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
- return false;
- }
- else {
- $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
- }
- }
- else {
- if($this.children("ul").children(".jstree-unchecked, .jstree-undetermined").length) {
- $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
- return false;
- }
- else {
- $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
- }
- }
- });
- if(this.data.ui) { this.data.ui.selected = this.get_checked(); }
- this.__callback(obj);
- },
- check_node : function (obj) {
- this.change_state(obj, false);
- },
- uncheck_node : function (obj) {
- this.change_state(obj, true);
- },
- check_all : function () {
- var _this = this;
- this.get_container().children("ul").children("li").each(function () {
- _this.check_node(this, false);
- });
- },
- uncheck_all : function () {
- var _this = this;
- this.get_container().children("ul").children("li").each(function () {
- _this.change_state(this, true);
- });
- },
-
- is_checked : function(obj) {
- obj = this._get_node(obj);
- return obj.length ? obj.is(".jstree-checked") : false;
- },
- get_checked : function (obj) {
- obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
- return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
- },
- get_unchecked : function (obj) {
- obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
- return obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
- },
-
- show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
- hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
-
- _repair_state : function (obj) {
- obj = this._get_node(obj);
- if(!obj.length) { return; }
- var a = obj.find("> ul > .jstree-checked").length,
- b = obj.find("> ul > .jstree-undetermined").length,
- c = obj.find("> ul > li").length;
-
- if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.check_node(obj); } }
- else if(a === 0 && b === 0) { this.uncheck_node(obj); }
- else if(a === c) { this.check_node(obj); }
- else {
- obj.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
- }
- },
- reselect : function () {
- if(this.data.ui) {
- var _this = this,
- s = this.data.ui.to_select;
- s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
- this.deselect_all();
- $.each(s, function (i, val) { _this.check_node(val); });
- this.__callback();
- }
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree XML 1.0
- * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
- */
-(function ($) {
- $.vakata.xslt = function (xml, xsl, callback) {
- var rs = "", xm, xs, processor, support;
- if(document.recalc) {
- xm = document.createElement('xml');
- xs = document.createElement('xml');
- xm.innerHTML = xml;
- xs.innerHTML = xsl;
- $("body").append(xm).append(xs);
- setTimeout( (function (xm, xs, callback) {
- return function () {
- callback.call(null, xm.transformNode(xs.XMLDocument));
- setTimeout( (function (xm, xs) { return function () { jQuery("body").remove(xm).remove(xs); }; })(xm, xs), 200);
- };
- }) (xm, xs, callback), 100);
- return true;
- }
- if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
- processor = new XSLTProcessor();
- support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
- if(!support) { return false; }
- xml = new DOMParser().parseFromString(xml, "text/xml");
- xsl = new DOMParser().parseFromString(xsl, "text/xml");
- if($.isFunction(processor.transformDocument)) {
- rs = document.implementation.createDocument("", "", null);
- processor.transformDocument(xml, xsl, rs, null);
- callback.call(null, XMLSerializer().serializeToString(rs));
- return true;
- }
- else {
- processor.importStylesheet(xsl);
- rs = processor.transformToFragment(xml, document);
- callback.call(null, $("<div>").append(rs).html());
- return true;
- }
- }
- return false;
- };
- var xsl = {
- 'nest' : '<?xml version="1.0" encoding="utf-8" ?>' +
- '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
- '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
- '<xsl:template match="/">' +
- ' <xsl:call-template name="nodes">' +
- ' <xsl:with-param name="node" select="/root" />' +
- ' </xsl:call-template>' +
- '</xsl:template>' +
- '<xsl:template name="nodes">' +
- ' <xsl:param name="node" />' +
- ' <ul>' +
- ' <xsl:for-each select="$node/item">' +
- ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
- ' <li>' +
- ' <xsl:attribute name="class">' +
- ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
- ' <xsl:choose>' +
- ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
- ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
- ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
- ' </xsl:choose>' +
- ' <xsl:value-of select="@class" />' +
- ' </xsl:attribute>' +
- ' <xsl:for-each select="@*">' +
- ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
- ' </xsl:if>' +
- ' </xsl:for-each>' +
- ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
- ' <xsl:for-each select="content/name">' +
- ' <a>' +
- ' <xsl:attribute name="href">' +
- ' <xsl:choose>' +
- ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
- ' <xsl:otherwise>#</xsl:otherwise>' +
- ' </xsl:choose>' +
- ' </xsl:attribute>' +
- ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
- ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
- ' <xsl:for-each select="@*">' +
- ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
- ' </xsl:if>' +
- ' </xsl:for-each>' +
- ' <ins>' +
- ' <xsl:attribute name="class">jstree-icon ' +
- ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
- ' </xsl:attribute>' +
- ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
- ' <xsl:text>&#xa0;</xsl:text>' +
- ' </ins>' +
- ' <xsl:value-of select="current()" />' +
- ' </a>' +
- ' </xsl:for-each>' +
- ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
- ' </li>' +
- ' </xsl:for-each>' +
- ' </ul>' +
- '</xsl:template>' +
- '</xsl:stylesheet>',
-
- 'flat' : '<?xml version="1.0" encoding="utf-8" ?>' +
- '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
- '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
- '<xsl:template match="/">' +
- ' <ul>' +
- ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
- ' <xsl:call-template name="nodes">' +
- ' <xsl:with-param name="node" select="." />' +
- ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
- ' </xsl:call-template>' +
- ' </xsl:for-each>' +
- ' </ul>' +
- '</xsl:template>' +
- '<xsl:template name="nodes">' +
- ' <xsl:param name="node" />' +
- ' <xsl:param name="is_last" />' +
- ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
- ' <li>' +
- ' <xsl:attribute name="class">' +
- ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
- ' <xsl:choose>' +
- ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
- ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
- ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
- ' </xsl:choose>' +
- ' <xsl:value-of select="@class" />' +
- ' </xsl:attribute>' +
- ' <xsl:for-each select="@*">' +
- ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
- ' </xsl:if>' +
- ' </xsl:for-each>' +
- ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
- ' <xsl:for-each select="content/name">' +
- ' <a>' +
- ' <xsl:attribute name="href">' +
- ' <xsl:choose>' +
- ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
- ' <xsl:otherwise>#</xsl:otherwise>' +
- ' </xsl:choose>' +
- ' </xsl:attribute>' +
- ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
- ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
- ' <xsl:for-each select="@*">' +
- ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
- ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
- ' </xsl:if>' +
- ' </xsl:for-each>' +
- ' <ins>' +
- ' <xsl:attribute name="class">jstree-icon ' +
- ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
- ' </xsl:attribute>' +
- ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
- ' <xsl:text>&#xa0;</xsl:text>' +
- ' </ins>' +
- ' <xsl:value-of select="current()" />' +
- ' </a>' +
- ' </xsl:for-each>' +
- ' <xsl:if test="$children">' +
- ' <ul>' +
- ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
- ' <xsl:call-template name="nodes">' +
- ' <xsl:with-param name="node" select="." />' +
- ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
- ' </xsl:call-template>' +
- ' </xsl:for-each>' +
- ' </ul>' +
- ' </xsl:if>' +
- ' </li>' +
- '</xsl:template>' +
- '</xsl:stylesheet>'
- };
- $.jstree.plugin("xml_data", {
- defaults : {
- data : false,
- ajax : false,
- xsl : "flat",
- clean_node : false,
- correct_state : true
- },
- _fn : {
- load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
- _is_loaded : function (obj) {
- var s = this._get_settings().xml_data;
- obj = this._get_node(obj);
- return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
- },
- load_node_xml : function (obj, s_call, e_call) {
- var s = this.get_settings().xml_data,
- error_func = function () {},
- success_func = function () {};
-
- obj = this._get_node(obj);
- if(obj && obj !== -1) {
- if(obj.data("jstree-is-loading")) { return; }
- else { obj.data("jstree-is-loading",true); }
- }
- switch(!0) {
- case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
- case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
- if(!obj || obj == -1) {
- this.parse_xml(s.data, $.proxy(function (d) {
- if(d) {
- d = d.replace(/ ?xmlns="[^"]*"/ig, "");
- if(d.length > 10) {
- d = $(d);
- this.get_container().children("ul").empty().append(d.children());
- if(s.clean_node) { this.clean_node(obj); }
- if(s_call) { s_call.call(this); }
- }
- }
- else {
- if(s.correct_state) {
- this.get_container().children("ul").empty();
- if(s_call) { s_call.call(this); }
- }
- }
- }, this));
- }
- break;
- case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
- error_func = function (x, t, e) {
- var ef = this.get_settings().xml_data.ajax.error;
- if(ef) { ef.call(this, x, t, e); }
- if(obj !== -1 && obj.length) {
- obj.children(".jstree-loading").removeClass("jstree-loading");
- obj.data("jstree-is-loading",false);
- if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
- }
- else {
- if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
- }
- if(e_call) { e_call.call(this); }
- };
- success_func = function (d, t, x) {
- d = x.responseText;
- var sf = this.get_settings().xml_data.ajax.success;
- if(sf) { d = sf.call(this,d,t,x) || d; }
- if(d == "") {
- return error_func.call(this, x, t, "");
- }
- this.parse_xml(d, $.proxy(function (d) {
- if(d) {
- d = d.replace(/ ?xmlns="[^"]*"/ig, "");
- if(d.length > 10) {
- d = $(d);
- if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
- else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.data("jstree-is-loading",false); }
- if(s.clean_node) { this.clean_node(obj); }
- if(s_call) { s_call.call(this); }
- }
- else {
- if(obj && obj !== -1) {
- obj.children(".jstree-loading").removeClass("jstree-loading");
- obj.data("jstree-is-loading",false);
- if(s.correct_state) {
- obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
- if(s_call) { s_call.call(this); }
- }
- }
- else {
- if(s.correct_state) {
- this.get_container().children("ul").empty();
- if(s_call) { s_call.call(this); }
- }
- }
- }
- }
- }, this));
- };
- s.ajax.context = this;
- s.ajax.error = error_func;
- s.ajax.success = success_func;
- if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
- $.ajax(s.ajax);
- break;
- }
- },
- parse_xml : function (xml, callback) {
- var s = this._get_settings().xml_data;
- $.vakata.xslt(xml, xsl[s.xsl], callback);
- },
- get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
- var result = "",
- s = this._get_settings(),
- _this = this,
- tmp1, tmp2, li, a, lang;
- if(!tp) { tp = "flat"; }
- if(!is_callback) { is_callback = 0; }
- obj = this._get_node(obj);
- if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
- li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
- if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
-
- a_attr = $.isArray(a_attr) ? a_attr : [ ];
-
- if(!is_callback) { result += "<root>"; }
- obj.each(function () {
- result += "<item";
- li = $(this);
- $.each(li_attr, function (i, v) { result += " " + v + "=\"" + (li.attr(v) || "").replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + "\""; });
- if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
- if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
- if(tp === "flat") { result += " parent_id=\"" + is_callback + "\""; }
- result += ">";
- result += "<content>";
- a = li.children("a");
- a.each(function () {
- tmp1 = $(this);
- lang = false;
- result += "<name";
- if($.inArray("languages", s.plugins) !== -1) {
- $.each(s.languages, function (k, z) {
- if(tmp1.hasClass(z)) { result += " lang=\"" + z + "\""; lang = z; return false; }
- });
- }
- if(a_attr.length) {
- $.each(a_attr, function (k, z) {
- result += " " + z + "=\"" + (tmp1.attr(z) || "").replace(/jstree[^ ]*|$/ig,'') + "\"";
- });
- }
- if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
- result += ' icon="' + tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + '"';
- }
- if(tmp1.children("ins").get(0).style.backgroundImage.length) {
- result += ' icon="' + tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '"';
- }
- result += ">";
- result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
- result += "</name>";
- });
- result += "</content>";
- tmp2 = li[0].id;
- li = li.find("> ul > li");
- if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
- else { tmp2 = ""; }
- if(tp == "nest") { result += tmp2; }
- result += "</item>";
- if(tp == "flat") { result += tmp2; }
- });
- if(!is_callback) { result += "</root>"; }
- return result;
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree search plugin 1.0
- * Enables both sync and async search on the tree
- * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
- */
-(function ($) {
- $.expr[':'].jstree_contains = function(a,i,m){
- return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
- };
- $.jstree.plugin("search", {
- __init : function () {
- this.data.search.str = "";
- this.data.search.result = $();
- },
- defaults : {
- ajax : false, // OR ajax object
- case_insensitive : false
- },
- _fn : {
- search : function (str, skip_async) {
- if(str === "") { return; }
- var s = this.get_settings().search,
- t = this,
- error_func = function () { },
- success_func = function () { };
- this.data.search.str = str;
-
- if(!skip_async && s.ajax !== false && this.get_container().find(".jstree-closed:eq(0)").length > 0) {
- this.search.supress_callback = true;
- error_func = function () { };
- success_func = function (d, t, x) {
- var sf = this.get_settings().search.ajax.success;
- if(sf) { d = sf.call(this,d,t,x) || d; }
- this.data.search.to_open = d;
- this._search_open();
- };
- s.ajax.context = this;
- s.ajax.error = error_func;
- s.ajax.success = success_func;
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
- if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
- if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
- $.ajax(s.ajax);
- return;
- }
- if(this.data.search.result.length) { this.clear_search(); }
- this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.case_insensitive ? "jstree_contains" : "contains") + "(" + this.data.search.str + ")");
- this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function () {
- t.open_node(this, false, true);
- });
- this.__callback({ nodes : this.data.search.result, str : str });
- },
- clear_search : function (str) {
- this.data.search.result.removeClass("jstree-search");
- this.__callback(this.data.search.result);
- this.data.search.result = $();
- },
- _search_open : function (is_callback) {
- var _this = this,
- done = true,
- current = [],
- remaining = [];
- if(this.data.search.to_open.length) {
- $.each(this.data.search.to_open, function (i, val) {
- if(val == "#") { return true; }
- if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
- else { remaining.push(val); }
- });
- if(current.length) {
- this.data.search.to_open = remaining;
- $.each(current, function (i, val) {
- _this.open_node(val, function () { _this._search_open(true); });
- });
- done = false;
- }
- }
- if(done) { this.search(this.data.search.str, true); }
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree contextmenu plugin 1.0
- */
-(function ($) {
- $.vakata.context = {
- cnt : $("<div id='vakata-contextmenu'>"),
- vis : false,
- tgt : false,
- par : false,
- func : false,
- data : false,
- show : function (s, t, x, y, d, p) {
- var html = $.vakata.context.parse(s), h, w;
- if(!html) { return; }
- $.vakata.context.vis = true;
- $.vakata.context.tgt = t;
- $.vakata.context.par = p || t || null;
- $.vakata.context.data = d || null;
- $.vakata.context.cnt
- .html(html)
- .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
- h = $.vakata.context.cnt.height();
- w = $.vakata.context.cnt.width();
- if(x + w > $(document).width()) {
- x = $(document).width() - (w + 5);
- $.vakata.context.cnt.find("li > ul").addClass("right");
- }
- if(y + h > $(document).height()) {
- y = y - (h + t[0].offsetHeight);
- $.vakata.context.cnt.find("li > ul").addClass("bottom");
- }
-
- $.vakata.context.cnt
- .css({ "left" : x, "top" : y })
- .find("li:has(ul)")
- .bind("mouseenter", function (e) {
- var w = $(document).width(),
- h = $(document).height(),
- ul = $(this).children("ul").show();
- if(w !== $(document).width()) { ul.toggleClass("right"); }
- if(h !== $(document).height()) { ul.toggleClass("bottom"); }
- })
- .bind("mouseleave", function (e) {
- $(this).children("ul").hide();
- })
- .end()
- .css({ "visibility" : "visible" })
- .show();
- $(document).triggerHandler("context_show.vakata");
- },
- hide : function () {
- $.vakata.context.vis = false;
- $.vakata.context.cnt.attr("class","").hide();
- $(document).triggerHandler("context_hide.vakata");
- },
- parse : function (s, is_callback) {
- if(!s) { return false; }
- var str = "",
- tmp = false,
- was_sep = true;
- if(!is_callback) { $.vakata.context.func = {}; }
- str += "<ul>";
- $.each(s, function (i, val) {
- if(!val) { return true; }
- $.vakata.context.func[i] = val.action;
- if(!was_sep && val.separator_before) {
- str += "<li class='vakata-separator vakata-separator-before'></li>";
- }
- was_sep = false;
- str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
- if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
- if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
- str += ">&#160;</ins><a href='#' rel='" + i + "'>";
- if(val.submenu) {
- str += "<span style='float:right;'>&raquo;</span>";
- }
- str += val.label + "</a>";
- if(val.submenu) {
- tmp = $.vakata.context.parse(val.submenu, true);
- if(tmp) { str += tmp; }
- }
- str += "</li>";
- if(val.separator_after) {
- str += "<li class='vakata-separator vakata-separator-after'></li>";
- was_sep = true;
- }
- });
- str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
- str += "</ul>";
- return str.length > 10 ? str : false;
- },
- exec : function (i) {
- if($.isFunction($.vakata.context.func[i])) {
- $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
- return true;
- }
- else { return false; }
- }
- };
- $(function () {
- var css_string = '' +
- '#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
- '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
- '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
- '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
- '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
- '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
- '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
- '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
- '#vakata-contextmenu .right { right:100%; left:auto; } ' +
- '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
- '#vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ';
- $.vakata.css.add_sheet({ str : css_string });
- $.vakata.context.cnt
- .delegate("a","click", function (e) { e.preventDefault(); })
- .delegate("a","mouseup", function (e) {
- if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
- $.vakata.context.hide();
- }
- else { $(this).blur(); }
- })
- .delegate("a","mouseover", function () {
- $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
- })
- .appendTo("body");
- $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
- if(typeof $.hotkeys !== "undefined") {
- $(document)
- .bind("keydown", "up", function (e) {
- if($.vakata.context.vis) {
- var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
- if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
- o.addClass("vakata-hover");
- e.stopImmediatePropagation();
- e.preventDefault();
- }
- })
- .bind("keydown", "down", function (e) {
- if($.vakata.context.vis) {
- var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
- if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
- o.addClass("vakata-hover");
- e.stopImmediatePropagation();
- e.preventDefault();
- }
- })
- .bind("keydown", "right", function (e) {
- if($.vakata.context.vis) {
- $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
- e.stopImmediatePropagation();
- e.preventDefault();
- }
- })
- .bind("keydown", "left", function (e) {
- if($.vakata.context.vis) {
- $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
- e.stopImmediatePropagation();
- e.preventDefault();
- }
- })
- .bind("keydown", "esc", function (e) {
- $.vakata.context.hide();
- e.preventDefault();
- })
- .bind("keydown", "space", function (e) {
- $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
- e.preventDefault();
- });
- }
- });
-
- $.jstree.plugin("contextmenu", {
- __init : function () {
- this.get_container()
- .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
- e.preventDefault();
- this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
- }, this))
- .bind("destroy.jstree", $.proxy(function () {
- if(this.data.contextmenu) {
- $.vakata.context.hide();
- }
- }, this));
- $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
- },
- defaults : {
- select_node : false, // requires UI plugin
- show_at_node : true,
- items : { // Could be a function that should return an object like this one
- "create" : {
- "separator_before" : false,
- "separator_after" : true,
- "label" : "Create",
- "action" : function (obj) { this.create(obj); }
- },
- "rename" : {
- "separator_before" : false,
- "separator_after" : false,
- "label" : "Rename",
- "action" : function (obj) { this.rename(obj); }
- },
- "remove" : {
- "separator_before" : false,
- "icon" : false,
- "separator_after" : false,
- "label" : "Delete",
- "action" : function (obj) { this.remove(obj); }
- },
- "ccp" : {
- "separator_before" : true,
- "icon" : false,
- "separator_after" : false,
- "label" : "Edit",
- "action" : false,
- "submenu" : {
- "cut" : {
- "separator_before" : false,
- "separator_after" : false,
- "label" : "Cut",
- "action" : function (obj) { this.cut(obj); }
- },
- "copy" : {
- "separator_before" : false,
- "icon" : false,
- "separator_after" : false,
- "label" : "Copy",
- "action" : function (obj) { this.copy(obj); }
- },
- "paste" : {
- "separator_before" : false,
- "icon" : false,
- "separator_after" : false,
- "label" : "Paste",
- "action" : function (obj) { this.paste(obj); }
- }
- }
- }
- }
- },
- _fn : {
- show_contextmenu : function (obj, x, y) {
- obj = this._get_node(obj);
- var s = this.get_settings().contextmenu,
- a = obj.children("a:visible:eq(0)"),
- o = false;
- if(s.select_node && this.data.ui && !this.is_selected(obj)) {
- this.deselect_all();
- this.select_node(obj, true);
- }
- if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
- o = a.offset();
- x = o.left;
- y = o.top + this.data.core.li_height;
- }
- if($.isFunction(s.items)) { s.items = s.items.call(this, obj); }
- this.data.contextmenu = true;
- $.vakata.context.show(s.items, a, x, y, this, obj);
- if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree types plugin 1.0
- * Adds support types of nodes
- * You can set an attribute on each li node, that represents its type.
- * According to the type setting the node may get custom icon/validation rules
- */
-(function ($) {
- $.jstree.plugin("types", {
- __init : function () {
- var s = this._get_settings().types;
- this.data.types.attach_to = [];
- this.get_container()
- .bind("init.jstree", $.proxy(function () {
- var types = s.types,
- attr = s.type_attr,
- icons_css = "",
- _this = this;
-
- $.each(types, function (i, tp) {
- $.each(tp, function (k, v) {
- if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
- });
- if(!tp.icon) { return true; }
- if( tp.icon.image || tp.icon.position) {
- if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
- else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '=' + i + '] > a > .jstree-icon { '; }
- if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
- if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
- else { icons_css += ' background-position:0 0; '; }
- icons_css += '} ';
- }
- });
- if(icons_css != "") { $.vakata.css.add_sheet({ 'str' : icons_css }); }
- }, this))
- .bind("before.jstree", $.proxy(function (e, data) {
- if($.inArray(data.func, this.data.types.attach_to) !== -1) {
- var s = this._get_settings().types.types,
- t = this._get_type(data.args[0]);
- if(
- (
- (s[t] && typeof s[t][data.func] !== "undefined") ||
- (s["default"] && typeof s["default"][data.func] !== "undefined")
- ) && !this._check(data.func, data.args[0])
- ) {
- e.stopImmediatePropagation();
- return false;
- }
- }
- }, this));
- },
- defaults : {
- // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
- max_children : -1,
- // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
- max_depth : -1,
- // defines valid node types for the root nodes
- valid_children : "all",
-
- // where is the type stores (the rel attribute of the LI element)
- type_attr : "rel",
- // a list of types
- types : {
- // the default type
- "default" : {
- "max_children" : -1,
- "max_depth" : -1,
- "valid_children": "all"
-
- // Bound functions - you can bind any other function here (using boolean or function)
- //"select_node" : true,
- //"open_node" : true,
- //"close_node" : true,
- //"create_node" : true,
- //"delete_node" : true
- }
- }
- },
- _fn : {
- _get_type : function (obj) {
- obj = this._get_node(obj);
- return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
- },
- set_type : function (str, obj) {
- obj = this._get_node(obj);
- return (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
- },
- _check : function (rule, obj, opts) {
- var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types;
- if(obj === -1) {
- if(!!s[rule]) { v = s[rule]; }
- else { return; }
- }
- else {
- if(t === false) { return; }
- if(!!s.types[t] && !!s.types[t][rule]) { v = s.types[t][rule]; }
- else if(!!s.types["default"] && !!s.types["default"][rule]) { v = s.types["default"][rule]; }
- }
- if($.isFunction(v)) { v = v.call(this, obj); }
- if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
- // also include the node itself - otherwise if root node it is not checked
- this._get_node(obj).children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
- // check if current depth already exceeds global tree depth
- if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
- d = (i === 0) ? v : _this._check(rule, this, false);
- // check if current node max depth is already matched or exceeded
- if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
- // otherwise - set the max depth to the current value minus current depth
- if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
- // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
- if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
- });
- }
- return v;
- },
- check_move : function () {
- if(!this.__call_old()) { return false; }
- var m = this._get_move(),
- s = m.rt._get_settings().types,
- mc = m.rt._check("max_children", m.cr),
- md = m.rt._check("max_depth", m.cr),
- vc = m.rt._check("valid_children", m.cr),
- ch = 0, d = 1, t;
-
- if(vc === "none") { return false; }
- if($.isArray(vc) && m.ot && m.ot._get_type) {
- m.o.each(function () {
- if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
- });
- if(d === false) { return false; }
- }
- if(s.max_children !== -2 && mc !== -1) {
- ch = m.cr === -1 ? this.get_container().children("> ul > li").not(m.o).length : m.cr.children("> ul > li").not(m.o).length;
- if(ch + m.o.length > mc) { return false; }
- }
- if(s.max_depth !== -2 && md !== -1) {
- d = 0;
- if(md === 0) { return false; }
- if(typeof m.o.d === "undefined") {
- // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
- t = m.o;
- while(t.length > 0) {
- t = t.find("> ul > li");
- d ++;
- }
- m.o.d = d;
- }
- if(md - m.o.d < 0) { return false; }
- }
- return true;
- },
- create_node : function (obj, position, js, callback, is_loaded, skip_check) {
- if(!skip_check && (is_loaded || this._is_loaded(obj))) {
- var p = (position && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
- s = this._get_settings().types,
- mc = this._check("max_children", p),
- md = this._check("max_depth", p),
- vc = this._check("valid_children", p),
- ch;
- if(!js) { js = {}; }
- if(vc === "none") { return false; }
- if($.isArray(vc)) {
- if(!js.attr || !js.attr[s.type_attr]) {
- if(!js.attr) { js.attr = {}; }
- js.attr[s.type_attr] = vc[0];
- }
- else {
- if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
- }
- }
- if(s.max_children !== -2 && mc !== -1) {
- ch = p === -1 ? this.get_container().children("> ul > li").length : p.children("> ul > li").length;
- if(ch + 1 > mc) { return false; }
- }
- if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
- }
- return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
- }
- }
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree HTML data 1.0
- * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
- */
-(function ($) {
- $.jstree.plugin("html_data", {
- __init : function () {
- // this used to use html() and clean the whitespace, but this way any attached data was lost
- this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
- // remove white space from LI node - otherwise nodes appear a bit to the right
- this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
- },
- defaults : {
- data : false,
- ajax : false,
- correct_state : true
- },
- _fn : {
- load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
- _is_loaded : function (obj) {
- obj = this._get_node(obj);
- return obj == -1 || !obj || !this._get_settings().html_data.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
- },
- load_node_html : function (obj, s_call, e_call) {
- var d,
- s = this.get_settings().html_data,
- error_func = function () {},
- success_func = function () {};
- obj = this._get_node(obj);
- if(obj && obj !== -1) {
- if(obj.data("jstree-is-loading")) { return; }
- else { obj.data("jstree-is-loading",true); }
- }
- switch(!0) {
- case (!s.data && !s.ajax):
- if(!obj || obj == -1) {
- this.get_container()
- .children("ul").empty()
- .append(this.data.html_data.original_container_html)
- .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
- .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
- this.clean_node();
- }
- if(s_call) { s_call.call(this); }
- break;
- case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
- if(!obj || obj == -1) {
- d = $(s.data);
- if(!d.is("ul")) { d = $("<ul>").append(d); }
- this.get_container()
- .children("ul").empty().append(d.children())
- .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
- .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
- this.clean_node();
- }
- if(s_call) { s_call.call(this); }
- break;
- case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
- obj = this._get_node(obj);
- error_func = function (x, t, e) {
- var ef = this.get_settings().html_data.ajax.error;
- if(ef) { ef.call(this, x, t, e); }
- if(obj != -1 && obj.length) {
- obj.children(".jstree-loading").removeClass("jstree-loading");
- obj.data("jstree-is-loading",false);
- if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
- }
- else {
- if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
- }
- if(e_call) { e_call.call(this); }
- };
- success_func = function (d, t, x) {
- var sf = this.get_settings().html_data.ajax.success;
- if(sf) { d = sf.call(this,d,t,x) || d; }
- if(d == "") {
- return error_func.call(this, x, t, "");
- }
- if(d) {
- d = $(d);
- if(!d.is("ul")) { d = $("<ul>").append(d); }
- if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
- else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); obj.data("jstree-is-loading",false); }
- this.clean_node(obj);
- if(s_call) { s_call.call(this); }
- }
- else {
- if(obj && obj !== -1) {
- obj.children(".jstree-loading").removeClass("jstree-loading");
- obj.data("jstree-is-loading",false);
- if(s.correct_state) {
- obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
- if(s_call) { s_call.call(this); }
- }
- }
- else {
- if(s.correct_state) {
- this.get_container().children("ul").empty();
- if(s_call) { s_call.call(this); }
- }
- }
- }
- };
- s.ajax.context = this;
- s.ajax.error = error_func;
- s.ajax.success = success_func;
- if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
- if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
- if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
- $.ajax(s.ajax);
- break;
- }
- }
- }
- });
- // include the HTML data plugin by default
- $.jstree.defaults.plugins.push("html_data");
-})(jQuery);
-//*/
-
-/*
- * jsTree themeroller plugin 1.0
- * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
- */
-(function ($) {
- $.jstree.plugin("themeroller", {
- __init : function () {
- var s = this._get_settings().themeroller;
- this.get_container()
- .addClass("ui-widget-content")
- .delegate("a","mouseenter.jstree", function () {
- $(this).addClass(s.item_h);
- })
- .delegate("a","mouseleave.jstree", function () {
- $(this).removeClass(s.item_h);
- })
- .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
- this._themeroller(data.rslt.obj);
- }, this))
- .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
- this._themeroller();
- }, this))
- .bind("close_node.jstree", $.proxy(function (e, data) {
- data.rslt.obj.children("ins").removeClass(s.opened).addClass(s.closed);
- }, this))
- .bind("select_node.jstree", $.proxy(function (e, data) {
- data.rslt.obj.children("a").addClass(s.item_a);
- }, this))
- .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
- this.get_container()
- .find("." + s.item_a).removeClass(s.item_a).end()
- .find(".jstree-clicked").addClass(s.item_a);
- }, this))
- .bind("move_node.jstree", $.proxy(function (e, data) {
- this._themeroller(data.rslt.o);
- }, this));
- },
- __destroy : function () {
- var s = this._get_settings().themeroller,
- c = [ "ui-icon" ];
- $.each(s, function (i, v) {
- v = v.split(" ");
- if(v.length) { c = c.concat(v); }
- });
- this.get_container()
- .removeClass("ui-widget-content")
- .find("." + c.join(", .")).removeClass(c.join(" "));
- },
- _fn : {
- _themeroller : function (obj) {
- var s = this._get_settings().themeroller;
- obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj).parent();
- obj
- .find("li.jstree-closed > ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
- .find("li.jstree-open > ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
- .find("a").addClass(s.item)
- .children("ins.jstree-icon").addClass("ui-icon " + s.item_icon);
- }
- },
- defaults : {
- "opened" : "ui-icon-triangle-1-se",
- "closed" : "ui-icon-triangle-1-e",
- "item" : "ui-state-default",
- "item_h" : "ui-state-hover",
- "item_a" : "ui-state-active",
- "item_icon" : "ui-icon-folder-collapsed"
- }
- });
- $(function() {
- var css_string = '.jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }';
- $.vakata.css.add_sheet({ str : css_string });
- });
-})(jQuery);
-//*/
-
-/*
- * jsTree unique plugin 1.0
- * Forces different names amongst siblings (still a bit experimental)
- * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
- */
-(function ($) {
- $.jstree.plugin("unique", {
- __init : function () {
- this.get_container()
- .bind("before.jstree", $.proxy(function (e, data) {
- var nms = [], res = true, p, t;
- if(data.func == "move_node") {
- // obj, ref, position, is_copy, is_prepared, skip_check
- if(data.args[4] === true) {
- if(data.args[0].o && data.args[0].o.length) {
- data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
- res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o));
- }
- }
- }
- if(data.func == "create_node") {
- // obj, position, js, callback, is_loaded
- if(data.args[4] || this._is_loaded(data.args[0])) {
- p = this._get_node(data.args[0]);
- if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
- p = this._get_parent(data.args[0]);
- if(!p || p === -1) { p = this.get_container(); }
- }
- if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
- else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_settings().core.strings.new_node); }
- else { nms.push(data.args[2].data); }
- res = this._check_unique(nms, p.find("> ul > li"));
- }
- }
- if(data.func == "rename_node") {
- // obj, val
- nms.push(data.args[1]);
- t = this._get_node(data.args[0]);
- p = this._get_parent(t);
- if(!p || p === -1) { p = this.get_container(); }
- res = this._check_unique(nms, p.find("> ul > li").not(t));
- }
- if(!res) {
- e.stopPropagation();
- return false;
- }
- }, this));
- },
- _fn : {
- _check_unique : function (nms, p) {
- var cnms = [];
- p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
- if(!cnms.length || !nms.length) { return true; }
- cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
- if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
- return false;
- }
- return true;
- },
- check_move : function () {
- if(!this.__call_old()) { return false; }
- var p = this._get_move(), nms = [];
- if(p.o && p.o.length) {
- p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
- return this._check_unique(nms, p.np.find("> ul > li").not(p.o));
- }
- return true;
- }
- }
- });
-})(jQuery);
-//*/
diff --git a/solr/webapp/web/js/lib/jquery.sammy.js b/solr/webapp/web/js/lib/jquery.sammy.js
deleted file mode 100644
index 21b8a80a4f5..00000000000
--- a/solr/webapp/web/js/lib/jquery.sammy.js
+++ /dev/null
@@ -1,1863 +0,0 @@
-// name: sammy
-// version: 0.6.2
-/*
-
-Copyright (c) 2008 Aaron Quint, Quirkey NYC, LLC
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-(function($, window) {
-
- var Sammy,
- PATH_REPLACER = "([^\/]+)",
- PATH_NAME_MATCHER = /:([\w\d]+)/g,
- QUERY_STRING_MATCHER = /\?([^#]*)$/,
- // mainly for making `arguments` an Array
- _makeArray = function(nonarray) { return Array.prototype.slice.call(nonarray); },
- // borrowed from jQuery
- _isFunction = function( obj ) { return Object.prototype.toString.call(obj) === "[object Function]"; },
- _isArray = function( obj ) { return Object.prototype.toString.call(obj) === "[object Array]"; },
- _decode = decodeURIComponent,
- _encode = encodeURIComponent,
- _escapeHTML = function(s) {
- return String(s).replace(/&(?!\w+;)/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
- },
- _routeWrapper = function(verb) {
- return function(path, callback) { return this.route.apply(this, [verb, path, callback]); };
- },
- _template_cache = {},
- loggers = [];
-
-
- // `Sammy` (also aliased as $.sammy) is not only the namespace for a
- // number of prototypes, it's also a top level method that allows for easy
- // creation/management of `Sammy.Application` instances. There are a
- // number of different forms for `Sammy()` but each returns an instance
- // of `Sammy.Application`. When a new instance is created using
- // `Sammy` it is added to an Object called `Sammy.apps`. This
- // provides for an easy way to get at existing Sammy applications. Only one
- // instance is allowed per `element_selector` so when calling
- // `Sammy('selector')` multiple times, the first time will create
- // the application and the following times will extend the application
- // already added to that selector.
- //
- // ### Example
- //
- // // returns the app at #main or a new app
- // Sammy('#main')
- //
- // // equivilent to "new Sammy.Application", except appends to apps
- // Sammy();
- // Sammy(function() { ... });
- //
- // // extends the app at '#main' with function.
- // Sammy('#main', function() { ... });
- //
- Sammy = function() {
- var args = _makeArray(arguments),
- app, selector;
- Sammy.apps = Sammy.apps || {};
- if (args.length === 0 || args[0] && _isFunction(args[0])) { // Sammy()
- return Sammy.apply(Sammy, ['body'].concat(args));
- } else if (typeof (selector = args.shift()) == 'string') { // Sammy('#main')
- app = Sammy.apps[selector] || new Sammy.Application();
- app.element_selector = selector;
- if (args.length > 0) {
- $.each(args, function(i, plugin) {
- app.use(plugin);
- });
- }
- // if the selector changes make sure the refrence in Sammy.apps changes
- if (app.element_selector != selector) {
- delete Sammy.apps[selector];
- }
- Sammy.apps[app.element_selector] = app;
- return app;
- }
- };
-
- Sammy.VERSION = '0.6.2';
-
- // Add to the global logger pool. Takes a function that accepts an
- // unknown number of arguments and should print them or send them somewhere
- // The first argument is always a timestamp.
- Sammy.addLogger = function(logger) {
- loggers.push(logger);
- };
-
- // Sends a log message to each logger listed in the global
- // loggers pool. Can take any number of arguments.
- // Also prefixes the arguments with a timestamp.
- Sammy.log = function() {
- var args = _makeArray(arguments);
- args.unshift("[" + Date() + "]");
- $.each(loggers, function(i, logger) {
- logger.apply(Sammy, args);
- });
- };
-
- if (typeof window.console != 'undefined') {
- if (_isFunction(window.console.log.apply)) {
- Sammy.addLogger(function() {
- window.console.log.apply(window.console, arguments);
- });
- } else {
- Sammy.addLogger(function() {
- window.console.log(arguments);
- });
- }
- } else if (typeof console != 'undefined') {
- Sammy.addLogger(function() {
- console.log.apply(console, arguments);
- });
- }
-
- $.extend(Sammy, {
- makeArray: _makeArray,
- isFunction: _isFunction,
- isArray: _isArray
- })
-
- // Sammy.Object is the base for all other Sammy classes. It provides some useful
- // functionality, including cloning, iterating, etc.
- Sammy.Object = function(obj) { // constructor
- return $.extend(this, obj || {});
- };
-
- $.extend(Sammy.Object.prototype, {
-
- // Escape HTML in string, use in templates to prevent script injection.
- // Also aliased as `h()`
- escapeHTML: _escapeHTML,
- h: _escapeHTML,
-
- // Returns a copy of the object with Functions removed.
- toHash: function() {
- var json = {};
- $.each(this, function(k,v) {
- if (!_isFunction(v)) {
- json[k] = v;
- }
- });
- return json;
- },
-
- // Renders a simple HTML version of this Objects attributes.
- // Does not render functions.
- // For example. Given this Sammy.Object:
- //
- // var s = new Sammy.Object({first_name: 'Sammy', last_name: 'Davis Jr.'});
- // s.toHTML() //=> '<strong>first_name</strong> Sammy<br /><strong>last_name</strong> Davis Jr.<br />'
- //
- toHTML: function() {
- var display = "";
- $.each(this, function(k, v) {
- if (!_isFunction(v)) {
- display += "<strong>" + k + "</strong> " + v + "<br />";
- }
- });
- return display;
- },
-
- // Returns an array of keys for this object. If `attributes_only`
- // is true will not return keys that map to a `function()`
- keys: function(attributes_only) {
- var keys = [];
- for (var property in this) {
- if (!_isFunction(this[property]) || !attributes_only) {
- keys.push(property);
- }
- }
- return keys;
- },
-
- // Checks if the object has a value at `key` and that the value is not empty
- has: function(key) {
- return this[key] && $.trim(this[key].toString()) != '';
- },
-
- // convenience method to join as many arguments as you want
- // by the first argument - useful for making paths
- join: function() {
- var args = _makeArray(arguments);
- var delimiter = args.shift();
- return args.join(delimiter);
- },
-
- // Shortcut to Sammy.log
- log: function() {
- Sammy.log.apply(Sammy, arguments);
- },
-
- // Returns a string representation of this object.
- // if `include_functions` is true, it will also toString() the
- // methods of this object. By default only prints the attributes.
- toString: function(include_functions) {
- var s = [];
- $.each(this, function(k, v) {
- if (!_isFunction(v) || include_functions) {
- s.push('"' + k + '": ' + v.toString());
- }
- });
- return "Sammy.Object: {" + s.join(',') + "}";
- }
- });
-
- // The HashLocationProxy is the default location proxy for all Sammy applications.
- // A location proxy is a prototype that conforms to a simple interface. The purpose
- // of a location proxy is to notify the Sammy.Application its bound to when the location
- // or 'external state' changes. The HashLocationProxy considers the state to be
- // changed when the 'hash' (window.location.hash / '#') changes. It does this in two
- // different ways depending on what browser you are using. The newest browsers
- // (IE, Safari > 4, FF >= 3.6) support a 'onhashchange' DOM event, thats fired whenever
- // the location.hash changes. In this situation the HashLocationProxy just binds
- // to this event and delegates it to the application. In the case of older browsers
- // a poller is set up to track changes to the hash. Unlike Sammy 0.3 or earlier,
- // the HashLocationProxy allows the poller to be a global object, eliminating the
- // need for multiple pollers even when thier are multiple apps on the page.
- Sammy.HashLocationProxy = function(app, run_interval_every) {
- this.app = app;
- // set is native to false and start the poller immediately
- this.is_native = false;
- this._startPolling(run_interval_every);
- };
-
- Sammy.HashLocationProxy.prototype = {
-
- // bind the proxy events to the current app.
- bind: function() {
- var proxy = this, app = this.app;
- $(window).bind('hashchange.' + this.app.eventNamespace(), function(e, non_native) {
- // if we receive a native hash change event, set the proxy accordingly
- // and stop polling
- if (proxy.is_native === false && !non_native) {
- Sammy.log('native hash change exists, using');
- proxy.is_native = true;
- window.clearInterval(Sammy.HashLocationProxy._interval);
- }
- app.trigger('location-changed');
- });
- if (!Sammy.HashLocationProxy._bindings) {
- Sammy.HashLocationProxy._bindings = 0;
- }
- Sammy.HashLocationProxy._bindings++;
- },
-
- // unbind the proxy events from the current app
- unbind: function() {
- $(window).unbind('hashchange.' + this.app.eventNamespace());
- Sammy.HashLocationProxy._bindings--;
- if (Sammy.HashLocationProxy._bindings <= 0) {
- window.clearInterval(Sammy.HashLocationProxy._interval);
- }
- },
-
- // get the current location from the hash.
- getLocation: function() {
- // Bypass the `window.location.hash` attribute. If a question mark
- // appears in the hash IE6 will strip it and all of the following
- // characters from `window.location.hash`.
- var matches = window.location.toString().match(/^[^#]*(#.+)$/);
- return matches ? matches[1] : '';
- },
-
- // set the current location to `new_location`
- setLocation: function(new_location) {
- return (window.location = new_location);
- },
-
- _startPolling: function(every) {
- // set up interval
- var proxy = this;
- if (!Sammy.HashLocationProxy._interval) {
- if (!every) { every = 10; }
- var hashCheck = function() {
- var current_location = proxy.getLocation();
- if (!Sammy.HashLocationProxy._last_location ||
- current_location != Sammy.HashLocationProxy._last_location) {
- window.setTimeout(function() {
- $(window).trigger('hashchange', [true]);
- }, 13);
- }
- Sammy.HashLocationProxy._last_location = current_location;
- };
- hashCheck();
- Sammy.HashLocationProxy._interval = window.setInterval(hashCheck, every);
- }
- }
- };
-
-
- // Sammy.Application is the Base prototype for defining 'applications'.
- // An 'application' is a collection of 'routes' and bound events that is
- // attached to an element when `run()` is called.
- // The only argument an 'app_function' is evaluated within the context of the application.
- Sammy.Application = function(app_function) {
- var app = this;
- this.routes = {};
- this.listeners = new Sammy.Object({});
- this.arounds = [];
- this.befores = [];
- // generate a unique namespace
- this.namespace = (new Date()).getTime() + '-' + parseInt(Math.random() * 1000, 10);
- this.context_prototype = function() { Sammy.EventContext.apply(this, arguments); };
- this.context_prototype.prototype = new Sammy.EventContext();
-
- if (_isFunction(app_function)) {
- app_function.apply(this, [this]);
- }
- // set the location proxy if not defined to the default (HashLocationProxy)
- if (!this._location_proxy) {
- this.setLocationProxy(new Sammy.HashLocationProxy(this, this.run_interval_every));
- }
- if (this.debug) {
- this.bindToAllEvents(function(e, data) {
- app.log(app.toString(), e.cleaned_type, data || {});
- });
- }
- };
-
- Sammy.Application.prototype = $.extend({}, Sammy.Object.prototype, {
-
- // the four route verbs
- ROUTE_VERBS: ['get','post','put','delete'],
-
- // An array of the default events triggered by the
- // application during its lifecycle
- APP_EVENTS: ['run',
- 'unload',
- 'lookup-route',
- 'run-route',
- 'route-found',
- 'event-context-before',
- 'event-context-after',
- 'changed',
- 'error',
- 'check-form-submission',
- 'redirect',
- 'location-changed'],
-
- _last_route: null,
- _location_proxy: null,
- _running: false,
-
- // Defines what element the application is bound to. Provide a selector
- // (parseable by `jQuery()`) and this will be used by `$element()`
- element_selector: 'body',
-
- // When set to true, logs all of the default events using `log()`
- debug: false,
-
- // When set to true, and the error() handler is not overriden, will actually
- // raise JS errors in routes (500) and when routes can't be found (404)
- raise_errors: false,
-
- // The time in milliseconds that the URL is queried for changes
- run_interval_every: 50,
-
- // The default template engine to use when using `partial()` in an
- // `EventContext`. `template_engine` can either be a string that
- // corresponds to the name of a method/helper on EventContext or it can be a function
- // that takes two arguments, the content of the unrendered partial and an optional
- // JS object that contains interpolation data. Template engine is only called/refered
- // to if the extension of the partial is null or unknown. See `partial()`
- // for more information
- template_engine: null,
-
- // //=> Sammy.Application: body
- toString: function() {
- return 'Sammy.Application:' + this.element_selector;
- },
-
- // returns a jQuery object of the Applications bound element.
- $element: function(selector) {
- return selector ? $(this.element_selector).find(selector) : $(this.element_selector);
- },
-
- // `use()` is the entry point for including Sammy plugins.
- // The first argument to use should be a function() that is evaluated
- // in the context of the current application, just like the `app_function`
- // argument to the `Sammy.Application` constructor.
- //
- // Any additional arguments are passed to the app function sequentially.
- //
- // For much more detail about plugins, check out:
- // http://code.quirkey.com/sammy/doc/plugins.html
- //
- // ### Example
- //
- // var MyPlugin = function(app, prepend) {
- //
- // this.helpers({
- // myhelper: function(text) {
- // alert(prepend + " " + text);
- // }
- // });
- //
- // };
- //
- // var app = $.sammy(function() {
- //
- // this.use(MyPlugin, 'This is my plugin');
- //
- // this.get('#/', function() {
- // this.myhelper('and dont you forget it!');
- // //=> Alerts: This is my plugin and dont you forget it!
- // });
- //
- // });
- //
- // If plugin is passed as a string it assumes your are trying to load
- // Sammy."Plugin". This is the prefered way of loading core Sammy plugins
- // as it allows for better error-messaging.
- //
- // ### Example
- //
- // $.sammy(function() {
- // this.use('Mustache'); //=> Sammy.Mustache
- // this.use('Storage'); //=> Sammy.Storage
- // });
- //
- use: function() {
- // flatten the arguments
- var args = _makeArray(arguments),
- plugin = args.shift(),
- plugin_name = plugin || '';
- try {
- args.unshift(this);
- if (typeof plugin == 'string') {
- plugin_name = 'Sammy.' + plugin;
- plugin = Sammy[plugin];
- }
- plugin.apply(this, args);
- } catch(e) {
- if (typeof plugin === 'undefined') {
- this.error("Plugin Error: called use() but plugin (" + plugin_name.toString() + ") is not defined", e);
- } else if (!_isFunction(plugin)) {
- this.error("Plugin Error: called use() but '" + plugin_name.toString() + "' is not a function", e);
- } else {
- this.error("Plugin Error", e);
- }
- }
- return this;
- },
-
- // Sets the location proxy for the current app. By default this is set to
- // a new `Sammy.HashLocationProxy` on initialization. However, you can set
- // the location_proxy inside you're app function to give your app a custom
- // location mechanism. See `Sammy.HashLocationProxy` and `Sammy.DataLocationProxy`
- // for examples.
- //
- // `setLocationProxy()` takes an initialized location proxy.
- //
- // ### Example
- //
- // // to bind to data instead of the default hash;
- // var app = $.sammy(function() {
- // this.setLocationProxy(new Sammy.DataLocationProxy(this));
- // });
- //
- setLocationProxy: function(new_proxy) {
- var original_proxy = this._location_proxy;
- this._location_proxy = new_proxy;
- if (this.isRunning()) {
- if (original_proxy) {
- // if there is already a location proxy, unbind it.
- original_proxy.unbind();
- }
- this._location_proxy.bind();
- }
- },
-
- // `route()` is the main method for defining routes within an application.
- // For great detail on routes, check out: http://code.quirkey.com/sammy/doc/routes.html
- //
- // This method also has aliases for each of the different verbs (eg. `get()`, `post()`, etc.)
- //
- // ### Arguments
- //
- // * `verb` A String in the set of ROUTE_VERBS or 'any'. 'any' will add routes for each
- // of the ROUTE_VERBS. If only two arguments are passed,
- // the first argument is the path, the second is the callback and the verb
- // is assumed to be 'any'.
- // * `path` A Regexp or a String representing the path to match to invoke this verb.
- // * `callback` A Function that is called/evaluated whent the route is run see: `runRoute()`.
- // It is also possible to pass a string as the callback, which is looked up as the name
- // of a method on the application.
- //
- route: function(verb, path, callback) {
- var app = this, param_names = [], add_route, path_match;
-
- // if the method signature is just (path, callback)
- // assume the verb is 'any'
- if (!callback && _isFunction(path)) {
- path = verb;
- callback = path;
- verb = 'any';
- }
-
- verb = verb.toLowerCase(); // ensure verb is lower case
-
- // if path is a string turn it into a regex
- if (path.constructor == String) {
-
- // Needs to be explicitly set because IE will maintain the index unless NULL is returned,
- // which means that with two consecutive routes that contain params, the second set of params will not be found and end up in splat instead of params
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp/lastIndex
- PATH_NAME_MATCHER.lastIndex = 0;
-
- // find the names
- while ((path_match = PATH_NAME_MATCHER.exec(path)) !== null) {
- param_names.push(path_match[1]);
- }
- // replace with the path replacement
- path = new RegExp("^" + path.replace(PATH_NAME_MATCHER, PATH_REPLACER) + "$");
- }
- // lookup callback
- if (typeof callback == 'string') {
- callback = app[callback];
- }
-
- add_route = function(with_verb) {
- var r = {verb: with_verb, path: path, callback: callback, param_names: param_names};
- // add route to routes array
- app.routes[with_verb] = app.routes[with_verb] || [];
- // place routes in order of definition
- app.routes[with_verb].push(r);
- };
-
- if (verb === 'any') {
- $.each(this.ROUTE_VERBS, function(i, v) { add_route(v); });
- } else {
- add_route(verb);
- }
-
- // return the app
- return this;
- },
-
- // Alias for route('get', ...)
- get: _routeWrapper('get'),
-
- // Alias for route('post', ...)
- post: _routeWrapper('post'),
-
- // Alias for route('put', ...)
- put: _routeWrapper('put'),
-
- // Alias for route('delete', ...)
- del: _routeWrapper('delete'),
-
- // Alias for route('any', ...)
- any: _routeWrapper('any'),
-
- // `mapRoutes` takes an array of arrays, each array being passed to route()
- // as arguments, this allows for mass definition of routes. Another benefit is
- // this makes it possible/easier to load routes via remote JSON.
- //
- // ### Example
- //
- // var app = $.sammy(function() {
- //
- // this.mapRoutes([
- // ['get', '#/', function() { this.log('index'); }],
- // // strings in callbacks are looked up as methods on the app
- // ['post', '#/create', 'addUser'],
- // // No verb assumes 'any' as the verb
- // [/dowhatever/, function() { this.log(this.verb, this.path)}];
- // ]);
- // })
- //
- mapRoutes: function(route_array) {
- var app = this;
- $.each(route_array, function(i, route_args) {
- app.route.apply(app, route_args);
- });
- return this;
- },
-
- // A unique event namespace defined per application.
- // All events bound with `bind()` are automatically bound within this space.
- eventNamespace: function() {
- return ['sammy-app', this.namespace].join('-');
- },
-
- // Works just like `jQuery.fn.bind()` with a couple noteable differences.
- //
- // * It binds all events to the application element
- // * All events are bound within the `eventNamespace()`
- // * Events are not actually bound until the application is started with `run()`
- // * callbacks are evaluated within the context of a Sammy.EventContext
- //
- // See http://code.quirkey.com/sammy/docs/events.html for more info.
- //
- bind: function(name, data, callback) {
- var app = this;
- // build the callback
- // if the arity is 2, callback is the second argument
- if (typeof callback == 'undefined') { callback = data; }
- var listener_callback = function() {
- // pull off the context from the arguments to the callback
- var e, context, data;
- e = arguments[0];
- data = arguments[1];
- if (data && data.context) {
- context = data.context;
- delete data.context;
- } else {
- context = new app.context_prototype(app, 'bind', e.type, data, e.target);
- }
- e.cleaned_type = e.type.replace(app.eventNamespace(), '');
- callback.apply(context, [e, data]);
- };
-
- // it could be that the app element doesnt exist yet
- // so attach to the listeners array and then run()
- // will actually bind the event.
- if (!this.listeners[name]) { this.listeners[name] = []; }
- this.listeners[name].push(listener_callback);
- if (this.isRunning()) {
- // if the app is running
- // *actually* bind the event to the app element
- this._listen(name, listener_callback);
- }
- return this;
- },
-
- // Triggers custom events defined with `bind()`
- //
- // ### Arguments
- //
- // * `name` The name of the event. Automatically prefixed with the `eventNamespace()`
- // * `data` An optional Object that can be passed to the bound callback.
- // * `context` An optional context/Object in which to execute the bound callback.
- // If no context is supplied a the context is a new `Sammy.EventContext`
- //
- trigger: function(name, data) {
- this.$element().trigger([name, this.eventNamespace()].join('.'), [data]);
- return this;
- },
-
- // Reruns the current route
- refresh: function() {
- this.last_location = null;
- this.trigger('location-changed');
- return this;
- },
-
- // Takes a single callback that is pushed on to a stack.
- // Before any route is run, the callbacks are evaluated in order within
- // the current `Sammy.EventContext`
- //
- // If any of the callbacks explicitly return false, execution of any
- // further callbacks and the route itself is halted.
- //
- // You can also provide a set of options that will define when to run this
- // before based on the route it proceeds.
- //
- // ### Example
- //
- // var app = $.sammy(function() {
- //
- // // will run at #/route but not at #/
- // this.before('#/route', function() {
- // //...
- // });
- //
- // // will run at #/ but not at #/route
- // this.before({except: {path: '#/route'}}, function() {
- // this.log('not before #/route');
- // });
- //
- // this.get('#/', function() {});
- //
- // this.get('#/route', function() {});
- //
- // });
- //
- // See `contextMatchesOptions()` for a full list of supported options
- //
- before: function(options, callback) {
- if (_isFunction(options)) {
- callback = options;
- options = {};
- }
- this.befores.push([options, callback]);
- return this;
- },
-
- // A shortcut for binding a callback to be run after a route is executed.
- // After callbacks have no guarunteed order.
- after: function(callback) {
- return this.bind('event-context-after', callback);
- },
-
-
- // Adds an around filter to the application. around filters are functions
- // that take a single argument `callback` which is the entire route
- // execution path wrapped up in a closure. This means you can decide whether
- // or not to proceed with execution by not invoking `callback` or,
- // more usefuly wrapping callback inside the result of an asynchronous execution.
- //
- // ### Example
- //
- // The most common use case for around() is calling a _possibly_ async function
- // and executing the route within the functions callback:
- //
- // var app = $.sammy(function() {
- //
- // var current_user = false;
- //
- // function checkLoggedIn(callback) {
- // // /session returns a JSON representation of the logged in user
- // // or an empty object
- // if (!current_user) {
- // $.getJSON('/session', function(json) {
- // if (json.login) {
- // // show the user as logged in
- // current_user = json;
- // // execute the route path
- // callback();
- // } else {
- // // show the user as not logged in
- // current_user = false;
- // // the context of aroundFilters is an EventContext
- // this.redirect('#/login');
- // }
- // });
- // } else {
- // // execute the route path
- // callback();
- // }
- // };
- //
- // this.around(checkLoggedIn);
- //
- // });
- //
- around: function(callback) {
- this.arounds.push(callback);
- return this;
- },
-
- // Returns `true` if the current application is running.
- isRunning: function() {
- return this._running;
- },
-
- // Helpers extends the EventContext prototype specific to this app.
- // This allows you to define app specific helper functions that can be used
- // whenever you're inside of an event context (templates, routes, bind).
- //
- // ### Example
- //
- // var app = $.sammy(function() {
- //
- // helpers({
- // upcase: function(text) {
- // return text.toString().toUpperCase();
- // }
- // });
- //
- // get('#/', function() { with(this) {
- // // inside of this context I can use the helpers
- // $('#main').html(upcase($('#main').text());
- // }});
- //
- // });
- //
- //
- // ### Arguments
- //
- // * `extensions` An object collection of functions to extend the context.
- //
- helpers: function(extensions) {
- $.extend(this.context_prototype.prototype, extensions);
- return this;
- },
-
- // Helper extends the event context just like `helpers()` but does it
- // a single method at a time. This is especially useful for dynamically named
- // helpers
- //
- // ### Example
- //
- // // Trivial example that adds 3 helper methods to the context dynamically
- // var app = $.sammy(function(app) {
- //
- // $.each([1,2,3], function(i, num) {
- // app.helper('helper' + num, function() {
- // this.log("I'm helper number " + num);
- // });
- // });
- //
- // this.get('#/', function() {
- // this.helper2(); //=> I'm helper number 2
- // });
- // });
- //
- // ### Arguments
- //
- // * `name` The name of the method
- // * `method` The function to be added to the prototype at `name`
- //
- helper: function(name, method) {
- this.context_prototype.prototype[name] = method;
- return this;
- },
-
- // Actually starts the application's lifecycle. `run()` should be invoked
- // within a document.ready block to ensure the DOM exists before binding events, etc.
- //
- // ### Example
- //
- // var app = $.sammy(function() { ... }); // your application
- // $(function() { // document.ready
- // app.run();
- // });
- //
- // ### Arguments
- //
- // * `start_url` Optionally, a String can be passed which the App will redirect to
- // after the events/routes have been bound.
- run: function(start_url) {
- if (this.isRunning()) { return false; }
- var app = this;
-
- // actually bind all the listeners
- $.each(this.listeners.toHash(), function(name, callbacks) {
- $.each(callbacks, function(i, listener_callback) {
- app._listen(name, listener_callback);
- });
- });
-
- this.trigger('run', {start_url: start_url});
- this._running = true;
- // set last location
- this.last_location = null;
- if (this.getLocation() == '' && typeof start_url != 'undefined') {
- this.setLocation(start_url);
- }
- // check url
- this._checkLocation();
- this._location_proxy.bind();
- this.bind('location-changed', function() {
- app._checkLocation();
- });
-
- // bind to submit to capture post/put/delete routes
- /*
- this.bind('submit', function(e) {
- var returned = app._checkFormSubmission($(e.target).closest('form'));
- return (returned === false) ? e.preventDefault() : false;
- });
- */
-
- // bind unload to body unload
- $(window).bind('beforeunload', function() {
- app.unload();
- });
-
- // trigger html changed
- return this.trigger('changed');
- },
-
- // The opposite of `run()`, un-binds all event listeners and intervals
- // `run()` Automaticaly binds a `onunload` event to run this when
- // the document is closed.
- unload: function() {
- if (!this.isRunning()) { return false; }
- var app = this;
- this.trigger('unload');
- // clear interval
- this._location_proxy.unbind();
- // unbind form submits
- this.$element().unbind('submit').removeClass(app.eventNamespace());
- // unbind all events
- $.each(this.listeners.toHash() , function(name, listeners) {
- $.each(listeners, function(i, listener_callback) {
- app._unlisten(name, listener_callback);
- });
- });
- this._running = false;
- return this;
- },
-
- // Will bind a single callback function to every event that is already
- // being listened to in the app. This includes all the `APP_EVENTS`
- // as well as any custom events defined with `bind()`.
- //
- // Used internally for debug logging.
- bindToAllEvents: function(callback) {
- var app = this;
- // bind to the APP_EVENTS first
- $.each(this.APP_EVENTS, function(i, e) {
- app.bind(e, callback);
- });
- // next, bind to listener names (only if they dont exist in APP_EVENTS)
- $.each(this.listeners.keys(true), function(i, name) {
- if (app.APP_EVENTS.indexOf(name) == -1) {
- app.bind(name, callback);
- }
- });
- return this;
- },
-
- // Returns a copy of the given path with any query string after the hash
- // removed.
- routablePath: function(path) {
- return path.replace(QUERY_STRING_MATCHER, '');
- },
-
- // Given a verb and a String path, will return either a route object or false
- // if a matching route can be found within the current defined set.
- lookupRoute: function(verb, path) {
- var app = this, routed = false;
- this.trigger('lookup-route', {verb: verb, path: path});
- if (typeof this.routes[verb] != 'undefined') {
- $.each(this.routes[verb], function(i, route) {
- if (app.routablePath(path).match(route.path)) {
- routed = route;
- return false;
- }
- });
- }
- return routed;
- },
-
- // First, invokes `lookupRoute()` and if a route is found, parses the
- // possible URL params and then invokes the route's callback within a new
- // `Sammy.EventContext`. If the route can not be found, it calls
- // `notFound()`. If `raise_errors` is set to `true` and
- // the `error()` has not been overriden, it will throw an actual JS
- // error.
- //
- // You probably will never have to call this directly.
- //
- // ### Arguments
- //
- // * `verb` A String for the verb.
- // * `path` A String path to lookup.
- // * `params` An Object of Params pulled from the URI or passed directly.
- //
- // ### Returns
- //
- // Either returns the value returned by the route callback or raises a 404 Not Found error.
- //
- runRoute: function(verb, path, params, target) {
- var app = this,
- route = this.lookupRoute(verb, path),
- context,
- wrapped_route,
- arounds,
- around,
- befores,
- before,
- callback_args,
- path_params,
- final_returned;
-
- this.log('runRoute', [verb, path].join(' '));
- this.trigger('run-route', {verb: verb, path: path, params: params});
- if (typeof params == 'undefined') { params = {}; }
-
- $.extend(params, this._parseQueryString(path));
-
- if (route) {
- this.trigger('route-found', {route: route});
- // pull out the params from the path
- if ((path_params = route.path.exec(this.routablePath(path))) !== null) {
- // first match is the full path
- path_params.shift();
- // for each of the matches
- $.each(path_params, function(i, param) {
- // if theres a matching param name
- if (route.param_names[i]) {
- // set the name to the match
- params[route.param_names[i]] = _decode(param);
- } else {
- // initialize 'splat'
- if (!params.splat) { params.splat = []; }
- params.splat.push(_decode(param));
- }
- });
- }
-
- // set event context
- context = new this.context_prototype(this, verb, path, params, target);
- // ensure arrays
- arounds = this.arounds.slice(0);
- befores = this.befores.slice(0);
- // set the callback args to the context + contents of the splat
- callback_args = [context].concat(params.splat);
- // wrap the route up with the before filters
- wrapped_route = function() {
- var returned;
- while (befores.length > 0) {
- before = befores.shift();
- // check the options
- if (app.contextMatchesOptions(context, before[0])) {
- returned = before[1].apply(context, [context]);
- if (returned === false) { return false; }
- }
- }
- app.last_route = route;
- context.trigger('event-context-before', {context: context});
- returned = route.callback.apply(context, callback_args);
- context.trigger('event-context-after', {context: context});
- return returned;
- };
- $.each(arounds.reverse(), function(i, around) {
- var last_wrapped_route = wrapped_route;
- wrapped_route = function() { return around.apply(context, [last_wrapped_route]); };
- });
- try {
- final_returned = wrapped_route();
- } catch(e) {
- this.error(['500 Error', verb, path].join(' '), e);
- }
- return final_returned;
- } else {
- return this.notFound(verb, path);
- }
- },
-
- // Matches an object of options against an `EventContext` like object that
- // contains `path` and `verb` attributes. Internally Sammy uses this
- // for matching `before()` filters against specific options. You can set the
- // object to _only_ match certain paths or verbs, or match all paths or verbs _except_
- // those that match the options.
- //
- // ### Example
- //
- // var app = $.sammy(),
- // context = {verb: 'get', path: '#/mypath'};
- //
- // // match against a path string
- // app.contextMatchesOptions(context, '#/mypath'); //=> true
- // app.contextMatchesOptions(context, '#/otherpath'); //=> false
- // // equivilent to
- // app.contextMatchesOptions(context, {only: {path:'#/mypath'}}); //=> true
- // app.contextMatchesOptions(context, {only: {path:'#/otherpath'}}); //=> false
- // // match against a path regexp
- // app.contextMatchesOptions(context, /path/); //=> true
- // app.contextMatchesOptions(context, /^path/); //=> false
- // // match only a verb
- // app.contextMatchesOptions(context, {only: {verb:'get'}}); //=> true
- // app.contextMatchesOptions(context, {only: {verb:'post'}}); //=> false
- // // match all except a verb
- // app.contextMatchesOptions(context, {except: {verb:'post'}}); //=> true
- // app.contextMatchesOptions(context, {except: {verb:'get'}}); //=> false
- // // match all except a path
- // app.contextMatchesOptions(context, {except: {path:'#/otherpath'}}); //=> true
- // app.contextMatchesOptions(context, {except: {path:'#/mypath'}}); //=> false
- //
- contextMatchesOptions: function(context, match_options, positive) {
- // empty options always match
- var options = match_options;
- if (typeof options === 'undefined' || options == {}) {
- return true;
- }
- if (typeof positive === 'undefined') {
- positive = true;
- }
- // normalize options
- if (typeof options === 'string' || _isFunction(options.test)) {
- options = {path: options};
- }
- if (options.only) {
- return this.contextMatchesOptions(context, options.only, true);
- } else if (options.except) {
- return this.contextMatchesOptions(context, options.except, false);
- }
- var path_matched = true, verb_matched = true;
- if (options.path) {
- // wierd regexp test
- if (_isFunction(options.path.test)) {
- path_matched = options.path.test(context.path);
- } else {
- path_matched = (options.path.toString() === context.path);
- }
- }
- if (options.verb) {
- verb_matched = options.verb === context.verb;
- }
- return positive ? (verb_matched && path_matched) : !(verb_matched && path_matched);
- },
-
-
- // Delegates to the `location_proxy` to get the current location.
- // See `Sammy.HashLocationProxy` for more info on location proxies.
- getLocation: function() {
- return this._location_proxy.getLocation();
- },
-
- // Delegates to the `location_proxy` to set the current location.
- // See `Sammy.HashLocationProxy` for more info on location proxies.
- //
- // ### Arguments
- //
- // * `new_location` A new location string (e.g. '#/')
- //
- setLocation: function(new_location) {
- return this._location_proxy.setLocation(new_location);
- },
-
- // Swaps the content of `$element()` with `content`
- // You can override this method to provide an alternate swap behavior
- // for `EventContext.partial()`.
- //
- // ### Example
- //
- // var app = $.sammy(function() {
- //
- // // implements a 'fade out'/'fade in'
- // this.swap = function(content) {
- // this.$element().hide('slow').html(content).show('slow');
- // }
- //
- // get('#/', function() {
- // this.partial('index.html.erb') // will fade out and in
- // });
- //
- // });
- //
- swap: function(content) {
- return this.$element().html(content);
- },
-
- // a simple global cache for templates. Uses the same semantics as
- // `Sammy.Cache` and `Sammy.Storage` so can easily be replaced with
- // a persistant storage that lasts beyond the current request.
- templateCache: function(key, value) {
- if (typeof value != 'undefined') {
- return _template_cache[key] = value;
- } else {
- return _template_cache[key];
- }
- },
-
- // clear the templateCache
- clearTemplateCache: function() {
- return _template_cache = {};
- },
-
- // This thows a '404 Not Found' error by invoking `error()`.
- // Override this method or `error()` to provide custom
- // 404 behavior (i.e redirecting to / or showing a warning)
- notFound: function(verb, path) {
- var ret = this.error(['404 Not Found', verb, path].join(' '));
- return (verb === 'get') ? ret : true;
- },
-
- // The base error handler takes a string `message` and an `Error`
- // object. If `raise_errors` is set to `true` on the app level,
- // this will re-throw the error to the browser. Otherwise it will send the error
- // to `log()`. Override this method to provide custom error handling
- // e.g logging to a server side component or displaying some feedback to the
- // user.
- error: function(message, original_error) {
- if (!original_error) { original_error = new Error(); }
- original_error.message = [message, original_error.message].join(' ');
- this.trigger('error', {message: original_error.message, error: original_error});
- if (this.raise_errors) {
- throw(original_error);
- } else {
- this.log(original_error.message, original_error);
- }
- },
-
- _checkLocation: function() {
- var location, returned;
- // get current location
- location = this.getLocation();
- // compare to see if hash has changed
- if (!this.last_location || this.last_location[0] != 'get' || this.last_location[1] != location) {
- // reset last location
- this.last_location = ['get', location];
- // lookup route for current hash
- returned = this.runRoute('get', location);
- }
- return returned;
- },
-
- _getFormVerb: function(form) {
- var $form = $(form), verb, $_method;
- $_method = $form.find('input[name="_method"]');
- if ($_method.length > 0) { verb = $_method.val(); }
- if (!verb) { verb = $form[0].getAttribute('method'); }
- return $.trim(verb.toString().toLowerCase());
- },
-
- _checkFormSubmission: function(form) {
- var $form, path, verb, params, returned;
- this.trigger('check-form-submission', {form: form});
- $form = $(form);
- path = $form.attr('action');
- verb = this._getFormVerb($form);
- if (!verb || verb == '') { verb = 'get'; }
- this.log('_checkFormSubmission', $form, path, verb);
- if (verb === 'get') {
- this.setLocation(path + '?' + this._serializeFormParams($form));
- returned = false;
- } else {
- params = $.extend({}, this._parseFormParams($form));
- returned = this.runRoute(verb, path, params, form.get(0));
- };
- return (typeof returned == 'undefined') ? false : returned;
- },
-
- _serializeFormParams: function($form) {
- var queryString = "",
- fields = $form.serializeArray(),
- i;
- if (fields.length > 0) {
- queryString = this._encodeFormPair(fields[0].name, fields[0].value);
- for (i = 1; i < fields.length; i++) {
- queryString = queryString + "&" + this._encodeFormPair(fields[i].name, fields[i].value);
- }
- }
- return queryString;
- },
-
- _encodeFormPair: function(name, value){
- return _encode(name) + "=" + _encode(value);
- },
-
- _parseFormParams: function($form) {
- var params = {},
- form_fields = $form.serializeArray(),
- i;
- for (i = 0; i < form_fields.length; i++) {
- params = this._parseParamPair(params, form_fields[i].name, form_fields[i].value);
- }
- return params;
- },
-
- _parseQueryString: function(path) {
- var params = {}, parts, pairs, pair, i;
-
- parts = path.match(QUERY_STRING_MATCHER);
- if (parts) {
- pairs = parts[1].split('&');
- for (i = 0; i < pairs.length; i++) {
- pair = pairs[i].split('=');
- params = this._parseParamPair(params, _decode(pair[0]), _decode(pair[1]));
- }
- }
- return params;
- },
-
- _parseParamPair: function(params, key, value) {
- if (params[key]) {
- if (_isArray(params[key])) {
- params[key].push(value);
- } else {
- params[key] = [params[key], value];
- }
- } else {
- params[key] = value;
- }
- return params;
- },
-
- _listen: function(name, callback) {
- return this.$element().bind([name, this.eventNamespace()].join('.'), callback);
- },
-
- _unlisten: function(name, callback) {
- return this.$element().unbind([name, this.eventNamespace()].join('.'), callback);
- }
-
- });
-
- // `Sammy.RenderContext` is an object that makes sequential template loading,
- // rendering and interpolation seamless even when dealing with asyncronous
- // operations.
- //
- // `RenderContext` objects are not usually created directly, rather they are
- // instatiated from an `Sammy.EventContext` by using `render()`, `load()` or
- // `partial()` which all return `RenderContext` objects.
- //
- // `RenderContext` methods always returns a modified `RenderContext`
- // for chaining (like jQuery itself).
- //
- // The core magic is in the `then()` method which puts the callback passed as
- // an argument into a queue to be executed once the previous callback is complete.
- // All the methods of `RenderContext` are wrapped in `then()` which allows you
- // to queue up methods by chaining, but maintaing a guarunteed execution order
- // even with remote calls to fetch templates.
- //
- Sammy.RenderContext = function(event_context) {
- this.event_context = event_context;
- this.callbacks = [];
- this.previous_content = null;
- this.content = null;
- this.next_engine = false;
- this.waiting = false;
- };
-
- Sammy.RenderContext.prototype = $.extend({}, Sammy.Object.prototype, {
-
- // The "core" of the `RenderContext` object, adds the `callback` to the
- // queue. If the context is `waiting` (meaning an async operation is happening)
- // then the callback will be executed in order, once the other operations are
- // complete. If there is no currently executing operation, the `callback`
- // is executed immediately.
- //
- // The value returned from the callback is stored in `content` for the
- // subsiquent operation. If you return `false`, the queue will pause, and
- // the next callback in the queue will not be executed until `next()` is
- // called. This allows for the guarunteed order of execution while working
- // with async operations.
- //
- // If then() is passed a string instead of a function, the string is looked
- // up as a helper method on the event context.
- //
- // ### Example
- //
- // this.get('#/', function() {
- // // initialize the RenderContext
- // // Even though `load()` executes async, the next `then()`
- // // wont execute until the load finishes
- // this.load('myfile.txt')
- // .then(function(content) {
- // // the first argument to then is the content of the
- // // prev operation
- // $('#main').html(content);
- // });
- // });
- //
- then: function(callback) {
- if (!_isFunction(callback)) {
- // if a string is passed to then, assume we want to call
- // a helper on the event context in its context
- if (typeof callback === 'string' && callback in this.event_context) {
- var helper = this.event_context[callback];
- callback = function(content) {
- return helper.apply(this.event_context, [content]);
- };
- } else {
- return this;
- }
- }
- var context = this;
- if (this.waiting) {
- this.callbacks.push(callback);
- } else {
- this.wait();
- window.setTimeout(function() {
- var returned = callback.apply(context, [context.content, context.previous_content]);
- if (returned !== false) {
- context.next(returned);
- }
- }, 13);
- }
- return this;
- },
-
- // Pause the `RenderContext` queue. Combined with `next()` allows for async
- // operations.
- //
- // ### Example
- //
- // this.get('#/', function() {
- // this.load('mytext.json')
- // .then(function(content) {
- // var context = this,
- // data = JSON.parse(content);
- // // pause execution
- // context.wait();
- // // post to a url
- // $.post(data.url, {}, function(response) {
- // context.next(JSON.parse(response));
- // });
- // })
- // .then(function(data) {
- // // data is json from the previous post
- // $('#message').text(data.status);
- // });
- // });
- wait: function() {
- this.waiting = true;
- },
-
- // Resume the queue, setting `content` to be used in the next operation.
- // See `wait()` for an example.
- next: function(content) {
- this.waiting = false;
- if (typeof content !== 'undefined') {
- this.previous_content = this.content;
- this.content = content;
- }
- if (this.callbacks.length > 0) {
- this.then(this.callbacks.shift());
- }
- },
-
- // Load a template into the context.
- // The `location` can either be a string specifiying the remote path to the
- // file, a jQuery object, or a DOM element.
- //
- // No interpolation happens by default, the content is stored in
- // `content`.
- //
- // In the case of a path, unless the option `{cache: false}` is passed the
- // data is stored in the app's `templateCache()`.
- //
- // If a jQuery or DOM object is passed the `innerHTML` of the node is pulled in.
- // This is useful for nesting templates as part of the initial page load wrapped
- // in invisible elements or `<script>` tags. With template paths, the template
- // engine is looked up by the extension. For DOM/jQuery embedded templates,
- // this isnt possible, so there are a couple of options:
- //
- // * pass an `{engine:}` option.
- // * define the engine in the `data-engine` attribute of the passed node.
- // * just store the raw template data and use `interpolate()` manually
- //
- // If a `callback` is passed it is executed after the template load.
- load: function(location, options, callback) {
- var context = this;
- return this.then(function() {
- var should_cache, cached, is_json, location_array;
- if (_isFunction(options)) {
- callback = options;
- options = {};
- } else {
- options = $.extend({}, options);
- }
- if (callback) { this.then(callback); }
- if (typeof location === 'string') {
- // it's a path
- is_json = (location.match(/\.json$/) || options.json);
- should_cache = ((is_json && options.cache === true) || options.cache !== false);
- context.next_engine = context.event_context.engineFor(location);
- delete options.cache;
- delete options.json;
- if (options.engine) {
- context.next_engine = options.engine;
- delete options.engine;
- }
- if (should_cache && (cached = this.event_context.app.templateCache(location))) {
- return cached;
- }
- this.wait();
- $.ajax($.extend({
- url: location,
- data: {},
- dataType: is_json ? 'json' : null,
- type: 'get',
- success: function(data) {
- if (should_cache) {
- context.event_context.app.templateCache(location, data);
- }
- context.next(data);
- }
- }, options));
- return false;
- } else {
- // it's a dom/jQuery
- if (location.nodeType) {
- return location.innerHTML;
- }
- if (location.selector) {
- // it's a jQuery
- context.next_engine = location.attr('data-engine');
- if (options.clone === false) {
- return location.remove()[0].innerHTML.toString();
- } else {
- return location[0].innerHTML.toString();
- }
- }
- }
- });
- },
-
- // `load()` a template and then `interpolate()` it with data.
- //
- // ### Example
- //
- // this.get('#/', function() {
- // this.render('mytemplate.template', {name: 'test'});
- // });
- //
- render: function(location, data, callback) {
- if (_isFunction(location) && !data) {
- return this.then(location);
- } else {
- if (!data && this.content) { data = this.content; }
- return this.load(location)
- .interpolate(data, location)
- .then(callback);
- }
- },
-
- // `render()` the the `location` with `data` and then `swap()` the
- // app's `$element` with the rendered content.
- partial: function(location, data) {
- return this.render(location, data).swap();
- },
-
- // defers the call of function to occur in order of the render queue.
- // The function can accept any number of arguments as long as the last
- // argument is a callback function. This is useful for putting arbitrary
- // asynchronous functions into the queue. The content passed to the
- // callback is passed as `content` to the next item in the queue.
- //
- // === Example
- //
- // this.send($.getJSON, '/app.json')
- // .then(function(json) {
- // $('#message).text(json['message']);
- // });
- //
- //
- send: function() {
- var context = this,
- args = _makeArray(arguments),
- fun = args.shift();
-
- if (_isArray(args[0])) { args = args[0]; }
-
- return this.then(function(content) {
- args.push(function(response) { context.next(response); });
- context.wait();
- fun.apply(fun, args);
- return false;
- });
- },
-
- // itterates over an array, applying the callback for each item item. the
- // callback takes the same style of arguments as `jQuery.each()` (index, item).
- // The return value of each callback is collected as a single string and stored
- // as `content` to be used in the next iteration of the `RenderContext`.
- collect: function(array, callback, now) {
- var context = this;
- var coll = function() {
- if (_isFunction(array)) {
- callback = array;
- array = this.content;
- }
- var contents = [], doms = false;
- $.each(array, function(i, item) {
- var returned = callback.apply(context, [i, item]);
- if (returned.jquery && returned.length == 1) {
- returned = returned[0];
- doms = true;
- }
- contents.push(returned);
- return returned;
- });
- return doms ? contents : contents.join('');
- };
- return now ? coll() : this.then(coll);
- },
-
- // loads a template, and then interpolates it for each item in the `data`
- // array. If a callback is passed, it will call the callback with each
- // item in the array _after_ interpolation
- renderEach: function(location, name, data, callback) {
- if (_isArray(name)) {
- callback = data;
- data = name;
- name = null;
- }
- return this.load(location).then(function(content) {
- var rctx = this;
- if (!data) {
- data = _isArray(this.previous_content) ? this.previous_content : [];
- }
- if (callback) {
- $.each(data, function(i, value) {
- var idata = {}, engine = this.next_engine || location;
- name ? (idata[name] = value) : (idata = value);
- callback(value, rctx.event_context.interpolate(content, idata, engine));
- });
- } else {
- return this.collect(data, function(i, value) {
- var idata = {}, engine = this.next_engine || location;
- name ? (idata[name] = value) : (idata = value);
- return this.event_context.interpolate(content, idata, engine);
- }, true);
- }
- });
- },
-
- // uses the previous loaded `content` and the `data` object to interpolate
- // a template. `engine` defines the templating/interpolation method/engine
- // that should be used. If `engine` is not passed, the `next_engine` is
- // used. If `retain` is `true`, the final interpolated data is appended to
- // the `previous_content` instead of just replacing it.
- interpolate: function(data, engine, retain) {
- var context = this;
- return this.then(function(content, prev) {
- if (!data && prev) { data = prev; }
- if (this.next_engine) {
- engine = this.next_engine;
- this.next_engine = false;
- }
- var rendered = context.event_context.interpolate(content, data, engine);
- return retain ? prev + rendered : rendered;
- });
- },
-
- // executes `EventContext#swap()` with the `content`
- swap: function() {
- return this.then(function(content) {
- this.event_context.swap(content);
- }).trigger('changed', {});
- },
-
- // Same usage as `jQuery.fn.appendTo()` but uses `then()` to ensure order
- appendTo: function(selector) {
- return this.then(function(content) {
- $(selector).append(content);
- }).trigger('changed', {});
- },
-
- // Same usage as `jQuery.fn.prependTo()` but uses `then()` to ensure order
- prependTo: function(selector) {
- return this.then(function(content) {
- $(selector).prepend(content);
- }).trigger('changed', {});
- },
-
- // Replaces the `$(selector)` using `html()` with the previously loaded
- // `content`
- replace: function(selector) {
- return this.then(function(content) {
- $(selector).html(content);
- }).trigger('changed', {});
- },
-
- // trigger the event in the order of the event context. Same semantics
- // as `Sammy.EventContext#trigger()`. If data is ommitted, `content`
- // is sent as `{content: content}`
- trigger: function(name, data) {
- return this.then(function(content) {
- if (typeof data == 'undefined') { data = {content: content}; }
- this.event_context.trigger(name, data);
- });
- }
-
- });
-
- // `Sammy.EventContext` objects are created every time a route is run or a
- // bound event is triggered. The callbacks for these events are evaluated within a `Sammy.EventContext`
- // This within these callbacks the special methods of `EventContext` are available.
- //
- // ### Example
- //
- // $.sammy(function() {
- // // The context here is this Sammy.Application
- // this.get('#/:name', function() {
- // // The context here is a new Sammy.EventContext
- // if (this.params['name'] == 'sammy') {
- // this.partial('name.html.erb', {name: 'Sammy'});
- // } else {
- // this.redirect('#/somewhere-else')
- // }
- // });
- // });
- //
- // Initialize a new EventContext
- //
- // ### Arguments
- //
- // * `app` The `Sammy.Application` this event is called within.
- // * `verb` The verb invoked to run this context/route.
- // * `path` The string path invoked to run this context/route.
- // * `params` An Object of optional params to pass to the context. Is converted
- // to a `Sammy.Object`.
- // * `target` a DOM element that the event that holds this context originates
- // from. For post, put and del routes, this is the form element that triggered
- // the route.
- //
- Sammy.EventContext = function(app, verb, path, params, target) {
- this.app = app;
- this.verb = verb;
- this.path = path;
- this.params = new Sammy.Object(params);
- this.target = target;
- };
-
- Sammy.EventContext.prototype = $.extend({}, Sammy.Object.prototype, {
-
- // A shortcut to the app's `$element()`
- $element: function() {
- return this.app.$element(_makeArray(arguments).shift());
- },
-
- // Look up a templating engine within the current app and context.
- // `engine` can be one of the following:
- //
- // * a function: should conform to `function(content, data) { return interploated; }`
- // * a template path: 'template.ejs', looks up the extension to match to
- // the `ejs()` helper
- // * a string referering to the helper: "mustache" => `mustache()`
- //
- // If no engine is found, use the app's default `template_engine`
- //
- engineFor: function(engine) {
- var context = this, engine_match;
- // if path is actually an engine function just return it
- if (_isFunction(engine)) { return engine; }
- // lookup engine name by path extension
- engine = (engine || context.app.template_engine).toString();
- if ((engine_match = engine.match(/\.([^\.]+)$/))) {
- engine = engine_match[1];
- }
- // set the engine to the default template engine if no match is found
- if (engine && _isFunction(context[engine])) {
- return context[engine];
- }
-
- if (context.app.template_engine) {
- return this.engineFor(context.app.template_engine);
- }
- return function(content, data) { return content; };
- },
-
- // using the template `engine` found with `engineFor()`, interpolate the
- // `data` into `content`
- interpolate: function(content, data, engine) {
- return this.engineFor(engine).apply(this, [content, data]);
- },
-
- // Create and return a `Sammy.RenderContext` calling `render()` on it.
- // Loads the template and interpolate the data, however does not actual
- // place it in the DOM.
- //
- // ### Example
- //
- // // mytemplate.mustache <div class="name">{{name}}</div>
- // render('mytemplate.mustache', {name: 'quirkey'});
- // // sets the `content` to <div class="name">quirkey</div>
- // render('mytemplate.mustache', {name: 'quirkey'})
- // .appendTo('ul');
- // // appends the rendered content to $('ul')
- //
- render: function(location, data, callback) {
- return new Sammy.RenderContext(this).render(location, data, callback);
- },
-
- // Create and return a `Sammy.RenderContext` calling `renderEach()` on it.
- // Loads the template and interpolates the data for each item,
- // however does not actual place it in the DOM.
- //
- // ### Example
- //
- // // mytemplate.mustache <div class="name">{{name}}</div>
- // renderEach('mytemplate.mustache', [{name: 'quirkey'}, {name: 'endor'}])
- // // sets the `content` to <div class="name">quirkey</div><div class="name">endor</div>
- // renderEach('mytemplate.mustache', [{name: 'quirkey'}, {name: 'endor'}]).appendTo('ul');
- // // appends the rendered content to $('ul')
- //
- renderEach: function(location, name, data, callback) {
- return new Sammy.RenderContext(this).renderEach(location, name, data, callback);
- },
-
- // create a new `Sammy.RenderContext` calling `load()` with `location` and
- // `options`. Called without interpolation or placement, this allows for
- // preloading/caching the templates.
- load: function(location, options, callback) {
- return new Sammy.RenderContext(this).load(location, options, callback);
- },
-
- // `render()` the the `location` with `data` and then `swap()` the
- // app's `$element` with the rendered content.
- partial: function(location, data) {
- return new Sammy.RenderContext(this).partial(location, data);
- },
-
- // create a new `Sammy.RenderContext` calling `send()` with an arbitrary
- // function
- send: function() {
- var rctx = new Sammy.RenderContext(this);
- return rctx.send.apply(rctx, arguments);
- },
-
- // Changes the location of the current window. If `to` begins with
- // '#' it only changes the document's hash. If passed more than 1 argument
- // redirect will join them together with forward slashes.
- //
- // ### Example
- //
- // redirect('#/other/route');
- // // equivilent to
- // redirect('#', 'other', 'route');
- //
- redirect: function() {
- var to, args = _makeArray(arguments),
- current_location = this.app.getLocation();
- if (args.length > 1) {
- args.unshift('/');
- to = this.join.apply(this, args);
- } else {
- to = args[0];
- }
- this.trigger('redirect', {to: to});
- this.app.last_location = [this.verb, this.path];
- this.app.setLocation(to);
- if (current_location == to) {
- this.app.trigger('location-changed');
- }
- },
-
- // Triggers events on `app` within the current context.
- trigger: function(name, data) {
- if (typeof data == 'undefined') { data = {}; }
- if (!data.context) { data.context = this; }
- return this.app.trigger(name, data);
- },
-
- // A shortcut to app's `eventNamespace()`
- eventNamespace: function() {
- return this.app.eventNamespace();
- },
-
- // A shortcut to app's `swap()`
- swap: function(contents) {
- return this.app.swap(contents);
- },
-
- // Raises a possible `notFound()` error for the current path.
- notFound: function() {
- return this.app.notFound(this.verb, this.path);
- },
-
- // Default JSON parsing uses jQuery's `parseJSON()`. Include `Sammy.JSON`
- // plugin for the more conformant "crockford special".
- json: function(string) {
- return $.parseJSON(string);
- },
-
- // //=> Sammy.EventContext: get #/ {}
- toString: function() {
- return "Sammy.EventContext: " + [this.verb, this.path, this.params].join(' ');
- }
-
- });
-
- // An alias to Sammy
- $.sammy = window.Sammy = Sammy;
-
-})(jQuery, window);
diff --git a/solr/webapp/web/js/lib/jquery.timeago.js b/solr/webapp/web/js/lib/jquery.timeago.js
deleted file mode 100644
index 32a5ac72df2..00000000000
--- a/solr/webapp/web/js/lib/jquery.timeago.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/*
- * timeago: a jQuery plugin, version: 0.9.3 (2011-01-21)
- * @requires jQuery v1.2.3 or later
- *
- * Timeago is a jQuery plugin that makes it easy to support automatically
- * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
- *
- * For usage and examples, visit:
- * http://timeago.yarp.com/
- *
- * Licensed under the MIT:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
- */
-
-(function($) {
- $.timeago = function(timestamp) {
- if (timestamp instanceof Date) {
- return inWords(timestamp);
- } else if (typeof timestamp === "string") {
- return inWords($.timeago.parse(timestamp));
- } else {
- return inWords($.timeago.datetime(timestamp));
- }
- };
- var $t = $.timeago;
-
- $.extend($.timeago, {
- settings: {
- refreshMillis: 60000,
- allowFuture: false,
- strings: {
- prefixAgo: null,
- prefixFromNow: null,
- suffixAgo: "ago",
- suffixFromNow: "from now",
- seconds: "less than a minute",
- minute: "about a minute",
- minutes: "%d minutes",
- hour: "about an hour",
- hours: "about %d hours",
- day: "a day",
- days: "%d days",
- month: "about a month",
- months: "%d months",
- year: "about a year",
- years: "%d years",
- numbers: []
- }
- },
- inWords: function(distanceMillis) {
- var $l = this.settings.strings;
- var prefix = $l.prefixAgo;
- var suffix = $l.suffixAgo;
- if (this.settings.allowFuture) {
- if (distanceMillis < 0) {
- prefix = $l.prefixFromNow;
- suffix = $l.suffixFromNow;
- }
- distanceMillis = Math.abs(distanceMillis);
- }
-
- var seconds = distanceMillis / 1000;
- var minutes = seconds / 60;
- var hours = minutes / 60;
- var days = hours / 24;
- var years = days / 365;
-
- function substitute(stringOrFunction, number) {
- var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
- var value = ($l.numbers && $l.numbers[number]) || number;
- return string.replace(/%d/i, value);
- }
-
- var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
- seconds < 90 && substitute($l.minute, 1) ||
- minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
- minutes < 90 && substitute($l.hour, 1) ||
- hours < 24 && substitute($l.hours, Math.round(hours)) ||
- hours < 48 && substitute($l.day, 1) ||
- days < 30 && substitute($l.days, Math.floor(days)) ||
- days < 60 && substitute($l.month, 1) ||
- days < 365 && substitute($l.months, Math.floor(days / 30)) ||
- years < 2 && substitute($l.year, 1) ||
- substitute($l.years, Math.floor(years));
-
- return $.trim([prefix, words, suffix].join(" "));
- },
- parse: function(iso8601) {
- var s = $.trim(iso8601);
- s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
- s = s.replace(/-/g,"/");
- s = s.replace(/(\d)T(\d)/,"$1 $2").replace(/(\d)Z/,"$1 UTC");
- s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
- return new Date(s);
- },
- datetime: function(elem) {
- // jQuery's `is()` doesn't play well with HTML5 in IE
- var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
-
- var iso8601 = null;
-
- if( isTime )
- {
- iso8601 = $(elem).attr("datetime");
- }
-
- if( !iso8601 )
- {
- iso8601 = $(elem).attr("title");
- }
-
- if( !iso8601 )
- {
- iso8601 = $(elem).text();
- }
-
- return $t.parse(iso8601);
- }
- });
-
- $.fn.timeago = function() {
- var self = this;
- self.each(refresh);
-
- var $s = $t.settings;
- if ($s.refreshMillis > 0) {
- setInterval(function() { self.each(refresh); }, $s.refreshMillis);
- }
- return self;
- };
-
- function refresh() {
- var data = prepareData(this);
- if (!isNaN(data.datetime)) {
- $(this).text(inWords(data.datetime));
- }
- return this;
- }
-
- function prepareData(element) {
- element = $(element);
- if (!element.data("timeago")) {
- element.data("timeago", { datetime: $t.datetime(element) });
- var text = $.trim(element.text());
- if (text.length > 0) {
- element.attr("title", text);
- }
- }
- return element.data("timeago");
- }
-
- function inWords(date) {
- return $t.inWords(distance(date));
- }
-
- function distance(date) {
- return (new Date().getTime() - date.getTime());
- }
-
- // fix for IE6 suckage
- document.createElement("abbr");
- document.createElement("time");
-}(jQuery));
diff --git a/solr/webapp/web/js/lib/linker.js b/solr/webapp/web/js/lib/linker.js
deleted file mode 100644
index 565d37f5a0f..00000000000
--- a/solr/webapp/web/js/lib/linker.js
+++ /dev/null
@@ -1,48 +0,0 @@
-//by Michalis Tzikas & Vasilis Lolos
-//07-03-2012
-//v1.0
-/*
-Copyright (C) 2011 by Michalis Tzikas & Vasilis Lolos
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-(function( $ ){
- $.fn.linker = function(options) {
- var defaults = {
- target : '', //blank,self,parent,top
- className : '',
- rel : ''
- };
- var options = $.extend(defaults, options);
-
- target_string = (options.target != '') ? 'target="_'+options.target+'"' : '';
- class_string = (options.className != '') ? 'class="'+options.className+'"' : '';
- rel_string = (options.rel != '') ? 'rel="'+options.rel+'"' : '';
-
- $(this).each(function(){
- t = $(this).text();
-
- t = t.replace(/(https\:\/\/|http:\/\/)([www\.]?)([^\s|<]+)/gi,'<a href="$1$2$3" '+target_string+' '+class_string+' '+rel_string+'>$1$2$3</a>');
- t = t.replace(/([^https\:\/\/]|[^http:\/\/]|^)(www)\.([^\s|<]+)/gi,'$1<a href="http://$2.$3" '+target_string+' '+class_string+' '+rel_string+'>$2.$3</a>');
- t = t.replace(/<([^a]|^\/a])([^<>]+)>/g, "&lt;$1$2&gt;").replace(/&lt;\/a&gt;/g, "</a>").replace(/<(.)>/g, "&lt;$1&gt;").replace(/\n/g, '<br />');
-
- $(this).html(t);
- });
- };
-})( jQuery );
\ No newline at end of file
diff --git a/solr/webapp/web/js/lib/naturalSort.js b/solr/webapp/web/js/lib/naturalSort.js
deleted file mode 100644
index 6f052e996f2..00000000000
--- a/solr/webapp/web/js/lib/naturalSort.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-naturalSort.js
-- by Jim Palmer and other contributors
-
-The MIT License (MIT)
-
-Copyright (c) 2011 Jim Palmer and other contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-// naturalSort.js 0.7.0
-// https://github.com/jarinudom/naturalSort.js
-// (c) 2011 Jim Palmer and other contributors
-// naturalSort.js may be freely distributed under the MIT license.
-// Generated by CoffeeScript 1.7.1
-(function() {
- window.naturalSort = function(a, b) {
- var cLoc, dre, hre, i, numS, oFxNcL, oFyNcL, ore, re, sre, x, xD, xN, y, yD, yN;
- re = /(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/g;
- sre = /(^[ ]*|[ ]*$)/g;
- dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/;
- hre = /^0x[0-9a-f]+$/i;
- ore = /^0/;
- i = function(s) {
- return naturalSort.insensitive && ('' + s).toLowerCase() || '' + s;
- };
- x = i(a).replace(sre, '') || '';
- y = i(b).replace(sre, '') || '';
- xN = x.replace(re, '\u0000$1\u0000').replace(/\0$/, '').replace(/^\0/, '').split('\u0000');
- yN = y.replace(re, '\u0000$1\u0000').replace(/\0$/, '').replace(/^\0/, '').split('\u0000');
- xD = parseInt(x.match(hre), 16) || (xN.length !== 1 && x.match(dre) && Date.parse(x));
- yD = parseInt(y.match(hre), 16) || xD && y.match(dre) && Date.parse(y) || null;
- oFxNcL = void 0;
- oFyNcL = void 0;
- if (yD) {
- if (xD < yD) {
- return -1;
- }
- if (xD > yD) {
- return 1;
- }
- }
- cLoc = 0;
- numS = Math.max(xN.length, yN.length);
- while (cLoc < numS) {
- oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
- oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
- if (isNaN(oFxNcL) !== isNaN(oFyNcL)) {
- return (isNaN(oFxNcL) ? 1 : -1);
- } else if (typeof oFxNcL !== typeof oFyNcL) {
- oFxNcL += '';
- oFyNcL += '';
- }
- if (oFxNcL < oFyNcL) {
- return -1;
- }
- if (oFxNcL > oFyNcL) {
- return 1;
- }
- cLoc++;
- }
- return 0;
- };
-
-}).call(this);
diff --git a/solr/webapp/web/js/lib/order.js b/solr/webapp/web/js/lib/order.js
deleted file mode 100644
index 169ccfb7311..00000000000
--- a/solr/webapp/web/js/lib/order.js
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
-
-MIT License
------------
-
-Copyright (c) 2010-2011, The Dojo Foundation
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/**
- * @license RequireJS order 1.0.5 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint nomen: false, plusplus: false, strict: false */
-/*global require: false, define: false, window: false, document: false,
- setTimeout: false */
-
-//Specify that requirejs optimizer should wrap this code in a closure that
-//maps the namespaced requirejs API to non-namespaced local variables.
-/*requirejs namespace: true */
-
-(function () {
-
- //Sadly necessary browser inference due to differences in the way
- //that browsers load and execute dynamically inserted javascript
- //and whether the script/cache method works when ordered execution is
- //desired. Currently, Gecko and Opera do not load/fire onload for scripts with
- //type="script/cache" but they execute injected scripts in order
- //unless the 'async' flag is present.
- //However, this is all changing in latest browsers implementing HTML5
- //spec. With compliant browsers .async true by default, and
- //if false, then it will execute in order. Favor that test first for forward
- //compatibility.
- var testScript = typeof document !== "undefined" &&
- typeof window !== "undefined" &&
- document.createElement("script"),
-
- supportsInOrderExecution = testScript && (testScript.async ||
- ((window.opera &&
- Object.prototype.toString.call(window.opera) === "[object Opera]") ||
- //If Firefox 2 does not have to be supported, then
- //a better check may be:
- //('mozIsLocallyAvailable' in window.navigator)
- ("MozAppearance" in document.documentElement.style))),
-
- //This test is true for IE browsers, which will load scripts but only
- //execute them once the script is added to the DOM.
- supportsLoadSeparateFromExecute = testScript &&
- testScript.readyState === 'uninitialized',
-
- readyRegExp = /^(complete|loaded)$/,
- cacheWaiting = [],
- cached = {},
- scriptNodes = {},
- scriptWaiting = [];
-
- //Done with the test script.
- testScript = null;
-
- //Callback used by the type="script/cache" callback that indicates a script
- //has finished downloading.
- function scriptCacheCallback(evt) {
- var node = evt.currentTarget || evt.srcElement, i,
- moduleName, resource;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Pull out the name of the module and the context.
- moduleName = node.getAttribute("data-requiremodule");
-
- //Mark this cache request as loaded
- cached[moduleName] = true;
-
- //Find out how many ordered modules have loaded
- for (i = 0; (resource = cacheWaiting[i]); i++) {
- if (cached[resource.name]) {
- resource.req([resource.name], resource.onLoad);
- } else {
- //Something in the ordered list is not loaded,
- //so wait.
- break;
- }
- }
-
- //If just loaded some items, remove them from cacheWaiting.
- if (i > 0) {
- cacheWaiting.splice(0, i);
- }
-
- //Remove this script tag from the DOM
- //Use a setTimeout for cleanup because some older IE versions vomit
- //if removing a script node while it is being evaluated.
- setTimeout(function () {
- node.parentNode.removeChild(node);
- }, 15);
- }
- }
-
- /**
- * Used for the IE case, where fetching is done by creating script element
- * but not attaching it to the DOM. This function will be called when that
- * happens so it can be determined when the node can be attached to the
- * DOM to trigger its execution.
- */
- function onFetchOnly(node) {
- var i, loadedNode, resourceName;
-
- //Mark this script as loaded.
- node.setAttribute('data-orderloaded', 'loaded');
-
- //Cycle through waiting scripts. If the matching node for them
- //is loaded, and is in the right order, add it to the DOM
- //to execute the script.
- for (i = 0; (resourceName = scriptWaiting[i]); i++) {
- loadedNode = scriptNodes[resourceName];
- if (loadedNode &&
- loadedNode.getAttribute('data-orderloaded') === 'loaded') {
- delete scriptNodes[resourceName];
- require.addScriptToDom(loadedNode);
- } else {
- break;
- }
- }
-
- //If just loaded some items, remove them from waiting.
- if (i > 0) {
- scriptWaiting.splice(0, i);
- }
- }
-
- define({
- version: '1.0.5',
-
- load: function (name, req, onLoad, config) {
- var hasToUrl = !!req.nameToUrl,
- url, node, context;
-
- //If no nameToUrl, then probably a build with a loader that
- //does not support it, and all modules are inlined.
- if (!hasToUrl) {
- req([name], onLoad);
- return;
- }
-
- url = req.nameToUrl(name, null);
-
- //Make sure the async attribute is not set for any pathway involving
- //this script.
- require.s.skipAsync[url] = true;
- if (supportsInOrderExecution || config.isBuild) {
- //Just a normal script tag append, but without async attribute
- //on the script.
- req([name], onLoad);
- } else if (supportsLoadSeparateFromExecute) {
- //Just fetch the URL, but do not execute it yet. The
- //non-standards IE case. Really not so nice because it is
- //assuming and touching requrejs internals. OK though since
- //ordered execution should go away after a long while.
- context = require.s.contexts._;
-
- if (!context.urlFetched[url] && !context.loaded[name]) {
- //Indicate the script is being fetched.
- context.urlFetched[url] = true;
-
- //Stuff from require.load
- require.resourcesReady(false);
- context.scriptCount += 1;
-
- //Fetch the script now, remember it.
- node = require.attach(url, context, name, null, null, onFetchOnly);
- scriptNodes[name] = node;
- scriptWaiting.push(name);
- }
-
- //Do a normal require for it, once it loads, use it as return
- //value.
- req([name], onLoad);
- } else {
- //Credit to LABjs author Kyle Simpson for finding that scripts
- //with type="script/cache" allow scripts to be downloaded into
- //browser cache but not executed. Use that
- //so that subsequent addition of a real type="text/javascript"
- //tag will cause the scripts to be executed immediately in the
- //correct order.
- if (req.specified(name)) {
- req([name], onLoad);
- } else {
- cacheWaiting.push({
- name: name,
- req: req,
- onLoad: onLoad
- });
- require.attach(url, null, name, scriptCacheCallback, "script/cache");
- }
- }
- }
- });
-}());
diff --git a/solr/webapp/web/js/main.js b/solr/webapp/web/js/main.js
deleted file mode 100644
index 2a7c32a3d47..00000000000
--- a/solr/webapp/web/js/main.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-require
-(
- [
- 'lib/order!lib/console',
- 'lib/order!jquery',
- 'lib/order!lib/jquery.cookie',
- 'lib/order!lib/jquery.form',
- 'lib/order!lib/jquery.jstree',
- 'lib/order!lib/jquery.sammy',
- 'lib/order!lib/jquery.timeago',
- 'lib/order!lib/jquery.ajaxfileupload',
- 'lib/order!lib/jquery.blockUI',
- 'lib/order!lib/highlight',
- 'lib/order!lib/linker',
- 'lib/order!lib/ZeroClipboard',
- 'lib/order!lib/d3',
- 'lib/order!lib/chosen',
- 'lib/order!lib/naturalSort',
- 'lib/order!scripts/app',
-
- 'lib/order!scripts/analysis',
- 'lib/order!scripts/cloud',
- 'lib/order!scripts/cores',
- 'lib/order!scripts/documents',
- 'lib/order!scripts/dataimport',
- 'lib/order!scripts/dashboard',
- 'lib/order!scripts/files',
- 'lib/order!scripts/index',
- 'lib/order!scripts/java-properties',
- 'lib/order!scripts/logging',
- 'lib/order!scripts/ping',
- 'lib/order!scripts/plugins',
- 'lib/order!scripts/query',
- 'lib/order!scripts/replication',
- 'lib/order!scripts/schema-browser',
- 'lib/order!scripts/threads',
- 'lib/order!scripts/segments'
- ],
- function( $ )
- {
- app.run();
- }
-);
diff --git a/solr/webapp/web/js/require.js b/solr/webapp/web/js/require.js
deleted file mode 100644
index a47f8b44180..00000000000
--- a/solr/webapp/web/js/require.js
+++ /dev/null
@@ -1,11349 +0,0 @@
-/*
-
-MIT License
------------
-
-Copyright (c) 2010-2011, The Dojo Foundation
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 1.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false, sub: true */
-/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "1.0.6",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- checkLoadedDepth = 0,
- useInteractive = false,
- reservedDependencies = {
- require: true,
- module: true,
- exports: true
- },
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- urlFetched = {},
- managerCounter = 0,
- managerCallbacks = {},
- plugins = {},
- //Used to indicate which modules in a build scenario
- //need to be full executed.
- needFullExec = {},
- fullExec = {},
- resumeDepth = 0;
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * Given a relative module name, like ./something, normalize it to
- * a real name that can be mapped to a path.
- * @param {String} name the relative name
- * @param {String} baseName a real name that the name arg is relative
- * to.
- * @returns {String} normalized name
- */
- function normalize(name, baseName) {
- var pkgName, pkgConfig;
-
- //Adjust any relative paths.
- if (name && name.charAt(0) === ".") {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //Convert baseName to array, and lop off the last part,
- //so that . matches that "directory" and not name of the baseName's
- //module. For instance, baseName of "one/two/three", maps to
- //"one/two/three.js", but we want the directory, "one/two" for
- //this normalization.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- } else if (name.indexOf("./") === 0) {
- // No baseName, so this is ID is resolved relative
- // to baseUrl, pull off the leading dot.
- name = name.substring(2);
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule && pluginModule.normalize) {
- //Plugin is loaded, use its normalize method.
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //A regular module.
- normalizedName = normalize(name, parentName);
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- //Use name here since nameToUrl also calls normalize,
- //and for relative names that are outside the baseUrl
- //this causes havoc. Was thinking of just removing
- //parentModuleMap to avoid extra normalization, but
- //normalize() still does a dot removal because of
- //issue #142, so just pass in name here and redo
- //the normalization. Paths outside baseUrl are just
- //messy to support.
- url = context.nameToUrl(name, null, parentModuleMap);
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- return function () {
- //A version of a require function that passes a moduleName
- //value for items that may need to
- //look up paths relative to the moduleName
- var args = aps.call(arguments, 0), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
- var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- isBrowser: req.isBrowser
- });
- return modRequire;
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- */
- function queueDependency(manager) {
- context.paused.push(manager);
- }
-
- function execManager(manager) {
- var i, ret, err, errFile, errModuleTree,
- cb = manager.callback,
- map = manager.map,
- fullName = map.fullName,
- args = manager.deps,
- listeners = manager.listeners,
- cjsModule;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //If setting exports via "module" is in play,
- //favor that over return value and exports. After that,
- //favor a non-undefined return value over exports use.
- cjsModule = manager.cjsModule;
- if (cjsModule &&
- cjsModule.exports !== undefined &&
- //Make sure it is not already the exports value
- cjsModule.exports !== defined[fullName]) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- //If this module needed full execution in a build
- //environment, mark that now.
- if (needFullExec[fullName]) {
- fullExec[fullName] = true;
- }
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
-
- //If this module needed full execution in a build
- //environment, mark that now.
- if (needFullExec[fullName]) {
- fullExec[fullName] = true;
- }
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back listeners, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the listeners will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.id]) {
- delete waiting[manager.id];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- //Do not need to track manager callback now that it is defined.
- delete managerCallbacks[fullName];
-
- //Allow instrumentation like the optimizer to know the order
- //of modules executed and their dependencies.
- if (req.onResourceLoad && !manager.placeholder) {
- req.onResourceLoad(context, map, manager.depArray);
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- //Let listeners know of this manager's value.
- for (i = 0; (cb = listeners[i]); i++) {
- cb(ret);
- }
-
- return undefined;
- }
-
- /**
- * Helper that creates a callack function that is called when a dependency
- * is ready, and sets the i-th dependency for the manager as the
- * value passed to the callback generated by this function.
- */
- function makeArgCallback(manager, i) {
- return function (value) {
- //Only do the work if it has not been done
- //already for a dependency. Cycle breaking
- //logic in forceExec could mean this function
- //is called more than once for a given dependency.
- if (!manager.depDone[i]) {
- manager.depDone[i] = true;
- manager.deps[i] = value;
- manager.depCount -= 1;
- if (!manager.depCount) {
- //All done, execute!
- execManager(manager);
- }
- }
- };
- }
-
- function callPlugin(pluginName, depManager) {
- var map = depManager.map,
- fullName = map.fullName,
- name = map.name,
- plugin = plugins[pluginName] ||
- (plugins[pluginName] = defined[pluginName]),
- load;
-
- //No need to continue if the manager is already
- //in the process of loading.
- if (depManager.loading) {
- return;
- }
- depManager.loading = true;
-
- load = function (ret) {
- depManager.callback = function () {
- return ret;
- };
- execManager(depManager);
-
- loaded[depManager.id] = true;
-
- //The loading of this plugin
- //might have placed other things
- //in the paused queue. In particular,
- //a loader plugin that depends on
- //a different plugin loaded resource.
- resume();
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Indicate this is not a "real" module, so do not track it
- //for builds, it does not map to a real file.
- context.fake[moduleName] = true;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //No need to continue if the plugin value has already been
- //defined by a build.
- if (fullName in defined) {
- load(defined[fullName]);
- } else {
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
- var moduleDeps = [],
- i, dep, depMap;
- //Convert deps to full names and hold on to them
- //for reference later, when figuring out if they
- //are blocked by a circular dependency.
- for (i = 0; (dep = deps[i]); i++) {
- depMap = makeModuleMap(dep, map.parentMap);
- deps[i] = depMap.fullName;
- if (!depMap.prefix) {
- moduleDeps.push(deps[i]);
- }
- }
- depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
- return context.require(deps, cb);
- }), load, config);
- }
- }
-
- /**
- * Adds the manager to the waiting queue. Only fully
- * resolved items should be in the waiting queue.
- */
- function addWait(manager) {
- if (!waiting[manager.id]) {
- waiting[manager.id] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Function added to every manager object. Created out here
- * to avoid new function creation for each manager instance.
- */
- function managerAdd(cb) {
- this.listeners.push(cb);
- }
-
- function getManager(map, shouldQueue) {
- var fullName = map.fullName,
- prefix = map.prefix,
- plugin = prefix ? plugins[prefix] ||
- (plugins[prefix] = defined[prefix]) : null,
- manager, created, pluginManager, prefixMap;
-
- if (fullName) {
- manager = managerCallbacks[fullName];
- }
-
- if (!manager) {
- created = true;
- manager = {
- //ID is just the full name, but if it is a plugin resource
- //for a plugin that has not been loaded,
- //then add an ID counter to it.
- id: (prefix && !plugin ?
- (managerCounter++) + '__p@:' : '') +
- (fullName || '__r@' + (managerCounter++)),
- map: map,
- depCount: 0,
- depDone: [],
- depCallbacks: [],
- deps: [],
- listeners: [],
- add: managerAdd
- };
-
- specified[manager.id] = true;
-
- //Only track the manager/reuse it if this is a non-plugin
- //resource. Also only track plugin resources once
- //the plugin has been loaded, and so the fullName is the
- //true normalized value.
- if (fullName && (!prefix || plugins[prefix])) {
- managerCallbacks[fullName] = manager;
- }
- }
-
- //If there is a plugin needed, but it is not loaded,
- //first load the plugin, then continue on.
- if (prefix && !plugin) {
- prefixMap = makeModuleMap(prefix);
-
- //Clear out defined and urlFetched if the plugin was previously
- //loaded/defined, but not as full module (as in a build
- //situation). However, only do this work if the plugin is in
- //defined but does not have a module export value.
- if (prefix in defined && !defined[prefix]) {
- delete defined[prefix];
- delete urlFetched[prefixMap.url];
- }
-
- pluginManager = getManager(prefixMap, true);
- pluginManager.add(function (plugin) {
- //Create a new manager for the normalized
- //resource ID and have it call this manager when
- //done.
- var newMap = makeModuleMap(map.originalName, map.parentMap),
- normalizedManager = getManager(newMap, true);
-
- //Indicate this manager is a placeholder for the real,
- //normalized thing. Important for when trying to map
- //modules and dependencies, for instance, in a build.
- manager.placeholder = true;
-
- normalizedManager.add(function (resource) {
- manager.callback = function () {
- return resource;
- };
- execManager(manager);
- });
- });
- } else if (created && shouldQueue) {
- //Indicate the resource is not loaded yet if it is to be
- //queued.
- loaded[manager.id] = false;
- queueDependency(manager);
- addWait(manager);
- }
-
- return manager;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- manager = getManager(moduleMap),
- id = manager.id,
- deps = manager.deps,
- i, depArg, depName, depPrefix, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[id] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[id] = true;
- loaded[id] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Attach real depArray and callback to the manager. Do this
- //only if the module has not been defined already, so do this after
- //the fullName checks above. IE can call main() more than once
- //for a module.
- manager.depArray = depArray;
- manager.callback = callback;
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
- depPrefix = depArg.prefix;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- deps[i] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- deps[i] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = deps[i] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- } else if (depName in defined && !(depName in waiting) &&
- (!(fullName in needFullExec) ||
- (fullName in needFullExec && fullExec[depName]))) {
- //Module already defined, and not in a build situation
- //where the module is a something that needs full
- //execution and this dependency has not been fully
- //executed. See r.js's requirePatch.js for more info
- //on fullExec.
- deps[i] = defined[depName];
- } else {
- //Mark this dependency as needing full exec if
- //the current module needs full exec.
- if (fullName in needFullExec) {
- needFullExec[depName] = true;
- //Reset state so fully executed code will get
- //picked up correctly.
- delete defined[depName];
- urlFetched[depArg.url] = false;
- }
-
- //Either a resource that is not loaded yet, or a plugin
- //resource for either a plugin that has not
- //loaded yet.
- manager.depCount += 1;
- manager.depCallbacks[i] = makeArgCallback(manager, i);
- getManager(depArg, true).add(manager.depCallbacks[i]);
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (!manager.depCount) {
- //All done, execute!
- execManager(manager);
- } else {
- addWait(manager);
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function findCycle(manager, traced) {
- var fullName = manager.map.fullName,
- depArray = manager.depArray,
- fullyLoaded = true,
- i, depName, depManager, result;
-
- if (manager.isDone || !fullName || !loaded[fullName]) {
- return result;
- }
-
- //Found the cycle.
- if (traced[fullName]) {
- return manager;
- }
-
- traced[fullName] = true;
-
- //Trace through the dependencies.
- if (depArray) {
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (!loaded[depName] && !reservedDependencies[depName]) {
- fullyLoaded = false;
- break;
- }
- depManager = waiting[depName];
- if (depManager && !depManager.isDone && loaded[depName]) {
- result = findCycle(depManager, traced);
- if (result) {
- break;
- }
- }
- }
- if (!fullyLoaded) {
- //Discard the cycle that was found, since it cannot
- //be forced yet. Also clear this module from traced.
- result = undefined;
- delete traced[fullName];
- }
- }
-
- return result;
- }
-
- function forceExec(manager, traced) {
- var fullName = manager.map.fullName,
- depArray = manager.depArray,
- i, depName, depManager, prefix, prefixManager, value;
-
-
- if (manager.isDone || !fullName || !loaded[fullName]) {
- return undefined;
- }
-
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //Trace through the dependencies.
- if (depArray) {
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- //First, make sure if it is a plugin resource that the
- //plugin is not blocked.
- prefix = makeModuleMap(depName).prefix;
- if (prefix && (prefixManager = waiting[prefix])) {
- forceExec(prefixManager, traced);
- }
- depManager = waiting[depName];
- if (depManager && !depManager.isDone && loaded[depName]) {
- value = forceExec(depManager, traced);
- manager.depCallbacks[i](value);
- }
- }
- }
- }
-
- return defined[fullName];
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false,
- cycleDeps = [],
- i, prop, err, manager, cycleManager, moduleDeps;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- if (prop.indexOf('!') === -1) {
- //No reason to keep looking for unfinished
- //loading. If the only stillLoading is a
- //plugin resource though, keep going,
- //because it may be that a plugin resource
- //is waiting on a non-plugin cycle.
- cycleDeps = [];
- break;
- } else {
- moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;
- if (moduleDeps) {
- cycleDeps.push.apply(cycleDeps, moduleDeps);
- }
- }
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- err.contextName = context.contextName;
- return req.onError(err);
- }
-
- //If still loading but a plugin is waiting on a regular module cycle
- //break the cycle.
- if (stillLoading && cycleDeps.length) {
- for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {
- if ((cycleManager = findCycle(manager, {}))) {
- forceExec(cycleManager, {});
- break;
- }
- }
-
- }
-
- //If still waiting on loads, and the waiting load is something
- //other than a plugin resource, or there are still outstanding
- //scripts, then just try back later.
- if (!expired && (stillLoading || context.scriptCount)) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //If anything got placed in the paused queue, run it down.
- if (context.paused.length) {
- resume();
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var manager, map, url, i, p, args, fullName;
-
- //Any defined modules in the global queue, intake them now.
- context.takeGlobalQueue();
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (manager = p[i]); i++) {
- map = manager.map;
- url = map.url;
- fullName = map.fullName;
-
- //If the manager is for a plugin managed resource,
- //ask the plugin to load it now.
- if (map.prefix) {
- callPlugin(map.prefix, manager);
- } else {
- //Regular dependency.
- if (!urlFetched[url] && !loaded[fullName]) {
- req.load(context, fullName, url);
-
- //Mark the URL as fetched, but only if it is
- //not an empty: URL, used by the optimizer.
- //In that case we need to be sure to call
- //load() for each module that is mapped to
- //empty: so that dependencies are satisfied
- //correctly.
- if (url.indexOf('empty:') !== 0) {
- urlFetched[url] = true;
- }
- }
- }
- }
-
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- urlFetched: urlFetched,
- scriptCount: 0,
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- needFullExec: needFullExec,
- fake: {},
- fullExec: fullExec,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call.
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- if (isFunction(callback)) {
- //Invalid call
- return req.onError(makeError("requireargs", "Invalid require call"));
- }
-
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- //Call main but only if there are dependencies or
- //a callback to call.
- if (deps && deps.length || callback) {
- main(null, deps, callback, relModuleMap);
- }
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (!require) {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
-
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {}
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- req.resourcesReady(false);
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!deps.length && isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
-
- /**
- * Adds a node to the DOM. Public function since used by the order plugin.
- * This method should not normally be called by outside code.
- */
- req.addScriptToDom = function (node) {
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || (node && readyRegExp.test(node.readyState))) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- * @param {Function} [fetchOnlyFunction] optional function to indicate the script node
- * should be set up to fetch the script but do not attach it to the DOM
- * so that it can later be attached to execute it. This is a way for the
- * order plugin to support ordered loading in IE. Once the script is fetched,
- * but not executed, the fetchOnlyFunction will be called.
- */
- req.attach = function (url, context, moduleName, callback, type, fetchOnlyFunction) {
- var node;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || (context && context.config.scriptType) ||
- "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
-
-
- if (fetchOnlyFunction) {
- //Need to use old school onreadystate here since
- //when the event fires and the node is not attached
- //to the DOM, the evt.srcElement is null, so use
- //a closure to remember the node.
- node.onreadystatechange = function (evt) {
- //Script loaded but not executed.
- //Clear loaded handler, set the real one that
- //waits for script execution.
- if (node.readyState === 'loaded') {
- node.onreadystatechange = null;
- node.attachEvent("onreadystatechange", callback);
- fetchOnlyFunction(node);
- }
- };
- } else {
- node.attachEvent("onreadystatechange", callback);
- }
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //Fetch only means waiting to attach to DOM after loaded.
- if (!fetchOnlyFunction) {
- req.addScriptToDom(node);
- }
-
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (globalI = scripts.length - 1; globalI > -1 && (script = scripts[globalI]); globalI--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //resourcesReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- req.resourcesReady(true);
- };
-
- /**
- * Internal function that is triggered whenever all scripts/resources
- * have been loaded by the loader. Can be overridden by other, for
- * instance the domReady plugin, which wants to know when all resources
- * are loaded.
- */
- req.resourcesReady = function (isReady) {
- var contexts, context, prop;
-
- //First, set the public variable indicating that resources are loading.
- req.resourcesDone = isReady;
-
- if (req.resourcesDone) {
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- //FF < 3.6 readyState fix. Needed so that domReady plugin
- //works well in that environment, since require.js is normally
- //loaded via an HTML script tag so it will be there before window load,
- //where the domReady plugin is more likely to be loaded after window load.
- req.pageLoaded = function () {
- if (document.readyState !== "complete") {
- document.readyState = "complete";
- }
- };
- if (isBrowser) {
- if (document.addEventListener) {
- if (!document.readyState) {
- document.readyState = "loading";
- window.addEventListener("load", req.pageLoaded, false);
- }
- }
- }
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
-/*!
- * jQuery JavaScript Library v1.7.1
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Mon Nov 21 21:11:03 2011 -0500
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
- location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // A simple way to check for HTML strings or ID strings
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
- quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
-
- // Used for trimming whitespace
- trimLeft = /^\s+/,
- trimRight = /\s+$/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
- // Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
- rmsie = /(msie) ([\w.]+)/,
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
- // Matches dashed string for camelizing
- rdashAlpha = /-([a-z]|[0-9])/ig,
- rmsPrefix = /^-ms-/,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return ( letter + "" ).toUpperCase();
- },
-
- // Keep a UserAgent string for use with jQuery.browser
- userAgent = navigator.userAgent,
-
- // For matching the engine and version of the browser
- browserMatch,
-
- // The deferred used on DOM ready
- readyList,
-
- // The ready event handler
- DOMContentLoaded,
-
- // Save a reference to some core methods
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), or $(undefined)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // The body element only exists once, optimize finding it
- if ( selector === "body" && !context && document.body ) {
- this.context = document;
- this[0] = document.body;
- this.selector = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- // Are we dealing with HTML string or an ID?
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = quickExpr.exec( selector );
- }
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = ( context ? context.ownerDocument || context : document );
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- ret = rsingleTag.exec( selector );
-
- if ( ret ) {
- if ( jQuery.isPlainObject( context ) ) {
- selector = [ document.createElement( ret[1] ) ];
- jQuery.fn.attr.call( selector, context, true );
-
- } else {
- selector = [ doc.createElement( ret[1] ) ];
- }
-
- } else {
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $("#id")
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return ( context || rootjQuery ).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if ( selector.selector !== undefined ) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.7.1",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return slice.call( this, 0 );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
- // Build a new jQuery matched element set
- var ret = this.constructor();
-
- if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
-
- } else {
- jQuery.merge( ret, elems );
- }
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Attach the listeners
- jQuery.bindReady();
-
- // Add the callback
- readyList.add( fn );
-
- return this;
- },
-
- eq: function( i ) {
- i = +i;
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Either a released hold or an DOMready/load event and not yet ready
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.fireWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger( "ready" ).off( "ready" );
- }
- }
- },
-
- bindReady: function() {
- if ( readyList ) {
- return;
- }
-
- readyList = jQuery.Callbacks( "once memory" );
-
- // Catch cases where $(document).ready() is called after the
- // browser event has already occurred.
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var toplevel = false;
-
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
-
- if ( document.documentElement.doScroll && toplevel ) {
- doScrollCheck();
- }
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- // A crude way of determining if an object is a window
- isWindow: function( obj ) {
- return obj && typeof obj === "object" && "setInterval" in obj;
- },
-
- isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- try {
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
- } catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw new Error( msg );
- },
-
- parseJSON: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return ( new Function( "return " + data ) )();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- parseXML: function( data ) {
- var xml, tmp;
- try {
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
- } catch( e ) {
- xml = undefined;
- }
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Convert dashed to camelCase; used by the css and data modules
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0,
- length = object.length,
- isObj = length === undefined || jQuery.isFunction( object );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.apply( object[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( object[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return object;
- },
-
- // Use native String.trim function wherever possible
- trim: trim ?
- function( text ) {
- return text == null ?
- "" :
- trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
- },
-
- // results is for internal usage only
- makeArray: function( array, results ) {
- var ret = results || [];
-
- if ( array != null ) {
- // The window, strings (and functions) also have 'length'
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type( array );
-
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
- } else {
- jQuery.merge( ret, array );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, array, i ) {
- var len;
-
- if ( array ) {
- if ( indexOf ) {
- return indexOf.call( array, elem, i );
- }
-
- len = array.length;
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
-
- for ( ; i < len; i++ ) {
- // Skip accessing in sparse arrays
- if ( i in array && array[ i ] === elem ) {
- return i;
- }
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var i = first.length,
- j = 0;
-
- if ( typeof second.length === "number" ) {
- for ( var l = second.length; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [], retVal;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key, ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- if ( typeof context === "string" ) {
- var tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- var args = slice.call( arguments, 2 ),
- proxy = function() {
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Mutifunctional method to get and set values to a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, key, value, exec, fn, pass ) {
- var length = elems.length;
-
- // Setting many attributes
- if ( typeof key === "object" ) {
- for ( var k in key ) {
- jQuery.access( elems, k, key[k], exec, fn, value );
- }
- return elems;
- }
-
- // Setting one attribute
- if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = !pass && exec && jQuery.isFunction(value);
-
- for ( var i = 0; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
-
- return elems;
- }
-
- // Getting an attribute
- return length ? fn( elems[0], key ) : undefined;
- },
-
- now: function() {
- return ( new Date() ).getTime();
- },
-
- // Use of jQuery.browser is frowned upon.
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
- uaMatch: function( ua ) {
- ua = ua.toLowerCase();
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- },
-
- sub: function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
- },
-
- browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
- jQuery.browser[ browserMatch.browser ] = true;
- jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
- jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- };
-
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- };
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
- if ( jQuery.isReady ) {
- return;
- }
-
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch(e) {
- setTimeout( doScrollCheck, 1 );
- return;
- }
-
- // and execute any waiting functions
- jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-// String to Object flags format cache
-var flagsCache = {};
-
-// Convert String-formatted flags into Object-formatted ones and store in cache
-function createFlags( flags ) {
- var object = flagsCache[ flags ] = {},
- i, length;
- flags = flags.split( /\s+/ );
- for ( i = 0, length = flags.length; i < length; i++ ) {
- object[ flags[i] ] = true;
- }
- return object;
-}
-
-/*
- * Create a callback list using the following parameters:
- *
- * flags: an optional list of space-separated flags that will change how
- * the callback list behaves
- *
- * By default a callback list will act like an event callback list and can be
- * "fired" multiple times.
- *
- * Possible flags:
- *
- * once: will ensure the callback list can only be fired once (like a Deferred)
- *
- * memory: will keep track of previous values and will call any callback added
- * after the list has been fired right away with the latest "memorized"
- * values (like a Deferred)
- *
- * unique: will ensure a callback can only be added once (no duplicate in the list)
- *
- * stopOnFalse: interrupt callings when a callback returns false
- *
- */
-jQuery.Callbacks = function( flags ) {
-
- // Convert flags from String-formatted to Object-formatted
- // (we check in cache first)
- flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
-
- var // Actual callback list
- list = [],
- // Stack of fire calls for repeatable lists
- stack = [],
- // Last fire value (for non-forgettable lists)
- memory,
- // Flag to know if list is currently firing
- firing,
- // First callback to fire (used internally by add and fireWith)
- firingStart,
- // End of the loop when firing
- firingLength,
- // Index of currently firing callback (modified by remove if needed)
- firingIndex,
- // Add one or several callbacks to the list
- add = function( args ) {
- var i,
- length,
- elem,
- type,
- actual;
- for ( i = 0, length = args.length; i < length; i++ ) {
- elem = args[ i ];
- type = jQuery.type( elem );
- if ( type === "array" ) {
- // Inspect recursively
- add( elem );
- } else if ( type === "function" ) {
- // Add if not in unique mode and callback is not in
- if ( !flags.unique || !self.has( elem ) ) {
- list.push( elem );
- }
- }
- }
- },
- // Fire callbacks
- fire = function( context, args ) {
- args = args || [];
- memory = !flags.memory || [ context, args ];
- firing = true;
- firingIndex = firingStart || 0;
- firingStart = 0;
- firingLength = list.length;
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
- if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
- memory = true; // Mark as halted
- break;
- }
- }
- firing = false;
- if ( list ) {
- if ( !flags.once ) {
- if ( stack && stack.length ) {
- memory = stack.shift();
- self.fireWith( memory[ 0 ], memory[ 1 ] );
- }
- } else if ( memory === true ) {
- self.disable();
- } else {
- list = [];
- }
- }
- },
- // Actual Callbacks object
- self = {
- // Add a callback or a collection of callbacks to the list
- add: function() {
- if ( list ) {
- var length = list.length;
- add( arguments );
- // Do we need to add the callbacks to the
- // current firing batch?
- if ( firing ) {
- firingLength = list.length;
- // With memory, if we're not firing then
- // we should call right away, unless previous
- // firing was halted (stopOnFalse)
- } else if ( memory && memory !== true ) {
- firingStart = length;
- fire( memory[ 0 ], memory[ 1 ] );
- }
- }
- return this;
- },
- // Remove a callback from the list
- remove: function() {
- if ( list ) {
- var args = arguments,
- argIndex = 0,
- argLength = args.length;
- for ( ; argIndex < argLength ; argIndex++ ) {
- for ( var i = 0; i < list.length; i++ ) {
- if ( args[ argIndex ] === list[ i ] ) {
- // Handle firingIndex and firingLength
- if ( firing ) {
- if ( i <= firingLength ) {
- firingLength--;
- if ( i <= firingIndex ) {
- firingIndex--;
- }
- }
- }
- // Remove the element
- list.splice( i--, 1 );
- // If we have some unicity property then
- // we only need to do this once
- if ( flags.unique ) {
- break;
- }
- }
- }
- }
- }
- return this;
- },
- // Control if a given callback is in the list
- has: function( fn ) {
- if ( list ) {
- var i = 0,
- length = list.length;
- for ( ; i < length; i++ ) {
- if ( fn === list[ i ] ) {
- return true;
- }
- }
- }
- return false;
- },
- // Remove all callbacks from the list
- empty: function() {
- list = [];
- return this;
- },
- // Have the list do nothing anymore
- disable: function() {
- list = stack = memory = undefined;
- return this;
- },
- // Is it disabled?
- disabled: function() {
- return !list;
- },
- // Lock the list in its current state
- lock: function() {
- stack = undefined;
- if ( !memory || memory === true ) {
- self.disable();
- }
- return this;
- },
- // Is it locked?
- locked: function() {
- return !stack;
- },
- // Call all callbacks with the given context and arguments
- fireWith: function( context, args ) {
- if ( stack ) {
- if ( firing ) {
- if ( !flags.once ) {
- stack.push( [ context, args ] );
- }
- } else if ( !( flags.once && memory ) ) {
- fire( context, args );
- }
- }
- return this;
- },
- // Call all the callbacks with the given arguments
- fire: function() {
- self.fireWith( this, arguments );
- return this;
- },
- // To know if the callbacks have already been called at least once
- fired: function() {
- return !!memory;
- }
- };
-
- return self;
-};
-
-
-
-
-var // Static reference to slice
- sliceDeferred = [].slice;
-
-jQuery.extend({
-
- Deferred: function( func ) {
- var doneList = jQuery.Callbacks( "once memory" ),
- failList = jQuery.Callbacks( "once memory" ),
- progressList = jQuery.Callbacks( "memory" ),
- state = "pending",
- lists = {
- resolve: doneList,
- reject: failList,
- notify: progressList
- },
- promise = {
- done: doneList.add,
- fail: failList.add,
- progress: progressList.add,
-
- state: function() {
- return state;
- },
-
- // Deprecated
- isResolved: doneList.fired,
- isRejected: failList.fired,
-
- then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
- deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
- return this;
- },
- always: function() {
- deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
- return this;
- },
- pipe: function( fnDone, fnFail, fnProgress ) {
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( {
- done: [ fnDone, "resolve" ],
- fail: [ fnFail, "reject" ],
- progress: [ fnProgress, "notify" ]
- }, function( handler, data ) {
- var fn = data[ 0 ],
- action = data[ 1 ],
- returned;
- if ( jQuery.isFunction( fn ) ) {
- deferred[ handler ](function() {
- returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
- } else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
- }
- });
- } else {
- deferred[ handler ]( newDefer[ action ] );
- }
- });
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- if ( obj == null ) {
- obj = promise;
- } else {
- for ( var key in promise ) {
- obj[ key ] = promise[ key ];
- }
- }
- return obj;
- }
- },
- deferred = promise.promise({}),
- key;
-
- for ( key in lists ) {
- deferred[ key ] = lists[ key ].fire;
- deferred[ key + "With" ] = lists[ key ].fireWith;
- }
-
- // Handle state
- deferred.done( function() {
- state = "resolved";
- }, failList.disable, progressList.lock ).fail( function() {
- state = "rejected";
- }, doneList.disable, progressList.lock );
-
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
-
- // All done!
- return deferred;
- },
-
- // Deferred helper
- when: function( firstParam ) {
- var args = sliceDeferred.call( arguments, 0 ),
- i = 0,
- length = args.length,
- pValues = new Array( length ),
- count = length,
- pCount = length,
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
- firstParam :
- jQuery.Deferred(),
- promise = deferred.promise();
- function resolveFunc( i ) {
- return function( value ) {
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- if ( !( --count ) ) {
- deferred.resolveWith( deferred, args );
- }
- };
- }
- function progressFunc( i ) {
- return function( value ) {
- pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- deferred.notifyWith( promise, pValues );
- };
- }
- if ( length > 1 ) {
- for ( ; i < length; i++ ) {
- if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
- args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
- } else {
- --count;
- }
- }
- if ( !count ) {
- deferred.resolveWith( deferred, args );
- }
- } else if ( deferred !== firstParam ) {
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
- }
- return promise;
- }
-});
-
-
-
-
-jQuery.support = (function() {
-
- var support,
- all,
- a,
- select,
- opt,
- input,
- marginDiv,
- fragment,
- tds,
- events,
- eventName,
- i,
- isSupported,
- div = document.createElement( "div" ),
- documentElement = document.documentElement;
-
- // Preliminary tests
- div.setAttribute("className", "t");
- div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-
- all = div.getElementsByTagName( "*" );
- a = div.getElementsByTagName( "a" )[ 0 ];
-
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return {};
- }
-
- // First batch of supports tests
- select = document.createElement( "select" );
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName( "input" )[ 0 ];
-
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute("href") === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Tests for enctype support on a form(#6743)
- enctype: !!document.createElement("form").enctype,
-
- // Makes sure cloning an html5 element does not cause problems
- // Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent( "onclick" );
- }
-
- // Check if a radio maintains its value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute("type", "radio");
- support.radioValue = input.value === "t";
-
- input.setAttribute("checked", "checked");
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.lastChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- fragment.removeChild( input );
- fragment.appendChild( div );
-
- div.innerHTML = "";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- if ( window.getComputedStyle ) {
- marginDiv = document.createElement( "div" );
- marginDiv.style.width = "0";
- marginDiv.style.marginRight = "0";
- div.style.width = "2px";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
- }
-
- // Technique from Juriy Zaytsev
- // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for( i in {
- submit: 1,
- change: 1,
- focusin: 1
- }) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- fragment.removeChild( div );
-
- // Null elements to avoid leaks in IE
- fragment = select = opt = marginDiv = div = input = null;
-
- // Run tests that need a body at doc ready
- jQuery(function() {
- var container, outer, inner, table, td, offsetSupport,
- conMarginTop, ptlm, vb, style, html,
- body = document.getElementsByTagName("body")[0];
-
- if ( !body ) {
- // Return for frameset docs that don't have a body
- return;
- }
-
- conMarginTop = 1;
- ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
- vb = "visibility:hidden;border:0;";
- style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
- html = "<div " + style + "><div></div></div>" +
- "<table " + style + " cellpadding='0' cellspacing='0'>" +
- "<tr><td></td></tr></table>";
-
- container = document.createElement("div");
- container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
- body.insertBefore( container, body.firstChild );
-
- // Construct the test element
- div = document.createElement("div");
- container.appendChild( div );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName( "td" );
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE <= 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-
- // Figure out if the W3C box model works as expected
- div.innerHTML = "";
- div.style.width = div.style.paddingLeft = "1px";
- jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
-
- if ( typeof div.style.zoom !== "undefined" ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.style.display = "inline";
- div.style.zoom = 1;
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "";
- div.innerHTML = "<div style='width:4px;'></div>";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
- }
-
- div.style.cssText = ptlm + vb;
- div.innerHTML = html;
-
- outer = div.firstChild;
- inner = outer.firstChild;
- td = outer.nextSibling.firstChild.firstChild;
-
- offsetSupport = {
- doesNotAddBorder: ( inner.offsetTop !== 5 ),
- doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
- };
-
- inner.style.position = "fixed";
- inner.style.top = "20px";
-
- // safari subtracts parent border width here which is 5px
- offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
- inner.style.position = inner.style.top = "";
-
- outer.style.overflow = "hidden";
- outer.style.position = "relative";
-
- offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
- offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
-
- body.removeChild( container );
- div = container = null;
-
- jQuery.extend( support, offsetSupport );
- });
-
- return support;
-})();
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- // Please use with caution
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var privateCache, thisCache, ret,
- internalKey = jQuery.expando,
- getByName = typeof name === "string",
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
- isEvents = name === "events";
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ internalKey ] = id = ++jQuery.uuid;
- } else {
- id = internalKey;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // Avoids exposing jQuery metadata on plain JS objects when the object
- // is serialized using JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ] = jQuery.extend( cache[ id ], name );
- } else {
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
- }
- }
-
- privateCache = thisCache = cache[ id ];
-
- // jQuery data() is stored in a separate object inside the object's internal data
- // cache in order to avoid key collisions between internal data and user-defined
- // data.
- if ( !pvt ) {
- if ( !thisCache.data ) {
- thisCache.data = {};
- }
-
- thisCache = thisCache.data;
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // Users should not attempt to inspect the internal events object using jQuery.data,
- // it is undocumented and subject to change. But does anyone listen? No.
- if ( isEvents && !thisCache[ name ] ) {
- return privateCache.events;
- }
-
- // Check for both converted-to-camel and non-converted data property names
- // If a data property was specified
- if ( getByName ) {
-
- // First Try to find as-is property data
- ret = thisCache[ name ];
-
- // Test for null|undefined property data
- if ( ret == null ) {
-
- // Try to find the camelCased property
- ret = thisCache[ jQuery.camelCase( name ) ];
- }
- } else {
- ret = thisCache;
- }
-
- return ret;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, i, l,
-
- // Reference to internal data cache key
- internalKey = jQuery.expando,
-
- isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
-
- // See jQuery.data for more information
- id = isNode ? elem[ internalKey ] : internalKey;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
-
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
-
- if ( thisCache ) {
-
- // Support array or space separated string names for data keys
- if ( !jQuery.isArray( name ) ) {
-
- // try the string as a key before any manipulation
- if ( name in thisCache ) {
- name = [ name ];
- } else {
-
- // split the camel cased version by spaces unless a key with the spaces exists
- name = jQuery.camelCase( name );
- if ( name in thisCache ) {
- name = [ name ];
- } else {
- name = name.split( " " );
- }
- }
- }
-
- for ( i = 0, l = name.length; i < l; i++ ) {
- delete thisCache[ name[i] ];
- }
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( !pvt ) {
- delete cache[ id ].data;
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject(cache[ id ]) ) {
- return;
- }
- }
-
- // Browsers that fail expando deletion also refuse to delete expandos on
- // the window, but it will allow it on all other JS objects; other browsers
- // don't care
- // Ensure that `cache` is not a window object #10080
- if ( jQuery.support.deleteExpando || !cache.setInterval ) {
- delete cache[ id ];
- } else {
- cache[ id ] = null;
- }
-
- // We destroyed the cache and need to eliminate the expando on the node to avoid
- // false lookups in the cache for entries that no longer exist
- if ( isNode ) {
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( jQuery.support.deleteExpando ) {
- delete elem[ internalKey ];
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( internalKey );
- } else {
- elem[ internalKey ] = null;
- }
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- if ( elem.nodeName ) {
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- if ( match ) {
- return !(match === true || elem.getAttribute("classid") !== match);
- }
- }
-
- return true;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var parts, attr, name,
- data = null;
-
- if ( typeof key === "undefined" ) {
- if ( this.length ) {
- data = jQuery.data( this[0] );
-
- if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
- attr = this[0].attributes;
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( this[0], name, data[ name ] );
- }
- }
- jQuery._data( this[0], "parsedAttrs", true );
- }
- }
-
- return data;
-
- } else if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- // Try to fetch any internally stored data first
- if ( data === undefined && this.length ) {
- data = jQuery.data( this[0], key );
- data = dataAttr( this[0], key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
-
- } else {
- return this.each(function() {
- var self = jQuery( this ),
- args = [ parts[0], value ];
-
- self.triggerHandler( "setData" + parts[1] + "!", args );
- jQuery.data( this, key, value );
- self.triggerHandler( "changeData" + parts[1] + "!", args );
- });
- }
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
-
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- jQuery.isNumeric( data ) ? parseFloat( data ) :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// checks a cache object for emptiness
-function isEmptyDataObject( obj ) {
- for ( var name in obj ) {
-
- // if the public data object is empty, the private is still empty
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
- continue;
- }
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
- var deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- defer = jQuery._data( elem, deferDataKey );
- if ( defer &&
- ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
- ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
- // Give room for hard-coded callbacks to fire first
- // and eventually mark/queue something else on the element
- setTimeout( function() {
- if ( !jQuery._data( elem, queueDataKey ) &&
- !jQuery._data( elem, markDataKey ) ) {
- jQuery.removeData( elem, deferDataKey, true );
- defer.fire();
- }
- }, 0 );
- }
-}
-
-jQuery.extend({
-
- _mark: function( elem, type ) {
- if ( elem ) {
- type = ( type || "fx" ) + "mark";
- jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
- }
- },
-
- _unmark: function( force, elem, type ) {
- if ( force !== true ) {
- type = elem;
- elem = force;
- force = false;
- }
- if ( elem ) {
- type = type || "fx";
- var key = type + "mark",
- count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
- if ( count ) {
- jQuery._data( elem, key, count );
- } else {
- jQuery.removeData( elem, key, true );
- handleQueueMarkDefer( elem, type, "mark" );
- }
- }
- },
-
- queue: function( elem, type, data ) {
- var q;
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- q = jQuery._data( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery._data( elem, type, jQuery.makeArray(data) );
- } else {
- q.push( data );
- }
- }
- return q || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift(),
- hooks = {};
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- }
-
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift( "inprogress" );
- }
-
- jQuery._data( elem, type + ".run", hooks );
- fn.call( elem, function() {
- jQuery.dequeue( elem, type );
- }, hooks );
- }
-
- if ( !queue.length ) {
- jQuery.removeData( elem, type + "queue " + type + ".run", true );
- handleQueueMarkDefer( elem, type, "queue" );
- }
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- }
-
- if ( data === undefined ) {
- return jQuery.queue( this[0], type );
- }
- return this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
- type = type || "fx";
-
- return this.queue( type, function( next, hooks ) {
- var timeout = setTimeout( next, time );
- hooks.stop = function() {
- clearTimeout( timeout );
- };
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, object ) {
- if ( typeof type !== "string" ) {
- object = type;
- type = undefined;
- }
- type = type || "fx";
- var defer = jQuery.Deferred(),
- elements = this,
- i = elements.length,
- count = 1,
- deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- tmp;
- function resolve() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- }
- while( i-- ) {
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
- jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
- count++;
- tmp.add( resolve );
- }
- }
- resolve();
- return defer.promise();
- }
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
- rspace = /\s+/,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea)?$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- getSetAttribute = jQuery.support.getSetAttribute,
- nodeHook, boolHook, fixSpecified;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.attr );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.prop );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classNames, i, l, elem, className, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
-
- if ( (value && typeof value === "string") || value === undefined ) {
- classNames = ( value || "" ).split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 && elem.className ) {
- if ( value ) {
- className = (" " + elem.className + " ").replace( rclass, " " );
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[ c ] + " ", " ");
- }
- elem.className = jQuery.trim( className );
-
- } else {
- elem.className = "";
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ",
- i = 0,
- l = this.length;
- for ( ; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret, isFunction,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return;
- }
-
- isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var self = jQuery(this), val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value, i, max, option,
- index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type === "select-one";
-
- // Nothing was selected
- if ( index < 0 ) {
- return null;
- }
-
- // Loop through all the selected options
- i = one ? index : 0;
- max = one ? index + 1 : options.length;
- for ( ; i < max; i++ ) {
- option = options[ i ];
-
- // Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
- if ( one && !values.length && options.length ) {
- return jQuery( options[ index ] ).val();
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- attrFn: {
- val: true,
- css: true,
- html: true,
- text: true,
- data: true,
- width: true,
- height: true,
- offset: true
- },
-
- attr: function( elem, name, value, pass ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- if ( pass && name in jQuery.attrFn ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( typeof elem.getAttribute === "undefined" ) {
- return jQuery.prop( elem, name, value );
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // All attributes are lowercase
- // Grab necessary hook if one is defined
- if ( notxml ) {
- name = name.toLowerCase();
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, "" + value );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, value ) {
- var propName, attrNames, name, l,
- i = 0;
-
- if ( value && elem.nodeType === 1 ) {
- attrNames = value.toLowerCase().split( rspace );
- l = attrNames.length;
-
- for ( ; i < l; i++ ) {
- name = attrNames[ i ];
-
- if ( name ) {
- propName = jQuery.propFix[ name ] || name;
-
- // See #9699 for explanation of this approach (setting first, then removal)
- jQuery.attr( elem, name, "" );
- elem.removeAttribute( getSetAttribute ? name : propName );
-
- // Set corresponding property to false for boolean attributes
- if ( rboolean.test( name ) && propName in elem ) {
- elem[ propName ] = false;
- }
- }
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to its default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- // Use the value property for back compat
- // Use the nodeHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- 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( elem, name, value ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return ( elem[ name ] = value );
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- }
- }
-});
-
-// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
-jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- // Fall back to attribute presence where some booleans are not supported
- var attrNode,
- property = jQuery.prop( elem, name );
- return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !getSetAttribute ) {
-
- fixSpecified = {
- name: true,
- id: true
- };
-
- // Use this for any attribute in IE6/7
- // This fixes almost every IE6/7 issue
- nodeHook = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
- ret.nodeValue :
- undefined;
- },
- set: function( elem, value, name ) {
- // Set the existing or create a new attribute node
- var ret = elem.getAttributeNode( name );
- if ( !ret ) {
- ret = document.createAttribute( name );
- elem.setAttributeNode( ret );
- }
- return ( ret.nodeValue = value + "" );
- }
- };
-
- // Apply the nodeHook to tabindex
- jQuery.attrHooks.tabindex.set = nodeHook.set;
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-
- // Set contenteditable to false on removals(#10429)
- // Setting to empty string throws an error as an invalid value
- jQuery.attrHooks.contenteditable = {
- get: nodeHook.get,
- set: function( elem, value, name ) {
- if ( value === "" ) {
- value = "false";
- }
- nodeHook.set( elem, value, name );
- }
- };
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return ( elem.style.cssText = "" + value );
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- return null;
- }
- });
-}
-
-// IE6/7 call enctype encoding
-if ( !jQuery.support.enctype ) {
- jQuery.propFix.enctype = "encoding";
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
- }
- }
- });
-});
-
-
-
-
-var rformElems = /^(?:textarea|input|select)$/i,
- rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
- rhoverHack = /\bhover(\.\S+)?\b/,
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
- quickParse = function( selector ) {
- var quick = rquickIs.exec( selector );
- if ( quick ) {
- // 0 1 2 3
- // [ _, tag, id, class ]
- quick[1] = ( quick[1] || "" ).toLowerCase();
- quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
- }
- return quick;
- },
- quickIs = function( elem, m ) {
- var attrs = elem.attributes || {};
- return (
- (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
- (!m[2] || (attrs.id || {}).value === m[2]) &&
- (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
- );
- },
- hoverHack = function( events ) {
- return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
- };
-
-/*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
-jQuery.event = {
-
- add: function( elem, types, handler, data, selector ) {
-
- var elemData, eventHandle, events,
- t, tns, type, namespaces, handleObj,
- handleObjIn, quick, handlers, special;
-
- // Don't attach events to noData or text/comment nodes (allow plain objects tho)
- if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
- return;
- }
-
- // Caller can pass in an object of custom data in lieu of the handler
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- }
-
- // Make sure that the handler has a unique ID, used to find/remove it later
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure and main handler, if this is the first
- events = elemData.events;
- if ( !events ) {
- elemData.events = events = {};
- }
- eventHandle = elemData.handle;
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = jQuery.trim( hoverHack(types) ).split( " " );
- for ( t = 0; t < types.length; t++ ) {
-
- tns = rtypenamespace.exec( types[t] ) || [];
- type = tns[1];
- namespaces = ( tns[2] || "" ).split( "." ).sort();
-
- // If event changes its type, use the special event handlers for the changed type
- special = jQuery.event.special[ type ] || {};
-
- // If selector defined, determine special event api type, otherwise given type
- type = ( selector ? special.delegateType : special.bindType ) || type;
-
- // Update special based on newly reset type
- special = jQuery.event.special[ type ] || {};
-
- // handleObj is passed to all event handlers
- handleObj = jQuery.extend({
- type: type,
- origType: tns[1],
- data: data,
- handler: handler,
- guid: handler.guid,
- selector: selector,
- quick: quickParse( selector ),
- namespace: namespaces.join(".")
- }, handleObjIn );
-
- // Init the event handler queue if we're the first
- handlers = events[ type ];
- if ( !handlers ) {
- handlers = events[ type ] = [];
- handlers.delegateCount = 0;
-
- // Only use addEventListener/attachEvent if the special events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add to the element's handler list, delegates in front
- if ( selector ) {
- handlers.splice( handlers.delegateCount++, 0, handleObj );
- } else {
- handlers.push( handleObj );
- }
-
- // Keep track of which events have ever been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
-
- var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
- t, tns, type, origType, namespaces, origCount,
- j, events, special, handle, eventType, handleObj;
-
- if ( !elemData || !(events = elemData.events) ) {
- return;
- }
-
- // Once for each type.namespace in types; type may be omitted
- types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
- for ( t = 0; t < types.length; t++ ) {
- tns = rtypenamespace.exec( types[t] ) || [];
- type = origType = tns[1];
- namespaces = tns[2];
-
- // Unbind all events (on this namespace, if provided) for the element
- if ( !type ) {
- for ( type in events ) {
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
- }
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
- type = ( selector? special.delegateType : special.bindType ) || type;
- eventType = events[ type ] || [];
- origCount = eventType.length;
- namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
-
- // Remove matching events
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( ( mappedTypes || origType === handleObj.origType ) &&
- ( !handler || handler.guid === handleObj.guid ) &&
- ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
- eventType.splice( j--, 1 );
-
- if ( handleObj.selector ) {
- eventType.delegateCount--;
- }
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
- }
-
- // Remove generic event handler if we removed something and no more handlers exist
- // (avoids potential for endless recursion during removal of special event handlers)
- if ( eventType.length === 0 && origCount !== eventType.length ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- handle = elemData.handle;
- if ( handle ) {
- handle.elem = null;
- }
-
- // removeData also checks for emptiness and clears the expando if empty
- // so use it instead of delete
- jQuery.removeData( elem, [ "events", "handle" ], true );
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Don't do events on text and comment nodes
- if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
- return;
- }
-
- // Event object or event type
- var type = event.type || event,
- namespaces = [],
- cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
-
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
- return;
- }
-
- if ( type.indexOf( "!" ) >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf( "." ) >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.isTrigger = true;
- event.exclusive = exclusive;
- event.namespace = namespaces.join( "." );
- event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
- ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
-
- // Handle a global trigger
- if ( !elem ) {
-
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- cache = jQuery.cache;
- for ( i in cache ) {
- if ( cache[ i ].events && cache[ i ].events[ type ] ) {
- jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
- }
- }
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- if ( !event.target ) {
- event.target = elem;
- }
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- // Allow special events to draw outside the lines
- special = jQuery.event.special[ type ] || {};
- if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
- return;
- }
-
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
- eventPath = [[ elem, special.bindType || type ]];
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
- bubbleType = special.delegateType || type;
- cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
- old = null;
- for ( ; cur; cur = cur.parentNode ) {
- eventPath.push([ cur, bubbleType ]);
- old = cur;
- }
-
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
- if ( old && old === elem.ownerDocument ) {
- eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
- }
- }
-
- // Fire handlers on the event path
- for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
-
- cur = eventPath[i][0];
- event.type = eventPath[i][1];
-
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
- if ( handle ) {
- handle.apply( cur, data );
- }
- // Note that this is a bare JS function and not a jQuery handler
- handle = ontype && cur[ ontype ];
- if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
- event.preventDefault();
- }
- }
- event.type = type;
-
- // If nobody prevented the default action, do it now
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction() check here because IE6/7 fails that test.
- // Don't do default actions on window, that's where global variables be (#6170)
- // IE<9 dies on focus/blur to hidden element (#1486)
- if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
-
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- // Prevent re-triggering of the same event, since we already bubbled it above
- jQuery.event.triggered = type;
- elem[ type ]();
- jQuery.event.triggered = undefined;
-
- if ( old ) {
- elem[ ontype ] = old;
- }
- }
- }
- }
-
- return event.result;
- },
-
- dispatch: function( event ) {
-
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( event || window.event );
-
- var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
- delegateCount = handlers.delegateCount,
- args = [].slice.call( arguments, 0 ),
- run_all = !event.exclusive && !event.namespace,
- handlerQueue = [],
- i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
-
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[0] = event;
- event.delegateTarget = this;
-
- // Determine handlers that should run if there are delegated events
- // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
- if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
-
- // Pregenerate a single jQuery object for reuse with .is()
- jqcur = jQuery(this);
- jqcur.context = this.ownerDocument || this;
-
- for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
- selMatch = {};
- matches = [];
- jqcur[0] = cur;
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
- sel = handleObj.selector;
-
- if ( selMatch[ sel ] === undefined ) {
- selMatch[ sel ] = (
- handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
- );
- }
- if ( selMatch[ sel ] ) {
- matches.push( handleObj );
- }
- }
- if ( matches.length ) {
- handlerQueue.push({ elem: cur, matches: matches });
- }
- }
- }
-
- // Add the remaining (directly-bound) handlers
- if ( handlers.length > delegateCount ) {
- handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
- }
-
- // Run delegates first; they may want to stop propagation beneath us
- for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
- matched = handlerQueue[ i ];
- event.currentTarget = matched.elem;
-
- for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
- handleObj = matched.matches[ j ];
-
- // Triggered event must either 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
- if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
-
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
- .apply( matched.elem, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
- }
-
- return event.result;
- },
-
- // Includes some event props shared by KeyEvent and MouseEvent
- // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
- 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( event, original ) {
-
- // Add which for key events
- if ( event.which == null ) {
- event.which = original.charCode != null ? original.charCode : original.keyCode;
- }
-
- return event;
- }
- },
-
- mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
- filter: function( event, original ) {
- var eventDoc, doc, body,
- button = original.button,
- fromElement = original.fromElement;
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && original.clientX != null ) {
- eventDoc = event.target.ownerDocument || document;
- doc = eventDoc.documentElement;
- body = eventDoc.body;
-
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && fromElement ) {
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && button !== undefined ) {
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
- }
-
- return event;
- }
- },
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // Create a writable copy of the event object and normalize some properties
- var i, prop,
- originalEvent = event,
- fixHook = jQuery.event.fixHooks[ event.type ] || {},
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
- event = jQuery.Event( originalEvent );
-
- for ( i = copy.length; i; ) {
- prop = copy[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
- if ( !event.target ) {
- event.target = originalEvent.srcElement || document;
- }
-
- // Target should not be a text node (#504, Safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
- if ( event.metaKey === undefined ) {
- event.metaKey = event.ctrlKey;
- }
-
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
- },
-
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: jQuery.bindReady
- },
-
- load: {
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
-
- focus: {
- delegateType: "focusin"
- },
- blur: {
- delegateType: "focusout"
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- },
-
- simulate: function( type, elem, event, bubble ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- { type: type,
- isSimulated: true,
- originalEvent: {}
- }
- );
- if ( bubble ) {
- jQuery.event.trigger( e, null, elem );
- } else {
- jQuery.event.dispatch.call( elem, e );
- }
- if ( e.isDefaultPrevented() ) {
- event.preventDefault();
- }
- }
-};
-
-// Some plugins are using, but it's undocumented/deprecated and will be removed.
-// The 1.7 special event interface should provide all the hooks needed now.
-jQuery.event.handle = jQuery.event.dispatch;
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- if ( elem.detachEvent ) {
- elem.detachEvent( "on" + type, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !(this instanceof jQuery.Event) ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // Create a timestamp if incoming event doesn't have one
- this.timeStamp = src && src.timeStamp || jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- delegateType: fix,
- bindType: fix,
-
- handle: function( event ) {
- var target = this,
- related = event.relatedTarget,
- handleObj = event.handleObj,
- selector = handleObj.selector,
- ret;
-
- // For mousenter/leave call the handler if related is outside the target.
- // NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
- event.type = handleObj.origType;
- ret = handleObj.handler.apply( this, arguments );
- event.type = fix;
- }
- return ret;
- }
- };
-});
-
-// IE submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Lazy-add a submit handler when a descendant form may potentially be submitted
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
- // Node name check avoids a VML-related crash in IE (#9807)
- var elem = e.target,
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
- if ( form && !form._submit_attached ) {
- jQuery.event.add( form, "submit._submit", function( event ) {
- // If form was submitted by the user, bubble the event up the tree
- if ( this.parentNode && !event.isTrigger ) {
- jQuery.event.simulate( "submit", this.parentNode, event, true );
- }
- });
- form._submit_attached = true;
- }
- });
- // return undefined since we don't need an event listener
- },
-
- teardown: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
- jQuery.event.remove( this, "._submit" );
- }
- };
-}
-
-// IE change delegation and checkbox/radio fix
-if ( !jQuery.support.changeBubbles ) {
-
- jQuery.event.special.change = {
-
- setup: function() {
-
- if ( rformElems.test( this.nodeName ) ) {
- // IE doesn't fire change on a check/radio until blur; trigger it on click
- // after a propertychange. Eat the blur-change in special.change.handle.
- // This still fires onchange a second time for check/radio after blur.
- if ( this.type === "checkbox" || this.type === "radio" ) {
- jQuery.event.add( this, "propertychange._change", function( event ) {
- if ( event.originalEvent.propertyName === "checked" ) {
- this._just_changed = true;
- }
- });
- jQuery.event.add( this, "click._change", function( event ) {
- if ( this._just_changed && !event.isTrigger ) {
- this._just_changed = false;
- jQuery.event.simulate( "change", this, event, true );
- }
- });
- }
- return false;
- }
- // Delegated event; lazy-add a change handler on descendant inputs
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
- var elem = e.target;
-
- if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
- jQuery.event.add( elem, "change._change", function( event ) {
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
- jQuery.event.simulate( "change", this.parentNode, event, true );
- }
- });
- elem._change_attached = true;
- }
- });
- },
-
- handle: function( event ) {
- var elem = event.target;
-
- // Swallow native change events from checkbox/radio, we already triggered them above
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
- return event.handleObj.handler.apply( this, arguments );
- }
- },
-
- teardown: function() {
- jQuery.event.remove( this, "._change" );
-
- return rformElems.test( this.nodeName );
- }
- };
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0,
- handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
- };
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
- });
-}
-
-jQuery.fn.extend({
-
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
- var origFn, type;
-
- // Types can be a map of types/handlers
- if ( typeof types === "object" ) {
- // ( types-Object, selector, data )
- if ( typeof selector !== "string" ) {
- // ( types-Object, data )
- data = selector;
- selector = undefined;
- }
- for ( type in types ) {
- this.on( type, selector, data, types[ type ], one );
- }
- return this;
- }
-
- if ( data == null && fn == null ) {
- // ( types, fn )
- fn = selector;
- data = selector = undefined;
- } else if ( fn == null ) {
- if ( typeof selector === "string" ) {
- // ( types, selector, fn )
- fn = data;
- data = undefined;
- } else {
- // ( types, data, fn )
- fn = data;
- data = selector;
- selector = undefined;
- }
- }
- if ( fn === false ) {
- fn = returnFalse;
- } else if ( !fn ) {
- return this;
- }
-
- if ( one === 1 ) {
- origFn = fn;
- fn = function( event ) {
- // Can use an empty set, since event contains the info
- jQuery().off( event );
- return origFn.apply( this, arguments );
- };
- // Use same guid so caller can remove using origFn
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
- }
- return this.each( function() {
- jQuery.event.add( this, types, fn, data, selector );
- });
- },
- one: function( types, selector, data, fn ) {
- return this.on.call( this, types, selector, data, fn, 1 );
- },
- off: function( types, selector, fn ) {
- if ( types && types.preventDefault && types.handleObj ) {
- // ( event ) dispatched jQuery.Event
- var handleObj = types.handleObj;
- jQuery( types.delegateTarget ).off(
- handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
- handleObj.selector,
- handleObj.handler
- );
- return this;
- }
- if ( typeof types === "object" ) {
- // ( types-object [, selector] )
- for ( var type in types ) {
- this.off( type, selector, types[ type ] );
- }
- return this;
- }
- if ( selector === false || typeof selector === "function" ) {
- // ( types [, fn] )
- fn = selector;
- selector = undefined;
- }
- if ( fn === false ) {
- fn = returnFalse;
- }
- return this.each(function() {
- jQuery.event.remove( this, types, fn, selector );
- });
- },
-
- bind: function( types, data, fn ) {
- return this.on( types, null, data, fn );
- },
- unbind: function( types, fn ) {
- return this.off( types, null, fn );
- },
-
- live: function( types, data, fn ) {
- jQuery( this.context ).on( types, this.selector, data, fn );
- return this;
- },
- die: function( types, fn ) {
- jQuery( this.context ).off( types, this.selector || "**", fn );
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.on( types, selector, data, fn );
- },
- undelegate: function( selector, types, fn ) {
- // ( namespace ) or ( selector, types [, fn] )
- return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-jQuery.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( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.on( name, null, data, fn ) :
- this.trigger( name );
- };
-
- if ( jQuery.attrFn ) {
- jQuery.attrFn[ name ] = true;
- }
-
- if ( rkeyEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
- }
-
- if ( rmouseEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
- }
-});
-
-
-
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){
-
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- expando = "sizcache" + (Math.random() + '').replace('.', ''),
- done = 0,
- toString = Object.prototype.toString,
- hasDuplicate = false,
- baseHasDuplicate = true,
- rBackslash = /\\/g,
- rReturn = /\r\n/g,
- rNonWord = /\W/;
-
-// Here we check if the JavaScript engine is using some sort of
-// optimization where it does not always call our comparision
-// function. If that is the case, discard the hasDuplicate value.
-// Thus far that includes Google Chrome.
-[0, 0].sort(function() {
- baseHasDuplicate = false;
- return 0;
-});
-
-var Sizzle = function( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
-
- var origContext = context;
-
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
- return [];
- }
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- var m, set, checkSet, extra, ret, cur, pop, i,
- prune = true,
- contextXML = Sizzle.isXML( context ),
- parts = [],
- soFar = selector;
-
- // Reset the position of the chunker regexp (start from head)
- do {
- chunker.exec( "" );
- m = chunker.exec( soFar );
-
- if ( m ) {
- soFar = m[3];
-
- parts.push( m[1] );
-
- if ( m[2] ) {
- extra = m[3];
- break;
- }
- }
- } while ( m );
-
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
-
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- set = posProcess( parts[0] + parts[1], context, seed );
-
- } else {
- set = Expr.relative[ parts[0] ] ?
- [ context ] :
- Sizzle( parts.shift(), context );
-
- while ( parts.length ) {
- selector = parts.shift();
-
- if ( Expr.relative[ selector ] ) {
- selector += parts.shift();
- }
-
- set = posProcess( selector, set, seed );
- }
- }
-
- } else {
- // Take a shortcut and set the context if the root selector is an ID
- // (but not if it'll be faster if the inner selector is an ID)
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
-
- ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ?
- Sizzle.filter( ret.expr, ret.set )[0] :
- ret.set[0];
- }
-
- if ( context ) {
- ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
-
- set = ret.expr ?
- Sizzle.filter( ret.expr, ret.set ) :
- ret.set;
-
- if ( parts.length > 0 ) {
- checkSet = makeArray( set );
-
- } else {
- prune = false;
- }
-
- while ( parts.length ) {
- cur = parts.pop();
- pop = cur;
-
- if ( !Expr.relative[ cur ] ) {
- cur = "";
- } else {
- pop = parts.pop();
- }
-
- if ( pop == null ) {
- pop = context;
- }
-
- Expr.relative[ cur ]( checkSet, pop, contextXML );
- }
-
- } else {
- checkSet = parts = [];
- }
- }
-
- if ( !checkSet ) {
- checkSet = set;
- }
-
- if ( !checkSet ) {
- Sizzle.error( cur || selector );
- }
-
- if ( toString.call(checkSet) === "[object Array]" ) {
- if ( !prune ) {
- results.push.apply( results, checkSet );
-
- } else if ( context && context.nodeType === 1 ) {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
- results.push( set[i] );
- }
- }
-
- } else {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- results.push( set[i] );
- }
- }
- }
-
- } else {
- makeArray( checkSet, results );
- }
-
- if ( extra ) {
- Sizzle( extra, origContext, results, seed );
- Sizzle.uniqueSort( results );
- }
-
- return results;
-};
-
-Sizzle.uniqueSort = function( results ) {
- if ( sortOrder ) {
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[ i - 1 ] ) {
- results.splice( i--, 1 );
- }
- }
- }
- }
-
- return results;
-};
-
-Sizzle.matches = function( expr, set ) {
- return Sizzle( expr, null, null, set );
-};
-
-Sizzle.matchesSelector = function( node, expr ) {
- return Sizzle( expr, null, null, [node] ).length > 0;
-};
-
-Sizzle.find = function( expr, context, isXML ) {
- var set, i, len, match, type, left;
-
- if ( !expr ) {
- return [];
- }
-
- for ( i = 0, len = Expr.order.length; i < len; i++ ) {
- type = Expr.order[i];
-
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
- left = match[1];
- match.splice( 1, 1 );
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- match[1] = (match[1] || "").replace( rBackslash, "" );
- set = Expr.find[ type ]( match, context, isXML );
-
- if ( set != null ) {
- expr = expr.replace( Expr.match[ type ], "" );
- break;
- }
- }
- }
- }
-
- if ( !set ) {
- set = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( "*" ) :
- [];
- }
-
- return { set: set, expr: expr };
-};
-
-Sizzle.filter = function( expr, set, inplace, not ) {
- var match, anyFound,
- type, found, item, filter, left,
- i, pass,
- old = expr,
- result = [],
- curLoop = set,
- isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
-
- while ( expr && set.length ) {
- for ( type in Expr.filter ) {
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- filter = Expr.filter[ type ];
- left = match[1];
-
- anyFound = false;
-
- match.splice(1,1);
-
- if ( left.substr( left.length - 1 ) === "\\" ) {
- continue;
- }
-
- if ( curLoop === result ) {
- result = [];
- }
-
- if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
- if ( !match ) {
- anyFound = found = true;
-
- } else if ( match === true ) {
- continue;
- }
- }
-
- if ( match ) {
- for ( i = 0; (item = curLoop[i]) != null; i++ ) {
- if ( item ) {
- found = filter( item, match, i, curLoop );
- pass = not ^ found;
-
- if ( inplace && found != null ) {
- if ( pass ) {
- anyFound = true;
-
- } else {
- curLoop[i] = false;
- }
-
- } else if ( pass ) {
- result.push( item );
- anyFound = true;
- }
- }
- }
- }
-
- if ( found !== undefined ) {
- if ( !inplace ) {
- curLoop = result;
- }
-
- expr = expr.replace( Expr.match[ type ], "" );
-
- if ( !anyFound ) {
- return [];
- }
-
- break;
- }
- }
- }
-
- // Improper expression
- if ( expr === old ) {
- if ( anyFound == null ) {
- Sizzle.error( expr );
-
- } else {
- break;
- }
- }
-
- old = expr;
- }
-
- return curLoop;
-};
-
-Sizzle.error = function( msg ) {
- throw new Error( "Syntax error, unrecognized expression: " + msg );
-};
-
-/**
- * Utility function for retreiving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
-var getText = Sizzle.getText = function( elem ) {
- var i, node,
- nodeType = elem.nodeType,
- ret = "";
-
- if ( nodeType ) {
- if ( nodeType === 1 || nodeType === 9 ) {
- // Use textContent || innerText for elements
- if ( typeof elem.textContent === 'string' ) {
- return elem.textContent;
- } else if ( typeof elem.innerText === 'string' ) {
- // Replace IE's carriage returns
- return elem.innerText.replace( rReturn, '' );
- } else {
- // Traverse its children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
- ret += getText( elem );
- }
- }
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
- }
- } else {
-
- // If no nodeType, this is expected to be an array
- for ( i = 0; (node = elem[i]); i++ ) {
- // Do not traverse comment nodes
- if ( node.nodeType !== 8 ) {
- ret += getText( node );
- }
- }
- }
- return ret;
-};
-
-var Expr = Sizzle.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( elem ) {
- return elem.getAttribute( "href" );
- },
- type: function( elem ) {
- return elem.getAttribute( "type" );
- }
- },
-
- relative: {
- "+": function(checkSet, part){
- var isPartStr = typeof part === "string",
- isTag = isPartStr && !rNonWord.test( part ),
- isPartStrNotTag = isPartStr && !isTag;
-
- if ( isTag ) {
- part = part.toLowerCase();
- }
-
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
- if ( (elem = checkSet[i]) ) {
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
- elem || false :
- elem === part;
- }
- }
-
- if ( isPartStrNotTag ) {
- Sizzle.filter( part, checkSet, true );
- }
- },
-
- ">": function( checkSet, part ) {
- var elem,
- isPartStr = typeof part === "string",
- i = 0,
- l = checkSet.length;
-
- if ( isPartStr && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
-
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- var parent = elem.parentNode;
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
- }
- }
-
- } else {
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- checkSet[i] = isPartStr ?
- elem.parentNode :
- elem.parentNode === part;
- }
- }
-
- if ( isPartStr ) {
- Sizzle.filter( part, checkSet, true );
- }
- }
- },
-
- "": function(checkSet, part, isXML){
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
- },
-
- "~": function( checkSet, part, isXML ) {
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
- }
- },
-
- find: {
- ID: function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- },
-
- NAME: function( match, context ) {
- if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [],
- results = context.getElementsByName( match[1] );
-
- for ( var i = 0, l = results.length; i < l; i++ ) {
- if ( results[i].getAttribute("name") === match[1] ) {
- ret.push( results[i] );
- }
- }
-
- return ret.length === 0 ? null : ret;
- }
- },
-
- TAG: function( match, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( match[1] );
- }
- }
- },
- preFilter: {
- CLASS: function( match, curLoop, inplace, result, not, isXML ) {
- match = " " + match[1].replace( rBackslash, "" ) + " ";
-
- if ( isXML ) {
- return match;
- }
-
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
- if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
- if ( !inplace ) {
- result.push( elem );
- }
-
- } else if ( inplace ) {
- curLoop[i] = false;
- }
- }
- }
-
- return false;
- },
-
- ID: function( match ) {
- return match[1].replace( rBackslash, "" );
- },
-
- TAG: function( match, curLoop ) {
- return match[1].replace( rBackslash, "" ).toLowerCase();
- },
-
- CHILD: function( match ) {
- if ( match[1] === "nth" ) {
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- match[2] = match[2].replace(/^\+|\s*/g, '');
-
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
-
- // calculate the numbers (first)n+(last) including if they are negative
- match[2] = (test[1] + (test[2] || 1)) - 0;
- match[3] = test[3] - 0;
- }
- else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // TODO: Move to normal caching system
- match[0] = done++;
-
- return match;
- },
-
- ATTR: function( match, curLoop, inplace, result, not, isXML ) {
- var name = match[1] = match[1].replace( rBackslash, "" );
-
- if ( !isXML && Expr.attrMap[name] ) {
- match[1] = Expr.attrMap[name];
- }
-
- // Handle if an un-quoted value was used
- match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[4] = " " + match[4] + " ";
- }
-
- return match;
- },
-
- PSEUDO: function( match, curLoop, inplace, result, not ) {
- if ( match[1] === "not" ) {
- // If we're dealing with a complex expression, or a simple one
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
- match[3] = Sizzle(match[3], null, null, curLoop);
-
- } else {
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
-
- if ( !inplace ) {
- result.push.apply( result, ret );
- }
-
- return false;
- }
-
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
- return true;
- }
-
- return match;
- },
-
- POS: function( match ) {
- match.unshift( true );
-
- return match;
- }
- },
-
- filters: {
- enabled: function( elem ) {
- return elem.disabled === false && elem.type !== "hidden";
- },
-
- disabled: function( elem ) {
- return elem.disabled === true;
- },
-
- checked: function( elem ) {
- return elem.checked === true;
- },
-
- selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- parent: function( elem ) {
- return !!elem.firstChild;
- },
-
- empty: function( elem ) {
- return !elem.firstChild;
- },
-
- has: function( elem, i, match ) {
- return !!Sizzle( match[3], elem ).length;
- },
-
- header: function( elem ) {
- return (/h\d/i).test( elem.nodeName );
- },
-
- text: function( elem ) {
- var attr = elem.getAttribute( "type" ), type = elem.type;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
- },
-
- radio: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
- },
-
- checkbox: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
- },
-
- file: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
- },
-
- password: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
- },
-
- submit: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "submit" === elem.type;
- },
-
- image: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
- },
-
- reset: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "reset" === elem.type;
- },
-
- button: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && "button" === elem.type || name === "button";
- },
-
- input: function( elem ) {
- return (/input|select|textarea|button/i).test( elem.nodeName );
- },
-
- focus: function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- }
- },
- setFilters: {
- first: function( elem, i ) {
- return i === 0;
- },
-
- last: function( elem, i, match, array ) {
- return i === array.length - 1;
- },
-
- even: function( elem, i ) {
- return i % 2 === 0;
- },
-
- odd: function( elem, i ) {
- return i % 2 === 1;
- },
-
- lt: function( elem, i, match ) {
- return i < match[3] - 0;
- },
-
- gt: function( elem, i, match ) {
- return i > match[3] - 0;
- },
-
- nth: function( elem, i, match ) {
- return match[3] - 0 === i;
- },
-
- eq: function( elem, i, match ) {
- return match[3] - 0 === i;
- }
- },
- filter: {
- PSEUDO: function( elem, match, i, array ) {
- var name = match[1],
- filter = Expr.filters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
-
- } else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
-
- } else if ( name === "not" ) {
- var not = match[3];
-
- for ( var j = 0, l = not.length; j < l; j++ ) {
- if ( not[j] === elem ) {
- return false;
- }
- }
-
- return true;
-
- } else {
- Sizzle.error( name );
- }
- },
-
- CHILD: function( elem, match ) {
- var first, last,
- doneName, parent, cache,
- count, diff,
- type = match[1],
- node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
-
- case "nth":
- first = match[2];
- last = match[3];
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- doneName = match[0];
- parent = elem.parentNode;
-
- if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
- count = 0;
-
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- node.nodeIndex = ++count;
- }
- }
-
- parent[ expando ] = doneName;
- }
-
- diff = elem.nodeIndex - last;
-
- if ( first === 0 ) {
- return diff === 0;
-
- } else {
- return ( diff % first === 0 && diff / first >= 0 );
- }
- }
- },
-
- ID: function( elem, match ) {
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
- },
-
- TAG: function( elem, match ) {
- return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
- },
-
- CLASS: function( elem, match ) {
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
- .indexOf( match ) > -1;
- },
-
- ATTR: function( elem, match ) {
- var name = match[1],
- result = Sizzle.attr ?
- Sizzle.attr( elem, name ) :
- Expr.attrHandle[ name ] ?
- Expr.attrHandle[ name ]( elem ) :
- elem[ name ] != null ?
- elem[ name ] :
- elem.getAttribute( name ),
- value = result + "",
- type = match[2],
- check = match[4];
-
- return result == null ?
- type === "!=" :
- !type && Sizzle.attr ?
- result != null :
- type === "=" ?
- value === check :
- type === "*=" ?
- value.indexOf(check) >= 0 :
- type === "~=" ?
- (" " + value + " ").indexOf(check) >= 0 :
- !check ?
- value && result !== false :
- type === "!=" ?
- value !== check :
- type === "^=" ?
- value.indexOf(check) === 0 :
- type === "$=" ?
- value.substr(value.length - check.length) === check :
- type === "|=" ?
- value === check || value.substr(0, check.length + 1) === check + "-" :
- false;
- },
-
- POS: function( elem, match, i, array ) {
- var name = match[2],
- filter = Expr.setFilters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
- }
- }
- }
-};
-
-var origPOS = Expr.match.POS,
- fescape = function(all, num){
- return "\\" + (num - 0 + 1);
- };
-
-for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
-}
-
-var makeArray = function( array, results ) {
- array = Array.prototype.slice.call( array, 0 );
-
- if ( results ) {
- results.push.apply( results, array );
- return results;
- }
-
- return array;
-};
-
-// Perform a simple check to determine if the browser is capable of
-// converting a NodeList to an array using builtin methods.
-// Also verifies that the returned array holds DOM nodes
-// (which is not the case in the Blackberry browser)
-try {
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
-
-// Provide a fallback method if it does not work
-} catch( e ) {
- makeArray = function( array, results ) {
- var i = 0,
- ret = results || [];
-
- if ( toString.call(array) === "[object Array]" ) {
- Array.prototype.push.apply( ret, array );
-
- } else {
- if ( typeof array.length === "number" ) {
- for ( var l = array.length; i < l; i++ ) {
- ret.push( array[i] );
- }
-
- } else {
- for ( ; array[i]; i++ ) {
- ret.push( array[i] );
- }
- }
- }
-
- return ret;
- };
-}
-
-var sortOrder, siblingCheck;
-
-if ( document.documentElement.compareDocumentPosition ) {
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- return a.compareDocumentPosition ? -1 : 1;
- }
-
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
- };
-
-} else {
- sortOrder = function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
- siblingCheck = function( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
- };
-}
-
-// Check to see if the browser returns elements by name when
-// querying by getElementById (and provide a workaround)
-(function(){
- // We're going to inject a fake input element with a specified name
- var form = document.createElement("div"),
- id = "script" + (new Date()).getTime(),
- root = document.documentElement;
-
- form.innerHTML = "<a name='" + id + "'/>";
-
- // Inject it into the root element, check its status, and remove it quickly
- root.insertBefore( form, root.firstChild );
-
- // The workaround has to do additional checks after a getElementById
- // Which slows things down for other browsers (hence the branching)
- if ( document.getElementById( id ) ) {
- Expr.find.ID = function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
-
- return m ?
- m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
- [m] :
- undefined :
- [];
- }
- };
-
- Expr.filter.ID = function( elem, match ) {
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-
- return elem.nodeType === 1 && node && node.nodeValue === match;
- };
- }
-
- root.removeChild( form );
-
- // release memory in IE
- root = form = null;
-})();
-
-(function(){
- // Check to see if the browser returns only elements
- // when doing getElementsByTagName("*")
-
- // Create a fake element
- var div = document.createElement("div");
- div.appendChild( document.createComment("") );
-
- // Make sure no comments are found
- if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function( match, context ) {
- var results = context.getElementsByTagName( match[1] );
-
- // Filter out possible comments
- if ( match[1] === "*" ) {
- var tmp = [];
-
- for ( var i = 0; results[i]; i++ ) {
- if ( results[i].nodeType === 1 ) {
- tmp.push( results[i] );
- }
- }
-
- results = tmp;
- }
-
- return results;
- };
- }
-
- // Check to see if an attribute returns normalized href attributes
- div.innerHTML = "<a href='#'></a>";
-
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
- div.firstChild.getAttribute("href") !== "#" ) {
-
- Expr.attrHandle.href = function( elem ) {
- return elem.getAttribute( "href", 2 );
- };
- }
-
- // release memory in IE
- div = null;
-})();
-
-if ( document.querySelectorAll ) {
- (function(){
- var oldSizzle = Sizzle,
- div = document.createElement("div"),
- id = "__sizzle__";
-
- div.innerHTML = "<p class='TEST'></p>";
-
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
-
- Sizzle = function( query, context, extra, seed ) {
- context = context || document;
-
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && !Sizzle.isXML(context) ) {
- // See if we find a selector to speed up
- var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
-
- if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
- // Speed-up: Sizzle("TAG")
- if ( match[1] ) {
- return makeArray( context.getElementsByTagName( query ), extra );
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
- return makeArray( context.getElementsByClassName( match[2] ), extra );
- }
- }
-
- if ( context.nodeType === 9 ) {
- // Speed-up: Sizzle("body")
- // The body element only exists once, optimize finding it
- if ( query === "body" && context.body ) {
- return makeArray( [ context.body ], extra );
-
- // Speed-up: Sizzle("#ID")
- } else if ( match && match[3] ) {
- var elem = context.getElementById( match[3] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id === match[3] ) {
- return makeArray( [ elem ], extra );
- }
-
- } else {
- return makeArray( [], extra );
- }
- }
-
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(qsaError) {}
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- var oldContext = context,
- old = context.getAttribute( "id" ),
- nid = old || id,
- hasParent = context.parentNode,
- relativeHierarchySelector = /^\s*[+~]/.test( query );
-
- if ( !old ) {
- context.setAttribute( "id", nid );
- } else {
- nid = nid.replace( /'/g, "\\$&" );
- }
- if ( relativeHierarchySelector && hasParent ) {
- context = context.parentNode;
- }
-
- try {
- if ( !relativeHierarchySelector || hasParent ) {
- return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
- }
-
- } catch(pseudoError) {
- } finally {
- if ( !old ) {
- oldContext.removeAttribute( "id" );
- }
- }
- }
- }
-
- return oldSizzle(query, context, extra, seed);
- };
-
- for ( var prop in oldSizzle ) {
- Sizzle[ prop ] = oldSizzle[ prop ];
- }
-
- // release memory in IE
- div = null;
- })();
-}
-
-(function(){
- var html = document.documentElement,
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
-
- if ( matches ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9 fails this)
- var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
- pseudoWorks = false;
-
- try {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( document.documentElement, "[test!='']:sizzle" );
-
- } catch( pseudoError ) {
- pseudoWorks = true;
- }
-
- Sizzle.matchesSelector = function( node, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
-
- if ( !Sizzle.isXML( node ) ) {
- try {
- if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
- var ret = matches.call( node, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || !disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9, so check for that
- node.document && node.document.nodeType !== 11 ) {
- return ret;
- }
- }
- } catch(e) {}
- }
-
- return Sizzle(expr, null, null, [node]).length > 0;
- };
- }
-})();
-
-(function(){
- var div = document.createElement("div");
-
- div.innerHTML = "<div class='test e'></div><div class='test'></div>";
-
- // Opera can't find a second classname (in 9.6)
- // Also, make sure that getElementsByClassName actually exists
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
- return;
- }
-
- // Safari caches class attributes, doesn't catch changes (in 3.2)
- div.lastChild.className = "e";
-
- if ( div.getElementsByClassName("e").length === 1 ) {
- return;
- }
-
- Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function( match, context, isXML ) {
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
- return context.getElementsByClassName(match[1]);
- }
- };
-
- // release memory in IE
- div = null;
-})();
-
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem[ expando ] === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 && !isXML ){
- elem[ expando ] = doneName;
- elem.sizset = i;
- }
-
- if ( elem.nodeName.toLowerCase() === cur ) {
- match = elem;
- break;
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem[ expando ] === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 ) {
- if ( !isXML ) {
- elem[ expando ] = doneName;
- elem.sizset = i;
- }
-
- if ( typeof cur !== "string" ) {
- if ( elem === cur ) {
- match = true;
- break;
- }
-
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
- match = elem;
- break;
- }
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-if ( document.documentElement.contains ) {
- Sizzle.contains = function( a, b ) {
- return a !== b && (a.contains ? a.contains(b) : true);
- };
-
-} else if ( document.documentElement.compareDocumentPosition ) {
- Sizzle.contains = function( a, b ) {
- return !!(a.compareDocumentPosition(b) & 16);
- };
-
-} else {
- Sizzle.contains = function() {
- return false;
- };
-}
-
-Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
-
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-var posProcess = function( selector, context, seed ) {
- var match,
- tmpSet = [],
- later = "",
- root = context.nodeType ? [context] : context;
-
- // Position selectors must be done after the filter
- // And so must :not(positional) so we move all PSEUDOs to the end
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.PSEUDO, "" );
- }
-
- selector = Expr.relative[selector] ? selector + "*" : selector;
-
- for ( var i = 0, l = root.length; i < l; i++ ) {
- Sizzle( selector, root[i], tmpSet, seed );
- }
-
- return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-// Override sizzle attribute retrieval
-Sizzle.attr = jQuery.attr;
-Sizzle.selectors.attrMap = {};
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.filters;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})();
-
-
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prevUntil|prevAll)/,
- // Note: This RegExp should be improved, or likely pulled from Sizzle
- rmultiselector = /,/,
- isSimple = /^.[^:#\[\.,]*$/,
- slice = Array.prototype.slice,
- POS = jQuery.expr.match.POS,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var self = this,
- i, l;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- var ret = this.pushStack( "", "find", selector ),
- length, n, r;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && (
- typeof selector === "string" ?
- // If this is a positional selector, check membership in the returned set
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
- POS.test( selector ) ?
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
-
- // Array (deprecated as of jQuery 1.7)
- if ( jQuery.isArray( selectors ) ) {
- var level = 1;
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( i = 0; i < selectors.length; i++ ) {
-
- if ( jQuery( cur ).is( selectors[ i ] ) ) {
- ret.push({ selector: selectors[ i ], elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
-
- return ret;
- }
-
- // String
- var pos = POS.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- cur = this[i];
-
- while ( cur ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
-
- } else {
- cur = cur.parentNode;
- if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
- break;
- }
- }
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
-
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
- }
-
- // index in selector
- if ( typeof elem === "string" ) {
- return jQuery.inArray( this[0], jQuery( elem ) );
- }
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- }
-});
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
- },
- prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( elem.parentNode.firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.makeArray( elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until );
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, slice.call( arguments ).join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
- break;
- }
- }
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return ( elem === qualifier ) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
- });
-}
-
-
-
-
-function createSafeFragment( document ) {
- var list = nodeNames.split( "|" ),
- safeFrag = document.createDocumentFragment();
-
- if ( safeFrag.createElement ) {
- while ( list.length ) {
- safeFrag.createElement(
- list.pop()
- );
- }
- }
- return safeFrag;
-}
-
-var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" +
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
- rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
- rtagName = /<([\w:]+)/,
- rtbody = /<tbody/i,
- rhtml = /<|&#?\w+;/,
- rnoInnerhtml = /<(?:script|style)/i,
- rnocache = /<(?:script|object|embed|option|style)/i,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"),
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptType = /\/(java|ecma)script/i,
- rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
- wrapMap = {
- 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, "", "" ]
- },
- safeFragment = createSafeFragment( document );
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE can't serialize <link> and <script> tags normally
-if ( !jQuery.support.htmlSerialize ) {
- wrapMap._default = [ 1, "div<div>", "</div>" ];
-}
-
-jQuery.fn.extend({
- text: function( text ) {
- if ( jQuery.isFunction(text) ) {
- return this.each(function(i) {
- var self = jQuery( this );
-
- self.text( text.call(this, i, self.text()) );
- });
- }
-
- if ( typeof text !== "object" && text !== undefined ) {
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
- }
-
- return jQuery.text( this );
- },
-
- wrapAll: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
- }
-
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
-
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
- }
-
- wrap.map(function() {
- var elem = this;
-
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
- elem = elem.firstChild;
- }
-
- return elem;
- }).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
- }
-
- return this.each(function() {
- var self = jQuery( this ),
- contents = self.contents();
-
- if ( contents.length ) {
- contents.wrapAll( html );
-
- } else {
- self.append( html );
- }
- });
- },
-
- wrap: function( html ) {
- var isFunction = jQuery.isFunction( html );
-
- return this.each(function(i) {
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
- });
- },
-
- unwrap: function() {
- return this.parent().each(function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- }).end();
- },
-
- append: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.appendChild( elem );
- }
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.insertBefore( elem, this.firstChild );
- }
- });
- },
-
- before: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this );
- });
- } else if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- set.push.apply( set, this.toArray() );
- return this.pushStack( set, "before", arguments );
- }
- },
-
- after: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- } else if ( arguments.length ) {
- var set = this.pushStack( this, "after", arguments );
- set.push.apply( set, jQuery.clean(arguments) );
- return set;
- }
- },
-
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
- if ( !keepData && elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- jQuery.cleanData( [ elem ] );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- }
- }
-
- return this;
- },
-
- empty: function() {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- return this;
- },
-
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
-
- return this.map( function () {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
- },
-
- html: function( value ) {
- if ( value === undefined ) {
- return this[0] && this[0].nodeType === 1 ?
- this[0].innerHTML.replace(rinlinejQuery, "") :
- null;
-
- // See if we can take a shortcut and just use innerHTML
- } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
- !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
-
- value = value.replace(rxhtmlTag, "<$1></$2>");
-
- try {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( this[i].nodeType === 1 ) {
- jQuery.cleanData( this[i].getElementsByTagName("*") );
- this[i].innerHTML = value;
- }
- }
-
- // If using innerHTML throws an exception, use the fallback method
- } catch(e) {
- this.empty().append( value );
- }
-
- } else if ( jQuery.isFunction( value ) ) {
- this.each(function(i){
- var self = jQuery( this );
-
- self.html( value.call(this, i, self.html()) );
- });
-
- } else {
- this.empty().append( value );
- }
-
- return this;
- },
-
- replaceWith: function( value ) {
- if ( this[0] && this[0].parentNode ) {
- // Make sure that the elements are removed from the DOM before they are inserted
- // this can help fix replacing a parent with child elements
- if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
- });
- }
-
- if ( typeof value !== "string" ) {
- value = jQuery( value ).detach();
- }
-
- return this.each(function() {
- var next = this.nextSibling,
- parent = this.parentNode;
-
- jQuery( this ).remove();
-
- if ( next ) {
- jQuery(next).before( value );
- } else {
- jQuery(parent).append( value );
- }
- });
- } else {
- return this.length ?
- this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
- this;
- }
- },
-
- detach: function( selector ) {
- return this.remove( selector, true );
- },
-
- domManip: function( args, table, callback ) {
- var results, first, fragment, parent,
- value = args[0],
- scripts = [];
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
- return this.each(function() {
- jQuery(this).domManip( args, table, callback, true );
- });
- }
-
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- args[0] = value.call(this, i, table ? self.html() : undefined);
- self.domManip( args, table, callback );
- });
- }
-
- if ( this[0] ) {
- parent = value && value.parentNode;
-
- // If we're in a fragment, just use that instead of building a new one
- if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
- results = { fragment: parent };
-
- } else {
- results = jQuery.buildFragment( args, this, scripts );
- }
-
- fragment = results.fragment;
-
- if ( fragment.childNodes.length === 1 ) {
- first = fragment = fragment.firstChild;
- } else {
- first = fragment.firstChild;
- }
-
- if ( first ) {
- table = table && jQuery.nodeName( first, "tr" );
-
- for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
- callback.call(
- table ?
- root(this[i], first) :
- this[i],
- // Make sure that we do not leak memory by inadvertently discarding
- // the original fragment (which might have attached data) instead of
- // using it; in addition, use the original fragment object for the last
- // item instead of first because it can end up being emptied incorrectly
- // in certain situations (Bug #8070).
- // Fragments from the fragment cache must always be cloned and never used
- // in place.
- results.cacheable || ( l > 1 && i < lastIndex ) ?
- jQuery.clone( fragment, true, true ) :
- fragment
- );
- }
- }
-
- if ( scripts.length ) {
- jQuery.each( scripts, evalScript );
- }
- }
-
- return this;
- }
-});
-
-function root( elem, cur ) {
- return jQuery.nodeName(elem, "table") ?
- (elem.getElementsByTagName("tbody")[0] ||
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
- elem;
-}
-
-function cloneCopyEvent( src, dest ) {
-
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
- return;
- }
-
- var type, i, l,
- oldData = jQuery._data( src ),
- curData = jQuery._data( dest, oldData ),
- events = oldData.events;
-
- if ( events ) {
- delete curData.handle;
- curData.events = {};
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
- }
- }
- }
-
- // make the cloned public data object a copy from the original
- if ( curData.data ) {
- curData.data = jQuery.extend( {}, curData.data );
- }
-}
-
-function cloneFixAttributes( src, dest ) {
- var nodeName;
-
- // We do not need to do anything for non-Elements
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // clearAttributes removes the attributes, which we don't want,
- // but also removes the attachEvent events, which we *do* want
- if ( dest.clearAttributes ) {
- dest.clearAttributes();
- }
-
- // mergeAttributes, in contrast, only merges back on the
- // original attributes, not the events
- if ( dest.mergeAttributes ) {
- dest.mergeAttributes( src );
- }
-
- nodeName = dest.nodeName.toLowerCase();
-
- // IE6-8 fail to clone children inside object elements that use
- // the proprietary classid attribute value (rather than the type
- // attribute) to identify the type of content to display
- if ( nodeName === "object" ) {
- dest.outerHTML = src.outerHTML;
-
- } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
- // IE6-8 fails to persist the checked state of a cloned checkbox
- // or radio button. Worse, IE6-7 fail to give the cloned element
- // a checked appearance if the defaultChecked value isn't also set
- if ( src.checked ) {
- dest.defaultChecked = dest.checked = src.checked;
- }
-
- // IE6-7 get confused and end up setting the value of a cloned
- // checkbox/radio button to an empty string instead of "on"
- if ( dest.value !== src.value ) {
- dest.value = src.value;
- }
-
- // IE6-8 fails to return the selected option to the default selected
- // state when cloning options
- } else if ( nodeName === "option" ) {
- dest.selected = src.defaultSelected;
-
- // IE6-8 fails to set the defaultValue to the correct value when
- // cloning other types of input fields
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
- }
-
- // Event data gets referenced instead of copied if the expando
- // gets copied too
- dest.removeAttribute( jQuery.expando );
-}
-
-jQuery.buildFragment = function( args, nodes, scripts ) {
- var fragment, cacheable, cacheresults, doc,
- first = args[ 0 ];
-
- // nodes may contain either an explicit document object,
- // a jQuery collection or context object.
- // If nodes[0] contains a valid object to assign to doc
- if ( nodes && nodes[0] ) {
- doc = nodes[0].ownerDocument || nodes[0];
- }
-
- // Ensure that an attr object doesn't incorrectly stand in as a document object
- // Chrome and Firefox seem to allow this to occur and will throw exception
- // Fixes #8950
- if ( !doc.createDocumentFragment ) {
- doc = document;
- }
-
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
- if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
- first.charAt(0) === "<" && !rnocache.test( first ) &&
- (jQuery.support.checkClone || !rchecked.test( first )) &&
- (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
-
- cacheable = true;
-
- cacheresults = jQuery.fragments[ first ];
- if ( cacheresults && cacheresults !== 1 ) {
- fragment = cacheresults;
- }
- }
-
- if ( !fragment ) {
- fragment = doc.createDocumentFragment();
- jQuery.clean( args, doc, fragment, scripts );
- }
-
- if ( cacheable ) {
- jQuery.fragments[ first ] = cacheresults ? fragment : 1;
- }
-
- return { fragment: fragment, cacheable: cacheable };
-};
-
-jQuery.fragments = {};
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var ret = [],
- insert = jQuery( selector ),
- parent = this.length === 1 && this[0].parentNode;
-
- if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
- insert[ original ]( this[0] );
- return this;
-
- } else {
- for ( var i = 0, l = insert.length; i < l; i++ ) {
- var elems = ( i > 0 ? this.clone(true) : this ).get();
- jQuery( insert[i] )[ original ]( elems );
- ret = ret.concat( elems );
- }
-
- return this.pushStack( ret, name, insert.selector );
- }
- };
-});
-
-function getAll( elem ) {
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- return elem.getElementsByTagName( "*" );
-
- } else if ( typeof elem.querySelectorAll !== "undefined" ) {
- return elem.querySelectorAll( "*" );
-
- } else {
- return [];
- }
-}
-
-// Used in clean, fixes the defaultChecked property
-function fixDefaultChecked( elem ) {
- if ( elem.type === "checkbox" || elem.type === "radio" ) {
- elem.defaultChecked = elem.checked;
- }
-}
-// Finds all inputs and passes them to fixDefaultChecked
-function findInputs( elem ) {
- var nodeName = ( elem.nodeName || "" ).toLowerCase();
- if ( nodeName === "input" ) {
- fixDefaultChecked( elem );
- // Skip scripts, get other children
- } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
- jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
- }
-}
-
-// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
-function shimCloneNode( elem ) {
- var div = document.createElement( "div" );
- safeFragment.appendChild( div );
-
- div.innerHTML = elem.outerHTML;
- return div.firstChild;
-}
-
-jQuery.extend({
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var srcElements,
- destElements,
- i,
- // IE<=8 does not properly clone detached, unknown element nodes
- clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ?
- elem.cloneNode( true ) :
- shimCloneNode( elem );
-
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
- // IE copies events bound via attachEvent when using cloneNode.
- // Calling detachEvent on the clone will also remove the events
- // from the original. In order to get around this, we use some
- // proprietary methods to clear the events. Thanks to MooTools
- // guys for this hotness.
-
- cloneFixAttributes( elem, clone );
-
- // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- // Weird iteration because IE will replace the length property
- // with an element if you are cloning the body and one of the
- // elements on the page has a name or id of "length"
- for ( i = 0; srcElements[i]; ++i ) {
- // Ensure that the destination node is not null; Fixes #9587
- if ( destElements[i] ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
- }
- }
- }
-
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- cloneCopyEvent( elem, clone );
-
- if ( deepDataAndEvents ) {
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- for ( i = 0; srcElements[i]; ++i ) {
- cloneCopyEvent( srcElements[i], destElements[i] );
- }
- }
- }
-
- srcElements = destElements = null;
-
- // Return the cloned set
- return clone;
- },
-
- clean: function( elems, context, fragment, scripts ) {
- var checkScriptType;
-
- context = context || document;
-
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if ( typeof context.createElement === "undefined" ) {
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
- }
-
- var ret = [], j;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( typeof elem === "number" ) {
- elem += "";
- }
-
- if ( !elem ) {
- continue;
- }
-
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- if ( !rhtml.test( elem ) ) {
- elem = context.createTextNode( elem );
- } else {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
-
- // Trim whitespace, otherwise indexOf won't work as expected
- var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
- wrap = wrapMap[ tag ] || wrapMap._default,
- depth = wrap[0],
- div = context.createElement("div");
-
- // Append wrapper element to unknown element safe doc fragment
- if ( context === document ) {
- // Use the fragment we've already created for this document
- safeFragment.appendChild( div );
- } else {
- // Use a fragment created with the owner document
- createSafeFragment( context ).appendChild( div );
- }
-
- // Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( depth-- ) {
- div = div.lastChild;
- }
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
-
- // String was a <table>, *may* have spurious <tbody>
- var hasBody = rtbody.test(elem),
- tbody = tag === "table" && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !hasBody ?
- div.childNodes :
- [];
-
- for ( j = tbody.length - 1; j >= 0 ; --j ) {
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
- }
- }
- }
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
- }
-
- elem = div.childNodes;
- }
- }
-
- // Resets defaultChecked for any radios and checkboxes
- // about to be appended to the DOM in IE 6/7 (#8060)
- var len;
- if ( !jQuery.support.appendChecked ) {
- if ( elem[0] && typeof (len = elem.length) === "number" ) {
- for ( j = 0; j < len; j++ ) {
- findInputs( elem[j] );
- }
- } else {
- findInputs( elem );
- }
- }
-
- if ( elem.nodeType ) {
- ret.push( elem );
- } else {
- ret = jQuery.merge( ret, elem );
- }
- }
-
- if ( fragment ) {
- checkScriptType = function( elem ) {
- return !elem.type || rscriptType.test( elem.type );
- };
- for ( i = 0; ret[i]; i++ ) {
- if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
- scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
-
- } else {
- if ( ret[i].nodeType === 1 ) {
- var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
-
- ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
- }
- fragment.appendChild( ret[i] );
- }
- }
- }
-
- return ret;
- },
-
- cleanData: function( elems ) {
- var data, id,
- cache = jQuery.cache,
- special = jQuery.event.special,
- deleteExpando = jQuery.support.deleteExpando;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
- continue;
- }
-
- id = elem[ jQuery.expando ];
-
- if ( id ) {
- data = cache[ id ];
-
- if ( data && data.events ) {
- for ( var type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
-
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
-
- // Null the DOM reference to avoid IE6/7/8 leak (#7054)
- if ( data.handle ) {
- data.handle.elem = null;
- }
- }
-
- if ( deleteExpando ) {
- delete elem[ jQuery.expando ];
-
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- }
-
- delete cache[ id ];
- }
- }
- }
-});
-
-function evalScript( i, elem ) {
- if ( elem.src ) {
- jQuery.ajax({
- url: elem.src,
- async: false,
- dataType: "script"
- });
- } else {
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
-}
-
-
-
-
-var ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity=([^)]*)/,
- // fixed for IE9, see #8346
- rupper = /([A-Z]|^ms)/g,
- rnumpx = /^-?\d+(?:px)?$/i,
- rnum = /^-?\d/,
- rrelNum = /^([\-+])=([\-+.\de]+)/,
-
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssWidth = [ "Left", "Right" ],
- cssHeight = [ "Top", "Bottom" ],
- curCSS,
-
- getComputedStyle,
- currentStyle;
-
-jQuery.fn.css = function( name, value ) {
- // Setting 'undefined' is a no-op
- if ( arguments.length === 2 && value === undefined ) {
- return this;
- }
-
- return jQuery.access( this, name, value, true, function( elem, name, value ) {
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- });
-};
-
-jQuery.extend({
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity", "opacity" );
- return ret === "" ? "1" : ret;
-
- } else {
- return elem.style.opacity;
- }
- }
- }
- },
-
- // Exclude the following css properties to add px
- cssNumber: {
- "fillOpacity": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
-
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- // normalize float css property
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
- },
-
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
-
- // Make sure that we're working with the right name
- var ret, type, origName = jQuery.camelCase( name ),
- style = elem.style, hooks = jQuery.cssHooks[ origName ];
-
- name = jQuery.cssProps[ origName ] || origName;
-
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
-
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
- // Fixes bug #9237
- type = "number";
- }
-
- // Make sure that NaN and null values aren't set. See: #7116
- if ( value == null || type === "number" && isNaN( value ) ) {
- return;
- }
-
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
- }
-
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
- // Fixes bug #5509
- try {
- style[ name ] = value;
- } catch(e) {}
- }
-
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
- return ret;
- }
-
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
-
- css: function( elem, name, extra ) {
- var ret, hooks;
-
- // Make sure that we're working with the right name
- name = jQuery.camelCase( name );
- hooks = jQuery.cssHooks[ name ];
- name = jQuery.cssProps[ name ] || name;
-
- // cssFloat needs a special treatment
- if ( name === "cssFloat" ) {
- name = "float";
- }
-
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
- return ret;
-
- // Otherwise, if a way to get the computed value exists, use that
- } else if ( curCSS ) {
- return curCSS( elem, name );
- }
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
-
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- callback.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
- }
-});
-
-// DEPRECATED, Use jQuery.css() instead
-jQuery.curCSS = jQuery.css;
-
-jQuery.each(["height", "width"], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- var val;
-
- if ( computed ) {
- if ( elem.offsetWidth !== 0 ) {
- return getWH( elem, name, extra );
- } else {
- jQuery.swap( elem, cssShow, function() {
- val = getWH( elem, name, extra );
- });
- }
-
- return val;
- }
- },
-
- set: function( elem, value ) {
- if ( rnumpx.test( value ) ) {
- // ignore negative width and height values #1599
- value = parseFloat( value );
-
- if ( value >= 0 ) {
- return value + "px";
- }
-
- } else {
- return value;
- }
- }
- };
-});
-
-if ( !jQuery.support.opacity ) {
- jQuery.cssHooks.opacity = {
- get: function( elem, computed ) {
- // IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
- ( parseFloat( RegExp.$1 ) / 100 ) + "" :
- computed ? "1" : "";
- },
-
- set: function( elem, value ) {
- var style = elem.style,
- currentStyle = elem.currentStyle,
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
- filter = currentStyle && currentStyle.filter || style.filter || "";
-
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
-
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
- if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
-
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
- // style.removeAttribute is IE Only, but so apparently is this code path...
- style.removeAttribute( "filter" );
-
- // if there there is no filter style applied in a css rule, we are done
- if ( currentStyle && !currentStyle.filter ) {
- return;
- }
- }
-
- // otherwise, set new filter values
- style.filter = ralpha.test( filter ) ?
- filter.replace( ralpha, opacity ) :
- filter + " " + opacity;
- }
- };
-}
-
-jQuery(function() {
- // This hook cannot be added until DOM ready because the support test
- // for it is not run until after DOM ready
- if ( !jQuery.support.reliableMarginRight ) {
- jQuery.cssHooks.marginRight = {
- get: function( elem, computed ) {
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // Work around by temporarily setting element display to inline-block
- var ret;
- jQuery.swap( elem, { "display": "inline-block" }, function() {
- if ( computed ) {
- ret = curCSS( elem, "margin-right", "marginRight" );
- } else {
- ret = elem.style.marginRight;
- }
- });
- return ret;
- }
- };
- }
-});
-
-if ( document.defaultView && document.defaultView.getComputedStyle ) {
- getComputedStyle = function( elem, name ) {
- var ret, defaultView, computedStyle;
-
- name = name.replace( rupper, "-$1" ).toLowerCase();
-
- if ( (defaultView = elem.ownerDocument.defaultView) &&
- (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
- ret = computedStyle.getPropertyValue( name );
- if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
- ret = jQuery.style( elem, name );
- }
- }
-
- return ret;
- };
-}
-
-if ( document.documentElement.currentStyle ) {
- currentStyle = function( elem, name ) {
- var left, rsLeft, uncomputed,
- ret = elem.currentStyle && elem.currentStyle[ name ],
- style = elem.style;
-
- // Avoid setting ret to empty string here
- // so we don't default to auto
- if ( ret === null && style && (uncomputed = style[ name ]) ) {
- ret = uncomputed;
- }
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
-
- // Remember the original values
- left = style.left;
- rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- if ( rsLeft ) {
- elem.runtimeStyle.left = elem.currentStyle.left;
- }
- style.left = name === "fontSize" ? "1em" : ( ret || 0 );
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- if ( rsLeft ) {
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret === "" ? "auto" : ret;
- };
-}
-
-curCSS = getComputedStyle || currentStyle;
-
-function getWH( elem, name, extra ) {
-
- // Start with offset property
- var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- which = name === "width" ? cssWidth : cssHeight,
- i = 0,
- len = which.length;
-
- if ( val > 0 ) {
- if ( extra !== "border" ) {
- for ( ; i < len; i++ ) {
- if ( !extra ) {
- val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
- } else {
- val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
- }
- }
- }
-
- return val + "px";
- }
-
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name, name );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ] || 0;
- }
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
-
- // Add padding, border, margin
- if ( extra ) {
- for ( ; i < len; i++ ) {
- val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
- if ( extra !== "padding" ) {
- val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
- }
- }
- }
-
- return val + "px";
-}
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.hidden = function( elem ) {
- var width = elem.offsetWidth,
- height = elem.offsetHeight;
-
- return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
- };
-
- jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
- };
-}
-
-
-
-
-var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rhash = /#.*$/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- rquery = /\?/,
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
- rselectTextarea = /^(?:select|textarea)/i,
- rspacesAjax = /\s+/,
- rts = /([?&])_=[^&]*/,
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
-
- // Keep a copy of the old load method
- _load = jQuery.fn.load,
-
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
-
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
-
- // Document location
- ajaxLocation,
-
- // Document location segments
- ajaxLocParts,
-
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = ["*/"] + ["*"];
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
- ajaxLocation = location.href;
-} catch( e ) {
- // Use the href attribute of an A element
- // since IE will modify it given document.location
- ajaxLocation = document.createElement( "a" );
- ajaxLocation.href = "";
- ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
-function addToPrefiltersOrTransports( structure ) {
-
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
-
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
-
- if ( jQuery.isFunction( func ) ) {
- var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
- i = 0,
- length = dataTypes.length,
- dataType,
- list,
- placeBefore;
-
- // For each dataType in the dataTypeExpression
- for ( ; i < length; i++ ) {
- dataType = dataTypes[ i ];
- // We control if we're asked to add before
- // any existing element
- placeBefore = /^\+/.test( dataType );
- if ( placeBefore ) {
- dataType = dataType.substr( 1 ) || "*";
- }
- list = structure[ dataType ] = structure[ dataType ] || [];
- // then we add to the structure accordingly
- list[ placeBefore ? "unshift" : "push" ]( func );
- }
- }
- };
-}
-
-// Base inspection function for prefilters and transports
-function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
- dataType /* internal */, inspected /* internal */ ) {
-
- dataType = dataType || options.dataTypes[ 0 ];
- inspected = inspected || {};
-
- inspected[ dataType ] = true;
-
- var list = structure[ dataType ],
- i = 0,
- length = list ? list.length : 0,
- executeOnly = ( structure === prefilters ),
- selection;
-
- for ( ; i < length && ( executeOnly || !selection ); i++ ) {
- selection = list[ i ]( options, originalOptions, jqXHR );
- // If we got redirected to another dataType
- // we try there if executing only and not done already
- if ( typeof selection === "string" ) {
- if ( !executeOnly || inspected[ selection ] ) {
- selection = undefined;
- } else {
- options.dataTypes.unshift( selection );
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, selection, inspected );
- }
- }
- }
- // If we're only executing or nothing was selected
- // we try the catchall dataType if not done already
- if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, "*", inspected );
- }
- // unnecessary when only executing (prefilters)
- // but it'll be ignored by the caller in that case
- return selection;
-}
-
-// A special extend for ajax options
-// that takes "flat" options (not to be deep extended)
-// Fixes #9887
-function ajaxExtend( target, src ) {
- var key, deep,
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
- for ( key in src ) {
- if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
- }
- }
- if ( deep ) {
- jQuery.extend( true, target, deep );
- }
-}
-
-jQuery.fn.extend({
- load: function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
-
- // Don't do a request if no elements are being requested
- } else if ( !this.length ) {
- return this;
- }
-
- var off = url.indexOf( " " );
- if ( off >= 0 ) {
- var selector = url.slice( off, url.length );
- url = url.slice( 0, off );
- }
-
- // Default to a GET request
- var type = "GET";
-
- // If the second parameter was provided
- if ( params ) {
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
- // We assume that it's the callback
- callback = params;
- params = undefined;
-
- // Otherwise, build a param string
- } else if ( typeof params === "object" ) {
- params = jQuery.param( params, jQuery.ajaxSettings.traditional );
- type = "POST";
- }
- }
-
- var self = this;
-
- // Request the remote document
- jQuery.ajax({
- url: url,
- type: type,
- dataType: "html",
- data: params,
- // Complete callback (responseText is used internally)
- complete: function( jqXHR, status, responseText ) {
- // Store the response as specified by the jqXHR object
- responseText = jqXHR.responseText;
- // If successful, inject the HTML into all the matched elements
- if ( jqXHR.isResolved() ) {
- // #4825: Get the actual response in case
- // a dataFilter is present in ajaxSettings
- jqXHR.done(function( r ) {
- responseText = r;
- });
- // See if a selector was specified
- self.html( selector ?
- // Create a dummy div to hold the results
- jQuery("<div>")
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append(responseText.replace(rscript, ""))
-
- // Locate the specified elements
- .find(selector) :
-
- // If not, just inject the full result
- responseText );
- }
-
- if ( callback ) {
- self.each( callback, [ responseText, status, jqXHR ] );
- }
- }
- });
-
- return this;
- },
-
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
-
- serializeArray: function() {
- return this.map(function(){
- return this.elements ? jQuery.makeArray( this.elements ) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- ( this.checked || rselectTextarea.test( this.nodeName ) ||
- rinput.test( this.type ) );
- })
- .map(function( i, elem ){
- var val = jQuery( this ).val();
-
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val, i ){
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
- }
-});
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
- jQuery.fn[ o ] = function( f ){
- return this.on( o, f );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- type: method,
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- };
-});
-
-jQuery.extend({
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- if ( settings ) {
- // Building a settings object
- ajaxExtend( target, jQuery.ajaxSettings );
- } else {
- // Extending ajaxSettings
- settings = target;
- target = jQuery.ajaxSettings;
- }
- ajaxExtend( target, settings );
- return target;
- },
-
- ajaxSettings: {
- url: ajaxLocation,
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- type: "GET",
- contentType: "application/x-www-form-urlencoded",
- processData: true,
- async: true,
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- text: "text/plain",
- json: "application/json, text/javascript",
- "*": allTypes
- },
-
- contents: {
- xml: /xml/,
- html: /html/,
- json: /json/
- },
-
- responseFields: {
- xml: "responseXML",
- text: "responseText"
- },
-
- // List of data converters
- // 1) key format is "source_type destination_type" (a single space in-between)
- // 2) the catchall symbol "*" can be used for source_type
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
-
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- context: true,
- url: true
- }
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events
- // It's the callbackContext if one was provided in the options
- // and if it's a DOM node or a jQuery collection
- globalEventContext = callbackContext !== s &&
- ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
- jQuery( callbackContext ) : jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks( "once memory" ),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // ifModified key
- ifModifiedKey,
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // Response headers
- responseHeadersString,
- responseHeaders,
- // transport
- transport,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // The jqXHR state
- state = 0,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Fake xhr
- jqXHR = {
-
- readyState: 0,
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( !state ) {
- var lname = name.toLowerCase();
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match === undefined ? null : match;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- statusText = statusText || "abort";
- if ( transport ) {
- transport.abort( statusText );
- }
- done( 0, statusText );
- return this;
- },
-
- url : s.url,
- data : s.data
- };
-
- // Callback for when everything is done
- // It is defined here because jslint complains if it is declared
- // at the end of the function (which would be more logical and readable)
- function done( status, nativeStatusText, responses, headers ) {
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
-
- var isSuccess,
- success,
- error,
- statusText = nativeStatusText,
- response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
- lastModified,
- etag;
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
-
- if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
- jQuery.lastModified[ ifModifiedKey ] = lastModified;
- }
- if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
- jQuery.etag[ ifModifiedKey ] = etag;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
-
- statusText = "notmodified";
- isSuccess = true;
-
- // If we have data
- } else {
-
- try {
- success = ajaxConvert( s, response );
- statusText = "success";
- isSuccess = true;
- } catch(e) {
- // We have a parsererror
- statusText = "parsererror";
- error = e;
- }
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if ( !statusText || status ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = "" + ( nativeStatusText || statusText );
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
-
- // Attach deferreds
- deferred.promise( jqXHR );
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- jqXHR.complete = completeDeferred.add;
-
- // Status-dependent callbacks
- jqXHR.statusCode = function( map ) {
- if ( map ) {
- var tmp;
- if ( state < 2 ) {
- for ( tmp in map ) {
- statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
- }
- } else {
- tmp = map[ jqXHR.status ];
- jqXHR.then( tmp, tmp );
- }
- }
- return this;
- };
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // We also use the url parameter if available
- s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
-
- // Determine if a cross-domain request is in order
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefiler, stop there
- if ( state === 2 ) {
- return false;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Get ifModifiedKey before adding the anti-cache parameter
- ifModifiedKey = s.url;
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
-
- var ts = jQuery.now(),
- // try replacing _= if it is there
- ret = s.url.replace( rts, "$1_=" + ts );
-
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- ifModifiedKey = ifModifiedKey || s.url;
- if ( jQuery.lastModified[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
- }
- if ( jQuery.etag[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
- }
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already
- jqXHR.abort();
- return false;
-
- }
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout( function(){
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch (e) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
-
- return jqXHR;
- },
-
- // Serialize an array of form elements or a set of
- // key/values into a query string
- param: function( a, traditional ) {
- var s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : value;
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings.traditional;
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( var prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
-
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
- }
-});
-
-function buildParams( prefix, obj, traditional, add ) {
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
-
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
- }
- });
-
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
- // Serialize object item.
- for ( var name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
-}
-
-// This is still on the jQuery object... for now
-// Want to move this to jQuery.ajax some day
-jQuery.extend({
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {}
-
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields,
- ct,
- type,
- finalDataType,
- firstDataType;
-
- // Fill responseXXX fields
- for ( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- var dataTypes = s.dataTypes,
- converters = {},
- i,
- key,
- length = dataTypes.length,
- tmp,
- // Current and previous dataTypes
- current = dataTypes[ 0 ],
- prev,
- // Conversion expression
- conversion,
- // Conversion function
- conv,
- // Conversion functions (transitive conversion)
- conv1,
- conv2;
-
- // For each dataType in the chain
- for ( i = 1; i < length; i++ ) {
-
- // Create converters map
- // with lowercased keys
- if ( i === 1 ) {
- for ( key in s.converters ) {
- if ( typeof key === "string" ) {
- converters[ key.toLowerCase() ] = s.converters[ key ];
- }
- }
- }
-
- // Get the dataTypes
- prev = current;
- current = dataTypes[ i ];
-
- // If current is auto dataType, update it to prev
- if ( current === "*" ) {
- current = prev;
- // If no auto and dataTypes are actually different
- } else if ( prev !== "*" && prev !== current ) {
-
- // Get the converter
- conversion = prev + " " + current;
- conv = converters[ conversion ] || converters[ "* " + current ];
-
- // If there is no direct converter, search transitively
- if ( !conv ) {
- conv2 = undefined;
- for ( conv1 in converters ) {
- tmp = conv1.split( " " );
- if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
- conv2 = converters[ tmp[1] + " " + current ];
- if ( conv2 ) {
- conv1 = converters[ conv1 ];
- if ( conv1 === true ) {
- conv = conv2;
- } else if ( conv2 === true ) {
- conv = conv1;
- }
- break;
- }
- }
- }
- }
- // If we found no converter, dispatch an error
- if ( !( conv || conv2 ) ) {
- jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
- }
- // If found converter is not an equivalence
- if ( conv !== true ) {
- // Convert with 1 or 2 converters accordingly
- response = conv ? conv( response ) : conv2( conv1(response) );
- }
- }
- }
- return response;
-}
-
-
-
-
-var jsc = jQuery.now(),
- jsre = /(\=)\?(&|$)|\?\?/i;
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- return jQuery.expando + "_" + ( jsc++ );
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
- ( typeof s.data === "string" );
-
- if ( s.dataTypes[ 0 ] === "jsonp" ||
- s.jsonp !== false && ( jsre.test( s.url ) ||
- inspectData && jsre.test( s.data ) ) ) {
-
- var responseContainer,
- jsonpCallback = s.jsonpCallback =
- jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
- previous = window[ jsonpCallback ],
- url = s.url,
- data = s.data,
- replace = "$1" + jsonpCallback + "$2";
-
- if ( s.jsonp !== false ) {
- url = url.replace( jsre, replace );
- if ( s.url === url ) {
- if ( inspectData ) {
- data = data.replace( jsre, replace );
- }
- if ( s.data === data ) {
- // Add callback manually
- url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
- }
- }
- }
-
- s.url = url;
- s.data = data;
-
- // Install callback
- window[ jsonpCallback ] = function( response ) {
- responseContainer = [ response ];
- };
-
- // Clean-up function
- jqXHR.always(function() {
- // Set callback back to previous value
- window[ jsonpCallback ] = previous;
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( previous ) ) {
- window[ jsonpCallback ]( responseContainer[ 0 ] );
- }
- });
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( jsonpCallback + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Delegate to script
- return "script";
- }
-});
-
-
-
-
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /javascript|ecmascript/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement( "script" );
-
- script.async = "async";
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( head && script.parentNode ) {
- head.removeChild( script );
- }
-
- // Dereference the script
- script = undefined;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709 and #4378).
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( 0, 1 );
- }
- }
- };
- }
-});
-
-
-
-
-var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject ? function() {
- // Abort all pending requests
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]( 0, 1 );
- }
- } : false,
- xhrId = 0,
- xhrCallbacks;
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-(function( xhr ) {
- jQuery.extend( jQuery.support, {
- ajax: !!xhr,
- cors: !!xhr && ( "withCredentials" in xhr )
- });
-})( jQuery.ajaxSettings.xhr() );
-
-// Create transport if the browser can provide an xhr
-if ( jQuery.support.ajax ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var xhr = s.xhr(),
- handle,
- i;
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( _ ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occured
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- status = xhr.status;
- responseHeaders = xhr.getAllResponseHeaders();
- responses = {};
- xml = xhr.responseXML;
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
- responses.text = xhr.responseText;
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- // if we're in sync mode or it's in cache
- // and has been retrieved directly (IE6 & IE7)
- // we need to manually fire the callback
- if ( !s.async || xhr.readyState === 4 ) {
- callback();
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback(0,1);
- }
- }
- };
- }
- });
-}
-
-
-
-
-var elemdisplay = {},
- iframe, iframeDoc,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
- timerId,
- fxAttrs = [
- // height animations
- [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
- // width animations
- [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
- // opacity animations
- [ "opacity" ]
- ],
- fxNow;
-
-jQuery.fn.extend({
- show: function( speed, easing, callback ) {
- var elem, display;
-
- if ( speed || speed === 0 ) {
- return this.animate( genFx("show", 3), speed, easing, callback );
-
- } else {
- for ( var i = 0, j = this.length; i < j; i++ ) {
- elem = this[ i ];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
- display = elem.style.display = "";
- }
-
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( display === "" && jQuery.css(elem, "display") === "none" ) {
- jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
- }
- }
- }
-
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- elem = this[ i ];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- if ( display === "" || display === "none" ) {
- elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
- }
- }
- }
-
- return this;
- }
- },
-
- hide: function( speed, easing, callback ) {
- if ( speed || speed === 0 ) {
- return this.animate( genFx("hide", 3), speed, easing, callback);
-
- } else {
- var elem, display,
- i = 0,
- j = this.length;
-
- for ( ; i < j; i++ ) {
- elem = this[i];
- if ( elem.style ) {
- display = jQuery.css( elem, "display" );
-
- if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
- jQuery._data( elem, "olddisplay", display );
- }
- }
- }
-
- // Set the display of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- if ( this[i].style ) {
- this[i].style.display = "none";
- }
- }
-
- return this;
- }
- },
-
- // Save the old toggle function
- _toggle: jQuery.fn.toggle,
-
- toggle: function( fn, fn2, callback ) {
- var bool = typeof fn === "boolean";
-
- if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
- this._toggle.apply( this, arguments );
-
- } else if ( fn == null || bool ) {
- this.each(function() {
- var state = bool ? fn : jQuery(this).is(":hidden");
- jQuery(this)[ state ? "show" : "hide" ]();
- });
-
- } else {
- this.animate(genFx("toggle", 3), fn, fn2, callback);
- }
-
- return this;
- },
-
- fadeTo: function( speed, to, easing, callback ) {
- return this.filter(":hidden").css("opacity", 0).show().end()
- .animate({opacity: to}, speed, easing, callback);
- },
-
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed( speed, easing, callback );
-
- if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete, [ false ] );
- }
-
- // Do not change referenced properties as per-property easing will be lost
- prop = jQuery.extend( {}, prop );
-
- function doAnimation() {
- // XXX 'this' does not always have a nodeName when running the
- // test suite
-
- if ( optall.queue === false ) {
- jQuery._mark( this );
- }
-
- var opt = jQuery.extend( {}, optall ),
- isElement = this.nodeType === 1,
- hidden = isElement && jQuery(this).is(":hidden"),
- name, val, p, e,
- parts, start, end, unit,
- method;
-
- // will store per property easing and be used to determine when an animation is complete
- opt.animatedProperties = {};
-
- for ( p in prop ) {
-
- // property name normalization
- name = jQuery.camelCase( p );
- if ( p !== name ) {
- prop[ name ] = prop[ p ];
- delete prop[ p ];
- }
-
- val = prop[ name ];
-
- // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
- if ( jQuery.isArray( val ) ) {
- opt.animatedProperties[ name ] = val[ 1 ];
- val = prop[ name ] = val[ 0 ];
- } else {
- opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
- }
-
- if ( val === "hide" && hidden || val === "show" && !hidden ) {
- return opt.complete.call( this );
- }
-
- if ( isElement && ( name === "height" || name === "width" ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
- this.style.display = "inline-block";
-
- } else {
- this.style.zoom = 1;
- }
- }
- }
- }
-
- if ( opt.overflow != null ) {
- this.style.overflow = "hidden";
- }
-
- for ( p in prop ) {
- e = new jQuery.fx( this, opt, p );
- val = prop[ p ];
-
- if ( rfxtypes.test( val ) ) {
-
- // Tracks whether to show or hide based on private
- // data attached to the element
- method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
- if ( method ) {
- jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
- e[ method ]();
- } else {
- e[ val ]();
- }
-
- } else {
- parts = rfxnum.exec( val );
- start = e.cur();
-
- if ( parts ) {
- end = parseFloat( parts[2] );
- unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" ) {
- jQuery.style( this, p, (end || 1) + unit);
- start = ( (end || 1) / e.cur() ) * start;
- jQuery.style( this, p, start + unit);
- }
-
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] ) {
- end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
- }
-
- e.custom( start, end, unit );
-
- } else {
- e.custom( start, val, "" );
- }
- }
- }
-
- // For JS strict compliance
- return true;
- }
-
- return optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
-
- stop: function( type, clearQueue, gotoEnd ) {
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each(function() {
- var index,
- hadTimers = false,
- timers = jQuery.timers,
- data = jQuery._data( this );
-
- // clear marker counters if we know they won't be
- if ( !gotoEnd ) {
- jQuery._unmark( true, this );
- }
-
- function stopQueue( elem, data, index ) {
- var hooks = data[ index ];
- jQuery.removeData( elem, index, true );
- hooks.stop( gotoEnd );
- }
-
- if ( type == null ) {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
- stopQueue( this, data, index );
- }
- }
- } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
- stopQueue( this, data, index );
- }
-
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- if ( gotoEnd ) {
-
- // force the next step to be the last
- timers[ index ]( true );
- } else {
- timers[ index ].saveState();
- }
- hadTimers = true;
- timers.splice( index, 1 );
- }
- }
-
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( !( gotoEnd && hadTimers ) ) {
- jQuery.dequeue( this, type );
- }
- });
- }
-
-});
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout( clearFxNow, 0 );
- return ( fxNow = jQuery.now() );
-}
-
-function clearFxNow() {
- fxNow = undefined;
-}
-
-// Generate parameters to create a standard animation
-function genFx( type, num ) {
- var obj = {};
-
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
- obj[ this ] = type;
- });
-
- return obj;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx( "show", 1 ),
- slideUp: genFx( "hide", 1 ),
- slideToggle: genFx( "toggle", 1 ),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.extend({
- speed: function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
-
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
-
- // Queueing
- opt.old = opt.complete;
-
- opt.complete = function( noUnmark ) {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- } else if ( noUnmark !== false ) {
- jQuery._unmark( this );
- }
- };
-
- return opt;
- },
-
- easing: {
- linear: function( p, n, firstNum, diff ) {
- return firstNum + diff * p;
- },
- swing: function( p, n, firstNum, diff ) {
- return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
- }
- },
-
- timers: [],
-
- fx: function( elem, options, prop ) {
- this.options = options;
- this.elem = elem;
- this.prop = prop;
-
- options.orig = options.orig || {};
- }
-
-});
-
-jQuery.fx.prototype = {
- // Simple function for setting a style value
- update: function() {
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
- },
-
- // Get the current size
- cur: function() {
- if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
- return this.elem[ this.prop ];
- }
-
- var parsed,
- r = jQuery.css( this.elem, this.prop );
- // Empty strings, null, undefined and "auto" are converted to 0,
- // complex values such as "rotate(1rad)" are returned as is,
- // simple values such as "10px" are parsed to Float.
- return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
- },
-
- // Start an animation from one number to another
- custom: function( from, to, unit ) {
- var self = this,
- fx = jQuery.fx;
-
- this.startTime = fxNow || createFxNow();
- this.end = to;
- this.now = this.start = from;
- this.pos = this.state = 0;
- this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
-
- function t( gotoEnd ) {
- return self.step( gotoEnd );
- }
-
- t.queue = this.options.queue;
- t.elem = this.elem;
- t.saveState = function() {
- if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.start );
- }
- };
-
- if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval( fx.tick, fx.interval );
- }
- },
-
- // Simple 'show' function
- show: function() {
- var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
-
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
- this.options.show = true;
-
- // Begin the animation
- // Make sure that we start at a small width/height to avoid any flash of content
- if ( dataShow !== undefined ) {
- // This show is picking up where a previous hide or show left off
- this.custom( this.cur(), dataShow );
- } else {
- this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
- }
-
- // Start by showing the element
- jQuery( this.elem ).show();
- },
-
- // Simple 'hide' function
- hide: function() {
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
- this.options.hide = true;
-
- // Begin the animation
- this.custom( this.cur(), 0 );
- },
-
- // Each step of an animation
- step: function( gotoEnd ) {
- var p, n, complete,
- t = fxNow || createFxNow(),
- done = true,
- elem = this.elem,
- options = this.options;
-
- if ( gotoEnd || t >= options.duration + this.startTime ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
-
- options.animatedProperties[ this.prop ] = true;
-
- for ( p in options.animatedProperties ) {
- if ( options.animatedProperties[ p ] !== true ) {
- done = false;
- }
- }
-
- if ( done ) {
- // Reset the overflow
- if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
-
- jQuery.each( [ "", "X", "Y" ], function( index, value ) {
- elem.style[ "overflow" + value ] = options.overflow[ index ];
- });
- }
-
- // Hide the element if the "hide" operation was done
- if ( options.hide ) {
- jQuery( elem ).hide();
- }
-
- // Reset the properties, if the item has been hidden or shown
- if ( options.hide || options.show ) {
- for ( p in options.animatedProperties ) {
- jQuery.style( elem, p, options.orig[ p ] );
- jQuery.removeData( elem, "fxshow" + p, true );
- // Toggle data is no longer needed
- jQuery.removeData( elem, "toggle" + p, true );
- }
- }
-
- // Execute the complete function
- // in the event that the complete function throws an exception
- // we must ensure it won't be called twice. #5684
-
- complete = options.complete;
- if ( complete ) {
-
- options.complete = false;
- complete.call( elem );
- }
- }
-
- return false;
-
- } else {
- // classical easing cannot be used with an Infinity duration
- if ( options.duration == Infinity ) {
- this.now = t;
- } else {
- n = t - this.startTime;
- this.state = n / options.duration;
-
- // Perform the easing function, defaults to swing
- this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
- this.now = this.start + ( (this.end - this.start) * this.pos );
- }
- // Perform the next step of the animation
- this.update();
- }
-
- return true;
- }
-};
-
-jQuery.extend( jQuery.fx, {
- tick: function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- },
-
- interval: 13,
-
- stop: function() {
- clearInterval( timerId );
- timerId = null;
- },
-
- speeds: {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
- },
-
- step: {
- opacity: function( fx ) {
- jQuery.style( fx.elem, "opacity", fx.now );
- },
-
- _default: function( fx ) {
- if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
- } else {
- fx.elem[ fx.prop ] = fx.now;
- }
- }
- }
-});
-
-// Adds width/height step functions
-// Do not set anything below 0
-jQuery.each([ "width", "height" ], function( i, prop ) {
- jQuery.fx.step[ prop ] = function( fx ) {
- jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
- };
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-
-// Try to restore the default display value of an element
-function defaultDisplay( nodeName ) {
-
- if ( !elemdisplay[ nodeName ] ) {
-
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // No iframe to use yet, so create it
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
-
- body.appendChild( iframe );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
-
- elem = iframeDoc.createElement( nodeName );
-
- iframeDoc.body.appendChild( elem );
-
- display = jQuery.css( elem, "display" );
- body.removeChild( iframe );
- }
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- }
-
- return elemdisplay[ nodeName ];
-}
-
-
-
-
-var rtable = /^t(?:able|d|h)$/i,
- rroot = /^(?:body|html)$/i;
-
-if ( "getBoundingClientRect" in document.documentElement ) {
- jQuery.fn.offset = function( options ) {
- var elem = this[0], box;
-
- if ( options ) {
- return this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- if ( !elem || !elem.ownerDocument ) {
- return null;
- }
-
- if ( elem === elem.ownerDocument.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- try {
- box = elem.getBoundingClientRect();
- } catch(e) {}
-
- var doc = elem.ownerDocument,
- docElem = doc.documentElement;
-
- // Make sure we're not dealing with a disconnected DOM node
- if ( !box || !jQuery.contains( docElem, elem ) ) {
- return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
- }
-
- var body = doc.body,
- win = getWindow(doc),
- clientTop = docElem.clientTop || body.clientTop || 0,
- clientLeft = docElem.clientLeft || body.clientLeft || 0,
- scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
- scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
- top = box.top + scrollTop - clientTop,
- left = box.left + scrollLeft - clientLeft;
-
- return { top: top, left: left };
- };
-
-} else {
- jQuery.fn.offset = function( options ) {
- var elem = this[0];
-
- if ( options ) {
- return this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- if ( !elem || !elem.ownerDocument ) {
- return null;
- }
-
- if ( elem === elem.ownerDocument.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- var computedStyle,
- offsetParent = elem.offsetParent,
- prevOffsetParent = elem,
- doc = elem.ownerDocument,
- docElem = doc.documentElement,
- body = doc.body,
- defaultView = doc.defaultView,
- prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
- top = elem.offsetTop,
- left = elem.offsetLeft;
-
- while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
- if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
- break;
- }
-
- computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
- top -= elem.scrollTop;
- left -= elem.scrollLeft;
-
- if ( elem === offsetParent ) {
- top += elem.offsetTop;
- left += elem.offsetLeft;
-
- if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevOffsetParent = offsetParent;
- offsetParent = elem.offsetParent;
- }
-
- if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevComputedStyle = computedStyle;
- }
-
- if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
- top += body.offsetTop;
- left += body.offsetLeft;
- }
-
- if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
- top += Math.max( docElem.scrollTop, body.scrollTop );
- left += Math.max( docElem.scrollLeft, body.scrollLeft );
- }
-
- return { top: top, left: left };
- };
-}
-
-jQuery.offset = {
-
- bodyOffset: function( body ) {
- var top = body.offsetTop,
- left = body.offsetLeft;
-
- if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
- left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
- }
-
- return { top: top, left: left };
- },
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
-
- position: function() {
- if ( !this[0] ) {
- return null;
- }
-
- var elem = this[0],
-
- // Get *real* offsetParent
- offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
- offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
-
- // Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
- parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
-
- // Subtract the two offsets
- return {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( ["Left", "Top"], function( i, name ) {
- var method = "scroll" + name;
-
- jQuery.fn[ method ] = function( val ) {
- var elem, win;
-
- if ( val === undefined ) {
- elem = this[ 0 ];
-
- if ( !elem ) {
- return null;
- }
-
- win = getWindow( elem );
-
- // Return the scroll offset
- return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
- jQuery.support.boxModel && win.document.documentElement[ method ] ||
- win.document.body[ method ] :
- elem[ method ];
- }
-
- // Set the scroll offset
- return this.each(function() {
- win = getWindow( this );
-
- if ( win ) {
- win.scrollTo(
- !i ? val : jQuery( win ).scrollLeft(),
- i ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- this[ method ] = val;
- }
- });
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-
-
-
-
-// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each([ "Height", "Width" ], function( i, name ) {
-
- var type = name.toLowerCase();
-
- // innerHeight and innerWidth
- jQuery.fn[ "inner" + name ] = function() {
- var elem = this[0];
- return elem ?
- elem.style ?
- parseFloat( jQuery.css( elem, type, "padding" ) ) :
- this[ type ]() :
- null;
- };
-
- // outerHeight and outerWidth
- jQuery.fn[ "outer" + name ] = function( margin ) {
- var elem = this[0];
- return elem ?
- elem.style ?
- parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
- this[ type ]() :
- null;
- };
-
- jQuery.fn[ type ] = function( size ) {
- // Get window width or height
- var elem = this[0];
- if ( !elem ) {
- return size == null ? null : this;
- }
-
- if ( jQuery.isFunction( size ) ) {
- return this.each(function( i ) {
- var self = jQuery( this );
- self[ type ]( size.call( this, i, self[ type ]() ) );
- });
- }
-
- if ( jQuery.isWindow( elem ) ) {
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
- var docElemProp = elem.document.documentElement[ "client" + name ],
- body = elem.document.body;
- return elem.document.compatMode === "CSS1Compat" && docElemProp ||
- body && body[ "client" + name ] || docElemProp;
-
- // Get document width or height
- } else if ( elem.nodeType === 9 ) {
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- return Math.max(
- elem.documentElement["client" + name],
- elem.body["scroll" + name], elem.documentElement["scroll" + name],
- elem.body["offset" + name], elem.documentElement["offset" + name]
- );
-
- // Get or set width or height on the element
- } else if ( size === undefined ) {
- var orig = jQuery.css( elem, type ),
- ret = parseFloat( orig );
-
- return jQuery.isNumeric( ret ) ? ret : orig;
-
- // Set the width or height on the element (default to pixels if value is unitless)
- } else {
- return this.css( type, typeof size === "string" ? size : size + "px" );
- }
- };
-
-});
-
-
-
-
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-
-// Expose jQuery as an AMD module, but only for AMD loaders that
-// understand the issues with loading multiple versions of jQuery
-// in a page that all might call define(). The loader will indicate
-// they have special allowances for multiple jQuery versions by
-// specifying define.amd.jQuery = true. Register as a named module,
-// since jQuery can be concatenated with other files that may use define,
-// but not use a proper concatenation script that understands anonymous
-// AMD modules. A named AMD is safest and most robust way to register.
-// Lowercase jquery is used because AMD module names are derived from
-// file names, and jQuery is normally delivered in a lowercase file name.
-// Do this after creating the global so that if an AMD module wants to call
-// noConflict to hide this version of jQuery, it will work.
-if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
-}
-
-
-
-})( window );
diff --git a/solr/webapp/web/js/scripts/analysis.js b/solr/webapp/web/js/scripts/analysis.js
deleted file mode 100644
index 5fcadaf0f1a..00000000000
--- a/solr/webapp/web/js/scripts/analysis.js
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-// #/:core/analysis
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(analysis)$' ),
- function( context )
- {
- var active_core = this.active_core;
- var core_basepath = active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/analysis.html',
- function( template )
- {
- content_element
- .html( template );
-
- var analysis_element = $( '#analysis', content_element );
- var analysis_form = $( 'form', analysis_element );
- var analysis_result = $( '#analysis-result', analysis_element );
- analysis_result.hide();
-
- var verbose_link = $( '.verbose_output a', analysis_element );
-
- var type_or_name = $( '#type_or_name', analysis_form );
- var schema_browser_element = $( '#tor_schema' );
- var schema_browser_path = app.core_menu.find( '.schema-browser a' ).attr( 'href' );
- var schema_browser_map = { 'fieldname' : 'field', 'fieldtype' : 'type' };
-
- type_or_name
- .die( 'change' )
- .live
- (
- 'change',
- function( event )
- {
- var info = $( this ).val().split( '=' );
-
- schema_browser_element
- .attr( 'href', schema_browser_path + '?' + schema_browser_map[info[0]] + '=' + info[1] );
- }
- );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/luke?wt=json&show=schema',
- dataType : 'json',
- context : type_or_name,
- beforeSend : function( xhr, settings )
- {
- this
- .html( '<option value="">Loading ... </option>' )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- var content = '';
-
- var fields = [];
- for( var field_name in response.schema.fields )
- {
- fields.push
- (
- '<option value="fieldname=' + field_name.esc() + '">' + field_name.esc() + '</option>'
- );
- }
- if( 0 !== fields.length )
- {
- content += '<optgroup label="Fields">' + "\n";
- content += fields.sort().join( "\n" ) + "\n";
- content += '</optgroup>' + "\n";
- }
-
- var types = [];
- for( var type_name in response.schema.types )
- {
- types.push
- (
- '<option value="fieldtype=' + type_name.esc() + '">' + type_name.esc() + '</option>'
- );
- }
- if( 0 !== types.length )
- {
- content += '<optgroup label="Types">' + "\n";
- content += types.sort().join( "\n" ) + "\n";
- content += '</optgroup>' + "\n";
- }
-
- this
- .html( content );
-
- var defaultSearchField = 'fieldname\=' + ( context.params['analysis.fieldname'] || response.schema.defaultSearchField );
-
- if( context.params['analysis.fieldtype'] )
- {
- defaultSearchField = 'fieldtype\=' + context.params['analysis.fieldtype'];
- }
-
- $( 'option[value="' + defaultSearchField + '"]', this )
- .attr( 'selected', 'selected' );
-
- this
- .chosen()
- .trigger( 'change' );
-
- var fields = 0;
- for( var key in context.params )
- {
- if( 'string' === typeof context.params[key] && 0 !== context.params[key].length )
- {
- fields++;
- $( '[name="' + key + '"]', analysis_form )
- .val( context.params[key] );
- }
- }
-
- if( 'undefined' !== typeof context.params.verbose_output )
- {
- verbose_link.trigger( 'toggle', !!context.params.verbose_output.match( /^(1|true)$/ ) );
- }
-
- if( 0 !== fields )
- {
- analysis_form
- .trigger( 'execute' );
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
-
- $( '.analysis-error .head a', analysis_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).parents( '.analysis-error' )
- .toggleClass( 'expanded' );
- }
- );
-
- var check_empty_spacer = function()
- {
- var spacer_holder = $( 'td.part.data.spacer .holder', analysis_result );
-
- if( 0 === spacer_holder.size() )
- {
- return false;
- }
-
- var verbose_output = analysis_result.hasClass( 'verbose_output' );
-
- spacer_holder
- .each
- (
- function( index, element )
- {
- element = $( element );
-
- if( verbose_output )
- {
- var cell = element.parent();
- element.height( cell.height() );
- }
- else
- {
- element.removeAttr( 'style' );
- }
- }
- );
- }
-
- verbose_link
- .die( 'toggle' )
- .live
- (
- 'toggle',
- function( event, state )
- {
- $( this ).parent()
- .toggleClass( 'active', state );
-
- analysis_result
- .toggleClass( 'verbose_output', state );
-
- check_empty_spacer();
- }
- )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).parent()
- .toggleClass( 'active' );
-
- analysis_form.trigger( 'submit' );
- }
- );
-
- var button = $( 'button', analysis_form )
-
- var compute_analysis_params = function()
- {
- var params = analysis_form.formToArray();
-
- var type_or_name = $( '#type_or_name', analysis_form ).val().split( '=' );
- params.push( { name: 'analysis.' + type_or_name[0], value: type_or_name[1] } );
- params.push( { name: 'verbose_output', value: $( '.verbose_output', analysis_element ).hasClass( 'active' ) ? 1 : 0 } );
-
- return params;
- }
-
- analysis_form
- .die( 'submit' )
- .live
- (
- 'submit',
- function( event )
- {
- var params = $.param( compute_analysis_params() )
- .replace( /[\w\.]+=\+*(&)/g, '$1' ) // remove empty parameters
- .replace( /(&)+/, '$1' ) // reduce multiple ampersands
- .replace( /^&/, '' ) // remove leading ampersand
- .replace( /\+/g, '%20' ); // replace plus-signs with encoded whitespaces
-
- context.redirect( context.path.split( '?' ).shift() + '?' + params );
- return false;
- }
- )
- .die( 'execute' )
- .live
- (
- 'execute',
- function( event )
- {
- var url = core_basepath + '/analysis/field?wt=json&analysis.showmatch=true&' + context.path.split( '?' ).pop();
- url = url.replace( /&verbose_output=\d/, '' );
-
- $.ajax
- (
- {
- url : url,
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- loader.show( $( 'span', button ) );
- button.attr( 'disabled', true );
- },
- success : function( response, status_text, xhr, form )
- {
- $( '.analysis-error', analysis_element )
- .hide();
-
- analysis_result
- .empty()
- .show();
-
- for( var name in response.analysis.field_names )
- {
- build_analysis_table( 'name', name, response.analysis.field_names[name] );
- }
-
- for( var name in response.analysis.field_types )
- {
- build_analysis_table( 'type', name, response.analysis.field_types[name] );
- }
-
- check_empty_spacer();
- },
- error : function( xhr, text_status, error_thrown )
- {
- analysis_result
- .empty()
- .hide();
-
- if( 404 === xhr.status )
- {
- $( '#analysis-handler-missing', analysis_element )
- .show();
- }
- else
- {
- $( '#analysis-error', analysis_element )
- .show();
-
- var response = null;
- try
- {
- eval( 'response = ' + xhr.responseText + ';' );
- }
- catch( e )
- {
- console.error( e );
- }
-
- $( '#analysis-error .body', analysis_element )
- .text( response ? response.error.msg : xhr.responseText );
- }
- },
- complete : function()
- {
- loader.hide( $( 'span', button ) );
- button.removeAttr( 'disabled' );
- }
- }
- );
- }
- );
-
- var generate_class_name = function( type )
- {
- var classes = [type];
- if( 'text' !== type )
- {
- classes.push( 'verbose_output' );
- }
- return classes.join( ' ' );
- }
-
- var build_analysis_table = function( field_or_name, name, analysis_data )
- {
- for( var type in analysis_data )
- {
- var type_length = analysis_data[type].length;
- if( 0 !== type_length )
- {
- var global_elements_count = 0;
- if( 'string' === typeof analysis_data[type][1] )
- {
- analysis_data[type][1] = [{ 'text': analysis_data[type][1] }]
- }
-
- for( var i = 1; i < type_length; i += 2 )
- {
- var tmp_type_length = analysis_data[type][i].length;
- for( var j = 0; j < tmp_type_length; j++ )
- {
- global_elements_count = Math.max
- (
- ( analysis_data[type][i][j].positionHistory || [] )[0] || 1,
- global_elements_count
- );
- }
- }
-
- var content = '<div class="' + type + '">' + "\n";
- content += '<table border="0" cellspacing="0" cellpadding="0">' + "\n";
-
- for( var i = 0; i < analysis_data[type].length; i += 2 )
- {
- var colspan = 1;
- var elements = analysis_data[type][i+1];
- var elements_count = global_elements_count;
-
- if( !elements[0] || !elements[0].positionHistory )
- {
- colspan = elements_count;
- elements_count = 1;
- }
-
- var legend = [];
- for( var key in elements[0] )
- {
- var key_parts = key.split( '#' );
- var used_key = key_parts.pop();
- var short_key = used_key;
-
- if( 1 === key_parts.length )
- {
- used_key = '<abbr title="' + key + '">' + used_key + '</abbr>';
- }
-
- if( 'positionHistory' === short_key || 'match' === short_key )
- {
- continue;
- }
-
- legend.push
- (
- '<tr class="' + generate_class_name( short_key ) + '">' +
- '<td>' + used_key + '</td>' +
- '</tr>'
- );
- }
-
- content += '<tbody>' + "\n";
- content += '<tr class="step">' + "\n";
-
- // analyzer
- var analyzer_name = analysis_data[type][i].replace( /(\$1)+$/g, '' );
-
- var analyzer_short = -1 !== analyzer_name.indexOf( '$' )
- ? analyzer_name.split( '$' )[1]
- : analyzer_name.split( '.' ).pop();
- analyzer_short = analyzer_short.match( /[A-Z]/g ).join( '' );
-
- content += '<td class="part analyzer"><div>' + "\n";
- content += '<abbr title="' + analysis_data[type][i].esc() + '">' + "\n";
- content += analyzer_short.esc() + '</abbr></div></td>' + "\n";
-
- // legend
- content += '<td class="part legend"><div class="holder">' + "\n";
- content += '<table border="0" cellspacing="0" cellpadding="0">' + "\n";
- content += '<tr><td>' + "\n";
- content += '<table border="0" cellspacing="0" cellpadding="0">' + "\n";
- content += legend.join( "\n" ) + "\n";
- content += '</table></td></tr></table></td>' + "\n";
-
- // data
- var cell_content = '<td class="part data spacer" colspan="' + colspan + '"><div class="holder">&nbsp;</div></td>';
- var cells = new Array( elements_count + 1 ).join( cell_content );
- content += cells + "\n";
-
- content += '</tr>' + "\n";
- content += '</tbody>' + "\n";
- }
- content += '</table>' + "\n";
- content += '</div>' + "\n";
-
- $( '.' + type, analysis_result )
- .remove();
-
- analysis_result
- .append( content );
-
- var analysis_result_type = $( '.' + type, analysis_result );
-
- for( var i = 0; i < analysis_data[type].length; i += 2 )
- {
- for( var j = 0; j < analysis_data[type][i+1].length; j += 1 )
- {
- var pos = analysis_data[type][i+1][j].positionHistory
- ? analysis_data[type][i+1][j].positionHistory[0]
- : 1;
- var selector = 'tr.step:eq(' + ( i / 2 ) +') '
- + 'td.data:eq(' + ( pos - 1 ) + ') '
- + '.holder';
- var cell = $( selector, analysis_result_type );
-
- cell.parent()
- .removeClass( 'spacer' );
-
- var table = $( 'table tr.details', cell );
- if( 0 === table.size() )
- {
- cell
- .html
- (
- '<table border="0" cellspacing="0" cellpadding="0">' +
- '<tr class="details"></tr></table>'
- );
- var table = $( 'table tr.details', cell );
- }
-
- var tokens = [];
- for( var key in analysis_data[type][i+1][j] )
- {
- var short_key = key.split( '#' ).pop();
-
- if( 'positionHistory' === short_key || 'match' === short_key )
- {
- continue;
- }
-
- var classes = [];
- classes.push( generate_class_name( short_key ) );
-
- var data = analysis_data[type][i+1][j][key];
- if( 'object' === typeof data && data instanceof Array )
- {
- data = data.join( ' ' );
- }
- if( 'string' === typeof data )
- {
- data = data.esc();
- }
-
- if( null === data || 0 === data.length )
- {
- classes.push( 'empty' );
- data = '&empty;';
- }
-
- if( analysis_data[type][i+1][j].match &&
- ( 'text' === short_key || 'raw_bytes' === short_key ) )
- {
- classes.push( 'match' );
- }
-
- tokens.push
- (
- '<tr class="' + classes.join( ' ' ) + '">' +
- '<td>' + data + '</td>' +
- '</tr>'
- );
- }
- table
- .append
- (
- '<td class="details">' +
- '<table border="0" cellspacing="0" cellpadding="0">' +
- tokens.join( "\n" ) +
- '</table></td>'
- );
- }
- }
-
- }
- }
- }
-
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/app.js b/solr/webapp/web/js/scripts/app.js
deleted file mode 100644
index a967cfe307a..00000000000
--- a/solr/webapp/web/js/scripts/app.js
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var loader = {
-
- show : function( element )
- {
- $( element )
- .addClass( 'loader' );
- },
-
- hide : function( element )
- {
- $( element )
- .removeClass( 'loader' );
- }
-
-};
-
-Number.prototype.esc = function()
-{
- return new String( this ).esc();
-}
-
-String.prototype.esc = function()
-{
- return this.replace( /</g, '&lt;' ).replace( />/g, '&gt;' );
-}
-
-SolrDate = function( date )
-{
- // ["Sat Mar 03 11:00:00 CET 2012", "Sat", "Mar", "03", "11:00:00", "CET", "2012"]
- var parts = date.match( /^(\w+)\s+(\w+)\s+(\d+)\s+(\d+\:\d+\:\d+)\s+(\w+)\s+(\d+)$/ );
-
- // "Sat Mar 03 2012 10:37:33"
- return new Date( parts[1] + ' ' + parts[2] + ' ' + parts[3] + ' ' + parts[6] + ' ' + parts[4] );
-}
-
-var sammy = $.sammy
-(
- function()
- {
- this.bind
- (
- 'run',
- function( event, config )
- {
- if( 0 === config.start_url.length )
- {
- location.href = '#/';
- return false;
- }
- }
- );
-
- this.bind
- (
- 'error',
- function( message, original_error )
- {
- alert( original_error.message );
- }
- );
-
- // activate_core
- this.before
- (
- {},
- function( context )
- {
- app.clear_timeout();
-
- var menu_wrapper = $( '#menu-wrapper' );
-
- $( 'li[id].active', menu_wrapper )
- .removeClass( 'active' );
-
- $( 'li.active', menu_wrapper )
- .removeClass( 'active' );
-
- // global dashboard doesn't have params.splat
- if( !this.params.splat )
- {
- this.params.splat = [ '~index' ];
- }
-
- var selector = '~' === this.params.splat[0][0]
- ? '#' + this.params.splat[0].replace( /^~/, '' ) + '.global'
- : '#core-selector #' + this.params.splat[0].replace( /\./g, '__' );
-
- var active_element = $( selector, menu_wrapper );
-
- if( 0 === active_element.size() )
- {
- this.app.error( 'There exists no core with name "' + this.params.splat[0] + '"' );
- return false;
- }
-
- if( active_element.hasClass( 'global' ) )
- {
- active_element
- .addClass( 'active' );
-
- if( this.params.splat[1] )
- {
- $( '.' + this.params.splat[1], active_element )
- .addClass( 'active' );
- }
-
- $( '#core-selector option[selected]' )
- .removeAttr( 'selected' )
- .trigger( 'liszt:updated' );
-
- $( '#core-selector .chzn-container > a' )
- .addClass( 'chzn-default' );
- }
- else
- {
- active_element
- .attr( 'selected', 'selected' )
- .trigger( 'liszt:updated' );
-
- if( !this.params.splat[1] )
- {
- this.params.splat[1] = 'overview';
- }
-
- $( '#core-menu .' + this.params.splat[1] )
- .addClass( 'active' );
-
- this.active_core = active_element;
- }
-
- check_fixed_menu();
- }
- );
- }
-);
-
-var solr_admin = function( app_config )
-{
- that = this,
-
- menu_element = null,
-
- is_multicore = null,
- cores_data = null,
- active_core = null,
-
- config = app_config,
- params = null,
- dashboard_values = null,
- schema_browser_data = null,
-
- plugin_data = null,
-
- this.menu_element = $( '#core-selector select' );
- this.core_menu = $( '#core-menu ul' );
-
- this.config = config;
- this.timeout = null;
-
- this.core_regex_base = '^#\\/([\\w\\d-\\.]+)';
-
- browser = {
- locale : null,
- language : null,
- country : null
- };
-
- show_global_error = function( error )
- {
- var main = $( '#main' );
-
- $( 'div[id$="-wrapper"]', main )
- .remove();
-
- main
- .addClass( 'error' )
- .append( error );
-
- var pre_tags = $( 'pre', main );
- if( 0 !== pre_tags.size() )
- {
- hljs.highlightBlock( pre_tags.get(0) );
- }
- };
-
- sort_cores_data = function sort_cores_data( cores_status )
- {
- // build array of core-names for sorting
- var core_names = [];
- for( var core_name in cores_status )
- {
- core_names.push( core_name );
- }
- core_names.sort();
-
- var core_count = core_names.length;
- var cores = {};
-
- for( var i = 0; i < core_count; i++ )
- {
- var core_name = core_names[i];
- cores[core_name] = cores_status[core_name];
- }
-
- return cores;
- };
-
- this.set_cores_data = function set_cores_data( cores )
- {
- that.cores_data = sort_cores_data( cores.status );
-
- that.menu_element
- .empty();
-
- var core_list = [];
- core_list.push( '<option></option>' );
-
- var core_count = 0;
- for( var core_name in that.cores_data )
- {
- core_count++;
- var core_path = config.solr_path + '/' + core_name;
- var classes = [];
-
- if( cores.status[core_name]['isDefaultCore'] )
- {
- classes.push( 'default' );
- }
-
- var core_tpl = '<option '
- + ' id="' + core_name.replace( /\./g, '__' ) + '" '
- + ' class="' + classes.join( ' ' ) + '"'
- + ' data-basepath="' + core_path + '"'
- + ' schema="' + cores.status[core_name]['schema'] + '"'
- + ' config="' + cores.status[core_name]['config'] + '"'
- + ' value="#/' + core_name + '"'
- + ' title="' + core_name + '"'
- + '>'
- + core_name
- + '</option>';
-
- core_list.push( core_tpl );
- }
-
- var has_cores = 0 !== core_count;
- if( has_cores )
- {
- that.menu_element
- .append( core_list.join( "\n" ) )
- .trigger( 'liszt:updated' );
- }
-
- var core_selector = $( '#core-selector' );
- core_selector.find( '#has-cores' ).toggle( has_cores );
- core_selector.find( '#has-no-cores' ).toggle( !has_cores );
-
- if( has_cores )
- {
- var cores_element = core_selector.find( '#has-cores' );
- var selector_width = cores_element.width();
-
- cores_element.find( '.chzn-container' )
- .css( 'width', selector_width + 'px' );
-
- cores_element.find( '.chzn-drop' )
- .css( 'width', ( selector_width - 2 ) + 'px' );
- }
-
- this.check_for_init_failures( cores );
- };
-
- this.remove_init_failures = function remove_init_failures()
- {
- $( '#init-failures' )
- .hide()
- .find( 'ul' )
- .empty();
- }
-
- this.check_for_init_failures = function check_for_init_failures( cores )
- {
- if( !cores.initFailures )
- {
- this.remove_init_failures();
- return false;
- }
-
- var failures = [];
- for( var core_name in cores.initFailures )
- {
- failures.push
- (
- '<li>' +
- '<strong>' + core_name.esc() + ':</strong>' + "\n" +
- cores.initFailures[core_name].esc() + "\n" +
- '</li>'
- );
- }
-
- if( 0 === failures.length )
- {
- this.remove_init_failures();
- return false;
- }
-
- $( '#init-failures' )
- .show()
- .find( 'ul' )
- .html( failures.join( "\n" ) );
- }
-
- this.run = function()
- {
- var navigator_language = navigator.userLanguage || navigator.language;
- var language_match = navigator_language.match( /^(\w{2})([-_](\w{2}))?$/ );
- if( language_match )
- {
- if( language_match[1] )
- {
- browser.language = language_match[1].toLowerCase();
- }
- if( language_match[3] )
- {
- browser.country = language_match[3].toUpperCase();
- }
- if( language_match[1] && language_match[3] )
- {
- browser.locale = browser.language + '_' + browser.country
- }
- }
-
- $.ajax
- (
- {
- url : config.solr_path + config.core_admin_path + '?wt=json&indexInfo=false',
- dataType : 'json',
- beforeSend : function( arr, form, options )
- {
- $( '#content' )
- .html( '<div id="index"><div class="loader">Loading ...</div></div>' );
- },
- success : function( response )
- {
- that.set_cores_data( response );
-
- that.menu_element
- .chosen()
- .off( 'change' )
- .on
- (
- 'change',
- function( event )
- {
- location.href = $( 'option:selected', this ).val();
- return false;
- }
- )
- .on
- (
- 'liszt:updated',
- function( event )
- {
- var core_name = $( 'option:selected', this ).text();
-
- that.core_menu
- .html
- (
- //Keep this in alphabetical order after the overview
- '<li class="overview"><a href="#/' + core_name + '"><span>Overview</span></a></li>' + "\n" +
- '<li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n" +
- '<li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n" +
- '<li class="documents"><a href="#/' + core_name + '/documents"><span>Documents</span></a></li>' + "\n" +
- '<li class="files"><a href="#/' + core_name + '/files"><span>Files</span></a></li>' + "\n" +
- '<li class="ping"><a rel="' + that.config.solr_path + '/' + core_name + '/admin/ping"><span>Ping</span></a></li>' + "\n" +
- '<li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n" +
- '<li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n" +
- '<li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n" +
- '<li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>' +
- '<li class="segments"><a href="#/' + core_name + '/segments"><span>Segments info</span></a></li>'
- )
- .show();
-
- if( !core_name )
- {
- that.core_menu
- .hide()
- .empty();
- }
- }
- );
-
- check_fixed_menu();
- $( window ).resize( check_fixed_menu );
-
- var system_url = config.solr_path + '/admin/info/system?wt=json';
- $.ajax
- (
- {
- url : system_url,
- dataType : 'json',
- beforeSend : function( arr, form, options )
- {
- },
- success : function( response )
- {
- that.dashboard_values = response;
-
- var environment_args = null;
- var cloud_args = null;
-
- if( response.jvm && response.jvm.jmx && response.jvm.jmx.commandLineArgs )
- {
- var command_line_args = response.jvm.jmx.commandLineArgs.join( ' | ' );
-
- environment_args = command_line_args.match( /-Dsolr.environment=((dev|test|prod)?[\w\d]*)/i );
- }
-
- if( response.mode )
- {
- cloud_args = response.mode.match( /solrcloud/i );
- }
-
- // environment
-
- var wrapper = $( '#wrapper' );
- var environment_element = $( '#environment' );
- if( environment_args )
- {
- wrapper
- .addClass( 'has-environment' );
-
- if( environment_args[1] )
- {
- environment_element
- .html( environment_args[1] );
- }
-
- if( environment_args[2] )
- {
- environment_element
- .addClass( environment_args[2] );
- }
- }
- else
- {
- wrapper
- .removeClass( 'has-environment' );
- }
-
- // cloud
-
- var cloud_nav_element = $( '#menu #cloud' );
- if( cloud_args )
- {
- cloud_nav_element
- .show();
- }
-
- // sammy
-
- sammy.run( location.hash );
- },
- error : function()
- {
- },
- complete : function()
- {
- loader.hide( this );
- }
- }
- );
- },
- error : function()
- {
- },
- complete : function()
- {
- }
- }
- );
- };
-
- this.convert_duration_to_seconds = function convert_duration_to_seconds( str )
- {
- var seconds = 0;
- var arr = new String( str || '' ).split( '.' );
- var parts = arr[0].split( ':' ).reverse();
- var parts_count = parts.length;
-
- for( var i = 0; i < parts_count; i++ )
- {
- seconds += ( parseInt( parts[i], 10 ) || 0 ) * Math.pow( 60, i );
- }
-
- // treat more or equal than .5 as additional second
- if( arr[1] && 5 <= parseInt( arr[1][0], 10 ) )
- {
- seconds++;
- }
-
- return seconds;
- };
-
- this.convert_seconds_to_readable_time = function convert_seconds_to_readable_time( seconds )
- {
- seconds = parseInt( seconds || 0, 10 );
- var minutes = Math.floor( seconds / 60 );
- var hours = Math.floor( minutes / 60 );
-
- var text = [];
- if( 0 !== hours )
- {
- text.push( hours + 'h' );
- seconds -= hours * 60 * 60;
- minutes -= hours * 60;
- }
-
- if( 0 !== minutes )
- {
- text.push( minutes + 'm' );
- seconds -= minutes * 60;
- }
-
- if( 0 !== seconds )
- {
- text.push( ( '0' + seconds ).substr( -2 ) + 's' );
- }
-
- return text.join( ' ' );
- };
-
- this.clear_timeout = function clear_timeout()
- {
- if( !app.timeout )
- {
- return false;
- }
-
- console.debug( 'Clearing Timeout #' + this.timeout );
- clearTimeout( this.timeout );
- this.timeout = null;
- };
-
- this.format_json = function format_json( json_str )
- {
- if( JSON.stringify && JSON.parse )
- {
- json_str = JSON.stringify( JSON.parse( json_str ), undefined, 2 );
- }
-
- return json_str.esc();
- };
-
- this.format_number = function format_number( number )
- {
- var sep = {
- 'de_CH' : '\'',
- 'de' : '.',
- 'en' : ',',
- 'es' : '.',
- 'it' : '.',
- 'ja' : ',',
- 'sv' : ' ',
- 'tr' : '.',
- '_' : '' // fallback
- };
-
- return ( number || 0 ).toString().replace
- (
- /\B(?=(\d{3})+(?!\d))/g,
- sep[ browser.locale ] || sep[ browser.language ] || sep['_']
- );
- };
-
- check_fixed_menu = function check_fixed_menu()
- {
- $( '#wrapper' ).toggleClass( 'scroll', $( window ).height() < $( '#menu-wrapper' ).height() + $( '#header' ).height() + 40 );
- }
-
-};
-
-var connection_check_delay = 1000;
-var connection_working = true;
-
-var connection_check = function connection_check()
-{
- $.ajax
- (
- {
- url : config.solr_path + config.core_admin_path + '?wt=json&indexInfo=false',
- dataType : 'json',
- context : $( '.blockUI #connection_status span' ),
- beforeSend : function( arr, form, options )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response )
- {
- connection_working = true;
-
- this
- .html( 'Instance is available - <a href="javascript:location.reload();">Reload the page</a>' );
-
- this.parents( '#connection_status' )
- .addClass( 'online' );
-
- this.parents( '.blockUI' )
- .css( 'borderColor', '#080' );
- },
- error : function()
- {
- connection_check_delay += connection_check_delay;
- window.setTimeout( connection_check, connection_check_delay );
- },
- complete : function()
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
-};
-
-var connection_error = function connection_error()
-{
- connection_working = false;
-
- $.blockUI
- (
- {
- message: $( '#connection_status' ),
- css: { width: '450px', borderColor: '#f00' }
- }
- );
-
- window.setTimeout( connection_check, connection_check_delay );
-}
-
-$( document ).ajaxError
-(
- function( event, xhr, settings, thrownError )
- {
- if( connection_working && 0 === xhr.status )
- {
- connection_error();
- }
- }
-);
-
-$.ajaxSetup( { cache: false } );
-var app = new solr_admin( app_config );
diff --git a/solr/webapp/web/js/scripts/cloud.js b/solr/webapp/web/js/scripts/cloud.js
deleted file mode 100644
index 7890af80f68..00000000000
--- a/solr/webapp/web/js/scripts/cloud.js
+++ /dev/null
@@ -1,877 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var zk_error = function zk_error( xhr, text_status, error_thrown )
-{
- var zk = null;
- try
- {
- eval( 'zk = ' + xhr.responseText + ';' );
- }
- catch( e ) {}
-
- var message = '<p class="txt">Loading of "<code>' + xhr.url + '</code>" '
- + 'failed (HTTP-Status <code>' + xhr.status + '</code>)</p>' + "\n";
-
- if( zk.error )
- {
- message += '<p class="msg">"' + zk.error.esc() + '"</p>' + "\n";
- }
-
- this.closest( '#cloud' )
- .html( '<div class="block" id="error">' + message + '</div>' );
-};
-
-var init_debug = function( cloud_element )
-{
- var debug_element = $( '#debug', cloud_element );
- var debug_button = $( '#menu #cloud .dump a' );
-
- var clipboard_element = $( '.clipboard', debug_element );
- var clipboard_button = $( 'a', clipboard_element );
-
- debug_button
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- debug_element.trigger( 'show' );
- return false;
- }
- );
-
- $( '.close', debug_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- debug_element.trigger( 'hide' );
- return false;
- }
- );
-
- $( '.clipboard', debug_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- return false;
- }
- );
-
- debug_element
- .die( 'show' )
- .live
- (
- 'show',
- function( event )
- {
- debug_element.show();
-
- $.ajax
- (
- {
- url : app.config.solr_path + '/admin/zookeeper?wt=json&dump=true',
- dataType : 'text',
- context : debug_element,
- beforeSend : function( xhr, settings )
- {
- $( '.debug', debug_element )
- .html( '<span class="loader">Loading Dump ...</span>' );
-
- ZeroClipboard.setMoviePath( 'img/ZeroClipboard.swf' );
-
- clipboard_client = new ZeroClipboard.Client();
-
- clipboard_client.addEventListener
- (
- 'load',
- function( client )
- {
- }
- );
-
- clipboard_client.addEventListener
- (
- 'complete',
- function( client, text )
- {
- clipboard_element
- .addClass( 'copied' );
-
- clipboard_button
- .data( 'text', clipboard_button.text() )
- .text( clipboard_button.data( 'copied' ) );
- }
- );
- },
- success : function( response, text_status, xhr )
- {
- clipboard_client.glue
- (
- clipboard_element.get(0),
- clipboard_button.get(0)
- );
-
- clipboard_client.setText( response.replace( /\\/g, '\\\\' ) );
-
- $( '.debug', debug_element )
- .removeClass( 'loader' )
- .text( response );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
- )
- .die( 'hide' )
- .live
- (
- 'hide',
- function( event )
- {
- $( '.debug', debug_element )
- .empty();
-
- clipboard_element
- .removeClass( 'copied' );
-
- clipboard_button
- .data( 'copied', clipboard_button.text() )
- .text( clipboard_button.data( 'text' ) );
-
- clipboard_client.destroy();
-
- debug_element.hide();
- }
- );
-};
-
-var helper_path_class = function( p )
-{
- var classes = [ 'link' ];
- classes.push( 'lvl-' + p.target.depth );
-
- if( p.target.data && p.target.data.leader )
- {
- classes.push( 'leader' );
- }
-
- if( p.target.data && p.target.data.state )
- {
- classes.push( p.target.data.state );
- }
-
- return classes.join( ' ' );
-};
-
-var helper_node_class = function( d )
-{
- var classes = [ 'node' ];
- classes.push( 'lvl-' + d.depth );
-
- if( d.data && d.data.leader )
- {
- classes.push( 'leader' );
- }
-
- if( d.data && d.data.state )
- {
- classes.push( d.data.state );
- }
-
- return classes.join( ' ' );
-};
-
-var helper_data = {
- protocol: [],
- host: [],
- hostname: [],
- port: [],
- pathname: []
-};
-
-var helper_node_text = function( d )
-{
- if( !d.data || !d.data.uri )
- {
- return d.name;
- }
-
- var name = d.data.uri.hostname;
-
- if( 1 !== helper_data.protocol.length )
- {
- name = d.data.uri.protocol + '//' + name;
- }
-
- if( 1 !== helper_data.port.length )
- {
- name += ':' + d.data.uri.port;
- }
-
- if( 1 !== helper_data.pathname.length )
- {
- name += d.data.uri.pathname;
- }
-
- return name;
-};
-
-var generate_graph = function( graph_element, graph_data, leaf_count )
-{
- var w = graph_element.width(),
- h = leaf_count * 20;
-
- var tree = d3.layout.tree()
- .size([h, w - 400]);
-
- var diagonal = d3.svg.diagonal()
- .projection(function(d) { return [d.y, d.x]; });
-
- var vis = d3.select( '#canvas' ).append( 'svg' )
- .attr( 'width', w )
- .attr( 'height', h)
- .append( 'g' )
- .attr( 'transform', 'translate(100, 0)' );
-
- var nodes = tree.nodes( graph_data );
-
- var link = vis.selectAll( 'path.link' )
- .data( tree.links( nodes ) )
- .enter().append( 'path' )
- .attr( 'class', helper_path_class )
- .attr( 'd', diagonal );
-
- var node = vis.selectAll( 'g.node' )
- .data( nodes )
- .enter().append( 'g' )
- .attr( 'class', helper_node_class )
- .attr( 'transform', function(d) { return 'translate(' + d.y + ',' + d.x + ')'; } )
-
- node.append( 'circle' )
- .attr( 'r', 4.5 );
-
- node.append( 'text' )
- .attr( 'dx', function( d ) { return 0 === d.depth ? -8 : 8; } )
- .attr( 'dy', function( d ) { return 5; } )
- .attr( 'text-anchor', function( d ) { return 0 === d.depth ? 'end' : 'start'; } )
- .attr( 'data-href', function( d ) { return d.name; } )
- .text( helper_node_text );
-
- $( 'text[data-href*="//"]', graph_element )
- .die( 'click' )
- .live
- (
- 'click',
- function()
- {
- location.href = $( this ).data( 'href' );
- }
- );
-};
-
-var generate_rgraph = function( graph_element, graph_data, leaf_count )
-{
- var max_val = Math.min( graph_element.width(), $( 'body' ).height() )
- var r = max_val / 2;
-
- var cluster = d3.layout.cluster()
- .size([360, r - 160]);
-
- var diagonal = d3.svg.diagonal.radial()
- .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
-
- var vis = d3.select( '#canvas' ).append( 'svg' )
- .attr( 'width', r * 2 )
- .attr( 'height', r * 2 )
- .append( 'g' )
- .attr( 'transform', 'translate(' + r + ',' + r + ')' );
-
- var nodes = cluster.nodes( graph_data );
-
- var link = vis.selectAll( 'path.link' )
- .data( cluster.links( nodes ) )
- .enter().append( 'path' )
- .attr( 'class', helper_path_class )
- .attr( 'd', diagonal );
-
- var node = vis.selectAll( 'g.node' )
- .data( nodes )
- .enter().append( 'g' )
- .attr( 'class', helper_node_class )
- .attr( 'transform', function(d) { return 'rotate(' + (d.x - 90) + ')translate(' + d.y + ')'; } )
-
- node.append( 'circle' )
- .attr( 'r', 4.5 );
-
- node.append( 'text' )
- .attr( 'dx', function(d) { return d.x < 180 ? 8 : -8; } )
- .attr( 'dy', '.31em' )
- .attr( 'text-anchor', function(d) { return d.x < 180 ? 'start' : 'end'; } )
- .attr( 'transform', function(d) { return d.x < 180 ? null : 'rotate(180)'; } )
- .attr( 'data-href', function( d ) { return d.name; } )
- .text( helper_node_text );
-
- $( 'text[data-href*="//"]', graph_element )
- .die( 'click' )
- .live
- (
- 'click',
- function()
- {
- location.href = $( this ).data( 'href' );
- }
- );
-};
-
-var prepare_graph_data = function( response, graph_element, live_nodes, callback )
-{
- var state = null;
- eval( 'state = ' + response.znode.data + ';' );
-
- var leaf_count = 0;
- var graph_data = {
- name: null,
- children : []
- };
-
- for( var c in state )
- {
- var shards = [];
- for( var s in state[c].shards )
- {
- var nodes = [];
- for( var n in state[c].shards[s].replicas )
- {
- leaf_count++;
- var replica = state[c].shards[s].replicas[n]
-
- var uri = replica.base_url;
- var parts = uri.match( /^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/ );
- var uri_parts = {
- protocol: parts[1],
- host: parts[2],
- hostname: parts[3],
- port: parseInt( parts[5] || 80, 10 ),
- pathname: parts[6]
- };
-
- helper_data.protocol.push( uri_parts.protocol );
- helper_data.host.push( uri_parts.host );
- helper_data.hostname.push( uri_parts.hostname );
- helper_data.port.push( uri_parts.port );
- helper_data.pathname.push( uri_parts.pathname );
-
- var status = replica.state;
-
- if( !live_nodes[replica.node_name] )
- {
- status = 'gone';
- }
-
- var node = {
- name: uri,
- data: {
- type : 'node',
- state : status,
- leader : 'true' === replica.leader,
- uri : uri_parts
- }
- };
- nodes.push( node );
- }
-
- var shard = {
- name: s,
- data: {
- type : 'shard'
- },
- children: nodes
- };
- shards.push( shard );
- }
-
- var collection = {
- name: c,
- data: {
- type : 'collection'
- },
- children: shards
- };
- graph_data.children.push( collection );
- }
-
- helper_data.protocol = $.unique( helper_data.protocol );
- helper_data.host = $.unique( helper_data.host );
- helper_data.hostname = $.unique( helper_data.hostname );
- helper_data.port = $.unique( helper_data.port );
- helper_data.pathname = $.unique( helper_data.pathname );
-
- callback( graph_element, graph_data, leaf_count );
-}
-
-var update_status_filter = function(filterType, filterVal) {
- if (filterType == 'status') {
- $( '#cloudGraphPagingStatusFilter' ).val(filterVal);
- $( '#cloudGraphPagingStatusFilter' ).show();
- $( '#cloudGraphPagingFilter' ).hide();
- $( '#cloudGraphPagingFilter' ).val('');
- } else {
- $( '#cloudGraphPagingStatusFilter' ).hide();
- $( '#cloudGraphPagingStatusFilter' ).val('');
- $( '#cloudGraphPagingFilter' ).val(filterVal);
- $( '#cloudGraphPagingFilter' ).show();
- }
-};
-
-var prepare_graph = function( graph_element, callback )
-{
- $.ajax
- (
- {
- url : app.config.solr_path + '/admin/zookeeper?wt=json&path=%2Flive_nodes',
- dataType : 'json',
- success : function( response, text_status, xhr )
- {
- var live_nodes = {};
- for( var c in response.tree[0].children )
- {
- live_nodes[response.tree[0].children[c].data.title] = true;
- }
-
- var start = $( '#cloudGraphPagingStart' ).val();
- var rows = $( '#cloudGraphPagingRows' ).val();
- var clusterStateUrl = app.config.solr_path + '/admin/zookeeper?wt=json&detail=true&path=%2Fclusterstate.json&view=graph';
- if (start && rows)
- clusterStateUrl += ('&start='+start+'&rows='+rows);
-
- var filterType = $( '#cloudGraphPagingFilterType' ).val();
- if (filterType) {
- var filter = (filterType == 'status')
- ? $( '#cloudGraphPagingStatusFilter' ).val()
- : $( '#cloudGraphPagingFilter' ).val();
- if (filter)
- clusterStateUrl += ('&filterType='+filterType+'&filter='+filter);
- }
-
- $.ajax
- (
- {
- url : clusterStateUrl,
- dataType : 'json',
- context : graph_element,
- beforeSend : function( xhr, settings )
- {
- this.show();
- },
- success : function( response, text_status, xhr )
- {
- prepare_graph_data(response, graph_element, live_nodes, callback)
-
- if (response.znode && response.znode.paging) {
- var parr = response.znode.paging.split('|');
- if (parr.length < 3) {
- $( '#cloudGraphPaging' ).hide();
- return;
- }
-
- var start = Math.max(parseInt(parr[0]),0);
- var prevEnabled = (start > 0);
- $('#cloudGraphPagingPrev').prop('disabled', !prevEnabled);
- if (prevEnabled)
- $('#cloudGraphPagingPrev').show();
- else
- $('#cloudGraphPagingPrev').hide();
-
- var rows = parseInt(parr[1])
- var total = parseInt(parr[2])
- $( '#cloudGraphPagingStart' ).val(start);
- $( '#cloudGraphPagingRows' ).val(rows);
- if (rows == -1)
- $( '#cloudGraphPaging' ).hide();
-
- var filterType = parr.length > 3 ? parr[3] : '';
- if (filterType == '' || filterType == 'none') filterType = 'status';
-
- $( '#cloudGraphPagingFilterType' ).val(filterType);
- var filter = parr.length > 4 ? parr[4] : '';
-
- update_status_filter(filterType, filter);
-
- var page = Math.floor(start/rows)+1;
- var pages = Math.ceil(total/rows);
- var last = Math.min(start+rows,total);
- var nextEnabled = (last < total);
- $('#cloudGraphPagingNext').prop('disabled', !nextEnabled);
- if (nextEnabled)
- $('#cloudGraphPagingNext').show();
- else
- $('#cloudGraphPagingNext').hide();
-
- var status = (total > 0)
- ? 'Collections '+(start+1)+' - '+last+' of '+total+'. '
- : 'No collections found.';
- $( '#cloudGraphPagingStatus' ).html(status);
- } else {
- $( '#cloudGraphPaging' ).hide();
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
-
-};
-
-var init_graph = function( graph_element )
-{
- prepare_graph
- (
- graph_element,
- function( graph_element, graph_data, leaf_count )
- {
- generate_graph( graph_element, graph_data, leaf_count );
- }
- );
-}
-
-var init_rgraph = function( graph_element )
-{
- prepare_graph
- (
- graph_element,
- function( graph_element, graph_data, leaf_count )
- {
- generate_rgraph( graph_element, graph_data, leaf_count );
- }
- );
-}
-
-var init_tree = function( tree_element )
-{
- $.ajax
- (
- {
- url : app.config.solr_path + '/admin/zookeeper?wt=json',
- dataType : 'json',
- context : tree_element,
- beforeSend : function( xhr, settings )
- {
- this
- .show();
- },
- success : function( response, text_status, xhr )
- {
- var self = this;
-
- $( '#tree', this )
- .jstree
- (
- {
- "plugins" : [ "json_data" ],
- "json_data" : {
- "data" : response.tree,
- "progressive_render" : true
- },
- "core" : {
- "animation" : 0
- }
- }
- )
- .jstree
- (
- 'open_node',
- 'li:first'
- );
-
- var tree_links = $( '#tree a', this );
-
- tree_links
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( 'a.active', $( this ).parents( '#tree' ) )
- .removeClass( 'active' );
-
- $( this )
- .addClass( 'active' );
-
- tree_element
- .addClass( 'show' );
-
- var file_content = $( '#file-content' );
-
- $( 'a.close', file_content )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( '#tree a.active' )
- .removeClass( 'active' );
-
- tree_element
- .removeClass( 'show' );
-
- return false;
- }
- );
-
- $.ajax
- (
- {
- url : this.href,
- dataType : 'json',
- context : file_content,
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- var props = [];
- for( var key in response.znode.prop )
- {
- props.push
- (
- '<li><dl class="clearfix">' + "\n" +
- '<dt>' + key.esc() + '</dt>' + "\n" +
- '<dd>' + response.znode.prop[key].esc() + '</dd>' + "\n" +
- '</dl></li>'
- );
- }
-
- $( '#prop ul', this )
- .empty()
- .html( props.join( "\n" ) );
-
- $( '#prop ul li:odd', this )
- .addClass( 'odd' );
-
- var data_element = $( '#data', this );
-
- var highlight = false;
- var data = '<em>Node "' + response.znode.path + '" has no utf8 Content</em>';
-
- if( response.znode.data )
- {
- var classes = '';
- var path = response.znode.path.split( '.' );
-
- if( 1 < path.length )
- {
- highlight = true;
- classes = 'syntax language-' + path.pop().esc();
- }
-
- data = '<pre class="' + classes + '">'
- + response.znode.data.esc()
- + '</pre>';
- }
-
-
- data_element
- .show()
- .html( data );
-
- if( highlight )
- {
- hljs.highlightBlock( data_element.get(0) );
- }
-
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
-
- return false;
- }
- );
- },
- error : zk_error,
- complete : function( xhr, text_status )
- {
- }
- }
- );
-};
-
-// updates the starting position for paged navigation
-// and then rebuilds the graph based on the selected page
-var update_start = function(direction, cloud_element) {
- var start = $( '#cloudGraphPagingStart' ).val();
- var rows = $( '#cloudGraphPagingRows' ).val();
- var startAt = start ? parseInt(start) : 0;
- var numRows = rows ? parseInt(rows) : 20;
- var newStart = Math.max(startAt + (rows * direction),0);
- $( '#cloudGraphPagingStart' ).val(newStart);
-
- var graph_element = $( '#graph-content', cloud_element );
- $( '#canvas', graph_element).empty();
- init_graph( graph_element );
-};
-
-// #/~cloud
-sammy.get
-(
- /^#\/(~cloud)$/,
- function( context )
- {
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/cloud.html',
- function( template )
- {
- content_element
- .html( template );
-
- var cloud_element = $( '#cloud', content_element );
- var navigation_element = $( '#menu #cloud' );
-
- init_debug( cloud_element );
-
- $( '.tree', navigation_element )
- .die( 'activate' )
- .live
- (
- 'activate',
- function( event )
- {
- $( this ).addClass( 'active' );
- init_tree( $( '#tree-content', cloud_element ) );
- }
- );
-
- $( '.graph', navigation_element )
- .die( 'activate' )
- .live
- (
- 'activate',
- function( event )
- {
- $( this ).addClass( 'active' );
- init_graph( $( '#graph-content', cloud_element ) );
-
- $('#cloudGraphPagingNext').click(function() {
- update_start(1, cloud_element);
- });
-
- $('#cloudGraphPagingPrev').click(function() {
- update_start(-1, cloud_element);
- });
-
- $('#cloudGraphPagingRows').change(function() {
- var rows = $( this ).val();
- if (!rows || rows == '')
- $( this ).val("20");
-
- // ? restart the start position when rows changes?
- $( '#cloudGraphPagingStart' ).val(0);
- update_start(-1, cloud_element);
- });
-
- $('#cloudGraphPagingFilter').change(function() {
- var filter = $( this ).val();
- // reset the start position when the filter changes
- $( '#cloudGraphPagingStart' ).val(0);
- update_start(-1, cloud_element);
- });
-
- $( '#cloudGraphPagingStatusFilter' ).show();
- $( '#cloudGraphPagingFilter' ).hide();
-
- $('#cloudGraphPagingFilterType').change(function() {
- update_status_filter($( this ).val(), '');
- });
-
- $('#cloudGraphPagingStatusFilter').change(function() {
- // just reset the paged navigation controls based on this update
- $( '#cloudGraphPagingStart' ).val(0);
- update_start(-1, cloud_element);
- });
-
- }
- );
-
- $( '.rgraph', navigation_element )
- .die( 'activate' )
- .live
- (
- 'activate',
- function( event )
- {
- $( "#cloudGraphPaging" ).hide(); // TODO: paging for rgraph too
-
- $( this ).addClass( 'active' );
- init_rgraph( $( '#graph-content', cloud_element ) );
- }
- );
-
- $.ajax
- (
- {
- url : app.config.solr_path + '/admin/zookeeper?wt=json',
- dataType : 'json',
- context : cloud_element,
- success : function( response, text_status, xhr )
- {
- $( 'a[href="' + context.path + '"]', navigation_element )
- .trigger( 'activate' );
- },
- error : zk_error
- }
- );
-
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/cores.js b/solr/webapp/web/js/scripts/cores.js
deleted file mode 100644
index 54f6cfab7b2..00000000000
--- a/solr/webapp/web/js/scripts/cores.js
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-sammy.bind
-(
- 'cores_load_data',
- function( event, params )
- {
- $.ajax
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- if( params.only_failures )
- {
- app.check_for_init_failures( response );
- return true;
- }
-
- var has_cores = false;
- for( core in response.status )
- {
- has_cores = true; break;
- }
-
- app.set_cores_data( response );
-
- if( has_cores )
- {
- params.success( app.cores_data );
- }
- else
- {
- params.error();
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
-);
-
-sammy.bind
-(
- 'cores_build_navigation',
- function( event, params )
- {
- var navigation_content = ['<ul>'];
-
- for( var core in params.cores )
- {
- var core_name = core;
- if( !core_name )
- {
- core_name = '<em>(empty)</em>';
- }
- navigation_content.push( '<li><a href="' + params.basepath + core + '">' + core_name + '</a></li>' );
- }
-
- params.navigation_element
- .html( navigation_content.join( "\n" ) );
-
- $( 'a[href="' + params.basepath + params.current_core + '"]', params.navigation_element ).parent()
- .addClass( 'current' );
- }
-);
-
-sammy.bind
-(
- 'cores_load_template',
- function( event, params )
- {
- if( app.cores_template )
- {
- params.callback();
- return true;
- }
-
- $.get
- (
- 'tpl/cores.html',
- function( template )
- {
- params.content_element
- .html( template );
-
- app.cores_template = template;
- params.callback();
- }
- );
- }
-);
-
-// #/~cores
-sammy.get
-(
- /^#\/(~cores)$/,
- function( context )
- {
- delete app.cores_template;
- var content_element = $( '#content' );
-
- sammy.trigger
- (
- 'cores_load_data',
- {
- success : function( cores )
- {
- var first_core = null;
- for( var key in cores )
- {
- if( !first_core )
- {
- first_core = key;
- }
- continue;
- }
- context.redirect( context.path + '/' + first_core );
- },
- error : function()
- {
- sammy.trigger
- (
- 'cores_load_template',
- {
- content_element : content_element,
- callback : function()
- {
- var cores_element = $( '#cores', content_element );
- var navigation_element = $( '#navigation', cores_element );
- var data_element = $( '#data', cores_element );
- var core_data_element = $( '#core-data', data_element );
- var index_data_element = $( '#index-data', data_element );
-
- // layout
-
- var ui_block = $( '#ui-block' );
- var actions_element = $( '.actions', cores_element );
- var div_action = $( 'div.action', actions_element );
-
- ui_block
- .css( 'opacity', 0.7 )
- .width( cores_element.width() + 10 )
- .height( cores_element.height() );
-
- if( $( '#cloud.global' ).is( ':visible' ) )
- {
- $( '.cloud', div_action )
- .show();
- }
-
- $( 'button.action', actions_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var self = $( this );
-
- self
- .toggleClass( 'open' );
-
- $( '.action.' + self.attr( 'id' ), actions_element )
- .trigger( 'open' );
-
- return false;
- }
- );
-
- div_action
- .die( 'close' )
- .live
- (
- 'close',
- function( event )
- {
- div_action.hide();
- ui_block.hide();
- }
- )
- .die( 'open' )
- .live
- (
- 'open',
- function( event )
- {
- var self = $( this );
- var rel = $( '#' + self.data( 'rel' ) );
-
- self
- .trigger( 'close' )
- .show()
- .css( 'left', rel.position().left );
-
- ui_block
- .show();
- }
- );
-
- $( 'form button.reset', actions_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).closest( 'div.action' )
- .trigger( 'close' );
- }
- );
-
- $( 'form', div_action )
- .ajaxForm
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json&indexInfo=false',
- dataType : 'json',
- beforeSubmit : function( array, form, options )
- {
- $( 'button[type="submit"] span', form )
- .addClass( 'loader' );
- },
- success : function( response, status_text, xhr, form )
- {
- delete app.cores_data;
- sammy.refresh();
-
- $( 'button.reset', form )
- .trigger( 'click' );
- },
- error : function( xhr, text_status, error_thrown )
- {
- var response = null;
- eval( 'response = ' + xhr.responseText + ';' );
-
- var error_elem = $( '.error', div_action.filter( ':visible' ) );
- error_elem.show();
- $( 'span', error_elem ).text( response.error.msg );
- },
- complete : function()
- {
- $( 'button span.loader', actions_element )
- .removeClass( 'loader' );
- }
- }
- );
-
- // --
-
- $( '#add', content_element )
- .trigger( 'click' );
-
- $( '[data-rel="add"] input[type="text"]:first', content_element )
- .focus();
- }
- }
- );
- }
- }
- );
- }
-);
-
-// #/~cores
-sammy.get
-(
- /^#\/(~cores)\//,
- function( context )
- {
- var content_element = $( '#content' );
-
- var path_parts = this.path.match( /^(.+\/~cores\/)(.*)$/ );
- var current_core = path_parts[2];
-
- sammy.trigger
- (
- 'cores_load_data',
- {
- error : function()
- {
- context.redirect( '#/' + context.params.splat[0] );
- },
- success : function( cores )
- {
- sammy.trigger
- (
- 'cores_load_template',
- {
- content_element : content_element,
- callback : function()
- {
- var cores_element = $( '#cores', content_element );
- var navigation_element = $( '#navigation', cores_element );
- var data_element = $( '#data', cores_element );
- var core_data_element = $( '#core-data', data_element );
- var index_data_element = $( '#index-data', data_element );
-
- cores_element
- .removeClass( 'empty' );
-
- sammy.trigger
- (
- 'cores_build_navigation',
- {
- cores : cores,
- basepath : path_parts[1],
- current_core : current_core,
- navigation_element : navigation_element
- }
- );
-
- var core_data = cores[current_core];
- var core_basepath = $( '#' + current_core, app.menu_element ).attr( 'data-basepath' );
-
- // core-data
-
- $( '.startTime dd', core_data_element )
- .html( core_data.startTime );
-
- $( '.instanceDir dd', core_data_element )
- .html( core_data.instanceDir );
-
- $( '.dataDir dd', core_data_element )
- .html( core_data.dataDir );
-
- // index-data
-
- $( '.lastModified dd', index_data_element )
- .html( core_data.index.lastModified || '-' );
-
- $( '.version dd', index_data_element )
- .html( core_data.index.version );
-
- $( '.numDocs dd', index_data_element )
- .html( core_data.index.numDocs );
-
- $( '.maxDoc dd', index_data_element )
- .html( core_data.index.maxDoc );
-
- $( '.deletedDocs dd', index_data_element )
- .html( core_data.index.deletedDocs || '-' );
-
- $( '.optimized dd', index_data_element )
- .addClass( !core_data.index.hasDeletions ? 'ico-1' : 'ico-0' );
-
- $( '#actions #optimize', cores_element )
- .show();
-
- $( '.optimized dd span', index_data_element )
- .html( !core_data.index.hasDeletions ? 'yes' : 'no' );
-
- $( '.current dd', index_data_element )
- .addClass( core_data.index.current ? 'ico-1' : 'ico-0' );
-
- $( '.current dd span', index_data_element )
- .html( core_data.index.current ? 'yes' : 'no' );
-
- $( '.directory dd', index_data_element )
- .html
- (
- core_data.index.directory
- .replace( /:/g, ':&#8203;' )
- .replace( /@/g, '@&#8203;' )
- );
-
- var core_names = [];
- var core_selects = $( '#actions select', cores_element );
-
- for( var key in cores )
- {
- core_names.push( '<option value="' + key + '">' + key + '</option>' )
- }
-
- core_selects
- .html( core_names.join( "\n") );
-
- $( 'option[value="' + current_core + '"]', core_selects.filter( '.other' ) )
- .remove();
-
- $( 'input[data-core="current"]', cores_element )
- .val( current_core );
-
- // layout
-
- var ui_block = $( '#ui-block' );
- var actions_element = $( '.actions', cores_element );
- var div_action = $( 'div.action', actions_element );
-
- ui_block
- .css( 'opacity', 0.7 )
- .width( cores_element.width() + 10 )
- .height( cores_element.height() );
-
- if( $( '#cloud.global' ).is( ':visible' ) )
- {
- $( '.cloud', div_action )
- .show();
- }
-
- $( 'button.action', actions_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var self = $( this );
-
- self
- .toggleClass( 'open' );
-
- $( '.action.' + self.attr( 'id' ), actions_element )
- .trigger( 'open' );
-
- return false;
- }
- );
-
- div_action
- .die( 'close' )
- .live
- (
- 'close',
- function( event )
- {
- div_action.hide();
- ui_block.hide();
- }
- )
- .die( 'open' )
- .live
- (
- 'open',
- function( event )
- {
- var self = $( this );
- var rel = $( '#' + self.data( 'rel' ) );
-
- self
- .trigger( 'close' )
- .show()
- .css( 'left', rel.position().left );
-
- ui_block
- .show();
- }
- );
-
- $( 'form button.reset', actions_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).closest( 'div.action' )
- .trigger( 'close' );
- }
- );
-
- var form_callback = {
-
- rename : function( form, response )
- {
- var url = path_parts[1] + $( 'input[name="other"]', form ).val();
- context.redirect( url );
- }
-
- };
-
- $( 'form', div_action )
- .ajaxForm
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json&indexInfo=false',
- dataType : 'json',
- beforeSubmit : function( array, form, options )
- {
- $( 'button[type="submit"] span', form )
- .addClass( 'loader' );
- },
- success : function( response, status_text, xhr, form )
- {
- var action = $( 'input[name="action"]', form ).val().toLowerCase();
-
- delete app.cores_data;
-
- if( form_callback[action] )
- {
- form_callback[action]( form, response );
- }
- else
- {
- sammy.refresh();
- }
-
- $( 'button.reset', form )
- .trigger( 'click' );
- },
- error : function( xhr, text_status, error_thrown )
- {
- var response = null;
- eval( 'response = ' + xhr.responseText + ';' );
-
- var error_elem = $( '.error', div_action.filter( ':visible' ) );
- error_elem.show();
- $( 'span', error_elem ).text( response.error.msg );
- },
- complete : function()
- {
- $( 'button span.loader', actions_element )
- .removeClass( 'loader' );
- }
- }
- );
-
- var reload_button = $( '#actions #reload', cores_element );
- reload_button
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=RELOAD&core=' + current_core,
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- $( 'span', this )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this
- .addClass( 'success' );
-
- delete app.cores_data;
- sammy.refresh();
-
- window.setTimeout
- (
- function()
- {
- reload_button
- .removeClass( 'success' );
- },
- 1000
- );
- },
- error : function( xhr, text_status, error_thrown )
- {
- this
- .addClass( 'warn' );
-
- sammy.trigger( 'cores_load_data', { only_failures : true } );
-
- window.setTimeout
- (
- function()
- {
- reload_button
- .removeClass( 'warn' );
- },
- 1000
- );
- },
- complete : function( xhr, text_status )
- {
- $( 'span', this )
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
-
- $( '#actions #unload', cores_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var ret = confirm( 'Do you really want to unload Core "' + current_core + '"?' );
- if( !ret )
- {
- return false;
- }
-
- $.ajax
- (
- {
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=UNLOAD&core=' + current_core,
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- $( 'span', this )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- delete app.cores_data;
- context.redirect( path_parts[1].substr( 0, path_parts[1].length - 1 ) );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function( xhr, text_status )
- {
- $( 'span', this )
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
-
- var optimize_button = $( '#actions #optimize', cores_element );
- optimize_button
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- $( 'span', this )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this
- .addClass( 'success' );
-
- window.setTimeout
- (
- function()
- {
- optimize_button
- .removeClass( 'success' );
- },
- 1000
- );
-
- $( '.optimized dd.ico-0', index_data_element )
- .removeClass( 'ico-0' )
- .addClass( 'ico-1' );
- },
- error : function( xhr, text_status, error_thrown)
- {
- console.warn( 'd0h, optimize broken!' );
- },
- complete : function( xhr, text_status )
- {
- $( 'span', this )
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
-
- $( '.timeago', data_element )
- .timeago();
-
- $( 'ul', data_element )
- .each
- (
- function( i, element )
- {
- $( 'li:odd', element )
- .addClass( 'odd' );
- }
- )
- }
- }
- );
- }
- }
- );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/dashboard.js b/solr/webapp/web/js/scripts/dashboard.js
deleted file mode 100644
index 31070d0ffd4..00000000000
--- a/solr/webapp/web/js/scripts/dashboard.js
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var set_healthcheck_status = function( status )
-{
- var hc_button = $( '.healthcheck-status' )
- if ( status == 'enable' )
- {
- hc_button.parents( 'dd' )
- .removeClass( 'ico-0' )
- .addClass( 'ico-1' );
- hc_button
- .addClass( 'enabled' )
- .html( 'disable ping' );
- } else {
- hc_button.parents( 'dd' )
- .removeClass( 'ico-1')
- .addClass( 'ico-0' );
- hc_button
- .removeClass( 'enabled' )
- .html( 'enable ping' );
- }
-};
-
-// #/:core
-sammy.get
-(
- new RegExp( app.core_regex_base + '$' ),
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- content_element
- .removeClass( 'single' );
-
- if( !app.core_menu.data( 'admin-extra-loaded' ) )
- {
- app.core_menu.data( 'admin-extra-loaded', new Date() );
-
- $.get
- (
- core_basepath + '/admin/file/?file=admin-extra.menu-top.html&contentType=text/html;charset=utf-8',
- function( menu_extra )
- {
- app.core_menu
- .prepend( menu_extra );
- }
- );
-
- $.get
- (
- core_basepath + '/admin/file/?file=admin-extra.menu-bottom.html&contentType=text/html;charset=utf-8',
- function( menu_extra )
- {
- app.core_menu
- .append( menu_extra );
- }
- );
- }
-
- $.get
- (
- 'tpl/dashboard.html',
- function( template )
- {
- content_element
- .html( template );
-
- var dashboard_element = $( '#dashboard' );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/luke?wt=json&show=index&numTerms=0',
- dataType : 'json',
- context : $( '#statistics', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading ...' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
-
- $( '.content', this )
- .show();
-
- var data = {
- 'index_num-doc' : response['index']['numDocs'],
- 'index_heap-usage-bytes' : response['index']['indexHeapUsageBytes'],
- 'index_max-doc' : response['index']['maxDoc'],
- 'index_deleted-doc' : response['index']['deletedDocs'],
- 'index_version' : response['index']['version'],
- 'index_segmentCount' : response['index']['segmentCount'],
- 'index_last-modified' : response['index']['lastModified']
- };
-
- for( var key in data )
- {
- $( '.' + key, this )
- .show();
-
- $( '.value.' + key, this )
- .html( data[key] );
- }
-
- var optimized_element = $( '.value.index_optimized', this );
- if( !response['index']['hasDeletions'] )
- {
- optimized_element
- .addClass( 'ico-1' );
-
- $( 'span', optimized_element )
- .html( 'yes' );
- }
- else
- {
- optimized_element
- .addClass( 'ico-0' );
-
- $( 'span', optimized_element )
- .html( 'no' );
- }
-
- var current_element = $( '.value.index_current', this );
- if( response['index']['current'] )
- {
- current_element
- .addClass( 'ico-1' );
-
- $( 'span', current_element )
- .html( 'yes' );
- }
- else
- {
- current_element
- .addClass( 'ico-0' );
-
- $( 'span', current_element )
- .html( 'no' );
- }
-
- $( 'a', optimized_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this.parents( 'dd' )
- .removeClass( 'ico-0' )
- .addClass( 'ico-1' );
- },
- error : function( xhr, text_status, error_thrown)
- {
- console.warn( 'd0h, optimize broken!' );
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
-
- $( '.timeago', this )
- .timeago();
- },
- error : function( xhr, text_status, error_thrown )
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'Luke is not configured' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
-
- $.ajax
- (
- {
- url : core_basepath + '/replication?command=details&wt=json',
- dataType : 'json',
- context : $( '#replication', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
-
- $( '.content', this )
- .show();
-
- $( '.replication', context.active_core )
- .show();
-
- var data = response.details;
- var is_slave = 'undefined' !== typeof( data.slave );
- var headline = $( 'h2 span', this );
- var details_element = $( '#details', this );
- var current_type_element = $( ( is_slave ? '.slave' : '.masterSearch' ), this );
- var master_data = is_slave ? data.slave.masterDetails : data;
-
- if( is_slave )
- {
- this
- .addClass( 'slave' );
-
- headline
- .html( headline.html() + ' (Slave)' );
- }
- else
- {
- this
- .addClass( 'master' );
-
- headline
- .html( headline.html() + ' (Master)' );
- }
-
- // the currently searchable commit regardless of type
- $( '.version div', current_type_element )
- .html( data.indexVersion );
- $( '.generation div', current_type_element )
- .html( data.generation );
- $( '.size div', current_type_element )
- .html( data.indexSize );
-
- // what's replicable on the master
- var master_element = $( '.master', details_element );
- $( '.version div', master_element )
- .html( master_data.master.replicableVersion || '-' );
- $( '.generation div', master_element )
- .html( master_data.master.replicableGeneration || '-' );
- $( '.size div', master_element )
- .html( "-" );
-
- if( is_slave )
- {
- var master_element = $( '.masterSearch', details_element );
- $( '.version div', master_element )
- .html( data.slave.masterDetails.indexVersion );
- $( '.generation div', master_element )
- .html( data.slave.masterDetails.generation );
- $( '.size div', master_element )
- .html( data.slave.masterDetails.indexSize );
-
- // warnings if slave version|gen doesn't match what's replicable
- if( data.indexVersion !== master_data.master.replicableVersion )
- {
- $( '.version', details_element )
- .addClass( 'diff' );
- }
- else
- {
- $( '.version', details_element )
- .removeClass( 'diff' );
- }
-
- if( data.generation !== master_data.master.replicableGeneration )
- {
- $( '.generation', details_element )
- .addClass( 'diff' );
- }
- else
- {
- $( '.generation', details_element )
- .removeClass( 'diff' );
- }
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'Replication is not configured' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/system?wt=json',
- dataType : 'json',
- context : $( '#instance', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
-
- $( '.content', this )
- .show();
-
- $( 'dl', this )
- .show();
-
- var data = {
- 'dir_cwd' : response.core.directory.cwd,
- 'dir_instance' : response.core.directory.instance,
- 'dir_data' : response.core.directory.data,
- 'dir_index' : response.core.directory.index,
- 'dir_impl' : response.core.directory.dirimpl
- };
-
- for( var key in data )
- {
- $( '.' + key, this )
- .show();
-
- $( '.value.' + key, this )
- .html( data[key] );
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( '/admin/system Handler is not configured' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/file/?file=admin-extra.html',
- dataType : 'html',
- context : $( '#admin-extra', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .hide()
- .empty();
-
- $( '.content', this )
- .show()
- .html( response );
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'We found no "admin-extra.html" file.' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/ping?action=status&wt=json',
- dataType : 'json',
- context : $( '#healthcheck', dashboard_element ),
- beforeSend : function( xhr, settings )
- {
- $( 'h2', this )
- .addClass( 'loader' );
-
- $( '.message', this )
- .show()
- .html( 'Loading' );
-
- $( '.content', this )
- .hide();
- },
- success : function( response, text_status, xhr )
- {
- $( '.message', this )
- .empty()
- .hide();
-
- $( '.content', this )
- .show();
-
- var status_element = $( '.value.status', this );
- var toggle_button = $( '.healthcheck-status', this );
- var status = response['status'];
- $( 'span', status_element ).html( status );
-
- var action = ( response['status'] == 'enabled' ) ? 'enable' : 'disable';
- set_healthcheck_status(action);
-
- if( response['status'] == 'enabled' )
- {
- status_element
- .addClass( 'ico-1' );
- toggle_button
- .addClass( 'enabled' );
- }
- else
- {
- status_element
- .addClass( 'ico-0' );
- }
-
- $( '.healthcheck-status', status_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var action = $(this).hasClass( 'enabled' ) ? 'disable' : 'enable';
- $.ajax
- (
- {
- url : core_basepath + '/admin/ping?action=' + action + '&wt=json',
- dataType : 'json',
- context : $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- set_healthcheck_status(action);
- },
- error : function( xhr, text_status, error_thrown)
- {
- console.warn( 'd0h, enable broken!' );
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
- }
- }
- );
- }
- );
- },
- error : function( xhr, text_status, error_thrown)
- {
- this
- .addClass( 'disabled' );
-
- $( '.message', this )
- .show()
- .html( 'Ping request handler is not configured with a healthcheck file.' );
- },
- complete : function( xhr, text_status )
- {
- $( 'h2', this )
- .removeClass( 'loader' );
- }
- }
- );
-
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/dataimport.js b/solr/webapp/web/js/scripts/dataimport.js
deleted file mode 100644
index 20532c6c2c4..00000000000
--- a/solr/webapp/web/js/scripts/dataimport.js
+++ /dev/null
@@ -1,812 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var dataimport_timeout = 2000;
-var cookie_dataimport_autorefresh = 'dataimport_autorefresh';
-
-sammy.bind
-(
- 'dataimport_queryhandler_load',
- function( event, params )
- {
- var core_basepath = params.active_core.attr( 'data-basepath' );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/mbeans?cat=QUERY&wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- var handlers = response['solr-mbeans'][1];
- var dataimport_handlers = [];
- for( var key in handlers )
- {
- if( handlers[key]['class'] !== key &&
- handlers[key]['class'] === 'org.apache.solr.handler.dataimport.DataImportHandler' )
- {
- dataimport_handlers.push( key );
- }
- }
- params.callback( dataimport_handlers.sort(naturalSort) );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
-);
-
-// #/:core/dataimport
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(dataimport)$' ),
- function( context )
- {
- sammy.trigger
- (
- 'dataimport_queryhandler_load',
- {
- active_core : this.active_core,
- callback : function( dataimport_handlers )
- {
- if( 0 === dataimport_handlers.length )
- {
- $( '#content' )
- .html( 'sorry, no dataimport-handler defined!' );
-
- return false;
- }
-
- context.redirect( context.path + '/' + dataimport_handlers[0] );
- }
- }
- );
- }
-);
-
-// #/:core/dataimport
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(dataimport)\\/' ),
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- var path_parts = this.path.match( /^(.+\/dataimport\/)(.*)$/ );
- var handler_url = core_basepath + path_parts[2];
-
- $( 'li.dataimport', this.active_core )
- .addClass( 'active' );
-
- $.get
- (
- 'tpl/dataimport.html',
- function( template )
- {
- content_element
- .html( template );
-
- var dataimport_element = $( '#dataimport', content_element );
- var form_element = $( '#form', dataimport_element );
- var config_element = $( '#config', dataimport_element );
- var error_element = $( '#error', dataimport_element );
- var debug_response_element = $( '#debug_response', dataimport_element );
-
- var autorefresh_status = false;
- var debug_mode = false;
-
- // handler
-
- sammy.trigger
- (
- 'dataimport_queryhandler_load',
- {
- active_core : context.active_core,
- callback : function( dataimport_handlers )
- {
- var handlers_element = $( '#navigation ul', form_element );
- var handlers = [];
-
- for( var i = 0; i < dataimport_handlers.length; i++ )
- {
- handlers.push
- (
- '<li><a href="' + path_parts[1] + dataimport_handlers[i] + '">' +
- dataimport_handlers[i] +
- '</a></li>'
- );
- }
-
- $( handlers_element )
- .html( handlers.join( "\n") ) ;
-
- $( 'a[href="' + context.path + '"]', handlers_element ).closest( 'li' )
- .addClass( 'current' );
-
- $( 'form', form_element )
- .show();
- }
- }
- );
-
- // config
-
- function dataimport_fetch_config()
- {
- $.ajax
- (
- {
- url : handler_url + '?command=show-config&indent=true',
- dataType : 'xml',
- context : $( '#dataimport_config', config_element ),
- beforeSend : function( xhr, settings )
- {
- error_element
- .empty()
- .hide();
- },
- success : function( config, text_status, xhr )
- {
- dataimport_element
- .removeClass( 'error' );
-
- config_element
- .addClass( 'hidden' );
-
- var entities = [ '<option value=""></option>' ];
-
- $( 'document > entity', config )
- .each
- (
- function( i, element )
- {
- entities.push( '<option>' + $( element ).attr( 'name' ).esc() + '</option>' );
- }
- );
-
- $( '#entity', form_element )
- .html( entities.join( "\n" ) );
-
- $( '.editable textarea', this )
- .val( xhr.responseText.replace( /\n+$/, '' ) );
- },
- error : function( xhr, text_status, error_thrown )
- {
- if( 'parsererror' === error_thrown )
- {
- dataimport_element
- .addClass( 'error' );
-
- error_element
- .text( 'Dataimport XML-Configuration is not valid' )
- .show();
-
- config_element
- .removeClass( 'hidden' );
- }
- },
- complete : function( xhr, text_status )
- {
- var code = $(
- '<pre class="syntax language-xml"><code>' +
- xhr.responseText.esc() +
- '</code></pre>'
- );
- $( '.formatted', this ).html( code );
-
- if( 'success' === text_status )
- {
- hljs.highlightBlock( code.get(0) );
- }
- }
- }
- );
- }
- dataimport_fetch_config();
-
- $( '.block .toggle', dataimport_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).parents( '.block' )
- .toggleClass( 'hidden' );
-
- return false;
- }
- )
-
- var reload_config_element = $( '.reload_config', config_element );
- reload_config_element
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : handler_url + '?command=reload-config',
- dataType : 'xml',
- context: $( this ),
- beforeSend : function( xhr, settings )
- {
- this
- .removeClass( 'error' )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- this
- .addClass( 'success' );
-
- window.setTimeout
- (
- function()
- {
- reload_config_element
- .removeClass( 'success' );
- },
- 5000
- );
- },
- error : function( xhr, text_status, error_thrown )
- {
- this
- .addClass( 'error' );
- },
- complete : function( xhr, text_status )
- {
- this
- .removeClass( 'loader' );
-
- dataimport_fetch_config();
- }
- }
- );
- return false;
- }
- );
-
- var debug_mode_element = $( '.debug_mode', config_element );
- debug_mode_element
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var self = $( this );
- var block = self.closest( '.block' )
-
- var debug_checkbox = $( 'input[name="debug"]', form_element );
- var submit_span = $( 'button[type="submit"] span', form_element );
-
- debug_mode = !debug_mode;
-
- block.toggleClass( 'debug_mode', debug_mode );
-
- if( debug_mode )
- {
- block.removeClass( 'hidden' );
-
- debug_checkbox
- .attr( 'checked', 'checked' )
- .trigger( 'change' );
-
- submit_span
- .data( 'original', submit_span.text() )
- .text( submit_span.data( 'debugmode' ) );
- }
- else
- {
- submit_span
- .text( submit_span.data( 'original' ) )
- .removeData( 'original' );
- }
- }
- );
-
- // abort
-
- var abort_import_element = $( '.abort-import', dataimport_element );
- abort_import_element
- .off( 'click' )
- .on
- (
- 'click',
- function( event )
- {
- var span_element = $( 'span', this );
-
- $.ajax
- (
- {
- url : handler_url + '?command=abort&wt=json',
- dataType : 'json',
- type: 'GET',
- context: $( this ),
- beforeSend : function( xhr, settings )
- {
- span_element
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- span_element
- .data( 'original', span_element.text() )
- .text( span_element.data( 'aborting' ) );
-
- this
- .removeClass( 'warn' )
- .addClass( 'success' );
-
- window.setTimeout
- (
- function()
- {
- $( 'span', abort_import_element )
- .removeClass( 'loader' )
- .text( span_element.data( 'original' ) )
- .removeData( 'original' );
-
- abort_import_element
- .removeClass( 'success' )
- .addClass( 'warn' );
- },
- dataimport_timeout * 2
- );
-
- dataimport_fetch_status();
- }
- }
- );
- return false;
- }
- );
-
- // state
-
- var status_button = $( 'form button.refresh-status', form_element );
-
- status_button
- .off( 'click' )
- .on
- (
- 'click',
- function( event )
- {
- dataimport_fetch_status();
- return false;
- }
- )
- .trigger( 'click' );
-
- function dataimport_fetch_status( clear_timeout )
- {
- if( clear_timeout )
- {
- app.clear_timeout();
- }
-
- $.ajax
- (
- {
- url : handler_url + '?command=status&indent=true&wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- $( 'span', status_button )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- var state_element = $( '#current_state', content_element );
-
- var status = response.status;
- var rollback_time = response.statusMessages.Rolledback || null;
- var abort_time = response.statusMessages.Aborted || null;
-
- var messages = response.statusMessages;
- var messages_count = 0;
- for( var key in messages ) { messages_count++; }
-
- function dataimport_compute_details( response, details_element, elapsed_seconds )
- {
- details_element
- .show();
-
- // --
-
- var document_config = {
- 'Requests' : 'Total Requests made to DataSource',
- 'Fetched' : 'Total Rows Fetched',
- 'Skipped' : 'Total Documents Skipped',
- 'Processed' : 'Total Documents Processed'
- };
-
- var document_details = [];
- for( var key in document_config )
- {
- var value = parseInt( response.statusMessages[document_config[key]], 10 );
-
- var detail = '<abbr title="' + document_config[key].esc() + '">' + key.esc() + '</abbr>: ' + app.format_number( value ).esc();
- if( elapsed_seconds && 'skipped' !== key.toLowerCase() )
- {
- detail += ' <span>(' + app.format_number( Math.round( value / elapsed_seconds ) ).esc() + '/s)</span>'
- }
-
- document_details.push( detail );
- };
-
- $( '.docs', details_element )
- .html( document_details.join( ', ' ) );
-
- // --
-
- var dates_config = {
- 'Started' : 'Full Dump Started',
- 'Aborted' : 'Aborted',
- 'Rolledback' : 'Rolledback'
- };
-
- var dates_details = [];
- for( var key in dates_config )
- {
- var value = response.statusMessages[dates_config[key]];
-
- if( value )
- {
- var detail = '<abbr title="' + dates_config[key].esc() + '">' + key.esc() + '</abbr>: '
- + '<abbr class="time">' + value.esc() + '</abbr>';
- dates_details.push( detail );
- }
- };
-
- var dates_element = $( '.dates', details_element );
-
- dates_element
- .html( dates_details.join( ', ' ) );
-
- $( '.time', dates_element )
- .removeData( 'timeago' )
- .timeago();
- };
-
- var get_time_taken = function get_default_time_taken()
- {
- var time_taken_text = response.statusMessages['Time taken'];
- return app.convert_duration_to_seconds( time_taken_text );
- };
-
- var get_default_info_text = function default_info_text()
- {
- var info_text = response.statusMessages[''] || '';
-
- // format numbers included in status nicely
- info_text = info_text.replace
- (
- /\d{4,}/g,
- function( match, position, string )
- {
- return app.format_number( parseInt( match, 10 ) );
- }
- );
-
- var time_taken_text = app.convert_seconds_to_readable_time( get_time_taken() );
- if( time_taken_text )
- {
- info_text += ' (Duration: ' + time_taken_text.esc() + ')';
- }
-
- return info_text;
- };
-
- var show_info = function show_info( info_text, elapsed_seconds )
- {
- $( '.info strong', state_element )
- .text( info_text || get_default_info_text() );
-
- $( '.info .details', state_element )
- .hide();
- };
-
- var show_full_info = function show_full_info( info_text, elapsed_seconds )
- {
- show_info( info_text, elapsed_seconds );
-
- dataimport_compute_details
- (
- response,
- $( '.info .details', state_element ),
- elapsed_seconds || get_time_taken()
- );
- };
-
- state_element
- .removeAttr( 'class' );
-
- var current_time = new Date();
- $( '.last_update abbr', state_element )
- .text( current_time.toTimeString().split( ' ' ).shift() )
- .attr( 'title', current_time.toUTCString() );
-
- $( '.info', state_element )
- .removeClass( 'loader' );
-
- if( 'busy' === status )
- {
- state_element
- .addClass( 'indexing' );
-
- if( autorefresh_status )
- {
- $( '.info', state_element )
- .addClass( 'loader' );
- }
-
- var time_elapsed_text = response.statusMessages['Time Elapsed'];
- var elapsed_seconds = app.convert_duration_to_seconds( time_elapsed_text );
- time_elapsed_text = app.convert_seconds_to_readable_time( elapsed_seconds );
-
- var info_text = time_elapsed_text
- ? 'Indexing since ' + time_elapsed_text
- : 'Indexing ...';
-
- show_full_info( info_text, elapsed_seconds );
- }
- else if( rollback_time )
- {
- state_element
- .addClass( 'failure' );
-
- show_full_info();
- }
- else if( abort_time )
- {
- state_element
- .addClass( 'aborted' );
-
- show_full_info( 'Aborting current Import ...' );
- }
- else if( 'idle' === status && 0 !== messages_count )
- {
- state_element
- .addClass( 'success' );
-
- show_full_info();
- }
- else
- {
- state_element
- .addClass( 'idle' );
-
- show_info( 'No information available (idle)' );
- }
-
- // show raw status
-
- var code = $(
- '<pre class="syntax language-json"><code>' +
- app.format_json( xhr.responseText ).esc() +
- '</code></pre>'
- );
-
- $( '#raw_output_container', content_element ).html( code );
- hljs.highlightBlock( code.get(0) );
-
- if( !app.timeout && autorefresh_status )
- {
- app.timeout = window.setTimeout
- (
- function()
- {
- dataimport_fetch_status( true )
- },
- dataimport_timeout
- );
- }
- },
- error : function( xhr, text_status, error_thrown )
- {
- console.debug( arguments );
-
- reload_config_element
- .addClass( 'error' );
- },
- complete : function( xhr, text_status )
- {
- $( 'span', status_button )
- .removeClass( 'loader' )
- .addClass( 'success' );
-
- window.setTimeout
- (
- function()
- {
- $( 'span', status_button )
- .removeClass( 'success' );
- },
- dataimport_timeout / 2
- );
- }
- }
- );
- }
-
- // form
-
- var form = $( 'form', form_element );
-
- form
- .ajaxForm
- (
- {
- url : handler_url,
- data : {
- wt : 'json',
- indent : 'true'
- },
- dataType : 'json',
- type: 'POST',
- beforeSend : function( xhr, settings )
- {
- $( 'button[type="submit"] span', form_element )
- .addClass( 'loader' );
-
- error_element
- .empty()
- .hide();
- },
- beforeSubmit : function( array, form, options )
- {
- var entity = $( '#entity', form ).val();
- if( entity.length )
- {
- array.push( { name : 'entity', value: entity } );
- }
-
- var start = parseInt( $( '#start', form ).val(), 10 );
- if( start )
- {
- array.push( { name : 'start', value: start } );
- }
-
- var rows = parseInt( $( '#rows', form ).val(), 10 );
- if( rows )
- {
- array.push( { name : 'rows', value: rows } );
- }
-
- $( 'input:checkbox', form ).not( ':checked' )
- .each( function( i, input )
- {
- array.push( { name: input.name, value: 'false' } );
- }
- );
-
- var custom_parameters = $( '#custom_parameters', form ).val();
- if( custom_parameters.length )
- {
- var params = custom_parameters.split( '&' );
- for( var i in params )
- {
- var tmp = params[i].split( '=' );
- array.push( { name : tmp[0], value: tmp[1] } );
- }
- }
-
- if( debug_mode )
- {
- array.push( { name: 'dataConfig', value: $( '#dataimport_config .editable textarea' ).val() } );
- }
- },
- success : function( response, text_status, xhr )
- {
- },
- error : function( xhr, text_status, error_thrown )
- {
- var response = null;
- try
- {
- eval( 'response = ' + xhr.responseText + ';' );
- }
- catch( e ){}
-
- error_element
- .text( response.error.msg || 'Unknown Error (Exception w/o Message)' )
- .show();
- },
- complete : function( xhr, text_status )
- {
- $( 'button[type="submit"] span', form_element )
- .removeClass( 'loader' );
-
- var debug = $( 'input[name="debug"]:checked', form );
- if( 0 !== debug.size() )
- {
- var code = $(
- '<pre class="syntax language-json"><code>' +
- app.format_json( xhr.responseText ).esc() +
- '</code></pre>'
- );
-
- $( '.content', debug_response_element ).html( code );
- hljs.highlightBlock( code.get(0) );
- }
-
- dataimport_fetch_status();
- }
- }
- );
-
- $( 'input[name="debug"]', form )
- .off( 'change' )
- .on
- (
- 'change',
- function( event )
- {
- debug_response_element.toggle( this.checked );
- }
- );
-
- $( '#auto-refresh-status a', form_element )
- .off( 'click' )
- .on
- (
- 'click',
- function( event )
- {
- $.cookie( cookie_dataimport_autorefresh, $.cookie( cookie_dataimport_autorefresh ) ? null : true );
- $( this ).trigger( 'state' );
-
- dataimport_fetch_status();
-
- return false;
- }
- )
- .off( 'state' )
- .on
- (
- 'state',
- function( event )
- {
- autorefresh_status = !!$.cookie( cookie_dataimport_autorefresh );
-
- $.cookie( cookie_dataimport_autorefresh )
- ? $( this ).addClass( 'on' )
- : $( this ).removeClass( 'on' );
- }
- )
- .trigger( 'state' );
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/documents.js b/solr/webapp/web/js/scripts/documents.js
deleted file mode 100644
index 45cfbed7d88..00000000000
--- a/solr/webapp/web/js/scripts/documents.js
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-//helper for formatting JSON and others
-var content_generator = {
-
- _default: function (toEsc) {
- return toEsc.esc();
- },
-
- json: function (toEsc) {
- return app.format_json(toEsc);
- }
-
-};
-
-//Utiltity function for turning on/off various elements
-function toggles(documents_form, show_json, show_file, show_doc, doc_text, show_wizard) {
- var the_document = $('#document', documents_form);
- if (show_doc) {
- //console.log("doc: " + doc_text);
- the_document.val(doc_text);
- the_document.show();
- } else {
- the_document.hide();
- }
- var file_upload = $('#file-upload', documents_form);
- var upload_only = $('#upload-only', documents_form);
- if (show_file) {
- file_upload.show();
- upload_only.show();
- } else {
- file_upload.hide();
- upload_only.hide();
- }
- var wizard = $('#wizard', documents_form);
- if (show_wizard) {
- wizard.show();
- } else {
- wizard.hide();
- }
-}
-// #/:core/documents
-
-//Utiltity function for setting up the wizard fields
-function addWizardFields(active_core, wizard) {
- var core_basepath = active_core.attr('data-basepath');
- var select_options = "";
- //Populate the select options based off the Fields REST API
- $.getJSON(window.location.protocol + '//' + window.location.host
- + core_basepath + "/schema/fields").done(
- //TODO: handle dynamic fields
- //TODO: get the unique key, too
- function (data) {
- var field_select = $("#wiz-field-select", wizard);
- field_select.empty();
- $.each(data.fields,
- function (i, item) {
- //console.log("i[" + i + "]=" + item.name);
- if (item.name != "_version_"){
- select_options += '<option name="' + item.name + '">'
- + item.name + '</option>';
- }
- });
- //console.log("select_options: " + select_options);
- //fill in the select options
- field_select.append(select_options);
- });
- var wizard_doc = $("#wizard-doc", wizard);
- wizard_doc.die('focusin')
- .live('focusin', function (event) {
- $("#wizard-doc", wizard).text("");
- }
- );
- //Add the click handler for the "Add Field" target, which
- //takes the field content and moves it into the document target
- var add_field = $("#add-field-href", wizard);
- add_field.die("click")
- .live("click",
- function (event) {
- //take the field and the contents and append it to the document
- var wiz_select = $("#wiz-field-select", wizard);
- var selected = $("option:selected", wiz_select);
- console.log("selected field: " + selected);
- var wiz_doc = $("#wizard-doc", wizard);
- var the_document = $("#document");
- var current_doc = the_document.val();
- console.log("current_text: " + current_doc + " wiz_doc: " + wiz_doc.val());
- var index = current_doc.lastIndexOf("}");
- var new_entry = '"' + selected.val() + '":"' + wiz_doc.val() + '"';
- if (index >= 0) {
- current_doc = current_doc.substring(0, index) + ', ' + new_entry + "}";
- } else {
- //we don't have a doc at all
- current_doc = "{" + new_entry + "}";
- }
- current_doc = content_generator['json'](current_doc);
- the_document.val(current_doc);
- //clear the wiz doc window
- wiz_doc.val("");
- return false;
- }
- );
-
- //console.log("adding " + i + " child: " + child);
-
-}
-
-//The main program for adding the docs
-sammy.get
-(
- new RegExp(app.core_regex_base + '\\/(documents)$'),
- function (context) {
- var active_core = this.active_core;
- var core_basepath = active_core.attr('data-basepath');
- var content_element = $('#content');
-
-
- $.post
- (
- 'tpl/documents.html',
- function (template) {
-
- content_element
- .html(template);
- var documents_element = $('#documents', content_element);
- var documents_form = $('#form form', documents_element);
- var url_element = $('#url', documents_element);
- var result_element = $('#result', documents_element);
- var response_element = $('#response', documents_element);
- var doc_type_select = $('#document-type', documents_form);
- //Since we are showing "example" docs, when the area receives the focus
- // remove the example content.
- $('#document', documents_form).die('focusin')
- .live('focusin',
- function (event) {
- var document_type = $('#document-type', documents_form).val();
- if (document_type != "wizard"){
- //Don't clear the document when in wizard mode.
- var the_document = $('#document', documents_form);
- the_document.text("");
- }
- }
- );
-
- /*response_element.html("");*/
- //Setup the handlers for toggling the various display options for the "Document Type" select
- doc_type_select
- .die('change')
- .live
- (
- 'change',
- function (event) {
- var document_type = $('#document-type', documents_form).val();
- var file_upload = $('#file-upload', documents_form);
-
- //need to clear out any old file upload by forcing a redraw so that
- //we don't try to upload an old file
- file_upload.html(file_upload.html());
- if (document_type == "json") {
- toggles(documents_form, true, false, true, '{"id":"change.me","title":"change.me"}', false);
- $("#attribs").show();
- } else if (document_type == "upload") {
- toggles(documents_form, false, true, false, "", false);
- $("#attribs").show();
- } else if (document_type == "csv") {
- toggles(documents_form, false, false, true, "id,title\nchange.me,change.me", false);
- $("#attribs").show();
- } else if (document_type == "solr") {
- toggles(documents_form, false, false, true, '<add>\n' +
- '<doc>\n' +
- '<field name="id">change.me</field>\n' +
- '<field name="title" >chang.me</field>\n' +
- '</doc>\n' +
- '</add>\n', false);
- $("#attribs").hide();
- } else if (document_type == "wizard") {
- var wizard = $('#wizard', documents_form);
- addWizardFields(active_core, wizard);
- //$("#wizard-doc", wizard).text('Enter your field text here and then click "Add Field" to add the field to the document.');
- toggles(documents_form, false, false, true, "", true);
- $("#attribs").show();
- } else if (document_type == "xml") {
- toggles(documents_form, false, false, true, '<doc>\n' +
- '<field name="id">change.me</field>' +
- '<field name="title">change.me</field>' +
- '</doc>', false);
- $("#attribs").show();
- }
- return false;
- }
- );
- doc_type_select.chosen().trigger('change');
- //Setup the submit option handling.
- documents_form
- .die('submit')
- .live
- (
- 'submit',
- function (event) {
- var form_values = [];
- var handler_path = $('#qt', documents_form).val();
- if ('/' !== handler_path[0]) {
- form_values.push({ name: 'qt', value: handler_path.esc() });
- handler_path = '/update';
- }
-
- var document_url = window.location.protocol + '//' + window.location.host
- + core_basepath + handler_path + '?wt=json';
-
- url_element
- .attr('href', document_url)
- .text(document_url)
- .trigger('change');
- var the_document = $('#document', documents_form).val();
- var commit_within = $('#commitWithin', documents_form).val();
- var overwrite = $('#overwrite', documents_form).val();
- var the_command = "";
- var content_type = "";
- var document_type = $('#document-type', documents_form).val();
- var doingFileUpload = false;
- //Both JSON and Wizard use the same pathway for submission
- //New entries primarily need to fill the_command and set the content_type
- if (document_type == "json" || document_type == "wizard") {
- //create a JSON command
- the_command = "{"
- + '"add":{ "doc":' + the_document + ","
- + '"overwrite":' + overwrite + ","
- + '"commitWithin":' + commit_within
- + "}}";
- content_type = "application/json";
- } else if (document_type == "csv") {
- the_command = the_document;
- document_url += "&commitWithin=" + commit_within + "&overwrite=" + overwrite;
- content_type = "application/csv";
- } else if (document_type == "xml") {
- the_command = '<add commitWithin="' + commit_within
- + '" overwrite="' + overwrite + '"'
- + ">"
- + the_document + "</add>";
- content_type = "text/xml";
- } else if (document_type == "upload") {
- doingFileUpload = true;
- } else if (document_type == "solr") {
- //guess content_type
- the_command = the_document;
- if (the_document.indexOf("<") >= 0) {
- //XML
- content_type = "text/xml";
- } else if (the_document.indexOf("{") >= 0) {
- //JSON
- content_type = "application/json";
- } //TODO: do we need to handle others?
- } else {
- //How to handle other?
- }
-
- //Handle the submission of the form in the case where we are not uploading a file
- if (doingFileUpload == false) {
- $.ajax(
- {
- url: document_url,
- //dataType : 'json',
- processData: false,
- type: 'POST',
- contentType: content_type,
- data: the_command,
- context: response_element,
- beforeSend: function (xhr, settings) {
- console.log("beforeSend: Vals: " + document_url + " content-type: " + document_type + " the cmd: " + the_command);
-
- },
- success: function (response, text_status, xhr) {
- console.log("success: " + response + " status: " + text_status + " xhr: " + xhr.responseText);
- this.html('<div><span class="description">Status</span>: ' + text_status + '</div>'
- + '<div><span class="description">Response:</span>' + '<pre class="syntax language-json"><code>' + content_generator['json'](xhr.responseText) + "</code></pre></div>");
- result_element.show();
- },
- error: function (xhr, text_status, error_thrown) {
- console.log("error: " + text_status + " thrown: " + error_thrown);
- this.html('<div><span class="description">Status</span>: ' + text_status + '</div><div><span class="description">Error:</span> '
- + '' + error_thrown
- + '</div>'
- + '<div><span class="description">Error</span>:' + '<pre class="syntax language-json"><code>'
- + content_generator['json'](xhr.responseText) +
- '</code></pre></div>');
- result_element.show();
- },
- complete: function (xhr, text_status) {
- //console.log("complete: " + text_status + " xhr: " + xhr.responseText + " doc type: " + document_type);
-
- //alert(text_status + ": " + xhr.responseText);
- /*this
- .removeClass( 'loader' );*/
- }
- }
- );
- } else {
- //upload the file
- var the_file = $('#the-file', documents_form);
- var erh_params = $('#erh-params', documents_form).val();
- if (erh_params != "") {
- if (erh_params.substring(0,1) != "&"){
- erh_params = "&" + erh_params;
- }
- document_url = document_url + erh_params;
- }
- console.log("uploading file to: " + document_url);
- the_file.ajaxfileupload({
- 'action': document_url,
- 'validate_extensions': false,
- 'upload_now': true,
- 'params': {
- 'extra': 'info'
- },
- 'onComplete': function (response) {
- response = response.replace('<pre style="word-wrap: break-word; white-space: pre-wrap;">', "");
- response = response.replace("</pre>", "");
- console.log('completed upload: ' + response);
- response_element.html('<div><span class="description">Response:</span>' + '<pre class="syntax language-json"><code>' + content_generator['json'](response) + "</code></pre></div>");
- result_element.show();
-
- },
- 'onStart': function () {
- console.log("starting file upload");
- //if (weWantedTo) return false; // cancels upload
- },
- 'onCancel': function () {
- console.log('no file selected');
- }
- });
- }
- return false;
- }
- );
- }
- )
- }
-)
-/*
- Sample docs:
- <doc boost="2.5">
- <field name="id">05991</field>
- <field name="title" boost="2.0">Bridgewater</field>
- </doc>
-
- {"id":"foo","title":"blah"}
-
- */
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/files.js b/solr/webapp/web/js/scripts/files.js
deleted file mode 100644
index c6b19519cfa..00000000000
--- a/solr/webapp/web/js/scripts/files.js
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-// #/:core/files
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(files)$' ),
- function( context )
- {
- core_basepath = this.active_core.attr( 'data-basepath' );
- current_core = context.params.splat[0];
-
- var content_element = $( '#content' );
-
- var file_endpoint = core_basepath + '/admin/file';
-
- var path = context.path.split( '?' );
- var selected_file = null;
- if( path && path[1] )
- {
- selected_file = path[1].split( '=' ).pop();
- }
-
- $.get
- (
- 'tpl/files.html',
- function( template )
- {
- content_element
- .html( template );
-
- var frame_element = $( '#frame', content_element );
-
- var tree_callback = function( event, data )
- {
- $( 'li[data-file].jstree-closed', event.currentTarget )
- .filter
- (
- function( index, element )
- {
- return selected_file && 0 === selected_file.indexOf( $( element ).data( 'file' ) );
- }
- )
- .each
- (
- function( index, element )
- {
- data.inst.open_node( element );
- }
- );
-
- if( selected_file )
- {
- $( 'li[data-file="' + selected_file.replace( /\/$/, '' ) + '"] > a', event.currentTarget )
- .addClass( 'active' );
- }
- };
-
- var load_tree = function()
- {
- $( '#tree', frame_element )
- .empty()
- .jstree
- (
- {
- plugins : [ 'json_data', 'sort' ],
- json_data : {
- ajax: {
- url : file_endpoint + '?wt=json',
- data : function( n )
- {
- if( -1 === n )
- return null;
-
- return {
- file : n.attr( 'data-file' )
- };
- },
- success : function( response, status, xhr )
- {
- var files = [];
-
- for( var file in response.files )
- {
- var is_directory = response.files[file].directory;
- var prefix = xhr.data ? xhr.data.file + '/' : ''
-
- var item = {
- data: {
- title : file,
- attr : {
- title : file,
- href : '#/' + current_core + '/files?file=' + prefix + file
- }
- },
- attr : {
- 'data-file' : prefix + file
- }
- };
-
- if( is_directory )
- {
- item.state = 'closed';
- item.data.attr.href += '/';
- }
-
- files.push( item );
- }
-
- return files;
- }
- },
- progressive_render : true
- },
- core : {
- animation : 0
- }
- }
- )
- .on
- (
- 'loaded.jstree',
- tree_callback
- )
- .on
- (
- 'open_node.jstree',
- tree_callback
- );
- };
- load_tree();
-
- if( selected_file )
- {
- $( '#new-file-holder input' )
- .val
- (
- '/' !== selected_file.substr( -1 )
- ? selected_file.replace( /[^\/]+$/, '' )
- : selected_file
- );
- }
-
- if( selected_file && '/' !== selected_file.substr( -1 ) )
- {
- frame_element
- .addClass( 'show' );
-
- var endpoint = file_endpoint + '?file=' + selected_file;
-
- var content_type_map = { xml : 'text/xml', html : 'text/html', js : 'text/javascript', json : 'application/json', 'css' : 'text/css' };
- if (selected_file == 'managed-schema') {
- endpoint += '&contentType=' + 'text/xml' + ';charset=utf-8';
- } else {
- var file_ext = selected_file.match( /\.(\w+)$/ );
- endpoint += '&contentType=' + ( content_type_map[ file_ext[1] || '' ] || 'text/plain' ) + ';charset=utf-8';
- }
-
-
- var public_url = window.location.protocol + '//' + window.location.host + endpoint;
-
- $( '#url', frame_element )
- .text( public_url )
- .attr( 'href', public_url );
-
- var load_file = function( load_tree )
- {
- if( load_tree )
- {
- load_tree();
- }
-
- $.ajax
- (
- {
- url : endpoint,
- context : frame_element,
- beforeSend : function( xhr, settings )
- {
- var block = $( '.view-file .response', this );
-
- if( !block.data( 'placeholder' ) )
- {
- block.data( 'placeholder', block.text() );
- }
-
- block
- .text( block.data( 'placeholder' ) );
- },
- success : function( response, text_status, xhr )
- {
- var content_type = xhr.getResponseHeader( 'Content-Type' ) || '';
- var highlight = null;
-
- if( 0 === content_type.indexOf( 'text/xml' ) || 0 === xhr.responseText.indexOf( '<?xml' ) ||
- 0 === content_type.indexOf( 'text/html' ) || 0 === xhr.responseText.indexOf( '<!--' ) )
- {
- highlight = 'xml';
- }
- else if( 0 === content_type.indexOf( 'text/javascript' ) )
- {
- highlight = 'javascript';
- }
- else if( 0 === content_type.indexOf( 'text/css' ) )
- {
- highlight = 'css';
- }
- else if( 0 === content_type.indexOf( 'application/json' ) )
- {
- highlight = 'json';
- }
-
- var code = $(
- '<pre class="syntax' + ( highlight ? ' language-' + highlight : '' )+ '"><code>' +
- xhr.responseText.esc() +
- '</code></pre>'
- );
- $( '.view-file .response', this )
- .html( code );
-
- if( highlight )
- {
- hljs.highlightBlock( code.get( 0 ) );
- }
-
- $( 'form textarea', this )
- .val( xhr.responseText );
- },
- error : function( xhr, text_status, error_thrown)
- {
- $( '.view-file .response', this )
- .text( 'No such file exists.' );
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
- load_file();
- }
- }
- );
- }
-);
-
-// legacy redirect for 'config' & 'schema' pages
-// #/:core/schema, #/:core/config
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(schema|config)$' ),
- function( context )
- {
- context.redirect( '#/' + context.params.splat[0] + '/files?file=' + this.active_core.attr( context.params.splat[1] ) );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/index.js b/solr/webapp/web/js/scripts/index.js
deleted file mode 100644
index d01c4a9258e..00000000000
--- a/solr/webapp/web/js/scripts/index.js
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var parse_memory_value = function( value )
-{
- if( value !== Number( value ) )
- {
- var units = 'BKMGTPEZY';
- var match = value.match( /^(\d+([,\.]\d+)?) (\w)\w?$/ );
- var value = parseFloat( match[1] ) * Math.pow( 1024, units.indexOf( match[3].toUpperCase() ) );
- }
-
- return value;
-};
-
-var generate_bar = function( bar_container, bar_data, convert_label_values )
-{
- bar_holder = $( '.bar-holder', bar_container );
-
- var bar_level = 1;
- var max_width = Math.round( $( '.bar-max', bar_holder ).width() );
- $( '.bar-max.val', bar_holder ).text( bar_data['max'] );
-
- bar_level++;
- $( '.bar-total.bar', bar_holder ).width( new String( (bar_data['total']/bar_data['max'])*100 ) + '%' );
- $( '.bar-total.val', bar_holder ).text( bar_data['total'] );
-
- if( bar_data['used'] )
- {
- bar_level++;
- $( '.bar-used.bar', bar_holder ).width( new String( (bar_data['used']/bar_data['total'])*100 ) + '%' );
- $( '.bar-used.val', bar_holder ).text( bar_data['used'] );
- }
-
- bar_holder
- .addClass( 'bar-lvl-' + bar_level );
-
- var percentage = ( ( ( bar_data['used'] || bar_data['total'] ) / bar_data['max'] ) * 100 ).toFixed(1);
-
- var hl = $( '[data-desc="' + bar_container.attr( 'id' ) + '"]' );
-
- $( '.bar-desc', hl )
- .remove();
-
- hl
- .append( ' <small class="bar-desc">' + percentage + '%</small>' );
-
- if( !!convert_label_values )
- {
- $( '.val', bar_holder )
- .each
- (
- function()
- {
- var self = $( this );
-
- var unit = null;
- var byte_value = parseInt( self.html() );
-
- self
- .attr( 'title', 'raw: ' + byte_value + ' B' );
-
- byte_value /= 1024;
- byte_value /= 1024;
- unit = 'MB';
-
- if( 1024 <= byte_value )
- {
- byte_value /= 1024;
- unit = 'GB';
- }
-
- byte_value = byte_value.toFixed( 2 ) + ' ' + unit;
-
- self
- .text( byte_value );
- }
- );
- }
-};
-
-var system_info = function( element, system_data )
-{
- // -- usage
-
- var load_average = ( system_data['system']['uptime'] || '' ).match( /load averages?: (\d+[.,]\d\d),? (\d+[.,]\d\d),? (\d+[.,]\d\d)/ );
- if( load_average )
- {
- var hl = $( '#system h2', element );
-
- $( '.bar-desc', hl )
- .remove();
-
- hl
- .append( ' <small class="bar-desc">' + load_average.slice( 1 ).join( ' ' ).replace( /,/g, '.' ).esc() + '</small>' );
- }
-
- // -- physical-memory-bar
-
- var bar_holder = $( '#physical-memory-bar', element );
- if( system_data['system']['totalPhysicalMemorySize'] === undefined || system_data['system']['freePhysicalMemorySize'] === undefined )
- {
- bar_holder.hide();
- }
- else
- {
- bar_holder.show();
-
- var bar_data = {
- 'max' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] ),
- 'total' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] - system_data['system']['freePhysicalMemorySize'] )
- };
-
- generate_bar( bar_holder, bar_data, true );
- }
-
- // -- swap-space-bar
-
- var bar_holder = $( '#swap-space-bar', element );
- if( system_data['system']['totalSwapSpaceSize'] === undefined || system_data['system']['freeSwapSpaceSize'] === undefined )
- {
- bar_holder.hide();
- }
- else
- {
- bar_holder.show();
-
- var bar_data = {
- 'max' : parse_memory_value( system_data['system']['totalSwapSpaceSize'] ),
- 'total' : parse_memory_value( system_data['system']['totalSwapSpaceSize'] - system_data['system']['freeSwapSpaceSize'] )
- };
-
- generate_bar( bar_holder, bar_data, true );
- }
-
- // -- file-descriptor-bar
-
- var bar_holder = $( '#file-descriptor-bar', element );
- if( system_data['system']['maxFileDescriptorCount'] === undefined || system_data['system']['openFileDescriptorCount'] === undefined )
- {
- bar_holder.hide();
- }
- else
- {
- bar_holder.show();
-
- var bar_data = {
- 'max' : parse_memory_value( system_data['system']['maxFileDescriptorCount'] ),
- 'total' : parse_memory_value( system_data['system']['openFileDescriptorCount'] )
- };
-
- generate_bar( bar_holder, bar_data );
- }
-
- 0 === $( '#system div[id$="-bar"]:visible', element ).size()
- ? $( '#system .no-info', element ).show()
- : $( '#system .no-info', element ).hide();
-
- // -- memory-bar
-
- var bar_holder = $( '#jvm-memory-bar', element );
- if( system_data['jvm']['memory'] === undefined )
- {
- bar_holder.hide();
- }
- else
- {
- bar_holder.show();
-
- var jvm_memory = $.extend
- (
- {
- 'free' : null,
- 'total' : null,
- 'max' : null,
- 'used' : null,
- 'raw' : {
- 'free' : null,
- 'total' : null,
- 'max' : null,
- 'used' : null,
- 'used%' : null
- }
- },
- system_data['jvm']['memory']
- );
-
- var bar_data = {
- 'max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
- 'total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
- 'used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
- };
-
- generate_bar( bar_holder, bar_data, true );
- }
-
-}
-
-// #/
-sammy.get
-(
- /^#\/$/,
- function( context )
- {
- var content_element = $( '#content' );
-
- content_element
- .html( '<div id="index"></div>' );
-
- $.ajax
- (
- {
- url : 'tpl/index.html',
- context : $( '#index', content_element ),
- beforeSend : function( arr, form, options )
- {
- },
- success : function( template )
- {
- var self = this;
-
- this
- .html( template );
-
- var data = {
- 'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
- 'jvm_version' : app.dashboard_values['jvm']['name'] + ' (' + app.dashboard_values['jvm']['version'] + ')',
- 'processors' : app.dashboard_values['jvm']['processors'],
- 'solr_spec_version' : app.dashboard_values['lucene']['solr-spec-version'] || '-',
- 'solr_impl_version' : app.dashboard_values['lucene']['solr-impl-version'] || '-',
- 'lucene_spec_version' : app.dashboard_values['lucene']['lucene-spec-version'] || '-',
- 'lucene_impl_version' : app.dashboard_values['lucene']['lucene-impl-version'] || '-'
- };
-
- for( var key in data )
- {
- var value_element = $( '.' + key + ' dd', this );
-
- value_element
- .text( data[key].esc() );
-
- value_element.closest( 'li' )
- .show();
- }
-
- var commandLineArgs = app.dashboard_values['jvm']['jmx']['commandLineArgs'].sort().reverse();
- if( 0 !== commandLineArgs.length )
- {
- var cmd_arg_element = $( '.command_line_args dt', this );
- var cmd_arg_key_element = $( '.command_line_args dt', this );
- var cmd_arg_element = $( '.command_line_args dd', this );
-
- for( var key in commandLineArgs )
- {
- cmd_arg_element = cmd_arg_element.clone();
- cmd_arg_element.text( commandLineArgs[key] );
-
- cmd_arg_key_element
- .after( cmd_arg_element );
- }
-
- cmd_arg_key_element.closest( 'li' )
- .show();
-
- $( '.command_line_args dd:last', this )
- .remove();
-
- $( '.command_line_args dd:odd', this )
- .addClass( 'odd' );
- }
-
- $( '.timeago', this )
- .timeago();
-
- $( '.index-left .block li:visible:odd', this )
- .addClass( 'odd' );
-
- // -- system_info
-
- system_info( this, app.dashboard_values );
-
- $( '#system a.reload', this )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : config.solr_path + '/admin/info/system?wt=json',
- dataType : 'json',
- context : this,
- beforeSend : function( arr, form, options )
- {
- loader.show( this );
- },
- success : function( response )
- {
- system_info( self, response );
- },
- error : function()
- {
- },
- complete : function()
- {
- loader.hide( this );
- }
- }
- );
-
- return false;
- }
- );
- },
- error : function( xhr, text_status, error_thrown )
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/java-properties.js b/solr/webapp/web/js/scripts/java-properties.js
deleted file mode 100644
index a37ddd97ac8..00000000000
--- a/solr/webapp/web/js/scripts/java-properties.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-// #/~java-properties
-sammy.get
-(
- /^#\/(~java-properties)$/,
- function( context )
- {
- var content_element = $( '#content' );
-
- content_element
- .html( '<div id="java-properties"></div>' );
-
- $.ajax
- (
- {
- url : app.config.solr_path + '/admin/info/properties?wt=json',
- dataType : 'json',
- context : $( '#java-properties', content_element ),
- beforeSend : function( xhr, settings )
- {
- this
- .html( '<div class="loader">Loading ...</div>' );
- },
- success : function( response, text_status, xhr )
- {
- var system_properties = response['system.properties'];
- var properties_data = {};
- var properties_content = [];
- var properties_order = [];
-
- var workaround = xhr.responseText.match( /"(line\.separator)"\s*:\s*"(.+?)"/ );
- if( workaround && workaround[2] )
- {
- system_properties[workaround[1]] = workaround[2];
- }
-
- for( var key in system_properties )
- {
- var displayed_key = key.replace( /\./g, '.&#8203;' );
- var displayed_value = [ system_properties[key] ];
- var item_class = 'clearfix';
-
- if( -1 !== key.indexOf( '.path' ) || -1 !== key.indexOf( '.dirs' ) )
- {
- displayed_value = system_properties[key].split( system_properties['path.separator'] );
- if( 1 < displayed_value.length )
- {
- item_class += ' multi';
- }
- }
-
- var item_content = '<li><dl class="' + item_class + '">' + "\n"
- + '<dt>' + displayed_key.esc() + '</dt>' + "\n";
-
- for( var i in displayed_value )
- {
- item_content += '<dd>' + displayed_value[i].esc() + '</dd>' + "\n";
- }
-
- item_content += '</dl></li>';
-
- properties_data[key] = item_content;
- properties_order.push( key );
- }
-
- properties_order.sort();
- for( var i in properties_order )
- {
- properties_content.push( properties_data[properties_order[i]] );
- }
-
- this
- .html( '<ul>' + properties_content.join( "\n" ) + '</ul>' );
-
- $( 'li:odd', this )
- .addClass( 'odd' );
-
- $( '.multi dd:odd', this )
- .addClass( 'odd' );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/logging.js b/solr/webapp/web/js/scripts/logging.js
deleted file mode 100644
index a632ab6b5e4..00000000000
--- a/solr/webapp/web/js/scripts/logging.js
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var loglevel_path = app.config.solr_path + '/admin/info/logging';
-var cookie_logging_timezone = 'logging_timezone';
-var frame_element = null;
-
-var logging_handler = function( response, text_status, xhr )
-{
- var self = this;
- var loggers = response.loggers;
-
- var levels = '<div class="selector-holder"><div class="selector">' + "\n"
- + '<a class="trigger"><span><em>null</em></span></a>' + "\n"
- + '<ul>' + "\n";
-
- for( var key in response.levels )
- {
- var level = response.levels[key].esc();
- levels += '<li><a href="#" data-level="' + level + '">' + level + '</a></li>' + "\n";
- }
-
- levels += '<li class="unset"><a href="#" data-level="unset">UNSET</a></li>' + "\n"
- + '</ul>' + "\n"
- + '<a class="close"><span>[x]</span></a>' + "\n"
- + '</div></div>';
-
- var logger_tree = function( filter )
- {
- var logger_content = '';
- var filter_regex = new RegExp( '^' + filter + '\\.\\w+$' );
-
- for( var i in loggers )
- {
- var logger = loggers[i];
- var continue_matcher = false;
-
- if( !filter )
- {
- continue_matcher = logger.name.indexOf( '.' ) !== -1;
- }
- else
- {
- continue_matcher = !logger.name.match( filter_regex );
- }
-
- if( continue_matcher )
- {
- continue;
- }
-
- var logger_class = '';
-
- if( logger.set )
- {
- logger_class = 'set';
- }
-
- if( !logger.level )
- {
- logger_class = 'null';
- }
-
- var logger_name = logger.name.split( '.' );
- var display_name = logger_name.pop();
-
- var leaf_class = 'jstree-leaf';
- if( logger.level )
- {
- leaf_class += ' level-' + logger.level.esc().toLowerCase();
- }
-
- logger_content += '<li class="' + leaf_class + '" data-logger="' + logger.name.esc() + '">';
- logger_content += '<ins class="trigger jstree-icon">&nbsp;</ins>' + "\n";
- logger_content += '<a href="#" class="trigger '+ logger_class + '"' ;
-
- if( logger.level )
- {
- logger_content += 'rel="' + logger.level.esc() + '" ';
- }
-
- logger_content += 'title="' + logger.name.esc() + '">' + "\n";
-
- if( 0 !== logger_name.length )
- {
- logger_content += '<span class="ns">' + logger_name.join( '.' ).esc() + '.</span>';
- }
-
- logger_content += '<span class="name">' + ( display_name ? display_name.esc() : '<em>empty</em>' ) + '</span>' + "\n";
- logger_content += '</a>';
-
- logger_content += levels;
-
- if( !!logger.name )
- {
- var child_logger_content = logger_tree( logger.name );
- if( child_logger_content )
- {
- logger_content += '<ul>';
- logger_content += child_logger_content;
- logger_content += '</ul>';
- }
- }
-
- logger_content += '</li>';
- }
-
- return logger_content;
- };
-
- var logger_content = '<div class="block">' + "\n"
- + '<h2><span>' + response.watcher.esc() + '</span></h2>' + "\n"
- + '<ul class="tree jstree">' + logger_tree( null ) + '</ul>' + "\n"
- + '</div>';
-
- self
- .html( logger_content );
-
- self
- .die( 'clear' )
- .live
- (
- 'clear',
- function( event )
- {
- $( '.open', this )
- .removeClass( 'open' );
- }
- );
-
- $( 'li:last-child', this )
- .addClass( 'jstree-last' );
-
- $( 'li.jstree-leaf > a', this )
- .each
- (
- function( index, element )
- {
- element = $( element );
- var level = element.attr( 'rel' );
-
- if( level )
- {
- var selector = $( '.selector-holder', element.closest( 'li' ) );
-
- var trigger = $( 'a.trigger', selector );
-
- trigger
- .text( level.esc() );
-
- if( element.hasClass( 'set' ) )
- {
- trigger.first()
- .addClass( 'set' );
- }
-
- $( 'ul a[data-level="' + level + '"]', selector ).first()
- .addClass( 'level' );
- }
- }
- )
-
- $( '.trigger', this )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- self.trigger( 'clear' );
-
- $( '.selector-holder', $( this ).parents( 'li' ).first() ).first()
- .trigger( 'toggle' );
-
- return false;
- }
- );
-
- $( '.selector .close', this )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- self.trigger( 'clear' );
- return false;
- }
- );
-
- $( '.selector-holder', this )
- .die( 'toggle')
- .live
- (
- 'toggle',
- function( event )
- {
- var row = $( this ).closest( 'li' );
-
- $( 'a:first', row )
- .toggleClass( 'open' );
-
- $( '.selector-holder:first', row )
- .toggleClass( 'open' );
- }
- );
-
- $( '.selector ul a', this )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var element = $( this );
-
- $.ajax
- (
- {
- url : loglevel_path,
- dataType : 'json',
- data : {
- 'wt' : 'json',
- 'set' : $( this ).parents( 'li[data-logger]' ).data( 'logger' ) + ':' + element.data( 'level' )
- },
- type : 'POST',
- context : self,
- beforeSend : function( xhr, settings )
- {
- element
- .addClass( 'loader' );
- },
- success : logging_handler
- }
- );
-
- return false;
- }
- );
-
-};
-
-var format_time_options = {};
-
-var format_time = function( time )
-{
- time = time ? new Date( time ) : new Date();
- return '<time datetime="' + time.toISOString().esc() + '">' + format_time_content( time ) + '</abbr>';
-}
-
-var format_time_content = function( time )
-{
- return time.toLocaleString( undefined, format_time_options ).esc();
-}
-
-var load_logging_viewer = function()
-{
- var table = $( 'table', frame_element );
- var state = $( '#state', frame_element );
- var since = table.data( 'latest' ) || 0;
- var sticky_mode = null;
-
- $.ajax
- (
- {
- url : loglevel_path + '?wt=json&since=' + since,
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- // initial request
- if( 0 === since )
- {
- sticky_mode = true;
- }
-
- // state element is in viewport
- else if( state.position().top <= $( window ).scrollTop() + $( window ).height() - ( $( 'body' ).height() - state.position().top ) )
- {
- sticky_mode = true;
- }
-
- else
- {
- sticky_mode = false;
- }
- },
- success : function( response, text_status, xhr )
- {
- var docs = response.history.docs;
- var docs_count = docs.length;
-
- var table = $( 'table', frame_element );
-
- $( 'h2 span', frame_element )
- .text( response.watcher.esc() );
-
- state
- .html( 'Last Check: ' + format_time() );
-
- app.timeout = setTimeout
- (
- load_logging_viewer,
- 10000
- );
-
- if( 0 === docs_count )
- {
- table.trigger( 'update' );
- return false;
- }
-
- var content = '<tbody>';
-
- for( var i = 0; i < docs_count; i++ )
- {
- var doc = docs[i];
-
- if( 1 === doc.time.length )
- {
- for( var key in doc )
- {
- doc[key] = doc[key][0];
- }
- }
-
- if( !doc.trace )
- {
- var lines = doc.message.split( "\n" );
- if( 1 < lines.length )
- {
- doc.trace = doc.message;
- doc.message = lines[0];
- delete lines;
- }
- }
-
- var has_trace = 'undefined' !== typeof( doc.trace );
-
- doc.logger = '<abbr title="' + doc.logger.esc() + '">' + doc.logger.split( '.' ).pop().esc() + '</abbr>';
-
- var classes = [ 'level-' + doc.level.toLowerCase().esc() ];
- if( has_trace )
- {
- classes.push( 'has-trace' );
- }
-
- content += '<tr class="' + classes.join( ' ' ) + '">' + "\n";
- content += '<td class="span"><a><span>' + format_time( doc.time ) + '</span></a></td>' + "\n";
- content += '<td class="level span"><a><span>' + doc.level.esc() + '</span></span></a></td>' + "\n";
- content += '<td class="span"><a><span>' + doc.core + '</span></a></td>' + "\n";
- content += '<td class="span"><a><span>' + doc.logger + '</span></a></td>' + "\n";
- content += '<td class="message span"><a><span>' + doc.message.replace( /,/g, ',&#8203;' ).esc() + '</span></a></td>' + "\n";
- content += '</tr>' + "\n";
-
- if( has_trace )
- {
- content += '<tr class="trace">' + "\n";
- content += '<td colspan="4"><pre>' + doc.trace.esc() + '</pre></td>' + "\n";
- content += '</tr>' + "\n";
- }
-
- }
-
- content += '</tbody>';
-
- $( 'table', frame_element )
- .append( content );
-
- table
- .data( 'latest', response.info.last )
- .removeClass( 'has-data' )
- .trigger( 'update' );
-
- if( sticky_mode )
- {
- $( 'body' )
- .animate
- (
- { scrollTop: state.position().top },
- 1000
- );
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
-}
-
-// #/~logging
-sammy.get
-(
- /^#\/(~logging)$/,
- function( context )
- {
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/logging.html',
- function( template )
- {
- content_element
- .html( template );
-
- frame_element = $( '#frame', content_element );
- frame_element
- .html
- (
- '<div id="viewer">' + "\n" +
- '<div class="block">' + "\n" +
- '<h2><span>&nbsp;</span></h2>' + "\n" +
- '</div>' + "\n" +
- '<table border="0" cellpadding="0" cellspacing="0">' + "\n" +
- '<thead>' + "\n" +
- '<tr>' + "\n" +
- '<th class="time">Time (<span>Local</span>)</th>' + "\n" +
- '<th class="level">Level</th>' + "\n" +
- '<th class="core">Core</th>' + "\n" +
- '<th class="logger">Logger</th>' + "\n" +
- '<th class="message">Message</th>' + "\n" +
- '</tr>' + "\n" +
- '</thead>' + "\n" +
- '<tfoot>' + "\n" +
- '<tr>' + "\n" +
- '<td colspan="4">No Events available</td>' + "\n" +
- '</tr>' + "\n" +
- '</thead>' + "\n" +
- '</table>' + "\n" +
- '<div id="footer" class="clearfix">' + "\n" +
- '<div id="state" class="loader">&nbsp;</div>' + "\n" +
- '<div id="date-format"><a>Show dates in UTC</a></div>' + "\n" +
- '</div>' + "\n" +
- '</div>'
- );
-
- var table = $( 'table', frame_element );
-
- table
- .die( 'update' )
- .live
- (
- 'update',
- function( event )
- {
- var table = $( this );
- var tbody = $( 'tbody', table );
-
- 0 !== tbody.size()
- ? table.addClass( 'has-data' )
- : table.removeClass( 'has-data' );
-
- return false;
- }
- );
-
- load_logging_viewer();
-
- $( '.has-trace a', table )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).closest( 'tr' )
- .toggleClass( 'open' )
- .next().toggle();
-
- return false;
- }
- );
-
- var date_format = $( '#date-format a', frame_element );
-
- date_format
- .off( 'click' )
- .on
- (
- 'click',
- function( event )
- {
- var self = $( this );
-
- if( !self.hasClass( 'on' ) )
- {
- self.addClass( 'on' );
- $( 'table th.time span', frame_element ).text( 'UTC' );
- format_time_options.timeZone = 'UTC';
- $.cookie( cookie_logging_timezone, 'UTC' );
- }
- else
- {
- self.removeClass( 'on' );
- $( 'table th.time span', frame_element ).text( 'Local' );
- delete format_time_options.timeZone;
- $.cookie( cookie_logging_timezone, null );
- }
-
- $( 'time', frame_element )
- .each
- (
- function( index, element )
- {
- var self = $( element );
- self.text( format_time_content( new Date( self.attr( 'datetime' ) ) ) );
- }
- )
-
- return false;
- }
- );
-
- if( 'UTC' === $.cookie( cookie_logging_timezone ) )
- {
- date_format
- .trigger( 'click' );
- }
- }
- );
- }
-);
-
-// #/~logging/level
-sammy.get
-(
- /^#\/(~logging)\/level$/,
- function( context )
- {
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/logging.html',
- function( template )
- {
- content_element
- .html( template );
-
- $( '#menu a[href="' + context.path + '"]' )
- .parent().addClass( 'active' );
-
- $.ajax
- (
- {
- url : loglevel_path + '?wt=json',
- dataType : 'json',
- context : $( '#frame', content_element ),
- beforeSend : function( xhr, settings )
- {
- this
- .html( '<div class="loader">Loading ...</div>' );
- },
- success : logging_handler
- }
- );
- }
- );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/ping.js b/solr/webapp/web/js/scripts/ping.js
deleted file mode 100644
index 537724afe64..00000000000
--- a/solr/webapp/web/js/scripts/ping.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-$( '.ping a', app.core_menu )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : $( this ).attr( 'rel' ) + '?wt=json&ts=' + (new Date).getTime(),
- dataType : 'json',
- context: this,
- beforeSend : function( arr, form, options )
- {
- loader.show( this );
- },
- success : function( response, text_status, xhr )
- {
- $( this )
- .removeAttr( 'title' );
-
- $( this ).parents( 'li' )
- .removeClass( 'error' );
-
- var qtime_element = $( '.qtime', this );
-
- if( 0 === qtime_element.size() )
- {
- qtime_element = $( '<small class="qtime"> (<span></span>)</small>' );
-
- $( this )
- .append( qtime_element );
- }
-
- $( 'span', qtime_element )
- .html( response.responseHeader.QTime + 'ms' );
- },
- error : function( xhr, text_status, error_thrown )
- {
- $( this )
- .attr( 'title', '/admin/ping is not configured (' + xhr.status + ': ' + error_thrown + ')' );
-
- $( this ).parents( 'li' )
- .addClass( 'error' );
- },
- complete : function( xhr, text_status )
- {
- loader.hide( this );
- }
- }
- );
-
- return false;
- }
- );
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/plugins.js b/solr/webapp/web/js/scripts/plugins.js
deleted file mode 100644
index f68682f0623..00000000000
--- a/solr/webapp/web/js/scripts/plugins.js
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var core_basepath = null;
-var content_element = null;
-var selected_type = null;
-var context_path = null;
-var active_context = null;
-var changes = null;
-var reference_xml = null;
-
-var compute_plugin_data = function( response, changeset )
-{
- var types = [];
- var sort_table = {};
- var plugin_data = {};
-
- var types_obj = {};
- var plugin_key = null;
-
- changes = { count : {}, list : {} }
-
- for( var i = 0; i < response['solr-mbeans'].length; i++ )
- {
- if( !( i % 2 ) )
- {
- plugin_key = response['solr-mbeans'][i];
- }
- else
- {
- plugin_data[plugin_key] = response['solr-mbeans'][i];
- }
- }
-
- for( var key in plugin_data )
- {
- sort_table[key] = {
- url : [],
- component : [],
- handler : []
- };
- for( var part_key in plugin_data[key] )
- {
- if( plugin_data[key][part_key]['_changed_'] )
- {
- delete plugin_data[key][part_key]['_changed_'];
-
- changes.count[key] = changes.count[key] || 0;
- changes.count[key]++;
-
- changes.list[key] = changes.list[key] || {};
- changes.list[key][part_key] = true;
- }
-
- if( 0 < part_key.indexOf( '.' ) )
- {
- types_obj[key] = true;
- sort_table[key]['handler'].push( part_key );
- }
- else if( 0 === part_key.indexOf( '/' ) )
- {
- types_obj[key] = true;
- sort_table[key]['url'].push( part_key );
- }
- else
- {
- types_obj[key] = true;
- sort_table[key]['component'].push( part_key );
- }
- }
- }
-
- for( var type in types_obj )
- {
- types.push( type );
- }
- types.sort();
-
- return {
- 'plugin_data' : plugin_data,
- 'sort_table' : sort_table,
- 'types' : types
- };
-};
-
-var render_plugin_data = function( plugin_data, plugin_sort, types )
-{
- var frame_element = $( '#frame', content_element );
- var navigation_element = $( '#navigation ul', content_element );
-
- var navigation_content = [];
- for( var i = 0; i < types.length; i++ )
- {
- var type_url = active_context.params.splat[0] + '/' + active_context.params.splat[1] + '/' + types[i].toLowerCase();
-
- var navigation_markup = '<li class="' + types[i].toLowerCase().esc() + '">' +
- '<a href="#/' + type_url + '" rel="' + types[i].esc() + '">' + types[i].esc();
-
- if( changes.count[types[i]] )
- {
- navigation_markup += ' <span>' + changes.count[types[i]].esc() + '</span>';
- }
-
- navigation_markup += '</a>' +
- '</li>';
-
- navigation_content.push( navigation_markup );
- }
-
- navigation_content.push( '<li class="PLUGINCHANGES"><a href="#">Watch Changes</a></li>' );
- navigation_content.push( '<li class="RELOAD"><a href="#" onClick="window.location.reload()">Refresh Values</a></li>' );
-
- navigation_element
- .html( navigation_content.join( "\n" ) );
-
- $( '.PLUGINCHANGES a', navigation_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- load_reference_xml();
-
- changes = { count : {}, list : {} }
- $( 'a > span', navigation_element ).remove();
- $( '.entry.changed', frame_element ).removeClass( 'changed' );
-
- $.blockUI
- (
- {
- message: $('#recording'),
- css: { width: '450px' }
- }
- );
-
- return false;
- }
- );
-
- $( '#recording button' )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- type: 'POST',
- url: core_basepath + '/admin/mbeans',
- dataType : 'json',
- data: {
- 'stats': 'true',
- 'wt': 'json',
- 'diff': 'true',
- 'all': 'true',
- 'stream.body': reference_xml
- },
- success : function( response, text_status, xhr )
- {
- load_reference_xml();
-
- app.plugin_data = compute_plugin_data( response );
- render_plugin_data( app.plugin_data.plugin_data, app.plugin_data.sort_table, app.plugin_data.types );
- }
- }
- );
- $.unblockUI();
- return false;
- }
- );
-
- $( 'a[href="' + context_path + '"]', navigation_element )
- .parent().addClass( 'current' );
-
- var content = '<ul>';
- for( var sort_key in plugin_sort[selected_type] )
- {
- plugin_sort[selected_type][sort_key].sort();
- var plugin_type_length = plugin_sort[selected_type][sort_key].length;
-
- for( var i = 0; i < plugin_type_length; i++ )
- {
- var bean = plugin_sort[selected_type][sort_key][i];
- var classes = [ 'entry' ];
-
- if( changes.list[selected_type] && changes.list[selected_type][bean] )
- {
- classes.push( 'changed' );
- }
-
- content += '<li class="' + classes.join( ' ' ) + '">' + "\n";
- content += '<a href="' + context_path + '?entry=' + bean.esc() + '" data-bean="' + bean.esc() + '">';
- content += '<span>' + bean.esc() + '</span>';
- content += '</a>' + "\n";
- content += '<ul class="detail">' + "\n";
-
- var details = plugin_data[selected_type][ plugin_sort[selected_type][sort_key][i] ];
- for( var detail_key in details )
- {
- if( 'stats' !== detail_key )
- {
- var detail_value = details[detail_key];
-
- if( 'description' === detail_key )
- {
- // Link component list to their MBeans page
- if(detail_value.match(/^Search using components: /)) {
- var idx = detail_value.indexOf(':');
- var url = '#/'+active_context.params.splat[0]+'/plugins/other?entry=';
- var tmp = 'Search using components:<ul>';
- $.each(detail_value.substr(idx+1).split(","), function(index, value) {
- value = $.trim(value);
- tmp += '<li><a href="'+url+value+'" class="linker">'+value+"</a></li>";
- });
- tmp += "</ul>";
- detail_value = tmp;
- }
- }
-
- content += '<li><dl class="clearfix">' + "\n";
- content += '<dt>' + detail_key.esc() + ':</dt>' + "\n";
- if($.isArray(detail_value)) {
- $.each(detail_value, function(index, value) {
- content += '<dd>' + value.esc() + '</dd>' + "\n";
- });
- }
- else {
- content += '<dd>' + new String( detail_value ).esc() + '</dd>' + "\n";
- }
- content += '</dl></li>' + "\n";
- }
- else if( 'stats' === detail_key && details[detail_key] )
- {
- content += '<li class="stats clearfix">' + "\n";
- content += '<span>' + detail_key.esc() + ':</span>' + "\n";
- content += '<ul>' + "\n";
-
- for( var stats_key in details[detail_key] )
- {
- var stats_value = new String( details[detail_key][stats_key] );
- stats_value = stats_value.replace( /([\(@])/g, '$1&#8203;' );
-
- content += '<li><dl class="clearfix">' + "\n";
- content += '<dt>' + stats_key.esc() + ':</dt>' + "\n";
- content += '<dd>' + stats_value.esc() + '</dd>' + "\n";
- content += '</dl></li>' + "\n";
- }
-
- content += '</ul></li>' + "\n";
- }
- }
-
- content += '</ul>' + "\n";
- }
- }
- content += '</ul>' + "\n";
-
- frame_element
- .html( content );
-
-
- var path = active_context.path.split( '?entry=' );
- var entries = ( path[1] || '' ).split( ',' );
-
- var entry_count = entries.length;
- for( var i = 0; i < entry_count; i++ )
- {
- $( 'a[data-bean="' + entries[i].esc() + '"]', frame_element )
- .parent().addClass( 'expanded' );
- }
-
- $( 'a', frame_element )
- .off( 'click' )
- .on
- (
- 'click',
- function( event )
- {
- var self = $( this );
- var bean = self.data( 'bean' );
-
- var split = '?entry=';
- var path = active_context.path.split( split );
- var entry = ( path[1] || '' );
-
- var regex = new RegExp( bean.replace( /\//g, '\\/' ) + '(,|$)' );
- var match = regex.test( entry );
-
- var url = path[0] + split;
-
- url += match
- ? entry.replace( regex, '' )
- : entry + ',' + bean;
-
- url = url.replace( /=,/, '=' );
- url = url.replace( /,$/, '' );
- url = url.replace( /\?entry=$/, '' );
-
- active_context.redirect( url );
- return false;
- }
- );
-
- // Try to make links for anything with http (but leave the rest alone)
- $( '.detail dd' ).each(function(index) {
- var txt = $(this).html();
- if(txt.indexOf("http") >= 0) {
- $(this).linker({
- className : 'linker'
- });
- }
- });
-
- // Add invisible whitespace after each slash
- $( '.detail a.linker' ).each(function(index) {
- $(this).html( $(this).html().replace( /\//g, '/&#8203;' ) );
- });
-
-
- $( '.entry', frame_element )
- .each
- (
- function( i, entry )
- {
- $( '.detail > li', entry ).not( '.stats' ).filter( ':even' )
- .addClass( 'odd' );
-
- $( '.stats li:odd', entry )
- .addClass( 'odd' );
- }
- );
-};
-
-var load_reference_xml = function()
-{
- $.ajax
- (
- {
- type: 'GET',
- url: core_basepath + '/admin/mbeans?stats=true&wt=xml',
- dataType : 'text',
- success: function( data )
- {
- reference_xml = data;
- }
- }
- );
-}
-
-sammy.bind
-(
- 'plugins_load',
- function( event, params )
- {
- var callback = function()
- {
- params.callback( app.plugin_data.plugin_data, app.plugin_data.sort_table, app.plugin_data.types );
- }
-
- if( app.plugin_data )
- {
- callback( app.plugin_data );
- return true;
- }
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/mbeans?stats=true&wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- app.plugin_data = compute_plugin_data( response );
-
- $.get
- (
- 'tpl/plugins.html',
- function( template )
- {
- $( '#content' )
- .html( template );
-
- callback( app.plugin_data );
- }
- );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
-);
-
-// #/:core/plugins/$type
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(plugins)\\/(\\w+)$' ),
- function( context )
- {
- core_basepath = this.active_core.attr( 'data-basepath' );
- content_element = $( '#content' );
- selected_type = context.params.splat[2].toUpperCase();
- context_path = context.path.split( '?' ).shift();
- active_context = context;
-
- sammy.trigger
- (
- 'plugins_load',
- {
- active_core : this.active_core,
- callback : render_plugin_data
- }
- );
- }
-);
-
-// #/:core/plugins
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(plugins)$' ),
- function( context )
- {
- core_basepath = this.active_core.attr( 'data-basepath' );
- delete app.plugin_data;
-
- sammy.trigger
- (
- 'plugins_load',
- {
- active_core : this.active_core,
- callback : function( plugin_data, plugin_sort, types )
- {
- context.redirect( context.path + '/' + types[0].toLowerCase() );
- }
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/query.js b/solr/webapp/web/js/scripts/query.js
deleted file mode 100644
index 417fef99373..00000000000
--- a/solr/webapp/web/js/scripts/query.js
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-// #/:core/query
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(query)$' ),
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/query.html',
- function( template )
- {
- content_element
- .html( template );
-
- var query_element = $( '#query', content_element );
- var query_form = $( '#form form', query_element );
- var url_element = $( '#url', query_element );
- var result_element = $( '#result', query_element );
- var response_element = $( '#response', result_element );
-
- url_element
- .die( 'change' )
- .live
- (
- 'change',
- function( event )
- {
- var wt = $( '[name="wt"]', query_form ).val();
-
- var content_generator = {
-
- _default : function( xhr )
- {
- return xhr.responseText.esc();
- },
-
- json : function( xhr )
- {
- return app.format_json( xhr.responseText );
- }
-
- };
-
- $.ajax
- (
- {
- url : this.href,
- dataType : wt,
- context : response_element,
- beforeSend : function( xhr, settings )
- {
- this
- .html( '<div class="loader">Loading ...</div>' );
- },
- complete : function( xhr, text_status )
- {
- var code = $(
- '<pre class="syntax language-' + wt + '"><code>' +
- ( content_generator[wt] || content_generator['_default'] )( xhr ) +
- '</code></pre>'
- );
- this.html( code );
-
- if( 'success' === text_status )
- {
- hljs.highlightBlock( code.get(0) );
- }
- }
- }
- );
- }
- )
-
- $( '.optional legend input[type=checkbox]', query_form )
- .die( 'change' )
- .live
- (
- 'change',
- function( event )
- {
- var fieldset = $( this ).parents( 'fieldset' );
-
- this.checked
- ? fieldset.addClass( 'expanded' )
- : fieldset.removeClass( 'expanded' );
- }
- );
-
- $( '.multiple a', query_form )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var self = $( this );
- var row = self.closest( '.row' );
- var container = self.closest( '.multiple' );
-
- var add = parseInt( self.data( 'action' ), 10 );
- if( add )
- {
- var new_row = row.clone();
- new_row.find( 'input' ).val( '' );
- row.after( new_row );
- row.next().find( 'input' ).focus();
- }
- else if( 1 === $( '.row', container ).size() )
- {
- row.find( 'input' ).val( '' ).focus();
- }
- else
- {
- row.remove();
- container.find( 'input:last' ).focus();
- }
-
- return false;
- }
- )
-
- query_form
- .die( 'submit' )
- .live
- (
- 'submit',
- function( event )
- {
- var form_values = [];
-
- var add_to_form_values = function add_to_form_values( fields )
- {
- for( var i in fields )
- {
- if( !fields[i].value || 0 === fields[i].value.length )
- {
- continue;
- }
-
- form_values.push( fields[i] );
- }
- };
-
- var fieldsets = $( '> fieldset', query_form );
-
- var fields = fieldsets.first().formToArray( true );
- add_to_form_values( fields );
-
- fieldsets.not( '.common' )
- .each
- (
- function( i, set )
- {
- if( $( 'legend input', set ).is( ':checked' ) )
- {
- var fields = $( set ).formToArray( true );
- add_to_form_values( fields );
- }
- }
- );
-
- var handler_path = $( '#qt', query_form ).val();
- if( '/' !== handler_path[0] )
- {
- form_values.push( { name : 'qt', value : handler_path.esc() } );
- handler_path = '/select';
- }
-
- var query_url = window.location.protocol + '//' + window.location.host
- + core_basepath + handler_path + '?' + $.param( form_values );
-
- var custom_parameters = $( '#custom_parameters', query_form ).val();
- if( custom_parameters && 0 !== custom_parameters.length )
- {
- query_url += '&' + custom_parameters.replace( /^&/, '' );
- }
-
- url_element
- .attr( 'href', query_url )
- .text( query_url )
- .trigger( 'change' );
-
- result_element
- .show();
-
- return false;
- }
- );
-
- var fields = 0;
- for( var key in context.params )
- {
- if( 'string' === typeof context.params[key] )
- {
- fields++;
- $( '[name="' + key + '"]', query_form )
- .val( context.params[key] );
- }
- }
-
- if( 0 !== fields )
- {
- query_form
- .trigger( 'submit' );
- }
- }
- );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/replication.js b/solr/webapp/web/js/scripts/replication.js
deleted file mode 100644
index f407f868240..00000000000
--- a/solr/webapp/web/js/scripts/replication.js
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var timer_element = null;
-var timer_timeout = null;
-
-var core_basepath = null;
-var navigation_element = null;
-var replication_element = null;
-
-var init_timer = function( next_tick )
-{
- if( timer_timeout )
- {
- window.clearTimeout( timer_timeout );
- }
- update_timer( next_tick );
-}
-
-var update_timer = function( next_tick )
-{
- if( 0 === next_tick )
- {
- replication_fetch_status();
- return false;
- }
-
- $( 'p .tick', timer_element )
- .text( app.convert_seconds_to_readable_time( next_tick ) );
-
- timer_timeout = window.setTimeout
- (
- 'update_timer( ' + --next_tick + ' )',
- 1000
- );
-}
-
-var clear_timer = function()
-{
- if( timer_timeout )
- {
- window.clearTimeout( timer_timeout );
- timer_element.hide();
- }
-}
-
-var replication_fetch_status = function()
-{
- $.ajax
- (
- {
- url : core_basepath + '/replication?command=details&wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- $( '.refresh-status span', navigation_element )
- .addClass( 'loader' );
-
- clear_timer();
- },
- success : function( response, text_status, xhr )
- {
- $( '.refresh-status span', navigation_element )
- .removeClass( 'loader' );
-
- var data = response.details;
- var is_slave = 'true' === data.isSlave;
-
- replication_element
- .addClass( is_slave ? 'slave' : 'master' );
-
- if( is_slave )
- {
- var error_element = $( '#error', replication_element );
-
- if( data.slave.ERROR )
- {
- error_element
- .html( data.slave.ERROR )
- .show();
- }
- else
- {
- error_element
- .hide()
- .empty();
- }
-
- var progress_element = $( '#progress', replication_element );
-
- var start_element = $( '#start', progress_element );
- $( 'span', start_element )
- .text( data.slave.replicationStartTime );
-
- var eta_element = $( '#eta', progress_element );
- $( 'span', eta_element )
- .text( app.convert_seconds_to_readable_time( data.slave.timeRemaining ) );
-
- var bar_element = $( '#bar', progress_element );
- $( '.files span', bar_element )
- .text( data.slave.numFilesToDownload );
- $( '.size span', bar_element )
- .text( data.slave.bytesToDownload );
-
- var speed_element = $( '#speed', progress_element );
- $( 'span', speed_element )
- .text( data.slave.downloadSpeed );
-
- var done_element = $( '#done', progress_element );
- $( '.files span', done_element )
- .text( data.slave.numFilesDownloaded );
- $( '.size span', done_element )
- .text( data.slave.bytesDownloaded );
- $( '.percent span', done_element )
- .text( parseInt(data.slave.totalPercent ) );
-
- var percent = parseInt( data.slave.totalPercent );
- if( 0 === percent )
- {
- done_element
- .css( 'width', '1px' );
- }
- else
- {
- done_element
- .css( 'width', percent + '%' );
- }
-
- var current_file_element = $( '#current-file', replication_element );
- $( '.file', current_file_element )
- .text( data.slave.currentFile );
- $( '.done', current_file_element )
- .text( data.slave.currentFileSizeDownloaded );
- $( '.total', current_file_element )
- .text( data.slave.currentFileSize );
- $( '.percent', current_file_element )
- .text( parseInt( data.slave.currentFileSizePercent ) );
-
- if( !data.slave.indexReplicatedAtList )
- {
- data.slave.indexReplicatedAtList = [];
- }
-
- if( !data.slave.replicationFailedAtList )
- {
- data.slave.replicationFailedAtList = [];
- }
-
- var iterations_element = $( '#iterations', replication_element );
- var iterations_list = $( '.iterations ul', iterations_element );
-
- var iterations_data = [];
- var iterations_obj = {};
-
- for( var i in data.slave.indexReplicatedAtList )
- {
- var date = data.slave.indexReplicatedAtList[i];
- if( !iterations_obj[date] )
- {
- iterations_obj[date] = true;
- iterations_data.push( date );
- }
- }
-
- for( var i in data.slave.replicationFailedAtList )
- {
- var date = data.slave.replicationFailedAtList[i];
- if( !iterations_obj[date] )
- {
- iterations_obj[date] = true;
- iterations_data.push( date );
- }
- }
-
- iterations_data.sort().reverse();
-
- if( 0 !== iterations_data.length )
- {
- var iterations = [];
- for( var i = 0; i < iterations_data.length; i++ )
- {
- iterations.push( '<li data-date="' + iterations_data[i] + '">' + iterations_data[i] + '</li>' );
- }
-
- iterations_list
- .html( iterations.join( "\n" ) )
- .show();
-
- $( data.slave.indexReplicatedAtList )
- .each
- (
- function( key, value )
- {
- $( 'li[data-date="' + value + '"]', iterations_list )
- .addClass( 'replicated' );
- }
- );
-
- if( data.slave.indexReplicatedAt )
- {
- $( 'li[data-date="' + data.slave.indexReplicatedAt + '"]', iterations_list )
- .addClass( 'latest' );
- }
-
- $( data.slave.replicationFailedAtList )
- .each
- (
- function( key, value )
- {
- $( 'li[data-date="' + value + '"]', iterations_list )
- .addClass( 'failed' );
- }
- );
-
- if( data.slave.replicationFailedAt )
- {
- $( 'li[data-date="' + data.slave.replicationFailedAt + '"]', iterations_list )
- .addClass( 'latest' );
- }
-
- if( 0 !== $( 'li:hidden', iterations_list ).size() )
- {
- $( 'a', iterations_element )
- .show();
- }
- else
- {
- $( 'a', iterations_element )
- .hide();
- }
- }
- }
-
- var details_element = $( '#details', replication_element );
- var current_type_element = $( ( is_slave ? '.slave' : '.masterSearch' ), details_element );
- var master_data = is_slave ? data.slave.masterDetails : data;
-
- // the currently searchable commit regardless of type
- $( '.version div', current_type_element )
- .html( data.indexVersion );
- $( '.generation div', current_type_element )
- .html( data.generation );
- $( '.size div', current_type_element )
- .html( data.indexSize );
-
- // what's replicable on the master
- var master_element = $( '.master', details_element );
- $( '.version div', master_element )
- .html( master_data.master.replicableVersion || '-' );
- $( '.generation div', master_element )
- .html( master_data.master.replicableGeneration || '-' );
- $( '.size div', master_element )
- .html( "-" );
-
- if( is_slave )
- {
- // what's searchable on the master
- var master_searchable = $( '.masterSearch', details_element );
- $( '.version div', master_searchable )
- .html( master_data.indexVersion );
- $( '.generation div', master_searchable )
- .html( master_data.generation );
- $( '.size div', master_searchable )
- .html( master_data.indexSize );
-
- // warnings if slave version|gen doesn't match what's replicable
- if( data.indexVersion !== master_data.master.replicableVersion )
- {
- $( '.version', details_element )
- .addClass( 'diff' );
- }
- else
- {
- $( '.version', details_element )
- .removeClass( 'diff' );
- }
-
- if( data.generation !== master_data.master.replicableGeneration )
- {
- $( '.generation', details_element )
- .addClass( 'diff' );
- }
- else
- {
- $( '.generation', details_element )
- .removeClass( 'diff' );
- }
- }
-
- if( is_slave )
- {
- var settings_element = $( '#settings', replication_element );
-
- if( data.slave.masterUrl )
- {
- $( '.masterUrl dd', settings_element )
- .html( response.details.slave.masterUrl )
- .parents( 'li' ).show();
- }
-
- var polling_content = '&nbsp;';
- var polling_ico = 'ico-1';
-
- if( 'true' === data.slave.isPollingDisabled )
- {
- polling_ico = 'ico-0';
-
- $( '.disable-polling', navigation_element ).hide();
- $( '.enable-polling', navigation_element ).show();
- }
- else
- {
- $( '.disable-polling', navigation_element ).show();
- $( '.enable-polling', navigation_element ).hide();
-
- if( data.slave.pollInterval )
- {
- polling_content = '(interval: ' + data.slave.pollInterval + ')';
- }
- }
-
- $( '.isPollingDisabled dd', settings_element )
- .removeClass( 'ico-0' )
- .removeClass( 'ico-1' )
- .addClass( polling_ico )
- .html( polling_content )
- .parents( 'li' ).show();
-
- if( 'true' === data.slave.isReplicating )
- {
- replication_element
- .addClass( 'replicating' );
-
- $( '.replicate-now', navigation_element ).hide();
- $( '.abort-replication', navigation_element ).show();
-
- window.setTimeout( replication_fetch_status, 1000 );
- }
- else
- {
- replication_element
- .removeClass( 'replicating' );
-
- $( '.replicate-now', navigation_element ).show();
- $( '.abort-replication', navigation_element ).hide();
-
-
- if( 'false' === data.slave.isPollingDisabled && data.slave.pollInterval )
- {
- timer_element = $( '.timer', navigation_element );
- approx_element = $( '.approx', timer_element );
-
- var next_tick = app.convert_duration_to_seconds( data.slave.pollInterval );
- approx_element.show();
-
- if( data.slave.nextExecutionAt )
- {
- var nextExecutionAt = new SolrDate( data.slave.nextExecutionAt );
- var currentDate = new SolrDate( data.slave.currentDate );
-
- if( nextExecutionAt.getTime() > currentDate.getTime() )
- {
- next_tick = ( nextExecutionAt.getTime() - currentDate.getTime() ) / 1000;
- approx_element.hide();
-
- $( 'small', timer_element )
- .text( data.slave.nextExecutionAt )
- .show();
- }
- }
-
- init_timer( next_tick );
-
- timer_element
- .show();
- }
- }
- }
-
- var master_settings_element = $( '#master-settings', replication_element );
- var master_data = is_slave ? data.slave.masterDetails.master : data.master;
-
- var replication_icon = 'ico-0';
- if( 'true' === master_data.replicationEnabled )
- {
- replication_icon = 'ico-1';
-
- $( '.disable-replication', navigation_element ).show();
- $( '.enable-replication', navigation_element ).hide();
- }
- else
- {
- $( '.disable-replication', navigation_element ).hide();
- $( '.enable-replication', navigation_element ).show();
- }
-
- $( '.replicationEnabled dd', master_settings_element )
- .removeClass( 'ico-0' )
- .removeClass( 'ico-1' )
- .addClass( replication_icon )
- .parents( 'li' ).show();
-
- $( '.replicateAfter dd', master_settings_element )
- .html( master_data.replicateAfter.join( ', ' ) )
- .parents( 'li' ).show();
-
- if( master_data.confFiles )
- {
- var conf_files = [];
- var conf_data = master_data.confFiles.split( ',' );
-
- for( var i = 0; i < conf_data.length; i++ )
- {
- var item = conf_data[i];
-
- if( - 1 !== item.indexOf( ':' ) )
- {
- info = item.split( ':' );
- item = '<abbr title="' + info[0] + ' » ' + info[1] + '">' + ( is_slave ? info[1] : info[0] ) + '</abbr>';
- }
-
- conf_files.push( item );
- }
-
- $( '.confFiles dd', master_settings_element )
- .html( conf_files.join( ', ' ) )
- .parents( 'li' ).show();
- }
-
-
- $( '.block', replication_element ).last()
- .addClass( 'last' );
- },
- error : function( xhr, text_status, error_thrown )
- {
- $( '#content' )
- .html( 'sorry, no replication-handler defined!' );
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
-}
-
-// #/:core/replication
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(replication)$' ),
- function( context )
- {
- core_basepath = this.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/replication.html',
- function( template )
- {
- content_element
- .html( template );
-
- replication_element = $( '#replication', content_element );
- navigation_element = $( '#navigation', replication_element );
-
- replication_fetch_status();
-
- $( '#iterations a', content_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).parents( '.iterations' )
- .toggleClass( 'expanded' );
-
- return false;
- }
- );
-
- $( 'button', navigation_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var button = $( this );
- var command = button.data( 'command' );
-
- if( button.hasClass( 'refresh-status' ) && !button.hasClass( 'loader' ) )
- {
- replication_fetch_status();
- }
- else if( command )
- {
- $.get
- (
- core_basepath + '/replication?command=' + command + '&wt=json',
- function()
- {
- replication_fetch_status();
- }
- );
- }
- return false;
- }
- );
- }
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/schema-browser.js b/solr/webapp/web/js/scripts/schema-browser.js
deleted file mode 100644
index c25bafeaebf..00000000000
--- a/solr/webapp/web/js/scripts/schema-browser.js
+++ /dev/null
@@ -1,1229 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-var current_core = null;
-var cookie_schema_browser_autoload = 'schema-browser_autoload';
-
-var luke_array_to_struct = function( array )
-{
- var struct = {
- keys : [],
- values : []
- };
- for( var i = 0; i < array.length; i += 2 )
- {
- struct.keys.push( array[i] );
- struct.values.push( array[i+1] );
- }
- return struct;
-}
-
-var luke_array_to_hash = function( array )
-{
- var hash = {};
- for( var i = 0; i < array.length; i += 2 )
- {
- hash[ array[i] ] = array[i+1];
- }
- return hash;
-}
-
-var load_terminfo = function( trigger_element, core_basepath, field, data_element, terminfo_element )
-{
- var luke_url = core_basepath + '/admin/luke?wt=json&fl=' + field;
- var topterms_count_element = $( '.topterms-holder .head input', terminfo_element );
-
- var term_load_count = parseInt( topterms_count_element.val(), 10 );
- if( term_load_count )
- {
- luke_url += '&numTerms=' + term_load_count;
- }
-
- $.ajax
- (
- {
- url : luke_url,
- dataType : 'json',
- context : terminfo_element,
- beforeSend : function( xhr, settings )
- {
- $( 'span', trigger_element )
- .addClass( 'loader' );
- },
- success : function( response, text_status, xhr )
- {
- var additional_styles = [];
- var field_data = response.fields[field];
-
- if( !field_data || !( field_data.topTerms && field_data.histogram ) )
- {
- terminfo_element
- .addClass( 'disabled' );
-
- return false;
- }
-
- var get_width = function get_width()
- {
- return $( this ).width();
- }
-
- var topterms_holder_element = $( '.topterms-holder', data_element );
- var histogram_holder_element = $( '.histogram-holder', data_element );
-
- if( !field_data.topTerms )
- {
- topterms_holder_element
- .hide();
- }
- else
- {
- topterms_holder_element
- .show();
-
- var topterms_table_element = $( 'ul', topterms_holder_element );
-
- var topterms = field_data.topTerms;
- var topterms_count = topterms.length;
-
- var topterms_content = '';
- var topterms_frq_last = null;
-
- for( var i = 0; i < topterms_count; i += 2 )
- {
- if( topterms_frq_last !== topterms[i+1] )
- {
- if( topterms_frq_last )
- {
- topterms_content += '</ul></li>' + "\n";
- }
-
- topterms_frq_last = topterms[i+1];
- topterms_content += '<li class="clearfix">'
- + '<p><span>' + app.format_number( topterms_frq_last ) + '</span></p>' + "\n"
- + '<ul>' + "\n";
- }
-
- var target = '#/' + current_core + '/query?q=' + field.esc() + ':' + encodeURIComponent( '"' + topterms[i] + '"' );
- topterms_content += '<li><a href="' + target + '">' + topterms[i].esc() + '</a></li>' + "\n";
- }
-
- topterms_content += '</li>';
-
- topterms_count = topterms_count / 2;
-
- $( 'input', trigger_element )
- .val( topterms_count );
-
- topterms_table_element
- .html( topterms_content );
-
- var max_width = 10 + Math.max.apply( Math, $( 'p', topterms_table_element ).map( get_width ).get() );
- additional_styles.push
- (
- topterms_table_element.selector + ' p { width: ' + max_width + 'px !important; }' + "\n" +
- topterms_table_element.selector + ' ul { margin-left: ' + ( max_width + 5 ) + 'px !important; }'
- );
-
- topterms_count_element
- .val( topterms_count );
-
- $( 'p.head .max', topterms_holder_element )
- .html( field_data.distinct );
-
- $( 'p.head #query_link', topterms_holder_element )
- .attr( 'href', '#/' + current_core + '/query?q=' + field.esc() + ':[* TO *]' );
-
- $( 'ul li:even', topterms_table_element )
- .addClass( 'odd' );
- }
-
- if( !field_data.histogram )
- {
- histogram_holder_element
- .hide();
- }
- else
- {
- histogram_holder_element
- .show();
-
- var histogram_values = luke_array_to_hash( field_data.histogram );
- var histogram_entries = [];
-
- var histogram_max = null;
- for( var key in histogram_values )
- {
- histogram_max = Math.max( histogram_max, histogram_values[key] );
- }
-
- for( var key in histogram_values )
- {
- histogram_entries.push
- (
- '<li>' + "\n" +
- ' <dl class="clearfix" style="width: ' + ( ( histogram_values[key] / histogram_max ) * 100 ) + '%;">' + "\n" +
- ' <dt><span>' + app.format_number( key ) + '</span></dt>' + "\n" +
- ' <dd><span>' + app.format_number( histogram_values[key] ) + '</span></dd>' + "\n" +
- ' </dl>' + "\n" +
- '</li>'
- );
- }
-
- $( 'ul', histogram_holder_element )
- .html( histogram_entries.join( "\n" ) );
-
- $( 'ul li:even', histogram_holder_element )
- .addClass( 'odd' );
-
- var max_width = 10 + Math.max.apply( Math, $( 'dt', histogram_holder_element ).map( get_width ).get() );
- additional_styles.push
- (
- histogram_holder_element.selector + ' ul { margin-left: ' + max_width + 'px !important; }' + "\n" +
- histogram_holder_element.selector + ' li dt { left: ' + ( max_width * -1 ) + 'px !important; width: ' + max_width + 'px !important; }'
- );
- }
-
- if( additional_styles )
- {
- terminfo_element
- .prepend( '<style type="text/css">' + additional_styles.join( "\n" ) + '</style>' );
- }
- },
- error : function( xhr, text_status, error_thrown)
- {
- terminfo_element
- .addClass( 'disabled' );
- },
- complete : function( xhr, text_status )
- {
- $( 'span', trigger_element )
- .removeClass( 'loader' );
- }
- }
- );
-}
-
-sammy.bind
-(
- 'schema_browser_navi',
- function( event, params )
- {
- var related_navigation_element = $( '#related dl#f-df-t', params.schema_browser_element );
- var related_navigation_meta = $( '#related dl.ukf-dsf', params.schema_browser_element );
- var related_select_element = $( '#related select', params.schema_browser_element )
- var type = 'index';
-
- var sammy_basepath = app.core_menu.find( '.active a' ).attr( 'href' );
-
- if( !related_navigation_meta.hasClass( 'done' ) )
- {
- if( app.schema_browser_data.unique_key_field )
- {
- $( '.unique-key-field', related_navigation_meta )
- .show()
- .after
- (
- '<dd class="unique-key-field"><a href="' + sammy_basepath + '?field=' +
- app.schema_browser_data.unique_key_field + '">' +
- app.schema_browser_data.unique_key_field + '</a></dd>'
- );
- }
-
- if( app.schema_browser_data.default_search_field )
- {
- $( '.default-search-field', related_navigation_meta )
- .show()
- .after
- (
- '<dd class="default-search-field"><a href="' + sammy_basepath + '?field=' +
- app.schema_browser_data.default_search_field + '">' +
- app.schema_browser_data.default_search_field + '</a></dd>'
- );
- }
-
- related_navigation_meta
- .addClass( 'done' );
- }
-
- if( params.route_params )
- {
- var type = params.route_params.type;
- var value = params.route_params.value;
-
- var navigation_data = {
- 'fields' : [],
- 'copyfield_source' : [],
- 'copyfield_dest' : [],
- 'dynamic_fields' : [],
- 'types' : []
- }
-
- $( 'option[value="' + params.route_params.path.esc() + '"]', related_select_element )
- .attr( 'selected', 'selected' );
-
- related_select_element
- .trigger( 'liszt:updated' );
-
- if( 'field' === type )
- {
- navigation_data.fields.push( value );
-
- if( app.schema_browser_data.relations.f_t[value] )
- {
- navigation_data.types.push( app.schema_browser_data.relations.f_t[value] );
- }
-
- if( app.schema_browser_data.relations.f_df[value] )
- {
- navigation_data.dynamic_fields.push( app.schema_browser_data.relations.f_df[value] );
- }
-
- if( app.schema_browser_data.fields[value].copySources && 0 !== app.schema_browser_data.fields[value].copySources.length )
- {
- navigation_data.copyfield_source = app.schema_browser_data.fields[value].copySources;
- }
-
- if( app.schema_browser_data.fields[value].copyDests && 0 !== app.schema_browser_data.fields[value].copyDests.length )
- {
- navigation_data.copyfield_dest = app.schema_browser_data.fields[value].copyDests;
- }
- }
- else if( 'dynamic-field' === type )
- {
- navigation_data.dynamic_fields.push( value );
- navigation_data.types.push( app.schema_browser_data.relations.df_t[value] );
-
- if( app.schema_browser_data.relations.df_f[value] )
- {
- navigation_data.fields = app.schema_browser_data.relations.df_f[value];
- }
- }
- else if( 'type' === type )
- {
- navigation_data.types.push( value );
-
- if( app.schema_browser_data.relations.t_f[value] )
- {
- navigation_data.fields = app.schema_browser_data.relations.t_f[value];
- }
-
- if( app.schema_browser_data.relations.t_df[value] )
- {
- navigation_data.dynamic_fields = app.schema_browser_data.relations.t_df[value];
- }
- }
-
- var navigation_content = '';
-
- if( 0 !== navigation_data.fields.length )
- {
- navigation_data.fields.sort();
- navigation_content += '<dt class="field">Field</dt>' + "\n";
- for( var i in navigation_data.fields )
- {
- var href = sammy_basepath + '?field=' + navigation_data.fields[i];
- navigation_content += '<dd class="field"><a href="' + href + '">' + navigation_data.fields[i] + '</a></dd>' + "\n";
- }
- }
-
- if( 0 !== navigation_data.copyfield_source.length )
- {
- navigation_data.copyfield_source.sort();
- navigation_content += '<dt class="copyfield">Copied from</dt>' + "\n";
- for( var i in navigation_data.copyfield_source )
- {
- var href = sammy_basepath + '?field=' + navigation_data.copyfield_source[i];
- navigation_content += '<dd class="copyfield"><a href="' + href + '">' + navigation_data.copyfield_source[i] + '</a></dd>' + "\n";
- }
- }
-
- if( 0 !== navigation_data.copyfield_dest.length )
- {
- navigation_data.copyfield_dest.sort();
- navigation_content += '<dt class="copyfield">Copied to</dt>' + "\n";
- for( var i in navigation_data.copyfield_dest )
- {
- var href = sammy_basepath + '?field=' + navigation_data.copyfield_dest[i];
- navigation_content += '<dd class="copyfield"><a href="' + href + '">' + navigation_data.copyfield_dest[i] + '</a></dd>' + "\n";
- }
- }
-
- if( 0 !== navigation_data.dynamic_fields.length )
- {
- navigation_data.dynamic_fields.sort();
- navigation_content += '<dt class="dynamic-field">Dynamic Field</dt>' + "\n";
- for( var i in navigation_data.dynamic_fields )
- {
- var href = sammy_basepath + '?dynamic-field=' + navigation_data.dynamic_fields[i];
- navigation_content += '<dd class="dynamic-field"><a href="' + href + '">' + navigation_data.dynamic_fields[i] + '</a></dd>' + "\n";
- }
- }
-
- if( 0 !== navigation_data.types.length )
- {
- navigation_data.types.sort();
- navigation_content += '<dt class="type">Type</dt>' + "\n";
- for( var i in navigation_data.types )
- {
- var href = sammy_basepath + '?type=' + navigation_data.types[i];
- navigation_content += '<dd class="type"><a href="' + href + '">' + navigation_data.types[i] + '</a></dd>' + "\n";
- }
- }
-
- related_navigation_element
- .show()
- .attr( 'class', type )
- .html( navigation_content );
- }
- else
- {
- related_navigation_element
- .hide();
-
- $( 'option:selected', related_select_element )
- .removeAttr( 'selected' );
- }
-
- if( 'field' === type && value === app.schema_browser_data.unique_key_field )
- {
- $( '.unique-key-field', related_navigation_meta )
- .addClass( 'active' );
- }
- else
- {
- $( '.unique-key-field', related_navigation_meta )
- .removeClass( 'active' );
- }
-
- if( 'field' === type && value === app.schema_browser_data.default_search_field )
- {
- $( '.default-search-field', related_navigation_meta )
- .addClass( 'active' );
- }
- else
- {
- $( '.default-search-field', related_navigation_meta )
- .removeClass( 'active' );
- }
-
- if( params.callback )
- {
- params.callback( app.schema_browser_data, $( '#data', params.schema_browser_element ) );
- }
- }
-);
-
-sammy.bind
-(
- 'schema_browser_load',
- function( event, params )
- {
- var core_basepath = params.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- if( app.schema_browser_data )
- {
- params.schema_browser_element = $( '#schema-browser', content_element );
-
- sammy.trigger
- (
- 'schema_browser_navi',
- params
- );
- }
- else
- {
- content_element
- .html( '<div id="schema-browser"><div class="loader">Loading ...</div></div>' );
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/luke?numTerms=0&wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- app.schema_browser_data = {
- default_search_field : null,
- unique_key_field : null,
- key : {},
- fields : {},
- dynamic_fields : {},
- types : {},
- relations : {
- f_df : {},
- f_t : {},
- df_f : {},
- df_t : {},
- t_f : {},
- t_df : {}
- }
- };
-
- app.schema_browser_data.fields = response.fields;
- app.schema_browser_data.key = response.info.key;
-
- $.ajax
- (
- {
- url : core_basepath + '/admin/luke?show=schema&wt=json',
- dataType : 'json',
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- app.schema_browser_data.default_search_field = response.schema.defaultSearchField;
- app.schema_browser_data.unique_key_field = response.schema.uniqueKeyField;
-
- app.schema_browser_data.dynamic_fields = response.schema.dynamicFields;
- app.schema_browser_data.types = response.schema.types;
-
- for( var field in response.schema.fields )
- {
- app.schema_browser_data.fields[field] = $.extend
- (
- {},
- app.schema_browser_data.fields[field],
- response.schema.fields[field]
- );
- }
-
- for( var field in app.schema_browser_data.fields )
- {
- var copy_dests = app.schema_browser_data.fields[field].copyDests;
- for( var i in copy_dests )
- {
- var copy_dest = copy_dests[i];
- if( !app.schema_browser_data.fields[copy_dest] )
- {
- app.schema_browser_data.fields[copy_dest] = {
- partial : true,
- copySources : []
- };
- }
-
- if( app.schema_browser_data.fields[copy_dest].partial )
- {
- app.schema_browser_data.fields[copy_dest].copySources.push( field );
- }
- }
-
- var copy_sources = app.schema_browser_data.fields[field].copySources;
- for( var i in copy_sources )
- {
- var copy_source = copy_sources[i];
- if( !app.schema_browser_data.fields[copy_source] )
- {
- app.schema_browser_data.fields[copy_source] = {
- partial : true,
- copyDests : []
- };
- }
-
- if( app.schema_browser_data.fields[copy_source].partial )
- {
- app.schema_browser_data.fields[copy_source].copyDests.push( field );
- }
- }
-
- app.schema_browser_data.relations.f_t[field] = app.schema_browser_data.fields[field].type;
-
- if( !app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type] )
- {
- app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type] = [];
- }
- app.schema_browser_data.relations.t_f[app.schema_browser_data.fields[field].type].push( field );
-
- if( app.schema_browser_data.fields[field].dynamicBase )
- {
- app.schema_browser_data.relations.f_df[field] = app.schema_browser_data.fields[field].dynamicBase;
-
- if( !app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase] )
- {
- app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase] = [];
- }
- app.schema_browser_data.relations.df_f[app.schema_browser_data.fields[field].dynamicBase].push( field );
- }
- }
-
- for( var dynamic_field in app.schema_browser_data.dynamic_fields )
- {
- app.schema_browser_data.relations.df_t[dynamic_field] = app.schema_browser_data.dynamic_fields[dynamic_field].type;
-
- if( !app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type] )
- {
- app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type] = [];
- }
- app.schema_browser_data.relations.t_df[app.schema_browser_data.dynamic_fields[dynamic_field].type].push( dynamic_field );
- }
-
- $.get
- (
- 'tpl/schema-browser.html',
- function( template )
- {
- content_element
- .html( template );
-
- var schema_browser_element = $( '#schema-browser', content_element );
- var related_element = $( '#related', schema_browser_element );
- var related_select_element = $( 'select', related_element );
- var data_element = $( '#data', schema_browser_element );
-
- var related_options = '';
-
- var fields = [];
- for( var field_name in app.schema_browser_data.fields )
- {
- fields.push
- (
- '<option value="?field=' + field_name.esc() + '">' + field_name.esc() + '</option>'
- );
- }
- if( 0 !== fields.length )
- {
- fields.sort();
- related_options += '<optgroup label="Fields">' + "\n";
- related_options += fields.sort().join( "\n" ) + "\n";
- related_options += '</optgroup>' + "\n";
- }
-
- var dynamic_fields = [];
- for( var type_name in app.schema_browser_data.dynamic_fields )
- {
- dynamic_fields.push
- (
- '<option value="?dynamic-field=' + type_name.esc() + '">' + type_name.esc() + '</option>'
- );
- }
- if( 0 !== dynamic_fields.length )
- {
- dynamic_fields.sort();
- related_options += '<optgroup label="DynamicFields">' + "\n";
- related_options += dynamic_fields.sort().join( "\n" ) + "\n";
- related_options += '</optgroup>' + "\n";
- }
-
- var types = [];
- for( var type_name in app.schema_browser_data.types )
- {
- types.push
- (
- '<option value="?type=' + type_name.esc() + '">' + type_name.esc() + '</option>'
- );
- }
- if( 0 !== types.length )
- {
- types.sort();
- related_options += '<optgroup label="Types">' + "\n";
- related_options += types.sort().join( "\n" ) + "\n";
- related_options += '</optgroup>' + "\n";
- }
-
- related_select_element
- .attr( 'rel', app.core_menu.find( '.active a' ).attr( 'href' ) )
- .append( related_options )
- .chosen();
-
- related_select_element
- .die( 'change' )
- .live
- (
- 'change',
- function( event )
- {
- var select_element = $( this );
- var option_element = $( 'option:selected', select_element );
-
- location.href = select_element.attr( 'rel' ) + option_element.val();
- return false;
- }
- );
-
- params.schema_browser_element = schema_browser_element;
- sammy.trigger
- (
- 'schema_browser_navi',
- params
- );
- }
- );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
-
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
- }
-);
-
-// #/:core/schema-browser
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(schema-browser)$' ),
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
- current_core = context.params.splat[0];
-
- var trigger_params = {
- active_core : this.active_core
- };
-
- var path = context.path.split( '?' );
- if( path && path[1] )
- {
- var param = path[1].split( '=' );
- trigger_params.route_params = {
- path : '?' + path[1],
- type : param[0],
- value : param[1]
- }
-
- trigger_params.callback = function( schema_browser_data, data_element )
- {
- var field = trigger_params.route_params.value;
-
- var type = trigger_params.route_params.type;
- var is_f = 'field' === type;
- var is_df = 'dynamic-field' === type;
- var is_t = 'type' === type;
-
- var options_element = $( '.options', data_element );
- var sammy_basepath = context.path.indexOf( '/', context.path.indexOf( '/', 2 ) + 1 );
-
- data_element
- .show();
-
- // -- head
-
- var head_element = $( '.head', data_element );
- if( is_f )
- {
- $( '.type', head_element ).html( 'Field' );
- }
- else if( is_df )
- {
- $( '.type', head_element ).html( 'Dynamic Field' );
- }
- else if( is_t )
- {
- $( '.type', head_element ).html( 'Type' );
- }
- $( '.name', head_element ).html( field.esc() );
-
-
- var partial_state = false;
- if( is_f )
- {
- partial_state = !!schema_browser_data.fields[field].partial;
- }
-
- $( '.partial', data_element )
- .toggle( partial_state );
-
- // -- docs
- var docs_element = $( 'dt.docs', options_element );
- if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].docs )
- {
- $( 'dd.docs', options_element )
- .remove();
-
- var target = '#/' + current_core + '/query?q=' + field.esc() + ':[* TO *]';
- docs_element
- .show()
- .after(
- '<dd class="docs">'+
- '<a href="'+target+'">' + schema_browser_data.fields[field].docs + '</a>' +
- '</dd>' );
- }
- else
- {
- $( '.docs', options_element )
- .hide();
- }
-
- // -- distinct
- var distinct_element = $( 'dt.distinct', options_element );
- if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].distinct )
- {
- $( 'dd.distinct', options_element )
- .remove();
-
- distinct_element
- .show()
- .after( '<dd class="distinct">' + schema_browser_data.fields[field].distinct + '</dd>' );
- }
- else
- {
- $( '.distinct', options_element )
- .hide();
- }
-
- // -- position-increment-gap
- var pig_element = $( 'dt.position-increment-gap', options_element );
- if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].positionIncrementGap )
- {
- $( 'dd.position-increment-gap', options_element )
- .remove();
-
- pig_element
- .show()
- .after( '<dd class="position-increment-gap">' + schema_browser_data.fields[field].positionIncrementGap + '</dd>' );
- }
- else
- {
- $( '.position-increment-gap', options_element )
- .hide();
- }
-
- var similarity_element = $( 'dt.similarity', options_element );
- if ( is_t && schema_browser_data.types[field] && schema_browser_data.types[field].similarity ) {
- var similarity = schema_browser_data.types[field].similarity
- if (similarity.details && similarity.className) {
- $( 'dd.similarity', options_element ).remove();
- similarity_element
- .show()
- .after(['<dd class="similarity">', similarity.details.esc(), ' (', similarity.className.esc(), ') </dd>'].join(""));
- }
- } else {
- $( '.similarity', options_element ).hide();
- }
-
-
- // -- flags table
- var flags_table = $( 'table.flags', data_element );
-
- var flags_arr = [];
- for( var key in schema_browser_data.key )
- {
- flags_arr.push( '<th data-key="' + key + '">' + schema_browser_data.key[key] + '</th>' );
- }
-
- $( 'thead tr', flags_table )
- .append( flags_arr.join( "\n" ) );
-
-
- var flags_body = $( 'tbody', flags_table );
- flags_body.empty();
-
- var generate_flags_row = function generate_flags_row( flags_str, title )
- {
- var flags_arr = [ '<th>' + title.esc() + '</th>' ];
-
- if( 0 === flags_str.indexOf( '(' ) )
- {
- flags_arr.push( '<td colspan="2" class="text">' + flags_str + '</td>' );
- }
- else
- {
- var i = 0;
- for( var key in schema_browser_data.key )
- {
- var flag_match = key === flags_str[i];
-
- var flag_cell = '<td '
- + ' data-key="' + key + '"'
- + ' class="' + ( flag_match ? 'check' : '' ) + '"'
- + '>'
- + ( flag_match ? '<span>√</span>' : '&nbsp;' )
- + '</td>';
-
- flags_arr.push( flag_cell );
- i++;
- }
- }
-
- flags_body
- .append( '<tr>' + flags_arr.join( "\n" ) + '</tr>' );
- };
-
- var flags = null;
- if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].flags )
- {
- flags = schema_browser_data.fields[field].flags;
- }
- else if( is_df && schema_browser_data.dynamic_fields[field] && schema_browser_data.dynamic_fields[field].flags )
- {
- flags = schema_browser_data.dynamic_fields[field].flags;
- }
-
- if( flags )
- {
- generate_flags_row( flags, 'Properties' );
- }
-
- if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].schema )
- {
- generate_flags_row( schema_browser_data.fields[field].schema, 'Schema' );
- }
-
- if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].index )
- {
- generate_flags_row( schema_browser_data.fields[field].index, 'Index' );
- }
-
-
- if( 0 !== $( 'tr', flags_body ).size() )
- {
- var col_count = 0;
- for( var key in schema_browser_data.key )
- {
- var cols = $( '[data-key="' + key + '"]', flags_table );
-
- var col_used = 0 !== cols.filter( '.check' ).size();
- col_count += col_used;
-
- cols.toggle( col_used );
- }
-
- $( 'td[colspan]', flags_body )
- .attr( 'colspan', col_count );
-
- flags_table.show();
- }
- else
- {
- flags_table.hide();
- }
-
- var analyzer_element = $( '.analyzer', data_element );
- var analyzer_data = null;
-
- var analysis_link = false;
- var analysis_link_elements = $( 'p a', analyzer_element );
- var analysis_target = '#/' + current_core + '/analysis?';
-
- if( is_f )
- {
- analyzer_data = schema_browser_data.types[schema_browser_data.relations.f_t[field]];
-
- analysis_link = true;
- analysis_target += 'analysis.fieldname=' + field;
- }
- else if( is_df )
- {
- analyzer_data = schema_browser_data.types[schema_browser_data.relations.df_t[field]];
- }
- else if( is_t )
- {
- analyzer_data = schema_browser_data.types[field];
-
- analysis_link = true;
- analysis_target += 'analysis.fieldtype=' + field;
- }
-
- if( analysis_link )
- {
- analysis_link_elements
- .addClass( 'analysis' )
- .attr( 'href', analysis_target );
- }
- else
- {
- analysis_link_elements
- .removeClass( 'analysis' )
- .removeAttr( 'href' );
- }
-
-
- if( analyzer_data )
- {
- var transform_analyzer_data_into_list = function( analyzer_data )
- {
- var args = [];
- for( var key in analyzer_data.args )
- {
- var arg_class = '';
- var arg_content = '';
-
- if( 'true' === analyzer_data.args[key] || '1' === analyzer_data.args[key] )
- {
- arg_class = 'ico-1';
- arg_content = key;
- }
- else if( 'false' === analyzer_data.args[key] || '0' === analyzer_data.args[key] )
- {
- arg_class = 'ico-0';
- arg_content = key;
- }
- else
- {
- arg_content = key + ': ';
-
- if( 'synonyms' === key || 'words' === key )
- {
- // @TODO: set link target for file
- arg_content += '<a>' + analyzer_data.args[key] + '</a>';
- }
- else
- {
- arg_content += analyzer_data.args[key];
- }
- }
-
- args.push( '<dd class="' + arg_class + '">' + arg_content + '</dd>' );
- }
-
- var list_content = '<dt>' + analyzer_data.className + '</dt>';
- if( 0 !== args.length )
- {
- args.sort();
- list_content += args.join( "\n" );
- }
-
- return list_content;
- }
-
- // -- field-type
- var field_type_element = $( 'dt.field-type', options_element );
-
- $( 'dd.field-type', options_element )
- .remove();
-
- field_type_element
- .show()
- .after( '<dd class="field-type">' + analyzer_data.className + '</dd>' );
-
- $( '.toggle', analyzer_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).closest( 'li' )
- .toggleClass( 'open' );
-
- return false;
- }
- );
-
- for( var key in analyzer_data )
- {
- var key_match = key.match( /^(.+)Analyzer$/ );
- if( !key_match )
- {
- continue;
- }
-
- var analyzer_key_element = $( '.' + key_match[1], analyzer_element );
- var analyzer_key_data = analyzer_data[key];
-
- analyzer_element.show();
- analyzer_key_element.show();
-
- $( 'ul li', analyzer_key_element )
- .removeClass( 'data' )
- .hide();
-
- for( var type in analyzer_key_data )
- {
- if( 'object' !== typeof analyzer_key_data[type] )
- {
- continue;
- }
-
- var type_element = $( '.' + type, analyzer_key_element );
- var type_content = [];
-
- type_element
- .addClass( 'data' )
- .show();
-
- if( analyzer_key_data[type].className )
- {
- type_content.push( transform_analyzer_data_into_list( analyzer_key_data[type] ) );
- }
- else
- {
- for( var entry in analyzer_key_data[type] )
- {
- type_content.push( transform_analyzer_data_into_list( analyzer_key_data[type][entry] ) );
- }
- }
-
- $( 'dl', type_element )
- .empty()
- .append( type_content.join( "\n" ) );
- }
-
- var name_element = $( 'dl:first dt a', analyzer_key_element );
- if( analyzer_key_data.className )
- {
- name_element
- .html( analyzer_key_data.className );
- }
-
- 0 === $( 'ul li.data', analyzer_key_element ).size()
- ? name_element.removeClass( 'toggle' )
- : name_element.addClass( 'toggle' );
- }
- }
-
- var terminfo_element = $( '.terminfo-holder', data_element );
-
- terminfo_element
- .removeClass( 'disabled' )
- .removeClass( 'loaded' );
-
- var trigger_element = $( '.trigger button', terminfo_element );
- var form_element = $( 'form', terminfo_element );
-
- trigger_element
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- form_element
- .trigger( 'submit' );
-
- return false;
- }
- );
-
- form_element
- .clearForm()
- .die( 'submit' )
- .live
- (
- 'submit',
- function( event )
- {
- load_terminfo( trigger_element, core_basepath, field, data_element, terminfo_element );
-
- terminfo_element
- .addClass( 'loaded' );
-
- return false;
- }
- );
-
- $( '.max-holder', terminfo_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var element = $( this );
-
- $( 'input', element.closest( 'form' ) )
- .val( $( '.max', element ).text() );
-
- form_element
- .trigger( 'submit' );
-
- return false;
- }
- );
-
- $( '.trigger .autoload', terminfo_element )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.cookie( cookie_schema_browser_autoload, $.cookie( cookie_schema_browser_autoload ) ? null : true );
- $( this ).trigger( 'state' );
-
- return false;
- }
- )
- .die( 'state' )
- .live
- (
- 'state',
- function( event )
- {
- $.cookie( cookie_schema_browser_autoload )
- ? $( this ).addClass( 'on' )
- : $( this ).removeClass( 'on' );
- }
- )
- .die( 'init' )
- .live
- (
- 'init',
- function( event )
- {
- if( !$.cookie( cookie_schema_browser_autoload ) )
- {
- return false;
- }
-
- $( this ).trigger( 'state' );
- trigger_element.trigger( 'click' );
- }
- )
- .trigger( 'init' );
-
- $( 'div[class$="-holder"]', terminfo_element )
- .hide();
-
- if( !is_f )
- {
- terminfo_element
- .hide();
- }
- else
- {
- terminfo_element
- .show();
- }
- }
- }
- else
- {
- trigger_params.callback = function( schema_browser_data, data_element )
- {
- data_element
- .hide();
- };
- }
-
- delete app.schema_browser_data;
-
- sammy.trigger
- (
- 'schema_browser_load',
- trigger_params
- );
- }
-);
diff --git a/solr/webapp/web/js/scripts/segments.js b/solr/webapp/web/js/scripts/segments.js
deleted file mode 100644
index eb5c169afc4..00000000000
--- a/solr/webapp/web/js/scripts/segments.js
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-
-var get_tooltip = function( segment_response ) {
- var tooltip =
- '<div>Segment <b>' + segment_response.name + '</b>:</div>' +
- '<div class="label">#docs:</div><div>' + number_format(segment_response.size) +'</div>' +
- '<div class="label">#dels:</div><div>' + number_format(segment_response.delCount) + '</div>' +
- '<div class="label">size:</div><div>' + number_format(segment_response.sizeInBytes) + ' bytes </div>' +
- '<div class="label">age:</div><div>' + segment_response.age + '</div>' +
- '<div class="label">source:</div><div>' + segment_response.source + '</div>';
- return tooltip;
-};
-
-var get_entry = function( segment_response, segment_bytes_max ) {
- //calcualte dimensions of graph
- var dims = calculate_dimensions(segment_response.sizeInBytes,
- segment_bytes_max, segment_response.size, segment_response.delCount)
- //create entry for segment with given dimensions
- var entry = get_entry_item(segment_response.name, dims,
- get_tooltip(segment_response), (segment_response.mergeCandidate)?true:false);
-
- return entry;
-};
-
-var get_entry_item = function(name, dims, tooltip, isMergeCandidate) {
- var entry = '<li>' + "\n" +
- ' <dl class="clearfix" style="width: ' + dims['size'] + '%;">' + "\n" +
- ' <dt><div>' + name + '</div></dt>' + "\n" +
- ' <dd>';
- entry += '<div class="live' + ((isMergeCandidate)?' merge-candidate':'') +
- '" style="width: ' + dims['alive_doc_size'] + '%;">&nbsp;</div>';
- entry += '<div class="toolitp">' + tooltip +'</div>';
-
- if (dims['deleted_doc_size'] > 0.001) {
- entry += '<div class="deleted" style="width:' + dims['deleted_doc_size']
- + '%;margin-left:' + dims['alive_doc_size'] + '%;">&nbsp;</div>';
- }
- entry += '</dd></dl></li>';
- return entry;
-};
-
-var get_footer = function(deletions_count, documents_count) {
- return '<li><dl><dt></dt><dd>Deletions: ' +
- (documents_count == 0 ? 0 : round_2(deletions_count/documents_count * 100)) +
- '% </dd></dl></li>';
-};
-
-var calculate_dimensions = function(segment_size_in_bytes, segment_size_in_bytes_max, doc_count, delete_doc_count) {
- var segment_size_in_bytes_log = Math.log(segment_size_in_bytes);
- var segment_size_in_bytes_max_log = Math.log(segment_size_in_bytes_max);
-
- var dims = {};
- //Normalize to 100% size of bar
- dims['size'] = Math.floor((segment_size_in_bytes_log / segment_size_in_bytes_max_log ) * 100);
- //Deleted doc part size
- dims['deleted_doc_size'] = Math.floor((delete_doc_count/(delete_doc_count + doc_count)) * dims['size']);
- //Alive doc part size
- dims['alive_doc_size'] = dims['size'] - dims['deleted_doc_size'];
-
- return dims;
-};
-
-var calculate_max_size_on_disk = function(segment_entries) {
- var max = 0;
- $.each(segment_entries, function(idx, obj) {
- if (obj.sizeInBytes > max) {
- max = obj.sizeInBytes;
- }
- });
- return max;
-};
-
-var round_2 = function(num) {
- return Math.round(num*100)/100;
-};
-
-var number_format = function(x) {
- return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
-};
-
-var prepare_x_axis = function(segment_bytes_max) {
- var factor = 1024*1024; //for MB
-
- var segment_bytes_max_log = Math.log(segment_bytes_max);
-
- var series_entry = '<li>' + "\n" +
- ' <dl class="clearfix" style="width:100%;">' + "\n" +
- ' <dt><div>Size</div></dt>' + "\n" +
- ' <dd>' +
- ' <div class="start">0</div>';
- var step = 0;
- for (var j = 0; j < 3; j+=1) {
- step += segment_bytes_max_log/4;
- var step_value = number_format(Math.floor((Math.pow(Math.E, step))/factor))
- series_entry += '<div class="w5">' + ((step_value > 0.001)?step_value : '&nbsp;') + '</div>'
- }
- series_entry += '<div class="end">' + number_format(Math.floor(segment_bytes_max/factor)) + ' MB </div>' +
- ' </dd>' +
- ' </dl>' +
- '</li>';
- return series_entry;
-};
-
-// #/:core/admin/segments
-sammy.get
-(
- new RegExp( app.core_regex_base + '\\/(segments)$' ),
- function( context )
- {
- var core_basepath = this.active_core.attr( 'data-basepath' );
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/segments.html',
- function( template )
- {
- content_element.html( template );
-
- var segments_element = $('#segments', content_element);
- var segments_reload = $( '#segments a.reload' );
- var url_element = $('#url', segments_element);
- var result_element = $('#result', segments_element);
- var response_element = $('#response', result_element);
- var segments_holder_element = $('.segments-holder', result_element);
-
- segments_reload
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $.ajax
- (
- {
- url : core_basepath + '/admin/segments?wt=json',
- dataType : 'json',
- context: this,
- beforeSend : function( arr, form, options )
- {
- loader.show( this );
- },
- success : function( response, text_status, xhr )
- {
- var segments_response = response['segments'],
- segments_entries = [],
- segment_bytes_max = calculate_max_size_on_disk( segments_response );
-
- //scale
- segments_entries.push( prepare_x_axis( segment_bytes_max ) );
-
- var documents_count = 0, deletions_count = 0;
-
- //elements
- $.each( segments_response, function( key, segment_response ) {
- segments_entries.push( get_entry( segment_response, segment_bytes_max ) );
-
- documents_count += segment_response.size;
- deletions_count += segment_response.delCount;
- });
-
- //footer
- segments_entries.push( get_footer( deletions_count, documents_count ) );
-
- $( 'ul', segments_holder_element ).html( segments_entries.join("\n" ) );
- },
- error : function( xhr, text_status, error_thrown )
- {
- $( this )
- .attr( 'title', '/admin/segments is not configured (' + xhr.status + ': ' + error_thrown + ')' );
-
- $( this ).parents( 'li' )
- .addClass( 'error' );
- },
- complete : function( xhr, text_status )
- {
- loader.hide( this );
- }
- }
- );
- return false;
- }
- );
- //initially submit
- segments_reload.click();
- }
- );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/scripts/threads.js b/solr/webapp/web/js/scripts/threads.js
deleted file mode 100644
index 099dd97cede..00000000000
--- a/solr/webapp/web/js/scripts/threads.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-// #/~threads
-sammy.get
-(
- /^#\/(~threads)$/,
- function( context )
- {
- var content_element = $( '#content' );
-
- $.get
- (
- 'tpl/threads.html',
- function( template )
- {
- content_element
- .html( template );
-
- $.ajax
- (
- {
- url : app.config.solr_path + '/admin/info/threads?wt=json',
- dataType : 'json',
- context : $( '#threads', content_element ),
- beforeSend : function( xhr, settings )
- {
- },
- success : function( response, text_status, xhr )
- {
- var self = this;
-
- var threadDumpData = response.system.threadDump;
- var threadDumpContent = [];
- var c = 0;
- for( var i = 1; i < threadDumpData.length; i += 2 )
- {
- var state = threadDumpData[i].state.esc();
- var name = '<a title="' + state +'"><span>' + threadDumpData[i].name.esc() + ' (' + threadDumpData[i].id.esc() + ')</span></a>';
-
- var classes = [state];
- var details = '';
-
- if( 0 !== c % 2 )
- {
- classes.push( 'odd' );
- }
-
- if( threadDumpData[i].lock )
- {
- classes.push( 'lock' );
- name += "\n" + '<p title="Waiting on">' + threadDumpData[i].lock.esc() + '</p>';
- }
-
- if( threadDumpData[i].stackTrace && 0 !== threadDumpData[i].stackTrace.length )
- {
- classes.push( 'stacktrace' );
-
- var stack_trace = threadDumpData[i].stackTrace
- .join( '###' )
- .esc()
- .replace( /\(/g, '&#8203;(' )
- .replace( /###/g, '</li><li>' );
-
- name += '<div>' + "\n"
- + '<ul>' + "\n"
- + '<li>' + stack_trace + '</li>'
- + '</ul>' + "\n"
- + '</div>';
- }
-
- var item = '<tr class="' + classes.join( ' ' ) +'">' + "\n"
- + '<td class="name">' + name + '</td>' + "\n"
- + '<td class="time">' + threadDumpData[i].cpuTime.esc() + '<br>' + threadDumpData[i].userTime.esc() + '</td>' + "\n"
- + '</tr>';
-
- threadDumpContent.push( item );
- c++;
- }
-
- var threadDumpBody = $( '#thread-dump tbody', this );
-
- threadDumpBody
- .html( threadDumpContent.join( "\n" ) );
-
- $( '.name a', threadDumpBody )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- $( this ).closest( 'tr' )
- .toggleClass( 'open' );
- }
- );
-
- $( '.controls a', this )
- .die( 'click' )
- .live
- (
- 'click',
- function( event )
- {
- var threads_element = $( self );
- var is_collapsed = threads_element.hasClass( 'collapsed' );
- var thread_rows = $( 'tr', threads_element );
-
- thread_rows
- .each
- (
- function( index, element )
- {
- if( is_collapsed )
- {
- $( element )
- .addClass( 'open' );
- }
- else
- {
- $( element )
- .removeClass( 'open' );
- }
- }
- );
-
- threads_element
- .toggleClass( 'collapsed' )
- .toggleClass( 'expanded' );
- }
- );
- },
- error : function( xhr, text_status, error_thrown)
- {
- },
- complete : function( xhr, text_status )
- {
- }
- }
- );
- }
- );
- }
-);
\ No newline at end of file
diff --git a/solr/webapp/web/js/lib/jquery-1.7.2.min.js b/solr/webapp/web/libs/jquery-1.7.2.min.js
similarity index 100%
rename from solr/webapp/web/js/lib/jquery-1.7.2.min.js
rename to solr/webapp/web/libs/jquery-1.7.2.min.js
diff --git a/solr/webapp/web/old.html b/solr/webapp/web/old.html
deleted file mode 100644
index d688a0a56e3..00000000000
--- a/solr/webapp/web/old.html
+++ /dev/null
@@ -1,169 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<head>
-
- <title>Solr Admin</title>
-
- <link rel="icon" type="image/x-icon" href="img/favicon.ico?_=${version}">
- <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico?_=${version}">
-
- <link rel="stylesheet" type="text/css" href="css/styles/common.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/analysis.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/cloud.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/cores.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/dashboard.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/dataimport.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/files.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/index.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/java-properties.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/logging.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/menu.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/plugins.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/documents.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/query.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/replication.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/schema-browser.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/threads.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/styles/segments.css?_=${version}">
- <link rel="stylesheet" type="text/css" href="css/chosen.css?_=${version}">
-
- <meta http-equiv="x-ua-compatible" content="IE=9">
-
- <script type="text/javascript">
-
- var app_config = {};
-
- app_config.solr_path = '${contextPath}';
- app_config.core_admin_path = '${adminPath}';
-
- </script>
-
-</head>
-<body>
-
- <div id="wrapper">
-
- <div id="header">
-
- <a href="./" id="solr"><span>Apache SOLR</span></a>
-
- <p id="environment">&nbsp;</p>
-
- </div>
-
- <div id="main" class="clearfix">
-
- <div id="init-failures">
-
- <h2>SolrCore Initialization Failures</h2>
- <ul></ul>
- <p>Please check your logs for more information</p>
-
- </div>
-
- <div class="old-ui-warning">
- THIS USER INTERFACE IS DEPRECATED. Please use the current UI <a class="ul" href="/solr/">here</a>
- <a target="_blank" href="http://wiki.apache.org/solr/AngularUI">&nbsp;<span class="help"></span></a>
- </div>
-
- <div id="content-wrapper">
- <div id="content">
-
- &nbsp;
-
- </div>
- </div>
-
- <div id="menu-wrapper">
- <div>
-
- <ul id="menu">
-
- <li id="index" class="global"><p><a href="#/">Dashboard</a></p></li>
-
- <li id="logging" class="global"><p><a href="#/~logging">Logging</a></p>
- <ul>
- <li class="level"><a href="#/~logging/level">Level</a></li>
- </ul>
- </li>
-
- <li id="cloud" class="global optional"><p><a href="#/~cloud">Cloud</a></p>
- <ul>
- <li class="tree"><a href="#/~cloud?view=tree">Tree</a></li>
- <li class="graph"><a href="#/~cloud">Graph</a></li>
- <li class="rgraph"><a href="#/~cloud?view=rgraph">Graph (Radial)</a></li>
- <li class="dump"><a href="#/~cloud">Dump</a></li>
- </ul>
- </li>
-
- <li id="cores" class="global"><p><a href="#/~cores">Core Admin</a></p></li>
-
- <li id="java-properties" class="global"><p><a href="#/~java-properties">Java Properties</a></li>
-
- <li id="threads" class="global"><p><a href="#/~threads">Thread Dump</a></p></li>
-
- </ul>
-
- <div id="core-selector">
- <div id="has-cores">
- <select data-placeholder="Core Selector"></select>
- </div>
- <p id="has-no-cores"><a href="#/~cores">
- No cores available
- <span>Go and create one</span>
- </a></p>
- </div>
- <div id="core-menu">
- <ul></ul>
- </div>
-
- </div>
- </div>
-
- <div id="meta">
-
- <ul>
-
- <li class="documentation"><a href="http://lucene.apache.org/solr/"><span>Documentation</span></a></li>
- <li class="issues"><a href="http://issues.apache.org/jira/browse/SOLR"><span>Issue Tracker</span></a></li>
- <li class="irc"><a href="https://wiki.apache.org/solr/IRCChannels"><span>IRC Channel</span></a></li>
- <li class="mailinglist"><a href="http://lucene.apache.org/solr/resources.html#community"><span>Community forum</span></a></li>
- <li class="wiki-query-syntax"><a href="https://cwiki.apache.org/confluence/display/solr/Query+Syntax+and+Parsing"><span>Solr Query Syntax</span></a></li>
-
- </ul>
-
- </div>
-
- </div>
-
- </div>
-
- <div id="connection_status">
-
- <span>Connection lost &hellip;</span>
-
- </div>
-
- <script type="text/javascript"> var require = { urlArgs: '_=${version}' }; </script>
- <script src="js/require.js?_=${version}" data-main="js/main"></script>
-
-</body>
-</html>
diff --git a/solr/webapp/web/tpl/analysis.html b/solr/webapp/web/tpl/analysis.html
deleted file mode 100644
index 76f5699c1c6..00000000000
--- a/solr/webapp/web/tpl/analysis.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="analysis">
-
- <div class="block analysis-error" id="analysis-handler-missing">
-
- <div class="head">This Functionality requires the <code>/analysis/field</code> Handler to be registered and active!</div>
-
- </div>
-
- <div class="block analysis-error" id="analysis-error">
-
- <div class="body"></div>
-
- </div>
-
- <div id="analysis-holder">
-
- <div id="field-analysis">
-
- <form method="get">
-
- <ul class="clearfix">
-
- <li class="index">
-
- <label for="analysis_fieldvalue_index">Field Value (Index)</label>
- <textarea name="analysis.fieldvalue" id="analysis_fieldvalue_index"></textarea>
-
- </li>
-
- <li class="query">
-
- <label for="analysis_fieldvalue_query">Field Value (Query)</label>
- <textarea name="analysis.query" id="analysis_fieldvalue_query"></textarea>
-
- </li>
-
- <li class="settings-holder clearfix">
- <div class="settings clearfix">
-
- <label for="type_or_name">Analyse Fieldname / FieldType:</label>
- <select id="type_or_name"></select>
- <a id="tor_schema" href="#"><span>Schema Browser</span>&nbsp;</a>
-
- <div class="buttons clearfix">
-
- <button type="submit"><span>Analyse Values</span></button>
-
- <div class="verbose_output active">
- <a>Verbose Output</a>
- </div>
-
- </div>
-
- </div>
- </li>
-
- </ul>
-
- </form>
-
- </div>
-
- <div id="analysis-result" class="clearfix verbose_output"></div>
-
- </div>
-
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/cloud.html b/solr/webapp/web/tpl/cloud.html
deleted file mode 100644
index 3ce78a3f6c9..00000000000
--- a/solr/webapp/web/tpl/cloud.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="cloud" class="clearfix">
-
- <div id="frame">
-
- <div id="tree-content" class="content clearfix">
-
- <div id="tree" class="tree">#tree</div>
- <div id="file-content" class="clearfix">
-
- <div id="prop">
- <ul></ul>
- </div>
-
- <div id="data"></div>
-
- <a class="close"><span>[x]</span></a>
-
- </div>
-
- </div>
-
- <div id="graph-content" class="content clearfix">
-
- <div id="canvas"></div>
-
- <div id="legend">
- <ul>
- <li class="leader"><svg width="15" height="15"><g transform="translate(5,2)"><g transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg> Leader</li>
- <li class="active"><svg width="15" height="15"><g transform="translate(5,2)"><g transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg> Active</li>
- <li class="recovering"><svg width="15" height="15"><g transform="translate(5,2)"><g transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg> Recovering</li>
- <li class="down"><svg width="15" height="15"><g transform="translate(5,2)"><g transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg> Down</li>
- <li class="recovery_failed"><svg width="15" height="15"><g transform="translate(5,2)"><g transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg> Recovery Failed</li>
- <li class="gone"><svg width="15" height="15"><g transform="translate(5,2)"><g transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg> Gone</li>
- </ul>
- </div>
-
- <div style="width: 100%; text-align: center;">
- <div id="cloudGraphPaging">
- <button id="cloudGraphPagingPrev">&lt; Previous</button>
- <input id="cloudGraphPagingStart" type="hidden" name="start" />
- <span id="cloudGraphPagingStatus"></span>&nbsp;
- Filter by:&nbsp;<select id="cloudGraphPagingFilterType">
- <option value="status">Status</option>
- <option value="name">Name</option>
- </select>&nbsp;
- <select id="cloudGraphPagingStatusFilter">
- <option value=""> - Any - </option>
- <option value="healthy">Healthy</option>
- <option value="degraded">Degraded</option>
- <option value="downed_shard">Downed Shard</option>
- <option value="recovering">Replica in Recovery</option>
- </select>
- <input id="cloudGraphPagingFilter" type="text" size="10" name="filter" />&nbsp;
- Show <input id="cloudGraphPagingRows" type="text" size="2" name="rows" /> per page.
- <button id="cloudGraphPagingNext">Next &gt;</button>
- </div>
- </div>
-
- </div>
-
- </div>
-
- <div id="debug">
- <ul class="clearfix">
- <li class="clipboard"><a href="#" data-copied="Copied to Clipboard!">Copy to Clipboard (BUGGY!)</a></li>
- <li class="close"><a href="#">Close</a></li>
- </ul>
- <pre class="debug"></pre>
- </div>
-
-</div>
diff --git a/solr/webapp/web/tpl/cores.html b/solr/webapp/web/tpl/cores.html
deleted file mode 100644
index 98a6a1247aa..00000000000
--- a/solr/webapp/web/tpl/cores.html
+++ /dev/null
@@ -1,226 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="cores" class="clearfix empty">
-
- <div id="ui-block">&nbsp;</div>
-
- <div id="frame">
-
- <div id="actions" class="actions clearfix">
-
- <button id="add" class="action"><span>Add Core</span></button>
- <button id="unload" class="warn requires-core"><span>Unload</span></button>
- <button id="rename" class="action requires-core"><span>Rename</span></button>
- <button id="swap" class="action requires-core"><span>Swap</span></button>
- <button id="reload" class="requires-core"><span>Reload</span></button>
- <button id="optimize" class="requires-core"><span>Optimize</span></button>
-
- <div class="action add" data-rel="add">
-
- <form>
-
- <input type="hidden" name="action" value="CREATE">
-
- <p class="clearfix"><label for="add_name">name:</label>
- <input type="text" name="name" id="add_name" value="new_core"></p>
-
- <p class="clearfix"><label for="add_instanceDir">instanceDir:</label>
- <input type="text" name="instanceDir" id="add_instanceDir" value="new_core"></p>
-
- <p class="clearfix"><label for="add_dataDir">dataDir:</label>
- <input type="text" name="dataDir" id="dataDir" value="data"></p>
-
- <p class="clearfix"><label for="add_config">config:</label>
- <input type="text" name="config" id="add_config" value="solrconfig.xml"></p>
-
- <p class="clearfix"><label for="add_schema">schema:</label>
- <input type="text" name="schema" id="add_schema" value="schema.xml"></p>
-
- <div class="cloud">
-
- <p class="clearfix"><label for="add_collection">collection:</label>
- <input type="text" name="collection" id="add_collection"></p>
-
- <p class="clearfix"><label for="add_shard">shard:</label>
- <input type="text" name="shard" id="shard"></p>
-
- </div>
-
- <p class="clearfix note directory-note">
-
- <span><code>instanceDir</code> and <code>dataDir</code> need to exist before you can create the core</span>
-
- </p>
-
- <p class="clearfix note error">
-
- <span></span>
-
- </p>
-
- <p class="clearfix buttons">
- <button type="submit" class="submit"><span>Add Core</span></button>
- <button type="reset" class="reset"><span>Cancel</span></button>
- </p>
-
- </form>
-
- </div>
-
- <div class="action rename" data-rel="rename">
-
- <form>
-
- <input type="hidden" name="action" value="RENAME">
- <input type="hidden" name="core" data-core="current">
-
- <p class="clearfix"><label for="rename_other">New Name:</label>
- <input type="text" name="other" data-core="current" id="rename_other"></p>
-
- <p class="clearfix buttons">
- <button type="submit" class="submit"><span>Rename Core</span></button>
- <button type="reset" class="reset"><span>Cancel</span></button>
- </p>
-
- </form>
-
- </div>
-
- <div class="action swap" data-rel="swap">
-
- <form>
-
- <input type="hidden" name="action" value="SWAP">
-
- <p class="clearfix"><label for="swap_core">this:</label>
- <input type="text" id="swap_core" name="core" data-core="current" readonly="readonly"></p>
-
- <p class="clearfix"><label for="swap_other">and:</label>
- <select name="other" id="swap_other" name="other" class="other">
- </select></p>
-
- <p class="clearfix buttons">
- <button type="submit" class="submit"><span>Swap Cores</span></button>
- <button type="reset" class="reset"><span>Cancel</span></button>
- </p>
-
- </form>
-
- </div>
-
- </div>
-
- <div id="data" class="requires-core">
-
- <div class="block" id="core-data">
-
- <h2><span>Core</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <ul>
-
- <li class="startTime"><dl class="clearfix">
- <dt><span>startTime:</span></dt>
- <dd class="timeago"></dd>
- </dl></li>
-
- <li class="instanceDir"><dl class="clearfix">
- <dt><span>instanceDir:</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="dataDir"><dl class="clearfix">
- <dt><span>dataDir:</span></dt>
- <dd></dd>
- </dl></li>
-
- </ul>
-
- </div>
- </div>
-
- <div class="block" id="index-data">
-
- <h2><span>Index</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <ul>
-
- <li class="lastModified"><dl class="clearfix">
- <dt><span>lastModified:</span></dt>
- <dd class="timeago"></dd>
- </dl></li>
-
- <li class="version"><dl class="clearfix">
- <dt><span>version:</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="numDocs"><dl class="clearfix">
- <dt><span>numDocs:</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="maxDoc"><dl class="clearfix">
- <dt><span>maxDoc:</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="deletedDocs"><dl class="clearfix">
- <dt><span>deletedDocs:</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="optimized"><dl class="clearfix">
- <dt><span>optimized:</span></dt>
- <dd class="ico"><span></span></dd>
- </dl></li>
-
- <li class="current"><dl class="clearfix">
- <dt><span>current:</span></dt>
- <dd class="ico"><span></span></dd>
- </dl></li>
-
- <li class="directory"><dl class="clearfix">
- <dt><span>directory:</span></dt>
- <dd></dd>
- </dl></li>
-
- </ul>
-
- </div>
- </div>
-
- </div>
-
- </div>
-
- <div id="navigation" class="requires-core clearfix">
-
- </div>
-
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/dashboard.html b/solr/webapp/web/tpl/dashboard.html
deleted file mode 100644
index 814b3c4ad1c..00000000000
--- a/solr/webapp/web/tpl/dashboard.html
+++ /dev/null
@@ -1,201 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="dashboard">
-
- <div class="clearfix">
-
- <div class="block fieldlist" id="statistics">
-
- <h2><span>Statistics</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <dl>
-
- <dt class="index_last-modified">Last Modified:</dt>
- <dd class="index_last-modified value timeago"></dd>
-
- <dt class="index_num-doc">Num Docs:</dt>
- <dd class="index_num-doc value"></dd>
-
- <dt class="index_max-doc">Max Doc:</dt>
- <dd class="index_max-doc value"></dd>
-
- <dt class="index_heap-usage-bytes">Heap Memory Usage:</dt>
- <dd class="index_heap-usage-bytes value"></dd>
-
- <dt class="index_deleted-doc">Deleted Docs:</dt>
- <dd class="index_deleted-doc value"></dd>
-
- <dt class="index_version">Version:</dt>
- <dd class="index_version value"></dd>
-
- <dt class="index_segmentCount">Segment Count:</dt>
- <dd class="index_segmentCount value"></dd>
-
- <dt class="index_optimized">Optimized:</dt>
- <dd class="index_optimized value ico"><span></span>
- <a>optimize now</a></dd>
-
- <dt class="index_current">Current:</dt>
- <dd class="index_current value ico"><span></span></dd>
-
- </dl>
-
- </div>
- </div>
-
- <div class="block fieldlist" id="instance">
-
- <h2><span>Instance</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <dl>
-
- <dt class="dir_cwd"><abbr title="Current Working Directory">CWD</abbr>:</dt>
- <dd class="dir_cwd value"></dd>
-
- <dt class="dir_instance">Instance:</dt>
- <dd class="dir_instance value"></dd>
-
- <dt class="dir_data">Data:</dt>
- <dd class="dir_data value"></dd>
-
- <dt class="dir_index">Index:</dt>
- <dd class="dir_index value"></dd>
-
- <dt class="dir_impl">Impl:</dt>
- <dd class="dir_impl value"></dd>
-
- </dl>
-
- </div>
- </div>
-
- </div>
- <div class="clearfix">
-
- <div class="block" id="replication">
-
- <h2><span class="is-replicating">Replication</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content clearfix"id="details">
-
- <table border="0" cellspacing="0" cellpadding="0">
-
- <thead>
-
- <tr>
-
- <td><span>Index</span></td>
- <th>Version</th>
- <th><abbr title="Generation">Gen</abbr></th>
- <th>Size</th>
-
- </tr>
-
- </thead>
- <tbody>
-
- <tr class="masterSearch">
-
- <th>Master (Searching)</th>
- <td class="version"><div>x</div></td>
- <td class="generation"><div>y</div></td>
- <td class="size"><div>z</div></td>
-
- </tr>
-
- <tr class="master">
-
- <th>Master (Replicable)</th>
- <td class="version"><div>x</div></td>
- <td class="generation"><div>y</div></td>
- <td class="size"><div>z</div></td>
-
- </tr>
-
- <tr class="slave slaveOnly">
-
- <th>Slave (Searching)</th>
- <td class="version"><div>a</div></td>
- <td class="generation"><div>c</div></td>
- <td class="size"><div>c</div></td>
-
- </tr>
-
- </tbody>
-
- </table>
-
- </div>
- </div>
-
- <div class="block fieldlist" id="healthcheck">
-
- <h2><span>Healthcheck</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
- <dl>
-
- <dt class="status">Status:</dt>
- <dd class="status value ico">
- <button class="healthcheck-status">Healthcheck Status</button>
- </dd>
- </dl>
- </div>
-
- </div>
-
- </div>
- <div class="clearfix">
-
- <div class="block" id="admin-extra">
-
- <h2><span>Admin Extra</span></h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- </div>
-
- </div>
-
- </div>
-
-
-</div>
diff --git a/solr/webapp/web/tpl/dataimport.html b/solr/webapp/web/tpl/dataimport.html
deleted file mode 100644
index 3dc32b21bb6..00000000000
--- a/solr/webapp/web/tpl/dataimport.html
+++ /dev/null
@@ -1,183 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="dataimport" class="clearfix">
-
- <div id="frame">
-
- <div id="error"></div>
-
- <div id="current_state">
-
- <p class="last_update">Last Update: <abbr>Unknown</abbr></p>
- <div class="info">
-
- <strong></strong>
- <div class="details">
- <div class="docs"></div>
- <div class="dates"></div>
- </div>
-
- <button class="abort-import warn"><span data-aborting="Aborting Import">Abort Import</span></button>
-
- </div>
-
- </div>
-
- <div class="block hidden" id="raw_output">
-
- <h2>
- <a class="toggle"><span>Raw Status-Output</span></a>
- </h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <div id="raw_output_container"></div>
-
- </div>
-
- </div>
-
- <div class="block hidden" id="config">
-
- <h2 class="clearfix">
- <a class="toggle"><span>Configuration</span></a>
- <a class="r reload_config" title="Reload Configuration">Reload</a>
- <a class="r debug_mode">Debug-Mode</a>
- </h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <div id="dataimport_config">
-
- <div class="formatted">
-
- <div class="loader">Loading ...</div>
-
- </div>
-
- <div class="editable">
-
- <textarea></textarea>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div class="block hidden" id="debug_response">
-
- <h2>
- <a class="toggle"><span>Raw Debug-Response</span></a>
- </h2>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <em>No Request executed</em>
-
- </div>
-
- </div>
-
- </div>
-
- <div id="form">
-
- <div id="navigation">
-
- <ul></ul>
-
- </div>
-
- <form action="#" method="get">
-
- <label for="command">
- <a rel="help">Command</a>
- </label>
- <select name="command" id="command">
- <option>full-import</option>
- <option>delta-import</option>
- </select>
-
- <label for="verbose" class="checkbox">
- <input type="checkbox" name="verbose" id="verbose" value="true">
- <a rel="help">Verbose</a>
- </label>
-
- <label for="clean" class="checkbox">
- <input type="checkbox" name="clean" id="clean" value="true" checked="checked">
- <a rel="help">Clean</a>
- </label>
-
- <label for="commit" class="checkbox">
- <input type="checkbox" name="commit" id="commit" value="true" checked="checked">
- <a rel="help">Commit</a>
- </label>
-
- <label for="optimize" class="checkbox">
- <input type="checkbox" name="optimize" id="optimize" value="true">
- <a rel="help">Optimize</a>
- </label>
-
- <label for="debug" class="checkbox">
- <input type="checkbox" name="debug" id="debug" value="true">
- <a rel="help">Debug</a>
- </label>
-
- <label for="entity">
- <a rel="help">Entity</a>
- </label>
- <select id="entity"></select>
-
- <label for="start">
- <a rel="help">Start</a>,
- <a rel="help">Rows</a>
- </label>
- <div class="clearfix">
- <input type="text" id="start" placeholder="0">
- <input type="text" id="rows" placeholder="10">
- </div>
-
- <label for="custom_parameters">
- <a rel="help">Custom Parameters</a>
- </label>
- <input type="text" id="custom_parameters" value="" placeholder="key1=val1&amp;key2=val2">
-
- <button class="execute" type="submit"><span data-debugmode="Execute with this Configuration →">Execute</span></button>
- <button class="refresh-status"><span>Refresh Status</span></button>
-
- </form>
-
- <p id="auto-refresh-status"><a>Auto-Refresh Status</a></p>
-
- </div>
-
-</div>
diff --git a/solr/webapp/web/tpl/documents.html b/solr/webapp/web/tpl/documents.html
deleted file mode 100644
index d2a2e0e7d2d..00000000000
--- a/solr/webapp/web/tpl/documents.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<!--
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
--->
-
-<div id="documents" class="clearfix">
- <div id="form">
- <form action="#" method="post">
- <label for="qt">
- <a rel="help">Request-Handler (qt)</a>
- </label>
- <input type="text" id="qt" value="/update" title="Request handler in solrconfig.xml.">
- <!-- TODO: Add support for uploading docs and a doc wizard -->
- <label for="document-type">
- <a rel="help">Document Type</a>
- </label>
-
- <div><select name="document-type" id="document-type" title="The type of the document field">
- <!-- TODO: support the Builder -->
- <option value="csv">CSV</option>
- <option value="wizard">Document Builder</option>
- <option value="upload">File Upload</option>
- <option selected="true" value="json">JSON</option>
- <option value="solr">Solr Command (raw XML or JSON)</option>
- <option value="xml">XML</option>
- <!-- TODO: If other, then, show a text box -->
- <!--<option>Other</option>-->
- </select></div>
-
- <div id="document-container">
- <div id="wizard">
- <div id="wizard-fields">
- <div><span class="description">Field</span>: <select id="wiz-field-select" name="wiz-field-select"></select>
- </div>
- <div><span id="wiz-field-data"><span class="description">Field Data</span>:</span> <textarea id="wizard-doc"
- name="wizard-doc"
- rows="10"
- cols="40">Enter your field text here and then click "Add Field" to add the field to the document.</textarea></div>
- </div>
- <div id="wizard-add"><a id="add-field-href" href="#"><img border="0" src="./img/ico/plus-button.png"/>Add
- Field</a></div>
- </div>
- <label for="document">
- <a rel="help">Document(s)</a>
- </label>
- <textarea name="document" id="document" title="The Document" rows="10"
- cols="70">{"id":"change.me","title":"change.me"}</textarea>
-
- <div id="file-upload">
- <input type="file" id="the-file" name="the-file"/>
- </div>
- </div>
-
- <div id="advanced">
- <!-- TODO: only show for JSON/XML-->
- <div id="attribs">
- <div id="upload-only">
- <label for="erh-params"><!-- TODO: cleaner way to do this? -->
- <a rel="help">Extracting Req. Handler Params</a>
- </label>
- <input type="text" id="erh-params" value="&literal.id=change.me"
- title="Extracting Request Handler Parameters" size="50">
- </div>
- <div id="general-attribs">
- <label for="commitWithin">
- <a rel="help">Commit Within</a>
- </label>
- <input type="text" id="commitWithin" value="1000" title="Commit Within (ms)">
- <label for="overwrite">
- <a rel="help">Overwrite</a>
- </label>
- <input type="text" id="overwrite" value="true" title="Overwrite">
- </div>
- </div>
- </div>
-
- <button type="submit" id="submit">Submit Document</button>
- </form>
- </div>
- <div id="result">
- <div id="response">
- <!--<iframe src="about:blank"></iframe>-->
- </div>
-
- </div>
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/files.html b/solr/webapp/web/tpl/files.html
deleted file mode 100644
index 0a27f24a95e..00000000000
--- a/solr/webapp/web/tpl/files.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="files" class="clearfix">
-
- <div id="frame">
-
- <div id="tree-holder">
-
- <div id="tree" class="tree">#tree</div>
-
- </div>
- <div id="file-content" class="clearfix">
-
- <div class="top clearfix">
-
- <a id="url" class="address-bar" href="#"></a>
-
- </div>
-
- <div class="view-file">
-
- <div class="response">Loading …</div>
-
- </div>
-
- </div>
-
- </div>
-
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/index.html b/solr/webapp/web/tpl/index.html
deleted file mode 100644
index 18fd71a66a6..00000000000
--- a/solr/webapp/web/tpl/index.html
+++ /dev/null
@@ -1,250 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="index" class="clearfix">
-
- <div class="clearfix">
-
- <div class="index-left">
-
- <div class="block" id="instance">
-
- <h2><span>Instance</span></h2>
-
- <div class="content">
-
- <ul class="data">
-
- <li class="start_time"><dl class="clearfix">
- <dt><span>Start</span></dt>
- <dd class="timeago"></dd>
- </dl></li>
-
- <li class="host"><dl class="clearfix">
- <dt><span>Host</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="dir dir_cwd"><dl class="clearfix">
- <dt><span>CWD</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="dir dir_instance"><dl class="clearfix">
- <dt><span>Instance</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="dir dir_data"><dl class="clearfix">
- <dt><span>Data</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="dir dir_index"><dl class="clearfix">
- <dt><span>Index</span></dt>
- <dd></dd>
- </dl></li>
-
- </ul>
-
- </div>
-
- </div>
-
- <div class="block" id="versions">
-
- <h2><span>Versions</span></h2>
-
- <div class="content">
-
- <ul class="data">
-
- <li class="solr solr_spec_version"><dl class="clearfix">
- <dt><span>solr-spec</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="solr_impl_version"><dl class="clearfix">
- <dt class=""><span>solr-impl</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="lucene lucene_spec_version"><dl class="clearfix">
- <dt><span>lucene-spec</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="lucene_impl_version"><dl class="clearfix">
- <dt><span>lucene-impl</span></dt>
- <dd></dd>
- </dl></li>
-
- </ul>
-
- </div>
-
- </div>
-
- </div>
-
- <div class="index-right">
-
- <div class="block" id="system">
-
- <h2><span>System</span></h2>
- <a class="reload"><span>reload</span></a>
-
- <div class="content">
-
- <div id="physical-memory-bar">
-
- <p data-desc="physical-memory-bar">Physical Memory</p>
- <div class="bar-holder">
-
- <div class="bar-max bar">
- <span class="bar-max val"></span>
-
- <div class="bar-total bar">
- <span class="bar-total val"></span>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div id="swap-space-bar">
-
- <p data-desc="swap-space-bar">Swap Space</p>
- <div class="bar-holder">
-
- <div class="bar-max bar">
- <span class="bar-max val"></span>
-
- <div class="bar-total bar">
- <span class="bar-total val"></span>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div id="file-descriptor-bar">
-
- <p data-desc="file-descriptor-bar">File Descriptor Count</p>
- <div class="bar-holder">
-
- <div class="bar-max bar">
- <span class="bar-max val"></span>
-
- <div class="bar-total bar">
- <span class="bar-total val"></span>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <p class="no-info">Sorry, no information available</p>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div class="clearfix">
-
- <div class="index-left">
-
- <div class="block" id="jvm">
-
- <h2><span>JVM</span></h2>
-
- <div class="content clearfix">
-
- <ul class="data">
-
- <li class="jvm_version"><dl class="clearfix">
- <dt><span>Runtime</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="processors"><dl class="clearfix">
- <dt><span>Processors</span></dt>
- <dd></dd>
- </dl></li>
-
- <li class="command_line_args"><dl class="clearfix">
- <dt><span>Args</span></dt>
- <dd></dd>
- </dl></li>
-
- </ul>
-
- </div>
-
- </div>
-
- </div>
- <div class="index-right">
-
- <div class="block" id="jvm-memory">
-
- <h2><span data-desc="jvm-memory-bar">JVM-Memory</span></h2>
-
- <div class="content">
-
- <div id="jvm-memory-bar">
- <div class="bar-holder">
-
- <div class="bar-max bar">
- <span class="bar-max val"></span>
-
- <div class="bar-total bar">
- <span class="bar-total val"></span>
-
- <div class="bar-used bar">
- <span class="bar-used val"></span>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/logging.html b/solr/webapp/web/tpl/logging.html
deleted file mode 100644
index 80671e5280d..00000000000
--- a/solr/webapp/web/tpl/logging.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="logging" class="clearfix">
-
- <div id="frame">
-
- </div>
-
-</div>
diff --git a/solr/webapp/web/tpl/plugins.html b/solr/webapp/web/tpl/plugins.html
deleted file mode 100644
index 2d4a1a82bb0..00000000000
--- a/solr/webapp/web/tpl/plugins.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="plugins" class="clearfix">
-
- <div id="frame">
-
- </div>
-
- <div id="navigation" class="clearfix">
-
- <ul>
- </ul>
-
- </div>
-
- <div id="recording">
- <div class="wrapper clearfix">
-
- <p class="loader">Watching for Changes</p>
- <button class="primary">Stop &amp; Show Changes</button>
-
- </div>
- </div>
-
-</div>
diff --git a/solr/webapp/web/tpl/query.html b/solr/webapp/web/tpl/query.html
deleted file mode 100644
index bd0cdb06981..00000000000
--- a/solr/webapp/web/tpl/query.html
+++ /dev/null
@@ -1,361 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="query" class="clearfix">
-
- <div id="form">
-
- <form action="#" method="get">
-
- <label for="qt">
- <a rel="help">Request-Handler (qt)</a>
- </label>
- <input type="text" id="qt" value="/select" title="Request handler in solrconfig.xml.">
-
- <fieldset class="common">
- <legend>common</legend>
- <div class="fieldset">
-
- <label for="q">
- q
- </label>
- <textarea name="q" id="q" title="The query string.">*:*</textarea>
-
- <label for="fq">
- <a rel="help">fq</a>
- </label>
- <div class="multiple">
- <div class="row clearfix">
- <input type="text" id="fq" name="fq" title="Filter query.">
- <div class="buttons">
- <a class="rem" data-action="0"><span>[-]</span></a>
- <a class="add" data-action="1"><span>[+]</span></a>
- </div>
- </div>
- </div>
-
- <label for="sort">
- <a rel="help">sort</a>
- </label>
- <input type="text" id="sort" name="sort" title="Sort field or function with asc|desc.">
-
- <label for="start">
- <a rel="help">start</a>,
- <a rel="help">rows</a>
- </label>
- <div class="clearfix">
- <input type="text" name="start" id="start" placeholder="0" pattern="[0-9]+" title="Number of leading documents to skip. (Integer)">
- <input type="text" name="rows" id="rows" placeholder="10" pattern="[0-9]+" title="Number of documents to return after 'start'. (Integer)">
- </div>
-
- <label for="fl">
- <a rel="help">fl</a>
- </label>
- <input type="text" name="fl" id="fl" value="" title="Field list, comma separated.">
-
- <label for="df">
- <a rel="help">df</a>
- </label>
- <input type="text" name="df" id="df" value="" title="Default search field">
-
- <label for="custom_parameters">
- <a rel="help">Raw Query Parameters</a>
- </label>
- <input type="text" id="custom_parameters" value="" placeholder="key1=val1&amp;key2=val2">
-
- <label for="wt">
- <a rel="help">wt</a>
- </label>
- <select name="wt" id="wt" title="The writer type (response format).">
- <option>json</option>
- <option>xml</option>
- <option>python</option>
- <option>ruby</option>
- <option>php</option>
- <option>csv</option>
- </select>
-
- <label for="indent" class="checkbox">
- <input type="checkbox" name="indent" id="indent" value="true" title="Indent results." checked="checked">
- <a rel="help">indent</a>
- </label>
-
- <label for="debugQuery" class="checkbox">
- <input type="checkbox" name="debugQuery" id="debugQuery" value="true" title="Show timing and diagnostics.">
- <a rel="help">debugQuery</a>
- </label>
-
- </div>
- </fieldset>
-
- <fieldset class="dismax optional">
- <legend>
- <label for="dismax" class="checkbox">
- <input type="checkbox" name="defType" id="dismax" value="dismax">
- dismax
- </label>
- </legend>
- <div class="fieldset">
-
- <label for="q_alt">q.alt</label>
- <input type="text" name="q.alt" id="q_alt" title="Alternate query when 'q' is absent.">
-
- <label for="qf">qf</label>
- <input type="text" name="qf" id="qf" title="Query fields with optional boosts.">
-
- <label for="mm">mm</label>
- <input type="text" name="mm" id="mm" title="Min-should-match expression.">
-
- <label for="pf">pf</label>
- <input type="text" name="pf" id="pf" title="Phrase boosted fields.">
-
- <label for="ps">ps</label>
- <input type="text" name="ps" id="ps" title="Phrase boost slop.">
-
- <label for="qs">qs</label>
- <input type="text" name="qs" id="qs" title="Query string phrase slop.">
-
- <label for="tie">tie</label>
- <input type="text" name="tie" id="tie" title="Score tie-breaker. Try 0.1.">
-
- <label for="bq">bq</label>
- <input type="text" name="bq" id="bq" title="Boost query.">
-
- <label for="bf">bf</label>
- <input type="text" name="bf" id="bf" title="Boost function (added).">
-
- </div>
- </fieldset>
-
- <fieldset class="edismax optional">
- <legend>
- <label for="edismax" class="checkbox">
- <input type="checkbox" name="defType" id="edismax" value="edismax">
- <strong>e</strong>dismax
- </label>
- </legend>
- <div class="fieldset">
-
- <label for="edismax_q_alt">q.alt</label>
- <input type="text" name="q.alt" id="edismax_q_alt" title="Alternate query when 'q' is absent.">
-
- <label for="edismax_qf">qf</label>
- <input type="text" name="qf" id="edismax_qf" title="Query fields with optional boosts.">
-
- <label for="edismax_mm">mm</label>
- <input type="text" name="mm" id="edismax_mm" title="Min-should-match expression.">
-
- <label for="edismax_pf">pf</label>
- <input type="text" name="pf" id="edismax_pf" title="Phrase boosted fields.">
-
- <label for="edismax_ps">ps</label>
- <input type="text" name="ps" id="edismax_ps" title="Phrase boost slop.">
-
- <label for="edismax_qs">qs</label>
- <input type="text" name="qs" id="edismax_qs" title="Query string phrase slop.">
-
- <label for="edismax_tie">tie</label>
- <input type="text" name="tie" id="edismax_tie" title="Score tie-breaker. Try 0.1.">
-
- <label for="edismax_bq">bq</label>
- <input type="text" name="bq" id="edismax_bq" title="Boost query.">
-
- <label for="edismax_bf">bf</label>
- <input type="text" name="bf" id="edismax_bf" title="Boost function (added).">
-
- <label for="edismax_uf" title="User Fields">uf</label>
- <input type="text" name="uf" id="edismax_uf">
-
- <label for="edismax_pf2" title="bigram phrase boost fields">pf2</label>
- <input type="text" name="pf2" id="edismax_pf2">
-
- <label for="edismax_pf3" title="trigram phrase boost fields">pf3</label>
- <input type="text" name="pf3" id="edismax_pf3">
-
- <label for="edismax_ps2" title="phrase slop for bigram phrases">ps2</label>
- <input type="text" name="ps2" id="edismax_ps2">
-
- <label for="edismax_ps3" title="phrase slop for trigram phrases">ps3</label>
- <input type="text" name="ps3" id="edismax_ps3">
-
- <label for="edismax_boost" title="multiplicative boost function">boost</label>
- <input type="text" name="boost" id="edismax_boost">
-
- <label for="edismax_stopwords" class="checkbox" title="remove stopwords from mandatory 'matching' component">
- <input type="checkbox" name="stopwords" id="edismax_stopwords" value="true" checked="checked">
- stopwords
- </label>
-
- <label for="edismax_lowercaseOperators" class="checkbox" title="Enable lower-case 'and' and 'or' as operators">
- <input type="checkbox" name="lowercaseOperators" id="edismax_lowercaseOperators" value="true" checked="checked">
- lowercaseOperators
- </label>
-
- </div>
- </fieldset>
-
- <fieldset class="hl optional">
- <legend>
- <label for="hl" class="checkbox">
- <input type="checkbox" name="hl" id="hl" value="true" title="Enable highlighting.">
- hl
- </label>
- </legend>
- <div class="fieldset">
-
- <label for="hl_fl">hl.fl</label>
- <input type="text" name="hl.fl" id="hl_fl" value="" title="Fields to highlight on.">
-
- <label for="hl_simple_pre">hl.simple.pre</label>
- <input type="text" name="hl.simple.pre" id="hl_simple_pre" value="<em>">
-
- <label for="hl_simple_post">hl.simple.post</label>
- <input type="text" name="hl.simple.post" id="hl_simple_post" value="</em>">
-
- <label for="hl_requireFieldMatch" class="checkbox">
- <input type="checkbox" name="hl.requireFieldMatch" id="hl_requireFieldMatch" value="true">
- hl.requireFieldMatch
- </label>
-
- <label for="hl_usePhraseHighlighter" class="checkbox">
- <input type="checkbox" name="hl.usePhraseHighlighter" id="hl_usePhraseHighlighter" value="true">
- hl.usePhraseHighlighter
- </label>
-
- <label for="hl_highlightMultiTerm" class="checkbox">
- <input type="checkbox" name="hl.highlightMultiTerm" id="hl_highlightMultiTerm" value="true">
- hl.highlightMultiTerm
- </label>
-
- </div>
- </fieldset>
-
- <fieldset class="facet optional">
- <legend>
- <label for="facet" class="checkbox">
- <input type="checkbox" name="facet" id="facet" value="true">
- facet
- </label>
- </legend>
- <div class="fieldset">
-
- <label for="facet_query">facet.query</label>
- <textarea name="facet.query" id="facet_query"></textarea>
-
- <label for="facet_field">facet.field</label>
- <input type="text" name="facet.field" id="facet_field">
-
- <label for="facet_prefix">facet.prefix</label>
- <input type="text" name="facet.prefix" id="facet_prefix">
-
- </div>
- </fieldset>
-
- <fieldset class="spatial optional">
- <legend>
- <label for="spatial" class="checkbox">
- <input type="checkbox" name="spatial" id="spatial" value="true">
- spatial
- </label>
- </legend>
- <div class="fieldset">
-
- <label for="pt">pt</label>
- <input type="text" name="pt" id="pt">
-
- <label for="sfield">sfield</label>
- <input type="text" name="sfield" id="sfield">
-
- <label for="d">d</label>
- <input type="text" name="d" id="d">
-
- </div>
- </fieldset>
-
- <fieldset class="spellcheck optional">
- <legend>
- <label for="spellcheck" class="checkbox">
- <input type="checkbox" name="spellcheck" id="spellcheck" value="true">
- spellcheck
- </label>
- </legend>
- <div class="fieldset">
-
- <label for="spellcheck_build" class="checkbox">
- <input type="checkbox" name="spellcheck.build" id="spellcheck_build" value="true">
- spellcheck.build
- </label>
-
- <label for="spellcheck_reload" class="checkbox">
- <input type="checkbox" name="spellcheck.reload" id="spellcheck_reload" value="true">
- spellcheck.reload
- </label>
-
- <label for="spellcheck_q">spellcheck.q</label>
- <input type="text" name="spellcheck.q" id="spellcheck_q">
-
- <label for="spellcheck_dictionary">spellcheck.dictionary</label>
- <input type="text" name="spellcheck.dictionary" id="spellcheck_dictionary">
-
- <label for="spellcheck_count">spellcheck.count</label>
- <input type="text" name="spellcheck.count" id="spellcheck_count">
-
- <label for="spellcheck_onlyMorePopular" class="checkbox">
- <input type="checkbox" name="spellcheck.onlyMorePopular" id="spellcheck_onlyMorePopular" value="true">
- spellcheck.onlyMorePopular
- </label>
-
- <label for="spellcheck_extendedResults" class="checkbox">
- <input type="checkbox" name="spellcheck.extendedResults" id="spellcheck_extendedResults" value="true">
- spellcheck.extendedResults
- </label>
-
- <label for="spellcheck_collate" class="checkbox">
- <input type="checkbox" name="spellcheck.collate" id="spellcheck_collate" value="true">
- spellcheck.collate
- </label>
-
- <label for="spellcheck_maxCollations">spellcheck.maxCollations</label>
- <input type="text" name="spellcheck.maxCollations" id="spellcheck_maxCollations">
-
- <label for="spellcheck_maxCollationTries">spellcheck.maxCollationTries</label>
- <input type="text" name="spellcheck.maxCollationTries" id="spellcheck_maxCollationTries">
-
- <label for="spellcheck_accuracy">spellcheck.accuracy</label>
- <input type="text" name="spellcheck.accuracy" id="spellcheck_accuracy">
-
- </fieldset>
-
-
- <button type="submit">Execute Query</button>
-
- </form>
-
- </div>
-
- <div id="result">
-
- <a id="url" class="address-bar" href="#"></a>
-
- <div id="response">
-
- <iframe src="about:blank"></iframe>
-
- </div>
-
- </div>
-
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/replication.html b/solr/webapp/web/tpl/replication.html
deleted file mode 100644
index 2bfdfbdbd8c..00000000000
--- a/solr/webapp/web/tpl/replication.html
+++ /dev/null
@@ -1,216 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="replication" class="clearfix">
-
- <div id="frame">
-
- <div id="error"></div>
-
- <div class="replicating block">
-
- <div id="progress">
-
- <div id="start"><div class="info">
-
- <span>Wed May 11 19:41:48 UTC 2011</span>
-
- </div></div>
-
- <div id="speed"><div class="info">
-
- <span>5.1 MB</span>/s
-
- </div></div>
-
- <div id="bar">
-
- <div id="bar-info"><div class="info">
-
- <div class="files"><span>24</span> Files</div>
- <div class="size"><span>226.85 MB</span></div>
-
- </div></div>
-
- <div id="eta"><div class="info">
-
- ETA: <span>25s</span>
-
- </div></div>
-
- <div id="done" style="width: 20.0%;">
-
- <div class="percent">
-
- <span>20</span>%
-
- </div>
-
- <div id="done-info"><div class="info">
-
- <div class="files"><span>2</span> Files</div>
- <div class="size"><span>91.76 MB</span></div>
-
- </div></div>
-
- </div>
-
- </div>
-
- </div>
-
- <div id="current-file" class="clearfix">
-
- <div class="label"><span class="loader">Current File:</span></div>
- <div class="file">_a.fdt</div>
- <div class="progress">
- <span class="done">84 MB</span> / <span class="total">102.98 MB</span> [<span class="percent">81</span>%]
- </div>
-
- </div>
-
- </div>
-
- <div id="iterations" class="slaveOnly block clearfix">
-
- <div class="label"><span class="">Iterations:</span></div>
- <div class="iterations">
- <ul>
- </ul>
- <a>
- <span class="expand">Show all Iterations</span>
- <span class="collapse">Hide past Iterations</span>
- </a>
- </div>
-
- </div>
-
- <div id="details" class="block clearfix">
-
- <table border="0" cellspacing="0" cellpadding="0">
-
- <thead>
-
- <tr>
-
- <td><span>Index</span></td>
- <th>Version</th>
- <th><abbr title="Generation">Gen</abbr></th>
- <th>Size</th>
-
- </tr>
-
- </thead>
- <tbody>
-
- <tr class="masterSearch">
-
- <th>Master (Searching)</th>
- <td class="version"><div></div></td>
- <td class="generation"><div></div></td>
- <td class="size"><div></div></td>
-
- </tr>
-
- <tr class="master">
-
- <th>Master (Replicable)</th>
- <td class="version"><div></div></td>
- <td class="generation"><div></div></td>
- <td class="size"><div></div></td>
-
- </tr>
-
- <tr class="slave slaveOnly">
-
- <th>Slave (Searching)</th>
- <td class="version"><div></div></td>
- <td class="generation"><div></div></td>
- <td class="size"><div></div></td>
-
- </tr>
-
- </tbody>
-
- </table>
-
- </div>
-
- <div id="settings" class="settings block clearfix slaveOnly">
-
- <div class="label"><span>Settings:</span></div>
- <ul>
- <li class="masterUrl"><dl class="clearfix">
- <dt>master url:</dt>
- <dd></dd>
- </dl></li>
- <li class="isPollingDisabled"><dl class="clearfix">
- <dt>polling enable:</dt>
- <dd class="ico">&nbsp;</dd>
- </dl></li>
- </ul>
-
- </div>
-
- <div id="master-settings" class="settings block clearfix">
-
- <div class="label"><span>Settings (Master):</span></div>
- <ul>
- <li class="replicationEnabled"><dl class="clearfix">
- <dt>replication enable:</dt>
- <dd class="ico">&nbsp;</dd>
- </dl></li>
- <li class="replicateAfter"><dl class="clearfix">
- <dt>replicateAfter:</dt>
- <dd></dd>
- </dl></li>
- <li class="confFiles"><dl class="clearfix">
- <dt>confFiles:</dt>
- <dd></dd>
- </dl></li>
- </ul>
-
- </div>
-
- </div>
-
- <div id="navigation">
-
- <div class="timer">
-
- <p>Next Run: <span class="approx">~</span><span class="tick">15m 8s</span></p>
- <small>Sat Mar 03 11:00:00 CET 2012</smalL>
-
- </div>
-
- <button class="refresh-status"><span>Refresh Status</span></button>
-
- <div class="slaveOnly">
- <button class="optional replicate-now primary" data-command="fetchindex"><span>Replicate now</span></button>
- <button class="optional abort-replication warn" data-command="abortfetch"><span>Abort Replication</span></button>
-
- <button class="optional disable-polling" data-command="disablepoll"><span>Disable Polling</span></button>
- <button class="optional enable-polling" data-command="enablepoll"><span>Enable Polling</span></button>
- </div>
-
- <div class="masterOnly">
- <button class="optional disable-replication warn" data-command="disablereplication"><span>Disable Replication<span></button>
- <button class="optional enable-replication warn" data-command="enablereplication"><span>Enable Replication<span></button>
- </div>
-
- </div>
-
-</div>
diff --git a/solr/webapp/web/tpl/schema-browser.html b/solr/webapp/web/tpl/schema-browser.html
deleted file mode 100644
index 43386680fa7..00000000000
--- a/solr/webapp/web/tpl/schema-browser.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="schema-browser" class="loaded">
-
- <div class="clearfix">
-
- <div id="data">
-
- <div id="field">
-
- <div class="field-options">
-
- <div class="block head">
- <h2>
- <span class="type"></span>:
- <span class="name"></span>
- </h2>
- </div>
-
- <div class="partial">
-
- <p>Because your Index is empty, we have not enough Information about this Field</p>
-
- </div>
-
- <dl class="options clearfix">
-
- <dt class="field-type">Field-Type:</dt>
-
- <dt class="similarity">Similarity:</dt>
-
- <dt class="position-increment-gap"><abbr title="Position Increment Gap">PI Gap</abbr>:</dt>
-
- <dt class="docs">Docs:</dt>
-
- <dt class="distinct">Distinct:</dt>
-
- </dl>
-
- <table class="flags" cellspacing="0" cellpadding="0" border="0">
-
- <thead>
-
- <tr>
-
- <td>Flags:</td>
-
- </tr>
-
- </thead>
-
- <tbody>
-
- </tbody>
-
- </table>
-
- <ul class="analyzer">
- <li class="clearfix index">
-
- <p><a><span>Index&nbsp;Analyzer:</span></a></p>
- <dl>
- <dt><a class="toggle"></a></dt>
- </dl>
-
- <ul>
- <li class="clearfix charFilters">
- <p>Char Filters:</p>
- <dl>
- </dl>
- </li>
- <li class="clearfix tokenizer">
- <p>Tokenizer:</p>
- <dl>
- </dl>
- </li>
- <li class="clearfix filters">
- <p>Token Filters:</p>
- <dl>
- </dl>
- </li>
- </ul>
-
- </li>
- <li class="clearfix query">
-
- <p><a><span>Query&nbsp;Analyzer:</span></a></p>
- <dl>
- <dt><a class="toggle"></a></dt>
- </dl>
-
- <ul>
- <li class="clearfix charFilters">
- <p>Char Filters:</p>
- <dl>
- </dl>
- </li>
- <li class="clearfix tokenizer">
- <p>Tokenizer:</p>
- <dl>
- </dl>
- </li>
- <li class="clearfix filters">
- <p>Token Filters:</p>
- <dl>
- </dl>
- </li>
- </ul>
-
- </li>
- </ul>
-
- </div>
-
- <div class="terminfo-holder clearfix">
-
- <div class="trigger">
-
- <button class="submit"><span>Load Term Info</span></button>
-
- <a class="autoload" title="Automatically load Term Info?"><span>Autoload</span></a>
-
- </div>
-
- <p class="status">Sorry, no Term Info available :(</p>
-
- <div class="topterms-holder">
-
- <form>
- <p class="head">
- <input type="text">
- <a class="max-holder" title="Load all Top-Terms">/<span class="max"></span></a> Top-Terms:
- <a id="query_link" href="#"><span>Query</span>&nbsp;</a>
- </p>
- </form>
-
- <ul>
-
- </ul>
-
- </div>
-
- <div class="histogram-holder">
-
- <p class="head">Histogram:</p>
-
- <ul></ul>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div id="related">
-
- <select>
- <option value="" selected="selected">Please select ...</option>
- </select>
-
- <dl id="f-df-t">
- </dl>
-
- <dl class="ukf-dsf">
-
- <dt class="unique-key-field">Unique Key Field</dt>
-
- <dt class="default-search-field">Default Search Field</dt>
-
- </dl>
-
- </div>
-
- </div>
-
-</div>
diff --git a/solr/webapp/web/tpl/segments.html b/solr/webapp/web/tpl/segments.html
deleted file mode 100644
index ffc21770468..00000000000
--- a/solr/webapp/web/tpl/segments.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="segments">
- <div class="clearfix">
-
- <div class="block fieldlist" id="statistics">
-
- <h2><span>Segments</span></h2>
- <a class="reload"><span>reload</span></a>
-
- <div class="message-container">
- <div class="message"></div>
- </div>
-
- <div class="content">
-
- <div id="result">
-
- <div id="response">
-
- <div class="segments-holder">
-
- <ul></ul>
-
- </div>
-
- </div>
-
- </div>
- </div>
- </div>
-
- </div>
-
-</div>
\ No newline at end of file
diff --git a/solr/webapp/web/tpl/threads.html b/solr/webapp/web/tpl/threads.html
deleted file mode 100644
index 87153ba7486..00000000000
--- a/solr/webapp/web/tpl/threads.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<div id="threads" class="collapsed">
-
- <div class="controls">
- <a>
- <span class="expand">Show all Stacktraces</span>
- <span class="collapse">Hide all Stacktraces</span>
- </a>
- </div>
-
- <div id="thread-dump">
-
- <table border="0" cellpadding="0" cellspacing="0">
-
- <thead>
-
- <tr>
-
- <th class="name">name</th>
- <th class="time">cpuTime / userTime</th>
-
- </tr>
-
- </thead>
-
- <tbody>
-
- </tbody>
-
- </table>
-
- </div>
-
- <div class="controls">
- <a>
- <span class="expand">Show all Stacktraces</span>
- <span class="collapse">Hide all Stacktraces</span>
- </a>
- </div>
-
-</div>
\ No newline at end of file