Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Version to 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Kos committed Sep 18, 2015
1 parent a910f2e commit 01fc993
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bulbs-public-embed-instagram",
"version": "0.0.7",
"version": "0.0.8",
"main": [
"dist/jquery.instagram-embed-processor.js"
],
Expand Down
27 changes: 16 additions & 11 deletions dist/jquery.instagram-embed-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ InstagramEmbedProcessor.prototype._getInstagramEmbedScript = function () {
return this._shared.instagramLoaded.promise();
};

InstagramEmbedProcessor.prototype._sanitizeHtml = function (html) {
InstagramEmbedProcessor.prototype._sanitizeHtml = function (unsanitizedHtml) {
var html;
if (typeof(unsanitizedHtml) === 'string') {
html = unsanitizedHtml;
} else {
html = unescape(this.$container.attr('instagram-embed-html-unsanitized'));
this.$container.attr('instagram-embed-html-unsanitized', '');
}

return $(html).not('script').prop('outerHTML');
};

Expand All @@ -52,25 +60,22 @@ InstagramEmbedProcessor.prototype.isRendered = function (val) {
};

InstagramEmbedProcessor.prototype.prep = function (embedHtml) {
var html;
if (typeof(embedHtml) !== 'string') {
html = this.$container.attr('instagram-embed-html-unsanitized');
this.$container.attr('instagram-embed-html-unsanitized', '');
} else {
html = embedHtml;
}

var sanitized = this._sanitizeHtml(html);
var sanitized = this._sanitizeHtml(embedHtml);
this.html(sanitized);
};

InstagramEmbedProcessor.prototype.insertUnrenderedHtml = function () {
this.$container.html(this.html());
};

InstagramEmbedProcessor.prototype.render = function () {
var rendered;

if (!this.isRendered()) {
this.insertUnrenderedHtml();

var self = this;
rendered = this._getInstagramEmbedScript().done(function () {
self.$container.html(self.html());
instgrm.Embeds.process();

self.$container.data('instagramEmbedRendered', true);
Expand Down

0 comments on commit 01fc993

Please sign in to comment.