libre-jqgrid 4.17.2 → 4.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/.tscache/all/hashes/free-jqgrid.d.ts-74303c8b076937117540c0cb798f2053 +1 -0
  2. package/.tscache/all/hashes/test.ts-0d81877a31bc5d7ac52dd35a66602f01 +1 -0
  3. package/.tscache/all/timestamp +0 -0
  4. package/dist/css/ui.jqgrid.css +1618 -0
  5. package/dist/css/ui.jqgrid.min.css +4 -0
  6. package/dist/css/ui.jqgrid.min.css.map +1 -0
  7. package/dist/i18n/grid.locale-ar.js +198 -0
  8. package/dist/i18n/grid.locale-bg.js +201 -0
  9. package/dist/i18n/grid.locale-bs.js +230 -0
  10. package/dist/i18n/grid.locale-ca.js +204 -0
  11. package/dist/i18n/grid.locale-cn.js +237 -0
  12. package/dist/i18n/grid.locale-cs.js +197 -0
  13. package/dist/i18n/grid.locale-da.js +196 -0
  14. package/dist/i18n/grid.locale-de.js +240 -0
  15. package/dist/i18n/grid.locale-el.js +195 -0
  16. package/dist/i18n/grid.locale-en.js +256 -0
  17. package/dist/i18n/grid.locale-es.js +202 -0
  18. package/dist/i18n/grid.locale-fa.js +211 -0
  19. package/dist/i18n/grid.locale-fi.js +201 -0
  20. package/dist/i18n/grid.locale-fr.js +197 -0
  21. package/dist/i18n/grid.locale-gl.js +197 -0
  22. package/dist/i18n/grid.locale-he.js +198 -0
  23. package/dist/i18n/grid.locale-hr.js +231 -0
  24. package/dist/i18n/grid.locale-hu.js +196 -0
  25. package/dist/i18n/grid.locale-id.js +238 -0
  26. package/dist/i18n/grid.locale-is.js +197 -0
  27. package/dist/i18n/grid.locale-it.js +189 -0
  28. package/dist/i18n/grid.locale-ja.js +203 -0
  29. package/dist/i18n/grid.locale-kr.js +194 -0
  30. package/dist/i18n/grid.locale-lt.js +199 -0
  31. package/dist/i18n/grid.locale-me.js +198 -0
  32. package/dist/i18n/grid.locale-nl.js +208 -0
  33. package/dist/i18n/grid.locale-no.js +180 -0
  34. package/dist/i18n/grid.locale-pl.js +204 -0
  35. package/dist/i18n/grid.locale-pt-br.js +210 -0
  36. package/dist/i18n/grid.locale-pt.js +196 -0
  37. package/dist/i18n/grid.locale-ro.js +210 -0
  38. package/dist/i18n/grid.locale-ru.js +196 -0
  39. package/dist/i18n/grid.locale-sk.js +198 -0
  40. package/dist/i18n/grid.locale-sl.js +230 -0
  41. package/dist/i18n/grid.locale-sr.js +199 -0
  42. package/dist/i18n/grid.locale-sv.js +198 -0
  43. package/dist/i18n/grid.locale-th.js +195 -0
  44. package/dist/i18n/grid.locale-tr.js +197 -0
  45. package/dist/i18n/grid.locale-tw.js +199 -0
  46. package/dist/i18n/grid.locale-ua.js +199 -0
  47. package/dist/i18n/grid.locale-vi.js +238 -0
  48. package/dist/i18n/min/grid.locale-ar.js +10 -0
  49. package/dist/i18n/min/grid.locale-ar.js.map +1 -0
  50. package/dist/i18n/min/grid.locale-bg.js +10 -0
  51. package/dist/i18n/min/grid.locale-bg.js.map +1 -0
  52. package/dist/i18n/min/grid.locale-ca.js +15 -0
  53. package/dist/i18n/min/grid.locale-ca.js.map +1 -0
  54. package/dist/i18n/min/grid.locale-cn.js +10 -0
  55. package/dist/i18n/min/grid.locale-cn.js.map +1 -0
  56. package/dist/i18n/min/grid.locale-cs.js +11 -0
  57. package/dist/i18n/min/grid.locale-cs.js.map +1 -0
  58. package/dist/i18n/min/grid.locale-da.js +10 -0
  59. package/dist/i18n/min/grid.locale-da.js.map +1 -0
  60. package/dist/i18n/min/grid.locale-de.js +21 -0
  61. package/dist/i18n/min/grid.locale-de.js.map +1 -0
  62. package/dist/i18n/min/grid.locale-el.js +10 -0
  63. package/dist/i18n/min/grid.locale-el.js.map +1 -0
  64. package/dist/i18n/min/grid.locale-en.js +11 -0
  65. package/dist/i18n/min/grid.locale-en.js.map +1 -0
  66. package/dist/i18n/min/grid.locale-es.js +16 -0
  67. package/dist/i18n/min/grid.locale-es.js.map +1 -0
  68. package/dist/i18n/min/grid.locale-fa.js +8 -0
  69. package/dist/i18n/min/grid.locale-fa.js.map +1 -0
  70. package/dist/i18n/min/grid.locale-fi.js +11 -0
  71. package/dist/i18n/min/grid.locale-fi.js.map +1 -0
  72. package/dist/i18n/min/grid.locale-fr.js +10 -0
  73. package/dist/i18n/min/grid.locale-fr.js.map +1 -0
  74. package/dist/i18n/min/grid.locale-gl.js +9 -0
  75. package/dist/i18n/min/grid.locale-gl.js.map +1 -0
  76. package/dist/i18n/min/grid.locale-he.js +10 -0
  77. package/dist/i18n/min/grid.locale-he.js.map +1 -0
  78. package/dist/i18n/min/grid.locale-hr.js +11 -0
  79. package/dist/i18n/min/grid.locale-hr.js.map +1 -0
  80. package/dist/i18n/min/grid.locale-hu.js +10 -0
  81. package/dist/i18n/min/grid.locale-hu.js.map +1 -0
  82. package/dist/i18n/min/grid.locale-id.js +10 -0
  83. package/dist/i18n/min/grid.locale-id.js.map +1 -0
  84. package/dist/i18n/min/grid.locale-is.js +9 -0
  85. package/dist/i18n/min/grid.locale-is.js.map +1 -0
  86. package/dist/i18n/min/grid.locale-it.js +2 -0
  87. package/dist/i18n/min/grid.locale-it.js.map +1 -0
  88. package/dist/i18n/min/grid.locale-ja.js +10 -0
  89. package/dist/i18n/min/grid.locale-ja.js.map +1 -0
  90. package/dist/i18n/min/grid.locale-kr.js +2 -0
  91. package/dist/i18n/min/grid.locale-kr.js.map +1 -0
  92. package/dist/i18n/min/grid.locale-lt.js +10 -0
  93. package/dist/i18n/min/grid.locale-lt.js.map +1 -0
  94. package/dist/i18n/min/grid.locale-me.js +10 -0
  95. package/dist/i18n/min/grid.locale-me.js.map +1 -0
  96. package/dist/i18n/min/grid.locale-nl.js +2 -0
  97. package/dist/i18n/min/grid.locale-nl.js.map +1 -0
  98. package/dist/i18n/min/grid.locale-no.js +2 -0
  99. package/dist/i18n/min/grid.locale-no.js.map +1 -0
  100. package/dist/i18n/min/grid.locale-pl.js +18 -0
  101. package/dist/i18n/min/grid.locale-pl.js.map +1 -0
  102. package/dist/i18n/min/grid.locale-pt-br.js +21 -0
  103. package/dist/i18n/min/grid.locale-pt-br.js.map +1 -0
  104. package/dist/i18n/min/grid.locale-pt.js +9 -0
  105. package/dist/i18n/min/grid.locale-pt.js.map +1 -0
  106. package/dist/i18n/min/grid.locale-ro.js +10 -0
  107. package/dist/i18n/min/grid.locale-ro.js.map +1 -0
  108. package/dist/i18n/min/grid.locale-ru.js +10 -0
  109. package/dist/i18n/min/grid.locale-ru.js.map +1 -0
  110. package/dist/i18n/min/grid.locale-sk.js +10 -0
  111. package/dist/i18n/min/grid.locale-sk.js.map +1 -0
  112. package/dist/i18n/min/grid.locale-sr.js +10 -0
  113. package/dist/i18n/min/grid.locale-sr.js.map +1 -0
  114. package/dist/i18n/min/grid.locale-sv.js +10 -0
  115. package/dist/i18n/min/grid.locale-sv.js.map +1 -0
  116. package/dist/i18n/min/grid.locale-th.js +10 -0
  117. package/dist/i18n/min/grid.locale-th.js.map +1 -0
  118. package/dist/i18n/min/grid.locale-tr.js +10 -0
  119. package/dist/i18n/min/grid.locale-tr.js.map +1 -0
  120. package/dist/i18n/min/grid.locale-tw.js +11 -0
  121. package/dist/i18n/min/grid.locale-tw.js.map +1 -0
  122. package/dist/i18n/min/grid.locale-ua.js +10 -0
  123. package/dist/i18n/min/grid.locale-ua.js.map +1 -0
  124. package/dist/i18n/min/grid.locale-vi.js +10 -0
  125. package/dist/i18n/min/grid.locale-vi.js.map +1 -0
  126. package/dist/jquery.jqgrid.min.js +11 -0
  127. package/dist/jquery.jqgrid.min.js.map +1 -0
  128. package/{js/jquery.jqgrid.src.js.1 → dist/jquery.jqgrid.src.js} +1 -1
  129. package/dist/modules/grid.base.js +8518 -0
  130. package/dist/modules/grid.celledit.js +673 -0
  131. package/dist/modules/grid.common.js +844 -0
  132. package/dist/modules/grid.custom.js +1795 -0
  133. package/dist/modules/grid.filter.js +897 -0
  134. package/dist/modules/grid.formedit.js +2537 -0
  135. package/dist/modules/grid.grouping.js +737 -0
  136. package/dist/modules/grid.import.js +251 -0
  137. package/dist/modules/grid.inlinedit.js +784 -0
  138. package/dist/modules/grid.jqueryui.js +965 -0
  139. package/dist/modules/grid.pivot.js +862 -0
  140. package/dist/modules/grid.subgrid.js +379 -0
  141. package/dist/modules/grid.tbltogrid.js +141 -0
  142. package/dist/modules/grid.treegrid.js +683 -0
  143. package/dist/modules/jqdnr.js +188 -0
  144. package/dist/modules/jqmodal.js +292 -0
  145. package/dist/modules/jquery.fmatter.js +1061 -0
  146. package/dist/modules/jsonxml.js +343 -0
  147. package/dist/modules/min/grid.base.js +11 -0
  148. package/dist/modules/min/grid.base.js.map +1 -0
  149. package/dist/modules/min/grid.celledit.js +2 -0
  150. package/dist/modules/min/grid.celledit.js.map +1 -0
  151. package/dist/modules/min/grid.common.js +2 -0
  152. package/dist/modules/min/grid.common.js.map +1 -0
  153. package/dist/modules/min/grid.custom.js +2 -0
  154. package/dist/modules/min/grid.custom.js.map +1 -0
  155. package/dist/modules/min/grid.filter.js +2 -0
  156. package/dist/modules/min/grid.filter.js.map +1 -0
  157. package/dist/modules/min/grid.formedit.js +2 -0
  158. package/dist/modules/min/grid.formedit.js.map +1 -0
  159. package/dist/modules/min/grid.grouping.js +2 -0
  160. package/dist/modules/min/grid.grouping.js.map +1 -0
  161. package/dist/modules/min/grid.import.js +2 -0
  162. package/dist/modules/min/grid.import.js.map +1 -0
  163. package/dist/modules/min/grid.inlinedit.js +2 -0
  164. package/dist/modules/min/grid.inlinedit.js.map +1 -0
  165. package/dist/modules/min/grid.jqueryui.js +2 -0
  166. package/dist/modules/min/grid.jqueryui.js.map +1 -0
  167. package/dist/modules/min/grid.pivot.js +2 -0
  168. package/dist/modules/min/grid.pivot.js.map +1 -0
  169. package/dist/modules/min/grid.subgrid.js +2 -0
  170. package/dist/modules/min/grid.subgrid.js.map +1 -0
  171. package/dist/modules/min/grid.tbltogrid.js +2 -0
  172. package/dist/modules/min/grid.tbltogrid.js.map +1 -0
  173. package/dist/modules/min/grid.treegrid.js +2 -0
  174. package/dist/modules/min/grid.treegrid.js.map +1 -0
  175. package/dist/modules/min/jqdnr.js +2 -0
  176. package/dist/modules/min/jqdnr.js.map +1 -0
  177. package/dist/modules/min/jqmodal.js +2 -0
  178. package/dist/modules/min/jqmodal.js.map +1 -0
  179. package/dist/modules/min/jquery.fmatter.js +2 -0
  180. package/dist/modules/min/jquery.fmatter.js.map +1 -0
  181. package/dist/modules/min/jsonxml.js +2 -0
  182. package/dist/modules/min/jsonxml.js.map +1 -0
  183. package/dist/plugins/css/ui.multiselect.css +30 -0
  184. package/dist/plugins/css/ui.multiselect.min.css +2 -0
  185. package/dist/plugins/css/ui.multiselect.min.css.map +1 -0
  186. package/dist/plugins/grid.odata.js +1313 -0
  187. package/dist/plugins/jqgrid_download.js +109 -0
  188. package/dist/plugins/jquery.contextmenu-ui.js +304 -0
  189. package/dist/plugins/jquery.contextmenu.js +174 -0
  190. package/dist/plugins/jquery.createcontexmenufromnavigatorbuttons.js +172 -0
  191. package/dist/plugins/jquery.jqgrid.showhidecolumnmenu.js +201 -0
  192. package/dist/plugins/min/grid.odata.js +11 -0
  193. package/dist/plugins/min/grid.odata.js.map +1 -0
  194. package/dist/plugins/min/jquery.contextmenu-ui.js +26 -0
  195. package/dist/plugins/min/jquery.contextmenu-ui.js.map +1 -0
  196. package/dist/plugins/min/jquery.contextmenu.js +19 -0
  197. package/dist/plugins/min/jquery.contextmenu.js.map +1 -0
  198. package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js +12 -0
  199. package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js.map +1 -0
  200. package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js +10 -0
  201. package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js.map +1 -0
  202. package/dist/plugins/min/ui.multiselect.js +30 -0
  203. package/dist/plugins/min/ui.multiselect.js.map +1 -0
  204. package/dist/plugins/ui.multiselect.js +389 -0
  205. package/dist/ts/free-jqgrid.d.ts +2132 -0
  206. package/js/jquery.jqgrid.min.js +1 -1
  207. package/js/jquery.jqgrid.min.js.map +1 -1
  208. package/js/jquery.jqgrid.src.js +8 -3
  209. package/libre-jqgrid-4.17.4.tgz +0 -0
  210. package/package.json +1 -1
  211. package/.github/workflows/npm.yml +0 -47
