first commit
This commit is contained in:
68
customerportal/libraries/angularjs/directives/disqus/dirDisqus.js
vendored
Normal file
68
customerportal/libraries/angularjs/directives/disqus/dirDisqus.js
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
|
||||
* A directive to embed a Disqus comments widget on your AngularJS page.
|
||||
|
||||
*
|
||||
|
||||
* For documentation, see the README.md file in this directory
|
||||
|
||||
*
|
||||
|
||||
* Created by Michael on 22/01/14.
|
||||
|
||||
* Copyright Michael Bromley 2014
|
||||
|
||||
* Available under the MIT license.
|
||||
|
||||
*/
|
||||
|
||||
angular.module('angularUtils.directives.dirDisqus', [])
|
||||
|
||||
|
||||
|
||||
.directive('dirDisqus', ['$window', function($window) {
|
||||
|
||||
return {
|
||||
|
||||
restrict: 'E',
|
||||
|
||||
scope: {
|
||||
|
||||
disqus_shortname: '@disqusShortname',
|
||||
|
||||
disqus_identifier: '@disqusIdentifier',
|
||||
|
||||
disqus_title: '@disqusTitle',
|
||||
|
||||
disqus_url: '@disqusUrl',
|
||||
|
||||
disqus_category_id: '@disqusCategoryId',
|
||||
|
||||
disqus_disable_mobile: '@disqusDisableMobile',
|
||||
|
||||
readyToBind: "@"
|
||||
|
||||
},
|
||||
|
||||
template: '<div id="disqus_thread"></div><a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>',
|
||||
|
||||
link: function(scope) {
|
||||
|
||||
|
||||
|
||||
// ensure that the disqus_identifier and disqus_url are both set, otherwise we will run in to identifier conflicts when using URLs with "#" in them
|
||||
|
||||
// see http://help.disqus.com/customer/portal/articles/662547-why-are-the-same-comments-showing-up-on-multiple-pages-
|
||||
|
||||
if (typeof scope.disqus_identifier === 'undefined' || typeof scope.disqus_url === 'undefined') {
|
||||
|
||||
throw "Please ensure that the `disqus-identifier` and `disqus-url` attributes are both set.";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
scope.$watch("readyToBind", function(isReady) {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user