detail.ejs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <!DOCTYPE html>
  2. <html lang="<%= lang %>">
  3. <head>
  4. <%- include('common-meta') %>
  5. <link rel="stylesheet" href="/stylesheets/styles.css">
  6. <link rel="stylesheet" href="/stylesheets/header.css">
  7. <link rel="stylesheet" href="/stylesheets/detail.css">
  8. <script type="application/ld+json">
  9. {
  10. "@context": "https://schema.org",
  11. "@type": "CreativeWork",
  12. "name": "<%= translate.printableColoringPage[lang] %>: <%= detail.title %>",
  13. "description": "<%= detail.desc %>",
  14. "url": "https://art.pcoloring.com<%= uri %>",
  15. "image": "<%= detail.thumb %>",
  16. "category": "<%= detail.tags[0] %>",
  17. "keywords": "coloring page, <%= detail.title %>, color by number, paint by number, free, printable, <%= detail.tags.join() %>",
  18. "contentRating": "General Audience",
  19. "mainEntityOfPage": "https://art.pcoloring.com<%= uri %>",
  20. "publisher": {
  21. "@type": "Organization",
  22. "name": "JCCY",
  23. "logo": {
  24. "@type": "ImageObject",
  25. "url": "https://art.pcoloring.com/assets/icon/icon.webp"
  26. }
  27. },
  28. "offers": {
  29. "@type": "Offer",
  30. "priceCurrency": "USD",
  31. "price": "0.00",
  32. "eligibleRegion": {
  33. "@type": "Place",
  34. "name": "Worldwide"
  35. },
  36. "url": "https://art.pcoloring.com<%= uri %>"
  37. },
  38. "author": {
  39. "@type": "Person",
  40. "name": "<%= detail.user.username %>"
  41. },
  42. "datePublished": "<%= detail.publishTime %>"
  43. }
  44. </script>
  45. </head>
  46. <!-- Google tag (gtag.js) -->
  47. <script async src="https://www.googletagmanager.com/gtag/js?id=G-JBGGVGLHTP"></script>
  48. <script>
  49. window.dataLayer = window.dataLayer || [];
  50. function gtag() { dataLayer.push(arguments); }
  51. gtag('js', new Date());
  52. gtag('config', 'G-JBGGVGLHTP');
  53. </script>
  54. <body>
  55. <%- include('header') %>
  56. <div class="details">
  57. <div class="poster"><img src="<%= detail.thumb %>" alt="<%= detail.title %>"></div>
  58. <div class="description">
  59. <h1>
  60. <%= detail.title %>
  61. </h1>
  62. <p>
  63. <%= translate.artist[lang] %>: <a href="/<%= lang %>/artist/<%= detail.user._id %>"
  64. class="tag-button">
  65. <%= detail.user.username %>
  66. </a>
  67. </p>
  68. <p>
  69. <%= translate.publishTime[lang] %>: <%= detail.publishTime %>
  70. </p>
  71. <p>
  72. <%= translate.tag[lang] %>:
  73. <% detail.tags.forEach(tag=> { %>
  74. <a href="/<%= lang %>/tag/<%= tag %>" class="tag-button">
  75. <%= tag %>
  76. </a>
  77. <% }); %>
  78. </p>
  79. <h2 style="font-size: 16px; font-weight:normal;">
  80. <%= detail.copy ?? detail.desc %>
  81. </h2>
  82. <div class="button-wrapper">
  83. <a href="/play/<%= detail._id %>" class="play-button">
  84. <%= translate.play[lang] %>
  85. </a>
  86. <a id="downloadBtn" class="play-button" style="background-color: lightseagreen;">
  87. <%= translate.download[lang] %>
  88. </a>
  89. </div>
  90. </div>
  91. </div>
  92. <p style=" display: flex; justify-content: center; color: #777; font-size: 18px; font-weight: 500;">
  93. <%= translate.mayYouLike[lang] %>:
  94. </p>
  95. <div class="content" style="margin-bottom: 40px;">
  96. <div class="image-grid">
  97. <% relates.forEach(item=> { %>
  98. <div class="image-card">
  99. <a href="<%= item.uri %>"><img src="<%= item.thumb %>" alt="<%= item.title %>"></a>
  100. <div class="card-title">
  101. <%= item.title %>
  102. </div>
  103. </div>
  104. <% }); %>
  105. </div>
  106. </div>
  107. <%- include('pagination') %>
  108. <script>
  109. // document.getElementById('downloadBtn').addEventListener('click', function () {
  110. // var link = document.createElement('a');
  111. // link.style.display = 'none';
  112. // link.href = '<%= detail.downlink %>';
  113. // link.download = '<%= detail._id %>.jpeg';
  114. // document.body.appendChild(link);
  115. // link.click();
  116. // document.body.removeChild(link);
  117. // });
  118. document.getElementById('downloadBtn').addEventListener('click', function () {
  119. const imageUrl = '<%= detail.downlink %>';
  120. fetch(imageUrl)
  121. .then(response => {
  122. if (!response.ok) {
  123. throw new Error('Network response was not ok');
  124. }
  125. return response.blob();
  126. })
  127. .then(blob => {
  128. const url = URL.createObjectURL(blob);
  129. const a = document.createElement('a');
  130. a.style.display = 'none';
  131. a.href = url;
  132. a.download = '<%= detail._id %>.webp';
  133. document.body.appendChild(a);
  134. a.click();
  135. URL.revokeObjectURL(url);
  136. document.body.removeChild(a);
  137. })
  138. .catch(error => {
  139. console.error('Image Download Error:', error);
  140. });
  141. });
  142. </script>
  143. </body>
  144. </html>