Skip to content

Commit

Permalink
display list of supported oembed hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed Jun 9, 2021
1 parent 63fbe61 commit 0435b0e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions static/javascript/geotag.oembed.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ window.addEventListener("load", function load(event){
return;
}

console.log("HELLO", endpoints_map);

geotag.oembed.set_endpoints_map(endpoints_map);

var q_el = document.getElementById("oembed-url");
Expand Down Expand Up @@ -38,6 +40,24 @@ window.addEventListener("load", function load(event){
return;
}

var valid_el = document.getElementById("oembed-valid-endpoints");

if (valid_el){

var oembed_hosts = [];

for (var host in endpoints_map){
oembed_hosts.push(host);
}

if (oembed_hosts.length){

var str_hosts = oembed_hosts.join(", ");
var str_valid = "Supported OEmbed hosts are: " + str_hosts;
valid_el.innerText = str_valid;
}
}

var handle_geotag_props = function(props){

var camera = geotag.camera.getCamera();
Expand Down
2 changes: 1 addition & 1 deletion templates/html/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="form-group">
<label for="oembed-url">Fetch an image</label>
<input class="form-control mr-sm-2" type="search" name="oembed-url" id="oembed-url" placeholder="Enter a URL to retrieve" value="" aria-label="Fetch" aria-describedby="oembed-url-help" />
<small id="oembed-url-help" class="form-text text-muted">A valid OEmbed URL for retrieving an image to display. <span id="valid-oembed-endpoints"></span></small>
<small id="oembed-url-help" class="form-text text-muted">A valid OEmbed URL for retrieving an image to display. <small id="oembed-valid-endpoints"></span></small>
</div>
<button class="btn btn-primary pull-right" type="submit" id="oembed-fetch">Fetch</button>
{{ end }}
Expand Down

0 comments on commit 0435b0e

Please sign in to comment.