Golden-ifpass

ifpass-1.7.1

Sep 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ifpass 1.7.1 by Golden. Paste into a bookmark to use. Have fun! I am not liable for any consequences of you misusing this code. You are allowed to modify this code as long as I am credited as the original creator. */
  2. var version = "ifpass 1.7.1 by Golden";
  3. var scriptString = `
  4. var homePage = "https://web.archive.org";
  5. var version = "` + version + `";
  6. var news = "NEW:\\n - Bookmarks!\\n - Type javascript:ifpass(\\"https://web.archive.org\\"); into a bookmark\\n   and click it while ifpass is loaded!\\n - You can now use Enter to submit URLs!";
  7. var features = "Features:\\n - Doesn't save to search history.\\n - Works in Firefox and Chrome.\\n - Includes fully functional home button.\\n - Reload to reset page.";
  8. var todo = "TODO:\\n - A way to save the home URL.\\n - Display errors when websites don't support iframes.";
  9. var help = ()=> {
  10.     alert(version + "\\n" + news + "\\n" + features + "\\n" + todo);
  11. };
  12. var getHomepage = () => {
  13.     return homePage;
  14. };
  15. var setHomepage = ()=> {
  16.     homePage = prompt("Homepage?\\n(Cancel to reset to default.)", homePage);
  17.     if (!homePage) {
  18.         homePage = "https://web.archive.org";
  19.     }
  20. };
  21. var goto = (page) => {
  22.     loadedPage.src = page;
  23. };
  24. var ifpass = goto;`;
  25.  
  26. document.body.innerHTML = ``;
  27. var style = document.createElement("style");
  28. style.innerHTML = `
  29.     element {
  30.         border: 0;
  31.         margin: 0;
  32.         font-size:100%;
  33.         line-height:1;
  34.         font-family: "tahoma"
  35.     }
  36.     body {
  37.         border: 0;
  38.         margin: 0;
  39.     }
  40. `;
  41. document.body.appendChild(style);
  42.  
  43. var script = document.createElement("script");
  44. script.innerHTML = scriptString;
  45. document.body.appendChild(script);
  46.  
  47. document.body.innerHTML += `
  48. <div align="center">
  49.     <button onclick="help();" >?</button>
  50.      | <button onclick="setHomepage();" >Change</button>
  51.      <button onclick="loadedPage.src = homePage;" ></button>
  52.      | <input type="text" id="textBox" style="width: 40%" value="https://web.archive.org" ></input>
  53.     <button onclick="goto(textBox.value);" >Go!</button>
  54.      | <button onclick="loadedPage.src += '';" ></button>
  55. </div>
  56.  
  57. <iframe id="loadedPage" onload="textBox.value = loadedPage.src" frameBorder="0" ` +
  58. `sandbox="allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-same-origin allow-scripts" ` +
  59. `src="https://web.archive.org" width=100% height=96.5%>Your browser does not support ifpass, which uses IFrames. Please upgrade your browser.</iframe>
  60.  
  61. <noscript>Your browser does not support ifpass, which uses Javascript scripts. Please enable scripts.</noscript>
  62. `;
  63.  
  64. var node = document.getElementsByTagName("input")[0];
  65. node.addEventListener("keyup", function(event) {
  66.     if (event.key === "Enter") {
  67.         goto(textBox.value);
  68.     }
  69. });
  70.  
  71.  
  72. console.log(version + ". Pastebin: https://pastebin.com/ayGirY13");
Add Comment
Please, Sign In to add comment