Load notifications script from background page
This commit is contained in:
parent
f90f6328dd
commit
ddbaf87741
2 changed files with 51 additions and 52 deletions
102
js/options.js
102
js/options.js
|
@ -15,61 +15,61 @@
|
||||||
*/
|
*/
|
||||||
;(function() {
|
;(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
$('.notifications .on button').click(function() {
|
extension.windows.getBackground(function(bg) {
|
||||||
Whisper.Notifications.disable();
|
$('.notifications .on button').click(function() {
|
||||||
initOptions();
|
bg.Whisper.Notifications.disable();
|
||||||
});
|
initOptions();
|
||||||
|
|
||||||
$('.notifications .off button').click(function() {
|
|
||||||
Whisper.Notifications.enable(initOptions);
|
|
||||||
initOptions();
|
|
||||||
});
|
|
||||||
|
|
||||||
function initOptions() {
|
|
||||||
if (Whisper.Notifications.isEnabled()) {
|
|
||||||
$('.notifications .on').show();
|
|
||||||
$('.notifications .off').hide();
|
|
||||||
} else {
|
|
||||||
$('.notifications .on').hide();
|
|
||||||
$('.notifications .off').show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setProvisioningUrl(url) {
|
|
||||||
$('#status').text('');
|
|
||||||
new QRCode($('#qr')[0]).makeCode(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmNumber(number) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
$('#qr').hide();
|
|
||||||
$('.confirmation-dialog .number').text(number);
|
|
||||||
$('.confirmation-dialog .cancel').click(function(e) {
|
|
||||||
localStorage.clear();
|
|
||||||
reject();
|
|
||||||
});
|
|
||||||
$('.confirmation-dialog .ok').click(function(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
$('.confirmation-dialog').hide();
|
|
||||||
$('.progress-dialog').show();
|
|
||||||
$('.progress-dialog .status').text('Generating Keys');
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
$('.modal-container').show();
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
var counter = 0;
|
$('.notifications .off button').click(function() {
|
||||||
function incrementCounter() {
|
bg.Whisper.Notifications.enable(initOptions);
|
||||||
$('.progress-dialog .bar').css('width', (++counter * 100 / 100) + '%');
|
initOptions();
|
||||||
}
|
});
|
||||||
|
|
||||||
$('.modal-container .cancel').click(function() {
|
function initOptions() {
|
||||||
$('.modal-container').hide();
|
if (bg.Whisper.Notifications.isEnabled()) {
|
||||||
});
|
$('.notifications .on').show();
|
||||||
|
$('.notifications .off').hide();
|
||||||
|
} else {
|
||||||
|
$('.notifications .on').hide();
|
||||||
|
$('.notifications .off').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
function setProvisioningUrl(url) {
|
||||||
extension.windows.getBackground(function(bg) {
|
$('#status').text('');
|
||||||
|
new QRCode($('#qr')[0]).makeCode(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmNumber(number) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
$('#qr').hide();
|
||||||
|
$('.confirmation-dialog .number').text(number);
|
||||||
|
$('.confirmation-dialog .cancel').click(function(e) {
|
||||||
|
localStorage.clear();
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
$('.confirmation-dialog .ok').click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
$('.confirmation-dialog').hide();
|
||||||
|
$('.progress-dialog').show();
|
||||||
|
$('.progress-dialog .status').text('Generating Keys');
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
$('.modal-container').show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var counter = 0;
|
||||||
|
function incrementCounter() {
|
||||||
|
$('.progress-dialog .bar').css('width', (++counter * 100 / 100) + '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.modal-container .cancel').click(function() {
|
||||||
|
$('.modal-container').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function() {
|
||||||
if (bg.textsecure.registration.isDone()) {
|
if (bg.textsecure.registration.isDone()) {
|
||||||
$('#complete-number').text(bg.textsecure.storage.user.getNumber());
|
$('#complete-number').text(bg.textsecure.storage.user.getNumber());
|
||||||
$('#setup-complete').show().addClass('in');
|
$('#setup-complete').show().addClass('in');
|
||||||
|
|
|
@ -117,7 +117,6 @@
|
||||||
<script type="text/javascript" src="js/components.js"></script>
|
<script type="text/javascript" src="js/components.js"></script>
|
||||||
<script type="text/javascript" src="js/database.js"></script>
|
<script type="text/javascript" src="js/database.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/notifications.js"></script>
|
|
||||||
<script type="text/javascript" src="js/libphonenumber-util.js"></script>
|
<script type="text/javascript" src="js/libphonenumber-util.js"></script>
|
||||||
<script type="text/javascript" src="js/models/messages.js"></script>
|
<script type="text/javascript" src="js/models/messages.js"></script>
|
||||||
<script type="text/javascript" src="js/models/conversations.js"></script>
|
<script type="text/javascript" src="js/models/conversations.js"></script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue