static pages and loader for chapter an static pages

This commit is contained in:
Bachir Soussi Chiadmi
2015-03-24 18:52:21 +01:00
parent ea6cdaa6e7
commit c5e1e193e7
12 changed files with 817 additions and 238 deletions
+65 -17
View File
@@ -12,7 +12,7 @@
jQuery(document).ready(function($) {
console.log('Hello Jee');
var _debug = false,
var _debug = true,
_avgDelay = 1,
_lastDraw = new Date,
_fps,
@@ -41,6 +41,12 @@ jQuery(document).ready(function($) {
var _bubbles = new Array(),
_stars = new Array();
var _$footer = $('#footer'),
_$static_wrapper = $('<div><div class="inner"></div></div>').attr('id', 'static-wrapper').appendTo(_$container),
_$close_static = $('<div>').addClass('close').appendTo(_$static_wrapper);
_loaded_static = false;
var _$loader = $('<div>').attr('id','loader').appendTo(_$body);
function init(){
if(_debug)
@@ -48,6 +54,7 @@ jQuery(document).ready(function($) {
initChapterWrapper();
initChapters();
initStaticLinks();
launchNav();
// FULL SCREEN
@@ -61,17 +68,17 @@ jQuery(document).ready(function($) {
};
// create stars
for (var i = 20; i > 0; i--) {
_stars.push(
$('<div>')
.addClass('star star-'+i)
.css({
left:randB(-400, _container.w+400),
top:randB(-400, _container.h+400)
})
.prependTo(_$container)
);
};
// for (var i = 20; i > 0; i--) {
// _stars.push(
// $('<div>')
// .addClass('star star-'+i)
// .css({
// left:randB(-400, _container.w+400),
// top:randB(-400, _container.h+400)
// })
// .prependTo(_$container)
// );
// };
};
function initDebug(){
@@ -135,7 +142,7 @@ jQuery(document).ready(function($) {
console.log('document mousedown');
clearTimeout(_timeout_dragging);
if(_loaded_chapter)
if(_loaded_chapter || _loaded_static)
return false;
// set initial cursor pos
@@ -157,7 +164,7 @@ jQuery(document).ready(function($) {
.bind('mouseup', function(e){
console.log('document mouseup');
if(_loaded_chapter)
if(_loaded_chapter || _loaded_static)
return false;
stopMoveNav();
@@ -179,7 +186,7 @@ jQuery(document).ready(function($) {
console.log('touchstart');
clearTimeout(_timeout_dragging);
if(_loaded_chapter)
if(_loaded_chapter || _loaded_static)
return false;
// set initial pos
@@ -194,7 +201,7 @@ jQuery(document).ready(function($) {
.bind('touchmove', function(e){
console.log('document touchmove');
if(_loaded_chapter)
if(_loaded_chapter || _loaded_static)
return false;
updateNavPos(e.originalEvent.touches[0].clientX, e.originalEvent.touches[0].clientY, false);
@@ -202,7 +209,7 @@ jQuery(document).ready(function($) {
.bind('touchend', function(e){
console.log("document touchend");
if(_loaded_chapter)
if(_loaded_chapter || _loaded_static)
return false;
stopMoveNav();
@@ -303,6 +310,43 @@ jQuery(document).ready(function($) {
if(_loaded_chapter)
setTimeout(_loaded_chapter.buildVideos(), 100);
};
function initStaticLinks(){
$('ul.menu a', _$footer).on('click', onClickStaticLink);
_$close_static.on('click', onCloseStatic);
};
function onClickStaticLink(e){
e.preventDefault();
_$static_wrapper.removeClass('visible');
loadStaticContent($(this).attr("href"));
_$body.addClass('loading');
_loaded_static = true;
return false;
};
function loadStaticContent(h){
$.getJSON(
'/jee/static',
{"href":h},
onStaticLoaded
);
};
function onStaticLoaded(data, textstatus){
console.log('data',data);
displayStatic(data.node);
};
function displayStatic(node){
_$static_wrapper.addClass('visible').find('.inner').html(node);
_$body.removeClass('loading');
};
function onCloseStatic(e){
_$static_wrapper.removeClass('visible');
};
/*
________ __
/ ____/ /_ ____ _____ / /____ _____
@@ -635,6 +679,8 @@ jQuery(document).ready(function($) {
Chapter.prototype.loadNode = function(e){
// console.log("Chapter :: open : nid", this.nid);
_$body.addClass('loading');
$.getJSON(
'/jee/chapter/'+this.nid,
{},
@@ -685,6 +731,8 @@ jQuery(document).ready(function($) {
_$chapter_wrapper.addClass('visible');
// this.$vids.eq(this.cur_vid_playing).vimeo('play');
_$body.removeClass('loading');
};
Chapter.prototype.placeText = function(i, e){