From 94cc060914231b3369d5c36ab73711bea765c541 Mon Sep 17 00:00:00 2001 From: Wasabi Fan Date: Fri, 10 Feb 2017 19:03:25 -0800 Subject: [PATCH 1/5] Clean up releases script and add reload button --- _includes/page-core/title.html | 4 ++ javascripts/api-cache.js | 24 +++++---- javascripts/releases.js | 99 +++++++++++++++++++++------------- 3 files changed, 80 insertions(+), 47 deletions(-) diff --git a/_includes/page-core/title.html b/_includes/page-core/title.html index e069bac72..3ae6f8a85 100644 --- a/_includes/page-core/title.html +++ b/_includes/page-core/title.html @@ -13,6 +13,8 @@ {% assign edit_path = repo_url | append: '/edit/master/' | append: page.path %} {% elsif page.path contains 'news/' %} {% assign show_news_link = 1 %} +{% elsif page.path == 'download.md' %} + {% assign show_downloads_refresh_link = 1 %} {% endif %}
- + Download for Raspberry Pi Model 2/3 @@ -75,7 +75,7 @@ no-wrapper: true

- + Download for BeagleBone diff --git a/javascripts/releases.js b/javascripts/releases.js index 1de70b9dd..441772c59 100644 --- a/javascripts/releases.js +++ b/javascripts/releases.js @@ -52,9 +52,9 @@ function loadReleasesByPlatform(successCallback, errorCallback) { function initDownloadLinks() { loadReleasesByPlatform(function (releaseMap) { - $('a[data-release-link-platform]').each(function (i, element) { + $('a[data-download-button-platform]').each(function (i, element) { var $linkElem = $(element); - var targetReleasePlatform = $linkElem.data('release-link-platform'); + var targetReleasePlatform = $linkElem.data('download-button-platform'); var targetRelease = (releaseMap[targetReleasePlatform] || [])[0]; if (!targetRelease) { @@ -63,14 +63,20 @@ function initDownloadLinks() { } $linkElem.attr('href', targetRelease.downloadUrl); + $linkElem.addClass('btn-group-vertical download-button-container'); + + var $upperSection = $linkElem.children('.download-button-upper'); + if($upperSection.length <= 0) { + var $contents = $linkElem.contents(); + $upperSection = $('').addClass('btn btn-lg btn-primary download-button-upper').appendTo($linkElem); + $contents.appendTo($upperSection); + } + + $linkElem.children('.download-button-lower').remove(); + var $lowerSection = $('').addClass('btn download-button-lower').text(targetRelease.assetName).appendTo($linkElem); - $linkElem.children('small.download-info-label').remove(); var fileSize = targetRelease.size >> 20; - $('').addClass('download-info-label badge').text(fileSize + ' MiB').appendTo($linkElem); - $('').addClass('download-info-label').css({ - 'display': 'block', - 'font-size': '65%' - }).text(targetRelease.assetName).appendTo($linkElem); + $('').addClass('download-info-label badge').text(fileSize + ' MiB').appendTo($lowerSection); }); }, @@ -87,7 +93,7 @@ $(document).ready(function () { $('.release-link-alt').hide(); $('.release-link-container').show(); - if ($('a[data-release-link-platform]').length > 0) { + if ($('a[data-download-button-platform]').length > 0) { initDownloadLinks(); } }); \ No newline at end of file diff --git a/stylesheets/site-structure.scss b/stylesheets/site-structure.scss index 04fa6faa4..45fc9b647 100644 --- a/stylesheets/site-structure.scss +++ b/stylesheets/site-structure.scss @@ -152,6 +152,113 @@ ul + p, ol + p { font-size: 22px; } +.download-button-container { + text-decoration: none !important; + cursor: pointer; + touch-action: manipulation; + + * { + pointer-events: none; + } + + // The following styles are an adaptation of those for standard buttons; from mixins/_buttons.scss + // Darken percentages for the lower half are lessened manually because the lower half is already dark + &:focus, + &.focus { + .download-button-upper { + background-color: darken($brand-primary, 10%); + border-color: darken($brand-primary, 25%); + } + + .download-button-lower { + background-color: darken($gray, 7%); + border-color: darken($gray, 15%); + } + } + &:hover { + .download-button-upper { + background-color: darken($brand-primary, 10%); + border-color: darken($brand-primary, 12%); + } + + .download-button-lower { + background-color: darken($gray, 7%); + border-color: darken($gray, 9%); + } + } + + &:active, + &.active, + .open > &.dropdown-toggle { + .download-button-upper { + background-color: darken($brand-primary, 10%); + border-color: darken($brand-primary, 12%); + } + .download-button-lower { + background-color: darken($gray, 7%); + border-color: darken($gray, 9%); + } + + &:hover, + &:focus, + &.focus { + .download-button-upper { + background-color: darken($brand-primary, 17%); + border-color: darken($brand-primary, 25%); + } + .download-button-lower { + background-color: darken($gray, 13%); + border-color: darken($gray, 15%); + } + } + } + &.disabled, + &[disabled], + fieldset[disabled] & { + &, + &:hover, + &:focus, + &.focus, + &:active, + &.active { + .download-button-upper { + background-color: $brand-primary; + border-color: $brand-primary; + } + + .download-button-lower { + background-color: $gray; + border-color: $gray; + } + } + } + + .download-button-upper { + font-size: 25px; + font-weight: bold; + } + + .download-button-lower { + background-color: $gray; + color: white; + font-size: 85%; + + padding-top: 4px; + padding-bottom: 4px; + height: 30px; + + .badge { + color: $gray; + background-color: white; + + padding: 2px 5px; + font-size: 11px; + margin-right: -10px; + margin-left: 10px; + } + } +} + // thanks http://stackoverflow.com/a/32490429/1976323 $margins: (xs: 0.5rem, sm: 1rem, md: 1.5rem, lg: 2rem, xl: 2.5rem); From 9b49b3fb1257a21dbcc91d0eb4cdca10dea50413 Mon Sep 17 00:00:00 2001 From: Wasabi Fan Date: Sun, 26 Mar 2017 18:57:40 -0700 Subject: [PATCH 5/5] Fix download button alignment and normalize text --- docs/getting-started.md | 8 +++---- download.md | 16 ++++++------- javascripts/releases.js | 2 +- stylesheets/page-content.scss | 6 +++-- stylesheets/site-structure.scss | 42 ++++++++++++++++++++++++++++----- 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 0d3444fd5..824a1b550 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -51,12 +51,12 @@ please [open an issue on GitHub](/support){: .alert-link}.

diff --git a/download.md b/download.md index 9a821afe9..916b1544e 100644 --- a/download.md +++ b/download.md @@ -28,9 +28,9 @@ no-wrapper: true the primary focus of development.

- + - Download for EV3 + LEGO MINDSTORMS EV3 @@ -75,9 +75,9 @@ no-wrapper: true

diff --git a/javascripts/releases.js b/javascripts/releases.js index 441772c59..51f0b6021 100644 --- a/javascripts/releases.js +++ b/javascripts/releases.js @@ -68,7 +68,7 @@ function initDownloadLinks() { var $upperSection = $linkElem.children('.download-button-upper'); if($upperSection.length <= 0) { var $contents = $linkElem.contents(); - $upperSection = $('').addClass('btn btn-lg btn-primary download-button-upper').appendTo($linkElem); + $upperSection = $('').addClass('btn btn-primary download-button-upper').appendTo($linkElem); $contents.appendTo($upperSection); } diff --git a/stylesheets/page-content.scss b/stylesheets/page-content.scss index a8563ef3a..3f9f640f1 100644 --- a/stylesheets/page-content.scss +++ b/stylesheets/page-content.scss @@ -30,8 +30,10 @@ margin: 5px 0 5px !important; } -.download-button-small { - margin: 0 6px; +.stacked-download-button { + margin-top: 7px; + margin-left: 15px; + margin-right: 15px; } .dark-bg { diff --git a/stylesheets/site-structure.scss b/stylesheets/site-structure.scss index 45fc9b647..8c83717ea 100644 --- a/stylesheets/site-structure.scss +++ b/stylesheets/site-structure.scss @@ -234,29 +234,59 @@ ul + p, ol + p { } .download-button-upper { - font-size: 25px; font-weight: bold; } .download-button-lower { background-color: $gray; color: white; - font-size: 85%; padding-top: 4px; padding-bottom: 4px; - height: 30px; .badge { color: $gray; background-color: white; padding: 2px 5px; - font-size: 11px; - margin-right: -10px; - margin-left: 10px; } } + + &.btn-group-lg { + .download-button-upper { + font-size: 25px; + } + + .download-button-lower { + font-size: 85%; + height: 30px; + + .badge { + font-size: 11px; + margin-right: -10px; + margin-left: 10px; + } + } + } + + &.btn-group-md { + .download-button-upper { + font-size: 17px; + } + + .download-button-lower { + font-size: 75%; + height: 25px; + + .badge { + font-size: 10px; + margin-right: -10px; + margin-left: 10px; + } + } + } + + // small and extra-small download buttons are not used } // thanks http://stackoverflow.com/a/32490429/1976323