App support for firefox
This commit is contained in:
parent
caf3085594
commit
641faa4df3
2 changed files with 49 additions and 1 deletions
16
index.html
16
index.html
|
@ -120,7 +120,21 @@
|
||||||
/relay sslcertkey
|
/relay sslcertkey
|
||||||
/relay add ssl.weechat 8000
|
/relay add ssl.weechat 8000
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel" ng-hide="isinstalled">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4 class="panel-title">
|
||||||
|
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseFour">
|
||||||
|
Install app
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div id="collapseFour" class="panel-collapse collapse">
|
||||||
|
<div class="panel-body">
|
||||||
|
<p>If you have a very new Firefox you can install the frontend as an app. Click the button to install.</p>
|
||||||
|
<button class="btn btn-lg btn-primary" ng-click="install()">Install app <i class="glyphicon glyphicon-chevron-right"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -336,6 +336,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
window.webkitNotifications.requestPermission();
|
window.webkitNotifications.requestPermission();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check for firefox & app installed
|
||||||
|
if(navigator.mozApps != undefined) {
|
||||||
|
navigator.mozApps.getSelf().onsuccess = function _onAppReady(evt) {
|
||||||
|
var app = evt.target.result;
|
||||||
|
if(app) {
|
||||||
|
$scope.isinstalled = true;
|
||||||
|
}else {
|
||||||
|
$scope.isinstalled = false;
|
||||||
|
}
|
||||||
|
console.log($scope.isinstalled);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$scope.isinstalled = false;
|
||||||
|
}
|
||||||
|
|
||||||
$rootScope.$on('activeBufferChanged', function() {
|
$rootScope.$on('activeBufferChanged', function() {
|
||||||
$rootScope.scrollToBottom();
|
$rootScope.scrollToBottom();
|
||||||
|
@ -432,6 +446,26 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$scope.disconnect = function() {
|
$scope.disconnect = function() {
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
|
$scope.install = function() {
|
||||||
|
if(navigator.mozApps != undefined) {
|
||||||
|
var request = navigator.mozApps.install('http://torhve.github.io/glowing-bear/manifest.webapp');
|
||||||
|
request.onsuccess = function () {
|
||||||
|
$scope.isinstalled = true;
|
||||||
|
// Save the App object that is returned
|
||||||
|
var appRecord = this.result;
|
||||||
|
// Start the app.
|
||||||
|
appRecord.launch();
|
||||||
|
alert('Installation successful!');
|
||||||
|
};
|
||||||
|
request.onerror = function () {
|
||||||
|
// Display the error information from the DOMError object
|
||||||
|
alert('Install failed, error: ' + this.error.name);
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
alert('Sorry. Only supported in Firefox v26+');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Function gets called from bufferLineAdded code if user should be notified */
|
/* Function gets called from bufferLineAdded code if user should be notified */
|
||||||
$rootScope.createHighlight = function(buffer, message) {
|
$rootScope.createHighlight = function(buffer, message) {
|
||||||
|
|
Loading…
Reference in a new issue