Created
June 23, 2016 16:49
-
-
Save lktvlm/fdeba01aab7ac60344d197790eb92fd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name fix-outlook-date | |
// @namespace http://fix-outlook-date.whatev | |
// @version 0.1 | |
// @author lookout | |
// @description fix-outlook-date | |
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html | |
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js | |
// @include https://outlook* | |
// @include https://webmail* | |
// @grant none | |
// ==/UserScript== | |
if ($('body').filter('.ms-fwt-r[aria-label="Outlook"]').length) { | |
$('._lvv_Q').has('span').each(function () { | |
var text = $(this).text().trim(), | |
msgDate = new Date(), | |
dayNum = null; | |
if (!text.includes('.')) { | |
if (text.includes('Пн')) { | |
dayNum = 1; | |
} else if (text.includes('Вт')) { | |
dayNum = 2; | |
} else if (text.includes('Ср')) { | |
dayNum = 3; | |
} else if (text.includes('Чт')) { | |
dayNum = 4; | |
} else if (text.includes('Пт')) { | |
dayNum = 5; | |
} else if (text.includes('Сб')) { | |
dayNum = 6; | |
} else if (text.includes('Вс')) { | |
dayNum = 7; | |
} else if (text.includes(':')) { | |
dayNum = msgDate.getDay(); | |
} | |
if (Number.isInteger(dayNum)) { | |
var dayShift = dayNum - msgDate.getDay(); | |
msgDate = new Date(msgDate.setDate(msgDate.getDate() + dayShift)); | |
$(this).prepend($( | |
'<span>' + | |
msgDate.getDate() + '.' + ('0' + (msgDate.getMonth() + 1)).slice(-2) + ' ' + | |
'</span>' | |
)) | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment