Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Date difference when hovering a torrent date (#1287)

* Update en-us.all.json

* Update main.js

* Update base.jet.html

* Update main.js

* Update main.js
Cette révision appartient à :
kilo 2017-07-26 10:59:48 +02:00 révisé par ewhal
Parent 35905fbe33
révision d5888079f8
3 fichiers modifiés avec 15 ajouts et 4 suppressions

Voir le fichier

@ -54,14 +54,21 @@ function parseAllDates() {
var list = document.getElementsByClassName("date-full")
for (var i in list) {
var e = list[i]
e.title = e.innerText
var dateDifference = dateDiff(new Date(e.innerText), new Date());
e.title = T.r("torrent_age", dateDifference.d, dateDifference.h)
e.innerText = new Date(e.innerText).toLocaleString(lang)
}
}
function dateDiff( str1, str2 ) {
var diff = Date.parse( str2 ) - Date.parse( str1 );
return isNaN( diff ) ? NaN : {
diff : diff,
h : Math.floor( diff / 3600000 % 24 ),
d : Math.floor( diff / 86400000 )
};
}
parseAllDates()
//called if no Commit cookie is set or if the website has a newer commit than the one in cookie
function resetCookies() {
var cookies = document.cookie.split(";");

Voir le fichier

@ -90,7 +90,7 @@
</div>
</footer>
</div>
<script type="text/javascript" charset="utf-8">var commitVersion = "{{ Config.Build }}";</script>
<script type="text/javascript" charset="utf-8">var commitVersion = "{{ Config.Build }}"; T.Add("torrent_age", "{{T("torrent_age")}}");</script>
<script type="text/javascript" charset="utf-8" src="/js/main.js?v={{ Config.Version }}{{ Config.Build }}" async></script>
{{block footer_js()}}{{end}}
</body>

Voir le fichier

@ -1834,5 +1834,9 @@
{
"id": "torrent_preview",
"translation": "Preview your torrent"
},
{
"id": "torrent_age",
"translation": "{1} days {2} hours ago"
}
]