diff --git a/web/app/assets/images/content/button_download_mac_intel.png b/web/app/assets/images/content/button_download_mac_intel.png new file mode 100644 index 000000000..20ef7405c Binary files /dev/null and b/web/app/assets/images/content/button_download_mac_intel.png differ diff --git a/web/app/assets/images/content/button_download_mac_mx.png b/web/app/assets/images/content/button_download_mac_mx.png new file mode 100644 index 000000000..585ae5b64 Binary files /dev/null and b/web/app/assets/images/content/button_download_mac_mx.png differ diff --git a/web/app/assets/javascripts/web/downloads_legacy.js b/web/app/assets/javascripts/web/downloads_legacy.js new file mode 100644 index 000000000..e52fd006b --- /dev/null +++ b/web/app/assets/javascripts/web/downloads_legacy.js @@ -0,0 +1,174 @@ +(function(context,$) { + + "use strict"; + + context.JK = context.JK || {}; + + var downloads = {}; + var isCongratulations; + var downloadUris = {}; // map of platform > uri + var rest = context.JK.Rest(); + + function selectPlatform(selectedPlatform) { + //console.log("selectedPlatform", selectedPlatform); + var platformName; // mac, windows, linux + var platformDisplay; // Mac, Windows, Linux + var platform = selectedPlatform; //MacOSX, Win32, Unix + var platformName1, platformName2, platform1, platform2, platformDisplay1, platformDisplay2; + var uri = downloadUris[selectedPlatform]; + + // prepare template varaibles + if (selectedPlatform == "Unix") { + platformName = "linux"; + platformDisplay = "Linux" + platformName1 = "mac_intel"; + platformDisplay1 = "Mac/Intel"; + platformName2 = "windows"; + platformDisplay2 = "Windows"; + platform1 = "MacOSX"; + platform2 = "Win32" + } else if(selectedPlatform == "Win32") { + platformName = "windows"; + platformDisplay = "Windows"; + platformName1 = "mac_intel"; + platformDisplay1 = "Mac/Intel"; + platformName2 = "linux" + platformDisplay2 = "Linux"; + platform1 = "MacOSX"; + platform2 = "Unix"; + } else if(selectedPlatform == "MacOSX") { + platformName = "mac_intel"; + platformDisplay = "Mac/Intel"; + platformName1 = "windows"; + platformDisplay1 = "Windows"; + platformName2 = "linux"; + platformDisplay2 = "Linux"; + platform1 = "Win32"; + platform2 = "Unix"; + } + else { + alert("unknown platform: " + selectedPlatform); + } + + var options = { + platform : platform, + platformName : platformName, + platformDisplay : platformDisplay, + platformName1 : platformName1, + platformDisplay1 : platformDisplay1, + platformName2 : platformName2, + platformDisplay2 : platformDisplay2, + platform1: platform1, + platform2: platform2, + uri : uri ? uri : '#', + isCongratulations : isCongratulations + }; + + var blurb = $(context._.template($('#client-download-legacy-blurb-contents').html(), options, { variable: 'data' })); + + // isolate active image for blurb + $('div.hidden-images img[data-purpose=' + platformName + ']', blurb).remove().appendTo($('a.current-os-download', blurb)); + + var selectOthers = $(context._.template($('#client-download-legacy-select-others').html(), options, { variable: 'data' })); + + // isolate active images for selectOthers + $('div.hidden-images img[data-purpose=' + platformName1 + ']', selectOthers).remove().appendTo($('a[data-order=1]', selectOthers)); + $('div.hidden-images img[data-purpose=' + platformName2 + ']', selectOthers).remove().appendTo($('a[data-order=2]', selectOthers)); + + + // install click handler for change selection + $('a.choose-other-platform', selectOthers).click(function() { + var platform = $(this).attr('data-platform'); + selectPlatform(platform); + return false; + }); + + $('a', blurb).click(function() { + //console.log("download clicked"); + var clicked = $(this); + var href = clicked.attr('href'); + if(href != "#") { + context.JK.GA.trackDownload(clicked.attr('data-platform')); + rest.userDownloadedClient().always(function() { + $('body').append('