Fix qlink handling in Firefox
[blerg.git] / www / jssrc / blerg / Util.js
index 2734b36..18f3169 100644 (file)
@@ -3,9 +3,9 @@ blerg = window.blerg || {};
 blerg.Util = {};
 
 // Dirty, terrible shim for rewritten links below
-blerg.Util.qlink = function() {
+blerg.Util.qlink = function(ev) {
     try {
-        location.href = event.target.href;
+        location.href = ev.target.href;
     } catch(e) { }
     enyo.$.blerg.bubble('onNavigate');
     return false;
@@ -82,8 +82,8 @@ blerg.Util.blergFormat = function(text) {
         l = l.replace(/([^\w\\]|^)\*(\w[^*]*)\*(\W|$)/g, '$1<i>$2</i>$3');
 
         // Turn refs and tags into links
-        l = l.replace(/(\s|^)#([A-Za-z0-9_-]+)/g, '$1<a href="#/tag/$2" class="ref" onclick="return blerg.Util.qlink()">#$2</a>');
-        l = l.replace(/(\s|^)@([A-Za-z0-9_-]+)(\/\d+)?/g, '$1<a href="#$2$3" class="ref" onclick="return blerg.Util.qlink()">@$2</a>');
+        l = l.replace(/(\s|^)#([A-Za-z0-9_-]+)/g, '$1<a href="#/tag/$2" class="ref" onclick="return blerg.Util.qlink(event)">#$2</a>');
+        l = l.replace(/(\s|^)@([A-Za-z0-9_-]+)(\/\d+)?/g, '$1<a href="#$2$3" class="ref" onclick="return blerg.Util.qlink(event)">@$2</a>');
 
         // Create lists when lines begin with *
         if (l[0] == '*') {