Browse files

Added unique id counter and function, used it for embed ids

  • Loading branch information...
1 parent 5626bb4 commit bdba138222d4f89cac277a3ee192d9f8900df676 @barnabywalters committed Dec 23, 2012
View
9 output/chrome/content_script.js
@@ -7,8 +7,15 @@
var OwnYourComments = (function () {
// Private
+ var uniqIdCounter = 0;
// Utility functions
+
+ function uniq(prefix) {
+ uniqIdCounter ++;
+ return '' + prefix + uniqIdCounter;
+ }
+
function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback);
}
@@ -37,7 +44,7 @@ var OwnYourComments = (function () {
*/
function embedCommentsBox() {
$('iframe[data-disqus-uid], div#disqus_thread').each(function (i, el) {
- var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
+ var insertID = uniq('own-your-comments-embed-');
var insertFrame = $('<iframe />')
.attr('id', insertID)
View
9 output/firefox/chrome/content/content_script.js
@@ -7,8 +7,15 @@
var OwnYourComments = (function () {
// Private
+ var uniqIdCounter = 0;
// Utility functions
+
+ function uniq(prefix) {
+ uniqIdCounter ++;
+ return '' + prefix + uniqIdCounter;
+ }
+
function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback);
}
@@ -37,7 +44,7 @@ var OwnYourComments = (function () {
*/
function embedCommentsBox() {
$('iframe[data-disqus-uid], div#disqus_thread').each(function (i, el) {
- var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
+ var insertID = uniq('own-your-comments-embed-');
var insertFrame = $('<iframe />')
.attr('id', insertID)
View
9 output/opera/content_script.js
@@ -7,8 +7,15 @@
var OwnYourComments = (function () {
// Private
+ var uniqIdCounter = 0;
// Utility functions
+
+ function uniq(prefix) {
+ uniqIdCounter ++;
+ return '' + prefix + uniqIdCounter;
+ }
+
function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback);
}
@@ -37,7 +44,7 @@ var OwnYourComments = (function () {
*/
function embedCommentsBox() {
$('iframe[data-disqus-uid], div#disqus_thread').each(function (i, el) {
- var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
+ var insertID = uniq('own-your-comments-embed-');
var insertFrame = $('<iframe />')
.attr('id', insertID)
View
BIN output/ownyourcomments_0.9.crx
Binary file not shown.
View
BIN output/ownyourcomments_0.9.oex
Binary file not shown.
View
BIN output/ownyourcomments_0.9.xpi
Binary file not shown.
View
9 output/safari/ownyourcomments_0.9.safariextension/content_script.js
@@ -7,8 +7,15 @@
var OwnYourComments = (function () {
// Private
+ var uniqIdCounter = 0;
// Utility functions
+
+ function uniq(prefix) {
+ uniqIdCounter ++;
+ return '' + prefix + uniqIdCounter;
+ }
+
function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback);
}
@@ -37,7 +44,7 @@ var OwnYourComments = (function () {
*/
function embedCommentsBox() {
$('iframe[data-disqus-uid], div#disqus_thread').each(function (i, el) {
- var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
+ var insertID = uniq('own-your-comments-embed-');
var insertFrame = $('<iframe />')
.attr('id', insertID)
View
9 src/common/content_script.js
@@ -7,8 +7,15 @@
var OwnYourComments = (function () {
// Private
+ var uniqIdCounter = 0;
// Utility functions
+
+ function uniq(prefix) {
+ uniqIdCounter ++;
+ return '' + prefix + uniqIdCounter;
+ }
+
function getOption(key, callback) {
kango.invokeAsync('kango.storage.getItem', key, callback);
}
@@ -37,7 +44,7 @@ var OwnYourComments = (function () {
*/
function embedCommentsBox() {
$('iframe[data-disqus-uid], div#disqus_thread').each(function (i, el) {
- var insertID = 'own-your-comments-embed-' + $(el).attr('data-disqus-uid');
+ var insertID = uniq('own-your-comments-embed-');
var insertFrame = $('<iframe />')
.attr('id', insertID)

0 comments on commit bdba138

Please sign in to comment.