diff options
author | Silvio <silvio@socioambiental.org> | 2013-11-06 18:09:17 -0200 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2013-11-06 18:09:17 -0200 |
commit | 61a6e1ba091442fa5051ec7e49f3f60496195ae2 (patch) | |
tree | 928c146967844ab85939cefb089f87cc7f191a4c /timelinejs.tpl.php | |
parent | 329de8ec6cb06f7e3f1d6baadfe427c918b1712b (diff) | |
download | timelinejs-61a6e1ba091442fa5051ec7e49f3f60496195ae2.tar.gz timelinejs-61a6e1ba091442fa5051ec7e49f3f60496195ae2.tar.bz2 |
Use MakeMenuLinksOpenInNewWindow() just on widget mode
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 --> |