@@ -0,0 +1,343 @@
1
+ /**
2
+ * The below work is licensed under Creative Commons GNU LGPL License.
3
+ *
4
+ * Original work:
5
+ *
6
+ * License: http://creativecommons.org/licenses/LGPL/2.1/
7
+ * Author: Stefan Goessner/2006
8
+ * Web: http://goessner.net/
9
+ *
10
+ * Modifications made:
11
+ * Version: 0.9-p5
12
+ * Description: Restructured code, JSLint validated (no strict whitespaces),
13
+ * added handling of empty arrays, empty strings, and int/floats values.
14
+ * Author: Michael Schøler/2008-01-29
15
+ * Web: http://michael.hinnerup.net/blog/2008/01/26/converting-json-to-xml-and-xml-to-json/
16
+ *
17
+ * Description: json2xml added support to convert functions as CDATA
18
+ * so it will be easy to write characters that cause some problems when convert
19
+ *
20
+ * Author: Tony Tomov
21
+ **/
22
+
23
+ /*global jQuery, alert, define, exports, module, require */
24
+ /*jslint browser: true, vars: true, regexp: true, white: true */
25
+
26
+ (function (global, factory) {
27
+ "use strict";
28
+ if (typeof define === "function" && define.amd) {
29
+ // AMD. Register as an anonymous module.
30
+ //console.log("jsonxml AMD");
31
+ define([
32
+ "jquery"
33
+ ], function ($) {
34
+ //console.log("jsonxml AMD: define callback");
35
+ return factory($, global);
36
+ });
37
+ } else if (typeof module === "object" && module.exports) {
38
+ // Node/CommonJS
39
+ //console.log("jsonxml CommonJS, typeof define=" + typeof define + ", define=" + define);
40
+ module.exports = function (root, $) {
41
+ //console.log("jsonxml CommonJS: in module.exports");
42
+ if (!root) {
43
+ root = window;
44
+ }
45
+ //console.log("jsonxml CommonJS: before require('jquery')");
46
+ if ($ === undefined) {
47
+ // require("jquery") returns a factory that requires window to
48
+ // build a jQuery instance, we normalize how we use modules
49
+ // that require this pattern but the window provided is a noop
50
+ // if it's defined (how jquery works)
51
+ $ = typeof window !== "undefined" ?
52
+ require("jquery") :
53
+ require("jquery")(root);
54
+ }
55
+ //console.log("jsonxml CommonJS: before factory");
56
+ return factory($, root);
57
+ };
58
+ } else {
59
+ // Browser globals
60
+ //console.log("jsonxml Browser: before factory");
61
+ factory(jQuery, global);
62
+ }
63
+ }(typeof window !== "undefined" ? window : this, function ($, window) {
64
+ "use strict";
65
+ // begin module jsonxml
66
+ var xmlJsonClass = {
67
+ // Param "xml": Element or document DOM node.
68
+ // Param "tab": Tab or indent string for pretty output formatting omit or use empty string "" to supress.
69
+ // Returns: JSON string
70
+ xml2json: function (xml, tab) {
71
+ if (xml.nodeType === 9) {
72
+ // document node
73
+ xml = xml.documentElement;
74
+ }
75
+ var nws = this.removeWhite(xml),
76
+ obj = this.toObj(nws),
77
+ json = this.toJson(obj, xml.nodeName, "\t");
78
+ return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
79
+ },
80
+
81
+ // Param "o": JavaScript object
82
+ // Param "tab": tab or indent string for pretty output formatting omit or use empty string "" to supress.
83
+ // Returns: XML string
84
+ json2xml: function (o, tab) {
85
+ var toXml = function (v, name, ind) {
86
+ var xml = "", i, n, sXml, hasChild, m;
87
+ if (v instanceof Array) {
88
+ if (v.length === 0) {
89
+ xml += ind + "<" + name + ">__EMPTY_ARRAY_</" + name + ">\n";
90
+ } else {
91
+ for (i = 0, n = v.length; i < n; i += 1) {
92
+ sXml = ind + toXml(v[i], name, ind + "\t") + "\n";
93
+ xml += sXml;
94
+ }
95
+ }
96
+ } else if (typeof v === "object") {
97
+ hasChild = false;
98
+ xml += ind + "<" + name;
99
+ for (m in v) {
100
+ if (v.hasOwnProperty(m)) {
101
+ if (m.charAt(0) === "@") {
102
+ xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
103
+ } else {
104
+ hasChild = true;
105
+ }
106
+ }
107
+ }
108
+ xml += hasChild ? ">" : "/>";
109
+ if (hasChild) {
110
+ for (m in v) {
111
+ if (v.hasOwnProperty(m)) {
112
+ if (m === "#text") {
113
+ xml += v[m];
114
+ } else if (m === "#cdata") {
115
+ xml += "<![CDATA[" + v[m] + "]]>";
116
+ } else if (m.charAt(0) !== "@") {
117
+ xml += toXml(v[m], m, ind + "\t");
118
+ }
119
+ }
120
+ }
121
+ xml += (xml.charAt(xml.length - 1) === "\n" ? ind : "") + "</" + name + ">";
122
+ }
123
+ } else if (typeof v === "function") {
124
+ xml += ind + "<" + name + ">" + "<![CDATA[" + v + "]]>" + "</" + name + ">";
125
+ } else {
126
+ if (v === undefined) {
127
+ v = "";
128
+ }
129
+ if (v.toString() === "\"\"" || v.toString().length === 0) {
130
+ xml += ind + "<" + name + ">__EMPTY_STRING_</" + name + ">";
131
+ } else {
132
+ xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
133
+ }
134
+ }
135
+ return xml;
136
+ },
137
+ xml1 = "",
138
+ p;
139
+
140
+ for (p in o) {
141
+ if (o.hasOwnProperty(p)) {
142
+ xml1 += toXml(o[p], p, "");
143
+ }
144
+ }
145
+ return tab ? xml1.replace(/\t/g, tab) : xml1.replace(/\t|\n/g, "");
146
+ },
147
+ // Internal methods
148
+ toObj: function (xml) {
149
+ var o = {}, funcTest = /function/i, i, textChild = 0, cdataChild = 0, hasElementChild = false, n;
150
+ if (xml.nodeType === 1) {
151
+ // element node ..
152
+ if (xml.attributes.length) {
153
+ // element with attributes ..
154
+ for (i = 0; i < xml.attributes.length; i += 1) {
155
+ o["@" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || "").toString();
156
+ }
157
+ }
158
+ if (xml.firstChild) {
159
+ // element has child nodes ..
160
+ for (n = xml.firstChild; n; n = n.nextSibling) {
161
+ if (n.nodeType === 1) {
162
+ hasElementChild = true;
163
+ } else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
164
+ // non-whitespace text
165
+ textChild += 1;
166
+ } else if (n.nodeType === 4) {
167
+ // cdata section node
168
+ cdataChild += 1;
169
+ }
170
+ }
171
+ if (hasElementChild) {
172
+ if (textChild < 2 && cdataChild < 2) {
173
+ // structured element with evtl. a single text or/and cdata node ..
174
+ this.removeWhite(xml);
175
+ for (n = xml.firstChild; n; n = n.nextSibling) {
176
+ if (n.nodeType === 3) {
177
+ // text node
178
+ o["#text"] = this.escape(n.nodeValue);
179
+ } else if (n.nodeType === 4) {
180
+ // cdata node
181
+ if (funcTest.test(n.nodeValue)) {
182
+ o[n.nodeName] = [o[n.nodeName], n.nodeValue];
183
+ } else {
184
+ o["#cdata"] = this.escape(n.nodeValue);
185
+ }
186
+ } else if (o[n.nodeName]) {
187
+ // multiple occurence of element ..
188
+ if (o[n.nodeName] instanceof Array) {
189
+ o[n.nodeName][o[n.nodeName].length] = this.toObj(n);
190
+ } else {
191
+ o[n.nodeName] = [o[n.nodeName], this.toObj(n)];
192
+ }
193
+ } else {
194
+ // first occurence of element ..
195
+ o[n.nodeName] = this.toObj(n);
196
+ }
197
+ }
198
+ } else {
199
+ // mixed content
200
+ if (!xml.attributes.length) {
201
+ o = this.escape(this.innerXml(xml));
202
+ } else {
203
+ o["#text"] = this.escape(this.innerXml(xml));
204
+ }
205
+ }
206
+ } else if (textChild) {
207
+ // pure text
208
+ if (!xml.attributes.length) {
209
+ o = this.escape(this.innerXml(xml));
210
+ if (o === "__EMPTY_ARRAY_") {
211
+ o = "[]";
212
+ } else if (o === "__EMPTY_STRING_") {
213
+ o = "";
214
+ }
215
+ } else {
216
+ o["#text"] = this.escape(this.innerXml(xml));
217
+ }
218
+ } else if (cdataChild) {
219
+ // cdata
220
+ if (cdataChild > 1) {
221
+ o = this.escape(this.innerXml(xml));
222
+ } else {
223
+ for (n = xml.firstChild; n; n = n.nextSibling) {
224
+ if (funcTest.test(xml.firstChild.nodeValue)) {
225
+ o = xml.firstChild.nodeValue;
226
+ break;
227
+ }
228
+ o["#cdata"] = this.escape(n.nodeValue);
229
+ }
230
+ }
231
+ }
232
+ }
233
+ if (!xml.attributes.length && !xml.firstChild) {
234
+ o = null;
235
+ }
236
+ } else if (xml.nodeType === 9) {
237
+ // document.node
238
+ o = this.toObj(xml.documentElement);
239
+ } else {
240
+ ($.jgrid != null && $.jgrid.defaults != null && $.jgrid.isFunction($.jgrid.defaults.fatalError) ? $.jgrid.defaults.fatalError : alert)("unhandled node type: " + xml.nodeType);
241
+ }
242
+ return o;
243
+ },
244
+ toJson: function (o, name, ind, wellform) {
245
+ if (wellform === undefined) {
246
+ wellform = true;
247
+ }
248
+ var json = name ? ("\"" + name + "\"") : "", tab = "\t", newline = "\n", n, i, ar = [], arr = [], m;
249
+ if (!wellform) {
250
+ tab = "";
251
+ newline = "";
252
+ }
253
+
254
+ if (o === "[]") {
255
+ json += (name ? ":[]" : "[]");
256
+ } else if (o instanceof Array) {
257
+ for (i = 0, n = o.length; i < n; i += 1) {
258
+ ar[i] = this.toJson(o[i], "", ind + tab, wellform);
259
+ }
260
+ json += (name ? ":[" : "[") + (ar.length > 1 ? (newline + ind + tab + ar.join("," + newline + ind + tab) + newline + ind) : ar.join("")) + "]";
261
+ } else if (o === null) {
262
+ json += (name && ":") + "null";
263
+ } else if (typeof o === "object") {
264
+ for (m in o) {
265
+ if (o.hasOwnProperty(m)) {
266
+ arr[arr.length] = this.toJson(o[m], m, ind + tab, wellform);
267
+ }
268
+ }
269
+ json += (name ? ":{" : "{") + (arr.length > 1 ? (newline + ind + tab + arr.join("," + newline + ind + tab) + newline + ind) : arr.join("")) + "}";
270
+ } else if (typeof o === "string") {
271
+ json += (name && ":") + "\"" + o.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + "\"";
272
+ } else {
273
+ json += (name && ":") + o.toString();
274
+ }
275
+ return json;
276
+ },
277
+ innerXml: function (node) {
278
+ var s = "", child,
279
+ asXml = function (n) {
280
+ var str = "", i, c;
281
+ if (n.nodeType === 1) {
282
+ str += "<" + n.nodeName;
283
+ for (i = 0; i < n.attributes.length; i += 1) {
284
+ str += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue || "").toString() + "\"";
285
+ }
286
+ if (n.firstChild) {
287
+ str += ">";
288
+ for (c = n.firstChild; c; c = c.nextSibling) {
289
+ str += asXml(c);
290
+ }
291
+ str += "</" + n.nodeName + ">";
292
+ } else {
293
+ str += "/>";
294
+ }
295
+ } else if (n.nodeType === 3) {
296
+ str += n.nodeValue;
297
+ } else if (n.nodeType === 4) {
298
+ str += "<![CDATA[" + n.nodeValue + "]]>";
299
+ }
300
+ return str;
301
+ };
302
+ if (node.hasOwnProperty("innerHTML")) {
303
+ s = node.innerHTML;
304
+ } else {
305
+ for (child = node.firstChild; child; child = child.nextSibling) {
306
+ s += asXml(child);
307
+ }
308
+ }
309
+ return s;
310
+ },
311
+ escape: function (txt) {
312
+ return txt.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, "\\n").replace(/[\r]/g, "\\r");
313
+ },
314
+ removeWhite: function (e) {
315
+ e.normalize();
316
+ var n = e.firstChild, nxt;
317
+ while (n) {
318
+ if (n.nodeType === 3) {
319
+ // text node
320
+ if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
321
+ // pure whitespace text node
322
+ nxt = n.nextSibling;
323
+ e.removeChild(n);
324
+ n = nxt;
325
+ } else {
326
+ n = n.nextSibling;
327
+ }
328
+ } else if (n.nodeType === 1) {
329
+ // element node
330
+ this.removeWhite(n);
331
+ n = n.nextSibling;
332
+ } else {
333
+ // any other node
334
+ n = n.nextSibling;
335
+ }
336
+ }
337
+ return e;
338
+ }
339
+ };
340
+ window.xmlJsonClass = xmlJsonClass;
341
+ // end module jsonxml
342
+ return xmlJsonClass;
343
+ }));