Group overview page functions + remove window functions

This commit is contained in:
Christian Günter 2019-01-01 13:22:10 +01:00 committed by Lars Hvam
parent 1de9456567
commit e0c0610bad

View File

@ -19,6 +19,9 @@
/* exported preparePatch */ /* exported preparePatch */
/* exported registerStagePatch */ /* exported registerStagePatch */
/* exported toggleRepoListDetail */ /* exported toggleRepoListDetail */
/* exported onDirectionChange */
/* exported onOrderByChange */
/* exported onTagTypeChange */
/********************************************************** /**********************************************************
* Polyfills * Polyfills
@ -171,25 +174,37 @@ function perfClear() {
/********************************************************** /**********************************************************
* TAG PAGE Logic * TAG PAGE Logic
**********************************************************/ **********************************************************/
// somehow only functions on window are visible for the select tag function onTagTypeChange(oSelectObject){
window.onTagTypeChange = function(oSelectObject){
var sValue = oSelectObject.value; var sValue = oSelectObject.value;
submitSapeventForm({ type: sValue }, "change_tag_type", "post"); submitSapeventForm({ type: sValue }, "change_tag_type", "post");
}; }
/********************************************************** /**********************************************************
* Repo Overview Logic * Repo Overview Logic
**********************************************************/ **********************************************************/
// somehow only functions on window are visible for the select tag function onOrderByChange(oSelectObject){
window.onOrderByChange = function(oSelectObject){
var sValue = oSelectObject.value; var sValue = oSelectObject.value;
submitSapeventForm({ orderBy: sValue }, "change_order_by", "post"); submitSapeventForm({ orderBy: sValue }, "change_order_by", "post");
}; }
window.onDirectionChange = function(oSelectObject){ function onDirectionChange(oSelectObject){
var sValue = oSelectObject.value; var sValue = oSelectObject.value;
submitSapeventForm({ direction: sValue }, "direction", "post"); submitSapeventForm({ direction: sValue }, "direction", "post");
}; }
function findStyleSheetByName(name) {
var classes = document.styleSheets[0].cssRules || document.styleSheets[0].rules;
for (var i = 0; i < classes.length; i++) {
if (classes[i].selectorText === name) return classes[i];
}
}
function toggleRepoListDetail() {
var detailClass = findStyleSheetByName(".ro-detail");
if (detailClass) {
detailClass.style.display = detailClass.style.display === "none" ? "" : "none";
}
}
/********************************************************** /**********************************************************
* STAGE PAGE Logic * STAGE PAGE Logic
@ -614,7 +629,7 @@ KeyNavigation.prototype.onkeydown = function(oEvent) {
// navigate with arrows through list items and support pressing links with enter and space // navigate with arrows through list items and support pressing links with enter and space
if (oEvent.key === "ENTER" || oEvent.key === "") { if (oEvent.key === "ENTER" || oEvent.key === "") {
this.onEnterOrSpace(oEvent); this.onEnterOrSpace();
} else if (/Down$/.test(oEvent.key)) { } else if (/Down$/.test(oEvent.key)) {
this.onArrowDown(oEvent); this.onArrowDown(oEvent);
} else if (/Up$/.test(oEvent.key)) { } else if (/Up$/.test(oEvent.key)) {
@ -635,7 +650,7 @@ KeyNavigation.prototype.getActiveElementParent = function () {
return this.getActiveElement().parentElement; return this.getActiveElement().parentElement;
}; };
KeyNavigation.prototype.onEnterOrSpace = function (oEvent) { // eslint-disable-line no-unused-vars KeyNavigation.prototype.onEnterOrSpace = function () {
// Enter or space clicks the selected link // Enter or space clicks the selected link
@ -1213,18 +1228,3 @@ BranchOverview.prototype.showCommit = function(event){
BranchOverview.prototype.hideCommit = function (event){ // eslint-disable-line no-unused-vars BranchOverview.prototype.hideCommit = function (event){ // eslint-disable-line no-unused-vars
this.toggleCommit(); this.toggleCommit();
}; };
// Repo overview
function findStyleSheetByName(name) {
var classes = document.styleSheets[0].cssRules || document.styleSheets[0].rules;
for (var i = 0; i < classes.length; i++) {
if (classes[i].selectorText === name) return classes[i];
}
}
function toggleRepoListDetail() {
var detailClass = findStyleSheetByName(".ro-detail");
if (detailClass) {
detailClass.style.display = detailClass.style.display === "none" ? "" : "none";
}
}