diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-11-07 15:33:21 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-11-07 15:33:21 +0100 |
commit | 972ba89bc2abb8510810d814c08cc02c44ea533c (patch) | |
tree | 5b33afcdece7f2b165b4c597fe670b51a223c1ee /core | |
parent | 73d59bd397ba8b54ee47e19132ec6970751ad070 (diff) | |
parent | ba62d8dea73b768afcf41b53d0dd6eb463907dee (diff) | |
download | nextcloud-server-972ba89bc2abb8510810d814c08cc02c44ea533c.tar.gz nextcloud-server-972ba89bc2abb8510810d814c08cc02c44ea533c.zip |
Merge branch 'master' of github.com:owncloud/core into vcategories_db
Diffstat (limited to 'core')
-rw-r--r-- | core/css/styles.css | 1 | ||||
-rw-r--r-- | core/js/js.js | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/core/css/styles.css b/core/css/styles.css index 95dceb50dec..646a760f989 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -44,6 +44,7 @@ textarea:hover, textarea:focus, textarea:active { background-color:#fff; color:# input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, select, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, select:hover, select:focus, select:active, input[type="button"]:focus, .button:hover { background:#fff; color:#333; } +input[type="submit"] img, input[type="button"] img, button img, .button img { cursor:pointer; } input[type="checkbox"] { width:auto; } #quota { cursor:default; } diff --git a/core/js/js.js b/core/js/js.js index 2073fc4d4b7..2b2a64d25f9 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -649,7 +649,7 @@ $.fn.filterAttr = function(attr_name, attr_value) { function humanFileSize(size) { var humanList = ['B', 'kB', 'MB', 'GB', 'TB']; // Calculate Log with base 1024: size = 1024 ** order - var order = Math.floor(Math.log(size) / Math.log(1024)); + var order = size?Math.floor(Math.log(size) / Math.log(1024)):0; // Stay in range of the byte sizes that are defined order = Math.min(humanList.length - 1, order); var readableFormat = humanList[order]; @@ -675,6 +675,30 @@ function formatDate(date){ return $.datepicker.formatDate(datepickerFormatDate, date)+' '+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); } +/* takes an absolute timestamp and return a string with a human-friendly relative date + * @param int a Unix timestamp + */ +function relative_modified_date(timestamp) { + var timediff = Math.round((new Date()).getTime() / 1000) - timestamp; + var diffminutes = Math.round(timediff/60); + var diffhours = Math.round(diffminutes/60); + var diffdays = Math.round(diffhours/24); + var diffmonths = Math.round(diffdays/31); + if(timediff < 60) { return t('core','seconds ago'); } + else if(timediff < 120) { return t('core','1 minute ago'); } + else if(timediff < 3600) { return t('core','{minutes} minutes ago',{minutes: diffminutes}); } + //else if($timediff < 7200) { return '1 hour ago'; } + //else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if(timediff < 86400) { return t('core','today'); } + else if(timediff < 172800) { return t('core','yesterday'); } + else if(timediff < 2678400) { return t('core','{days} days ago',{days: diffdays}); } + else if(timediff < 5184000) { return t('core','last month'); } + //else if($timediff < 31556926) { return $diffmonths.' months ago'; } + else if(timediff < 31556926) { return t('core','months ago'); } + else if(timediff < 63113852) { return t('core','last year'); } + else { return t('core','years ago'); } +} + /** * get a variable by name * @param string name |