detail.ejs 6.8 KB

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