Created
April 24, 2015 11:34
-
-
Save dmitryd/21cb0eee72113d877069 to your computer and use it in GitHub Desktop.
TYPO3 Solr: modify selected facet link to serve as a reset link using jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$(document).ready(function() { | |
/** | |
* Turns the currently active facet link to "reset facet" link by removing the filter segment. | |
*/ | |
function modifyFacetLinkToReset() { | |
if (document.location.search.indexOf('tx_solr%5Bfilter%5D') > 0) { | |
$('.tx-solr-collapsible-facets a').each(function() { | |
if (this.href.indexOf(document.location.search) > 0) { | |
this.href = this.href.replace(/tx_solr%5Bfilter%5D[^&]+&?/, ''); | |
} | |
}); | |
} | |
} | |
modifyFacetLinkToReset(); | |
}); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment