Difference between revisions of "Template:Heidelberg/js/functions"

Line 202: Line 202:
 
             console.log(clickedItem);
 
             console.log(clickedItem);
 
         });
 
         });
 
<!-- Replace text -->
 
 
function primer(id){
 
    showId = id.replace(/xx/g, "").toUpperCase();
 
    var primername = '$' + id + '_name';
 
    var primerseq = '$' + id + '_seq';
 
  try{ 
 
var toolcontent = '&lt;strong&gt;' + eval(primername) + '&lt;/strong&gt;&lt;br/&gt;' + eval(primerseq);       
 
return '<span class="tooltipster" title="' + toolcontent + '">' + showId + '</span>';
 
} catch(err) {;}
 
};
 
 
$(function() {
 
    $("body *").replaceText( /xx.....xx/gi, primer);
 
  $('.tooltipster').tooltipster({
 
    contentAsHTML: true
 
    });
 
});
 
 
<!-- Replace text ende -->
 
 
// Used to expand and collapse logbook entries
 
$(function() {
 
    $('.notebooktext').hide();
 
    $('.notebookheading').on('click', function(event) {
 
        $(this).siblings().filter('.notebooktext').slideToggle();
 
        event.preventDefault();
 
    });
 
});
 

Revision as of 17:02, 17 September 2015

   $(document).ready(function () {
       var pos_menu;
       /*
       pos_menu = $('.container-fluid > .menu').offset().top;
       var pos_title = $('.container-fluid > .title').offset().top;
       $descidold = ;
       $panelid = '#1001';
       $(window).scroll(function () {
           var scroll_top = $(window).scrollTop();
           if (scroll_top > (pos_title - 42)) {
               $('.container-fluid > .title').css({ 'position': 'fixed', 'top': '45px', 'margin-left': 'auto' });
           } else {
               $('.container-fluid > .title').css({ 'position': 'relative', 'top': '0px' });
           }
           if (scroll_top > pos_menu) {
               $('.container-fluid > .menu').css({ 'position': 'fixed', 'top': '0px', 'margin-left': 'auto' });
           } else {
               $('.container-fluid > .menu').css({ 'position': 'relative', 'top': '0px' });
           }
       });
       */
   });

$(function() {

           $(".carouselimage").click( function() {
               highlightcarousel(this);
           });
       });
       function fillpanel(person) {
           var member = '$team' + person;
           var membername = member + 'name';
           var membertext = member + 'text';
           var memberpic = member + 'pic';
           $('#teampanelname').html(eval(membername));
           $('#teampaneltext').html(eval(membertext));
           $('#teampanelpic').attr('src', eval(memberpic));
       }
       function highlightcarousel(image) {
           var id = $(image).attr('id');
           switch(id) {
               case 'carouselteamchristine':
                   fillpanel('christine');
                   break;
               case 'carouselteamdaniel':
                   fillpanel('daniel');
                   break;
               case 'carouselteamfrieda':
                   fillpanel('frieda');
                   break;
               case 'carouselteamhendrik':
                   fillpanel('hendrik');
                   break;
               case 'carouselteamjasmin':
                   fillpanel('jasmin');
                   break;
               case 'carouselteamlukas':
                   fillpanel('lukas');
                   break;
               case 'carouselteammax':
                   fillpanel('max');
                   break;
               case 'carouselteammichael':
                   fillpanel('michael');
                   break;
               case 'carouselteamstefan':
            fillpanel('stefan');
                   break;
               case 'carouselteamtim':
                   fillpanel('tim');
                   break;
               default:
                   fillpanel('team');
           }
       }
       $(function() {
           $('.jcarousel').jcarousel();
       });
       function trigger(carousel, state)
       {
           $("#testbutton").html(carousel.first);
       };
       $(function() {
           $("#testbutton").click( function() {
               $('.jcarousel').jcarousel('scroll', '+=2');
               var first = $('.jcarousel').jcarousel('first');
               $(first).css({"width":"300px"});
           });
       });
       $activepanel = ;
       $(".carousel").delegate("li", "click", function() {
           var clickedItem = $(this).attr('class');
           console.log(clickedItem);
       });
   $(function() {
           $("#notebookpanel").hover(
                   function() {
                       $(this).css("background", "linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7)),url(800px-Heidelberg_media_pictures_notebook_color.png)")
                   },
                   function() {
                       $(this).css("background","linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7)),url(800px-Heidelberg_media_pictures_notebook_bw.png)");
           });
       });
   $(function () {
       $('.timeline li .timeline-panel').click(function () {
           adjustview();
           $panelid = '#' + $(this).attr('id');
           var descid = '#desc' + $(this).attr('id');
           timeline(descid);
       });
   })
   $(function () {
       $('.timeline li .timeline-badge').click(function () {
           shrinkTimeline();
       })
   })
   function timeline(descid) {
       console.log(descid + ', ' + $descidold); 
       extendTimeline();
       if ($descidold == descid) {
           adjustview();
           /* maybe I'll do something here later */
       } else {
           $($descidold).css({ "display": "none" });
           extendTimelinePanel(descid);
       }

}

   function adjustview() {
      // $('html, body').animate({ scrollTop: ($($panelid).offset().top - 105) }, 500);
      // console.log($($panelid).offset().top);
   }

function extendTimelinePanel(descid) {

   $(descid).css({ "display": "block" });
   $descidold = descid;
   adjustview();

}

function extendTimeline() {

   $(".timeline-badge").animate({ "left": "5%" });
   $(".timeline li .timeline-panel").animate({ "width": "820px" });
   $(".timeline li .timeline-panel").css({ "float": "right" });
   $(".timeline li .timeline-panel").addClass('active');
   $(".timeline li .timeline-panel").css({ "border-right": "5px solid #4063D7" });
   $(".timeline li .timeline-panel").css({ "border-left": "0px" });
   $(".timeline").addClass('active');

}

$('.dropdownbox > a:not(a[href="#"])').on('click', function() {

   self.location = $(this).attr('href');

});

function shrinkTimeline() {

   $(".timeline-badge").animate({ "left": "50%" });
   $(".timeline").removeClass('active');
   $(".description").css({ "display": "none" });
   $(".timeline li .timeline-panel").css({ "float": "left" });
   $(".timeline li.timeline-inverted .timeline-panel").css({ "float": "right" });
   $(".timeline li .timeline-panel").animate({ "margin-left": "0px" });
   $(".timeline li .timeline-panel").animate({ "left": "0px" });
   $(".timeline li .timeline-panel").animate({ "width": "415px" });
   $(".timeline li .timeline-panel").css({ "border-left": "5px solid #4063D7" });
   $(".timeline li .timeline-panel").css({ "border-right": "0px" });
   $(".timeline li.timeline-inverted .timeline-panel").css({ "border-right": "5px solid #4063D7" });
   $(".timeline li.timeline-inverted .timeline-panel").css({ "border-left": "0px" });
   $descidold = ;

}

   $(function() {
       $("#testbutton").click( function() {
           alert('button clicked');
       });
   });
   $activepanel = ;
       $(function() {
           $(".dropdown").hover( function() {
               $(this).dropdown();
           });
       });
       $(".carousel").delegate("li", "click", function() {
           var clickedItem = $(this).attr('class');
           console.log(clickedItem);
       });