diff --git a/src/assets/js/parts/wish.js b/src/assets/js/parts/wish.js
new file mode 100644
index 00000000..bb13823c
--- /dev/null
+++ b/src/assets/js/parts/wish.js
@@ -0,0 +1,3 @@
+$(function () {
+
+});
diff --git a/src/classes/page.php b/src/classes/page.php
index dfd4fe64..dddef72a 100644
--- a/src/classes/page.php
+++ b/src/classes/page.php
@@ -120,7 +120,9 @@ class Page
public array $messages = array();
public string $link_preview;
public string $description;
+
public array $stylesheets = array();
+ public array $scripts = array();
/**
* __construct
@@ -236,6 +238,23 @@ class Page
'default' => 'src/assets/css/default.css',
'dark' => 'src/assets/css/default/dark.css',
);
+
+ /**
+ * Scripts
+ */
+ $this->scripts = array(
+ 'j-query' => 'node_modules/jquery/dist/jquery.min.js',
+ 'fomantic-ui' => 'semantic/dist/semantic.min.js',
+ 'default' => 'src/assets/js/default.js',
+ );
+
+ /** html2canvas */
+ $CrawlerDetect = new \Jaybizzle\CrawlerDetect\CrawlerDetect();
+
+ if ($CrawlerDetect->isCrawler()) {
+ $this->scripts['html-2-canvas-1'] = 'node_modules/html2canvas/dist/html2canvas.min.js';
+ $this->scripts['html-2-canvas-2'] = 'src/assets/js/html2canvas.js';
+ }
}
public function header(): void
@@ -319,56 +338,25 @@ class Page
}
/**
- * Inline script
+ * Scripts
*/
+ /** Inline */
require ROOT . '/src/assets/js/inline.js.php';
- /** jQuery */
- $scriptjQuery = 'node_modules/jquery/dist/jquery.min.js';
- $scriptjQueryModified = filemtime($scriptjQuery);
- ?>
-
- name . '.js';
- /** Fomantic */
- $scriptFomantic = 'semantic/dist/semantic.min.js';
- $scriptFomanticModified = filemtime($scriptFomantic);
- ?>
-
- isCrawler()) {
- $scripthtml2canvas1 = 'node_modules/html2canvas/dist/html2canvas.min.js';
- $scripthtml2canvas1Modified = filemtime($scripthtml2canvas1);
- ?>
-
-
-
- scripts['page'] = $script_page;
}
- /** Default */
- $scriptDefault = 'src/assets/js/default.js';
- $scriptDefaultModified = filemtime($scriptDefault);
- ?>
-
- name . '.js';
-
- if (file_exists($scriptPage)) {
- $scriptPageModified = filemtime($scriptPage);
-
+ foreach ($this->scripts as $script_page) {
+ $hash = hash_file('crc32', $script_page);
?>
-
+
advertisements || $CrawlerDetect->isCrawler())) {
+ if (
+ in_array($_SERVER['HTTP_HOST'], $wishthis_hosts, true)
+ && (true === $user->advertisements || $CrawlerDetect->isCrawler())
+ ) {
?>
-
+
diff --git a/src/pages/wishlist.php b/src/pages/wishlist.php
index 4f8f7cd7..81032638 100644
--- a/src/pages/wishlist.php
+++ b/src/pages/wishlist.php
@@ -8,10 +8,11 @@
namespace wishthis;
-$wishlist = new Wishlist($_GET['hash']);
-$page = new Page(__FILE__, $wishlist->getTitle());
-$page->stylesheets[] = 'src/assets/css/wish-card.css';
-$wishlist_user = User::getFromID($wishlist->user);
+$wishlist = new Wishlist($_GET['hash']);
+$page = new Page(__FILE__, $wishlist->getTitle());
+$page->stylesheets['wish-card'] = 'src/assets/css/wish-card.css';
+$page->scripts['wish'] = 'src/assets/js/parts/wish.js';
+$wishlist_user = User::getFromID($wishlist->user);
if (!$wishlist->exists) {
$page->errorDocument(404, $wishlist);
diff --git a/src/pages/wishlists.php b/src/pages/wishlists.php
index 3fe0e2ff..a82e4c76 100644
--- a/src/pages/wishlists.php
+++ b/src/pages/wishlists.php
@@ -8,8 +8,9 @@
namespace wishthis;
-$page = new Page(__FILE__, __('My lists'), 1);
-$page->stylesheets[] = 'src/assets/css/wish-card.css';
+$page = new Page(__FILE__, __('My lists'), 1);
+$page->stylesheets['wish-card'] = 'src/assets/css/wish-card.css';
+$page->scripts['wish'] = 'src/assets/js/parts/wish.js';
$page->header();
$page->bodyStart();
$page->navigation();