Commit 4256692c authored by tobinski's avatar tobinski
Browse files

Add depth attribute to the widget.

parent d395f8b7
...@@ -91,6 +91,9 @@ ...@@ -91,6 +91,9 @@
<h3 slot="title">Example 10: Links (similarto) from geolinker dodis: Diedenhofen with credits</h3> <h3 slot="title">Example 10: Links (similarto) from geolinker dodis: Diedenhofen with credits</h3>
<p slot="credits">Example credits</p> <p slot="credits">Example credits</p>
</histhub-widget> </histhub-widget>
<histhub-widget endpoint="//api.geolinker.histhub.ch/v2/sameas/" resolver="resolverneo4j" location="https://dodis.ch/G8656" depth="2">
<h3 slot="title">Example 11: Links (similarto) from geolinker dodis: Diedenhofen with depth 2</h3>
</histhub-widget>
</div> </div>
</body> </body>
</html> </html>
...@@ -172,12 +172,13 @@ ...@@ -172,12 +172,13 @@
const language = this.getAttribute('language') || null; const language = this.getAttribute('language') || null;
const timeout = this.getAttribute('timeout') || null; const timeout = this.getAttribute('timeout') || null;
const location = this.getAttribute('location') || window.location.href; const location = this.getAttribute('location') || window.location.href;
const depth = this.getAttribute('depth') || 1;
this.linkTarget = this.getAttribute('link-target') || '_blank'; this.linkTarget = this.getAttribute('link-target') || '_blank';
if (typeof url === 'undefined' || typeof resolver === 'undefined' || typeof location === 'undefined') { if (typeof url === 'undefined' || typeof resolver === 'undefined' || typeof location === 'undefined') {
throw new Error("Missing required parameters"); throw new Error("Missing required parameters");
} }
try { try {
await this.fetchLinks(url, resolver, location, {language, timeout}); await this.fetchLinks(url, resolver, location, {language, timeout, depth});
} catch(error) { } catch(error) {
console.log(error); console.log(error);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment