(function () { let xhr = new XMLHttpRequest(); xhr.open('GET', 'https://office.iterios.com/widgets/741jq1vZyCm2LuFHu63cb0Nm03Cv3NhM?v=1730420'); xhr.send(); xhr.onload = function() { if (xhr.status != 200) { console.log(xhr.status + ':' + xhr.statusText); } else { let content = xhr.response.trim(); let root_node = document.createElement('div'); root_node.innerHTML = content; let elements_for_paste = []; let root_children = root_node.children; for (let i=0, root_child; root_child=root_children[i]; i++) { elements_for_paste.push(parseNode(root_child)) } for (let i=0; i <= (elements_for_paste.length - 1); i++) { document.getElementById('iterios_widget_container').appendChild(elements_for_paste[i]); } function parseNode(node) { // Create new element let parsed_node = document.createElement(node.tagName); parsed_node.innerHTML = node.innerHTML; // Set new element attributes let node_attributes = node.attributes; for(let i = node_attributes.length - 1; i >= 0; i--) { parsed_node.setAttribute(node_attributes[i].name, node_attributes[i].value); } // Append children nodes in new element let node_children = node.children; if (node_children.length > 0) { parsed_node.innerHTML = ''; for (let i=0, node_child; node_child=node_children[i]; i++) { parsed_node.appendChild(parseNode(node_child)) } } // Return new element return parsed_node; } } } })();