Commit 35a5bc44 authored by Remy Sharp's avatar Remy Sharp
Browse files

Use shorthand method $ and proper support check

Note that I've created `hasSupport` but not using it. I think you might want to use this function instead of the poor UA sniffing to detect support.

That said, iOS6 and (I believe) 7 can't preview the video because their blob support is broken (even though they claim to support it). If that's the case, we might want to hide step 2, and just let them upload. Also: I hate Apple. And iTunes. And myself for using these horrible things that Apple provides me with. Like my lovely 16gb RAM MBP.
parent c659a66d
//
// #iamindie campaign — clide-side logic.
//
function on(el, event, fn) {
el.addEventListener(event, fn, false);
}
function $(s) {
return document.querySelector(s || '');
}
if (!window.URL && window.webkitURL) {
window.URL = window.webkitURL;
}
var hasSupport = (function () {
// video
if (!document.createElement('video').canPlayType) {
return false;
}
// blobs
if (!window.URL || !window.URL.createObjectURL) {
return false;
}
if (!document.querySelector) {
return false;
}
// seriously, yo browser be old (well, "IE8 old"")
if (!document.addEventListener) {
return false;
}
// formData & XHR2
if (!window.FormData) {
return false;
}
return true;
});
// References to DOM elements.
var mobileNotice = document.getElementById('mobile-notice')
var fileInput = document.querySelector('input[type=file]');
var progressBar = document.getElementById('upload-progress');
var messageDisplay = document.getElementById('message');
var uploadItButton = document.getElementById('upload-it-button');
var videoPreview = document.getElementById('video-preview');
var videoButton = document.getElementById('video-button');
var video = document.getElementById('video-preview');
var mobileNotice = $('#mobile-notice')
var fileInput = $('input[type=file]');
var progressBar = $('#upload-progress');
var messageDisplay = $('#message');
var uploadItButton = $('#upload-it-button');
var videoPreview = $('#video-preview');
var videoButton = $('#video-button');
var video = $('#video-preview video');
var played = false;
// Initial state of UI elements.
videoPreview.disabled = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment