Difference between revisions of "Team:Slovenia/libraries/custom-js"

 
(41 intermediate revisions by 2 users not shown)
Line 1: Line 1:
li , p, td, th, tr{
+
function reloader() {
color: rgba(0, 0, 0, 0.8);
+
    try {
}
+
        //console.log('start');
body {  
+
        /*$('.ui.sticky.global').sticky({
overflow: auto;
+
            context: '#context',
}
+
            offset: 16
/* from docs.css */
+
        });
#example .main.container .introduction p,
+
        $('.ui.sticky.image').sticky({
#example .main.container .example p,
+
            context: '#context',
#example .main.container p {
+
            offset: 27
    color: rgba(0, 0, 0, 0.8);
+
        });
}
+
        $('.ui.sticky.text.menu').sticky({
 +
            context: '#context',
 +
            offset: 200
 +
        });
 +
        $('.ui.sticky.text').sticky({
 +
            context: '#context',
 +
            offset: 200
 +
        });*/
 +
        $('.image_div > img').visibility({
 +
            type: 'image',
 +
            transition: 'fade in',
 +
            duration: 500
 +
        });
 +
        $('.teamimg').hover(function () {
 +
            var width = $(this).outerWidth() / 2;
 +
            $(this).find('.left').animate({right: width}, {queue: false, duration: 300});
 +
            $(this).find('.right').animate({left: width}, {queue: false, duration: 300});
 +
        }, function () {
 +
            $(this).find('.left').animate({right: 0}, {queue: false, duration: 300});
 +
            $(this).find('.right').animate({left: 0}, {queue: false, duration: 300});
 +
        });
 +
        $(function () {
 +
            // The parameter are the selector for the container(s) of text in which you want replacement
 +
            // and a URL pointing to your bibfile - mind the same origin policy...
 +
            var zitator = new Zitator(".citing", "//2016.igem.org/wiki/images/5/53/T--Slovenia--references.txt");
 +
            zitator.zitiere();
 +
        });
 +
        function isScrolledIntoView(elem) {
 +
            var docViewTop = $(window).scrollTop();
 +
            var docViewBottom = docViewTop + $(window).height() - $("#menucomb").height();
  
 +
            var elemTop = $(elem).offset().top;
 +
            var elemBottom = elemTop + $(elem).height();
  
#example .main.container .examples h2,
+
            if (elemTop >= docViewTop) {
#example .main.container h2,
+
                return true;
#example .main.container .tab > h2 {
+
            }
    position: relative;
+
            else if (elemBottom >= docViewBottom) {
    margin: 5rem 0 3rem;
+
                return true;
}
+
            }
 +
            return false; // || elemTop >= docViewTop) ;
 +
        }
  
#example .main.container .examples > .rail + h2,
+
        function clearStyleOfSideMenu() {
#example .main.container > .rail + h2,
+
            //console.log("calling a function");
#example .main.container > .tab > .rail + h2,
+
            var id = null;
#example .main.container0 .examples h2:first-child,
+
            $("span.section.colorize").each(function () {
#example .main.container h2:first-child,
+
                var id = this.id;
#example .main.container > .tab > h2:first-child {
+
                //console.log(id);
    margin-top: 0;
+
                var selector = 'a[href*="#'.concat(id).concat('"]');
}
+
                $(selector).css("color", "");
 +
            });
  
#example > .pusher > .full.height {
+
            $("span.section.colorize").each(function() {
    display: -webkit-box;
+
                var ident = this.id;
    display: -webkit-flex;
+
                console.log(ident);
    display: -ms-flexbox;
+
                console.log(this);
    display: flex;
+
                if(ident != "") {
    -webkit-flex-direction: row;
+
                    var parent = (this.parentNode).parentNode;
    -ms-flex-direction: row;
+
                    if(isScrolledIntoView(parent)) {
    flex-direction: row;
+
                        var selector = 'a[href*="#'.concat(ident).concat('"]');
}
+
                        $(selector).css("color", "#DB2828");
 +
                        console.log(selector);
 +
                        return false;
 +
                    }
 +
                }
 +
            });
  
#example .full.height > .banana {
+
            /*var color = true;
    position: relative;
+
            $(".section").each(function () {
    z-index: 1;
+
            //clear each parent
    background-color: #1b1c1d;
+
            var id = this.id;
    width: 20%;
+
            var selector = 'a[href*="#'.concat(id).concat('"]');
height:100%;
+
            if (isScrolledIntoView($(this).parent().parent())) {
    -webkit-box-flex: 0;
+
            // nastavi barvo trenutni sekcij
    -webkit-flex: 0 0 auto;
+
            if(color) {
    -ms-flex: 0 0 auto;
+
    flex: 0 0 auto;
+
}
+
  
#example .article {
+
            console.log("section is found");
    -webkit-box-flex: 1;
+
            color = false;
    -webkit-flex: 1 1 auto;
+
            return false; //break from function
    -ms-flex: 1 1 auto;
+
            }
    flex: 1 1 auto;
+
            }
    min-width: 0;
+
            });*/
margin-left:20%;
+
        }
width:80%;
+
align:center;
+
}
+
  
#example .main.container {
+
        $(document).ready(function () {
    padding: 110px 0 7em;
+
                clearStyleOfSideMenu();
}
+
                $(window).scroll(function () {
 
+
                    clearStyleOfSideMenu();
/* Defaults */
+
                });
/*#example .masthead > .container,*/
+
            }
