diff --git a/content.js b/content.js new file mode 100644 index 0000000..d952c89 --- /dev/null +++ b/content.js @@ -0,0 +1,52 @@ +console.log("working"); +//ページが読み込まれたら実行 +window.onload = function () { + function replaceMicroWithMain() { + // すべてのIMGタグを取得 + const imgElements = document.querySelectorAll('img'); + + // すべてのsourceタグを取得 + const sourceElements = document.querySelectorAll('source'); + + // IMGタグの要素をループで処理 + imgElements.forEach(img => { + // "src"属性の値を取得 + const srcValue = img.getAttribute('src'); + + // "data-src"属性の値を取得 + const dataSrcValue = img.getAttribute('data-src'); + + // "src"属性に"micro"という文字列が含まれているかチェック + if (srcValue.includes('micro') && !srcValue.includes('cc.fantia.jp')) { + // "src"属性の値を"micro"を"main"に置換して更新 + img.setAttribute('src', srcValue.replace('micro', 'main')); + console.log(img); + } + + // "data-src"属性に"micro"という文字列が含まれているかチェック + if (dataSrcValue && dataSrcValue.includes('micro') && !dataSrcValue.includes('cc.fantia.jp')) { + // "data-src"属性の値を"micro"を"main"に置換して更新 + img.setAttribute('data-src', dataSrcValue.replace('micro', 'main')); + console.log(img); + } + }); + + // sourceタグの要素をループで処理 + sourceElements.forEach(source => { + // "srcset"属性の値を取得 + const srcsetValue = source.getAttribute('srcset'); + + // "srcset"属性に"micro"という文字列が含まれているかチェック + if (srcsetValue && srcsetValue.includes('micro') && !srcsetValue.includes('cc.fantia.jp')) { + // "srcset"属性の値を"micro"を"main"に置換して更新 + source.setAttribute('srcset', srcsetValue.replace('micro', 'main')); + console.log(source); + } + }); + } + + // 一定の間隔(1秒ごと)で置き換えを実行 + setInterval(replaceMicroWithMain, 1000); // 1000ミリ秒 = 1秒 + + +} \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..61a9b45 --- /dev/null +++ b/manifest.json @@ -0,0 +1,22 @@ +{ + "manifest_version": 3, + "name": "Fantiaぼかし解除", + "version": "1.0", + "description": "fantiaを未ログイン状態でもぼかしなしで閲覧できるようにする拡張機能です。", + "permissions": [ + "activeTab" + ], + "content_scripts": [ + { + "matches": [ + "https://fantia.jp/*" + ], + "js": [ + "content.js" + ], + "css": [ + "styles.css" + ] + } + ] +} \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..e67610e --- /dev/null +++ b/styles.css @@ -0,0 +1,26 @@ +/* styles.css */ +.img-blurred { + filter: blur(0px) !important; + -webkit-filter: blur(0px) !important; +} + + +body #page #main.single-product .the-product .product-body .product-gallery-container .product-thumbnail-message, +body #page #main.single-commission .the-product .product-body .product-gallery-container .product-thumbnail-message, +body #page #main.single-live-event .the-product .product-body .product-gallery-container .product-thumbnail-message { + position: initial !important; +} + +body #page #main.single-product .the-product .product-body .product-gallery-container .product-thumbnail-message .product-thumbnail-message-body, +body #page #main.single-commission .the-product .product-body .product-gallery-container .product-thumbnail-message .product-thumbnail-message-body, +body #page #main.single-live-event .the-product .product-body .product-gallery-container .product-thumbnail-message .product-thumbnail-message-body { + display: none !important; +} + +body.posts-show #page #main.single-post .single-post-body .the-post .post-thumbnail .post-thumbnail-message .post-thumbnail-message-body { + display: none !important; +} + +body.posts-show #page #main.single-post .single-post-body .the-post .post-thumbnail .post-thumbnail-message { + background-color: transparent !important; +} \ No newline at end of file