Skip to content

Instantly share code, notes, and snippets.

@xaicron
Created June 10, 2009 17:23
Show Gist options
  • Save xaicron/127367 to your computer and use it in GitHub Desktop.
Save xaicron/127367 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Pixiv Big Image
// @namespace http://blog.livedoor.jp/xaicron/
// @description always big illust view of pixiv
// @include http://www.pixiv.net/*
// ==/UserScript==
(function () {
var style = document.body.appendChild(document.createElement('style'));
var sandboxSheet = style.sheet || style.styleSheet;
var addCssRule = (function (selector, property) {
try {
sandboxSheet.insertRule(selector + '{' + property + '}', (sandboxSheet.cssRules || sandboxSheet.rules).length);
}
catch(e) {
sandboxSheet.addRule(selector, property);
}
});
addCssRule('#wrapper', 'width: auto');
addCssRule('#content', 'width: auto');
addCssRule('#content2', 'width: auto');
addCssRule('#content3', 'width: auto');
var ChangeBigImage = (function (elem) {
for (var i = 0; i < elem.childNodes.length; i++) {
child = elem.childNodes[i];
if (child.nodeName === 'IMG') {
child.src = child.src.replace(/_s(\.[^.]+)$/, '$1');
}
else if (child.childNodes.length) {
arguments.callee(child);
}
}
});
var illustList = [
'illust_c3',
'illust_c4',
'llust_c4_bs',
'illust_c4_comike',
'illust_c4_200',
'illust_c5'
];
for (var i = 0; i < illustList.length; i++) {
var tagId = illustList[i];
addCssRule('#' + tagId + ' li', 'width: auto; float: none; text-align: left;');
var elem = document.getElementById(tagId);
if (!elem) { continue }
ChangeBigImage(elem);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment