]>
git.proxmox.com Git - mirror_xterm.js.git/blob - addons/fullscreen/fullscreen.js
2 * Fullscreen addon for xterm.js
4 * Implements the toggleFullscreen function.
6 * If the `fullscreen` argument has been supplied, then
7 * if it is true, the fullscreen mode gets turned on,
8 * if it is false or null, the fullscreen mode gets turned off.
10 * If the `fullscreen` argument has not been supplied, the
11 * fullscreen mode is being toggled.
13 (function (fullscreen
) {
14 if (typeof exports
=== 'object' && typeof module
=== 'object') {
16 * CommonJS environment
18 module
.exports
= fullscreen(require('../../src/xterm'));
19 } else if (typeof define
== 'function') {
21 * Require.js is available
23 define(['../../src/xterm'], fullscreen
);
26 * Plain browser environment
28 fullscreen(this.Xterm
);
33 exports
.toggleFullScreen = function (term
, fullscreen
) {
36 if (typeof fullscreen
== 'undefined') {
37 fn
= (term
.element
.classList
.contains('fullscreen')) ? 'remove' : 'add';
38 } else if (!fullscreen
) {
44 term
.element
.classList
[fn
]('fullscreen');
47 Xterm
.prototype.toggleFullscreen = function (fullscreen
) {
48 exports
.toggleFullScreen(this, fullscreen
);