@@ -1220,10 +1220,12 @@ $(document).ready(function() {
12201220 // Remove existing annotation
12211221 $ ( '#tokensregex' ) . remove ( ) ;
12221222 // Make ajax call
1223+ // Previously this would escape the + and & in pattern before the
1224+ // call to encodeURIComponent, but the server doesn't double
1225+ // unescape the incoming patterns, so that was not working
12231226 $ . ajax ( {
12241227 type : 'POST' ,
1225- url : serverAddress + '/tokensregex?pattern=' + encodeURIComponent (
1226- pattern . replace ( "&" , "\\&" ) . replace ( '+' , '\\+' ) ) +
1228+ url : serverAddress + '/tokensregex?pattern=' + encodeURIComponent ( pattern ) +
12271229 '&properties=' + encodeURIComponent (
12281230 '{"annotators": "' + annotators ( ) + '", "date": "' + date ( ) + '"}' ) +
12291231 '&pipelineLanguage=' + encodeURIComponent ( $ ( '#language' ) . val ( ) ) ,
@@ -1263,8 +1265,7 @@ $(document).ready(function() {
12631265 // Make ajax call
12641266 $ . ajax ( {
12651267 type : 'POST' ,
1266- url : serverAddress + '/semgrex?pattern=' + encodeURIComponent (
1267- pattern . replace ( "&" , "\\&" ) . replace ( '+' , '\\+' ) ) +
1268+ url : serverAddress + '/semgrex?pattern=' + encodeURIComponent ( pattern ) +
12681269 '&properties=' + encodeURIComponent (
12691270 '{"annotators": "' + requiredAnnotators . join ( ',' ) + '", "date": "' + date ( ) + '"}' ) +
12701271 '&pipelineLanguage=' + encodeURIComponent ( $ ( '#language' ) . val ( ) ) ,
@@ -1303,8 +1304,7 @@ $(document).ready(function() {
13031304 // Make ajax call
13041305 $ . ajax ( {
13051306 type : 'POST' ,
1306- url : serverAddress + '/tregex?pattern=' + encodeURIComponent (
1307- pattern . replace ( "&" , "\\&" ) . replace ( '+' , '\\+' ) ) +
1307+ url : serverAddress + '/tregex?pattern=' + encodeURIComponent ( pattern ) +
13081308 '&properties=' + encodeURIComponent (
13091309 '{"annotators": "' + requiredAnnotators . join ( ',' ) + '", "date": "' + date ( ) + '"}' ) +
13101310 '&pipelineLanguage=' + encodeURIComponent ( $ ( '#language' ) . val ( ) ) ,
0 commit comments