2012-09-12 09:46:39 +00:00
|
|
|
/*\
|
|
|
|
title: $:/plugins/tiddlywiki/fullscreen/init.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: browser-startup
|
|
|
|
|
|
|
|
Message handler for full screen mode
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
2012-11-06 17:21:56 +00:00
|
|
|
/*global $tw: false, Element: false */
|
2012-09-12 09:46:39 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var toggleFullScreen = function() {
|
|
|
|
if(document[$tw.browser.isFullScreen]) {
|
|
|
|
document[$tw.browser.cancelFullScreen]();
|
|
|
|
} else {
|
2012-10-18 09:52:03 +00:00
|
|
|
document.documentElement[$tw.browser.requestFullScreen](Element.ALLOW_KEYBOARD_INPUT);
|
2012-09-12 09:46:39 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.startup = function() {
|
|
|
|
// Install the full screen handler
|
2013-10-25 11:53:58 +00:00
|
|
|
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
2012-09-12 09:46:39 +00:00
|
|
|
toggleFullScreen();
|
2013-10-25 11:53:58 +00:00
|
|
|
});
|
2012-09-12 09:46:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
})();
|