Skip to content

Instantly share code, notes, and snippets.

@yhsiang
Created April 20, 2014 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yhsiang/11114544 to your computer and use it in GitHub Desktop.
Save yhsiang/11114544 to your computer and use it in GitHub Desktop.
zhutil usage
# html
<div class="well well-small">
<p class="text-error">因監察院只提供圖檔,此為初步轉檔結果,尚未完整校正,歡迎<a href="https://docs.google.com/spreadsheets/d/16UxAPkZLtU8OVJQCJasqnqOkHfceArbM05zo0FYRcbw/edit#gid=0" target="_blank">回報錯誤</a>,將盡快修正。找原始檔 -&gt; <a href="http://sunshine.cy.gov.tw/GipOpenWeb/wSite/sp?xdUrl=/wSite/SpecialPublication/baseQuery.jsp" target="_blank">監察院財產申報資料</a></p>
2013-12-12的股票總額: 24筆,共<span class="number">253796240 </span>元<br>
2012-04-19的股票總額: 21筆,共<span class="number">227748080 </span>元<br>
2011-11-15的股票總額: 22筆,共<span class="number">218242591.1 </span>元<br>
</div>
# javascript
$('.number').each(function(index,ele){
var number = $(ele).text()
, zh_number = zhutil.approximate(number, {base: '億'});
$(ele).replaceWith(zh_number)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment