Initial commit
This commit is contained in:
7
botanjs/src/Dandelion/Swf/ExtAPI.css
Normal file
7
botanjs/src/Dandelion/Swf/ExtAPI.css
Normal file
@@ -0,0 +1,7 @@
|
||||
#extAPIConsole {
|
||||
-webkit-transition: all 0s;
|
||||
-moz-transition: all 0s;
|
||||
-ms-transition: all 0s;
|
||||
-o-transition: all 0s;
|
||||
transition: all 0s;
|
||||
}
|
44
botanjs/src/Dandelion/Swf/ExtAPI.js
Normal file
44
botanjs/src/Dandelion/Swf/ExtAPI.js
Normal file
@@ -0,0 +1,44 @@
|
||||
(function(){
|
||||
var ns = __namespace( "Dandelion.Swf.ExtAPI" );
|
||||
/** @type {System.Debug} */
|
||||
var debug = __import( "System.Debug" );
|
||||
|
||||
var jsReady = false
|
||||
, as = 0
|
||||
, cutConnection = false
|
||||
|
||||
, watchDogTime = new Date().getTime()
|
||||
, watchDogCounter = 0
|
||||
, lastCount = 0
|
||||
;
|
||||
|
||||
var ExtAPI = function ()
|
||||
{
|
||||
// TODO
|
||||
};
|
||||
|
||||
var isReady = function () { return jsReady; };
|
||||
|
||||
var init = function ()
|
||||
{
|
||||
jsReady = true;
|
||||
debug.Info( "[ExtAPI] " + new Date().toString() );
|
||||
};
|
||||
|
||||
var watch = function ()
|
||||
{
|
||||
if( watchDogCounter - lastCount < 300 )
|
||||
{
|
||||
lastCount = watchDogCounter;
|
||||
}
|
||||
else
|
||||
{
|
||||
cutConnection = true;
|
||||
debug.Warning( "[ExtAPI] Console Disabled: possible hanging dectected." )
|
||||
}
|
||||
watchDogTime = new Date().getTime();
|
||||
};
|
||||
|
||||
ns[ NS_EXPORT ]( EX_FUNC, "init", init );
|
||||
ns[ NS_EXPORT ]( EX_FUNC, "ready", isReady );
|
||||
})();
|
56
botanjs/src/Dandelion/Swf/_this.css
Normal file
56
botanjs/src/Dandelion/Swf/_this.css
Normal file
@@ -0,0 +1,56 @@
|
||||
.swf_wrapper {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.swf_wrapper > div {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.swf_inactive {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.swf_inactive:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.swf_inactive > div {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 3.5em solid transparent;
|
||||
border-bottom: 3.5em solid transparent;
|
||||
border-left: 5em solid #FFF;
|
||||
position: absolute;
|
||||
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-top: -3.5em;
|
||||
margin-left: -1.8em;
|
||||
}
|
||||
|
||||
/* title */
|
||||
.swf_caption {
|
||||
bottom: 0;
|
||||
|
||||
position: absolute;
|
||||
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
color: white;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
|
||||
padding: 0.2em;
|
||||
|
||||
font-size: 2em;
|
||||
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.swf_desc {
|
||||
font-size: 60%;
|
||||
}
|
173
botanjs/src/Dandelion/Swf/_this.js
Normal file
173
botanjs/src/Dandelion/Swf/_this.js
Normal file
@@ -0,0 +1,173 @@
|
||||
(function(){
|
||||
var ns = __namespace( "Dandelion" );
|
||||
|
||||
/** @type {System.utils} */
|
||||
var utils = __import( "System.utils" );
|
||||
/** @type {System.utils.IKey} */
|
||||
var IKey = __import( "System.utils.IKey" );
|
||||
/** @type {System.Policy} */
|
||||
var Policy = __import( "System.Policy" );
|
||||
/** @type {System.Debug} */
|
||||
var Dand = __import( "Dandelion" );
|
||||
|
||||
var IE = __import( "System.Global.IE" );
|
||||
|
||||
var s_current = {player: false, mask: false, stage: false, listener: false, sid: null};
|
||||
|
||||
var Swf = function (movieName)
|
||||
{
|
||||
if ( navigator.appName.indexOf("Microsoft") != -1 )
|
||||
{
|
||||
return window[movieName];
|
||||
}
|
||||
else
|
||||
{
|
||||
return document[movieName];
|
||||
}
|
||||
};
|
||||
|
||||
var realize = function (id)
|
||||
{
|
||||
var movieElement = Dand.id('swfWrapper_' + id)
|
||||
, swf_origin = Dand.wrap('a')
|
||||
, _src = movieElement.getAttribute("value")
|
||||
|
||||
swf_origin.href = _src;
|
||||
|
||||
if( Policy.isAllowedOrigin( stf_origin.host ) ) {
|
||||
swf_origin = "always";
|
||||
} else {
|
||||
swf_origin = "never";
|
||||
}
|
||||
|
||||
movieElement.onclick = ( IE ? createMovieIE : createMovie ).bind({
|
||||
sid: id
|
||||
, src: _src
|
||||
, width: movieElement.style.width
|
||||
, height: movieElement.style.height
|
||||
, s_stage:movieElement
|
||||
, origin: swf_origin
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
var getCurrentMovie = function (args)
|
||||
{
|
||||
if ( window.ExtAPI )
|
||||
{
|
||||
return thisMovie( s_current.sid );
|
||||
}
|
||||
return null;
|
||||
};
|
||||
*/
|
||||
|
||||
var createMovieIE = function ()
|
||||
{
|
||||
// Remove previous movie if exists
|
||||
if(s_current.stage)
|
||||
{
|
||||
s_current.stage.firstChild.className = "swf_inactive";
|
||||
s_current.stage.firstChild.innerHTML = s_current.player;
|
||||
s_current.stage.childNodes[1].style.bottom = "";
|
||||
s_current.stage.onclick = s_current.listener;
|
||||
}
|
||||
|
||||
this.s_stage.childNodes[1].style.bottom = "-2em";
|
||||
s_current.sid = "swf_" + this.sid;
|
||||
|
||||
s_current.stage = this.s_stage;
|
||||
s_current.player = this.s_stage.firstChild.innerHTML;
|
||||
|
||||
this.s_stage.firstChild.className = "swf_active";
|
||||
this.s_stage.firstChild.innerHTML = makeStageIE(this.src, this.width, this.height, s_current.sid, this.origin);
|
||||
|
||||
// Save event listener
|
||||
s_current.listener = this.s_stage.onclick;
|
||||
|
||||
// disable click event
|
||||
this.s_stage.onclick = null;
|
||||
};
|
||||
|
||||
var createMovie = function ()
|
||||
{
|
||||
|
||||
// Remove previous movie if exists
|
||||
if(s_current.stage)
|
||||
{
|
||||
s_current.stage.removeChild(s_current.player);
|
||||
s_current.stage.firstChild.style.bottom = "";
|
||||
s_current.stage.insertBefore(mask, stage.firstChild);
|
||||
s_current.stage.onclick = s_current.listener;
|
||||
}
|
||||
|
||||
|
||||
this.s_stage.childNodes[1].style.bottom = "-2em";
|
||||
s_current.sid = "swf_" + this.sid;
|
||||
|
||||
// Remove mask
|
||||
(s_current.stage = this.s_stage).removeChild(s_current.mask = this.s_stage.childNodes[0]);
|
||||
|
||||
s_current.player = makeStage(this.src, this.width, this.height, s_current.sid, this.origin);
|
||||
this.s_stage.appendChild(s_current.player);
|
||||
|
||||
// Save event listener
|
||||
s_current.listener = this.s_stage.onclick;
|
||||
|
||||
// disable click event
|
||||
this.s_stage.onclick = null;
|
||||
|
||||
};
|
||||
|
||||
var makeStage = function (src, width, height, sid, origin, wmode)
|
||||
{
|
||||
return Dand.wrapna("embed",
|
||||
[
|
||||
new IKey("src", src)
|
||||
, new IKey("quality", "high")
|
||||
, new IKey("bgcolor", "#869ca7")
|
||||
, new IKey("width", width)
|
||||
, new IKey("height", height)
|
||||
, new IKey("name", sid)
|
||||
, new IKey("align", "middle")
|
||||
, new IKey("wmode", wmode || "direct")
|
||||
, new IKey("play", "true")
|
||||
, new IKey("loop", "false")
|
||||
, new IKey("quality", "high")
|
||||
, new IKey("allowScriptAccess", origin)
|
||||
, new IKey("type", "application/x-shockwave-flash")
|
||||
, new IKey("pluginspage", "http://www.macromedia.com/go/getflashplayer")
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
var makeStageIE = function (src, width, height, sid, origin, wmode)
|
||||
{
|
||||
return Dand.wrape(
|
||||
Dand.wrapne('object',
|
||||
[
|
||||
Dand.wrapna("param", [new IKey("name", "wmode"), new IKey("value", wmode || "direct")])
|
||||
, Dand.wrapna("param", [new IKey("name", "quality"), new IKey("value", "high")])
|
||||
, Dand.wrapna("param", [new IKey("name", "movie"), new IKey("value", src)])
|
||||
, Dand.wrapna("param", [new IKey("name", "bgcolor"), new IKey("value", "#869ca7")])
|
||||
, Dand.wrapna("param", [new IKey("name", "allowScriptAccess"), new IKey("value", origin)])
|
||||
]
|
||||
,
|
||||
[
|
||||
new IKey("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000")
|
||||
, new IKey("id", sid)
|
||||
, new IKey("name", sid)
|
||||
, new IKey("width", width)
|
||||
, new IKey("height", height)
|
||||
, new IKey("data", src)
|
||||
, new IKey("type", "application/x-shockwave-flash")
|
||||
, new IKey("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab")
|
||||
]
|
||||
)
|
||||
).innerHTML;
|
||||
};
|
||||
|
||||
__static_method( Swf, "create", IE ? makeStageIE : makeStage );
|
||||
__static_method( Swf, "realize", realize );
|
||||
|
||||
ns[ NS_EXPORT ]( EX_CLASS, "Swf", Swf );
|
||||
})();
|
Reference in New Issue
Block a user