summaryrefslogtreecommitdiffstats
path: root/settings/js/log.js
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-03-28 15:02:31 +0100
committerMorris Jobke <morris.jobke@gmail.com>2013-03-28 15:02:31 +0100
commitdf74c0e43a1da9ca1565b23fb6a5a8608457f50a (patch)
treef1426d02b4cf320bc5ede197efb280e86114d96a /settings/js/log.js
parent7c8a0a486b51f770a5d78c63a5c1026e1dfea27f (diff)
downloadnextcloud-server-df74c0e43a1da9ca1565b23fb6a5a8608457f50a.tar.gz
nextcloud-server-df74c0e43a1da9ca1565b23fb6a5a8608457f50a.zip
apply code review hints
Diffstat (limited to 'settings/js/log.js')
-rw-r--r--settings/js/log.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/settings/js/log.js b/settings/js/log.js
index 2e20aba3aa4..d91c180a52b 100644
--- a/settings/js/log.js
+++ b/settings/js/log.js
@@ -17,30 +17,27 @@ OC.Log={
levels:['Debug','Info','Warning','Error','Fatal'],
loaded:3,//are initially loaded
getMore:function(count){
- if(!count){
- count=10;
- }
+ count = count || 10;
$.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:count},function(result){
if(result.status=='success'){
OC.Log.addEntries(result.data);
$('html, body').animate({scrollTop: $(document).height()}, 800);
if(!result.remain){
- $('#moreLog').css('display', 'none');
+ $('#moreLog').hide();
}
- $('#lessLog').css('display', '');
+ $('#lessLog').show();
}
});
},
showLess:function(count){
count = count || 10;
- $('#moreLog').css('display', '');
- while(OC.Log.loaded > 3 && count){
- $('#log tr').last().remove();
- OC.Log.loaded -= 1;
- count--;
- }
+ //calculate remaining items - at least 3
+ OC.Log.loaded = Math.max(3,OC.Log.loaded-count);
+ $('#moreLog').hide();
+ // remove all non-remaining items
+ $('#log tr').slice(OC.Log.loaded).remove();
if(OC.Log.loaded <= 3)
- $('#lessLog').css('display', 'none');
+ $('#lessLog').hide();
},
addEntries:function(entries){
for(var i=0;i<entries.length;i++){
@@ -68,6 +65,7 @@ OC.Log={
}
$(document).ready(function(){
+ $('#lessLog').hide(); // initially hide the less button
$('#moreLog').click(function(){
OC.Log.getMore();
})