diff options
Diffstat (limited to 'timelinejs.tpl.php')
-rw-r--r-- | timelinejs.tpl.php | 21 |
1 files changed, 14 insertions, 7 deletions
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: "<?php print $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 != "<?php global $base_url; print $base_url; ?>") { links[i].target = "_parent"; - } -} -MakeMenuLinksOpenInNewWindow(); + } + // FIXME + //console.log(links[i].protocol + '//' + links[i].hostname + ' <?php print $base_url; ?>'); + } + } + + if (typeof(timelineWidget) != "undefined" && timelineWidget == true) { + MakeMenuLinksOpenInNewWindow(); + } </script> <script type="text/javascript" src="/<?php print $library_path; ?>/compiled/js/storyjs-embed.js"></script> <!-- END Timeline Embed --> |