upjs-rails 0.13.0 → 0.14.0
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/design/up-validate.js.coffee +4 -4
- data/dist/up.js +885 -158
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up/browser.js.coffee +7 -2
- data/lib/assets/javascripts/up/bus.js.coffee +10 -9
- data/lib/assets/javascripts/up/flow.js.coffee +13 -7
- data/lib/assets/javascripts/up/form.js.coffee +8 -2
- data/lib/assets/javascripts/up/history.js.coffee +28 -5
- data/lib/assets/javascripts/up/layout.js.coffee +19 -12
- data/lib/assets/javascripts/up/link.js.coffee +16 -7
- data/lib/assets/javascripts/up/modal.js.coffee +24 -6
- data/lib/assets/javascripts/up/motion.js.coffee +10 -3
- data/lib/assets/javascripts/up/navigation.js.coffee +2 -0
- data/lib/assets/javascripts/up/popup.js.coffee +9 -2
- data/lib/assets/javascripts/up/proxy.js.coffee +47 -9
- data/lib/assets/javascripts/up/syntax.js.coffee +7 -6
- data/lib/assets/javascripts/up/tooltip.js.coffee +6 -0
- data/lib/assets/javascripts/up/util.js.coffee +613 -95
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/Gemfile +6 -0
- data/spec_app/Gemfile.lock +18 -13
- data/spec_app/spec/javascripts/helpers/to_end_with.js.coffee +4 -1
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +0 -2
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +6 -6
- metadata +2 -2
@@ -84,7 +84,6 @@ up.layout = (($) ->
|
|
84
84
|
is called a second time, the previous animation will instantly jump to the
|
85
85
|
last frame before the next animation is started.
|
86
86
|
|
87
|
-
@protected
|
88
87
|
@function up.scroll
|
89
88
|
@param {String|Element|jQuery} viewport
|
90
89
|
The container element to scroll.
|
@@ -96,6 +95,7 @@ up.layout = (($) ->
|
|
96
95
|
The timing function that controls the acceleration for the scrolling's animation.
|
97
96
|
@return {Deferred}
|
98
97
|
A promise that will be resolved when the scrolling ends.
|
98
|
+
@experimental
|
99
99
|
###
|
100
100
|
scroll = (viewport, scrollTop, options) ->
|
101
101
|
$viewport = $(viewport)
|
@@ -134,7 +134,9 @@ up.layout = (($) ->
|
|
134
134
|
|
135
135
|
###*
|
136
136
|
@function up.layout.finishScrolling
|
137
|
-
@
|
137
|
+
@param {String|Element|jQuery}
|
138
|
+
The element that might currently be scrolling.
|
139
|
+
@internal
|
138
140
|
###
|
139
141
|
finishScrolling = (elementOrSelector) ->
|
140
142
|
$(elementOrSelector).each ->
|
@@ -143,7 +145,7 @@ up.layout = (($) ->
|
|
143
145
|
|
144
146
|
###*
|
145
147
|
@function up.layout.anchoredRight
|
146
|
-
@
|
148
|
+
@internal
|
147
149
|
###
|
148
150
|
anchoredRight = ->
|
149
151
|
u.multiSelector(config.anchoredRight).select()
|
@@ -205,6 +207,7 @@ up.layout = (($) ->
|
|
205
207
|
with the top edge of the viewport.
|
206
208
|
@return {Deferred}
|
207
209
|
A promise that will be resolved when the element is revealed.
|
210
|
+
@stable
|
208
211
|
###
|
209
212
|
reveal = (elementOrSelector, options) ->
|
210
213
|
u.debug('Revealing %o', elementOrSelector)
|
@@ -268,9 +271,9 @@ up.layout = (($) ->
|
|
268
271
|
|
269
272
|
Throws an error if no viewport could be found.
|
270
273
|
|
271
|
-
@protected
|
272
274
|
@function up.layout.viewportOf
|
273
275
|
@param {String|Element|jQuery} selectorOrElement
|
276
|
+
@internal
|
274
277
|
###
|
275
278
|
viewportOf = (selectorOrElement) ->
|
276
279
|
$element = $(selectorOrElement)
|
@@ -282,10 +285,10 @@ up.layout = (($) ->
|
|
282
285
|
Returns a jQuery collection of all the viewports contained within the
|
283
286
|
given selector or element.
|
284
287
|
|
285
|
-
@protected
|
286
288
|
@function up.layout.viewportsWithin
|
287
289
|
@param {String|Element|jQuery} selectorOrElement
|
288
290
|
@return jQuery
|
291
|
+
@internal
|
289
292
|
###
|
290
293
|
viewportsWithin = (selectorOrElement) ->
|
291
294
|
$element = $(selectorOrElement)
|
@@ -294,8 +297,8 @@ up.layout = (($) ->
|
|
294
297
|
###*
|
295
298
|
Returns a jQuery collection of all the viewports on the screen.
|
296
299
|
|
297
|
-
@protected
|
298
300
|
@function up.layout.viewports
|
301
|
+
@internal
|
299
302
|
###
|
300
303
|
viewports = ->
|
301
304
|
viewportSelector().select()
|
@@ -311,7 +314,7 @@ up.layout = (($) ->
|
|
311
314
|
|
312
315
|
@function up.layout.scrollTops
|
313
316
|
@return Object<String, Number>
|
314
|
-
@
|
317
|
+
@internal
|
315
318
|
###
|
316
319
|
scrollTops = ->
|
317
320
|
topsBySelector = {}
|
@@ -325,7 +328,7 @@ up.layout = (($) ->
|
|
325
328
|
|
326
329
|
###*
|
327
330
|
@function up.layout.fixedChildren
|
328
|
-
@
|
331
|
+
@internal
|
329
332
|
###
|
330
333
|
fixedChildren = (root = undefined) ->
|
331
334
|
root ||= document.body
|
@@ -348,7 +351,7 @@ up.layout = (($) ->
|
|
348
351
|
@function up.layout.saveScroll
|
349
352
|
@param {String} [options.url]
|
350
353
|
@param {Object<String, Number>} [options.tops]
|
351
|
-
@
|
354
|
+
@experimental
|
352
355
|
###
|
353
356
|
saveScroll = (options = {}) ->
|
354
357
|
url = u.option(options.url, up.history.url())
|
@@ -367,7 +370,7 @@ up.layout = (($) ->
|
|
367
370
|
@param {jQuery} [options.around]
|
368
371
|
If set, only restores viewports that are either an ancestor
|
369
372
|
or descendant of the given element.
|
370
|
-
@
|
373
|
+
@experimental
|
371
374
|
###
|
372
375
|
restoreScroll = (options = {}) ->
|
373
376
|
|
@@ -396,9 +399,10 @@ up.layout = (($) ->
|
|
396
399
|
u.resolvedDeferred()
|
397
400
|
|
398
401
|
###*
|
399
|
-
@protected
|
400
402
|
@function up.layout.revealOrRestoreScroll
|
401
|
-
@return {Deferred}
|
403
|
+
@return {Deferred}
|
404
|
+
A promise for when the revealing or scroll restauration ends
|
405
|
+
@internal
|
402
406
|
###
|
403
407
|
revealOrRestoreScroll = (selectorOrElement, options) ->
|
404
408
|
$element = $(selectorOrElement)
|
@@ -466,6 +470,7 @@ up.layout = (($) ->
|
|
466
470
|
</div>
|
467
471
|
|
468
472
|
@selector [up-viewport]
|
473
|
+
@stable
|
469
474
|
###
|
470
475
|
|
471
476
|
###*
|
@@ -480,6 +485,7 @@ up.layout = (($) ->
|
|
480
485
|
<div class="top-nav" up-fixed="top">...</div>
|
481
486
|
|
482
487
|
@selector [up-fixed=top]
|
488
|
+
@stable
|
483
489
|
###
|
484
490
|
|
485
491
|
###*
|
@@ -494,6 +500,7 @@ up.layout = (($) ->
|
|
494
500
|
<div class="bottom-nav" up-fixed="bottom">...</div>
|
495
501
|
|
496
502
|
@selector [up-fixed=bottom]
|
503
|
+
@stable
|
497
504
|
###
|
498
505
|
|
499
506
|
up.on 'up:framework:reset', reset
|
@@ -102,6 +102,7 @@ up.link = (($) ->
|
|
102
102
|
The selector to replace.
|
103
103
|
@param {Object} options
|
104
104
|
See options for [`up.replace`](/up.replace)
|
105
|
+
@stable
|
105
106
|
###
|
106
107
|
visit = (url, options) ->
|
107
108
|
options = u.options(options)
|
@@ -149,6 +150,10 @@ up.link = (($) ->
|
|
149
150
|
@param {Object} [options.headers={}]
|
150
151
|
An object of additional header key/value pairs to send along
|
151
152
|
with the request.
|
153
|
+
@return {Promise}
|
154
|
+
A promise that will be resolved when the link destination
|
155
|
+
has been loaded and rendered.
|
156
|
+
@stable
|
152
157
|
###
|
153
158
|
follow = (linkOrSelector, options) ->
|
154
159
|
$link = $(linkOrSelector)
|
@@ -171,12 +176,12 @@ up.link = (($) ->
|
|
171
176
|
Returns the HTTP method that should be used when following the given link.
|
172
177
|
|
173
178
|
Looks at the link's `up-method` or `data-method` attribute.
|
174
|
-
Defaults to `get`.
|
179
|
+
Defaults to `"get"`.
|
175
180
|
|
176
|
-
@protected
|
177
181
|
@function up.link.followMethod
|
178
182
|
@param linkOrSelector
|
179
183
|
@param options.method {String}
|
184
|
+
@internal
|
180
185
|
###
|
181
186
|
followMethod = (linkOrSelector, options) ->
|
182
187
|
$link = $(linkOrSelector)
|
@@ -245,6 +250,7 @@ up.link = (($) ->
|
|
245
250
|
Whether to force the use of a cached response (`true`)
|
246
251
|
or never use the cache (`false`)
|
247
252
|
or make an educated guess (`undefined`).
|
253
|
+
@stable
|
248
254
|
###
|
249
255
|
up.on 'click', 'a[up-target], [up-href][up-target]', (event, $link) ->
|
250
256
|
if shouldProcessLinkEvent(event, $link)
|
@@ -273,6 +279,7 @@ up.link = (($) ->
|
|
273
279
|
systems switch tabs on `mousedown` instead of `click`.
|
274
280
|
|
275
281
|
@selector a[up-instant]
|
282
|
+
@stable
|
276
283
|
###
|
277
284
|
up.on 'mousedown', 'a[up-instant], [up-href][up-instant]', (event, $link) ->
|
278
285
|
if shouldProcessLinkEvent(event, $link)
|
@@ -281,7 +288,7 @@ up.link = (($) ->
|
|
281
288
|
|
282
289
|
###*
|
283
290
|
@function up.link.childClicked
|
284
|
-
@
|
291
|
+
@internal
|
285
292
|
###
|
286
293
|
childClicked = (event, $link) ->
|
287
294
|
$target = $(event.target)
|
@@ -295,10 +302,10 @@ up.link = (($) ->
|
|
295
302
|
Makes sure that the given link is handled by Up.js.
|
296
303
|
|
297
304
|
This is done by giving the link an `up-follow` attribute
|
298
|
-
|
305
|
+
unless it already have it an `up-target` or `up-follow` attribute.
|
299
306
|
|
300
307
|
@function up.link.makeFollowable
|
301
|
-
@
|
308
|
+
@internal
|
302
309
|
###
|
303
310
|
makeFollowable = (link) ->
|
304
311
|
$link = $(link)
|
@@ -313,8 +320,7 @@ up.link = (($) ->
|
|
313
320
|
|
314
321
|
<a href="/users" up-follow>User list</a>
|
315
322
|
|
316
|
-
To only update a fragment instead of the entire page,
|
317
|
-
see [`up-target`](/up-target).
|
323
|
+
To only update a fragment instead of the entire page, see [`up-target`](/up-target).
|
318
324
|
|
319
325
|
\#\#\#\# Turn any element into a link
|
320
326
|
|
@@ -333,6 +339,7 @@ up.link = (($) ->
|
|
333
339
|
@param [up-restore-scroll='false']
|
334
340
|
Whether to restore the scroll position of all viewports
|
335
341
|
within the response.
|
342
|
+
@stable
|
336
343
|
###
|
337
344
|
up.on 'click', 'a[up-follow], [up-href][up-follow]', (event, $link) ->
|
338
345
|
if shouldProcessLinkEvent(event, $link)
|
@@ -360,6 +367,7 @@ up.link = (($) ->
|
|
360
367
|
(`up-target`, `up-instant`, `up-preload`, etc.).
|
361
368
|
|
362
369
|
@selector [up-expand]
|
370
|
+
@stable
|
363
371
|
###
|
364
372
|
up.compiler '[up-expand]', ($area) ->
|
365
373
|
link = $area.find('a, [up-href]').get(0)
|
@@ -392,6 +400,7 @@ up.link = (($) ->
|
|
392
400
|
<a href="/users" up-target=".main" up-instant up-preload>User list</a>
|
393
401
|
|
394
402
|
@selector [up-dash]
|
403
|
+
@stable
|
395
404
|
###
|
396
405
|
up.compiler '[up-dash]', ($element) ->
|
397
406
|
target = u.castedAttr($element, 'up-dash')
|
@@ -119,6 +119,7 @@ up.modal = (($) ->
|
|
119
119
|
@function up.modal.url
|
120
120
|
@return {String}
|
121
121
|
the source URL
|
122
|
+
@stable
|
122
123
|
###
|
123
124
|
currentUrl = undefined
|
124
125
|
|
@@ -127,7 +128,7 @@ up.modal = (($) ->
|
|
127
128
|
|
128
129
|
@function up.modal.coveredUrl
|
129
130
|
@return {String}
|
130
|
-
@
|
131
|
+
@experimental
|
131
132
|
###
|
132
133
|
coveredUrl = ->
|
133
134
|
$modal = $('.up-modal')
|
@@ -238,7 +239,8 @@ up.modal = (($) ->
|
|
238
239
|
@param {String} [options.easing]
|
239
240
|
The timing function that controls the animation's acceleration. [`up.animate`](/up.animate).
|
240
241
|
@return {Promise}
|
241
|
-
A promise that will be resolved when the
|
242
|
+
A promise that will be resolved when the popup has been loaded and rendered.
|
243
|
+
@stable
|
242
244
|
###
|
243
245
|
follow = (linkOrSelector, options) ->
|
244
246
|
options = u.options(options)
|
@@ -265,6 +267,9 @@ up.modal = (($) ->
|
|
265
267
|
The extracted content will be placed into the dialog window.
|
266
268
|
@param {Object} options
|
267
269
|
See options for [previous `up.modal.open` variant](/up.modal.open).
|
270
|
+
@return {Promise}
|
271
|
+
A promise that will be resolved when the popup has been loaded and rendered.
|
272
|
+
@stable
|
268
273
|
###
|
269
274
|
visit = (url, options) ->
|
270
275
|
options = u.options(options)
|
@@ -272,12 +277,12 @@ up.modal = (($) ->
|
|
272
277
|
open(options)
|
273
278
|
|
274
279
|
###*
|
275
|
-
@function
|
276
|
-
@
|
280
|
+
@function open
|
281
|
+
@internal
|
277
282
|
###
|
278
283
|
open = (options) ->
|
279
284
|
options = u.options(options)
|
280
|
-
$link = u.option(options.$link, u.
|
285
|
+
$link = u.option(options.$link, u.nullJQuery())
|
281
286
|
url = u.option(options.url, $link.attr('up-href'), $link.attr('href'))
|
282
287
|
selector = u.option(options.target, $link.attr('up-modal'), 'body')
|
283
288
|
width = u.option(options.width, $link.attr('up-width'), config.width)
|
@@ -314,12 +319,14 @@ up.modal = (($) ->
|
|
314
319
|
@event up:modal:open
|
315
320
|
@param event.preventDefault()
|
316
321
|
Event listeners may call this method to prevent the modal from opening.
|
322
|
+
@stable
|
317
323
|
###
|
318
324
|
|
319
325
|
###*
|
320
326
|
This event is [emitted](/up.emit) when a modal dialog has finished opening.
|
321
327
|
|
322
328
|
@event up:modal:opened
|
329
|
+
@stable
|
323
330
|
###
|
324
331
|
|
325
332
|
###*
|
@@ -331,6 +338,7 @@ up.modal = (($) ->
|
|
331
338
|
@function up.modal.close
|
332
339
|
@param {Object} options
|
333
340
|
See options for [`up.animate`](/up.animate)
|
341
|
+
@stable
|
334
342
|
###
|
335
343
|
close = (options) ->
|
336
344
|
$modal = $('.up-modal')
|
@@ -361,6 +369,7 @@ up.modal = (($) ->
|
|
361
369
|
@event up:modal:close
|
362
370
|
@param event.preventDefault()
|
363
371
|
Event listeners may call this method to prevent the modal from closing.
|
372
|
+
@stable
|
364
373
|
###
|
365
374
|
|
366
375
|
###*
|
@@ -368,6 +377,7 @@ up.modal = (($) ->
|
|
368
377
|
is done [closing](/up.modal.close).
|
369
378
|
|
370
379
|
@event up:modal:closed
|
380
|
+
@stable
|
371
381
|
###
|
372
382
|
|
373
383
|
autoclose = ->
|
@@ -381,7 +391,7 @@ up.modal = (($) ->
|
|
381
391
|
|
382
392
|
@function up.modal.contains
|
383
393
|
@param {String} elementOrSelector
|
384
|
-
@
|
394
|
+
@stable
|
385
395
|
###
|
386
396
|
contains = (elementOrSelector) ->
|
387
397
|
$element = $(elementOrSelector)
|
@@ -406,6 +416,7 @@ up.modal = (($) ->
|
|
406
416
|
@param [up-height]
|
407
417
|
@param [up-width]
|
408
418
|
@param [up-history]
|
419
|
+
@stable
|
409
420
|
###
|
410
421
|
up.on('click', 'a[up-modal]', (event, $link) ->
|
411
422
|
event.preventDefault()
|
@@ -436,9 +447,16 @@ up.modal = (($) ->
|
|
436
447
|
|
437
448
|
###*
|
438
449
|
When this element is clicked, closes a currently open dialog.
|
450
|
+
|
439
451
|
Does nothing if no modal is currently open.
|
440
452
|
|
453
|
+
To make a link that closes the current modal, but follows to
|
454
|
+
a fallback destination if no modal is open:
|
455
|
+
|
456
|
+
<a href="/fallback" up-close>Okay</a>
|
457
|
+
|
441
458
|
@selector [up-close]
|
459
|
+
@stable
|
442
460
|
###
|
443
461
|
up.on('click', '[up-close]', (event, $element) ->
|
444
462
|
if $element.closest('.up-modal').length
|
@@ -122,6 +122,7 @@ up.motion = (($) ->
|
|
122
122
|
for a list of pre-defined timing functions.
|
123
123
|
@return {Promise}
|
124
124
|
A promise for the animation's end.
|
125
|
+
@stable
|
125
126
|
###
|
126
127
|
animate = (elementOrSelector, animation, options) ->
|
127
128
|
$element = $(elementOrSelector)
|
@@ -143,8 +144,8 @@ up.motion = (($) ->
|
|
143
144
|
If `$element` is given, also inspects the element for animation-related
|
144
145
|
attributes like `up-easing` or `up-duration`.
|
145
146
|
|
146
|
-
@protected
|
147
147
|
@function up.motion.animateOptions
|
148
|
+
@internal
|
148
149
|
###
|
149
150
|
animateOptions = (allOptions, $element = null) ->
|
150
151
|
allOptions = u.options(allOptions)
|
@@ -227,6 +228,7 @@ up.motion = (($) ->
|
|
227
228
|
|
228
229
|
@function up.motion.finish
|
229
230
|
@param {Element|jQuery|String} elementOrSelector
|
231
|
+
@stable
|
230
232
|
###
|
231
233
|
finish = (elementOrSelector) ->
|
232
234
|
$(elementOrSelector).each ->
|
@@ -306,6 +308,7 @@ up.motion = (($) ->
|
|
306
308
|
Whether to reveal the new element by scrolling its parent viewport.
|
307
309
|
@return {Promise}
|
308
310
|
A promise for the transition's end.
|
311
|
+
@stable
|
309
312
|
###
|
310
313
|
morph = (source, target, transitionOrName, options) ->
|
311
314
|
|
@@ -347,7 +350,7 @@ up.motion = (($) ->
|
|
347
350
|
We use this to skip morphing for old browsers, or when the developer
|
348
351
|
decides to only animate the new element (i.e. no real ghosting or transition) .
|
349
352
|
|
350
|
-
@
|
353
|
+
@internal
|
351
354
|
###
|
352
355
|
skipMorph = ($old, $new, options) ->
|
353
356
|
# Simply hide the old element, which would be the side effect of withGhosts(...) below.
|
@@ -357,7 +360,7 @@ up.motion = (($) ->
|
|
357
360
|
up.layout.revealOrRestoreScroll($new, options)
|
358
361
|
|
359
362
|
###*
|
360
|
-
@
|
363
|
+
@internal
|
361
364
|
###
|
362
365
|
prependCopy = ($element, $viewport) ->
|
363
366
|
elementDims = u.measure($element, relative: true, inner: true)
|
@@ -437,6 +440,7 @@ up.motion = (($) ->
|
|
437
440
|
@function up.transition
|
438
441
|
@param {String} name
|
439
442
|
@param {Function} transition
|
443
|
+
@stable
|
440
444
|
###
|
441
445
|
transition = (name, transition) ->
|
442
446
|
transitions[name] = transition
|
@@ -470,6 +474,7 @@ up.motion = (($) ->
|
|
470
474
|
@function up.animation
|
471
475
|
@param {String} name
|
472
476
|
@param {Function} animation
|
477
|
+
@stable
|
473
478
|
###
|
474
479
|
animation = (name, animation) ->
|
475
480
|
animations[name] = animation
|
@@ -488,6 +493,7 @@ up.motion = (($) ->
|
|
488
493
|
@function up.motion.when
|
489
494
|
@param promises...
|
490
495
|
@return A new promise.
|
496
|
+
@experimental
|
491
497
|
###
|
492
498
|
resolvableWhen = u.resolvableWhen
|
493
499
|
|
@@ -498,6 +504,7 @@ up.motion = (($) ->
|
|
498
504
|
@function up.motion.none
|
499
505
|
@return {Promise}
|
500
506
|
A resolved promise
|
507
|
+
@stable
|
501
508
|
###
|
502
509
|
none = u.resolvedDeferred
|
503
510
|
|
@@ -126,6 +126,7 @@ up.navigation = (($) ->
|
|
126
126
|
<a href="/foo" up-follow up-current>Foo</a>
|
127
127
|
|
128
128
|
@selector [up-active]
|
129
|
+
@stable
|
129
130
|
###
|
130
131
|
sectionClicked = ($section) ->
|
131
132
|
unmarkActive()
|
@@ -188,6 +189,7 @@ up.navigation = (($) ->
|
|
188
189
|
<a href="/reports" up-alias="/reports/*">Reports</a>
|
189
190
|
|
190
191
|
@selector [up-current]
|
192
|
+
@stable
|
191
193
|
###
|
192
194
|
up.on 'up:fragment:inserted', ->
|
193
195
|
# If a new fragment is inserted, it's likely to be the result
|
@@ -56,6 +56,7 @@ up.popup = (($) ->
|
|
56
56
|
@function up.popup.url
|
57
57
|
@return {String}
|
58
58
|
the source URL
|
59
|
+
@stable
|
59
60
|
###
|
60
61
|
currentUrl = undefined
|
61
62
|
|
@@ -64,7 +65,7 @@ up.popup = (($) ->
|
|
64
65
|
|
65
66
|
@function up.popup.coveredUrl
|
66
67
|
@return {String}
|
67
|
-
@
|
68
|
+
@experimental
|
68
69
|
###
|
69
70
|
coveredUrl = ->
|
70
71
|
$popup = $('.up-popup')
|
@@ -183,6 +184,9 @@ up.popup = (($) ->
|
|
183
184
|
If set to `true`, the popup remains
|
184
185
|
open even if the page changes in the background.
|
185
186
|
@param {Object} [options.history=false]
|
187
|
+
@return {Promise}
|
188
|
+
A promise that will be resolved when the popup has been loaded and rendered.
|
189
|
+
@stable
|
186
190
|
###
|
187
191
|
attach = (linkOrSelector, options) ->
|
188
192
|
$link = $(linkOrSelector)
|
@@ -211,6 +215,7 @@ up.popup = (($) ->
|
|
211
215
|
@function up.popup.close
|
212
216
|
@param {Object} options
|
213
217
|
See options for [`up.animate`](/up.animate).
|
218
|
+
@stable
|
214
219
|
###
|
215
220
|
close = (options) ->
|
216
221
|
$popup = $('.up-popup')
|
@@ -236,7 +241,7 @@ up.popup = (($) ->
|
|
236
241
|
|
237
242
|
@methods up.popup.contains
|
238
243
|
@param {String} elementOrSelector
|
239
|
-
@
|
244
|
+
@stable
|
240
245
|
###
|
241
246
|
contains = (elementOrSelector) ->
|
242
247
|
$element = $(elementOrSelector)
|
@@ -256,6 +261,7 @@ up.popup = (($) ->
|
|
256
261
|
@selector a[up-popup]
|
257
262
|
@param [up-sticky]
|
258
263
|
@param [up-position]
|
264
|
+
@stable
|
259
265
|
###
|
260
266
|
up.on('click', 'a[up-popup]', (event, $link) ->
|
261
267
|
event.preventDefault()
|
@@ -289,6 +295,7 @@ up.popup = (($) ->
|
|
289
295
|
a currently open popup is closed.
|
290
296
|
|
291
297
|
@selector [up-close]
|
298
|
+
@stable
|
292
299
|
###
|
293
300
|
up.on('click', '[up-close]', (event, $element) ->
|
294
301
|
if $element.closest('.up-popup').length
|
@@ -100,8 +100,15 @@ up.proxy = (($) ->
|
|
100
100
|
|
101
101
|
|
102
102
|
###*
|
103
|
-
|
103
|
+
Returns a cached response for the given request.
|
104
|
+
|
105
|
+
Returns `undefined` if the given request is not currently cached.
|
106
|
+
|
104
107
|
@function up.proxy.get
|
108
|
+
@return {Promise}
|
109
|
+
A promise for the response that is API-compatible with the
|
110
|
+
promise returned by [`jQuery.ajax`](http://api.jquery.com/jquery.ajax/).
|
111
|
+
@experimental
|
105
112
|
###
|
106
113
|
get = (request) ->
|
107
114
|
request = normalizeRequest(request)
|
@@ -117,21 +124,41 @@ up.proxy = (($) ->
|
|
117
124
|
return response
|
118
125
|
|
119
126
|
###*
|
120
|
-
|
127
|
+
Manually stores a promise for the response to the given request.
|
128
|
+
|
121
129
|
@function up.proxy.set
|
130
|
+
@param {String} request.url
|
131
|
+
@param {String} [request.method='GET']
|
132
|
+
@param {String} [request.selector='body']
|
133
|
+
@param {Promise} response
|
134
|
+
A promise for the response that is API-compatible with the
|
135
|
+
promise returned by [`jQuery.ajax`](http://api.jquery.com/jquery.ajax/).
|
136
|
+
@experimental
|
122
137
|
###
|
123
138
|
set = cache.set
|
124
139
|
|
125
140
|
###*
|
126
|
-
|
141
|
+
Manually removes the given request from the cache.
|
142
|
+
|
143
|
+
You can also [configure](/up.proxy.config) when the proxy
|
144
|
+
automatically removes cache entries.
|
145
|
+
|
127
146
|
@function up.proxy.remove
|
147
|
+
@param {String} request.url
|
148
|
+
@param {String} [request.method='GET']
|
149
|
+
@param {String} [request.selector='body']
|
150
|
+
@experimental
|
128
151
|
###
|
129
152
|
remove = cache.remove
|
130
153
|
|
131
154
|
###*
|
132
155
|
Removes all cache entries.
|
133
156
|
|
157
|
+
Up.js also automatically clears the cache whenever it processes
|
158
|
+
a request with a non-GET HTTP method.
|
159
|
+
|
134
160
|
@function up.proxy.clear
|
161
|
+
@stable
|
135
162
|
###
|
136
163
|
clear = cache.clear
|
137
164
|
|
@@ -181,13 +208,17 @@ up.proxy = (($) ->
|
|
181
208
|
@function up.proxy.ajax
|
182
209
|
@param {String} request.url
|
183
210
|
@param {String} [request.method='GET']
|
184
|
-
@param {String} [request.selector]
|
211
|
+
@param {String} [request.selector='body']
|
185
212
|
@param {Boolean} [request.cache]
|
186
213
|
Whether to use a cached response, if available.
|
187
214
|
If set to `false` a network connection will always be attempted.
|
188
215
|
@param {Object} [request.headers={}]
|
189
216
|
An object of additional header key/value pairs to send along
|
190
217
|
with the request.
|
218
|
+
@return
|
219
|
+
A promise for the response that is API-compatible with the
|
220
|
+
promise returned by [`jQuery.ajax`](http://api.jquery.com/jquery.ajax/).
|
221
|
+
@stable
|
191
222
|
###
|
192
223
|
ajax = (options) ->
|
193
224
|
|
@@ -239,7 +270,9 @@ up.proxy = (($) ->
|
|
239
270
|
used to busy, but is now idle.
|
240
271
|
|
241
272
|
@function up.proxy.idle
|
242
|
-
@return {Boolean}
|
273
|
+
@return {Boolean}
|
274
|
+
Whether the proxy is idle
|
275
|
+
@experimental
|
243
276
|
###
|
244
277
|
idle = ->
|
245
278
|
pendingCount == 0
|
@@ -252,7 +285,9 @@ up.proxy = (($) ->
|
|
252
285
|
used to be idle, but is now busy.
|
253
286
|
|
254
287
|
@function up.proxy.busy
|
255
|
-
@return {Boolean}
|
288
|
+
@return {Boolean}
|
289
|
+
Whether the proxy is busy
|
290
|
+
@experimental
|
256
291
|
###
|
257
292
|
busy = ->
|
258
293
|
pendingCount > 0
|
@@ -288,6 +323,7 @@ up.proxy = (($) ->
|
|
288
323
|
waiting, **no** additional `up:proxy:busy` events will be triggered.
|
289
324
|
|
290
325
|
@event up:proxy:busy
|
326
|
+
@stable
|
291
327
|
###
|
292
328
|
|
293
329
|
loadEnded = ->
|
@@ -301,6 +337,7 @@ up.proxy = (($) ->
|
|
301
337
|
have [taken long to finish](/up:proxy:busy), but have finished now.
|
302
338
|
|
303
339
|
@event up:proxy:idle
|
340
|
+
@stable
|
304
341
|
###
|
305
342
|
|
306
343
|
load = (request) ->
|
@@ -315,10 +352,10 @@ up.proxy = (($) ->
|
|
315
352
|
is starting to load.
|
316
353
|
|
317
354
|
@event up:proxy:load
|
318
|
-
@protected
|
319
355
|
@param event.url
|
320
356
|
@param event.method
|
321
357
|
@param event.selector
|
358
|
+
@experimental
|
322
359
|
###
|
323
360
|
|
324
361
|
###*
|
@@ -326,10 +363,10 @@ up.proxy = (($) ->
|
|
326
363
|
has been received.
|
327
364
|
|
328
365
|
@event up:proxy:received
|
329
|
-
@protected
|
330
366
|
@param event.url
|
331
367
|
@param event.method
|
332
368
|
@param event.selector
|
369
|
+
@experimental
|
333
370
|
###
|
334
371
|
|
335
372
|
isIdempotent = (request) ->
|
@@ -350,12 +387,12 @@ up.proxy = (($) ->
|
|
350
387
|
preloadDelayTimer = setTimeout(block, delay)
|
351
388
|
|
352
389
|
###*
|
353
|
-
@protected
|
354
390
|
@function up.proxy.preload
|
355
391
|
@param {String|Element|jQuery}
|
356
392
|
The element whose destination should be preloaded.
|
357
393
|
@return
|
358
394
|
A promise that will be resolved when the request was loaded and cached
|
395
|
+
@stable
|
359
396
|
###
|
360
397
|
preload = (linkOrSelector, options) ->
|
361
398
|
$link = $(linkOrSelector)
|
@@ -382,6 +419,7 @@ up.proxy = (($) ->
|
|
382
419
|
The number of milliseconds to wait between hovering
|
383
420
|
and preloading. Increasing this will lower the load in your server,
|
384
421
|
but will also make the interaction feel less instant.
|
422
|
+
@stable
|
385
423
|
###
|
386
424
|
up.on 'mouseover mousedown touchstart', '[up-preload]', (event, $element) ->
|
387
425
|
# Don't do anything if we are hovering over the child
|