|
@@ -31,6 +31,7 @@ $(document).ready(function() {
|
|
initRailway();
|
|
initRailway();
|
|
initkeyboard();
|
|
initkeyboard();
|
|
initPagination();
|
|
initPagination();
|
|
|
|
+ initHashNav();
|
|
changePages();
|
|
changePages();
|
|
};
|
|
};
|
|
|
|
|
|
@@ -147,50 +148,40 @@ $(document).ready(function() {
|
|
if(typeof _ACTIVE_PAGES[_current_dp_key] !== "undefined"){
|
|
if(typeof _ACTIVE_PAGES[_current_dp_key] !== "undefined"){
|
|
_current_dp_ob = _ACTIVE_PAGES[_current_dp_key];
|
|
_current_dp_ob = _ACTIVE_PAGES[_current_dp_key];
|
|
|
|
|
|
- if (typeof _current_dp_ob[0].bg !== "undefined") {
|
|
+ updatePagesDisplay();
|
|
- var pl = _current_dp_ob[0];
|
|
+ updatePaginationDisplay();
|
|
-
|
|
+ updateRailwayDisplay();
|
|
- _$page_left
|
|
+ updateHash();
|
|
- .css({'background-image': "url("+_bgs_prefix+pl.bg+")"})
|
|
+ updatePagesOverlays();
|
|
- .removeClass(pageClassToRemove)
|
|
+ }
|
|
- .addClass('page-'+pl.page);
|
|
+ };
|
|
-
|
|
|
|
- _$pagi_l_txt.text(pl.page);
|
|
|
|
- }else{
|
|
|
|
- _$page_left.css({'background-image': "none"});
|
|
|
|
- _$pagi_l_txt.text("");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (typeof _current_dp_ob[1].bg !== "undefined") {
|
|
|
|
- var pr = _current_dp_ob[1];
|
|
|
|
- _$page_right
|
|
|
|
- .css({'background-image': "url("+_bgs_prefix+pr.bg+")"})
|
|
|
|
- .removeClass(pageClassToRemove)
|
|
|
|
- .addClass('page-'+pr.page);
|
|
|
|
- _$pagi_r_txt.text(pr.page);
|
|
|
|
- }else{
|
|
|
|
- _$page_right.css({'background-image': "none"});
|
|
|
|
- _$pagi_r_txt.text("");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var i = _active_pages_keys.indexOf(_current_dp_key);
|
|
|
|
- if( i == 0){
|
|
|
|
- _$pagi_l_arrow.addClass('hidden');
|
|
|
|
- }else{
|
|
|
|
- _$pagi_l_arrow.removeClass('hidden')
|
|
|
|
- }
|
|
|
|
- if(i == _active_pages_keys.length-1){
|
|
|
|
- _$pagi_r_arrow.addClass('hidden');
|
|
|
|
- }else{
|
|
|
|
- _$pagi_r_arrow.removeClass('hidden')
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ function updatePagesDisplay(){
|
|
|
|
+ if (typeof _current_dp_ob[0].bg !== "undefined") {
|
|
|
|
+ var pl = _current_dp_ob[0];
|
|
|
|
+
|
|
|
|
+ _$page_left
|
|
|
|
+ .css({'background-image': "url("+_bgs_prefix+pl.bg+")"})
|
|
|
|
+ .removeClass(pageClassToRemove)
|
|
|
|
+ .addClass('page-'+pl.page);
|
|
|
|
+
|
|
|
|
+ _$pagi_l_txt.text(pl.page);
|
|
|
|
+ }else{
|
|
|
|
+ _$page_left.css({'background-image': "none"});
|
|
|
|
+ _$pagi_l_txt.text("");
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
+ if (typeof _current_dp_ob[1].bg !== "undefined") {
|
|
- $('li.double-page-'+_current_dp_key).addClass('current');
|
|
+ var pr = _current_dp_ob[1];
|
|
|
|
+ _$page_right
|
|
|
|
+ .css({'background-image': "url("+_bgs_prefix+pr.bg+")"})
|
|
|
|
+ .removeClass(pageClassToRemove)
|
|
|
|
+ .addClass('page-'+pr.page);
|
|
|
|
+ _$pagi_r_txt.text(pr.page);
|
|
|
|
+ }else{
|
|
|
|
+ _$page_right.css({'background-image': "none"});
|
|
|
|
+ _$pagi_r_txt.text("");
|
|
}
|
|
}
|
|
-
|
|
|
|
};
|
|
};
|
|
|
|
|
|
function pageClassToRemove(){
|
|
function pageClassToRemove(){
|
|
@@ -199,40 +190,100 @@ $(document).ready(function() {
|
|
return c[0];
|
|
return c[0];
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ function updatePaginationDisplay(){
|
|
|
|
+
|
|
|
|
+ var i = _active_pages_keys.indexOf(_current_dp_key);
|
|
|
|
+ if( i == 0){
|
|
|
|
+ _$pagi_l_arrow.addClass('hidden');
|
|
|
|
+ }else{
|
|
|
|
+ _$pagi_l_arrow.removeClass('hidden')
|
|
|
|
+ }
|
|
|
|
+ if(i == _active_pages_keys.length-1){
|
|
|
|
+ _$pagi_r_arrow.addClass('hidden');
|
|
|
|
+ }else{
|
|
|
|
+ _$pagi_r_arrow.removeClass('hidden')
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ function updateRailwayDisplay(){
|
|
|
|
+
|
|
|
|
+ $('li.double-page-'+_current_dp_key).addClass('current');
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
function updatePagesOverlays(){
|
|
function updatePagesOverlays(){
|
|
console.log("updatePagesOverlays");
|
|
console.log("updatePagesOverlays");
|
|
|
|
|
|
|
|
|
|
- $('.overlay, .maps',_$page_left).children().remove();
|
|
+ resetOverlays();
|
|
- $('.overlay, .maps',_$page_right).children().remove();
|
|
+
|
|
-
|
|
+
|
|
- console.log("Overlays", _ACTIVE_PAGES[_current_dp_key].overlays);
|
|
+ var lr = 0,
|
|
-
|
|
+ p_ob,
|
|
- for (var map in _ACTIVE_PAGES[_current_dp_key].overlays) {
|
|
+ $p,
|
|
- if (_ACTIVE_PAGES[_current_dp_key].overlays.hasOwnProperty(map)) {
|
|
+ map;
|
|
- map = _ACTIVE_PAGES[_current_dp_key].overlays[map];
|
|
+ for(var i in _current_dp_ob){
|
|
- console.log("Map",map);
|
|
+ p_ob = _current_dp_ob[i];
|
|
- _$maps_left.append(
|
|
+ console.log("p_ob", p_ob);
|
|
|
|
+
|
|
|
|
+ $p = lr == 0 ? _$maps_left : _$maps_right;
|
|
|
|
+
|
|
|
|
+ for(var m in p_ob.overlays){
|
|
|
|
+ map = p_ob.overlays[m];
|
|
|
|
+ console.log('map', map);
|
|
|
|
+ $p.append(
|
|
$('<div>')
|
|
$('<div>')
|
|
.addClass("map")
|
|
.addClass("map")
|
|
.attr('overlay', map.over)
|
|
.attr('overlay', map.over)
|
|
|
|
+ .attr('debug', map.debug)
|
|
.css({
|
|
.css({
|
|
- "left":map.x,
|
|
+ "left":map.x+"mm",
|
|
- "top":map.y,
|
|
+ "top":map.y+"mm",
|
|
- "width":map.w,
|
|
+ "width":map.w+"mm",
|
|
- "height":map.h
|
|
+ "height":map.h+"mm"
|
|
})
|
|
})
|
|
.bind("mouseover", function(e){
|
|
.bind("mouseover", function(e){
|
|
$(this)
|
|
$(this)
|
|
.parents('.page').find('.overlay')
|
|
.parents('.page').find('.overlay')
|
|
.css({
|
|
.css({
|
|
-
|
|
+ 'background-image':'url(images/overlays/'+$(this).attr('overlay')+')'
|
|
- 'background-image':'url(images/vectos/'+$(this).attr('overlay')+')'
|
|
|
|
});
|
|
});
|
|
})
|
|
})
|
|
|
|
+ .bind("mouseout", function(e){
|
|
|
|
+ $(this)
|
|
|
|
+ .parents('.page').find('.overlay')
|
|
|
|
+ .css({'background-image':'none'});
|
|
|
|
+ })
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+ lr++;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ function resetOverlays(){
|
|
|
|
+ $('.overlay, .maps','.page').css({'background-image':'none'}).children().remove();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ function initHashNav(){
|
|
|
|
+ h = window.location.hash;
|
|
|
|
+ console.log('hash',h);
|
|
|
|
+ _current_dp_key = h.match(/^#(\d+)$/)[1];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function updateHash(){
|
|
|
|
+ window.location.hash = _current_dp_key;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|