Skip to content
Extraits de code Groupes Projets
Valider 22d4083c rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

use history.pushstate to preserve filters on page refresh

parent abfd9c35
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -37,7 +37,7 @@ $(document).ready(function(){ ...@@ -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(){ ...@@ -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(){ ...@@ -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(){ ...@@ -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(){ ...@@ -150,4 +154,5 @@ $(document).ready(function(){
} }
}); });
} }
}); });
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter