Skip to content

Commit

Permalink
use @ssorallen's blob support test in customizer; fixes #12617
Browse files Browse the repository at this point in the history
  • Loading branch information
cvrebert committed Feb 18, 2014
1 parent db32afe commit 966fdcb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
38 changes: 26 additions & 12 deletions docs/assets/js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,18 +329,32 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
})

// browser support alerts
if (!window.URL && navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
showCallout('Looks like you\'re using safari, which sadly doesn\'t have the best support' +
'for HTML5 blobs. Because of this your file will be downloaded with the name <code>"untitled"</code>.' +
'However, if you check your downloads folder, just rename this <code>"untitled"</code> file' +
'to <code>"bootstrap.zip"</code> and you should be good to go!')
} else if (!window.URL && !window.webkitURL) {
$('.bs-docs-section, .bs-docs-sidebar').css('display', 'none')

showCallout('Looks like your current browser doesn\'t support the Bootstrap Customizer. Please take a second' +
'to <a href="https://www.google.com/intl/en/chrome/browser/">upgrade to a more modern browser</a>.', true)
}
// browser support alert
+function () {
/**
* Based on:
* Blob Feature Check v1.0.0
* https://github.com/ssorallen/blob-feature-check/
* License: Public domain (http://unlicense.org)
*/
var svg = new Blob(
['<svg xmlns=\'http://www.w3.org/2000/svg\'></svg>'],
{type: 'image/svg+xml;charset=utf-8'}
)

var img = new Image()
img.onload = function () {
$compileBtn.prop('disabled', false)
}
img.onerror = function () {
$('.bs-docs-section, .bs-docs-sidebar').css('display', 'none')
showCallout('Looks like your current browser doesn\'t support the Bootstrap Customizer. Please take a second ' +
'to <a href="https://www.google.com/intl/en/chrome/browser/">upgrade to a more modern browser</a>.', true)
}

var url = window.webkitURL || window.URL // Safari 6 uses "webkitURL".
img.src = url.createObjectURL(svg)
}()

parseUrl()
}
2 changes: 1 addition & 1 deletion docs/customize.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ <h1 id="download" class="page-header">Download</h1>

<p class="lead">Hooray! Your custom version of Bootstrap is now ready to be compiled. Just click the button below to finish the process.</p>
<div class="bs-customize-download">
<button type="submit" id="btn-compile" class="btn btn-block btn-lg btn-outline" onclick="_gaq.push(['_trackEvent', 'Customize', 'Download', 'Customize and Download']);">Compile and Download</button>
<button type="submit" id="btn-compile" disabled="disabled" class="btn btn-block btn-lg btn-outline" onclick="_gaq.push(['_trackEvent', 'Customize', 'Download', 'Customize and Download']);">Compile and Download</button>

This comment has been minimized.

Copy link
@zlatanvasovic

zlatanvasovic Feb 18, 2014

Contributor

disabled is enough

</div>
</div><!-- /download -->
</form>

0 comments on commit 966fdcb

Please sign in to comment.