Skip to content

Commit

Permalink
Wrote initial version of embedCommentsBoxURL for Disqus
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabywalters committed Dec 23, 2012
1 parent 4c3df5a commit 4b32d0c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/common/content_script.js
Expand Up @@ -9,7 +9,7 @@
var OwnYourComments = (function () { var OwnYourComments = (function () {
// Private // Private
// Utility functions // Utility functions
function getConfig(key, callback) { function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback); kango.invokeAsync('kango.storage.getItem', key, callback);
} }


Expand All @@ -35,7 +35,21 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes * Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/ */
function embedCommentsBox(url) { 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 // Public
Expand Down

0 comments on commit 4b32d0c

Please sign in to comment.