You've reached the maximum number of tweets you can load in an hour.
";n+="You can view tweets again starting at:
"+t.reset_time+"
Still waiting on Twitter. "+e.mid+"
";VMM.attachElement("#"+e.id.toString(),VMM.MediaElement.loadingmessage(n))})},errorTimeOutOembed:function(e){trace("TWITTER JSON ERROR TIMEOUT "+e.mid);VMM.attachElement("#"+e.id.toString(),VMM.MediaElement.loadingmessage("Still waiting on Twitter: "+e.mid))},pushQue:function(){if(VMM.master_config.twitter.que.length>0){VMM.ExternalAPI.twitter.create(VMM.master_config.twitter.que[0],VMM.ExternalAPI.twitter.pushQue);VMM.master_config.twitter.que.remove(0)}},getOEmbed:function(e,t){var n="//api.twitter.com/1/statuses/oembed.json?id="+e.mid+"&omit_script=true&include_entities=true&callback=?",r=setTimeout(VMM.ExternalAPI.twitter.errorTimeOutOembed,VMM.master_config.timers.api,e);VMM.getJSON(n,function(t){var n="",r="";n+=t.html.split("—")[0]+"";r=t.author_url.split("twitter.com/")[1];n+="";VMM.attachElement("#"+e.id.toString(),n);VMM.attachElement("#text_thumb_"+e.id.toString(),t.html);VMM.attachElement("#marker_content_"+e.id.toString(),t.html)}).error(function(t,n,i){trace("TWITTER error");trace("TWITTER ERROR: "+n+" "+t.responseText);clearTimeout(r);VMM.attachElement("#"+e.id,VMM.MediaElement.loadingmessage("ERROR LOADING TWEET "+e.mid))}).success(function(e){clearTimeout(r);clearTimeout(callback_timeout);t()})},getHTML:function(e){var t="//api.twitter.com/1/statuses/oembed.json?id="+e+"&omit_script=true&include_entities=true&callback=?";VMM.getJSON(t,VMM.ExternalAPI.twitter.onJSONLoaded)},onJSONLoaded:function(e){trace("TWITTER JSON LOADED");var t=e.id;VMM.attachElement("#"+t,VMM.Util.linkify_with_twitter(e.html))},parseTwitterDate:function(e){var t=new Date(Date.parse(e));return t},prettyParseTwitterDate:function(e){var t=new Date(Date.parse(e));return VMM.Date.prettyDate(t,!0)},getTweets:function(e){var t=[],n=e.length;for(var r=0;r",s=VMM.Util.linkify_with_twitter(e.text,"_blank");i+=s;i+="
";i+="— "+e.user.name+" (@"+e.user.screen_name+") "+VMM.ExternalAPI.twitter.prettyParseTwitterDate(e.created_at)+"
";n.content=r;n.raw=e.results[t];i.push(n)}var o={tweetdata:i};VMM.fireEvent(global,"TWEETSLOADED",o)})},prettyHTML:function(e,t){var e=e.toString(),n={twitterid:e},r="//api.twitter.com/1/statuses/show.json?id="+e+"&include_entities=true&callback=?",i=setTimeout(VMM.ExternalAPI.twitter.errorTimeOut,VMM.master_config.timers.api,e);VMM.getJSON(r,VMM.ExternalAPI.twitter.formatJSON).error(function(t,n,r){trace("TWITTER error");trace("TWITTER ERROR: "+n+" "+t.responseText);VMM.attachElement("#twitter_"+e,"",s=VMM.Util.linkify_with_twitter(e.results[t].text,"_blank");r+=s;r+="
";r+="— "+e.results[t].from_user_name+" (@"+e.results[t].from_user+") "+VMM.ExternalAPI.twitter.prettyParseTwitterDate(e.results[t].created_at)+"
ERROR LOADING TWEET "+e+"
")}).success(function(e){clearTimeout(i);t&&VMM.ExternalAPI.twitter.secondaryMedia(e)})},formatJSON:function(e){var t=e.id_str,n="";n+="";typeof e.entities.media!="undefined"&&e.entities.media[0].type=="photo"&&(n+="",r=VMM.Util.linkify_with_twitter(e.text,"_blank");n+=r;n+="
"+t.object.attachments[r].content+"
";o+="";o+="ERROR LOADING GOOGLE+
"+i.error.message+"
"))}).success(function(e){clearTimeout(googleplus_timeout);clearTimeout(callback_timeout);t()})},pushQue:function(){if(VMM.master_config.googleplus.que.length>0){VMM.ExternalAPI.googleplus.create(VMM.master_config.googleplus.que[0],VMM.ExternalAPI.googleplus.pushQue);VMM.master_config.googleplus.que.remove(0)}},errorTimeOut:function(e){trace("GOOGLE+ JSON ERROR TIMEOUT "+e.activity);VMM.attachElement("#googleplus_"+e.activity,VMM.MediaElement.loadingmessage("Still waiting on GOOGLE+
"+e.activity+"
"))}},googledocs:{get:function(e){VMM.master_config.googledocs.que.push(e);VMM.master_config.googledocs.active=!0},create:function(e){var t="";e.id.match(/docs.google.com/i)?t="":t="";VMM.attachElement("#"+e.uid,t)},pushQue:function(){for(var e=0;eWikipedia entry unable to load using Internet Explorer 8 or below.
";VMM.attachElement("#"+e.uid,r)}VMM.getJSON(n,function(t){if(t.query){var n,r,i="",s="",o=1,u=[];n=VMM.Util.getObjectAttributeByIndex(t.query.pages,0).extract;r=VMM.Util.getObjectAttributeByIndex(t.query.pages,0).title;n.match("")?u=n.split("
"):u.push(n);for(var a=0;a Wikipedia is not responding "+o.data.text.replace(/<\s*\/?\s*b\s*.*?>/g,"")+""+r+"
";i+=""+VMM.master_config.language.messages.wikipedia+"";i+=VMM.Util.linkify_wikipedia(s);n.match("REDIRECT")||VMM.attachElement("#"+e.uid,i)}}).error(function(n,r,i){trace("WIKIPEDIA error");trace("WIKIPEDIA ERROR: "+r+" "+n.responseText);trace(i);VMM.attachElement("#"+e.uid,VMM.MediaElement.loadingmessage("")}},pushQue:function(){for(var e=0;e
")},pushQue:function(){if(VMM.master_config.vimeo.que.length>0){VMM.ExternalAPI.vimeo.create(VMM.master_config.vimeo.que[0],VMM.ExternalAPI.vimeo.pushQue);VMM.master_config.vimeo.que.remove(0)}}},vine:{get:function(e){VMM.master_config.vine.que.push(e);VMM.master_config.vine.active=!0},create:function(e,t){trace("VINE CREATE");var n="https://vine.co/v/"+e.id+"/embed/simple";VMM.attachElement("#"+e.uid,"")},pushQue:function(){if(VMM.master_config.vine.que.length>0){VMM.ExternalAPI.vine.create(VMM.master_config.vine.que[0],VMM.ExternalAPI.vine.pushQue);VMM.master_config.vine.que.remove(0)}}},webthumb:{get:function(e,t){VMM.master_config.webthumb.que.push(e);VMM.master_config.webthumb.active=!0},sizes:function(e){var t="";e<=150?t="t":e<=306?t="m":t="l";return t},create:function(e){trace("WEB THUMB CREATE");var t="//free.pagepeeker.com/v2/thumbs.php?";url=e.id.replace("http://","");VMM.attachElement("#"+e.uid,"
");VMM.attachElement("#"+e.uid+"_thumb","
")},pushQue:function(){for(var e=0;e
"+v+"
");else{VMM.appendElement(f,""+v+"
");VMM.appendElement(f,""+v+"
")}VMM.Lib.attr(u,"id",("marker_"+T[r].uniqueid).toString());VMM.bindEvent(a,Q,"",{number:r});VMM.bindEvent(a,G,"mouseenter mouseleave",{number:r,elem:a});d={marker:u,flag:a,lineevent:p,type:"marker",full:!0,relative_pos:_marker_relative_pos,tag:T[r].tag,pos_left:0};if(T[r].type=="start"){trace("BUILD MARKER HAS START PAGE");b.start_page=!0;d.type="start"}T[r].type=="storify"&&(d.type="storify");T[r].tag&&A.push(T[r].tag);C.push(d)}A=VMM.Util.deDupeArray(A);A.length>3?b.nav.rows.current=b.nav.rows.half:b.nav.rows.current=b.nav.rows.full;for(i=0;i"+A[i]+"
";n+="";n+=""+o.data.quote.text.replace(/<\s*\/?\s*b\s*.*?>/g,"")+"
"}}else if(o.type=="link"){f.headline=o.data.link.title;f.text=o.data.link.description;o.data.link.thumbnail!="undefined"&&o.data.link.thumbnail!=""?f.asset.media=o.data.link.thumbnail:f.asset.media=o.permalink;f.asset.caption=""+o.data.link.title+"";f.slug=o.data.link.title}else if(o.type=="text"){if(o.permalink.match("storify")){u=!0;var l=e.content.author.username,c="";if(typeof o.attribution.name!="undefined"){r=o.attribution.name;i=o.attribution.username+" "}var h="
";h+="";
+
+ // CREDIT
+ if (credit != null && credit != "") {
+ ce += VMM.createElement("div", credit, "credit");
+ }
+
+ // CAPTION
+ if (caption != null && caption != "") {
+ ce += VMM.createElement("div", caption, "caption");
+ }
+
+ }
+
+ ce += "
mmm d',' yyyy''"
+ },
+
+ month: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
+ month_abbr: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."],
+ day: ["Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
+ day_abbr: ["Sun.", "Mon.", "Tues.", "Wed.", "Thurs.", "Fri.", "Sat."],
+ hour: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
+ hour_suffix: ["am"],
+
+ //B.C.
+ bc_format: {
+ year: "yyyy",
+ month_short: "mmm",
+ month: "mmmm yyyy",
+ full_short: "mmm d",
+ full: "mmmm d',' yyyy",
+ time_no_seconds_short: "h:MM TT",
+ time_no_seconds_small_date: "dddd', 'h:MM TT'
'mmmm d',' yyyy''",
+ full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
+ full_long_small_date: "hh:MM TT'
'dddd',' mmm d',' yyyy''"
+ },
+
+ setLanguage: function(lang) {
+ trace("SET DATE LANGUAGE");
+ VMM.Date.dateformats = lang.dateformats;
+ VMM.Date.month = lang.date.month;
+ VMM.Date.month_abbr = lang.date.month_abbr;
+ VMM.Date.day = lang.date.day;
+ VMM.Date.day_abbr = lang.date.day_abbr;
+ dateFormat.i18n.dayNames = lang.date.day_abbr.concat(lang.date.day);
+ dateFormat.i18n.monthNames = lang.date.month_abbr.concat(lang.date.month);
+ },
+
+ parse: function(d, precision) {
+ "use strict";
+ var date,
+ date_array,
+ time_array,
+ time_parse,
+ p = {
+ year: false,
+ month: false,
+ day: false,
+ hour: false,
+ minute: false,
+ second: false,
+ millisecond: false
+ };
+
+ if (type.of(d) == "date") {
+ trace("DEBUG THIS, ITs A DATE");
+ date = d;
+ } else {
+ date = new Date(0, 0, 1, 0, 0, 0, 0);
+
+ if ( d.match(/,/gi) ) {
+ date_array = d.split(",");
+ for(var i = 0; i < date_array.length; i++) {
+ date_array[i] = parseInt(date_array[i], 10);
+ }
+ if (date_array[0]) {
+ date.setFullYear(date_array[0]);
+ p.year = true;
+ }
+ if (date_array[1]) {
+ date.setMonth(date_array[1] - 1);
+ p.month = true;
+ }
+ if (date_array[2]) {
+ date.setDate(date_array[2]);
+ p.day = true;
+ }
+ if (date_array[3]) {
+ date.setHours(date_array[3]);
+ p.hour = true;
+ }
+ if (date_array[4]) {
+ date.setMinutes(date_array[4]);
+ p.minute = true;
+ }
+ if (date_array[5]) {
+ date.setSeconds(date_array[5]);
+ if (date_array[5] >= 1) {
+ p.second = true;
+ }
+ }
+ if (date_array[6]) {
+ date.setMilliseconds(date_array[6]);
+ if (date_array[6] >= 1) {
+ p.millisecond = true;
+ }
+ }
+ } else if (d.match("/")) {
+ if (d.match(" ")) {
+
+ time_parse = d.split(" ");
+ if (d.match(":")) {
+ time_array = time_parse[1].split(":");
+ if (time_array[0] >= 0 ) {
+ date.setHours(time_array[0]);
+ p.hour = true;
+ }
+ if (time_array[1] >= 0) {
+ date.setMinutes(time_array[1]);
+ p.minute = true;
+ }
+ if (time_array[2] >= 0) {
+ date.setSeconds(time_array[2]);
+ p.second = true;
+ }
+ if (time_array[3] >= 0) {
+ date.setMilliseconds(time_array[3]);
+ p.millisecond = true;
+ }
+ }
+ date_array = time_parse[0].split("/");
+ } else {
+ date_array = d.split("/");
+ }
+ if (date_array[2]) {
+ date.setFullYear(date_array[2]);
+ p.year = true;
+ }
+ if (date_array[0] >= 0) {
+ date.setMonth(date_array[0] - 1);
+ p.month = true;
+ }
+ if (date_array[1] >= 0) {
+ if (date_array[1].length > 2) {
+ date.setFullYear(date_array[1]);
+ p.year = true;
+ } else {
+ date.setDate(date_array[1]);
+ p.day = true;
+ }
+ }
+ } else if (d.match("now")) {
+ var now = new Date();
+
+ date.setFullYear(now.getFullYear());
+ p.year = true;
+
+ date.setMonth(now.getMonth());
+ p.month = true;
+
+ date.setDate(now.getDate());
+ p.day = true;
+
+ if (d.match("hours")) {
+ date.setHours(now.getHours());
+ p.hour = true;
+ }
+ if (d.match("minutes")) {
+ date.setHours(now.getHours());
+ date.setMinutes(now.getMinutes());
+ p.hour = true;
+ p.minute = true;
+ }
+ if (d.match("seconds")) {
+ date.setHours(now.getHours());
+ date.setMinutes(now.getMinutes());
+ date.setSeconds(now.getSeconds());
+ p.hour = true;
+ p.minute = true;
+ p.second = true;
+ }
+ if (d.match("milliseconds")) {
+ date.setHours(now.getHours());
+ date.setMinutes(now.getMinutes());
+ date.setSeconds(now.getSeconds());
+ date.setMilliseconds(now.getMilliseconds());
+ p.hour = true;
+ p.minute = true;
+ p.second = true;
+ p.millisecond = true;
+ }
+ } else if (d.length <= 8) {
+ p.year = true;
+ date.setFullYear(parseInt(d, 10));
+ date.setMonth(0);
+ date.setDate(1);
+ date.setHours(0);
+ date.setMinutes(0);
+ date.setSeconds(0);
+ date.setMilliseconds(0);
+ } else if (d.match("T")) {
+ if (navigator.userAgent.match(/MSIE\s(?!9.0)/)) {
+ // IE 8 < Won't accept dates with a "-" in them.
+ time_parse = d.split("T");
+ if (d.match(":")) {
+ time_array = time_parse[1].split(":");
+ if (time_array[0] >= 1) {
+ date.setHours(time_array[0]);
+ p.hour = true;
+ }
+ if (time_array[1] >= 1) {
+ date.setMinutes(time_array[1]);
+ p.minute = true;
+ }
+ if (time_array[2] >= 1) {
+ date.setSeconds(time_array[2]);
+ if (time_array[2] >= 1) {
+ p.second = true;
+ }
+ }
+ if (time_array[3] >= 1) {
+ date.setMilliseconds(time_array[3]);
+ if (time_array[3] >= 1) {
+ p.millisecond = true;
+ }
+ }
+ }
+ date_array = time_parse[0].split("-");
+ if (date_array[0]) {
+ date.setFullYear(date_array[0]);
+ p.year = true;
+ }
+ if (date_array[1] >= 0) {
+ date.setMonth(date_array[1] - 1);
+ p.month = true;
+ }
+ if (date_array[2] >= 0) {
+ date.setDate(date_array[2]);
+ p.day = true;
+ }
+
+ } else {
+ date = new Date(Date.parse(d));
+ p.year = true;
+ p.month = true;
+ p.day = true;
+ p.hour = true;
+ p.minute = true;
+ if (date.getSeconds() >= 1) {
+ p.second = true;
+ }
+ if (date.getMilliseconds() >= 1) {
+ p.millisecond = true;
+ }
+ }
+ } else {
+ date = new Date(
+ parseInt(d.slice(0,4), 10),
+ parseInt(d.slice(4,6), 10) - 1,
+ parseInt(d.slice(6,8), 10),
+ parseInt(d.slice(8,10), 10),
+ parseInt(d.slice(10,12), 10)
+ );
+ p.year = true;
+ p.month = true;
+ p.day = true;
+ p.hour = true;
+ p.minute = true;
+ if (date.getSeconds() >= 1) {
+ p.second = true;
+ }
+ if (date.getMilliseconds() >= 1) {
+ p.millisecond = true;
+ }
+
+ }
+
+ }
+
+ if (precision != null && precision != "") {
+ return {
+ date: date,
+ precision: p
+ };
+ } else {
+ return date;
+ }
+ },
+
+
+
+ prettyDate: function(d, is_abbr, p, d2) {
+ var _date,
+ _date2,
+ format,
+ bc_check,
+ is_pair = false,
+ bc_original,
+ bc_number,
+ bc_string;
+
+ if (d2 != null && d2 != "" && typeof d2 != 'undefined') {
+ is_pair = true;
+ trace("D2 " + d2);
+ }
+
+
+ if (type.of(d) == "date") {
+
+ if (type.of(p) == "object") {
+ if (p.millisecond || p.second && d.getSeconds() >= 1) {
+ // YEAR MONTH DAY HOUR MINUTE
+ if (is_abbr){
+ format = VMM.Date.dateformats.time_short;
+ } else {
+ format = VMM.Date.dateformats.time_short;
+ }
+ } else if (p.minute) {
+ // YEAR MONTH DAY HOUR MINUTE
+ if (is_abbr){
+ format = VMM.Date.dateformats.time_no_seconds_short;
+ } else {
+ format = VMM.Date.dateformats.time_no_seconds_small_date;
+ }
+ } else if (p.hour) {
+ // YEAR MONTH DAY HOUR
+ if (is_abbr) {
+ format = VMM.Date.dateformats.time_no_seconds_short;
+ } else {
+ format = VMM.Date.dateformats.time_no_seconds_small_date;
+ }
+ } else if (p.day) {
+ // YEAR MONTH DAY
+ if (is_abbr) {
+ format = VMM.Date.dateformats.full_short;
+ } else {
+ format = VMM.Date.dateformats.full;
+ }
+ } else if (p.month) {
+ // YEAR MONTH
+ if (is_abbr) {
+ format = VMM.Date.dateformats.month_short;
+ } else {
+ format = VMM.Date.dateformats.month;
+ }
+ } else if (p.year) {
+ format = VMM.Date.dateformats.year;
+ } else {
+ format = VMM.Date.dateformats.year;
+ }
+
+ } else {
+
+ if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
+ // YEAR ONLY
+ format = VMM.Date.dateformats.year;
+ } else if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
+ // YEAR MONTH
+ if (is_abbr) {
+ format = VMM.Date.dateformats.month_short;
+ } else {
+ format = VMM.Date.dateformats.month;
+ }
+ } else if (d.getHours() === 0 && d.getMinutes() === 0) {
+ // YEAR MONTH DAY
+ if (is_abbr) {
+ format = VMM.Date.dateformats.full_short;
+ } else {
+ format = VMM.Date.dateformats.full;
+ }
+ } else if (d.getMinutes() === 0) {
+ // YEAR MONTH DAY HOUR
+ if (is_abbr) {
+ format = VMM.Date.dateformats.time_no_seconds_short;
+ } else {
+ format = VMM.Date.dateformats.time_no_seconds_small_date;
+ }
+ } else {
+ // YEAR MONTH DAY HOUR MINUTE
+ if (is_abbr){
+ format = VMM.Date.dateformats.time_no_seconds_short;
+ } else {
+ format = VMM.Date.dateformats.full_long;
+ }
+ }
+ }
+
+ _date = dateFormat(d, format, false);
+ //_date = "Jan"
+ bc_check = _date.split(" ");
+
+ // BC TIME SUPPORT
+ for(var i = 0; i < bc_check.length; i++) {
+ if ( parseInt(bc_check[i], 10) < 0 ) {
+ trace("YEAR IS BC");
+ bc_original = bc_check[i];
+ bc_number = Math.abs( parseInt(bc_check[i], 10) );
+ bc_string = bc_number.toString() + " B.C.";
+ _date = _date.replace(bc_original, bc_string);
+ }
+ }
+
+
+ if (is_pair) {
+ _date2 = dateFormat(d2, format, false);
+ bc_check = _date2.split(" ");
+ // BC TIME SUPPORT
+ for(var j = 0; j < bc_check.length; j++) {
+ if ( parseInt(bc_check[j], 10) < 0 ) {
+ trace("YEAR IS BC");
+ bc_original = bc_check[j];
+ bc_number = Math.abs( parseInt(bc_check[j], 10) );
+ bc_string = bc_number.toString() + " B.C.";
+ _date2 = _date2.replace(bc_original, bc_string);
+ }
+ }
+
+ }
+ } else {
+ trace("NOT A VALID DATE?");
+ trace(d);
+ }
+
+ if (is_pair) {
+ return _date + " — " + _date2;
+ } else {
+ return _date;
+ }
+ }
+
+ }).init();
+
+ /*
+ * Date Format 1.2.3
+ * (c) 2007-2009 Steven Levithan
");
+ },
+
+ /* * Generate a Unique ID
+ ================================================== */
+ // VMM.Util.unique_ID(size);
+ unique_ID: function(size) {
+
+ var getRandomNumber = function(range) {
+ return Math.floor(Math.random() * range);
+ };
+
+ var getRandomChar = function() {
+ var chars = "abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ";
+ return chars.substr( getRandomNumber(62), 1 );
+ };
+
+ var randomID = function(size) {
+ var str = "";
+ for(var i = 0; i < size; i++) {
+ str += getRandomChar();
+ }
+ return str;
+ };
+
+ return randomID(size);
+ },
+ /* * Tells you if a number is even or not
+ ================================================== */
+ // VMM.Util.isEven(n)
+ isEven: function(n){
+ return (n%2 === 0) ? true : false;
+ },
+ /* * Get URL Variables
+ ================================================== */
+ // var somestring = VMM.Util.getUrlVars(str_url)["varname"];
+ getUrlVars: function(string) {
+
+ var str = string.toString();
+
+ if (str.match('&')) {
+ str = str.replace("&", "&");
+ } else if (str.match('&')) {
+ str = str.replace("&", "&");
+ } else if (str.match('&')) {
+ str = str.replace("&", "&");
+ }
+
+ var vars = [], hash;
+ var hashes = str.slice(str.indexOf('?') + 1).split('&');
+ for(var i = 0; i < hashes.length; i++) {
+ hash = hashes[i].split('=');
+ vars.push(hash[0]);
+ vars[hash[0]] = hash[1];
+ }
+
+
+ return vars;
+ },
+
+ /* * Cleans up strings to become real HTML
+ ================================================== */
+ toHTML: function(text) {
+
+ text = this.nl2br(text);
+ text = this.linkify(text);
+
+ return text.replace(/\s\s/g," ");
+ },
+
+ /* * Returns text strings as CamelCase
+ ================================================== */
+ toCamelCase: function(s,forceLowerCase) {
+
+ if(forceLowerCase !== false) forceLowerCase = true;
+
+ var sps = ((forceLowerCase) ? s.toLowerCase() : s).split(" ");
+
+ for(var i=0; ienv 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