-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimplyedit-loader.js
More file actions
27 lines (23 loc) · 969 Bytes
/
simplyedit-loader.js
File metadata and controls
27 lines (23 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(function createSimplyEditScriptTag(window, document, elementName, functionName, element, siblingElement) {
function setAttribute(p_sName, p_sValue, p_sHost) {
if (p_sHost === undefined || p_sHost === window.location.host) {
element.setAttribute(p_sName, p_sValue);
}
}
element = element || document.createElement(elementName);
element.async = 1;
element.src = 'https://cdn.simplyedit.io/1/simply-edit.js';
siblingElement = siblingElement || document.scripts[0];
siblingElement.parentNode.insertBefore(element, siblingElement);
window[functionName] = window[functionName] || {
key: function (p_sKey, p_sHost) {
setAttribute('data-api-key', p_sKey, p_sHost);
},
set: function (p_sName, p_sValue, p_sHost) {
setAttribute('data-simply-' + p_sName, p_sValue, p_sHost);
},
src: function (p_sValue, p_sHost) {
setAttribute('src', p_sValue, p_sHost);
}
};
})(window, document, 'script', 'simply');