Skip to content

Instantly share code, notes, and snippets.

@tcarlsen
Created April 16, 2014 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcarlsen/10859757 to your computer and use it in GitHub Desktop.
Save tcarlsen/10859757 to your computer and use it in GitHub Desktop.
top.js
$(document).ready(function () {
var location = window.location.href;
var hashtag = (location.split('#/')[1] || 'sofie/start').split('/');
var page = hashtag[1];
if (hashtag[0] !== 'sofie') {
page = 'start';
}
// * Home button * //
var home = $('<home />')
.css({
'position': 'absolute',
'left': '343px',
'font-family': 'b-sans-r',
'top': '67px',
'background': '#FFF',
'border-radius': '10px',
'padding': '2px 7px 4px 7px',
'border': 'solid',
'border-width': '1px',
'border-color': 'rgb(215, 25, 32)',
'cursor': 'pointer'
})
.html("Tilbage til Sofies hjem ")
.bind('click', function (e) {
e.preventDefault();
$('#graphicFrame')
.contents()
.find('content')
.animate({
'opacity': '0'
}, 300, 'linear', function () {
$('#graphicFrame')
.contents()
.find('.start')
.css({
'opacity': '1'
});
// * Check for active video * //
if ($('#graphicFrame').contents().find('.video-forbrug').length > 0) {
$('#graphicFrame').contents().find('videoStop').trigger('click');
}
if ($('#graphicFrame').contents().find('.video-facebook').length > 0) {
$('#graphicFrame').contents().find('videoStop').trigger('click');
}
/*clearInterval($('#graphicFrame').contents().find('animtePath'));
$('#graphicFrame').contents().find('.running').empty();*/
$('#graphicFrame').on('load', function () {
this.contentWindow.fuck();
});
$('#graphicFrame').contents().find('svg').trigger('click');
$('#graphicFrame').contents().find('.running').empty();
$('#graphicFrame').attr('src', 'index.html#start');
$('home')
.css({
'display': 'none',
'opacity': '0'
});
});
window.location.hash = '#/sofie/start';
});
$('#sofie-top')
.html('<img src="images/top/logo_top.png" width="329px" height="100px"/>')
.css({
'padding-left': '14px',
'padding-bottom': '5px',
'padding-top': '5px',
'background-image': 'url("images/top/top_back.png")',
'width': '926px',
'border-bottom': 'solid',
'border-bottom-width': '2px',
'border-bottom-color': 'rgb(215, 25, 32)'
})
.prepend(home);
if (page === 'start') {
home.hide();
}
$('#sofie-frame')
.html('<iframe id="graphicFrame" src="index.html#' + page + '" width="940" height="700" scrolling="no" frameborder="0" data-infogfx="Klik her for at se infografikken"></iframe>');
$('body').css({
'margin': '0px'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment