SHARE
TWEET

Untitled

a guest May 24th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function handleClick () {
  2.   var name = document.getElementsByName("Name")[0];
  3.   var zutaten = document.getElementsByName("Zutaten")[0];
  4.   var zubereitung = document.getElementsByName("Zubereitung")[0];
  5.  
  6.   var new_doc = document.implementation.createHTMLDocument(name.value);
  7.   //Add Meta Tags
  8.   var meta = document.createElement("meta");
  9.   meta.name = "viewport";
  10.   meta.content = "width=device-width, initial-scale=1.0";
  11.  
  12.   new_doc.head.appendChild(meta);
  13.   new_doc.head.innerHTML = "<meta charset=\"UTF-8\">" + new_doc.head.innerHTML;
  14.  
  15.   //Add the fucking rest
  16.   var p = document.createElement("a");
  17.   p.innerText = "Zurück zur Übersicht";
  18.   p.href = "/index";
  19.   new_doc.body.appendChild(p);
  20.  
  21.   new_doc.body.appendChild(document.createElement("br"));
  22.   new_doc.body.appendChild(document.createElement("br"));
  23.  
  24.   var div = document.createElement("div");
  25.   var a = document.createElement("a");
  26.   a.style.fontSize = "40px"
  27.   a.textContent = name.value;
  28.   div.appendChild(a);
  29.   new_doc.body.appendChild(div);
  30.  
  31.   new_doc.body.appendChild(document.createElement("br"));
  32.   new_doc.body.appendChild(document.createElement("br"));
  33.  
  34.   div = document.createElement("div");
  35.   div.style.fontSize = "30px";
  36.   div.textContent = "Zutaten:"
  37.   new_doc.body.appendChild(div);
  38.  
  39.   var unorderList = document.createElement("ul");
  40.   var zutaten_arr = zutaten.value.split("\n");
  41.   for (var i = 0; i < zutaten_arr.length; i++) {
  42.       var li = document.createElement("li");
  43.       li.innerText = zutaten_arr[i];
  44.       unorderList.appendChild(li);
  45.   }
  46.   new_doc.body.appendChild(unorderList);
  47.   new_doc.body.appendChild(document.createElement("br"));
  48.   new_doc.body.appendChild(document.createElement("br"));
  49.  
  50.   div = document.createElement("div");
  51.   div.innerText = "Zubereitung:";
  52.   div.style.fontSize = "30px";
  53.  
  54.   new_doc.body.appendChild(div);
  55.  
  56.   var orderedList = document.createElement("ol");
  57.   var zubereitungs_arr = zubereitung.value.split("\n");
  58.   for (i = 0; i < zubereitungs_arr.length; i++) {
  59.      var oli = document.createElement("li");
  60.       oli.innerText = zubereitungs_arr[i];
  61.       orderedList.appendChild(oli);
  62.   }
  63.   new_doc.body.appendChild(orderedList);
  64.  
  65.   window.open("https://html-captnrafaelh967062.codeanyapp.com/place_content.php?name=" + name.value + "&head=" + new_doc.head.outerHTML + "&body=" + new_doc.body.outerHTML, "_top");
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top