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.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sunspot-solr +2 -6
  3. data/lib/sunspot/solr/server.rb +2 -3
  4. data/solr/README.txt +181 -181
  5. data/solr/bin/post +29 -19
  6. data/solr/bin/solr +247 -428
  7. data/solr/bin/solr.cmd +102 -256
  8. data/solr/bin/solr.in.cmd +15 -7
  9. data/solr/bin/solr.in.sh +26 -12
  10. data/solr/server/README.txt +110 -113
  11. data/solr/server/contexts/solr-jetty-context.xml +8 -8
  12. data/solr/server/etc/jetty-http.xml +47 -0
  13. data/solr/server/etc/jetty-https-ssl.xml +175 -159
  14. data/solr/server/etc/jetty-https.xml +53 -0
  15. data/solr/server/etc/jetty-ssl.xml +46 -0
  16. data/solr/server/etc/jetty.xml +189 -167
  17. data/solr/server/etc/webdefault.xml +527 -527
  18. data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
  19. data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
  20. data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
  21. data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
  22. data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
  23. data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
  24. data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
  25. data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
  26. data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
  27. data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
  28. data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
  29. data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
  30. data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
  31. data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
  32. data/solr/server/modules/http.mod +9 -0
  33. data/solr/server/modules/https.mod +9 -0
  34. data/solr/server/modules/server.mod +11 -0
  35. data/solr/server/modules/ssl.mod +9 -0
  36. data/solr/server/resources/jetty-logging.properties +1 -0
  37. data/solr/server/resources/log4j.properties +24 -24
  38. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
  39. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
  40. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
  41. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
  42. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
  43. data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
  44. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
  45. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
  46. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
  47. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
  48. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
  49. 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
  50. 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
  51. 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
  52. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
  53. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
  54. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
  55. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
  56. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
  57. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
  58. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
  59. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
  60. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
  61. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
  62. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
  63. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
  64. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
  65. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
  66. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
  67. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
  68. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
  69. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
  70. data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
  71. data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
  72. data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
  73. data/solr/server/solr-webapp/webapp/admin.html +164 -163
  74. data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
  75. data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
  76. data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
  77. data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
  78. data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
  79. data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
  80. data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
  81. data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
  82. data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
  83. data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
  84. data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
  85. data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
  86. data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
  87. data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
  88. data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
  89. data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
  90. data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
  91. data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
  92. data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
  93. data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
  94. data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
  95. data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
  96. data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
  97. data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
  98. data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
  99. data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
  100. data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
  101. data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
  102. data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
  103. data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
  104. data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
  105. data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
  106. data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
  107. data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
  108. data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
  109. data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
  110. data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
  111. data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
  112. data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
  113. data/solr/server/solr-webapp/webapp/index.html +208 -0
  114. data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
  115. data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
  116. data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
  117. data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
  118. data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
  119. data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
  120. data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
  121. data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
  122. data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
  123. data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
  124. data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
  125. data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
  126. data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
  127. data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
  128. data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
  129. data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
  130. data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
  131. data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
  132. data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
  133. data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
  134. data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
  135. data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
  136. data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
  137. data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
  138. data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
  139. data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
  140. data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
  141. data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
  142. data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
  143. data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
  144. data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
  145. data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
  146. data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
  147. data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
  148. data/solr/server/solr-webapp/webapp/js/main.js +60 -58
  149. data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
  150. data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
  151. data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
  152. data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
  153. data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
  154. data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
  155. data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
  156. data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
  157. data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
  158. data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
  159. data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
  160. data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
  161. data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
  162. data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
  163. data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
  164. data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
  165. data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
  166. data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
  167. data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
  168. data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
  169. data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
  170. data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
  171. data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
  172. data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
  173. data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
  174. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
  175. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
  176. data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
  177. data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
  178. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
  179. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
  180. data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
  181. data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
  182. data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
  183. data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
  184. data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
  185. data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
  186. data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
  187. data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
  188. data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
  189. data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
  190. data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
  191. data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
  192. data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
  193. data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
  194. data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
  195. data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
  196. data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
  197. data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
  198. data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
  199. data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
  200. data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
  201. data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
  202. data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
  203. data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
  204. data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
  205. data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
  206. data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
  207. data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
  208. data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
  209. data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
  210. data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
  211. data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
  212. data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
  213. data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
  214. data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
  215. data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
  216. data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
  217. data/solr/server/solr/README.txt +77 -77
  218. data/solr/server/solr/solr.xml +51 -51
  219. data/solr/server/solr/zoo.cfg +17 -17
  220. data/solr/server/start.jar +0 -0
  221. data/spec/server_spec.rb +3 -8
  222. metadata +132 -43
  223. data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
  224. data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
  225. data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
  226. data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
  227. data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
  228. data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
  229. data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
  230. data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
  231. data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
  232. data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
  233. data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
  234. data/solr/server/lib/servlet-api-3.0.jar +0 -0
  235. data/solr/server/solr-webapp/webapp/.gitignore +0 -1
  236. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
  237. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
  238. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
  239. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
  240. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
  241. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
  242. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
  243. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
  244. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
  245. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
  246. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
  247. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
  248. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
  249. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
  250. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
  251. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
  252. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
  253. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
  254. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
  255. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
  256. 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>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</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>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
117
+ &lt;/div&gt;</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>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</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("&lt;p style=\"color:blue\"&gt;an html\n" +
146
+ "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
147
+ "snippet&lt;/p&gt;");
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 &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
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,"&lt;");
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, '&amp;').
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, '&lt;').
487
+ replace(/>/g, '&gt;');
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>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</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>&lt;div ng-bind-html="snippetWithTarget | linky:'_blank'"&gt;<br>&lt;/div&gt;</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>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</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, '&quot;'),
695
+ '">');
696
+ addText(text);
697
+ html.push('</a>');
698
+ }
699
+ };
700
+ }]);
701
+
702
+
703
+ })(window, window.angular);