angular-duoshuo
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -1,2 +0,2 @@ | ||
!function(e,r){"use strict";function t(){function t(e){if(e){if(!e.short_name)throw new Error("duoshuo.config(); `short_name` is required");window.duoshuoQuery=e}}this.config=t,this.$get=["$rootScope",function(t){var n={};return e.forEach(["get","post","ajax"],function(e){n[e]=function(n,i,d,s,u){if(!window.DUOSHUO)throw new Error("duoshuo embed.js is required!");var c=window.DUOSHUO.API;if(!c)throw new Error("duoshuo embed.js must be unstable version!");return o&&r.start(),c[e](n,i,function(e){o&&r.done(),d(0===e.code?null:new Error(e.code+" "+e.errorMessage),e.response,e),u||t.$apply()},function(e){return o&&r.done(),s&&"function"==typeof s?s(e):void 0})}}),n.on=function(e,r,n){if(0===["reset","ready"].indexOf(e))return r(new Error("event not found"));var o=e;return"ready"===o&&(o="reset"),window.DUOSHUO.visitor.on(o,function(){var e=this,o=this.data;r(null,o,e),n||t.$apply()})},n.render=function(){if(!window.DUOSHUO||!window.DUOSHUO.initSelector)throw new Error("createDirective(); duoshuo embed.js is required!");return window.DUOSHUO.initSelector(window.DUOSHUO.selectors[".ds-thread"])},n}]}function n(r){return"ds-thread"===r?function(){return{restrict:"AE",replace:!0,template:'<div class="ds-thread-wrapper"></div>',link:function(r,t,n){e.element(document).ready(function(){var r={};n.threadId&&(r["thread-id"]=n.threadId),n.threadKey&&(r["thread-key"]=n.threadKey),e.element(t[0]).append(window.DUOSHUO.createEmbedThread("div",r))})}}}:function(){return{restrict:"AE",replace:!0,template:'<div class="'+r+'">',link:function(){e.element(document).ready(function(){window.DUOSHUO&&window.DUOSHUO.initSelector&&window.DUOSHUO.initSelector(r,window.DUOSHUO.selectors["."+r])})}}}}if(!e)throw new Error("Angular.js required!");var o=r&&r.start&&r.done;e.module("duoshuo",[]).provider("duoshuo",t).directive("dsThread",n("ds-thread")).directive("dsRecentComments",n("ds-recent-comments")).directive("dsRecentVisitors",n("ds-recent-visitors")).directive("dsThreadCount",n("ds-thread-count")).directive("dsTopThreads",n("ds-top-threads")).directive("dsLogin",n("ds-login"))}(window.angular,window.NProgress); | ||
!function(e,r){"use strict";function t(){function t(e){if(e){if(!e.short_name)throw new Error("duoshuo.config(); `short_name` is required");window.duoshuoQuery=e}}this.config=t,this.$get=["$rootScope",function(t){var n={};return e.forEach(["get","post","ajax"],function(e){n[e]=function(n,i,d,s,u){if(!window.DUOSHUO)throw new Error("duoshuo embed.js is required!");var c=window.DUOSHUO.API;if(!c)throw new Error("duoshuo embed.js must be unstable version!");return o&&r.start(),c[e](n,i,function(e){o&&r.done(),d(0===e.code?null:new Error(e.code+" "+e.errorMessage),e.response,e),u||t.$apply()},function(e){return o&&r.done(),s&&"function"==typeof s?s(e):void 0})}}),n.on=function(e,r,n){if(0===["reset","ready"].indexOf(e))return r(new Error("event not found"));var o=e;return"ready"===o&&(o="reset"),window.DUOSHUO.visitor.on(o,function(){var e=this,o=this.data;r(null,o,e),n||t.$apply()})},n.render=function(){if(!window.DUOSHUO||!window.DUOSHUO.initSelector)throw new Error("createDirective(); duoshuo embed.js is required!");return window.DUOSHUO.initSelector(".ds-thread",window.DUOSHUO.selectors[".ds-thread"])},n}]}function n(r){return"ds-thread"===r?function(){return{restrict:"AE",replace:!0,template:'<div class="ds-thread-wrapper"></div>',link:function(r,t,n){e.element(document).ready(function(){var r={};n.threadId&&(r["thread-id"]=n.threadId),n.threadKey&&(r["thread-key"]=n.threadKey),e.element(t[0]).append(window.DUOSHUO.createEmbedThread("div",r))})}}}:function(){return{restrict:"AE",replace:!0,template:'<div class="'+r+'">',link:function(){e.element(document).ready(function(){window.DUOSHUO&&window.DUOSHUO.initSelector&&window.DUOSHUO.initSelector("."+r,window.DUOSHUO.selectors["."+r])})}}}}if(!e)throw new Error("Angular.js required!");var o=r&&r.start&&r.done;e.module("duoshuo",[]).provider("duoshuo",t).directive("dsThread",n("ds-thread")).directive("dsRecentComments",n("ds-recent-comments")).directive("dsRecentVisitors",n("ds-recent-visitors")).directive("dsThreadCount",n("ds-thread-count")).directive("dsTopThreads",n("ds-top-threads")).directive("dsLogin",n("ds-login"))}(window.angular,window.NProgress); | ||
//# sourceMappingURL=duoshuo.min.js.map |
{ | ||
"name": "angular-duoshuo", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "a duoshuo SDK for angular.js, pure front-end, cross-domain request supported.", | ||
@@ -5,0 +5,0 @@ "main": "dist/duoshuo.min.js", |
@@ -95,2 +95,3 @@ ;(function(angular, NProgress) { | ||
return window.DUOSHUO.initSelector( | ||
'.ds-thread', | ||
window.DUOSHUO.selectors['.ds-thread'] | ||
@@ -106,25 +107,2 @@ ) | ||
function createDirective(type) { | ||
if (type === 'ds-thread') { | ||
return function dsThreadDirective() { | ||
return { | ||
restrict: 'AE', | ||
replace: true, | ||
template: '<div class="ds-thread-wrapper"></div>', | ||
link: function(scope, element, attrs) { | ||
// Render comments when DOM has been injected. | ||
angular.element(document).ready(function() { | ||
var data = {}; | ||
if (attrs.threadId) data['thread-id'] = attrs.threadId; | ||
if (attrs.threadKey) data['thread-key'] = attrs.threadKey; | ||
// Fired after DOM ready | ||
angular | ||
.element(element[0]) | ||
.append(window.DUOSHUO.createEmbedThread('div', data)); | ||
}); | ||
} | ||
}; | ||
}; | ||
} | ||
return function directive() { | ||
@@ -142,3 +120,3 @@ return { | ||
window.DUOSHUO | ||
.initSelector(type, window.DUOSHUO.selectors['.' + type]) | ||
.initSelector('.' + type, window.DUOSHUO.selectors['.' + type]) | ||
}); | ||
@@ -145,0 +123,0 @@ } |
Sorry, the diff of this file is not supported yet
13928
140