Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var proto = Object.create(HTMLElement.prototype);
  2. proto.jsonpcallback = function(result) {
  3.     //...
  4. }
  5.  
  6. proto.attachedCallback = function() {
  7.     var requestURL = "https://www.openthesaurus.de/synonyme/search?q=";
  8.     requestURL += this.getAttribute("word").substr(1, this.getAttribute("word").length - 2);
  9.     requestURL += "&format=application/json&callback=proto.jsonpcallback";
  10.  
  11.     var script = document.createElement('script');
  12.     script.type = "text/javascript";
  13.     script.src = requestURL;
  14.     document.body.appendChild(script);
  15. };
  16. var XComponent = document.registerElement('synonym-list', {
  17.     prototype: proto
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement