(Created page with "function reloader() { try { console.log('start'); $('.ui.sticky.global').sticky({ context: '#context', offset: 0.25 });...") |
Zigapusnik (Talk | contribs) |
||
Line 1: | Line 1: | ||
+ | // вики е едно глупо нешто и затоа не работи ништо како што би требало: | ||
+ | // има мана што често не ја наоѓа функцијата стики и затоа после секој џаваскрипт | ||
+ | // исклучок, повторно пробуваме да го вчитаме шаблонот | ||
function reloader() { | function reloader() { | ||
try { | try { | ||
Line 34: | Line 37: | ||
// The parameter are the selector for the container(s) of text in which you want replacement | // 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... | // and a URL pointing to your bibfile - mind the same origin policy... | ||
− | var zitator = new Zitator(".citing", "// | + | var zitator = new Zitator(".citing", "//igem2016.fri.uni-lj.si/img_auth.php/1/17/References.txt"); |
zitator.zitiere(); | 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() { | |
− | + | var id = null; | |
− | + | $(".section").each(function () { | |
− | + | var id = $(this).attr('id'); | |
− | + | var selector = 'a[href*="#'.concat(id).concat('"]'); | |
− | + | $(selector).css("color", ""); | |
− | + | }); | |
− | + | $(".section").each(function () { | |
− | + | //clear each parent | |
− | + | var id = $(this).attr('id'); | |
− | + | var selector = 'a[href*="#'.concat(id).concat('"]'); | |
− | + | if (isScrolledIntoView($(this).parent().parent())) { | |
− | + | console.log($(this).attr("id")); | |
− | + | //nastavi barvo trenutni sekciji | |
− | + | $(selector).css("color", "#DB2828"); | |
− | + | return false; //break from function | |
− | + | } | |
− | + | }); | |
− | + | } | |
− | + | $(document).ready(function () { | |
− | + | clearStyleOfSideMenu(); | |
− | + | $(window).scroll(function () { | |
− | + | clearStyleOfSideMenu(); | |
− | + | }); | |
− | + | } | |
− | + | ); | |
− | + | ||
− | + | ||
$(".menuItem").mouseenter( | $(".menuItem").mouseenter( | ||
function () { | function () { | ||
Line 88: | Line 89: | ||
var context = this; | var context = this; | ||
$("a", context).each(function () { | $("a", context).each(function () { | ||
− | if (loc.match(/[^#]*/) == $(this).attr("href")) { | + | if (loc.match(/[^#]*/) == $(this).attr("href")) { |
defaultItem = $(context).attr("id"); | defaultItem = $(context).attr("id"); | ||
− | parent = $("#".concat(defaultItem.replace("Submenu", ""))); | + | parent = $("#".concat(defaultItem.replace("Submenu", ""))); |
} | } | ||
}); | }); | ||
Line 99: | Line 100: | ||
parent = $($(this).parents('.ui.simple.item.menuItem')); | parent = $($(this).parents('.ui.simple.item.menuItem')); | ||
defaultItem = (parent.attr('id')).concat("Submenu"); | defaultItem = (parent.attr('id')).concat("Submenu"); | ||
− | + | console.log(defaultItem); | |
} | } | ||
}); | }); | ||
Line 122: | Line 123: | ||
} catch (e) { | } catch (e) { | ||
console.log('startReloading'); | console.log('startReloading'); | ||
− | $.getScript("https:// | + | $.getScript("https://igem2016.fri.uni-lj.si/index.php?title=Template:Slovenia/semantic.min.js&action=raw&ctype=text/javascript", function () { |
console.log('success'); | console.log('success'); | ||
reloader(); | reloader(); | ||
Line 138: | Line 139: | ||
var matches = document.body.querySelectorAll(object + '[data-ref]'); | var matches = document.body.querySelectorAll(object + '[data-ref]'); | ||
while (number < matches.length) { | while (number < matches.length) { | ||
+ | // for (var number = 0; number < matches.length; number++) { | ||
+ | //console.log("bla"); | ||
+ | //number++; | ||
var refName = matches[number].dataset.ref; | var refName = matches[number].dataset.ref; | ||
if (refName in numberPairs) { | if (refName in numberPairs) { | ||
Line 147: | Line 151: | ||
number++; | number++; | ||
} | } | ||
+ | // console.log(numberPairs); | ||
return [numberPairs, objectPairs, number]; | return [numberPairs, objectPairs, number]; | ||
} | } | ||
Line 154: | Line 159: | ||
var figures = enumerateKeys('figure'); | var figures = enumerateKeys('figure'); | ||
+ | // console.log(tables[2]); | ||
+ | // console.log(figures[2]); | ||
var maximum = Math.max(tables[2], figures[2]); | var maximum = Math.max(tables[2], figures[2]); | ||
Line 173: | Line 180: | ||
var number = tables[1][label]; | var number = tables[1][label]; | ||
$(this).html("<a href=''> Table " + tables[1][label] + " </a>"); | $(this).html("<a href=''> Table " + tables[1][label] + " </a>"); | ||
+ | // console.log($(tables[0][number]).offset()); | ||
$(this).on('click', function () { | $(this).on('click', function () { | ||
window.scroll(0, $(tables[0][number]).offset().top - 122); | window.scroll(0, $(tables[0][number]).offset().top - 122); | ||
Line 189: | Line 197: | ||
function resize(img) { | function resize(img) { | ||
− | + | if(img.className.includes("medium")) { | |
− | + | img.className = "ui huge image"; | |
− | + | } | |
− | + | else { | |
− | + | img.className = "ui medium image"; | |
− | + | } | |
} | } | ||
Line 204: | Line 212: | ||
$(".submenu").each(function () { | $(".submenu").each(function () { | ||
var context = this; | var context = this; | ||
− | + | $(this).css("color", "#DB2828"); | |
− | + | $(this).css("font-weight", "bold"); | |
$("a", context).each(function () { | $("a", context).each(function () { | ||
if (loc.match(/[^#]*/) == $(this).attr("href")) { | if (loc.match(/[^#]*/) == $(this).attr("href")) { | ||
defaultItem = $(context).attr("id"); | defaultItem = $(context).attr("id"); | ||
parent = $("#".concat(defaultItem.replace("Submenu", ""))); | parent = $("#".concat(defaultItem.replace("Submenu", ""))); | ||
− | + | $(this).css("color", "#DB2828"); | |
− | + | $(this).css("font-weight", "bold"); | |
} | } | ||
}); | }); | ||
− | + | ||
} | } | ||
); | ); | ||
Line 240: | Line 248: | ||
console.log("Injecting header"); | console.log("Injecting header"); | ||
var menu = "<div class='submenu' id='projectSubmenu'> \ | var menu = "<div class='submenu' id='projectSubmenu'> \ | ||
− | <div class='menu' style = 'position: absolute; left: 0'> \ | + | <div class='menu'> <!-- style = 'position: absolute; left: 0'> --> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Description' \ |
class='item'>Description</a> \ | class='item'>Description</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Design' \ |
class='item'>Design</a> \ | class='item'>Design</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Experiments' \ |
class='item'>Experiments</a> \ | class='item'>Experiments</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Results' \ |
class='item'>Results</a> \ | class='item'>Results</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Demonstrate' \ |
class='item'>Demonstration</a> \ | class='item'>Demonstration</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Proof' \ |
class='item'>Proof of Concept</a> \ | class='item'>Proof of Concept</a> \ | ||
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
− | <div class='submenu' id='partsSubmenu'> \ | + | <div class='submenu' id='partsSubmenu' position='relative;'> \ |
− | <div class='menu' style = 'position: absolute; | + | <div class='menu' style = 'position: absolute; right: 10%'> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Basic_Part' \ |
class='item'>Basic Part</a> \ | class='item'>Basic Part</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Composite_Part' \ |
class='item'>Composite part</a> \ | class='item'>Composite part</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Part_Collection' \ |
class='item'>Part Collection</a> \ | class='item'>Part Collection</a> \ | ||
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
− | <div class='submenu' id='notebookSubmenu'> \ | + | <div class='submenu' id='notebookSubmenu' style = 'position:relative;'> \ |
<!-- this is notebook submenu --> \ | <!-- this is notebook submenu --> \ | ||
− | <div class='menu' style = 'position: absolute; left: 50%'>\ | + | <div class='menu' style = 'position: absolute; right:10%'> <!-- style = 'position: absolute; left: 50%'> -->\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Notebook/Protocols' class='item'>Protocols</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Notebook/LogBook' class='item'>Log book</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Notebook/InitialProposals' class='item'>Initial proposals</a> \ |
</div>\ | </div>\ | ||
</div> \ | </div> \ | ||
− | <div class='submenu' id='societySubmenu'> \ | + | <div class='submenu' id='societySubmenu' style = 'position:relative;'> \ |
− | <div class='menu' style = 'position: absolute; right: 0'> \ | + | <div class='menu' style = 'position:absolute; right:0;'> <!-- style = 'position: absolute; right: 0'> -->\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Engagement' \ |
class='item'>Education and Public Engagement</a> \ | class='item'>Education and Public Engagement</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Integrated_Practices' \ |
class='item'>Integrated Practices</a> \ | class='item'>Integrated Practices</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Collaborations' \ |
class='item'>Collaboration</a> \ | class='item'>Collaboration</a> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Safety' \ |
class='item'>Safety</a> \ | class='item'>Safety</a> \ | ||
</div> \ | </div> \ | ||
Line 289: | Line 297: | ||
<div class='submenu' id='ideaSubmenu'> \ | <div class='submenu' id='ideaSubmenu'> \ | ||
<!-- this is idea submenu -->\ | <!-- this is idea submenu -->\ | ||
− | <div class='menu' style = 'position: absolute; left: 0'> \ | + | <div class='menu'> <!-- style = 'position: absolute; left: 0'> -->\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Idea/Challenge' class='item'>Challenge</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Idea/Solution' class='item'>Solution</a> \ |
+ | <!-- <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Requirements' class='item'>Medal requirements</a> -->\ | ||
</div>\ | </div>\ | ||
</div> \ | </div> \ | ||
<div class='submenu' id='mechanosensingSubmenu'> \ | <div class='submenu' id='mechanosensingSubmenu'> \ | ||
− | <div class='menu' style = 'position: absolute; left: 0'> \ | + | <div class='menu'> <!-- style = 'position: absolute; left: 0'> -->\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Overview' class='item'>Overview</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Mechanosensitive_channels' class='item'>Mechanosensitive channels</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Gas_vesicles' class='item'>Gas vesicles</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/CaDependent_mediator' class='item'>Ca-dependent mediator</a> \ |
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
− | <div class='submenu' id='implementationSubmenu'> \ | + | <div class='submenu' id='implementationSubmenu' style = 'position:relative;'> \ |
− | <div class='menu' style = 'position: absolute; right: | + | <div class='menu' style = 'position: absolute; right: 15%'> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Implementation/ProteaseInducible_secretion' class='item'>Protease inducible secretion</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Implementation/Impact' class='item'>Impact</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Implementation/Touch_painting' class='item'>Touch painting</a> \ |
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
<div class='submenu' id='proteaseSignallingSubmenu'> \ | <div class='submenu' id='proteaseSignallingSubmenu'> \ | ||
− | <div class='menu' style = 'position: absolute; left: 0' > \ | + | <div class='menu'> <!-- style = 'position: absolute; left: 0' > -->\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Protease_signalling/Overview' class='item'>Overview</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Protease_signalling/Reporters' class='item'>Reporters</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Protease_signalling/Orthogonality' class='item'>Orthogonality</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Protease_signalling/Split_proteases' class='item'>Split proteases</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Protease_signalling/LightDependentMediator' class='item'>Light-dependent mediator</a> \ |
+ | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing/Protease_signalling/Logic' class='item'>Logic</a> \ | ||
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
− | <div class='submenu' id='dryLabSubmenu'> \ | + | <div class='submenu' id='dryLabSubmenu' style = 'position:relative;'> \ |
− | <div class='menu' style = 'position: absolute; right: 30%'> \ | + | <div class='menu'> <!-- style = 'position: absolute; right: 30%'> -->\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/dryLab/Software' class='item'>CaPTURE software</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/dryLab/Hardware' class='item'>Ultrasound controlling device</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/dryLab/UltrasoundModel' class='item'>Modeling of ultrasound</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/dryLab/CCinteractions' class='item'>Modeling logic gates</a> \ |
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
− | <div class='submenu' id='teamSubmenu'> \ | + | <div class='submenu' id='teamSubmenu' style = 'position:relative;'> \ |
− | <div class='menu' style = 'position: absolute; right: 0'> \ | + | <div class='menu' style = 'position:absolute; right:0;'>\ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Students' class='item'>Students</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Advisors' class='item'>Advisors</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Attributions' class='item'>Attributions</a> \ |
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Sponsors' class='item'>Sponsors</a> \ |
</div> \ | </div> \ | ||
</div> \ | </div> \ | ||
Line 337: | Line 347: | ||
<div class='ui red secondary ten item pointing menu'> \ | <div class='ui red secondary ten item pointing menu'> \ | ||
<div class='ui simple item menuItem' id='home'> \ | <div class='ui simple item menuItem' id='home'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia' class='home'> \ |
Home \ | Home \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='idea'> \ | <div class='ui simple item menuItem' id='idea'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Idea' class='home'> \ |
Idea \ | Idea \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='mechanosensing'> \ | <div class='ui simple item menuItem' id='mechanosensing'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Mechanosensing' class='home'> \ |
Mechanosensing \ | Mechanosensing \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='proteaseSignalling'> \ | <div class='ui simple item menuItem' id='proteaseSignalling'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Protease_signalling' class='home'> \ |
Protease signaling\ | Protease signaling\ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<!-- <div class='ui simple item menuItem' id='project'> \ | <!-- <div class='ui simple item menuItem' id='project'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Project' class='home'> \ |
Project \ | Project \ | ||
</a> \ | </a> \ | ||
</div> -->\ | </div> -->\ | ||
<div class='ui simple item menuItem' id='dryLab'> \ | <div class='ui simple item menuItem' id='dryLab'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Dry_lab' class='home'> \ |
Dry lab \ | Dry lab \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='implementation'> \ | <div class='ui simple item menuItem' id='implementation'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Implementation' class='home'> \ |
Implementation \ | Implementation \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='parts' > \ | <div class='ui simple item menuItem' id='parts' > \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Parts' class='home'> \ |
Parts \ | Parts \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='notebook' > \ | <div class='ui simple item menuItem' id='notebook' > \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Notebook' class='home'> \ |
Notebook \ | Notebook \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='society'> \ | <div class='ui simple item menuItem' id='society'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Society' class='home'> \ |
Society \ | Society \ | ||
</a> \ | </a> \ | ||
</div> \ | </div> \ | ||
<div class='ui simple item menuItem' id='team'> \ | <div class='ui simple item menuItem' id='team'> \ | ||
− | <a href='https:// | + | <a href='https://igem2016.fri.uni-lj.si/index.php/Team:Slovenia/Team' class='home'> \ |
Team \ | Team \ | ||
</a> \ | </a> \ | ||
Line 400: | Line 410: | ||
} | } | ||
− | $('.playGif').on('click', function () { | + | $('.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); | |
}); | }); |
Revision as of 09:43, 14 October 2016
// вики е едно глупо нешто и затоа не работи ништо како што би требало: // има мана што често не ја наоѓа функцијата стики и затоа после секој џаваскрипт // исклучок, повторно пробуваме да го вчитаме шаблонот function reloader() {
try { console.log('start'); $('.ui.sticky.global').sticky({ context: '#context', offset: 0.25 }); $('.ui.sticky.image').sticky({ context: '#context', offset: 21 }); $('.ui.sticky.text.menu').sticky({ context: '#context', offset: 122 }); $('.ui.sticky.text').sticky({ context: '#context', offset: 122 }); $('.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", "//igem2016.fri.uni-lj.si/img_auth.php/1/17/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() { var id = null; $(".section").each(function () { var id = $(this).attr('id'); var selector = 'a[href*="#'.concat(id).concat('"]'); $(selector).css("color", ""); }); $(".section").each(function () { //clear each parent var id = $(this).attr('id'); var selector = 'a[href*="#'.concat(id).concat('"]'); if (isScrolledIntoView($(this).parent().parent())) { console.log($(this).attr("id")); //nastavi barvo trenutni sekciji $(selector).css("color", "#DB2828"); 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://igem2016.fri.uni-lj.si/index.php?title=Template:Slovenia/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) { // for (var number = 0; number < matches.length; number++) { //console.log("bla"); //number++; var refName = matches[number].dataset.ref; if (refName in numberPairs) { console.log(refName, "This label has already been assigned."); } else { numberPairs[number + 1] = matches[number]; objectPairs[refName] = number + 1; } number++; } // console.log(numberPairs); return [numberPairs, objectPairs, number];
}
function enumerate() {
var tables = enumerateKeys('table'); var figures = enumerateKeys('figure');
// console.log(tables[2]); // console.log(figures[2]); 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>"); // console.log($(tables[0][number]).offset()); $(this).on('click', function () { window.scroll(0, $(tables[0][number]).offset().top - 122); }) } 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 - 122); }) } });
} $(document).ready(enumerate); $(document).ready(setDefaultMenu);
function resize(img) { if(img.className.includes("medium")) { img.className = "ui huge image"; } else { img.className = "ui medium image"; } }
function setDefaultMenu() {
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 () { 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);
}
$('.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); });