Permalink
Browse files

Wrote initial version of embedCommentsBoxURL for Disqus

  • Loading branch information...
1 parent 4c3df5a commit 4b32d0c13b90368f935826a708554b74b128b232 @barnabywalters committed Dec 23, 2012
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/common/content_script.js
@@ -9,7 +9,7 @@
var OwnYourComments = (function () {
// Private
// Utility functions
- function getConfig(key, callback) {
+ function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback);
}
@@ -35,7 +35,21 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/
function embedCommentsBox(url) {
- $()
+ $('iframe[data-disqus-uid]').before(function () {
+ var eID = $(this).attr('data-disqus-uid');
+
+ var el = $('iframe').attr('id', 'own-your-comments-embed-' + eID);
+
+ var properties = {
+ url: window.location.href
+ };
+
+ getOption('commentEmbedURL', function (url) {
+ $('#' + eID).attr('src', expandTemplates(url, properties));
+ });
+
+ return el;
+ });
}
// Public

0 comments on commit 4b32d0c

Please sign in to comment.