From 01fc993a4f2952e0f1a5f4c054e183f49ff08940 Mon Sep 17 00:00:00 2001 From: Andrew Kos Date: Fri, 18 Sep 2015 10:06:00 -0500 Subject: [PATCH] Version to 0.0.8 --- bower.json | 2 +- dist/jquery.instagram-embed-processor.js | 27 ++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/bower.json b/bower.json index ddde06d..0c3730c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bulbs-public-embed-instagram", - "version": "0.0.7", + "version": "0.0.8", "main": [ "dist/jquery.instagram-embed-processor.js" ], diff --git a/dist/jquery.instagram-embed-processor.js b/dist/jquery.instagram-embed-processor.js index d784479..eb3b15a 100644 --- a/dist/jquery.instagram-embed-processor.js +++ b/dist/jquery.instagram-embed-processor.js @@ -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'); }; @@ -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);