|
@@ -8,6 +8,10 @@
|
|
|
<link rel="stylesheet" href="/stylesheets/header.css">
|
|
<link rel="stylesheet" href="/stylesheets/header.css">
|
|
|
<link rel="stylesheet" href="/stylesheets/detail.css">
|
|
<link rel="stylesheet" href="/stylesheets/detail.css">
|
|
|
|
|
|
|
|
|
|
+ <script type="text/javascript"
|
|
|
|
|
+ src="https://platform-api.sharethis.com/js/sharethis.js#property=67e0d66a54a3d000192a4615&product=inline-share-buttons&source=platform"
|
|
|
|
|
+ async="async"></script>
|
|
|
|
|
+
|
|
|
<script type="application/ld+json">
|
|
<script type="application/ld+json">
|
|
|
{
|
|
{
|
|
|
"@context": "https://schema.org",
|
|
"@context": "https://schema.org",
|
|
@@ -61,37 +65,54 @@
|
|
|
<div class="details">
|
|
<div class="details">
|
|
|
<div class="poster"><img src="<%= detail.thumb %>" alt="<%= detail.title %>"></div>
|
|
<div class="poster"><img src="<%= detail.thumb %>" alt="<%= detail.title %>"></div>
|
|
|
<div class="description">
|
|
<div class="description">
|
|
|
- <h1>
|
|
|
|
|
- <%= detail.title %>
|
|
|
|
|
- </h1>
|
|
|
|
|
- <p>
|
|
|
|
|
- <%= translate.artist[lang] %>: <a href="/<%= lang %>/artist/<%= detail.user._id %>"
|
|
|
|
|
- class="tag-button">
|
|
|
|
|
- <%= detail.user.username %>
|
|
|
|
|
- </a>
|
|
|
|
|
- </p>
|
|
|
|
|
- <p>
|
|
|
|
|
- <%= translate.publishTime[lang] %>: <%= detail.publishTime %>
|
|
|
|
|
- </p>
|
|
|
|
|
- <p>
|
|
|
|
|
- <%= translate.tag[lang] %>:
|
|
|
|
|
- <% detail.tags.forEach(tag=> { %>
|
|
|
|
|
- <a href="/<%= lang %>/tag/<%= tag %>" class="tag-button">
|
|
|
|
|
- <%= tag %>
|
|
|
|
|
- </a>
|
|
|
|
|
- <% }); %>
|
|
|
|
|
- </p>
|
|
|
|
|
- <h2 style="font-size: 16px; font-weight:normal;">
|
|
|
|
|
- <%= detail.copy ?? detail.desc %>
|
|
|
|
|
- </h2>
|
|
|
|
|
- <div class="button-wrapper">
|
|
|
|
|
- <a href="/play/<%= detail._id %>" class="play-button">
|
|
|
|
|
- <%= translate.play[lang] %>
|
|
|
|
|
- </a>
|
|
|
|
|
- <a id="downloadBtn" class="play-button" style="background-color: lightseagreen;">
|
|
|
|
|
- <%= translate.download[lang] %>
|
|
|
|
|
- </a>
|
|
|
|
|
|
|
+ <div style="display: flex; justify-content: space-between;">
|
|
|
|
|
+ <h1>
|
|
|
|
|
+ <%= detail.title %>
|
|
|
|
|
+ </h1>
|
|
|
|
|
+ <div class="sharethis-inline-share-buttons"></div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <% if (detail.totalStartCount> 0) { %>
|
|
|
|
|
+ <div style="color:gray;">
|
|
|
|
|
+ <%=detail.totalStartCount%>
|
|
|
|
|
+ <%= translate.interested[lang] %>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <% } %>
|
|
|
|
|
+ <p>
|
|
|
|
|
+ <%= translate.artist[lang] %>: <a href="/<%= lang %>/artist/<%= detail.user._id %>"
|
|
|
|
|
+ class="tag-button">
|
|
|
|
|
+ <%= detail.user.username %>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <p>
|
|
|
|
|
+ <%= translate.publishTime[lang] %>: <%= detail.publishTime %>
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <p>
|
|
|
|
|
+ <%= translate.tag[lang] %>:
|
|
|
|
|
+ <% detail.tags.forEach(tag=> { %>
|
|
|
|
|
+ <a href="/<%= lang %>/tag/<%= tag %>" class="tag-button">
|
|
|
|
|
+ <%= tag %>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <% }); %>
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <p>
|
|
|
|
|
+ <%= detail.copy ?? detail.desc %>
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <div class="button-wrapper">
|
|
|
|
|
+ <a href="/play/<%= detail._id %>" class="play-button">
|
|
|
|
|
+ <%= translate.play[lang] %>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <a id="appBtn" class="play-button" style="background-color: darkolivegreen;">
|
|
|
|
|
+ <%= translate.playOnApp[lang] %>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <a href="/download/pdf/<%= detail._id %>" class="play-button"
|
|
|
|
|
+ style="background-color: lightseagreen;">
|
|
|
|
|
+ <%= translate.download[lang] %>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <a id="printBtn" onclick="printImage('<%= detail._id %>')" class="play-button"
|
|
|
|
|
+ style="background-color: black;">
|
|
|
|
|
+ <%= translate.print[lang] %>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -116,41 +137,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- // document.getElementById('downloadBtn').addEventListener('click', function () {
|
|
|
|
|
- // var link = document.createElement('a');
|
|
|
|
|
- // link.style.display = 'none';
|
|
|
|
|
- // link.href = '<%= detail.downlink %>';
|
|
|
|
|
- // link.download = '<%= detail._id %>.jpeg';
|
|
|
|
|
- // document.body.appendChild(link);
|
|
|
|
|
- // link.click();
|
|
|
|
|
- // document.body.removeChild(link);
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- document.getElementById('downloadBtn').addEventListener('click', function () {
|
|
|
|
|
- const imageUrl = '<%= detail.downlink %>';
|
|
|
|
|
- fetch(imageUrl)
|
|
|
|
|
- .then(response => {
|
|
|
|
|
- if (!response.ok) {
|
|
|
|
|
- throw new Error('Network response was not ok');
|
|
|
|
|
- }
|
|
|
|
|
- return response.blob();
|
|
|
|
|
- })
|
|
|
|
|
- .then(blob => {
|
|
|
|
|
- const url = URL.createObjectURL(blob);
|
|
|
|
|
- const a = document.createElement('a');
|
|
|
|
|
- a.style.display = 'none';
|
|
|
|
|
- a.href = url;
|
|
|
|
|
- a.download = '<%= detail._id %>.webp';
|
|
|
|
|
- document.body.appendChild(a);
|
|
|
|
|
- a.click();
|
|
|
|
|
- URL.revokeObjectURL(url);
|
|
|
|
|
- document.body.removeChild(a);
|
|
|
|
|
- })
|
|
|
|
|
- .catch(error => {
|
|
|
|
|
- console.error('Image Download Error:', error);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ function isMobileDevice() {
|
|
|
|
|
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ window.onload = function () {
|
|
|
|
|
+ if (isMobileDevice()) {
|
|
|
|
|
+ const printBtn = document.getElementById('printBtn');
|
|
|
|
|
+ printBtn.style.display = 'none'; // 移动端隐藏打印按钮
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ document.getElementById('appBtn').addEventListener('click', function () {
|
|
|
|
|
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
|
|
|
+
|
|
|
|
|
+ // Android 检测
|
|
|
|
|
+ if (/android/i.test(userAgent)) {
|
|
|
|
|
+ window.location.href = 'https://play.google.com/store/apps/details?id=com.pcoloring.art.puzzle.color.by.number';
|
|
|
|
|
+ }
|
|
|
|
|
+ // iOS 检测
|
|
|
|
|
+ else if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
|
|
|
|
|
+ window.location.href = 'https://apps.apple.com/gb/app/art-number-coloring-book/id1575480118';
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其他操作系统(例如桌面)
|
|
|
|
|
+ else {
|
|
|
|
|
+ // 可以显示一个提示,或者跳转到通用的下载页面
|
|
|
|
|
+ console.log('无法确定操作系统,或者为桌面操作系统');
|
|
|
|
|
+ window.location.href = 'https://pcoloring.com/anc/';
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ async function printImage(id) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const response = await fetch(`/download/pdf/${id}`);
|
|
|
|
|
+
|
|
|
|
|
+ if (!response.ok) {
|
|
|
|
|
+ throw new Error(`HTTP error! status: ${response.status}`);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const pdfBlob = await response.blob();
|
|
|
|
|
+ const pdfUrl = URL.createObjectURL(pdfBlob);
|
|
|
|
|
+
|
|
|
|
|
+ const printWindow = window.open(pdfUrl, '_blank');
|
|
|
|
|
+ printWindow.onload = () => {
|
|
|
|
|
+ printWindow.print();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ URL.revokeObjectURL(pdfUrl); // 释放 URL 对象
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('Error printing image:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
</body>
|
|
</body>
|
|
|
|
|
|