Skip to content

Instantly share code, notes, and snippets.

@udaken
Last active August 28, 2016 06:41
Show Gist options
  • Save udaken/d8c6f6dc5b152d1b9204cab24b9578e8 to your computer and use it in GitHub Desktop.
Save udaken/d8c6f6dc5b152d1b9204cab24b9578e8 to your computer and use it in GitHub Desktop.
weblio replace swf to html5
// ==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