Skip to content

Commit

Permalink
hotfix embed code cross-origin issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarinov committed Jan 30, 2017
1 parent ff8cdf8 commit 0f30744
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions browser/scripts/ui/playerUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ var VizorPlayerUI = function() {
e.preventDefault()
var data = {
origin : Vizor.origin,
embedOrigin: Vizor.embedOrigin,
shareURL : Vizor.shareURL,
embedSrc : Vizor.embedSrc
}
Expand Down
9 changes: 5 additions & 4 deletions views/graph/show.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@
window.Vizor = {}
Vizor.origin = window.location.origin
Vizor.embedOrigin = Vizor.origin.replace('https://','//').replace('http://','//')
Vizor.isEditor = false
{{#if graph.owner}}
Vizor.shareURL = window.location.origin + '/{{graph.owner}}/{{graph.name}}'
Vizor.embedSrc = window.location.origin + '/embed/{{graph.owner}}/{{graph.name}}'
Vizor.shareURL = Vizor.origin + '/{{graph.owner}}/{{graph.name}}'
Vizor.embedSrc = Vizor.embedOrigin + '/embed/{{graph.owner}}/{{graph.name}}'
{{else}}
Vizor.shareURL = window.location.origin
Vizor.embedSrc = window.location.origin
Vizor.shareURL = Vizor.origin
Vizor.embedSrc = Vizor.embedOrigin
{{/if}}
{{#if autoplay}}
Expand Down
2 changes: 1 addition & 1 deletion views/partials/playerShareDialog.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<section id="embedSource" class="collapsible">
<label><a href="#embedcode" class="trigger">Embed code</a></label>
<textarea id="embedcode" class="scrollbar target" readonly
><script src="{{origin}}/scripts/embed.js" data-vizorurl="{{embedSrc}}" /></textarea>
><script src="{{embedOrigin}}/scripts/embed.js" data-vizorurl="{{embedSrc}}" /></textarea>
</section>
</article>

0 comments on commit 0f30744

Please sign in to comment.