jqmobi-rails 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/lib/jqmobi/rails/version.rb +3 -3
- data/vendor/assets/javascripts/jq.mobi.js +37 -9
- data/vendor/assets/javascripts/jq.mobi_ujs.js +1 -2
- data/vendor/assets/javascripts/jq.ui.js +1725 -1673
- data/vendor/assets/javascripts/plugins/jq.carousel.js +9 -5
- data/vendor/assets/javascripts/plugins/jq.popup.js +8 -6
- data/vendor/assets/javascripts/plugins/jq.web.min.js +18 -18
- metadata +2 -2
data/README.md
CHANGED
@@ -18,7 +18,12 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Add these lines to the top of your app/assets/javascripts/application.js file:
|
22
|
+
|
23
|
+
```javascript
|
24
|
+
//= require jq.mobi
|
25
|
+
//= require jq.mobi_ujs
|
26
|
+
```
|
22
27
|
|
23
28
|
## Contributing
|
24
29
|
|
data/lib/jqmobi/rails/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Jqmobi
|
2
2
|
module Rails
|
3
|
-
VERSION = "0.0.
|
4
|
-
JQMOBI_VERSION = "1.
|
5
|
-
JQMOBI_UJS_VERSION = "
|
3
|
+
VERSION = "0.0.1"
|
4
|
+
JQMOBI_VERSION = "1.03"
|
5
|
+
JQMOBI_UJS_VERSION = "51f4668988122d5a915fa5a99ea55d9b2cb2a15e"
|
6
6
|
end
|
7
7
|
end
|
@@ -28,6 +28,34 @@ if (!window.jq || typeof (jq) !== "function") {
|
|
28
28
|
fragementRE=/^\s*<(\w+)[^>]*>/,
|
29
29
|
_attrCache={};
|
30
30
|
|
31
|
+
|
32
|
+
/**
|
33
|
+
* internal function to use domfragments for insertion
|
34
|
+
*
|
35
|
+
* @api private
|
36
|
+
*/
|
37
|
+
function _insertFragments(jqm,container,insert){
|
38
|
+
var frag=document.createDocumentFragment();
|
39
|
+
if(insert){
|
40
|
+
for(var j=jqm.length-1;j>=0;j--)
|
41
|
+
{
|
42
|
+
frag.insertBefore(jqm[j],frag.firstChild);
|
43
|
+
}
|
44
|
+
container.insertBefore(frag,container.firstChild);
|
45
|
+
|
46
|
+
}
|
47
|
+
else {
|
48
|
+
|
49
|
+
for(var j=0;j<jqm.length;j++)
|
50
|
+
frag.appendChild(jqm[j]);
|
51
|
+
container.appendChild(frag);
|
52
|
+
}
|
53
|
+
frag=null;
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
31
59
|
|
32
60
|
/**
|
33
61
|
* Internal function to test if a class name fits in a regular expression
|
@@ -769,11 +797,11 @@ if (!window.jq || typeof (jq) !== "function") {
|
|
769
797
|
element = $(element);
|
770
798
|
var i;
|
771
799
|
|
800
|
+
|
772
801
|
for (i = 0; i < this.length; i++) {
|
773
802
|
if (element.length && typeof element != "string") {
|
774
803
|
element = $(element);
|
775
|
-
|
776
|
-
insert != undefined ? this[i].insertBefore(element[j], this[i].firstChild) : this[i].appendChild(element[j]);
|
804
|
+
_insertFragments(element,this[i],insert);
|
777
805
|
} else {
|
778
806
|
var obj =fragementRE.test(element)?$(element):undefined;
|
779
807
|
if (obj == undefined || obj.length == 0) {
|
@@ -782,10 +810,7 @@ if (!window.jq || typeof (jq) !== "function") {
|
|
782
810
|
if (obj.nodeName != undefined && obj.nodeName.toLowerCase() == "script" && (!obj.type || obj.type.toLowerCase() === 'text/javascript')) {
|
783
811
|
window.eval(obj.innerHTML);
|
784
812
|
} else if(obj instanceof $jqm) {
|
785
|
-
|
786
|
-
{
|
787
|
-
insert != undefined ? this[i].insertBefore(obj[k], this[i].firstChild) : this[i].appendChild(obj[k]);
|
788
|
-
}
|
813
|
+
_insertFragments(obj,this[i],insert);
|
789
814
|
}
|
790
815
|
else {
|
791
816
|
insert != undefined ? this[i].insertBefore(obj, this[i].firstChild) : this[i].appendChild(obj);
|
@@ -874,8 +899,8 @@ if (!window.jq || typeof (jq) !== "function") {
|
|
874
899
|
return {
|
875
900
|
left: obj.left + window.pageXOffset,
|
876
901
|
top: obj.top + window.pageYOffset,
|
877
|
-
width: parseInt(
|
878
|
-
height: parseInt(
|
902
|
+
width: parseInt(obj.width),
|
903
|
+
height: parseInt(obj.height)
|
879
904
|
};
|
880
905
|
},
|
881
906
|
/**
|
@@ -1214,6 +1239,9 @@ if (!window.jq || typeof (jq) !== "function") {
|
|
1214
1239
|
if (!settings.headers)
|
1215
1240
|
settings.headers = {};
|
1216
1241
|
|
1242
|
+
if(!('async' in settings)||settings.async!==false)
|
1243
|
+
settings.async=true;
|
1244
|
+
|
1217
1245
|
if (!settings.dataType)
|
1218
1246
|
settings.dataType = "text/html";
|
1219
1247
|
else {
|
@@ -1291,7 +1319,7 @@ if (!window.jq || typeof (jq) !== "function") {
|
|
1291
1319
|
settings.complete.call(context, xhr, error ? 'error' : 'success');
|
1292
1320
|
}
|
1293
1321
|
};
|
1294
|
-
xhr.open(settings.type, settings.url,
|
1322
|
+
xhr.open(settings.type, settings.url, settings.async);
|
1295
1323
|
|
1296
1324
|
if (settings.contentType)
|
1297
1325
|
settings.headers['Content-Type'] = settings.contentType;
|
@@ -118,8 +118,7 @@
|
|
118
118
|
// memoized value from clicked submit button
|
119
119
|
var button = element.data('ujs:submit-button');
|
120
120
|
if (button) {
|
121
|
-
|
122
|
-
//data += '&' + encodeURIComponent(button);
|
121
|
+
data = data + '&' + encodeURIComponent(button.name) + '=' + encodeURIComponent(button.value);
|
123
122
|
element.data('ujs:submit-button', null);
|
124
123
|
}
|
125
124
|
} else if (element.filter(rails.inputChangeSelector).length > 0) {
|
@@ -796,15 +796,16 @@
|
|
796
796
|
</div></div>';
|
797
797
|
$(this.container).append($(markup));
|
798
798
|
|
799
|
-
$("#"
|
799
|
+
var $el=$("#"+this.id);
|
800
|
+
$el.bind("close", function(){
|
800
801
|
self.hide();
|
801
802
|
})
|
802
803
|
|
803
804
|
if (this.cancelOnly) {
|
804
|
-
$
|
805
|
-
$
|
805
|
+
$el.find('A#action').hide();
|
806
|
+
$el.find('A#cancel').addClass('center');
|
806
807
|
}
|
807
|
-
$
|
808
|
+
$el.find('A').each(function() {
|
808
809
|
var button = $(this);
|
809
810
|
button.bind('click', function(e) {
|
810
811
|
if (button.attr('id') == 'cancel') {
|
@@ -820,8 +821,8 @@
|
|
820
821
|
});
|
821
822
|
self.positionPopup();
|
822
823
|
$.blockUI(0.5);
|
823
|
-
$
|
824
|
-
$
|
824
|
+
$el.removeClass('hidden');
|
825
|
+
$el.bind("orientationchange", function() {
|
825
826
|
self.positionPopup();
|
826
827
|
});
|
827
828
|
|
@@ -841,6 +842,7 @@
|
|
841
842
|
remove: function() {
|
842
843
|
var self = this;
|
843
844
|
var $el=$("#"+self.id);
|
845
|
+
$el.unbind("close");
|
844
846
|
$el.find('BUTTON#action').unbind('click');
|
845
847
|
$el.find('BUTTON#cancel').unbind('click');
|
846
848
|
$el.unbind("orientationchange").remove();
|
@@ -1354,1673 +1356,1723 @@
|
|
1354
1356
|
};
|
1355
1357
|
}
|
1356
1358
|
})(jq);
|
1357
|
-
/**
|
1358
|
-
* jq.ui - A User Interface library for creating jqMobi applications
|
1359
|
-
*
|
1360
|
-
* @copyright 2011
|
1361
|
-
* @author AppMobi
|
1362
|
-
*/(function($) {
|
1363
|
-
|
1364
|
-
var hasLaunched = false;
|
1365
|
-
var startPath = window.location.pathname;
|
1366
|
-
var defaultHash = window.location.hash;
|
1367
|
-
var previousTarget = defaultHash;
|
1368
|
-
|
1369
|
-
|
1370
|
-
if(!("pushState" in window.history)){
|
1371
|
-
window.history['pushState']=function(){}
|
1372
|
-
}
|
1373
|
-
var ui = function() {
|
1374
|
-
// Init the page
|
1375
|
-
var that = this;
|
1376
|
-
if (window.AppMobi)
|
1377
|
-
document.addEventListener("appMobi.device.ready", function() {
|
1378
|
-
that.hasLaunched = true;
|
1379
|
-
if (that.autoLaunch) {
|
1380
|
-
that.launch();
|
1381
|
-
}
|
1382
|
-
}, false);
|
1383
|
-
else if (document.readyState == "complete" || document.readyState == "loaded") {
|
1384
|
-
that.hasLaunched = true;
|
1385
|
-
if (that.autoLaunch) {
|
1386
|
-
that.launch();
|
1387
|
-
}
|
1388
|
-
} else
|
1389
|
-
document.addEventListener("DOMContentLoaded", function() {
|
1390
|
-
that.hasLaunched = true;
|
1391
|
-
if (that.autoLaunch) {
|
1392
|
-
that.launch();
|
1393
|
-
}
|
1394
|
-
}, false);
|
1395
|
-
if (!window.AppMobi)
|
1396
|
-
AppMobi = {}, AppMobi.webRoot = "";
|
1397
|
-
window.addEventListener("popstate", function() {
|
1398
|
-
that.goBack();
|
1399
|
-
}, false);
|
1400
|
-
|
1401
|
-
/**
|
1402
|
-
* Helper function to setup the transition objects
|
1403
|
-
* Custom transitions can be added via $.ui.availableTransitions
|
1404
|
-
```
|
1405
|
-
$.ui.availableTransitions['none']=function();
|
1406
|
-
```
|
1407
|
-
*/
|
1408
|
-
(function(obj) {
|
1409
|
-
obj.availableTransitions = {};
|
1410
|
-
obj.availableTransitions['none'] = that.noTransition;
|
1411
|
-
obj.availableTransitions['default'] = that.noTransition;
|
1412
|
-
})(this);
|
1413
|
-
};
|
1414
|
-
|
1415
|
-
|
1416
|
-
ui.prototype = {
|
1417
|
-
fixAndroidInputs:true,
|
1418
|
-
isAjaxApp:false,
|
1419
|
-
isAppMobi: false,
|
1420
|
-
showLoading:true,
|
1421
|
-
navbar: "",
|
1422
|
-
header: "",
|
1423
|
-
viewportContainer: "",
|
1424
|
-
backButton: "",
|
1425
|
-
remotePages: {},
|
1426
|
-
history: [],
|
1427
|
-
homeDiv: "",
|
1428
|
-
screenWidth: "",
|
1429
|
-
content: "",
|
1430
|
-
modalWindow: "",
|
1431
|
-
customFooter: false,
|
1432
|
-
defaultFooter: "",
|
1433
|
-
defaultHeader: null,
|
1434
|
-
customMenu: false,
|
1435
|
-
defaultMenu: "",
|
1436
|
-
_readyFunc: null,
|
1437
|
-
doingTransition: false,
|
1438
|
-
passwordBox: new jq.passwordBox(),
|
1439
|
-
selectBox: jq.selectBox,
|
1440
|
-
ajaxUrl: "",
|
1441
|
-
transitionType: "slide",
|
1442
|
-
scrollingDivs: [],
|
1443
|
-
firstDiv: "",
|
1444
|
-
remoteJSPages: {},
|
1445
|
-
hasLaunched: false,
|
1446
|
-
launchCompleted: false,
|
1447
|
-
activeDiv: "",
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
$.ui.loadDefaultHash=
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
$.ui.actionsheet("
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
* @
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
$.ui.popup(
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
* @
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
* @
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
jq("#
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
* @
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
* @
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
this.
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
this.
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
* @param {String}
|
1665
|
-
* @param {String}
|
1666
|
-
* @
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
badge
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
$.ui.
|
1700
|
-
```
|
1701
|
-
* @param {
|
1702
|
-
* @title $.ui.
|
1703
|
-
*/
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
jq("#menu").
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
jq("#
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
```
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
},
|
1876
|
-
/**
|
1877
|
-
*
|
1878
|
-
```
|
1879
|
-
$.ui.
|
1880
|
-
```
|
1881
|
-
|
1882
|
-
* @param {String} value
|
1883
|
-
* @title $.ui.
|
1884
|
-
*/
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
*
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
```
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
*
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
*
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
if (addScroller) {
|
2036
|
-
this.
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
tmp
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
*
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
*
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
if (
|
2138
|
-
|
2139
|
-
that.
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
{
|
2148
|
-
that.customHeader =
|
2149
|
-
that.updateHeaderElements(
|
2150
|
-
}
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
that.
|
2165
|
-
}
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2198
|
-
|
2199
|
-
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2205
|
-
}
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
var
|
2282
|
-
|
2283
|
-
|
2284
|
-
if (
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
var
|
2328
|
-
var
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
if (
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
if (this.scrollingDivs[
|
2378
|
-
this.scrollingDivs[
|
2379
|
-
|
2380
|
-
|
2381
|
-
|
2382
|
-
|
2383
|
-
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2393
|
-
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
|
2405
|
-
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
this.
|
2455
|
-
|
2456
|
-
|
2457
|
-
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
this.
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2648
|
-
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
var
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
},
|
2745
|
-
}
|
2746
|
-
|
2747
|
-
|
2748
|
-
function
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
document.
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
}
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
},
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
var
|
2939
|
-
|
2940
|
-
|
2941
|
-
theTarget.
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
touch
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
1359
|
+
/**
|
1360
|
+
* jq.ui - A User Interface library for creating jqMobi applications
|
1361
|
+
*
|
1362
|
+
* @copyright 2011
|
1363
|
+
* @author AppMobi
|
1364
|
+
*/(function($) {
|
1365
|
+
|
1366
|
+
var hasLaunched = false;
|
1367
|
+
var startPath = window.location.pathname;
|
1368
|
+
var defaultHash = window.location.hash;
|
1369
|
+
var previousTarget = defaultHash;
|
1370
|
+
|
1371
|
+
|
1372
|
+
if(!("pushState" in window.history)){
|
1373
|
+
window.history['pushState']=function(){}
|
1374
|
+
}
|
1375
|
+
var ui = function() {
|
1376
|
+
// Init the page
|
1377
|
+
var that = this;
|
1378
|
+
if (window.AppMobi)
|
1379
|
+
document.addEventListener("appMobi.device.ready", function() {
|
1380
|
+
that.hasLaunched = true;
|
1381
|
+
if (that.autoLaunch) {
|
1382
|
+
that.launch();
|
1383
|
+
}
|
1384
|
+
}, false);
|
1385
|
+
else if (document.readyState == "complete" || document.readyState == "loaded") {
|
1386
|
+
that.hasLaunched = true;
|
1387
|
+
if (that.autoLaunch) {
|
1388
|
+
that.launch();
|
1389
|
+
}
|
1390
|
+
} else
|
1391
|
+
document.addEventListener("DOMContentLoaded", function() {
|
1392
|
+
that.hasLaunched = true;
|
1393
|
+
if (that.autoLaunch) {
|
1394
|
+
that.launch();
|
1395
|
+
}
|
1396
|
+
}, false);
|
1397
|
+
if (!window.AppMobi)
|
1398
|
+
AppMobi = {}, AppMobi.webRoot = "";
|
1399
|
+
window.addEventListener("popstate", function() {
|
1400
|
+
that.goBack();
|
1401
|
+
}, false);
|
1402
|
+
|
1403
|
+
/**
|
1404
|
+
* Helper function to setup the transition objects
|
1405
|
+
* Custom transitions can be added via $.ui.availableTransitions
|
1406
|
+
```
|
1407
|
+
$.ui.availableTransitions['none']=function();
|
1408
|
+
```
|
1409
|
+
*/
|
1410
|
+
(function(obj) {
|
1411
|
+
obj.availableTransitions = {};
|
1412
|
+
obj.availableTransitions['none'] = that.noTransition;
|
1413
|
+
obj.availableTransitions['default'] = that.noTransition;
|
1414
|
+
})(this);
|
1415
|
+
};
|
1416
|
+
|
1417
|
+
|
1418
|
+
ui.prototype = {
|
1419
|
+
fixAndroidInputs:true,
|
1420
|
+
isAjaxApp:false,
|
1421
|
+
isAppMobi: false,
|
1422
|
+
showLoading:true,
|
1423
|
+
navbar: "",
|
1424
|
+
header: "",
|
1425
|
+
viewportContainer: "",
|
1426
|
+
backButton: "",
|
1427
|
+
remotePages: {},
|
1428
|
+
history: [],
|
1429
|
+
homeDiv: "",
|
1430
|
+
screenWidth: "",
|
1431
|
+
content: "",
|
1432
|
+
modalWindow: "",
|
1433
|
+
customFooter: false,
|
1434
|
+
defaultFooter: "",
|
1435
|
+
defaultHeader: null,
|
1436
|
+
customMenu: false,
|
1437
|
+
defaultMenu: "",
|
1438
|
+
_readyFunc: null,
|
1439
|
+
doingTransition: false,
|
1440
|
+
passwordBox: new jq.passwordBox(),
|
1441
|
+
selectBox: jq.selectBox,
|
1442
|
+
ajaxUrl: "",
|
1443
|
+
transitionType: "slide",
|
1444
|
+
scrollingDivs: [],
|
1445
|
+
firstDiv: "",
|
1446
|
+
remoteJSPages: {},
|
1447
|
+
hasLaunched: false,
|
1448
|
+
launchCompleted: false,
|
1449
|
+
activeDiv: "",
|
1450
|
+
customClickHandler:"",
|
1451
|
+
|
1452
|
+
|
1453
|
+
css3animate: function(el, opts) {
|
1454
|
+
el = jq(el);
|
1455
|
+
if (!el.__proto__["css3Animate"])
|
1456
|
+
throw "css3Animate plugin is required";
|
1457
|
+
return el.css3Animate(opts);
|
1458
|
+
},
|
1459
|
+
/**
|
1460
|
+
* This is the time transitions will run for.
|
1461
|
+
```
|
1462
|
+
$.ui.transitionTime='400ms';
|
1463
|
+
```
|
1464
|
+
* @title $.ui.transitionTime;
|
1465
|
+
*/
|
1466
|
+
transitionTime:"500",
|
1467
|
+
/**
|
1468
|
+
* this is a boolean when set to true (default) it will load that panel when the app is started
|
1469
|
+
```
|
1470
|
+
$.ui.loadDefaultHash=false; //Never load the page from the hash when the app is started
|
1471
|
+
$.ui.loadDefaultHash=true; //Default
|
1472
|
+
```
|
1473
|
+
*@title $.ui.loadDefaultHash
|
1474
|
+
*/
|
1475
|
+
loadDefaultHash: true,
|
1476
|
+
|
1477
|
+
/**
|
1478
|
+
* This is a boolean that when set to true will add "&cache=_rand_" to any ajax loaded link
|
1479
|
+
```
|
1480
|
+
$.ui.useAjaxCacheBuster=true;
|
1481
|
+
```
|
1482
|
+
*@title $.ui.useAjaxCacheBuster
|
1483
|
+
*/
|
1484
|
+
useAjaxCacheBuster: false,
|
1485
|
+
/**
|
1486
|
+
* This is a shorthand call to the jq.actionsheet plugin. We wire it to the jQUi div automatically
|
1487
|
+
```
|
1488
|
+
$.ui.actionsheet("<a href='javascript:;' class='button'>Settings</a> <a href='javascript:;' class='button red'>Logout</a>")
|
1489
|
+
$.ui.actionsheet("[{
|
1490
|
+
text: 'back',
|
1491
|
+
cssClasses: 'red',
|
1492
|
+
handler: function () { $.ui.goBack(); ; }
|
1493
|
+
}, {
|
1494
|
+
text: 'show alert 5',
|
1495
|
+
cssClasses: 'blue',
|
1496
|
+
handler: function () { alert("hi"); }
|
1497
|
+
}, {
|
1498
|
+
text: 'show alert 6',
|
1499
|
+
cssClasses: '',
|
1500
|
+
handler: function () { alert("goodbye"); }
|
1501
|
+
}]");
|
1502
|
+
```
|
1503
|
+
* @param {String,Array} links
|
1504
|
+
* @title $.ui.actionsheet()
|
1505
|
+
*/
|
1506
|
+
actionsheet: function(opts) {
|
1507
|
+
el = jq("#jQUi");
|
1508
|
+
if (!el.__proto__["actionsheet"])
|
1509
|
+
throw "actionsheet plugin is required";
|
1510
|
+
return el.actionsheet(opts);
|
1511
|
+
},
|
1512
|
+
/**
|
1513
|
+
* This is a wrapper to jq.popup.js plugin. If you pass in a text string, it acts like an alert box and just gives a message
|
1514
|
+
```
|
1515
|
+
$.ui.popup(opts);
|
1516
|
+
$.ui.popup( {
|
1517
|
+
title:"Alert! Alert!",
|
1518
|
+
message:"This is a test of the emergency alert system!! Don't PANIC!",
|
1519
|
+
cancelText:"Cancel me",
|
1520
|
+
cancelCallback: function(){console.log("cancelled");},
|
1521
|
+
doneText:"I'm done!",
|
1522
|
+
doneCallback: function(){console.log("Done for!");},
|
1523
|
+
cancelOnly:false
|
1524
|
+
});
|
1525
|
+
$.ui.popup('Hi there');
|
1526
|
+
```
|
1527
|
+
* @param {Object|String} options
|
1528
|
+
* @title $.ui.popup(opts)
|
1529
|
+
*/
|
1530
|
+
popup: function(opts) {
|
1531
|
+
el = jq("#jQUi");
|
1532
|
+
if (!el.__proto__["popup"])
|
1533
|
+
throw "popup plugin is required";
|
1534
|
+
return el.popup(opts);
|
1535
|
+
},
|
1536
|
+
|
1537
|
+
/**
|
1538
|
+
*This will throw up a mask and block the UI
|
1539
|
+
```
|
1540
|
+
$.ui.blockUI(.9)
|
1541
|
+
````
|
1542
|
+
* @param {Float} opacity
|
1543
|
+
* @title $.ui.blockUI(opacity)
|
1544
|
+
*/
|
1545
|
+
blockUI: function(opacity) {
|
1546
|
+
$.blockUI(opacity);
|
1547
|
+
},
|
1548
|
+
/**
|
1549
|
+
*This will remove the UI mask
|
1550
|
+
```
|
1551
|
+
$.ui.unblockUI()
|
1552
|
+
````
|
1553
|
+
* @title $.ui.unblockUI()
|
1554
|
+
*/
|
1555
|
+
unblockUI: function() {
|
1556
|
+
$.unblockUI();
|
1557
|
+
},
|
1558
|
+
/**
|
1559
|
+
* Will remove the bottom nav bar menu from your application
|
1560
|
+
```
|
1561
|
+
$.ui.removeFooterMenu();
|
1562
|
+
```
|
1563
|
+
* @title $.ui.removeFooterMenu
|
1564
|
+
*/
|
1565
|
+
removeFooterMenu: function() {
|
1566
|
+
jq("#navbar").hide();
|
1567
|
+
jq("#content").css("bottom", "0px");
|
1568
|
+
this.showNavMenu = false;
|
1569
|
+
},
|
1570
|
+
/**
|
1571
|
+
* Boolean if you want to show the bottom nav menu.
|
1572
|
+
```
|
1573
|
+
$.ui.showNavMenu = false;
|
1574
|
+
```
|
1575
|
+
* @title $.ui.showNavMenu
|
1576
|
+
*/
|
1577
|
+
showNavMenu: true,
|
1578
|
+
/**
|
1579
|
+
* Boolean if you want to auto launch jqUi
|
1580
|
+
```
|
1581
|
+
$.ui.autoLaunch = false; //
|
1582
|
+
* @title $.ui.autoLaunch
|
1583
|
+
*/
|
1584
|
+
autoLaunch: true,
|
1585
|
+
/**
|
1586
|
+
* Boolean if you want to show the back button
|
1587
|
+
```
|
1588
|
+
$.ui.showBackButton = false; //
|
1589
|
+
* @title $.ui.showBackButton
|
1590
|
+
*/
|
1591
|
+
showBackbutton: true,
|
1592
|
+
/**
|
1593
|
+
* @api private
|
1594
|
+
*/
|
1595
|
+
backButtonText: "",
|
1596
|
+
/**
|
1597
|
+
* Boolean if you want to reset the scroller position when navigating panels. Default is true
|
1598
|
+
```
|
1599
|
+
$.ui.resetScrollers=false; //Do not reset the scrollers when switching panels
|
1600
|
+
```
|
1601
|
+
* @title $.ui.resetScrollers
|
1602
|
+
*/
|
1603
|
+
resetScrollers: true,
|
1604
|
+
/**
|
1605
|
+
* function to fire when jqUi is ready and completed launch
|
1606
|
+
```
|
1607
|
+
$.ui.ready(function(){console.log('jqUi is ready');});
|
1608
|
+
```
|
1609
|
+
* @param {Function} function to execute
|
1610
|
+
* @title $.ui.ready
|
1611
|
+
*/
|
1612
|
+
ready: function(param) {
|
1613
|
+
if (this.launchCompleted)
|
1614
|
+
param();
|
1615
|
+
else
|
1616
|
+
document.addEventListener("jq.ui.ready", param, false);
|
1617
|
+
},
|
1618
|
+
/**
|
1619
|
+
* Override the back button class name
|
1620
|
+
```
|
1621
|
+
$.ui.setBackButtonStyle('newClass');
|
1622
|
+
```
|
1623
|
+
* @param {String} new class name
|
1624
|
+
* @title $.ui.setBackButtonStyle(class)
|
1625
|
+
*/
|
1626
|
+
setBackButtonStyle: function(className) {
|
1627
|
+
$am("backButton").className = className;
|
1628
|
+
},
|
1629
|
+
/**
|
1630
|
+
* Initiate a back transition
|
1631
|
+
```
|
1632
|
+
$.ui.goBack()
|
1633
|
+
```
|
1634
|
+
|
1635
|
+
* @title $.ui.goBack()
|
1636
|
+
*/
|
1637
|
+
goBack: function() {
|
1638
|
+
|
1639
|
+
if (this.history.length > 0) {
|
1640
|
+
var tmpEl = this.history.pop();
|
1641
|
+
this.loadContent(tmpEl.target + "", 0, 1, tmpEl.transition);
|
1642
|
+
this.transitionType = tmpEl.transition;
|
1643
|
+
}
|
1644
|
+
},
|
1645
|
+
/**
|
1646
|
+
* Clear the history queue
|
1647
|
+
```
|
1648
|
+
$.ui.clearHistory()
|
1649
|
+
```
|
1650
|
+
|
1651
|
+
* @title $.ui.clearHistory()
|
1652
|
+
*/
|
1653
|
+
clearHistory: function() {
|
1654
|
+
this.history = [];
|
1655
|
+
this.backButton.style.visibility = "hidden";
|
1656
|
+
},
|
1657
|
+
/**
|
1658
|
+
* Update a badge on the selected target. Position can be
|
1659
|
+
bl = bottom left
|
1660
|
+
tl = top left
|
1661
|
+
br = bottom right
|
1662
|
+
tr = top right (default)
|
1663
|
+
```
|
1664
|
+
$.ui.updateBadge('#mydiv','3','bl','green');
|
1665
|
+
```
|
1666
|
+
* @param {String} target
|
1667
|
+
* @param {String} Value
|
1668
|
+
* @param {String} [position]
|
1669
|
+
* @param {String|Object} [color or CSS hash]
|
1670
|
+
* @title $.ui.updateBadge(target,value,[position],[color])
|
1671
|
+
*/
|
1672
|
+
updateBadge: function(target, value, position,color) {
|
1673
|
+
if (position === undefined)
|
1674
|
+
position = "";
|
1675
|
+
if (target[0] != "#")
|
1676
|
+
target = "#" + target;
|
1677
|
+
var badge = jq(target).find("span.jq-badge");
|
1678
|
+
|
1679
|
+
if (badge.length == 0) {
|
1680
|
+
if (jq(target).css("position") != "absolute")
|
1681
|
+
jq(target).css("position", "relative");
|
1682
|
+
badge=jq("<span class='jq-badge " + position + "'>" + value + "</span>");
|
1683
|
+
jq(target).append(badge);
|
1684
|
+
} else
|
1685
|
+
badge.html(value);
|
1686
|
+
|
1687
|
+
|
1688
|
+
if(jq.isObject(color)){
|
1689
|
+
badge.css(color);
|
1690
|
+
}
|
1691
|
+
else if(color){
|
1692
|
+
badge.css("background",color);
|
1693
|
+
}
|
1694
|
+
|
1695
|
+
badge.data("ignore-pressed","true");
|
1696
|
+
|
1697
|
+
},
|
1698
|
+
/**
|
1699
|
+
* Removes a badge from the selected target.
|
1700
|
+
```
|
1701
|
+
$.ui.removeBadge('#mydiv');
|
1702
|
+
```
|
1703
|
+
* @param {String} target
|
1704
|
+
* @title $.ui.removeBadge(target)
|
1705
|
+
*/
|
1706
|
+
removeBadge: function(target) {
|
1707
|
+
jq(target).find("span.jq-badge").remove();
|
1708
|
+
},
|
1709
|
+
/**
|
1710
|
+
* Toggles the bottom nav nav menu. Force is a boolean to force show or hide.
|
1711
|
+
```
|
1712
|
+
$.ui.toggleNavMenu();//toggle it
|
1713
|
+
$.ui.toggleNavMenu(true); //force show it
|
1714
|
+
```
|
1715
|
+
* @param {Boolean} [force]
|
1716
|
+
* @title $.ui.toggleNavMenu([force])
|
1717
|
+
*/
|
1718
|
+
toggleNavMenu: function(force) {
|
1719
|
+
if (!jq.ui.showNavMenu)
|
1720
|
+
return;
|
1721
|
+
if (jq("#navbar").css("display") != "none" && ((force !== undefined && force !== true) || force === undefined)) {
|
1722
|
+
jq("#content").css("bottom", "0px");
|
1723
|
+
jq("#navbar").hide();
|
1724
|
+
} else if (force === undefined || (force !== undefined && force === true)) {
|
1725
|
+
jq("#navbar").show();
|
1726
|
+
jq("#content").css("bottom", jq("#navbar").css("height"));
|
1727
|
+
|
1728
|
+
}
|
1729
|
+
},
|
1730
|
+
/**
|
1731
|
+
* Toggles the top header menu.
|
1732
|
+
```
|
1733
|
+
$.ui.toggleHeaderMenu();//toggle it
|
1734
|
+
```
|
1735
|
+
* @param {Boolean} [force]
|
1736
|
+
* @title $.ui.toggleHeaderMenu([force])
|
1737
|
+
*/
|
1738
|
+
toggleHeaderMenu: function(force) {
|
1739
|
+
|
1740
|
+
if (jq("#header").css("display") != "none" && ((force !== undefined && force !== true) || force === undefined)) {
|
1741
|
+
jq("#content").css("top", "0px");
|
1742
|
+
jq("#header").hide();
|
1743
|
+
} else if (force === undefined || (force !== undefined && force === true)) {
|
1744
|
+
jq("#header").show();
|
1745
|
+
jq("#content").css("top", jq("#header").css("height"));
|
1746
|
+
|
1747
|
+
}
|
1748
|
+
},
|
1749
|
+
/**
|
1750
|
+
* Toggles the side menu. Force is a boolean to force show or hide.
|
1751
|
+
```
|
1752
|
+
$.ui.toggleSideMenu();//toggle it
|
1753
|
+
```
|
1754
|
+
* @param {Boolean} [force]
|
1755
|
+
* @title $.ui.toggleSideMenu([force])
|
1756
|
+
*/
|
1757
|
+
toggleSideMenu: function(force) {
|
1758
|
+
var that = this;
|
1759
|
+
if (!jq("#content").hasClass("hasMenu"))
|
1760
|
+
return;
|
1761
|
+
if (jq("#menu").css("display") != "block" && ((force !== undefined && force !== false) || force === undefined)) {
|
1762
|
+
this.scrollingDivs["menu_scroller"].initEvents();
|
1763
|
+
jq("#menu").show();
|
1764
|
+
window.setTimeout(function() {
|
1765
|
+
jq("#menu").addClass("on");
|
1766
|
+
jq("#header").addClass("on");
|
1767
|
+
jq("#navbar").addClass("on");
|
1768
|
+
jq("#content").addClass("on");
|
1769
|
+
}, 1); //needs to run after
|
1770
|
+
|
1771
|
+
} else if (force === undefined || (force !== undefined && force === false)) {
|
1772
|
+
this.scrollingDivs["menu_scroller"].removeEvents();
|
1773
|
+
|
1774
|
+
jq("#header").removeClass("on");
|
1775
|
+
jq("#menu").removeClass("on");
|
1776
|
+
jq("#navbar").removeClass("on");
|
1777
|
+
jq("#content").removeClass("on");
|
1778
|
+
setTimeout(function() {
|
1779
|
+
jq("#menu").hide();
|
1780
|
+
}, 300); //lame I know
|
1781
|
+
}
|
1782
|
+
},
|
1783
|
+
/**
|
1784
|
+
* depricated
|
1785
|
+
```
|
1786
|
+
$.ui.updateNavbar();//toggle it
|
1787
|
+
```
|
1788
|
+
* @title $.ui.updateNavbar([force])
|
1789
|
+
* @api private
|
1790
|
+
*/
|
1791
|
+
updateNavbar: function() {
|
1792
|
+
},
|
1793
|
+
/**
|
1794
|
+
* Updates the elements in the navbar
|
1795
|
+
```
|
1796
|
+
$.ui.updateNavbarElements(elements);
|
1797
|
+
```
|
1798
|
+
* @param {String|Object} Elements
|
1799
|
+
* @title $.ui.updateNavbarElements(Elements)
|
1800
|
+
*/
|
1801
|
+
updateNavbarElements: function(elems) {
|
1802
|
+
var nb = jq("#navbar");
|
1803
|
+
if (elems === undefined || elems == null)
|
1804
|
+
return;
|
1805
|
+
if (typeof (elems) == "string")
|
1806
|
+
return nb.html(elems), null;
|
1807
|
+
nb.html("");
|
1808
|
+
for (var i = 0; i < elems.length; i++) {
|
1809
|
+
var node = elems[i].cloneNode(true);
|
1810
|
+
nb.append(node);
|
1811
|
+
}
|
1812
|
+
jq("#navbar a").data("ignore-pressed", "true").data("resetHistory", "true");
|
1813
|
+
},
|
1814
|
+
/**
|
1815
|
+
* Updates the elements in the header
|
1816
|
+
```
|
1817
|
+
$.ui.updateHeaderElements(elements);
|
1818
|
+
```
|
1819
|
+
* @param {String|Object} Elements
|
1820
|
+
* @title $.ui.updateHeaderElement(Elements)
|
1821
|
+
*/
|
1822
|
+
updateHeaderElements: function(elems) {
|
1823
|
+
var nb = jq("#header");
|
1824
|
+
if (elems === undefined || elems == null)
|
1825
|
+
return;
|
1826
|
+
if (typeof (elems) == "string")
|
1827
|
+
return nb.html(elems), null;
|
1828
|
+
nb.html("");
|
1829
|
+
for (var i = 0; i < elems.length; i++) {
|
1830
|
+
var node = elems[i].cloneNode(true);
|
1831
|
+
nb.append(node);
|
1832
|
+
}
|
1833
|
+
},
|
1834
|
+
|
1835
|
+
/**
|
1836
|
+
* Updates the elements in the side menu
|
1837
|
+
```
|
1838
|
+
$.ui.updateSideMenu(elements);
|
1839
|
+
```
|
1840
|
+
* @param {String|Object} Elements
|
1841
|
+
* @title $.ui.updateSideMenu(Elements)
|
1842
|
+
*/
|
1843
|
+
updateSideMenu: function(elems) {
|
1844
|
+
var that = this;
|
1845
|
+
|
1846
|
+
var nb = jq("#menu_scroller");
|
1847
|
+
|
1848
|
+
if (elems === undefined || elems == null)
|
1849
|
+
return;
|
1850
|
+
if (typeof (elems) == "string")
|
1851
|
+
return nb.html(elems), null;
|
1852
|
+
nb.html('');
|
1853
|
+
var close = document.createElement("a");
|
1854
|
+
close.className = "closebutton jqMenuClose";
|
1855
|
+
close.href = "javascript:;"
|
1856
|
+
close.onclick = function() {
|
1857
|
+
that.toggleSideMenu();
|
1858
|
+
};
|
1859
|
+
nb.append(close);
|
1860
|
+
var tmp = document.createElement("div");
|
1861
|
+
tmp.className = "jqMenuHeader";
|
1862
|
+
tmp.innerHTML = "Menu";
|
1863
|
+
nb.append(tmp);
|
1864
|
+
for (var i = 0; i < elems.length; i++) {
|
1865
|
+
var node = elems[i].cloneNode(true);
|
1866
|
+
if (elems[i].oldhash) {
|
1867
|
+
node.href = elems[i].oldhref;
|
1868
|
+
node.onclick = elems[i].oldonclick;
|
1869
|
+
}
|
1870
|
+
nb.append(node);
|
1871
|
+
}
|
1872
|
+
//Move the scroller to the top and hide it
|
1873
|
+
this.scrollingDivs['menu_scroller'].scrollTo({
|
1874
|
+
x: 0,
|
1875
|
+
y: 0
|
1876
|
+
}, "0");
|
1877
|
+
},
|
1878
|
+
/**
|
1879
|
+
* Set the title of the current panel
|
1880
|
+
```
|
1881
|
+
$.ui.setTitle("new title");
|
1882
|
+
```
|
1883
|
+
|
1884
|
+
* @param {String} value
|
1885
|
+
* @title $.ui.setTitle(value)
|
1886
|
+
*/
|
1887
|
+
setTitle: function(val) {
|
1888
|
+
jq("#header #pageTitle").html(val);
|
1889
|
+
},
|
1890
|
+
/**
|
1891
|
+
* Override the text for the back button
|
1892
|
+
```
|
1893
|
+
$.ui.setBackButtonText("GO...");
|
1894
|
+
```
|
1895
|
+
|
1896
|
+
* @param {String} value
|
1897
|
+
* @title $.ui.setBackButtonText(value)
|
1898
|
+
*/
|
1899
|
+
setBackButtonText: function(text) {
|
1900
|
+
if (this.backButtonText.length > 0)
|
1901
|
+
jq("#header #backButton").html(this.backButtonText);
|
1902
|
+
else
|
1903
|
+
jq("#header #backButton").html(text);
|
1904
|
+
},
|
1905
|
+
/**
|
1906
|
+
* Show the loading mask
|
1907
|
+
```
|
1908
|
+
$.ui.showMask()
|
1909
|
+
$.ui.showMask(;Doing work')
|
1910
|
+
```
|
1911
|
+
|
1912
|
+
* @param {String} [text]
|
1913
|
+
* @title $.ui.showMask(text);
|
1914
|
+
*/
|
1915
|
+
showMask: function(text) {
|
1916
|
+
if (!text)
|
1917
|
+
text = "Loading Content";
|
1918
|
+
jq("#jQui_mask>h1").html(text);
|
1919
|
+
$am("jQui_mask").style.display = "block";
|
1920
|
+
},
|
1921
|
+
/**
|
1922
|
+
* Hide the loading mask
|
1923
|
+
* @title $.ui.hideMask();
|
1924
|
+
*/
|
1925
|
+
hideMask: function() {
|
1926
|
+
$am("jQui_mask").style.display = "none";
|
1927
|
+
},
|
1928
|
+
/**
|
1929
|
+
* Load a content panel in a modal window. We set the innerHTML so event binding will not work.
|
1930
|
+
```
|
1931
|
+
$.ui.showModal("#myDiv");
|
1932
|
+
```
|
1933
|
+
* @param {String|Object} panel to show
|
1934
|
+
* @title $.ui.showModal();
|
1935
|
+
*/
|
1936
|
+
showModal: function(id) {
|
1937
|
+
var that = this;
|
1938
|
+
|
1939
|
+
if ($am(id)) {
|
1940
|
+
//jq("#modalContainer").html('<div style="width:1px;height:1px;-webkit-transform:translate3d(0,0,0);float:right"></div>' + $am(id).childNodes[0].innerHTML + '');
|
1941
|
+
jq("#modalContainer").html($am(id).childNodes[0].innerHTML);
|
1942
|
+
jq('#modalContainer').append("<a href='javascript:;' onclick='$.ui.hideModal();' class='closebutton modalbutton'></a>");
|
1943
|
+
this.modalWindow.style.display = "block";
|
1944
|
+
|
1945
|
+
button = null;
|
1946
|
+
content = null;
|
1947
|
+
this.scrollingDivs['modal_container'].initEvents();
|
1948
|
+
this.scrollToTop('modal');
|
1949
|
+
}
|
1950
|
+
|
1951
|
+
},
|
1952
|
+
/**
|
1953
|
+
* Hide the modal window and remove the content
|
1954
|
+
```
|
1955
|
+
$.ui.hideModal("#myDiv");
|
1956
|
+
```
|
1957
|
+
* @title $.ui.hideModal();
|
1958
|
+
*/
|
1959
|
+
hideModal: function() {
|
1960
|
+
$am("modalContainer").innerHTML = "";
|
1961
|
+
$am("jQui_modal").style.display = "none";
|
1962
|
+
|
1963
|
+
this.scrollingDivs['modal_container'].removeEvents();
|
1964
|
+
},
|
1965
|
+
|
1966
|
+
/**
|
1967
|
+
* Update the HTML in a content panel
|
1968
|
+
```
|
1969
|
+
$.ui.updateContentDiv("#myDiv","This is the new content");
|
1970
|
+
```
|
1971
|
+
* @param {String,Object} panel
|
1972
|
+
* @param {String} html to update with
|
1973
|
+
* @title $.ui.updateContentDiv(id,content);
|
1974
|
+
*/
|
1975
|
+
updateContentDiv: function(id, content) {
|
1976
|
+
var el = $am(id);
|
1977
|
+
if (!el)
|
1978
|
+
return;
|
1979
|
+
|
1980
|
+
var newDiv = document.createElement("div");
|
1981
|
+
newDiv.innerHTML = content;
|
1982
|
+
if($(newDiv).children('.panel') && $(newDiv).children('.panel').length > 0) newDiv = $(newDiv).children('.panel').get();
|
1983
|
+
|
1984
|
+
|
1985
|
+
|
1986
|
+
if (el.getAttribute("scrolling") && el.getAttribute("scrolling").toLowerCase() == "no")
|
1987
|
+
el.innerHTML = newDiv.innerHTML;
|
1988
|
+
else
|
1989
|
+
el.childNodes[0].innerHTML = newDiv.innerHTML;
|
1990
|
+
|
1991
|
+
if($(newDiv).title) el.title = $(newDiv).title;
|
1992
|
+
},
|
1993
|
+
/**
|
1994
|
+
* Dynamically create a new panel on the fly. It wires events, creates the scroller, applies Android fixes, etc.
|
1995
|
+
```
|
1996
|
+
$.ui.addContentDiv("myDiv","This is the new content","Title");
|
1997
|
+
```
|
1998
|
+
* @param {String|Object} Element to add
|
1999
|
+
* @param {String} Content
|
2000
|
+
* @param {String} title
|
2001
|
+
* @title $.ui.addContentDiv(id,content,title);
|
2002
|
+
*/
|
2003
|
+
addContentDiv: function(el, content, title, refresh, refreshFunc) {
|
2004
|
+
var myEl = $am(el);
|
2005
|
+
if (!myEl) {
|
2006
|
+
var newDiv = document.createElement("div");
|
2007
|
+
newDiv.innerHTML = content;
|
2008
|
+
if($(newDiv).children('.panel') && $(newDiv).children('.panel').length > 0) newDiv = $(newDiv).children('.panel').get();
|
2009
|
+
|
2010
|
+
if(!newDiv.title&&title) newDiv.title = title;
|
2011
|
+
var newId = (newDiv.id)? newDiv.id : el; //figure out the new id - either the id from the loaded div.panel or the crc32 hash
|
2012
|
+
newDiv.id = newId;
|
2013
|
+
} else {
|
2014
|
+
newDiv = myEl;
|
2015
|
+
}
|
2016
|
+
newDiv.className = "panel";
|
2017
|
+
var that = this;
|
2018
|
+
|
2019
|
+
myEl = null;
|
2020
|
+
that.addDivAndScroll(newDiv, refresh, refreshFunc);
|
2021
|
+
newDiv = null;
|
2022
|
+
return newId;
|
2023
|
+
},
|
2024
|
+
/**
|
2025
|
+
* Takes a div and sets up scrolling for it..
|
2026
|
+
```
|
2027
|
+
$.ui.addDivAndScroll(object);
|
2028
|
+
```
|
2029
|
+
* @param {Object} Element
|
2030
|
+
* @title $.ui.addDivAndScroll(element);
|
2031
|
+
* @api private
|
2032
|
+
*/
|
2033
|
+
addDivAndScroll: function(tmp, refreshPull, refreshFunc) {
|
2034
|
+
var addScroller = true;
|
2035
|
+
if (tmp.getAttribute("scrolling") && tmp.getAttribute("scrolling").toLowerCase() == "no")
|
2036
|
+
addScroller = false;
|
2037
|
+
if (!addScroller) {
|
2038
|
+
this.content.appendChild(tmp);
|
2039
|
+
tmp = null;
|
2040
|
+
return;
|
2041
|
+
}
|
2042
|
+
//WE need to clone the div so we keep events
|
2043
|
+
var myDiv = tmp.cloneNode(false);
|
2044
|
+
|
2045
|
+
|
2046
|
+
tmp.title = null;
|
2047
|
+
tmp.id = null;
|
2048
|
+
tmp.removeAttribute("footer");
|
2049
|
+
tmp.removeAttribute("nav");
|
2050
|
+
jq(tmp).removeClass("panel");
|
2051
|
+
tmp.style.width = "100%";
|
2052
|
+
//tmp.style.height = "inherit";
|
2053
|
+
|
2054
|
+
myDiv.appendChild(tmp);
|
2055
|
+
|
2056
|
+
this.content.appendChild(myDiv);
|
2057
|
+
|
2058
|
+
this.selectBox.getOldSelects(myDiv.id);
|
2059
|
+
this.passwordBox.getOldPasswords(myDiv.id);
|
2060
|
+
|
2061
|
+
if (addScroller) {
|
2062
|
+
this.scrollingDivs[myDiv.id] = (jq(tmp).scroller({
|
2063
|
+
scrollBars: true,
|
2064
|
+
verticalScroll: true,
|
2065
|
+
horizontalScroll: false,
|
2066
|
+
vScrollCSS: "jqmScrollbar",
|
2067
|
+
refresh: false
|
2068
|
+
}));
|
2069
|
+
this.scrollingDivs[myDiv.id].removeEvents();
|
2070
|
+
}
|
2071
|
+
|
2072
|
+
|
2073
|
+
myDiv = null;
|
2074
|
+
tmp = null;
|
2075
|
+
},
|
2076
|
+
|
2077
|
+
/**
|
2078
|
+
* This has been depricated, as it was a design flaw on my end. People were updating segments of the panel and not the whole part. It's counter intuitive to have to call
|
2079
|
+
* $.ui.updateAnchors(object,reset) after each change.
|
2080
|
+
* This will be removed in 1.1
|
2081
|
+
* @title $.ui.updateAnchors(element,resetHistory);
|
2082
|
+
* @api private
|
2083
|
+
*/
|
2084
|
+
updateAnchors: function(domEl, reset) {
|
2085
|
+
},
|
2086
|
+
/**
|
2087
|
+
* Scrolls a panel to the top
|
2088
|
+
```
|
2089
|
+
$.ui.scrollToTop(id);
|
2090
|
+
```
|
2091
|
+
* @param {String} id without hash
|
2092
|
+
* @title $.ui.scrollToTop(id);
|
2093
|
+
*/
|
2094
|
+
scrollToTop: function(id) {
|
2095
|
+
if (this.scrollingDivs[id]) {
|
2096
|
+
this.scrollingDivs[id].scrollTo({
|
2097
|
+
x: 0,
|
2098
|
+
y: 0
|
2099
|
+
}, 0);
|
2100
|
+
}
|
2101
|
+
},
|
2102
|
+
/**
|
2103
|
+
* Scrolls all panels to the top and fixes position when orientation changes
|
2104
|
+
```
|
2105
|
+
$.ui.updateOrientation(event);
|
2106
|
+
```
|
2107
|
+
* @param {Event} event
|
2108
|
+
* @title $.ui.updateOrientation(event);
|
2109
|
+
* @api private
|
2110
|
+
*/
|
2111
|
+
updateOrientation: function(event) {
|
2112
|
+
for (var j in this.scrollingDivs) {
|
2113
|
+
if (typeof (this.scrollingDivs[j]) !== "function")
|
2114
|
+
this.scrollToTop(j);
|
2115
|
+
}
|
2116
|
+
},
|
2117
|
+
|
2118
|
+
/**
|
2119
|
+
* This is used when a transition fires to do helper events. We check to see if we need to change the nav menus, footer, and fire
|
2120
|
+
* the load/onload functions for panels
|
2121
|
+
```
|
2122
|
+
$.ui.parsePanelFunctions(currentDiv,oldDiv);
|
2123
|
+
```
|
2124
|
+
* @param {Object} current div
|
2125
|
+
* @param {Object} old div
|
2126
|
+
* @title $.ui.parsePanelFunctions(currentDiv,oldDiv);
|
2127
|
+
* @api private
|
2128
|
+
*/
|
2129
|
+
parsePanelFunctions: function(what, oldDiv) {
|
2130
|
+
var that = this;
|
2131
|
+
var hasFooter = what.getAttribute("data-footer");
|
2132
|
+
var hasHeader = what.getAttribute("data-header");
|
2133
|
+
window.setTimeout(function() {
|
2134
|
+
if (hasFooter && hasFooter.toLowerCase() == "none") {
|
2135
|
+
that.toggleNavMenu(false);
|
2136
|
+
} else {
|
2137
|
+
that.toggleNavMenu(true);
|
2138
|
+
}
|
2139
|
+
if (hasFooter && that.customFooter != hasFooter) {
|
2140
|
+
that.customFooter = hasFooter;
|
2141
|
+
that.updateNavbarElements(jq("#" + hasFooter).children());
|
2142
|
+
} else if (hasFooter != that.customFooter) {
|
2143
|
+
if (that.customFooter)
|
2144
|
+
that.updateNavbarElements(that.defaultFooter);
|
2145
|
+
that.customFooter = false;
|
2146
|
+
}
|
2147
|
+
|
2148
|
+
|
2149
|
+
if (hasHeader && that.customHeader != hasHeader) {
|
2150
|
+
that.customHeader = hasHeader;
|
2151
|
+
that.updateHeaderElements(jq("#" + hasHeader).children());
|
2152
|
+
} else if (hasHeader != that.customHeader) {
|
2153
|
+
if (that.customHeader)
|
2154
|
+
{
|
2155
|
+
that.updateHeaderElements(that.defaultHeader);
|
2156
|
+
that.setTitle(that.activeDiv.title);
|
2157
|
+
}
|
2158
|
+
that.customHeader = false;
|
2159
|
+
}
|
2160
|
+
|
2161
|
+
//Load inline footers
|
2162
|
+
var inlineFooters = $(what).find("footer");
|
2163
|
+
if (inlineFooters.length > 0)
|
2164
|
+
{
|
2165
|
+
that.customFooter = what.id;
|
2166
|
+
that.updateNavbarElements(inlineFooters.children());
|
2167
|
+
}
|
2168
|
+
//load inline headers
|
2169
|
+
var inlineHeader = $(what).find("header");
|
2170
|
+
|
2171
|
+
|
2172
|
+
if (inlineHeader.length > 0)
|
2173
|
+
{
|
2174
|
+
that.customHeader = what.id;
|
2175
|
+
that.updateHeaderElements(inlineHeader.children());
|
2176
|
+
}
|
2177
|
+
//check if the panel has a footer
|
2178
|
+
if (what.getAttribute("data-tab")) { //Allow the dev to force the footer menu
|
2179
|
+
|
2180
|
+
jq("#navbar a").removeClass("selected");
|
2181
|
+
jq("#navbar #" + what.getAttribute("data-tab")).addClass("selected");
|
2182
|
+
}
|
2183
|
+
var hasMenu = what.getAttribute("data-nav");
|
2184
|
+
if (hasMenu && that.customMenu != hasMenu) {
|
2185
|
+
that.customMenu = hasMenu;
|
2186
|
+
that.updateSideMenu(jq("#" + hasMenu).children());
|
2187
|
+
} else if (hasMenu != that.customMenu) {
|
2188
|
+
if (that.customMenu)
|
2189
|
+
that.updateSideMenu(that.defaultMenu);
|
2190
|
+
that.customMenu = false;
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
}, 10);
|
2194
|
+
|
2195
|
+
|
2196
|
+
|
2197
|
+
//Fire unload first
|
2198
|
+
if (oldDiv) {
|
2199
|
+
fnc = oldDiv.getAttribute("data-unload");
|
2200
|
+
if (typeof fnc == "string" && window[fnc]) {
|
2201
|
+
window[fnc](oldDiv);
|
2202
|
+
}
|
2203
|
+
}
|
2204
|
+
var fnc = what.getAttribute("data-load");
|
2205
|
+
if (typeof fnc == "string" && window[fnc]) {
|
2206
|
+
window[fnc](what);
|
2207
|
+
}
|
2208
|
+
if (this.menu.style.display == "block")
|
2209
|
+
this.toggleSideMenu(); //Close on phones to prevent orientation change bug.
|
2210
|
+
|
2211
|
+
},
|
2212
|
+
/**
|
2213
|
+
* Helper function that parses a contents html for any script tags and either adds them or executes the code
|
2214
|
+
* @api private
|
2215
|
+
*/
|
2216
|
+
parseScriptTags: function(div) {
|
2217
|
+
if (!div)
|
2218
|
+
return;
|
2219
|
+
var scripts = div.getElementsByTagName("script");
|
2220
|
+
div = null;
|
2221
|
+
for (var i = 0; i < scripts.length; i++) {
|
2222
|
+
if (scripts[i].src.length > 0 && !this.remoteJSPages[scripts[i].src]) {
|
2223
|
+
var doc = document.createElement("script");
|
2224
|
+
doc.type = scripts[i].type;
|
2225
|
+
doc.src = scripts[i].src;
|
2226
|
+
document.getElementsByTagName('head')[0].appendChild(doc);
|
2227
|
+
this.remoteJSPages[scripts[i].src] = 1;
|
2228
|
+
doc = null;
|
2229
|
+
} else {
|
2230
|
+
window.eval(scripts[i].innerHTML);
|
2231
|
+
}
|
2232
|
+
}
|
2233
|
+
},
|
2234
|
+
/**
|
2235
|
+
* This is called to initiate a transition or load content via ajax.
|
2236
|
+
* We can pass in a hash+id or URL and then we parse the panel for additional functions
|
2237
|
+
```
|
2238
|
+
$.ui.loadContent("#main",false,false,"up");
|
2239
|
+
```
|
2240
|
+
* @param {String} target
|
2241
|
+
* @param {Boolean} newtab (resets history)
|
2242
|
+
* @param {Boolean} go back (initiate the back click)
|
2243
|
+
* @param {String} transition
|
2244
|
+
* @title $.ui.loadContent(target,newTab,goBack,transition);
|
2245
|
+
* @api public
|
2246
|
+
*/
|
2247
|
+
loadContent: function(target, newTab, back, transition, anchor) {
|
2248
|
+
|
2249
|
+
if (this.doingTransition)
|
2250
|
+
return;
|
2251
|
+
|
2252
|
+
|
2253
|
+
what = null;
|
2254
|
+
var that = this;
|
2255
|
+
that.hideMask();
|
2256
|
+
var loadAjax = true;
|
2257
|
+
if (target.indexOf("#") == -1) {
|
2258
|
+
var urlHash = "url" + crc32(target); //Ajax urls
|
2259
|
+
if ($am(urlHash)) {
|
2260
|
+
|
2261
|
+
//ajax div already exists. Let's see if we should be refreshing it.
|
2262
|
+
loadAjax = false;
|
2263
|
+
if ((anchor && anchor.getAttribute("data-refresh-ajax") === 'true') || (anchor && anchor.refresh && anchor.refresh === true)||this.isAjaxApp) {
|
2264
|
+
loadAjax = true;
|
2265
|
+
} else
|
2266
|
+
target = "#" + urlHash;
|
2267
|
+
}
|
2268
|
+
}
|
2269
|
+
|
2270
|
+
if (target.indexOf("#") == -1 && anchor && loadAjax) {
|
2271
|
+
|
2272
|
+
// XML Request
|
2273
|
+
if (this.activeDiv.id == "jQui_ajax" && target == this.ajaxUrl)
|
2274
|
+
return;
|
2275
|
+
if (target.indexOf("http") == -1)
|
2276
|
+
target = AppMobi.webRoot + target;
|
2277
|
+
|
2278
|
+
var xmlhttp = new XMLHttpRequest();
|
2279
|
+
xmlhttp.onreadystatechange = function() {
|
2280
|
+
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
2281
|
+
this.doingTransition = false;
|
2282
|
+
|
2283
|
+
var doReturn = false;
|
2284
|
+
|
2285
|
+
//Here we check to see if we are retaining the div, if so update it
|
2286
|
+
if ($am(urlHash) !== undefined) {
|
2287
|
+
that.updateContentDiv(urlHash, xmlhttp.responseText);
|
2288
|
+
if(!$am(urlHash).title) $am(urlHash).title = anchor.title ? anchor.title : target;
|
2289
|
+
} else if (that.isAjaxApp || anchor.getAttribute("data-persist-ajax")) {
|
2290
|
+
var refresh = (anchor.getAttribute("data-pull-scroller") === 'true') ? true : false;
|
2291
|
+
refreshFunction = refresh ?
|
2292
|
+
function() {
|
2293
|
+
anchor.refresh = true;
|
2294
|
+
that.loadContent(target, newTab, back, transition, anchor);
|
2295
|
+
anchor.refresh = false;
|
2296
|
+
} : null
|
2297
|
+
that.addContentDiv(urlHash, xmlhttp.responseText,anchor.title ? anchor.title : target, refresh, refreshFunction);
|
2298
|
+
} else {
|
2299
|
+
that.updateContentDiv("jQui_ajax", xmlhttp.responseText);
|
2300
|
+
$am("jQui_ajax").title = anchor.title ? anchor.title : target;
|
2301
|
+
that.loadContent("#jQui_ajax", newTab, back);
|
2302
|
+
doReturn = true;
|
2303
|
+
}
|
2304
|
+
//Let's load the content now.
|
2305
|
+
//We need to check for any script tags and handle them
|
2306
|
+
var div = document.createElement("div");
|
2307
|
+
div.innerHTML = xmlhttp.responseText;
|
2308
|
+
that.parseScriptTags(div);
|
2309
|
+
if (doReturn)
|
2310
|
+
return;
|
2311
|
+
return that.loadContent("#" + urlHash, false, back, null);
|
2312
|
+
|
2313
|
+
}
|
2314
|
+
};
|
2315
|
+
ajaxUrl = target;
|
2316
|
+
var newtarget = this.useAjaxCacheBuster ? target + (target.split('?')[1] ? '&' : '?') + "cache=" + Math.random() * 10000000000000000 : target;
|
2317
|
+
xmlhttp.open("GET", newtarget, true);
|
2318
|
+
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
2319
|
+
xmlhttp.send();
|
2320
|
+
// show Ajax Mask
|
2321
|
+
if(this.showLoading)
|
2322
|
+
this.showMask();
|
2323
|
+
return;
|
2324
|
+
} else {
|
2325
|
+
// load a div
|
2326
|
+
|
2327
|
+
what = target.replace("#", "");
|
2328
|
+
|
2329
|
+
var slashIndex = what.indexOf('/');
|
2330
|
+
var hashLink = "";
|
2331
|
+
if (slashIndex != -1) {
|
2332
|
+
// Ignore everything after the slash for loading
|
2333
|
+
hashLink = what.substr(slashIndex);
|
2334
|
+
what = what.substr(0, slashIndex);
|
2335
|
+
}
|
2336
|
+
|
2337
|
+
what = $am(what);
|
2338
|
+
|
2339
|
+
if (!what)
|
2340
|
+
throw ("Target: " + target + " was not found");
|
2341
|
+
if (what == this.activeDiv && !back)
|
2342
|
+
return;
|
2343
|
+
|
2344
|
+
if (what.getAttribute("data-modal") == "true" || what.getAttribute("modal") == "true") {
|
2345
|
+
return this.showModal(what.id);
|
2346
|
+
}
|
2347
|
+
|
2348
|
+
|
2349
|
+
|
2350
|
+
this.transitionType = transition;
|
2351
|
+
var oldDiv = this.activeDiv;
|
2352
|
+
var currWhat = what;
|
2353
|
+
|
2354
|
+
|
2355
|
+
if (oldDiv == currWhat) //prevent it from going to itself
|
2356
|
+
return;
|
2357
|
+
|
2358
|
+
if (newTab) {
|
2359
|
+
|
2360
|
+
this.history = [];
|
2361
|
+
if(("#" + this.firstDiv.id)!=target){
|
2362
|
+
this.history.push({
|
2363
|
+
target: "#" + this.firstDiv.id,
|
2364
|
+
transition: transition
|
2365
|
+
});
|
2366
|
+
}
|
2367
|
+
} else if (!back) {
|
2368
|
+
this.history.push({
|
2369
|
+
target: previousTarget,
|
2370
|
+
transition: transition
|
2371
|
+
});
|
2372
|
+
|
2373
|
+
}
|
2374
|
+
window.history.pushState(what.id, what.id, startPath + '#' + what.id + hashLink);
|
2375
|
+
$(window).trigger("hashchange", {newUrl: startPath + '#' + what.id + hashLink,oldURL: startPath + "#" + this.activeDiv.id});
|
2376
|
+
|
2377
|
+
previousTarget = '#' + what.id + hashLink;
|
2378
|
+
|
2379
|
+
if (this.resetScrollers && this.scrollingDivs[what.id]) {
|
2380
|
+
this.scrollingDivs[what.id].scrollTo({
|
2381
|
+
x: 0,
|
2382
|
+
y: 0
|
2383
|
+
});
|
2384
|
+
}
|
2385
|
+
$(what).addClass("active");
|
2386
|
+
|
2387
|
+
what.style.display = "block";
|
2388
|
+
that.doingTransition = true;
|
2389
|
+
if (that.availableTransitions[transition])
|
2390
|
+
that.availableTransitions[transition].call(that, oldDiv, currWhat, back);
|
2391
|
+
else
|
2392
|
+
that.availableTransitions['default'].call(that, oldDiv, currWhat, back);
|
2393
|
+
|
2394
|
+
|
2395
|
+
|
2396
|
+
this.activeDiv = what;
|
2397
|
+
|
2398
|
+
if (this.scrollingDivs[this.activeDiv.id]) {
|
2399
|
+
this.scrollingDivs[this.activeDiv.id].initEvents();
|
2400
|
+
}
|
2401
|
+
if (this.scrollingDivs[oldDiv.id]) {
|
2402
|
+
this.scrollingDivs[oldDiv.id].removeEvents();
|
2403
|
+
}
|
2404
|
+
//Let's check if it has a function to run to update the data
|
2405
|
+
|
2406
|
+
|
2407
|
+
|
2408
|
+
setTimeout(function(){
|
2409
|
+
that.parsePanelFunctions(what, oldDiv);
|
2410
|
+
},300);
|
2411
|
+
setTimeout(function(){
|
2412
|
+
|
2413
|
+
if (back) {
|
2414
|
+
if (that.history.length > 0) {
|
2415
|
+
var val = that.history[that.history.length - 1];
|
2416
|
+
|
2417
|
+
var el = $am(val.target.replace("#", ""));
|
2418
|
+
that.setBackButtonText(el.title)
|
2419
|
+
}
|
2420
|
+
} else if (that.activeDiv.title)
|
2421
|
+
that.setBackButtonText(that.activeDiv.title)
|
2422
|
+
else
|
2423
|
+
that.setBackButtonText("Back");
|
2424
|
+
if (what.title) {
|
2425
|
+
that.setTitle(what.title);
|
2426
|
+
}
|
2427
|
+
if (newTab) {
|
2428
|
+
that.setBackButtonText(that.firstDiv.title)
|
2429
|
+
}
|
2430
|
+
|
2431
|
+
//Update the back buttons
|
2432
|
+
if (that.history.length == 0) {
|
2433
|
+
jq("#header #backButton").css("visibility","hidden");
|
2434
|
+
that.history = [];
|
2435
|
+
} else if (that.showBackbutton){
|
2436
|
+
jq("#header #backButton").css("visibility","visible");
|
2437
|
+
}
|
2438
|
+
},370);
|
2439
|
+
window.scrollTo(1, 1);
|
2440
|
+
|
2441
|
+
}
|
2442
|
+
},
|
2443
|
+
|
2444
|
+
/**
|
2445
|
+
* This is callled when you want to launch jqUi. If autoLaunch is set to true, it gets called on DOMContentLoaded.
|
2446
|
+
* If autoLaunch is set to false, you can manually invoke it.
|
2447
|
+
```
|
2448
|
+
$.ui.autoLaunch=false;
|
2449
|
+
$.ui.launch();
|
2450
|
+
```
|
2451
|
+
* @title $.ui.launch();
|
2452
|
+
*/
|
2453
|
+
launch: function() {
|
2454
|
+
|
2455
|
+
if (this.hasLaunched == false || this.launchCompleted) {
|
2456
|
+
this.hasLaunched = true;
|
2457
|
+
return;
|
2458
|
+
}
|
2459
|
+
this.isAppMobi = (window.AppMobi && typeof (AppMobi) == "object" && AppMobi.app !== undefined) ? true : false;
|
2460
|
+
var that = this;
|
2461
|
+
this.viewportContainer = jq("#jQUi");
|
2462
|
+
this.navbar = $am("navbar");
|
2463
|
+
this.content = $am("content");
|
2464
|
+
this.header = $am("header");
|
2465
|
+
this.menu = $am("menu");
|
2466
|
+
if (this.viewportContainer.length == 0) {
|
2467
|
+
var container = document.createElement("div");
|
2468
|
+
container.id = "jQUi";
|
2469
|
+
var body = document.body;
|
2470
|
+
while (body.firstChild) {
|
2471
|
+
container.appendChild(body.firstChild);
|
2472
|
+
}
|
2473
|
+
jq(document.body).prepend(container);
|
2474
|
+
this.viewportContainer = jq("#jQUi");
|
2475
|
+
}
|
2476
|
+
if (!this.navbar) {
|
2477
|
+
this.navbar = document.createElement("div");
|
2478
|
+
this.navbar.id = "navbar";
|
2479
|
+
this.navbar.style.cssText = "display:none";
|
2480
|
+
this.viewportContainer.append(this.navbar);
|
2481
|
+
}
|
2482
|
+
if (!this.header) {
|
2483
|
+
this.header = document.createElement("div");
|
2484
|
+
this.header.id = "header";
|
2485
|
+
this.viewportContainer.prepend(this.header);
|
2486
|
+
}
|
2487
|
+
if (!this.menu) {
|
2488
|
+
this.menu = document.createElement("div");
|
2489
|
+
this.menu.id = "menu";
|
2490
|
+
this.menu.style.overflow = "hidden";
|
2491
|
+
this.menu.innerHTML = "<div id='menu_scroller'></div>";
|
2492
|
+
this.viewportContainer.append(this.menu);
|
2493
|
+
this.scrollingDivs["menu_scroller"] = jq("#menu_scroller").scroller({
|
2494
|
+
scrollBars: true,
|
2495
|
+
verticalScroll: true,
|
2496
|
+
vScrollCSS: "jqmScrollbar"
|
2497
|
+
});
|
2498
|
+
}
|
2499
|
+
|
2500
|
+
|
2501
|
+
if (!this.content) {
|
2502
|
+
this.content = document.createElement("div");
|
2503
|
+
this.content.id = "content";
|
2504
|
+
this.viewportContainer.append(this.content);
|
2505
|
+
}
|
2506
|
+
this.header.innerHTML = '<a id="backButton" href="javascript:;"></a> <h1 id="pageTitle"></h1>' + this.header.innerHTML;
|
2507
|
+
this.backButton = $am("backButton");
|
2508
|
+
this.backButton.className = "button";
|
2509
|
+
|
2510
|
+
jq(document).on("click", "#backButton", function() {
|
2511
|
+
that.goBack();
|
2512
|
+
});
|
2513
|
+
this.backButton.style.visibility = "hidden";
|
2514
|
+
this.addContentDiv("jQui_ajax", "");
|
2515
|
+
var maskDiv = document.createElement("div");
|
2516
|
+
maskDiv.id = "jQui_mask";
|
2517
|
+
maskDiv.className = "ui-loader";
|
2518
|
+
maskDiv.innerHTML = "<span class='ui-icon ui-icon-loading spin'></span><h1>Loading Content</h1>";
|
2519
|
+
maskDiv.style.zIndex = 20000;
|
2520
|
+
maskDiv.style.display = "none";
|
2521
|
+
document.body.appendChild(maskDiv);
|
2522
|
+
var modalDiv = document.createElement("div");
|
2523
|
+
modalDiv.id = "jQui_modal";
|
2524
|
+
|
2525
|
+
this.viewportContainer.append(modalDiv);
|
2526
|
+
modalDiv.appendChild(jq("<div id='modalContainer'></div>").get());
|
2527
|
+
this.scrollingDivs['modal_container'] = jq("#modalContainer").scroller({
|
2528
|
+
scrollBars: true,
|
2529
|
+
vertical: true,
|
2530
|
+
vScrollCSS: "jqmScrollbar"
|
2531
|
+
});
|
2532
|
+
|
2533
|
+
this.modalWindow = modalDiv;
|
2534
|
+
var defer = [];
|
2535
|
+
var contentDivs = this.viewportContainer.get().querySelectorAll(".panel");
|
2536
|
+
for (var i = 0; i < contentDivs.length; i++) {
|
2537
|
+
var el = contentDivs[i];
|
2538
|
+
var tmp = el;
|
2539
|
+
var id;
|
2540
|
+
if (el.parentNode && el.parentNode.id != "content") {
|
2541
|
+
el.parentNode.removeChild(el);
|
2542
|
+
var id = el.id;
|
2543
|
+
this.addDivAndScroll(tmp);
|
2544
|
+
if (tmp.getAttribute("selected"))
|
2545
|
+
this.firstDiv = $am(id);
|
2546
|
+
} else if (!el.parsedContent) {
|
2547
|
+
el.parsedContent = 1;
|
2548
|
+
el.parentNode.removeChild(el);
|
2549
|
+
var id = el.id;
|
2550
|
+
this.addDivAndScroll(tmp);
|
2551
|
+
if (tmp.getAttribute("selected"))
|
2552
|
+
this.firstDiv = $am(id);
|
2553
|
+
}
|
2554
|
+
if (el.getAttribute("data-defer")){
|
2555
|
+
defer[id] = el.getAttribute("data-defer");
|
2556
|
+
defer.length++;
|
2557
|
+
}
|
2558
|
+
el = null;
|
2559
|
+
}
|
2560
|
+
if(!this.firstDiv)
|
2561
|
+
this.firstDiv=$("#content").children().get(0);
|
2562
|
+
contentDivs = null;
|
2563
|
+
var loadingDefer=false;
|
2564
|
+
var toLoad=defer.length;
|
2565
|
+
if(toLoad>0){
|
2566
|
+
loadingDefer=true;
|
2567
|
+
var loaded=0;
|
2568
|
+
for (var j in defer) {
|
2569
|
+
(function(j) {
|
2570
|
+
jq.ajax({url:AppMobi.webRoot + defer[j], success:function(data) {
|
2571
|
+
if (data.length == 0)
|
2572
|
+
return;
|
2573
|
+
$.ui.updateContentDiv(j, data);
|
2574
|
+
that.parseScriptTags(jq(j).get());
|
2575
|
+
loaded++;
|
2576
|
+
if(loaded>=toLoad){
|
2577
|
+
$(document).trigger("defer:loaded");
|
2578
|
+
loadingDefer=false;
|
2579
|
+
|
2580
|
+
}
|
2581
|
+
},error:function(msg){
|
2582
|
+
//still trigger the file as being loaded to not block jq.ui.ready
|
2583
|
+
console.log("Error with deferred load "+AppMobi.webRoot+defer[j])
|
2584
|
+
loaded++;
|
2585
|
+
if(loaded>=toLoad){
|
2586
|
+
$(document).trigger("defer:loaded");
|
2587
|
+
loadingDefer=false;
|
2588
|
+
}
|
2589
|
+
}});
|
2590
|
+
})(j);
|
2591
|
+
}
|
2592
|
+
}
|
2593
|
+
if (this.firstDiv) {
|
2594
|
+
|
2595
|
+
var that = this;
|
2596
|
+
// Fix a bug in iOS where translate3d makes the content blurry
|
2597
|
+
this.activeDiv = this.firstDiv;
|
2598
|
+
|
2599
|
+
//window.setTimeout(function() {
|
2600
|
+
var loadFirstDiv=function(){
|
2601
|
+
//activeDiv = firstDiv;
|
2602
|
+
if (defaultHash.length > 0 && that.loadDefaultHash&&defaultHash!=("#"+that.firstDiv.id)&&$(defaultHash).length>0)
|
2603
|
+
{
|
2604
|
+
that.activeDiv=$(defaultHash).get();
|
2605
|
+
jq("#header #backButton").css("visibility","visible");
|
2606
|
+
that.setBackButtonText(that.activeDiv.title)
|
2607
|
+
that.history=[{target:"#"+that.firstDiv.id}]; //Reset the history to the first div
|
2608
|
+
}
|
2609
|
+
else
|
2610
|
+
previousTarget="#"+that.activeDiv.id;
|
2611
|
+
if (that.scrollingDivs[that.activeDiv.id]) {
|
2612
|
+
that.scrollingDivs[that.activeDiv.id].initEvents();
|
2613
|
+
}
|
2614
|
+
that.activeDiv.style.display = "block";
|
2615
|
+
|
2616
|
+
|
2617
|
+
if (that.activeDiv.title)
|
2618
|
+
that.setTitle(that.activeDiv.title);
|
2619
|
+
that.parsePanelFunctions(that.activeDiv);
|
2620
|
+
//Load the default hash
|
2621
|
+
|
2622
|
+
that.history=[{target:"#"+that.firstDiv.id}]; //Reset the history to the first div
|
2623
|
+
modalDiv = null;
|
2624
|
+
maskDiv = null;
|
2625
|
+
that.launchCompleted = true;
|
2626
|
+
|
2627
|
+
if(jq("#navbar a").length>0){
|
2628
|
+
jq("#navbar a").data("ignore-pressed", "true").data("resetHistory", "true");
|
2629
|
+
that.defaultFooter = jq("#navbar").children();
|
2630
|
+
that.updateNavbarElements(that.defaultFooter);
|
2631
|
+
}
|
2632
|
+
var firstMenu = jq("nav").get();
|
2633
|
+
if(firstMenu){
|
2634
|
+
that.defaultMenu = jq(firstMenu).children();
|
2635
|
+
that.updateSideMenu(that.defaultMenu);
|
2636
|
+
}
|
2637
|
+
that.defaultHeader = jq("#header").children();
|
2638
|
+
jq(document).trigger("jq.ui.ready");
|
2639
|
+
jq("#splashscreen").remove();
|
2640
|
+
};
|
2641
|
+
if(loadingDefer){
|
2642
|
+
$(document).one("defer:loaded",loadFirstDiv);
|
2643
|
+
}
|
2644
|
+
else
|
2645
|
+
loadFirstDiv();
|
2646
|
+
}
|
2647
|
+
|
2648
|
+
},
|
2649
|
+
|
2650
|
+
noTransition: function(oldDiv, currDiv, back) {
|
2651
|
+
oldDiv.style.display = "block";
|
2652
|
+
currDiv.style.display = "block";
|
2653
|
+
var that = this
|
2654
|
+
if (back) {
|
2655
|
+
that.css3animate(currDiv, {
|
2656
|
+
x: "0%",
|
2657
|
+
time: "1ms"
|
2658
|
+
});
|
2659
|
+
that.css3animate(oldDiv, {
|
2660
|
+
x: 0,
|
2661
|
+
time: "1ms"
|
2662
|
+
});
|
2663
|
+
|
2664
|
+
} else {
|
2665
|
+
|
2666
|
+
that.css3animate(oldDiv, {
|
2667
|
+
x: 0,
|
2668
|
+
y: 0,
|
2669
|
+
time: "1ms"
|
2670
|
+
});
|
2671
|
+
that.css3animate(currDiv, {
|
2672
|
+
x: "0%",
|
2673
|
+
time: "1ms"
|
2674
|
+
});
|
2675
|
+
}
|
2676
|
+
that.finishTransition(oldDiv);
|
2677
|
+
currDiv.style.zIndex = 2;
|
2678
|
+
oldDiv.style.zIndex = 1;
|
2679
|
+
$(oldDiv).removeClass('active');
|
2680
|
+
},
|
2681
|
+
|
2682
|
+
/**
|
2683
|
+
* This must be called at the end of every transition to hide the old div and reset the doingTransition variable
|
2684
|
+
*
|
2685
|
+
* @param {Object} Div that transitioned out
|
2686
|
+
* @title $.ui.finishTransition(oldDiv)
|
2687
|
+
*/
|
2688
|
+
finishTransition: function(oldDiv) {
|
2689
|
+
|
2690
|
+
oldDiv.style.display = 'none';
|
2691
|
+
this.doingTransition = false;
|
2692
|
+
|
2693
|
+
}
|
2694
|
+
/**
|
2695
|
+
* END
|
2696
|
+
* @api private
|
2697
|
+
*/
|
2698
|
+
};
|
2699
|
+
|
2700
|
+
function $am(el) {
|
2701
|
+
el = el.indexOf("#") == -1 ? "#" + el : el;
|
2702
|
+
return jq(el).get(0);
|
2703
|
+
}
|
2704
|
+
|
2705
|
+
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D"; /* Number */
|
2706
|
+
var crc32 = function( /* String */str, /* Number */crc) {
|
2707
|
+
if (crc == undefined)
|
2708
|
+
crc = 0;
|
2709
|
+
var n = 0; //a number between 0 and 255
|
2710
|
+
var x = 0; //an hex number
|
2711
|
+
crc = crc ^ (-1);
|
2712
|
+
for (var i = 0, iTop = str.length; i < iTop; i++) {
|
2713
|
+
n = (crc ^ str.charCodeAt(i)) & 0xFF;
|
2714
|
+
x = "0x" + table.substr(n * 9, 8);
|
2715
|
+
crc = (crc >>> 8) ^ x;
|
2716
|
+
}
|
2717
|
+
return crc ^ (-1);
|
2718
|
+
};
|
2719
|
+
|
2720
|
+
|
2721
|
+
$.ui = new ui;
|
2722
|
+
})(jq);
|
2723
|
+
|
2724
|
+
//The following functions are utilitiy functions for jqUi. They are not apart of the base class, but help with locking the page scroll,
|
2725
|
+
//input box issues, remove the address bar on iOS and android, etc
|
2726
|
+
(function() {
|
2727
|
+
var jQUi;
|
2728
|
+
|
2729
|
+
//Check to see if any <nav> items are found. If so, add the CSS classes
|
2730
|
+
jq(document).ready(function() {
|
2731
|
+
if (jq("nav").length > 0) {
|
2732
|
+
jq("#jQUi #header").addClass("hasMenu");
|
2733
|
+
jq("#jQUi #content").addClass("hasMenu");
|
2734
|
+
jq("#jQUi #navbar").addClass("hasMenu");
|
2735
|
+
}
|
2736
|
+
jQUi = jq("#jQUi");
|
2737
|
+
setTimeout(function(){
|
2738
|
+
hideAddressBar();
|
2739
|
+
},100);
|
2740
|
+
});
|
2741
|
+
|
2742
|
+
document.addEventListener("appMobi.device.ready", function() { //in AppMobi, we need to undo the height stuff since it causes issues.
|
2743
|
+
setTimeout(function() {
|
2744
|
+
jQUi.css("height", "100%"), document.body.style.height = "100%";
|
2745
|
+
document.documentElement.style.minHeight = window.innerHeight;
|
2746
|
+
}, 300);
|
2747
|
+
});
|
2748
|
+
|
2749
|
+
|
2750
|
+
window.addEventListener("orientationchange", function(e) {
|
2751
|
+
jq.ui.updateOrientation()
|
2752
|
+
window.setTimeout(function() {
|
2753
|
+
hideAddressBar();
|
2754
|
+
}, 200);
|
2755
|
+
}, false);
|
2756
|
+
|
2757
|
+
if (jq.os.android)
|
2758
|
+
{
|
2759
|
+
window.addEventListener("resize", function(e) {
|
2760
|
+
window.scrollTo(0,1);
|
2761
|
+
jq.ui.updateOrientation();
|
2762
|
+
if(document.body.clientWidth>=700)
|
2763
|
+
$.ui.toggleSideMenu(false);
|
2764
|
+
window.setTimeout(function() {
|
2765
|
+
hideAddressBar();
|
2766
|
+
}, 100);
|
2767
|
+
}, false);
|
2768
|
+
}
|
2769
|
+
|
2770
|
+
|
2771
|
+
function hideAddressBar() {
|
2772
|
+
if (jq.os.desktop)
|
2773
|
+
return jQUi.css("height", "100%");
|
2774
|
+
if (jq.os.android) {
|
2775
|
+
window.scrollTo(1, 1);
|
2776
|
+
if (document.documentElement.scrollHeight < window.outerHeight / window.devicePixelRatio)
|
2777
|
+
jQUi.css("height", (window.outerHeight / window.devicePixelRatio) + 'px');
|
2778
|
+
}
|
2779
|
+
else {
|
2780
|
+
document.documentElement.style.height = "5000px";
|
2781
|
+
|
2782
|
+
window.scrollTo(0, 1);
|
2783
|
+
document.documentElement.style.height = window.innerHeight + "px";
|
2784
|
+
jQUi.css("height", window.innerHeight + "px");
|
2785
|
+
}
|
2786
|
+
}
|
2787
|
+
//The following is based on Cubiq.org - iOS no click delay. We use this to capture events to input boxes to fix Android...and fix iOS ;)
|
2788
|
+
//We had to make a lot of fixes to allow access to input elements on android, etc.
|
2789
|
+
function NoClickDelay(el) {
|
2790
|
+
if (typeof (el) === "string")
|
2791
|
+
el = document.getElementById(el);
|
2792
|
+
el.addEventListener('touchstart', this, false);
|
2793
|
+
}
|
2794
|
+
var prevClickField;
|
2795
|
+
var prevPanel;
|
2796
|
+
var prevField;
|
2797
|
+
var closeField;
|
2798
|
+
NoClickDelay.prototype = {
|
2799
|
+
dX: 0,
|
2800
|
+
dY: 0,
|
2801
|
+
cX: 0,
|
2802
|
+
cY: 0,
|
2803
|
+
handleEvent: function(e) {
|
2804
|
+
switch (e.type) {
|
2805
|
+
case 'touchstart':
|
2806
|
+
this.onTouchStart(e);
|
2807
|
+
break;
|
2808
|
+
case 'touchmove':
|
2809
|
+
this.onTouchMove(e);
|
2810
|
+
break;
|
2811
|
+
case 'touchend':
|
2812
|
+
this.onTouchEnd(e);
|
2813
|
+
break;
|
2814
|
+
}
|
2815
|
+
},
|
2816
|
+
|
2817
|
+
onTouchStart: function(e) {
|
2818
|
+
|
2819
|
+
this.dX = e.touches[0].pageX;
|
2820
|
+
this.dY = e.touches[0].pageY;
|
2821
|
+
|
2822
|
+
var theTarget = e.target;
|
2823
|
+
if (theTarget.nodeType == 3)
|
2824
|
+
theTarget = theTarget.parentNode;
|
2825
|
+
|
2826
|
+
if(closeField)
|
2827
|
+
clearTimeout(closeField),closeField=null;
|
2828
|
+
if(prevField){
|
2829
|
+
prevField=null;
|
2830
|
+
var field = document.createElement('input');
|
2831
|
+
field.setAttribute('type', 'text');
|
2832
|
+
field.id="myhack";
|
2833
|
+
document.body.appendChild(field);
|
2834
|
+
|
2835
|
+
closeField=setTimeout(function() {
|
2836
|
+
field.focus();
|
2837
|
+
setTimeout(function() {
|
2838
|
+
field.blur();
|
2839
|
+
field.parentNode.removeChild(field);
|
2840
|
+
}, 50);
|
2841
|
+
}, 350);
|
2842
|
+
}
|
2843
|
+
|
2844
|
+
if(prevPanel){
|
2845
|
+
//prevField.blur();
|
2846
|
+
prevPanel.css("-webkit-transform","translate3d(0px,0px,0px)");
|
2847
|
+
prevPanel.css("left","0");
|
2848
|
+
prevField=null;
|
2849
|
+
prevPanel=null;
|
2850
|
+
}
|
2851
|
+
|
2852
|
+
var tagname = theTarget.tagName.toLowerCase();
|
2853
|
+
var type=theTarget.type||"";
|
2854
|
+
if((tagname=="a"&& theTarget.href.indexOf("tel:")===0)||((tagname=="input")||tagname=="textarea"||tagname=="select")&&type!="checkbox"&&type!="radio"){
|
2855
|
+
|
2856
|
+
if(jq.os.android&&$.ui.fixAndroidInputs){
|
2857
|
+
prevField=theTarget;
|
2858
|
+
theTarget.focus();
|
2859
|
+
//prevField=theTarget;
|
2860
|
+
prevPanel=$(theTarget).closest(".panel");
|
2861
|
+
prevPanel.css("left","-100%");
|
2862
|
+
prevPanel.css("-webkit-transition-duration","0ms");
|
2863
|
+
prevPanel.css("-webkit-transform","translate3d(100%,0px,0px)");
|
2864
|
+
prevPanel.css("position","absolute");
|
2865
|
+
return;
|
2866
|
+
}
|
2867
|
+
|
2868
|
+
}
|
2869
|
+
else
|
2870
|
+
e.preventDefault();
|
2871
|
+
this.moved = false;
|
2872
|
+
document.addEventListener('touchmove', this, true);
|
2873
|
+
document.addEventListener('touchend', this, true);
|
2874
|
+
|
2875
|
+
},
|
2876
|
+
|
2877
|
+
onTouchMove: function(e) {
|
2878
|
+
|
2879
|
+
this.moved = true;
|
2880
|
+
this.cX = e.touches[0].pageX - this.dX;
|
2881
|
+
this.cY = e.touches[0].pageY - this.dY;
|
2882
|
+
|
2883
|
+
// e.preventDefault();
|
2884
|
+
return false;
|
2885
|
+
},
|
2886
|
+
onTouchEnd: function(e) {
|
2887
|
+
document.removeEventListener('touchmove', this, true);
|
2888
|
+
document.removeEventListener('touchend', this, true);
|
2889
|
+
|
2890
|
+
if ((!jq.os.blackberry && !this.moved) || (jq.os.blackberry && (Math.abs(this.cX) < 5 || Math.abs(this.cY) < 5))) {
|
2891
|
+
var theTarget = e.target;
|
2892
|
+
if (theTarget.nodeType == 3)
|
2893
|
+
theTarget = theTarget.parentNode;
|
2894
|
+
|
2895
|
+
var theEvent = document.createEvent('MouseEvents');
|
2896
|
+
theEvent.initEvent('click', true, true);
|
2897
|
+
theTarget.dispatchEvent(theEvent);
|
2898
|
+
e.preventDefault();
|
2899
|
+
}
|
2900
|
+
|
2901
|
+
prevClickField = null;
|
2902
|
+
this.dX = this.cX = this.cY = this.dY = 0;
|
2903
|
+
return false;
|
2904
|
+
|
2905
|
+
}
|
2906
|
+
};
|
2907
|
+
|
2908
|
+
|
2909
|
+
|
2910
|
+
jq(document).ready(function() {
|
2911
|
+
document.body.addEventListener('touchmove', function(e) {
|
2912
|
+
e.preventDefault();
|
2913
|
+
if(jq.os.android)
|
2914
|
+
e.stopPropagation();
|
2915
|
+
window.scrollTo(1, 1);
|
2916
|
+
}, false);
|
2917
|
+
if (!jq.os.desktop)
|
2918
|
+
new NoClickDelay(document.getElementById("jQUi"));
|
2919
|
+
|
2920
|
+
document.getElementById("jQUi").addEventListener("click", function(e) {
|
2921
|
+
|
2922
|
+
var theTarget = e.target;
|
2923
|
+
if (theTarget.nodeType == 3)
|
2924
|
+
theTarget = theTarget.parentNode;
|
2925
|
+
if (checkAnchorClick(theTarget)) {
|
2926
|
+
e.preventDefault();
|
2927
|
+
return false;
|
2928
|
+
}
|
2929
|
+
}, true);
|
2930
|
+
|
2931
|
+
jq("#navbar").on("click", "a", function(e) {
|
2932
|
+
jq("#navbar a").removeClass("selected");
|
2933
|
+
setTimeout(function() {
|
2934
|
+
$(e.target).addClass("selected");
|
2935
|
+
}, 10);
|
2936
|
+
});
|
2937
|
+
});
|
2938
|
+
|
2939
|
+
function checkAnchorClick(theTarget) {
|
2940
|
+
var parent = false;
|
2941
|
+
while (theTarget.tagName && theTarget.tagName.toLowerCase() != "a" && theTarget.parentNode)
|
2942
|
+
parent = true, theTarget = theTarget.parentNode; //let's try the parent so <a href="#foo"><img src="whatever.jpg"></a> will work
|
2943
|
+
if (theTarget&&theTarget.tagName&&theTarget.tagName.toLowerCase() == "a") {
|
2944
|
+
|
2945
|
+
|
2946
|
+
var custom=(typeof jq.ui.customClickHandler=="function")?jq.ui.customClickHandler:false;
|
2947
|
+
if(custom!==false&&jq.ui.customClickHandler(theTarget)){
|
2948
|
+
return true;
|
2949
|
+
}
|
2950
|
+
if (theTarget.href.toLowerCase().indexOf("javascript:") !== -1 || theTarget.getAttribute("data-ignore")) {
|
2951
|
+
return false;
|
2952
|
+
}
|
2953
|
+
|
2954
|
+
|
2955
|
+
|
2956
|
+
if(theTarget.href.indexOf("tel:")===0)
|
2957
|
+
return false;
|
2958
|
+
if (theTarget.hash.indexOf("#") === -1 && theTarget.target.length > 0)
|
2959
|
+
{
|
2960
|
+
|
2961
|
+
if (theTarget.href.toLowerCase().indexOf("javascript:") != 0) {
|
2962
|
+
if (jq.ui.isAppMobi)
|
2963
|
+
AppMobi.device.launchExternal(theTarget.href);
|
2964
|
+
else if (!jq.os.desktop)
|
2965
|
+
brokerClickEventMobile(theTarget);
|
2966
|
+
else
|
2967
|
+
window.open(theTarget);
|
2968
|
+
return true;
|
2969
|
+
}
|
2970
|
+
return false;
|
2971
|
+
}
|
2972
|
+
if ((theTarget.href.indexOf("#") !== -1 && theTarget.hash.length == 0) || theTarget.href.length == 0)
|
2973
|
+
return true;
|
2974
|
+
|
2975
|
+
var mytransition = theTarget.getAttribute("data-transition");
|
2976
|
+
var resetHistory = theTarget.getAttribute("data-resetHistory");
|
2977
|
+
var back = (theTarget.getAttribute("data-reverse") && theTarget.getAttribute("data-reverse") == 'true')?true:false;
|
2978
|
+
resetHistory = resetHistory && resetHistory.toLowerCase() == "true" ? true : false;
|
2979
|
+
|
2980
|
+
var href = theTarget.hash.length > 0 ? theTarget.hash : theTarget.href;
|
2981
|
+
jq.ui.loadContent(href, resetHistory, back, mytransition, theTarget);
|
2982
|
+
|
2983
|
+
return true;
|
2984
|
+
}
|
2985
|
+
}
|
2986
|
+
function brokerClickEventMobile(theTarget) {
|
2987
|
+
if (jq.os.desktop)
|
2988
|
+
return;
|
2989
|
+
var clickevent = document.createEvent('Event');
|
2990
|
+
clickevent.initEvent('click', true, false);
|
2991
|
+
theTarget.target = "_blank";
|
2992
|
+
theTarget.dispatchEvent(clickevent);
|
2993
|
+
}
|
2994
|
+
})();
|
2995
|
+
|
2996
|
+
//Touch events are from zepto/touch.js
|
2997
|
+
|
2998
|
+
(function($) {
|
2999
|
+
var touch = {}, touchTimeout;
|
3000
|
+
|
3001
|
+
function parentIfText(node) {
|
3002
|
+
return 'tagName' in node ? node : node.parentNode;
|
3003
|
+
}
|
3004
|
+
|
3005
|
+
function swipeDirection(x1, x2, y1, y2) {
|
3006
|
+
var xDelta = Math.abs(x1 - x2), yDelta = Math.abs(y1 - y2);
|
3007
|
+
if (xDelta >= yDelta) {
|
3008
|
+
return (x1 - x2 > 0 ? 'Left' : 'Right');
|
3009
|
+
} else {
|
3010
|
+
return (y1 - y2 > 0 ? 'Up' : 'Down');
|
3011
|
+
}
|
3012
|
+
}
|
3013
|
+
|
3014
|
+
var longTapDelay = 750;
|
3015
|
+
function longTap() {
|
3016
|
+
if (touch.last && (Date.now() - touch.last >= longTapDelay)) {
|
3017
|
+
touch.el.trigger('longTap');
|
3018
|
+
touch = {};
|
3019
|
+
}
|
3020
|
+
}
|
3021
|
+
$(document).ready(function() {
|
3022
|
+
$(document.body).bind('touchstart', function(e) {
|
3023
|
+
var now = Date.now(), delta = now - (touch.last || now);
|
3024
|
+
touch.el = $(parentIfText(e.touches[0].target));
|
3025
|
+
touchTimeout && clearTimeout(touchTimeout);
|
3026
|
+
touch.x1 = e.touches[0].pageX;
|
3027
|
+
touch.y1 = e.touches[0].pageY;
|
3028
|
+
if (delta > 0 && delta <= 250)
|
3029
|
+
touch.isDoubleTap = true;
|
3030
|
+
touch.last = now;
|
3031
|
+
setTimeout(longTap, longTapDelay);
|
3032
|
+
if (!touch.el.data("ignore-pressed"))
|
3033
|
+
touch.el.addClass("selected");
|
3034
|
+
else
|
3035
|
+
touch.el.closest(".selectable").addClass("selected");
|
3036
|
+
}).bind('touchmove', function(e) {
|
3037
|
+
touch.x2 = e.touches[0].pageX;
|
3038
|
+
touch.y2 = e.touches[0].pageY;
|
3039
|
+
}).bind('touchend', function(e) {
|
3040
|
+
if (!touch.el) {
|
3041
|
+
touch = {};
|
3042
|
+
return;
|
3043
|
+
}
|
3044
|
+
if (!touch.el.data("ignore-pressed"))
|
3045
|
+
touch.el.removeClass("selected");
|
3046
|
+
else
|
3047
|
+
touch.el.closest(".selectable").removeClass("selected");
|
3048
|
+
if (touch.isDoubleTap) {
|
3049
|
+
touch.el.trigger('doubleTap');
|
3050
|
+
touch = {};
|
3051
|
+
} else if (Math.abs(touch.x1 - touch.x2) > 5 || Math.abs(touch.y1 - touch.y2) > 5) {
|
3052
|
+
(Math.abs(touch.x1 - touch.x2) > 30 || Math.abs(touch.y1 - touch.y2) > 30) &&
|
3053
|
+
touch.el.trigger('swipe') &&
|
3054
|
+
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
|
3055
|
+
touch.x1 = touch.x2 = touch.y1 = touch.y2 = touch.last = 0;
|
3056
|
+
touch={};
|
3057
|
+
} else if ('last' in touch) {
|
3058
|
+
touch.el.trigger('tap');
|
3059
|
+
touchTimeout = setTimeout(function() {
|
3060
|
+
touchTimeout = null;
|
3061
|
+
if (touch.el)
|
3062
|
+
touch.el.trigger('singleTap');
|
3063
|
+
touch = {};
|
3064
|
+
}, 250);
|
3065
|
+
}
|
3066
|
+
}).bind('touchcancel', function() {
|
3067
|
+
touch = {}
|
3068
|
+
});
|
3069
|
+
});
|
3070
|
+
|
3071
|
+
['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(m) {
|
3072
|
+
$.fn[m] = function(callback) {
|
3073
|
+
return this.bind(m, callback)
|
3074
|
+
}
|
3075
|
+
});
|
3024
3076
|
})(jq);
|
3025
3077
|
(function($ui){
|
3026
3078
|
|