Skip to content

Instantly share code, notes, and snippets.

@slime-hatena
Last active November 18, 2021 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slime-hatena/3983e42ebaf9843f5fe50b744de52299 to your computer and use it in GitHub Desktop.
Save slime-hatena/3983e42ebaf9843f5fe50b744de52299 to your computer and use it in GitHub Desktop.
webページの情報からissueを作成するやつ
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');
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