-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Commit with all the code and stuff to show you how I hosted the…
… Google CSE
- Loading branch information
0 parents
commit 0b94b01
Showing
7 changed files
with
308 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
application: html5search | ||
version: 1 | ||
runtime: python | ||
api_version: 1 | ||
|
||
handlers: | ||
- url: /favicon\.ico | ||
static_files: favicon.ico | ||
upload: favicon\.ico | ||
|
||
- url: / | ||
static_files: static/index.html | ||
upload: static/index\.html | ||
|
||
- url: /index.html | ||
static_files: static/index.html | ||
upload: static/index\.html | ||
|
||
- url: /opensearch.xml | ||
static_files: static/opensearch.xml | ||
mime_type: application/opensearchdescription+xml | ||
upload: static/opensearch.xml | ||
|
||
- url: /scripts | ||
static_dir: scripts | ||
mime_type: application/javascript | ||
|
||
- url: /search/.* | ||
static_files: static/index.html | ||
upload: static/index\.html5search |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
indexes: | ||
|
||
# AUTOGENERATED | ||
|
||
# This index.yaml is automatically updated whenever the dev_appserver | ||
# detects that a new type of query is run. If you want to manage the | ||
# index.yaml file manually, remove the above marker line (the line | ||
# saying "# AUTOGENERATED"). If you want to manage some indexes | ||
# manually, move them above the marker line. The index.yaml file is | ||
# automatically uploaded to the admin console when you next deploy | ||
# your application using appcfg.py. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright 2007 Google Inc. | ||
# | ||
# 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. | ||
# | ||
from google.appengine.ext import webapp | ||
from google.appengine.ext.webapp import util | ||
|
||
|
||
class MainHandler(webapp.RequestHandler): | ||
def get(self): | ||
self.response.out.write('Hello world!') | ||
|
||
|
||
def main(): | ||
application = webapp.WSGIApplication([('/', MainHandler)], | ||
debug=True) | ||
util.run_wsgi_app(application) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
<title>HTML5 Search</title> | ||
<script src="/scripts/leviroutes.js"></script> | ||
<link rel="search" | ||
href="http://www.html5search.com/opensearch.xml" | ||
type="application/opensearchdescription+xml" | ||
title="HTML5 Search" /> | ||
<!-- Place this tag in the <head> of your document --> | ||
<div id="cse" style="width: 100%;">HTML5 Search Engine - searching all the best resources for HTML5, JS and CSS.</div> | ||
<script src="http://www.google.com/jsapi" type="text/javascript"></script> | ||
<script type="text/javascript"> | ||
google.load('search', '1', {language : 'en'}); | ||
google.setOnLoadCallback(function() { | ||
var csc = new google.search.CustomSearchControl( | ||
'012887599717425551906:mepdx2iop00'); | ||
|
||
csc.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); | ||
csc.draw('cse'); | ||
csc.setSearchStartingCallback(undefined, function(a,b,q) { | ||
window.history.pushState(q, 'Results for ' + q, '/search/' + q); | ||
}) | ||
var app = new routes(); | ||
|
||
app.get("/search/:query", function(req) { | ||
var query = req.params.query; | ||
// Do a search. | ||
csc.execute(decodeURI(query)); | ||
}); | ||
}, true); | ||
</script> | ||
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" /> | ||
<style type="text/css"> | ||
body { | ||
margin: 0; | ||
} | ||
|
||
#cse { | ||
padding-top: 10px; | ||
background: #eee; | ||
} | ||
|
||
form.gsc-search-box { | ||
background: #eee; | ||
-webkit-box-shadow: 0px 5px 5px #555; | ||
margin-bottom: 5px; | ||
padding:10px; | ||
box-sizing: border-box; | ||
} | ||
|
||
|
||
.gsc-control-cse { | ||
font-family: Arial, sans-serif; | ||
border-color: #eee; | ||
padding: 0px 0px 0px 0px; | ||
border: none; | ||
} | ||
|
||
.gsc-control-wrapper-cse { | ||
} | ||
|
||
.gsc-result-info { | ||
padding: 10px; | ||
} | ||
|
||
input.gsc-input { | ||
border-color: #BCCDF0; | ||
font-size: 2em; | ||
background-image: none !important; | ||
} | ||
input.gsc-search-button { | ||
border-color: #666666; | ||
background-color: #CECECE; | ||
font-size: 2em; | ||
} | ||
.gsc-tabHeader.gsc-tabhInactive { | ||
border-color: #E9E9E9; | ||
background-color: #E9E9E9; | ||
} | ||
.gsc-tabHeader.gsc-tabhActive { | ||
border-top-color: #FF9900; | ||
border-left-color: #E9E9E9; | ||
border-right-color: #E9E9E9; | ||
background-color: #FFFFFF; | ||
} | ||
.gsc-tabsArea { | ||
border-color: #E9E9E9; | ||
} | ||
.gsc-webResult.gsc-result, | ||
.gsc-results .gsc-imageResult { | ||
border-color: #FFFFFF; | ||
background-color: #FFFFFF; | ||
} | ||
.gsc-webResult.gsc-result:hover, | ||
.gsc-imageResult:hover { | ||
border-color: #FFFFFF; | ||
background-color: #FFFFFF; | ||
} | ||
.gs-webResult.gs-result a.gs-title:link, | ||
.gs-webResult.gs-result a.gs-title:link b, | ||
.gs-imageResult a.gs-title:link, | ||
.gs-imageResult a.gs-title:link b { | ||
color: #0000CC; | ||
} | ||
.gs-webResult.gs-result a.gs-title:visited, | ||
.gs-webResult.gs-result a.gs-title:visited b, | ||
.gs-imageResult a.gs-title:visited, | ||
.gs-imageResult a.gs-title:visited b { | ||
color: #0000CC; | ||
} | ||
.gs-webResult.gs-result a.gs-title:hover, | ||
.gs-webResult.gs-result a.gs-title:hover b, | ||
.gs-imageResult a.gs-title:hover, | ||
.gs-imageResult a.gs-title:hover b { | ||
color: #0000CC; | ||
} | ||
.gs-webResult.gs-result a.gs-title:active, | ||
.gs-webResult.gs-result a.gs-title:active b, | ||
.gs-imageResult a.gs-title:active, | ||
.gs-imageResult a.gs-title:active b { | ||
color: #0000CC; | ||
} | ||
.gsc-cursor-page { | ||
color: #0000CC; | ||
} | ||
a.gsc-trailing-more-results:link { | ||
color: #0000CC; | ||
} | ||
.gs-webResult .gs-snippet, | ||
.gs-imageResult .gs-snippet, | ||
.gs-fileFormatType { | ||
color: #000000; | ||
} | ||
.gs-webResult div.gs-visibleUrl, | ||
.gs-imageResult div.gs-visibleUrl { | ||
color: #008000; | ||
} | ||
.gs-webResult div.gs-visibleUrl-short { | ||
color: #008000; | ||
} | ||
.gs-webResult div.gs-visibleUrl-short { | ||
display: none; | ||
} | ||
.gs-webResult div.gs-visibleUrl-long { | ||
display: block; | ||
} | ||
.gsc-cursor-box { | ||
border-color: #FFFFFF; | ||
} | ||
.gsc-results .gsc-cursor-box .gsc-cursor-page { | ||
border-color: #E9E9E9; | ||
background-color: #FFFFFF; | ||
color: #0000CC; | ||
} | ||
.gsc-results .gsc-cursor-box .gsc-cursor-current-page { | ||
border-color: #FF9900; | ||
background-color: #FFFFFF; | ||
color: #0000CC; | ||
} | ||
.gs-promotion { | ||
border-color: #336699; | ||
background-color: #FFFFFF; | ||
} | ||
.gs-promotion a.gs-title:link, | ||
.gs-promotion a.gs-title:link *, | ||
.gs-promotion .gs-snippet a:link { | ||
color: #0000CC; | ||
} | ||
.gs-promotion a.gs-title:visited, | ||
.gs-promotion a.gs-title:visited *, | ||
.gs-promotion .gs-snippet a:visited { | ||
color: #0000CC; | ||
} | ||
.gs-promotion a.gs-title:hover, | ||
.gs-promotion a.gs-title:hover *, | ||
.gs-promotion .gs-snippet a:hover { | ||
color: #0000CC; | ||
} | ||
.gs-promotion a.gs-title:active, | ||
.gs-promotion a.gs-title:active *, | ||
.gs-promotion .gs-snippet a:active { | ||
color: #0000CC; | ||
} | ||
.gs-promotion .gs-snippet, | ||
.gs-promotion .gs-title .gs-promotion-title-right, | ||
.gs-promotion .gs-title .gs-promotion-title-right * { | ||
color: #000000; | ||
} | ||
.gs-promotion .gs-visibleUrl, | ||
.gs-promotion .gs-visibleUrl-short { | ||
color: #008000; | ||
} | ||
.gsc-adBlock { | ||
padding: 5px; | ||
background-color: #eee; | ||
} | ||
</style> | ||
<script type="text/javascript"> | ||
|
||
var _gaq = _gaq || []; | ||
_gaq.push(['_setAccount', 'UA-28238845-1']); | ||
_gaq.push(['_trackPageview']); | ||
|
||
(function() { | ||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||
})(); | ||
</script> | ||
<script> | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> | ||
<ShortName>HTML5 Search</ShortName> | ||
<Description>Searches only the best HTML5, JS and CSS sites on the web.</Description> | ||
<Tags>html5 html css js css3 web</Tags> | ||
<Contact>paul.kinlan@gmail.com</Contact> | ||
<Url type="text/html" | ||
template="http://www.html5search.com/search/{searchTerms}"/> | ||
</OpenSearchDescription> |