esphinx-rails 1.1.2 → 1.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d566d1cefa1a1296f58f60c5b5d7a952f1663e53
4
- data.tar.gz: 199f1ca54abde4caf59ce392d24418df7c16d76d
3
+ metadata.gz: 2a1eb931a5add6cb29b9f6b16e539d4e9f1705d7
4
+ data.tar.gz: b077b92b26170d6ddad4a883c36dcca8d3274c44
5
5
  SHA512:
6
- metadata.gz: 475e105cfc42966a10f63b1024f75dbb50f5567a9b0423af7f4af10deecfcbe37e749048a1ffe4efee5394d1428b9439a59f2a0900f134b6da7d8aa79a062e1e
7
- data.tar.gz: d9e01840069b9c4b94804c4f0eaa69ddf97b3885134ec19f04d0e16be331baf709dca1012138c5d02895e3a46ad4e36322ab14b045bc0f6d5e4ae62efffd8399
6
+ metadata.gz: ff87486de461af49f7888fc7e51b87999c2c1c129e231c3122b7dec55be6bd46f5f6c8db9efa4c5ae126c35c6448b23b7f713ed7817a700390863ef77ffda787
7
+ data.tar.gz: 27fa98bc00024b5910af2ce9213c73b5632670a596ae47a2b4c6b32f8bb3fe739b65eb6f6ea2d6af438054e061a11089ffdc04d5bd7af428205d404d2ddd0f35
@@ -1,5 +1,6 @@
1
1
  var
2
- esPhinx;
2
+ esPhinx,
3
+ Iterable;
3
4
 
4
5
 