#example .main.container {
+
        );
/*#example .fixed.menu > .container {*/
+
        $(".menuItem").mouseenter(
    /*margin-left: 3em !important;
+
            function () {
    margin-right: 3em !important;*/
+
                var loc = window.location.href;
    width: auto !important;
+
                var defaultItem;
    max-width: 960px !important;
+
                var parent;
}
+
                $(".submenu").each(function () {
 
+
                        var context = this;
/*#example .masthead > .container {*/
+
                        $("a", context).each(function () {
/*margin-right: 387px !important;*/
+
                            if (loc.match(/[^#]*/) == $(this).attr("href")) {
/*}*/
+
                                defaultItem = $(context).attr("id");
#example .main.container {
+
                                parent = $("#".concat(defaultItem.replace("Submenu", "")));
    /*margin-right: 387px !important;*/
+
                            }
position: relative;
+
                        });
margin-left: auto; margin-right: auto;
+
                    }
}
+
                );
 
+
                $(".ui.simple.item.menuItem a").each(function () {
/* Remove Fixed Sidebar */
+
                    if (loc.match(/[^#]*/) == $(this).attr("href")) {
@media only screen and (max-width: 1144px) {
+
                        parent = $($(this).parents('.ui.simple.item.menuItem'));
     /* Hide Fixed Sidebar */
+
                        defaultItem = (parent.attr('id')).concat("Submenu");
    #example .full.height > .banana {
+
                        //console.log(defaultItem);
         display: none;
+
                    }
 +
                });
 +
                defaultItem = document.getElementById(defaultItem);
 +
                clearElements();
 +
                var submenu = document.getElementById(this.id.concat("Submenu"));
 +
                var submenuText = document.getElementById("SecondarySubmenu");
 +
                if (submenuText.innerHTML != submenu.innerHTML) {
 +
                    this.className = "ui simple active item menuItem";
 +
                    submenuText.innerHTML = submenu.innerHTML;
 +
                }
 +
                else {
 +
                    parent.attr("class", "ui simple active item menuItem");
 +
                    submenuText.innerHTML = defaultItem.innerHTML;
 +
                }
 +
            }
 +
        );
 +
        $("#menucomb").mouseleave(function () {
 +
                setDefaultMenu();
 +
            }
 +
        );
 +
     } catch (e) {
 +
        //console.log('startReloading');
 +
        $.getScript("https://2016.igem.org/Team:Slovenia/libraries/semantic-min-js?action=raw&ctype=text/javascript", function () {
 +
            //console.log('success');
 +
            reloader();
 +
         });
 +
        //console.log('endReloading');
 
     }
 
     }
 
}
 
}
 +
$(document).ready(injectHeader);
 +
$(document).ready(reloader);
 +
function enumerateKeys(object) {
 +
    var numberPairs = {};
 +
    var objectPairs = {};
 +
    var number = 0;
  
/* Remove Rail */
+
    var matches = document.body.querySelectorAll(object + '[data-ref]');
@media only screen and (max-width: 992px) {
+
     while (number < matches.length) {
     /* Fluid Containers */
+
        var refName = matches[number].dataset.ref;
    #example .masthead > .container,
+
console.log(refName);
    #example .main.container,
+
console.log(matches[number]);
    #example .fixed.menu > .container {
+
        if (refName in numberPairs) {
         margin-left: 1em !important;
+
            console.log(refName, "This label has already been assigned.");
        margin-right: 1em !important;
+
         } else {
         max-width: none !important;
+
            numberPairs[number + 1] = matches[number];
 +
            objectPairs[refName] = number + 1;
 +
            console.log(refName);
 +
         }
 +
        number++;
 
     }
 
     }
 +
    return [numberPairs, objectPairs, number];
 
}
 
}
  
/* end of docs*/
+
function enumerate() {
 +
    var tables = enumerateKeys('table');
 +
    var figures = enumerateKeys('figure');
  
/* override default */
+
     var maximum = Math.max(tables[2], figures[2]);
#content {
+
     width: 100%;
+
    background-color: transparent;
+
    margin-left: 0;
+
    padding-left: 0;
+
}
+
  
#contentSub, #firstHeading, #column-one, #footer {
+
    for (var number = 1; number <= maximum; number++) {
    display: none;
+
        if (number in tables[0]) {
}
+
            $(tables[0][number]).children('caption').prepend("Table " + number + ": ")
 +
        }
 +
        if (number in figures[0]) {
 +
            $(figures[0][number]).children('figcaption').prepend("Figure " + number + ": ")
 +
        }
 +
    }
  
#firstHeading, #content {
+
    $(this).find('ref').each(function () {
    margin-top: 0 !important;
+
        var label = $(this).text();
     padding-top: 0 !important;
+
        $(this).click(function (event) {
 +
            event.preventDefault();
 +
        });
 +
        if (label in tables[1]) {
 +
            var number = tables[1][label];
 +
            $(this).html("<a href=''> Table " + tables[1][label] + " </a>");
 +
            $(this).on('click', function () {
 +
                window.scroll(0, $(tables[0][number]).offset().top - 150);
 +
            })
 +
        } else {
 +
            var number = figures[1][label];
 +
            $(this).html("<a href=''>Figure " + figures[1][label] + "</a>");
 +
            $(this).on('click', function () {
 +
                window.scroll(0, $(figures[0][number]).offset().top - 150);
 +
            })
 +
        }
 +
     });
 
}
 
}
 +
