mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-06-26 02:30:31 +00:00
theme: avoid id collisions between headings and theme #646
This commit is contained in:
parent
862d8bb8c2
commit
e18c213e8c
30 changed files with 511 additions and 507 deletions
static/js
|
@ -2,7 +2,7 @@ window.relearn = window.relearn || {};
|
|||
|
||||
window.relearn.runInitialSearch = function(){
|
||||
if( window.relearn.isSearchInit && window.relearn.isLunrInit ){
|
||||
var input = document.querySelector('#search-by-detail');
|
||||
var input = document.querySelector('#R-search-by-detail');
|
||||
if( !input ){
|
||||
return;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ function initLunrIndex( index ){
|
|||
}
|
||||
|
||||
function triggerSearch(){
|
||||
var input = document.querySelector('#search-by-detail');
|
||||
var input = document.querySelector('#R-search-by-detail');
|
||||
if( !input ){
|
||||
return;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ window.addEventListener( 'popstate', function ( event ){
|
|||
}
|
||||
});
|
||||
|
||||
var input = document.querySelector('#search-by-detail');
|
||||
var input = document.querySelector('#R-search-by-detail');
|
||||
if( input ){
|
||||
input.addEventListener( 'keydown', function(event) {
|
||||
// if we are pressing ESC in the searchdetail our focus will
|
||||
|
@ -199,7 +199,7 @@ function resolvePlaceholders( s, args ) {
|
|||
};
|
||||
|
||||
function searchDetail( value ) {
|
||||
var results = document.querySelector('#searchresults');
|
||||
var results = document.querySelector('#R-searchresults');
|
||||
var hint = document.querySelector('.searchhint');
|
||||
hint.innerText = '';
|
||||
results.textContent = '';
|
||||
|
@ -252,7 +252,7 @@ initLunrJson();
|
|||
initLunrJs();
|
||||
|
||||
function startSearch(){
|
||||
var input = document.querySelector('#search-by-detail');
|
||||
var input = document.querySelector('#R-search-by-detail');
|
||||
if( input ){
|
||||
var state = window.history.state || {};
|
||||
state = Object.assign( {}, ( typeof state === 'object' ) ? state : {} );
|
||||
|
@ -262,8 +262,8 @@ function startSearch(){
|
|||
|
||||
var searchList = new autoComplete({
|
||||
/* selector for the search box element */
|
||||
selectorToInsert: '#header-wrapper',
|
||||
selector: '#search-by',
|
||||
selectorToInsert: '#R-header-wrapper',
|
||||
selector: '#R-search-by',
|
||||
/* source is the callback to perform the search */
|
||||
source: function(term, response) {
|
||||
response(search(term));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue