Skip to content

Instantly share code, notes, and snippets.

@kageroh
Created November 1, 2012 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kageroh/3994197 to your computer and use it in GitHub Desktop.
Save kageroh/3994197 to your computer and use it in GitHub Desktop.
Google Chrome (PC) でモバゲーするやつ汎用版(やったことあるゲームは個別に対応追加予定)(開発ツールの Emulate touch events にチェック必要)
// ==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