diff --git a/Firefox/manifest.json b/Firefox/manifest.json index 8f88d5c..ea8c43f 100644 --- a/Firefox/manifest.json +++ b/Firefox/manifest.json @@ -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", diff --git a/Firefox/notifier.js b/Firefox/notifier.js index eb056bd..2f6e364 100644 --- a/Firefox/notifier.js +++ b/Firefox/notifier.js @@ -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); diff --git a/Firefox/popup/notifier_popup.css b/Firefox/popup/notifier_popup.css index 8c595aa..b50077a 100644 --- a/Firefox/popup/notifier_popup.css +++ b/Firefox/popup/notifier_popup.css @@ -67,7 +67,7 @@ a { font-size:13px; height: 50px; - width: 350px; + width: 385px; border-bottom: #154e69 1px solid; } @@ -80,7 +80,7 @@ a #notification #blocNotif { float:right; - width: 300px; + width: 335px; height: 50px; overflow: hidden; text-overflow: ellipsis; @@ -88,7 +88,7 @@ a #notification #pseudo { - width:50%; + width:40%; max-height: 18px; overflow-y: hidden; text-overflow: ellipsis; @@ -102,7 +102,7 @@ a max-height: 13px; float:right; text-align:right; - padding-right:10px; + padding-right:20px; color: #77b8d5; }