Zach Wise
12 years ago
8 changed files with 1696 additions and 44 deletions
@ -0,0 +1,881 @@ |
|||||||
|
/* |
||||||
|
VéritéCo Timeline CDN 0.8 |
||||||
|
Designed and built by Zach Wise digitalartwork.net |
||||||
|
*/ |
||||||
|
|
||||||
|
/* CodeKit Import |
||||||
|
http://incident57.com/codekit/
|
||||||
|
================================================== */ |
||||||
|
// @codekit-append "Embed.js";
|
||||||
|
|
||||||
|
/* REPLACE THIS WITH YOUR GOOGLE ANALYTICS ACCOUNT |
||||||
|
================================================== */ |
||||||
|
var embed_analytics = "UA-537357-20"; |
||||||
|
|
||||||
|
/* REPLACE THIS WITH YOUR BASE PATH FOR TIMELINE |
||||||
|
================================================== */ |
||||||
|
//var embed_path = "http://embed.verite.co/timeline/";
|
||||||
|
|
||||||
|
/* LOAD TIMER |
||||||
|
================================================== */ |
||||||
|
var load_time_start = new Date().getTime(), the_load_time = 0; |
||||||
|
|
||||||
|
/* GOOGLE ANALYTICS |
||||||
|
================================================== */ |
||||||
|
var _gaq = _gaq || []; |
||||||
|
|
||||||
|
|
||||||
|
(function() { |
||||||
|
var ga = document.createElement('script'), s = document.getElementsByTagName('script')[0]; |
||||||
|
ga.type = 'text/javascript'; |
||||||
|
ga.async = true; |
||||||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
||||||
|
s.parentNode.insertBefore(ga, s); |
||||||
|
|
||||||
|
_gaq.push(['_setAccount', embed_analytics]); |
||||||
|
_gaq.push(['_trackPageview']); |
||||||
|
|
||||||
|
})(); |
||||||
|
|
||||||
|
/* TIMELINE CDN SPECIFIC |
||||||
|
================================================== */ |
||||||
|
var getUrlVars = function() { |
||||||
|
var varobj = {}, url_vars = [], uv ; |
||||||
|
|
||||||
|
//url_vars = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||||
|
url_vars = window.location.href.slice(window.location.href.indexOf('?') + 1); |
||||||
|
|
||||||
|
if (url_vars.match('#')) { |
||||||
|
url_vars = url_vars.split('#')[0]; |
||||||
|
} |
||||||
|
url_vars = url_vars.split('&'); |
||||||
|
|
||||||
|
for(var i = 0; i < url_vars.length; i++) { |
||||||
|
uv = url_vars[i].split('='); |
||||||
|
varobj[uv[0]] = uv[1]; |
||||||
|
} |
||||||
|
|
||||||
|
return varobj; |
||||||
|
}; |
||||||
|
|
||||||
|
var onHeadline = function(e, headline) { |
||||||
|
var the_page_title = "/" + headline, |
||||||
|
the_page_url = location.href; |
||||||
|
|
||||||
|
document.title = headline; |
||||||
|
the_load_time = Math.floor((new Date().getTime() - load_time_start)/100)/10; |
||||||
|
_gaq.push(['_trackEvent', 'Timeline', headline, the_page_url, the_load_time]); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
var url_config = getUrlVars(); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************** |
||||||
|
Begin LazyLoad.js
|
||||||
|
***********************************************/ |
||||||
|
|
||||||
|
/*jslint browser: true, eqeqeq: true, bitwise: true, newcap: true, immed: true, regexp: false */ |
||||||
|
|
||||||
|
/** |
||||||
|
LazyLoad makes it easy and painless to lazily load one or more external |
||||||
|
JavaScript or CSS files on demand either during or after the rendering of a web |
||||||
|
page. |
||||||
|
|
||||||
|
Supported browsers include Firefox 2+, IE6+, Safari 3+ (including Mobile |
||||||
|
Safari), Google Chrome, and Opera 9+. Other browsers may or may not work and |
||||||
|
are not officially supported. |
||||||
|
|
||||||
|
Visit https://github.com/rgrove/lazyload/ for more info.
|
||||||
|
|
||||||
|
Copyright (c) 2011 Ryan Grove <ryan@wonko.com> |
||||||
|
All rights reserved. |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||||
|
this software and associated documentation files (the 'Software'), to deal in |
||||||
|
the Software without restriction, including without limitation the rights to |
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so, |
||||||
|
subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all |
||||||
|
copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||||
|
|
||||||
|
@module lazyload |
||||||
|
@class LazyLoad |
||||||
|
@static |
||||||
|
@version 2.0.3 (git) |
||||||
|
*/ |
||||||
|
|
||||||
|
LazyLoad = (function (doc) { |
||||||
|
// -- Private Variables ------------------------------------------------------
|
||||||
|
|
||||||
|
// User agent and feature test information.
|
||||||
|
var env, |
||||||
|
|
||||||
|
// Reference to the <head> element (populated lazily).
|
||||||
|
head, |
||||||
|
|
||||||
|
// Requests currently in progress, if any.
|
||||||
|
pending = {}, |
||||||
|
|
||||||
|
// Number of times we've polled to check whether a pending stylesheet has
|
||||||
|
// finished loading. If this gets too high, we're probably stalled.
|
||||||
|
pollCount = 0, |
||||||
|
|
||||||
|
// Queued requests.
|
||||||
|
queue = {css: [], js: []}, |
||||||
|
|
||||||
|
// Reference to the browser's list of stylesheets.
|
||||||
|
styleSheets = doc.styleSheets; |
||||||
|
|
||||||
|
// -- Private Methods --------------------------------------------------------
|
||||||
|
|
||||||
|
/** |
||||||
|
Creates and returns an HTML element with the specified name and attributes. |
||||||
|
|
||||||
|
@method createNode |
||||||
|
@param {String} name element name |
||||||
|
@param {Object} attrs name/value mapping of element attributes |
||||||
|
@return {HTMLElement} |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function createNode(name, attrs) { |
||||||
|
var node = doc.createElement(name), attr; |
||||||
|
|
||||||
|
for (attr in attrs) { |
||||||
|
if (attrs.hasOwnProperty(attr)) { |
||||||
|
node.setAttribute(attr, attrs[attr]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return node; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Called when the current pending resource of the specified type has finished |
||||||
|
loading. Executes the associated callback (if any) and loads the next |
||||||
|
resource in the queue. |
||||||
|
|
||||||
|
@method finish |
||||||
|
@param {String} type resource type ('css' or 'js') |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function finish(type) { |
||||||
|
var p = pending[type], |
||||||
|
callback, |
||||||
|
urls; |
||||||
|
|
||||||
|
if (p) { |
||||||
|
callback = p.callback; |
||||||
|
urls = p.urls; |
||||||
|
|
||||||
|
urls.shift(); |
||||||
|
pollCount = 0; |
||||||
|
|
||||||
|
// If this is the last of the pending URLs, execute the callback and
|
||||||
|
// start the next request in the queue (if any).
|
||||||
|
if (!urls.length) { |
||||||
|
callback && callback.call(p.context, p.obj); |
||||||
|
pending[type] = null; |
||||||
|
queue[type].length && load(type); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Populates the <code>env</code> variable with user agent and feature test |
||||||
|
information. |
||||||
|
|
||||||
|
@method getEnv |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function getEnv() { |
||||||
|
var ua = navigator.userAgent; |
||||||
|
|
||||||
|
env = { |
||||||
|
// True if this browser supports disabling async mode on dynamically
|
||||||
|
// created script nodes. See
|
||||||
|
// http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
|
||||||
|
async: doc.createElement('script').async === true |
||||||
|
}; |
||||||
|
|
||||||
|
(env.webkit = /AppleWebKit\//.test(ua)) |
||||||
|
|| (env.ie = /MSIE/.test(ua)) |
||||||
|
|| (env.opera = /Opera/.test(ua)) |
||||||
|
|| (env.gecko = /Gecko\//.test(ua)) |
||||||
|
|| (env.unknown = true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Loads the specified resources, or the next resource of the specified type |
||||||
|
in the queue if no resources are specified. If a resource of the specified |
||||||
|
type is already being loaded, the new request will be queued until the |
||||||
|
first request has been finished. |
||||||
|
|
||||||
|
When an array of resource URLs is specified, those URLs will be loaded in |
||||||
|
parallel if it is possible to do so while preserving execution order. All |
||||||
|
browsers support parallel loading of CSS, but only Firefox and Opera |
||||||
|
support parallel loading of scripts. In other browsers, scripts will be |
||||||
|
queued and loaded one at a time to ensure correct execution order. |
||||||
|
|
||||||
|
@method load |
||||||
|
@param {String} type resource type ('css' or 'js') |
||||||
|
@param {String|Array} urls (optional) URL or array of URLs to load |
||||||
|
@param {Function} callback (optional) callback function to execute when the |
||||||
|
resource is loaded |
||||||
|
@param {Object} obj (optional) object to pass to the callback function |
||||||
|
@param {Object} context (optional) if provided, the callback function will |
||||||
|
be executed in this object's context |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function load(type, urls, callback, obj, context) { |
||||||
|
var _finish = function () { finish(type); }, |
||||||
|
isCSS = type === 'css', |
||||||
|
nodes = [], |
||||||
|
i, len, node, p, pendingUrls, url; |
||||||
|
|
||||||
|
env || getEnv(); |
||||||
|
|
||||||
|
if (urls) { |
||||||
|
// If urls is a string, wrap it in an array. Otherwise assume it's an
|
||||||
|
// array and create a copy of it so modifications won't be made to the
|
||||||
|
// original.
|
||||||
|
urls = typeof urls === 'string' ? [urls] : urls.concat(); |
||||||
|
|
||||||
|
// Create a request object for each URL. If multiple URLs are specified,
|
||||||
|
// the callback will only be executed after all URLs have been loaded.
|
||||||
|
//
|
||||||
|
// Sadly, Firefox and Opera are the only browsers capable of loading
|
||||||
|
// scripts in parallel while preserving execution order. In all other
|
||||||
|
// browsers, scripts must be loaded sequentially.
|
||||||
|
//
|
||||||
|
// All browsers respect CSS specificity based on the order of the link
|
||||||
|
// elements in the DOM, regardless of the order in which the stylesheets
|
||||||
|
// are actually downloaded.
|
||||||
|
if (isCSS || env.async || env.gecko || env.opera) { |
||||||
|
// Load in parallel.
|
||||||
|
queue[type].push({ |
||||||
|
urls : urls, |
||||||
|
callback: callback, |
||||||
|
obj : obj, |
||||||
|
context : context |
||||||
|
}); |
||||||
|
} else { |
||||||
|
// Load sequentially.
|
||||||
|
for (i = 0, len = urls.length; i < len; ++i) { |
||||||
|
queue[type].push({ |
||||||
|
urls : [urls[i]], |
||||||
|
callback: i === len - 1 ? callback : null, // callback is only added to the last URL
|
||||||
|
obj : obj, |
||||||
|
context : context |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// If a previous load request of this type is currently in progress, we'll
|
||||||
|
// wait our turn. Otherwise, grab the next item in the queue.
|
||||||
|
if (pending[type] || !(p = pending[type] = queue[type].shift())) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
head || (head = doc.head || doc.getElementsByTagName('head')[0]); |
||||||
|
pendingUrls = p.urls; |
||||||
|
|
||||||
|
for (i = 0, len = pendingUrls.length; i < len; ++i) { |
||||||
|
url = pendingUrls[i]; |
||||||
|
|
||||||
|
if (isCSS) { |
||||||
|
node = env.gecko ? createNode('style') : createNode('link', { |
||||||
|
href: url, |
||||||
|
rel : 'stylesheet' |
||||||
|
}); |
||||||
|
} else { |
||||||
|
node = createNode('script', {src: url}); |
||||||
|
node.async = false; |
||||||
|
} |
||||||
|
|
||||||
|
node.className = 'lazyload'; |
||||||
|
node.setAttribute('charset', 'utf-8'); |
||||||
|
|
||||||
|
if (env.ie && !isCSS) { |
||||||
|
node.onreadystatechange = function () { |
||||||
|
if (/loaded|complete/.test(node.readyState)) { |
||||||
|
node.onreadystatechange = null; |
||||||
|
_finish(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} else if (isCSS && (env.gecko || env.webkit)) { |
||||||
|
// Gecko and WebKit don't support the onload event on link nodes.
|
||||||
|
if (env.webkit) { |
||||||
|
// In WebKit, we can poll for changes to document.styleSheets to
|
||||||
|
// figure out when stylesheets have loaded.
|
||||||
|
p.urls[i] = node.href; // resolve relative URLs (or polling won't work)
|
||||||
|
pollWebKit(); |
||||||
|
} else { |
||||||
|
// In Gecko, we can import the requested URL into a <style> node and
|
||||||
|
// poll for the existence of node.sheet.cssRules. Props to Zach
|
||||||
|
// Leatherman for calling my attention to this technique.
|
||||||
|
node.innerHTML = '@import "' + url + '";'; |
||||||
|
pollGecko(node); |
||||||
|
} |
||||||
|
} else { |
||||||
|
node.onload = node.onerror = _finish; |
||||||
|
} |
||||||
|
|
||||||
|
nodes.push(node); |
||||||
|
} |
||||||
|
|
||||||
|
for (i = 0, len = nodes.length; i < len; ++i) { |
||||||
|
head.appendChild(nodes[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Begins polling to determine when the specified stylesheet has finished loading |
||||||
|
in Gecko. Polling stops when all pending stylesheets have loaded or after 10 |
||||||
|
seconds (to prevent stalls). |
||||||
|
|
||||||
|
Thanks to Zach Leatherman for calling my attention to the @import-based |
||||||
|
cross-domain technique used here, and to Oleg Slobodskoi for an earlier |
||||||
|
same-domain implementation. See Zach's blog for more details: |
||||||
|
http://www.zachleat.com/web/2010/07/29/load-css-dynamically/
|
||||||
|
|
||||||
|
@method pollGecko |
||||||
|
@param {HTMLElement} node Style node to poll. |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function pollGecko(node) { |
||||||
|
var hasRules; |
||||||
|
|
||||||
|
try { |
||||||
|
// We don't really need to store this value or ever refer to it again, but
|
||||||
|
// if we don't store it, Closure Compiler assumes the code is useless and
|
||||||
|
// removes it.
|
||||||
|
hasRules = !!node.sheet.cssRules; |
||||||
|
} catch (ex) { |
||||||
|
// An exception means the stylesheet is still loading.
|
||||||
|
pollCount += 1; |
||||||
|
|
||||||
|
if (pollCount < 200) { |
||||||
|
setTimeout(function () { pollGecko(node); }, 50); |
||||||
|
} else { |
||||||
|
// We've been polling for 10 seconds and nothing's happened. Stop
|
||||||
|
// polling and finish the pending requests to avoid blocking further
|
||||||
|
// requests.
|
||||||
|
hasRules && finish('css'); |
||||||
|
} |
||||||
|
|
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
// If we get here, the stylesheet has loaded.
|
||||||
|
finish('css'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Begins polling to determine when pending stylesheets have finished loading |
||||||
|
in WebKit. Polling stops when all pending stylesheets have loaded or after 10 |
||||||
|
seconds (to prevent stalls). |
||||||
|
|
||||||
|
@method pollWebKit |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function pollWebKit() { |
||||||
|
var css = pending.css, i; |
||||||
|
|
||||||
|
if (css) { |
||||||
|
i = styleSheets.length; |
||||||
|
|
||||||
|
// Look for a stylesheet matching the pending URL.
|
||||||
|
while (--i >= 0) { |
||||||
|
if (styleSheets[i].href === css.urls[0]) { |
||||||
|
finish('css'); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
pollCount += 1; |
||||||
|
|
||||||
|
if (css) { |
||||||
|
if (pollCount < 200) { |
||||||
|
setTimeout(pollWebKit, 50); |
||||||
|
} else { |
||||||
|
// We've been polling for 10 seconds and nothing's happened, which may
|
||||||
|
// indicate that the stylesheet has been removed from the document
|
||||||
|
// before it had a chance to load. Stop polling and finish the pending
|
||||||
|
// request to prevent blocking further requests.
|
||||||
|
finish('css'); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
|
||||||
|
/** |
||||||
|
Requests the specified CSS URL or URLs and executes the specified |
||||||
|
callback (if any) when they have finished loading. If an array of URLs is |
||||||
|
specified, the stylesheets will be loaded in parallel and the callback |
||||||
|
will be executed after all stylesheets have finished loading. |
||||||
|
|
||||||
|
@method css |
||||||
|
@param {String|Array} urls CSS URL or array of CSS URLs to load |
||||||
|
@param {Function} callback (optional) callback function to execute when |
||||||
|
the specified stylesheets are loaded |
||||||
|
@param {Object} obj (optional) object to pass to the callback function |
||||||
|
@param {Object} context (optional) if provided, the callback function |
||||||
|
will be executed in this object's context |
||||||
|
@static |
||||||
|
*/ |
||||||
|
css: function (urls, callback, obj, context) { |
||||||
|
load('css', urls, callback, obj, context); |
||||||
|
}, |
||||||
|
|
||||||
|
/** |
||||||
|
Requests the specified JavaScript URL or URLs and executes the specified |
||||||
|
callback (if any) when they have finished loading. If an array of URLs is |
||||||
|
specified and the browser supports it, the scripts will be loaded in |
||||||
|
parallel and the callback will be executed after all scripts have |
||||||
|
finished loading. |
||||||
|
|
||||||
|
Currently, only Firefox and Opera support parallel loading of scripts while |
||||||
|
preserving execution order. In other browsers, scripts will be |
||||||
|
queued and loaded one at a time to ensure correct execution order. |
||||||
|
|
||||||
|
@method js |
||||||
|
@param {String|Array} urls JS URL or array of JS URLs to load |
||||||
|
@param {Function} callback (optional) callback function to execute when |
||||||
|
the specified scripts are loaded |
||||||
|
@param {Object} obj (optional) object to pass to the callback function |
||||||
|
@param {Object} context (optional) if provided, the callback function |
||||||
|
will be executed in this object's context |
||||||
|
@static |
||||||
|
*/ |
||||||
|
js: function (urls, callback, obj, context) { |
||||||
|
load('js', urls, callback, obj, context); |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
})(this.document); |
||||||
|
|
||||||
|
|
||||||
|
/*********************************************** |
||||||
|
Begin Embed.LoadLib.js
|
||||||
|
***********************************************/ |
||||||
|
|
||||||
|
/* |
||||||
|
LoadLib |
||||||
|
Designed and built by Zach Wise digitalartwork.net |
||||||
|
*/ |
||||||
|
|
||||||
|
/* * CodeKit Import |
||||||
|
* http://incident57.com/codekit/
|
||||||
|
================================================== */ |
||||||
|
// @codekit-prepend "../Library/LazyLoad.js";
|
||||||
|
|
||||||
|
LoadLib = (function (doc) { |
||||||
|
var loaded = []; |
||||||
|
|
||||||
|
function isLoaded(url) { |
||||||
|
|
||||||
|
var i = 0, |
||||||
|
has_loaded = false; |
||||||
|
|
||||||
|
for (i = 0; i < loaded; i++) { |
||||||
|
if (loaded[i] == url) { |
||||||
|
has_loaded = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (has_loaded) { |
||||||
|
return true; |
||||||
|
} else { |
||||||
|
loaded.push(url); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
|
||||||
|
css: function (urls, callback, obj, context) { |
||||||
|
if (!isLoaded(urls)) { |
||||||
|
LazyLoad.css(urls, callback, obj, context); |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
js: function (urls, callback, obj, context) { |
||||||
|
if (!isLoaded(urls)) { |
||||||
|
LazyLoad.js(urls, callback, obj, context); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
})(this.document); |
||||||
|
|
||||||
|
/*********************************************** |
||||||
|
Begin Embed.js
|
||||||
|
***********************************************/ |
||||||
|
|
||||||
|
/* |
||||||
|
VéritéCo StoryJS Embed Loader 1.1 |
||||||
|
Designed and built by Zach Wise digitalartwork.net |
||||||
|
Date: June 21, 2012 |
||||||
|
*/ |
||||||
|
|
||||||
|
/* CodeKit Import |
||||||
|
http://incident57.com/codekit/
|
||||||
|
================================================== */ |
||||||
|
// @codekit-prepend "Embed.LoadLib.js";
|
||||||
|
|
||||||
|
var WebFontConfig; |
||||||
|
|
||||||
|
if(typeof embed_path == 'undefined' || typeof embed_path == 'undefined') { |
||||||
|
// REPLACE WITH YOUR BASEPATH IF YOU WANT OTHERWISE IT WILL TRY AND FIGURE IT OUT
|
||||||
|
var embed_path = getScriptPath("storyjs-embed.js").split("js/")[0]; |
||||||
|
} |
||||||
|
|
||||||
|
function getScriptPath(scriptname) { |
||||||
|
var scriptTags = document.getElementsByTagName('script'), |
||||||
|
script_path = "", |
||||||
|
script_path_end = ""; |
||||||
|
for(var i = 0; i < scriptTags.length; i++) { |
||||||
|
if (scriptTags[i].src.match(scriptname)) { |
||||||
|
script_path = scriptTags[i].src; |
||||||
|
} |
||||||
|
} |
||||||
|
if (script_path != "") { |
||||||
|
script_path_end = "/" |
||||||
|
} |
||||||
|
return script_path.split('?')[0].split('/').slice(0, -1).join('/') + script_path_end; |
||||||
|
} |
||||||
|
|
||||||
|
/* CHECK TO SEE IF A CONFIG IS ALREADY DEFINED (FOR EASY EMBED) |
||||||
|
================================================== */ |
||||||
|
(function() { |
||||||
|
if (typeof url_config == 'object') { |
||||||
|
createStoryJS(url_config); |
||||||
|
} else if (typeof timeline_config == 'object') { |
||||||
|
createStoryJS(timeline_config); |
||||||
|
} else if (typeof storyjs_config == 'object') { |
||||||
|
createStoryJS(storyjs_config); |
||||||
|
} else if (typeof config == 'object') { |
||||||
|
createStoryJS(config); |
||||||
|
} else { |
||||||
|
// No existing config. Call createStoryJS(your_config) manually with a config
|
||||||
|
} |
||||||
|
})(); |
||||||
|
|
||||||
|
/* CREATE StoryJS Embed |
||||||
|
================================================== */ |
||||||
|
function createStoryJS(c, src) { |
||||||
|
/* VARS |
||||||
|
================================================== */ |
||||||
|
var storyjs_embedjs, t, te, x, |
||||||
|
isCDN = false, |
||||||
|
js_version = "1.71", |
||||||
|
jquery_version_required = "1.7.1", |
||||||
|
jquery_version = "", |
||||||
|
ready = { |
||||||
|
timeout: "", |
||||||
|
checks: 0, |
||||||
|
finished: false, |
||||||
|
js: false, |
||||||
|
css: false, |
||||||
|
jquery: false, |
||||||
|
has_jquery: false, |
||||||
|
language: false, |
||||||
|
font: { |
||||||
|
css: false, |
||||||
|
js: false |
||||||
|
} |
||||||
|
}, |
||||||
|
path = { |
||||||
|
base: embed_path, |
||||||
|
css: embed_path + "css/", |
||||||
|
js: embed_path + "js/", |
||||||
|
locale: embed_path + "js/locale/", |
||||||
|
jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", |
||||||
|
font: { |
||||||
|
google: false, |
||||||
|
css: embed_path + "css/themes/font/", |
||||||
|
js: "http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js" |
||||||
|
} |
||||||
|
}, |
||||||
|
storyjs_e_config = { |
||||||
|
version: js_version, |
||||||
|
debug: false, |
||||||
|
type: 'timeline', |
||||||
|
id: 'storyjs', |
||||||
|
embed_id: 'timeline-embed', |
||||||
|
embed: true, |
||||||
|
width: '100%', |
||||||
|
height: '650', |
||||||
|
source: 'https://docs.google.com/spreadsheet/pub?key=0Agl_Dv6iEbDadFYzRjJPUGktY0NkWXFUWkVIZDNGRHc&output=html', |
||||||
|
lang: 'en', |
||||||
|
font: 'default', |
||||||
|
css: path.css + 'timeline.css?'+js_version, |
||||||
|
js: path.js + 'timeline-min.js?'+js_version |
||||||
|
}, |
||||||
|
font_presets = [ |
||||||
|
{ name: "Merriweather-NewsCycle", google: [ 'News+Cycle:400,700:latin', 'Merriweather:400,700,900:latin' ] }, |
||||||
|
{ name: "PoiretOne-Molengo", google: [ 'Poiret+One::latin', 'Molengo::latin' ] }, |
||||||
|
{ name: "Arvo-PTSans", google: [ 'Arvo:400,700,400italic:latin', 'PT+Sans:400,700,400italic:latin' ] }, |
||||||
|
{ name: "PTSerif-PTSans", google: [ 'PT+Sans:400,700,400italic:latin', 'PT+Serif:400,700,400italic:latin' ] }, |
||||||
|
{ name: "PT", google: [ 'PT+Sans+Narrow:400,700:latin', 'PT+Sans:400,700,400italic:latin', 'PT+Serif:400,700,400italic:latin' ] }, |
||||||
|
{ name: "DroidSerif-DroidSans", google: [ 'Droid+Sans:400,700:latin', 'Droid+Serif:400,700,400italic:latin' ] }, |
||||||
|
{ name: "Lekton-Molengo", google: [ 'Lekton:400,700,400italic:latin', 'Molengo::latin' ] }, |
||||||
|
{ name: "NixieOne-Ledger", google: [ 'Nixie+One::latin', 'Ledger::latin' ] }, |
||||||
|
{ name: "AbrilFatface-Average", google: [ 'Average::latin', 'Abril+Fatface::latin' ] }, |
||||||
|
{ name: "PlayfairDisplay-Muli", google: [ 'Playfair+Display:400,400italic:latin', 'Muli:300,400,300italic,400italic:latin' ] }, |
||||||
|
{ name: "Rancho-Gudea", google: [ 'Rancho::latin', 'Gudea:400,700,400italic:latin' ] }, |
||||||
|
{ name: "Bevan-PotanoSans", google: [ 'Bevan::latin', 'Pontano+Sans::latin' ] }, |
||||||
|
{ name: "BreeSerif-OpenSans", google: [ 'Bree+Serif::latin', 'Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800:latin' ] }, |
||||||
|
{ name: "SansitaOne-Kameron", google: [ 'Sansita+One::latin', 'Kameron:400,700:latin' ] }, |
||||||
|
{ name: "Lora-Istok", google: [ 'Lora:400,700,400italic,700italic:latin', 'Istok+Web:400,700,400italic,700italic:latin' ] }, |
||||||
|
{ name: "Pacifico-Arimo", google: [ 'Pacifico::latin', 'Arimo:400,700,400italic,700italic:latin' ] } |
||||||
|
]; |
||||||
|
|
||||||
|
/* BUILD CONFIG |
||||||
|
================================================== */ |
||||||
|
if (typeof c == 'object') { |
||||||
|
for (x in c) { |
||||||
|
if (Object.prototype.hasOwnProperty.call(c, x)) { |
||||||
|
storyjs_e_config[x] = c[x]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (typeof src != 'undefined') { |
||||||
|
storyjs_e_config.source = src; |
||||||
|
} |
||||||
|
|
||||||
|
/* CDN VERSION? |
||||||
|
================================================== */ |
||||||
|
if (typeof url_config == 'object') { |
||||||
|
isCDN = true; |
||||||
|
|
||||||
|
/* IS THE SOURCE GOOGLE SPREADSHEET WITH JUST THE KEY? |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.source.match("docs.google.com") || storyjs_e_config.source.match("json") || storyjs_e_config.source.match("storify") ) { |
||||||
|
|
||||||
|
} else { |
||||||
|
storyjs_e_config.source = "https://docs.google.com/spreadsheet/pub?key=" + storyjs_e_config.source + "&output=html"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/* DETERMINE TYPE |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.js.match("/")) { |
||||||
|
|
||||||
|
} else { |
||||||
|
storyjs_e_config.css = path.css + storyjs_e_config.type + ".css?" + js_version; |
||||||
|
storyjs_e_config.js = path.js + storyjs_e_config.type + "-min.js?" + js_version; |
||||||
|
storyjs_e_config.id = "storyjs-" + storyjs_e_config.type; |
||||||
|
} |
||||||
|
|
||||||
|
// Check for old installs still using the old method of language
|
||||||
|
if (storyjs_e_config.js.match("locale")) { |
||||||
|
storyjs_e_config.lang = storyjs_e_config.js.split("locale/")[1].replace(".js", ""); |
||||||
|
storyjs_e_config.js = path.js + 'timeline-min.js?' + js_version; |
||||||
|
} |
||||||
|
|
||||||
|
/* PREPARE LANGUAGE |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.lang.match("/")) { |
||||||
|
path.locale = storyjs_e_config.lang; |
||||||
|
} else { |
||||||
|
path.locale = path.locale + storyjs_e_config.lang + ".js?" + js_version; |
||||||
|
} |
||||||
|
|
||||||
|
// Check for old installs still using the old method of language
|
||||||
|
if (storyjs_e_config.js.match("locale")) { |
||||||
|
storyjs_e_config.lang = storyjs_e_config.js.split("locale/")[1].replace(".js", ""); |
||||||
|
} |
||||||
|
|
||||||
|
/* PREPARE |
||||||
|
================================================== */ |
||||||
|
createEmbedDiv(); |
||||||
|
load_css(); |
||||||
|
|
||||||
|
/* Load CSS |
||||||
|
================================================== */ |
||||||
|
function load_css() { |
||||||
|
LoadLib.css(storyjs_e_config.css, onloaded_css); |
||||||
|
} |
||||||
|
|
||||||
|
/* Load CSS |
||||||
|
================================================== */ |
||||||
|
function load_js() { |
||||||
|
LoadLib.js(storyjs_e_config.js, onloaded_js); |
||||||
|
} |
||||||
|
|
||||||
|
/* Load FONT |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.font == "default") { |
||||||
|
ready.font.js = true; |
||||||
|
ready.font.css = true; |
||||||
|
} else { |
||||||
|
// FONT CSS
|
||||||
|
var fn; |
||||||
|
if (storyjs_e_config.font.match("/")) { |
||||||
|
fn = storyjs_e_config.font.split(".css")[0].split("/"); |
||||||
|
path.font.name = fn[fn.length -1]; |
||||||
|
path.font.css = storyjs_e_config.font; |
||||||
|
} else { |
||||||
|
path.font.name = storyjs_e_config.font; |
||||||
|
path.font.css = path.font.css + storyjs_e_config.font + ".css?" + js_version; |
||||||
|
} |
||||||
|
LoadLib.css(path.font.css, onloaded_font_css); |
||||||
|
|
||||||
|
// FONT GOOGLE JS
|
||||||
|
for(var i = 0; i < font_presets.length; i++) { |
||||||
|
if (path.font.name == font_presets[i].name) { |
||||||
|
path.font.google = true; |
||||||
|
WebFontConfig = {google: { families: font_presets[i].google }}; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (path.font.google) { |
||||||
|
LoadLib.js(path.font.js, onloaded_font_js); |
||||||
|
} else { |
||||||
|
ready.font.js = true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/* Load jQuery |
||||||
|
================================================== */ |
||||||
|
try { |
||||||
|
ready.has_jquery = jQuery; |
||||||
|
ready.has_jquery = true; |
||||||
|
if (ready.has_jquery) { |
||||||
|
var jquery_version = parseFloat(jQuery.fn.jquery); |
||||||
|
if (jquery_version < parseFloat(jquery_version_required) ) { |
||||||
|
//console.log("NOT THE REQUIRED VERSION OF JQUERY, LOADING THE REQUIRED VERSION");
|
||||||
|
//console.log("YOU HAVE VERSION " + jQuery.fn.jquery + ", JQUERY VERSION " + jquery_version_required + " OR ABOVE NEEDED");
|
||||||
|
ready.jquery = false; |
||||||
|
} else { |
||||||
|
ready.jquery = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} catch(err) { |
||||||
|
ready.jquery = false; |
||||||
|
} |
||||||
|
if (!ready.jquery) { |
||||||
|
LoadLib.js(path.jquery, onloaded_jquery); |
||||||
|
} else { |
||||||
|
onloaded_jquery(); |
||||||
|
} |
||||||
|
|
||||||
|
/* On Loaded |
||||||
|
================================================== */ |
||||||
|
|
||||||
|
function onloaded_jquery() { |
||||||
|
LoadLib.js(storyjs_e_config.js, onloaded_js); |
||||||
|
} |
||||||
|
function onloaded_js() { |
||||||
|
ready.js = true; |
||||||
|
if (storyjs_e_config.lang != "en") { |
||||||
|
load_js(); |
||||||
|
} else { |
||||||
|
ready.language = true; |
||||||
|
} |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_language() { |
||||||
|
ready.language = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_css() { |
||||||
|
ready.css = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_font_css() { |
||||||
|
ready.font.css = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_font_js() { |
||||||
|
ready.font.js = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_check() { |
||||||
|
if (ready.checks > 40) { |
||||||
|
return; |
||||||
|
alert("Error Loading Files"); |
||||||
|
} else { |
||||||
|
ready.checks++; |
||||||
|
if (ready.js && ready.css && ready.font.css && ready.font.js && ready.language) { |
||||||
|
if (!ready.finished) { |
||||||
|
ready.finished = true; |
||||||
|
buildEmbed(); |
||||||
|
} |
||||||
|
} else { |
||||||
|
ready.timeout = setTimeout('onloaded_check_again();', 250); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
this.onloaded_check_again = function() { |
||||||
|
onloaded_check(); |
||||||
|
}; |
||||||
|
|
||||||
|
/* Build Timeline |
||||||
|
================================================== */ |
||||||
|
function createEmbedDiv() { |
||||||
|
var embed_classname = "storyjs-embed"; |
||||||
|
|
||||||
|
t = document.createElement('div'); |
||||||
|
|
||||||
|
if (storyjs_e_config.embed_id != "") { |
||||||
|
te = document.getElementById(storyjs_e_config.embed_id); |
||||||
|
} else { |
||||||
|
te = document.getElementById("timeline-embed"); |
||||||
|
} |
||||||
|
|
||||||
|
te.appendChild(t); |
||||||
|
t.setAttribute("id", storyjs_e_config.id); |
||||||
|
|
||||||
|
if (storyjs_e_config.width.toString().match("%") ) { |
||||||
|
te.style.width = storyjs_e_config.width; |
||||||
|
embed_classname += " full-embed"; |
||||||
|
} else { |
||||||
|
embed_classname += " sized-embed"; |
||||||
|
storyjs_e_config.width = storyjs_e_config.width - 2; |
||||||
|
te.style.width = (storyjs_e_config.width) + 'px'; |
||||||
|
} |
||||||
|
|
||||||
|
te.setAttribute("class", embed_classname); |
||||||
|
te.setAttribute("className", embed_classname);
|
||||||
|
|
||||||
|
if (storyjs_e_config.height.toString().match("%") ) { |
||||||
|
te.style.height = storyjs_e_config.height; |
||||||
|
} else { |
||||||
|
storyjs_e_config.height = storyjs_e_config.height - 16; |
||||||
|
te.style.height = (storyjs_e_config.height) + 'px'; |
||||||
|
} |
||||||
|
|
||||||
|
t.style.position = 'relative'; |
||||||
|
} |
||||||
|
|
||||||
|
function buildEmbed() { |
||||||
|
VMM.debug = storyjs_e_config.debug; |
||||||
|
storyjs_embedjs = new VMM.Timeline(storyjs_e_config.id); |
||||||
|
storyjs_embedjs.init(storyjs_e_config); |
||||||
|
if (isCDN) { |
||||||
|
VMM.bindEvent(global, onHeadline, "HEADLINE"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
/* |
||||||
|
VéritéCo Embed Generator 0.8 |
||||||
|
Designed and built by Zach Wise digitalartwork.net |
||||||
|
Date: June 21, 2012 |
||||||
|
*/function getScriptPath(e){var t=document.getElementsByTagName("script"),n="";for(var r=0;r<t.length;r++)t[r].src.match(e)&&(n=t[r].src);return n.split("?")[0].split("/").slice(0,-1).join("/")+"/"}function getUrlVars(e){var t=[],n,r,i=e.toString();i.match("&")?i=i.replace("&","&"):i.match("&")?i=i.replace("&","&"):i.match("&")&&(i=i.replace("&","&"));i.match("#")&&(i=i.split("#")[0]);r=i.slice(i.indexOf("?")+1).split("&");for(var s=0;s<r.length;s++){n=r[s].split("=");t.push(n[0]);t[n[0]]=n[1]}return t}function getLinkAndIframe(){var e={},t=document.getElementById("embed-source-url"),n=document.getElementById("embed-width"),r=document.getElementById("embed-height"),i=document.getElementById("embed-maptype"),s=document.getElementById("embed-language"),o=document.getElementById("embed_code"),u=document.getElementById("embed-font"),a=document.getElementById("embed-wordpressplugin"),f=document.getElementById("embed-startatend"),l=document.getElementById("embed-hashbookmark"),c=document.getElementById("embed-startzoomadjust"),h=document.getElementById("embed-startatslide"),p=document.getElementById("embed-debug"),d=!1,v=!1,m=!1,g,y,b,w,E;t.value.match("docs.google.com")?E=getUrlVars(t.value).key:t.value==""?E="0Agl_Dv6iEbDadHdKcHlHcTB5bzhvbF9iTWwyMmJHdkE":E=t.value;f.checked&&(d=!0);l.checked&&(v=!0);p.checked&&(m=!0);w="[timeline ";n.value>0&&(w+="width='"+n.value+"' ");r.value>0&&(w+="height='"+n.value+"' ");w+="font='"+u.value+"' ";w+="maptype='"+i.value+"' ";w+="lang='"+s.value+"' ";w+="src='"+t.value+"' ";d&&(w+="start_at_end='"+d+"' ");v&&(w+="hash_bookmark='"+v+"' ");m&&(w+="debug='"+m+"' ");parseInt(h.value,10)>0&&(w+="start_at_slide='"+parseInt(h.value,10)+"' ");parseInt(c.value,10)>0&&(w+="start_zoom_adjust='"+parseInt(c.value,10)+"' ");w+="]";e.wordpress=w;b=embed_path+"?source="+E;b+="&font="+u.value;b+="&maptype="+i.value;b+="&lang="+s.value;d&&(b+="&start_at_end="+d);v&&(b+="&hash_bookmark="+v);m&&(b+="&debug="+m);parseInt(h.value,10)>0&&(b+="&start_at_slide="+parseInt(h.value,10));parseInt(c.value,10)>0&&(b+="&start_zoom_adjust="+parseInt(c.value,10));n.value>0&&(b+="&width="+n.value);r.value>0&&(b+="&height="+r.value);g="<iframe src='"+b+"'";n.value>0&&(g+=" width='"+n.value+"'");r.value>0&&(g+=" height='"+r.value+"'");g+=" frameborder='0'></iframe>";e.iframe=g;e.link=b;a.checked?e.copybox=w:e.copybox=g;return e}function updateEmbedCode(e,t){var n=document.getElementById("embed_code"),r=getLinkAndIframe();n.value=r.copybox;$("#preview-embed-link").attr("href",r.link);$("#preview-embed-iframe").html(r.iframe)}if(typeof embed_path=="undefined"||typeof embed_path=="undefined"){var embed_path=getScriptPath("timeline-embed-generator.js").split("js/")[0];embed_path.match("http")?embed_path=embed_path:embed_path=="/"?embed_path="index.html":embed_path+="index.html"}; |
@ -0,0 +1,802 @@ |
|||||||
|
/*jslint browser: true, eqeqeq: true, bitwise: true, newcap: true, immed: true, regexp: false */ |
||||||
|
|
||||||
|
/** |
||||||
|
LazyLoad makes it easy and painless to lazily load one or more external |
||||||
|
JavaScript or CSS files on demand either during or after the rendering of a web |
||||||
|
page. |
||||||
|
|
||||||
|
Supported browsers include Firefox 2+, IE6+, Safari 3+ (including Mobile |
||||||
|
Safari), Google Chrome, and Opera 9+. Other browsers may or may not work and |
||||||
|
are not officially supported. |
||||||
|
|
||||||
|
Visit https://github.com/rgrove/lazyload/ for more info.
|
||||||
|
|
||||||
|
Copyright (c) 2011 Ryan Grove <ryan@wonko.com> |
||||||
|
All rights reserved. |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||||
|
this software and associated documentation files (the 'Software'), to deal in |
||||||
|
the Software without restriction, including without limitation the rights to |
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so, |
||||||
|
subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all |
||||||
|
copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||||
|
|
||||||
|
@module lazyload |
||||||
|
@class LazyLoad |
||||||
|
@static |
||||||
|
@version 2.0.3 (git) |
||||||
|
*/ |
||||||
|
|
||||||
|
LazyLoad = (function (doc) { |
||||||
|
// -- Private Variables ------------------------------------------------------
|
||||||
|
|
||||||
|
// User agent and feature test information.
|
||||||
|
var env, |
||||||
|
|
||||||
|
// Reference to the <head> element (populated lazily).
|
||||||
|
head, |
||||||
|
|
||||||
|
// Requests currently in progress, if any.
|
||||||
|
pending = {}, |
||||||
|
|
||||||
|
// Number of times we've polled to check whether a pending stylesheet has
|
||||||
|
// finished loading. If this gets too high, we're probably stalled.
|
||||||
|
pollCount = 0, |
||||||
|
|
||||||
|
// Queued requests.
|
||||||
|
queue = {css: [], js: []}, |
||||||
|
|
||||||
|
// Reference to the browser's list of stylesheets.
|
||||||
|
styleSheets = doc.styleSheets; |
||||||
|
|
||||||
|
// -- Private Methods --------------------------------------------------------
|
||||||
|
|
||||||
|
/** |
||||||
|
Creates and returns an HTML element with the specified name and attributes. |
||||||
|
|
||||||
|
@method createNode |
||||||
|
@param {String} name element name |
||||||
|
@param {Object} attrs name/value mapping of element attributes |
||||||
|
@return {HTMLElement} |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function createNode(name, attrs) { |
||||||
|
var node = doc.createElement(name), attr; |
||||||
|
|
||||||
|
for (attr in attrs) { |
||||||
|
if (attrs.hasOwnProperty(attr)) { |
||||||
|
node.setAttribute(attr, attrs[attr]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return node; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Called when the current pending resource of the specified type has finished |
||||||
|
loading. Executes the associated callback (if any) and loads the next |
||||||
|
resource in the queue. |
||||||
|
|
||||||
|
@method finish |
||||||
|
@param {String} type resource type ('css' or 'js') |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function finish(type) { |
||||||
|
var p = pending[type], |
||||||
|
callback, |
||||||
|
urls; |
||||||
|
|
||||||
|
if (p) { |
||||||
|
callback = p.callback; |
||||||
|
urls = p.urls; |
||||||
|
|
||||||
|
urls.shift(); |
||||||
|
pollCount = 0; |
||||||
|
|
||||||
|
// If this is the last of the pending URLs, execute the callback and
|
||||||
|
// start the next request in the queue (if any).
|
||||||
|
if (!urls.length) { |
||||||
|
callback && callback.call(p.context, p.obj); |
||||||
|
pending[type] = null; |
||||||
|
queue[type].length && load(type); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Populates the <code>env</code> variable with user agent and feature test |
||||||
|
information. |
||||||
|
|
||||||
|
@method getEnv |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function getEnv() { |
||||||
|
var ua = navigator.userAgent; |
||||||
|
|
||||||
|
env = { |
||||||
|
// True if this browser supports disabling async mode on dynamically
|
||||||
|
// created script nodes. See
|
||||||
|
// http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
|
||||||
|
async: doc.createElement('script').async === true |
||||||
|
}; |
||||||
|
|
||||||
|
(env.webkit = /AppleWebKit\//.test(ua)) |
||||||
|
|| (env.ie = /MSIE/.test(ua)) |
||||||
|
|| (env.opera = /Opera/.test(ua)) |
||||||
|
|| (env.gecko = /Gecko\//.test(ua)) |
||||||
|
|| (env.unknown = true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Loads the specified resources, or the next resource of the specified type |
||||||
|
in the queue if no resources are specified. If a resource of the specified |
||||||
|
type is already being loaded, the new request will be queued until the |
||||||
|
first request has been finished. |
||||||
|
|
||||||
|
When an array of resource URLs is specified, those URLs will be loaded in |
||||||
|
parallel if it is possible to do so while preserving execution order. All |
||||||
|
browsers support parallel loading of CSS, but only Firefox and Opera |
||||||
|
support parallel loading of scripts. In other browsers, scripts will be |
||||||
|
queued and loaded one at a time to ensure correct execution order. |
||||||
|
|
||||||
|
@method load |
||||||
|
@param {String} type resource type ('css' or 'js') |
||||||
|
@param {String|Array} urls (optional) URL or array of URLs to load |
||||||
|
@param {Function} callback (optional) callback function to execute when the |
||||||
|
resource is loaded |
||||||
|
@param {Object} obj (optional) object to pass to the callback function |
||||||
|
@param {Object} context (optional) if provided, the callback function will |
||||||
|
be executed in this object's context |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function load(type, urls, callback, obj, context) { |
||||||
|
var _finish = function () { finish(type); }, |
||||||
|
isCSS = type === 'css', |
||||||
|
nodes = [], |
||||||
|
i, len, node, p, pendingUrls, url; |
||||||
|
|
||||||
|
env || getEnv(); |
||||||
|
|
||||||
|
if (urls) { |
||||||
|
// If urls is a string, wrap it in an array. Otherwise assume it's an
|
||||||
|
// array and create a copy of it so modifications won't be made to the
|
||||||
|
// original.
|
||||||
|
urls = typeof urls === 'string' ? [urls] : urls.concat(); |
||||||
|
|
||||||
|
// Create a request object for each URL. If multiple URLs are specified,
|
||||||
|
// the callback will only be executed after all URLs have been loaded.
|
||||||
|
//
|
||||||
|
// Sadly, Firefox and Opera are the only browsers capable of loading
|
||||||
|
// scripts in parallel while preserving execution order. In all other
|
||||||
|
// browsers, scripts must be loaded sequentially.
|
||||||
|
//
|
||||||
|
// All browsers respect CSS specificity based on the order of the link
|
||||||
|
// elements in the DOM, regardless of the order in which the stylesheets
|
||||||
|
// are actually downloaded.
|
||||||
|
if (isCSS || env.async || env.gecko || env.opera) { |
||||||
|
// Load in parallel.
|
||||||
|
queue[type].push({ |
||||||
|
urls : urls, |
||||||
|
callback: callback, |
||||||
|
obj : obj, |
||||||
|
context : context |
||||||
|
}); |
||||||
|
} else { |
||||||
|
// Load sequentially.
|
||||||
|
for (i = 0, len = urls.length; i < len; ++i) { |
||||||
|
queue[type].push({ |
||||||
|
urls : [urls[i]], |
||||||
|
callback: i === len - 1 ? callback : null, // callback is only added to the last URL
|
||||||
|
obj : obj, |
||||||
|
context : context |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// If a previous load request of this type is currently in progress, we'll
|
||||||
|
// wait our turn. Otherwise, grab the next item in the queue.
|
||||||
|
if (pending[type] || !(p = pending[type] = queue[type].shift())) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
head || (head = doc.head || doc.getElementsByTagName('head')[0]); |
||||||
|
pendingUrls = p.urls; |
||||||
|
|
||||||
|
for (i = 0, len = pendingUrls.length; i < len; ++i) { |
||||||
|
url = pendingUrls[i]; |
||||||
|
|
||||||
|
if (isCSS) { |
||||||
|
node = env.gecko ? createNode('style') : createNode('link', { |
||||||
|
href: url, |
||||||
|
rel : 'stylesheet' |
||||||
|
}); |
||||||
|
} else { |
||||||
|
node = createNode('script', {src: url}); |
||||||
|
node.async = false; |
||||||
|
} |
||||||
|
|
||||||
|
node.className = 'lazyload'; |
||||||
|
node.setAttribute('charset', 'utf-8'); |
||||||
|
|
||||||
|
if (env.ie && !isCSS) { |
||||||
|
node.onreadystatechange = function () { |
||||||
|
if (/loaded|complete/.test(node.readyState)) { |
||||||
|
node.onreadystatechange = null; |
||||||
|
_finish(); |
||||||
|
} |
||||||
|
}; |
||||||
|
} else if (isCSS && (env.gecko || env.webkit)) { |
||||||
|
// Gecko and WebKit don't support the onload event on link nodes.
|
||||||
|
if (env.webkit) { |
||||||
|
// In WebKit, we can poll for changes to document.styleSheets to
|
||||||
|
// figure out when stylesheets have loaded.
|
||||||
|
p.urls[i] = node.href; // resolve relative URLs (or polling won't work)
|
||||||
|
pollWebKit(); |
||||||
|
} else { |
||||||
|
// In Gecko, we can import the requested URL into a <style> node and
|
||||||
|
// poll for the existence of node.sheet.cssRules. Props to Zach
|
||||||
|
// Leatherman for calling my attention to this technique.
|
||||||
|
node.innerHTML = '@import "' + url + '";'; |
||||||
|
pollGecko(node); |
||||||
|
} |
||||||
|
} else { |
||||||
|
node.onload = node.onerror = _finish; |
||||||
|
} |
||||||
|
|
||||||
|
nodes.push(node); |
||||||
|
} |
||||||
|
|
||||||
|
for (i = 0, len = nodes.length; i < len; ++i) { |
||||||
|
head.appendChild(nodes[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Begins polling to determine when the specified stylesheet has finished loading |
||||||
|
in Gecko. Polling stops when all pending stylesheets have loaded or after 10 |
||||||
|
seconds (to prevent stalls). |
||||||
|
|
||||||
|
Thanks to Zach Leatherman for calling my attention to the @import-based |
||||||
|
cross-domain technique used here, and to Oleg Slobodskoi for an earlier |
||||||
|
same-domain implementation. See Zach's blog for more details: |
||||||
|
http://www.zachleat.com/web/2010/07/29/load-css-dynamically/
|
||||||
|
|
||||||
|
@method pollGecko |
||||||
|
@param {HTMLElement} node Style node to poll. |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function pollGecko(node) { |
||||||
|
var hasRules; |
||||||
|
|
||||||
|
try { |
||||||
|
// We don't really need to store this value or ever refer to it again, but
|
||||||
|
// if we don't store it, Closure Compiler assumes the code is useless and
|
||||||
|
// removes it.
|
||||||
|
hasRules = !!node.sheet.cssRules; |
||||||
|
} catch (ex) { |
||||||
|
// An exception means the stylesheet is still loading.
|
||||||
|
pollCount += 1; |
||||||
|
|
||||||
|
if (pollCount < 200) { |
||||||
|
setTimeout(function () { pollGecko(node); }, 50); |
||||||
|
} else { |
||||||
|
// We've been polling for 10 seconds and nothing's happened. Stop
|
||||||
|
// polling and finish the pending requests to avoid blocking further
|
||||||
|
// requests.
|
||||||
|
hasRules && finish('css'); |
||||||
|
} |
||||||
|
|
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
// If we get here, the stylesheet has loaded.
|
||||||
|
finish('css'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
Begins polling to determine when pending stylesheets have finished loading |
||||||
|
in WebKit. Polling stops when all pending stylesheets have loaded or after 10 |
||||||
|
seconds (to prevent stalls). |
||||||
|
|
||||||
|
@method pollWebKit |
||||||
|
@private |
||||||
|
*/ |
||||||
|
function pollWebKit() { |
||||||
|
var css = pending.css, i; |
||||||
|
|
||||||
|
if (css) { |
||||||
|
i = styleSheets.length; |
||||||
|
|
||||||
|
// Look for a stylesheet matching the pending URL.
|
||||||
|
while (--i >= 0) { |
||||||
|
if (styleSheets[i].href === css.urls[0]) { |
||||||
|
finish('css'); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
pollCount += 1; |
||||||
|
|
||||||
|
if (css) { |
||||||
|
if (pollCount < 200) { |
||||||
|
setTimeout(pollWebKit, 50); |
||||||
|
} else { |
||||||
|
// We've been polling for 10 seconds and nothing's happened, which may
|
||||||
|
// indicate that the stylesheet has been removed from the document
|
||||||
|
// before it had a chance to load. Stop polling and finish the pending
|
||||||
|
// request to prevent blocking further requests.
|
||||||
|
finish('css'); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
|
||||||
|
/** |
||||||
|
Requests the specified CSS URL or URLs and executes the specified |
||||||
|
callback (if any) when they have finished loading. If an array of URLs is |
||||||
|
specified, the stylesheets will be loaded in parallel and the callback |
||||||
|
will be executed after all stylesheets have finished loading. |
||||||
|
|
||||||
|
@method css |
||||||
|
@param {String|Array} urls CSS URL or array of CSS URLs to load |
||||||
|
@param {Function} callback (optional) callback function to execute when |
||||||
|
the specified stylesheets are loaded |
||||||
|
@param {Object} obj (optional) object to pass to the callback function |
||||||
|
@param {Object} context (optional) if provided, the callback function |
||||||
|
will be executed in this object's context |
||||||
|
@static |
||||||
|
*/ |
||||||
|
css: function (urls, callback, obj, context) { |
||||||
|
load('css', urls, callback, obj, context); |
||||||
|
}, |
||||||
|
|
||||||
|
/** |
||||||
|
Requests the specified JavaScript URL or URLs and executes the specified |
||||||
|
callback (if any) when they have finished loading. If an array of URLs is |
||||||
|
specified and the browser supports it, the scripts will be loaded in |
||||||
|
parallel and the callback will be executed after all scripts have |
||||||
|
finished loading. |
||||||
|
|
||||||
|
Currently, only Firefox and Opera support parallel loading of scripts while |
||||||
|
preserving execution order. In other browsers, scripts will be |
||||||
|
queued and loaded one at a time to ensure correct execution order. |
||||||
|
|
||||||
|
@method js |
||||||
|
@param {String|Array} urls JS URL or array of JS URLs to load |
||||||
|
@param {Function} callback (optional) callback function to execute when |
||||||
|
the specified scripts are loaded |
||||||
|
@param {Object} obj (optional) object to pass to the callback function |
||||||
|
@param {Object} context (optional) if provided, the callback function |
||||||
|
will be executed in this object's context |
||||||
|
@static |
||||||
|
*/ |
||||||
|
js: function (urls, callback, obj, context) { |
||||||
|
load('js', urls, callback, obj, context); |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
})(this.document); |
||||||
|
|
||||||
|
|
||||||
|
/*********************************************** |
||||||
|
Begin Embed.LoadLib.js
|
||||||
|
***********************************************/ |
||||||
|
|
||||||
|
/* |
||||||
|
LoadLib |
||||||
|
Designed and built by Zach Wise digitalartwork.net |
||||||
|
*/ |
||||||
|
|
||||||
|
/* * CodeKit Import |
||||||
|
* http://incident57.com/codekit/
|
||||||
|
================================================== */ |
||||||
|
// @codekit-prepend "../Library/LazyLoad.js";
|
||||||
|
|
||||||
|
LoadLib = (function (doc) { |
||||||
|
var loaded = []; |
||||||
|
|
||||||
|
function isLoaded(url) { |
||||||
|
|
||||||
|
var i = 0, |
||||||
|
has_loaded = false; |
||||||
|
|
||||||
|
for (i = 0; i < loaded; i++) { |
||||||
|
if (loaded[i] == url) { |
||||||
|
has_loaded = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (has_loaded) { |
||||||
|
return true; |
||||||
|
} else { |
||||||
|
loaded.push(url); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
|
||||||
|
css: function (urls, callback, obj, context) { |
||||||
|
if (!isLoaded(urls)) { |
||||||
|
LazyLoad.css(urls, callback, obj, context); |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
js: function (urls, callback, obj, context) { |
||||||
|
if (!isLoaded(urls)) { |
||||||
|
LazyLoad.js(urls, callback, obj, context); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
})(this.document); |
||||||
|
|
||||||
|
/*********************************************** |
||||||
|
Begin Embed.js
|
||||||
|
***********************************************/ |
||||||
|
|
||||||
|
/* |
||||||
|
VéritéCo StoryJS Embed Loader 1.1 |
||||||
|
Designed and built by Zach Wise digitalartwork.net |
||||||
|
Date: June 21, 2012 |
||||||
|
*/ |
||||||
|
|
||||||
|
/* CodeKit Import |
||||||
|
http://incident57.com/codekit/
|
||||||
|
================================================== */ |
||||||
|
// @codekit-prepend "Embed.LoadLib.js";
|
||||||
|
|
||||||
|
var WebFontConfig; |
||||||
|
|
||||||
|
if(typeof embed_path == 'undefined' || typeof embed_path == 'undefined') { |
||||||
|
// REPLACE WITH YOUR BASEPATH IF YOU WANT OTHERWISE IT WILL TRY AND FIGURE IT OUT
|
||||||
|
var embed_path = getScriptPath("storyjs-embed.js").split("js/")[0]; |
||||||
|
} |
||||||
|
|
||||||
|
function getScriptPath(scriptname) { |
||||||
|
var scriptTags = document.getElementsByTagName('script'), |
||||||
|
script_path = "", |
||||||
|
script_path_end = ""; |
||||||
|
for(var i = 0; i < scriptTags.length; i++) { |
||||||
|
if (scriptTags[i].src.match(scriptname)) { |
||||||
|
script_path = scriptTags[i].src; |
||||||
|
} |
||||||
|
} |
||||||
|
if (script_path != "") { |
||||||
|
script_path_end = "/" |
||||||
|
} |
||||||
|
return script_path.split('?')[0].split('/').slice(0, -1).join('/') + script_path_end; |
||||||
|
} |
||||||
|
|
||||||
|
/* CHECK TO SEE IF A CONFIG IS ALREADY DEFINED (FOR EASY EMBED) |
||||||
|
================================================== */ |
||||||
|
(function() { |
||||||
|
if (typeof url_config == 'object') { |
||||||
|
createStoryJS(url_config); |
||||||
|
} else if (typeof timeline_config == 'object') { |
||||||
|
createStoryJS(timeline_config); |
||||||
|
} else if (typeof storyjs_config == 'object') { |
||||||
|
createStoryJS(storyjs_config); |
||||||
|
} else if (typeof config == 'object') { |
||||||
|
createStoryJS(config); |
||||||
|
} else { |
||||||
|
// No existing config. Call createStoryJS(your_config) manually with a config
|
||||||
|
} |
||||||
|
})(); |
||||||
|
|
||||||
|
/* CREATE StoryJS Embed |
||||||
|
================================================== */ |
||||||
|
function createStoryJS(c, src) { |
||||||
|
/* VARS |
||||||
|
================================================== */ |
||||||
|
var storyjs_embedjs, t, te, x, |
||||||
|
isCDN = false, |
||||||
|
js_version = "1.71", |
||||||
|
jquery_version_required = "1.7.1", |
||||||
|
jquery_version = "", |
||||||
|
ready = { |
||||||
|
timeout: "", |
||||||
|
checks: 0, |
||||||
|
finished: false, |
||||||
|
js: false, |
||||||
|
css: false, |
||||||
|
jquery: false, |
||||||
|
has_jquery: false, |
||||||
|
language: false, |
||||||
|
font: { |
||||||
|
css: false, |
||||||
|
js: false |
||||||
|
} |
||||||
|
}, |
||||||
|
path = { |
||||||
|
base: embed_path, |
||||||
|
css: embed_path + "css/", |
||||||
|
js: embed_path + "js/", |
||||||
|
locale: embed_path + "js/locale/", |
||||||
|
jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", |
||||||
|
font: { |
||||||
|
google: false, |
||||||
|
css: embed_path + "css/themes/font/", |
||||||
|
js: "http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js" |
||||||
|
} |
||||||
|
}, |
||||||
|
storyjs_e_config = { |
||||||
|
version: js_version, |
||||||
|
debug: false, |
||||||
|
type: 'timeline', |
||||||
|
id: 'storyjs', |
||||||
|
embed_id: 'timeline-embed', |
||||||
|
embed: true, |
||||||
|
width: '100%', |
||||||
|
height: '650', |
||||||
|
source: 'https://docs.google.com/spreadsheet/pub?key=0Agl_Dv6iEbDadFYzRjJPUGktY0NkWXFUWkVIZDNGRHc&output=html', |
||||||
|
lang: 'en', |
||||||
|
font: 'default', |
||||||
|
css: path.css + 'timeline.css?'+js_version, |
||||||
|
js: path.js + 'timeline-min.js?'+js_version |
||||||
|
}, |
||||||
|
font_presets = [ |
||||||
|
{ name: "Merriweather-NewsCycle", google: [ 'News+Cycle:400,700:latin', 'Merriweather:400,700,900:latin' ] }, |
||||||
|
{ name: "PoiretOne-Molengo", google: [ 'Poiret+One::latin', 'Molengo::latin' ] }, |
||||||
|
{ name: "Arvo-PTSans", google: [ 'Arvo:400,700,400italic:latin', 'PT+Sans:400,700,400italic:latin' ] }, |
||||||
|
{ name: "PTSerif-PTSans", google: [ 'PT+Sans:400,700,400italic:latin', 'PT+Serif:400,700,400italic:latin' ] }, |
||||||
|
{ name: "PT", google: [ 'PT+Sans+Narrow:400,700:latin', 'PT+Sans:400,700,400italic:latin', 'PT+Serif:400,700,400italic:latin' ] }, |
||||||
|
{ name: "DroidSerif-DroidSans", google: [ 'Droid+Sans:400,700:latin', 'Droid+Serif:400,700,400italic:latin' ] }, |
||||||
|
{ name: "Lekton-Molengo", google: [ 'Lekton:400,700,400italic:latin', 'Molengo::latin' ] }, |
||||||
|
{ name: "NixieOne-Ledger", google: [ 'Nixie+One::latin', 'Ledger::latin' ] }, |
||||||
|
{ name: "AbrilFatface-Average", google: [ 'Average::latin', 'Abril+Fatface::latin' ] }, |
||||||
|
{ name: "PlayfairDisplay-Muli", google: [ 'Playfair+Display:400,400italic:latin', 'Muli:300,400,300italic,400italic:latin' ] }, |
||||||
|
{ name: "Rancho-Gudea", google: [ 'Rancho::latin', 'Gudea:400,700,400italic:latin' ] }, |
||||||
|
{ name: "Bevan-PotanoSans", google: [ 'Bevan::latin', 'Pontano+Sans::latin' ] }, |
||||||
|
{ name: "BreeSerif-OpenSans", google: [ 'Bree+Serif::latin', 'Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800:latin' ] }, |
||||||
|
{ name: "SansitaOne-Kameron", google: [ 'Sansita+One::latin', 'Kameron:400,700:latin' ] }, |
||||||
|
{ name: "Lora-Istok", google: [ 'Lora:400,700,400italic,700italic:latin', 'Istok+Web:400,700,400italic,700italic:latin' ] }, |
||||||
|
{ name: "Pacifico-Arimo", google: [ 'Pacifico::latin', 'Arimo:400,700,400italic,700italic:latin' ] } |
||||||
|
]; |
||||||
|
|
||||||
|
/* BUILD CONFIG |
||||||
|
================================================== */ |
||||||
|
if (typeof c == 'object') { |
||||||
|
for (x in c) { |
||||||
|
if (Object.prototype.hasOwnProperty.call(c, x)) { |
||||||
|
storyjs_e_config[x] = c[x]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (typeof src != 'undefined') { |
||||||
|
storyjs_e_config.source = src; |
||||||
|
} |
||||||
|
|
||||||
|
/* CDN VERSION? |
||||||
|
================================================== */ |
||||||
|
if (typeof url_config == 'object') { |
||||||
|
isCDN = true; |
||||||
|
|
||||||
|
/* IS THE SOURCE GOOGLE SPREADSHEET WITH JUST THE KEY? |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.source.match("docs.google.com") || storyjs_e_config.source.match("json") || storyjs_e_config.source.match("storify") ) { |
||||||
|
|
||||||
|
} else { |
||||||
|
storyjs_e_config.source = "https://docs.google.com/spreadsheet/pub?key=" + storyjs_e_config.source + "&output=html"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/* DETERMINE TYPE |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.js.match("/")) { |
||||||
|
|
||||||
|
} else { |
||||||
|
storyjs_e_config.css = path.css + storyjs_e_config.type + ".css?" + js_version; |
||||||
|
storyjs_e_config.js = path.js + storyjs_e_config.type + "-min.js?" + js_version; |
||||||
|
storyjs_e_config.id = "storyjs-" + storyjs_e_config.type; |
||||||
|
} |
||||||
|
|
||||||
|
// Check for old installs still using the old method of language
|
||||||
|
if (storyjs_e_config.js.match("locale")) { |
||||||
|
storyjs_e_config.lang = storyjs_e_config.js.split("locale/")[1].replace(".js", ""); |
||||||
|
storyjs_e_config.js = path.js + 'timeline-min.js?' + js_version; |
||||||
|
} |
||||||
|
|
||||||
|
/* PREPARE LANGUAGE |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.lang.match("/")) { |
||||||
|
path.locale = storyjs_e_config.lang; |
||||||
|
} else { |
||||||
|
path.locale = path.locale + storyjs_e_config.lang + ".js?" + js_version; |
||||||
|
} |
||||||
|
|
||||||
|
// Check for old installs still using the old method of language
|
||||||
|
if (storyjs_e_config.js.match("locale")) { |
||||||
|
storyjs_e_config.lang = storyjs_e_config.js.split("locale/")[1].replace(".js", ""); |
||||||
|
} |
||||||
|
|
||||||
|
/* PREPARE |
||||||
|
================================================== */ |
||||||
|
createEmbedDiv(); |
||||||
|
load_css(); |
||||||
|
|
||||||
|
/* Load CSS |
||||||
|
================================================== */ |
||||||
|
function load_css() { |
||||||
|
LoadLib.css(storyjs_e_config.css, onloaded_css); |
||||||
|
} |
||||||
|
|
||||||
|
/* Load CSS |
||||||
|
================================================== */ |
||||||
|
function load_js() { |
||||||
|
LoadLib.js(storyjs_e_config.js, onloaded_js); |
||||||
|
} |
||||||
|
|
||||||
|
/* Load FONT |
||||||
|
================================================== */ |
||||||
|
if (storyjs_e_config.font == "default") { |
||||||
|
ready.font.js = true; |
||||||
|
ready.font.css = true; |
||||||
|
} else { |
||||||
|
// FONT CSS
|
||||||
|
var fn; |
||||||
|
if (storyjs_e_config.font.match("/")) { |
||||||
|
fn = storyjs_e_config.font.split(".css")[0].split("/"); |
||||||
|
path.font.name = fn[fn.length -1]; |
||||||
|
path.font.css = storyjs_e_config.font; |
||||||
|
} else { |
||||||
|
path.font.name = storyjs_e_config.font; |
||||||
|
path.font.css = path.font.css + storyjs_e_config.font + ".css?" + js_version; |
||||||
|
} |
||||||
|
LoadLib.css(path.font.css, onloaded_font_css); |
||||||
|
|
||||||
|
// FONT GOOGLE JS
|
||||||
|
for(var i = 0; i < font_presets.length; i++) { |
||||||
|
if (path.font.name == font_presets[i].name) { |
||||||
|
path.font.google = true; |
||||||
|
WebFontConfig = {google: { families: font_presets[i].google }}; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (path.font.google) { |
||||||
|
LoadLib.js(path.font.js, onloaded_font_js); |
||||||
|
} else { |
||||||
|
ready.font.js = true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/* Load jQuery |
||||||
|
================================================== */ |
||||||
|
try { |
||||||
|
ready.has_jquery = jQuery; |
||||||
|
ready.has_jquery = true; |
||||||
|
if (ready.has_jquery) { |
||||||
|
var jquery_version = parseFloat(jQuery.fn.jquery); |
||||||
|
if (jquery_version < parseFloat(jquery_version_required) ) { |
||||||
|
//console.log("NOT THE REQUIRED VERSION OF JQUERY, LOADING THE REQUIRED VERSION");
|
||||||
|
//console.log("YOU HAVE VERSION " + jQuery.fn.jquery + ", JQUERY VERSION " + jquery_version_required + " OR ABOVE NEEDED");
|
||||||
|
ready.jquery = false; |
||||||
|
} else { |
||||||
|
ready.jquery = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} catch(err) { |
||||||
|
ready.jquery = false; |
||||||
|
} |
||||||
|
if (!ready.jquery) { |
||||||
|
LoadLib.js(path.jquery, onloaded_jquery); |
||||||
|
} else { |
||||||
|
onloaded_jquery(); |
||||||
|
} |
||||||
|
|
||||||
|
/* On Loaded |
||||||
|
================================================== */ |
||||||
|
|
||||||
|
function onloaded_jquery() { |
||||||
|
LoadLib.js(storyjs_e_config.js, onloaded_js); |
||||||
|
} |
||||||
|
function onloaded_js() { |
||||||
|
ready.js = true; |
||||||
|
if (storyjs_e_config.lang != "en") { |
||||||
|
load_js(); |
||||||
|
} else { |
||||||
|
ready.language = true; |
||||||
|
} |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_language() { |
||||||
|
ready.language = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_css() { |
||||||
|
ready.css = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_font_css() { |
||||||
|
ready.font.css = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_font_js() { |
||||||
|
ready.font.js = true; |
||||||
|
onloaded_check(); |
||||||
|
} |
||||||
|
function onloaded_check() { |
||||||
|
if (ready.checks > 40) { |
||||||
|
return; |
||||||
|
alert("Error Loading Files"); |
||||||
|
} else { |
||||||
|
ready.checks++; |
||||||
|
if (ready.js && ready.css && ready.font.css && ready.font.js && ready.language) { |
||||||
|
if (!ready.finished) { |
||||||
|
ready.finished = true; |
||||||
|
buildEmbed(); |
||||||
|
} |
||||||
|
} else { |
||||||
|
ready.timeout = setTimeout('onloaded_check_again();', 250); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
this.onloaded_check_again = function() { |
||||||
|
onloaded_check(); |
||||||
|
}; |
||||||
|
|
||||||
|
/* Build Timeline |
||||||
|
================================================== */ |
||||||
|
function createEmbedDiv() { |
||||||
|
var embed_classname = "storyjs-embed"; |
||||||
|
|
||||||
|
t = document.createElement('div'); |
||||||
|
|
||||||
|
if (storyjs_e_config.embed_id != "") { |
||||||
|
te = document.getElementById(storyjs_e_config.embed_id); |
||||||
|
} else { |
||||||
|
te = document.getElementById("timeline-embed"); |
||||||
|
} |
||||||
|
|
||||||
|
te.appendChild(t); |
||||||
|
t.setAttribute("id", storyjs_e_config.id); |
||||||
|
|
||||||
|
if (storyjs_e_config.width.toString().match("%") ) { |
||||||
|
te.style.width = storyjs_e_config.width; |
||||||
|
embed_classname += " full-embed"; |
||||||
|
} else { |
||||||
|
embed_classname += " sized-embed"; |
||||||
|
storyjs_e_config.width = storyjs_e_config.width - 2; |
||||||
|
te.style.width = (storyjs_e_config.width) + 'px'; |
||||||
|
} |
||||||
|
|
||||||
|
te.setAttribute("class", embed_classname); |
||||||
|
te.setAttribute("className", embed_classname);
|
||||||
|
|
||||||
|
if (storyjs_e_config.height.toString().match("%") ) { |
||||||
|
te.style.height = storyjs_e_config.height; |
||||||
|
} else { |
||||||
|
storyjs_e_config.height = storyjs_e_config.height - 16; |
||||||
|
te.style.height = (storyjs_e_config.height) + 'px'; |
||||||
|
} |
||||||
|
|
||||||
|
t.style.position = 'relative'; |
||||||
|
} |
||||||
|
|
||||||
|
function buildEmbed() { |
||||||
|
VMM.debug = storyjs_e_config.debug; |
||||||
|
storyjs_embedjs = new VMM.Timeline(storyjs_e_config.id); |
||||||
|
storyjs_embedjs.init(storyjs_e_config); |
||||||
|
if (isCDN) { |
||||||
|
VMM.bindEvent(global, onHeadline, "HEADLINE"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
|||||||
Subproject commit d660b08f11f8495531a1fb87ae6b340cfc551ee9 |
Subproject commit 36a2a055a1c93f8876e4faf8490e49339df73f66 |
Loading…
Reference in new issue