diff --git a/js/options.js b/js/options.js index 8ec6ec6ba..875a6d0d3 100644 --- a/js/options.js +++ b/js/options.js @@ -15,61 +15,61 @@ */ ;(function() { 'use strict'; - $('.notifications .on button').click(function() { - Whisper.Notifications.disable(); - initOptions(); - }); + extension.windows.getBackground(function(bg) { + $('.notifications .on button').click(function() { + bg.Whisper.Notifications.disable(); + initOptions(); + }); - $('.notifications .off button').click(function() { - Whisper.Notifications.enable(initOptions); - initOptions(); - }); + $('.notifications .off button').click(function() { + bg.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 initOptions() { + if (bg.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 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(); + 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(); }); - $('.modal-container').show(); - }); - } + } - var counter = 0; - function incrementCounter() { - $('.progress-dialog .bar').css('width', (++counter * 100 / 100) + '%'); - } + var counter = 0; + function incrementCounter() { + $('.progress-dialog .bar').css('width', (++counter * 100 / 100) + '%'); + } - $('.modal-container .cancel').click(function() { - $('.modal-container').hide(); - }); + $('.modal-container .cancel').click(function() { + $('.modal-container').hide(); + }); - $(function() { - extension.windows.getBackground(function(bg) { + $(function() { if (bg.textsecure.registration.isDone()) { $('#complete-number').text(bg.textsecure.storage.user.getNumber()); $('#setup-complete').show().addClass('in'); diff --git a/options.html b/options.html index e3a54ea90..24931373d 100644 --- a/options.html +++ b/options.html @@ -117,7 +117,6 @@ -