Advertisement
basictomonokai

ApiFlash

Mar 5th, 2020
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  6.  
  7. <link href="https://fonts.googleapis.com/earlyaccess/mplus1p.css" rel="stylesheet" />
  8. <style>
  9. body {
  10. font-family: "Rounded Mplus 1c";
  11. font-size: 100%;
  12. color: #ecf0f1;
  13. background: #27ae60;
  14. }
  15.  
  16. #kkaf {
  17. font-size: 1.5rem;
  18. margin: 10px;
  19. }
  20.  
  21. #inp {
  22. font-size: 1.5rem;
  23. margin: 10px;
  24. }
  25.  
  26. </style>
  27.  
  28. <title>スクショ</title>
  29.  
  30.  
  31.  
  32. <style>
  33.  
  34. #buttonx {
  35. width:200px;
  36. color:#ffffff;
  37. background:#e67e22;
  38. font-family: fantasy,sans-serif;
  39. font-size:24px;
  40. font-weight:bold;
  41. text-shadow:0 1px 0px #143352,0 2px 0px #143352;
  42. text-align:center;
  43. display:inline-block;
  44. text-decoration:none;
  45. border:1px solid #225588;
  46. padding:5px 0 2px 0;
  47. border-radius:5px;
  48. margin-bottom:20px;
  49. margin-left:10px;
  50. opacity: 0.7;
  51. }
  52.  
  53. </style>
  54.  
  55. <style>
  56.  
  57. div#footer-fixed
  58. {
  59. position: fixed; /* フッターの固定 */
  60. bottom: 0px; /* 位置(下0px) */
  61. left: 0px; /* 位置(左0px) */
  62. width: 100%; /* 横幅100% */
  63. height: 70px; /* 縦幅70px */
  64. }
  65.  
  66.  
  67. div#body-bk{
  68. padding: 0px 0 80px 0; /* 下に80pxを余白を取る */
  69. }
  70.  
  71. </style>
  72.  
  73.  
  74.  
  75. </head>
  76.  
  77. <body>
  78. <h1>WEBサイトをスクショ</h1>
  79.  
  80. <div id="body-bk">
  81.  
  82. <div id="kkaf">
  83. <input id="inp" type="text" name="namae" size="50" placeholder="ここにURLを入力"><br>
  84. <a id="buttonx" onmouseover="this.style.background='#e67e22'" onmouseout="this.style.background='#d35400'" onclick="this.style.background='#e74c3c';urlscr()">スクショ</a>
  85. <a id="buttonx" onmouseover="this.style.background='#e67e22'" onmouseout="this.style.background='#d35400'" onclick="this.style.background='#e74c3c';urlclr()">クリア</a>
  86. <br>
  87. <img id="image" src="http://placehold.jp/24/cccccc/ffffff/400x300.png?text=ここに結果が表示">
  88. </div>
  89.  
  90. </div>
  91.  
  92. <div id="footer-fixed">
  93.  
  94. </div>
  95.  
  96.  
  97. <script>
  98. function urlscr() {
  99. var myImage = document.getElementById('image');
  100. var myInput = encodeURIComponent(document.getElementById('inp').value);
  101.  
  102. var myRequest = 'https://api.apiflash.com/v1/urltoimage?access_key=xxxxxx&url='+myInput;
  103.  
  104. fetch(myRequest)
  105. .then(response => response.blob())
  106. .then(function(myBlob) {
  107. var objectURL = URL.createObjectURL(myBlob);
  108. myImage.src = objectURL;
  109. myImage.width = 500;
  110. });
  111. }
  112.  
  113.  
  114. function urlclr() {
  115. var myImage = document.getElementById('image');
  116. myImage.src = 'http://placehold.jp/24/cccccc/ffffff/400x300.png?text=ここに結果が表示';
  117. document.getElementById('inp').value = '';
  118. }
  119.  
  120. </script>
  121.  
  122. </body>
  123.  
  124. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement