diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-07-24 11:57:23 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-07-24 11:57:23 +0530 |
commit | 210fca3a77b9043e0f2c608e1eaff6f2ec37cdf3 (patch) | |
tree | 34123e1c92d6cae2a4435161f68991ebe7b89a64 /docs/_includes/appstoreimages.html | |
parent | 54b0e8a12bdc9c7aef52a1629641b6b1137277a6 (diff) |
added landing page
Diffstat (limited to 'docs/_includes/appstoreimages.html')
-rw-r--r-- | docs/_includes/appstoreimages.html | 67 |
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 |