Skip to content

Instantly share code, notes, and snippets.

@oflow
Last active December 6, 2016 06:14
Show Gist options
  • Save oflow/fb7c08141aaf8aa79d84ec1adf60e38f to your computer and use it in GitHub Desktop.
Save oflow/fb7c08141aaf8aa79d84ec1adf60e38f to your computer and use it in GitHub Desktop.
ドスパラは(+税)の表示やめろ!
// ==UserScript==
// @name ドスパラ税込み表示
// @description ドスパラは(+税)の表示やめろ!
// @include http://www.dospara.co.jp/*
// ==/UserScript==
'use strict';
['em[itemprop="price"]', '.itemSearchTable .price', 'span.rankingAreaPrice'].forEach(query => {
document.querySelectorAll(query).forEach(elm => {
var price = Number(elm.textContent.split('円')[0].replace(/[^\d]/g, ''));
if (price && !isNaN(price)) {
elm.innerHTML = String(Math.floor(price * 1.08)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') + '円 <span class="tax">(税込)</span>';
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment