From bdf67e1da00ecafef962fcf3b4e85e447e93778d Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Sat, 12 Jul 2014 18:56:07 +0900 Subject: [PATCH 1/7] add swfobject/swfobject.d.ts --- swfobject/swfobject.d.ts | 103 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 swfobject/swfobject.d.ts diff --git a/swfobject/swfobject.d.ts b/swfobject/swfobject.d.ts new file mode 100644 index 000000000..55fe3de4c --- /dev/null +++ b/swfobject/swfobject.d.ts @@ -0,0 +1,103 @@ +// Type definitions for swfobject 2.2 +// https://code.google.com/p/swfobject/ + +declare module swfobject { + export var ua: { + w3: boolean; + pv: number[]; + wk: any; + 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 hasPlayerVersion( + 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; + } +} From b36767cf62f2ac8c9b91b0cc16bd23ffd1a610be Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Mon, 13 Oct 2014 17:28:14 +0900 Subject: [PATCH 2/7] change indent to space. --- swfobject/swfobject-tests.d.ts | 3 + swfobject/swfobject.d.ts | 168 +++++++++++++++++---------------- 2 files changed, 88 insertions(+), 83 deletions(-) create mode 100644 swfobject/swfobject-tests.d.ts diff --git a/swfobject/swfobject-tests.d.ts b/swfobject/swfobject-tests.d.ts new file mode 100644 index 000000000..9bf4d09f7 --- /dev/null +++ b/swfobject/swfobject-tests.d.ts @@ -0,0 +1,3 @@ +/// + +var userAgent = swfobject.ua; diff --git a/swfobject/swfobject.d.ts b/swfobject/swfobject.d.ts index 55fe3de4c..f13f8a87a 100644 --- a/swfobject/swfobject.d.ts +++ b/swfobject/swfobject.d.ts @@ -1,103 +1,105 @@ -// Type definitions for swfobject 2.2 -// https://code.google.com/p/swfobject/ +// 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; - ie: boolean; - win: boolean; - mac: boolean; - }; + 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 registerObject( + objectIdStr: string, + swfVersionStr: string, + xiSwfUrlStr?: string, + callbackFn?: (callbackObj: ICallbackObj) => void + ): void; - export function getObjectById( - objectIdStr: string - ): HTMLElement; + 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 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 switchOffAutoHideShow(): void; - export function getFlashPlayerVersion(): IFlashPlayerVersion; + export function getFlashPlayerVersion(): IFlashPlayerVersion; - interface IFlashPlayerVersion { - major: number; - minor: number; - release: number; - } + interface IFlashPlayerVersion { + major: number; + minor: number; + release: number; + } - export function hasPlayerVersion( - rv: string - ): void; + export function hasPlayerVersion( + rv: string + ): void; - export function createSWF( - attObj: ISwfObjectAttribute, - parObj: ISwfObjectParameter, - replaceElemIdStr: string - ): HTMLElement; + 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 showExpressInstall( + att: ISwfObjectAttribute, + par: ISwfObjectParameter, + replaceElemIdStr: string, + callbackFn?: (callbackObj: ICallbackObj) => void + ): void; - export function removeSWF( - objElemIdStr: string - ): void; + export function removeSWF( + objElemIdStr: string + ): void; - export function createCSS( - selStr: string, - declStr: string, - mediaStr: string, - newStyleBoolean: boolean - ): void; + export function createCSS( + selStr: string, + declStr: string, + mediaStr?: string, + newStyleBoolean?: boolean + ): void; - export function addDomLoadEvent( - fn: () => void - ): void; + export function addDomLoadEvent( + fn: () => void + ): void; - export function addLoadEvent( - fn: (event?: Event) => void - ): void; + export function addLoadEvent( + fn: (event?: Event) => void + ): void; - export function getQueryParamValue( - param?: string - ): string; + export function getQueryParamValue( + param?: string + ): string; - export interface ISwfObjectAttribute { - id?: string; - width?: string; - height?: string; - } + export interface ISwfObjectAttribute { + id?: string; + width?: string; + height?: string; + } - export interface ISwfObjectParameter { - flashvars?: string; - } + export interface ISwfObjectParameter { + flashvars?: string; + } - export interface ICallbackObj { - success: boolean; - id: string; - ref?: HTMLElement; - } + export interface ICallbackObj { + success: boolean; + id: string; + ref?: HTMLElement; + } } From d37ca093eff503793c98e3fd8273c62a28a98b27 Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Mon, 13 Oct 2014 18:21:21 +0900 Subject: [PATCH 3/7] fix public method. --- swfobject/swfobject.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swfobject/swfobject.d.ts b/swfobject/swfobject.d.ts index f13f8a87a..058e24b29 100644 --- a/swfobject/swfobject.d.ts +++ b/swfobject/swfobject.d.ts @@ -47,7 +47,7 @@ declare module swfobject { release: number; } - export function hasPlayerVersion( + export function hasFlashPlayerVersion( rv: string ): void; From f3b078ea26487c130934d22c09f94a295e1f657d Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Mon, 13 Oct 2014 18:40:48 +0900 Subject: [PATCH 4/7] add swfobject-test.d.ts. --- swfobject/swfobject-tests.d.ts | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/swfobject/swfobject-tests.d.ts b/swfobject/swfobject-tests.d.ts index 9bf4d09f7..87c14eb4c 100644 --- a/swfobject/swfobject-tests.d.ts +++ b/swfobject/swfobject-tests.d.ts @@ -1,3 +1,46 @@ /// +// 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', + () => { + } +); From 46f8f830b59ddc488c75559ae32dc04a260cc8b0 Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Mon, 13 Oct 2014 19:15:59 +0900 Subject: [PATCH 5/7] rename test file. --- swfobject/{swfobject-tests.d.ts => swfobject-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename swfobject/{swfobject-tests.d.ts => swfobject-tests.ts} (100%) diff --git a/swfobject/swfobject-tests.d.ts b/swfobject/swfobject-tests.ts similarity index 100% rename from swfobject/swfobject-tests.d.ts rename to swfobject/swfobject-tests.ts From 110ce88d6da1d68fa565f6dd9f17ce15fee47b7a Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Mon, 13 Oct 2014 19:27:09 +0900 Subject: [PATCH 6/7] add myself to contributors. --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a28a3f9a9..cd3b21c84 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -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)) From de37ee39bb235372216785fa81fe941d9491fa2b Mon Sep 17 00:00:00 2001 From: Seitaro MAKABE Date: Mon, 13 Oct 2014 19:38:02 +0900 Subject: [PATCH 7/7] fix header comments. --- swfobject/swfobject.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swfobject/swfobject.d.ts b/swfobject/swfobject.d.ts index 058e24b29..98c748d7a 100644 --- a/swfobject/swfobject.d.ts +++ b/swfobject/swfobject.d.ts @@ -1,6 +1,6 @@ // Type definitions for swfobject v2.2 // Project: https://code.google.com/p/swfobject/ -// Definitions by: rou https://github.com/rou +// Definitions by: rou // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module swfobject {