Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kepstin committed Mar 28, 2023
2 parents 62926d2 + 52ab0f7 commit 8e7f348
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 26 additions & 1 deletion Fix-pixiv-thumbnails.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name:ja pixivサムネイルを改善する
// @namespace https://www.kepstin.ca/userscript/
// @license MIT; https://spdx.org/licenses/MIT.html
// @version 20201031.3
// @version 20230328.1
// @description Stop pixiv from cropping thumbnails to a square. Use higher resolution thumbnails on Retina displays.
// @description:ja 正方形にトリミングされて表示されるのを防止します。Retinaディスプレイで高解像度のサムネイルを使用します。
// @author Calvin Walton
Expand Down Expand Up @@ -280,6 +280,30 @@
})
}

function addStylesheet() {
if (!(window.location.host == "www.pixiv.net")) { return; }
if (document.head === null) {
document.addEventListener("DOMContentLoaded", addStylesheet, { once: true });
return;
}
let s = document.createElement("style");
s.textContent = `
div[type="illust"] {
border-radius: 0;
}
div[type="illust"] img {
border-radius: 0;
background: var(--charcoal-background1);
}
div[type="illust"] a > div::before {
border-radius: 0;
background: transparent;
box-shadow: inset 0 0 0 1px var(--charcoal-border);
}
`;
document.head.appendChild(s);
}

function loadSettings () {
const gmDomainOverride = GM_getValue('domainOverride')
if (typeof gmDomainOverride === 'undefined') {
Expand Down Expand Up @@ -326,6 +350,7 @@
})
}

addStylesheet()
onetimeThumbnails(document.firstElementChild)
const thumbnailObserver = new MutationObserver(mutationObserverCallback)
thumbnailObserver.observe(document.firstElementChild, {
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Stop pixiv from cropping thumbnails to a square. Use higher resolution thumbnails on Retina displays.

***2021-10-27** The [updated Discovery page](https://www.pixiv.net/info.php?id=7477) is already supported. No userscript update is required.*

Please note: this script will increase data usage on mobile devices.

I understand English and simple Japanese, please help translate :)
Expand Down

0 comments on commit 8e7f348

Please sign in to comment.