Created
October 10, 2010 02:14
-
-
Save mirakui/618846 to your computer and use it in GitHub Desktop.
dmm_util.user.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DMM Util | |
// @description DMM Utility | |
// @match http://www.dmm.co.jp/* | |
// ==/UserScript== | |
(function() { | |
function replaceImg(img) { | |
var src = img.src | |
img.onload = function(){ | |
img.width = img.naturalWidth; | |
img.height = img.naturalHeight; | |
} | |
if (src.match(/ps\.jpg$/)) { | |
img.src = src.replace(/ps\.jpg$/, "pl.jpg"); | |
} | |
else if (src.match(/pt\.jpg$/)) { | |
img.src = src.replace(/pt\.jpg$/, "ps.jpg"); | |
} | |
else if (src.match(/-\d+\.jpg$/)) { | |
img.src = src.replace(/-\d+\.jpg$/, "jp$&"); | |
} | |
} | |
window.addEventListener("load", function() { | |
if (!unsafeWindow.$$) { | |
return ; | |
} | |
unsafeWindow.$A(unsafeWindow.$$("img[src^='http://pics.dmm'][src$='.jpg']")).each(function(img) { | |
replaceImg(img); | |
}); | |
var samplevideo = unsafeWindow.$$("#sample-video").first(); | |
if (samplevideo) { | |
samplevideo.insert('<iframe src="' + window.location.href + 'ajax=movie" width="680" height="490" scrolling="no" style="border:none"/>'); | |
} | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment