Skip to content

Commit 95bb1cf

Browse files
Merge pull request #17 from BonsaiAI/dariusgarza-bonsai
Dariusgarza bonsai
2 parents 40bb6f4 + f182ce5 commit 95bb1cf

File tree

9 files changed

+145
-11
lines changed

9 files changed

+145
-11
lines changed

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ GIT
88
GEM
99
remote: https://rubygems.org/
1010
specs:
11-
activesupport (5.0.0.1)
11+
activesupport (5.0.1)
1212
concurrent-ruby (~> 1.0, >= 1.0.2)
1313
i18n (~> 0.7)
1414
minitest (~> 5.1)
1515
tzinfo (~> 1.1)
1616
addressable (2.5.0)
1717
public_suffix (~> 2.0, >= 2.0.2)
18-
autoprefixer-rails (6.5.4)
18+
autoprefixer-rails (6.6.1)
1919
execjs
2020
backports (3.6.8)
2121
coffee-script (2.4.1)
@@ -24,7 +24,7 @@ GEM
2424
coffee-script-source (1.12.2)
2525
compass-import-once (1.0.5)
2626
sass (>= 3.2, < 3.5)
27-
concurrent-ruby (1.0.3)
27+
concurrent-ruby (1.0.4)
2828
contracts (0.13.0)
2929
dotenv (2.1.1)
3030
erubis (2.7.0)
@@ -94,7 +94,7 @@ GEM
9494
padrino-support (0.13.3.3)
9595
activesupport (>= 3.1)
9696
parallel (1.10.0)
97-
public_suffix (2.0.4)
97+
public_suffix (2.0.5)
9898
rack (2.0.1)
9999
rb-fsevent (0.9.8)
100100
rb-inotify (0.9.7)
@@ -125,4 +125,4 @@ DEPENDENCIES
125125
rouge!
126126

127127
BUNDLED WITH
128-
1.13.6
128+
1.13.7

source/images/search.svg

Lines changed: 15 additions & 0 deletions
Loading

source/javascripts/all.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
//= require ./app/_toc
55
//= require ./app/_nav
66
//= require ./app/_darkbox.js
7+
//= require ./app/_google-search
8+
//= require ./app/_svg-fills

source/javascripts/all_nosearch.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//= require ./lib/_energize
22
//= require ./app/_lang
33
//= require ./app/_toc
4-
//= require ./app/_nav
4+
//= require ./app/_nav
5+
//= require ./app/_google-search
6+
//= require ./app/_svg-fills
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
(function() {
2+
var cx = '003552815484763729059:feruzu5o53s';
3+
var gcse = document.createElement('script');
4+
gcse.type = 'text/javascript';
5+
gcse.async = true;
6+
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
7+
var s = document.getElementsByTagName('script')[0];
8+
s.parentNode.insertBefore(gcse, s);
9+
})();
10+
window.onload = function(){
11+
document.getElementById('gsc-i-id1').placeholder = 'Search Bonsai Docs';
12+
13+
$("td.gsc-search-button").empty().html('<input type="image" src="https://dl.dropboxusercontent.com/s/l4e4aa6s5t9m4xx/search.svg?dl=0" class="gsc-search-button gsc-search-button-v2 svg" title="search">');
14+
15+
};
16+
17+
$(function(){
18+
jQuery('img.svg').each(function(){
19+
var $img = jQuery(this);
20+
var imgID = $img.attr('id');
21+
var imgClass = $img.attr('class');
22+
var imgURL = $img.attr('src');
23+
24+
jQuery.get(imgURL, function(data) {
25+
// Get the SVG tag, ignore the rest
26+
var $svg = jQuery(data).find('svg');
27+
28+
// Add replaced image's ID to the new SVG
29+
if(typeof imgID !== 'undefined') {
30+
$svg = $svg.attr('id', imgID);
31+
}
32+
// Add replaced image's classes to the new SVG
33+
if(typeof imgClass !== 'undefined') {
34+
$svg = $svg.attr('class', imgClass+' replaced-svg');
35+
}
36+
37+
// Remove any invalid XML tags as per http://validator.w3.org
38+
$svg = $svg.removeAttr('xmlns:a');
39+
40+
// Check if the viewport is set, else we gonna set it if we can.
41+
if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
42+
$svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
43+
}
44+
45+
// Replace image with new SVG
46+
$img.replaceWith($svg);
47+
48+
}, 'xml');
49+
50+
});
51+
});
52+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$("td.gsc-search-button").empty().html('<input type="button" value="search" title="search">');
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Replace all SVG images with inline SVG
3+
*/
4+
jQuery('img.svg').each(function(){
5+
var $img = jQuery(this);
6+
var imgID = $img.attr('id');
7+
var imgClass = $img.attr('class');
8+
var imgURL = $img.attr('src');
9+
10+
jQuery.get(imgURL, function(data) {
11+
// Get the SVG tag, ignore the rest
12+
var $svg = jQuery(data).find('svg');
13+
14+
// Add replaced image's ID to the new SVG
15+
if(typeof imgID !== 'undefined') {
16+
$svg = $svg.attr('id', imgID);
17+
}
18+
// Add replaced image's classes to the new SVG
19+
if(typeof imgClass !== 'undefined') {
20+
$svg = $svg.attr('class', imgClass+' replaced-svg');
21+
}
22+
23+
// Remove any invalid XML tags as per http://validator.w3.org
24+
$svg = $svg.removeAttr('xmlns:a');
25+
26+
// Replace image with new SVG
27+
$img.replaceWith($svg);
28+
29+
}, 'xml');
30+
31+
});

