Add ability to dynamically load a different bundle in IE11

This commit is contained in:
Bryan Housel
2020-01-21 13:19:06 -05:00
parent a364c52f47
commit c548d0e216
3 changed files with 130 additions and 94 deletions

106
dist/index.html vendored
View File

@@ -1,54 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>iD</title>
<link rel='stylesheet' href='iD.css'>
<link rel='icon' type='image/png' href='data:image/png;base64,iVBORw0KGgo='>
<head>
<meta charset='utf-8'>
<title>iD</title>
<link rel='stylesheet' href='iD.css'>
<link rel='icon' type='image/png' href='data:image/png;base64,iVBORw0KGgo='>
<meta name='viewport' content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'/>
<meta name='apple-mobile-web-app-capable' content='yes' />
<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />
</head>
<!-- mobile devices -->
<meta name='viewport' content='initial-scale=1.0 maximum-scale=1.0'>
<meta name='apple-mobile-web-app-capable' content='yes' />
<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />
<body>
<div id='id-container'></div>
<!--[if !IE]>-->
<script src='iD.js'></script>
<!--<![endif]-->
</head>
<body>
<div id='id-container'></div>
<script>
if (typeof iD == 'undefined' || !iD.utilDetect().support) {
document.getElementById('id-container').innerHTML = 'Sorry, your browser is not currently supported. Please use Potlatch 2 to edit the map.';
document.getElementById('id-container').className = 'unsupported';
<script>
var container = document.getElementById('id-container');
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.onload = checkScript;
newScript.onerror = checkScript;
} else {
var id = iD.coreContext();
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
if (isIE11) {
newScript.src = 'iD.min.js';
} else {
newScript.src = 'iD.min.js';
}
// disable boundaries (unless we have an explicit disable_features list)
var q = iD.utilStringQs(window.location.hash.substring(1));
if (!q.hasOwnProperty('disable_features')) {
id.features().disable('boundaries');
}
document.getElementsByTagName('head')[0].appendChild(newScript);
id.ui()(document.getElementById('id-container'), function() {
id.container().select('#about-list')
.insert('li', '.user-list')
.attr('class', 'source-switch')
.call(iD.uiSourceSwitch(id)
.keys([{
'urlroot': 'https://www.openstreetmap.org',
'oauth_consumer_key': '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
'oauth_secret': 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL'
}, {
'urlroot': 'https://api06.dev.openstreetmap.org',
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
}
])
);
});
}
</script>
</body>
function checkScript() {
if (typeof iD === 'undefined' || !iD.utilDetect().support) {
container.innerHTML = 'Sorry, your browser is not currently supported. Please use Potlatch 2 to edit the map.';
container.className = 'unsupported';
} else {
var context = iD.coreContext();
// disable boundaries (unless we have an explicit disable_features list)
var q = iD.utilStringQs(window.location.hash.substring(1));
if (!q.hasOwnProperty('disable_features')) {
context.features().disable('boundaries');
}
context.ui()(container, function() {
context.container().select('#about-list')
.insert('li', '.user-list')
.attr('class', 'source-switch')
.call(iD.uiSourceSwitch(context)
.keys([{
'urlroot': 'https://www.openstreetmap.org',
'oauth_consumer_key': '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
'oauth_secret': 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL'
}, {
'urlroot': 'https://api06.dev.openstreetmap.org',
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
}
])
);
});
}
}
</script>
</body>
</html>

15
dist/land.html vendored
View File

@@ -1,9 +1,10 @@
<!DOCTYPE html>
<html><head></head>
<body>
<script>
opener.authComplete(window.location.href);
window.close();
</script>
</body>
<html>
<head></head>
<body>
<script>
opener.authComplete(window.location.href);
window.close();
</script>
</body>
</html>

View File

@@ -1,47 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>iD</title>
<link rel='stylesheet' href='dist/iD.css'/>
<meta name='viewport' content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'/>
<meta name='apple-mobile-web-app-capable' content='yes'/>
<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent'/>
<script src='dist/iD.js'></script>
</head>
<body>
<div id='id-container'></div>
<script>
<head>
<meta charset='utf-8'>
<title>iD</title>
<link rel='stylesheet' href='dist/iD.css'>
<link rel='icon' type='image/png' href='data:image/png;base64,iVBORw0KGgo='>
<meta name='viewport' content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'/>
<meta name='apple-mobile-web-app-capable' content='yes'/>
<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent'/>
</head>
id = iD.coreContext()
.assetPath('dist/');
<body>
<div id='id-container'></div>
// disable boundaries (unless we have an explicit disable_features list)
var q = iD.utilStringQs(window.location.hash.substring(1));
if (!q.hasOwnProperty('disable_features')) {
id.features().disable('boundaries');
<script>
var container = document.getElementById('id-container');
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.onload = checkScript;
newScript.onerror = checkScript;
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
if (isIE11) {
newScript.src = 'dist/iD.js';
} else {
newScript.src = 'dist/iD.js';
}
document.getElementsByTagName('head')[0].appendChild(newScript);
function checkScript() {
if (typeof iD === 'undefined' || !iD.utilDetect().support) {
container.innerHTML = 'Sorry, your browser is not currently supported. Please use Potlatch 2 to edit the map.';
container.className = 'unsupported';
} else {
var context = iD.coreContext().assetPath('dist/');
// disable boundaries (unless we have an explicit disable_features list)
var q = iD.utilStringQs(window.location.hash.substring(1));
if (!q.hasOwnProperty('disable_features')) {
context.features().disable('boundaries');
}
context.ui()(container, function() {
context.container().select('#about-list')
.insert('li', '.user-list')
.attr('class', 'source-switch')
.call(iD.uiSourceSwitch(context)
.keys([{
'urlroot': 'https://www.openstreetmap.org',
'oauth_consumer_key': '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
'oauth_secret': 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL'
}, {
'urlroot': 'https://api06.dev.openstreetmap.org',
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
}
])
);
});
}
id.ui()(document.getElementById('id-container'), function() {
id.container().select('#about-list')
.insert('li', '.user-list')
.attr('class', 'source-switch')
.call(iD.uiSourceSwitch(id)
.keys([
{
'urlroot': 'https://www.openstreetmap.org',
'oauth_consumer_key': '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
'oauth_secret': 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL'
},
{
'urlroot': 'https://api06.dev.openstreetmap.org',
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
}
])
);
});
</script>
</body>
}
</script>
</body>
</html>