summaryrefslogtreecommitdiff
path: root/timelinejs.tpl.php
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-11-06 18:09:17 -0200
committerSilvio <silvio@socioambiental.org>2013-11-06 18:09:17 -0200
commit61a6e1ba091442fa5051ec7e49f3f60496195ae2 (patch)
tree928c146967844ab85939cefb089f87cc7f191a4c /timelinejs.tpl.php
parent329de8ec6cb06f7e3f1d6baadfe427c918b1712b (diff)
downloadtimelinejs-61a6e1ba091442fa5051ec7e49f3f60496195ae2.tar.gz
timelinejs-61a6e1ba091442fa5051ec7e49f3f60496195ae2.tar.bz2
Use MakeMenuLinksOpenInNewWindow() just on widget mode
Diffstat (limited to 'timelinejs.tpl.php')
-rw-r--r--timelinejs.tpl.php21
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 -->