å®å¿ãããé販ããã¯ãã¼ã¯ã¬ãããä½ã£ã¦ã¿ã
æè¿ããAmazonãã®ãã¼ã±ãããã¬ã¤ã¹ã®å£ã³ãå½è£
ãé
·ãã®ã§ã¿ããªçµæ§è¿·æãã¦ãããããªãã§ããããæé¤ããã«ã¯Amazonã販売ããååã ãã表示ããã®ãæã£åãæ©ãã®ã ããããã«ããããããªãã·ã§ã³ãæ®éã«ã¯é¸ã¶ãã¨ã¯ãªããã®äºæ
ã§ä¸å¯è½ã§URLã«ã&emi=AN1VRQENFRJN5ãã¨èªåã§ä»ããå¿
è¦ããããããã
ã©ãããããããã¯ãã¼ã¯ã¬ãããã£ã¦ãã¤ã«ããã°ãã¡ãã¡æåã§ããå¿
è¦ã¯ãªããããã¨ãã話ãã¿ãã®ã§ãã¤ãã§ã«åãååããヨドバシ・ドッド・コムãã§è²©å£²ããã¦ããããæ¤ç´¢ã§ããããã¯ãã¼ã¯ã¬ãããä½ã£ã¦ã¿ãã
æ¦è¦
ããã¯ãã¼ã¯ã¬ããã®æ©è½ã¯ä»¥ä¸ã®ã¨ããã
- ãAmazonãã§æ¤ç´¢ãããã¼ã¯ã¼ããå
ã«ãå¥ã¿ãã«ä»¥ä¸ã表示ãã
- åºåè ãAmazonã®ååã®ã¿ã«çµã£ãæ¤ç´¢çµæ
- ãヨドバシ・ドッド・コムãã§ç¾å¨è²©å£²ä¸ã®æ¤ç´¢çµæ
- ãヨドバシ・ドッド・コムãã§æ¤ç´¢ãããã¼ã¯ã¼ããå
ã«ãå¥ã¿ãã«ä»¥ä¸ã表示ãã
- ãAmazonãã§åºåè ãAmazonã®ååã®ã¿ã«çµã£ãæ¤ç´¢çµæ
åä½ç°å¢
ã¨ãããã確èªæ¸ã®ãã®ã
- Windows 10 (1903)
- Chromeã(76.0.3809.132)
- FireFox (68.02)
- Mac OS (10.14.6)
- Chrome (76.0.3809.100)
- Safari (12.1.2)
- Android 9
- Chrome (76.0.3809.132)
- iOS (12.4.1)
- Safari (???)ãâãã¾ãåãã¦ãããããããã
iOSã®Safariã¯ã¿ã表示ãã§ããªãã£ãæ°ããããã©ãããããã¿ã表示ã§ããã®ãã¨ãããã¾ãããããããããã£ãâ¦ã
è¨å®
以ä¸ã®ããã¯ãã¼ã¯ã¨ãã¦ç»é²ããã
javascript:(function(){function c(a){window.open("https://www.amazon.co.jp/s?k="+a+"&emi=AN1VRQENFRJN5","_blank","noopener")}var b={"www.amazon.co.jp":{key:"k",a:[c,function(a){window.open("https://www.yodobashi.com/?word="+a+"&discontinued=false","_blank","noopener")}]},"www.yodobashi.com":{key:"word",a:[c]}}[location.host];if(void 0===b)alert("\u3053\u306e\u30b5\u30a4\u30c8["+location.host+"]\u3067\u306f\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002");else{var d=function(a){a=window.location.href.match(new RegExp("[?&]"+ a+"=(.*?)(&|$|#)"));return null==a?"":decodeURIComponent(a[1])}(b.key);""===d?alert("\u5546\u54c1\u691c\u7d22\u3092\u884c\u3063\u3066\u304b\u3089\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002"):b.a.forEach(function(a){a(d)})}})();
ããã¯ãã¼ã¯ç»é²ã®ä»æ¹ã¯OSããã©ã¦ã¶ã§ç°ãªãã®ã§é å¼µãã
使ãæ¹
Amazonã¾ãã¯ã¨ããã·ãããã³ã ã§ååæ¤ç´¢ãã¦ãããç»é²ããããã¯ãã¼ã¯ãã¯ãªãã¯ãã¦ãããã¯ãã¼ã¯ã¬ãããå®è¡ããã
ãã®ï¼
- ãAmazonãã§æ®éã«ååæ¤ç´¢ãã
- ããã¯ãã¼ã¯ã¬ãããå®è¡ãã
- Amazon(Amazonåºåã®ã¿)ã¨ã¨ããã·ãããã³ã (ç¾å¨è²©å£²ä¸ã®ã¿)ã®æ¤ç´¢çµæãããããå¥ã¿ãã§è¡¨ç¤ºããã
ãã®ï¼
- ãヨドバシ・ドッド・コムãã§æ®éã«ååæ¤ç´¢ãã
- ããã¯ãã¼ã¯ã¬ãããå®è¡ãã
- Amazon(Amazonåºåã®ã¿)ã®æ¤ç´¢çµæãããããå¥ã¿ãã§è¡¨ç¤ºããã
注æç¹
- Amazonã¯JPã®ã¿å¯¾å¿
- å¥ã¿ãã§æ¤ç´¢çµæã表示ãããªãå ´åã¯ãæãããã©ã¦ã¶ã®ãããã¢ãããããã¯ãåå ãªã®ã§ãªãªã¸ãã«ã®ãã¼ã¸ã表示ãã¦ããã¿ãã®ä¸ã®ã»ãã«è¦åãåºã¦ãªãããã§ãã¯ãã¦è§£é¤ãã¦
- Androidã§Amazonã·ã§ããã³ã°ã¢ããªãã¤ã³ã¹ãã¼ã«ãã¦ããå ´åã¯Amazonã·ã§ããã³ã°ã¢ããªãæå®ãããªãã·ã§ã³ãæ¨ã¦ã¦éãã®ã§ã¢ããªè¨å®ãããªã³ã¯ã§éããªãããã«ããªãã¨é§ç®ã£ã
- ãµã¤ãã®è¨è¨ãå¤ããã¨åä½ããªããªãã®ã§ãã®æã¯çµããã§
- iOSã¨MacOSã¯ã¡ããã¨ãã¹ããã¦ãªãã®ã§æ£ç´åããªãã£ãããã¾ã
åè
ããã¯ãã¼ã¯ã¬ããã¯ä»¥ä¸ã®ãµã¤ããåèã«ä½æã
Bookmarkletを作ろう(準備編) - Qiita 純正JavaScriptでのクエリパラメータ取得 - Qiita アレな出品を一括除外? Amazonの検索結果をクリーンにできる「魔法の文字列」が話題に【やじうまWatch】 - INTERNET Watch
ãªãªã¸ãã«ã³ã¼ã
ããã¯ãã¼ã¯ã¬ããç¨ã«ã³ã³ãã¤ã«ããåã®ã³ã¼ããJavaScriptã¯ããã¾ãæ¸ããªãã®ã§çªã£è¾¼ã¾ãªãã§æ¬²ããã
javascript:( function () { const configs = { 'www.amazon.co.jp': { key: 'k', functions: [ openPureAma, openNowYodo, ] }, 'www.yodobashi.com': { key: 'word', functions: [ openPureAma ] } }; const config = configs[location.host]; if (config === undefined) { alert('ãã®ãµã¤ã[' + location.host + ']ã§ã¯å®è¡ã§ãã¾ããã'); return; } const key = getQueryParam(config.key); if (key === '') { alert('ååæ¤ç´¢ãè¡ã£ã¦ããå®è¡ãã¦ãã ããã'); return; } config.functions.forEach((f) => { f(key); }); function getQueryParam(key) { const value = window.location.href.match(new RegExp('[?&]' + key + '=(.*?)(&|$|#)')); if (value == null) return ''; return decodeURIComponent(value[1]); } function openPureAma(key) { // 'emi=AN1VRQENFRJN5'ã§åºåè Amazonã«çµãè¾¼ã const url = `https://www.amazon.co.jp/s?k=${key}&emi=AN1VRQENFRJN5`; window.open(url, '_blank', 'noopener'); } function openNowYodo(key) { // 'discontinued=false'ã§è²©å£²çµäºååãé表示ã«ãã const url = `https://www.yodobashi.com/?word=${key}&discontinued=false`; window.open(url, '_blank', 'noopener'); } } )();
å§ç¸®å¾
ãªãªã¸ãã«ã®ã³ã¼ãã以ä¸ã®ãµã¤ãã§ã³ã³ãã¤ã«ãã¦å é ã«ãjavascript:ããä»ããã¨ããã¯ãã¼ã¯ã¬ããã®å®æã
(function(){function c(a){window.open("https://www.amazon.co.jp/s?k="+a+"&emi=AN1VRQENFRJN5","_blank","noopener")}var b={"www.amazon.co.jp":{key:"k",a:[c,function(a){window.open("https://www.yodobashi.com/?word="+a+"&discontinued=false","_blank","noopener")}]},"www.yodobashi.com":{key:"word",a:[c]}}[location.host];if(void 0===b)alert("\u3053\u306e\u30b5\u30a4\u30c8["+location.host+"]\u3067\u306f\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002");else{var d=function(a){a=window.location.href.match(new RegExp("[?&]"+ a+"=(.*?)(&|$|#)"));return null==a?"":decodeURIComponent(a[1])}(b.key);""===d?alert("\u5546\u54c1\u691c\u7d22\u3092\u884c\u3063\u3066\u304b\u3089\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002"):b.a.forEach(function(a){a(d)})}})();
ã¨ãããã¨ã§ããªã«ãèªåæµã«æ¹é ãããæã¯ä¸è¨ãªãªã¸ãã«ã³ã¼ãããã¼ã¹ã«ç·¨éãã¡ãã£ã¦ãã ããã