From 23608321549df020dc0a2c79fc00f5edd1ffe2e6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 4 Aug 2015 22:14:25 -0400 Subject: pull in video stuff and write bg wrapper :) --- public/js/lib/bg.js | 29 +++++ public/js/lib/parser.js | 286 ------------------------------------------------ public/js/lib/video.js | 91 +++++++++++++++ 3 files changed, 120 insertions(+), 286 deletions(-) create mode 100644 public/js/lib/bg.js delete mode 100644 public/js/lib/parser.js create mode 100644 public/js/lib/video.js (limited to 'public/js/lib') diff --git a/public/js/lib/bg.js b/public/js/lib/bg.js new file mode 100644 index 0000000..5a188f3 --- /dev/null +++ b/public/js/lib/bg.js @@ -0,0 +1,29 @@ +var bg = (function(){ + + var bg = {} + bg.el = document.getElementById("bg") + + bg.change = function(url){ + var img = new Image () + img.src = url + oktween.add({ + obj: bg.el.style, + from: { opacity: 1 }, + to: { opacity: 0 }, + easing: "circ_in", + duration: 500, + finished: function(){ + bg.el.style.backgroundImage = "url(" + url + ")" + } + }).then({ + delay: 500, + obj: bg.el.style, + from: { opacity: 0 }, + to: { opacity: 1 }, + easing: "circ_in", + duration: 500, + }) + + } + +})() \ No newline at end of file diff --git a/public/js/lib/parser.js b/public/js/lib/parser.js deleted file mode 100644 index 20c5306..0000000 --- a/public/js/lib/parser.js +++ /dev/null @@ -1,286 +0,0 @@ -var Parser = (function(){ - var Parser = {} - Parser.integrations = [{ - type: 'image', - regex: /\.(jpeg|jpg|gif|png|svg)(\?.*)?$/i, - fetch: function(url, done) { - var img = new Image () - img.onload = function(){ - if (!img) return - var width = img.naturalWidth, height = img.naturalHeight - img = null - done({ - url: url, - type: "image", - token: "", - thumbnail: "", - title: "", - width: width, - height: height, - }) - } - img.src = url - if (img.complete) { - img.onload() - } - }, - tag: function (media) { - return ''; - } - }, { - type: 'video', - regex: /\.(mp4|webm)(\?.*)?$/i, - fetch: function(url, done) { - var video = document.createElement("video") - video.addEventListener("loadedmetadata", function(){ - var width = video.videoWidth, height = video.videoHeight - video = null - done({ - url: url, - type: "video", - token: "", - thumbnail: "", - title: "", - width: width, - height: height, - }) - }) - video.src = url - video.load() - }, - tag: function (media) { - return '