$(document).ready(enumerate);
 +
$(document).ready(setDefaultMenu);
 +
$(document).ready(function(){
 +
    $('.ui.accordion').accordion();
 +
});
  
#bodyContent {
+
function resize(img) {
     margin-left: 0;
+
     if (!(img.className.indexOf("big") >= 0)) {
     padding-left: 0;
+
        img.className = "ui big centered image";
 +
        img.parentElement.parentElement.setAttribute("align-property", img.parentElement.parentElement.align);
 +
        img.parentElement.parentElement.setAttribute("align", "center");
 +
        img.parentElement.parentElement.setAttribute("data-property", img.parentElement.parentElement.style.cssText);
 +
        img.parentElement.parentElement.style.cssText = "clear: both";
 +
     }
 +
    else {
 +
        img.parentElement.parentElement.setAttribute("align", "");
 +
        img.className = "ui image";
 +
        img.parentElement.parentElement.style.cssText = img.parentElement.parentElement.getAttribute("data-property");
 +
        img.parentElement.parentElement.align = img.parentElement.parentElement.getAttribute("align-property");
 +
    }
 +
    //scroll to image, (if two images are floated and the right one is resised, then the image gets pushed down)
 +
    //var top = img.offsetTop;
 +
    //console.log($(img).offset().top);
 +
    //console.log($("menucomb").height());
 +
    $(window).scrollTop($(img).offset().top -  $(window).height()/2 + $(img).height()/2);
 
}
 
}
  
body {
+
function setDefaultMenu() {
     /*padding-top: 14px;*/
+
     //console.log("calling set default item");
    background-color: #FCFCFC;
+
    clearElements();
}
+
    var loc = window.location.href;
 +
    var defaultItem;
 +
    var parent;
 +
    $(".submenu").each(function () {
 +
            var context = this;
 +
            $(this).css("color", "#DB2828");
 +
            $(this).css("font-weight", "bold");
 +
            $("a", context).each(function () {
 +
                //console.log($(this).attr("href"));
 +
                if (loc.match(/[^#]*/) == $(this).attr("href")) {
 +
                    defaultItem = $(context).attr("id");
 +
                    parent = $("#".concat(defaultItem.replace("Submenu", "")));
 +
                    $(this).css("color", "#DB2828");
 +
                    $(this).css("font-weight", "bold");
 +
                }
 +
            });
  
/* transparenten pravokotnik na levi in del za besedilo */
+
        }
#example:not(.site) > .pusher > .full.height {
+
    );
    background-color: transparent;
+
    $(".ui.simple.item.menuItem a").each(function () {
}
+
        if (loc.match(/[^#]*/) == $(this).attr("href")) {
 +
            parent = $($(this).parents('.ui.simple.item.menuItem'));
 +
            defaultItem = (parent.attr('id')).concat("Submenu");
 +
        }
 +
    });
  
/* pravokotnik na levi - sirina, ozadje.. */
+
    var submenuText = document.getElementById("SecondarySubmenu");
#example .full.height > .banana {
+
    defaultItem = document.getElementById(defaultItem);
    width: 20%;
+
     parent.attr("class", "ui simple active item menuItem");
position:fixed;
+
     submenuText.innerHTML = defaultItem.innerHTML;
height: 100%;
+
     background-color: transparent;
+
     padding-top: 8px;
+
padding-left:16px;
+
background-color: #333333;
+
color:white;
+
 
}
 
}
  
/* menus */
+
function clearElements() {
#projectSubmenu, #partsSubmenu, #notebookSubmenu, #notebookSubmenu, #societySubmenu, #ideaSubmenu, #homeSubmenu, #dryLabSubmenu, #teamSubmenu, #proteaseSignallingSubmenu, #mechanosensingSubmenu, #implementationSubmenu {
+
     var elements = document.getElementsByClassName("menuItem");
     display: none;
+
    for (var i = 0; i < elements.length; i++) {
 +
        elements[i].className = "ui simple item menuItem";
 +
    }
 
}
 
}
  
#menucomb {
+
function injectHeader() {
right:0px;
+
    //console.log("Injecting header");
position:fixed;
+
    var menu = "<div class='submenu' id='projectSubmenu'> \
width:80%;
+
<div class='menu'> \
    background-color: #FCFCFC;
+
<a href='https://2016.igem.org/Team:Slovenia/Description' \
    padding-top: 12px !important;
+
  class='item menuFix'>Description</a> \
     padding-bottom: 12px;
+
</div> \
    margin-top: 0 !important;
+
</div> \
min-width: 700px !important;
+
<div class = 'submenu' id='homeSubmenu'> \
 +
<div class='menu'> \
 +
  <a href='https://2016.igem.org/Team:Slovenia' class='item menuFix'><img border='0' alt='USflag' src='//2016.igem.org/wiki/images/5/5d/T--Slovenia--USflag.png'></a> \
 +
  <a href='https://2016.igem.org/Team:Slovenia/HomeSlo' class='item menuFix'><img border='0' alt='USflag' src='//2016.igem.org/wiki/images/7/7b/T--Slovenia--SLOflag.png'></a> \
 +
</div> \
 +
</div> \
 +
<div class='submenu' id='partsSubmenu'> \
 +
<div class='menu' style = 'position: absolute; right: 15%'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Parts' \
 +
  class='item menuFix'>All Parts</a> \
 +
  <a href='https://2016.igem.org/Team:Slovenia/Basic_Part' \
 +
  class='item menuFix'>New Basic Part</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Part_Collection' \
 +
  class='item menuFix'>Part Collection</a> \
 +
</div> \
 +
</div> \
 +
<div class='submenu' id='notebookSubmenu'> \
 +
<!-- this is notebook submenu --> \
 +
<div class='menu' style = 'position: absolute; right: 8%'>\
 +
<a href='https://2016.igem.org/Team:Slovenia/Notebook' class='item menuFix'>Log book</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Measurement' class='item menuFix'>Protocols</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Notebook/Proposals' class='item menuFix'>Initial proposals</a> \
 +
</div>\
 +
</div> \
 +
<div class='submenu' id='societySubmenu'> \
 +
<div class='menu' style = 'position: absolute; right: 0'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Integrated_Practices' class='item menuFix'>Integrated Practices</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Engagement' \
 +
  class='item menuFix'>Education and Public Engagement</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Collaborations' \
 +
  class='item menuFix'>Collaboration</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Safety' \
 +
  class='item menuFix'>Safety</a> \
 +
</div> \
 +
</div> \
 +
<div class='submenu' id='homeSubmenu'> \
 +
</div> \
 +
<div class='submenu' id='ideaSubmenu'> \
 +
<!-- this is idea submenu -->\
 +
<div class='menu'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Idea/Challenge' class='item menuFix'>Challenges</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Idea/Solution' class='item menuFix'>Solutions</a> \
 +
</div>\
 +
</div> \
 +
<div class='submenu' id='mechanosensingSubmenu'> \
 +
<div class='menu'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Mechanosensing/Overview' class='item menuFix'>Overview</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Mechanosensing/Mechanosensitive_channels' class='item menuFix'>Mechanosensitive channels</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Mechanosensing/Gas_vesicles' class='item menuFix'>Gas vesicles</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Mechanosensing/CaDependent_mediator' class='item menuFix'>Ca-dependent mediator</a> \
 +
</div> \
 +
</div> \
 +
<div class='submenu' id='implementationSubmenu'> \
 +
<div class='menu' style = 'position: absolute; right: 30%'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Demonstrate' class='item menuFix'>Protease inducible secretion</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Proof' class='item menuFix'>Touch painting</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Implementation/Impact' class='item menuFix'>Impact</a> \
 +
</div> \
 +
</div> \
 +
<div class='submenu' id='proteaseSignallingSubmenu'> \
 +
<div class='menu'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Overview' class='item menuFix'>Overview</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Reporters' class='item menuFix'>Reporters</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Orthogonality' class='item menuFix'>Orthogonality</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Split_proteases' class='item menuFix'>Split proteases</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Light_dependent_mediator' class='item menuFix'>Light-dependent mediator</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Logic' class='item menuFix'>Logic</a> \
 +
</div> \
 +
</div> \
 +
<div  class='submenu' id='dryLabSubmenu'> \
 +
<div class='menu' style = 'position: absolute; right: 30%'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Hardware' class='item menuFix'>Ultrasound controlling device</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Model' class='item menuFix'>Modeling of ultrasound</a>  \
 +
<a href='https://2016.igem.org/Team:Slovenia/Software' class='item menuFix'>CaPTURE software</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/ModelLogic' class='item menuFix'>Modeling logic gates</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/CoiledCoilInteraction' class='item menuFix'>Coiled-coil interaction model</a> \
 +
</div> \
 +
</div> \
 +
<div class='submenu' id='teamSubmenu'> \
 +
<div class='menu' style = 'position: absolute; right: 0'> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Team/Students' class='item menuFix'>Students</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Team/Advisors' class='item menuFix'>Advisors</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Attributions' class='item menuFix'>Attributions</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Sponsors'  class='item menuFix'>Sponsors</a> \
 +
</div> \
 +
</div> \
 +
<div class='ui sticky global' id='menucomb'> \
 +
<div class='ui red secondary ten item pointing menu'> \
 +
<a href='https://2016.igem.org/Team:Slovenia' class='ui simple item menuItem menuFix' id='home'> \
 +
                        Home \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Idea/Challenge' class='ui simple item menuItem menuFix' id='idea'> \
 +
                        Idea \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Mechanosensing/Overview' class='ui simple item menuItem menuFix' id='mechanosensing'> \
 +
                        Mechano- <br>sensing \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Protease_signaling/Overview' class='ui simple item menuItem menuFix' id='proteaseSignalling'> \
 +
                        Protease<br /> signaling\
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Hardware' class='ui simple item menuItem menuFix' id='dryLab'> \
 +
                        Dry lab \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Demonstrate' class='ui simple item menuItem menuFix' id='implementation'> \
 +
                        Implementation \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Parts' class='ui simple item menuItem menuFix' id='parts' > \
 +
                        Parts \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Notebook' class='ui simple item menuItem menuFix' id='notebook' > \
 +
                        Notebook \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Integrated_Practices' class='ui simple item menuItem menuFix' id='society'> \
 +
                        Society \
 +
</a> \
 +
<a href='https://2016.igem.org/Team:Slovenia/Team/Students' class='ui simple item menuItem menuFix' id='team'> \
 +
                        Team \
 +
</a> \
 +
</div> \
 +
  \
 +
<div class='ui secondary menu' id='SecondarySubmenu'> \
 +
</div> \
 +
</div>";
 +
     var contextDiv = document.getElementById("context");
 +
    contextDiv.innerHTML = menu.concat(contextDiv.innerHTML);
 +
var elements = document.getElementsByClassName("menuFix");
 +
 +
if(window.innerWidth < 768 ) {
 +
//phone
 +
console.log("small screen");
 +
for (var i = 0; i < elements.length; i++) {
 +
elements[i].setAttribute("style", "font-size:5px;");
 +
}
 +
}
 +
else if(window.innerWidth < 800) {
 +
//small screen
 +
console.log("small screen");
 +
for (var i = 0; i < elements.length; i++) {
 +
elements[i].setAttribute("style", "font-size:7px;");
 +
}
 +
}
 +
else if(window.innerWidth < 980) {
 +
//medium screen
 +
console.log("small screen");
 +
for (var i = 0; i < elements.length; i++) {
 +
elements[i].setAttribute("style", "font-size:9px;");
 +
}
 +
}
 +
else if(window.innerWidth < 1280) {
 +
//normal
 +
console.log("small screen");
 +
for (var i = 0; i < elements.length; i++) {
 +
elements[i].setAttribute("style", "font-size:11px;");
 +
}
 +
}
 +
console.log("end of injecting");
 
}
 
}
  
