Skip to content

Commit

Permalink
fix issue with terminal on body #562
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Mar 14, 2020
1 parent 843ab7e commit c065a2b
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 29 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
@@ -1,4 +1,6 @@
## 2.14.2
## 2.15.0
### Features
* add new API event touchscroll for mobile (use it in less) [#556](https://github.com/jcubic/jquery.terminal/issues/556)
### Bugfix
* fix vertical bar cursor animation on empty command line
* fix edge case while splitting the command line with formatting (better fix for [#379](https://github.com/jcubic/jquery.terminal/379))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ http://terminal.jcubic.pl

[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
[![travis](https://travis-ci.org/jcubic/jquery.terminal.svg?branch=devel&0d536a02c83cc37f27ab09a6ae5da3d1ced023a9)](https://travis-ci.org/jcubic/jquery.terminal)
[![travis](https://travis-ci.org/jcubic/jquery.terminal.svg?branch=devel&843ab7e423154a87a45844b685b5bf9793502f4b)](https://travis-ci.org/jcubic/jquery.terminal)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&d9f1c3bc9581b774f5523a97f75faaeb)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![package quality](http://npm.packagequality.com/shield/jquery.terminal.svg)](http://packagequality.com/#?package=jquery.terminal)
Expand Down
33 changes: 25 additions & 8 deletions js/jquery.terminal-2.14.1.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Tue, 10 Mar 2020 10:02:43 +0000
* Date: Sat, 14 Mar 2020 10:51:59 +0000
*/
/* global location, setTimeout, window, global, sprintf, setImmediate,
IntersectionObserver, ResizeObserver, module, require, define,
Expand Down Expand Up @@ -4250,7 +4250,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Tue, 10 Mar 2020 10:02:43 +0000',
date: 'Sat, 14 Mar 2020 10:51:59 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -7717,10 +7717,6 @@
}
// ---------------------------------------------------------------------
var self = this;
if (self.is('body,html')) {
self = $('<div/>').appendTo('body');
$('body').addClass('full-screen-terminal');
}
if (this.length > 1) {
return this.each(function() {
$.fn.terminal.call(
Expand All @@ -7730,8 +7726,20 @@
);
});
}
// terminal already exists
if (self.data('terminal')) {
var body_terminal;
if (self.is('body,html')) {
// terminal already exists on body
if (self.hasClass('full-screen-terminal')) {
var data = self.find('> .terminal').data('terminal');
if (data) {
return data;
}
}
body_terminal = self;
self = $('<div/>').appendTo('body');
$('body').addClass('full-screen-terminal');
} else if (self.data('terminal')) {
// terminal already exists
return self.data('terminal');
}
// -----------------------------------------------------------------
Expand Down Expand Up @@ -9356,6 +9364,15 @@
}
output.remove();
wrapper.remove();
if (body_terminal) {
var $body = $(body_terminal);
if ($body.attr('class') === 'full-screen-terminal') {
$body.removeAttr('class');
} else {
$body.removeClass('full-screen-terminal');
}
self.remove();
}
defunct = true;
});
return self;
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.14.1.min.js

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions js/jquery.terminal-src.js
Expand Up @@ -7717,10 +7717,6 @@
}
// ---------------------------------------------------------------------
var self = this;
if (self.is('body,html')) {
self = $('<div/>').appendTo('body');
$('body').addClass('full-screen-terminal');
}
if (this.length > 1) {
return this.each(function() {
$.fn.terminal.call(
Expand All @@ -7730,8 +7726,20 @@
);
});
}
// terminal already exists
if (self.data('terminal')) {
var body_terminal;
if (self.is('body,html')) {
// terminal already exists on body
if (self.hasClass('full-screen-terminal')) {
var data = self.find('> .terminal').data('terminal');
if (data) {
return data;
}
}
body_terminal = self;
self = $('<div/>').appendTo('body');
$('body').addClass('full-screen-terminal');
} else if (self.data('terminal')) {
// terminal already exists
return self.data('terminal');
}
// -----------------------------------------------------------------
Expand Down Expand Up @@ -9356,6 +9364,15 @@
}
output.remove();
wrapper.remove();
if (body_terminal) {
var $body = $(body_terminal);
if ($body.attr('class') === 'full-screen-terminal') {
$body.removeAttr('class');
} else {
$body.removeClass('full-screen-terminal');
}
self.remove();
}
defunct = true;
});
return self;
Expand Down
33 changes: 25 additions & 8 deletions js/jquery.terminal.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Tue, 10 Mar 2020 10:02:43 +0000
* Date: Sat, 14 Mar 2020 10:51:59 +0000
*/
/* global location, setTimeout, window, global, sprintf, setImmediate,
IntersectionObserver, ResizeObserver, module, require, define,
Expand Down Expand Up @@ -4250,7 +4250,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Tue, 10 Mar 2020 10:02:43 +0000',
date: 'Sat, 14 Mar 2020 10:51:59 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -7717,10 +7717,6 @@
}
// ---------------------------------------------------------------------
var self = this;
if (self.is('body,html')) {
self = $('<div/>').appendTo('body');
$('body').addClass('full-screen-terminal');
}
if (this.length > 1) {
return this.each(function() {
$.fn.terminal.call(
Expand All @@ -7730,8 +7726,20 @@
);
});
}
// terminal already exists
if (self.data('terminal')) {
var body_terminal;
if (self.is('body,html')) {
// terminal already exists on body
if (self.hasClass('full-screen-terminal')) {
var data = self.find('> .terminal').data('terminal');
if (data) {
return data;
}
}
body_terminal = self;
self = $('<div/>').appendTo('body');
$('body').addClass('full-screen-terminal');
} else if (self.data('terminal')) {
// terminal already exists
return self.data('terminal');
}
// -----------------------------------------------------------------
Expand Down Expand Up @@ -9356,6 +9364,15 @@
}
output.remove();
wrapper.remove();
if (body_terminal) {
var $body = $(body_terminal);
if ($body.attr('class') === 'full-screen-terminal') {
$body.removeAttr('class');
} else {
$body.removeClass('full-screen-terminal');
}
self.remove();
}
defunct = true;
});
return self;
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit c065a2b

Please sign in to comment.