Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. javascript: var imgs = document.getElementsByTagName("img");
  2.  
  3. function download(data, filename, type) {
  4. var file = new Blob([data], {
  5. type: type
  6. });
  7. if (window.navigator.msSaveOrOpenBlob) window.navigator.msSaveOrOpenBlob(file, filename);
  8. else {
  9. var a = document.createElement("a"),
  10. url = URL.createObjectURL(file);
  11. a.href = url;
  12. a.download = filename;
  13. document.body.appendChild(a);
  14. a.click();
  15. setTimeout(function() {
  16. document.body.removeChild(a);
  17. window.URL.revokeObjectURL(url);
  18. }, 0);
  19. }
  20. }
  21.  
  22. function getElementsByXPath(xpath, parent) {
  23. let results = [];
  24. let query = document.evaluate(xpath, parent || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  25. for (let i = 0, length = query.snapshotLength; i < length; ++i) {
  26. results.push(query.snapshotItem(i));
  27. }
  28. return results;
  29. }
  30. var imgSrcs = [];
  31. var p1 = getElementsByXPath("/html/head/meta[13]")[0].content.split("_")[0];
  32. var lembar = Number(getElementsByXPath('/html/body/script[6]/text()')[0].data.split('"pageCount":')[1].split(',')[0]);
  33. var judul = document.title.replace(" - issuu", "");
  34. for (var i = 1; i <= lembar; i++) {
  35. imgSrcs.push(p1 + "_" + i + ".jpg")
  36. }
  37. var turl = "";
  38. var hasil = "<!DOCTYPE html>";
  39. hasil = hasil + "<html lang='en'>";
  40. hasil = hasil + " <head>";
  41. hasil = hasil + " <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
  42. hasil = hasil + " <meta http-equiv='X-UA-Compatible' content='IE=edge'>";
  43. hasil = hasil + " <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'>";
  44. hasil = hasil + " <title>" + judul + "</title>";
  45. hasil = hasil + " <meta name='description' content='lightGallery lets you to create animated thumbnails for your gallery with the help of thumbnail plugin.'>";
  46. hasil = hasil + " <link href='https://sachinchoolur.github.io/lightGallery/static/css/main.css' rel='stylesheet'>";
  47. hasil = hasil + " <link href='https://sachinchoolur.github.io/lightGallery/static/css/justifiedGallery.min.css' rel='stylesheet'>";
  48. hasil = hasil + " <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>";
  49. hasil = hasil + " <link href='https://sachinchoolur.github.io/lightGallery/lightgallery/css/lightgallery.css' rel='stylesheet'>";
  50. hasil = hasil + " </head>";
  51. hasil = hasil + " <body class='demos'>";
  52. hasil = hasil + " <section class='section pdb0'>";
  53. hasil = hasil + " <div class='container-fluid'>";
  54. hasil = hasil + " <div class='section-header has-desc mrb50'>";
  55. hasil = hasil + " <h3 class='page-header mrb15'><a href='" + window.location + "'>" + judul + "</a></h3>";
  56. hasil = hasil + " </div>";
  57. hasil = hasil + " <div class='demo-gallery mrb30'>";
  58. hasil = hasil + " <div id='aniimated-thumbnials' class='list-unstyled justified-gallery' style='height: 800px;'>";
  59. for (var i = 0; i < imgSrcs.length; i++) {
  60. turl = imgSrcs[i].replace(".jpg", "_thumb_medium.jpg");
  61. hasil = hasil + " <a class='jg-entry hoverZoomLink' href='" + imgSrcs[i] + "' data-sub-html='" + judul + " " + i + "' style='width: 187px; height: 126.144px; top: 6px; left: 6px; opacity: 1;'>";
  62. hasil = hasil + " <img class='img-responsive' src='" + turl + "' style='width: 187px; height: 127px; margin-left: -93.5px; margin-top: -63.5px;'>";
  63. hasil = hasil + " <div class='demo-gallery-poster'><img src='https://sachinchoolur.github.io/lightGallery/static/img/zoom.png'></div>";
  64. hasil = hasil + " </a>";
  65. }
  66. hasil = hasil + " </div>";
  67. hasil = hasil + " </div>";
  68. hasil = hasil + " </div>";
  69. hasil = hasil + " </section>";
  70. hasil = hasil + " <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'></script>";
  71. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/static/js/prettify.js'></script>";
  72. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/static/js/jquery.justifiedGallery.min.js'></script>";
  73. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/static/js/transition.js'></script>";
  74. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/static/js/collapse.js'></script>";
  75. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/lightgallery/js/lightgallery.js'></script>";
  76. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/lightgallery/js/lg-fullscreen.js'></script>";
  77. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/lightgallery/js/lg-thumbnail.js'></script>";
  78. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/lightgallery/js/lg-video.js'></script>";
  79. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/lightgallery/js/lg-autoplay.js'></script>";
  80. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/lightgallery/js/lg-zoom.js'></script>";
  81. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/external/jquery.mousewheel.min.js'></script>";
  82. hasil = hasil + " <script src='https://sachinchoolur.github.io/lightGallery/static/js/demos.js'></script>";
  83. hasil = hasil + " </body>";
  84. hasil = hasil + "</html>";
  85. download(hasil, judul + ".html", "text/html")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement