sunspot_solr 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sunspot-solr +2 -6
- data/lib/sunspot/solr/server.rb +2 -3
- data/solr/README.txt +181 -181
- data/solr/bin/post +29 -19
- data/solr/bin/solr +247 -428
- data/solr/bin/solr.cmd +102 -256
- data/solr/bin/solr.in.cmd +15 -7
- data/solr/bin/solr.in.sh +26 -12
- data/solr/server/README.txt +110 -113
- data/solr/server/contexts/solr-jetty-context.xml +8 -8
- data/solr/server/etc/jetty-http.xml +47 -0
- data/solr/server/etc/jetty-https-ssl.xml +175 -159
- data/solr/server/etc/jetty-https.xml +53 -0
- data/solr/server/etc/jetty-ssl.xml +46 -0
- data/solr/server/etc/jetty.xml +189 -167
- data/solr/server/etc/webdefault.xml +527 -527
- data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
- data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
- data/solr/server/modules/http.mod +9 -0
- data/solr/server/modules/https.mod +9 -0
- data/solr/server/modules/server.mod +11 -0
- data/solr/server/modules/ssl.mod +9 -0
- data/solr/server/resources/jetty-logging.properties +1 -0
- data/solr/server/resources/log4j.properties +24 -24
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-common-5.0.0.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-kuromoji-5.0.0.jar → lucene-analyzers-kuromoji-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-phonetic-5.0.0.jar → lucene-analyzers-phonetic-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
- data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
- data/solr/server/solr-webapp/webapp/admin.html +164 -163
- data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
- data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
- data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
- data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
- data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
- data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
- data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
- data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
- data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
- data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
- data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
- data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
- data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
- data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
- data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
- data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
- data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
- data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
- data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
- data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
- data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
- data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
- data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
- data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
- data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
- data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
- data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
- data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
- data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
- data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
- data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
- data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
- data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
- data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
- data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
- data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
- data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
- data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
- data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
- data/solr/server/solr-webapp/webapp/index.html +208 -0
- data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
- data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
- data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
- data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
- data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
- data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
- data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
- data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
- data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
- data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
- data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
- data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
- data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
- data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
- data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
- data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
- data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
- data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
- data/solr/server/solr-webapp/webapp/js/main.js +60 -58
- data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
- data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
- data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
- data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
- data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
- data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
- data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
- data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
- data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
- data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
- data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
- data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
- data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
- data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
- data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
- data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
- data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
- data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
- data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
- data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
- data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
- data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
- data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
- data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
- data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
- data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
- data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
- data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
- data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
- data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
- data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
- data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
- data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
- data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
- data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
- data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
- data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
- data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
- data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
- data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
- data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
- data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
- data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
- data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
- data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
- data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
- data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
- data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
- data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
- data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
- data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
- data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
- data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
- data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
- data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
- data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
- data/solr/server/solr/README.txt +77 -77
- data/solr/server/solr/solr.xml +51 -51
- data/solr/server/solr/zoo.cfg +17 -17
- data/solr/server/start.jar +0 -0
- data/spec/server_spec.rb +3 -8
- metadata +132 -43
- data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/servlet-api-3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/.gitignore +0 -1
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
- data/solr/server/webapps/solr.war +0 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
/*
|
25
|
+
AngularJS v1.3.8
|
26
|
+
(c) 2010-2014 Google, Inc. http://angularjs.org
|
27
|
+
License: MIT
|
28
|
+
*/
|
29
|
+
(function(p,d,C){'use strict';function v(r,h,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,c,b,f,y){function z(){k&&(g.cancel(k),k=null);l&&(l.$destroy(),l=null);m&&(k=g.leave(m),k.then(function(){k=null}),m=null)}function x(){var b=r.current&&r.current.locals;if(d.isDefined(b&&b.$template)){var b=a.$new(),f=r.current;m=y(b,function(b){g.enter(b,null,m||c).then(function(){!d.isDefined(t)||t&&!a.$eval(t)||h()});z()});l=f.scope=b;l.$emit("$viewContentLoaded");
|
30
|
+
l.$eval(w)}else z()}var l,m,k,t=b.autoscroll,w=b.onload||"";a.$on("$routeChangeSuccess",x);x()}}}function A(d,h,g){return{restrict:"ECA",priority:-400,link:function(a,c){var b=g.current,f=b.locals;c.html(f.$template);var y=d(c.contents());b.controller&&(f.$scope=a,f=h(b.controller,f),b.controllerAs&&(a[b.controllerAs]=f),c.data("$ngControllerController",f),c.children().data("$ngControllerController",f));y(a)}}}p=d.module("ngRoute",["ng"]).provider("$route",function(){function r(a,c){return d.extend(Object.create(a),
|
31
|
+
c)}function h(a,d){var b=d.caseInsensitiveMatch,f={originalPath:a,regexp:a},g=f.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,d,b,c){a="?"===c?c:null;c="*"===c?c:null;g.push({name:b,optional:!!a});d=d||"";return""+(a?"":d)+"(?:"+(a?d:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");f.regexp=new RegExp("^"+a+"$",b?"i":"");return f}var g={};this.when=function(a,c){var b=d.copy(c);d.isUndefined(b.reloadOnSearch)&&(b.reloadOnSearch=!0);
|
32
|
+
d.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);g[a]=d.extend(b,a&&h(a,b));if(a){var f="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";g[f]=d.extend({redirectTo:a},h(f,b))}return this};this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,c,b,f,h,p,x){function l(b){var e=s.current;
|
33
|
+
(v=(n=k())&&e&&n.$$route===e.$$route&&d.equals(n.pathParams,e.pathParams)&&!n.reloadOnSearch&&!w)||!e&&!n||a.$broadcast("$routeChangeStart",n,e).defaultPrevented&&b&&b.preventDefault()}function m(){var u=s.current,e=n;if(v)u.params=e.params,d.copy(u.params,b),a.$broadcast("$routeUpdate",u);else if(e||u)w=!1,(s.current=e)&&e.redirectTo&&(d.isString(e.redirectTo)?c.path(t(e.redirectTo,e.params)).search(e.params).replace():c.url(e.redirectTo(e.pathParams,c.path(),c.search())).replace()),f.when(e).then(function(){if(e){var a=
|
34
|
+
d.extend({},e.resolve),b,c;d.forEach(a,function(b,e){a[e]=d.isString(b)?h.get(b):h.invoke(b,null,null,e)});d.isDefined(b=e.template)?d.isFunction(b)&&(b=b(e.params)):d.isDefined(c=e.templateUrl)&&(d.isFunction(c)&&(c=c(e.params)),c=x.getTrustedResourceUrl(c),d.isDefined(c)&&(e.loadedTemplateUrl=c,b=p(c)));d.isDefined(b)&&(a.$template=b);return f.all(a)}}).then(function(c){e==s.current&&(e&&(e.locals=c,d.copy(e.params,b)),a.$broadcast("$routeChangeSuccess",e,u))},function(b){e==s.current&&a.$broadcast("$routeChangeError",
|
35
|
+
e,u,b)})}function k(){var a,b;d.forEach(g,function(f,g){var q;if(q=!b){var h=c.path();q=f.keys;var l={};if(f.regexp)if(h=f.regexp.exec(h)){for(var k=1,m=h.length;k<m;++k){var n=q[k-1],p=h[k];n&&p&&(l[n.name]=p)}q=l}else q=null;else q=null;q=a=q}q&&(b=r(f,{params:d.extend({},c.search(),a),pathParams:a}),b.$$route=f)});return b||g[null]&&r(g[null],{params:{},pathParams:{}})}function t(a,b){var c=[];d.forEach((a||"").split(":"),function(a,d){if(0===d)c.push(a);else{var f=a.match(/(\w+)(?:[?*])?(.*)/),
|
36
|
+
g=f[1];c.push(b[g]);c.push(f[2]||"");delete b[g]}});return c.join("")}var w=!1,n,v,s={routes:g,reload:function(){w=!0;a.$evalAsync(function(){l();m()})},updateParams:function(a){if(this.current&&this.current.$$route){var b={},f=this;d.forEach(Object.keys(a),function(c){f.current.pathParams[c]||(b[c]=a[c])});a=d.extend({},this.current.params,a);c.path(t(this.current.$$route.originalPath,a));c.search(d.extend({},c.search(),b))}else throw B("norout");}};a.$on("$locationChangeStart",l);a.$on("$locationChangeSuccess",
|
37
|
+
m);return s}]});var B=d.$$minErr("ngRoute");p.provider("$routeParams",function(){this.$get=function(){return{}}});p.directive("ngView",v);p.directive("ngView",A);v.$inject=["$route","$anchorScroll","$animate"];A.$inject=["$compile","$controller","$route"]})(window,window.angular);
|
38
|
+
//# sourceMappingURL=angular-route.min.js.map
|
@@ -0,0 +1,703 @@
|
|
1
|
+
/**
|
2
|
+
The MIT License
|
3
|
+
|
4
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
*/
|
24
|
+
/**
|
25
|
+
* @license AngularJS v1.3.8
|
26
|
+
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
27
|
+
* License: MIT
|
28
|
+
*/
|
29
|
+
(function(window, angular, undefined) {'use strict';
|
30
|
+
|
31
|
+
var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @ngdoc module
|
35
|
+
* @name ngSanitize
|
36
|
+
* @description
|
37
|
+
*
|
38
|
+
* # ngSanitize
|
39
|
+
*
|
40
|
+
* The `ngSanitize` module provides functionality to sanitize HTML.
|
41
|
+
*
|
42
|
+
*
|
43
|
+
* <div doc-module-components="ngSanitize"></div>
|
44
|
+
*
|
45
|
+
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
|
46
|
+
*/
|
47
|
+
|
48
|
+
/*
|
49
|
+
* HTML Parser By Misko Hevery (misko@hevery.com)
|
50
|
+
* based on: HTML Parser By John Resig (ejohn.org)
|
51
|
+
* Original code by Erik Arvidsson, Mozilla Public License
|
52
|
+
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
53
|
+
*
|
54
|
+
* // Use like so:
|
55
|
+
* htmlParser(htmlString, {
|
56
|
+
* start: function(tag, attrs, unary) {},
|
57
|
+
* end: function(tag) {},
|
58
|
+
* chars: function(text) {},
|
59
|
+
* comment: function(text) {}
|
60
|
+
* });
|
61
|
+
*
|
62
|
+
*/
|
63
|
+
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @ngdoc service
|
67
|
+
* @name $sanitize
|
68
|
+
* @kind function
|
69
|
+
*
|
70
|
+
* @description
|
71
|
+
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
|
72
|
+
* then serialized back to properly escaped html string. This means that no unsafe input can make
|
73
|
+
* it into the returned string, however, since our parser is more strict than a typical browser
|
74
|
+
* parser, it's possible that some obscure input, which would be recognized as valid HTML by a
|
75
|
+
* browser, won't make it through the sanitizer. The input may also contain SVG markup.
|
76
|
+
* The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
|
77
|
+
* `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
|
78
|
+
*
|
79
|
+
* @param {string} html HTML input.
|
80
|
+
* @returns {string} Sanitized HTML.
|
81
|
+
*
|
82
|
+
* @example
|
83
|
+
<example module="sanitizeExample" deps="angular-sanitize.js">
|
84
|
+
<file name="index.html">
|
85
|
+
<script>
|
86
|
+
angular.module('sanitizeExample', ['ngSanitize'])
|
87
|
+
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
88
|
+
$scope.snippet =
|
89
|
+
'<p style="color:blue">an html\n' +
|
90
|
+
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
91
|
+
'snippet</p>';
|
92
|
+
$scope.deliberatelyTrustDangerousSnippet = function() {
|
93
|
+
return $sce.trustAsHtml($scope.snippet);
|
94
|
+
};
|
95
|
+
}]);
|
96
|
+
</script>
|
97
|
+
<div ng-controller="ExampleController">
|
98
|
+
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
99
|
+
<table>
|
100
|
+
<tr>
|
101
|
+
<td>Directive</td>
|
102
|
+
<td>How</td>
|
103
|
+
<td>Source</td>
|
104
|
+
<td>Rendered</td>
|
105
|
+
</tr>
|
106
|
+
<tr id="bind-html-with-sanitize">
|
107
|
+
<td>ng-bind-html</td>
|
108
|
+
<td>Automatically uses $sanitize</td>
|
109
|
+
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
|
110
|
+
<td><div ng-bind-html="snippet"></div></td>
|
111
|
+
</tr>
|
112
|
+
<tr id="bind-html-with-trust">
|
113
|
+
<td>ng-bind-html</td>
|
114
|
+
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
|
115
|
+
<td>
|
116
|
+
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
|
117
|
+
</div></pre>
|
118
|
+
</td>
|
119
|
+
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
|
120
|
+
</tr>
|
121
|
+
<tr id="bind-default">
|
122
|
+
<td>ng-bind</td>
|
123
|
+
<td>Automatically escapes</td>
|
124
|
+
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
|
125
|
+
<td><div ng-bind="snippet"></div></td>
|
126
|
+
</tr>
|
127
|
+
</table>
|
128
|
+
</div>
|
129
|
+
</file>
|
130
|
+
<file name="protractor.js" type="protractor">
|
131
|
+
it('should sanitize the html snippet by default', function() {
|
132
|
+
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
|
133
|
+
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
|
134
|
+
});
|
135
|
+
|
136
|
+
it('should inline raw snippet if bound to a trusted value', function() {
|
137
|
+
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
|
138
|
+
toBe("<p style=\"color:blue\">an html\n" +
|
139
|
+
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
140
|
+
"snippet</p>");
|
141
|
+
});
|
142
|
+
|
143
|
+
it('should escape snippet without any filter', function() {
|
144
|
+
expect(element(by.css('#bind-default div')).getInnerHtml()).
|
145
|
+
toBe("<p style=\"color:blue\">an html\n" +
|
146
|
+
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
147
|
+
"snippet</p>");
|
148
|
+
});
|
149
|
+
|
150
|
+
it('should update', function() {
|
151
|
+
element(by.model('snippet')).clear();
|
152
|
+
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
|
153
|
+
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
|
154
|
+
toBe('new <b>text</b>');
|
155
|
+
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
|
156
|
+
'new <b onclick="alert(1)">text</b>');
|
157
|
+
expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
|
158
|
+
"new <b onclick=\"alert(1)\">text</b>");
|
159
|
+
});
|
160
|
+
</file>
|
161
|
+
</example>
|
162
|
+
*/
|
163
|
+
function $SanitizeProvider() {
|
164
|
+
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
|
165
|
+
return function(html) {
|
166
|
+
var buf = [];
|
167
|
+
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
|
168
|
+
return !/^unsafe/.test($$sanitizeUri(uri, isImage));
|
169
|
+
}));
|
170
|
+
return buf.join('');
|
171
|
+
};
|
172
|
+
}];
|
173
|
+
}
|
174
|
+
|
175
|
+
function sanitizeText(chars) {
|
176
|
+
var buf = [];
|
177
|
+
var writer = htmlSanitizeWriter(buf, angular.noop);
|
178
|
+
writer.chars(chars);
|
179
|
+
return buf.join('');
|
180
|
+
}
|
181
|
+
|
182
|
+
|
183
|
+
// Regular Expressions for parsing tags and attributes
|
184
|
+
var START_TAG_REGEXP =
|
185
|
+
/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,
|
186
|
+
END_TAG_REGEXP = /^<\/\s*([\w:-]+)[^>]*>/,
|
187
|
+
ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,
|
188
|
+
BEGIN_TAG_REGEXP = /^</,
|
189
|
+
BEGING_END_TAGE_REGEXP = /^<\//,
|
190
|
+
COMMENT_REGEXP = /<!--(.*?)-->/g,
|
191
|
+
DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,
|
192
|
+
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
|
193
|
+
SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
194
|
+
// Match everything outside of normal chars and " (quote character)
|
195
|
+
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
|
196
|
+
|
197
|
+
|
198
|
+
// Good source of info about elements and attributes
|
199
|
+
// http://dev.w3.org/html5/spec/Overview.html#semantics
|
200
|
+
// http://simon.html5.org/html-elements
|
201
|
+
|
202
|
+
// Safe Void Elements - HTML5
|
203
|
+
// http://dev.w3.org/html5/spec/Overview.html#void-elements
|
204
|
+
var voidElements = makeMap("area,br,col,hr,img,wbr");
|
205
|
+
|
206
|
+
// Elements that you can, intentionally, leave open (and which close themselves)
|
207
|
+
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
|
208
|
+
var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
|
209
|
+
optionalEndTagInlineElements = makeMap("rp,rt"),
|
210
|
+
optionalEndTagElements = angular.extend({},
|
211
|
+
optionalEndTagInlineElements,
|
212
|
+
optionalEndTagBlockElements);
|
213
|
+
|
214
|
+
// Safe Block Elements - HTML5
|
215
|
+
var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," +
|
216
|
+
"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
|
217
|
+
"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul"));
|
218
|
+
|
219
|
+
// Inline Elements - HTML5
|
220
|
+
var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," +
|
221
|
+
"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
|
222
|
+
"samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
|
223
|
+
|
224
|
+
// SVG Elements
|
225
|
+
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
|
226
|
+
var svgElements = makeMap("animate,animateColor,animateMotion,animateTransform,circle,defs," +
|
227
|
+
"desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient," +
|
228
|
+
"line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,set," +
|
229
|
+
"stop,svg,switch,text,title,tspan,use");
|
230
|
+
|
231
|
+
// Special Elements (can contain anything)
|
232
|
+
var specialElements = makeMap("script,style");
|
233
|
+
|
234
|
+
var validElements = angular.extend({},
|
235
|
+
voidElements,
|
236
|
+
blockElements,
|
237
|
+
inlineElements,
|
238
|
+
optionalEndTagElements,
|
239
|
+
svgElements);
|
240
|
+
|
241
|
+
//Attributes that have href and hence need to be sanitized
|
242
|
+
var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap,xlink:href");
|
243
|
+
|
244
|
+
var htmlAttrs = makeMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
|
245
|
+
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
|
246
|
+
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
|
247
|
+
'scope,scrolling,shape,size,span,start,summary,target,title,type,' +
|
248
|
+
'valign,value,vspace,width');
|
249
|
+
|
250
|
+
// SVG attributes (without "id" and "name" attributes)
|
251
|
+
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
|
252
|
+
var svgAttrs = makeMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
|
253
|
+
'attributeName,attributeType,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,' +
|
254
|
+
'color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,' +
|
255
|
+
'font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,' +
|
256
|
+
'gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,' +
|
257
|
+
'keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,' +
|
258
|
+
'markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,' +
|
259
|
+
'overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,' +
|
260
|
+
'repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,' +
|
261
|
+
'stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,' +
|
262
|
+
'stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,' +
|
263
|
+
'stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,' +
|
264
|
+
'underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,' +
|
265
|
+
'viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,' +
|
266
|
+
'xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,' +
|
267
|
+
'zoomAndPan');
|
268
|
+
|
269
|
+
var validAttrs = angular.extend({},
|
270
|
+
uriAttrs,
|
271
|
+
svgAttrs,
|
272
|
+
htmlAttrs);
|
273
|
+
|
274
|
+
function makeMap(str) {
|
275
|
+
var obj = {}, items = str.split(','), i;
|
276
|
+
for (i = 0; i < items.length; i++) obj[items[i]] = true;
|
277
|
+
return obj;
|
278
|
+
}
|
279
|
+
|
280
|
+
|
281
|
+
/**
|
282
|
+
* @example
|
283
|
+
* htmlParser(htmlString, {
|
284
|
+
* start: function(tag, attrs, unary) {},
|
285
|
+
* end: function(tag) {},
|
286
|
+
* chars: function(text) {},
|
287
|
+
* comment: function(text) {}
|
288
|
+
* });
|
289
|
+
*
|
290
|
+
* @param {string} html string
|
291
|
+
* @param {object} handler
|
292
|
+
*/
|
293
|
+
function htmlParser(html, handler) {
|
294
|
+
if (typeof html !== 'string') {
|
295
|
+
if (html === null || typeof html === 'undefined') {
|
296
|
+
html = '';
|
297
|
+
} else {
|
298
|
+
html = '' + html;
|
299
|
+
}
|
300
|
+
}
|
301
|
+
var index, chars, match, stack = [], last = html, text;
|
302
|
+
stack.last = function() { return stack[ stack.length - 1 ]; };
|
303
|
+
|
304
|
+
while (html) {
|
305
|
+
text = '';
|
306
|
+
chars = true;
|
307
|
+
|
308
|
+
// Make sure we're not in a script or style element
|
309
|
+
if (!stack.last() || !specialElements[ stack.last() ]) {
|
310
|
+
|
311
|
+
// Comment
|
312
|
+
if (html.indexOf("<!--") === 0) {
|
313
|
+
// comments containing -- are not allowed unless they terminate the comment
|
314
|
+
index = html.indexOf("--", 4);
|
315
|
+
|
316
|
+
if (index >= 0 && html.lastIndexOf("-->", index) === index) {
|
317
|
+
if (handler.comment) handler.comment(html.substring(4, index));
|
318
|
+
html = html.substring(index + 3);
|
319
|
+
chars = false;
|
320
|
+
}
|
321
|
+
// DOCTYPE
|
322
|
+
} else if (DOCTYPE_REGEXP.test(html)) {
|
323
|
+
match = html.match(DOCTYPE_REGEXP);
|
324
|
+
|
325
|
+
if (match) {
|
326
|
+
html = html.replace(match[0], '');
|
327
|
+
chars = false;
|
328
|
+
}
|
329
|
+
// end tag
|
330
|
+
} else if (BEGING_END_TAGE_REGEXP.test(html)) {
|
331
|
+
match = html.match(END_TAG_REGEXP);
|
332
|
+
|
333
|
+
if (match) {
|
334
|
+
html = html.substring(match[0].length);
|
335
|
+
match[0].replace(END_TAG_REGEXP, parseEndTag);
|
336
|
+
chars = false;
|
337
|
+
}
|
338
|
+
|
339
|
+
// start tag
|
340
|
+
} else if (BEGIN_TAG_REGEXP.test(html)) {
|
341
|
+
match = html.match(START_TAG_REGEXP);
|
342
|
+
|
343
|
+
if (match) {
|
344
|
+
// We only have a valid start-tag if there is a '>'.
|
345
|
+
if (match[4]) {
|
346
|
+
html = html.substring(match[0].length);
|
347
|
+
match[0].replace(START_TAG_REGEXP, parseStartTag);
|
348
|
+
}
|
349
|
+
chars = false;
|
350
|
+
} else {
|
351
|
+
// no ending tag found --- this piece should be encoded as an entity.
|
352
|
+
text += '<';
|
353
|
+
html = html.substring(1);
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
if (chars) {
|
358
|
+
index = html.indexOf("<");
|
359
|
+
|
360
|
+
text += index < 0 ? html : html.substring(0, index);
|
361
|
+
html = index < 0 ? "" : html.substring(index);
|
362
|
+
|
363
|
+
if (handler.chars) handler.chars(decodeEntities(text));
|
364
|
+
}
|
365
|
+
|
366
|
+
} else {
|
367
|
+
html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
|
368
|
+
function(all, text) {
|
369
|
+
text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
|
370
|
+
|
371
|
+
if (handler.chars) handler.chars(decodeEntities(text));
|
372
|
+
|
373
|
+
return "";
|
374
|
+
});
|
375
|
+
|
376
|
+
parseEndTag("", stack.last());
|
377
|
+
}
|
378
|
+
|
379
|
+
if (html == last) {
|
380
|
+
throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " +
|
381
|
+
"of html: {0}", html);
|
382
|
+
}
|
383
|
+
last = html;
|
384
|
+
}
|
385
|
+
|
386
|
+
// Clean up any remaining tags
|
387
|
+
parseEndTag();
|
388
|
+
|
389
|
+
function parseStartTag(tag, tagName, rest, unary) {
|
390
|
+
tagName = angular.lowercase(tagName);
|
391
|
+
if (blockElements[ tagName ]) {
|
392
|
+
while (stack.last() && inlineElements[ stack.last() ]) {
|
393
|
+
parseEndTag("", stack.last());
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
if (optionalEndTagElements[ tagName ] && stack.last() == tagName) {
|
398
|
+
parseEndTag("", tagName);
|
399
|
+
}
|
400
|
+
|
401
|
+
unary = voidElements[ tagName ] || !!unary;
|
402
|
+
|
403
|
+
if (!unary)
|
404
|
+
stack.push(tagName);
|
405
|
+
|
406
|
+
var attrs = {};
|
407
|
+
|
408
|
+
rest.replace(ATTR_REGEXP,
|
409
|
+
function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {
|
410
|
+
var value = doubleQuotedValue
|
411
|
+
|| singleQuotedValue
|
412
|
+
|| unquotedValue
|
413
|
+
|| '';
|
414
|
+
|
415
|
+
attrs[name] = decodeEntities(value);
|
416
|
+
});
|
417
|
+
if (handler.start) handler.start(tagName, attrs, unary);
|
418
|
+
}
|
419
|
+
|
420
|
+
function parseEndTag(tag, tagName) {
|
421
|
+
var pos = 0, i;
|
422
|
+
tagName = angular.lowercase(tagName);
|
423
|
+
if (tagName)
|
424
|
+
// Find the closest opened tag of the same type
|
425
|
+
for (pos = stack.length - 1; pos >= 0; pos--)
|
426
|
+
if (stack[ pos ] == tagName)
|
427
|
+
break;
|
428
|
+
|
429
|
+
if (pos >= 0) {
|
430
|
+
// Close all the open elements, up the stack
|
431
|
+
for (i = stack.length - 1; i >= pos; i--)
|
432
|
+
if (handler.end) handler.end(stack[ i ]);
|
433
|
+
|
434
|
+
// Remove the open elements from the stack
|
435
|
+
stack.length = pos;
|
436
|
+
}
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
var hiddenPre=document.createElement("pre");
|
441
|
+
var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
|
442
|
+
/**
|
443
|
+
* decodes all entities into regular string
|
444
|
+
* @param value
|
445
|
+
* @returns {string} A string with decoded entities.
|
446
|
+
*/
|
447
|
+
function decodeEntities(value) {
|
448
|
+
if (!value) { return ''; }
|
449
|
+
|
450
|
+
// Note: IE8 does not preserve spaces at the start/end of innerHTML
|
451
|
+
// so we must capture them and reattach them afterward
|
452
|
+
var parts = spaceRe.exec(value);
|
453
|
+
var spaceBefore = parts[1];
|
454
|
+
var spaceAfter = parts[3];
|
455
|
+
var content = parts[2];
|
456
|
+
if (content) {
|
457
|
+
hiddenPre.innerHTML=content.replace(/</g,"<");
|
458
|
+
// innerText depends on styling as it doesn't display hidden elements.
|
459
|
+
// Therefore, it's better to use textContent not to cause unnecessary
|
460
|
+
// reflows. However, IE<9 don't support textContent so the innerText
|
461
|
+
// fallback is necessary.
|
462
|
+
content = 'textContent' in hiddenPre ?
|
463
|
+
hiddenPre.textContent : hiddenPre.innerText;
|
464
|
+
}
|
465
|
+
return spaceBefore + content + spaceAfter;
|
466
|
+
}
|
467
|
+
|
468
|
+
/**
|
469
|
+
* Escapes all potentially dangerous characters, so that the
|
470
|
+
* resulting string can be safely inserted into attribute or
|
471
|
+
* element text.
|
472
|
+
* @param value
|
473
|
+
* @returns {string} escaped text
|
474
|
+
*/
|
475
|
+
function encodeEntities(value) {
|
476
|
+
return value.
|
477
|
+
replace(/&/g, '&').
|
478
|
+
replace(SURROGATE_PAIR_REGEXP, function(value) {
|
479
|
+
var hi = value.charCodeAt(0);
|
480
|
+
var low = value.charCodeAt(1);
|
481
|
+
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
482
|
+
}).
|
483
|
+
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
|
484
|
+
return '&#' + value.charCodeAt(0) + ';';
|
485
|
+
}).
|
486
|
+
replace(/</g, '<').
|
487
|
+
replace(/>/g, '>');
|
488
|
+
}
|
489
|
+
|
490
|
+
/**
|
491
|
+
* create an HTML/XML writer which writes to buffer
|
492
|
+
* @param {Array} buf use buf.jain('') to get out sanitized html string
|
493
|
+
* @returns {object} in the form of {
|
494
|
+
* start: function(tag, attrs, unary) {},
|
495
|
+
* end: function(tag) {},
|
496
|
+
* chars: function(text) {},
|
497
|
+
* comment: function(text) {}
|
498
|
+
* }
|
499
|
+
*/
|
500
|
+
function htmlSanitizeWriter(buf, uriValidator) {
|
501
|
+
var ignore = false;
|
502
|
+
var out = angular.bind(buf, buf.push);
|
503
|
+
return {
|
504
|
+
start: function(tag, attrs, unary) {
|
505
|
+
tag = angular.lowercase(tag);
|
506
|
+
if (!ignore && specialElements[tag]) {
|
507
|
+
ignore = tag;
|
508
|
+
}
|
509
|
+
if (!ignore && validElements[tag] === true) {
|
510
|
+
out('<');
|
511
|
+
out(tag);
|
512
|
+
angular.forEach(attrs, function(value, key) {
|
513
|
+
var lkey=angular.lowercase(key);
|
514
|
+
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
|
515
|
+
if (validAttrs[lkey] === true &&
|
516
|
+
(uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
|
517
|
+
out(' ');
|
518
|
+
out(key);
|
519
|
+
out('="');
|
520
|
+
out(encodeEntities(value));
|
521
|
+
out('"');
|
522
|
+
}
|
523
|
+
});
|
524
|
+
out(unary ? '/>' : '>');
|
525
|
+
}
|
526
|
+
},
|
527
|
+
end: function(tag) {
|
528
|
+
tag = angular.lowercase(tag);
|
529
|
+
if (!ignore && validElements[tag] === true) {
|
530
|
+
out('</');
|
531
|
+
out(tag);
|
532
|
+
out('>');
|
533
|
+
}
|
534
|
+
if (tag == ignore) {
|
535
|
+
ignore = false;
|
536
|
+
}
|
537
|
+
},
|
538
|
+
chars: function(chars) {
|
539
|
+
if (!ignore) {
|
540
|
+
out(encodeEntities(chars));
|
541
|
+
}
|
542
|
+
}
|
543
|
+
};
|
544
|
+
}
|
545
|
+
|
546
|
+
|
547
|
+
// define ngSanitize module and register $sanitize service
|
548
|
+
angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
|
549
|
+
|
550
|
+
/* global sanitizeText: false */
|
551
|
+
|
552
|
+
/**
|
553
|
+
* @ngdoc filter
|
554
|
+
* @name linky
|
555
|
+
* @kind function
|
556
|
+
*
|
557
|
+
* @description
|
558
|
+
* Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
|
559
|
+
* plain email address links.
|
560
|
+
*
|
561
|
+
* Requires the {@link ngSanitize `ngSanitize`} module to be installed.
|
562
|
+
*
|
563
|
+
* @param {string} text Input text.
|
564
|
+
* @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.
|
565
|
+
* @returns {string} Html-linkified text.
|
566
|
+
*
|
567
|
+
* @usage
|
568
|
+
<span ng-bind-html="linky_expression | linky"></span>
|
569
|
+
*
|
570
|
+
* @example
|
571
|
+
<example module="linkyExample" deps="angular-sanitize.js">
|
572
|
+
<file name="index.html">
|
573
|
+
<script>
|
574
|
+
angular.module('linkyExample', ['ngSanitize'])
|
575
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
576
|
+
$scope.snippet =
|
577
|
+
'Pretty text with some links:\n'+
|
578
|
+
'http://angularjs.org/,\n'+
|
579
|
+
'mailto:us@somewhere.org,\n'+
|
580
|
+
'another@somewhere.org,\n'+
|
581
|
+
'and one more: ftp://127.0.0.1/.';
|
582
|
+
$scope.snippetWithTarget = 'http://angularjs.org/';
|
583
|
+
}]);
|
584
|
+
</script>
|
585
|
+
<div ng-controller="ExampleController">
|
586
|
+
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
587
|
+
<table>
|
588
|
+
<tr>
|
589
|
+
<td>Filter</td>
|
590
|
+
<td>Source</td>
|
591
|
+
<td>Rendered</td>
|
592
|
+
</tr>
|
593
|
+
<tr id="linky-filter">
|
594
|
+
<td>linky filter</td>
|
595
|
+
<td>
|
596
|
+
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
|
597
|
+
</td>
|
598
|
+
<td>
|
599
|
+
<div ng-bind-html="snippet | linky"></div>
|
600
|
+
</td>
|
601
|
+
</tr>
|
602
|
+
<tr id="linky-target">
|
603
|
+
<td>linky target</td>
|
604
|
+
<td>
|
605
|
+
<pre><div ng-bind-html="snippetWithTarget | linky:'_blank'"><br></div></pre>
|
606
|
+
</td>
|
607
|
+
<td>
|
608
|
+
<div ng-bind-html="snippetWithTarget | linky:'_blank'"></div>
|
609
|
+
</td>
|
610
|
+
</tr>
|
611
|
+
<tr id="escaped-html">
|
612
|
+
<td>no filter</td>
|
613
|
+
<td><pre><div ng-bind="snippet"><br></div></pre></td>
|
614
|
+
<td><div ng-bind="snippet"></div></td>
|
615
|
+
</tr>
|
616
|
+
</table>
|
617
|
+
</file>
|
618
|
+
<file name="protractor.js" type="protractor">
|
619
|
+
it('should linkify the snippet with urls', function() {
|
620
|
+
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
621
|
+
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
|
622
|
+
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
623
|
+
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
|
624
|
+
});
|
625
|
+
|
626
|
+
it('should not linkify snippet without the linky filter', function() {
|
627
|
+
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
|
628
|
+
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
|
629
|
+
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
630
|
+
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
|
631
|
+
});
|
632
|
+
|
633
|
+
it('should update', function() {
|
634
|
+
element(by.model('snippet')).clear();
|
635
|
+
element(by.model('snippet')).sendKeys('new http://link.');
|
636
|
+
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
637
|
+
toBe('new http://link.');
|
638
|
+
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
|
639
|
+
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
|
640
|
+
.toBe('new http://link.');
|
641
|
+
});
|
642
|
+
|
643
|
+
it('should work with the target property', function() {
|
644
|
+
expect(element(by.id('linky-target')).
|
645
|
+
element(by.binding("snippetWithTarget | linky:'_blank'")).getText()).
|
646
|
+
toBe('http://angularjs.org/');
|
647
|
+
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
|
648
|
+
});
|
649
|
+
</file>
|
650
|
+
</example>
|
651
|
+
*/
|
652
|
+
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
653
|
+
var LINKY_URL_REGEXP =
|
654
|
+
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/,
|
655
|
+
MAILTO_REGEXP = /^mailto:/;
|
656
|
+
|
657
|
+
return function(text, target) {
|
658
|
+
if (!text) return text;
|
659
|
+
var match;
|
660
|
+
var raw = text;
|
661
|
+
var html = [];
|
662
|
+
var url;
|
663
|
+
var i;
|
664
|
+
while ((match = raw.match(LINKY_URL_REGEXP))) {
|
665
|
+
// We can not end in these as they are sometimes found at the end of the sentence
|
666
|
+
url = match[0];
|
667
|
+
// if we did not match ftp/http/www/mailto then assume mailto
|
668
|
+
if (!match[2] && !match[4]) {
|
669
|
+
url = (match[3] ? 'http://' : 'mailto:') + url;
|
670
|
+
}
|
671
|
+
i = match.index;
|
672
|
+
addText(raw.substr(0, i));
|
673
|
+
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
|
674
|
+
raw = raw.substring(i + match[0].length);
|
675
|
+
}
|
676
|
+
addText(raw);
|
677
|
+
return $sanitize(html.join(''));
|
678
|
+
|
679
|
+
function addText(text) {
|
680
|
+
if (!text) {
|
681
|
+
return;
|
682
|
+
}
|
683
|
+
html.push(sanitizeText(text));
|
684
|
+
}
|
685
|
+
|
686
|
+
function addLink(url, text) {
|
687
|
+
html.push('<a ');
|
688
|
+
if (angular.isDefined(target)) {
|
689
|
+
html.push('target="',
|
690
|
+
target,
|
691
|
+
'" ');
|
692
|
+
}
|
693
|
+
html.push('href="',
|
694
|
+
url.replace(/"/g, '"'),
|
695
|
+
'">');
|
696
|
+
addText(text);
|
697
|
+
html.push('</a>');
|
698
|
+
}
|
699
|
+
};
|
700
|
+
}]);
|
701
|
+
|
702
|
+
|
703
|
+
})(window, window.angular);
|