5
6
  (function($) {
@@ -62,7 +63,7 @@ var
62
63
  attr,
63
64
  node = this.asNode(),
64
65
 
65
- block = function(node) {
66
+ iteratorBlock = function(node) {
66
67
  node.setAttribute(attrName, value);
67
68
  };
68
69
 
@@ -71,7 +72,7 @@ var
71
72
  }
72
73
 
73
74
  if (typeof value == "boolean" || value || value === "") {
74
- this.each(block);
75
+ this.each(iteratorBlock);
75
76
 
76
77
  return this;
77
78
  } else {
@@ -88,7 +89,7 @@ var
88
89
  var
89
90
  node = this.asNode(),
90
91
 
91
- block = function(node) {
92
+ iteratorBlock = function(node) {
92
93
  node[propertyName] = value;
93
94
  };
94
95
 
@@ -97,7 +98,7 @@ var
97
98
  }
98
99
 
99
100
  if (typeof value == "boolean" || value || value === "") {
100
- this.each(block);
101
+ this.each(iteratorBlock);
101
102
 
102
103
  return this;
103
104
  } else {
@@ -141,7 +142,7 @@ var
141
142
  pattern,
142
143
  removed,
143
144
 
144
- block = function(node) {
145
+ iteratorBlock = function(node) {
145
146
  currentClassList = $(node).attribute("class");
146
147
  removed = currentClassList.replace(pattern, "");
147
148
  $(node).attribute("class", removed.replace(/( )+/g, " ")
@@ -157,7 +158,7 @@ var
157
158
  .join(")|(") + "))(?=(\\b| ))", "g");
158
159
  }
159
160
 
160
- this.each(block);
161
+ this.each(iteratorBlock);
161
162
 
162
163
  return this;
163
164
  },
@@ -167,7 +168,7 @@ var
167
168
  currentClassList,
168
169
  asString,
169
170
 
170
- block = function(node) {
171
+ iteratorBlock = function(node) {
171
172
  currentClassList = $(node).attribute("class") || "";
172
173
  $(node).attribute("class", (currentClassList + " " +
173
174
  asString).trim());
@@ -180,7 +181,7 @@ var
180
181
  asString = classList;
181
182
  }
182
183
 
183
- this.each(block);
184
+ this.each(iteratorBlock);
184
185
 
185
186
  return this;
186
187
  },
@@ -226,11 +227,11 @@ var
226
227
 
227
228
  removeAttr: function(attrName) {
228
229
  var
229
- block = function(node) {
230
+ iteratorBlock = function(node) {
230
231
  node.removeAttribute(attrName);
231
232
  };
232
233
 
233
- this.each(block);
234
+ this.each(iteratorBlock);
234
235
 
235
236
  return this;
236
237
  },
@@ -64,7 +64,8 @@ var
64
64
  mapEach = function(eventName, runOnListener, callback) {
65
65
  var
66
66
  iteratorBlock = function(node) {
67
- if (node instanceof window.Node || node == window) {
67
+ if (node instanceof window.Node || node == window ||
68
+ node == document) {
68
69
  mapEventListener(node, eventName, runOnListener);
69
70
  callback.call(node);
70
71
  }
@@ -91,7 +92,6 @@ var
91
92
 
92
93
  };
93
94
 
94
-
95
95
  mapEach.call(self, "changeNode", runOnListener,
96
96
  function() {
97
97
  $(this).observe(observeCallback);
@@ -215,7 +215,10 @@ var
215
215
  },
216
216
 
217
217
  attachedEvent: function(eventName) {
218
- if (mapped(this.asNode())[eventName]) {
218
+ var
219
+ mappedNode = mapped(this.asNode());
220
+
221
+ if (mappedNode && mappedNode[eventName]) {
219
222
  return true;
220
223
  }
221
224
 
@@ -21,7 +21,7 @@ var
21
21
  // debugger
22
22
  // if (Object.classForName(Object.className(object1))
23
23
  if (object1.constructor
24
- .implementsMethods("compareTo")) {
24
+ .implementsMethod("compareTo")) {
25
25
  return object1.compareTo(object2);
26
26
  }
27
27
  };
@@ -341,7 +341,7 @@ var
341
341
  clone = this.clone(),
342
342
  index = -1,
343
343
 
344
- block = function(v, i) {
344
+ iteratorBlock = function(v, i) {
345
345
  if (typeof v == "string" && i >= startingIndex) {
346
346
  if (v.search(regexp) != -1) {
347
347
  index = i;
@@ -374,7 +374,7 @@ var
374
374
  }
375
375
 
376
376
  iterator = Iterable.Proxy.new(this);
377
- iterator.each(block);
377
+ iterator.each(iteratorBlock);
378
378
 
379
379
  return index;
380
380
  }
@@ -33,9 +33,9 @@ var
33
33
  }
34
34
  },
35
35
 
36
- implementsMethods: {
36
+ implementsMethod: {
37
37
  value: function(name) {
38
- return Object.implementsMethods(this, name);
38
+ return Object.implementsMethod(this, name);
39
39
  }
40
40
  }
41
41
 
@@ -92,51 +92,19 @@ var
92
92
  try {
93
93
  $.defineProperties($, {
94
94
 
95
- clone: {
96
- value: function(object, includeNonEnumerable) {
97
- if (typeof includeNonEnumerable != "boolean") {
98
- includeNonEnumerable = true;
99
- }
100
-
101
- var
102
- clone = {},
103
- properties = $.getOwnPropertyNames(object),
104
-
105
- callback = function(p) {
106
- clone[p] = object[p];
107
- };
108
-
109
- if (!includeNonEnumerable) {
110
- return Object.assign(clone, object);
111
- }
112
-
113
- try {
114
- properties.forEach(callback);
115
- } catch(e) {}
116
-
117
- return clone;
118
- }
95
+ areEquivalents: {
96
+ value: areEquivalents
119
97
  },
120
98
 
121
- className: {
99
+ empty: {
122
100
  value: function(object) {
123
- var
124
- pattern = /[a-zA-Z$_][^\]]+/g,
125
- string = $.prototype.toString.call(object);
126
-
127
- if (typeof object == "object" &&
128
- $.implementsMethods(object, "toString")) {
129
- // if implements, then calls it
130
- string = object.toString();
131
- }
132
-
133
- return pattern.exec(string)[0].split(" ")[1];
101
+ return $.amount(object) === 0;
134
102
  }
135
103
  },
136
104
 
137
- classForName: {
138
- value: function(name) {
139
- return window[name];
105
+ some: {
106
+ value: function(object) {
107
+ return !$.empty(object);
140
108
  }
141
109
  },
142
110
 
@@ -191,6 +159,93 @@ var
191
159
  }
192
160
  },
193
161
 
162
+ hasAttributes: {
163
+ value: function(object, attributes) {
164
+ var
165
+ amount = 0,
166
+ argumentsAsArray = Array.from(arguments),
167
+ researchedAttributes = argumentsAsArray
168
+ .slice(1, argumentsAsArray.length);
169
+
170
+ attributes = $.attributes(object, true);
171
+
172
+ researchedAttributes.forEach(function(attribute) {
173
+ if (attributes.includes(attribute)) {
174
+ amount++;
175
+ }
176
+ });
177
+
178
+ return amount == researchedAttributes.length;
179
+ }
180
+ },
181
+
182
+ implementsMethod: {
183
+ value: function(object, methods) {
184
+ var
185
+ amount = 0,
186
+ argumentsAsArray = Array.from(arguments),
187
+ researchedMethods = argumentsAsArray
188
+ .slice(1, argumentsAsArray.length);
189
+
190
+ methods = $.methods(object);
191
+ researchedMethods.forEach(function(method) {
192
+ if (methods.includes(method)) {
193
+ amount++;
194
+ }
195
+ });
196
+
197
+ return amount == researchedMethods.length;
198
+ }
199
+ },
200
+
201
+ clone: {
202
+ value: function(object, includeNonEnumerable) {
203
+ if (typeof includeNonEnumerable != "boolean") {
204
+ includeNonEnumerable = true;
205
+ }
206
+
207
+ var
208
+ clone = {},
209
+ properties = $.getOwnPropertyNames(object),
210
+
211
+ callback = function(p) {
212
+ clone[p] = object[p];
213
+ };
214
+
215
+ if (!includeNonEnumerable) {
216
+ return Object.assign(clone, object);
217
+ }
218
+
219
+ try {
220
+ properties.forEach(callback);
221
+ } catch(e) {}
222
+
223
+ return clone;
224
+ }
225
+ },
226
+
227
+ className: {
228
+ value: function(object) {
229
+ var
230
+ pattern = /[a-zA-Z$_][^\]]+/g,
231
+ string = $.prototype.toString.call(object);
232
+
233
+ if (typeof object == "object" &&
234
+ $.implementsMethod(object, "toString")) {
235
+ // if implements, then calls it
236
+ string = object.toString();
237
+ }
238
+
239
+ return pattern.exec(string)[0].split(" ")[1];
240
+ }
241
+ },
242
+
243
+ classForName: {
244
+ value: function(name) {
245
+ return window[name];
246
+ }
247
+ },
248
+
194
249
  firstKey: {
195
250
  value: function(object) {
196
251
  var
@@ -338,18 +393,6 @@ var
338
393
  }
339
394
  },
340
395
 
341
- empty: {
342
- value: function(object) {
343
- return $.amount(object) === 0;
344
- }
345
- },
346
-
347
- some: {
348
- value: function(object) {
349
- return !$.empty(object);
350
- }
351
- },
352
-
353
396
  delete: {
354
397
  value: function(index, object) {
355
398
  if (delete object[index]) {
@@ -451,49 +494,6 @@ var
451
494
 
452
495
  return properties.difference($.attributes(object, true));
453
496
  }
454
- },
455
-
456
- hasAttributes: {
457
- value: function(object, attributes) {
458
- var
459
- amount = 0,
460
- argumentsAsArray = Array.from(arguments),
461
- researchedAttributes = argumentsAsArray
462
- .slice(1, argumentsAsArray.length);
463
-
464
- attributes = $.attributes(object, true);
465
-
466
- researchedAttributes.forEach(function(attribute) {
467
- if (attributes.includes(attribute)) {
468
- amount++;
469
- }
470
- });
471
-
472
- return amount == researchedAttributes.length;
473
- }
474
- },
475
-
476
- implementsMethods: {
477
- value: function(object, methods) {
478
- var
479
- amount = 0,
480
- argumentsAsArray = Array.from(arguments),
481
- researchedMethods = argumentsAsArray
482
- .slice(1, argumentsAsArray.length);
483
-
484
- methods = $.methods(object);
485
- researchedMethods.forEach(function(method) {
486
- if (methods.includes(method)) {
487
- amount++;
488
- }
489
- });
490
-
491
- return amount == researchedMethods.length;
492
- }
493
- },
494
-
495
- areEquivalents: {
496
- value: areEquivalents
497
497
  }
498
498
 
499
499
  });
@@ -5,6 +5,19 @@
5
5
  try {
6
6
 
7
7
  Object.defineProperties($.prototype, {
8
+
9
+ empty: {
10
+ value: function() {
11
+ return this.length === 0;
12
+ }
13
+ },
14
+
15
+ filled: {
16
+ value: function() {
17
+ return !this.empty();
18
+ }
19
+ },
20
+
8
21
  reverse: {
9
22
  value: function() {
10
23
  var
@@ -110,19 +123,8 @@
110
123
  }
111
124
  return this.slice(start, this.length);
112
125
  }
113
- },
114
-
115
- empty: {
116
- value: function() {
117
- return this.length === 0;
118
- }
119
- },
120
-
121
- filled: {
122
- value: function() {
123
- return !this.empty();
124
- }
125
126
  }
127
+
126
128
  });
127
129
 
128
130
  } catch(e) {}
@@ -19,7 +19,7 @@
19
19
  }
20
20
  } catch (e) {}
21
21
 
22
- } while (next)
22
+ } while (next);
23
23
 
24
24
  return collection;
25
25
  }
@@ -96,8 +96,8 @@ var
96
96
  },
97
97
 
98
98
  hasAnyAccessor = function(body) {
99
- return Object.implementsMethods(body, "get") ||
100
- Object.implementsMethods(body, "set");
99
+ return Object.implementsMethod(body, "get") ||
100
+ Object.implementsMethod(body, "set");
101
101
  },
102
102
 
103
103
  callback = function(body, name, trace) {
@@ -18,6 +18,24 @@ var
18
18
  // text: function() {
19
19
  // },
20
20
 
21
+ hasClass: function(classList) {
22
+ var
23
+ element = $(this.asNode()),
24
+ pattern;
25
+
26
+ if (arguments.length > 1) {
27
+ classList = Array.from(arguments);
28
+ } else {
29
+ classList = classList.split(" ");
30
+ }
31
+
32
+ pattern = new RegExp("(?=.*(\\b" + classList
33
+ .join("(?=(\\b| ))))(?=.*(\\b") +
34
+ "(?=(\\b| )))).*", "g");
35
+
36
+ return pattern.test(element.attribute("class"));
37
+ },
38
+
21
39
  insertAfter: function(element) {
22
40
  var
23
41
  elements = $(element),
@@ -177,25 +195,6 @@ var
177
195
  return this;
178
196
  },
179
197
 
180
- hasClass: function(classList) {
181
- var
182
- element = $(this.asNode()),
183
- pattern;
184
-
185
- if (arguments.length > 1) {
186
- classList = Array.from(arguments);
187
- pattern = new RegExp("(?=.*(\\b" + classList
188
- .join("(?=(\\b| ))))(?=.*(\\b") +
189
- "(?=(\\b| )))).*", "g");
190
- } else {
191
- pattern = new RegExp("(?=.*(\\b" + classList.split(" ")
192
- .join("(?=(\\b| ))))(?=.*(\\b") +
193
- "(?=(\\b| )))).*", "g");
194
- }
195
-
196
- return pattern.test(element.attribute("class"));
197
- },
198
-
199
198
  is: function(comparedNode) {
200
199
  var
201
200
  asIterable,
@@ -1,6 +1,5 @@
1
1
  var
2
- esPhinx,
3
- Iterable;
2
+ esPhinx;
4
3
 
5
4
 
6
5
  (function($) {
@@ -126,7 +125,7 @@ var
126
125
  callback = function(element) {
127
126
  var
128
127
  iteratorBlock = function(comparator) {
129
- if (element.is(comparator)) {
128
+ if ($(element).is(comparator)) {
130
129
  children.push(comparator);
131
130
  }
132
131
  };
@@ -7,6 +7,47 @@ var
7
7
 
8
8
  $.prototype.extend({
9
9
 
10
+ asArray: function() {
11
+ return Array.from(this);
12
+ },
13
+
14
+ asNode: function() {
15
+ if (this.some()) {
16
+ return this.first()[0];
17
+ }
18
+ return null;
19
+ },
20
+
21
+ textContentsAsArray: function() {
22
+ var
23
+ array = [],
24
+
25
+ callback = function(node) {
26
+ array.push($(node).text().trim());
27
+ };
28
+
29
+ this.each(callback);
30
+
31
+ return array;
32
+ },
33
+
34
+ asString: function() {
35
+ var
36
+ string = "",
37
+
38
+ callback = function(node) {
39
+ if (node instanceof window.Element) {
40
+ string += node.outerHTML + "\n";
41
+ } else if (node instanceof window.Text) {
42
+ string += node.wholeText + "\n";
43
+ }
44
+ };
45
+
46
+ this.each(callback);
47
+
48
+ return string;
49
+ },
50
+
10
51
  empty: function() {
11
52
  return this.length === 0;
12
53
  },
@@ -69,10 +110,6 @@ var
69
110
  return this.selectInBreadth(callback);
70
111
  },
71
112
 
72
- asArray: function() {
73
- return Array.from(this);
74
- },
75
-
76
113
  sort: function(compareFunction) {
77
114
  return $($.Collection.new(this).sort(compareFunction));
78
115
  },
@@ -250,13 +287,6 @@ var
250
287
  return siblings;
251
288
  },
252
289
 
253
- asNode: function() {
254
- if (this.some()) {
255
- return this.first()[0];
256
- }
257
- return null;
258
- },
259
-
260
290
  amount: function() {
261
291
  return this.length;
262
292
  },
@@ -300,23 +330,6 @@ var
300
330
  return $(this[this.lastIndex()]);
301
331
  },
302
332
 
303
- asString: function() {
304
- var
305
- string = "",
306
-
307
- callback = function(node) {
308
- if (node instanceof window.Element) {
309
- string += node.outerHTML + "\n";
310
- } else if (node instanceof window.Text) {
311
- string += node.wholeText + "\n";
312
- }
313
- };
314
-
315
- this.each(callback);
316
-
317
- return string;
318
- },
319
-
320
333
  findHasNotAttr: function(query, attr) {
321
334
  return this.find(query + ":not([" + attr + "])");
322
335
  },
@@ -325,19 +338,6 @@ var
325
338
  return this.find(query + "[" + attr + "=\"" + value + "\"]");
326
339
  },
327
340
 
328
- textContentsAsArray: function() {
329
- var
330
- array = [],
331
-
332
- callback = function(node) {
333
- array.push($(node).text().trim());
334
- };
335
-
336
- this.each(callback);
337
-
338
- return array;
339
- },
340
-
341
341
  item: function(index) {
342
342
  return $(this[index]);
343
343
  }
@@ -67,7 +67,7 @@ var
67
67
  } else if (duration.minutes) {
68
68
  options.maxAge = duration.minutes * 60;
69
69
  } else if (duration.hours) {
70
- options.maxAge = optdurationons.hours * 60 * 60;
70
+ options.maxAge = duration.hours * 60 * 60;
71
71
  } else if (duration.days) {
72
72
  options.maxAge = duration.days * 24 * 60 * 60;
73
73
  }
@@ -148,19 +148,19 @@ var
148
148
  }
149
149
 
150
150
  return "";
151
- },
151
+ }
152
152
 
153
- reset: function(key, durationOptions) {
153
+ // reset: function(key, durationOptions) {
154
154
 
155
- },
155
+ // },
156
156
 
157
- delete: function(key) {
157
+ // delete: function(key) {
158
158
 
159
- },
159
+ // },
160
160
 
161
- restart: function(key) {
161
+ // restart: function(key) {
162
162
 
163
- }
163
+ // }
164
164
 
165
165
  });
166
166
 
@@ -11,11 +11,37 @@ var
11
11
  var
12
12
  observer,
13
13
 
14
- block = function(mutations) {
15
- callback.call(observer, mutations);
14
+ resolveArguments = function() {
15
+ if (options) {
16
+ if (!options.childList ||
17
+ typeof options.childList != "boolean") {
18
+ options.childList = true;
19
+ }
20
+
21
+ if (!options.subtree ||
22
+ typeof options.subtree != "boolean") {
23
+ options.subtree = true;
24
+ }
25
+
26
+ if (!options.characterData ||
27
+ typeof options.characterData != "boolean") {
28
+ options.characterData = true;
29
+ }
30
+
31
+ // if (!options.attributes ||
32
+ // typeof options.attributes != "boolean") {
33
+ // options.attributes = false;
34
+ // }
35
+
36
+ }
16
37
  },
17
38
 
18
39
  iteratorBlock = function(node) {
40
+ var
41
+ block = function(mutations) {
42
+ callback.call(observer, mutations);
43
+ };
44
+
19
45
  observer = new window.MutationObserver(block);
20
46
 
21
47
  observer.observe(node, options);
@@ -25,28 +51,7 @@ var
25
51
  callback = options;
26
52
  }
27
53
 
28
- if (options) {
29
- if (!options.childList ||
30
- typeof options.childList != "boolean") {
31
- options.childList = true;
32
- }
33
-
34
- if (!options.subtree ||
35
- typeof options.subtree != "boolean") {
36
- options.subtree = true;
37
- }
38
-
39
- if (!options.characterData ||
40
- typeof options.characterData != "boolean") {
41
- options.characterData = true;
42
- }
43
-
44
- // if (!options.attributes ||
45
- // typeof options.attributes != "boolean") {
46
- // options.attributes = false;
47
- // }
48
-
49
- }
54
+ resolveArguments();
50
55
 
51
56
  this.each(iteratorBlock);
52
57
 
@@ -90,7 +90,7 @@ var
90
90
  return new ConstructorReference(options, callbackUntil);
91
91
  }
92
92
 
93
- resolveArguments(callbackUntil, options);
93
+ resolveArguments();
94
94
 
95
95
  start(callbackUntil, options);
96
96
 
@@ -30,7 +30,7 @@ var
30
30
  i;
31
31
 
32
32
  if (_options) {
33
- if (_options.acceptDelete == true) {
33
+ if (_options.acceptDelete === true) {
34
34
  if (isDeleteKey(e)) {
35
35
  return false;
36
36
  }
@@ -1,5 +1,5 @@
1
1
  module ESphinx
2
2
  module Rails
3
- VERSION = "1.1.2"
3
+ VERSION = "1.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esphinx-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rplaurindo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-15 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Abstraction helpers for Javascript.
14
14
  email:
@@ -60,7 +60,6 @@ files:
60
60
  - lib/assets/javascripts/esphinx/util/browser.js
61
61
  - lib/assets/javascripts/esphinx/util/cookie.js
62
62
  - lib/assets/javascripts/esphinx/util/keyboard.js
63
- - lib/assets/javascripts/esphinx/util/loader.js
64
63
  - lib/assets/javascripts/esphinx/util/observer.js
65
64
  - lib/assets/javascripts/esphinx/util/promise.js
66
65
  - lib/assets/javascripts/esphinx/util/protector.js
@@ -1,84 +0,0 @@
1
- // talvez o problema possa ser resolvido com funções assíncronas. Da atual forma não funciona porque linha por linha do arquivo é carregada sem que o outro arquivo chamado por getScript esteja carregado.
2
-
3
- var
4
- esPhinx;
5
-
6
-
7
- (function($) {
8
- "use strict";
9
-
10
- // var
11
- // // aparentemente não será necessário
12
- // promises = [],
13
-
14
- // promise = function(src) {
15
- // if (promises.indexOf(src) < 0) {
16
- // promises.unshift(src);
17
- // }
18
- // };
19
-
20
-
21
- $.extend({
22
-
23
- config: {
24
- rootPath: "/",
25
- loadPath: []
26
- },
27
-
28
- getScript: function(src) {
29
- var
30
- // script,
31
- first = $("script").first(),
32
-
33
- // resetLoadPath = function() {
34
- // $.config.loadPath = [];
35
- // },
36
-
37
- resolvePath = function(path) {
38
- return path.replace(/^\/*/, "/").replace(/\/+$/, "");
39
- },
40
-
41
- joinPaths = function(names) {
42
- var
43
- path = "",
44
- args = Array.from(arguments),
45
-
46
- callback = function(v) {
47
- path += resolvePath(v);
48
- };
49
-
50
- args.forEach(callback);
51
-
52
- return path;
53
- },
54
-
55
- withoutExtension = function(src) {
56
- return src.replace(/(\..*)/, "");
57
- },
58
-
59
- resolveSrc = function(src) {
60
- if (src.match(/(\.js)$/i)) {
61
- return src;
62
- }
63
-
64
- return src + ".js";
65
- };
66
-
67
- // o loadPath pode ser iterado para fazer a verificação
68
- src = joinPaths($.config.rootPath, withoutExtension(src));
69
-
70
- // debugger
71
- if (!$("script[src^=\"" + src + "\"]").some()) {
72
- // debugger
73
- $("<script></script>")
74
- // resolver com options
75
- // .attribute("defer", "defer")
76
- .attribute("async", "async")
77
- .attribute("src", resolveSrc(src))
78
- .insertBefore(first);
79
- }
80
- }
81
-
82
- });
83
-
84
- }(esPhinx));