IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Преглед изворни кода

Support for viewing .nii.gz

pull/1/head
Stanislaw Adaszewski пре 4 година
родитељ
комит
39a1eb82fa
1 измењених фајлова са 10 додато и 2 уклоњено
  1. +10
    -2
      frontend/src/js/component/wb-collection-content.js

+ 10
- 2
frontend/src/js/component/wb-collection-content.js Прегледај датотеку

@@ -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)


Loading…
Откажи
Сачувај