From b79e545dc323badb1fb6b8feed1037982ee71606 Mon Sep 17 00:00:00 2001 From: Bruno Grieder Date: Wed, 1 Apr 2015 11:07:34 +0200 Subject: [PATCH] jquery-fullscreen type definitions (https://github.com/kayahr/jquery-fullscreen-plugin) --- jquery-fullscreen/jquery-fullscreen-tests.ts | 36 ++++++++++++++++++++ jquery-fullscreen/jquery-fullscreen.d.ts | 28 +++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 jquery-fullscreen/jquery-fullscreen-tests.ts create mode 100644 jquery-fullscreen/jquery-fullscreen.d.ts diff --git a/jquery-fullscreen/jquery-fullscreen-tests.ts b/jquery-fullscreen/jquery-fullscreen-tests.ts new file mode 100644 index 0000000000..633b3d3934 --- /dev/null +++ b/jquery-fullscreen/jquery-fullscreen-tests.ts @@ -0,0 +1,36 @@ +/// + +// +// Examples from https://github.com/kayahr/jquery-fullscreen-plugin +// + +function enteringFullScreen() { + + $(document).fullScreen(true); + $('#myVideo').fullScreen(true); +} + +function exitingFullScreen() { + + $(document).fullScreen(false); + $('#myVideo').fullScreen(false); +} + + +function queryingFullScreenMode() { + + //The method returns the current fullscreen element (or true if browser doesn't support this) when fullscreen mode is active, + // false if not active or null when the browser does not support fullscreen mode at all + var isFullScreen = $(document).fullScreen() != null; +} + +function fullScreenNotifications() { + + $(document).bind("fullscreenchange", () => { + console.log("Fullscreen " + ($(document).fullScreen() ? "on" : "off")); + }); + + $(document).bind("fullscreenerror", () => { + alert("Browser rejected fullscreen change"); + }); +} \ No newline at end of file diff --git a/jquery-fullscreen/jquery-fullscreen.d.ts b/jquery-fullscreen/jquery-fullscreen.d.ts new file mode 100644 index 0000000000..605b9fb59b --- /dev/null +++ b/jquery-fullscreen/jquery-fullscreen.d.ts @@ -0,0 +1,28 @@ +// Type definitions for jquery-fullscreen 1.1.5 +// Project: https://github.com/kayahr/jquery-fullscreen-plugin +// Definitions by: Bruno Grieder +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQuery { + + /** + * You can either switch the whole page or a single HTML element to fullscreen mode + * This only works when the code was triggered by a user interaction (For example a onclick event on a button). Browsers don't allow entering fullscreen mode without user interaction. + * Fullscreen mode is always exited via the document but this plugin allows it also via any HTML element. The owner document of the selected HTML element is used + */ + fullScreen(fullScreen: boolean): JQuery | boolean; + + /** + * The method returns the current fullscreen element (or true if browser doesn't support this) when fullscreen mode is active, + * false if not active or null when the browser does not support fullscreen mode at all + */ + fullScreen(): boolean; + + /** + * The plugin provides another method for simple fullscreen mode toggling + */ + toggleFullScreen(): JQuery | boolean; +} +