diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-02-06 16:36:20 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-02-06 16:36:20 (GMT) |
commit | 66dae0ccbc23f4df612711a2e61fadd9b15feb91 (patch) | |
tree | a069ef55f4d97b6419f38d8ce86eb19f5cc1f1e7 /apps/system/js/captive_portal.js | |
parent | b5b9e95e2f4c8ab19cef000c82fcfc0625c52666 (diff) |
Diffstat (limited to 'apps/system/js/captive_portal.js')
-rw-r--r-- | apps/system/js/captive_portal.js | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/apps/system/js/captive_portal.js b/apps/system/js/captive_portal.js deleted file mode 100644 index b23cb0d..0000000 --- a/apps/system/js/captive_portal.js +++ /dev/null @@ -1,73 +0,0 @@ -/* -*Mode: js; js-indent-level: 2; indent-tabs-mode: nil -**/ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ -'use strict'; - -var CaptivePortalLogin = (function() { - var eventId; - var isManualConnect = false; - var settings = window.navigator.mozSettings; - var notification = null; - var wifiManager = window.navigator.mozWifiManager; - var _ = window.navigator.mozL10n.get; - var captiveNotification_onTap = null; - - function handleLogin(id, url) { - //captive portal login needed - eventId = id; - var currentNetwork = wifiManager.connection.network; - var networkName = (currentNetwork && currentNetwork.ssid) ? - currentNetwork.ssid : ''; - var message = _('captive-wifi-available', { networkName: networkName}); - if (!isManualConnect) { - notification = NotificationScreen.addNotification({ - id: id, title: '', text: message, icon: null - }); - captiveNotification_onTap = function() { - notification.removeEventListener('tap', captiveNotification_onTap); - captiveNotification_onTap = null; - NotificationScreen.removeNotification(id); - new MozActivity({ - name: 'view', - data: { type: 'url', url: url } - }); - }; - notification.addEventListener('tap', captiveNotification_onTap); - } else { - settings.createLock().set({'wifi.connect_via_settings': false}); - new MozActivity({ - name: 'view', - data: { type: 'url', url: url } - }); - } - } - - function handleLoginAbort(id) { - if (id === eventId && notification) { - if (notification.parentNode) { - if (captiveNotification_onTap) { - notification.removeEventListener('tap', captiveNotification_onTap); - captiveNotification_onTap = null; - } - NotificationScreen.removeNotification(id); - notification = null; - } - } - } - - window.addEventListener('mozChromeEvent', function handleChromeEvent(e) { - switch (e.detail.type) { - case 'captive-portal-login': - handleLogin(e.detail.id, e.detail.url); - break; - case 'captive-portal-login-abort': - handleLoginAbort(e.detail.id); - break; - } - }); - - // Using settings API to know whether user is manually selecting - // wifi AP from settings app. - SettingsListener.observe('wifi.connect_via_settings', true, function(value) { - isManualConnect = value; - }); -})(); |