kojac 0.9.0.1 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmY3Y2Y3OTRjODA1NDQ4MGFkNzQ2YjBlNzEyZWVhZjg1NzI3NWYxNA==
4
+ MzlmODZlNDc1ZGE2MjY2NzM0NDk5MTVmNzhiNWMxZDQ3ZjdmM2FhYw==
5
5
  data.tar.gz: !binary |-
6
- MDQyNTNmYmM4YzA4ZTBiYmYzYmI2NWExYmRkNDBjODk5ZjJjNjhlMg==
6
+ ZTg1NjYzNDY0MDRiNGY4M2M0YTQxMDAzYjZjYTYwYjA1YTBkZDRiMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjllODJmMWIzMGJjNjlkODNhZTM1N2Q3MTRjOTUyZTI3Y2Q4YzQ1OTgxYTAw
10
- MWM5YTAxMDQ1MzAyYTkwMGM4NGQ2YTQ1MmIxM2Y3MzMyZTllMTc4NjA3NThh
11
- Y2JlMWM3ODUyYWZhNGEyYWVmNWRjNmI3OTk1MmRjMTEzYTE4Mjc=
9
+ MzljZTFhZmZiNzdkYjE1YWJmMzg5M2M5ZjQ3NTI3NmQxYzhiZThkMjYwMDgw
10
+ MzdmZTNiZmU0NTFkMTEyNWRjNDRiN2ZmYjA3MGYyN2Q3ZmVkZmFhMjYzYzhm
11
+ NDk0YmU3YmUzZGQwYzllZTBmZjUyYjNmNGVkYmMyMTAyNzViZDg=
12
12
  data.tar.gz: !binary |-
13
- NWQ5OTQ4ZGM4ZDc3M2EyOTBmMjRmZmRhODI3ZDhiYWVlNTE5Y2MwNzhiMDcw
14
- MmZhNDk3YTZjNDk1MWE0NGFlMDQyOWM4NzUwODk4NzMyMDY1MGNhZGVkYmQy
15
- NzEwMDdiN2I1ZmY4MWFmNjg1Mzc1ZTM4OTIyY2IzYWUzZTAxYzU=
13
+ ODE2MDU0YWJjMzVhMzY4M2EwNGY5YjMxODFiZTE0YWQ5N2FhZDJkY2UxZTUy
14
+ MGE0Mzk0MTk0OTRkNGNkYTVmNjcxMGExZGY1ZDg1YzYwYzk2MmUwNTExZjZi
15
+ MjBiODcyZTc1OWQ1MGQxNzAwNjk0OGExZDk2NThhMTM0NGM3MDI=
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kojac (0.9.0.1)
4
+ kojac (0.9.1)
5
5
  jquery-rails
6
- json2-rails
7
6
  strong_parameters
8
7
  underscore_plus
9
8
 
@@ -67,8 +66,7 @@ GEM
67
66
  ember-source (1.0.0.rc7)
68
67
  handlebars-source (= 1.0.12)
69
68
  erubis (2.7.0)
70
- execjs (1.4.0)
71
- multi_json (~> 1.0)
69
+ execjs (2.0.0)
72
70
  handlebars-source (1.0.12)
73
71
  hike (1.2.3)
74
72
  i18n (0.6.5)
@@ -77,13 +75,14 @@ GEM
77
75
  railties (>= 3.0, < 5.0)
78
76
  thor (>= 0.14, < 2.0)
79
77
  json (1.8.0)
80
- json2-rails (1.0.0)
81
78
  mail (2.5.4)
82
79
  mime-types (~> 1.16)
83
80
  treetop (~> 1.4.8)
84
81
  mime-types (1.24)
82
+ mini_portile (0.5.1)
85
83
  multi_json (1.7.9)
86
- nokogiri (1.5.9)
84
+ nokogiri (1.6.0)
85
+ mini_portile (~> 0.5.0)
87
86
  polyglot (0.3.3)
88
87
  rack (1.4.5)
89
88
  rack-cache (1.2)
@@ -110,23 +109,23 @@ GEM
110
109
  rake (10.1.0)
111
110
  rdoc (3.12.2)
112
111
  json (~> 1.4)
113
- rspec-core (2.13.1)
114
- rspec-expectations (2.13.0)
112
+ rspec-core (2.14.5)
113
+ rspec-expectations (2.14.2)
115
114
  diff-lcs (>= 1.1.3, < 2.0)
116
- rspec-mocks (2.13.1)
117
- rspec-rails (2.13.2)
115
+ rspec-mocks (2.14.3)
116
+ rspec-rails (2.14.0)
118
117
  actionpack (>= 3.0)
119
118
  activesupport (>= 3.0)
120
119
  railties (>= 3.0)