.ui.vertical.sticky.text.menu {
+
$('.playGif').on('click', function () {
     font-size: 1rem;
+
     //console.log("play detected");
     background-color: transparent;
+
     var parent = $(this);
     padding-top: 60px !important;
+
    var parAlt = parent.attr('data-alt');
}
+
     var parSrc = parent.attr('src');
.ui.vertical.sticky.text.menu > a {
+
    parent.attr("src", parAlt).attr("data-alt", parSrc);
color:white !important;
+
});
}
+
function relativeCoords() {
 +
    console.log("what what");
 +
    var img = document.getElementById("projectScheme");
 +
    var c1 = [74, 132, 136, 217, 241, 225, 319, 175, 365, 89, 298, 42, 152, 62];
 +
    var c2 =  [387, 125, 393, 283, 423, 316, 518, 190, 486, 120];
 +
    var c3 = [528, 77, 497, 134, 537, 173, 672, 185, 739, 145, 733, 94, 694, 71];
 +
    var c4 = [393, 283, 423, 316, 454, 300, 474, 260, 537, 273, 494, 305, 678, 285, 697, 243, 788, 239, 788, 330, 383, 374, 343, 319];
  
/* end of menus */
+
    for(i = 0; i < c1.length; i++) {
 +
        c1[i] = (c1[i]/(800.0)*img.clientWidth);
 +
    }
 +
    document.getElementById("area1").coords = c1.toString();
  
span.section  {  
+
    for(i = 0; i < c2.length; i++) {
  margin-top: -130px;        /* Size of fixed header */
+
        c2[i] = (c2[i]/(800.0)*img.clientWidth);
  padding-bottom: 130px;
+
    }
  display: block;  
+
    document.getElementById("area2").coords = c2.toString();
}
+
  
/* tabelite neka bidat na sredina */
+
    for(i = 0; i < c3.length; i++) {
.ui.table {
+
        c3[i] = (c3[i]/(800.0)*img.clientWidth);
     margin: auto;
+
     }
     width: 100%;
+
     document.getElementById("area3").coords = c3.toString();
}
+
  
/*црна боја на менито */
+
    for(i = 0; i < c4.length; i++) {
.home:link, .home:visited, .home:active, .home:hover {
+
        c4[i] = (c4[i]/(800.0)*img.clientWidth);
    color: black;
+
    }
 +
    document.getElementById("area4").coords = c4.toString();
 
}
 
}
  
/* glavniot naslov neka ima edna crvena boja */
+
function relativeCoordsStar() {
#context h1 {
+
     var img = document.getElementById("starScheme");
     color: #c10c00;
+
var c1 = [254, 239, 194, 163, 225, 51, 319, 163];
}
+
var c2 = [260, 242, 323, 170, 452, 193, 363, 288];
 +
var c3 = [260, 249, 362, 295, 389, 433, 260, 369];
 +
var c4 = [252, 246, 252, 369, 131, 426, 150, 294];
 +
var c5 = [250, 242, 147, 288, 55, 192, 187, 169];
 +
 +
    for(i = 0; i < c1.length; i++) {
 +
        c1[i] = (c1[i]/(515.0)*img.clientWidth);
 +
    }
 +
    document.getElementById("patients").coords = c1.toString();
  
/* ostanatite naslovi neka bidat vo druga crvena */
+
    for(i = 0; i < c2.length; i++) {
#context h2 {
+
        c2[i] = (c2[i]/(515.0)*img.clientWidth);
     color: #c10c00;
+
    }
}
+
     document.getElementById("scientists").coords = c2.toString();
  
/* naslovot na bibliografijata neka e vo treta boja */
+
    for(i = 0; i < c3.length; i++) {
#ref-title {
+
        c3[i] = (c3[i]/(515.0)*img.clientWidth);
     color: #860000
+
     }
}
+
    document.getElementById("iGEMers").coords = c3.toString();
  
caption, figcaption {
+
     for(i = 0; i < c4.length; i++) {
     caption-side: bottom;
+
        c4[i] = (c4[i]/(515.0)*img.clientWidth);
    text-align: center
+
     }
}
+
     document.getElementById("researches").coords = c4.toString();
 
