Skip to content

Instantly share code, notes, and snippets.

@elbotho
Created October 15, 2018 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbotho/55b16e399758985ccf466cbafed5f551 to your computer and use it in GitHub Desktop.
Save elbotho/55b16e399758985ccf466cbafed5f551 to your computer and use it in GitHub Desktop.
Squarespace search umlauts hack
//until the bug gets fixed this kinda works
document.addEventListener("DOMContentLoaded", function() {
setTimeout(setupSearchFix, 1200);
});
function setupSearchFix(){
var if( $('.sqs-search-page .sqs-search-page-input input').length === 0 ) return;
console.log('squarespace search-fix');
var searchInput = Y.Widget.getByNode( Y.one ('.sqs-search-page .sqs-search-page-input input') );
var str = searchInput.get('queryString');
if ( !/[\-_.\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/i.test(str) ) return; //no umlauts to fix
searchInput.set('queryString', str+' ' );
searchInput.set('queryString', str.substring(0,str.length) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment