pending photos now stick to the publisher when adding or removing aspects... the home page however is a full reload, and some weird things happen when you switch from home
This commit is contained in:
parent
f8d524c983
commit
c29ebdabba
1 changed files with 23 additions and 4 deletions
|
|
@ -54,7 +54,17 @@ $(document).ready(function(){
|
||||||
listElement = $this.parent(),
|
listElement = $this.parent(),
|
||||||
guid = listElement.attr('data-guid'),
|
guid = listElement.attr('data-guid'),
|
||||||
post = $("#publisher textarea").val(),
|
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
|
||||||
|
|
@ -78,7 +88,7 @@ $(document).ready(function(){
|
||||||
homeListElement.removeClass('selected');
|
homeListElement.removeClass('selected');
|
||||||
}
|
}
|
||||||
|
|
||||||
performAjax(generateURL(), post);
|
performAjax(generateURL(), post, photos);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,25 +112,34 @@ $(document).ready(function(){
|
||||||
return baseURL;
|
return baseURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function performAjax(newURL, post){
|
function performAjax(newURL, post, photos){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : newURL,
|
url : newURL,
|
||||||
dataType : 'script',
|
dataType : 'script',
|
||||||
success : function(data){
|
success : function(data){
|
||||||
requests--;
|
requests--;
|
||||||
|
|
||||||
// fill in publisher
|
// fill in publisher
|
||||||
// (not cached because this element changes)
|
// (not cached because this element changes)
|
||||||
|
|
||||||
var textarea = $("#publisher textarea");
|
var textarea = $("#publisher textarea");
|
||||||
|
var photozone = $('#photodropzone')
|
||||||
|
|
||||||
if( textarea.val() == "" ) {
|
if( textarea.val() == "" ) {
|
||||||
textarea.val(post);
|
textarea.val(post);
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var photos_html = "";
|
||||||
|
for(var key in photos){
|
||||||
|
$("#publisher textarea").addClass("with_attachments");
|
||||||
|
photos_html = photos_html + "<li style='position:relative;'> " + ("<img src='" + photos[key] +"' data-id='" + key + "'>") + "</li>";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
$('html, body').animate({scrollTop:0}, 'fast');
|
$('html, body').animate({scrollTop:0}, 'fast');
|
||||||
|
|
||||||
// reinit listeners on stream
|
// reinit listeners on stream
|
||||||
|
photozone.html(photos_html);
|
||||||
Stream.initialize();
|
Stream.initialize();
|
||||||
|
|
||||||
// fade contents back in
|
// fade contents back in
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue