code cleanup
This commit is contained in:
parent
21a46af320
commit
3a80478e8a
|
@ -36,12 +36,12 @@ app.filter("autolink", function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", function ($scope, $interval, $http, $log) {
|
app.controller('MailboxController', ["$interval", "$http", "$log", function ($interval, $http, $log) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.updateUsername = function (username) {
|
self.updateUsername = function (username) {
|
||||||
username = username.replace(/[@].*$/, ''); // remove part after "@"
|
username = username.replace(/[@].*$/, ''); // remove part after "@"
|
||||||
if (self.username != username) {
|
if (self.username !== username) {
|
||||||
// changed
|
// changed
|
||||||
self.username = username;
|
self.username = username;
|
||||||
hasher.setHash(self.username);
|
hasher.setHash(self.username);
|
||||||
|
@ -54,7 +54,7 @@ app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", fun
|
||||||
self.mails = [];
|
self.mails = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.inputFieldUsername = self.address;
|
self.inputFieldUsername = self.username;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,9 +72,7 @@ app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", fun
|
||||||
hasher.initialized.add(self.onHashChange.bind(self)); //add initialized listener (to grab initial value in case it is already set)
|
hasher.initialized.add(self.onHashChange.bind(self)); //add initialized listener (to grab initial value in case it is already set)
|
||||||
hasher.init(); //initialize hasher (start listening for history changes)
|
hasher.init(); //initialize hasher (start listening for history changes)
|
||||||
|
|
||||||
$interval(function () {
|
$interval(self.updateMails, reload_interval_ms);
|
||||||
self.updateMails()
|
|
||||||
}, reload_interval_ms);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updateMails = function () {
|
self.updateMails = function () {
|
||||||
|
@ -112,7 +110,7 @@ app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", fun
|
||||||
};
|
};
|
||||||
|
|
||||||
self.deleteMail = function (mailid, index) {
|
self.deleteMail = function (mailid, index) {
|
||||||
// insantly remove mail.
|
// instantly remove from frontend.
|
||||||
self.mails.splice(index, 1);
|
self.mails.splice(index, 1);
|
||||||
// remove on backend.
|
// remove on backend.
|
||||||
$http.get(backend_url, {params: {username: self.username, delete_email_id: mailid}})
|
$http.get(backend_url, {params: {username: self.username, delete_email_id: mailid}})
|
||||||
|
@ -128,7 +126,6 @@ app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", fun
|
||||||
detail: response
|
detail: response
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initial load
|
// Initial load
|
||||||
|
|
Loading…
Reference in New Issue
Block a user