Created
November 1, 2012 15:08
-
-
Save kageroh/3994197 to your computer and use it in GitHub Desktop.
Google Chrome (PC) でモバゲーするやつ汎用版(やったことあるゲームは個別に対応追加予定)(開発ツールの Emulate touch events にチェック必要)
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 emu.js | |
// @namespace http://twitter.com/amasawa | |
// @include http://sp.pf.mbga.jp/* | |
// @run-at document-start | |
// ==/UserScript== | |
(function () { | |
var script = document.createElement('script'); | |
script.textContent = '\ | |
(function () {\ | |
window.ontouchstart = function () {};\ | |
window.orientation = 0;\ | |
document.createTouch = function () {};\ | |
document.ontouchstart = function () {};\ | |
window.chrome = false;\ | |
Object.defineProperty(navigator, "platform", { get: function () { return "iPhone"; } });\ | |
}());\ | |
'; | |
/* 戦国コレクションは実行しなくていい(実行するとおかしくなる)ページがある */ | |
if (/12004449/.test(location.href) && /(?:quest_do|_swf)/.test(location.href)) return; | |
if (/12004449/.test(location.href) || /* 戦国コレクションは対策が強めなので DOMNodeInserted だと間に合わない */ | |
/tutorial/.test(location.href) && !/12008982/.test(location.href) /* モンハン カードマスターは除く */) { | |
location.href = 'javascript:' + script.textContent; | |
} else { | |
document.addEventListener('DOMNodeInserted', function (event) { | |
document.removeEventListener('DOMNodeInserted', arguments.callee, false); | |
event.target.appendChild(script); | |
script.parentNode.removeChild(script); | |
}, false); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment