Skip to content

Instantly share code, notes, and snippets.

@ktakayama
Last active April 7, 2024 04:58
Show Gist options
  • Save ktakayama/96377 to your computer and use it in GitHub Desktop.
Save ktakayama/96377 to your computer and use it in GitHub Desktop.
楽天のメルマガチェックを自動解除するGreaseonkeyスクリプト
// ==UserScript==
// @name Deny Rakuten News
// @namespace http://espion.just-size.jp/archives/05/136155838.html
// @description Deny Rakuten News
// @include https://*.step.rakuten.co.jp/*
// @include https://*.travel.rakuten.co.jp/rsv/RsvInput.do*
// @include https://my.rental.rakuten.co.jp/action/my/*
// @include https://delivery.rakuten.co.jp/*?module=Default&action=OrderStep*
// @include https://auction.item.rms.rakuten.co.jp/*
// @include https://my.checkout.rakuten.co.jp/myc/purchase/Confirm
// @include https://coupon.rakuten.co.jp/getCoupon*
// @include http://step.checkout.rakuten.co.jp/ost/api/OrderConfirmation
// ==/UserScript==
/*
Copyright (c) 2006-2013, Kyosuke Takayama <[email protected]>
Distributed under the NEW BSD license
2015-05-16:
- 楽天デリバリーのカスタムURLに対応
- 楽天クーポンサービスの画面に対応
2013-07-08:
- 楽天あんしん支払いサービスの画面に対応
2012-09-01:
- 楽天オークションの@includeのURLを変更
2012-07-05:
- 楽天トラベルのURL変更に対応
2012-01-26:
- 楽天オークションの画面に対応
2012-01-06:
- 条件追加
2011-09-12:
- 楽天デリバリーの画面に対応
- 楽天レンタルの画面に対応
2010-01-03:
- パラメータ追加
2009-11-12:
- フォームのパラメータ変化に対応
2009-05-15:
- 解除したメルマガの数を画面に表示
- 楽天トラベルの画面に対応
2006-12-24:
- 注文画面の HTML 構造の変化に対応
*/
(
function() {
function main() {
var nodes = document.evaluate(
"//input[@type='checkbox'] [contains(@name,'newscheck_') or contains(@name,'news_check') or \
contains(@id,'adMailCheck') or \ contains(@id,'newscheck_') or \
contains(@name,'f_rmail_') or \ contains(@name,'f_send_flg') or \
contains(@name,'f_tabiinfo_flg') or \ contains(@name,'f_mobile_flg') or \
contains(@name,'f_premium_flg') or \
contains(@id,'groupMagagine') or contains(@name,'mailNews') or contains(@name,'checkoutMagazine') or \
@name='mag' or @name='poima' or @name='myMailKbn' or @id='basket' or \
@name='rmail_check' or @name='shop_rating_check' or @name='shopMail' or @name='coutMail']",
document.documentElement,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null
);
for (var i = 0; i < nodes.snapshotLength; i++) {
var z = nodes.snapshotItem(i);
z.checked = false;
try {
z.parentNode.style.color = '#FF0000';
z.parentNode.style.backgroundColor = '#DDD999';
} catch(e) { GM_log(e); }
}
if(i == 0) return;
var div = document.createElement('div');
with(div.style) {
position = "absolute";
top = "180px";
right = "10px";
opacity = 0.8;
padding = "0.5em 1.0em";
fontWeight = "bold";
border = "1px solid #EEEEAA";
backgroundColor = "#FFFFEE";
}
div.innerHTML = "メルマガ解除:" + i + "件";
document.body.appendChild(div);
}
main();
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment