--Improves platform detection for linux on /get-dash/index.html

--Adds friendly "platform not detected" message styled with callout.
--Hardens "download button" init code and removes unnecessary execution
--console-log cleanup
This commit is contained in:
Chuck Williams 2017-01-31 23:09:13 -07:00
parent e3e3aeb6e4
commit df757d920c
5 changed files with 63 additions and 50 deletions

View file

@ -1,29 +1,3 @@
- name: "Dash Core Win/32 ZIP"
description: Dash Core QT Wallet (All Features incl IS, PS, ....)
logo_url: /assets/img/dash_circle_normal.png
os: win32
type: desktop
vendor_id: dash_core
vendor_label: Dash Core
product_id: dash_core_win_32_zip
product_label: Dash Core Win/32 ZIP
product_security_label: "https://www.dash.org"
product_security_url: "https://www.dash.org"
product_website_label: Dash.org
product_website_url: "https://www.dash.org"
product_source_label: Github
product_source_url: "https://github.com/dashpay/dash"
links:
-
label: Download ZIP
url: "https://www.dash.org/binaries/dash-0.12.0.58-win32.zip"
-
label: Hash File
url: "https://github.com/dashpay/dash/releases/download/v0.12.0.58/SHA256SUMS.asc"
-
label: PGP
url: "https://www.dash.org/binaries/dash-0.12.0.58-win32.zip.asc"
- name: "Dash Core Win/32 Installer" - name: "Dash Core Win/32 Installer"
description: Dash Core QT Wallet (All Features incl IS, PS, ....) description: Dash Core QT Wallet (All Features incl IS, PS, ....)
logo_url: /assets/img/dash_circle_normal.png logo_url: /assets/img/dash_circle_normal.png
@ -50,6 +24,32 @@
label: PGP label: PGP
url: "https://www.dash.org/binaries/dash-0.12.0.58-win32-setup.exe.asc" url: "https://www.dash.org/binaries/dash-0.12.0.58-win32-setup.exe.asc"
- name: "Dash Core Win/32 ZIP"
description: Dash Core QT Wallet (All Features incl IS, PS, ....)
logo_url: /assets/img/dash_circle_normal.png
os: win32
type: desktop
vendor_id: dash_core
vendor_label: Dash Core
product_id: dash_core_win_32_zip
product_label: Dash Core Win/32 ZIP
product_security_label: "https://www.dash.org"
product_security_url: "https://www.dash.org"
product_website_label: Dash.org
product_website_url: "https://www.dash.org"
product_source_label: Github
product_source_url: "https://github.com/dashpay/dash"
links:
-
label: Download ZIP
url: "https://www.dash.org/binaries/dash-0.12.0.58-win32.zip"
-
label: Hash File
url: "https://github.com/dashpay/dash/releases/download/v0.12.0.58/SHA256SUMS.asc"
-
label: PGP
url: "https://www.dash.org/binaries/dash-0.12.0.58-win32.zip.asc"
- name: "Dash Core Win/64 Installer" - name: "Dash Core Win/64 Installer"
description: Dash Core QT Wallet (All Features incl IS, PS, ....) description: Dash Core QT Wallet (All Features incl IS, PS, ....)
logo_url: /assets/img/dash_circle_normal.png logo_url: /assets/img/dash_circle_normal.png

View file

@ -16,12 +16,14 @@
<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>
<section>
<p id="platform-not-detected" class="callout-blue">{% t pages.get-dash.hero-platform-not-detected %}</p>
<div class="hero__buttons hero__buttons--get-dash"> <div class="hero__buttons hero__buttons--get-dash">
<button id="download-detected-platform-button" href="#" class="btn-blue-solid btn-large">{% t pages.get-dash.hero-download-btn %}</button> <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 id="platform-not-detected">{% t pages.get-dash.hero-platform-not-detected %}</p> </section>
<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>

View file

@ -1,6 +1,6 @@
{% assign desktop-os-collection = site.data.wallets-collection | where:"type","desktop" | group_by:"os" %} {% assign wallet-collection-by-os = site.data.wallets-collection | group_by:"os" %}
<script> <script>
var walletsCollectionByOs = {{ desktop-os-collection | jsonify }}; var walletsCollectionByOs = {{ wallet-collection-by-os | jsonify }};
console.log('walletsCollectionByOs : ' , walletsCollectionByOs ); console.log('walletsCollectionByOs : ' , walletsCollectionByOs );
</script> </script>

View file

@ -6,7 +6,9 @@
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
if (typeof(walletsCollectionByOs) !== 'undefined' && walletsCollectionByOs) {
initDownloadButton(); initDownloadButton();
}
}); });
function getBestWalletMatch() { function getBestWalletMatch() {
@ -15,8 +17,10 @@
})), })),
_family = platform.os.family, _family = platform.os.family,
_vendor = 'dash_core', _vendor = 'dash_core',
_product_id = null,
_walletOs = 'win32', _walletOs = 'win32',
_type = 'desktop' _type = 'desktop',
detectedWallet = {}
; ;
switch (true) { switch (true) {
@ -42,6 +46,7 @@
break; break;
case /(linux|centos|debian|fedora|freebsd|gentoo|haiku|kubuntu|openbsd|red hat|suse|ubuntu|cygwin)/gi.test(_family): case /(linux|centos|debian|fedora|freebsd|gentoo|haiku|kubuntu|openbsd|red hat|suse|ubuntu|cygwin)/gi.test(_family):
_walletOs = 'linux'; _walletOs = 'linux';
_product_id = platform.os.architecture === 32 ? 'dash_core_linux_32' : 'dash_core_linux_64';
_vendor = 'dash_core'; _vendor = 'dash_core';
_type = 'desktop'; _type = 'desktop';
break; break;
@ -50,8 +55,13 @@
break; break;
} }
var detectedWallet = _.find(_walletsCollection,{os:_walletOs,vendor_id:_vendor,type:_type}); if ( _product_id ) {
detectedWallet = _.find(_walletsCollection,{product_id:_product_id});
} else {
detectedWallet = _.find(_walletsCollection,{os:_walletOs,vendor_id:_vendor,type:_type});
}
console.info('detectedWallet: ' , detectedWallet, {os:_walletOs,vendor_id:_vendor,type:_type});
return detectedWallet; return detectedWallet;
} }
@ -68,6 +78,7 @@
_notDetectedMessage = $('#platform-not-detected'); _notDetectedMessage = $('#platform-not-detected');
; ;
if (_downloadButton && _downloadButton.length > 0) {
if (_detectedWallet) { if (_detectedWallet) {
_downloadButton.html(_detectedWallet.links[0].label+': '+_detectedWallet.name) _downloadButton.html(_detectedWallet.links[0].label+': '+_detectedWallet.name)
.attr({ .attr({
@ -82,6 +93,7 @@
_downloadButton.hide(); _downloadButton.hide();
_notDetectedMessage.show(); _notDetectedMessage.show();
} }
}
return _downloadButton; return _downloadButton;
} }

View file

@ -6,7 +6,6 @@
*/ */
;(function() { ;(function() {
'use strict'; 'use strict';
console.log('platform.js');
/** Used to determine if values are of the language type `Object`. */ /** Used to determine if values are of the language type `Object`. */
var objectTypes = { var objectTypes = {