Last active
November 18, 2021 19:41
-
-
Save slime-hatena/3983e42ebaf9843f5fe50b744de52299 to your computer and use it in GitHub Desktop.
webページの情報からissueを作成するやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function(d,o,r,s){s=d.createElement('script');s.src =`<githack raw url>?o=${o}&r=${r}`;d.getElementsByTagName('head')[0].appendChild(s);})(document,'Owner Name','Repository Name'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('webページの情報からissueを作成するやつ\nhttps://gist.github.com/slime-hatena/3983e42ebaf9843f5fe50b744de52299'); | |
let args = []; | |
let parameters = document.currentScript.src.split('?')[1].split('&'); | |
for(let i = 0; parameters[i]; ++i) { | |
let k = parameters[i].split('='); | |
args[decodeURIComponent(k[0])] = decodeURIComponent(k[1]); | |
} | |
let domain = document.domain; | |
let title = ''; | |
let body = ''; | |
switch (domain) { | |
case 'www.amazon.co.jp': | |
title += document.title.replace('Amazon | ', ''); | |
body += `[Amazon](http://amazon.co.jp/${location.href.match(/[dg]p(\/product)?\/[A-Z0-9]*/g)[0]})`; | |
body += '\n'; | |
body += '値段: ' + document.querySelector("#corePrice_desktop > div > table > tbody > tr:nth-child(2) > td.a-span12 > span.a-price.a-text-price.a-size-medium.apexPriceToPay > span:nth-child(2)")?.innerHTML; | |
body += '\n'; | |
body += '\n'; | |
body += `![](${document.querySelector("#landingImage")?.src})`; | |
body += '\n'; | |
break; | |
default: | |
title += document.title; | |
body += document.URL; | |
body += '\n'; | |
break; | |
} | |
window.open(`https://github.com/${args.o}/${args.r}/issues/new?title=${encodeURI(title)}&body=${encodeURI(body)}`); | |
location.reload(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment