-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagreement-embed.js
More file actions
23 lines (21 loc) · 897 Bytes
/
Copy pathagreement-embed.js
File metadata and controls
23 lines (21 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function () {
var iframe = document.createElement('iframe');
iframe.src = 'https://cuny-libraries.github.io/caw-forms/agreement.html?embed=1';
iframe.title = 'Author Submission Agreement';
iframe.style.cssText = 'width:100%;border:none;display:block;min-height:600px;';
iframe.setAttribute('scrolling', 'no');
// Resize iframe to fit content as user interacts with the form
window.addEventListener('message', function (e) {
if (e.origin === 'https://cuny-libraries.github.io' && e.data && e.data.cawIframeHeight) {
iframe.style.height = (e.data.cawIframeHeight + 24) + 'px';
}
});
// document.currentScript is null when the script is deferred/async
var scriptEl = document.currentScript ||
document.querySelector('script[src*="agreement-embed"]');
if (scriptEl) {
scriptEl.parentNode.replaceChild(iframe, scriptEl);
} else {
document.body.appendChild(iframe);
}
})();