-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathangular-erated.min.js
1 lines (1 loc) · 1.63 KB
/
angular-erated.min.js
1
function eratedServiceProvider(){var e="",r={},t=[];this.setApiKey=function(r){e=r},this.setDefaultConfig=function(e){r=e},this.$get=["$q","$http","angularLoad",function(i,a,n){function o(){return e}function u(e){var r=i.defer();return a.get("//api.erated.co/v1/users/"+e+"?partner="+o()).success(function(e){return e.hasOwnProperty("error")?void r.reject(e):void r.resolve(e)}),r.promise}function d(){return r}function l(e,r,i){t.push({review_content:e,reviewed_as_seller:r,review_type:i})}function c(){return t}function v(){t=[]}function s(){n.loadScript("//cdn.erated.co/iframe/erated_imp.js")}function f(r){var t=g.getReviews();window.eRated={config:{align:r.align,key:e,color:r.color,reputationMode:"marketplace",privacy:{firstNameOnly:!1},view:r.view,type:"html",width:380},userData:{name:r.username,sha1Email:r.emailhash,location:r.location,image:r.image,reputationData:{numberOfReviews:0,percentPositiveReviews:0,reviews:t}}};var i=g.getDefaultConfig();for(var a in i)window.eRated.config[a]=i[a];return g.removeAllReviews(),window.eRated}var g={apiKey:e,getApiKey:o,getUserProfile:u,getDefaultConfig:d,addReview:l,getReviews:c,removeAllReviews:v,loadSetupScript:s,setupVars:f};return g}]}function eratedPlugin(e){var r='<div class="erated"></div>';return{restrict:"EA",link:function(r,t,i){var a=i;window.eRated=null,window.erated=null,window.eratedPlugin=null,window.init_eRated=null,e.loadSetupScript(),e.setupVars(a)},template:r}}angular.module("angular-erated",["angularLoad"]),angular.module("angular-erated").provider("eratedService",[eratedServiceProvider]),angular.module("angular-erated").directive("eratedplugin",["eratedService",eratedPlugin]);