Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect key from longer URL #1175

Merged
merged 28 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
87f5076
detect key from longer URL
vanithaak Oct 16, 2022
049a0f4
Merge branch 'main' into vanithak
vanithaak Oct 16, 2022
9b89862
detect key from longer URL
vanithaak Oct 16, 2022
f6225c3
Merge branch 'main' of https://github.com/vanithaak/Leaflet.Distortab…
vanithaak Oct 17, 2022
4976617
Merge branch 'publiclab:main' into main
vanithaak Oct 19, 2022
2ea3e66
Merge branch 'main' into vanithak
vanithaak Oct 19, 2022
c71fc06
Merge branch 'publiclab:main' into main
vanithaak Oct 19, 2022
8db3a8e
Merge branch 'publiclab:main' into main
vanithaak Oct 19, 2022
1dca9e3
Merge branch 'publiclab:main' into main
vanithaak Oct 20, 2022
7cbcb80
fixes
vanithaak Oct 20, 2022
24df784
Merge branch 'main' of https://github.com/vanithaak/Leaflet.Distortab…
vanithaak Oct 20, 2022
47f1aa2
Merge branch 'publiclab:main' into main
vanithaak Oct 21, 2022
e160296
made a more flexible function to handle url
vanithaak Oct 21, 2022
53b33d8
Merge branch 'main' into vanithak
vanithaak Oct 21, 2022
67115ff
Merge branch 'main' into vanithak
vanithaak Oct 21, 2022
07c7e94
Merge branch 'publiclab:main' into main
vanithaak Oct 21, 2022
b85fcb5
Merge branch 'main' into vanithak
vanithaak Oct 22, 2022
773c2fe
Merge branch 'publiclab:main' into main
vanithaak Oct 22, 2022
13c6402
Merge branch 'publiclab:main' into main
vanithaak Oct 23, 2022
67b2862
updates
vanithaak Oct 23, 2022
f8da8ca
made a more flexible function to handle url
vanithaak Oct 21, 2022
602a4bb
made new function extractKey
vanithaak Oct 23, 2022
5a9a2a8
Merge branch 'vanithak' of https://github.com/vanithaak/Leaflet.Disto…
vanithaak Oct 23, 2022
7147210
Merge branch 'main' into vanithak
vanithaak Oct 25, 2022
947c332
replace 'http:' to https:
vanithaak Oct 26, 2022
ed036a0
updated http functionality
vanithaak Oct 26, 2022
abd523e
Merge branch 'main' into vanithak
jywarren Oct 30, 2022
cb93f85
Merge branch 'main' into vanithak
jywarren Oct 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/leaflet.distortableimage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 28 additions & 5 deletions examples/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,33 @@ <h3 id="offcanvasRightLabel">Images</h3>

form.addEventListener('submit', (event) => {
event.preventDefault();
const url = input.value.replace('details', 'metadata');
let splitUrl = url.split('/');
let detectKey = splitUrl[splitUrl.length - 2];
console.log("detected key", detectKey);
extractKey();
});

welcomeModal.addEventListener('hidden.bs.modal', (event) => {
new bootstrap.Offcanvas(sidebar).show();
});

function extractKey() {
let getUrl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! I'd like to test it out a bit. But can you put it within its own named function, like function showImages(getUrl) { below? Maybe it could be named function extractKey()?

if(!input.value.includes('archive.org/details/') && !input.value.includes('https://'))
{
getUrl = `https://archive.org/details/${input.value}/`;
showImages(getUrl);
}
else if(!input.value.includes('https://')) {
getUrl = `https://${input.value}`;
showImages(getUrl);
}
else
{
getUrl = input.value;
showImages(getUrl)
}
}

function showImages(getUrl) {
const url = getUrl.replace('details', 'metadata');
let fetchedFrom
axios.get(url)
.then((response) => {
Expand Down Expand Up @@ -142,7 +165,7 @@ <h3 id="offcanvasRightLabel">Images</h3>
.finally(() => {
bootstrap.Modal.getInstance(welcomeModal).hide();
});
});
}

welcomeModal.addEventListener('hidden.bs.modal', (event) => {
new bootstrap.Offcanvas(sidebar).show();
Expand Down