Difference between revisions of "Sitemap"

 
(136 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Main2017}}
 
{{Main2017}}
 
<html>
 
<html>
 +
<link rel="stylesheet" type="text/css" href="https://igem.org/wiki/index.php?title=HQ:Sitemap.css&action=raw&ctype=text/css" />
 +
<script src="https://igem.org/wiki/index.php?title=HQ:Sitemap.js&action=raw&ctype=text/javascript"></script>
 +
 +
 +
<script>
 +
 +
var site_name = "2017.igem.org";
 +
 +
</script>
 +
  
 
<div class="column full_size" >
 
<div class="column full_size" >
Line 8: Line 18:
  
  
<style>
 
.view_format {
 
    width: 12%;
 
    float: left;
 
    background-color: #f2f2f2;
 
    color: #797979;
 
    padding: 5px 10px;
 
    text-align: center;
 
    margin: 0px 29.703px;
 
    border-radius: 7px;
 
cursor:pointer;
 
font-weight:bold;
 
}
 
  
.view_format.selected_view {
 
background-color: #00bdcd;
 
color:white;
 
}
 
  
.view_format_content {display:none; }
 
  
.view_format_content.selected_content {display:block; }
+
 
</style>
+
 
 +
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
 +
 
 +
 
 +
 
 +
 
  
 
<div class="column full_size">
 
<div class="column full_size">
<div class="view_format selected_view" id="list_view"> LIST </div>
+
<div class="view_format selected_view" id="list_view"> PAGE LIST </div>
<div class="view_format" id="team_view"> TEAMS </div>
+
<div class="view_format" id="team_view"> TEAM PAGES </div>
<div class="view_format" id="hq_view"> HQ </div>
+
<div class="view_format HQ_info" id="hq_view"> HQ </div>
 
</div>
 
</div>
  
Line 49: Line 46:
 
<h2> LIST </h2>
 
<h2> LIST </h2>
  
<ul id="organized_pages">
+
<ol id="organized_pages">
  
</ul>
+
</ol>
  
 
</div>
 
</div>
Line 60: Line 57:
  
  
<div class="column full_size view_format_content" id="team_view_content">
+
<div class="view_format_content" id="team_view_content">
<h2> TEAMS </h2>
+
<div class = "column full_size">
 +
<h2> TEAMS </h2>     
 +
</div>
  
<ul id="team_list">
+
<div class="column half_size">
</ul>
+
<ol id="team_list">
 +
</ol>
 +
</div>
 +
 
 +
 
 +
<div class="column half_size">
 +
<p class="loading"> Loading all team pages... </p>
 +
</div>
 
</div>
 
</div>
  
Line 72: Line 78:
  
  
 +
<div class="HQ_info">
 +
<div class="column full_size view_format_content"  id="hq_view_content">
  
<div class="multiple_links view_format_content" id="hq_view_content">
 
 
<div class="column full_size">
 
 
<h2> HQ </h2>
 
<h2> HQ </h2>
 
<p> This is the view for iGEM HQ </p>
 
<p> This is the view for iGEM HQ </p>
  
  
<div class="column full_size">
 
<h2> Wiki in numbers </h2>
 
  
 
<table>
 
<table>
Line 88: Line 91:
 
</tr>
 
</tr>
  
<tr>
+
<tr align="center">
<td id="total_pages_count"></td>
+
<td id="total_pages_count">   <p class="loading"> ... </p>  </td>
<td id="wiki_pages_count"> </td>
+
<td id="wiki_pages_count"> <p class="loading"> ... </p> </td>
<td id="hq_pages_count"></td>
+
<td id="hq_pages_count">  <p class="loading"> ... </p> </td>
<td id="redirect_pages_count"></td>
+
<td id="redirect_pages_count"> <p class="loading"> ... </p> </td>
<td id="not_sorted_pages_count"></td>
+
<td id="not_sorted_pages_count"> <p class="loading"> ... </p></td>
<td id="team_pages_count"></td>
+
<td id="team_pages_count">  <p class="loading"> ... </p> </td>
 
</tr>
 
</tr>
  
  
 
</table>  
 
