gaf-mobile
Version:
GAF mobile Web site
6 lines • 7.29 kB
JavaScript
/*! angular-easyfb
version: 1.4.1
build date: 2015-09-22
author: Robin Fan
https://github.com/pc035860/angular-easyfb.git */
!function(a){function b(b,c){var d="ezfb-social-plugin-wrap",e="display: inline-block; width: 0; height: 0; overflow: hidden;",f=["fbPage","fbComments"],g=function(a){var b='<span class="'+d+'" style="'+e+'">';return a.wrap(b).parent()},h=function(a){var b='<div class="'+d+'">';return a.wrap(b).parent()},i=function(a){return a.parent().hasClass(d)},j=function(a){var b=a.parent();return b.after(a).remove(),a};a.directive(c,["ezfb","$q","$document",function(a,d,e){var k=f.indexOf(c)>=0,l=c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return{restrict:"EC",require:"?^ezfbXfbml",compile:function(c,d){return c.removeClass(l),function(c,d,e,f){function m(a){return function(){var b;n&&a===o&&(b=e.onrender,b&&c.$eval(b),n=!1,j(d))}}if(!f){var n=!1,o=0;a.$rendered().then(function(){d.addClass(l),c.$watch(function(){var a=[];return angular.forEach(b,function(b){a.push(e[b])}),a},function(b){var c;o++,n?a.XFBML.parse(d.parent()[0],m(o)):(n=!0,c=k?h:g,a.XFBML.parse(c(d)[0],m(o)))},!0)}),d.bind("$destroy",function(){i(d)&&j(d)})}}}}}])}a.provider("ezfb",function(){function a(a,b){return angular.isObject(b)?void angular.extend(a,b):angular.copy(a)}function b(a,b,c){return function(){return a.apply(b,c)}}var c={COMPLETED_REGISTRATION:"fb_mobile_complete_registration",VIEWED_CONTENT:"fb_mobile_content_view",SEARCHED:"fb_mobile_search",RATED:"fb_mobile_rate",COMPLETED_TUTORIAL:"fb_mobile_tutorial_completion",ADDED_TO_CART:"fb_mobile_add_to_cart",ADDED_TO_WISHLIST:"fb_mobile_add_to_wishlist",INITIATED_CHECKOUT:"fb_mobile_initiated_checkout",ADDED_PAYMENT_INFO:"fb_mobile_add_payment_info",ACHIEVED_LEVEL:"fb_mobile_level_achieved",UNLOCKED_ACHIEVEMENT:"fb_mobile_achievement_unlocked",SPENT_CREDITS:"fb_mobile_spent_credits"},d={CURRENCY:"fb_currency",REGISTRATION_METHOD:"fb_registration_method",CONTENT_TYPE:"fb_content_type",CONTENT_ID:"fb_content_id",SEARCH_STRING:"fb_search_string",SUCCESS:"fb_success",MAX_RATING_VALUE:"fb_max_rating_value",PAYMENT_INFO_AVAILABLE:"fb_payment_info_available",NUM_ITEMS:"fb_num_items",LEVEL:"fb_level",DESCRIPTION:"fb_description"},e=-1,f={api:[1,2,3],ui:1,getAuthResponse:e,getLoginStatus:0,login:0,logout:0,"Event.subscribe":1,"Event.unsubscribe":1,"XFBML.parse":1,"Canvas.Prefetcher.addStaticResource":e,"Canvas.Prefetcher.setCollectionMode":e,"Canvas.getPageInfo":0,"Canvas.hideFlashElement":e,"Canvas.scrollTo":e,"Canvas.setAutoGrow":e,"Canvas.setDoneLoading":0,"Canvas.setSize":e,"Canvas.setUrlHandler":0,"Canvas.showFlashElement":e,"Canvas.startTimer":e,"Canvas.stopTimer":0,"AppEvents.logEvent":e,"AppEvents.logPurchase":e,"AppEvents.activateApp":e},g="en_US",h={status:!0,cookie:!0,xfbml:!0,version:"v2.4"},i=["$window","$document","ezfbAsyncInit","ezfbLocale",function(a,b,c,d){!function(a){var b,c="facebook-jssdk",e=a.getElementsByTagName("script")[0];a.getElementById(c)||(b=a.createElement("script"),b.id=c,b.async=!0,b.src="//connect.facebook.net/"+d+"/sdk.js",e.parentNode.insertBefore(b,e))}(b[0]),a.fbAsyncInit=c}],j=i,k=["$window","ezfbInitParams",function(a,b){a.FB.init(b)}],l=k;return{setInitParams:function(b){a(h,b)},getInitParams:function(){return a(h)},setLocale:function(a){g=a},getLocale:function(){return g},setLoadSDKFunction:function(a){if(!angular.isArray(a)&&!angular.isFunction(a))throw new Error("Init function type error.");j=a},getLoadSDKFunction:function(){return j},setInitFunction:function(a){if(!angular.isArray(a)&&!angular.isFunction(a))throw new Error("Init function type error.");l=a},getInitFunction:function(){return l},$get:["$window","$q","$document","$parse","$rootScope","$injector","$timeout",function(i,m,n,o,p,q,r){var s,t,u,v,w,x;return v={},w=m.defer(),(h.appId||l!==k)&&w.resolve(),s=m.defer(),t=m.defer(),n[0].getElementById("fb-root")||n.find("body").append('<div id="fb-root"></div>'),x=function(){w.promise.then(function(){var a=function(){u.$$rendered=!0,r(function(){t.resolve()}),u.Event.unsubscribe("xfbml.render",a)};u.Event.subscribe("xfbml.render",a),q.invoke(l,null,{ezfbInitParams:h}),u.$$ready=!0,s.resolve()})},q.invoke(j,null,{ezfbAsyncInit:x,ezfbLocale:g}),u={$$ready:!1,$$rendered:!1,$ready:function(a){return angular.isFunction(a)&&s.promise.then(a),s.promise},$rendered:function(a){return angular.isFunction(a)&&t.promise.then(a),t.promise},init:function(b){a(h,b),w.resolve()},AppEvents:{EventNames:c,ParameterNames:d}},angular.forEach(f,function(a,c){var d=o(c),f=d.assign;f(u,function(){var f=b(function(b){var f,g;if(f=m.defer(),g=function(a){var d,e;for(d=angular.isFunction(b[a])?b[a]:angular.noop,e=function(){var a=Array.prototype.slice.call(arguments);p.$$phase?(d.apply(null,a),f.resolve.apply(f,a)):p.$apply(function(){d.apply(null,a),f.resolve.apply(f,a)})};b.length<=a;)b.push(null);var g;if("Event.subscribe"===c)g=b[0],angular.isUndefined(v[g])&&(v[g]=[]),v[g].push({original:d,wrapped:e});else if("Event.unsubscribe"===c&&(g=b[0],angular.isArray(v[g]))){var h,i,j=v[g].length;for(h=0;j>h;h++)if(i=v[g][h],i.original===d){e=i.wrapped,v[g].splice(h,1);break}}b[a]=e},a!==e)if(angular.isNumber(a))g(a);else if(angular.isArray(a)){var h,j;for(h=0;h<a.length;h++)if(j=a[h],b.length==j||b.length==j+1&&angular.isFunction(b[j])){g(j);break}}var k=d(i.FB);if(!k)throw new Error("Facebook API `FB."+c+"` doesn't exist.");return k.apply(i.FB,b),f.promise},null,[Array.prototype.slice.call(arguments)]);if("getAuthResponse"===c){if(angular.isUndefined(i.FB))throw new Error("`FB` is not ready.");return i.FB.getAuthResponse()}return a!==e?s.promise.then(f):void s.promise.then(f)})}),u}]}}).directive("ezfbXfbml",["ezfb","$parse","$compile","$timeout",function(a,b,c,d){return{restrict:"EAC",controller:function(){},compile:function(e,f){var g=e.html();return function(e,f,h){var i=!0,j=h.onrender,k=function(){i&&(j&&e.$eval(j),i=!1)};a.XFBML.parse(f[0],k);var l=b(h.ezfbXfbml).assign;e.$watch(h.ezfbXfbml,function(b){b&&(i=!0,f.html(g),c(f.contents())(e),d(function(){a.XFBML.parse(f[0],k)}),(l||angular.noop)(e,!1))},!0)}}}}]);var c={fbLike:["action","colorscheme","href","kidDirectedSite","layout","ref","share","showFaces","width"],fbShareButton:["href","layout","width"],fbSend:["colorscheme","href","kidDirectedSite","ref"],fbPost:["href","width"],fbFollow:["colorscheme","href","kidDirectedSite","layout","showFaces","width"],fbComments:["colorscheme","href","mobile","numPosts","orderBy","width"],fbCommentsCount:["href"],fbActivity:["action","appId","colorscheme","filter","header","height","linktarget","maxAge","recommendations","ref","site","width"],fbRecommendations:["action","appId","colorscheme","header","height","linktarget","maxAge","ref","site","width"],fbRecommendationsBar:["action","href","maxAge","numRecommendations","readTime","ref","side","site","trigger"],fbLikeBox:["colorscheme","forceWall","header","height","href","showBorder","showFaces","stream","width"],fbFacepile:["action","appId","colorscheme","href","maxRows","size","width"],fbPage:["href","width","height","hideCover","showFacepile","showPosts"],fbVideo:["href","width","allowfullscreen"],fbAdPreview:["adAccountId","adgroupId","creative","creativeId","adFormat","pageType","targeting","post"]};angular.forEach(c,b)}(angular.module("ezfb",[]));