Skip to content

Instantly share code, notes, and snippets.

@emanon001
Created January 31, 2015 06:32
Show Gist options
  • Save emanon001/a93d16cbbc3e7b18897e to your computer and use it in GitHub Desktop.
Save emanon001/a93d16cbbc3e7b18897e to your computer and use it in GitHub Desktop.
スポニチの画像表示用Flash をクリックすると、実際の画像リンクを開く
// ==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