Difference between revisions of "Sitemap"

Line 142: Line 142:
 
</div>
 
</div>
  
 +
 +
 +
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
  
  
Line 147: Line 150:
  
 
//these script uses "0" to replace special characters for sorting and ordering pages  
 
//these script uses "0" to replace special characters for sorting and ordering pages  
 +
//"Sitemap" is part of the ids to make sure it is appended on the page and not on the menu or anywhere else
 
 
 +
 +
load_page_list("https://2017.igem.org/Special:AllPages");
 +
 
$(document).ready(function() {
 
$(document).ready(function() {
  
+
//check if the user is part of HQ
 
check_user_priviliges();
 
check_user_priviliges();
 
 
 
// call the function to load the page list  
 
// call the function to load the page list  
load_page_list("https://2017.igem.org/Special:AllPages");
 
  
  
Line 166: Line 172:
 
$("#"+this.id+"_content").addClass("selected_content");
 
$("#"+this.id+"_content").addClass("selected_content");
 
});
 
});
 
 
  
  
Line 176: Line 180:
  
  
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
//FUNCTIONS
 
//FUNCTIONS
  
Line 197: Line 201:
  
  
function send_alert () {
+
/////////////////////////////////////////////////////////////////////////////////
console.log("its done");
+
}
+
 
+
function postpone( fun )
+
{
+
  window.setTimeout(fun,0);
+
}
+
  
  
Line 217: Line 214:
 
});
 
});
  
 +
 
var next_page_url = $link_page.find('.mw-allpages-nav a:contains("Next page")').attr('href');
 
var next_page_url = $link_page.find('.mw-allpages-nav a:contains("Next page")').attr('href');
  
 +
//if there is another page with more links, run this function again
 
if (next_page_url) {
 
if (next_page_url) {
 
load_page_list(next_page_url);
 
load_page_list(next_page_url);
Line 225: Line 224:
 
});
 
});
  
 
 
 
 
postpone( send_alert() );
 
 
}
 
}
  
  
  
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
/////////////////////////////////////////////////////////////////////////////////
  
 +
 +
