diff --git a/rhodecode/public/js/rhodecode.js b/rhodecode/public/js/rhodecode.js --- a/rhodecode/public/js/rhodecode.js +++ b/rhodecode/public/js/rhodecode.js @@ -13,7 +13,7 @@ if (typeof console == "undefined" || typ * Inspired by https://gist.github.com/1049426 */ String.prototype.format = function() { - function format() { + function format() { var str = this; var len = arguments.length+1; var safe = undefined; @@ -22,18 +22,18 @@ String.prototype.format = function() { // For each {0} {1} {n...} replace with the argument in that position. If // the argument is an object or an array it will be stringified to JSON. for (var i=0; i < len; arg = arguments[i++]) { - safe = typeof arg === 'object' ? JSON.stringify(arg) : arg; - str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe); + safe = typeof arg === 'object' ? JSON.stringify(arg) : arg; + str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe); } return str; - } + } - // Save a reference of what may already exist under the property native. - // Allows for doing something like: if("".format.native) { /* use native */ } - format.native = String.prototype.format; + // Save a reference of what may already exist under the property native. + // Allows for doing something like: if("".format.native) { /* use native */ } + format.native = String.prototype.format; - // Replace the prototype property - return format; + // Replace the prototype property + return format; }(); @@ -620,34 +620,34 @@ var q_filter = function(target,nodes,dis } F.updateFilter = function() { - // Reset timeout - F.filterTimeout = null; + // Reset timeout + F.filterTimeout = null; - var obsolete = []; + var obsolete = []; - var req = q_filter_field.value.toLowerCase(); + var req = q_filter_field.value.toLowerCase(); - var l = nodes.length; - var i; - var showing = 0; + var l = nodes.length; + var i; + var showing = 0; - for (i=0;i -1) || ((contact.lname+"").toLowerCase().indexOf(query) > -1) || ((contact.nname) && ((contact.nname).toLowerCase().indexOf(query) > -1))) { - matches[matches.length] = contact; - } + matches[matches.length] = contact; + } } return matches; }; @@ -1586,12 +1586,12 @@ var removeReviewMember = function(review var updateReviewers = function(reviewers_ids, repo_name, pull_request_id){ if (reviewers_ids === undefined){ - var reviewers_ids = []; - var ids = YUQ('#review_members input'); - for(var i=0; i -1) || ((contact.lname+"").toLowerCase().indexOf(query) > -1) || ((contact.nname) && ((contact.nname).toLowerCase().indexOf(query) > -1))) { - matches[matches.length] = contact; - } + matches[matches.length] = contact; + } } return matches; }; @@ -1778,9 +1778,9 @@ var quick_repo_menu = function(){ // returns a node from given html; var fromHTML = function(html){ - var _html = document.createElement('element'); - _html.innerHTML = html; - return _html; + var _html = document.createElement('element'); + _html.innerHTML = html; + return _html; } var get_rev = function(node){ @@ -1801,16 +1801,16 @@ var get_date = function(node){ } var revisionSort = function(a, b, desc, field) { - var a_ = fromHTML(a.getData(field)); - var b_ = fromHTML(b.getData(field)); + var a_ = fromHTML(a.getData(field)); + var b_ = fromHTML(b.getData(field)); - // extract revisions from string nodes - a_ = get_rev(a_) - b_ = get_rev(b_) + // extract revisions from string nodes + a_ = get_rev(a_) + b_ = get_rev(b_) - var comp = YAHOO.util.Sort.compare; - var compState = comp(a_, b_, desc); - return compState; + var comp = YAHOO.util.Sort.compare; + var compState = comp(a_, b_, desc); + return compState; }; var ageSort = function(a, b, desc, field) { @@ -1861,19 +1861,19 @@ var addPermAction = function(_html, user var elmts = YUD.getElementsByClassName('last_new_member'); var last_node = elmts[elmts.length-1]; if (last_node){ - var next_id = (YUD.getElementsByClassName('new_members')).length; - _html = _html.format(next_id); - last_node.innerHTML = _html; - YUD.setStyle(last_node, 'display', ''); - YUD.removeClass(last_node, 'last_new_member'); - MembersAutoComplete("perm_new_member_name_"+next_id, - "perm_container_"+next_id, users_list, groups_list); - //create new last NODE - var el = document.createElement('tr'); - el.id = 'add_perm_input'; - YUD.addClass(el,'last_new_member'); - YUD.addClass(el,'new_members'); - YUD.insertAfter(el, last_node); + var next_id = (YUD.getElementsByClassName('new_members')).length; + _html = _html.format(next_id); + last_node.innerHTML = _html; + YUD.setStyle(last_node, 'display', ''); + YUD.removeClass(last_node, 'last_new_member'); + MembersAutoComplete("perm_new_member_name_"+next_id, + "perm_container_"+next_id, users_list, groups_list); + //create new last NODE + var el = document.createElement('tr'); + el.id = 'add_perm_input'; + YUD.addClass(el,'last_new_member'); + YUD.addClass(el,'new_members'); + YUD.insertAfter(el, last_node); } }