Team:Concordia/JS/Base

From 2013.igem.org

(Difference between revisions)
(Created page with "var background_image_map = { "Project" : "project", "Notebook" : "notebook" }; function setBackgroundOnHover(ev){ var el = $('.contents'); el.removeClass(); ...")
 
(12 intermediate revisions not shown)
Line 1: Line 1:
var background_image_map = {
var background_image_map = {
     "Project" : "project",
     "Project" : "project",
-
     "Notebook" : "notebook"
+
    "Team" : "team",
 +
    "HP": "hp",
 +
     "Notebook" : "notebook",
 +
    "Modeling" : "modeling"
};
};
Line 34: Line 37:
window.onload = function(){
window.onload = function(){
 +
    //Remove mediaWiki's markup
 +
    $("body").append(function(){ return $("#myContent",this); });
 +
    $("#globalWrapper").addClass("invisible");
 +
 +
    $(".radial-menu-container").css("height", $(document).height() + "px");
 +
 +
    if((".radial-menu-container").length >0){
 +
$("body").addClass("index");
 +
 +
if ( window.addEventListener )
 +
          {
 +
              var InsertedKeys = [];
 +
              var konami = "38,38,40,40,37,39,37,39,66,65";
 +
              window.addEventListener("keydown",
 +
              function(e)
 +
              {
 +
                  if(InsertedKeys.length > 12)
 +
                      InsertedKeys.splice(0,1);
 +
                  InsertedKeys.push( e.keyCode );
 +
                  if ( InsertedKeys.toString().indexOf( konami ) >= 0 )
 +
                  { 
 +
                      //put what we want to do
 +
                      alert('Cheat code accepted');
 +
                      $('.radial-menu-container a')
 +
  .append('<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Unico_Anello.png/693px-Unico_Anello.png"'+
 +
  'style="left: -238px; position: relative; top: -200px; width: 300%;"  /> ')
 +
  .append('<img src="https://photos-6.dropbox.com/t/0/AABR74kGqPZ3Pz-BKCyleFHm5wVzjttzlnMYUacMHtugEw/12/121320100/png/1024x768/3/1380319200/0/2/cellowshipofthering.png/DJqawG0c8FCor8fR3--vYUZusJuPpqfeZHBpkyxrK3k"'+
 +
  'style="width:350%; position:relative;top:-400px;left:-285px;" />');
 +
                        $('#ringimgwiki').hide();
 +
$('#ringimgwiki').show(1000);
 +
 +
 +
                  }
 +
               
 +
 +
              },
 +
              true);
 +
           
 +
          }
 +
    }
 +
   
     $(".slice").hover( setBackgroundOnHover, setBackgroundDefault );
     $(".slice").hover( setBackgroundOnHover, setBackgroundDefault );
     if($(".meny").length > 0) {
     if($(".meny").length > 0) {
Line 47: Line 91:
     $(".closeAvgrund").click(hideAvgrund);
     $(".closeAvgrund").click(hideAvgrund);
     $(".team-member").click(showAvgrund);
     $(".team-member").click(showAvgrund);
 +
 +
var deleteI = $('.title img');
 +
if(deleteI.length > 0)
 +
{
 +
deleteI.removeAttr('src').removeAttr('alt');
 +
}
 +
};
};

Latest revision as of 04:01, 8 October 2013

var background_image_map = {

   "Project" : "project",
   "Team" : "team",
   "HP": "hp",
   "Notebook" : "notebook",
   "Modeling" : "modeling"

};

function setBackgroundOnHover(ev){

   var el = $('.contents');
   el.removeClass();
   el.addClass(background_image_map[this.firstChild.innerHTML]);
   el.addClass('contents');

};

function setBackgroundDefault(){

   var el = $('.contents');
   el.removeClass();
   el.addClass('contents');

};

function showAvgrund(ev) {

   $(".avgrund-popup").removeClass("invisible");
   var className = Array.prototype.filter.call(

ev.currentTarget.classList, function(el){ return el !== 'team-member' && el !== "col-md-3" })[0];

   $("h1").scrollTop();
   Avgrund.show("#"+className+"-modal");

}

function hideAvgrund(ev){

   $(".avgrund-popup").addClass("invisible");
   Avgrund.hide(ev);

};

window.onload = function(){

   //Remove mediaWiki's markup
   $("body").append(function(){ return $("#myContent",this); });
   $("#globalWrapper").addClass("invisible");
   $(".radial-menu-container").css("height", $(document).height() + "px");
   if((".radial-menu-container").length >0){

$("body").addClass("index");

if ( window.addEventListener )

         {
             var InsertedKeys = [];
             var konami = "38,38,40,40,37,39,37,39,66,65";
             window.addEventListener("keydown",
             function(e)
             {
                 if(InsertedKeys.length > 12)
                     InsertedKeys.splice(0,1);
                 InsertedKeys.push( e.keyCode );
                 if ( InsertedKeys.toString().indexOf( konami ) >= 0 )
                 {  
                     //put what we want to do
                     alert('Cheat code accepted');
                     $('.radial-menu-container a')
 .append('<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Unico_Anello.png/693px-Unico_Anello.png"'+
 'style="left: -238px; position: relative; top: -200px; width: 300%;"  /> ')
 .append('<img src="https://photos-6.dropbox.com/t/0/AABR74kGqPZ3Pz-BKCyleFHm5wVzjttzlnMYUacMHtugEw/12/121320100/png/1024x768/3/1380319200/0/2/cellowshipofthering.png/DJqawG0c8FCor8fR3--vYUZusJuPpqfeZHBpkyxrK3k"'+
  'style="width:350%; position:relative;top:-400px;left:-285px;" />');
                        $('#ringimgwiki').hide();

$('#ringimgwiki').show(1000);


                 }
               
             },
             true);
           
         }
   }
   
   $(".slice").hover( setBackgroundOnHover, setBackgroundDefault );
   if($(".meny").length > 0) {

var meny = Meny.create({ menuElement: document.querySelector('.meny'), contentsElement: document.querySelector('.contents'), position: 'left', width: 260, mouse: true, touch: true });

   }
   $(".closeAvgrund").click(hideAvgrund);
   $(".team-member").click(showAvgrund);

var deleteI = $('.title img'); if(deleteI.length > 0) { deleteI.removeAttr('src').removeAttr('alt'); }

};