refactor: move inline search function to js file

avoid inline script for CSP
This commit is contained in:
curben 2019-05-21 14:12:30 +09:30
parent 0b2c5dbc6c
commit 03c527b2f5
2 changed files with 10 additions and 2 deletions

View File

@ -6,8 +6,8 @@
<% } %> <% } %>
<div class="searchContainer"> <div class="searchContainer">
<input class="searchBox" type="text" id="search" placeholder="Search..."> <input class="searchBox" type="text" id="searchTxt" placeholder="Search...">
<a class="searchBtn no-underline" href="#" onClick="window.open(`https://gitlab.com/search?utf8=%E2%9C%93&search=` + document.getElementById(`search`).value + `&group_id=&project_id=8306723&search_code=true&repository_ref=master`)"> <a class="searchBtn no-underline" id="searchClick" href="#">
<svg viewBox="0 0 512 512"> <svg viewBox="0 0 512 512">
<title>Search</title> <title>Search</title>
<desc>Search icon</desc> <desc>Search icon</desc>

View File

@ -62,3 +62,11 @@
cl.responsive() cl.responsive()
}) })
})(jQuery) })(jQuery)
// Search button function
const searchClick = document.getElementById('searchClick')
searchClick.onclick = function() {
window.open('https://gitlab.com/search?utf8=%E2%9C%93&search=' +
document.getElementById('searchTxt').value +
'&group_id=&project_id=8306723&search_code=true&repository_ref=master')
}