121
- rspec-core (~> 2.13.0)
122
- rspec-expectations (~> 2.13.0)
123
- rspec-mocks (~> 2.13.0)
120
+ rspec-core (~> 2.14.0)
121
+ rspec-expectations (~> 2.14.0)
122
+ rspec-mocks (~> 2.14.0)
124
123
  sprockets (2.2.2)
125
124
  hike (~> 1.2)
126
125
  multi_json (~> 1.0)
127
126
  rack (~> 1.0)
128
127
  tilt (~> 1.1, != 1.3.0)
129
- sqlite3 (1.3.7)
128
+ sqlite3 (1.3.8)
130
129
  strong_parameters (0.2.1)
131
130
  actionpack (~> 3.0)
132
131
  activemodel (~> 3.0)
data/kojac.gemspec CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.require_paths = ["lib"]
23
23
 
24
24
  s.add_dependency "underscore_plus"
25
- s.add_dependency "json2-rails"
26
25
  s.add_dependency "jquery-rails"
27
26
  s.add_dependency 'strong_parameters'
28
27
 
data/lib/kojac/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kojac
2
- VERSION = "0.9.0.1"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -0,0 +1,850 @@
1
+ /*! JSON v3.2.5 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */
2
+ ;(function (window) {
3
+ // Convenience aliases.
4
+ var getClass = {}.toString, isProperty, forEach, undef;
5
+
6
+ // Detect the `define` function exposed by asynchronous module loaders. The
7
+ // strict `define` check is necessary for compatibility with `r.js`.
8
+ var isLoader = typeof define === "function" && define.amd, JSON3 = typeof exports == "object" && exports;
9
+
10
+ if (JSON3 || isLoader) {
11
+ if (typeof JSON == "object" && JSON) {
12
+ // Delegate to the native `stringify` and `parse` implementations in
13
+ // asynchronous module loaders and CommonJS environments.
14
+ if (JSON3) {
15
+ JSON3.stringify = JSON.stringify;
16
+ JSON3.parse = JSON.parse;
17
+ } else {
18
+ JSON3 = JSON;
19
+ }
20
+ } else if (isLoader) {
21
+ JSON3 = window.JSON = {};
22
+ }
23
+ } else {
24
+ // Export for web browsers and JavaScript engines.
25
+ JSON3 = window.JSON || (window.JSON = {});
26
+ }
27
+
28
+ // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
29
+ var isExtended = new Date(-3509827334573292);
30
+ try {
31
+ // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
32
+ // results for certain dates in Opera >= 10.53.
33
+ isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
34
+ // Safari < 2.0.2 stores the internal millisecond time value correctly,
35
+ // but clips the values returned by the date methods to the range of
36
+ // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
37
+ isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
38
+ } catch (exception) {}
39
+
40
+ // Internal: Determines whether the native `JSON.stringify` and `parse`
41
+ // implementations are spec-compliant. Based on work by Ken Snyder.
42
+ function has(name) {
43
+ if (name == "bug-string-char-index") {
44
+ // IE <= 7 doesn't support accessing string characters using square
45
+ // bracket notation. IE 8 only supports this for primitives.
46
+ return "a"[0] != "a";
47
+ }
48
+ var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', isAll = name == "json";
49
+ if (isAll || name == "json-stringify" || name == "json-parse") {
50
+ // Test `JSON.stringify`.
51
+ if (name == "json-stringify" || isAll) {
52
+ var stringify = JSON3.stringify, stringifySupported = typeof stringify == "function" && isExtended;
53
+ if (stringifySupported) {
54
+ // A test function object with a custom `toJSON` method.
55
+ (value = function () {
56
+ return 1;
57
+ }).toJSON = value;
58
+ try {
59
+ stringifySupported =
60
+ // Firefox 3.1b1 and b2 serialize string, number, and boolean
61
+ // primitives as object literals.
62
+ stringify(0) === "0" &&
63
+ // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
64
+ // literals.
65
+ stringify(new Number()) === "0" &&
66
+ stringify(new String()) == '""' &&
67
+ // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
68
+ // does not define a canonical JSON representation (this applies to
69
+ // objects with `toJSON` properties as well, *unless* they are nested
70
+ // within an object or array).
71
+ stringify(getClass) === undef &&
72
+ // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
73
+ // FF 3.1b3 pass this test.
74
+ stringify(undef) === undef &&
75
+ // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
76
+ // respectively, if the value is omitted entirely.
77
+ stringify() === undef &&
78
+ // FF 3.1b1, 2 throw an error if the given value is not a number,
79
+ // string, array, object, Boolean, or `null` literal. This applies to
80
+ // objects with custom `toJSON` methods as well, unless they are nested
81
+ // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
82
+ // methods entirely.
83
+ stringify(value) === "1" &&
84
+ stringify([value]) == "[1]" &&
85
+ // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
86
+ // `"[null]"`.
87
+ stringify([undef]) == "[null]" &&
88
+ // YUI 3.0.0b1 fails to serialize `null` literals.
89
+ stringify(null) == "null" &&
90
+ // FF 3.1b1, 2 halts serialization if an array contains a function:
91
+ // `[1, true, getClass, 1]` serializes as "[1,true,],". These versions
92
+ // of Firefox also allow trailing commas in JSON objects and arrays.
93
+ // FF 3.1b3 elides non-JSON values from objects and arrays, unless they
94
+ // define custom `toJSON` methods.
95
+ stringify([undef, getClass, null]) == "[null,null,null]" &&
96
+ // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
97
+ // where character escape codes are expected (e.g., `\b` => `\u0008`).
98
+ stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
99
+ // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
100
+ stringify(null, value) === "1" &&
101
+ stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
102
+ // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
103
+ // serialize extended years.
104
+ stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
105
+ // The milliseconds are optional in ES 5, but required in 5.1.
106
+ stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
107
+ // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
108
+ // four-digit years instead of six-digit years. Credits: @Yaffle.
109
+ stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
110
+ // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
111
+ // values less than 1000. Credits: @Yaffle.
112
+ stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
113
+ } catch (exception) {
114
+ stringifySupported = false;
115
+ }
116
+ }
117
+ if (!isAll) {
118
+ return stringifySupported;
119
+ }
120
+ }
121
+ // Test `JSON.parse`.
122
+ if (name == "json-parse" || isAll) {
123
+ var parse = JSON3.parse;
124
+ if (typeof parse == "function") {
125
+ try {
126
+ // FF 3.1b1, b2 will throw an exception if a bare literal is provided.
127
+ // Conforming implementations should also coerce the initial argument to
128
+ // a string prior to parsing.
129
+ if (parse("0") === 0 && !parse(false)) {
130
+ // Simple parsing test.
131
+ value = parse(serialized);
132
+ var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
133
+ if (parseSupported) {
134
+ try {
135
+ // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
136
+ parseSupported = !parse('"\t"');
137
+ } catch (exception) {}
138
+ if (parseSupported) {
139
+ try {
140
+ // FF 4.0 and 4.0.1 allow leading `+` signs, and leading and
141
+ // trailing decimal points. FF 4.0, 4.0.1, and IE 9-10 also
142
+ // allow certain octal literals.
143
+ parseSupported = parse("01") !== 1;
144
+ } catch (exception) {}
145
+ }
146
+ }
147
+ }
148
+ } catch (exception) {
149
+ parseSupported = false;
150
+ }
151
+ }
152
+ if (!isAll) {
153
+ return parseSupported;
154
+ }
155
+ }
156
+ return stringifySupported && parseSupported;
157
+ }
158
+ }
159
+
160
+ if (!has("json")) {
161
+ // Common `[[Class]]` name aliases.
162
+ var functionClass = "[object Function]";
163
+ var dateClass = "[object Date]";
164
+ var numberClass = "[object Number]";
165
+ var stringClass = "[object String]";
166
+ var arrayClass = "[object Array]";
167
+ var booleanClass = "[object Boolean]";
168
+
169
+ // Detect incomplete support for accessing string characters by index.
170
+ var charIndexBuggy = has("bug-string-char-index");
171
+
172
+ // Define additional utility methods if the `Date` methods are buggy.
173
+ if (!isExtended) {
174
+ var floor = Math.floor;
175
+ // A mapping between the months of the year and the number of days between
176
+ // January 1st and the first of the respective month.
177
+ var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
178
+ // Internal: Calculates the number of days between the Unix epoch and the
179
+ // first day of the given month.
180
+ var getDay = function (year, month) {
181
+ return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
182
+ };
183
+ }
184
+
185
+ // Internal: Determines if a property is a direct property of the given
186
+ // object. Delegates to the native `Object#hasOwnProperty` method.
187
+ if (!(isProperty = {}.hasOwnProperty)) {
188
+ isProperty = function (property) {
189
+ var members = {}, constructor;
190
+ if ((members.__proto__ = null, members.__proto__ = {
191
+ // The *proto* property cannot be set multiple times in recent
192
+ // versions of Firefox and SeaMonkey.
193
+ "toString": 1
194
+ }, members).toString != getClass) {
195
+ // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
196
+ // supports the mutable *proto* property.
197
+ isProperty = function (property) {
198
+ // Capture and break the object's prototype chain (see section 8.6.2
199
+ // of the ES 5.1 spec). The parenthesized expression prevents an
200
+ // unsafe transformation by the Closure Compiler.
201
+ var original = this.__proto__, result = property in (this.__proto__ = null, this);
202
+ // Restore the original prototype chain.
203
+ this.__proto__ = original;
204
+ return result;
205
+ };
206
+ } else {
207
+ // Capture a reference to the top-level `Object` constructor.
208
+ constructor = members.constructor;
209
+ // Use the `constructor` property to simulate `Object#hasOwnProperty` in
210
+ // other environments.
211
+ isProperty = function (property) {
212
+ var parent = (this.constructor || constructor).prototype;
213
+ return property in this && !(property in parent && this[property] === parent[property]);
214
+ };
215
+ }
216
+ members = null;
217
+ return isProperty.call(this, property);
218
+ };
219
+ }
220
+
221
+ // Internal: A set of primitive types used by `isHostType`.
222
+ var PrimitiveTypes = {
223
+ 'boolean': 1,
224
+ 'number': 1,
225
+ 'string': 1,
226
+ 'undefined': 1
227
+ };
228
+
229
+ // Internal: Determines if the given object `property` value is a
230
+ // non-primitive.
231
+ var isHostType = function (object, property) {
232
+ var type = typeof object[property];
233
+ return type == 'object' ? !!object[property] : !PrimitiveTypes[type];
234
+ };
235
+
236
+ // Internal: Normalizes the `for...in` iteration algorithm across
237
+ // environments. Each enumerated key is yielded to a `callback` function.
238
+ forEach = function (object, callback) {
239
+ var size = 0, Properties, members, property, forEach;
240
+
241
+ // Tests for bugs in the current environment's `for...in` algorithm. The
242
+ // `valueOf` property inherits the non-enumerable flag from
243
+ // `Object.prototype` in older versions of IE, Netscape, and Mozilla.
244
+ (Properties = function () {
245
+ this.valueOf = 0;
246
+ }).prototype.valueOf = 0;
247
+
248
+ // Iterate over a new instance of the `Properties` class.
249
+ members = new Properties();
250
+ for (property in members) {
251
+ // Ignore all properties inherited from `Object.prototype`.
252
+ if (isProperty.call(members, property)) {
253
+ size++;
254
+ }
255
+ }
256
+ Properties = members = null;
257
+
258
+ // Normalize the iteration algorithm.
259
+ if (!size) {
260
+ // A list of non-enumerable properties inherited from `Object.prototype`.
261
+ members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
262
+ // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
263
+ // properties.
264
+ forEach = function (object, callback) {
265
+ var isFunction = getClass.call(object) == functionClass, property, length;
266
+ var hasProperty = !isFunction && typeof object.constructor != 'function' && isHostType(object, 'hasOwnProperty') ? object.hasOwnProperty : isProperty;
267
+ for (property in object) {
268
+ // Gecko <= 1.0 enumerates the `prototype` property of functions under
269
+ // certain conditions; IE does not.
270
+ if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
271
+ callback(property);
272
+ }
273
+ }
274
+ // Manually invoke the callback for each non-enumerable property.
275
+ for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
276
+ };
277
+ } else if (size == 2) {
278
+ // Safari <= 2.0.4 enumerates shadowed properties twice.
279
+ forEach = function (object, callback) {
280
+ // Create a set of iterated properties.
281
+ var members = {}, isFunction = getClass.call(object) == functionClass, property;
282
+ for (property in object) {
283
+ // Store each property name to prevent double enumeration. The
284
+ // `prototype` property of functions is not enumerated due to cross-
285
+ // environment inconsistencies.
286
+ if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
287
+ callback(property);
288
+ }
289
+ }
290
+ };
291
+ } else {
292
+ // No bugs detected; use the standard `for...in` algorithm.
293
+ forEach = function (object, callback) {
294
+ var isFunction = getClass.call(object) == functionClass, property, isConstructor;
295
+ for (property in object) {
296
+ if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
297
+ callback(property);
298
+ }
299
+ }
300
+ // Manually invoke the callback for the `constructor` property due to
301
+ // cross-environment inconsistencies.
302
+ if (isConstructor || isProperty.call(object, (property = "constructor"))) {
303
+ callback(property);
304
+ }
305
+ };
306
+ }
307
+ return forEach(object, callback);
308
+ };
309
+
310
+ // Public: Serializes a JavaScript `value` as a JSON string. The optional
311
+ // `filter` argument may specify either a function that alters how object and
312
+ // array members are serialized, or an array of strings and numbers that
313
+ // indicates which properties should be serialized. The optional `width`
314
+ // argument may be either a string or number that specifies the indentation
315
+ // level of the output.
316
+ if (!has("json-stringify")) {
317
+ // Internal: A map of control characters and their escaped equivalents.
318
+ var Escapes = {
319
+ 92: "\\\\",
320
+ 34: '\\"',
321
+ 8: "\\b",
322
+ 12: "\\f",
323
+ 10: "\\n",
324
+ 13: "\\r",
325
+ 9: "\\t"
326
+ };
327
+
328
+ // Internal: Converts `value` into a zero-padded string such that its
329
+ // length is at least equal to `width`. The `width` must be <= 6.
330
+ var leadingZeroes = "000000";
331
+ var toPaddedString = function (width, value) {
332
+ // The `|| 0` expression is necessary to work around a bug in
333
+ // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
334
+ return (leadingZeroes + (value || 0)).slice(-width);
335
+ };
336
+
337
+ // Internal: Double-quotes a string `value`, replacing all ASCII control
338
+ // characters (characters with code unit values between 0 and 31) with
339
+ // their escaped equivalents. This is an implementation of the
340
+ // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
341
+ var unicodePrefix = "\\u00";
342
+ var quote = function (value) {
343
+ var result = '"', index = 0, length = value.length, isLarge = length > 10 && charIndexBuggy, symbols;
344
+ if (isLarge) {
345
+ symbols = value.split("");
346
+ }
347
+ for (; index < length; index++) {
348
+ var charCode = value.charCodeAt(index);
349
+ // If the character is a control character, append its Unicode or
350
+ // shorthand escape sequence; otherwise, append the character as-is.
351
+ switch (charCode) {
352
+ case 8: case 9: case 10: case 12: case 13: case 34: case 92:
353
+ result += Escapes[charCode];
354
+ break;
355
+ default:
356
+ if (charCode < 32) {
357
+ result += unicodePrefix + toPaddedString(2, charCode.toString(16));
358
+ break;
359
+ }
360
+ result += isLarge ? symbols[index] : charIndexBuggy ? value.charAt(index) : value[index];
361
+ }
362
+ }
363
+ return result + '"';
364
+ };
365
+
366
+ // Internal: Recursively serializes an object. Implements the
367
+ // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
368
+ var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
369
+ var value = object[property], className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, hasMembers, result;
370
+ try {
371
+ // Necessary for host object support.
372
+ value = object[property];
373
+ } catch (exception) {}
374
+ if (typeof value == "object" && value) {
375
+ className = getClass.call(value);
376
+ if (className == dateClass && !isProperty.call(value, "toJSON")) {
377
+ if (value > -1 / 0 && value < 1 / 0) {
378
+ // Dates are serialized according to the `Date#toJSON` method
379
+ // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
380
+ // for the ISO 8601 date time string format.
381
+ if (getDay) {
382
+ // Manually compute the year, month, date, hours, minutes,
383
+ // seconds, and milliseconds if the `getUTC*` methods are
384
+ // buggy. Adapted from @Yaffle's `date-shim` project.
385
+ date = floor(value / 864e5);
386
+ for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
387
+ for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
388
+ date = 1 + date - getDay(year, month);
389
+ // The `time` value specifies the time within the day (see ES
390
+ // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
391
+ // to compute `A modulo B`, as the `%` operator does not
392
+ // correspond to the `modulo` operation for negative numbers.
393
+ time = (value % 864e5 + 864e5) % 864e5;
394
+ // The hours, minutes, seconds, and milliseconds are obtained by
395
+ // decomposing the time within the day. See section 15.9.1.10.
396
+ hours = floor(time / 36e5) % 24;
397
+ minutes = floor(time / 6e4) % 60;
398
+ seconds = floor(time / 1e3) % 60;
399
+ milliseconds = time % 1e3;
400
+ } else {
401
+ year = value.getUTCFullYear();
402
+ month = value.getUTCMonth();
403
+ date = value.getUTCDate();
404
+ hours = value.getUTCHours();
405
+ minutes = value.getUTCMinutes();
406
+ seconds = value.getUTCSeconds();
407
+ milliseconds = value.getUTCMilliseconds();
408
+ }
409
+ // Serialize extended years correctly.
410
+ value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
411
+ "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
412
+ // Months, dates, hours, minutes, and seconds should have two
413
+ // digits; milliseconds should have three.
414
+ "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
415
+ // Milliseconds are optional in ES 5.0, but required in 5.1.
416
+ "." + toPaddedString(3, milliseconds) + "Z";
417
+ } else {
418
+ value = null;
419
+ }
420
+ } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
421
+ // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
422
+ // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
423
+ // ignores all `toJSON` methods on these objects unless they are
424
+ // defined directly on an instance.
425
+ value = value.toJSON(property);
426
+ }
427
+ }
428
+ if (callback) {
429
+ // If a replacement function was provided, call it to obtain the value
430
+ // for serialization.
431
+ value = callback.call(object, property, value);
432
+ }
433
+ if (value === null) {
434
+ return "null";
435
+ }
436
+ className = getClass.call(value);
437
+ if (className == booleanClass) {
438
+ // Booleans are represented literally.
439
+ return "" + value;
440
+ } else if (className == numberClass) {
441
+ // JSON numbers must be finite. `Infinity` and `NaN` are serialized as
442
+ // `"null"`.
443
+ return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
444
+ } else if (className == stringClass) {
445
+ // Strings are double-quoted and escaped.
446
+ return quote("" + value);
447
+ }
448
+ // Recursively serialize objects and arrays.
449
+ if (typeof value == "object") {
450
+ // Check for cyclic structures. This is a linear search; performance
451
+ // is inversely proportional to the number of unique nested objects.
452
+ for (length = stack.length; length--;) {
453
+ if (stack[length] === value) {
454
+ // Cyclic structures cannot be serialized by `JSON.stringify`.
455
+ throw TypeError();
456
+ }
457
+ }
458
+ // Add the object to the stack of traversed objects.
459
+ stack.push(value);
460
+ results = [];
461
+ // Save the current indentation level and indent one additional level.
462
+ prefix = indentation;
463
+ indentation += whitespace;
464
+ if (className == arrayClass) {
465
+ // Recursively serialize array elements.
466
+ for (index = 0, length = value.length; index < length; hasMembers || (hasMembers = true), index++) {
467
+ element = serialize(index, value, callback, properties, whitespace, indentation, stack);
468
+ results.push(element === undef ? "null" : element);
469
+ }
470
+ result = hasMembers ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
471
+ } else {
472
+ // Recursively serialize object members. Members are selected from
473
+ // either a user-specified list of property names, or the object
474
+ // itself.
475
+ forEach(properties || value, function (property) {
476
+ var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
477
+ if (element !== undef) {
478
+ // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
479
+ // is not the empty string, let `member` {quote(property) + ":"}
480
+ // be the concatenation of `member` and the `space` character."
481
+ // The "`space` character" refers to the literal space
482
+ // character, not the `space` {width} argument provided to
483
+ // `JSON.stringify`.
484
+ results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
485
+ }
486
+ hasMembers || (hasMembers = true);
487
+ });
488
+ result = hasMembers ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
489
+ }
490
+ // Remove the object from the traversed object stack.
491
+ stack.pop();
492
+ return result;
493
+ }
494
+ };
495
+
496
+ // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
497
+ JSON3.stringify = function (source, filter, width) {
498
+ var whitespace, callback, properties;
499
+ if (typeof filter == "function" || typeof filter == "object" && filter) {
500
+ if (getClass.call(filter) == functionClass) {
501
+ callback = filter;
502
+ } else if (getClass.call(filter) == arrayClass) {
503
+ // Convert the property names array into a makeshift set.
504
+ properties = {};
505
+ for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((getClass.call(value) == stringClass || getClass.call(value) == numberClass) && (properties[value] = 1)));
506
+ }
507
+ }
508
+ if (width) {
509
+ if (getClass.call(width) == numberClass) {
510
+ // Convert the `width` to an integer and create a string containing
511
+ // `width` number of space characters.
512
+ if ((width -= width % 1) > 0) {
513
+ for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
514
+ }
515
+ } else if (getClass.call(width) == stringClass) {
516
+ whitespace = width.length <= 10 ? width : width.slice(0, 10);
517
+ }
518
+ }
519
+ // Opera <= 7.54u2 discards the values associated with empty string keys
520
+ // (`""`) only if they are used directly within an object member list
521
+ // (e.g., `!("" in { "": 1})`).
522
+ return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
523
+ };
524
+ }
525
+
526
+ // Public: Parses a JSON source string.
527
+ if (!has("json-parse")) {
528
+ var fromCharCode = String.fromCharCode;
529
+
530
+ // Internal: A map of escaped control characters and their unescaped
531
+ // equivalents.
532
+ var Unescapes = {
533
+ 92: "\\",
534
+ 34: '"',
535
+ 47: "/",
536
+ 98: "\b",
537
+ 116: "\t",
538
+ 110: "\n",
539
+ 102: "\f",
540
+ 114: "\r"
541
+ };
542
+
543
+ // Internal: Stores the parser state.
544
+ var Index, Source;
545
+
546
+ // Internal: Resets the parser state and throws a `SyntaxError`.
547
+ var abort = function() {
548
+ Index = Source = null;
549
+ throw SyntaxError();
550
+ };
551
+
552
+ // Internal: Returns the next token, or `"$"` if the parser has reached
553
+ // the end of the source string. A token may be a string, number, `null`
554
+ // literal, or Boolean literal.
555
+ var lex = function () {
556
+ var source = Source, length = source.length, value, begin, position, isSigned, charCode;
557
+ while (Index < length) {
558
+ charCode = source.charCodeAt(Index);
559
+ switch (charCode) {
560
+ case 9: case 10: case 13: case 32:
561
+ // Skip whitespace tokens, including tabs, carriage returns, line
562
+ // feeds, and space characters.
563
+ Index++;
564
+ break;
565
+ case 123: case 125: case 91: case 93: case 58: case 44:
566
+ // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
567
+ // the current position.
568
+ value = charIndexBuggy ? source.charAt(Index) : source[Index];
569
+ Index++;
570
+ return value;
571
+ case 34:
572
+ // `"` delimits a JSON string; advance to the next character and
573
+ // begin parsing the string. String tokens are prefixed with the
574
+ // sentinel `@` character to distinguish them from punctuators and
575
+ // end-of-string tokens.
576
+ for (value = "@", Index++; Index < length;) {
577
+ charCode = source.charCodeAt(Index);
578
+ if (charCode < 32) {
579
+ // Unescaped ASCII control characters (those with a code unit
580
+ // less than the space character) are not permitted.
581
+ abort();
582
+ } else if (charCode == 92) {
583
+ // A reverse solidus (`\`) marks the beginning of an escaped
584
+ // control character (including `"`, `\`, and `/`) or Unicode
585
+ // escape sequence.
586
+ charCode = source.charCodeAt(++Index);
587
+ switch (charCode) {
588
+ case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
589
+ // Revive escaped control characters.
590
+ value += Unescapes[charCode];
591
+ Index++;
592
+ break;
593
+ case 117:
594
+ // `\u` marks the beginning of a Unicode escape sequence.
595
+ // Advance to the first character and validate the
596
+ // four-digit code point.
597
+ begin = ++Index;
598
+ for (position = Index + 4; Index < position; Index++) {
599
+ charCode = source.charCodeAt(Index);
600
+ // A valid sequence comprises four hexdigits (case-
601
+ // insensitive) that form a single hexadecimal value.
602
+ if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
603
+ // Invalid Unicode escape sequence.
604
+ abort();
605
+ }
606
+ }
607
+ // Revive the escaped character.
608
+ value += fromCharCode("0x" + source.slice(begin, Index));
609
+ break;
610
+ default:
611
+ // Invalid escape sequence.
612
+ abort();
613
+ }
614
+ } else {
615
+ if (charCode == 34) {
616
+ // An unescaped double-quote character marks the end of the
617
+ // string.
618
+ break;
619
+ }
620
+ charCode = source.charCodeAt(Index);
621
+ begin = Index;
622
+ // Optimize for the common case where a string is valid.
623
+ while (charCode >= 32 && charCode != 92 && charCode != 34) {
624
+ charCode = source.charCodeAt(++Index);
625
+ }
626
+ // Append the string as-is.
627
+ value += source.slice(begin, Index);
628
+ }
629
+ }
630
+ if (source.charCodeAt(Index) == 34) {
631
+ // Advance to the next character and return the revived string.
632
+ Index++;
633
+ return value;
634
+ }
635
+ // Unterminated string.
636
+ abort();
637
+ default:
638
+ // Parse numbers and literals.
639
+ begin = Index;
640
+ // Advance past the negative sign, if one is specified.
641
+ if (charCode == 45) {
642
+ isSigned = true;
643
+ charCode = source.charCodeAt(++Index);
644
+ }
645
+ // Parse an integer or floating-point value.
646
+ if (charCode >= 48 && charCode <= 57) {
647
+ // Leading zeroes are interpreted as octal literals.
648
+ if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
649
+ // Illegal octal literal.
650
+ abort();
651
+ }
652
+ isSigned = false;
653
+ // Parse the integer component.
654
+ for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
655
+ // Floats cannot contain a leading decimal point; however, this
656
+ // case is already accounted for by the parser.
657
+ if (source.charCodeAt(Index) == 46) {
658
+ position = ++Index;
659
+ // Parse the decimal component.
660
+ for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
661
+ if (position == Index) {
662
+ // Illegal trailing decimal.
663
+ abort();
664
+ }
665
+ Index = position;
666
+ }
667
+ // Parse exponents. The `e` denoting the exponent is
668
+ // case-insensitive.
669
+ charCode = source.charCodeAt(Index);
670
+ if (charCode == 101 || charCode == 69) {
671
+ charCode = source.charCodeAt(++Index);
672
+ // Skip past the sign following the exponent, if one is
673
+ // specified.
674
+ if (charCode == 43 || charCode == 45) {
675
+ Index++;
676
+ }
677
+ // Parse the exponential component.
678
+ for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
679
+ if (position == Index) {
680
+ // Illegal empty exponent.
681
+ abort();
682
+ }
683
+ Index = position;
684
+ }
685
+ // Coerce the parsed value to a JavaScript number.
686
+ return +source.slice(begin, Index);
687
+ }
688
+ // A negative sign may only precede numbers.
689
+ if (isSigned) {
690
+ abort();
691
+ }
692
+ // `true`, `false`, and `null` literals.
693
+ if (source.slice(Index, Index + 4) == "true") {
694
+ Index += 4;
695
+ return true;
696
+ } else if (source.slice(Index, Index + 5) == "false") {
697
+ Index += 5;
698
+ return false;
699
+ } else if (source.slice(Index, Index + 4) == "null") {
700
+ Index += 4;
701
+ return null;
702
+ }
703
+ // Unrecognized token.
704
+ abort();
705
+ }
706
+ }
707
+ // Return the sentinel `$` character if the parser has reached the end
708
+ // of the source string.
709
+ return "$";
710
+ };
711
+
712
+ // Internal: Parses a JSON `value` token.
713
+ var get = function (value) {
714
+ var results, hasMembers;
715
+ if (value == "$") {
716
+ // Unexpected end of input.
717
+ abort();
718
+ }
719
+ if (typeof value == "string") {
720
+ if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
721
+ // Remove the sentinel `@` character.
722
+ return value.slice(1);
723
+ }
724
+ // Parse object and array literals.
725
+ if (value == "[") {
726
+ // Parses a JSON array, returning a new JavaScript array.
727
+ results = [];
728
+ for (;; hasMembers || (hasMembers = true)) {
729
+ value = lex();
730
+ // A closing square bracket marks the end of the array literal.
731
+ if (value == "]") {
732
+ break;
733
+ }
734
+ // If the array literal contains elements, the current token
735
+ // should be a comma separating the previous element from the
736
+ // next.
737
+ if (hasMembers) {
738
+ if (value == ",") {
739
+ value = lex();
740
+ if (value == "]") {
741
+ // Unexpected trailing `,` in array literal.
742
+ abort();
743
+ }
744
+ } else {
745
+ // A `,` must separate each array element.
746
+ abort();
747
+ }
748
+ }
749
+ // Elisions and leading commas are not permitted.
750
+ if (value == ",") {
751
+ abort();
752
+ }
753
+ results.push(get(value));
754
+ }
755
+ return results;
756
+ } else if (value == "{") {
757
+ // Parses a JSON object, returning a new JavaScript object.
758
+ results = {};
759
+ for (;; hasMembers || (hasMembers = true)) {
760
+ value = lex();
761
+ // A closing curly brace marks the end of the object literal.
762
+ if (value == "}") {
763
+ break;
764
+ }
765
+ // If the object literal contains members, the current token
766
+ // should be a comma separator.
767
+ if (hasMembers) {
768
+ if (value == ",") {
769
+ value = lex();
770
+ if (value == "}") {
771
+ // Unexpected trailing `,` in object literal.
772
+ abort();
773
+ }
774
+ } else {
775
+ // A `,` must separate each object member.
776
+ abort();
777
+ }
778
+ }
779
+ // Leading commas are not permitted, object property names must be
780
+ // double-quoted strings, and a `:` must separate each property
781
+ // name and value.
782
+ if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
783
+ abort();
784
+ }
785
+ results[value.slice(1)] = get(lex());
786
+ }
787
+ return results;
788
+ }
789
+ // Unexpected token encountered.
790
+ abort();
791
+ }
792
+ return value;
793
+ };
794
+
795
+ // Internal: Updates a traversed object member.
796
+ var update = function(source, property, callback) {
797
+ var element = walk(source, property, callback);
798
+ if (element === undef) {
799
+ delete source[property];
800
+ } else {
801
+ source[property] = element;
802
+ }
803
+ };
804
+
805
+ // Internal: Recursively traverses a parsed JSON object, invoking the
806
+ // `callback` function for each value. This is an implementation of the
807
+ // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
808
+ var walk = function (source, property, callback) {
809
+ var value = source[property], length;
810
+ if (typeof value == "object" && value) {
811
+ // `forEach` can't be used to traverse an array in Opera <= 8.54
812
+ // because its `Object#hasOwnProperty` implementation returns `false`
813
+ // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
814
+ if (getClass.call(value) == arrayClass) {
815
+ for (length = value.length; length--;) {
816
+ update(value, length, callback);
817
+ }
818
+ } else {
819
+ forEach(value, function (property) {
820
+ update(value, property, callback);
821
+ });
822
+ }
823
+ }
824
+ return callback.call(source, property, value);
825
+ };
826
+
827
+ // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
828
+ JSON3.parse = function (source, callback) {
829
+ var result, value;
830
+ Index = 0;
831
+ Source = "" + source;
832
+ result = get(lex());
833
+ // If a JSON string contains multiple tokens, it is invalid.
834
+ if (lex() != "$") {
835
+ abort();
836
+ }
837
+ // Reset the parser state.
838
+ Index = Source = null;
839
+ return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
840
+ };
841
+ }
842
+ }
843
+
844
+ // Export for asynchronous module loaders.
845
+ if (isLoader) {
846
+ define(function () {
847
+ return JSON3;
848
+ });
849
+ }
850
+ }(this));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kojac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.1
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary McGhee
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: json2-rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: jquery-rails
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -274,6 +260,7 @@ files:
274
260
  - spec/run.html
275
261
  - spec/spec.js
276
262
  - spec/support/jasmine.yml
263
+ - vendor/assets/javascripts/json3.js
277
264
  homepage: https://github.com/buzzware/KOJAC
278
265
  licenses:
279
266
  - MIT