Created
February 13, 2014 01:54
-
-
Save gozen-bro3/8968308 to your computer and use it in GitHub Desktop.
ブラウザ三国志 フレーム変更
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 bro_wideframe | |
// @version 1.00 | |
// @description ブラウザ三国志 フレーム変更 | |
// @include http://mixi.jp/run_appli.pl?id=6598 | |
// @include http://*.mixi-platform.com/* | |
// @include http://*.3gokushi.jp/* | |
// @icon https://raw.github.com/5zen/bro3_dasu/master/icon.png | |
// @grant GM_listValues | |
// @grant GM_setValue | |
// @grant GM_registerMenuCommand | |
// @grant GM_log | |
// @grant GM_getValue | |
// @grant GM_deleteValue | |
// @grant GM_addStyle | |
// ==/UserScript== | |
var CHECK_TIME = 500; | |
if(location.hostname.match("mixi-platform.com")){ | |
if(!location.pathname.match("/gadgets/ifr")) return; | |
if(decodeURIComponent(location.search).match(/&app_id=[^&]+&/)!="&app_id=6598&") return; | |
} | |
GM_addStyle( | |
".adBanner {display:none !important;}" + | |
"#ADDSPACE, .appliSidebox01 {display:none !important;}" | |
); | |
console.log(location.href); | |
if(location.href=="http://mixi.jp/run_appli.pl?id=6598") { | |
GM_addStyle(".appliAdArea01 { display:none !important;}"); | |
window.addEventListener("message",function( event ) { | |
if(!event.origin.match(/http:\/\/m\d+\.3gokushi\.jp/)) return; | |
var iframe = document.getElementById('app_content_6598'); | |
if(iframe == null) return; | |
var data = JSON.parse(event.data); | |
if(data.command != 'resize') return; | |
iframe.style.height = data.height + 'px'; | |
},false); | |
} | |
if(location.href.match(/m\d+\.3gokushi\.jp/)){ // フレームチェック | |
if(window.parent != window){ // フレームで無かったら何もしない | |
var height = 0; | |
setInterval(function() { | |
var target = window.parent.postMessage ? window.parent : undefined; | |
if(height == document.body.offsetHeight) return; | |
height = document.body.offsetHeight; | |
if(typeof target != 'undefined') { | |
var send = {"command": "resize","height" : height,}; | |
target.postMessage(JSON.stringify(send),'http://mixi.jp'); | |
} | |
},CHECK_TIME); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment