Difference between revisions of "Sitemap"

Line 127: Line 127:
  
  
<script src="https://igem.org/wiki/index.php?title=HQ:Sitemap.js&action=raw&ctype=text/javascript"></script>
+
 
 +
 
 +
<script>
 +
 
 +
$(document).ready(function() {
 +
 
 +
// call the function to load the page list
 +
load_page_list("https://2017.igem.org/Special:AllPages");
 +
 
 +
 
 +
//switching between views
 +
 
 +
$(".view_format").click(function() {
 +
$(".view_format").removeClass("selected_view");
 +
$(".view_format_content").removeClass("selected_content");
 +
 +
$(this).addClass("selected_view");
 +
$("#"+this.id+"_content").addClass("selected_content");
 +
});
 +
 
 +
$("#hq_pages_count").append( ("#HQ li").length);
 +
$("#redirect_pages_count").append( ("#redirect li").length);
 +
 
 +
});
 +
 
 +
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 +
//FUNCTIONS
 +
 
 +
 
 +
 
 +
function load_page_list ( page_url ) {
 +
$.get(page_url).then(function(page_html) {
 +
var $link_page = $(page_html);
 +
 
 +
$link_page.find('.mw-allpages-chunk li').each(function () {
 +
sort_pages( $(this).text(),  $(this).html() );
 +
});
 +
 
 +
var next_page_url = $link_page.find('.mw-allpages-nav a:contains("Next page")').attr('href');
 +
 
 +
if (next_page_url) {
 +
load_page_list(next_page_url);
 +
}
 +
 
 +
});
 +
}
 +
 
 +
 
 +
 
 +
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 +
 
 +
 
 +
function sort_pages ( page_name , page_link ) {
 +
 
 +
//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);
 +
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
 +
 +
// check how many "tiers" (  /  ) the page name has in order to nest it
 +
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_main_team_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:
 +
 +
page_sublist_id = page_sublist_id + page_name.replace( /\//g , "0");
 +
append_page_to = "#Sitemap0"+ page_name.substring(0, page_name.indexOf("/"));
 +
 +
if(page_name.substring(0,4) == "Team"){
 +
append_page_to = append_page_to.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);
 +
 +
break;
 +
 +
 +
case 2:
 +
 +
append_page_to = "#" + page_sublist_id + page_name.substring(0, page_name.lastIndexOf("/"));
 +
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"){
 +
append_page_to = append_page_to.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);
 +
 +
break;
 +
 +
 
 +
 
 +
case 3: default://this page might be a subpage inside a page in a hub list
 +
$("#not_sorted").append("<li> <a  href='"+page_name+"'>"+page_name +"</a></li>");
 +
break;
 +
}
 +
 
 +
}
 +
 
 +
 +
}
 +
 
 +
 
 +
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 +
 
 +
//Function to check if the page is a redirect ( a non existing page)
 +
function is_it_a_special_page ( page_name, page_link ) {
 +
 
 +
 
 +
// is it a HQ page or a Dev page ?
 +
if( page_name.substring(0, 2 ) == "HQ"  ||  page_name.substring(0, page_name.indexOf("/") ) == "Dev" ) {
 +
$("#HQ").append("<li ><a  href='/"+page_name+"'>"+page_name +"</a> </li>");
 +
return true;
 +
}
 +
 
 +
// is it a redirect?
 +
else if( page_link.indexOf("mw-redirect") >= 0)  {
 +
 +
//if it is a team page redirect, process it as normal team page
 +
if(page_name.substring(0,4) == "Team"){
 +
return false;
 +
}
 +
else {
 +
$("#redirect").append("<li >"+ page_link+"</li>" );
 +
return true;
 +
}
 +
}
 +
 
 +
//if a page doesn't fall under the menu structure for a specific reason
 +
else if (page_name == "Common_Ground" || page_name == "Letter") {
 +
$("#HQ").append("<li ><a  href='/"+page_name+"'>"+page_name +"</a> </li>");
 +
return true;
 +
}
 +
 
 +
 
 +
// this page is not a special case, let's sort it!
 +
else {
 +
return false;
 +
}
 +
 
 +
}
 +
 
 +
 
 +
 
 +
 
 +
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 +
 
 +
function append_page (append_page_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>  <ol id='"+page_sublist_id+"' ></ol></li>");
 +
 
 +
}
 +
 
 +
 
 +
function append_main_team_page (append_page_to, page_name, page_name_display, page_sublist_id ) {
 +
 
 +
$(append_page_to).append("<li> <div class='expand_content first'>  <a href='https://2017.igem.org/"+page_name+"'>"+page_name_display+"</a></div> <div class='expand_content control_button'> </div> <div class='expand_content more'>  <ol id='"+page_sublist_id+"' ></ol></div> </li> <div class='clear extra_space'></div> ");
 +
 
 +
}
 +
 
 +
 
 +
</script>
  
  
 
</html>
 
</html>

Revision as of 16:48, 21 April 2017

MENU


You have JavaScript disabled.

This page requires JavaScript in order to function correctly. Please enable JavaScript in your browser, then try again.

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.

LIST
TEAMS
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