Skip to content

Instantly share code, notes, and snippets.

@tokikanno
Last active May 26, 2021 07:18
Show Gist options
  • Select an option

  • Save tokikanno/c809fdd6c33fc0c1125848f5f33872d7 to your computer and use it in GitHub Desktop.

Select an option

Save tokikanno/c809fdd6c33fc0c1125848f5f33872d7 to your computer and use it in GitHub Desktop.
(() => {
const parseNumberFromElement = (selector) => parseInt($(selector).text().replace(',', ''))
const fmt = new Intl.NumberFormat('zh-TW')
let v = parseNumberFromElement('#num1') - parseNumberFromElement('#num2') - parseNumberFromElement('#num3')
let html = `<div class="EmbedBg TaiwanEmbed">
<div class="TWtotalTwEmbed">
<p class="TwTitle ">尚 未<br>判 定</p>
<div class="TwEmbed1 outbreak_info_block" style="width: 440px;">
<div class="outbreak_info_class">通報數 - 排除 - 確診</div>
<div class="outbreak_info_number">${fmt.format(v)}</div>
</div>
</div>
</div>`
$(html).insertAfter(
$('#EmbedchartS .EmbedBg.TaiwanEmbed')
)
v = parseNumberFromElement('#num6') - parseNumberFromElement('#num7') - parseNumberFromElement('#num8')
html = `<div class="TaiwanEmbed">
<div class="TWtotalTwEmbed">
<p class="TwTitle ">尚 未<br>判 定</p>
<div class="TwEmbed1 outbreak_info_block" style="width: 440px;">
<div class="outbreak_info_class">通報數 - 排除 - 確診</div>
<div class="outbreak_info_number">${fmt.format(v)}</div>
</div>
</div>
</div>`
$(html).insertAfter(
$('#EmbedchartS .TaiwanEmbed').not('.EmbedBg')
)
})()
@tokikanno
Copy link
Author

tokikanno commented May 25, 2021

簡單計算 CDC 網頁上未判定案例數量 (2021/5/25)

image

@tokikanno
Copy link
Author

5/26
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment