Profile pic sync from KAK FB group is improved
PS: Tried using windows, are line endings borked?
This commit is contained in:
1 parent
14c57bf9eb
commit
4488acdfcb
7 files changed
+53
-90
No files matched your search
@@ -385,39 +385,6 @@ $(document).ready(function() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* View: Add user
|
||||
*/
|
||||
var input_selector = "#id_facebook_username";
|
||||
/* Facebook username check */
|
||||
$(input_selector).on('keyup', _.debounce(function(event) {
|
||||
var user_id = event.target.value;
|
||||
if(user_id.trim().length === 0) {
|
||||
$(input_selector).parent().removeClass('has-success has-feedback has-error');
|
||||
$(input_selector).parent().find(".facebook-image img").attr('src', no_picture_url);
|
||||
return;
|
||||
}
|
||||
var picture_url = "https://graph.facebook.com/" + user_id + "/picture";
|
||||
var static_url = $("meta[name=x-django-static-url]").attr('content');
|
||||
var no_picture_url = static_url +"img/unknown_person.png";
|
||||
$.ajax({
|
||||
url: picture_url,
|
||||
statusCode: {
|
||||
200: function() {
|
||||
$(input_selector).parent().addClass('has-success has-feedback');
|
||||
$(input_selector).parent().removeClass('has-error');
|
||||
$(input_selector).parent().find(".facebook-image img").attr('src', picture_url);
|
||||
|
||||
},
|
||||
404: function() {
|
||||
$(input_selector).parent().addClass('has-error has-feedback');
|
||||
$(input_selector).parent().removeClass('has-success');
|
||||
$(input_selector).parent().find(".facebook-image img").attr('src', no_picture_url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 300)); // Only every 300ms
|
||||
|
||||
/*
|
||||
* View: Inventory report
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user