Difference between revisions of "Dev/Awards2"

Line 277: Line 277:
  
  
//wrap medals in a hrefs
 
function load_these_items ( source_page , destination_div ) {
 
$("#"+destination_div ).load( source_page , function() { 
 
$( "li" ).each(function( index ) {
 
$(this).wrap( "<a href=\'https://2017.igem.org/Team:" + $( this ).text() + "\'>"  );
 
});
 
});
 
}
 
  
  
  
 
$(document).ready(function() {
 
$(document).ready(function() {
 
 
 
 
var award_name;
 
var trim;
 
 
//sort awards
 
for( x=0; x< awards_set.length; x++) {
 
 
//reset variables
 
award_name="";
 
trim = 0;
 
 
// is this a nomination or a winner?
 
if ( (awards_set[x].award).substring(0,9) == "Nominated" ) {
 
trim = 19;
 
}
 
else if ( (awards_set[x].award).substring(0,4) == "Best" ) {
 
trim = 5;
 
}
 
 
//remove from the beginning of the string ( "Best or Nominated for Best" )
 
award_name = (awards_set[x].award).substring( trim,  (awards_set[x].award).length );
 
 
//check if the award is a track
 
if ( award_name.indexOf('Project') > -1) {
 
//its a track, trim at the first empty space
 
award_name = award_name.substring( 0 , award_name.indexOf(' ') )  +"_TA";
 
}
 
else {
 
//trim to the first comma if the team is overgrad or high school to standardize
 
if(  awards_set[x].section == "high_school" || awards_set[x].section == "overgrad") {
 
award_name = award_name.substring( 0 , award_name.indexOf(',') ) +"_SA" ;
 
}
 
//if its more than one word
 
if ( award_name.indexOf(' ') >= 0 ) {
 
award_name = award_name.substring( 0 , award_name.indexOf(' ') ) +"_SA" ;
 
}
 
}
 
 
 
 
//after the award_name has been trimmed to append -
 
//append winner to their section
 
if (trim == 5  ) {
 
 
// check if there is only one winner
 
if ( awards_set[x].section == "underover") {
 
$("#"+award_name).append( "<div class='award_winner full'><li>" + awards_set[x].team_name + "</div>" );
 
}
 
else {
 
$("#"+award_name).append( "<div class='award_winner half'><li>" + awards_set[x].team_name + "</div>" );
 
}
 
 
}
 
 
//append nomination to their award
 
if (trim == 19  ) {
 
$("#"+award_name+"_nominations").append( "<li>" + awards_set[x].team_name + "</li>" );
 
}
 
}
 
 
 
 
 
//medals
 
// to use this function send the "source page" and then send the div's id to where you want to send it
 
 
load_these_items ( "https://2017.igem.org/Dev/Awards #demo_gold",  "gold_medals");
 
load_these_items ( "https://2017.igem.org/Dev/Awards #demo_silver",  "silver_medals");
 
load_these_items ( "https://2017.igem.org/Dev/Awards #demo_bronze",  "bronze_medals");
 
 
  
  
Line 633: Line 552:
 
{'award':'Nominated for Best Part Collection','team_name':'UCLA','section':'undergrad'},
 
{'award':'Nominated for Best Part Collection','team_name':'UCLA','section':'undergrad'},
 
];
 
];
 +
 +
 +
 +
var award_name;
 +
var trim;
 +
 +
//sort awards
 +
for( x=0; x< awards_set.length; x++) {
 +
 +
//reset variables
 +
award_name="";
 +
trim = 0;
 +
 +
// is this a nomination or a winner?
 +
if ( (awards_set[x].award).substring(0,9) == "Nominated" ) {
 +
trim = 19;
 +
}
 +
else if ( (awards_set[x].award).substring(0,4) == "Best" ) {
 +
trim = 5;
 +
}
 +
 +
//remove from the beginning of the string ( "Best or Nominated for Best" )
 +
award_name = (awards_set[x].award).substring( trim,  (awards_set[x].award).length );
 +
 +
//check if the award is a track
 +
if ( award_name.indexOf('Project') > -1) {
 +
//its a track, trim at the first empty space
 +
award_name = award_name.substring( 0 , award_name.indexOf(' ') )  +"_TA";
 +
}
 +
else {
 +
//trim to the first comma if the team is overgrad or high school to standardize
 +
if(  awards_set[x].section == "high_school" || awards_set[x].section == "overgrad") {
 +
award_name = award_name.substring( 0 , award_name.indexOf(',') ) +"_SA" ;
 +
}
 +
//if its more than one word
 +
if ( award_name.indexOf(' ') >= 0 ) {
 +
award_name = award_name.substring( 0 , award_name.indexOf(' ') ) +"_SA" ;
 +
}
 +
}
 +
 +
 +
 +
//after the award_name has been trimmed to append -
 +
//append winner to their section
 +
if (trim == 5  ) {
 +
 +
// check if there is only one winner
 +
if ( awards_set[x].section == "underover") {
 +
$("#"+award_name).append( "<div class='award_winner full'><li>" + awards_set[x].team_name + "</div>" );
 +
}
 +
else {
 +
$("#"+award_name).append( "<div class='award_winner half'><li>" + awards_set[x].team_name + "</div>" );
 +
}
 +
 +
}
 +
 +
//append nomination to their award
 +
if (trim == 19  ) {
 +
$("#"+award_name+"_nominations").append( "<li>" + awards_set[x].team_name + "</li>" );
 +
}
 +
}
 +
 +
 +
 +
 +
//medals
 +
// to use this function send the "source page" and then send the div's id to where you want to send it
 +
 +
load_these_items ( "https://2017.igem.org/Dev/Awards #demo_gold",  "gold_medals");
 +
load_these_items ( "https://2017.igem.org/Dev/Awards #demo_silver",  "silver_medals");
 +
load_these_items ( "https://2017.igem.org/Dev/Awards #demo_bronze",  "bronze_medals");
 +
 +
  
  
Line 638: Line 630:
 
});
 
});
  
 +
//wrap medals in a hrefs
 +
function load_these_items ( source_page , destination_div ) {
 +
$("#"+destination_div ).load( source_page , function() { 
 +
$( "li" ).each(function( index ) {
 +
$(this).wrap( "<a href=\'https://2017.igem.org/Team:" + $( this ).text() + "\'>"  );
 +
});
 +
});
 +
}
  
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 22:08, 7 November 2017

MENU

AWARDS

Best Diagnostics Project

Nominations

Best Energy Project

Nominations

Best Environment Project

Nominations

Best Food and Nutrition Project

Nominations

Best Foundational Advance Project

Nominations

Best Information Processing Project

Nominations

Best Manufacturing Project

Nominations

Best New Application Project

Nominations

Best Therapeutics Project

Nominations

Best Hardware Project

Nominations

Best SoftwareProject

Nominations

Best Measurement Project

Nominations

Best Wiki

Nominations

Best Presentation

Nominations

Best Poster

Nominations

Best Integrated Human Practices

Nominations

Best Education & Public Engagement

Nominations

Best Model

Nominations

Best Entrepreneurship

Nominations

Best Applied Design

Nominations

Best Measurement

Nominations

Best Software

Nominations

Best Hardware

Nominations

GOLD

SILVER

BRONZE