Skip to content

Commit

Permalink
format date
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarOk1412 committed Nov 18, 2016
1 parent 52ea784 commit 2e40aa6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Zds-Notificateur",
"version": "2.0",
"version": "2.1",
"homepage_url": "https://zestedesavoir.com",
"description": "Une extension pour connaitre le nombre de notifications et de MP de ZesteDeSavoir sans avoir besoin d'ouvrir le site",

Expand Down
20 changes: 19 additions & 1 deletion Firefox/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,28 @@ function getNotificationsFromAPI() {
var senderAvatarNotif = resultsNotification[notif].childNodes[4].childNodes[5].innerHTML;
var dateNotif = resultsNotification[notif].childNodes[5].innerHTML;
var date = new Date((dateNotif || "").replace(/-/g,"/").replace(/[TZ]/g," "));
var minutes = '' + date.getMinutes();
if(minutes.length < 2) {
minutes = '0' + minutes;
}
var formatedDate = 'le ' + [date.getDate(),
date.getMonth()+1].join('/') + ' à ' +
[date.getHours(),
date.getMinutes()].join('h');
minutes].join('h');
var actualDate = new Date();
if(date.getDate() == actualDate.getDate() &&
date.getMonth() == actualDate.getMonth() &&
date.getYear() == actualDate.getYear()) {
formatedDate = "Aujourd'hui";
} else {
var yesterday = actualDate;
yesterday.setDate(actualDate.getDate() - 1);
if(date.getDate() == yesterday.getDate() &&
date.getMonth() == yesterday.getMonth() &&
date.getYear() == yesterday.getYear()) {
formatedDate = "Hier";
}
}
var urlNotif = "https://zestedesavoir.com" + resultsNotification[notif].childNodes[3].innerHTML;
if(_debug) console.log(urlNotif + " by " + senderNotif);
addNotification(titleNotif, senderNotif, senderAvatarNotif, formatedDate, urlNotif);
Expand Down
8 changes: 4 additions & 4 deletions Firefox/popup/notifier_popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ a
{
font-size:13px;
height: 50px;
width: 350px;
width: 385px;
border-bottom: #154e69 1px solid;
}

Expand All @@ -80,15 +80,15 @@ a
#notification #blocNotif
{
float:right;
width: 300px;
width: 335px;
height: 50px;
overflow: hidden;
text-overflow: ellipsis;
}

#notification #pseudo
{
width:50%;
width:40%;
max-height: 18px;
overflow-y: hidden;
text-overflow: ellipsis;
Expand All @@ -102,7 +102,7 @@ a
max-height: 13px;
float:right;
text-align:right;
padding-right:10px;
padding-right:20px;
color: #77b8d5;
}

Expand Down

0 comments on commit 2e40aa6

Please sign in to comment.