GitHub PullRequestReviewCommentEvent at 2014-01-26 20:18:49
Repository: FreshRSS
Actor: Alkarex
Payload: {"comment":{"url":"https://api.github.com/repos/marienfressinaud/FreshRSS/pulls/comments/9177243","id":9177243,"diff_hunk":"@@ -20,33 +20,48 @@ function redirect(url, new_tab) {\n \t}\n }\n \n+function numberFormat(nStr) {\n+\t// Thx to http://www.mredkj.com/javascript/numberFormat.html\n+\tnStr += '';\n+\tvar x = nStr.split('.');\n+\tvar x1 = x[0];\n+\tvar x2 = x.length > 1 ? '.' + x[1] : '';\n+\tvar rgx = /(\\d+)(\\d{3})/;\n+\twhile (rgx.test(x1)) {\n+\t\tx1 = x1.replace(rgx, '$1' + \" \" + '$2');\n+\t}\n+\treturn x1 + x2;\n+}\n+\n function incLabel(p, inc) {\n \tvar i = (parseInt(p.replace(/\\D/g, ''), 10) || 0) + inc;\n-\treturn i > 0 ? ' (' + i + ')' : '';\n+\treturn i > 0 ? ' (' + numberFormat(i) + ')' : '';\n }\n \n function incUnreadsFeed(article, feed_id, nb) {\n+\t\n \t//Update unread: feed\n \tvar elem = $('#' + feed_id + '>.feed').get(0),\n-\t\tfeed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0,\n+\t\tfeed_unreads = elem ? (parseInt(elem.getAttribute('data-unread').replace(' ', ''), 10) || 0) : 0,\n \t\tfeed_priority = elem ? (parseInt(elem.getAttribute('data-priority'), 10) || 0) : 0;\n \tif (elem) {\n-\t\telem.setAttribute('data-unread', Math.max(0, feed_unreads + nb));\n+\t\telem.setAttribute('data-unread', numberFormat(Math.max(0, feed_unreads + nb)));\n \t}\n \n \t//Update unread: category\n \telem = $('#' + feed_id).parent().prevAll('.category').children(':first').get(0);\n-\tfeed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;\n+\tfeed_unreads = elem ? (parseInt(elem.getAttribute('data-unread').replace(' ', ''), 10) || 0) : 0;\n \tif (elem) {\n-\t\telem.setAttribute('data-unread', Math.max(0, feed_unreads + nb));\n+\t\telem.setAttribute('data-unread', numberFormat(Math.max(0, feed_unreads + nb)));\n \t}\n \n \t//Update unread: all\n \tif (feed_priority > 0) {\n \t\telem = $('#aside_flux .all').children(':first').get(0);\n \t\tif (elem) {\n-\t\t\tfeed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;\n-\t\t\telem.setAttribute('data-unread', Math.max(0, feed_unreads + nb));\n+\t\t\tfeed_unreads = elem ? (parseInt(elem.getAttribute('data-unread').replace(' ', ''), 10) || 0) : 0;\n+\t\t\talert(elem.getAttribute('data-unread') + \"\\n\" + feed_unreads);","path":"p/scripts/main.js","position":51,"original_position":51,"commit_id":"ec720c4f69759fb08bf07ef322eb2ecac187909f","original_commit_id":"ec720c4f69759fb08bf07ef322eb2ecac187909f","user":{"login":"Alkarex","id":1008324,"avatar_url":"https://gravatar.com/avatar/f629a2a6793ddaaab61a9accf98c67f1?d=https%3A%2F%2Fidenticons.github.com%2Fd534d9d75986e4bfbed6d133f6de1154.png&r=x","gravatar_id":"f629a2a6793ddaaab61a9accf98c67f1","url":"https://api.github.com/users/Alkarex","html_url":"https://github.com/Alkarex","followers_url":"https://api.github.com/users/Alkarex/followers","following_url":"https://api.github.com/users/Alkarex/following{/other_user}","gists_url":"https://api.github.com/users/Alkarex/gists{/gist_id}","starred_url":"https://api.github.com/users/Alkarex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alkarex/subscriptions","organizations_url":"https://api.github.com/users/Alkarex/orgs","repos_url":"https://api.github.com/users/Alkarex/repos","events_url":"https://api.github.com/users/Alkarex/events{/privacy}","received_events_url":"https://api.github.com/users/Alkarex/received_events","type":"User","site_admin":false},"body":"Penser à enlever le alert","created_at":"2014-01-26T20:18:49Z","updated_at":"2014-01-26T20:18:49Z","html_url":"https://github.com/marienfressinaud/FreshRSS/pull/398#discussion_r9177243","pull_request_url":"https://api.github.com/repos/marienfressinaud/FreshRSS/pulls/398","_links":{"self":{"href":"https://api.github.com/repos/marienfressinaud/FreshRSS/pulls/comments/9177243"},"html":{"href":"https://github.com/marienfressinaud/FreshRSS/pull/398#discussion_r9177243"},"pull_request":{"href":"https://api.github.com/repos/marienfressinaud/FreshRSS/pulls/398"}}}}