mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-05 17:36:54 +00:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
/*
|
|
* Fullscreen addon for xterm.js
|
|
*
|
|
* Implements the toggleFullscreen function.
|
|
*
|
|
* If the `fullscreen` argument has been supplied, then
|
|
* if it is true, the fullscreen mode gets turned on,
|
|
* if it is false or null, the fullscreen mode gets turned off.
|
|
*
|
|
* If the `fullscreen` argument has not been supplied, the
|
|
* fullscreen mode is being toggled.
|
|
*/
|
|
(function (fullscreen) {
|
|
if (typeof define == 'function') {
|
|
/*
|
|
* Require.js is available
|
|
*/
|
|
define(['../../src/xterm'], fullscreen);
|
|
} else {
|
|
/*
|
|
* Plain browser environment
|
|
*/
|
|
fullscreen(this.Xterm);
|
|
}
|
|
})(function (Xterm) {
|
|
Xterm.prototype.toggleFullscreen = function (fullscreen) {
|
|
var fn;
|
|
|
|
if (typeof fullscreen == 'undefined') {
|
|
fn = (this.element.classList.contains('fullscreen')) ? 'remove' : 'add';
|
|
} else if (!fullscreen) {
|
|
fn = 'remove';
|
|
} else {
|
|
fn = 'add';
|
|
}
|
|
|
|
this.element.classList[fn]('fullscreen');
|
|
};
|
|
}); |