Permalink
Browse files

Fixed stupid bug, improved markup in options.html

  • Loading branch information...
1 parent ce3147d commit 2660d40ab59f7f4d0e7e64c2112c677dc6aaa45f @barnabywalters committed Dec 23, 2012
@@ -36,20 +36,20 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/
function embedCommentsBox() {
- $('iframe[data-disqus-uid]').before(function () {
- var eID = $(this).attr('data-disqus-uid');
+ $('iframe[data-disqus-uid]').each(function (i, el) {
+ var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
- var el = $('iframe').attr('id', 'own-your-comments-embed-' + eID);
+ var insertFrame = $('<iframe />').attr('id', insertID);
- var properties = {
- url: window.location.href
- };
+ var properties = { url: window.location.href };
getOption('commentEmbedURL', function (url) {
- $('#' + eID).attr('src', expandTemplates(url, properties));
+ $('#' + insertID).attr('src', expandTemplates(url, properties));
});
- return el;
+ console.log('Inserting:', insertFrame, 'before:', el);
+
+ $(el).before(insertFrame);
});
}
@@ -61,4 +61,4 @@ var OwnYourComments = (function () {
};
}());
-window.setTimeout(1000, OwnYourComments.init);
+setTimeout(OwnYourComments.init, 2000);
@@ -36,20 +36,20 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/
function embedCommentsBox() {
- $('iframe[data-disqus-uid]').before(function () {
- var eID = $(this).attr('data-disqus-uid');
+ $('iframe[data-disqus-uid]').each(function (i, el) {
+ var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
- var el = $('iframe').attr('id', 'own-your-comments-embed-' + eID);
+ var insertFrame = $('<iframe />').attr('id', insertID);
- var properties = {
- url: window.location.href
- };
+ var properties = { url: window.location.href };
getOption('commentEmbedURL', function (url) {
- $('#' + eID).attr('src', expandTemplates(url, properties));
+ $('#' + insertID).attr('src', expandTemplates(url, properties));
});
- return el;
+ console.log('Inserting:', insertFrame, 'before:', el);
+
+ $(el).before(insertFrame);
});
}
@@ -61,4 +61,4 @@ var OwnYourComments = (function () {
};
}());
-window.setTimeout(1000, OwnYourComments.init);
+setTimeout(OwnYourComments.init, 2000);
@@ -36,20 +36,20 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/
function embedCommentsBox() {
- $('iframe[data-disqus-uid]').before(function () {
- var eID = $(this).attr('data-disqus-uid');
+ $('iframe[data-disqus-uid]').each(function (i, el) {
+ var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
- var el = $('iframe').attr('id', 'own-your-comments-embed-' + eID);
+ var insertFrame = $('<iframe />').attr('id', insertID);
- var properties = {
- url: window.location.href
- };
+ var properties = { url: window.location.href };
getOption('commentEmbedURL', function (url) {
- $('#' + eID).attr('src', expandTemplates(url, properties));
+ $('#' + insertID).attr('src', expandTemplates(url, properties));
});
- return el;
+ console.log('Inserting:', insertFrame, 'before:', el);
+
+ $(el).before(insertFrame);
});
}
@@ -61,4 +61,4 @@ var OwnYourComments = (function () {
};
}());
-window.setTimeout(1000, OwnYourComments.init);
+setTimeout(OwnYourComments.init, 2000);
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,8 @@
<dict>
<key>Author</key>
<string>Barnaby Walters</string>
+ <key>Builder Version</key>
+ <string>6534.57.2</string>
<key>CFBundleDisplayName</key>
<string>Own Your Comments</string>
<key>CFBundleIdentifier</key>
@@ -17,7 +19,7 @@
<key>Chrome</key>
<dict>
<key>Database Quota</key>
- <real>10485760.0</real>
+ <real>10485760</real>
<key>Global Page</key>
<string>background.html</string>
<key>Popovers</key>
@@ -36,20 +36,20 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/
function embedCommentsBox() {
- $('iframe[data-disqus-uid]').before(function () {
- var eID = $(this).attr('data-disqus-uid');
+ $('iframe[data-disqus-uid]').each(function (i, el) {
+ var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
- var el = $('iframe').attr('id', 'own-your-comments-embed-' + eID);
+ var insertFrame = $('<iframe />').attr('id', insertID);
- var properties = {
- url: window.location.href
- };
+ var properties = { url: window.location.href };
getOption('commentEmbedURL', function (url) {
- $('#' + eID).attr('src', expandTemplates(url, properties));
+ $('#' + insertID).attr('src', expandTemplates(url, properties));
});
- return el;
+ console.log('Inserting:', insertFrame, 'before:', el);
+
+ $(el).before(insertFrame);
});
}
@@ -61,4 +61,4 @@ var OwnYourComments = (function () {
};
}());
-window.setTimeout(1000, OwnYourComments.init);
+setTimeout(OwnYourComments.init, 2000);
@@ -36,20 +36,22 @@ var OwnYourComments = (function () {
* Embeds an Indieweb comments box before Disqus or Livefyre iframes
*/
function embedCommentsBox() {
- $('iframe[data-disqus-uid]').before(function () {
- var eID = $(this).attr('data-disqus-uid');
+ $('iframe[data-disqus-uid]').each(function (i, el) {
+ var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
- var el = $('iframe').attr('id', 'own-your-comments-embed-' + eID);
+ var insertFrame = $('<iframe />').attr('id', insertID);
- var properties = {
- url: window.location.href
- };
+ var properties = { url: window.location.href };
getOption('commentEmbedURL', function (url) {
- $('#' + eID).attr('src', expandTemplates(url, properties));
+ $('#' + insertID).attr('src', expandTemplates(url, properties));
});
- return el;
+ getOption('commentEmbedHeight', function (height) {
+ $('#' + insertID).css('height', height);
+ });
+
+ $(el).before(insertFrame);
});
}
@@ -61,4 +63,4 @@ var OwnYourComments = (function () {
};
}());
-window.setTimeout(1000, OwnYourComments.init);
+setTimeout(OwnYourComments.init, 2000);
View
@@ -53,7 +53,7 @@
<label><b>Disqus/Livefyre Embed URL</b> ⇒ <input id="commentEmbedURL" type="url" class="monitor" placeholder="http://example.org/notes/new?inReplyTo={url}" /></label>
- <label><b title="CSS height string">Height:</b> <input class="short" id="commentEmbedHeight" class="monitor" placeholder="5em"</b>
+ <label><b title="CSS height string">Height:</b> <input class="short" id="commentEmbedHeight" class="monitor" placeholder="5em" /></label>
<div class="metadata">
<div class="notes">
View
@@ -1,4 +1,4 @@
-function saveURL(evt) {
+function saveOption(evt) {
kango.invokeAsync('kango.storage.setItem', $(evt.target).attr('id'), evt.target.value);
$('#notice').text('Unsaved Changes Made!').toggleClass('unsaved');
@@ -11,7 +11,7 @@ function main() {
$('.monitor').each(function () {
var self = $(this);
- self.keyup(saveURL);
+ self.keyup(saveOption);
kango.invokeAsync('kango.storage.getItem', self.attr('id'), function (url) {
self.val(url);

0 comments on commit 2660d40

Please sign in to comment.