Created
January 31, 2015 06:32
-
-
Save emanon001/a93d16cbbc3e7b18897e to your computer and use it in GitHub Desktop.
スポニチの画像表示用Flash をクリックすると、実際の画像リンクを開く
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 Sponichi image easy access | |
// @namespace https://github.com/emanon001/ | |
// @description スポニチの画像表示用Flash をクリックすると、実際の画像リンクを開く | |
// @include http://www.sponichi.co.jp/*/gazo/*.html | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
var flashObj = document.querySelector('.photo-boxC01 object'); | |
if (! flashObj) return; | |
var flashVarsElem = flashObj.querySelector('param[name="FlashVars"]'); | |
if (! flashVarsElem) return; | |
var flashVars = flashVarsElem.getAttribute('value'); | |
var photoUrl = flashVars.match(/jpg=(.*)&/)[1]; | |
if (! photoUrl) return; | |
flashObj.addEventListener('click', function () { | |
window.open(photoUrl); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment