Skip to content

Instantly share code, notes, and snippets.

@nekova
Last active August 29, 2015 14:02
Show Gist options
  • Save nekova/0ecea80c934c75874f25 to your computer and use it in GitHub Desktop.
Save nekova/0ecea80c934c75874f25 to your computer and use it in GitHub Desktop.
Implement `github_actrnuf` with Dart
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