From 74c61fe31a3fa611eca3a37c4dec666d834c97f9 Mon Sep 17 00:00:00 2001 From: Pashe Date: Tue, 24 Feb 2015 03:10:15 -0600 Subject: [PATCH 1/2] Add data-fullimage attribute to catalog images --- templates/themes/catalog/catalog.html | 2 +- templates/themes/catalog/theme.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index a0b36c64..250a1b14 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -47,7 +47,7 @@ {% if post.youtube %} diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index a5491a7c..88f6ad5b 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -66,6 +66,7 @@ } else { $post['file'] = $config['uri_thumb'] . $files[0]->thumb; + $post['fullimage'] = $config['uri_img'] . $files[0]->file; } } } else { From 2fd294d0d958dc9460eb70c45ecea46d1f539335 Mon Sep 17 00:00:00 2001 From: Pashe Date: Tue, 24 Feb 2015 03:17:35 -0600 Subject: [PATCH 2/2] Have image-hover.js use data-fullimage instead of the API --- js/image-hover.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/js/image-hover.js b/js/image-hover.js index 801b8dff..ac175ff4 100644 --- a/js/image-hover.js +++ b/js/image-hover.js @@ -133,19 +133,8 @@ function imageHoverStart(e) { //Pashe, anonish, WTFPL if ($this.parent().attr("href").match("src")) { fullUrl = $this.parent().attr("href"); } else if (isOnCatalog()) { - $this.css("cursor", "progress"); - fullUrl = $this.attr("src"); - $.ajax(($this.parent().attr("href").replace(/\.html$/, ".json")), { - success: function (result) { - $this.css("cursor", "unset"); - fullUrl = result.posts[0].tim + result.posts[0].ext; - if (!isImage(getFileExtension(fullUrl))) {return;} - $("#chx_hoverImage").attr("src", "/" + thisBoard + "/" + fullUrl); - $("#chx_hoverImage").on("load", function() {$this.css("cursor", "none")}); - }, - async: true, - cache: true - }); + fullUrl = $this.attr("data-fullimage"); + if (!isImage(getFileExtension(fullUrl))) {fullUrl = $this.attr("src");} } if (isVideo(getFileExtension(fullUrl))) {return;}