Add Google search function (#222)
Solves #150 Signed-off-by: Martin Herbst <mail@mherbst.de>pull/246/head
parent
06bdbaf501
commit
92a0be79d6
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
<body class="{{ include.bodyClass }}">
|
<body class="{{ include.bodyClass }}">
|
||||||
<div id="header" class="navbar-fixed">
|
<div id="header" class="navbar-fixed">
|
||||||
<nav role="navigation">
|
<nav role="navigation">
|
||||||
|
@ -42,6 +43,12 @@
|
||||||
<li><a href="{{docu}}/developers">Developer Guide</a></li>
|
<li><a href="{{docu}}/developers">Developer Guide</a></li>
|
||||||
<li><a target="_blank" href="https://community.openhab.org">Community Forum</a></li>
|
<li><a target="_blank" href="https://community.openhab.org">Community Forum</a></li>
|
||||||
<li><a target="_blank" href="https://github.com/openhab">GitHub</a></li>
|
<li><a target="_blank" href="https://github.com/openhab">GitHub</a></li>
|
||||||
|
<li class="search"><span style="font-family: 'material-design-icons'"></span></li>
|
||||||
|
<li class="search">
|
||||||
|
<form method="GET" id="searchform" class="search-form" action="/search">
|
||||||
|
<input id="query" name="q" type="text" class="search-form-input" placeholder="search" />
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul id="nav-mobile" class="side-nav">
|
<ul id="nav-mobile" class="side-nav">
|
||||||
<li><a href="{{base}}/index.html">Home</a></li>
|
<li><a href="{{base}}/index.html">Home</a></li>
|
||||||
|
@ -50,6 +57,11 @@
|
||||||
<li><a href="{{docu}}/developers">Developer Guide</a></li>
|
<li><a href="{{docu}}/developers">Developer Guide</a></li>
|
||||||
<li><a target="_blank" href="https://community.openhab.org">Community Forum</a></li>
|
<li><a target="_blank" href="https://community.openhab.org">Community Forum</a></li>
|
||||||
<li><a target="_blank" href="https://github.com/openhab">GitHub</a></li>
|
<li><a target="_blank" href="https://github.com/openhab">GitHub</a></li>
|
||||||
|
<li class="search">
|
||||||
|
<form method="GET" id="searchformmob" class="search-form" action="/search">
|
||||||
|
<input id="querymob" name="q" type="text" class="search-form-input" placeholder="search" />
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,3 +12,40 @@
|
||||||
.card .card-action a:hover {
|
.card .card-action a:hover {
|
||||||
color: #039BE5;
|
color: #039BE5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li.search:hover {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-form-input {
|
||||||
|
padding-left: 5px !important;
|
||||||
|
width: 100px;
|
||||||
|
width: 100px;
|
||||||
|
border: none !important;
|
||||||
|
transition: 0.2s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchform .search-form-input:focus {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchresults td {
|
||||||
|
border: none;
|
||||||
|
padding: 0 8px 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchresults .gsc-webResult .gsc-result {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchresults table {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchresults .gs-title {
|
||||||
|
height: 1.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchresults input {
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
layout: intro
|
||||||
|
title: openHAB 2 - Search Results
|
||||||
|
---
|
||||||
|
{% include base.html %}
|
||||||
|
<h2>Search Results</h2>
|
||||||
|
<div id="searchresults">
|
||||||
|
<div id="gsearch"></div>
|
||||||
|
<script>
|
||||||
|
var myCallback = function() {
|
||||||
|
if (document.readyState == 'complete') {
|
||||||
|
google.search.cse.element.render(
|
||||||
|
{
|
||||||
|
div: "gsearch"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
google.setOnLoadCallback(function() {
|
||||||
|
google.search.cse.element.render(
|
||||||
|
{
|
||||||
|
div: "gsearch"
|
||||||
|
});
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.__gcse = {
|
||||||
|
parsetags: 'explicit',
|
||||||
|
callback: myCallback
|
||||||
|
};
|
||||||
|
(function() {
|
||||||
|
var cx = '003707250976775348452:h9hxadbatfq';
|
||||||
|
var gcse = document.createElement('script');
|
||||||
|
gcse.type = 'text/javascript';
|
||||||
|
gcse.async = true;
|
||||||
|
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
||||||
|
var s = document.getElementsByTagName('script')[0];
|
||||||
|
s.parentNode.insertBefore(gcse, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<gcse:searchresults-only linkTarget=""></gcse:searchresults-only>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue