Skip to content

Commit

Permalink
Added @voodootikigod's rad regex awesomeness for urgent check.
Browse files Browse the repository at this point in the history
  • Loading branch information
joemccann committed May 21, 2011
1 parent 7314e47 commit 8a49dd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions public/js/tick.js
Expand Up @@ -40,15 +40,14 @@
postList.items.forEach(function(el,i){
if(el.task !== runningList.items[i]) changes = true;

var match = el.task.match(/\*/g)
, currentItem = allItems[i];
var currentItem = allItems[i];

if( match && match.length == 1 )
if( /^[^*]+[*]{1}[^*]*$/.test(el.task) )
{
currentItem.removeAttribute('data-urgent')
currentItem.innerText = currentItem.innerText.replace('*', '')
}
else if( (match && match.length == 2) || (currentItem['data-urgent'] !== undefined))
else if( /^[^*]+[*]{2}[^*]*$/.test(el.task) || (currentItem['data-urgent'] !== undefined))
{
var attr = d.createAttribute('data-urgent');
attr.nodeValue = 'true';
Expand Down
2 changes: 1 addition & 1 deletion public/ticklist.json
@@ -1 +1 @@
{"items":[{"task":"Bathe Mack.","urgent":false},{"task":"Finish RFPs for clients.","urgent":false},{"task":"Drink avocado marg.","urgent":false},{"task":"Enjoy the Rapture.","urgent":true}]}
{"items":[{"task":"Bathe Mack.","urgent":false},{"task":"Finish RFPs for clients.","urgent":false},{"task":"Drink avocado marg.","urgent":true},{"task":"Enjoy the Rapture.","urgent":false}]}

0 comments on commit 8a49dd6

Please sign in to comment.