source/layouts/home.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
<p class="welcome">Welcome to Bonsai Docs</p>
38-
<div id="search"><span>Future home of the search bar 🔎</span></div>
38+
<gcse:search></gcse:search>
3939

4040

4141

source/stylesheets/test.css

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ body{font-size:16px;}
7171

7272
.p2{font-size: 135%;font-weight: 400;}
7373
.welcome{font-size:200%;text-align:center;background-color: transparent;background: none;margin: 0;margin-top: 90px;}
74-
#browse ul li a:hover {color:#3bb94f;}
75-
76-
74+
#browse ul li a:hover {color:#3bb94f;}
75+
.content h3{
76+
font-size: 142%;
77+
margin-top: 2.5em;
78+
margin-bottom: 0.8em;
79+
font-weight: 400;
80+
}
7781

7882

83+
7984
/*///////////////////////////////////////////////////////////////////////////////
8085
// THE INCREADIBLE EDIBLE HAMBURGER NAV
8186
////////////////////////////////////////////////////////////////////////////////*/
@@ -139,7 +144,7 @@ nav ul li a:visited:hover {
139144
nav ul li a:not(:only-child):after,
140145
nav ul li a:visited:not(:only-child):after {
141146
padding-left: 4px;
142-
content: ' â–¾';
147+
content: ' â–¾';
143148
}
144149
nav ul li ul li {
145150
min-width: 190px;
@@ -291,3 +296,29 @@ article {
291296
bottom: 0;
292297
/*height: 9999%;*/
293298
}
299+
300+
301+
302+
#gs_tti50 #gsc-i-id1 {background-image:none !important}
303+
.gsc-control-cse {background-color:transparent !important; border:none !important;}
304+
.gsc-wrapper > div:first-of-type {display:none !important;}
305+
.gcsc-branding {display: none !important;}
306+
#___gcse_0{width: 60Vw;margin: 0 auto;padding: 10px 0;margin-bottom: 85px;margin-top: 16px;}
307+
.gsc-search-box-tools .gsc-search-box .gsc-input {padding-right:0 !important;/* height: 30px !important; */}
308+
.gsc-input-box {
309+
height:45px !important;
310+
border-radius:3px;
311+
border:solid 2px #ccc !important;
312+
display: -ms-flexbox;
313+
display: flex;
314+
-ms-flex-align: center;
315+
align-items: center;
316+
padding-left: 10px;
317+
}
318+
319+
.gsc-search-button .gsc-search-button-v2 {background-color: hsl(0, 0%, 92%);padding: 0;margin-left: 0;box-sizing: border-box;padding: 10px;min-width: 73px;height: 49px !important;border-left: none;margin-left: -5px;}
320+
svg path {fill: #fafafa !important;}
321+
322+
input.gsc-search-button {border:solid 2px #ccc !important;/* margin: 0 !important; */height: 45px !important;width: auto !important;margin-left: 0;}
323+
324+

0 commit comments

Comments
 (0)