Created
April 19, 2010 09:14
-
-
Save olleolleolle/370862 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| === modified file 'plugin/npapi/scriptable-test.html' | |
| --- plugin/npapi/scriptable-test.html 2010-04-15 20:19:54 +0000 | |
| +++ plugin/npapi/scriptable-test.html 2010-04-19 08:56:51 +0000 | |
| @@ -1,282 +1,245 @@ | |
| <html> | |
| <head> | |
| - <title>Scriptable Plugin Test</title> | |
| + <title>Gnash: Scriptable Plugin Test</title> | |
| + <style type="text/css" media="screen"> | |
| + body, * {font-family:sans-serif;} | |
| + h1 {text-align:center;} | |
| + #content {} | |
| + #test-actions { | |
| + list-style-type: none; | |
| + margin: 0; | |
| + padding: 0; | |
| + } | |
| + p {font-family: monospace;} | |
| + #log { | |
| + font-family: monospace; | |
| + width: 800px; | |
| + float:right; | |
| + } | |
| + #log p { | |
| + margin: 0; | |
| + border-bottom:1px solid gray; | |
| + } | |
| + #log h2 a { | |
| + font-style: italic; | |
| + font-weight:normal; | |
| + font-size:12px; | |
| + } | |
| + </style> | |
| </head> | |
| <body> | |
| - | |
| - <center> | |
| - <h1> Scriptable Plugin </h1> | |
| - </center> | |
| - | |
| - <br><br> | |
| - | |
| - <center> | |
| - | |
| - <embed type="application/x-shockwave-flash" width=1 height=1 hidden="true"><br> | |
| + <h1>Scriptable Plugin testbed</h1> | |
| + <div id="log"> | |
| + <h2>Log <a href="#" onclick="clearLog(); return false;">Clear</a></h2> | |
| - <script> | |
| + </div> | |
| + <div id="content"> | |
| + | |
| + <embed type="application/x-shockwave-flash" width="1" height="1" hidden="true"> | |
| + | |
| + <ul id="test-actions"> | |
| + <li><button onclick='ShowVersion()'>Show Version</button></li> | |
| + <li><button onclick='ShowFoobar("barfood")'>Show Foobar</button></li> | |
| + <li><button onclick='FlashSetVariable("var1", "value1")'>SetVariable</button></li> | |
| + <li><button onclick='FlashGetVariable("var1")'>GetVariable</button></li> | |
| + <li><button onclick='FlashGotoFrame(123)'>GotoFrame</button></li> | |
| + <li><button onclick='FlashIsPlaying()'>IsPlaying</button></li> | |
| + <li><button onclick='FlashLoadMovie(2, "bogus")'>LoadMovie</button></li> | |
| + <li><button onclick='FlashPan(1, 2, 0)'>Pan</button></li> | |
| + <li><button onclick='FlashPercentLoaded()'>PercentLoaded</button></li> | |
| + <li><button onclick='FlashPlay()'>Play</button></li> | |
| + <li><button onclick='FlashRewind()'>Rewind</button></li> | |
| + <li><button onclick='FlashSetZoomRect(1, 2, 3, 4)'>SetZoomRect</button></li> | |
| + <li><button onclick='FlashStopPlay()'>StopPlay</button></li> | |
| + <li><button onclick='FlashZoom(12)'>Zoom</button></li> | |
| + <li><button onclick='FlashTotalFrames()'>TotalFrames</button></li> | |
| + </ul> | |
| + | |
| +</div> | |
| + | |
| + <script type="text/javascript"> | |
| var embed = document.embeds[0]; | |
| - | |
| - function ShowVersion() | |
| - { | |
| - document.write("Codebase = = " + embed.codebase + "<br>"); | |
| - document.write("Classid = " + embed.classid + "<br>"); | |
| - document.write("Pluginspage = " + embed.pluginspage + "<br>"); | |
| - document.write("Src = " + embed.src + "<br>"); | |
| - document.write("BG Color = " + embed.bgcolor + "<br>"); | |
| - document.write("Quality = " + embed.quality + "<br>"); | |
| - document.write("movie = " + embed.movie + "<br>"); | |
| - // document.write("onafterupdate = " + embed.onafterupdate + "<br>"); | |
| - // document.write("onbeforeupdate = " + embed.onbeforeupdate + "<br>"); | |
| - // document.write("onblur = " + embed.onblur + "<br>"); | |
| - // document.write("oncellchange = " + embed.oncellchange + "<br>"); | |
| - // document.write("onclick = " + embed.onclick + "<br>"); | |
| - // document.write("ondblClick = " + embed.ondblClick + "<br>"); | |
| - // document.write("ondrag = " + embed.ondrag + "<br>"); | |
| - // document.write("ondragend = " + embed.ondragend + "<br>"); | |
| - // document.write("ondragenter = " + embed.ondragenter + "<br>"); | |
| - // document.write("ondragleave = " + embed.ondragleave + "<br>"); | |
| - // document.write("ondragover = " + embed.ondragover + "<br>"); | |
| - // document.write("ondrop = " + embed.ondrop + "<br>"); | |
| - // document.write("onfinish = " + embed.onfinish + "<br>"); | |
| - // document.write("onfocus = " + embed.onfocus + "<br>"); | |
| - // document.write("onhelp = " + embed.onhelp + "<br>"); | |
| - // document.write("onmousedown = " + embed.onmousedown + "<br>"); | |
| - // document.write("onmouseup = " + embed.onmouseup + "<br>"); | |
| - // document.write("onmouseover = " + embed.onmouseover + "<br>"); | |
| - // document.write("onmousemove = " + embed.onmousemove + "<br>"); | |
| - // document.write("onmouseout = " + embed.onmouseout + "<br>"); | |
| - // document.write("onkeypress = " + embed.onkeypress + "<br>"); | |
| - // document.write("onkeydown = " + embed.onkeydown + "<br>"); | |
| - // document.write("onkeyup = " + embed.onkeyup + "<br>"); | |
| - // document.write("onload = " + embed.onload + "<br>"); | |
| - // document.write("onlosecapture = " + embed.onlosecapture + "<br>"); | |
| - // document.write("onpropertychange = " + embed.onpropertychange + "<br>"); | |
| - // document.write("onreadystatechange = " + embed.onreadystatechange + "<br>"); | |
| - // document.write("onrowsdelete = " + embed.onrowsdelete + "<br>"); | |
| - // document.write("onrowenter = " + embed.onrowenter + "<br>"); | |
| - // document.write("onrowexit = " + embed.onrowexit + "<br>"); | |
| - // document.write("onrowsinserted = " + embed.onrowsinserted + "<br>"); | |
| - // document.write("onstart = " + embed.onstart + "<br>"); | |
| - // document.write("onscroll = " + embed.onscroll + "<br>"); | |
| - // document.write("onbeforeeditfocus = " + embed.onbeforeeditfocus + "<br>"); | |
| - // document.write("onactivate = " + embed.onactivate) + "<br>"; | |
| - // document.write("onbeforedeactivate = " + embed.onbeforedeactivate + "<br>"); | |
| - // document.write("ondeactivate = " + embed.ondeactivate + "<br>"); | |
| - document.write("type = " + embed.type + "<br>"); | |
| - document.write("id = " + embed.id + "<br>"); | |
| - document.write("width = " + embed.width + "<br>"); | |
| - document.write("height = " + embed.height + "<br>"); | |
| - document.write("align = " + embed.align + "<br>"); | |
| - document.write("vspace", + embed.vspace + "<br>"); | |
| - document.write("hspace = " + embed.hspace + "<br>"); | |
| - document.write("class = " + embed.class + "<br>"); | |
| - document.write("title = " + embed.title + "<br>"); | |
| - document.write("accesskey = " + embed.accesskey + "<br>"); | |
| - document.write("name = " + embed.name + "<br>"); | |
| - document.write("tabindex = " + embed.tabindex + "<br>"); | |
| - document.write("FlashVars = " + embed.FlashVars + "<br>"); | |
| - | |
| - alert(embed.version); | |
| -} | |
| - | |
| -function FlashSetVariable(name, value) | |
| -{ | |
| - embed.SetVariable(name, value); | |
| -// alert("FlashSetVariable"); | |
| -} | |
| - | |
| -function FlashGetVariable(name) | |
| -{ | |
| - var value = embed.GetVariable(name); | |
| -// document.write("Got Variable = " + value + "<br>"); | |
| - alert(value); | |
| -} | |
| - | |
| -function FlashGotoFrame(num) | |
| -{ | |
| - embed.GotoFrame(num); | |
| -// document.write("GotoFrame<br>"); | |
| -// alert(value); | |
| -} | |
| - | |
| -function FlashIsPlaying() | |
| -{ | |
| - var value = embed.IsPlaying(); | |
| -// document.write("IsPlaying() = " + value + "<br>"); | |
| - alert(value); | |
| -} | |
| - | |
| -function FlashLoadMovie(layer, name) | |
| -{ | |
| - embed.LoadMovie(layer, name); | |
| -// document.write("LoadMovie()<br>"); | |
| -// alert("FlashLoadMovie"); | |
| -} | |
| - | |
| -function FlashPan(x, y, mode) | |
| -{ | |
| - embed.Pan(x, y, mode); | |
| -// document.write("Pan()<br>"); | |
| -// alert("FlashPan"); | |
| -} | |
| - | |
| -function FlashPercentLoaded() | |
| -{ | |
| - var value = embed.PercentLoaded(); | |
| -// document.write("PercentLoaded() = " + value + "<br>"); | |
| - alert(value); | |
| -} | |
| - | |
| -function FlashPlay() | |
| -{ | |
| - embed.Play(); | |
| -// document.write("Play()<br>"); | |
| -// alert("FlashPlay"); | |
| -} | |
| - | |
| -function FlashRewind() | |
| -{ | |
| - embed.Rewind(); | |
| -// document.write("Rewind()<br>"); | |
| -// alert("FlashRewind"); | |
| -} | |
| - | |
| -function FlashSetZoomRect(left, top, right, bottom) | |
| -{ | |
| - embed.SetZoomRect(left, top, right, bottom); | |
| -// document.write("SetZoomRect()<br>"); | |
| -// alert("FlashSetZoomRect"); | |
| -} | |
| - | |
| -function FlashStopPlay() | |
| -{ | |
| - embed.StopPlay(); | |
| -// document.write("StopPlay()<br>"); | |
| -// alert("FlashStopPlay"); | |
| -} | |
| - | |
| -function FlashZoom(zoom) | |
| -{ | |
| - embed.Zoom(zoom); | |
| -// document.write("Zoom()<br>"); | |
| -// alert("FlashZoom"); | |
| -} | |
| - | |
| -function FlashTotalFrames() | |
| -{ | |
| - var value = embed.TotalFrames(); | |
| -// document.write("TotalFrames() = " + value + "<br>"); | |
| - alert(value); | |
| -} | |
| - | |
| -function ShowFoobar(msg) | |
| -{ | |
| - document.write(embed.SetVariable("foo", "bar") + "<br>"); | |
| - document.write(embed.SetVariable("fuby", 1.1) + "<br>"); | |
| - document.write(embed.GetVariable("foo") + "<br>"); | |
| - | |
| - alert(embed.showFoobar(msg)); | |
| -} | |
| + function clearLog() { | |
| + var log = document.getElementById("log"); | |
| + log.innerHTML = '<h2>Log <a href="#" onclick="clearLog(); return false;">Clear</a></h2>'; | |
| + } | |
| + function addLog(str) { | |
| + var p = document.createElement("P"); | |
| + p.innerHTML = str; | |
| + var log = document.getElementById("log"); | |
| + log.appendChild(p); | |
| + } | |
| + | |
| + function ShowVersion() { | |
| + var v = ''; | |
| + v += "Codebase = " + embed.codebase + "<br>"; | |
| + v += "Classid = " + embed.classid + "<br>"; | |
| + v += "Plugins page = " + embed.pluginspage + "<br>"; | |
| + v += "Src = " + embed["src"] + "<br>"; | |
| + v += "BG Color = " + embed.bgcolor + "<br>"; | |
| + v += "Quality = " + embed.quality + "<br>"; | |
| + v += "movie = " + embed.movie + "<br>"; | |
| + // v += "onafterupdate = " + embed.onafterupdate + "<br>"; | |
| + // v += "onbeforeupdate = " + embed.onbeforeupdate + "<br>"; | |
| + // v += "onblur = " + embed.onblur + "<br>"; | |
| + // v += "oncellchange = " + embed.oncellchange + "<br>"; | |
| + // v += "onclick = " + embed.onclick + "<br>"; | |
| + // v += "ondblClick = " + embed.ondblClick + "<br>"; | |
| + // v += "ondrag = " + embed.ondrag + "<br>"; | |
| + // v += "ondragend = " + embed.ondragend + "<br>"; | |
| + // v += "ondragenter = " + embed.ondragenter + "<br>"; | |
| + // v += "ondragleave = " + embed.ondragleave + "<br>"; | |
| + // v += "ondragover = " + embed.ondragover + "<br>"; | |
| + // v += "ondrop = " + embed.ondrop + "<br>"; | |
| + // v += "onfinish = " + embed.onfinish + "<br>"; | |
| + // v += "onfocus = " + embed.onfocus + "<br>"; | |
| + // v += "onhelp = " + embed.onhelp + "<br>"; | |
| + // v += "onmousedown = " + embed.onmousedown + "<br>"; | |
| + // v += "onmouseup = " + embed.onmouseup + "<br>"; | |
| + // v += "onmouseover = " + embed.onmouseover + "<br>"; | |
| + // v += "onmousemove = " + embed.onmousemove + "<br>"; | |
| + // v += "onmouseout = " + embed.onmouseout + "<br>"; | |
| + // v += "onkeypress = " + embed.onkeypress + "<br>"; | |
| + // v += "onkeydown = " + embed.onkeydown + "<br>"; | |
| + // v += "onkeyup = " + embed.onkeyup + "<br>"; | |
| + // v += "onload = " + embed.onload + "<br>"; | |
| + // v += "onlosecapture = " + embed.onlosecapture + "<br>"; | |
| + // v += "onpropertychange = " + embed.onpropertychange + "<br>"; | |
| + // v += "onreadystatechange = " + embed.onreadystatechange + "<br>"; | |
| + // v += "onrowsdelete = " + embed.onrowsdelete + "<br>"; | |
| + // v += "onrowenter = " + embed.onrowenter + "<br>"; | |
| + // v += "onrowexit = " + embed.onrowexit + "<br>"; | |
| + // v += "onrowsinserted = " + embed.onrowsinserted + "<br>"; | |
| + // v += "onstart = " + embed.onstart + "<br>"; | |
| + // v += "onscroll = " + embed.onscroll + "<br>"; | |
| + // v += "onbeforeeditfocus = " + embed.onbeforeeditfocus + "<br>"; | |
| + // v += "onactivate = " + embed.onactivate + "<br>"; | |
| + // v += "onbeforedeactivate = " + embed.onbeforedeactivate + "<br>"; | |
| + // v += "ondeactivate = " + embed.ondeactivate + "<br>"; | |
| + | |
| + v += "type = " + embed.type + "<br>"; | |
| + v += "id = " + embed.id + "<br>"; | |
| + v += "width = " + embed.width + "<br>"; | |
| + v += "height = " + embed.height + "<br>"; | |
| + v += "align = " + embed.align + "<br>"; | |
| + v += "vspace = " + embed.vspace + "<br>"; | |
| + v += "hspace = " + embed.hspace + "<br>"; | |
| + v += "class = " + embed["class"] + "<br>"; | |
| + v += "title = " + embed.title + "<br>"; | |
| + v += "accesskey = " + embed.accesskey + "<br>"; | |
| + v += "name = " + embed.name + "<br>"; | |
| + v += "tabindex = " + embed.tabindex + "<br>"; | |
| + v += "FlashVars = " + embed.FlashVars + "<br>"; | |
| + | |
| + addLog('Found version is:' + embed.version); | |
| + addLog(v); | |
| + | |
| + } | |
| + | |
| + function FlashSetVariable(name, value) | |
| + { | |
| + embed.SetVariable(name, value); | |
| + // addLog("FlashSetVariable"); | |
| + } | |
| + | |
| + function FlashGetVariable(name) | |
| + { | |
| + var value = embed.GetVariable(name); | |
| + // addLog("Got Variable = " + value); | |
| + addLog(value); | |
| + } | |
| + | |
| + function FlashGotoFrame(num) | |
| + { | |
| + embed.GotoFrame(num); | |
| + // addLog("GotoFrame<br>"); | |
| + // addLog(value); | |
| + } | |
| + | |
| + function FlashIsPlaying() | |
| + { | |
| + var value = embed.IsPlaying(); | |
| + // addLog("IsPlaying() = " + value); | |
| + addLog(value); | |
| + } | |
| + | |
| + function FlashLoadMovie(layer, name) | |
| + { | |
| + embed.LoadMovie(layer, name); | |
| + // addLog("LoadMovie()<br>"); | |
| + // addLog("FlashLoadMovie"); | |
| + } | |
| + | |
| + function FlashPan(x, y, mode) | |
| + { | |
| + embed.Pan(x, y, mode); | |
| + // addLog("Pan()<br>"); | |
| + // addLog("FlashPan"); | |
| + } | |
| + | |
| + function FlashPercentLoaded() | |
| + { | |
| + var value = embed.PercentLoaded(); | |
| + // addLog("PercentLoaded() = " + value); | |
| + addLog(value); | |
| + } | |
| + | |
| + function FlashPlay() | |
| + { | |
| + embed.Play(); | |
| + // addLog("Play()<br>"); | |
| + // addLog("FlashPlay"); | |
| + } | |
| + | |
| + function FlashRewind() | |
| + { | |
| + embed.Rewind(); | |
| + // addLog("Rewind()<br>"); | |
| + // addLog("FlashRewind"); | |
| + } | |
| + | |
| + function FlashSetZoomRect(left, top, right, bottom) | |
| + { | |
| + embed.SetZoomRect(left, top, right, bottom); | |
| + // addLog("SetZoomRect()<br>"); | |
| + // addLog("FlashSetZoomRect"); | |
| + } | |
| + | |
| + function FlashStopPlay() | |
| + { | |
| + embed.StopPlay(); | |
| + // addLog("StopPlay()<br>"); | |
| + // addLog("FlashStopPlay"); | |
| + } | |
| + | |
| + function FlashZoom(zoom) | |
| + { | |
| + embed.Zoom(zoom); | |
| + // addLog("Zoom()<br>"); | |
| + // addLog("FlashZoom"); | |
| + } | |
| + | |
| + function FlashTotalFrames() | |
| + { | |
| + var value = embed.TotalFrames(); | |
| + // addLog("TotalFrames() = " + value); | |
| + addLog(value); | |
| + } | |
| + | |
| + function ShowFoobar(msg) | |
| + { | |
| + addLog(embed.SetVariable("foo", "bar")); | |
| + addLog(embed.SetVariable("fuby", 1.1)); | |
| + addLog(embed.GetVariable("foo")); | |
| + if (typeof embed.showFoobar === 'function') { | |
| + addLog('Running embed.showFoobar("'+msg+'")'); | |
| + addLog(embed.showFoobar(msg)); | |
| + } else { | |
| + addLog("Quitting: embed.showFoobar is not a function. Tried running embed.showFoobar('"+msg+"')"); | |
| + } | |
| + } | |
| </script> | |
| -<br> | |
| -<form name="form1"> | |
| -<input type=button value="Show Version" onclick='ShowVersion()'> | |
| -</form> | |
| -<br> | |
| - | |
| -<form name="form2"> | |
| -<input type=button value="Show Foobar" onclick='ShowFoobar("barfood")'> | |
| -</form> | |
| - | |
| -</center> | |
| - | |
| -<div id="main"> | |
| -<table> | |
| - <tr><td> | |
| - <form name="form3"> | |
| - <input type=button value="SetVariable" onclick='FlashSetVariable("var1", "value1")'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form4"> | |
| - <input type=button value="GetVariable" onclick='FlashGetVariable("var1")'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form5"> | |
| - <input type=button value="GotoFrame" onclick='FlashGotoFrame(123)'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form6"> | |
| - <input type=button value="IsPlaying" onclick='FlashIsPlaying()'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form7"> | |
| - <input type=button value="LoadMovie" onclick='FlashLoadMovie(2, "bogus")'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form8"> | |
| - <input type=button value="Pan" onclick='FlashPan(1, 2, 0)'> | |
| - </form> | |
| - | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form9"> | |
| - <input type=button value="PercentLoaded" onclick='FlashPercentLoaded()'> | |
| - </form> | |
| - </td> | |
| - | |
| - </tr><tr> | |
| - | |
| - <td> | |
| - <form name="form10"> | |
| - <input type=button value="Play" onclick='FlashPlay()'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form11"> | |
| - <input type=button value="Rewind" onclick='FlashRewind()'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form12"> | |
| - <input type=button value="SetZoomRect" onclick='FlashSetZoomRect(1, 2, 3, 4)'> | |
| - </form> | |
| - | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form13"> | |
| - <input type=button value="StopPlay" onclick='FlashStopPlay()'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form14"> | |
| - <input type=button value="Zoom" onclick='FlashZoom(12)'> | |
| - </form> | |
| - </td> | |
| - | |
| - <td> | |
| - <form name="form15"> | |
| - <input type=button value="TotalFrames" onclick='FlashTotalFrames()'> | |
| - </form> | |
| - </td></tr> | |
| -</table> | |
| -</div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment