comparison surugaya-fixes.user.js @ 107:4bc5a633437c

The urls need to be lowercased
author nanaya <me@nanaya.net>
date Sun, 15 Jan 2023 23:15:45 +0900
parents 42fbeb68c0e5
children 2c4470b73ad9
comparison
equal deleted inserted replaced
106:42fbeb68c0e5 107:4bc5a633437c
1 // ==UserScript== 1 // ==UserScript==
2 // @name suruga-ya fixes 2 // @name suruga-ya fixes
3 // @namespace https://myconan.net 3 // @namespace https://myconan.net
4 // @version 2.0.1 4 // @version 2.0.2
5 // @description Show all products with fast image 5 // @description Show all products with fast image
6 // @author nanaya 6 // @author nanaya
7 // @match https://www.suruga-ya.jp/* 7 // @match https://www.suruga-ya.jp/*
8 // @grant none 8 // @grant none
9 // @downloadURL https://hg.myconan.net/ec-userscripts/raw-file/tip/surugaya-fixes.user.js 9 // @downloadURL https://hg.myconan.net/ec-userscripts/raw-file/tip/surugaya-fixes.user.js
29 const origSrc = image.getAttribute('src') 29 const origSrc = image.getAttribute('src')
30 if (origSrc == null) return 30 if (origSrc == null) return
31 const found = origSrc.match(itemImageRegexp) 31 const found = origSrc.match(itemImageRegexp)
32 if (found == null) return 32 if (found == null) return
33 33
34 const src = `https://www.suruga-ya.jp/database/pics_light/game/${found[1]}.jpg` 34 const src = `https://www.suruga-ya.jp/database/pics_light/game/${found[1].toLowerCase()}.jpg`
35 const setNotFound = () => { 35 const setNotFound = () => {
36 image.removeEventListener('error', setNotFound) 36 image.removeEventListener('error', setNotFound)
37 image.setAttribute('src', 'https://www.suruga-ya.jp/database/images/no_photo.jpg') 37 image.setAttribute('src', 'https://www.suruga-ya.jp/database/images/no_photo.jpg')
38 } 38 }
39 image.addEventListener('error', setNotFound) 39 image.addEventListener('error', setNotFound)