mirror of
https://github.com/seigler/dash-website
synced 2025-07-27 07:16:10 +00:00
Implements OS detection & cleanup on /get-dash/index.html
This commit is contained in:
parent
13002fe958
commit
031cf91dd4
7 changed files with 1319 additions and 2 deletions
|
@ -301,6 +301,7 @@ pages:
|
||||||
hero-text: Download the latest Dash client to get started
|
hero-text: Download the latest Dash client to get started
|
||||||
hero-wallet-version: Dash Wallet (Fullclient v12.0.56) for OSX
|
hero-wallet-version: Dash Wallet (Fullclient v12.0.56) for OSX
|
||||||
hero-wallet-version-select: Choose Another
|
hero-wallet-version-select: Choose Another
|
||||||
|
hero-platform-not-detected: "We're sorry, but your platform could not be automatically detected. Please select \"All Wallets\" to find a compatible version."
|
||||||
hero-download-btn: Download
|
hero-download-btn: Download
|
||||||
hero-all-wallets-btn: All Wallets
|
hero-all-wallets-btn: All Wallets
|
||||||
hero-guide-btn: Setup Guide
|
hero-guide-btn: Setup Guide
|
||||||
|
|
|
@ -10,16 +10,18 @@
|
||||||
<!-- Navigation -->
|
<!-- Navigation -->
|
||||||
{% include nav-desktop.html logo-color='black' %}
|
{% include nav-desktop.html logo-color='black' %}
|
||||||
|
|
||||||
|
|
||||||
<!-- Hero content -->
|
<!-- Hero content -->
|
||||||
<div class="hero__content">
|
<div class="hero__content">
|
||||||
<h1 class="hero__title">{% t pages.get-dash.hero-heading %}</h1>
|
<h1 class="hero__title">{% t pages.get-dash.hero-heading %}</h1>
|
||||||
<p class="hero__lead">{% t pages.get-dash.hero-text %}</p>
|
<p class="hero__lead">{% t pages.get-dash.hero-text %}</p>
|
||||||
|
|
||||||
<div class="hero__buttons hero__buttons--get-dash">
|
<div class="hero__buttons hero__buttons--get-dash">
|
||||||
<a href="#" class="btn-blue-solid btn-large">{% t pages.get-dash.hero-download-btn %}</a>
|
<button id="download-detected-platform-button" href="#" class="btn-blue-solid btn-large">{% t pages.get-dash.hero-download-btn %}</button>
|
||||||
<a href="../wallets/" class="btn-large btn-white-solid">{% t pages.get-dash.hero-all-wallets-btn %}</a>
|
<a href="../wallets/" class="btn-large btn-white-solid">{% t pages.get-dash.hero-all-wallets-btn %}</a>
|
||||||
</div>
|
</div>
|
||||||
<p class="hero__text">{% t pages.get-dash.hero-wallet-version %} – (<a href="#" class="hero__link">{% t pages.get-dash.hero-wallet-version-select %}</a>)</p>
|
<p id="platform-not-detected">{% t pages.get-dash.hero-platform-not-detected %}</p>
|
||||||
|
|
||||||
<div class="hero__buttons">
|
<div class="hero__buttons">
|
||||||
<a href="#getdash-wallet-setup" class="btn-white-solid">{% t pages.get-dash.hero-guide-btn %}</a>
|
<a href="#getdash-wallet-setup" class="btn-white-solid">{% t pages.get-dash.hero-guide-btn %}</a>
|
||||||
<a href="#getdash-buy" class="btn-white-solid">{% t pages.get-dash.hero-buy-btn %}</a>
|
<a href="#getdash-buy" class="btn-white-solid">{% t pages.get-dash.hero-buy-btn %}</a>
|
||||||
|
|
6
_includes/wallets_js_data.html
Normal file
6
_includes/wallets_js_data.html
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{% assign desktop-os-collection = site.data.wallets-collection | where:"type","desktop" | group_by:"os" %}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var walletsCollectionByOs = {{ desktop-os-collection | jsonify }};
|
||||||
|
console.log('walletsCollectionByOs : ' , walletsCollectionByOs );
|
||||||
|
</script>
|
|
@ -5,6 +5,7 @@ description: pages.get-dash.description
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include hero/get-dash.html %}
|
{% include hero/get-dash.html %}
|
||||||
|
{% include wallets_js_data.html %}
|
||||||
|
|
||||||
<div class="page page--get-dash">
|
<div class="page page--get-dash">
|
||||||
|
|
||||||
|
|
88
src/js/get-dash.js
Normal file
88
src/js/get-dash.js
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
/**
|
||||||
|
* Created by cwilliams on 1/30/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
;(function ($) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
initDownloadButton();
|
||||||
|
});
|
||||||
|
|
||||||
|
function getBestWalletMatch() {
|
||||||
|
var _walletsCollection = _.flatten(walletsCollectionByOs.map(function (walletGroupCollection){
|
||||||
|
return walletGroupCollection.items;
|
||||||
|
})),
|
||||||
|
_family = platform.os.family,
|
||||||
|
_vendor = 'dash_core',
|
||||||
|
_walletOs = 'win32',
|
||||||
|
_type = 'desktop'
|
||||||
|
;
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
case /(^Mac OS X$|^OS X$|^Mac$|^Macintosh$)/.test(_family):
|
||||||
|
_walletOs = 'osx';
|
||||||
|
_vendor = 'dash_core';
|
||||||
|
_type = 'desktop';
|
||||||
|
break;
|
||||||
|
case /android/gi.test(_family):
|
||||||
|
_walletOs = 'android';
|
||||||
|
_vendor = 'hash_engineering_solutions';
|
||||||
|
_type = 'mobile';
|
||||||
|
break;
|
||||||
|
case /Windows/gi.test(_family):
|
||||||
|
_walletOs = platform.os.architecture === 64 ? 'win64' : 'win32';
|
||||||
|
_vendor = 'dash_core';
|
||||||
|
_type = 'desktop';
|
||||||
|
break;
|
||||||
|
case /^ios/gi.test(_family):
|
||||||
|
_walletOs = 'ios'
|
||||||
|
_vendor = '';
|
||||||
|
_type = '';
|
||||||
|
break;
|
||||||
|
case /(linux|centos|debian|fedora|freebsd|gentoo|haiku|kubuntu|openbsd|red hat|suse|ubuntu|cygwin)/gi.test(_family):
|
||||||
|
_walletOs = 'linux';
|
||||||
|
_vendor = 'dash_core';
|
||||||
|
_type = 'desktop';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// do nothing;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var detectedWallet = _.find(_walletsCollection,{os:_walletOs,vendor_id:_vendor,type:_type});
|
||||||
|
|
||||||
|
return detectedWallet;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDownloadClick (event) {
|
||||||
|
var _dlButton = $(event.target),
|
||||||
|
_linkTo = _dlButton.data('detectedWallet').links[0].url;
|
||||||
|
;
|
||||||
|
window.open(_linkTo,"_blank");
|
||||||
|
}
|
||||||
|
|
||||||
|
function initDownloadButton(){
|
||||||
|
var _downloadButton = $('#download-detected-platform-button'),
|
||||||
|
_detectedWallet = getBestWalletMatch(),
|
||||||
|
_notDetectedMessage = $('#platform-not-detected');
|
||||||
|
;
|
||||||
|
|
||||||
|
if (_detectedWallet) {
|
||||||
|
_downloadButton.html(_detectedWallet.links[0].label+': '+_detectedWallet.name)
|
||||||
|
.attr({
|
||||||
|
title: platform.os.toString()
|
||||||
|
})
|
||||||
|
.data('detectedWallet',_detectedWallet)
|
||||||
|
.click(onDownloadClick)
|
||||||
|
.show()
|
||||||
|
;
|
||||||
|
_notDetectedMessage.hide();
|
||||||
|
} else {
|
||||||
|
_downloadButton.hide();
|
||||||
|
_notDetectedMessage.show();
|
||||||
|
}
|
||||||
|
return _downloadButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
}(jQuery));
|
1217
src/js/platform.js
Normal file
1217
src/js/platform.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,6 +15,8 @@ description: pages.wallets.description
|
||||||
{% assign paper-wallets = site.data.wallets-collection | sort: "product_label" | where:"type","paper" %}
|
{% assign paper-wallets = site.data.wallets-collection | sort: "product_label" | where:"type","paper" %}
|
||||||
{% assign security-wallets = site.data.wallets-collection| sort: "product_label" | where:"type","security" %}
|
{% assign security-wallets = site.data.wallets-collection| sort: "product_label" | where:"type","security" %}
|
||||||
|
|
||||||
|
{% include wallets_js_data.html %}
|
||||||
|
|
||||||
{% for vendor-group in vendor-collection %}
|
{% for vendor-group in vendor-collection %}
|
||||||
{% include modals/vendor-group-download-collection.html %}
|
{% include modals/vendor-group-download-collection.html %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue