use history.pushstate to preserve filters on page refresh
This commit is contained in:
parent
abfd9c355c
commit
22d4083c8c
1 changed files with 20 additions and 15 deletions
|
|
@ -37,7 +37,7 @@ $(document).ready(function(){
|
||||||
$("#aspect_stream_container").fadeTo(100, 0.4);
|
$("#aspect_stream_container").fadeTo(100, 0.4);
|
||||||
$("#aspect_contact_pictures").fadeTo(100, 0.4);
|
$("#aspect_contact_pictures").fadeTo(100, 0.4);
|
||||||
|
|
||||||
performAjax( $(this).attr('href'), $("#publisher textarea").val());
|
performAjax( $(this).attr('href'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#aspect_nav a.aspect_selector").click(function(e){
|
$("#aspect_nav a.aspect_selector").click(function(e){
|
||||||
|
|
@ -53,19 +53,8 @@ $(document).ready(function(){
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
listElement = $this.parent(),
|
listElement = $this.parent(),
|
||||||
guid = listElement.attr('data-guid'),
|
guid = listElement.attr('data-guid'),
|
||||||
post = $("#publisher textarea").val(),
|
homeListElement = $("#aspect_nav a.home_selector").parent();
|
||||||
homeListElement = $("#aspect_nav a.home_selector").parent(),
|
|
||||||
photos = {};
|
|
||||||
|
|
||||||
|
|
||||||
//pass photos
|
|
||||||
$('#photodropzone img').each(function(){
|
|
||||||
var img = $(this);
|
|
||||||
guid = img.attr('data-id');
|
|
||||||
url = img.attr('src');
|
|
||||||
photos[guid] = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
if( listElement.hasClass('selected') ){
|
if( listElement.hasClass('selected') ){
|
||||||
// remove filter
|
// remove filter
|
||||||
var idx = selectedGUIDS.indexOf( guid );
|
var idx = selectedGUIDS.indexOf( guid );
|
||||||
|
|
@ -88,7 +77,7 @@ $(document).ready(function(){
|
||||||
homeListElement.removeClass('selected');
|
homeListElement.removeClass('selected');
|
||||||
}
|
}
|
||||||
|
|
||||||
performAjax(generateURL(), post, photos);
|
performAjax(generateURL());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -112,7 +101,22 @@ $(document).ready(function(){
|
||||||
return baseURL;
|
return baseURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function performAjax(newURL, post, photos){
|
function performAjax(newURL) {
|
||||||
|
var post = $("#publisher textarea").val(),
|
||||||
|
photos = {};
|
||||||
|
|
||||||
|
|
||||||
|
//pass photos
|
||||||
|
$('#photodropzone img').each(function(){
|
||||||
|
var img = $(this);
|
||||||
|
guid = img.attr('data-id');
|
||||||
|
url = img.attr('src');
|
||||||
|
photos[guid] = url;
|
||||||
|
});
|
||||||
|
|
||||||
|
// set url
|
||||||
|
history.pushState(null, document.title, generateURL());
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : newURL,
|
url : newURL,
|
||||||
dataType : 'script',
|
dataType : 'script',
|
||||||
|
|
@ -150,4 +154,5 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue