Created
February 9, 2019 15:20
-
-
Save Flatroy/f2f8e1370a9c081b96aa865e3c01a84d to your computer and use it in GitHub Desktop.
Revisions
-
Flatroy created this gist
Feb 9, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ // From https://github.com/kleampa/not-paid/blob/master/not-paid.js (function(){ /* change these variables as you wish */ var due_date = new Date('2017-02-27'); var days_deadline = 60; /* stop changing here */ var current_date = new Date(); var utc1 = Date.UTC(due_date.getFullYear(), due_date.getMonth(), due_date.getDate()); var utc2 = Date.UTC(current_date.getFullYear(), current_date.getMonth(), current_date.getDate()); var days = Math.floor((utc2 - utc1) / (1000 * 60 * 60 * 24)); if(days > 0) { var days_late = days_deadline-days; var opacity = (days_late*100/days_deadline)/100; opacity = (opacity < 0) ? 0 : opacity; opacity = (opacity > 1) ? 1 : opacity; if(opacity >= 0 && opacity <= 1) { document.getElementsByTagName("BODY")[0].style.opacity = opacity; } } })()