// Global variables var OldId = 0; function showMain() { $('#entrypage').fadeOut(); $('#bgvideo').fadeOut("slow"); $('#mainwrapper').fadeIn("slow"); $('#bgvideo').trigger('pause'); } function showVideo() { $('#mainwrapper').fadeOut("slow"); $('#bgvideo').trigger('play'); $('#bgvideo').fadeIn(); $('#entrypage').fadeIn("slow"); } function showInfoboxContent(show) { if ($('#infobox-action').text() == 'Vis mindre' && show == undefined) { $('#infobox').animate({'height': '90px'}); $('#infobox-text').fadeOut('slow'); $('#infobox-action').text('Vis mer'); } else { $('#infobox-action').text('Vis mindre'); $('#infobox').animate({'height': '500px'}); $('#infobox-text').fadeIn('slow'); } } function updateProject(Id, svgLayerId, obj) { if (Id == OldId) { // Remove selected class $(obj).removeClass('project-selected'); // Hide svg layer if (svgLayerId !== "") { $('#' + svgLayerId)[0].setAttribute('style', 'display: none'); }; // Blank infobox and reset size $('#infobox').animate({'height': '5px'}); $('#infobox-text').fadeOut('slow'); $('#infobox-action').text('Les mer'); $('#infobox-action').hide(); $('#infobox-title').text(''); $('#infobox-ingress').text(''); $('#infobox-text').html(''); // Blank old id OldId = 0; } else { $('.role-selected').removeClass('role-selected'); $(obj).addClass('project-selected'); $('#infobox-title').text($('#title' + Id)[0].innerHTML); $('#infobox-ingress').text($('#ingress' + Id)[0].innerHTML); $('#infobox-text').html($('#text' + Id)[0].innerHTML); $('#infobox-action').show(); if ($('#infobox').css('height') == "5px") { $('#infobox').animate({'height': '90px'}); }; if (svgLayerId !== "") { $('#' + svgLayerId)[0].setAttribute('style', 'display: inline'); }; // Sett id to old id OldId = Id; } } function updateRole(Id, obj) { if (Id == OldId) { // Remove selected class $(obj).removeClass('role-selected'); // Blank infobox and reset size $('#infobox').animate({'height': '5px'}); $('#infobox-text').fadeOut('slow'); $('#infobox-action').text('Les mer'); $('#infobox-action').hide(); $('#infobox-title').text(''); $('#infobox-ingress').text(''); $('#infobox-text').html(''); // Blank old id OldId = 0; } else { $('.role-selected').removeClass('role-selected'); $(obj).addClass('role-selected'); $('#infobox-title').text($('#title' + Id)[0].innerHTML); $('#infobox-ingress').text($('#ingress' + Id)[0].innerHTML); $('#infobox-text').html($('#text' + Id)[0].innerHTML); $('#infobox-action').show(); showInfoboxContent("true"); // Sett id to old id OldId = Id; } } function updateTimeline(Id) { $('#infobox-title').text($('#title' + Id)[0].innerHTML); $('#infobox-ingress').text($('#ingress' + Id)[0].innerHTML); $('#infobox-text').html($('#text' + Id)[0].innerHTML); $('#infobox-action').show(); showInfoboxContent("true"); } function toggleVideo(obj) { $('#toggleVideo').toggleClass("play pause"); if ($('#toggleVideo').attr('class') == "play") { $('#bgvideo').trigger('pause'); } else { $('#bgvideo').trigger('play'); }; } /* IE SVG Modification */ function detectIE() { var ua = window.navigator.userAgent; var msie = ua.indexOf('MSIE '); if (msie > 0) { // IE 10 or older => return version number return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); } var trident = ua.indexOf('Trident/'); if (trident > 0) { // IE 11 => return version number var rv = ua.indexOf('rv:'); return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); } var edge = ua.indexOf('Edge/'); if (edge > 0) { // Edge (IE 12+) => return version number return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); } // other browser return false; } $(document).ready(function() { // Hack to resize SVG on IE9 - IE11 var IE = detectIE(); if (IE<12 && IE !== false) { var svgHeight = window.innerWidth * 0.416; $('#svg3788')[0].setAttribute("width", window.innerWidth); $('#svg3788')[0].setAttribute("height", svgHeight); }; })