Switch to a local external.js file.
authorLeif Hanson <leif@gaslightmedia.com>
Mon, 9 Sep 2013 15:36:31 +0000 (15:36 +0000)
committerLeif Hanson <leif@gaslightmedia.com>
Mon, 9 Sep 2013 15:36:31 +0000 (15:36 +0000)
Toolkit/Page.php
libjs/external.js [new file with mode: 0755]

index d0adbb5..73e6d06 100755 (executable)
@@ -150,7 +150,7 @@ class Toolkit_Page
         $GLOBALS['bottomScripts'][] = $this->baseURL . 'photoswipe/lib/klass.min.js';
         $GLOBALS['bottomScripts'][] = $this->baseURL . 'photoswipe/code.photoswipe.jquery-3.0.5.js';
         $GLOBALS['bottomScripts'][] = $this->baseURL . "fancybox/jquery.fancybox.js";
-        $GLOBALS['bottomScripts'][] = $this->glmAppBaseURL . 'libjs/external.js';
+        $GLOBALS['bottomScripts'][] = $this->baseURL . 'libjs/external.js';
         $GLOBALS['bottomScripts'][] = $this->baseURL . "libjs/pagefunctions.js";
     }
 
diff --git a/libjs/external.js b/libjs/external.js
new file mode 100755 (executable)
index 0000000..44277e8
--- /dev/null
@@ -0,0 +1,25 @@
+
+/*
+ * Open all links that are not of the site to open in new window
+ */
+
+
+$('a').each(function() {
+   var urlPattern = new RegExp('/' + window.location.host + '/');
+   if(     !urlPattern.test(this.href)
+        && !$(this).hasClass('thickbox')
+        && !$(this).hasClass('colorbox')
+        && !$(this).hasClass('various')
+        && !$(this).hasClass('phototitle')
+        && !$(this).hasClass('photoimg')
+        && ($(this).attr('href') != "#")
+        && ($(this).attr('href') != "")
+        && ($(this).attr('href') != null)
+   ) {
+       $(this).click(function(event) {
+           event.preventDefault();
+           event.stopPropagation();
+           window.open(this.href, '_blank');
+       });
+   }
+});