Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/apps/system/js/captive_portal.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/system/js/captive_portal.js')
-rw-r--r--apps/system/js/captive_portal.js73
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;
- });
-})();