@ -165,6 +165,7 @@ export default {
} ) ;
} ) ;
let licenses = document . querySelector ( '.license-filters' ) ;
let licenses = document . querySelector ( '.license-filters' ) ;
let subjects = document . querySelector ( '.subject-filters' ) ;
let subjects = document . querySelector ( '.subject-filters' ) ;
let institutions = document . querySelector ( '.institution-filters' ) ;
let sorts = document . querySelector ( '.sorts' ) ;
let sorts = document . querySelector ( '.sorts' ) ;
let clearFilters = document . querySelector ( '.clear-filters' ) ;
let clearFilters = document . querySelector ( '.clear-filters' ) ;
clearFilters . hidden = false ;
clearFilters . hidden = false ;
@ -172,47 +173,66 @@ export default {
if ( event . target . type !== 'radio' ) {
if ( event . target . type !== 'radio' ) {
return ;
return ;
}
}
let license = '' ;
let subject = '' ;
const subject = subjects . querySelector ( 'input[type="radio"]:checked' ) . value
let filterValue = '*' ;
? ` [data-subject=" ${ subjects . querySelector ( 'input[type="radio"]:checked' ) . value } "] `
if ( subjects . querySelector ( 'input[type="radio"]:checked' ) . value ) {
: '' ;
subject = ` [data-subject=" ${
const institution = institutions . querySelector ( 'input[type="radio"]:checked' ) . value
subjects . querySelector ( 'input[type="radio"]:checked' ) . value
? ` [data-institution*=" ${ institutions . querySelector ( 'input[type="radio"]:checked' ) . value } "] `
} " ] ` ;
: '' ;
}
const license = event . target . value
if ( event . target . value ) {
? ` [data-license=" ${ event . target . value } "] `
license = ` [data-license=" ${ event . target . value } "] ` ;
: '' ;
}
if ( license || subject ) {
const filterValue = subject || license || institution ? ` ${ subject } ${ license } ${ institution } ` : '*' ;
filterValue = ` ${ license } ${ subject } ` ;
$grid . isotope ( { filter : filterValue } ) ;
} ) ;
institutions . addEventListener ( 'click' , function ( event ) {
if ( event . target . type !== 'radio' ) {
return ;
}
}
const subject = subjects . querySelector ( 'input[type="radio"]:checked' ) . value
? ` [data-subject=" ${ subjects . querySelector ( 'input[type="radio"]:checked' ) . value } "] `
: '' ;
const license = licenses . querySelector ( 'input[type="radio"]:checked' ) . value
? ` [data-license=" ${ licenses . querySelector ( 'input[type="radio"]:checked' ) . value } "] `
: '' ;
const institution = event . target . value
? ` [data-institution*=" ${ event . target . value } "] `
: '' ;
const filterValue = subject || license || institution ? ` ${ subject } ${ license } ${ institution } ` : '*' ;
$grid . isotope ( { filter : filterValue } ) ;
$grid . isotope ( { filter : filterValue } ) ;
} ) ;
} ) ;
subjects . addEventListener ( 'click' , function ( event ) {
subjects . addEventListener ( 'click' , function ( event ) {
if ( event . target . type !== 'radio' ) {
if ( event . target . type !== 'radio' ) {
return ;
return ;
}
}
let license = '' ;
let subject = '' ;
const license = licenses . querySelector ( 'input[type="radio"]:checked' ) . value
let filterValue = '*' ;
? ` [data-license=" ${ licenses . querySelector ( 'input[type="radio"]:checked' ) . value } "] `
if ( licenses . querySelector ( 'input[type="radio"]:checked' ) . value ) {
: '' ;
license = ` [data-license=" ${
const institution = institutions . querySelector ( 'input[type="radio"]:checked' ) . value
licenses . querySelector ( 'input[type="radio"]:checked' ) . value
? ` [data-institution*=" ${ institutions . querySelector ( 'input[type="radio"]:checked' ) . value } "] `
} " ] ` ;
: '' ;
}
const subject = event . target . value
if ( event . target . value ) {
? ` [data-subject=" ${ event . target . value } "] `
subject = ` [data-subject=" ${ event . target . value } "] ` ;
: '' ;
}
if ( license || subject ) {
const filterValue = subject || license || institution ? ` ${ subject } ${ license } ${ institution } ` : '*' ;
filterValue = ` ${ license } ${ subject } ` ;
}
$grid . isotope ( { filter : filterValue } ) ;
$grid . isotope ( { filter : filterValue } ) ;
} ) ;
} ) ;
clearFilters . addEventListener ( 'click' , function ( ) {
clearFilters . addEventListener ( 'click' , function ( ) {
let allLicenses = document . getElementById ( 'all-licenses' ) ;
let allLicenses = document . getElementById ( 'all-licenses' ) ;
let allSubjects = document . getElementById ( 'all-subjects' ) ;
let allSubjects = document . getElementById ( 'all-subjects' ) ;
let allInstitutions = document . getElementById ( 'all-institutions' ) ;
allLicenses . checked = true ;
allLicenses . checked = true ;
allSubjects . checked = true ;
allSubjects . checked = true ;
allInstitutions . checked = true ;
$grid . isotope ( { filter : '*' } ) ;
$grid . isotope ( { filter : '*' } ) ;
} ) ;
} ) ;
sorts . addEventListener ( 'click' , function ( event ) {
sorts . addEventListener ( 'click' , function ( event ) {