Remove more jQuery

This commit is contained in:
Rico Sta. Cruz 2017-10-02 04:45:09 +08:00
parent cb8d022be7
commit 6d8f2fa790
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
4 changed files with 7 additions and 14 deletions

View File

@ -1,6 +1,5 @@
/* eslint-disable no-new */
import $ from 'jquery'
import Isotope from 'isotope-layout/dist/isotope.pkgd.js'
import onmount from 'onmount'

View File

@ -1,4 +1,3 @@
import onmount from 'onmount'
import wrapify from '../wrapify'
import ready from 'dom101/ready'

View File

@ -1,13 +1,11 @@
import $ from 'jquery'
import onmount from 'onmount'
import * as Search from '../helpers/search'
import qs from '../helpers/qs'
import on from 'dom101/on'
onmount('[data-js-search-input]', function () {
const $this = $(this)
$this.on('input', () => {
const val = $this.val()
on(this, 'input', () => {
const val = this.value
if (val === '') {
Search.showAll()
@ -18,7 +16,7 @@ onmount('[data-js-search-input]', function () {
const query = (qs(window.location.search) || {}).q
if (query && query.length) {
$this.val(query)
Search.show(query)
this.value = query
setTimeout(() => { Search.show(query) })
}
})

View File

@ -1,5 +1,3 @@
import $ from 'jquery'
import onmount from 'onmount'
import permutate from '../helpers/permutate'
@ -8,9 +6,8 @@ import permutate from '../helpers/permutate'
*/
onmount('[data-js-searchable-item]', function () {
const $this = $(this)
const data = $this.data('js-searchable-item')
const data = JSON.parse(this.getAttribute('data-js-searchable-item') || '{}')
const words = permutate(data)
$this.attr('data-search-index', words.join(' '))
this.setAttribute('data-search-index', words.join(' '))
})