+
figure {
+
     for(i = 0; i < c5.length; i++) {
    display: block;
+
         c5[i] = (c5[i]/(515.0)*img.clientWidth);
}
+
     }
 
+
     document.getElementById("doctors").coords = c5.toString();
/* bibliography*/
+
x-ref sup > a, x-ref sup > a:visited, x-ref sup > a:hover, x-ref sup > a:active {
+
    color: grey;
+
}
+
 
+
.reference > a {
+
    color: black;
+
}
+
 
+
/* end of bibliography */
+
 
+
/* enumeration of tables and figures */
+
ref > a, ref > a:visited, ref > a:active, ref > a:hover {
+
    color: black;
+
}
+
 
+
/* team images */
+
.teamimg {
+
     overflow: hidden;
+
}
+
 
+
.hiddentext {
+
     position: absolute;
+
    max-width: 80%;
+
}
+
 
+
.image_div {
+
    position: relative;
+
    overflow: hidden;
+
     width: 50%;
+
    float: left;
+
}
+
 
+
.right img {
+
    position: relative;
+
    margin-left: -100%;
+
}
+
 
+
/* end of team images */
+
 
+
/* logo row */
+
footer .column > a {
+
    margin: auto;
+
    display: inline-block !important;
+
}
+
 
+
/* Calendar */
+
/*#calendarTable {
+
         position:relative;
+
        width: auto;
+
}*/
+
#calendarHead:hover {
+
    background-color: white;
+
    color: #DB2828;
+
    cursor: pointer;
+
    cursor: hand;
+
}
+
#right, #left, #tdays, #tmonth {
+
    text-align:center;
+
    background-color: #AFAFAF;
+
    color:white;
+
    font-weight: bold;
+
}
+
#calendarHead {
+
    text-align:center;
+
    font-weight: bold;
+
    color: white;
+
    background-color: #AFAFAF;
+
}
+
.week > td, .weekHighLight > td {
+
    margin: 0 auto;
+
    background-color: white; /* #AFAFAF; */
+
    text-align: right;
+
    vertical-align: top;
+
}
+
.weak {
+
    color:  #DB2828;
+
}
+
.week:hover > td, #right:hover, #left:hover, .weekHighLight > td {
+
     background-color: #DB2828;
+
    color: white;
+
    cursor: pointer;
+
    cursor: hand;
+
}
+
 
+
/* Images and resizing stuff */
+
figure {
+
  background-color: #fff;
+
  padding: 5px;
+
  font-size: .875em;
+
  display: table;
+
}
+
 
+
figure img {
+
     display: block;
+
    width: 100%;
+
}
+
 
+
figcaption {
+
    display: table-caption;
+
    caption-side: bottom;
+
    background: #fff;
+
font-size:11px;
+
line-height:1.6em;
+
    /* padding: 0 1px 1px; */
+
}​
+
 
+
.ui.justified.container, p, .ui.segment {
+
  -webkit-hyphens: none !important;
+
  -ms-hyphens: none !important;
+
  hyphens: none !important;
+
}
+
 
+
h3, h4 {
+
    font-size:1.28rem;
+
    padding-bottom: 8px;
+
}
+
 
+
#context h3 {
+
    color: #c10c00;
+
}
+
 
+
h5 {
+
    font-size:1.071rem
+
 
}
 
}

Latest revision as of 18:03, 19 October 2016

