metamaps--metamaps/app/assets/javascripts/lib/embedly.js

2 lines
42 KiB
JavaScript
Raw Permalink Normal View History

!function(){var a=function b(c,d,e){function f(h,i){if(!d[h]){if(!c[h]){var j="function"==typeof a&&a;if(!i&&j)return j(h,!0);if(g)return g(h,!0);throw new Error("Cannot find module '"+h+"'")}var k=d[h]={exports:{}};c[h][0].call(k.exports,function(a){var b=c[h][1][a];return f(b?b:a)},k,k.exports,b,c,d,e)}return d[h].exports}for(var g="function"==typeof a&&a,h=0;h<e.length;h++)f(e[h]);return f}({1:[function(a,b){var c=a("./utils.js"),d=a("./browser.js"),e=function(){return this instanceof e?void this.init():new e};e.prototype.init=function(){this.data={}},e.prototype.add=function(a,b,c,d){c=c===!0?!0:!1;var e={func:b,one:c,ctx:d};return this.data.hasOwnProperty(a)?this.data[a].push(e):this.data[a]=[e],this},e.prototype.on=function(a,b,c){return this.add(a,b,!1,c)},e.prototype.off=function(a,b){if(!this.data.hasOwnProperty(a))return this;var d=c.reduce(this.data[a],function(a,d){return c.isNone(b)||d.func!==b?c.isNone(b)?a:(a.push(d),a):a},[]);return 0===d.length?delete this.data[a]:this.data[a]=d,this},e.prototype.one=function(a,b,c){return this.add(a,b,!0,c)},e.prototype.get=function(a,b,c,d){this.one(a+".response",c,d),this.notify(a,b)},e.prototype.notify=function(){var a=Array.prototype.slice.call(arguments,0);if(0===a.length)return this;var b=a.splice(0,1)[0];if(!this.data.hasOwnProperty(b))return this;var e,f=[],g=[];return c.each(this.data[b],function(a){g.push(a),a.one===!1&&f.push(a)}),0===f.length?delete this.data[b]:this.data[b]=f,c.each(g,function(f){try{e=c.isNone(f.ctx)?this:f.ctx,f.func.apply(e,a)}catch(g){d.console.error(b,a,g)}},this),this},b.exports=e},{"./browser.js":2,"./utils.js":15}],2:[function(a,b){var c=a("./utils.js"),d=a("./dom.js"),e=a("./urlparse.js"),f=a("conf"),g={};g.supports={_test:function(a){var b=["Webkit","Moz","O","ms","Khtml"],d=document.createElement("div"),e=a.charAt(0).toUpperCase()+a.substr(1),f=[a];c.each(b,function(a){f.push(a+e)});for(var g=0;g<f.length;g++)if(""===d.style[f[g]])return!0;return!1},postMessage:function(){return!!window.postMessage},boxShadow:function(){return g.supports._test("boxShadow")},borderRadius:function(){return g.supports._test("borderRadius")},touch:function(){return!!("ontouchstart"in window)},svg:function(){return!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect},mediaQuery:function(){return!("undefined"==typeof window.matchMedia&&"undefined"==typeof window.msMatchMedia)},rgba:function(){var a=document.createElement("div"),b=a.style.color;try{a.style.color="rgba(1,5,13,0.44)"}catch(c){}return a.style.color!==b},cors:function(){if("undefined"==typeof XMLHttpRequest)return!1;var a=new XMLHttpRequest;return"withCredentials"in a?!0:"undefined"!=typeof XDomainRequest?!0:!1},flash:function(){if("undefined"!=typeof navigator.plugins&&0!==navigator.plugins.length)return!!navigator.plugins["Shockwave Flash"];try{return!!new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(a){return!1}}},g.detect=function(){var a=function(a,b){b?d.addClass(document.body,a):d.addClass(document.body,"no-"+a)};a("touch",g.supports.touch()),a("boxshadow",g.supports.boxShadow()),a("borderradius",g.supports.borderRadius()),a("rgba",g.supports.rgba()),a("mediaquery",g.supports.mediaQuery())},g.console={_log:function(a,b){if(f.EMB_DEBUG&&!c.isNone(window.console)&&window.console)if(window.console[a].apply)window.console[a].apply(window.console,b);else{var d=Array.prototype.join.call(b,", ");window.console[a](d)}},log:function(){this._log("log",arguments)},error:function(){this._log("error",arguments)}},g.open=function(a,b,d,e,f,h){if(c.isNone(f)||c.isNone(h)){var i=g.window.center(d,e);f=i.top,h=i.left}var j=window.open(a,b,"scrollbars=no, resizable=1, width="+d+", height="+e+", top="+f+", left="+h);window.focus&&j.focus()},g.cookie={set:function(a,b,c,d){var e="";if(c){var f=new Date;f.setTime(f.getTime()+24*c*60*60*1e3),e="; expires="+f.toGMTString()}document.cookie=a+"="+b+e+"; path=/"+(d?"; secure":"")},get:function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "===e.charAt(0);)e=e.s
return null==a?e:Array.prototype.map&&a.map===Array.prototype.map?a.map(b,c):(d.each(a,function(a,d,f){e[e.length]=b.call(c,a,d,f)}),e)},d.reduce=function(a,b,c,e){var f=arguments.length>2;if(null==a&&(a=[]),l&&a.reduce===l)return e&&(b=d.bind(b,e)),f?a.reduce(b,c):a.reduce(b);if(d.each(a,function(a,d,g){f?c=b.call(e,c,a,d,g):(c=a,f=!0)}),!f)throw new TypeError("Reduce of empty array with no initial value");return c},d.zip=function(a){return d.map(a[0],function(b,c){return b.map(a,function(a){return a[c]})})},d.extend=function(a){return d.each(Array.prototype.slice.call(arguments,1),function(b){for(var c in b)void 0!==b[c]&&(a[c]=b[c])}),a},d.contains=function(a,b){if(!n){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return!0;return!1}return a.indexOf(b)>-1},d.every=function(a,b,c){b||(b=d.identity);var f=!0;return null==a?f:m&&a.every===m?a.every(b,c):(d.each(a,function(a,d,g){return(f=f&&b.call(c,a,d,g))?void 0:e}),!!f)},d.indexOf=function(a,b){if(null==a)return-1;var c=0,d=a.length;if(n&&a.indexOf===n)return a.indexOf(b);for(;d>c;c++)if(a[c]===b)return c;return-1};var p=function(){};d.bind=function(a,b){var c,e;if(o&&a.bind===o)return o.apply(a,i.call(arguments,1));if(!d.isFunction(a))throw new TypeError;return c=i.call(arguments,2),e=function(){if(!(this instanceof e))return a.apply(b,c.concat(i.call(arguments)));p.prototype=a.prototype;var d=new p;p.prototype=null;var f=a.apply(d,c.concat(i.call(arguments)));return Object(f)===f?f:d}},d.get=function(a,b,c){if(c=d.isNone(c)?null:c,d.isNone(b)||!d.isString(b)||!a)return c;if(""===b)return a;var e=b.split("."),f=e.splice(0,1)[0];return a.hasOwnProperty(f)?d.get(a[f],e.join("."),c):c},d.isFunction=function(a){try{return/^\s*\bfunction\b/.test(a)}catch(b){return!1}},d.isNone=function(a){return null===a||void 0===a},d.isString=function(a){return"[object String]"===j.call(a)},d.isNumber=function(a){return"[object Number]"===j.call(a)},d.isDate=function(a){return"[object Date]"===j.call(a)},d.isObject=function(a){return"[object Object]"===j.call(a)},d.isArray=function(a){return"[object Array]"===j.call(a)},d.isElement=function(a){return!d.isNone(a)&&!d.isNone(a.nodeType)&&1===a.nodeType},d.isEmptyObject=function(a){if(d.isObject(a)){for(var b in a)if(g.hasOwnProperty.call(a,b))return!1;return!0}return!1},d.bool=function(a){return d.isNone(a)?null:"true"===a||"1"===a||1===a||a===!0?!0:"false"===a||"0"===a||0===a||a===!1?!1:null},d.assert=function(a,b){if(!a)throw b||"Assertion Failed"},d.getUUID=function(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})},d.getTimestamp=function(){var a=new Date;return a.getTime()},d.trim=function(a){return a.replace(/^\s+|\s+$/g,"")},d.capitalize=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},d.camelCase=function(a){var b=a.split("-");return b.length>1&&(a=b[0],a+=d.map(b.slice(1),function(a){return a[0].toUpperCase()+a.substr(1)}).join("")),a},d.truncate=function(a,b){return a?(b=b?b:50,a.length<b?a:(a=a.substr(0,b-3),d.trim(a)+"...")):""},d.hash=function(a){for(var b=0,c=0,d=a.length;d>c;c++)b=31*b+a.charCodeAt(c)<<0;return(Math.pow(2,31)+b).toString()},d.rgbToHex=function(a,b,c){return"#"+((1<<24)+(a<<16)+(b<<8)+c).toString(16).slice(1)},c.EMB_DEBUG===!0&&(window._=d),b.exports=d},{conf:"AqyHQT"}],16:[function(a,b){var c=a("./utils.js"),d=a("./dom.js"),e=a("./browser.js"),f=function(){this.init()};f.prototype.init=function(){this._elements=[],this._listening=!1},f.prototype.viewable=function(a){if(!a.getBoundingClientRect)return!0;var b;try{b=a.getBoundingClientRect()}catch(c){return!1}return b.bottom>=0&&b.right>=0&&b.top<=(window.innerHeight||document.documentElement.clientHeight)&&b.left<=(window.innerWidth||document.documentElement.clientWidth)},f.prototype.check=function(){this.freeze=!0;var a=[];c.each(this._elements,c.bind(function(b,c){if(this.viewable(b.elem)){try{b.func.call(this)}catch(d){e.console.log(d)}a.push(c)}},this)),c.each(a,function(a){this._elements.splice(a,1)},this),0===this._elements.length&&this.stop(),this.freeze=!1},