|
|
@@ -15,6 +15,14 @@ function encodeURIComponentIncludingDots(s) { |
|
|
|
return encodeURIComponent(s).replace('.', '%2E');
|
|
|
|
}
|
|
|
|
|
|
|
|
function endsWith(what, endings) {
|
|
|
|
if (typeof(endings) === 'string')
|
|
|
|
return what.endsWith(endings);
|
|
|
|
if (endings instanceof Array)
|
|
|
|
return endings.map(a => what.endsWith(a)).reduce((a, b) => (a || b));
|
|
|
|
throw Error('Expected second argument to be either a string or an array');
|
|
|
|
}
|
|
|
|
|
|
|
|
class WBCollectionContent extends Component {
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
@@ -143,7 +151,7 @@ class WBCollectionContent extends Component { |
|
|
|
alert('Not implemented.')
|
|
|
|
} }><i class="far fa-eye"></i></button>
|
|
|
|
|
|
|
|
{ item[1].toLowerCase().endsWith('.nii') ? (
|
|
|
|
{ endsWith(item[1].toLowerCase(), ['.nii', '.nii.gz']) ? (
|
|
|
|
<button class="btn btn-outline-primary mx-1" title="View Image"
|
|
|
|
onclick={ () => manifestWorker.postMessage([ 'getFile',
|
|
|
|
'.' + collectionPath + '/' + item[1] ]).then(e => {
|
|
|
@@ -154,7 +162,7 @@ class WBCollectionContent extends Component { |
|
|
|
const blocksBlobUrl = URL.createObjectURL(blob);
|
|
|
|
window.open('/image-viewer/' + encodeURIComponent(blocksBlobUrl), '_blank');
|
|
|
|
|
|
|
|
}) }><i class="far fa-eye"></i></button>
|
|
|
|
}) }><i class="fas fa-image"></i></button>
|
|
|
|
) : null }
|
|
|
|
</div>
|
|
|
|
) : null)
|
|
|
|