Skip to content

Commit

Permalink
Embed hypothesis and add subFrameIdentifier config
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescdavis committed Jan 19, 2018
1 parent 50e62b1 commit 028960a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mfr/extensions/pdf/render.py
Expand Up @@ -13,7 +13,7 @@ class PdfRenderer(extension.BaseRenderer):
]).get_template('viewer.mako')

def render(self):
return self.TEMPLATE.render(base=self.assets_url, url=self.metadata.download_url)
return self.TEMPLATE.render(base=self.assets_url, url=self.metadata.download_url, unique_key=self.metadata.unique_key)

@property
def file_required(self):
Expand Down
6 changes: 4 additions & 2 deletions mfr/extensions/pdf/templates/viewer.mako
Expand Up @@ -37,11 +37,13 @@ http://sourceforge.net/adobe/cmap/wiki/License/

<script src="debugger.js"></script>
<script src="viewer.js"></script>
<!-- Set domain to domain suffix for iframe same-origin (https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) -->
<script>window.document.domain = (location.host.match(/([^\.:]+\.?[^\.:]+)(?::\d+)?$/) || [])[1];</script>
</head>

<body tabindex="1" class="loadingInProgress">
<script type="application/json" class="js-hypothesis-config">
{ "subFrameIdentifier": "${unique_key}" }
</script>
<script src="https://hypothes.is/embed.js"></script>
<div id="outerContainer">

<div id="sidebarContainer">
Expand Down

0 comments on commit 028960a

Please sign in to comment.