unpoly-rails 0.31.2 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +49 -5
- data/README.md +21 -15
- data/README_RAILS.md +2 -2
- data/Rakefile +1 -1
- data/bower.json +4 -3
- data/design/homepage.txt +2 -2
- data/dist/unpoly-bootstrap3.css +3 -0
- data/dist/unpoly-bootstrap3.min.css +1 -1
- data/dist/unpoly.css +4 -4
- data/dist/unpoly.js +114 -80
- data/dist/unpoly.min.css +1 -1
- data/dist/unpoly.min.js +3 -3
- data/lib/assets/javascripts/unpoly/browser.js.coffee +1 -1
- data/lib/assets/javascripts/unpoly/bus.js.coffee +3 -3
- data/lib/assets/javascripts/unpoly/flow.js.coffee +15 -11
- data/lib/assets/javascripts/unpoly/form.js.coffee +1 -1
- data/lib/assets/javascripts/unpoly/layout.js.coffee +12 -9
- data/lib/assets/javascripts/unpoly/link.js.coffee +22 -7
- data/lib/assets/javascripts/unpoly/log.js.coffee +3 -2
- data/lib/assets/javascripts/unpoly/modal.js.coffee +11 -13
- data/lib/assets/javascripts/unpoly/motion.js.coffee +1 -1
- data/lib/assets/javascripts/unpoly/navigation.js.coffee +5 -5
- data/lib/assets/javascripts/unpoly/popup.js.coffee +8 -9
- data/lib/assets/javascripts/unpoly/proxy.js.coffee +2 -2
- data/lib/assets/javascripts/unpoly/syntax.js.coffee +19 -15
- data/lib/assets/javascripts/unpoly/util.js.coffee +19 -3
- data/lib/assets/stylesheets/unpoly-bootstrap3/modal-ext.css.sass +6 -1
- data/lib/assets/stylesheets/unpoly/modal.css.sass +7 -2
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +2 -2
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/app/assets/javascripts/bootstrap_manifest.coffee +2 -2
- data/spec_app/app/views/css_test/modal.erb +4 -0
- data/spec_app/app/views/css_test/modal_contents_wide.erb +5 -0
- data/spec_app/app/views/layouts/integration_test.erb +1 -0
- data/spec_app/spec/javascripts/helpers/knife.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/browser_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/bus_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +63 -5
- data/spec_app/spec/javascripts/up/form_spec.js.coffee +2 -2
- data/spec_app/spec/javascripts/up/history_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/layout_spec.js.coffee +27 -1
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +3 -3
- data/spec_app/spec/javascripts/up/log_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +3 -3
- data/spec_app/spec/javascripts/up/motion_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +21 -3
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/syntax_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/tooltip_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +2 -2
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/README.md +2 -2
- data/unpoly-rails.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d773b2af12e832d7e2181a1df6d423e80efac985
|
4
|
+
data.tar.gz: c5edb394c1cba8008299c76039ccbb817a582ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c53329553146e3b4cdb9c70534e323ffe236b744260191ab615f637ee1838ebdaa5d45784e386382cddd74a5c23cd4e05a1e0eed0fd7307c006530c474d84b14
|
7
|
+
data.tar.gz: 842425dd5b9dfc1053213ad42caf5264588c46d5a51ed1d416c085790657ebf7ef72924ed142dbb747a868684af163db5b6bac4d8d841bb86e92853702ce199d
|
data/CHANGELOG.md
CHANGED
@@ -10,7 +10,53 @@ Unreleased
|
|
10
10
|
|
11
11
|
### Compatible changes
|
12
12
|
|
13
|
-
|
13
|
+
|
14
|
+
### Breaking changes
|
15
|
+
|
16
|
+
|
17
|
+
Unreleased
|
18
|
+
----------
|
19
|
+
|
20
|
+
### Compatible changes
|
21
|
+
|
22
|
+
- Fix a bug where morphing an [`[up-keep]`](/up-keep) element with a destructor would throw an error.
|
23
|
+
- Fix a bug where an [`[up-keep]`](/up-keep) element would lose its jQuery event handlers when it was kept.
|
24
|
+
- Fix a bug where [`up.log.disable()`](/up.log.disable) did not persist through page reloads.
|
25
|
+
- Fix a bug where [`up.reveal`](/up.reveal) would scroll too far if the viewport has a `padding-top`.
|
26
|
+
- Fix a bug where [`up.reveal`](/up.reveal) would not scroll to an element at the bottom edge of the visible area
|
27
|
+
if [`up.layout.config.snap`](/up.layout.config) is set.
|
28
|
+
- Several features have been promoted from experimental API to stable API:
|
29
|
+
- [`[up-drawer]`](/up-drawer)
|
30
|
+
- [`up.syntax.data`](/up.syntax.data)
|
31
|
+
- [`up.extract`](/up.extract)
|
32
|
+
- When [targeting](/up-target) an URL with a #hash, the viewport will now scroll to the first row of an element
|
33
|
+
with that ID, rather than scrolling as little as possible.
|
34
|
+
|
35
|
+
|
36
|
+
### Breaking changes
|
37
|
+
|
38
|
+
- [Modals](/up.modal) can no longer grow wider than the screen
|
39
|
+
- The spacing around a modal dialog is longer implemented as a `margin` of `.up-modal-dialog`.
|
40
|
+
It is now a padding of `.up-modal-viewport`. This makes it easier to set the `width` or `max-width` of the dialog box.
|
41
|
+
|
42
|
+
If your project has custom Unpoly styles, you should grep your CSS files for changes to the `margin`
|
43
|
+
of `.up-modal-dialog` and set it as a `padding` on `.up-modal-viewport[flavor=default]` instead.
|
44
|
+
|
45
|
+
|
46
|
+
0.31.2
|
47
|
+
------
|
48
|
+
|
49
|
+
### Compatible changes
|
50
|
+
|
51
|
+
- Unpoly can now be installed as an npm module called `unpoly`.
|
52
|
+
|
53
|
+
|
54
|
+
0.31.0
|
55
|
+
------
|
56
|
+
|
57
|
+
### Compatible changes
|
58
|
+
|
59
|
+
- Drawers are now a built-in modal flavor! Use the [`[up-drawer]`](/up-drawer) attribute to open page fragements
|
14
60
|
in a modal drawer that slides in from the edge of the screen.
|
15
61
|
|
16
62
|
|
@@ -20,8 +66,6 @@ Unreleased
|
|
20
66
|
[`up.modal.flavors`](/up.modal.flavors) property instead.
|
21
67
|
|
22
68
|
|
23
|
-
|
24
|
-
|
25
69
|
0.30.1
|
26
70
|
------
|
27
71
|
|
@@ -189,7 +233,7 @@ Unreleased
|
|
189
233
|
|
190
234
|
### Breaking changes
|
191
235
|
|
192
|
-
- When inserting a page fragment with a `<script src="...">` tag, the linked
|
236
|
+
- When inserting a page fragment with a `<script src="...">` tag, the linked JavaScript is no longer loaded and executed. Inline scripts will still be executed. You can configure this behavior using the new [`up.flow.config`](/up.flow.config) property.
|
193
237
|
|
194
238
|
|
195
239
|
|
@@ -408,7 +452,7 @@ Unreleased
|
|
408
452
|
- All UJS functionality remains unchanged, so e.g. `up-target` is still called `up-target`.
|
409
453
|
- The Bower package has been renamed to `unpoly`.
|
410
454
|
- The Ruby gem for the Rails bindings has been renamed to `unpoly-rails`.
|
411
|
-
- The new
|
455
|
+
- The new JavaScript and stylesheet assets are:
|
412
456
|
- [`unpoly.js`](https://raw.githubusercontent.com/unpoly/unpoly/master/dist/unpoly.js)
|
413
457
|
- [`unpoly.min.js`](https://raw.githubusercontent.com/unpoly/unpoly/master/dist/unpoly.min.js)
|
414
458
|
- [`unpoly.css`](https://raw.githubusercontent.com/unpoly/unpoly/master/dist/unpoly.css)
|
data/README.md
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
-
Unpoly
|
2
|
-
|
1
|
+
[Unpoly](http://unpoly.com)
|
2
|
+
======
|
3
3
|
|
4
|
-
|
4
|
+
Unobtrusive JavaScript framework for server-side applications
|
5
|
+
-------------------------------------------------------------
|
5
6
|
|
6
|
-
|
7
|
+
[Unpoly](http://unpoly.com) enables fast and flexible frontends with minimal changes to your server-side code.
|
8
|
+
|
9
|
+
This repository is home to both the Unpoly javascript code and its (optional) bindings for Ruby on Rails (`unpoly-rails` gem).
|
7
10
|
|
8
11
|
|
9
12
|
Getting started
|
10
13
|
---------------
|
11
14
|
|
12
|
-
- See [unpoly.com](http://unpoly.com) for more information and
|
15
|
+
- See [unpoly.com](http://unpoly.com) for more information and JavaScript API documentation.
|
13
16
|
- See [`CHANGELOG.md`](https://github.com/unpoly/unpoly/blob/master/CHANGELOG.md) for notable changes.
|
14
17
|
- See [`README_RAILS.md`](https://github.com/unpoly/unpoly/blob/master/README_RAILS.md) documentation of the Rails bindings.
|
15
18
|
|
@@ -47,25 +50,28 @@ To run RSpec tests for the `unpoly-rails` gem:
|
|
47
50
|
|
48
51
|
### Making a new release
|
49
52
|
|
50
|
-
We are currently feeding
|
53
|
+
We are currently feeding four release channels:
|
51
54
|
|
52
55
|
- Manual download from Github
|
53
|
-
|
56
|
+
npm
|
57
|
+
- Bower (which is based on Git and version tags)
|
54
58
|
- Rubygems (as the `unpoly-rails` gem)
|
55
59
|
|
56
60
|
We always release to all channel simultaneously.
|
57
61
|
|
58
62
|
To make a new release:
|
59
63
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
1. Edit `lib/unpoly/rails/version.rb` and bump the version number. Use [semantic versioning](http://semver.org/).
|
65
|
+
2. Add an entry to `CHANGELOG.md`
|
66
|
+
3. Commit and push the version bump and `CHANGELOG.md`
|
67
|
+
4. From the project root, type `rake publish:build`. This will output minified JS and CSS files to the `dist` folder. It also updates the `package.json` for npm.
|
68
|
+
5. Commit and push the generated files. There is a rake task `rake publish:commit` that helps with this.
|
69
|
+
6. From the project root, type `rake publish:release`. This will publish a new gem version to Rubygems.org.
|
70
|
+
7. It will also push a tag for this version, which Bower requires for its own versioning scheme. Finally it publishes to npm.
|
71
|
+
|
72
|
+
Always remember to build, commit and push build artifacts before calling `rake publish:release` so the Git tag points to the correct commit.
|
67
73
|
|
68
|
-
|
74
|
+
If you have done this process a few times and know what you're doing, you can call `rake publish:all` to run all these steps in sequence.
|
69
75
|
|
70
76
|
|
71
77
|
Credits
|
data/README_RAILS.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
unpoly-rails: Ruby on Rails bindings for Unpoly
|
2
2
|
===============================================
|
3
3
|
|
4
|
-
[Unpoly](http://unpoly.com) is a backend-agnostic
|
4
|
+
[Unpoly](http://unpoly.com) is a backend-agnostic [unobtrusive JavaScript](https://en.wikipedia.org/wiki/Unobtrusive_JavaScript) framework. `unpoly-rails` gives your [Ruby on Rails](http://rubyonrails.org/) application some convenience candy when you are using Unpoly in your frontend.
|
5
5
|
|
6
6
|
|
7
7
|
Features
|
@@ -120,4 +120,4 @@ Before you make a PR, please have some discussion about the proposed change by [
|
|
120
120
|
|
121
121
|
### Making a new release
|
122
122
|
|
123
|
-
New versions of `unpoly-rails` are released as part of the [Unpoly release process](https://github.com/unpoly/unpoly/blob/master/README.md#making-a-new-release).
|
123
|
+
New versions of `unpoly-rails` are released as part of the [Unpoly release process](https://github.com/unpoly/unpoly/blob/master/README.md#making-a-new-release), which also feeds other package managers like Bower or npm.
|
data/Rakefile
CHANGED
data/bower.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "unpoly",
|
3
|
-
"homepage": "
|
3
|
+
"homepage": "http://unpoly.com",
|
4
4
|
"authors": [
|
5
|
-
"Henning Koch <henning
|
5
|
+
"Henning Koch <henning@triskweline.de>"
|
6
6
|
],
|
7
|
-
"description": "
|
7
|
+
"description": "Unobtrusive JavaScript framework",
|
8
8
|
"main": ["dist/unpoly.js", "dist/unpoly.css"],
|
9
9
|
"license": "MIT",
|
10
10
|
"ignore": [
|
@@ -18,6 +18,7 @@
|
|
18
18
|
"Gemfile.lock",
|
19
19
|
"Rakefile",
|
20
20
|
".ruby-version",
|
21
|
+
"package.json",
|
21
22
|
"unpoly-rails.gemspec"
|
22
23
|
],
|
23
24
|
"dependencies": {
|
data/design/homepage.txt
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
UI patterns like navigation bars, infinite scrolling,
|
28
28
|
drop-down menus, modals dialogs, etc.
|
29
29
|
|
30
|
-
Plays nice with existing
|
30
|
+
Plays nice with existing JavaScript
|
31
31
|
|
32
32
|
Convert to up.compiler directives.
|
33
33
|
|
@@ -57,7 +57,7 @@
|
|
57
57
|
Both UJS and programmatic interfaces
|
58
58
|
|
59
59
|
All Unpoly functionality is available as both unobtrusive behavior
|
60
|
-
(through HTML attributes like up-target) and
|
60
|
+
(through HTML attributes like up-target) and JavaScript functions
|
61
61
|
for programmatic access and integration with your code.
|
62
62
|
|
63
63
|
|
data/dist/unpoly-bootstrap3.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.up-modal-content{padding:0}.up-modal[up-flavor='drawer'] .up-modal-content{border-radius:0;border-top:none;border-bottom:none}.up-modal[up-flavor='drawer'][up-position='left'] .up-modal-content{border-left:none}.up-modal[up-flavor='drawer'][up-position='right'] .up-modal-content{border-right:none}
|
1
|
+
.up-modal-content{padding:0}.up-modal-dialog{margin:0}.up-modal[up-flavor='drawer'] .up-modal-content{border-radius:0;border-top:none;border-bottom:none}.up-modal[up-flavor='drawer'][up-position='left'] .up-modal-content{border-left:none}.up-modal[up-flavor='drawer'][up-position='right'] .up-modal-content{border-right:none}
|
data/dist/unpoly.css
CHANGED
@@ -31,7 +31,8 @@
|
|
31
31
|
z-index: 12000;
|
32
32
|
overflow-x: hidden;
|
33
33
|
overflow-y: scroll;
|
34
|
-
text-align: center;
|
34
|
+
text-align: center;
|
35
|
+
padding: 30px 10px; }
|
35
36
|
|
36
37
|
.up-modal.up-modal-animating {
|
37
38
|
overflow-y: scroll; }
|
@@ -42,7 +43,6 @@
|
|
42
43
|
z-index: 13000;
|
43
44
|
position: relative;
|
44
45
|
box-sizing: border-box;
|
45
|
-
margin: 30px 10px;
|
46
46
|
max-width: 100%;
|
47
47
|
display: inline-block;
|
48
48
|
text-align: left; }
|
@@ -67,11 +67,11 @@
|
|
67
67
|
cursor: pointer; }
|
68
68
|
|
69
69
|
.up-modal[up-flavor='drawer'] .up-modal-viewport {
|
70
|
-
text-align: left;
|
70
|
+
text-align: left;
|
71
|
+
padding: 0; }
|
71
72
|
.up-modal[up-flavor='drawer'][up-position='right'] .up-modal-viewport {
|
72
73
|
text-align: right; }
|
73
74
|
.up-modal[up-flavor='drawer'] .up-modal-dialog {
|
74
|
-
margin: 0;
|
75
75
|
max-width: 350px; }
|
76
76
|
.up-modal[up-flavor='drawer'] .up-modal-content {
|
77
77
|
min-height: 100vh;
|
data/dist/unpoly.js
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
*/
|
10
10
|
|
11
11
|
world.up = {
|
12
|
-
version: "0.
|
12
|
+
version: "0.32.0"
|
13
13
|
};
|
14
14
|
|
15
15
|
}).call(this);
|
@@ -36,7 +36,7 @@ that might save you from loading something like [Underscore.js](http://underscor
|
|
36
36
|
@function up.util.noop
|
37
37
|
@experimental
|
38
38
|
*/
|
39
|
-
var $createElementFromSelector, $createPlaceholder, ANIMATION_DEFERRED_KEY, DivertibleChain, ESCAPE_HTML_ENTITY_MAP, all, any, appendRequestData, cache, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, cssAnimate, detect, documentHasVerticalScrollbar, each, escapeHtml, escapePressed, evalOption, except, extend, extractOptions, fail, findWithSelf, finishCssAnimate, fixedToAbsolute, forceCompositing, forceRepaint, horizontalScreenHalf, identity, intersect, isArray, isBlank, isDeferred, isDefined, isDetached, isElement, isFixed, isFormData, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isNumber, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, multiSelector, nextFrame, nonUpClasses, noop, normalizeMethod, normalizeUrl, nullJQuery, offsetParent, once, only, opacity, openConfig, option, options, parseUrl, pluckData, pluckKey, presence, presentAttr, previewable, promiseTimer, reject, remove, requestDataAsArray, requestDataAsQuery, requestDataFromForm, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, selectorForElement, sequence, setMissingAttrs, setTimer, submittedValue, temporaryCss, times, titleFromXhr, toArray, trim, unJQuery, uniq, unresolvableDeferred, unresolvablePromise, unwrapElement, whenReady;
|
39
|
+
var $createElementFromSelector, $createPlaceholder, ANIMATION_DEFERRED_KEY, DivertibleChain, ESCAPE_HTML_ENTITY_MAP, all, any, appendRequestData, cache, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, cssAnimate, detachWith, detect, documentHasVerticalScrollbar, each, escapeHtml, escapePressed, evalOption, except, extend, extractOptions, fail, findWithSelf, finishCssAnimate, fixedToAbsolute, forceCompositing, forceRepaint, horizontalScreenHalf, identity, intersect, isArray, isBlank, isDeferred, isDefined, isDetached, isElement, isFixed, isFormData, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isNumber, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, multiSelector, nextFrame, nonUpClasses, noop, normalizeMethod, normalizeUrl, nullJQuery, offsetParent, once, only, opacity, openConfig, option, options, parseUrl, pluckData, pluckKey, presence, presentAttr, previewable, promiseTimer, reject, remove, requestDataAsArray, requestDataAsQuery, requestDataFromForm, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, selectorForElement, sequence, setMissingAttrs, setTimer, submittedValue, temporaryCss, times, titleFromXhr, toArray, trim, unJQuery, uniq, unresolvableDeferred, unresolvablePromise, unwrapElement, whenReady;
|
40
40
|
noop = $.noop;
|
41
41
|
|
42
42
|
/**
|
@@ -545,7 +545,7 @@ that might save you from loading something like [Underscore.js](http://underscor
|
|
545
545
|
/**
|
546
546
|
Returns whether the given argument is an object.
|
547
547
|
|
548
|
-
This also returns `true` for functions, which may behave like objects in
|
548
|
+
This also returns `true` for functions, which may behave like objects in JavaScript.
|
549
549
|
For an alternative that returns `false` for functions, see [`up.util.isHash`](/up.util.isHash).
|
550
550
|
|
551
551
|
@function up.util.isObject
|
@@ -936,7 +936,7 @@ that might save you from loading something like [Underscore.js](http://underscor
|
|
936
936
|
|
937
937
|
/**
|
938
938
|
Schedules the given function to be called in the
|
939
|
-
next
|
939
|
+
next JavaScript execution frame.
|
940
940
|
|
941
941
|
@function up.util.nextFrame
|
942
942
|
@param {Function} block
|
@@ -1977,7 +1977,7 @@ that might save you from loading something like [Underscore.js](http://underscor
|
|
1977
1977
|
};
|
1978
1978
|
|
1979
1979
|
/**
|
1980
|
-
Throws a [
|
1980
|
+
Throws a [JavaScript error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
|
1981
1981
|
with the given message.
|
1982
1982
|
|
1983
1983
|
The message will also be printed to the [error log](/up.log.error). Also a notification will be shown at the bottom of the screen.
|
@@ -2257,6 +2257,23 @@ that might save you from loading something like [Underscore.js](http://underscor
|
|
2257
2257
|
return 'right';
|
2258
2258
|
}
|
2259
2259
|
};
|
2260
|
+
|
2261
|
+
/**
|
2262
|
+
Like `$old.replaceWith($new)`, but keeps event handlers bound to `$old`.
|
2263
|
+
|
2264
|
+
Note that this is a memory leak unless you re-attach `$new` to the DOM aferwards.
|
2265
|
+
|
2266
|
+
@function up.util.detachWith
|
2267
|
+
@internal
|
2268
|
+
*/
|
2269
|
+
detachWith = function($old, $new) {
|
2270
|
+
var $insertion;
|
2271
|
+
$insertion = $('<div></div>');
|
2272
|
+
$insertion.insertAfter($old);
|
2273
|
+
$old.detach();
|
2274
|
+
$insertion.replaceWith($new);
|
2275
|
+
return $old;
|
2276
|
+
};
|
2260
2277
|
return {
|
2261
2278
|
isDetached: isDetached,
|
2262
2279
|
requestDataAsArray: requestDataAsArray,
|
@@ -2368,7 +2385,8 @@ that might save you from loading something like [Underscore.js](http://underscor
|
|
2368
2385
|
promiseTimer: promiseTimer,
|
2369
2386
|
previewable: previewable,
|
2370
2387
|
evalOption: evalOption,
|
2371
|
-
horizontalScreenHalf: horizontalScreenHalf
|
2388
|
+
horizontalScreenHalf: horizontalScreenHalf,
|
2389
|
+
detachWith: detachWith
|
2372
2390
|
};
|
2373
2391
|
})($);
|
2374
2392
|
|
@@ -2777,8 +2795,8 @@ use the more convenient [`up.on`](/up.on):
|
|
2777
2795
|
This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
2778
2796
|
|
2779
2797
|
- Event listeners on [unsupported browsers](/up.browser.isSupported) are silently discarded,
|
2780
|
-
leaving you with an application without
|
2781
|
-
a soup of randomly broken
|
2798
|
+
leaving you with an application without JavaScript. This is typically preferable to
|
2799
|
+
a soup of randomly broken JavaScript in ancient browsers.
|
2782
2800
|
- A jQuery object with the target element is automatically passed to the event handler
|
2783
2801
|
as a second argument. You no longer need to write `$(this)` in the handler function.
|
2784
2802
|
- You use an [`up-data`](/up-data) attribute to [attach structured data](/up.on#attaching-structured-data)
|
@@ -3214,7 +3232,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
3214
3232
|
/**
|
3215
3233
|
Boots the Unpoly framework.
|
3216
3234
|
|
3217
|
-
**This is called automatically** by including the Unpoly
|
3235
|
+
**This is called automatically** by including the Unpoly JavaScript files.
|
3218
3236
|
|
3219
3237
|
Unpoly will not boot if the current browser is [not supported](/up.browser.isSupported).
|
3220
3238
|
This leaves you with a classic server-side application on legacy browsers.
|
@@ -3327,7 +3345,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
3327
3345
|
*/
|
3328
3346
|
config = u.config({
|
3329
3347
|
prefix: '[UP] ',
|
3330
|
-
enabled:
|
3348
|
+
enabled: b.sessionStorage().getItem(SESSION_KEY_ENABLED) === 'true',
|
3331
3349
|
collapse: false
|
3332
3350
|
});
|
3333
3351
|
reset = function() {
|
@@ -3431,7 +3449,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
3431
3449
|
up.on('up:framework:boot', printBanner);
|
3432
3450
|
up.on('up:framework:reset', reset);
|
3433
3451
|
setEnabled = function(value) {
|
3434
|
-
b.sessionStorage().setItem(SESSION_KEY_ENABLED, value);
|
3452
|
+
b.sessionStorage().setItem(SESSION_KEY_ENABLED, value.toString());
|
3435
3453
|
return config.enabled = value;
|
3436
3454
|
};
|
3437
3455
|
|
@@ -3552,13 +3570,13 @@ Toast alerts
|
|
3552
3570
|
}).call(this);
|
3553
3571
|
|
3554
3572
|
/**
|
3555
|
-
Custom
|
3573
|
+
Custom JavaScript
|
3556
3574
|
=================
|
3557
3575
|
|
3558
|
-
Every app needs a way to pair
|
3576
|
+
Every app needs a way to pair JavaScript snippets with certain HTML elements,
|
3559
3577
|
in order to integrate libraries or implement custom behavior.
|
3560
3578
|
|
3561
|
-
Unpoly lets you organize your
|
3579
|
+
Unpoly lets you organize your JavaScript snippets using [compilers](/up.compiler).
|
3562
3580
|
|
3563
3581
|
For instance, to activate the [Masonry](http://masonry.desandro.com/) jQuery plugin for every element
|
3564
3582
|
with a `grid` class, use this compiler:
|
@@ -3577,9 +3595,9 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3577
3595
|
var slice = [].slice;
|
3578
3596
|
|
3579
3597
|
up.syntax = (function($) {
|
3580
|
-
var
|
3598
|
+
var DESTRUCTIBLE_CLASS, DESTRUCTORS_KEY, addDestructor, applyCompiler, buildCompiler, clean, compile, compiler, compilers, data, discoverDestructors, insertCompiler, macro, macros, reset, snapshot, u;
|
3581
3599
|
u = up.util;
|
3582
|
-
|
3600
|
+
DESTRUCTIBLE_CLASS = 'up-destructible';
|
3583
3601
|
DESTRUCTORS_KEY = 'up-destructors';
|
3584
3602
|
compilers = [];
|
3585
3603
|
macros = [];
|
@@ -3603,14 +3621,14 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3603
3621
|
\#\#\# Integrating jQuery plugins
|
3604
3622
|
|
3605
3623
|
`up.compiler` is a great way to integrate jQuery plugins.
|
3606
|
-
Let's say your
|
3624
|
+
Let's say your JavaScript plugin wants you to call `lightboxify()`
|
3607
3625
|
on links that should open a lightbox. You decide to
|
3608
3626
|
do this for all links with an `lightbox` class:
|
3609
3627
|
|
3610
3628
|
<a href="river.png" class="lightbox">River</a>
|
3611
3629
|
<a href="ocean.png" class="lightbox">Ocean</a>
|
3612
3630
|
|
3613
|
-
This
|
3631
|
+
This JavaScript will do exactly that:
|
3614
3632
|
|
3615
3633
|
up.compiler('a.lightbox', function($element) {
|
3616
3634
|
$element.lightboxify();
|
@@ -3623,7 +3641,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3623
3641
|
|
3624
3642
|
<clock></clock>
|
3625
3643
|
|
3626
|
-
Here is the
|
3644
|
+
Here is the JavaScript that inserts the current time into to these elements:
|
3627
3645
|
|
3628
3646
|
up.compiler('clock', function($element) {
|
3629
3647
|
var now = new Date();
|
@@ -3634,7 +3652,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3634
3652
|
\#\#\# Cleaning up after yourself
|
3635
3653
|
|
3636
3654
|
If your compiler returns a function, Unpoly will use this as a *destructor* to
|
3637
|
-
clean up if the element leaves the DOM. Note that in Unpoly the same DOM ad
|
3655
|
+
clean up if the element leaves the DOM. Note that in Unpoly the same DOM ad JavaScript environment
|
3638
3656
|
will persist through many page loads, so it's important to not create
|
3639
3657
|
[memory leaks](https://makandracards.com/makandra/31325-how-to-create-memory-leaks-in-jquery).
|
3640
3658
|
|
@@ -3863,7 +3881,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3863
3881
|
};
|
3864
3882
|
addDestructor = function($jqueryElement, destructor) {
|
3865
3883
|
var destructors;
|
3866
|
-
$jqueryElement.addClass(
|
3884
|
+
$jqueryElement.addClass(DESTRUCTIBLE_CLASS);
|
3867
3885
|
destructors = $jqueryElement.data(DESTRUCTORS_KEY) || [];
|
3868
3886
|
destructors.push(destructor);
|
3869
3887
|
return $jqueryElement.data(DESTRUCTORS_KEY, destructors);
|
@@ -3931,16 +3949,18 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3931
3949
|
@internal
|
3932
3950
|
*/
|
3933
3951
|
clean = function($fragment) {
|
3934
|
-
return u.findWithSelf($fragment, "." +
|
3952
|
+
return u.findWithSelf($fragment, "." + DESTRUCTIBLE_CLASS).each(function() {
|
3935
3953
|
var $element, destructor, destructors, i, len;
|
3936
3954
|
$element = $(this);
|
3937
3955
|
destructors = $element.data(DESTRUCTORS_KEY);
|
3938
|
-
|
3939
|
-
|
3940
|
-
|
3956
|
+
if (destructors) {
|
3957
|
+
for (i = 0, len = destructors.length; i < len; i++) {
|
3958
|
+
destructor = destructors[i];
|
3959
|
+
destructor();
|
3960
|
+
}
|
3961
|
+
$element.removeData(DESTRUCTORS_KEY);
|
3962
|
+
return $element.removeClass(DESTRUCTIBLE_CLASS);
|
3941
3963
|
}
|
3942
|
-
$element.removeData(DESTRUCTORS_KEY);
|
3943
|
-
return $element.removeClass(DESTRUCTABLE_CLASS);
|
3944
3964
|
});
|
3945
3965
|
};
|
3946
3966
|
|
@@ -3956,7 +3976,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3956
3976
|
|
3957
3977
|
<span class="person" up-data="{ age: 18, name: 'Bob' }">Bob</span>
|
3958
3978
|
|
3959
|
-
Calling `up.syntax.data` will deserialize the JSON string into a
|
3979
|
+
Calling `up.syntax.data` will deserialize the JSON string into a JavaScript object:
|
3960
3980
|
|
3961
3981
|
up.syntax.data('.person') // returns { age: 18, name: 'Bob' }
|
3962
3982
|
|
@@ -3966,7 +3986,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
3966
3986
|
The JSON-decoded value of the `up-data` attribute.
|
3967
3987
|
|
3968
3988
|
Returns an empty object (`{}`) if the element has no (or an empty) `up-data` attribute.
|
3969
|
-
@
|
3989
|
+
@stable
|
3970
3990
|
*/
|
3971
3991
|
|
3972
3992
|
/**
|
@@ -4561,7 +4581,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
4561
4581
|
element are visible for the user.
|
4562
4582
|
|
4563
4583
|
By default Unpoly will always reveal an element before
|
4564
|
-
updating it with
|
4584
|
+
updating it with JavaScript functions like [`up.replace`](/up.replace)
|
4565
4585
|
or UJS behavior like [`[up-target]`](/a-up-target).
|
4566
4586
|
|
4567
4587
|
\#\#\# How Unpoly finds the viewport
|
@@ -4607,7 +4627,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
4607
4627
|
$viewport = options.viewport ? $(options.viewport) : viewportOf($element);
|
4608
4628
|
snap = u.option(options.snap, config.snap);
|
4609
4629
|
viewportIsDocument = $viewport.is(document);
|
4610
|
-
viewportHeight = viewportIsDocument ? u.clientSize().height : $viewport.
|
4630
|
+
viewportHeight = viewportIsDocument ? u.clientSize().height : $viewport.outerHeight();
|
4611
4631
|
originalScrollPos = $viewport.scrollTop();
|
4612
4632
|
newScrollPos = originalScrollPos;
|
4613
4633
|
offsetShift = void 0;
|
@@ -4639,7 +4659,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
4639
4659
|
if (firstElementRow < predictFirstVisibleRow() || options.top) {
|
4640
4660
|
newScrollPos = firstElementRow - obstruction.top;
|
4641
4661
|
}
|
4642
|
-
if (newScrollPos < snap) {
|
4662
|
+
if (newScrollPos < snap && elementDims.top < (0.5 * viewportHeight)) {
|
4643
4663
|
newScrollPos = 0;
|
4644
4664
|
}
|
4645
4665
|
if (newScrollPos !== originalScrollPos) {
|
@@ -4822,17 +4842,18 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
4822
4842
|
/**
|
4823
4843
|
@function up.layout.revealOrRestoreScroll
|
4824
4844
|
@return {Deferred}
|
4825
|
-
A promise for when the revealing or scroll
|
4845
|
+
A promise for when the revealing or scroll restoration ends
|
4826
4846
|
@internal
|
4827
4847
|
*/
|
4828
4848
|
revealOrRestoreScroll = function(selectorOrElement, options) {
|
4829
|
-
var $element, $target, id, parsed;
|
4849
|
+
var $element, $target, id, parsed, revealOptions;
|
4830
4850
|
$element = $(selectorOrElement);
|
4831
4851
|
if (options.restoreScroll) {
|
4832
4852
|
return restoreScroll({
|
4833
4853
|
around: $element
|
4834
4854
|
});
|
4835
4855
|
} else if (options.reveal) {
|
4856
|
+
revealOptions = {};
|
4836
4857
|
if (options.source) {
|
4837
4858
|
parsed = u.parseUrl(options.source);
|
4838
4859
|
if (parsed.hash && parsed.hash !== '#') {
|
@@ -4840,10 +4861,11 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
4840
4861
|
$target = u.findWithSelf($element, "#" + id + ", a[name='" + id + "']");
|
4841
4862
|
if ($target.length) {
|
4842
4863
|
$element = $target;
|
4864
|
+
revealOptions.top = true;
|
4843
4865
|
}
|
4844
4866
|
}
|
4845
4867
|
}
|
4846
|
-
return reveal($element);
|
4868
|
+
return reveal($element, revealOptions);
|
4847
4869
|
} else {
|
4848
4870
|
return u.resolvedDeferred();
|
4849
4871
|
}
|
@@ -4975,14 +4997,14 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
4975
4997
|
}).call(this);
|
4976
4998
|
|
4977
4999
|
/**
|
4978
|
-
|
4979
|
-
|
5000
|
+
Fragment update API
|
5001
|
+
===================
|
4980
5002
|
|
4981
5003
|
This module contains Unpoly's core functions to [change](/up.replace) or
|
4982
|
-
[destroy](/up.destroy) page fragments via
|
5004
|
+
[destroy](/up.destroy) page fragments via JavaScript.
|
4983
5005
|
|
4984
|
-
|
4985
|
-
|
5006
|
+
Other Unpoly modules (like [`up.link`](/up.link) or [`up.modal`](/up.modal))
|
5007
|
+
build upon this module to offer higher level API functions.
|
4986
5008
|
|
4987
5009
|
@class up.flow
|
4988
5010
|
*/
|
@@ -5000,7 +5022,7 @@ are based on this module.
|
|
5000
5022
|
Whether inline `<script>` tags inside inserted HTML fragments will be executed.
|
5001
5023
|
@param {Boolean} [options.runLinkedScripts=false]
|
5002
5024
|
Whether `<script src='...'>` tags inside inserted HTML fragments will fetch and execute
|
5003
|
-
the linked
|
5025
|
+
the linked JavaScript file.
|
5004
5026
|
@stable
|
5005
5027
|
*/
|
5006
5028
|
config = u.config({
|
@@ -5338,7 +5360,7 @@ are based on this module.
|
|
5338
5360
|
@return {Promise}
|
5339
5361
|
A promise that will be resolved then the selector was updated
|
5340
5362
|
and all animation has finished.
|
5341
|
-
@
|
5363
|
+
@stable
|
5342
5364
|
*/
|
5343
5365
|
extract = function(selectorOrElement, html, options) {
|
5344
5366
|
return up.log.group('Extracting %s from %d bytes of HTML', selectorOrElement, html != null ? html.length : void 0, function() {
|
@@ -5522,7 +5544,7 @@ are based on this module.
|
|
5522
5544
|
descendantsOnly: true
|
5523
5545
|
}))) {
|
5524
5546
|
$keepableClone = $keepable.clone();
|
5525
|
-
|
5547
|
+
up.util.detachWith($keepable, $keepableClone);
|
5526
5548
|
plan.$newElement.replaceWith($keepable);
|
5527
5549
|
keepPlans.push(plan);
|
5528
5550
|
}
|
@@ -5531,7 +5553,7 @@ are based on this module.
|
|
5531
5553
|
return keepPlans;
|
5532
5554
|
};
|
5533
5555
|
findKeepPlan = function($element, $new, options) {
|
5534
|
-
var $keepable, $partner,
|
5556
|
+
var $keepable, $partner, keepEventArgs, partnerSelector, plan;
|
5535
5557
|
if (options.keep) {
|
5536
5558
|
$keepable = $element;
|
5537
5559
|
if (partnerSelector = u.castedAttr($keepable, 'up-keep')) {
|
@@ -5544,16 +5566,16 @@ are based on this module.
|
|
5544
5566
|
}
|
5545
5567
|
$partner = $partner.first();
|
5546
5568
|
if ($partner.length && $partner.is('[up-keep]')) {
|
5547
|
-
|
5569
|
+
plan = {
|
5548
5570
|
$element: $keepable,
|
5549
5571
|
$newElement: $partner,
|
5550
5572
|
newData: up.syntax.data($partner)
|
5551
5573
|
};
|
5552
|
-
keepEventArgs = u.merge(
|
5574
|
+
keepEventArgs = u.merge(plan, {
|
5553
5575
|
message: ['Keeping element %o', $keepable.get(0)]
|
5554
5576
|
});
|
5555
5577
|
if (up.bus.nobodyPrevents('up:fragment:keep', keepEventArgs)) {
|
5556
|
-
return
|
5578
|
+
return plan;
|
5557
5579
|
}
|
5558
5580
|
}
|
5559
5581
|
}
|
@@ -6004,7 +6026,7 @@ are based on this module.
|
|
6004
6026
|
Animation
|
6005
6027
|
=========
|
6006
6028
|
|
6007
|
-
Whenever you [update a page fragment](/up
|
6029
|
+
Whenever you [update a page fragment](/up.link) you can animate the change.
|
6008
6030
|
|
6009
6031
|
Let's say you are using an [`up-target`](/a-up-target) link to update an element
|
6010
6032
|
with content from the server. You can add an attribute [`up-transition`](/a-up-target#up-transition)
|
@@ -6738,7 +6760,7 @@ Unpoly caches server responses for a few minutes,
|
|
6738
6760
|
making requests to these URLs return instantly.
|
6739
6761
|
|
6740
6762
|
All Unpoly functions and selectors go through this cache.
|
6741
|
-
If you need to make cache-aware requests from your [custom
|
6763
|
+
If you need to make cache-aware requests from your [custom JavaScript](/up.syntax),
|
6742
6764
|
use [`up.ajax`](/up.ajax).
|
6743
6765
|
|
6744
6766
|
\#\#\# How the cache is cleared
|
@@ -7057,7 +7079,7 @@ that appears during a long-running request.
|
|
7057
7079
|
|
7058
7080
|
<div class="spinner">Please wait!</div>
|
7059
7081
|
|
7060
|
-
Here is the
|
7082
|
+
Here is the JavaScript to make it alive:
|
7061
7083
|
|
7062
7084
|
up.compiler('.spinner', function($element) {
|
7063
7085
|
|
@@ -7341,7 +7363,7 @@ Standard HTML links are a poor fit for modern applications:
|
|
7341
7363
|
|
7342
7364
|
- State changes caused by AJAX updates get lost during the page transition.
|
7343
7365
|
- Unsaved form changes get lost during the page transition.
|
7344
|
-
- The
|
7366
|
+
- The JavaScript VM is reset during the page transition.
|
7345
7367
|
- If the page layout is composed from multiple srollable containers
|
7346
7368
|
(e.g. a pane view), the scroll positions get lost during the page transition.
|
7347
7369
|
- The user sees a "flash" as the browser loads and renders the new page,
|
@@ -7397,7 +7419,7 @@ with an `up-target` attribute:
|
|
7397
7419
|
Note that instead of `article` you can use any other CSS selector like `#main .article`.
|
7398
7420
|
|
7399
7421
|
With these [`up-target`](/a-up-target) annotations Unpoly only updates the targeted part of the screen.
|
7400
|
-
The
|
7422
|
+
The JavaScript environment will persist and the user will not see a white flash while the
|
7401
7423
|
new page is loading.
|
7402
7424
|
|
7403
7425
|
|
@@ -7408,7 +7430,7 @@ new page is loading.
|
|
7408
7430
|
- As you switch through pages, Unpoly will [update your browser's location bar and history](/up.history)
|
7409
7431
|
- You can [open fragments in popups or modal dialogs](/up.modal).
|
7410
7432
|
- You can give users [immediate feedback](/up.navigation) when a link is clicked or becomes current, without waiting for the server.
|
7411
|
-
- [Controlling Unpoly pragmatically through
|
7433
|
+
- [Controlling Unpoly pragmatically through JavaScript](/up.flow)
|
7412
7434
|
- [Defining custom tags](/up.syntax)
|
7413
7435
|
|
7414
7436
|
|
@@ -7598,20 +7620,36 @@ new page is loading.
|
|
7598
7620
|
}
|
7599
7621
|
});
|
7600
7622
|
};
|
7601
|
-
|
7623
|
+
|
7624
|
+
/**
|
7625
|
+
Returns whether the given link will be handled by Unpoly instead of making a full page load.
|
7626
|
+
|
7627
|
+
A link will be handled by Unpoly if it has an attribute
|
7628
|
+
like `up-target` or `up-modal`.
|
7629
|
+
|
7630
|
+
@function up.link.isFollowable
|
7631
|
+
@param {Element|jQuery|String} linkOrSelector
|
7632
|
+
The link to check.
|
7633
|
+
@experimental
|
7634
|
+
*/
|
7635
|
+
isFollowable = function(link) {
|
7636
|
+
var $link;
|
7637
|
+
$link = $(link);
|
7602
7638
|
return u.any(followVariantSelectors, function(selector) {
|
7603
7639
|
return $link.is(selector);
|
7604
7640
|
});
|
7605
7641
|
};
|
7606
7642
|
|
7607
7643
|
/**
|
7608
|
-
Makes sure that the given link
|
7644
|
+
Makes sure that the given link will be handled by Unpoly instead of making a full page load.
|
7609
7645
|
|
7610
7646
|
This is done by giving the link an `up-follow` attribute
|
7611
|
-
unless it already have it an `up-target` or `up-
|
7647
|
+
unless it already have it an attribute like `up-target` or `up-modal`.
|
7612
7648
|
|
7613
7649
|
@function up.link.makeFollowable
|
7614
|
-
@
|
7650
|
+
@param {Element|jQuery|String} linkOrSelector
|
7651
|
+
The link to process.
|
7652
|
+
@experimental
|
7615
7653
|
*/
|
7616
7654
|
makeFollowable = function(link) {
|
7617
7655
|
var $link;
|
@@ -7892,6 +7930,7 @@ new page is loading.
|
|
7892
7930
|
visit: visit,
|
7893
7931
|
follow: follow,
|
7894
7932
|
makeFollowable: makeFollowable,
|
7933
|
+
isFollowable: isFollowable,
|
7895
7934
|
shouldProcessLinkEvent: shouldProcessLinkEvent,
|
7896
7935
|
childClicked: childClicked,
|
7897
7936
|
followMethod: followMethod,
|
@@ -8129,7 +8168,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
8129
8168
|
@param {Function(value, $field)|String} onChange
|
8130
8169
|
The callback to run when the field's value changes.
|
8131
8170
|
If given as a function, it must take two arguments (`value`, `$field`).
|
8132
|
-
If given as a string, it will be evaled as
|
8171
|
+
If given as a string, it will be evaled as JavaScript code in a context where
|
8133
8172
|
(`value`, `$field`) are set.
|
8134
8173
|
@return {Function}
|
8135
8174
|
A destructor function that removes the observe watch when called.
|
@@ -8820,7 +8859,7 @@ to show a fragment in a popup overlay that rolls down from an anchoring element.
|
|
8820
8859
|
|
8821
8860
|
To open a popup, add an [`up-popup` attribute](/up-popup) to a link:
|
8822
8861
|
|
8823
|
-
<a href="/options" up-
|
8862
|
+
<a href="/options" up-popup=".menu">Show options</a>
|
8824
8863
|
|
8825
8864
|
When this link is clicked, Unpoly will request the path `/options` and extract
|
8826
8865
|
an element matching the selector `.menu` from the response. The matching element
|
@@ -9293,14 +9332,12 @@ The HTML of a popup element is simply this:
|
|
9293
9332
|
|
9294
9333
|
<a href="/fallback" up-close>Okay</a>
|
9295
9334
|
|
9296
|
-
@selector [up-close]
|
9335
|
+
@selector .up-popup [up-close]
|
9297
9336
|
@stable
|
9298
9337
|
*/
|
9299
|
-
up.on('click', '[up-close]', function(event, $element) {
|
9300
|
-
|
9301
|
-
|
9302
|
-
return up.bus.consumeAction(event);
|
9303
|
-
}
|
9338
|
+
up.on('click', '.up-popup [up-close]', function(event, $element) {
|
9339
|
+
closeAsap();
|
9340
|
+
return up.bus.consumeAction(event);
|
9304
9341
|
});
|
9305
9342
|
up.on('up:framework:reset', reset);
|
9306
9343
|
return {
|
@@ -9447,7 +9484,6 @@ or function.
|
|
9447
9484
|
*/
|
9448
9485
|
config = u.config({
|
9449
9486
|
maxWidth: null,
|
9450
|
-
minWidth: null,
|
9451
9487
|
width: null,
|
9452
9488
|
height: null,
|
9453
9489
|
history: true,
|
@@ -10036,7 +10072,7 @@ or function.
|
|
10036
10072
|
Clicking this link will load the destination via AJAX and open
|
10037
10073
|
the given selector in a modal dialog.
|
10038
10074
|
|
10039
|
-
|
10075
|
+
\#\#\# Example
|
10040
10076
|
|
10041
10077
|
<a href="/blogs" up-modal=".blog-list">Switch blog</a>
|
10042
10078
|
|
@@ -10120,14 +10156,12 @@ or function.
|
|
10120
10156
|
|
10121
10157
|
<a href="/fallback" up-close>Okay</a>
|
10122
10158
|
|
10123
|
-
@selector [up-close]
|
10159
|
+
@selector .up-modal [up-close]
|
10124
10160
|
@stable
|
10125
10161
|
*/
|
10126
|
-
up.on('click', '[up-close]', function(event, $element) {
|
10127
|
-
|
10128
|
-
|
10129
|
-
return up.bus.consumeAction(event);
|
10130
|
-
}
|
10162
|
+
up.on('click', '.up-modal [up-close]', function(event, $element) {
|
10163
|
+
closeAsap();
|
10164
|
+
return up.bus.consumeAction(event);
|
10131
10165
|
});
|
10132
10166
|
|
10133
10167
|
/**
|
@@ -10136,7 +10170,7 @@ or function.
|
|
10136
10170
|
|
10137
10171
|
You can configure drawers using the [`up.modal.flavors.drawer`](/up.modal.flavors.drawer) property.
|
10138
10172
|
|
10139
|
-
|
10173
|
+
\#\#\# Example
|
10140
10174
|
|
10141
10175
|
<a href="/blogs" up-drawer=".blog-list">Switch blog</a>
|
10142
10176
|
|
@@ -10154,7 +10188,7 @@ or function.
|
|
10154
10188
|
Valid values are `'left'`, `'right'` and `'auto'`. If set to `'auto'`, the
|
10155
10189
|
drawer will slide in from left if the opening link is on the left half of the screen.
|
10156
10190
|
Otherwise it will slide in from the right.
|
10157
|
-
@
|
10191
|
+
@stable
|
10158
10192
|
*/
|
10159
10193
|
up.macro('[up-drawer]', function($link) {
|
10160
10194
|
var target;
|
@@ -10524,8 +10558,8 @@ The tooltip element is appended to the end of `<body>`.
|
|
10524
10558
|
}).call(this);
|
10525
10559
|
|
10526
10560
|
/**
|
10527
|
-
Navigation
|
10528
|
-
|
10561
|
+
Navigation feedback
|
10562
|
+
===================
|
10529
10563
|
|
10530
10564
|
Unpoly automatically adds CSS classes to links while they are
|
10531
10565
|
currently loading ([`.up-active`](/up-active)) or
|
@@ -10672,7 +10706,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
10672
10706
|
Marks the given element as currently loading, by assigning the CSS class [`up-active`](/up-active).
|
10673
10707
|
|
10674
10708
|
This happens automatically when following links or submitting forms through the Unpoly API.
|
10675
|
-
Use this function if you make custom network calls from your own
|
10709
|
+
Use this function if you make custom network calls from your own JavaScript code.
|
10676
10710
|
|
10677
10711
|
If the given element is a link within an [expanded click area](/up-expand),
|
10678
10712
|
the class will be assigned to the expanded area.
|
@@ -10754,7 +10788,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
10754
10788
|
Marks the given element as no longer loading, by removing the CSS class [`up-active`](/up-active).
|
10755
10789
|
|
10756
10790
|
This happens automatically when network requests initiated by the Unpoly API have completed.
|
10757
|
-
Use this function if you make custom network calls from your own
|
10791
|
+
Use this function if you make custom network calls from your own JavaScript code.
|
10758
10792
|
|
10759
10793
|
@function up.navigation.stop
|
10760
10794
|
@param {jQuery} event.$element
|
@@ -10803,7 +10837,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
10803
10837
|
- the link's [`up-href`](#turn-any-element-into-a-link) attribute
|
10804
10838
|
- a space-separated list of URLs in the link's `up-alias` attribute
|
10805
10839
|
|
10806
|
-
|
10840
|
+
\#\#\# Matching URL by prefix
|
10807
10841
|
|
10808
10842
|
You can mark a link as `.up-current` whenever the current URL matches a prefix.
|
10809
10843
|
To do so, end the `up-alias` attribute in an asterisk (`*`).
|