Skip to content

Commit 8aa5bde

Browse files
committed
1 parent cc8b759 commit 8aa5bde

File tree

4 files changed

+10
-23
lines changed

4 files changed

+10
-23
lines changed

controllers/search.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports.index = function (req, res, next) {
2+
var q = req.query.q;
3+
res.redirect('https://www.google.com.hk/#hl=zh-CN&q=site:cnodejs.org+' + q);
4+
};

public/stylesheets/gsc.less

Lines changed: 0 additions & 9 deletions
This file was deleted.

routes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var auth = require('./middlewares/auth');
2323
var limit = require('./middlewares/limit');
2424
var status = require('./controllers/status');
2525
var github = require('./controllers/github');
26+
var search = require('./controllers/search');
2627
var passport = require('passport');
2728
var configMiddleware = require('./middlewares/conf');
2829
var config = require('./config');
@@ -136,4 +137,6 @@ module.exports = function (app) {
136137
github.callback);
137138
app.get('/auth/github/new', github.new);
138139
app.post('/auth/github/create', github.create);
140+
141+
app.get('/search', search.index);
139142
};

views/layout.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
.css('/public/stylesheets/style.css')
2727
.css('/public/libs/code-prettify/prettify.css')
2828
.css('/public/stylesheets/responsive.css')
29-
.css('/public/stylesheets/gsc.less')
3029
.done(assets, config.site_static_host, config.mini_assets)
3130
%>
3231
<%- Loader('/public/index.min.js')
@@ -52,19 +51,9 @@
5251
<div class='navbar-inner'>
5352
<div class='container'>
5453
<a class='brand' href='/'><%- config.site_logo || config.name %></a>
55-
<script>
56-
(function() {
57-
var cx = '013626818774326637431:k27snvx507a';
58-
var gcse = document.createElement('script');
59-
gcse.type = 'text/javascript';
60-
gcse.async = true;
61-
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
62-
'//www.google.com/cse/cse.js?cx=' + cx;
63-
var s = document.getElementsByTagName('script')[0];
64-
s.parentNode.insertBefore(gcse, s);
65-
})();
66-
</script>
67-
<gcse:searchbox-only newWindow="true"></gcse:searchbox-only>
54+
<form id='search_form' class='navbar-search' action="/search">
55+
<input type='text' id='q' name='q' class='search-query span3' value=''/>
56+
</form>
6857
<ul class='nav pull-right'>
6958
<li><a href='/'>首页</a></li>
7059
<li><a href='https://github.com/cnodejs/nodeclub/wiki/'>Wiki</a></li>

0 commit comments

Comments
 (0)