Last active
August 29, 2015 14:02
-
-
Save nekova/0ecea80c934c75874f25 to your computer and use it in GitHub Desktop.
Implement `github_actrnuf` with Dart
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
import 'dart:html'; | |
void classifyDate(Element modified_at) { | |
RegExp more_a_year = new RegExp("year"); | |
RegExp more_5_month = new RegExp("([5-9]|1)+ months"); | |
if (more_a_year.hasMatch(modified_at.text)) { | |
modified_at.style.color = 'red'; | |
}else if (more_5_month.hasMatch(modified_at.text)) { | |
modified_at.style.color = 'orange'; | |
} | |
} | |
void main() { | |
ElementList modified_date = document.querySelectorAll("time[is='time-ago']"); | |
modified_date.forEach((Element modified_at) { | |
classifyDate(modified_at); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment