wiselinks
wiselinks copied to clipboard
Use Wiselinks on all links by default
Hi! And thanks for a great solution.
What do you think about adding the option to turn wiselinks by default for all links and forms?
I am developing a website where all the links have to be handled with wiselinks and a little uncomfortable add data-push for each link. Personally, I would be more convenient to add data-no-push for links where wiselinks not needed.
thank you
:+1:
+1 Is this possible already?
Still not, but I promise to make this work as soon as possible.
$('button').data('push',true);
$('a').data('push',true);
:+1:
Better way is to activate all links with push where no data-push
and data-replace
attributes are present.
$(function(){
$('button, a').not('[data-no-push], [data-replace], [href$="#"]').attr('data-push', true);
}
$(document).on('page:always', function() { $('button, a').not('[data-no-push], [data-replace], [href$="#"]').attr('data-push', true); });
With data attribute data-no-push="true"
you can disable wiselinks on a link.
If anyone stumbles, this should be relatively easy to do just by binding at the document level as a click capture; and in that callback; bind to the regular (so that you are always last), and triggering if default was not prevented. (note: you may want to also handle MetaKey's etc)