Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseos authored Aug 14, 2023
1 parent 81d8956 commit 17533f9
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
52 changes: 52 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
@@ -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秒


}
22 changes: 22 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}
26 changes: 26 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 17533f9

Please sign in to comment.