From 79cb8733e5435748a01bc0397309d31dbab6197b Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 18 Nov 2017 13:32:47 +1300 Subject: [PATCH] sdk: add encodeURIComponent() to getters, add getThumbnailURL(), add thumbnail.* constants --- static/sdk.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/static/sdk.js b/static/sdk.js index 1df061d..db436d9 100644 --- a/static/sdk.js +++ b/static/sdk.js @@ -65,13 +65,24 @@ var contented = (function() { }, "getPreviewURL": function(id) { - return baseURL + "get/" + id; // n.b. there's no better preview URL yet + return baseURL + "get/" + encodeURIComponent(id); // n.b. there's no better preview URL yet }, "getDownloadURL": function(id) { - return baseURL + "get/" + id; + return baseURL + "get/" + encodeURIComponent(id); }, "getInfoJSONURL": function(id) { - return baseURL + "info/" + id; + return baseURL + "info/" + encodeURIComponent(id); + }, + "getThumbnailURL": function(thumbnailType, id) { + return baseURL + "thumb/" + encodeURIComponent(thumbnailType) + "/" + encodeURIComponent(id); + }, + "thumbnail": { + "small_square": "s", + "medium_square": "b", + "medium": "t", + "large": "m", + "xlarge": "l", + "xxlarge": "h" } };