Difference between revisions of "Team:Purdue/Navpage"

 
(87 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
<head>
 
<head>
 
<script>
 
<script>
 +
//Hi Welcome to the NavPage
 +
// In order to add your link, please See the comments in the function Called Main.
  
function letterEntry(letter){
 
this.letter=letter;
 
var a = [];
 
var Header = document.createElement("h1");
 
Header.innerHTML=letter;
 
var Url_name = [];
 
var ulList;
 
  
}
+
$(document).ready(() => {
 
+
function Main(){
letterEntry.prototype.addLink = function(urlName){
+
Url_name.push(urlName);
+
 
+
}
+
 
+
var entryBlocks = [];
+
Main();
+
function Main(){
+
  
 
//Generate an array for each letter;
 
//Generate an array for each letter;
 
var charCode = 65;
 
var charCode = 65;
 
for(i = 0; i<26; i++){
 
for(i = 0; i<26; i++){
     entryBlocks[i]= letterEntry(String.fromCharCode(charCode));
+
     entryBlocks[i]= new letterEntry(String.fromCharCode(charCode+i),"","");
 
}
 
}
 +
//--------------------------------------------------------------------------
 +
//ADD LINKS TO YOUR PAGES HERE USING THIS FORMAT
  
 +
// addLink("Name of text that will act as link/name of page,URL to your page");
  
 +
// It's important to not include a space between the comma,
 +
// It doesn't matter which order you place the link, just as long as it is before the arrayToList(); call
 +
// If after you add the link, but an ERROR appears on the top of the loaded page, then you added it incorrectly
 +
//---------------------------------------------------------------------
 +
addLink("Home Page,https://2018.igem.org/Team:Purdue");
 +
addLink("Problem,https://2018.igem.org/Team:Purdue/Design");
 +
addLink("Solution,https://2018.igem.org/Team:Purdue/Description");
 +
addLink("Integrated Human Practices,https://2018.igem.org/Team:Purdue/Human_Practices");
 +
addLink("Collaborations ,https://2018.igem.org/Team:Purdue/Collaborations");
 +
addLink("Survey, https://2018.igem.org/Team:Purdue/Survey");
 +
addLink("Genetic Construct,https://2018.igem.org/Team:Purdue/Genetic_Pathway");
 +
addLink("Experiments,https://2018.igem.org/Team:Purdue/Experiments");
 +
addLink("Model,https://2018.igem.org/Team:Purdue/Model");
 +
addLink("Hardware,https://2018.igem.org/Team:Purdue/Hardware");
 +
addLink("Safety,https://2018.igem.org/Team:Purdue/Safety");
 +
addLink("Laboratory Protocols,https://2018.igem.org/Team:Purdue/Protocols");
 +
addLink("Lab Notebook,https://2018.igem.org/Team:Purdue/Notebook");
 +
addLink("Interlab Study,https://2018.igem.org/Team:Purdue/Interlab");
 +
//addLink("Demonstration of Effectiveness,https://2018.igem.org/Team:Purdue/Demonstrate");
 +
addLink("Parts,https://2018.igem.org/Team:Purdue/Parts");
 +
//addLink("Results of our Model,https://2018.igem.org/Team:Purdue/Model");
 +
addLink("Team's Judging Form,https://igem.org/2018_Judging_Form?team=Purdue");
 +
//addLink("Team History,https://2018.igem.org/Team:Purdue/History");
 +
addLink("Team Bios,https://2018.igem.org/Team:Purdue/Team");
 +
//addLink("Please Remove if not needed Measurements Page,https://2018.igem.org/Team:Purdue/Measurement");
 +
addLink("Attributions,https://2018.igem.org/Team:Purdue/Attributions");
 +
addLink("Quiz,https://2018.igem.org/Team:Purdue/Quiz");
 +
//addLink("Try our Game,https://2018.igem.org/Team:Purdue/Game");
 +
//addLink("Applied Model,https://2018.igem.org/Team:Purdue/Applied_Model");
 +
//addLink("Applied Design,https://2018.igem.org/Team:Purdue/Applied_Design");
  
 
+
//PLACE YOUR LINKS BEFORE THIS LINE
 
+
 
arrayToList();
 
arrayToList();
 
//now a tags are made, time to place them in an unordered list
 
//now a tags are made, time to place them in an unordered list
entryBlocks.forEach(atagsInList());
+
atagsInList();
 
+
}
  
  
 +
function letterEntry(letter, Header,Url_name, a){
 +
this.letter=letter;
 +
this.a = a;
 +
this. a = [];
 +
this.Header = Header;
 +
this.Header = document.createElement("h2");
 +
this.Header.innerHTML=letter;
 +
this.Url_name=Url_name;
 +
this.Url_name = [];
 +
var ulList;
 
}
 
}
function addLink(Name_Url){
+
function addLinkToList (urlName,index){
for(i = 0; i<=len(entryBlocks); i++){
+
entryBlocks[index].Url_name.push(urlName);
    if(entryBlocks[i].letter==(Name.toUpperCase())[0]){
+
        entryBlocks[i].addLink(Name_Url);
+
}
+
    else{
+
    document.getElementById("error").innerHTML="ERROR IN LINK NAME";
+
 
}
 
}
 +
var entryBlocks = [];
 +
Main();
  
}
 
  
  
  
 +
  
 +
function addLink(Name_Url){
 +
var flag=0
 +
for(i = 0; i<entryBlocks.length; i++){
 +
    if(entryBlocks[i].letter==(Name_Url.toUpperCase())[0]){
 +
        addLinkToList(Name_Url,i);
 +
        flag=1;
 +
 +
}
 +
}
 +
    if(!flag){
 +
    document.getElementById("error").innerHTML="ERROR IN LINK NAME";
 
}
 
}
  
 +
}
  
 +
function arrayToList(){
 +
var obj;
 +
var temp;
 +
var subObj;
 +
var as;
 +
for (i = 0; i < entryBlocks.length; i++){
 +
if(entryBlocks[i].Url_name){
 +
entryBlocks[i].Url_name.sort();
  
 
+
for (k = 0; k < entryBlocks[i].Url_name.length; k++){
function arrayToList(){
+
temp = entryBlocks[i].Url_name[k].split(",",2);
entryBlocks.forEach(function(obj,index){
+
as =  document.createElement("a");
+
obj.Url_name.sort();
+
obj.Url_name.forEach(function(objec,index){
+
var temp = objec.split(",",1)
+
var as =  document.createElement("a");
+
 
as.href=temp[1];
 
as.href=temp[1];
 
as.innerHTML=temp[0];
 
as.innerHTML=temp[0];
obj.a.push(as)
+
entryBlocks[i].a.push(as);
 
+
}
 
+
}
 
+
}
});
+
 
+
 
+
});
+
 
+
 
+
 
+
 
+
 
+
 
+
 
}
 
}
  
 
function atagsInList(obj,Index){
 
function atagsInList(obj,Index){
 
//takes the link tags and adds them to a list
 
//takes the link tags and adds them to a list
obj.ulList = document.createElement("ul");
+
var list_item;
 
+
for (i=0; i < entryBlocks.length; i++){
obj.a.forEach(function(obje,index){
+
entryBlocks[i].ulList = document.createElement("ul");
var list_item = document.createElement("li");
+
if(entryBlocks[i].a.length){
list_item.appendChild(obje);
+
for (k=0; k < entryBlocks[i].a.length;k++){
obj.ulList.appendChild(list_item);
+
list_item = document.createElement("li");
});
+
list_item.appendChild(entryBlocks[i].a[k]);
 
+
entryBlocks[i].ulList.appendChild(list_item);
obj.Header.appendChild(obj.ulList);
+
document.getElementById("div").appendChild(obj.Header);
+
  
 +
//Special addition to the judging form link
 +
if(entryBlocks[i].a[k].href=="https://igem.org/2018_Judging_Form?team=Purdue"){
 +
entryBlocks[i].a[k].target= "_blank";
 +
}
 
}
 
}
 +
if(entryBlocks[i].a.length){
 +
document.getElementById("di").appendChild(entryBlocks[i].Header);
 +
document.getElementById("di").appendChild(entryBlocks[i].ulList);
  
  
  
  
 +
}
 +
}
 +
}
 +
}
 +
});
 
</script>
 
</script>
 +
.
 +
</head>
  
</head>
+
<div class="body alternate">
<div class="basic-page-body" id="div">
+
<div class="section">
 +
<div class="spacer-small"></div>
 +
<div class="spacer-small"></div>
 +
<div class="wrapper">
 +
<h1> Navigation Page </h1>
 +
</div>
 +
<div class="wrapper" id="di">
 
<!-- This page is for the creation of an alphabetical pages link -->
 
<!-- This page is for the creation of an alphabetical pages link -->
 
<p id="error"></p>
 
<p id="error"></p>
 
 
 
 
 
 
</div>
 
</div>
 
 
 
 
</html>
 
</html>
 +
{{:Team:Purdue/Footer}}

Latest revision as of 03:04, 18 October 2018

Bootstrap Example

.

Navigation Page