TxRxs
by
noromanba
2022-01-03 [2022/01/03 03:19:45]
replace http to https
-
/*
* @title TxRxs
* @description replace http to https
* @include http://*
* @include https://*
* @license MIT License https://opensource.org/licenses/MIT
* @javascript_url
* @private WIP
*/
(() => {
'use strict';
const wipe = (ctx) => {
ctx.querySelectorAll([
'a[href^="http:"]',
]).forEach(link => {
//*
link.protocol = 'https:';
alert(link.href.trim())
alert(link.textContent.trim())
if (link.href.trim() === link.textContent.trim()) {
link.textContent = link.href;
}
/*
const s = new URL(link.href);
s.href.protocol = 'https:';
s.href = s.href.trim();
if (link.href.trim() === link.textContent.trim()) {
link.textContent = s.href;
}
link.href = s.href;
*/
});
};
wipe(document.body);
new MutationObserver(records => {
records.forEach(record => {
wipe(record.target);
});
}).observe(document.body, {
childList: true,
subtree: true,
});
})();
/* from *dumb* phone */
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。