TinyNav.js icon indicating copy to clipboard operation
TinyNav.js copied to clipboard

Enhancement: string replace option

Open boye opened this issue 9 years ago • 0 comments

First and foremost, thanks for sharing TinyNav.js with the GitHub community, it's a great plugin!

Since I needed something to format the textNode of the <option> elements I extended tinyNav.js with a replace option. It works as follows:

$('.nav-filter').tinyNav({
    active: 'selected',
    replace: {
        regex: /\d{1,3}/,
        fn: function (nr) {
            return '(' + nr + ')';
        }
    }
});

Basically it's a simple way to modify the content before it's gets injected in the DOM. If you want to...I could do a pull request. Just let me know.

Cheers

boye avatar Sep 07 '15 18:09 boye