upjs-rails 0.11.1 → 0.12.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 +50 -0
- data/dist/up-bootstrap.js +9 -17
- data/dist/up-bootstrap.min.js +1 -1
- data/dist/up.js +384 -458
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up/boot.js.coffee +2 -2
- data/lib/assets/javascripts/up/browser.js.coffee +2 -2
- data/lib/assets/javascripts/up/bus.js.coffee +39 -88
- data/lib/assets/javascripts/up/flow.js.coffee +25 -33
- data/lib/assets/javascripts/up/form.js.coffee +2 -2
- data/lib/assets/javascripts/up/history.js.coffee +8 -7
- data/lib/assets/javascripts/up/layout.js.coffee +19 -18
- data/lib/assets/javascripts/up/link.js.coffee +2 -2
- data/lib/assets/javascripts/up/magic.js.coffee +41 -27
- data/lib/assets/javascripts/up/modal.js.coffee +74 -57
- data/lib/assets/javascripts/up/motion.js.coffee +11 -10
- data/lib/assets/javascripts/up/navigation.js.coffee +11 -10
- data/lib/assets/javascripts/up/popup.js.coffee +19 -16
- data/lib/assets/javascripts/up/proxy.js.coffee +17 -16
- data/lib/assets/javascripts/up/tooltip.js.coffee +28 -14
- data/lib/assets/javascripts/up/util.js.coffee +14 -22
- data/lib/assets/javascripts/up-bootstrap/layout-ext.js.coffee +5 -6
- data/lib/assets/javascripts/up-bootstrap/modal-ext.js.coffee +8 -8
- data/lib/assets/javascripts/up-bootstrap/navigation-ext.js.coffee +2 -5
- data/lib/assets/javascripts/up.js.coffee +0 -1
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/spec/javascripts/up/bus_spec.js.coffee +43 -6
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/history_spec.js.coffee +3 -3
- data/spec_app/spec/javascripts/up/layout_spec.js.coffee +9 -11
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +7 -9
- data/spec_app/spec/javascripts/up/magic_spec.js.coffee +5 -5
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +8 -10
- data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +13 -13
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +1 -5
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +51 -52
- data/spec_app/spec/javascripts/up/tooltip_spec.js.coffee +19 -5
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +14 -23
- metadata +1 -3
- data/lib/assets/javascripts/up/slot.js.coffee +0 -63
- data/spec_app/spec/javascripts/up/slot_spec.js.coffee +0 -16
data/dist/up.js
CHANGED
@@ -24,8 +24,8 @@ If you use them in your own code, you will get hurt.
|
|
24
24
|
(function() {
|
25
25
|
var slice = [].slice;
|
26
26
|
|
27
|
-
up.util = (function() {
|
28
|
-
var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, any, cache, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, emptyJQuery, endsWith, error, escapePressed, evalConsoleTemplate, extend, findWithSelf, finishCssAnimate, fixedToAbsolute, forceCompositing, identity, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isNumber, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, multiSelector, nextFrame, normalizeMethod, normalizeUrl, nullJquery, offsetParent, once, only, option, options, presence, presentAttr, remove, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, setMissingAttrs, startsWith, temporaryCss, times, toArray, trim, unJquery, uniq, unwrapElement, warn;
|
27
|
+
up.util = (function($) {
|
28
|
+
var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, any, argNames, cache, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, emptyJQuery, endsWith, error, escapePressed, evalConsoleTemplate, extend, findWithSelf, finishCssAnimate, fixedToAbsolute, forceCompositing, identity, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isNumber, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, multiSelector, nextFrame, normalizeMethod, normalizeUrl, nullJquery, offsetParent, once, only, option, options, presence, presentAttr, remove, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, setMissingAttrs, startsWith, temporaryCss, times, toArray, trim, unJquery, uniq, unwrapElement, warn;
|
29
29
|
memoize = function(func) {
|
30
30
|
var cache, cached;
|
31
31
|
cache = void 0;
|
@@ -1054,47 +1054,16 @@ If you use them in your own code, you will get hurt.
|
|
1054
1054
|
};
|
1055
1055
|
};
|
1056
1056
|
config = function(factoryOptions) {
|
1057
|
-
var
|
1057
|
+
var hash;
|
1058
1058
|
if (factoryOptions == null) {
|
1059
1059
|
factoryOptions = {};
|
1060
1060
|
}
|
1061
|
-
hash = {
|
1062
|
-
|
1063
|
-
|
1064
|
-
},
|
1065
|
-
reset: function() {
|
1066
|
-
var j, key, len, ownKeys;
|
1067
|
-
ownKeys = copy(Object.getOwnPropertyNames(hash));
|
1068
|
-
for (j = 0, len = ownKeys.length; j < len; j++) {
|
1069
|
-
key = ownKeys[j];
|
1070
|
-
if (!contains(apiKeys, key)) {
|
1071
|
-
delete hash[key];
|
1072
|
-
}
|
1073
|
-
}
|
1074
|
-
return hash.update(copy(factoryOptions));
|
1075
|
-
},
|
1076
|
-
update: function(options) {
|
1077
|
-
var key, results, value;
|
1078
|
-
if (options) {
|
1079
|
-
if (isString(options)) {
|
1080
|
-
hash.ensureKeyExists(options);
|
1081
|
-
return hash[options];
|
1082
|
-
} else {
|
1083
|
-
results = [];
|
1084
|
-
for (key in options) {
|
1085
|
-
value = options[key];
|
1086
|
-
hash.ensureKeyExists(key);
|
1087
|
-
results.push(hash[key] = value);
|
1088
|
-
}
|
1089
|
-
return results;
|
1090
|
-
}
|
1091
|
-
} else {
|
1092
|
-
return hash;
|
1093
|
-
}
|
1094
|
-
}
|
1061
|
+
hash = {};
|
1062
|
+
hash.reset = function() {
|
1063
|
+
return extend(hash, factoryOptions);
|
1095
1064
|
};
|
1096
|
-
apiKeys = Object.getOwnPropertyNames(hash);
|
1097
1065
|
hash.reset();
|
1066
|
+
Object.preventExtensions(hash);
|
1098
1067
|
return hash;
|
1099
1068
|
};
|
1100
1069
|
unwrapElement = function(wrapper) {
|
@@ -1133,7 +1102,18 @@ If you use them in your own code, you will get hurt.
|
|
1133
1102
|
bottom: ''
|
1134
1103
|
});
|
1135
1104
|
};
|
1105
|
+
argNames = function(fun) {
|
1106
|
+
var code, match, pattern;
|
1107
|
+
code = fun.toString();
|
1108
|
+
pattern = new RegExp('\\(([^\\)]*)\\)');
|
1109
|
+
if (match = code.match(pattern)) {
|
1110
|
+
return match[1].split(/\s*,\s*/);
|
1111
|
+
} else {
|
1112
|
+
return error('Could not parse argument names of %o', fun);
|
1113
|
+
}
|
1114
|
+
};
|
1136
1115
|
return {
|
1116
|
+
argNames: argNames,
|
1137
1117
|
offsetParent: offsetParent,
|
1138
1118
|
fixedToAbsolute: fixedToAbsolute,
|
1139
1119
|
presentAttr: presentAttr,
|
@@ -1217,7 +1197,7 @@ If you use them in your own code, you will get hurt.
|
|
1217
1197
|
emptyJQuery: emptyJQuery,
|
1218
1198
|
evalConsoleTemplate: evalConsoleTemplate
|
1219
1199
|
};
|
1220
|
-
})();
|
1200
|
+
})($);
|
1221
1201
|
|
1222
1202
|
up.error = up.util.error;
|
1223
1203
|
|
@@ -1241,7 +1221,7 @@ we can't currently get rid off.
|
|
1241
1221
|
(function() {
|
1242
1222
|
var slice = [].slice;
|
1243
1223
|
|
1244
|
-
up.browser = (function() {
|
1224
|
+
up.browser = (function($) {
|
1245
1225
|
var canCssAnimation, canInputEvent, canLogSubstitution, canPushState, initialRequestMethod, isIE8OrWorse, isIE9OrWorse, isRecentJQuery, isSupported, loadPage, popCookie, puts, u, url;
|
1246
1226
|
u = up.util;
|
1247
1227
|
loadPage = function(url, options) {
|
@@ -1345,7 +1325,7 @@ we can't currently get rid off.
|
|
1345
1325
|
isSupported: isSupported,
|
1346
1326
|
puts: puts
|
1347
1327
|
};
|
1348
|
-
})();
|
1328
|
+
})(jQuery);
|
1349
1329
|
|
1350
1330
|
}).call(this);
|
1351
1331
|
|
@@ -1357,11 +1337,11 @@ Up.js uses an internal event bus that you can use to hook into lifecycle events
|
|
1357
1337
|
|
1358
1338
|
This internal event bus might eventually be rolled into regular events that we trigger on `document`.
|
1359
1339
|
|
1360
|
-
\#\#\# `fragment:
|
1340
|
+
\#\#\# `fragment:inserted` event
|
1361
1341
|
|
1362
1342
|
This event is triggered after Up.js has inserted an HTML fragment into the DOM through mechanisms like [`[up-target]`](/up.flow#up-target) or [`up.replace`](/up.flow#up.replace):
|
1363
1343
|
|
1364
|
-
up.
|
1344
|
+
up.on('up:fragment:inserted', function($fragment) {
|
1365
1345
|
console.log("Looks like we have a new %o!", $fragment);
|
1366
1346
|
});
|
1367
1347
|
|
@@ -1369,12 +1349,12 @@ The event is triggered *before* Up has compiled the fragment with your [custom b
|
|
1369
1349
|
Upon receiving the event, Up.js will start compilation.
|
1370
1350
|
|
1371
1351
|
|
1372
|
-
\#\#\# `fragment:
|
1352
|
+
\#\#\# `fragment:destroyed` event
|
1373
1353
|
|
1374
1354
|
This event is triggered when Up.js is destroying an HTML fragment, e.g. because it's being replaced
|
1375
1355
|
with a new version or because someone explicitly called [`up.destroy`](/up.flow#up.destroy):
|
1376
1356
|
|
1377
|
-
up.
|
1357
|
+
up.on('up:fragment:destroyed', function($fragment) {
|
1378
1358
|
console.log("Looks like we lost %o!", $fragment);
|
1379
1359
|
});
|
1380
1360
|
|
@@ -1397,127 +1377,66 @@ We need to work on this page:
|
|
1397
1377
|
(function() {
|
1398
1378
|
var slice = [].slice;
|
1399
1379
|
|
1400
|
-
up.bus = (function() {
|
1401
|
-
var
|
1380
|
+
up.bus = (function($) {
|
1381
|
+
var emit, nobodyPrevents, reset, u;
|
1402
1382
|
u = up.util;
|
1403
|
-
callbacksByEvent = {};
|
1404
|
-
defaultCallbacksByEvent = {};
|
1405
1383
|
|
1406
1384
|
/**
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
@
|
1411
|
-
|
1412
|
-
|
1413
|
-
reset = function() {
|
1414
|
-
return callbacksByEvent = u.copy(defaultCallbacksByEvent);
|
1415
|
-
};
|
1416
|
-
callbacksFor = function(event) {
|
1417
|
-
return callbacksByEvent[event] || (callbacksByEvent[event] = []);
|
1418
|
-
};
|
1419
|
-
|
1420
|
-
/**
|
1421
|
-
Makes a snapshot of the currently registered bus listeners,
|
1422
|
-
to later be restored through [`up.bus.reset`](/up.bus#up.bus.reset)
|
1423
|
-
|
1424
|
-
@private
|
1425
|
-
@method up.bus.snapshot
|
1426
|
-
*/
|
1427
|
-
snapshot = function() {
|
1428
|
-
var callbacks, event, results;
|
1429
|
-
defaultCallbacksByEvent = {};
|
1430
|
-
results = [];
|
1431
|
-
for (event in callbacksByEvent) {
|
1432
|
-
callbacks = callbacksByEvent[event];
|
1433
|
-
results.push(defaultCallbacksByEvent[event] = u.copy(callbacks));
|
1434
|
-
}
|
1435
|
-
return results;
|
1436
|
-
};
|
1437
|
-
|
1438
|
-
/**
|
1439
|
-
Registers an event handler to be called when the given
|
1440
|
-
event is triggered.
|
1441
|
-
|
1442
|
-
@method up.bus.on
|
1443
|
-
@param {String} eventNames
|
1444
|
-
A space-separated list of event names to match.
|
1445
|
-
@param {Function} handler
|
1446
|
-
The event handler to be called with the event arguments.
|
1447
|
-
@return {Function}
|
1448
|
-
A function that unregisters the given handlers
|
1385
|
+
@method up.bus.emit
|
1386
|
+
@param {String} eventName
|
1387
|
+
The name of the event.
|
1388
|
+
@param args...
|
1389
|
+
The arguments that describe the event.
|
1390
|
+
@protected
|
1449
1391
|
*/
|
1450
|
-
|
1451
|
-
var
|
1452
|
-
|
1453
|
-
|
1454
|
-
eventName = ref[i];
|
1455
|
-
callbacksFor(eventName).push(handler);
|
1392
|
+
emit = function(eventName, eventProps) {
|
1393
|
+
var $target, event;
|
1394
|
+
if (eventProps == null) {
|
1395
|
+
eventProps = {};
|
1456
1396
|
}
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1397
|
+
event = $.Event(eventName, eventProps);
|
1398
|
+
$target = eventProps.$element || $(document);
|
1399
|
+
u.debug("Emitting %o on %o with props %o", eventName, $target, eventProps);
|
1400
|
+
$target.trigger(event);
|
1401
|
+
return event;
|
1460
1402
|
};
|
1461
1403
|
|
1462
1404
|
/**
|
1463
|
-
|
1405
|
+
Emits an event with the given name and property.
|
1406
|
+
Returns whether any event listener has prevented the default action.
|
1464
1407
|
|
1465
|
-
@method
|
1466
|
-
@
|
1467
|
-
A space-separated list of event names .
|
1468
|
-
@param {Function} handler
|
1469
|
-
The event handler that should stop listening.
|
1408
|
+
@method nobodyPrevents
|
1409
|
+
@protected
|
1470
1410
|
*/
|
1471
|
-
|
1472
|
-
var
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
eventName = ref[i];
|
1477
|
-
results.push(u.remove(callbacksFor(eventName), handler));
|
1478
|
-
}
|
1479
|
-
return results;
|
1411
|
+
nobodyPrevents = function() {
|
1412
|
+
var args, event;
|
1413
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
1414
|
+
event = emit.apply(null, args);
|
1415
|
+
return !event.isDefaultPrevented();
|
1480
1416
|
};
|
1481
1417
|
|
1482
1418
|
/**
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
up.bus.on('foo:bar', function(x, y) {
|
1488
|
-
console.log("Value of x is " + x);
|
1489
|
-
console.log("Value of y is " + y);
|
1490
|
-
});
|
1491
|
-
|
1492
|
-
up.bus.emit('foo:bar', 'arg1', 'arg2')
|
1419
|
+
Resets Up.js to the state when it was booted.
|
1420
|
+
All custom event handlers, animations, etc. that have been registered
|
1421
|
+
will be discarded.
|
1493
1422
|
|
1494
|
-
|
1495
|
-
|
1496
|
-
// Value of x is arg1
|
1497
|
-
// Value of y is arg2
|
1423
|
+
This is an internal method for to enable unit testing.
|
1424
|
+
Don't use this in production.
|
1498
1425
|
|
1499
|
-
@
|
1500
|
-
@
|
1501
|
-
The name of the event.
|
1502
|
-
@param args...
|
1503
|
-
The arguments that describe the event.
|
1426
|
+
@protected
|
1427
|
+
@method up.reset
|
1504
1428
|
*/
|
1505
|
-
|
1506
|
-
|
1507
|
-
eventName = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
1508
|
-
callbacks = callbacksFor(eventName);
|
1509
|
-
return u.each(callbacks, function(callback) {
|
1510
|
-
return callback.apply(null, args);
|
1511
|
-
});
|
1429
|
+
reset = function() {
|
1430
|
+
return up.bus.emit('up:framework:reset');
|
1512
1431
|
};
|
1513
|
-
listen('framework:ready', snapshot);
|
1514
|
-
listen('framework:reset', reset);
|
1515
1432
|
return {
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1433
|
+
emit: emit,
|
1434
|
+
nobodyPrevents: nobodyPrevents,
|
1435
|
+
reset: reset
|
1519
1436
|
};
|
1520
|
-
})();
|
1437
|
+
})(jQuery);
|
1438
|
+
|
1439
|
+
up.reset = up.bus.reset;
|
1521
1440
|
|
1522
1441
|
}).call(this);
|
1523
1442
|
|
@@ -1541,8 +1460,8 @@ We need to work on this page:
|
|
1541
1460
|
(function() {
|
1542
1461
|
var slice = [].slice;
|
1543
1462
|
|
1544
|
-
up.magic = (function() {
|
1545
|
-
var DESTROYABLE_CLASS, DESTROYER_KEY, applyCompiler, compile, compiler, compilers, data, defaultCompilers, defaultLiveDescriptions, destroy, live, liveDescriptions, onEscape,
|
1463
|
+
up.magic = (function($) {
|
1464
|
+
var DESTROYABLE_CLASS, DESTROYER_KEY, applyCompiler, compile, compiler, compilers, data, defaultCompilers, defaultLiveDescriptions, destroy, hello, live, liveDescriptions, onEscape, reset, snapshot, u, upListenerToJqueryListener;
|
1546
1465
|
u = up.util;
|
1547
1466
|
DESTROYABLE_CLASS = 'up-destroyable';
|
1548
1467
|
DESTROYER_KEY = 'up-destroyer';
|
@@ -1595,8 +1514,10 @@ We need to work on this page:
|
|
1595
1514
|
@method up.on
|
1596
1515
|
@param {String} events
|
1597
1516
|
A space-separated list of event names to bind.
|
1598
|
-
@param {String} selector
|
1599
|
-
The selector an on which the event must be triggered.
|
1517
|
+
@param {String} [selector]
|
1518
|
+
The selector of an element on which the event must be triggered.
|
1519
|
+
Omit the selector to listen to all events with that name, regardless
|
1520
|
+
of the event target.
|
1600
1521
|
@param {Function(event, $element, data)} behavior
|
1601
1522
|
The handler that should be called.
|
1602
1523
|
The function takes the affected element as the first argument (as a jQuery object).
|
@@ -1605,16 +1526,28 @@ We need to work on this page:
|
|
1605
1526
|
*/
|
1606
1527
|
liveDescriptions = [];
|
1607
1528
|
defaultLiveDescriptions = null;
|
1608
|
-
|
1609
|
-
|
1529
|
+
|
1530
|
+
/**
|
1531
|
+
* Convert an Up.js style listener (second argument is the event target
|
1532
|
+
* as a jQuery collection) to a vanilla jQuery listener
|
1533
|
+
*/
|
1534
|
+
upListenerToJqueryListener = function(upListener) {
|
1535
|
+
return function(event) {
|
1536
|
+
var $me;
|
1537
|
+
$me = event.$element || $(this);
|
1538
|
+
return upListener.apply($me.get(0), [event, $me, data($me)]);
|
1539
|
+
};
|
1540
|
+
};
|
1541
|
+
live = function() {
|
1542
|
+
var args, behavior, description, lastIndex, ref;
|
1543
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
1610
1544
|
if (!up.browser.isSupported()) {
|
1611
1545
|
return;
|
1612
1546
|
}
|
1613
|
-
description =
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
];
|
1547
|
+
description = u.copy(args);
|
1548
|
+
lastIndex = description.length - 1;
|
1549
|
+
behavior = description[lastIndex];
|
1550
|
+
description[lastIndex] = upListenerToJqueryListener(behavior);
|
1618
1551
|
liveDescriptions.push(description);
|
1619
1552
|
return (ref = $(document)).on.apply(ref, description);
|
1620
1553
|
};
|
@@ -1883,14 +1816,16 @@ We need to work on this page:
|
|
1883
1816
|
other Up.js methods. You will only need to call this if you
|
1884
1817
|
manipulate the DOM without going through Up.js.
|
1885
1818
|
|
1886
|
-
@method up.
|
1887
|
-
@param {String|Element|jQuery}
|
1819
|
+
@method up.hello
|
1820
|
+
@param {String|Element|jQuery} selectorOrElement
|
1888
1821
|
*/
|
1889
|
-
|
1890
|
-
var $
|
1891
|
-
$
|
1892
|
-
up.bus.emit('fragment:
|
1893
|
-
|
1822
|
+
hello = function(selectorOrElement) {
|
1823
|
+
var $element;
|
1824
|
+
$element = $(selectorOrElement);
|
1825
|
+
up.bus.emit('up:fragment:inserted', {
|
1826
|
+
$element: $element
|
1827
|
+
});
|
1828
|
+
return $element;
|
1894
1829
|
};
|
1895
1830
|
onEscape = function(handler) {
|
1896
1831
|
return live('keydown', 'body', function(event) {
|
@@ -1899,33 +1834,38 @@ We need to work on this page:
|
|
1899
1834
|
}
|
1900
1835
|
});
|
1901
1836
|
};
|
1902
|
-
|
1903
|
-
return
|
1837
|
+
live('ready', (function() {
|
1838
|
+
return hello(document.body);
|
1904
1839
|
}));
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1840
|
+
live('up:fragment:inserted', function(event) {
|
1841
|
+
return compile(event.$element);
|
1842
|
+
});
|
1843
|
+
live('up:fragment:destroy', function(event) {
|
1844
|
+
return destroy(event.$element);
|
1845
|
+
});
|
1846
|
+
live('up:framework:boot', snapshot);
|
1847
|
+
live('up:framework:reset', reset);
|
1909
1848
|
return {
|
1910
1849
|
compiler: compiler,
|
1911
1850
|
on: live,
|
1912
|
-
|
1851
|
+
hello: hello,
|
1913
1852
|
onEscape: onEscape,
|
1914
1853
|
data: data
|
1915
1854
|
};
|
1916
|
-
})();
|
1855
|
+
})(jQuery);
|
1917
1856
|
|
1918
1857
|
up.compiler = up.magic.compiler;
|
1919
1858
|
|
1920
1859
|
up.on = up.magic.on;
|
1921
1860
|
|
1922
|
-
up.
|
1861
|
+
up.hello = up.magic.hello;
|
1862
|
+
|
1863
|
+
up.ready = function() {
|
1864
|
+
return up.util.error('up.ready no longer exists. Please use up.hello instead.');
|
1865
|
+
};
|
1923
1866
|
|
1924
1867
|
up.awaken = function() {
|
1925
|
-
|
1926
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
1927
|
-
up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version");
|
1928
|
-
return up.compiler.apply(up, args);
|
1868
|
+
return up.util.error('up.awaken no longer exists. Please use up.compiler instead.');
|
1929
1869
|
};
|
1930
1870
|
|
1931
1871
|
}).call(this);
|
@@ -1946,16 +1886,16 @@ We need to work on this page:
|
|
1946
1886
|
*/
|
1947
1887
|
|
1948
1888
|
(function() {
|
1949
|
-
up.history = (function() {
|
1889
|
+
up.history = (function($) {
|
1950
1890
|
var buildState, config, currentUrl, isCurrentUrl, manipulate, nextPreviousUrl, normalizeUrl, observeNewUrl, pop, previousUrl, push, register, replace, reset, restoreStateOnPop, u;
|
1951
1891
|
u = up.util;
|
1952
1892
|
|
1953
1893
|
/**
|
1954
|
-
@method up.history.
|
1955
|
-
@param {Array<String>} [
|
1894
|
+
@method up.history.config
|
1895
|
+
@param {Array<String>} [config.popTargets=['body']]
|
1956
1896
|
An array of CSS selectors to replace when the user goes
|
1957
1897
|
back in history.
|
1958
|
-
@param {Boolean} [
|
1898
|
+
@param {Boolean} [config.restoreScroll=true]
|
1959
1899
|
Whether to restore the known scroll positions
|
1960
1900
|
when the user goes back or forward in history.
|
1961
1901
|
*/
|
@@ -2121,9 +2061,12 @@ We need to work on this page:
|
|
2121
2061
|
return up.link.makeFollowable($link);
|
2122
2062
|
}
|
2123
2063
|
});
|
2124
|
-
up.
|
2064
|
+
up.on('up:framework:reset', reset);
|
2125
2065
|
return {
|
2126
|
-
|
2066
|
+
config: config,
|
2067
|
+
defaults: function() {
|
2068
|
+
return u.error('up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.');
|
2069
|
+
},
|
2127
2070
|
push: push,
|
2128
2071
|
replace: replace,
|
2129
2072
|
url: currentUrl,
|
@@ -2132,7 +2075,7 @@ We need to work on this page:
|
|
2132
2075
|
},
|
2133
2076
|
normalizeUrl: normalizeUrl
|
2134
2077
|
};
|
2135
|
-
})();
|
2078
|
+
})(jQuery);
|
2136
2079
|
|
2137
2080
|
}).call(this);
|
2138
2081
|
|
@@ -2148,37 +2091,37 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2148
2091
|
(function() {
|
2149
2092
|
var slice = [].slice;
|
2150
2093
|
|
2151
|
-
up.layout = (function() {
|
2094
|
+
up.layout = (function($) {
|
2152
2095
|
var SCROLL_PROMISE_KEY, anchoredRight, config, finishScrolling, fixedChildren, lastScrollTops, measureObstruction, reset, restoreScroll, reveal, saveScroll, scroll, scrollTops, u, viewportOf, viewportSelector, viewports, viewportsWithin;
|
2153
2096
|
u = up.util;
|
2154
2097
|
|
2155
2098
|
/**
|
2156
2099
|
Configures the application layout.
|
2157
2100
|
|
2158
|
-
@method up.layout.
|
2159
|
-
@param {Array<String>} [
|
2101
|
+
@method up.layout.config
|
2102
|
+
@param {Array<String>} [config.viewports]
|
2160
2103
|
An array of CSS selectors that find viewports
|
2161
2104
|
(containers that scroll their contents).
|
2162
|
-
@param {Array<String>} [
|
2105
|
+
@param {Array<String>} [config.fixedTop]
|
2163
2106
|
An array of CSS selectors that find elements fixed to the
|
2164
2107
|
top edge of the screen (using `position: fixed`).
|
2165
|
-
@param {Array<String>} [
|
2108
|
+
@param {Array<String>} [config.fixedBottom]
|
2166
2109
|
An array of CSS selectors that find elements fixed to the
|
2167
2110
|
bottom edge of the screen (using `position: fixed`).
|
2168
|
-
@param {Array<String>} [
|
2111
|
+
@param {Array<String>} [config.anchoredRight]
|
2169
2112
|
An array of CSS selectors that find elements anchored to the
|
2170
2113
|
right edge of the screen (using `position: fixed` or `position: absolute`).
|
2171
|
-
@param {Number} [
|
2114
|
+
@param {Number} [config.duration]
|
2172
2115
|
The duration of the scrolling animation in milliseconds.
|
2173
2116
|
Setting this to `0` will disable scrolling animations.
|
2174
|
-
@param {String} [
|
2117
|
+
@param {String} [config.easing]
|
2175
2118
|
The timing function that controls the animation's acceleration.
|
2176
2119
|
See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
|
2177
2120
|
for a list of pre-defined timing functions.
|
2178
|
-
@param {Number} [
|
2121
|
+
@param {Number} [config.snap]
|
2179
2122
|
When [revealing](#up.reveal) elements, Up.js will scroll an viewport
|
2180
|
-
to the top when the revealed element is closer to the top than `
|
2181
|
-
@param {Number} [
|
2123
|
+
to the top when the revealed element is closer to the top than `config.snap`.
|
2124
|
+
@param {Number} [config.substance]
|
2182
2125
|
A number indicating how many top pixel rows of an element to [reveal](#up.reveal).
|
2183
2126
|
*/
|
2184
2127
|
config = u.config({
|
@@ -2346,7 +2289,7 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2346
2289
|
- the currently open [modal](/up.modal)
|
2347
2290
|
- an element with the attribute `[up-viewport]`
|
2348
2291
|
- the `<body>` element
|
2349
|
-
- an element matching the selector you have configured using `up.viewport.
|
2292
|
+
- an element matching the selector you have configured using `up.viewport.config.viewports.push('my-custom-selector')`
|
2350
2293
|
|
2351
2294
|
\#\#\#\# Fixed elements obstruction the viewport
|
2352
2295
|
|
@@ -2356,7 +2299,7 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2356
2299
|
To make `up.aware` of these fixed elements you can either:
|
2357
2300
|
|
2358
2301
|
- give the element an attribute [`up-fixed="top"`](#up-fixed-top) or [`up-fixed="bottom"`](up-fixed-bottom)
|
2359
|
-
- [configure default options](#up.layout.
|
2302
|
+
- [configure default options](#up.layout.config) for `fixedTop` or `fixedBottom`
|
2360
2303
|
|
2361
2304
|
@method up.reveal
|
2362
2305
|
@param {String|Element|jQuery} element
|
@@ -2518,7 +2461,7 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2518
2461
|
|
2519
2462
|
/**
|
2520
2463
|
Saves the top scroll positions of all the
|
2521
|
-
viewports configured in `up.layout.
|
2464
|
+
viewports configured in [`up.layout.config.viewports`](#up.layout.config).
|
2522
2465
|
The saved scroll positions can be restored by calling
|
2523
2466
|
[`up.layout.restoreScroll()`](#up.layout.restoreScroll).
|
2524
2467
|
|
@@ -2539,7 +2482,7 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2539
2482
|
|
2540
2483
|
/**
|
2541
2484
|
Restores the top scroll positions of all the
|
2542
|
-
viewports configured in `up.layout.
|
2485
|
+
viewports configured in [`up.layout.config.viewports`](#up.layout.config).
|
2543
2486
|
|
2544
2487
|
@method up.layout.restoreScroll
|
2545
2488
|
@param {jQuery} [options.around]
|
@@ -2652,12 +2595,15 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2652
2595
|
@method [up-fixed=bottom]
|
2653
2596
|
@ujs
|
2654
2597
|
*/
|
2655
|
-
up.
|
2598
|
+
up.on('up:framework:reset', reset);
|
2656
2599
|
return {
|
2657
2600
|
reveal: reveal,
|
2658
2601
|
scroll: scroll,
|
2659
2602
|
finishScrolling: finishScrolling,
|
2660
|
-
|
2603
|
+
config: config,
|
2604
|
+
defaults: function() {
|
2605
|
+
return u.error('up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.');
|
2606
|
+
},
|
2661
2607
|
viewportOf: viewportOf,
|
2662
2608
|
viewportsWithin: viewportsWithin,
|
2663
2609
|
viewports: viewports,
|
@@ -2667,7 +2613,7 @@ This modules contains functions to scroll the viewport and reveal contained elem
|
|
2667
2613
|
anchoredRight: anchoredRight,
|
2668
2614
|
fixedChildren: fixedChildren
|
2669
2615
|
};
|
2670
|
-
})();
|
2616
|
+
})(jQuery);
|
2671
2617
|
|
2672
2618
|
up.scroll = up.layout.scroll;
|
2673
2619
|
|
@@ -2694,8 +2640,8 @@ We need to work on this page:
|
|
2694
2640
|
*/
|
2695
2641
|
|
2696
2642
|
(function() {
|
2697
|
-
up.flow = (function() {
|
2698
|
-
var autofocus, destroy, elementsInserted, findOldFragment, first, fragmentNotFound, implant, isRealElement, parseImplantSteps, parseResponse, reload, replace,
|
2643
|
+
up.flow = (function($) {
|
2644
|
+
var autofocus, destroy, elementsInserted, findOldFragment, first, fragmentNotFound, implant, isRealElement, parseImplantSteps, parseResponse, reload, replace, reveal, setSource, source, swapElements, u;
|
2699
2645
|
u = up.util;
|
2700
2646
|
setSource = function(element, sourceUrl) {
|
2701
2647
|
var $element;
|
@@ -2885,7 +2831,7 @@ We need to work on this page:
|
|
2885
2831
|
});
|
2886
2832
|
}
|
2887
2833
|
autofocus($new);
|
2888
|
-
return up.
|
2834
|
+
return up.hello($new);
|
2889
2835
|
};
|
2890
2836
|
swapElements = function($old, $new, pseudoClass, transition, options) {
|
2891
2837
|
var $wrapper, insertionMethod;
|
@@ -2999,23 +2945,31 @@ We need to work on this page:
|
|
2999
2945
|
destroy = function(selectorOrElement, options) {
|
3000
2946
|
var $element, animateOptions, animationDeferred;
|
3001
2947
|
$element = $(selectorOrElement);
|
3002
|
-
|
3003
|
-
|
3004
|
-
})
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
up.
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
2948
|
+
if (up.bus.nobodyPrevents('up:fragment:destroy', {
|
2949
|
+
$element: $element
|
2950
|
+
})) {
|
2951
|
+
options = u.options(options, {
|
2952
|
+
animation: 'none'
|
2953
|
+
});
|
2954
|
+
animateOptions = up.motion.animateOptions(options);
|
2955
|
+
$element.addClass('up-destroying');
|
2956
|
+
if (u.isPresent(options.url)) {
|
2957
|
+
up.history.push(options.url);
|
2958
|
+
}
|
2959
|
+
if (u.isPresent(options.title)) {
|
2960
|
+
document.title = options.title;
|
2961
|
+
}
|
2962
|
+
animationDeferred = u.presence(options.animation, u.isDeferred) || up.motion.animate($element, options.animation, animateOptions);
|
2963
|
+
animationDeferred.then(function() {
|
2964
|
+
up.bus.emit('up:fragment:destroyed', {
|
2965
|
+
$element: $element
|
2966
|
+
});
|
2967
|
+
return $element.remove();
|
2968
|
+
});
|
2969
|
+
return animationDeferred;
|
2970
|
+
} else {
|
2971
|
+
return $.Deferred();
|
2972
|
+
}
|
3019
2973
|
};
|
3020
2974
|
|
3021
2975
|
/**
|
@@ -3038,22 +2992,7 @@ We need to work on this page:
|
|
3038
2992
|
sourceUrl = options.url || source(selectorOrElement);
|
3039
2993
|
return replace(selectorOrElement, sourceUrl, options);
|
3040
2994
|
};
|
3041
|
-
|
3042
|
-
/**
|
3043
|
-
Resets Up.js to the state when it was booted.
|
3044
|
-
All custom event handlers, animations, etc. that have been registered
|
3045
|
-
will be discarded.
|
3046
|
-
|
3047
|
-
This is an internal method for to enable unit testing.
|
3048
|
-
Don't use this in production.
|
3049
|
-
|
3050
|
-
@protected
|
3051
|
-
@method up.reset
|
3052
|
-
*/
|
3053
|
-
reset = function() {
|
3054
|
-
return up.bus.emit('framework:reset');
|
3055
|
-
};
|
3056
|
-
up.bus.on('app:ready', function() {
|
2995
|
+
up.on('ready', function() {
|
3057
2996
|
return setSource(document.body, up.browser.url());
|
3058
2997
|
});
|
3059
2998
|
return {
|
@@ -3061,10 +3000,9 @@ We need to work on this page:
|
|
3061
3000
|
reload: reload,
|
3062
3001
|
destroy: destroy,
|
3063
3002
|
implant: implant,
|
3064
|
-
reset: reset,
|
3065
3003
|
first: first
|
3066
3004
|
};
|
3067
|
-
})();
|
3005
|
+
})(jQuery);
|
3068
3006
|
|
3069
3007
|
up.replace = up.flow.replace;
|
3070
3008
|
|
@@ -3072,8 +3010,6 @@ We need to work on this page:
|
|
3072
3010
|
|
3073
3011
|
up.destroy = up.flow.destroy;
|
3074
3012
|
|
3075
|
-
up.reset = up.flow.reset;
|
3076
|
-
|
3077
3013
|
up.first = up.flow.first;
|
3078
3014
|
|
3079
3015
|
}).call(this);
|
@@ -3107,7 +3043,7 @@ We need to work on this page:
|
|
3107
3043
|
*/
|
3108
3044
|
|
3109
3045
|
(function() {
|
3110
|
-
up.motion = (function() {
|
3046
|
+
up.motion = (function($) {
|
3111
3047
|
var GHOSTING_PROMISE_KEY, animate, animateOptions, animation, animations, assertIsDeferred, config, defaultAnimations, defaultTransitions, findAnimation, finish, finishGhosting, morph, none, prependCopy, reset, resolvableWhen, snapshot, transition, transitions, u, withGhosts;
|
3112
3048
|
u = up.util;
|
3113
3049
|
animations = {};
|
@@ -3118,10 +3054,10 @@ We need to work on this page:
|
|
3118
3054
|
/**
|
3119
3055
|
Sets default options for animations and transitions.
|
3120
3056
|
|
3121
|
-
@method up.motion.
|
3122
|
-
@param {Number} [
|
3123
|
-
@param {Number} [
|
3124
|
-
@param {String} [
|
3057
|
+
@method up.motion.config
|
3058
|
+
@param {Number} [config.duration=300]
|
3059
|
+
@param {Number} [config.delay=0]
|
3060
|
+
@param {String} [config.easing='ease']
|
3125
3061
|
*/
|
3126
3062
|
config = u.config({
|
3127
3063
|
duration: 300,
|
@@ -3241,7 +3177,7 @@ We need to work on this page:
|
|
3241
3177
|
return options;
|
3242
3178
|
};
|
3243
3179
|
findAnimation = function(name) {
|
3244
|
-
return animations[name] || u.error("Unknown animation %o",
|
3180
|
+
return animations[name] || u.error("Unknown animation %o", name);
|
3245
3181
|
};
|
3246
3182
|
GHOSTING_PROMISE_KEY = 'up-ghosting-promise';
|
3247
3183
|
withGhosts = function($old, $new, options, block) {
|
@@ -3677,8 +3613,8 @@ We need to work on this page:
|
|
3677
3613
|
transition('cross-fade', function($old, $new, options) {
|
3678
3614
|
return resolvableWhen(animate($old, 'fade-out', options), animate($new, 'fade-in', options));
|
3679
3615
|
});
|
3680
|
-
up.
|
3681
|
-
up.
|
3616
|
+
up.on('up:framework:boot', snapshot);
|
3617
|
+
up.on('up:framework:reset', reset);
|
3682
3618
|
return {
|
3683
3619
|
morph: morph,
|
3684
3620
|
animate: animate,
|
@@ -3686,12 +3622,15 @@ We need to work on this page:
|
|
3686
3622
|
finish: finish,
|
3687
3623
|
transition: transition,
|
3688
3624
|
animation: animation,
|
3689
|
-
|
3625
|
+
config: config,
|
3626
|
+
defaults: function() {
|
3627
|
+
return u.error('up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.');
|
3628
|
+
},
|
3690
3629
|
none: none,
|
3691
3630
|
when: resolvableWhen,
|
3692
3631
|
prependCopy: prependCopy
|
3693
3632
|
};
|
3694
|
-
})();
|
3633
|
+
})(jQuery);
|
3695
3634
|
|
3696
3635
|
up.transition = up.motion.transition;
|
3697
3636
|
|
@@ -3708,8 +3647,8 @@ Caching and preloading
|
|
3708
3647
|
======================
|
3709
3648
|
|
3710
3649
|
All HTTP requests go through the Up.js proxy.
|
3711
|
-
It caches a [limited](/up.proxy#up.proxy.
|
3712
|
-
for a [limited](/up.proxy#up.proxy.
|
3650
|
+
It caches a [limited](/up.proxy#up.proxy.config) number of server responses
|
3651
|
+
for a [limited](/up.proxy#up.proxy.config) amount of time,
|
3713
3652
|
making requests to these URLs return insantly.
|
3714
3653
|
|
3715
3654
|
The cache is cleared whenever the user makes a non-`GET` request
|
@@ -3750,13 +3689,13 @@ The `proxy:busy` event will be emitted after a delay of 300 ms
|
|
3750
3689
|
to prevent the spinner from flickering on and off.
|
3751
3690
|
You can change (or remove) this delay like this:
|
3752
3691
|
|
3753
|
-
up.proxy.
|
3692
|
+
up.proxy.config.busyDelay = 150;
|
3754
3693
|
|
3755
3694
|
@class up.proxy
|
3756
3695
|
*/
|
3757
3696
|
|
3758
3697
|
(function() {
|
3759
|
-
up.proxy = (function() {
|
3698
|
+
up.proxy = (function($) {
|
3760
3699
|
var $waitingLink, SAFE_HTTP_METHODS, ajax, alias, busy, busyDelayTimer, busyEventEmitted, cache, cacheKey, cancelBusyDelay, cancelPreloadDelay, checkPreload, clear, config, get, idle, isIdempotent, load, loadEnded, loadStarted, normalizeRequest, pendingCount, preload, preloadDelayTimer, remove, reset, set, startPreloadDelay, u;
|
3761
3700
|
u = up.util;
|
3762
3701
|
$waitingLink = void 0;
|
@@ -3766,17 +3705,17 @@ You can change (or remove) this delay like this:
|
|
3766
3705
|
busyEventEmitted = void 0;
|
3767
3706
|
|
3768
3707
|
/**
|
3769
|
-
@method up.proxy.
|
3770
|
-
@param {Number} [
|
3708
|
+
@method up.proxy.config
|
3709
|
+
@param {Number} [config.preloadDelay=75]
|
3771
3710
|
The number of milliseconds to wait before [`[up-preload]`](#up-preload)
|
3772
3711
|
starts preloading.
|
3773
|
-
@param {Number} [
|
3712
|
+
@param {Number} [config.cacheSize=70]
|
3774
3713
|
The maximum number of responses to cache.
|
3775
3714
|
If the size is exceeded, the oldest items will be dropped from the cache.
|
3776
|
-
@param {Number} [
|
3715
|
+
@param {Number} [config.cacheExpiry=300000]
|
3777
3716
|
The number of milliseconds until a cache entry expires.
|
3778
3717
|
Defaults to 5 minutes.
|
3779
|
-
@param {Number} [
|
3718
|
+
@param {Number} [config.busyDelay=300]
|
3780
3719
|
How long the proxy waits until emitting the `proxy:busy` [event](/up.bus).
|
3781
3720
|
Use this to prevent flickering of spinners.
|
3782
3721
|
*/
|
@@ -3937,7 +3876,7 @@ You can change (or remove) this delay like this:
|
|
3937
3876
|
if (wasIdle) {
|
3938
3877
|
emission = function() {
|
3939
3878
|
if (busy()) {
|
3940
|
-
up.bus.emit('proxy:busy');
|
3879
|
+
up.bus.emit('up:proxy:busy');
|
3941
3880
|
return busyEventEmitted = true;
|
3942
3881
|
}
|
3943
3882
|
};
|
@@ -3951,17 +3890,17 @@ You can change (or remove) this delay like this:
|
|
3951
3890
|
loadEnded = function() {
|
3952
3891
|
pendingCount -= 1;
|
3953
3892
|
if (idle() && busyEventEmitted) {
|
3954
|
-
up.bus.emit('proxy:idle');
|
3893
|
+
up.bus.emit('up:proxy:idle');
|
3955
3894
|
return busyEventEmitted = false;
|
3956
3895
|
}
|
3957
3896
|
};
|
3958
3897
|
load = function(request) {
|
3959
3898
|
var promise;
|
3960
3899
|
u.debug('Loading URL %o', request.url);
|
3961
|
-
up.bus.emit('proxy:load', request);
|
3900
|
+
up.bus.emit('up:proxy:load', request);
|
3962
3901
|
promise = u.ajax(request);
|
3963
3902
|
promise.always(function() {
|
3964
|
-
return up.bus.emit('proxy:receive', request);
|
3903
|
+
return up.bus.emit('up:proxy:receive', request);
|
3965
3904
|
});
|
3966
3905
|
return promise;
|
3967
3906
|
};
|
@@ -4028,7 +3967,7 @@ You can change (or remove) this delay like this:
|
|
4028
3967
|
return checkPreload($element);
|
4029
3968
|
}
|
4030
3969
|
});
|
4031
|
-
up.
|
3970
|
+
up.on('up:framework:reset', reset);
|
4032
3971
|
return {
|
4033
3972
|
preload: preload,
|
4034
3973
|
ajax: ajax,
|
@@ -4038,9 +3977,12 @@ You can change (or remove) this delay like this:
|
|
4038
3977
|
remove: remove,
|
4039
3978
|
idle: idle,
|
4040
3979
|
busy: busy,
|
4041
|
-
|
3980
|
+
config: config,
|
3981
|
+
defaults: function() {
|
3982
|
+
return u.error('up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.');
|
3983
|
+
}
|
4042
3984
|
};
|
4043
|
-
})();
|
3985
|
+
})(jQuery);
|
4044
3986
|
|
4045
3987
|
}).call(this);
|
4046
3988
|
|
@@ -4129,7 +4071,7 @@ Read on
|
|
4129
4071
|
*/
|
4130
4072
|
|
4131
4073
|
(function() {
|
4132
|
-
up.link = (function() {
|
4074
|
+
up.link = (function($) {
|
4133
4075
|
var childClicked, follow, followMethod, makeFollowable, shouldProcessLinkEvent, u, visit;
|
4134
4076
|
u = up.util;
|
4135
4077
|
|
@@ -4474,7 +4416,7 @@ Read on
|
|
4474
4416
|
childClicked: childClicked,
|
4475
4417
|
followMethod: followMethod
|
4476
4418
|
};
|
4477
|
-
})();
|
4419
|
+
})(jQuery);
|
4478
4420
|
|
4479
4421
|
up.visit = up.link.visit;
|
4480
4422
|
|
@@ -4507,7 +4449,7 @@ We need to work on this page:
|
|
4507
4449
|
*/
|
4508
4450
|
|
4509
4451
|
(function() {
|
4510
|
-
up.form = (function() {
|
4452
|
+
up.form = (function($) {
|
4511
4453
|
var observe, submit, u;
|
4512
4454
|
u = up.util;
|
4513
4455
|
|
@@ -4815,7 +4757,7 @@ We need to work on this page:
|
|
4815
4757
|
submit: submit,
|
4816
4758
|
observe: observe
|
4817
4759
|
};
|
4818
|
-
})();
|
4760
|
+
})(jQuery);
|
4819
4761
|
|
4820
4762
|
up.submit = up.form.submit;
|
4821
4763
|
|
@@ -4848,15 +4790,16 @@ We need to work on this page:
|
|
4848
4790
|
*/
|
4849
4791
|
|
4850
4792
|
(function() {
|
4851
|
-
up.popup = (function() {
|
4852
|
-
var autoclose, close, config, contains, createHiddenPopup, currentSource, discardHistory, ensureInViewport,
|
4793
|
+
up.popup = (function($) {
|
4794
|
+
var attach, autoclose, close, config, contains, createHiddenPopup, currentSource, discardHistory, ensureInViewport, rememberHistory, reset, setPosition, source, u, updated;
|
4853
4795
|
u = up.util;
|
4854
4796
|
currentSource = void 0;
|
4855
4797
|
|
4856
4798
|
/**
|
4857
|
-
@method up.popup.
|
4858
|
-
@param {String}
|
4859
|
-
@param {String}
|
4799
|
+
@method up.popup.config
|
4800
|
+
@param {String} config.openAnimation
|
4801
|
+
@param {String} config.closeAnimation
|
4802
|
+
@param {String} config.position
|
4860
4803
|
*/
|
4861
4804
|
config = u.config({
|
4862
4805
|
openAnimation: 'fade-in',
|
@@ -4968,9 +4911,9 @@ We need to work on this page:
|
|
4968
4911
|
};
|
4969
4912
|
|
4970
4913
|
/**
|
4971
|
-
|
4914
|
+
Attaches a popup overlay to the given element or selector.
|
4972
4915
|
|
4973
|
-
@method up.popup.
|
4916
|
+
@method up.popup.attach
|
4974
4917
|
@param {Element|jQuery|String} elementOrSelector
|
4975
4918
|
@param {String} [options.url]
|
4976
4919
|
@param {String} [options.position='bottom-right']
|
@@ -4987,7 +4930,7 @@ We need to work on this page:
|
|
4987
4930
|
open even if the page changes in the background.
|
4988
4931
|
@param {Object} [options.history=false]
|
4989
4932
|
*/
|
4990
|
-
|
4933
|
+
attach = function(linkOrSelector, options) {
|
4991
4934
|
var $link, $popup, animateOptions, animation, history, position, selector, sticky, url;
|
4992
4935
|
$link = $(linkOrSelector);
|
4993
4936
|
options = u.options(options);
|
@@ -5066,9 +5009,9 @@ We need to work on this page:
|
|
5066
5009
|
};
|
5067
5010
|
|
5068
5011
|
/**
|
5069
|
-
Opens
|
5012
|
+
Opens this link's destination of in a popup overlay:
|
5070
5013
|
|
5071
|
-
<a href="/decks" up-
|
5014
|
+
<a href="/decks" up-popup=".deck_list">Switch deck</a>
|
5072
5015
|
|
5073
5016
|
If the `up-sticky` attribute is set, the dialog does not auto-close
|
5074
5017
|
if a page fragment below the popup overlay updates:
|
@@ -5086,7 +5029,7 @@ We need to work on this page:
|
|
5086
5029
|
if ($link.is('.up-current')) {
|
5087
5030
|
return close();
|
5088
5031
|
} else {
|
5089
|
-
return
|
5032
|
+
return attach($link);
|
5090
5033
|
}
|
5091
5034
|
});
|
5092
5035
|
up.on('click', 'body', function(event, $body) {
|
@@ -5096,7 +5039,7 @@ We need to work on this page:
|
|
5096
5039
|
return close();
|
5097
5040
|
}
|
5098
5041
|
});
|
5099
|
-
up.
|
5042
|
+
up.on('up:fragment:inserted', function(event, $fragment) {
|
5100
5043
|
var newSource;
|
5101
5044
|
if (contains($fragment)) {
|
5102
5045
|
if (newSource = $fragment.attr('up-source')) {
|
@@ -5123,15 +5066,21 @@ We need to work on this page:
|
|
5123
5066
|
return event.preventDefault();
|
5124
5067
|
}
|
5125
5068
|
});
|
5126
|
-
up.
|
5069
|
+
up.on('up:framework:reset', reset);
|
5127
5070
|
return {
|
5128
|
-
|
5071
|
+
attach: attach,
|
5129
5072
|
close: close,
|
5130
5073
|
source: source,
|
5131
|
-
|
5132
|
-
|
5074
|
+
config: config,
|
5075
|
+
defaults: function() {
|
5076
|
+
return u.error('up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.');
|
5077
|
+
},
|
5078
|
+
contains: contains,
|
5079
|
+
open: function() {
|
5080
|
+
return up.warn('up.popup.open no longer exists. Please use up.popup.attach instead.');
|
5081
|
+
}
|
5133
5082
|
};
|
5134
|
-
})();
|
5083
|
+
})(jQuery);
|
5135
5084
|
|
5136
5085
|
}).call(this);
|
5137
5086
|
|
@@ -5148,32 +5097,30 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5148
5097
|
*/
|
5149
5098
|
|
5150
5099
|
(function() {
|
5151
|
-
|
5152
|
-
|
5153
|
-
up.modal = (function() {
|
5154
|
-
var autoclose, close, config, contains, createHiddenModal, currentSource, discardHistory, open, rememberHistory, reset, shiftElements, source, templateHtml, u, unshiftElements, updated;
|
5100
|
+
up.modal = (function($) {
|
5101
|
+
var autoclose, close, config, contains, createHiddenModal, currentSource, discardHistory, follow, open, rememberHistory, reset, shiftElements, source, templateHtml, u, unshiftElements, updated, visit;
|
5155
5102
|
u = up.util;
|
5156
5103
|
|
5157
5104
|
/**
|
5158
5105
|
Sets default options for future modals.
|
5159
5106
|
|
5160
|
-
@method up.modal.
|
5161
|
-
@param {Number} [
|
5107
|
+
@method up.modal.config
|
5108
|
+
@param {Number} [config.width]
|
5162
5109
|
The width of the dialog as a CSS value like `'400px'` or `50%`.
|
5163
5110
|
|
5164
5111
|
Defaults to `undefined`, meaning that the dialog will grow to fit its contents
|
5165
|
-
until it reaches `
|
5112
|
+
until it reaches `config.maxWidth`. Leaving this as `undefined` will
|
5166
5113
|
also allow you to control the width using CSS on `.up-modal-dialog´.
|
5167
|
-
@param {Number} [
|
5114
|
+
@param {Number} [config.maxWidth]
|
5168
5115
|
The width of the dialog as a CSS value like `'400px'` or `50%`.
|
5169
5116
|
You can set this to `undefined` to make the dialog fit its contents.
|
5170
5117
|
Be aware however, that e.g. Bootstrap stretches input elements
|
5171
5118
|
to `width: 100%`, meaning the dialog will also stretch to the full
|
5172
5119
|
width of the screen.
|
5173
|
-
@param {Number} [
|
5120
|
+
@param {Number} [config.height='auto']
|
5174
5121
|
The height of the dialog in pixels.
|
5175
5122
|
Defaults to `undefined`, meaning that the dialog will grow to fit its contents.
|
5176
|
-
@param {String|Function(config)} [
|
5123
|
+
@param {String|Function(config)} [config.template]
|
5177
5124
|
A string containing the HTML structure of the modal.
|
5178
5125
|
You can supply an alternative template string, but make sure that it
|
5179
5126
|
defines tag with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
|
@@ -5181,12 +5128,12 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5181
5128
|
You can also supply a function that returns a HTML string.
|
5182
5129
|
The function will be called with the modal options (merged from these defaults
|
5183
5130
|
and any per-open overrides) whenever a modal opens.
|
5184
|
-
@param {String} [
|
5131
|
+
@param {String} [config.closeLabel='X']
|
5185
5132
|
The label of the button that closes the dialog.
|
5186
|
-
@param {String} [
|
5133
|
+
@param {String} [config.openAnimation='fade-in']
|
5187
5134
|
The animation used to open the modal. The animation will be applied
|
5188
5135
|
to both the dialog box and the overlay dimming the page.
|
5189
|
-
@param {String} [
|
5136
|
+
@param {String} [config.closeAnimation='fade-out']
|
5190
5137
|
The animation used to close the modal. The animation will be applied
|
5191
5138
|
to both the dialog box and the overlay dimming the page.
|
5192
5139
|
*/
|
@@ -5278,33 +5225,31 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5278
5225
|
});
|
5279
5226
|
};
|
5280
5227
|
updated = function($modal, animation, animateOptions) {
|
5281
|
-
var
|
5282
|
-
up.bus.emit('modal:open');
|
5228
|
+
var deferred;
|
5283
5229
|
shiftElements();
|
5284
5230
|
$modal.show();
|
5285
|
-
|
5286
|
-
|
5287
|
-
return up.bus.emit('modal:opened');
|
5231
|
+
deferred = up.animate($modal, animation, animateOptions);
|
5232
|
+
return deferred.then(function() {
|
5233
|
+
return up.bus.emit('up:modal:opened');
|
5288
5234
|
});
|
5289
|
-
return promise;
|
5290
5235
|
};
|
5291
5236
|
|
5292
5237
|
/**
|
5293
5238
|
Opens the given link's destination in a modal overlay:
|
5294
5239
|
|
5295
5240
|
var $link = $('...');
|
5296
|
-
up.modal.
|
5241
|
+
up.modal.follow($link);
|
5297
5242
|
|
5298
5243
|
Any option attributes for [`a[up-modal]`](#a.up-modal) will be honored.
|
5299
5244
|
|
5300
5245
|
\#\#\#\# Events
|
5301
5246
|
|
5302
|
-
- Emits an [event](/up.bus) `modal:open` when the modal
|
5247
|
+
- Emits an [event](/up.bus) `up:modal:open` when the modal
|
5303
5248
|
is starting to open.
|
5304
|
-
- Emits an [event](/up.bus) `modal:opened` when the opening
|
5249
|
+
- Emits an [event](/up.bus) `up:modal:opened` when the opening
|
5305
5250
|
animation has finished and the modal contents are fully visible.
|
5306
5251
|
|
5307
|
-
@method up.modal.
|
5252
|
+
@method up.modal.follow
|
5308
5253
|
@param {Element|jQuery|String} elementOrSelector
|
5309
5254
|
The link to follow.
|
5310
5255
|
@param {String} [options.target]
|
@@ -5331,19 +5276,24 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5331
5276
|
@return {Promise}
|
5332
5277
|
A promise that will be resolved when the modal has finished loading.
|
5333
5278
|
*/
|
5279
|
+
follow = function($link, options) {
|
5280
|
+
options = u.options(options);
|
5281
|
+
options.$link = $link;
|
5282
|
+
return open(options);
|
5283
|
+
};
|
5334
5284
|
|
5335
5285
|
/**
|
5336
5286
|
Opens a modal for the given URL.
|
5337
5287
|
|
5338
5288
|
Example:
|
5339
5289
|
|
5340
|
-
up.modal.
|
5290
|
+
up.modal.visit('/foo', { target: '.list' })
|
5341
5291
|
|
5342
5292
|
This will request `/foo`, extract the `.list` selector from the response
|
5343
5293
|
and open the selected container in a modal dialog.
|
5344
5294
|
|
5345
|
-
@method up.modal.
|
5346
|
-
@param {String}
|
5295
|
+
@method up.modal.visit
|
5296
|
+
@param {String} url
|
5347
5297
|
The URL to load.
|
5348
5298
|
@param {String} options.target
|
5349
5299
|
The CSS selector to extract from the response.
|
@@ -5351,17 +5301,19 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5351
5301
|
@param {Object} options
|
5352
5302
|
See options for [previous `up.modal.open` variant](#up.modal.open).
|
5353
5303
|
*/
|
5354
|
-
|
5355
|
-
|
5356
|
-
|
5357
|
-
|
5358
|
-
|
5359
|
-
|
5360
|
-
|
5361
|
-
|
5362
|
-
|
5363
|
-
|
5304
|
+
visit = function(url, options) {
|
5305
|
+
options = u.options(options);
|
5306
|
+
options.url = url;
|
5307
|
+
return open(options);
|
5308
|
+
};
|
5309
|
+
|
5310
|
+
/**
|
5311
|
+
@private
|
5312
|
+
*/
|
5313
|
+
open = function(options) {
|
5314
|
+
var $link, $modal, animateOptions, animation, height, history, maxWidth, selector, sticky, url, width;
|
5364
5315
|
options = u.options(options);
|
5316
|
+
$link = u.option(options.$link, u.nullJquery());
|
5365
5317
|
url = u.option(options.url, $link.attr('up-href'), $link.attr('href'));
|
5366
5318
|
selector = u.option(options.target, $link.attr('up-modal'), 'body');
|
5367
5319
|
width = u.option(options.width, $link.attr('up-width'), config.width);
|
@@ -5372,19 +5324,25 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5372
5324
|
history = up.browser.canPushState() ? u.option(options.history, u.castedAttr($link, 'up-history'), true) : false;
|
5373
5325
|
animateOptions = up.motion.animateOptions(options, $link);
|
5374
5326
|
close();
|
5375
|
-
|
5376
|
-
|
5377
|
-
|
5378
|
-
|
5379
|
-
|
5380
|
-
|
5381
|
-
|
5382
|
-
|
5383
|
-
|
5384
|
-
|
5385
|
-
|
5386
|
-
|
5387
|
-
|
5327
|
+
if (up.bus.nobodyPrevents('up:modal:open', {
|
5328
|
+
url: url
|
5329
|
+
})) {
|
5330
|
+
$modal = createHiddenModal({
|
5331
|
+
selector: selector,
|
5332
|
+
width: width,
|
5333
|
+
maxWidth: maxWidth,
|
5334
|
+
height: height,
|
5335
|
+
sticky: sticky
|
5336
|
+
});
|
5337
|
+
return up.replace(selector, url, {
|
5338
|
+
history: history,
|
5339
|
+
insert: function() {
|
5340
|
+
return updated($modal, animation, animateOptions);
|
5341
|
+
}
|
5342
|
+
});
|
5343
|
+
} else {
|
5344
|
+
return $.Deferred();
|
5345
|
+
}
|
5388
5346
|
};
|
5389
5347
|
|
5390
5348
|
/**
|
@@ -5418,22 +5376,27 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5418
5376
|
var $modal, deferred;
|
5419
5377
|
$modal = $('.up-modal');
|
5420
5378
|
if ($modal.length) {
|
5421
|
-
|
5422
|
-
|
5423
|
-
|
5424
|
-
|
5425
|
-
|
5426
|
-
|
5427
|
-
|
5428
|
-
|
5429
|
-
|
5430
|
-
|
5431
|
-
|
5432
|
-
unshifter
|
5433
|
-
|
5434
|
-
|
5435
|
-
|
5436
|
-
|
5379
|
+
if (up.bus.nobodyPrevents('up:modal:close', {
|
5380
|
+
$element: $modal
|
5381
|
+
})) {
|
5382
|
+
options = u.options(options, {
|
5383
|
+
animation: config.closeAnimation,
|
5384
|
+
url: $modal.attr('up-previous-url'),
|
5385
|
+
title: $modal.attr('up-previous-title')
|
5386
|
+
});
|
5387
|
+
currentSource = void 0;
|
5388
|
+
deferred = up.destroy($modal, options);
|
5389
|
+
deferred.then(function() {
|
5390
|
+
var unshifter;
|
5391
|
+
while (unshifter = unshiftElements.pop()) {
|
5392
|
+
unshifter();
|
5393
|
+
}
|
5394
|
+
return up.bus.emit('up:modal:closed');
|
5395
|
+
});
|
5396
|
+
return deferred;
|
5397
|
+
} else {
|
5398
|
+
return $.Deferred();
|
5399
|
+
}
|
5437
5400
|
} else {
|
5438
5401
|
return u.resolvedDeferred();
|
5439
5402
|
}
|
@@ -5499,7 +5462,7 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5499
5462
|
</div>
|
5500
5463
|
|
5501
5464
|
If you want to change the design beyond CSS, you can
|
5502
|
-
configure Up.js to [use a different HTML structure](#up.modal.
|
5465
|
+
configure Up.js to [use a different HTML structure](#up.modal.config).
|
5503
5466
|
|
5504
5467
|
|
5505
5468
|
\#\#\#\# Closing behavior
|
@@ -5538,7 +5501,7 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5538
5501
|
return close();
|
5539
5502
|
}
|
5540
5503
|
});
|
5541
|
-
up.
|
5504
|
+
up.on('up:fragment:inserted', function(event, $fragment) {
|
5542
5505
|
var newSource;
|
5543
5506
|
if (contains($fragment)) {
|
5544
5507
|
if (newSource = $fragment.attr('up-source')) {
|
@@ -5565,15 +5528,22 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
|
|
5565
5528
|
return event.preventDefault();
|
5566
5529
|
}
|
5567
5530
|
});
|
5568
|
-
up.
|
5531
|
+
up.on('up:framework:reset', reset);
|
5569
5532
|
return {
|
5570
|
-
|
5533
|
+
visit: visit,
|
5534
|
+
follow: follow,
|
5535
|
+
open: function() {
|
5536
|
+
return up.error('up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.');
|
5537
|
+
},
|
5571
5538
|
close: close,
|
5572
5539
|
source: source,
|
5573
|
-
|
5540
|
+
config: config,
|
5541
|
+
defaults: function() {
|
5542
|
+
return u.error('up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.');
|
5543
|
+
},
|
5574
5544
|
contains: contains
|
5575
5545
|
};
|
5576
|
-
})();
|
5546
|
+
})(jQuery);
|
5577
5547
|
|
5578
5548
|
}).call(this);
|
5579
5549
|
|
@@ -5597,8 +5567,8 @@ We need to work on this page:
|
|
5597
5567
|
*/
|
5598
5568
|
|
5599
5569
|
(function() {
|
5600
|
-
up.tooltip = (function() {
|
5601
|
-
var close, createElement,
|
5570
|
+
up.tooltip = (function($) {
|
5571
|
+
var attach, close, createElement, setPosition, u;
|
5602
5572
|
u = up.util;
|
5603
5573
|
setPosition = function($link, $tooltip, position) {
|
5604
5574
|
var css, linkBox, tooltipBox;
|
@@ -5623,8 +5593,16 @@ We need to work on this page:
|
|
5623
5593
|
$tooltip.attr('up-position', position);
|
5624
5594
|
return $tooltip.css(css);
|
5625
5595
|
};
|
5626
|
-
createElement = function(
|
5627
|
-
|
5596
|
+
createElement = function(options) {
|
5597
|
+
var $element;
|
5598
|
+
$element = u.$createElementFromSelector('.up-tooltip');
|
5599
|
+
if (u.isGiven(options.text)) {
|
5600
|
+
$element.text(options.text);
|
5601
|
+
} else {
|
5602
|
+
$element.html(options.html);
|
5603
|
+
}
|
5604
|
+
$element.appendTo(document.body);
|
5605
|
+
return $element;
|
5628
5606
|
};
|
5629
5607
|
|
5630
5608
|
/**
|
@@ -5634,7 +5612,7 @@ We need to work on this page:
|
|
5634
5612
|
html: 'Enter multiple words or phrases'
|
5635
5613
|
});
|
5636
5614
|
|
5637
|
-
@method up.tooltip.
|
5615
|
+
@method up.tooltip.attach
|
5638
5616
|
@param {Element|jQuery|String} elementOrSelector
|
5639
5617
|
@param {String} [options.html]
|
5640
5618
|
The HTML to display in the tooltip.
|
@@ -5643,18 +5621,22 @@ We need to work on this page:
|
|
5643
5621
|
@param {String} [options.animation]
|
5644
5622
|
The animation to use when opening the tooltip.
|
5645
5623
|
*/
|
5646
|
-
|
5647
|
-
var $link, $tooltip, animateOptions, animation, html, position;
|
5624
|
+
attach = function(linkOrSelector, options) {
|
5625
|
+
var $link, $tooltip, animateOptions, animation, html, position, text;
|
5648
5626
|
if (options == null) {
|
5649
5627
|
options = {};
|
5650
5628
|
}
|
5651
5629
|
$link = $(linkOrSelector);
|
5652
|
-
html = u.option(options.html, $link.attr('up-tooltip')
|
5630
|
+
html = u.option(options.html, $link.attr('up-tooltip-html'));
|
5631
|
+
text = u.option(options.text, $link.attr('up-tooltip'), $link.attr('title'));
|
5653
5632
|
position = u.option(options.position, $link.attr('up-position'), 'top');
|
5654
5633
|
animation = u.option(options.animation, u.castedAttr($link, 'up-animation'), 'fade-in');
|
5655
5634
|
animateOptions = up.motion.animateOptions(options, $link);
|
5656
5635
|
close();
|
5657
|
-
$tooltip = createElement(
|
5636
|
+
$tooltip = createElement({
|
5637
|
+
text: text,
|
5638
|
+
html: html
|
5639
|
+
});
|
5658
5640
|
setPosition($link, $tooltip, position);
|
5659
5641
|
return up.animate($tooltip, animation, animateOptions);
|
5660
5642
|
};
|
@@ -5680,7 +5662,7 @@ We need to work on this page:
|
|
5680
5662
|
};
|
5681
5663
|
|
5682
5664
|
/**
|
5683
|
-
Displays a tooltip when hovering the mouse over this element:
|
5665
|
+
Displays a tooltip with text content when hovering the mouse over this element:
|
5684
5666
|
|
5685
5667
|
<a href="/decks" up-tooltip="Show all decks">Decks</a>
|
5686
5668
|
|
@@ -5691,7 +5673,16 @@ We need to work on this page:
|
|
5691
5673
|
@method [up-tooltip]
|
5692
5674
|
@ujs
|
5693
5675
|
*/
|
5694
|
-
|
5676
|
+
|
5677
|
+
/**
|
5678
|
+
Displays a tooltip with HTML content when hovering the mouse over this element:
|
5679
|
+
|
5680
|
+
<a href="/decks" up-tooltip="Show <b>all</b> decks">Decks</a>
|
5681
|
+
|
5682
|
+
@method [up-tooltip-html]
|
5683
|
+
@ujs
|
5684
|
+
*/
|
5685
|
+
up.compiler('[up-tooltip], [up-tooltip-html]', function($link) {
|
5695
5686
|
$link.on('mouseover', function() {
|
5696
5687
|
return open($link);
|
5697
5688
|
});
|
@@ -5702,15 +5693,18 @@ We need to work on this page:
|
|
5702
5693
|
up.on('click', 'body', function(event, $body) {
|
5703
5694
|
return close();
|
5704
5695
|
});
|
5705
|
-
up.
|
5696
|
+
up.on('up:framework:reset', close);
|
5706
5697
|
up.magic.onEscape(function() {
|
5707
5698
|
return close();
|
5708
5699
|
});
|
5709
5700
|
return {
|
5710
|
-
|
5711
|
-
close: close
|
5701
|
+
attach: attach,
|
5702
|
+
close: close,
|
5703
|
+
open: function() {
|
5704
|
+
return u.error('up.tooltip.open no longer exists. Use up.tooltip.attach instead.');
|
5705
|
+
}
|
5712
5706
|
};
|
5713
|
-
})();
|
5707
|
+
})(jQuery);
|
5714
5708
|
|
5715
5709
|
}).call(this);
|
5716
5710
|
|
@@ -5729,16 +5723,16 @@ by providing instant feedback for user interactions.
|
|
5729
5723
|
*/
|
5730
5724
|
|
5731
5725
|
(function() {
|
5732
|
-
up.navigation = (function() {
|
5726
|
+
up.navigation = (function($) {
|
5733
5727
|
var CLASS_ACTIVE, SELECTORS_SECTION, SELECTOR_ACTIVE, SELECTOR_SECTION, SELECTOR_SECTION_INSTANT, config, currentClass, enlargeClickArea, locationChanged, normalizeUrl, reset, sectionClicked, sectionUrls, selector, u, unmarkActive, urlSet;
|
5734
5728
|
u = up.util;
|
5735
5729
|
|
5736
5730
|
/**
|
5737
5731
|
Sets default options for this module.
|
5738
5732
|
|
5739
|
-
@method up.navigation.
|
5740
|
-
@param {Number} [
|
5741
|
-
|
5733
|
+
@method up.navigation.config
|
5734
|
+
@param {Number} [config.currentClasses]
|
5735
|
+
An array of classes to set on [links that point the current location](#up-current).
|
5742
5736
|
*/
|
5743
5737
|
config = u.config({
|
5744
5738
|
currentClasses: ['up-current']
|
@@ -5927,97 +5921,29 @@ by providing instant feedback for user interactions.
|
|
5927
5921
|
@method [up-current]
|
5928
5922
|
@ujs
|
5929
5923
|
*/
|
5930
|
-
up.
|
5924
|
+
up.on('up:fragment:inserted', function() {
|
5931
5925
|
unmarkActive();
|
5932
5926
|
return locationChanged();
|
5933
5927
|
});
|
5934
|
-
up.
|
5928
|
+
up.on('up:fragment:destroy', function(event, $fragment) {
|
5935
5929
|
if ($fragment.is('.up-modal, .up-popup')) {
|
5936
5930
|
return locationChanged();
|
5937
5931
|
}
|
5938
5932
|
});
|
5939
|
-
up.
|
5933
|
+
up.on('up:framework:reset', reset);
|
5940
5934
|
return {
|
5941
|
-
|
5942
|
-
|
5943
|
-
|
5944
|
-
|
5945
|
-
}).call(this);
|
5946
|
-
|
5947
|
-
/**
|
5948
|
-
Content slots
|
5949
|
-
=============
|
5950
|
-
|
5951
|
-
It can be useful to mark "slots" in your page layout where you expect
|
5952
|
-
content to appear in the future.
|
5953
|
-
|
5954
|
-
For example, you might have
|
5955
|
-
|
5956
|
-
<div up-slot class="alerts"></div>
|
5957
|
-
|
5958
|
-
<script>
|
5959
|
-
up.compiler('.alerts', function ($element) {
|
5960
|
-
setInterval(3000, function() { up.reload('.alerts') });
|
5961
|
-
});
|
5962
|
-
</script>
|
5963
|
-
|
5964
|
-
Seeing that the `.alerts` container is empty, Up.js will hide it:
|
5965
|
-
|
5966
|
-
<div class="alerts" up-slot style="display: none"></div>
|
5967
|
-
|
5968
|
-
As soon as you
|
5969
|
-
|
5970
|
-
<div class="alerts" up-slot>
|
5971
|
-
Meeting at 11:30 AM
|
5972
|
-
</div>
|
5973
|
-
|
5974
|
-
|
5975
|
-
TODO: Write some documentation
|
5976
|
-
|
5977
|
-
@class up.slot
|
5978
|
-
*/
|
5979
|
-
|
5980
|
-
(function() {
|
5981
|
-
up.slot = (function() {
|
5982
|
-
var check, hasContent, u;
|
5983
|
-
u = up.util;
|
5984
|
-
hasContent = function($slot) {
|
5985
|
-
return u.trim($slot.html()) !== '';
|
5986
|
-
};
|
5987
|
-
check = function($element) {
|
5988
|
-
return u.findWithSelf($element, '[up-slot]').each(function() {
|
5989
|
-
var $slot;
|
5990
|
-
$slot = $(this);
|
5991
|
-
if (!hasContent($slot)) {
|
5992
|
-
return $slot.hide();
|
5993
|
-
}
|
5994
|
-
});
|
5935
|
+
config: config,
|
5936
|
+
defaults: function() {
|
5937
|
+
return u.error('up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.');
|
5938
|
+
}
|
5995
5939
|
};
|
5996
|
-
|
5997
|
-
/**
|
5998
|
-
Use this attribute to mark up empty element containers that
|
5999
|
-
you plan to update with content in the future.
|
6000
|
-
|
6001
|
-
An element with this attribute is automatically hidden
|
6002
|
-
if it has no content, and is re-shown if it is updated with
|
6003
|
-
content.
|
6004
|
-
|
6005
|
-
This is useful to prevent the element from applying unwanted
|
6006
|
-
margins to the surrounding page flow.
|
6007
|
-
|
6008
|
-
@method [up-slot]
|
6009
|
-
@ujs
|
6010
|
-
*/
|
6011
|
-
return up.bus.on('fragment:ready', check);
|
6012
|
-
})();
|
5940
|
+
})(jQuery);
|
6013
5941
|
|
6014
5942
|
}).call(this);
|
6015
5943
|
(function() {
|
6016
5944
|
if (up.browser.isSupported()) {
|
6017
|
-
up.bus.emit('framework:
|
6018
|
-
|
6019
|
-
return up.bus.emit('app:ready');
|
6020
|
-
});
|
5945
|
+
up.bus.emit('up:framework:boot');
|
5946
|
+
up.bus.emit('up:framework:booted');
|
6021
5947
|
}
|
6022
5948
|
|
6023
5949
|
}).call(this);
|