function reloader() {

   try {
       //console.log('start');
       /*$('.ui.sticky.global').sticky({
           context: '#context',
           offset: 16
       });
       $('.ui.sticky.image').sticky({
           context: '#context',
           offset: 27
       });
       $('.ui.sticky.text.menu').sticky({
           context: '#context',
           offset: 200
       });
       $('.ui.sticky.text').sticky({
           context: '#context',
           offset: 200
       });*/
       $('.image_div > img').visibility({
           type: 'image',
           transition: 'fade in',
           duration: 500
       });
       $('.teamimg').hover(function () {
           var width = $(this).outerWidth() / 2;
           $(this).find('.left').animate({right: width}, {queue: false, duration: 300});
           $(this).find('.right').animate({left: width}, {queue: false, duration: 300});
       }, function () {
           $(this).find('.left').animate({right: 0}, {queue: false, duration: 300});
           $(this).find('.right').animate({left: 0}, {queue: false, duration: 300});
       });
       $(function () {
           // The parameter are the selector for the container(s) of text in which you want replacement
           // and a URL pointing to your bibfile - mind the same origin policy...
           var zitator = new Zitator(".citing", "//2016.igem.org/wiki/images/5/53/T--Slovenia--references.txt");
           zitator.zitiere();
       });
       function isScrolledIntoView(elem) {
           var docViewTop = $(window).scrollTop();
           var docViewBottom = docViewTop + $(window).height() - $("#menucomb").height();
           var elemTop = $(elem).offset().top;
           var elemBottom = elemTop + $(elem).height();
           if (elemTop >= docViewTop) {
               return true;
           }
           else if (elemBottom >= docViewBottom) {
               return true;
           }
           return false; // || elemTop >= docViewTop) ;
       }
       function clearStyleOfSideMenu() {
           //console.log("calling a function");
           var id = null;
           $("span.section.colorize").each(function () {
               var id = this.id;
               //console.log(id);
               var selector = 'a[href*="#'.concat(id).concat('"]');
               $(selector).css("color", "");
           });
           $("span.section.colorize").each(function() {
               var ident = this.id;
               console.log(ident);
               console.log(this);
               if(ident != "") {
                   var parent = (this.parentNode).parentNode;
                   if(isScrolledIntoView(parent)) {
                       var selector = 'a[href*="#'.concat(ident).concat('"]');
                       $(selector).css("color", "#DB2828");
                       console.log(selector);
                       return false;
                   }
               }
           });
           /*var color = true;
            $(".section").each(function () {
            //clear each parent
            var id = this.id;
            var selector = 'a[href*="#'.concat(id).concat('"]');
            if (isScrolledIntoView($(this).parent().parent())) {
            // nastavi barvo trenutni sekcij
            if(color) {
            console.log("section is found");
            color = false;
            return false; //break from function
            }
            }
            });*/
       }
       $(document).ready(function () {
               clearStyleOfSideMenu();
               $(window).scroll(function () {
                   clearStyleOfSideMenu();
               });
           }
       );
       $(".menuItem").mouseenter(
           function () {
               var loc = window.location.href;
               var defaultItem;
               var parent;
               $(".submenu").each(function () {
                       var context = this;
                       $("a", context).each(function () {
                           if (loc.match(/[^#]*/) == $(this).attr("href")) {
                               defaultItem = $(context).attr("id");
                               parent = $("#".concat(defaultItem.replace("Submenu", "")));
                           }
                       });
                   }
               );
               $(".ui.simple.item.menuItem a").each(function () {
                   if (loc.match(/[^#]*/) == $(this).attr("href")) {
                       parent = $($(this).parents('.ui.simple.item.menuItem'));
                       defaultItem = (parent.attr('id')).concat("Submenu");
                       //console.log(defaultItem);
                   }
               });
               defaultItem = document.getElementById(defaultItem);
               clearElements();
               var submenu = document.getElementById(this.id.concat("Submenu"));
               var submenuText = document.getElementById("SecondarySubmenu");
               if (submenuText.innerHTML != submenu.innerHTML) {
                   this.className = "ui simple active item menuItem";
                   submenuText.innerHTML = submenu.innerHTML;
               }
               else {
                   parent.attr("class", "ui simple active item menuItem");
                   submenuText.innerHTML = defaultItem.innerHTML;
               }
           }
       );
       $("#menucomb").mouseleave(function () {
               setDefaultMenu();
           }
       );
   } catch (e) {
       //console.log('startReloading');
       $.getScript("https://2016.igem.org/Team:Slovenia/libraries/semantic-min-js?action=raw&ctype=text/javascript", function () {
           //console.log('success');
           reloader();
       });
       //console.log('endReloading');
   }

} $(document).ready(injectHeader); $(document).ready(reloader); function enumerateKeys(object) {

   var numberPairs = {};
   var objectPairs = {};
   var number = 0;
   var matches = document.body.querySelectorAll(object + '[data-ref]');
   while (number < matches.length) {
       var refName = matches[number].dataset.ref;

console.log(refName); console.log(matches[number]);

       if (refName in numberPairs) {
           console.log(refName, "This label has already been assigned.");
       } else {
           numberPairs[number + 1] = matches[number];
           objectPairs[refName] = number + 1;
           console.log(refName);
       }
       number++;
   }
   return [numberPairs, objectPairs, number];

}

function enumerate() {

   var tables = enumerateKeys('table');
   var figures = enumerateKeys('figure');
   var maximum = Math.max(tables[2], figures[2]);
   for (var number = 1; number <= maximum; number++) {
       if (number in tables[0]) {
           $(tables[0][number]).children('caption').prepend("Table " + number + ": ")
       }
       if (number in figures[0]) {
           $(figures[0][number]).children('figcaption').prepend("Figure " + number + ": ")
       }
   }
   $(this).find('ref').each(function () {
       var label = $(this).text();
       $(this).click(function (event) {
           event.preventDefault();
       });
       if (label in tables[1]) {
           var number = tables[1][label];
           $(this).html("<a href=> Table " + tables[1][label] + " </a>");
           $(this).on('click', function () {
               window.scroll(0, $(tables[0][number]).offset().top - 150);
           })
       } else {
           var number = figures[1][label];
           $(this).html("<a href=>Figure " + figures[1][label] + "</a>");
           $(this).on('click', function () {
               window.scroll(0, $(figures[0][number]).offset().top - 150);
           })
       }
   });

} $(document).ready(enumerate); $(document).ready(setDefaultMenu); $(document).ready(function(){

   $('.ui.accordion').accordion();

});

function resize(img) {

   if (!(img.className.indexOf("big") >= 0)) {
       img.className = "ui big centered image";
       img.parentElement.parentElement.setAttribute("align-property", img.parentElement.parentElement.align);
       img.parentElement.parentElement.setAttribute("align", "center");
       img.parentElement.parentElement.setAttribute("data-property", img.parentElement.parentElement.style.cssText);
       img.parentElement.parentElement.style.cssText = "clear: both";
   }
   else {
       img.parentElement.parentElement.setAttribute("align", "");
       img.className = "ui image";
       img.parentElement.parentElement.style.cssText = img.parentElement.parentElement.getAttribute("data-property");
       img.parentElement.parentElement.align = img.parentElement.parentElement.getAttribute("align-property");
   }
   //scroll to image, (if two images are floated and the right one is resised, then the image gets pushed down)
   //var top = img.offsetTop;
   //console.log($(img).offset().top);
   //console.log($("menucomb").height());
   $(window).scrollTop($(img).offset().top -  $(window).height()/2 + $(img).height()/2);

}

function setDefaultMenu() {

   //console.log("calling set default item");
   clearElements();
   var loc = window.location.href;
   var defaultItem;
   var parent;
   $(".submenu").each(function () {
           var context = this;
           $(this).css("color", "#DB2828");
           $(this).css("font-weight", "bold");
           $("a", context).each(function () {
               //console.log($(this).attr("href"));
               if (loc.match(/[^#]*/) == $(this).attr("href")) {
                   defaultItem = $(context).attr("id");
                   parent = $("#".concat(defaultItem.replace("Submenu", "")));
                   $(this).css("color", "#DB2828");
                   $(this).css("font-weight", "bold");
               }
           });
       }
   );
   $(".ui.simple.item.menuItem a").each(function () {
       if (loc.match(/[^#]*/) == $(this).attr("href")) {
           parent = $($(this).parents('.ui.simple.item.menuItem'));
           defaultItem = (parent.attr('id')).concat("Submenu");
       }
   });
   var submenuText = document.getElementById("SecondarySubmenu");
   defaultItem = document.getElementById(defaultItem);
   parent.attr("class", "ui simple active item menuItem");
   submenuText.innerHTML = defaultItem.innerHTML;

}

function clearElements() {

   var elements = document.getElementsByClassName("menuItem");
   for (var i = 0; i < elements.length; i++) {
       elements[i].className = "ui simple item menuItem";
   }

}

function injectHeader() {

   //console.log("Injecting header");
var menu = " \ \ \ \ \ \ \ \ \ \ \ \ ";
   var contextDiv = document.getElementById("context");
   contextDiv.innerHTML = menu.concat(contextDiv.innerHTML);	

var elements = document.getElementsByClassName("menuFix");

if(window.innerWidth < 768 ) { //phone console.log("small screen"); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute("style", "font-size:5px;"); } } else if(window.innerWidth < 800) { //small screen console.log("small screen"); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute("style", "font-size:7px;"); } } else if(window.innerWidth < 980) { //medium screen console.log("small screen"); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute("style", "font-size:9px;"); } } else if(window.innerWidth < 1280) { //normal console.log("small screen"); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute("style", "font-size:11px;"); } } console.log("end of injecting"); }

$('.playGif').on('click', function () {

   //console.log("play detected");
   var parent = $(this);
   var parAlt = parent.attr('data-alt');
   var parSrc = parent.attr('src');
   parent.attr("src", parAlt).attr("data-alt", parSrc);

}); function relativeCoords() {

   console.log("what what");
   var img = document.getElementById("projectScheme");
   var c1 = [74, 132, 136, 217, 241, 225, 319, 175, 365, 89, 298, 42, 152, 62];
   var c2 =  [387, 125, 393, 283, 423, 316, 518, 190, 486, 120];
   var c3 = [528, 77, 497, 134, 537, 173, 672, 185, 739, 145, 733, 94, 694, 71];
   var c4 = [393, 283, 423, 316, 454, 300, 474, 260, 537, 273, 494, 305, 678, 285, 697, 243, 788, 239, 788, 330, 383, 374, 343, 319];
   for(i = 0; i < c1.length; i++) {
       c1[i] = (c1[i]/(800.0)*img.clientWidth);
   }
   document.getElementById("area1").coords = c1.toString();
   for(i = 0; i < c2.length; i++) {
       c2[i] = (c2[i]/(800.0)*img.clientWidth);
   }
   document.getElementById("area2").coords = c2.toString();
   for(i = 0; i < c3.length; i++) {
       c3[i] = (c3[i]/(800.0)*img.clientWidth);
   }
   document.getElementById("area3").coords = c3.toString();
   for(i = 0; i < c4.length; i++) {
       c4[i] = (c4[i]/(800.0)*img.clientWidth);
   }
   document.getElementById("area4").coords = c4.toString();

}

function relativeCoordsStar() {

   var img = document.getElementById("starScheme");

var c1 = [254, 239, 194, 163, 225, 51, 319, 163]; var c2 = [260, 242, 323, 170, 452, 193, 363, 288]; var c3 = [260, 249, 362, 295, 389, 433, 260, 369]; var c4 = [252, 246, 252, 369, 131, 426, 150, 294]; var c5 = [250, 242, 147, 288, 55, 192, 187, 169];

   for(i = 0; i < c1.length; i++) {
       c1[i] = (c1[i]/(515.0)*img.clientWidth);
   }
   document.getElementById("patients").coords = c1.toString();
   for(i = 0; i < c2.length; i++) {
       c2[i] = (c2[i]/(515.0)*img.clientWidth);
   }
   document.getElementById("scientists").coords = c2.toString();
   for(i = 0; i < c3.length; i++) {
       c3[i] = (c3[i]/(515.0)*img.clientWidth);
   }
   document.getElementById("iGEMers").coords = c3.toString();
   for(i = 0; i < c4.length; i++) {
       c4[i] = (c4[i]/(515.0)*img.clientWidth);
   }
   document.getElementById("researches").coords = c4.toString();
   for(i = 0; i < c5.length; i++) {
       c5[i] = (c5[i]/(515.0)*img.clientWidth);
   }
   document.getElementById("doctors").coords = c5.toString();	

}