Upgrade to Pro — share decks privately, control downloads, hide ads and more …

解決策をひとつ増やそう!ブラウザ拡張機能作成のススメ

 解決策をひとつ増やそう!ブラウザ拡張機能作成のススメ

2023/12/09
合同勉強会 in 大都会岡山 -2023 Winter-
https://gbdaitokai.connpass.com/event/299345/

Masayuki Maekawa

December 09, 2023
Tweet

More Decks by Masayuki Maekawa

Other Decks in Programming

Transcript

  1. NBOJGFTUKTPO { "manifest_version": 3, "name": "࠷খݶͷChrome֦ுػೳ", "version": "1.0", “description": "ϖʔδ্ͷHTMLΛมߋ͢Δ࠷খݶͷChrome֦ுػೳ",

    "content_scripts": [ { "matches": ["<all_urls>"], "js": ["content.js"] } ] } ఆٛɾઃఆϑΝΠϧ શͯͷ΢ΣϒϖʔδͰɺ DPOUFOUKTΛద༻͢Δ
  2. DPOUFOUKT // content.js // ϖʔδ্ͷςΩετΛมߋ // document.body.innerText = "Hello, Chrome֦ுػೳ!";

    // DomContentLoad࣌ʹaλάͷtargetଐੑΛ࡟আ͢Δ function removeTarget() { const links = document.querySelectorAll('a[target]'); links.forEach((link) => { link.removeAttribute('target'); }); setTimeout(removeTarget, 500) } removeTarget(); ࣮ߦϑΝΠϧ ϖʔδ಺શͯͷUBSHFUଐੑ ΛSFNPWF͢Δ
  3. NBOJGFTUKTPO { "manifest_version": 3, "name": "࠷খݶͷChrome֦ுػೳ", "version": "1.0", “description": "ϖʔδ্ͷHTMLΛมߋ͢Δ࠷খݶͷChrome֦ுػೳ",

    "content_scripts": [ { "matches": ["https://maepon.blog*"], "js": ["content.js"] } ] } ఆٛɾઃఆϑΝΠϧ ద༻͢ΔαΠτ͸ࢦఆͨ͠ํ ͕ແ೉Ͱ͢ ʢਖ਼نදݱ͸࢖͑ͳ͍͸ͣʣ