From 61a6e1ba091442fa5051ec7e49f3f60496195ae2 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 6 Nov 2013 18:09:17 -0200 Subject: Use MakeMenuLinksOpenInNewWindow() just on widget mode --- timelinejs.tpl.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'timelinejs.tpl.php') diff --git a/timelinejs.tpl.php b/timelinejs.tpl.php index e3e1175..7fef98d 100644 --- a/timelinejs.tpl.php +++ b/timelinejs.tpl.php @@ -13,14 +13,21 @@ lang: "" } -function MakeMenuLinksOpenInNewWindow() { - var links = document.getElementsByTagName("a"); - for (var i = 0; i < links.length; i++) { - if (links[i].href != "http://widgets.socioambiental.org/") + // Used to open links in the parent iframe when showing as a widget + function MakeMenuLinksOpenInNewWindow() { + var links = document.getElementsByTagName("a"); + for (var i = 0; i < links.length; i++) { + if (links[i].protocol + '//' + links[i].hostname != "") { links[i].target = "_parent"; - } -} -MakeMenuLinksOpenInNewWindow(); + } + // FIXME + //console.log(links[i].protocol + '//' + links[i].hostname + ' '); + } + } + + if (typeof(timelineWidget) != "undefined" && timelineWidget == true) { + MakeMenuLinksOpenInNewWindow(); + } -- cgit v1.2.3