From 8a49dd685b4887db9de8f89a2205fff4dc68ba89 Mon Sep 17 00:00:00 2001 From: Joe McCann Date: Sat, 21 May 2011 17:51:47 -0500 Subject: [PATCH] Added @voodootikigod's rad regex awesomeness for urgent check. --- public/js/tick.js | 7 +++---- public/ticklist.json | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/public/js/tick.js b/public/js/tick.js index 1c4ee0f..54b2c8c 100644 --- a/public/js/tick.js +++ b/public/js/tick.js @@ -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'; diff --git a/public/ticklist.json b/public/ticklist.json index 179e13b..376d9a4 100644 --- a/public/ticklist.json +++ b/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}]} \ No newline at end of file +{"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}]} \ No newline at end of file