-
Notifications
You must be signed in to change notification settings - Fork 18
/
bb.min.js
34 lines (34 loc) · 13.5 KB
/
bb.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var COMPILED=!0,goog=goog||{};goog.global=this;goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]?c[d]:c[d]={}:c[d]=b};goog.define=function(a,b){var c=b;COMPILED||goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,a)&&(c=goog.global.CLOSURE_DEFINES[a]);goog.exportPath_(a,c)};goog.DEBUG=!0;goog.LOCALE="en";goog.TRUSTED_SITE=!0;
goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing app-only code into non-debug environment"+a?": "+a:".");};
COMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={});goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};
goog.addDependency=function(a,b,c){if(goog.DEPENDENCIES_ENABLED){var d;a=a.replace(/\\/g,"/");for(var e=goog.dependencies_,g=0;d=b[g];g++)e.nameToPath[d]=a,a in e.pathToNames||(e.pathToNames[a]={}),e.pathToNames[a][d]=!0;for(d=0;b=c[d];d++)a in e.requires||(e.requires[a]={}),e.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0;
goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a,b){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");};
goog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;
goog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),d=-1==d?c.length:
d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()){var b=goog.global.document;if("complete"==b.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}b.write('<script type="text/javascript" src="'+a+'">\x3c/script>');
return!0}return!1},goog.writeScripts_=function(){function a(e){if(!(e in d.written)){if(!(e in d.visited)&&(d.visited[e]=!0,e in d.requires))for(var f in d.requires[e])if(!goog.isProvided_(f))if(f in d.nameToPath)a(d.nameToPath[f]);else throw Error("Undefined nameToPath for "+f);e in c||(c[e]=!0,b.push(e))}}var b=[],c={},d=goog.dependencies_,e;for(e in goog.included_)d.written[e]||a(e);for(e=0;e<b.length;e++)if(b[e])goog.importScript_(goog.basePath+b[e]);else throw Error("Undefined script input");
},goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js"));
goog.typeOf=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b};goog.isDef=function(a){return void 0!==a};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isString=function(a){return"string"==typeof a};
goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};goog.isFunction=function(a){return"function"==goog.typeOf(a)};goog.isObject=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.hasUid=function(a){return!!a[goog.UID_PROPERTY_]};goog.removeUid=function(a){"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};
goog.UID_PROPERTY_="closure_uid_"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};
goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};
goog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval)if(null==goog.evalWorksForGlobals_&&(goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=!1;c.appendChild(b.createTextNode(a));b.body.appendChild(c);
b.body.removeChild(c)}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;goog.getCssName=function(a,b){var c=function(a){return goog.cssNameMapping_[a]||a},d=function(a){a=a.split("-");for(var b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join("-")},d=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:d:function(a){return a};return b?a+"-"+d(b):d(a)};goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};
!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b){var c=b||{},d;for(d in c){var e=(""+c[d]).replace(/\$/g,"$$$$");a=a.replace(RegExp("\\{\\$"+d+"\\}","gi"),e)}return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};
goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};
goog.base=function(a,b,c){var d=arguments.callee.caller;if(goog.DEBUG&&!d)throw Error("arguments.caller not defined. goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(d.superClass_)return d.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var e=Array.prototype.slice.call(arguments,2),g=!1,f=a.constructor;f;f=f.superClass_&&f.superClass_.constructor)if(f.prototype[b]===d)g=!0;else if(g)return f.prototype[b].apply(a,
e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error("goog.base called from a method of one name to a method of a different name");};goog.scope=function(a){a.call(goog.global)};var BB={go:{},Frame:function(a,b,c,d){this.win=a;this.scroll=b;this.mouse=c;this.clicked=d||!1}};BB.Frame.getClientRes=function(){return{width:window.innerWidth,height:window.innerHeight}};BB.Frame.getCurrentWin=function(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}};BB.Frame.getCurrentScroll=function(){return{offsetX:document.body.scrollLeft,offsetY:document.body.scrollTop}};
BB.Frame.getCurrentMouse=function(){return{x:BB.Session.mouse.x||0,y:BB.Session.mouse.y||0}};BB.Recording=function(a,b,c,d,e){this.title=a;this.url=b;this.res=c;this.fps=d;this.frames=e};
BB.RecPlayer=function(a,b,c){this.recording=a||{};this.win=document.createElement("div");this.viewport=document.createElement("div");this.doc=document.createElement("iframe");this.mouse=document.createElement("img");this.ticks={FRAME_DUR_MILLI:0,FRAME_DUR_SEC:0};this.frames={TOTAL:0,CURRENT:0};this.active=!1;this._mouseOn=new Image;this._mouseOff=new Image;this.init(b,c)};
BB.RecPlayer.prototype.init=function(a,b){this._mouseOn.src=a||"/assets/img/mouse-on.png";this._mouseOff.src=b||"/assets/img/mouse-off.png";this.win.className="bb-win";this.viewport.className="bb-vp";this.doc.className="bb-doc";this.mouse.className="bb-mouse";this.mouse._width=32;this.mouse._height=32;this.mouse._centerX=parseInt(0.5*this.mouse._width,10);this.mouse._centerY=parseInt(0.5*this.mouse._height,10);this.mouse.style.left="-100px";this.mouse.style.top="-100px";this.mouse.src=this._mouseOff.src;
this.win.appendChild(this.mouse);this.win.appendChild(this.viewport);this.viewport.appendChild(this.doc);this.timer};BB.RecPlayer.prototype.setRecording=function(a){this.recording=a;this.active=!1};BB.RecPlayer.prototype.centerMouse=function(a,b){this.mouse.style.left=a-this.mouse._centerX+"px";this.mouse.style.top=b-this.mouse._centerY+"px"};
BB.RecPlayer.prototype.tick=function(){var a=this.recording.frames[this.frames.CURRENT];this.centerMouse(a.mouse.x,a.mouse.y);this.mouse.src=a.clicked?this._mouseOn.src:this._mouseOff.src;this.frames.CURRENT++;this.frames.CURRENT<this.frames.TOTAL&&(this.timer=setTimeout(this.tick.bind(this),this.ticks.FRAME_DUR_MILLI))};
BB.RecPlayer.prototype.go=function(a){if(!this.active&&this.recording!=={}){for(var b;a.firstChild;)b=a.firstChild.cloneNode(!1),a.replaceChild(b,a.firstChild);this.ticks.FRAME_DUR_MILLI=1E3/this.recording.fps;this.ticks.FRAME_DUR_SEC=this.recording.fps/1E3;this.frames.TOTAL=this.recording.frames.length;this.frames.CURRENT=0;this.win.style.width=this.recording.res.width+"px";this.win.style.height=this.recording.res.height+"px";this.viewport.style.width=this.recording.frames[0].win.width+"px";this.viewport.style.height=
this.recording.frames[0].win.height+"px";this.doc.style.width=this.recording.frames[0].win.width+"px";this.doc.style.height=this.recording.frames[0].win.height+"px";this.doc.src=this.recording.url;this.mouse.style.transitionDuration=this.ticks.FRAME_DUR_SEC+"s";this.centerMouse(this.recording.frames[0].mouse.x,this.recording.frames[0].mouse.y);a.appendChild(this.win);this.active=!0;this.tick()}};BB.RecPlayer.prototype.stop=function(){clearTimeout(this.timer)};
BB.Session=function(a,b,c,d){this.backendUrl=a;this.fps=b||3;this.TICK_MILLI=1E3/this.fps;this.title=c||BB.Session.getPageTitle();this.url=d||BB.Session.getPageUrl();this.frames=[];this.clicked=this.active=!1;this.init()};BB.Session.prototype.init=function(){var a=this;document.addEventListener("mousemove",function(a){BB.Session.mouse.x=a.clientX||a.pageX;BB.Session.mouse.y=a.clientY||a.pageY},!1);document.addEventListener("click",function(b){a.clicked=!0},!1)};
BB.Session.prototype.start=function(){this.active||(this.active=!0,this.tick())};BB.Session.prototype.stop=function(){clearTimeout(this.timer);this.active=!1};BB.Session.prototype.tick=function(){if(this.active){var a=new BB.Frame(BB.Frame.getCurrentWin(),BB.Frame.getCurrentScroll(),BB.Frame.getCurrentMouse(),this.clicked);this.frames.push(a);this.timer=setTimeout(this.tick.bind(this),this.TICK_MILLI);this.clicked=!1}};
BB.Session.prototype.upload=function(){var a=new XMLHttpRequest;a.open("POST","/save.php",!0);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.send("recording="+this.toString())};BB.Session.getPageTitle=function(){var a=document.getElementsByTagName("title"),b="Untitled document";0<a.length&&(b=a[0].textContent);return b};BB.Session.getPageUrl=function(){return window.location.href};
BB.Session.prototype.toString=function(){return JSON.stringify(new BB.Recording(this.title,this.url,BB.Frame.getClientRes(),this.fps,this.frames))};BB.Session.mouse={x:0,y:0};
//# sourceMappingURL=bb.js.map