-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #459 from camicroscope/develop
For 3.8.3
- Loading branch information
Showing
10 changed files
with
177 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="../../core/openseadragon/openseadragon.js"></script> | ||
<script src="../../core/Store.js"></script> | ||
<script src="../../common/PathdbMods.js"></script> | ||
<link rel="stylesheet" href="./style.css"> | ||
<title>Select an Image</title> | ||
</head> | ||
<body> | ||
<h1> Images </h1> | ||
<div id="pages"></div> | ||
<div id="workspace" class="flex-grid"></div> | ||
</body> | ||
<script src="./multi.js"></script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// initalize dependencies and params | ||
let store = new Store('../../data/'); | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const page = parseInt(urlParams.get('p'), 10) || 0; | ||
const mode = urlParams.get('mode'); | ||
const MAX_TILES = parseInt(urlParams.get('mt'), 10) || 16; | ||
const prefixUrl = 'https://cdn.jsdelivr.net/npm/[email protected]/build/openseadragon/images/'; | ||
let query = JSON.parse(urlParams.get('q') || '{}'); | ||
let list = JSON.parse(urlParams.get('l') || '[]'); | ||
|
||
let viewers = []; | ||
|
||
// run the pathdb mods as needed | ||
if (mode == 'pathdb') { | ||
PathDbMods(); | ||
} | ||
|
||
const workspace = document.getElementById('workspace'); | ||
|
||
function addTile(url, i, name, dest) { | ||
let d = document.createElement('div'); | ||
d.id = 'osd' + i; | ||
d.className = 'osd col'; | ||
// tile size, and hidden to start | ||
d.style = 'min-width: 400px; width:22%; height:400px'; | ||
// add link to slide | ||
let b = document.createElement('a'); | ||
b.id = 'link' + i; | ||
b.innerText = name; | ||
b.href=dest; | ||
d.appendChild(b); | ||
d.appendChild(document.createElement('br')); | ||
workspace.appendChild(d); | ||
viewers[i] = OpenSeadragon({ | ||
id: d.id, | ||
prefixUrl: prefixUrl, | ||
tileSources: url, | ||
}); | ||
} | ||
|
||
function onInit() { | ||
let promises = []; | ||
if (list.length) { | ||
for (j of list) { | ||
promises.push(store.getSlide(j)); | ||
} | ||
} else { | ||
promises.push(store.findSlide(null, null, null, null, query)); | ||
} | ||
Promise.all(promises).then((xx)=>{ | ||
let x = xx.flat(); | ||
// pagination | ||
// previous? | ||
if (page > 0) { | ||
let p = document.createElement('a'); | ||
let prevParam = new URLSearchParams(window.location.search); | ||
p.id = 'prevPage'; | ||
prevParam.set('p', page-1); | ||
p.innerText = 'Prev'; | ||
p.href = './multi.html?' + prevParam.toString(); | ||
document.getElementById('pages').append(p); | ||
} | ||
// next? | ||
if (page < Math.floor(x.length/MAX_TILES)-1) { | ||
let p = document.createElement('a'); | ||
let nextParam = new URLSearchParams(window.location.search); | ||
p.id = 'nextPage'; | ||
nextParam.set('p', page+1); | ||
p.innerText = 'Next'; | ||
p.href = './multi.html?' + nextParam.toString(); | ||
document.getElementById('pages').append(p); | ||
} | ||
// tiles | ||
let start = MAX_TILES * page; | ||
let stop = Math.min(x.length, start+MAX_TILES); | ||
for (let n = start; n < stop; n++) { | ||
let item = x[n]; | ||
let loc = '../../img/IIP/raw/?DeepZoom=' + item.location + '.dzi'; | ||
let dest = '../viewer/viewer.html?slideId=' + item._id['$oid']; | ||
if (mode == 'pathdb') { | ||
dest += '&mode=pathdb'; | ||
} | ||
addTile(loc, n, item.name, dest); | ||
} | ||
}); | ||
} | ||
|
||
// TODO pagination | ||
|
||
window.onload = onInit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
body{ | ||
margin: 25px; | ||
} | ||
.flex-grid { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
.col { | ||
flex: 1; | ||
} | ||
|
||
.osd{ | ||
margin: 10px; | ||
padding: 10px; | ||
background-color: HoneyDew; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters