metamaps--metamaps/public/lib/embedly.js

3 lines
57 KiB
JavaScript
Raw Permalink Normal View History

2015-08-03 18:02:30 +00:00
!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}({conf:[function(a,b,c){b.exports=a("d0R7L1")},{}],d0R7L1:[function(a,b,c){!function(a){a.EMB_DEBUG=!1,a.EMB_HTTPS="https:"===window.location.protocol?!0:!1,a.EMB_ORIGIN=(a.EMB_HTTPS?"https":"http")+"://cdn.embedly.com",a.EMB_ORIGIN_BASE=a.EMB_ORIGIN+"/",a.EMB_ASSET_VERSION="e49c63a5",a.EMB_FRAME_SRC=a.EMB_ORIGIN+"/widgets/",a.EMB_SECURE_FRAME_SRC="https://cdn.embedly.com/widgets/",a.EMB_POST_MESSAGE=!!window.postMessage,a.EMB_PROGRESS=!0,a.EMB_APP_API="https://app.embed.ly",a.EMB_API_KEY="fd92ebbc52fc43fb98f69e50e7893c13";var b=window.location.pathname.split(".")[0].split("/");a.EMB_GROUP=b[b.length-1].toLowerCase(),a.PAGE_PROGRESS_DOMAINS=[]}("undefined"==typeof b?this.conf={}:b.exports)},{}],3:[function(a,b,c){var d=a("./utils.js"),e=a("./browser.js"),f=function(){return this instanceof f?void this.init():new f};f.prototype.init=function(){this.data={},this.dead=!1},f.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},f.prototype.on=function(a,b,c){return this.add(a,b,!1,c)},f.prototype.off=function(a,b){if(!this.data.hasOwnProperty(a))return this;var c=d.reduce(this.data[a],function(a,c){return d.isNone(b)||c.func!==b?d.isNone(b)?a:(a.push(c),a):a},[]);return 0===c.length?delete this.data[a]:this.data[a]=c,this},f.prototype.one=function(a,b,c){return this.add(a,b,!0,c)},f.prototype.get=function(a,b,c,d){this.one(a+".response",c,d),this.notify(a,b)},f.prototype.notify=function(){if(this.dead)return!1;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 c,f=[],g=[];return d.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,d.each(g,function(f){try{c=d.isNone(f.ctx)?this:f.ctx,f.func.apply(c,a)}catch(g){e.console.error(b,a,g)}},this),this},f.prototype.clear=function(){this.dead=!0,this.data={}},b.exports=f},{"./browser.js":5,"./utils.js":27}],4:[function(a,b,c){var d=a("./utils.js"),e=a("./browser.js"),f=a("conf"),g={};g.random=function(a){return Math.floor(Math.random()*a)},g.safeCreateQuery=function(a){var b=d.map(a,function(a,b){return b+"="+("urls"===b?a:encodeURIComponent(a))});return b.sort(),b.join("&")},g.Keeper=function(a,b){this.init(a,b)},g.Keeper.prototype={init:function(a,b){this.urls=a,this.count=0,this.results={},this.callback=b},each:function(a){if(this.results[a.original_url]=a,this.count++,this.count===this.urls.length){var b=d.map(this.urls,function(a){return this.results[a]},this);this.callback(b)}return this}},g.ajax=function(a,b,c){var d=new XMLHttpRequest;if("withCredentials"in d)d.open("GET",a,!0),c===!0&&(d.withCredentials=!0),d.setRequestHeader("Accept","application/json"),d.onreadystatechange=function(){4===d.readyState&&(200===d.status?b&&b(JSON.parse(d.responseText)):b&&b({type:"error"}))};else{if("undefined"==typeof XDomainRequest)return b({type:"error"}),!1;d=new XDomainRequest,d.open("GET",a),d.onload=function(){b&&b(JSON.parse(d.responseText))},d.onerror=function(){b({type:"error"})},d.onprogress=function(){}}d.send(null)},g.API=function(a){this.init(a)},g.API.prototype.init=function(a){d.isString(a)?this.key=a:d.isNone(a)||(this.key=a.key),this.key=this.key?this.key:f.EMB_API_KEY,this.protocol="https:"===window.location.protocol?"https:":"http:"},g.API.prototype._buildUrl=function(a,b){if(d.isNone(this.key))return null;var c=this.protocol+"//api-cdn.embed.ly/"+a;return b=b?b:{},b.key=this.key,c+"?"+g.safeCreateQuery(b)},g.API.prototype._data=function(a,b,c,f){if(e.console.log(a,b,c,f),d.isNone(f)&&d.isFunction(c)&&(f=c,c={}),d.isNone(f))return!1;
}),k},b.exports=j},{"../api.js":4,"../dom.js":7,"../keeper.js":16,"../tunnels.js":25,"../utils.js":27,"./base.js":10}],16:[function(a,b,c){var d=a("./utils.js"),e=function(){this.init()};e.prototype.init=function(){this.len=0,this.count=0,this.results={},this.finished=!1,this.started=!1},e.prototype.callback=function(){var a=this.len;return this.len++,d.bind(function(b){this.each(a,b)},this)},e.prototype.done=function(){if(!this.started)return!1;if(this.finished)return!0;if(this.count===this.len){this.finished=!0;for(var a=[],b=0;b<this.len;b++)a.push(this.results[b]);return this.func.call(this.ctx,a),!0}},e.prototype.each=function(a,b){this.results[a]=b,this.count++,this.done()},e.prototype.wait=function(a,b){this.func=a,this.ctx=b?b:null,this.started=!0,this.done()},b.exports=e},{"./utils.js":27}],17:[function(a,b,c){var d=a("../utils.js"),e=a("../urlparse.js"),f=a("../browser.js"),g=a("../comms.js"),h={hub:null,timeout:null,connected:!1,connecting:!1,COOKIE_NAME:"em_cdn_uid",sid:d.getUUID(),_queue:[]};h.getUID=function(){var a=f.cookie.get(h.COOKIE_NAME);if(d.isNone(a))return h.setUID();var b=e.parseQuery(decodeURIComponent(a));if(!b.u||!b.t)return h.setUID();var c;try{c=parseInt(b.t,10)}catch(g){return h.setUID()}return 32!==b.u.length?h.setUID():d.getTimestamp()-c>15552e6?h.setUID(b.u):b.u},h.setUID=function(a){var b={u:d.isNone(a)?d.getUUID():a,t:d.getTimestamp()},c=encodeURIComponent(e.createQuery(b));return f.cookie.set(h.COOKIE_NAME,c,365),c=f.cookie.get(h.COOKIE_NAME),d.isNone(c)?0:(b=e.parseQuery(decodeURIComponent(c)),b.u)},h.uid=h.getUID(),h.release=function(){var a=h._queue;h._queue=[],f.console.log("log.release",a),h.hub.notify("xcomm.log.event",{events:a})},h.queue=function(a){clearTimeout(h.timeout),h._queue.push(a),h.comms()&&(h.timeout=setTimeout(function(){h.release()},50))},h.event=function(a){var b={uid:h.uid,sid:h.sid,t:d.getTimestamp()};window.self===window.top?(b.r=document.location.toString(),b.rr=document.referrer):b.r=document.referrer,d.assert(a.g),d.assert(a.c),d.assert(a.a),b=d.extend({},b,a),h.queue(b)},h.comms=function(){return h.connected?!0:h.connecting?!1:(h.connecting=!0,h.hub.one("xcomm.ready",function(){h.connected=!0,h.release()}),void g.connect(h.hub,{name:h.name}))},h.connect=function(a,b){h.name=b,a.on("log.event",function(a){h.event(a)}),h.hub=a},b.exports=h},{"../browser.js":5,"../comms.js":6,"../urlparse.js":26,"../utils.js":27}],18:[function(a,b,c){var d=a("./browser.js"),e=a("./utils.js"),f=a("./dom.js"),g={_data:null};g.COOKIE_NAME="em_p_uid",g.format=function(a){return a&&e.isObject(a)?e.map(a,function(a,b){return b+":"+a}).sort().join("|"):null},g.parse=function(a){if(!a)return null;var b;return e.reduce(a.split("|"),function(a,c){return null===a?null:(b=c.split(":"),2!==b.length?null:(a[b[0]]=b[1],a))},{})},g.timestamp=function(a){var b;try{b=parseInt(a,10)}catch(c){return!1}return b},g.get=function(){var a=d.cookie.get(g.COOKIE_NAME);if(e.isNone(a))return g.set();var b=g.parse(a),c=g.timestamp(b.t);return c===!1?g.set():e.getTimestamp()-c>15552e6?g.set({u:b.u,l:b.l}):b},g.set=function(a){var b={u:e.getUUID(),t:e.getTimestamp(),l:0};a&&(b=e.extend(b,a));var c=g.format(b);return d.cookie.set(g.COOKIE_NAME,c,365,"https:"===window.location.protocol),c=d.cookie.get(g.COOKIE_NAME),e.isNone(c)?null:g.parse(c)},g.update=function(a){var b=g.get();return b?(b=e.extend(b,a),g.set(b)):!1},g.data=function(){if(g._data)return g._data;var a={mt:e.getTimestamp(),mr:document.referrer,msw:d.window.innerWidth(),msh:d.window.innerHeight()},b=g.get();return b?(a.muu=b.u,a.mut=b.t,a.mul=b.l):a.muu=0,g._data=a,g.update({l:e.getTimestamp()}),g._data},g.send=function(a,b){if(!b||!e.isElement(b.elem))return!1;var c=e.extend(g.data(),{}),d=f.rect(b.elem);d&&(c.mft=d.top,c.mfl=d.left,c.mfw=d.width,c.mfh=d.height),b.send(a,c)},b.exports=g},{"./browser.js":5,"./dom.js":7,"./utils.js":27}],19:[function(a,b,c){var d=a("./dom.js"),e=a("./utils"),f={_event:null,_observer:null};f.nodeNames=["iframe","a","blockquote"],f.html=function(){var a=document.getElementsByTagName("html");return 0===a.length?null