v0.10.1 - Disable buttons if using unsupported browser

This commit is contained in:
Diego Rodríguez 2016-01-02 03:36:54 -05:00
parent e10faeda9b
commit 4a551cbca7
4 changed files with 18 additions and 15 deletions

View file

@ -66,6 +66,7 @@
var rtc, updateAll;
rtc = window.mozRTCPeerConnection || window.RTCPeerConnection || window.webkitRTCPeerConnection;
if (rtc == null) {
$scope.disabled = true;
ngNotify.set('Please use latest Chrome, Firefox or Opera', {
type: 'error',
sticky: true

View file

@ -4,8 +4,8 @@
<base href="">
<meta charset="UTF-8">
<title>βTorrent: Browser WebTorrent Client</title>
<meta name="description" content="βTorrent: fully-featured Browser WebTorrent Client">
<meta name="keywords" content="βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent">
<meta name="description" content="βTorrent is the first fully-featured Browser WebTorrent Client">
<meta name="keywords" content="βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent, torrenting, sharing, filesharing">
<meta name="author" content="Diego Rodríguez Baquero - DiegoRBaquero">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.jsdelivr.net/g/webtorrent@0.67.1,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1"></script>
@ -16,21 +16,21 @@
</head>
<body ng-controller="BTorrentCtrl" ng-cloak="">
<header>
<h1>βTorrent<span class="version"> v0.10.0</span></h1>
<h1>βTorrent<span class="version"> v0.10.1</span></h1>
</header>
<div class="container">
<div class="row">
<div class="four columns">
<input type="text" placeholder="magnet link or hash" ng-model="torrentInput" class="u-full-width">
<input type="text" placeholder="magnet link or hash" ng-model="torrentInput" ng-disabled="disabled" class="u-full-width">
</div>
<div class="two columns download-button">
<button ng-click="addMagnet()" ng-disabled="!torrentInput.length" ng-class="{'button-primary': torrentInput.length}"><i class="fa fa-download"></i> Download</button>
<button ng-click="addMagnet()" ng-disabled="!torrentInput.length || disabled" ng-class="{&quot;button-primary&quot;: torrentInput.length}"><i class="fa fa-download"></i> Download</button>
</div>
<div class="three columns">
<button type="file" ngf-select="openTorrentFile($file)" class="button-primary"><i class="fa fa-folder-open"></i> Open torrent file</button>
<button type="file" ngf-select="openTorrentFile($file)" ng-disabled="disabled" ng-class="{&quot;button-primary&quot;: !disabled}"><i class="fa fa-folder-open"></i> Open torrent file</button>
</div>
<div class="three columns u-pull-right">
<button ngf-select="seedFiles($files)" multiple="" class="u-pull-right button-primary"><i class="fa fa-upload"></i> Seed files</button>
<button ngf-select="seedFiles($files)" multiple="" ng-disabled="disabled" ng-class="{&quot;button-primary&quot;: !disabled}" class="u-pull-right"><i class="fa fa-upload"></i> Seed files</button>
</div>
</div>
<div ui-grid="gridOptions" ui-grid-resize-columns ui-grid-selection class="row grid"></div>

View file

@ -51,7 +51,9 @@ app = angular.module 'BTorrent', ['ui.grid', 'ui.grid.resizeColumns', 'ui.grid.s
app.controller 'BTorrentCtrl', ['$scope','$http','$log','$location', 'ngNotify', ($scope, $http, $log, $location, ngNotify) ->
rtc = window.mozRTCPeerConnection || window.RTCPeerConnection || window.webkitRTCPeerConnection
if !rtc? then ngNotify.set 'Please use latest Chrome, Firefox or Opera', {type: 'error', sticky: true}
if !rtc?
$scope.disabled = true
ngNotify.set 'Please use latest Chrome, Firefox or Opera', {type: 'error', sticky: true}
rtc = null
$scope.client = client

View file

@ -4,8 +4,8 @@ html(ng-app='BTorrent', lang='en')
base(href='')
meta(charset='UTF-8')
title βTorrent: Browser WebTorrent Client
meta(name='description', content='βTorrent: fully-featured Browser WebTorrent Client')
meta(name='keywords', content='βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent')
meta(name='description', content='βTorrent is the first fully-featured Browser WebTorrent Client')
meta(name='keywords', content='βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent, torrenting, sharing, filesharing')
meta(name='author', content='Diego Rodríguez Baquero - DiegoRBaquero')
meta(name='viewport', content='width=device-width, initial-scale=1')
script(src='https://cdn.jsdelivr.net/g/webtorrent@0.67.1,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1')
@ -17,21 +17,21 @@ html(ng-app='BTorrent', lang='en')
header
h1
| βTorrent
span.version v0.10.0
span.version v0.10.1
.container
.row
.four.columns
input.u-full-width(type='text', placeholder='magnet link or hash', ng-model='torrentInput')
input.u-full-width(type='text', placeholder='magnet link or hash', ng-model='torrentInput', ng-disabled='disabled')
.two.columns.download-button
button(ng-click='addMagnet()', ng-disabled='!torrentInput.length', ng-class="{'button-primary': torrentInput.length}")
button(ng-click='addMagnet()', ng-disabled='!torrentInput.length || disabled', ng-class='{"button-primary": torrentInput.length}')
i.fa.fa-download
| Download
.three.columns
button.button-primary(type='file', ngf-select='openTorrentFile($file)')
button(type='file', ngf-select='openTorrentFile($file)', ng-disabled='disabled', ng-class='{"button-primary": !disabled}')
i.fa.fa-folder-open
| Open torrent file
.three.columns.u-pull-right
button.u-pull-right.button-primary(ngf-select='seedFiles($files)', multiple='')
button.u-pull-right(ngf-select='seedFiles($files)', multiple='', ng-disabled='disabled', ng-class='{"button-primary": !disabled}')
i.fa.fa-upload
| Seed files
.row.grid(ui-grid='gridOptions', ui-grid-resize-columns, ui-grid-selection)