fix for external js and blog url
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 1 Feb 2016 19:41:51 +0000 (14:41 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 1 Feb 2016 19:41:51 +0000 (14:41 -0500)
Toolkit/Page.php
js/external.js [new file with mode: 0644]

index 84a8659..3b50adb 100755 (executable)
@@ -162,7 +162,7 @@ class Toolkit_Page
         $GLOBALS['bottomScripts'][] = MEDIA_BASE_URL . 'js/pageSetup.js';
         $GLOBALS['styleSheets'][] = $this->mediaBaseURL . 'fancybox/jquery.fancybox.css';
         $GLOBALS['bottomScripts'][] = $this->mediaBaseURL . "fancybox/jquery.fancybox.js";
-        $GLOBALS['bottomScripts']['external'] = $this->glmAppBaseURL . 'libjs/external.js';
+        $GLOBALS['bottomScripts']['external'] = $this->mediaBaseURL . 'js/external.js';
     }
 
     /**
diff --git a/js/external.js b/js/external.js
new file mode 100644 (file)
index 0000000..a8b1d62
--- /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') != "http://blog.keweenaw.info")
+        && ($(this).attr('href') != "")
+        && ($(this).attr('href') != null)
+   ) {
+       $(this).click(function(event) {
+           event.preventDefault();
+           event.stopPropagation();
+           window.open(this.href, '_blank');
+       });
+   }
+});