Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var proto = Object.create(HTMLElement.prototype);
- proto.jsonpcallback = function(result) {
- //...
- }
- proto.attachedCallback = function() {
- var requestURL = "https://www.openthesaurus.de/synonyme/search?q=";
- requestURL += this.getAttribute("word").substr(1, this.getAttribute("word").length - 2);
- requestURL += "&format=application/json&callback=proto.jsonpcallback";
- var script = document.createElement('script');
- script.type = "text/javascript";
- script.src = requestURL;
- document.body.appendChild(script);
- };
- var XComponent = document.registerElement('synonym-list', {
- prototype: proto
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement