aboutsummaryrefslogtreecommitdiff
path: root/docs/_includes/appstoreimages.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/_includes/appstoreimages.html')
-rw-r--r--docs/_includes/appstoreimages.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/docs/_includes/appstoreimages.html b/docs/_includes/appstoreimages.html
new file mode 100644
index 0000000..7fac822
--- /dev/null
+++ b/docs/_includes/appstoreimages.html
@@ -0,0 +1,67 @@
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
+
+{% if site.ios_app_id %}
+
+<script>
+
+$(function() {
+
+ var apiURL = "https://itunes.apple.com/lookup?id={{ site.ios_app_id }}&callback=?";
+
+ $.getJSON(apiURL, function(json) {
+
+ if (json.results && json.results.length) {
+
+ console.info("Image strings loaded from Apple API.");
+ var appInfo = json.results[0];
+
+ // Set favicon
+ $('link[rel="shortcut icon"]').attr("href", appInfo.artworkUrl512);
+
+ // Set page title using the iOS app ID if it is not set manually in _config.yml
+ var $pageTitle = $(".pageTitle");
+ if ($.trim($($pageTitle).text()).length == 0) {
+ $($pageTitle).html(appInfo.trackName);
+ }
+
+ // Set large app icon using the iOS app ID if it is not set manually in _config.yml
+ var $appIconLarge = $(".appIconLarge");
+ if (!$appIconLarge.attr('src')) {
+ $($appIconLarge).attr("src", appInfo.artworkUrl512);
+ }
+
+ // Set header app icon using the iOS app ID if it is not set manually in _config.yml
+ var $appIconHeader = $(".headerIcon");
+ if (!$appIconHeader.attr('src')) {
+ $($appIconHeader).attr("src", appInfo.artworkUrl512);
+ }
+
+ // Set app name using the iOS app ID if it is not set manually in _config.yml
+ var $appName = $(".appName");
+ var $headerName = $(".headerName");
+ if ($.trim($($appName).text()).length == 0) {
+ $($appName).html(appInfo.trackName);
+ $($headerName).html(appInfo.trackName);
+ }
+
+ // Set price using the iOS app ID if it is not set manually in _config.yml
+ var $appPrice = $(".appPrice");
+ if ($.trim($($appPrice).text()).length == 0) {
+ $($appPrice).html(appInfo.formattedPrice);
+ }
+
+ // Set App Store link using the iOS app ID if it is not set manually in _config.yml
+ var $appStoreLink = $(".appStoreLink");
+ if ($.trim($appStoreLink.attr('href')).length == 0) {
+ $($appStoreLink).attr("href", appInfo.trackViewUrl);
+ }
+
+ console.info(appInfo);
+
+ }
+ });
+});
+
+</script>
+
+{% endif %} \ No newline at end of file