##// END OF EJS Templates
js: drop some unused parts of YUI...
Mads Kiilerich -
r5906:81a1eb6c default
parent child Browse files
Show More
@@ -227,9 +227,9 b' Kallithea includes a minified version of'
227 git checkout hudson-yui2-2800
227 git checkout hudson-yui2-2800
228 ln -sf JumpToPageDropDown.js src/paginator/js/JumpToPageDropdown.js # work around inconsistent casing
228 ln -sf JumpToPageDropDown.js src/paginator/js/JumpToPageDropdown.js # work around inconsistent casing
229 rm -f tmp.js
229 rm -f tmp.js
230 for m in yahoo event dom connection animation dragdrop element datasource autocomplete container event-delegate json datatable paginator; do
230 for m in yahoo event dom animation datasource autocomplete event-delegate; do
231 rm -f build/\$m/\$m.js
231 rm -f build/$m/$m.js
232 ( cd src/\$m && ant build deploybuild ) && sed -e 's,@VERSION@,2.9.0,g' -e 's,@BUILD@,2800,g' build/\$m/\$m.js >> tmp.js
232 ( cd src/$m && ant build deploybuild ) && sed -e 's,@VERSION@,2.9.0,g' -e 's,@BUILD@,2800,g' build/$m/$m.js >> tmp.js
233 done
233 done
234 java -jar ../builder/componentbuild/lib/yuicompressor/yuicompressor-2.4.4.jar tmp.js -o yui.2.9.js
234 java -jar ../builder/componentbuild/lib/yuicompressor/yuicompressor-2.4.4.jar tmp.js -o yui.2.9.js
235
235
@@ -311,12 +311,6 b' var pyroutes = (function() {'
311 })();
311 })();
312
312
313
313
314 /**
315 * GLOBAL YUI Shortcuts
316 */
317 var YUD = YAHOO.util.Dom;
318 var YUE = YAHOO.util.Event;
319
320 /* Invoke all functions in callbacks */
314 /* Invoke all functions in callbacks */
321 var _run_callbacks = function(callbacks){
315 var _run_callbacks = function(callbacks){
322 if (callbacks !== undefined){
316 if (callbacks !== undefined){
@@ -1394,46 +1388,6 b' var quick_repo_menu = function(){'
1394 };
1388 };
1395
1389
1396
1390
1397 /**
1398 * TABLE SORTING
1399 */
1400
1401 var revisionSort = function(a, b, desc, field) {
1402 var a_ = parseInt(a.getData('last_rev_raw') || 0);
1403 var b_ = parseInt(b.getData('last_rev_raw') || 0);
1404
1405 return YAHOO.util.Sort.compare(a_, b_, desc);
1406 };
1407
1408 var ageSort = function(a, b, desc, field) {
1409 // data is like: <span class="tooltip" date="2014-06-04 18:18:55.325474" title="Wed, 04 Jun 2014 18:18:55">1 day and 23 hours ago</span>
1410 var a_ = $(a.getData(field)).attr('date');
1411 var b_ = $(b.getData(field)).attr('date');
1412
1413 return YAHOO.util.Sort.compare(a_, b_, desc);
1414 };
1415
1416 var lastLoginSort = function(a, b, desc, field) {
1417 var a_ = parseFloat(a.getData('last_login_raw') || 0);
1418 var b_ = parseFloat(b.getData('last_login_raw') || 0);
1419
1420 return YAHOO.util.Sort.compare(a_, b_, desc);
1421 };
1422
1423 var nameSort = function(a, b, desc, field) {
1424 var a_ = a.getData('raw_name') || 0;
1425 var b_ = b.getData('raw_name') || 0;
1426
1427 return YAHOO.util.Sort.compare(a_, b_, desc);
1428 };
1429
1430 var dateSort = function(a, b, desc, field) {
1431 var a_ = parseFloat(a.getData('raw_date') || 0);
1432 var b_ = parseFloat(b.getData('raw_date') || 0);
1433
1434 return YAHOO.util.Sort.compare(a_, b_, desc);
1435 };
1436
1437 var addPermAction = function(_html, users_list, groups_list){
1391 var addPermAction = function(_html, users_list, groups_list){
1438 var $last_node = $('.last_new_member').last(); // empty tr between last and add
1392 var $last_node = $('.last_new_member').last(); // empty tr between last and add
1439 var next_id = $('.new_members').length;
1393 var next_id = $('.new_members').length;
@@ -1502,289 +1456,6 b' var MultiSelectWidget = function(selecte'
1502 });
1456 });
1503 }
1457 }
1504
1458
1505 // custom paginator
1506 var YUI_paginator = function(links_per_page, containers){
1507
1508 (function () {
1509
1510 var Paginator = YAHOO.widget.Paginator,
1511 l = YAHOO.lang,
1512 setId = YAHOO.util.Dom.generateId;
1513
1514 Paginator.ui.MyFirstPageLink = function (p) {
1515 this.paginator = p;
1516
1517 p.subscribe('recordOffsetChange',this.update,this,true);
1518 p.subscribe('rowsPerPageChange',this.update,this,true);
1519 p.subscribe('totalRecordsChange',this.update,this,true);
1520 p.subscribe('destroy',this.destroy,this,true);
1521
1522 // TODO: make this work
1523 p.subscribe('firstPageLinkLabelChange',this.update,this,true);
1524 p.subscribe('firstPageLinkClassChange',this.update,this,true);
1525 };
1526
1527 Paginator.ui.MyFirstPageLink.init = function (p) {
1528 p.setAttributeConfig('firstPageLinkLabel', {
1529 value : 1,
1530 validator : l.isString
1531 });
1532 p.setAttributeConfig('firstPageLinkClass', {
1533 value : 'yui-pg-first',
1534 validator : l.isString
1535 });
1536 p.setAttributeConfig('firstPageLinkTitle', {
1537 value : 'First Page',
1538 validator : l.isString
1539 });
1540 };
1541
1542 // Instance members and methods
1543 Paginator.ui.MyFirstPageLink.prototype = {
1544 current : null,
1545 leftmost_page: null,
1546 rightmost_page: null,
1547 link : null,
1548 span : null,
1549 dotdot : null,
1550 getPos : function(cur_page, max_page, items){
1551 var edge = parseInt(items / 2) + 1;
1552 if (cur_page <= edge){
1553 var radius = Math.max(parseInt(items / 2), items - cur_page);
1554 }
1555 else if ((max_page - cur_page) < edge) {
1556 var radius = (items - 1) - (max_page - cur_page);
1557 }
1558 else{
1559 var radius = parseInt(items / 2);
1560 }
1561
1562 var left = Math.max(1, (cur_page - (radius)));
1563 var right = Math.min(max_page, cur_page + (radius));
1564 return [left, cur_page, right]
1565 },
1566 render : function (id_base) {
1567 var p = this.paginator,
1568 c = p.get('firstPageLinkClass'),
1569 label = p.get('firstPageLinkLabel'),
1570 title = p.get('firstPageLinkTitle');
1571
1572 this.link = document.createElement('a');
1573 this.span = document.createElement('span');
1574 $(this.span).hide();
1575
1576 var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5);
1577 this.leftmost_page = _pos[0];
1578 this.rightmost_page = _pos[2];
1579
1580 setId(this.link, id_base + '-first-link');
1581 this.link.href = '#';
1582 this.link.className = c;
1583 this.link.innerHTML = label;
1584 this.link.title = title;
1585 YUE.on(this.link,'click',this.onClick,this,true);
1586
1587 setId(this.span, id_base + '-first-span');
1588 this.span.className = c;
1589 this.span.innerHTML = label;
1590
1591 this.current = p.getCurrentPage() > 1 ? this.link : this.span;
1592 return this.current;
1593 },
1594 update : function (e) {
1595 var p = this.paginator;
1596 var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5);
1597 this.leftmost_page = _pos[0];
1598 this.rightmost_page = _pos[2];
1599
1600 if (e && e.prevValue === e.newValue) {
1601 return;
1602 }
1603
1604 var par = this.current ? this.current.parentNode : null;
1605 if (this.leftmost_page > 1) {
1606 if (par && this.current === this.span) {
1607 par.replaceChild(this.link,this.current);
1608 this.current = this.link;
1609 }
1610 } else {
1611 if (par && this.current === this.link) {
1612 par.replaceChild(this.span,this.current);
1613 this.current = this.span;
1614 }
1615 }
1616 },
1617 destroy : function () {
1618 YUE.purgeElement(this.link);
1619 this.current.parentNode.removeChild(this.current);
1620 this.link = this.span = null;
1621 },
1622 onClick : function (e) {
1623 YUE.stopEvent(e);
1624 this.paginator.setPage(1);
1625 }
1626 };
1627
1628 })();
1629
1630 (function () {
1631
1632 var Paginator = YAHOO.widget.Paginator,
1633 l = YAHOO.lang,
1634 setId = YAHOO.util.Dom.generateId;
1635
1636 Paginator.ui.MyLastPageLink = function (p) {
1637 this.paginator = p;
1638
1639 p.subscribe('recordOffsetChange',this.update,this,true);
1640 p.subscribe('rowsPerPageChange',this.update,this,true);
1641 p.subscribe('totalRecordsChange',this.update,this,true);
1642 p.subscribe('destroy',this.destroy,this,true);
1643
1644 // TODO: make this work
1645 p.subscribe('lastPageLinkLabelChange',this.update,this,true);
1646 p.subscribe('lastPageLinkClassChange', this.update,this,true);
1647 };
1648
1649 Paginator.ui.MyLastPageLink.init = function (p) {
1650 p.setAttributeConfig('lastPageLinkLabel', {
1651 value : -1,
1652 validator : l.isString
1653 });
1654 p.setAttributeConfig('lastPageLinkClass', {
1655 value : 'yui-pg-last',
1656 validator : l.isString
1657 });
1658 p.setAttributeConfig('lastPageLinkTitle', {
1659 value : 'Last Page',
1660 validator : l.isString
1661 });
1662
1663 };
1664
1665 Paginator.ui.MyLastPageLink.prototype = {
1666
1667 current : null,
1668 leftmost_page: null,
1669 rightmost_page: null,
1670 link : null,
1671 span : null,
1672 dotdot : null,
1673 na : null,
1674 getPos : function(cur_page, max_page, items){
1675 var edge = parseInt(items / 2) + 1;
1676 if (cur_page <= edge){
1677 var radius = Math.max(parseInt(items / 2), items - cur_page);
1678 }
1679 else if ((max_page - cur_page) < edge) {
1680 var radius = (items - 1) - (max_page - cur_page);
1681 }
1682 else{
1683 var radius = parseInt(items / 2);
1684 }
1685
1686 var left = Math.max(1, (cur_page - (radius)));
1687 var right = Math.min(max_page, cur_page + (radius));
1688 return [left, cur_page, right]
1689 },
1690 render : function (id_base) {
1691 var p = this.paginator,
1692 c = p.get('lastPageLinkClass'),
1693 label = p.get('lastPageLinkLabel'),
1694 last = p.getTotalPages(),
1695 title = p.get('lastPageLinkTitle');
1696
1697 var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5);
1698 this.leftmost_page = _pos[0];
1699 this.rightmost_page = _pos[2];
1700
1701 this.link = document.createElement('a');
1702 this.span = document.createElement('span');
1703 $(this.span).hide();
1704
1705 this.na = this.span.cloneNode(false);
1706
1707 setId(this.link, id_base + '-last-link');
1708 this.link.href = '#';
1709 this.link.className = c;
1710 this.link.innerHTML = label;
1711 this.link.title = title;
1712 YUE.on(this.link,'click',this.onClick,this,true);
1713
1714 setId(this.span, id_base + '-last-span');
1715 this.span.className = c;
1716 this.span.innerHTML = label;
1717
1718 setId(this.na, id_base + '-last-na');
1719
1720 if (this.rightmost_page < p.getTotalPages()){
1721 this.current = this.link;
1722 }
1723 else{
1724 this.current = this.span;
1725 }
1726
1727 this.current.innerHTML = p.getTotalPages();
1728 return this.current;
1729 },
1730
1731 update : function (e) {
1732 var p = this.paginator;
1733
1734 var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5);
1735 this.leftmost_page = _pos[0];
1736 this.rightmost_page = _pos[2];
1737
1738 if (e && e.prevValue === e.newValue) {
1739 return;
1740 }
1741
1742 var par = this.current ? this.current.parentNode : null,
1743 after = this.link;
1744 if (par) {
1745
1746 // only show the last page if the rightmost one is
1747 // lower, so we don't have doubled entries at the end
1748 if (!(this.rightmost_page < p.getTotalPages())){
1749 after = this.span
1750 }
1751
1752 if (this.current !== after) {
1753 par.replaceChild(after,this.current);
1754 this.current = after;
1755 }
1756 }
1757 this.current.innerHTML = this.paginator.getTotalPages();
1758
1759 },
1760 destroy : function () {
1761 YUE.purgeElement(this.link);
1762 this.current.parentNode.removeChild(this.current);
1763 this.link = this.span = null;
1764 },
1765 onClick : function (e) {
1766 YUE.stopEvent(e);
1767 this.paginator.setPage(this.paginator.getTotalPages());
1768 }
1769 };
1770
1771 })();
1772
1773 var pagi = new YAHOO.widget.Paginator({
1774 rowsPerPage: links_per_page,
1775 alwaysVisible: false,
1776 template : "{PreviousPageLink} {MyFirstPageLink} {PageLinks} {MyLastPageLink} {NextPageLink}",
1777 pageLinks: 5,
1778 containerClass: 'pagination-wh',
1779 currentPageClass: 'pager_curpage',
1780 pageLinkClass: 'pager_link',
1781 nextPageLinkLabel: '&gt;',
1782 previousPageLinkLabel: '&lt;',
1783 containers:containers
1784 });
1785
1786 return pagi
1787 }
1788
1459
1789 /**
1460 /**
1790 Branch Sorting callback for select2, modifying the filtered result so prefix
1461 Branch Sorting callback for select2, modifying the filtered result so prefix
@@ -123,6 +123,9 b' for (var i=0;i<data.length;i++){'
123
123
124 </script>
124 </script>
125 <script type="text/javascript">
125 <script type="text/javascript">
126 var YUD = YAHOO.util.Dom;
127 var YUE = YAHOO.util.Event;
128
126 /**
129 /**
127 * Plots summary graph
130 * Plots summary graph
128 *
131 *
General Comments 0
You need to be logged in to leave comments. Login now