inject smartphone.css dynamically in code/smartphone.js - this makes it easy to switch between modes on a URL parameter

fix #88
This commit is contained in:
Jon Atkins 2013-03-29 00:49:46 +00:00
parent bd736bab10
commit 39f5f9db2e
2 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,11 @@ window.runOnSmartphonesBeforeBoot = function() {
if(!isSmartphone()) return; if(!isSmartphone()) return;
console.warn('running smartphone pre boot stuff'); console.warn('running smartphone pre boot stuff');
// add smartphone stylesheet
headHTML = document.getElementsByTagName('head')[0].innerHTML;
headHTML += '<style>@@INCLUDESTRING:mobile/smartphone.css@@</style>';
document.getElementsByTagName('head')[0].innerHTML = headHTML;
// disable zoom buttons to see if they are really needed // disable zoom buttons to see if they are really needed
window.localStorage['iitc.zoom.buttons'] = 'false'; window.localStorage['iitc.zoom.buttons'] = 'false';

View File

@ -60,10 +60,7 @@ document.getElementsByTagName('head')[0].innerHTML = ''
+ '<title>Ingress Intel Map</title>' + '<title>Ingress Intel Map</title>'
+ '<style>@@INCLUDESTRING:style.css@@</style>' + '<style>@@INCLUDESTRING:style.css@@</style>'
+ '<style>@@INCLUDESTRING:external/leaflet.css@@</style>' + '<style>@@INCLUDESTRING:external/leaflet.css@@</style>'
// this navigator check is also used in code/smartphone.js //note: smartphone.css injection moved into code/smartphone.js
+ (navigator.userAgent.match(/Android.*Mobile/)
? '<style>@@INCLUDESTRING:mobile/smartphone.css@@</style>'
: '')
+ '<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Coda"/>'; + '<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Coda"/>';
document.getElementsByTagName('body')[0].innerHTML = '' document.getElementsByTagName('body')[0].innerHTML = ''