function sort_pages ( page_name , page_link ) {
  
function sort_pages ( page_name , page_link ) {
+
 
+
//this stores the id to where the page will appended to
//this variable will have the page name with only the necessary information for being displayed
+
var id_to_append_to;  
var page_name_display = page_name.substring(page_name.lastIndexOf("/")+1, page_name.length);
+
var page_sublist_id = "Sitemap0" ;
+
var append_page_to;
+
 
+
// clean string from empty spaces
+
page_name = page_name.replace(/ /g,"_");
+
 
 
if ( is_it_a_special_page ( page_name, page_link ) == false ) {  // check if a page is a redirect or a special case
+
//this variable will have the page name with only the necessary information for being displayed
 +
var page_name_display = page_name.substring(page_name.lastIndexOf("/")+1, page_name.length);
 
 
// check how many "tiers" (  /  ) the page name has in order to nest it
+
// clean page name from empty spaces
switch  ( (page_name.match( /\//g ) || []).length  ) {   
+
page_name = page_name.replace(/ /g,"_"); 
 +
 +
//this stores the id for the sublist that is created in order to nest pages in the append_page function
 +
var page_sublist_id = "Sitemap0" ;
 +
 +
 +
 +
 +
// first, check if a page is a redirect or a special case. If not...
 +
if ( is_it_a_special_page ( page_name, page_link ) == false ) { 
 +
 +
// check how many "tiers" (  /  ) the page name has in order to place it appropiately
 +
switch  ( (page_name.match( /\//g ) || []).length  ) {   
 
 
// this might be a hub, an unassigned page or a team page
 
case 0: 
 
if(page_name.substring(0,4) == "Team"){
 
append_page_to = "#team_list";
 
page_sublist_id = page_sublist_id + page_name.replace( /:/g , "0");
 
append_page(append_page_to, page_name, page_name_display, page_sublist_id);
 
}
 
else {
 
append_page_to = "#organized_pages";
 
page_sublist_id = page_sublist_id + page_name;
 
append_page(append_page_to, page_name, page_name_display, page_sublist_id);
 
 
}
 
break;
 
 
 
 
case 1:
+
// this might be a hub or a team page
 +
case 0: 
 +
if(page_name.substring(0,4) == "Team"){
 +
id_to_append_to = "#team_list";
 +
page_sublist_id = page_sublist_id + page_name.replace( /:/g , "0");
 +
append_page(id_to_append_to, page_name, page_name_display, page_sublist_id);
 +
}
 +
else {
 +
id_to_append_to = "#organized_pages";
 +
page_sublist_id = page_sublist_id + page_name;
 +
append_page(id_to_append_to, page_name, page_name_display, page_sublist_id);
 +
}
 +
break;
 +
 
 +
 +
//this page is under a hub or under a team page
 +
case 1:
 
 
page_sublist_id = page_sublist_id + page_name.replace( /\//g , "0");  
+
page_sublist_id = page_sublist_id + page_name.replace( /\//g , "0");  
append_page_to = "#Sitemap0"+ page_name.substring(0, page_name.indexOf("/"));
+
id_to_append_to = "#Sitemap0"+ page_name.substring(0, page_name.indexOf("/"));
 
 
if(page_name.substring(0,4) == "Team"){
+
if(page_name.substring(0,4) == "Team"){
append_page_to = append_page_to.replace( /:/g , "0");
+
id_to_append_to = id_to_append_to.replace( /:/g , "0");
page_sublist_id = page_sublist_id.replace( /:/g , "0");
+
page_sublist_id = page_sublist_id.replace( /:/g , "0");
}
+
}
  
append_page(append_page_to, page_name, page_name_display, page_sublist_id);  
+
append_page(id_to_append_to, page_name, page_name_display, page_sublist_id);  
 
 
break;
+
break;
 
 
 +
 +
//this page is under a submenu
 +
case 2:
 
 
case 2:
+
id_to_append_to = "#" + page_sublist_id + page_name.substring(0, page_name.lastIndexOf("/"));
+
id_to_append_to = id_to_append_to.replace( /\//g , "0");
append_page_to = "#" + page_sublist_id + page_name.substring(0, page_name.lastIndexOf("/"));
+
page_sublist_id = page_sublist_id + page_name.replace( /\//g , "0");
append_page_to = append_page_to.replace( /\//g , "0");
+
page_sublist_id = page_sublist_id + page_name.replace( /\//g , "0");
+
 
 
if(page_name.substring(0,4) == "Team"){
+
if(page_name.substring(0,4) == "Team"){
append_page_to = append_page_to.replace( /:/g , "0");
+
id_to_append_to = id_to_append_to.replace( /:/g , "0");
page_sublist_id = page_sublist_id.replace( /:/g , "0");
+
page_sublist_id = page_sublist_id.replace( /:/g , "0");
}
+
}
 
 
append_page(append_page_to, page_name, page_name_display, page_sublist_id);  
+
append_page(id_to_append_to, page_name, page_name_display, page_sublist_id);  
 
 
break;
+
break;
 
 
  
 
+
// this page has more than 3 "/"
case 3: default://this page might be a subpage inside a page in a hub list
+
case 3: default:
 
 
//check if this is a team's page
+
//check if this is a team's page, if so, append to a team namespace
if(page_name.substring(0,4) == "Team"){
+
if(page_name.substring(0,4) == "Team"){
append_page_to = page_name.substring(0, page_name.indexOf("/"));
+
id_to_append_to = page_name.substring(0, page_name.indexOf("/"));
append_page_to = "#Sitemap0" + append_page_to.replace( /:/g , "0");
+
id_to_append_to = "#Sitemap0" + id_to_append_to.replace( /:/g , "0");
page_name_display = page_name.substring(4, page_name.length);
+
page_name_display = page_name.substring(4, page_name.length);
append_page(append_page_to, page_name, page_name_display, "");
+
append_page(id_to_append_to, page_name, page_name_display, "");
}
+
}
else {
+
// hq pages shouldn't go beyond 3 "/" - append to not sorted
$("#not_sorted").append("<li> <a  href='"+page_name+"'>"+page_name +"</a></li>");
+
else {
}
+
$("#not_sorted").append("<li> <a  href='"+page_name+"'>"+page_name +"</a></li>");
+
}
break;
+
break;
}
+
 +
 +
}  
  
}
+
}
  
 
 
}
+
}
  
  
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
/////////////////////////////////////////////////////////////////////////////////
 +
 
  
 
//Function to check if the page is a redirect ( a non existing page)
 
//Function to check if the page is a redirect ( a non existing page)
Line 362: Line 370:
  
  
 +
/////////////////////////////////////////////////////////////////////////////////
  
  
 +
function append_page (id_to_append_to, page_name, page_name_display, page_sublist_id ) {
  
 
+
//check if id_to_append_to exists - if not, let's try to append it to another parent so the page is not orphaned
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
function append_page (append_page_to, page_name, page_name_display, page_sublist_id ) {
+
 
+
//check if append_page_to exists - if not, let's try to append it to another parent so the page is not orphaned
+
 
var found_where_to_append = false;
 
var found_where_to_append = false;
 
 
Line 376: Line 381:
 
 
 
//if it has somewhere to be appended  
 
//if it has somewhere to be appended  
if($(append_page_to).length > 0) {
+
if($(id_to_append_to).length > 0) {
 
found_where_to_append = true;
 
found_where_to_append = true;
 
}
 
}
Line 383: Line 388:
 
 
 
 
for( i=0; i < (append_page_to.match(/0/g) || []).length ; i++){
+
for( i=0; i < (id_to_append_to.match(/0/g) || []).length ; i++){
 
 
 
//trim to try to find a parent to append to
 
//trim to try to find a parent to append to
append_page_to append_page_to.substring(0, append_page_to.lastIndexOf("0"));
+
id_to_append_to id_to_append_to.substring(0, id_to_append_to.lastIndexOf("0"));
 
 
 
//check if it has somewhere to append, if so break the loop
 
//check if it has somewhere to append, if so break the loop
if($(append_page_to).length > 0) {
+
if($(id_to_append_to).length > 0) {
 
found_where_to_append = true;
 
found_where_to_append = true;
 
i = 999;
 
i = 999;
Line 401: Line 406:
 
// if it didnt have anywhere to append, send it to not sorted  
 
// if it didnt have anywhere to append, send it to not sorted  
 
if ( found_where_to_append ==  false){
 
if ( found_where_to_append ==  false){
append_page_to ="#not_sorted";
+
id_to_append_to ="#not_sorted";
 
}
 
}
 
 
$(append_page_to).append("<li><a href='https://2017.igem.org/"+page_name+"'>"+page_name_display+"</a>  <ol id='"+page_sublist_id+"' ></ol></li>");
+
$(id_to_append_to).append("<li><a href='https://2017.igem.org/"+page_name+"'>"+page_name_display+"</a>  <ol id='"+page_sublist_id+"' ></ol></li>");
 
 
 
 
Line 412: Line 417:
  
  
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
/////////////////////////////////////////////////////////////////////////////////
  
  
function append_main_team_page (append_page_to, page_name, page_name_display, page_sublist_id ) {
+
function append_main_team_page (id_to_append_to, page_name, page_name_display, page_sublist_id ) {
  
$(append_page_to).append("<li><a href='https://2017.igem.org/"+page_name+"'>"+page_name_display+"</a><div class='expand_collapse control_button'> </div> <div class='expand_collapse content'><ol id='"+page_sublist_id+"' ></ol> </div>  </li> <div class='clear extra_space'></div> ");
+
$(id_to_append_to).append("<li><a href='https://2017.igem.org/"+page_name+"'>"+page_name_display+"</a><div class='expand_collapse control_button'> </div> <div class='expand_collapse content'><ol id='"+page_sublist_id+"' ></ol> </div>  </li> <div class='clear extra_space'></div> ");
  
 
}
 
}
  
 
</script>
 
</script>

Revision as of 15:41, 24 April 2017

MENU

SITEMAP

iGEM is a multifaceted competition with many different components. Our websites have a lot of information, from requirements of the competition to tips on how make fundraising easier. This page is here to help you navigate our site and make sure you have access to all of its content.

PAGE LIST
TEAM PAGES
HQ

TEAMS

HQ

This is the view for iGEM HQ

Wiki in numbers

Total pages Wiki pages HQ pages Redirect pages Not sorted Team pages

HQ pages

Redirects

Not Sorted