mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-11 11:50:54 +08:00
Merge pull request #2960 from rou/def/swfobject
Definition of swfobject.js
This commit is contained in:
@@ -373,6 +373,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [stylus](https://github.com/LearnBoost/stylus) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [swfobject](https://code.google.com/p/swfobject/) (by [rou](https://github.com/rou))
|
||||
* [Swiper](http://www.idangero.us/sliders/swiper) (by [Sebastián Galiano](https://github.com/sgaliano))
|
||||
* [SwipeView](http://cubiq.org/swipeview) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Swiz](https://github.com/racker/node-swiz) (by [Jeff Goddard](https://github.com/jedigo))
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="swfobject.d.ts" />
|
||||
|
||||
// access to user agent.
|
||||
var userAgent = swfobject.ua;
|
||||
console.log(userAgent.w3, userAgent.pv, userAgent.mac, userAgent.win, userAgent.ie, userAgent.wk);
|
||||
|
||||
// get flash player version.
|
||||
var version = swfobject.getFlashPlayerVersion();
|
||||
console.log(version.major, version.minor);
|
||||
console.log('hasPlayerVersion', swfobject.hasFlashPlayerVersion('10.0.0'));
|
||||
|
||||
// listen to dom load event.
|
||||
swfobject.addDomLoadEvent(() => {
|
||||
console.log('dom load event.');
|
||||
});
|
||||
|
||||
// listen to load event.
|
||||
swfobject.addLoadEvent((event?: Event) => {
|
||||
console.log(event);
|
||||
});
|
||||
|
||||
// embed swf
|
||||
swfobject.embedSWF(
|
||||
'test.swf',
|
||||
'myContent',
|
||||
'300',
|
||||
'120',
|
||||
'10.0.0',
|
||||
'expressInstall.swf',
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
() => {
|
||||
console.log('embedded.');
|
||||
console.log(swfobject.getObjectById('myContent'));
|
||||
}
|
||||
);
|
||||
|
||||
// show express install
|
||||
swfobject.showExpressInstall(
|
||||
{},
|
||||
{},
|
||||
'expressInstall',
|
||||
() => {
|
||||
}
|
||||
);
|
||||
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
// Type definitions for swfobject v2.2
|
||||
// Project: https://code.google.com/p/swfobject/
|
||||
// Definitions by: rou <https://github.com/rou>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module swfobject {
|
||||
export var ua: {
|
||||
w3: boolean;
|
||||
pv: number[];
|
||||
wk: any; // number or boolean
|
||||
ie: boolean;
|
||||
win: boolean;
|
||||
mac: boolean;
|
||||
};
|
||||
|
||||
export function registerObject(
|
||||
objectIdStr: string,
|
||||
swfVersionStr: string,
|
||||
xiSwfUrlStr?: string,
|
||||
callbackFn?: (callbackObj: ICallbackObj) => void
|
||||
): void;
|
||||
|
||||
export function getObjectById(
|
||||
objectIdStr: string
|
||||
): HTMLElement;
|
||||
|
||||
export function embedSWF(
|
||||
swfUrlStr: string,
|
||||
replaceElemIdStr: string,
|
||||
widthStr: string,
|
||||
heightStr: string,
|
||||
swfVersionStr: string,
|
||||
xiSwfUrlStr?: string,
|
||||
flashvarsObj?: Object,
|
||||
parObj?: Object,
|
||||
attObj?: Object,
|
||||
callbackFn?: (callbackObj: ICallbackObj) => void
|
||||
): void;
|
||||
|
||||
export function switchOffAutoHideShow(): void;
|
||||
|
||||
export function getFlashPlayerVersion(): IFlashPlayerVersion;
|
||||
|
||||
interface IFlashPlayerVersion {
|
||||
major: number;
|
||||
minor: number;
|
||||
release: number;
|
||||
}
|
||||
|
||||
export function hasFlashPlayerVersion(
|
||||
rv: string
|
||||
): void;
|
||||
|
||||
export function createSWF(
|
||||
attObj: ISwfObjectAttribute,
|
||||
parObj: ISwfObjectParameter,
|
||||
replaceElemIdStr: string
|
||||
): HTMLElement;
|
||||
|
||||
export function showExpressInstall(
|
||||
att: ISwfObjectAttribute,
|
||||
par: ISwfObjectParameter,
|
||||
replaceElemIdStr: string,
|
||||
callbackFn?: (callbackObj: ICallbackObj) => void
|
||||
): void;
|
||||
|
||||
export function removeSWF(
|
||||
objElemIdStr: string
|
||||
): void;
|
||||
|
||||
export function createCSS(
|
||||
selStr: string,
|
||||
declStr: string,
|
||||
mediaStr?: string,
|
||||
newStyleBoolean?: boolean
|
||||
): void;
|
||||
|
||||
export function addDomLoadEvent(
|
||||
fn: () => void
|
||||
): void;
|
||||
|
||||
export function addLoadEvent(
|
||||
fn: (event?: Event) => void
|
||||
): void;
|
||||
|
||||
export function getQueryParamValue(
|
||||
param?: string
|
||||
): string;
|
||||
|
||||
export interface ISwfObjectAttribute {
|
||||
id?: string;
|
||||
width?: string;
|
||||
height?: string;
|
||||
}
|
||||
|
||||
export interface ISwfObjectParameter {
|
||||
flashvars?: string;
|
||||
}
|
||||
|
||||
export interface ICallbackObj {
|
||||
success: boolean;
|
||||
id: string;
|
||||
ref?: HTMLElement;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user