app/assets/javascripts/urb/urb.js.erb in urb-0.1.3 vs app/assets/javascripts/urb/urb.js.erb in urb-0.1.4

- old
+ new

@@ -5,11 +5,11 @@ // * // * (c) 2014 Paul Engel // * Except otherwise noted, URB is licensed under // * http://creativecommons.org/licenses/by/3.0 // * -// * $Date: 2014-07-08 10:56:53 $ +// * $Date: 2014-10-22 17:22:12 $ // * URB = (function() { var urb_path = '<%= URB::PATH %>', maxlength = <%= URB::MAXLENGTH %>, @@ -21,12 +21,12 @@ request: function(d,e,f,t){f=f||'post';var c=document.createElement('form');c.setAttribute('method',f);c.setAttribute('action',d);c.setAttribute('target',t);for(var b in e){if(e.hasOwnProperty(b)){var a=document.createElement('input');a.setAttribute('type','hidden');a.setAttribute('name',b);a.setAttribute('value',e[b]);c.appendChild(a)}}document.body.appendChild(c);c.submit()} }, init = function() { $.on(document, 'click', function(event) { - var target = event.target || event.srcElement || window.event.target || window.event.srcElement, css = URB.css || '', leftClick = (event.which || event.button) == 1; - if (leftClick) { + var target = event.target || event.srcElement || window.event.target || window.event.srcElement, css = URB.css || '', leftClick = (event.which || event.button) == 1, href = target.getAttribute('href'); + if (leftClick && !href.match(/#/)) { if (target.tagName.toLowerCase() == 'a' && ((css == '') || $.hasClass(target, css))) { event.preventDefault(); open(target.getAttribute('href'), ((event.ctrlKey || event.metaKey) ? '_blank' : undefined)); } } @@ -53,6 +53,6 @@ version: '<%= URB::VERSION %>', open: open }; }()); -} \ No newline at end of file +}