Expand Up @@ -23,6 +23,43 @@
* <p class="url-description"><strong>Read+Write</strong> access</p>
* </div>
*/

var keys = [37, 38, 39, 40];

function preventDefault(e) {
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
}

function keydown(e) {
for (var i = keys.length; i--;) {
if (e.keyCode === keys[i]) {
preventDefault(e);
return;
}
}
}

function wheel(e) {
preventDefault(e);
}

function disable_scroll() {
if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = wheel;
document.onkeydown = keydown;
}

function enable_scroll() {
if (window.removeEventListener) {
window.removeEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = document.onkeydown = null;
}

function toggleDisplay(node, option) {
if(node.nodeType == 1){
Expand All @@ -33,23 +70,90 @@
toggleDisplay(node, option);
node = node.nextSibling;
}
if (option == "block"){
disable_scroll();
}
else{
enable_scroll();
}

};



function handleArrows(e){


var orionhubDiv = document.getElementById("orionhub");
var orioneclipseorgDiv = document.getElementById("oeo");
var otherDiv = document.getElementById("other");

var orionhubA = document.getElementById("orionhubA");
var orioneclipseorgA = document.getElementById("orioneclipseorgA");
var otherA = document.getElementById("otherA");

var selectionDialog = document.getElementById("sd");


if(e.keyCode==40){
if(orionhubDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
}
else if(orioneclipseorgDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
}
}

if(e.keyCode==38){
if(orioneclipseorgDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
}
else if(otherDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
}
}
if(e.keyCode==13){
if(orionhubDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
window.open(orionhubA.href, "Orion");
toggleDisplay(selectionDialog, "none");
}
else if(otherDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
window.open(otherA.href, "Orion");
toggleDisplay(selectionDialog, "none");
}
else if(orioneclipseorgDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
window.open(orioneclipseorgA.href, "Orion");
toggleDisplay(selectionDialog, "none");

}

}


};



(function () {
try {


document.addEventListener("keydown", handleArrows, false);
var nativeClonesUl = document.getElementsByClassName("native-clones")[0];
var gitRepoUrl = document.getElementsByClassName("url-field")[0].value;
var gitRepoUrl = document.getElementsByClassName("private_clone_url")[0].children[0].getAttribute("href");

var orionSmallGif = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAAOCAYAAAC2POVFAAAAAXNSR0IArs4c6QAABUpJREFUSMfFll1sHFcZhp9zdnZn1xs7tjebqBvbUrxJ6/inMu1N4wuaKkikgggat1X5KdA6iUoQSL2jlwhZCJCQkBKVpq1UpNKEn0YRCTQqitM0EsgWiUtLDU0g3vgva7Nr7493d2Zn5nxcbG2apimX+aS5+XTOnPe853lnjuIjValUZGZ2lqmpKTLT0yQ3b2agr5/tO7YTj8fRWivuYCkAEZHFpSVeevFl3vnbu7S1tbJly2bK5RI3FrJ0dHTx1FPfZGdvD1YodOcEi4jMzy/IwUPPyPCjj8mpU6dlc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qtVq1ByHrR0d7B/+MtWqw9Ejv6BSrUgoFEIpReDXMRKCWB+67XOfzKxSsHEP9sYBjBFMIATGYIyhqSmmnn56hPb2BLVqrRE2gEQiofL5ZTn+2nHO/OEMY+fH2LQpSaG4QrFYJJ1Oc2BkhK6uznUmPdfFdWr09PTw+OOPcuzYi4ydO8/evZ9HKXCcCjWnjlJxZWrTwvzPCZbfAON+KDSMlfgCbP0OOtysCsWq+L6LCfz1sKVSd3HgwAijPxylWnVupr5er0sul+P99/9BsbiCbdvs2LGDbdu2Ydv2+ljXdWV2bp6obZNK3UW9XufadIZYLEpHKsXs3Bw1x6Grs5Pm5ubG/cMvi6m8h9SuNrTG0uj4IMraoADqXiBzszMoDV2dXaz9FHzfl8uXL5NMbua/c8bERMhYc/8AAAAASUVORK5CYII=)";



var closehref = document.createElement("a");
closehref.href = "javascript:;";
closehref.className = "close js-menu-close";
closehref.style.fontFamily = 'Octicons Regular'
closehref.style.fontSize = '16px'
closehref.style.display = "none";
closehref.style.verticalAlign = "top";
closehref.style.textDecoration = "none";
Expand All @@ -62,13 +166,13 @@
}

var close = document.createElement("span");
close.className = "mini-icon remove-close";
close.className = "mini-icon-remove-close";
close.style.display = "none";
close.style.verticalAlign = "top";


var header = document.createElement("div");
header.innerHTML = "Clone repository into";
header.innerHTML = "Clone Repository Into";
header.className = "context-title";
header.style.display="none";
header.id = "header";
Expand All @@ -84,15 +188,23 @@
selectSection.style.display = "none";

var orionhubDiv = document.createElement("div");
orionhubDiv.id = "orionhub";
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";

orionhubDiv.onmouseover = function(){
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
return true;
}

orionhubDiv.onmouseout = function(){
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
if (orionhubDiv.className == "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus"){
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
}
else{
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
}
return true;
}
orionhubDiv.style.display = "none";
Expand All @@ -101,6 +213,7 @@
h41.style.display = "none";

var orionhubA = document.createElement("a");
orionhubA.id = "orionhubA";
orionhubA.href = "http://orionhub.org/git/git-repository.html#,cloneGitRepository=" + gitRepoUrl;
orionhubA.className = "js-navigation-open";
orionhubA.target = "_blank";
Expand All @@ -112,8 +225,11 @@
}

var orioneclipseorgDiv = document.createElement("div");
orioneclipseorgDiv.id = "oeo";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.onmouseover = function(){
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
return true;
}
Expand All @@ -129,6 +245,7 @@
h42.style.display = "none";

var orioneclipseorgA = document.createElement("a");
orioneclipseorgA.id = "orioneclipseorgA";
orioneclipseorgA.className = "js-navigation-open";
orioneclipseorgA.href = "http://orion.eclipse.org/git/git-repository.html#,cloneGitRepository=" + gitRepoUrl;
orioneclipseorgA.rel = "nofollow";
Expand All @@ -142,9 +259,12 @@


var otherDiv = document.createElement("div");
otherDiv.id = "other";
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";

otherDiv.onmouseover = function(){
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
return true;
}
Expand Down Expand Up @@ -175,7 +295,7 @@
host.style.styleFloat = "top";
host.style.cssFloat = "top";
host.style.paddingLeft = "2px";
host.style.width = "200px";
host.style.width = "180px";
host.name = "hostName";
host.type = "text";
host.id = "hostid";
Expand All @@ -188,13 +308,15 @@
var val = host.getAttribute('value');

var otherA = document.createElement("a");
otherA.id = "otherA";
otherA.href = "";

otherA.style.paddingRight = "0px"
otherA.className = "js-navigation-open";
otherA.target = "_blank";
otherA.innerHTML = "Clone into ";
otherA.innerHTML = "other Orion at ";
otherA.style.display = "none";
otherA.style.width = "100px";
otherA.onclick = function(){
toggleDisplay(selectionDialog, "none");
return true;
Expand All @@ -218,8 +340,12 @@
a.onclick = function(e){
e.stopPropagation();
toggleDisplay(selectionDialog, "block");
//gitRepoUrl = document.getElementsByClassName("url-field")[0].value;
close.style.display = "none";
close.style.display = "block";
orionhubDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target navigation-focus";
otherDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
orioneclipseorgDiv.className = "commitish-item branch-commitish selector-item js-navigation-item js-navigation-target";
return true;
}

Expand Down Expand Up @@ -287,4 +413,3 @@
// silently ignore, not on the right page
}
})();