# HG changeset patch # User Mads Kiilerich # Date 1464019353 -7200 # Node ID 81a1eb6cd56ee66e7b9b21c27830d4874507c728 # Parent 278ae0578a76b1bafc88a559570990d18387c026 js: drop some unused parts of YUI YUI is now only used for autocompletion and statistics. diff -r 278ae0578a76 -r 81a1eb6cd56e LICENSE.md --- a/LICENSE.md Mon May 23 18:02:33 2016 +0200 +++ b/LICENSE.md Mon May 23 18:02:33 2016 +0200 @@ -227,9 +227,9 @@ git checkout hudson-yui2-2800 ln -sf JumpToPageDropDown.js src/paginator/js/JumpToPageDropdown.js # work around inconsistent casing rm -f tmp.js - for m in yahoo event dom connection animation dragdrop element datasource autocomplete container event-delegate json datatable paginator; do - rm -f build/\$m/\$m.js - ( 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 + for m in yahoo event dom animation datasource autocomplete event-delegate; do + rm -f build/$m/$m.js + ( 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 done java -jar ../builder/componentbuild/lib/yuicompressor/yuicompressor-2.4.4.jar tmp.js -o yui.2.9.js diff -r 278ae0578a76 -r 81a1eb6cd56e kallithea/public/js/base.js --- a/kallithea/public/js/base.js Mon May 23 18:02:33 2016 +0200 +++ b/kallithea/public/js/base.js Mon May 23 18:02:33 2016 +0200 @@ -311,12 +311,6 @@ })(); -/** - * GLOBAL YUI Shortcuts - */ -var YUD = YAHOO.util.Dom; -var YUE = YAHOO.util.Event; - /* Invoke all functions in callbacks */ var _run_callbacks = function(callbacks){ if (callbacks !== undefined){ @@ -1394,46 +1388,6 @@ }; -/** - * TABLE SORTING - */ - -var revisionSort = function(a, b, desc, field) { - var a_ = parseInt(a.getData('last_rev_raw') || 0); - var b_ = parseInt(b.getData('last_rev_raw') || 0); - - return YAHOO.util.Sort.compare(a_, b_, desc); -}; - -var ageSort = function(a, b, desc, field) { - // data is like: 1 day and 23 hours ago - var a_ = $(a.getData(field)).attr('date'); - var b_ = $(b.getData(field)).attr('date'); - - return YAHOO.util.Sort.compare(a_, b_, desc); -}; - -var lastLoginSort = function(a, b, desc, field) { - var a_ = parseFloat(a.getData('last_login_raw') || 0); - var b_ = parseFloat(b.getData('last_login_raw') || 0); - - return YAHOO.util.Sort.compare(a_, b_, desc); -}; - -var nameSort = function(a, b, desc, field) { - var a_ = a.getData('raw_name') || 0; - var b_ = b.getData('raw_name') || 0; - - return YAHOO.util.Sort.compare(a_, b_, desc); -}; - -var dateSort = function(a, b, desc, field) { - var a_ = parseFloat(a.getData('raw_date') || 0); - var b_ = parseFloat(b.getData('raw_date') || 0); - - return YAHOO.util.Sort.compare(a_, b_, desc); -}; - var addPermAction = function(_html, users_list, groups_list){ var $last_node = $('.last_new_member').last(); // empty tr between last and add var next_id = $('.new_members').length; @@ -1502,289 +1456,6 @@ }); } -// custom paginator -var YUI_paginator = function(links_per_page, containers){ - - (function () { - - var Paginator = YAHOO.widget.Paginator, - l = YAHOO.lang, - setId = YAHOO.util.Dom.generateId; - - Paginator.ui.MyFirstPageLink = function (p) { - this.paginator = p; - - p.subscribe('recordOffsetChange',this.update,this,true); - p.subscribe('rowsPerPageChange',this.update,this,true); - p.subscribe('totalRecordsChange',this.update,this,true); - p.subscribe('destroy',this.destroy,this,true); - - // TODO: make this work - p.subscribe('firstPageLinkLabelChange',this.update,this,true); - p.subscribe('firstPageLinkClassChange',this.update,this,true); - }; - - Paginator.ui.MyFirstPageLink.init = function (p) { - p.setAttributeConfig('firstPageLinkLabel', { - value : 1, - validator : l.isString - }); - p.setAttributeConfig('firstPageLinkClass', { - value : 'yui-pg-first', - validator : l.isString - }); - p.setAttributeConfig('firstPageLinkTitle', { - value : 'First Page', - validator : l.isString - }); - }; - - // Instance members and methods - Paginator.ui.MyFirstPageLink.prototype = { - current : null, - leftmost_page: null, - rightmost_page: null, - link : null, - span : null, - dotdot : null, - getPos : function(cur_page, max_page, items){ - var edge = parseInt(items / 2) + 1; - if (cur_page <= edge){ - var radius = Math.max(parseInt(items / 2), items - cur_page); - } - else if ((max_page - cur_page) < edge) { - var radius = (items - 1) - (max_page - cur_page); - } - else{ - var radius = parseInt(items / 2); - } - - var left = Math.max(1, (cur_page - (radius))); - var right = Math.min(max_page, cur_page + (radius)); - return [left, cur_page, right] - }, - render : function (id_base) { - var p = this.paginator, - c = p.get('firstPageLinkClass'), - label = p.get('firstPageLinkLabel'), - title = p.get('firstPageLinkTitle'); - - this.link = document.createElement('a'); - this.span = document.createElement('span'); - $(this.span).hide(); - - var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5); - this.leftmost_page = _pos[0]; - this.rightmost_page = _pos[2]; - - setId(this.link, id_base + '-first-link'); - this.link.href = '#'; - this.link.className = c; - this.link.innerHTML = label; - this.link.title = title; - YUE.on(this.link,'click',this.onClick,this,true); - - setId(this.span, id_base + '-first-span'); - this.span.className = c; - this.span.innerHTML = label; - - this.current = p.getCurrentPage() > 1 ? this.link : this.span; - return this.current; - }, - update : function (e) { - var p = this.paginator; - var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5); - this.leftmost_page = _pos[0]; - this.rightmost_page = _pos[2]; - - if (e && e.prevValue === e.newValue) { - return; - } - - var par = this.current ? this.current.parentNode : null; - if (this.leftmost_page > 1) { - if (par && this.current === this.span) { - par.replaceChild(this.link,this.current); - this.current = this.link; - } - } else { - if (par && this.current === this.link) { - par.replaceChild(this.span,this.current); - this.current = this.span; - } - } - }, - destroy : function () { - YUE.purgeElement(this.link); - this.current.parentNode.removeChild(this.current); - this.link = this.span = null; - }, - onClick : function (e) { - YUE.stopEvent(e); - this.paginator.setPage(1); - } - }; - - })(); - - (function () { - - var Paginator = YAHOO.widget.Paginator, - l = YAHOO.lang, - setId = YAHOO.util.Dom.generateId; - - Paginator.ui.MyLastPageLink = function (p) { - this.paginator = p; - - p.subscribe('recordOffsetChange',this.update,this,true); - p.subscribe('rowsPerPageChange',this.update,this,true); - p.subscribe('totalRecordsChange',this.update,this,true); - p.subscribe('destroy',this.destroy,this,true); - - // TODO: make this work - p.subscribe('lastPageLinkLabelChange',this.update,this,true); - p.subscribe('lastPageLinkClassChange', this.update,this,true); - }; - - Paginator.ui.MyLastPageLink.init = function (p) { - p.setAttributeConfig('lastPageLinkLabel', { - value : -1, - validator : l.isString - }); - p.setAttributeConfig('lastPageLinkClass', { - value : 'yui-pg-last', - validator : l.isString - }); - p.setAttributeConfig('lastPageLinkTitle', { - value : 'Last Page', - validator : l.isString - }); - - }; - - Paginator.ui.MyLastPageLink.prototype = { - - current : null, - leftmost_page: null, - rightmost_page: null, - link : null, - span : null, - dotdot : null, - na : null, - getPos : function(cur_page, max_page, items){ - var edge = parseInt(items / 2) + 1; - if (cur_page <= edge){ - var radius = Math.max(parseInt(items / 2), items - cur_page); - } - else if ((max_page - cur_page) < edge) { - var radius = (items - 1) - (max_page - cur_page); - } - else{ - var radius = parseInt(items / 2); - } - - var left = Math.max(1, (cur_page - (radius))); - var right = Math.min(max_page, cur_page + (radius)); - return [left, cur_page, right] - }, - render : function (id_base) { - var p = this.paginator, - c = p.get('lastPageLinkClass'), - label = p.get('lastPageLinkLabel'), - last = p.getTotalPages(), - title = p.get('lastPageLinkTitle'); - - var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5); - this.leftmost_page = _pos[0]; - this.rightmost_page = _pos[2]; - - this.link = document.createElement('a'); - this.span = document.createElement('span'); - $(this.span).hide(); - - this.na = this.span.cloneNode(false); - - setId(this.link, id_base + '-last-link'); - this.link.href = '#'; - this.link.className = c; - this.link.innerHTML = label; - this.link.title = title; - YUE.on(this.link,'click',this.onClick,this,true); - - setId(this.span, id_base + '-last-span'); - this.span.className = c; - this.span.innerHTML = label; - - setId(this.na, id_base + '-last-na'); - - if (this.rightmost_page < p.getTotalPages()){ - this.current = this.link; - } - else{ - this.current = this.span; - } - - this.current.innerHTML = p.getTotalPages(); - return this.current; - }, - - update : function (e) { - var p = this.paginator; - - var _pos = this.getPos(p.getCurrentPage(), p.getTotalPages(), 5); - this.leftmost_page = _pos[0]; - this.rightmost_page = _pos[2]; - - if (e && e.prevValue === e.newValue) { - return; - } - - var par = this.current ? this.current.parentNode : null, - after = this.link; - if (par) { - - // only show the last page if the rightmost one is - // lower, so we don't have doubled entries at the end - if (!(this.rightmost_page < p.getTotalPages())){ - after = this.span - } - - if (this.current !== after) { - par.replaceChild(after,this.current); - this.current = after; - } - } - this.current.innerHTML = this.paginator.getTotalPages(); - - }, - destroy : function () { - YUE.purgeElement(this.link); - this.current.parentNode.removeChild(this.current); - this.link = this.span = null; - }, - onClick : function (e) { - YUE.stopEvent(e); - this.paginator.setPage(this.paginator.getTotalPages()); - } - }; - - })(); - - var pagi = new YAHOO.widget.Paginator({ - rowsPerPage: links_per_page, - alwaysVisible: false, - template : "{PreviousPageLink} {MyFirstPageLink} {PageLinks} {MyLastPageLink} {NextPageLink}", - pageLinks: 5, - containerClass: 'pagination-wh', - currentPageClass: 'pager_curpage', - pageLinkClass: 'pager_link', - nextPageLinkLabel: '>', - previousPageLinkLabel: '<', - containers:containers - }); - - return pagi -} /** Branch Sorting callback for select2, modifying the filtered result so prefix diff -r 278ae0578a76 -r 81a1eb6cd56e kallithea/templates/summary/statistics.html --- a/kallithea/templates/summary/statistics.html Mon May 23 18:02:33 2016 +0200 +++ b/kallithea/templates/summary/statistics.html Mon May 23 18:02:33 2016 +0200 @@ -123,6 +123,9 @@