Fix window popstate
This commit is contained in:
parent
01bb50fdec
commit
82874d33a1
|
@ -190,30 +190,39 @@ var galleryAPI = function(){
|
||||||
$(".slidectrl .browserfullscreen").show();
|
$(".slidectrl .browserfullscreen").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.onpopstate = function(){
|
||||||
|
var image_id = document.URL.split('/')[document.URL.split('/').length-1];
|
||||||
|
var image = imageArray.filter(function(a){return a._id == image_id})[0];
|
||||||
|
imagecount = imageArray.indexOf(image);
|
||||||
|
changeTheaterImage(image.file.theater.url);
|
||||||
|
}
|
||||||
var changeImage = function(dom){
|
var changeImage = function(dom){
|
||||||
var pageurl = dom.attr('href');
|
var pageurl = dom.attr('href');
|
||||||
|
|
||||||
|
if(rcom.getInternetExplorerVersion() == -1){
|
||||||
|
if(pageurl!=window.location){
|
||||||
|
window.history.pushState({path:pageurl},'',pageurl);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
window.location.hash = pageurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
changeTheaterImage(dom.attr("data-content"));
|
||||||
|
}
|
||||||
|
var changeTheaterImage = function(url){
|
||||||
$img.fadeOut(200,function(){
|
$img.fadeOut(200,function(){
|
||||||
g.loadstart();
|
g.loadstart();
|
||||||
$img.attr("src","");
|
$img.attr("src","");
|
||||||
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"}).load(function(){
|
$img.attr({"src":url,"height":picHeight+"px"}).load(function(){
|
||||||
$img.fadeIn(200);
|
$img.fadeIn(200);
|
||||||
g.loadcomplete();
|
g.loadcomplete();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if($rslide.hasClass("fullscreen")){
|
if($rslide.hasClass("fullscreen")){
|
||||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||||
}
|
}
|
||||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||||
$slidelist.find("ul").hide();
|
$slidelist.find("ul").hide();
|
||||||
if(rcom.getInternetExplorerVersion() == -1){
|
|
||||||
if(pageurl!=window.location){
|
|
||||||
window.history.pushState({path:pageurl},'',pageurl);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
window.location.hash = pageurl;
|
|
||||||
}
|
|
||||||
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||||
if($('.bt-tag').hasClass("active"))
|
if($('.bt-tag').hasClass("active"))
|
||||||
updatePhotoTag();
|
updatePhotoTag();
|
||||||
|
@ -224,7 +233,6 @@ var galleryAPI = function(){
|
||||||
if(imageArray.length > 1)
|
if(imageArray.length > 1)
|
||||||
updateNavigation();
|
updateNavigation();
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
var updateNavigation = function(){
|
var updateNavigation = function(){
|
||||||
var next, prev;
|
var next, prev;
|
||||||
|
@ -269,7 +277,7 @@ var galleryAPI = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
var albumid = $("#main_pic").attr("data-content");
|
var albumid = $("#main_pic").attr("data-content");
|
||||||
g.albumArea.find(".bt-back").attr("href","../galleries/"+albumid);
|
g.albumArea.find(".bt-back").attr("href",'/'+g.locale+"/admin/galleries/"+albumid);
|
||||||
g.albumArea.find(".bt-edit").attr("href","../albums/"+albumid+"/edit");
|
g.albumArea.find(".bt-edit").attr("href","../albums/"+albumid+"/edit");
|
||||||
g.albumArea.css("margin-bottom","0");
|
g.albumArea.css("margin-bottom","0");
|
||||||
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
||||||
|
|
|
@ -159,19 +159,39 @@ var galleryAPI = function(){
|
||||||
$(".slidectrl .browserfullscreen").show();
|
$(".slidectrl .browserfullscreen").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.onpopstate = function(){
|
||||||
|
var image_id = window.location.pathname.split('/')[window.location.pathname.split('/').length-1].split('-');
|
||||||
|
var image = imageArray.filter(function(a){return a._id == image_id[1]})[0];
|
||||||
|
imagecount = imageArray.indexOf(image);
|
||||||
|
changeTheaterImage(image.file.theater.url);
|
||||||
|
}
|
||||||
var changeImage = function(dom){
|
var changeImage = function(dom){
|
||||||
var pageurl = dom.attr('href');
|
var pageurl = dom.attr('href');
|
||||||
|
|
||||||
|
if(rcom.getInternetExplorerVersion() == -1){
|
||||||
|
if(pageurl!=window.location){
|
||||||
|
var segments = window.location.pathname.split("/"),
|
||||||
|
uid = segments[segments.length-1];
|
||||||
|
pageurl = window.location.pathname.replace(uid,"-"+pageurl)+"?method=theater";
|
||||||
|
window.history.pushState({path:pageurl},'',pageurl);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
window.location.hash = pageurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
changeTheaterImage(dom.attr("data-content"));
|
||||||
|
}
|
||||||
|
var changeTheaterImage = function(url){
|
||||||
$img.fadeOut(200,function(){
|
$img.fadeOut(200,function(){
|
||||||
g.loadstart();
|
g.loadstart();
|
||||||
if($rslide.hasClass("fullscreen")){
|
if($rslide.hasClass("fullscreen")){
|
||||||
|
|
||||||
$img.attr({"src":dom.attr("data-content")}).css("height","100%").load(function(){
|
$img.attr({"src":url}).css("height","100%").load(function(){
|
||||||
g.loadcomplete();
|
g.loadcomplete();
|
||||||
$img.fadeIn(200);
|
$img.fadeIn(200);
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
$img.attr({"src":dom.attr("data-content")}).css("height","auto").load(function(){
|
$img.attr({"src":url}).css("height","auto").load(function(){
|
||||||
g.loadcomplete();
|
g.loadcomplete();
|
||||||
$img.fadeIn(200);
|
$img.fadeIn(200);
|
||||||
});;
|
});;
|
||||||
|
@ -181,16 +201,6 @@ var galleryAPI = function(){
|
||||||
}
|
}
|
||||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||||
$slidelist.find("ul").hide();
|
$slidelist.find("ul").hide();
|
||||||
if(rcom.getInternetExplorerVersion() == -1){
|
|
||||||
if(pageurl!=window.location){
|
|
||||||
var segments = window.location.pathname.split("/"),
|
|
||||||
uid = segments[segments.length-1];
|
|
||||||
pageurl = window.location.pathname.replace(uid,"-"+pageurl)+"?method=theater";
|
|
||||||
window.history.pushState({path:pageurl},'',pageurl);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
window.location.hash = pageurl;
|
|
||||||
}
|
|
||||||
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||||
updatePhotoTag();
|
updatePhotoTag();
|
||||||
if(imageArray[imagecount].description)
|
if(imageArray[imagecount].description)
|
||||||
|
|
Loading…
Reference in New Issue