Skip to content

Commit

Permalink
Chore: Update doc and test fixtures to support IE11 (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored Dec 19, 2018
1 parent ba3795d commit 6f9d783
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const config = Object.assign(commonConfig(), {
},
devServer: {
contentBase: './test',
disableHostCheck: true,
host: '0.0.0.0',
inline: true
}
});
Expand Down
23 changes: 12 additions & 11 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="stylesheet" href='./styles.css' />
<link rel="stylesheet" href='https://cdn01.boxcdn.net/platform/preview/1.60.0/en-US/preview.css' />
<link rel="stylesheet" href='https://unpkg.com/box-annotations/lib/annotations.css' />
Expand All @@ -16,28 +17,28 @@
<input id='token-set' placeholder='Enter token' />
<button onClick="setProperty('token')">Set new token</button>
</div>

<div class='container' id='file'>
<div> File ID: <span id='fileid-display'></span></div>
<input id='fileid-set' placeholder='Enter file ID' />
<button onClick="setProperty('fileid')">Set new file ID</button>
</div>
</div>
</div>

<div class='preview-container'> </div>
<script>
function setProperty(selector) {
// Get new value, fallback to local storage
const inputValue = document.querySelector('#' + selector + '-set')
var inputValue = document.querySelector('#' + selector + '-set')
value = inputValue && inputValue.value || localStorage.getItem(selector);


if (!value) {
return;
}

// Set it for display purposes
displayElement = document.querySelector('#' + selector + '-display');
var displayElement = document.querySelector('#' + selector + '-display');
displayElement.textContent = value;

// Cache it in local storage
Expand All @@ -48,15 +49,15 @@
}

function loadPreview() {
const token = localStorage.getItem('token');
const fileid = localStorage.getItem('fileid');
var token = localStorage.getItem('token');
var fileid = localStorage.getItem('fileid');

if ( !token || !fileid) {
return;
}

// Load Preview + Annotations with the passed in file ID
const options = {
var options = {
Image: {
enabledTypes: ["point"]
},
Expand All @@ -69,7 +70,7 @@
};

/* global BoxAnnotations */
const annotations = new BoxAnnotations(options);
var annotations = new BoxAnnotations(options);

/* global Box */
var preview = new Box.Preview();
Expand All @@ -85,4 +86,4 @@
setProperty('fileid');
</script>
</body>
</html>
</html>
13 changes: 7 additions & 6 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="stylesheet" href='./styles.css' />
<link rel="stylesheet" href='https://cdn01.boxcdn.net/platform/preview/1.60.0/en-US/preview.css' />
<link rel="stylesheet" href='./annotations.css' />
Expand Down Expand Up @@ -28,7 +29,7 @@
<script>
function setProperty(selector) {
// Get new value, fallback to local storage
const inputValue = document.querySelector('#' + selector + '-set')
var inputValue = document.querySelector('#' + selector + '-set')
value = inputValue && inputValue.value || localStorage.getItem(selector);


Expand All @@ -37,7 +38,7 @@
}

// Set it for display purposes
displayElement = document.querySelector('#' + selector + '-display');
var displayElement = document.querySelector('#' + selector + '-display');
displayElement.textContent = value;

// Cache it in local storage
Expand All @@ -48,15 +49,15 @@
}

function loadPreview() {
const token = localStorage.getItem('token');
const fileid = localStorage.getItem('fileid');
var token = localStorage.getItem('token');
var fileid = localStorage.getItem('fileid');

if ( !token || !fileid) {
return;
}

// Load Preview + Annotations with the passed in file ID
const options = {
var options = {
Image: {
enabledTypes: ["point"]
},
Expand All @@ -69,7 +70,7 @@
};

/* global BoxAnnotations */
const annotations = new BoxAnnotations(options);
var annotations = new BoxAnnotations(options);

/* global Box */
var preview = new Box.Preview();
Expand Down

0 comments on commit 6f9d783

Please sign in to comment.