🏳️🌈
- GitHub Staff
- http://digitarald.de
- @digitarald
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Original https://github.com/mozilla/fireplace/blob/c50b5ca51643f13ae2e8b3a003d3aa0432358bf7/hearth/media/js/user.js#L41 | |
| // Retrieve MCC and MNC from mozMobileConnection (requires "privileged" app type and "mobileconnection" permission) | |
| // and translates them to carrier and region via mobilenetwork.js | |
| try { | |
| // When Fireplace is served as a privileged packaged app (and not | |
| // served via Yulelog) our JS will have direct access to this API. | |
| var conn = navigator.mozMobileConnection; | |
| if (conn) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mccs = []; | |
| try { | |
| // navigator.mozMobileConnections is the new API. | |
| // navigator.mozMobileConnection is the legacy API. | |
| var conn; | |
| if ((conn = navigator.mozMobileConnection)) { | |
| console.log('navigator.mozMobileConnection available'); | |
| // `MCC`: Mobile Country Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function verifyMozAppsInstallation() { | |
| if (!navigator.mozApps || window.locationbar.visible) { | |
| // Not running as Firefox app | |
| return; | |
| } | |
| // Prevent multiple checks per day | |
| // FIXME: Use a time-limited cookie | |
| if (localStorage.mozAppsChecked) { | |
| console.log('Skipped verifyMozAppsInstallation'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "app_name": "connecta2", | |
| "is_packaged": true, | |
| "app_manifest": "https://marketplace.firefox.com/app/956189a1-c985-4824-85a9-de708d38d6f9/manifest.webapp" | |
| }, | |
| { | |
| "app_name": "whatsapp-firefox-os", | |
| "is_packaged": true, | |
| "app_manifest": "https://marketplace.firefox.com/app/90aa85eb-60f0-4e58-8147-558e162fac1c/manifest.webapp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Famous test</title> | |
| <meta name="viewport" content="width=device-width, maximum-scale=1, user-scalable=no" /> | |
| <style> | |
| html, body { | |
| margin: 0; | |
| padding: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>Famous test</title> | |
| <meta name="viewport" content="width=device-width, maximum-scale=1, user-scalable=no" /> | |
| <meta name="mobile-web-app-capable" content="yes" /> | |
| <meta name="apple-mobile-web-app-capable" content="yes" /> | |
| <meta name="apple-mobile-web-app-status-bar-style" content="black" /> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Detect installOrigin in Firefox apps to defer preload status. | |
| * | |
| * For most apps the installOrigin will be https://marketplace.firefox.com | |
| * Preloaded apps *can* customize their installOrigin to reflect country and/or | |
| * carrier (like https://fxos.telefonia.es for Telefónica in Spain). | |
| * | |
| * @param {Function} done Node-style callback (err, origin) | |
| * @example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Monkeypatch XHR to always use systemXHR | |
| var oldXMLHttpRequest = XMLHttpRequest; | |
| XMLHttpRequest = function() { | |
| return new oldXMLHttpRequest({ | |
| mozSystem: true | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!(/mobile|tablet/i).test(navigator.userAgent)) { | |
| location.href = 'http://www.your-desktop-version.com/'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias app-zip='zip -Xr ./package.zip ./* -x Makefile package.zip LICENSE install.html package.manifest *.sh META-INF "*\/.*" && open ./' |