Sha256: 44035aaf80fe76303b42d8dac494e3fb2480b4df9d4ab546af10a1a6f3b67c04
Contents?: true
Size: 869 Bytes
Versions: 3
Compression:
Stored size: 869 Bytes
Contents
// See the Pagy documentation: https://ddnexus.github.io/pagy/extras/compact function PagyCompact(id, marker, page){ var pagyNav = document.getElementById('pagy-nav-'+id), input = pagyNav.getElementsByTagName('input')[0], link = pagyNav.getElementsByTagName('a')[0]; this.go = function(){ if (page !== input.value) { var href = link.getAttribute('href').replace(marker, input.value); link.setAttribute('href', href); link.click(); } }; // select the content on click: easier for typing a number input.addEventListener('click', function(){ this.select() }); // jump to page number from input when the input looses focus input.addEventListener('focusout', this.go); // … and when pressing enter inside the input input.addEventListener('keyup', function(e){ if (e.which === 13) this.go() }.bind(this)); }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pagy-0.9.2 | lib/pagy/extras/javascripts/pagy-compact.js |
pagy-0.9.1 | lib/pagy/extras/javascripts/pagy-compact.js |
pagy-0.9.0 | lib/pagy/extras/javascripts/pagy-compact.js |