Difference between revisions of "Sitemap"

 
(45 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" >
 
<h1>SITEMAP </h1>
 
<h1>SITEMAP </h1>
Line 7: 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; }
 
  
  
.expand_collapse.control_button {   
+
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
float: left;
+
    width: 20px;
+
    background: white;
+
    font-weight: bold;
+
    text-align: center;
+
    background-color: #f2f2f2;
+
    margin-right: 10px;
+
    border-radius: 5px;}
+
 
+
.expand_collapse.control_button::before {
+
content: "+";
+
}
+
 
+
  
  
  
.expand_collapse.content {display:none;}
 
  
</style>
 
  
 
<div class="column full_size">
 
<div class="column full_size">
 
<div class="view_format selected_view" id="list_view"> PAGE LIST </div>
 
<div class="view_format selected_view" id="list_view"> PAGE LIST </div>
 
<div class="view_format" id="team_view"> TEAM PAGES </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 80: 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>
  
 +
<div class="column half_size">
 
<ol id="team_list">
 
<ol id="team_list">
 
</ol>
 
</ol>
 +
</div>
 +
 +
 +
<div class="column half_size">
 +
<p class="loading"> Loading all team pages... </p>
 +
</div>
 
</div>
 
</div>
  
Line 92: Line 78:
  
  
 +
<div class="HQ_info">
 +
<div class="column full_size view_format_content"  id="hq_view_content">
  
<div class="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 108: 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 128: Line 111:
 
</ol>
 
</ol>
 
</div>
 
</div>
 +
 
<div class="column half_size">
 
<div class="column half_size">
 
<h3> Redirects </h3>
 
<h3> Redirects </h3>
Line 141: Line 125:
  
 
</div>
 
</div>
<script>
+
</div>
 
+
//these script uses "0" to replace special characters for sorting and ordering pages
+
+
$(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");
+
});
+
 
+
+
 
+
 
+
 
+
});
+
 
+
 
+
 
+
 
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
//FUNCTIONS
+
 
+
 
+
function send_alert () {
+
console.log("its done");
+
}
+
 
+
function postpone( fun )
+
{
+
  window.setTimeout(fun,0);
+
}
+
 
+
 
+
 
+
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);
+
}
+
 
+
});
+
 
+
+
 
+
 
+
 
+
postpone( send_alert() );
+
}
+
 
+
 
+
 
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
 
+
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_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,5) == "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 ) {
+
 
+
//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;
+
+
 
+
+
//if it has somewhere to be appended
+
if($(append_page_to).length > 0) {
+
found_where_to_append = true;
+
}
+
+
else {
+
+
+
for( i=0; i < (append_page_to.match(/0/g) || []).length ; i++){
+
+
//trim to try to find a parent to append to
+
append_page_to =  append_page_to.substring(0, append_page_to.lastIndexOf("0"));
+
+
//check if it has somewhere to append, if so break the loop
+
if($(append_page_to).length > 0) {
+
found_where_to_append = true;
+
i = 999;
+
}
+
+
}
+
+
}
+
+
+
// if it didnt have anywhere to append, send it to not sorted
+
if ( found_where_to_append ==  false){
+
append_page_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>");
+
+
+
}
+
 
+
+
 
+
 
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
 
+
 
+
function append_main_team_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><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>
+

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