Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enabled open search integration

  • Loading branch information...
commit 0f6ea7c3b6a060f05be41a3be047006beb2a6294 1 parent c6a03ec
@paddyforan paddyforan authored
View
2  _config.yml
@@ -1,3 +1,5 @@
permalink: /:title
auto: true
server: true
+domain: "localhost:4000"
+google_cse_id: 012672112220120861281:u1mwwky5lri
View
6 _layouts/default.html
@@ -39,6 +39,12 @@
{% if page.section == "worker" %}
{% include sidemenu_worker.html %}
{% endif %}
+
+ {% if page.section == "search" %}
+ <p style="width: 100%; text-align: center;">
+ <a href="#" id="addSearch">Search From Your Browser</a>
+ </p>
+ {% endif %}
</div>
<div style="float: left; width: 688px" class="content">
View
27 open-search.xml
@@ -0,0 +1,27 @@
+---
+---
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ open-search.xhtml
+
+ Copyright 2009 Jack Leow
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
+ <ShortName>Iron.io Docs</ShortName>
+ <Description>Documentation for Iron.io services.</Description>
+ <Image width="16" height="16" type="image/x-icon">http://{{ site.domain }}/favicon.ico
+ </Image>
+ <Url type="text/html" method="get" template="http://{{ site.domain }}/search/?q={searchTerms}"></Url>
+ <Url type="application/x-suggestions+json" method="get" template="http://www.google.com/complete/search?q={searchTerms}&amp;partnerid={{ site.google_cse_id }}&amp;ds=cse&amp;output=firefox"></Url>
+</OpenSearchDescription>
View
12 search/index.html
@@ -1,6 +1,7 @@
---
title: Search Results
layout: default
+section: search
---
<h1>Search Results</h1>
@@ -25,7 +26,7 @@
google.setOnLoadCallback(function () {
var customSearchOptions = {};
var customSearchControl = new google.search.CustomSearchControl(
- '012672112220120861281:u1mwwky5lri', customSearchOptions);
+ '{{ site.google_cse_id }}', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchResultsOnly();
@@ -35,6 +36,13 @@
customSearchControl.execute(queryFromUrl);
}
}, true);
+
+ $('#addSearch').click(function(e) {
+ e.preventDefault();
+ var url = "http://{{ site.domain }}/open-search.xml";
+ window.external.AddSearchProvider(url);
+ });
+
</script>
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
<style type="text/css">
@@ -212,4 +220,4 @@
background : none repeat scroll 0% 0% white !important;
}
-</style>
+</style>
Please sign in to comment.
Something went wrong with that request. Please try again.