Merge Tor's 'torhve/ffapp' work
This branch adds App support for both Chrome and Firefox. The reference was https://github.com/torhve/glowing-bear/tree/ffapp
This commit is contained in:
commit
3720ef686e
6 changed files with 102 additions and 3 deletions
|
@ -36,6 +36,12 @@ body {
|
|||
box-shadow: rgba(255, 255, 255, 0.07) -1px 0 0;
|
||||
border-left: 1px solid #121212;
|
||||
}
|
||||
.panel-group .panel-heading + .panel-collapse .panel-body {
|
||||
-webkit-box-shadow: rgba(255, 255, 255, 0.07) 0 -1px 0;
|
||||
-moz-box-shadow: rgba(255, 255, 255, 0.07) 0 -1px 0;
|
||||
box-shadow: rgba(255, 255, 255, 0.07) 0 -1px 0;
|
||||
border-top: 1px solid #121212;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
|
|
BIN
img/weechat_logo_128x128.png
Normal file
BIN
img/weechat_logo_128x128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
21
index.html
21
index.html
|
@ -33,7 +33,7 @@
|
|||
<strong>Oh no!</strong> We cannot connect!
|
||||
</div>
|
||||
<div class="panel-group" id="accordion">
|
||||
<div class="panel ">
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
||||
|
@ -77,7 +77,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel ">
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
|
||||
|
@ -94,6 +94,7 @@
|
|||
<span class="label label-warning">WeeChat version 0.4.2 or higher is required.</span><br>
|
||||
The communication goes directly between your browser and your weechat in clear text.
|
||||
Connection settings are saved between sessions, including password, in your own browser.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -120,7 +121,21 @@
|
|||
/relay sslcertkey
|
||||
/relay add ssl.weechat 8000
|
||||
</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>
|
||||
|
|
|
@ -336,6 +336,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
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.scrollToBottom();
|
||||
|
@ -435,6 +449,26 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
$scope.disconnect = function() {
|
||||
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 */
|
||||
$rootScope.createHighlight = function(buffer, message) {
|
||||
|
|
25
manifest.json
Normal file
25
manifest.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "Weechat",
|
||||
"description": "WeeChat Web frontend",
|
||||
"version": "0.0.0.1",
|
||||
"manifest_version": 2,
|
||||
"icons": {
|
||||
"32": "img/favicon.png",
|
||||
"128": "img/weechat_logo_128x128.png"
|
||||
},
|
||||
"app": {
|
||||
"urls": [
|
||||
"http://torhve.github.io/glowing-bear/"
|
||||
],
|
||||
"launch": {
|
||||
"web_url": "http://torhve.github.io/glowing-bear/"
|
||||
}
|
||||
},
|
||||
"permissions": [
|
||||
"notifications"
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
"img/favicon.png"
|
||||
],
|
||||
}
|
||||
}
|
19
manifest.webapp
Normal file
19
manifest.webapp
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "WeeChat",
|
||||
"description": "WeeChat Web frontend",
|
||||
"icons": {
|
||||
"128": "img/weechat_logo_128x128.png",
|
||||
"32": "img/favicon.png"
|
||||
},
|
||||
"launch_path": "/glowing-bear/",
|
||||
"installs_allowed_from": [
|
||||
"*"
|
||||
],
|
||||
"developer": {
|
||||
"name": "Tor Hveem",
|
||||
"url": "http://github.com/torhve/"
|
||||
},
|
||||
"default_locale": "en",
|
||||
"version": "2"
|
||||
}
|
||||
|
Loading…
Reference in a new issue