Last active
August 28, 2016 06:41
-
-
Save udaken/d8c6f6dc5b152d1b9204cab24b9578e8 to your computer and use it in GitHub Desktop.
weblio replace swf to html5
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 weblio swf replacer | |
// @namespace http://d.hatena.ne.jp/deraw | |
// @description weblio replace swf to html5 | |
// @include http://ejje.weblio.jp/content/* | |
// @version 1.0 | |
// @grant none | |
// @license Public Domain | |
// @downloadURL https://gist.github.com/udaken/d8c6f6dc5b152d1b9204cab24b9578e8/raw/weblio_swf_replacer.user.js | |
// ==/UserScript== | |
(function(){ | |
var player = document.getElementById('ePsdQc'); | |
var keyword = document.getElementById('h1Query'); | |
var swfplayers = player.getElementsByTagName('object'); | |
if(swfplayers.length > 0) | |
{ | |
player.removeChild(swfplayers[0]); | |
} | |
var html5player = document.createElement('audio'); | |
html5player.setAttribute('controls', true); | |
html5player.setAttribute('preload', 'none'); | |
html5player.setAttribute('src', 'http://ejje.westatic.com/audio/' + keyword.textContent + '.mp3'); | |
player.appendChild(html5player); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment