Skip to content

Commit

Permalink
Merge pull request #83 from beagleterm/warning-alert
Browse files Browse the repository at this point in the history
Show warning alert if CrOS 54
  • Loading branch information
sunglim authored Nov 12, 2016
2 parents e907c7c + 6d284dd commit 3f573b6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
padding: 0;
color: #B2B2B2;
}

#warning-alert {
display: none;
}
4 changes: 4 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ <h4 class="modal-title">Beagle Term: New Connection</h4>
<div class="modal-footer">
<button type="button" id="connectBtn" class="btn btn-primary" data-dismiss="modal">Connect</button>
</div>
<div id="warning-alert" class="alert alert-danger">
<strong>Warning!</strong> BeagleTerm cannot connect to device on this version.
See <a href="#"><span id="warning-detail">Details</span></a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Expand Down
16 changes: 16 additions & 0 deletions app/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ var self;

document.addEventListener('DOMContentLoaded', function() {
$('#settingsModal').modal('show');
showWarningIfChromeOs();
}, false);

var showWarningIfChromeOs = function() {
var userAgent = navigator.userAgent;
// TODO: Use Rex.
if (userAgent.includes('CrOS') &&
userAgent.includes('54.0')) {
$('#warning-alert').show();
}
};

/*
* Utility functions
*
Expand Down Expand Up @@ -221,3 +231,9 @@ connectBtn.addEventListener('click', function(event) {
});
});
});

// Closes the settings dialog
var WarningSpan = document.querySelector('#warning-detail');
WarningSpan.addEventListener('click', function(event) {
window.open('https://github.com/beagleterm/beagle-term/issues/78');
});

0 comments on commit 3f573b6

Please sign in to comment.