</table>  
</div>
+
 
  
 
<div class="column half_size">
 
<div class="column half_size">
Line 105: Line 108:
 
<h3> HQ pages </h2>
 
<h3> HQ pages </h2>
  
<ul id="HQ">
+
<ol id="HQ">
</ul>
+
</ol>
 
</div>
 
</div>
 +
 
<div class="column half_size">
 
<div class="column half_size">
 
<h3> Redirects </h3>
 
<h3> Redirects </h3>
<ul id="redirect">
+
<ol id="redirect">
</ul>
+
</ol>
</div>
+
  
</div>
 
  
 +
<h3> Not Sorted </h3>
 +
<ol id="not_sorted">
 +
</ol>
  
 +
</div>
  
 
+
</div>
 
+
</div>
 
+
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
+
 
+
 
+
 
+
 
+
<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 ) {
+
 
+
// these variables will be used in some of the functions bellow - they show variations of page_name for #id purposes
+
var clean_name = page_name.replace( /\//g , "-");
+
var no_underscores_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
+
+
 
+
page_name = page_name.replace(/ /g,"_").replace(/:/g, "_");  // clean string from empty spaces
+
 
+
 
+
switch  ( (page_name.match( /\//g ) || []).length  ) {  // check how many "tiers" (  /  ) the page name has in order to nest it
+
 
+
case 0:  // this might be a hub or an unassigned page
+
append_tier_one ( page_name, no_underscores_name, "#organized_pages") ;
+
break;
+
 
+
case 1: //this page is likely to have a hub to append to
+
append_tier_two ( page_name, no_underscores_name, clean_name  ); 
+
break;
+
 
+
case 2: //this page might be a subpage inside a page in a hub list
+
append_tier_three ( page_name, no_underscores_name, clean_name ); 
+
break;
+
 
+
case 3: //this page might be a subpage inside a page in a hub list
+
append_to_not_sorted  (page_name );
+
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)  {
+
$("#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;
+
}
+
 
+
// is this a page from a team ?
+
else if ( page_name.substring(0, 4 ) == "Team") {
+
 
+
switch  ( (page_name.match( /\//g ) || []).length  ) {
+
case 0:
+
append_tier_one ( page_name, page_name, "#team_list") ;
+
break;
+
default:
+
append_tier_two ( page_name, page_name, page_name) ;
+
break;
+
}
+
return true;
+
}
+
 
+
 
+
// this page is not a special case, let's sort it!
+
else {
+
return false;
+
}
+
 
+
}
+
 
+
 
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
function append_to_not_sorted  (page_name) {
+
 
+
$("#not_sorted").append("<li> <a  href='"+page_name+"'>"+page_name +"</a></li>");
+
 
+
}
+
 
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
function append_tier_one ( page_name, no_underscores_name, append_to ) {
+
+
page_id = "map0"+page_name;
+
$(append_to).append("<li> <a href='"+page_name+"'>"+no_underscores_name+"</a> <ul  id='"+page_id+"' ></ul> </li>");
+
 
+
}
+
 
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
function append_tier_two (page_name, no_underscores_name, clean_name ) {
+
page_id  = "map0"+page_name;
+
$("#"+page_id.substring(0, page_id.indexOf("/") ) ).append("<li><a href='"+page_name+"'> "+no_underscores_name.substring( page_id.indexOf("/") -3, page_id.length) +"</a>  <ol id='"+clean_name+"'>  </ol></li>");
+
 
+
}
+
 
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
+
function append_tier_three (page_name,  no_underscores_name, clean_name ) {
+
 
+
$("#"+clean_name.substring(0,  clean_name.lastIndexOf("-") ) ).append("<li id='"+page_name+"'><a href='"+page_name+"'>"+no_underscores_name.substring( page_name.lastIndexOf("/")+1, page_name.length )+"</a></li>");
+
+
 
+
}
+
 
+
 
+
</script>
+
 
+
 
+
 
+
 
+
 
+
</html>
+

Latest revision as of 15:47, 19 May 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

Loading all team pages...

HQ

This is the view for iGEM HQ

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

...

...

...

...

...

...

HQ pages

Redirects

Not Sorted