From aa826c9c153ce1c40fdc65ec9e12c8efa2f12e8c Mon Sep 17 00:00:00 2001 From: kaos Date: Wed, 24 Jun 2015 13:41:08 +0200 Subject: [PATCH] fix permalink url for sections --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index bdd3520..8c1d1da 100644 --- a/main.js +++ b/main.js @@ -66,14 +66,14 @@ function setVideoListener(){ currentVideo.name = currentVideo.target.parents("article").find("h2").text().trim() + ".gif"; }); jQuery(".main-wrap").on('contextmenu', "a", function(e) { - currentVideo.target = jQuery(event.target) ; + currentVideo.target = jQuery(event.target); var previous = currentVideo.target.parents("article").prev(); var id = currentVideo.target.parents("article").data("entry-id"); if (previous.length > 0){ id = previous.data("entry-id"); } - currentVideo.permalink = "http://9gag.com/?id=" + id; + currentVideo.permalink = [location.protocol, '//', location.host, location.pathname].join('') + "?id=" + id; if (currentVideo.permalink == undefined){ console.log("Warning: unable to find the permalink for this post")