Skip to content

Instantly share code, notes, and snippets.

@dd-han
Last active August 17, 2018 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dd-han/17e0f43102c8331ff8727946b1fe4e4a to your computer and use it in GitHub Desktop.
Save dd-han/17e0f43102c8331ff8727946b1fe4e4a to your computer and use it in GitHub Desktop.
kancolle-best-window
document.getElementById('area-game').style['text-align'] = 'left';
var borderX = (window.outerWidth - window.innerWidth);
var borderY = (window.outerHeight - window.innerHeight);
var frame = document.getElementById('game_frame');
var rectHeight = frame.getBoundingClientRect().top;
var toY = rectHeight + 16 + window.pageYOffset;
/*
var toX = (document.getElementById('adFlashWrap').style.width - document.getElementById('maintenanceswf').style.width) / 2;
var width = document.getElementById('maintenanceswf').style.width;
var height = document.getElementById('maintenanceswf').style.height;
*/
window.scrollTo(58 - borderX, toY);
window.resizeTo(1200 + borderX,720+borderY);
document.getElementsByTagName('body')[0].style.overflow = 'hidden';
'ref: http://www.roy.hi-ho.ne.jp/mutaguchi/wsh/object/ie.htm
' https://social.msdn.microsoft.com/Forums/ie/en-US/06d38532-4b95-42b1-8c89-9ba5e5c6b8dc/how-to-convert-vbvba-code-from-iedocumentparentwindowexecutescriptjavascript-to?forum=iewebdevelopment
' https://stackoverflow.com/questions/11026949/vbscript-to-detect-if-user-exits-quits-out-of-internet-explorer-window?rq=1
Dim gameUrl
gameUrl = "http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/"
Dim jsScript
jsScript = "document.getElementById('area-game').style['text-align']='left';var borderX=(window.outerWidth-window.innerWidth);var borderY=(window.outerHeight-window.innerHeight);var frame=document.getElementById('game_frame');var rectHeight=frame.getBoundingClientRect().top;var toY=rectHeight+16+window.pageYOffset;window.scrollTo(58-borderX,toY);window.resizeTo(1200+borderX,720+borderY);document.getElementsByTagName('body')[0].style.overflow='hidden'"
Dim objIE
Set objIE = WScript.CreateObject("InternetExplorer.Application", "IE_")
objIE.Top = 0
objIE.Left = 0
objIE.Toolbar = false
objIE.Navigate gameUrl
objIE.Visible = true
' Keep the script busy so it doesn't end while waiting for the IE event
' It will start executing inside the subroutine below when the event fires
Do While True
WScript.Sleep 1000
Loop
Sub IE_onQuit
WScript.Echo "quit"
WScript.Quit 1
End Sub
Sub IE_DocumentComplete(pDisp, URL)
'WScript.Echo "DocumentComplete: " + URL
If InStr(1, URL, "http://osapi.dmm.com/gadgets/") = 1 Then
'WScript.Echo "===> main game page loaded"
'WScript.Echo "===> Inject some javascript here"
Call objIE.document.parentWindow.execScript (jsScript, "javascript")
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment