@@ 120-152 (lines=33) @@ | ||
117 | } |
|
118 | return txt; |
|
119 | }, |
|
120 | unescapeJS: function(){ |
|
121 | var txt = this; |
|
122 | ||
123 | /// C escape sequences \ ' " ? a b f n r t v |
|
124 | /// JS escape sequences \ ' " b f n r t |
|
125 | ||
126 | // process string |
|
127 | if (txt.indexOf("\\\\") > -1) { |
|
128 | txt = txt.split("\\\\").join("\\"); |
|
129 | } |
|
130 | if (txt.indexOf("\\'") > -1) { |
|
131 | txt = txt.split("\\'").join("\'"); |
|
132 | } |
|
133 | if (txt.indexOf('\\"') > -1) { |
|
134 | txt = txt.split('\\"').join("\""); |
|
135 | } |
|
136 | if (txt.indexOf("\\b") > -1) { |
|
137 | txt = txt.split("\\b").join("\b"); |
|
138 | } |
|
139 | if (txt.indexOf("\\f") > -1) { |
|
140 | txt = txt.split("\\f").join("\f"); |
|
141 | } |
|
142 | if (txt.indexOf("\\n") > -1) { |
|
143 | txt = txt.split("\\n").join("\n"); |
|
144 | } |
|
145 | if (txt.indexOf("\\r") > -1) { |
|
146 | txt = txt.split("\\r").join("\r"); |
|
147 | } |
|
148 | if (txt.indexOf("\\t") > -1) { |
|
149 | txt = txt.split("\\t").join("\t"); |
|
150 | } |
|
151 | return txt; |
|
152 | }, |
|
153 | escapeJSSimple: function(){ |
|
154 | var input = this; |
|
155 | input = input.split("\\").join("\\\\"); |
|
@@ 87-119 (lines=33) @@ | ||
84 | // do not use unescape() -- OUTDATED |
|
85 | return isFullURL ? decodeURI(txt.trim()) : decodeURIComponent(txt.trim()); |
|
86 | }, |
|
87 | escapeJS: function(singleQuotes = true, doubleQuotes = true){ |
|
88 | var txt = this; |
|
89 | ||
90 | /// C escape sequences \ ' " ? a b f n r t v |
|
91 | /// JS escape sequences \ ' " b f n r t |
|
92 | ||
93 | // process string |
|
94 | if (txt.indexOf("\\") > -1) { |
|
95 | txt = txt.split("\\").join("\\\\"); |
|
96 | } |
|
97 | if (singleQuotes && txt.indexOf("\'") > -1) { |
|
98 | txt = txt.split("\'").join("\\'"); |
|
99 | } |
|
100 | if (doubleQuotes && txt.indexOf('\"') > -1) { |
|
101 | txt = txt.split("\"").join('\\"'); |
|
102 | } |
|
103 | if (txt.indexOf("\b") > -1) { |
|
104 | txt = txt.split("\b").join("\\b"); |
|
105 | } |
|
106 | if (txt.indexOf("\f") > -1) { |
|
107 | txt = txt.split("\f").join("\\f"); |
|
108 | } |
|
109 | if (txt.indexOf("\n") > -1) { |
|
110 | txt = txt.split("\n").join("\\n"); |
|
111 | } |
|
112 | if (txt.indexOf("\r") > -1) { |
|
113 | txt = txt.split("\r").join("\\r"); |
|
114 | } |
|
115 | if (txt.indexOf("\t") > -1) { |
|
116 | txt = txt.split("\t").join("\\t"); |
|
117 | } |
|
118 | return txt; |
|
119 | }, |
|
120 | unescapeJS: function(){ |
|
121 | var txt = this; |
|
122 |