Skip to content

Commit

Permalink
Merge pull request #17 from BonsaiAI/dariusgarza-bonsai
Browse files Browse the repository at this point in the history
Dariusgarza bonsai
  • Loading branch information
jgarcia-bonsai authored Jan 3, 2017
2 parents 40bb6f4 + f182ce5 commit 95bb1cf
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.0.1)
activesupport (5.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
autoprefixer-rails (6.5.4)
autoprefixer-rails (6.6.1)
execjs
backports (3.6.8)
coffee-script (2.4.1)
Expand All @@ -24,7 +24,7 @@ GEM
coffee-script-source (1.12.2)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.0.3)
concurrent-ruby (1.0.4)
contracts (0.13.0)
dotenv (2.1.1)
erubis (2.7.0)
Expand Down Expand Up @@ -94,7 +94,7 @@ GEM
padrino-support (0.13.3.3)
activesupport (>= 3.1)
parallel (1.10.0)
public_suffix (2.0.4)
public_suffix (2.0.5)
rack (2.0.1)
rb-fsevent (0.9.8)
rb-inotify (0.9.7)
Expand Down Expand Up @@ -125,4 +125,4 @@ DEPENDENCIES
rouge!

BUNDLED WITH
1.13.6
1.13.7
15 changes: 15 additions & 0 deletions source/images/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions source/javascripts/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
//= require ./app/_toc
//= require ./app/_nav
//= require ./app/_darkbox.js
//= require ./app/_google-search
//= require ./app/_svg-fills
4 changes: 3 additions & 1 deletion source/javascripts/all_nosearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//= require ./lib/_energize
//= require ./app/_lang
//= require ./app/_toc
//= require ./app/_nav
//= require ./app/_nav
//= require ./app/_google-search
//= require ./app/_svg-fills
52 changes: 52 additions & 0 deletions source/javascripts/app/_google-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
(function() {
var cx = '003552815484763729059:feruzu5o53s';
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);
})();
window.onload = function(){
document.getElementById('gsc-i-id1').placeholder = 'Search Bonsai Docs';

$("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">');

};

$(function(){
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');

jQuery.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = jQuery(data).find('svg');

// Add replaced image's ID to the new SVG
if(typeof imgID !== 'undefined') {
$svg = $svg.attr('id', imgID);
}
// Add replaced image's classes to the new SVG
if(typeof imgClass !== 'undefined') {
$svg = $svg.attr('class', imgClass+' replaced-svg');
}

// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');

// Check if the viewport is set, else we gonna set it if we can.
if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
$svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
}

// Replace image with new SVG
$img.replaceWith($svg);

}, 'xml');

});
});

1 change: 1 addition & 0 deletions source/javascripts/app/_search-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$("td.gsc-search-button").empty().html('<input type="button" value="search" title="search">');
31 changes: 31 additions & 0 deletions source/javascripts/app/_svg-fills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Replace all SVG images with inline SVG
*/
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');

jQuery.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = jQuery(data).find('svg');

// Add replaced image's ID to the new SVG
if(typeof imgID !== 'undefined') {
$svg = $svg.attr('id', imgID);
}
// Add replaced image's classes to the new SVG
if(typeof imgClass !== 'undefined') {
$svg = $svg.attr('class', imgClass+' replaced-svg');
}

// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');

// Replace image with new SVG
$img.replaceWith($svg);

}, 'xml');

});
2 changes: 1 addition & 1 deletion source/layouts/home.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


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



Expand Down
39 changes: 35 additions & 4 deletions source/stylesheets/test.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ body{font-size:16px;}

.p2{font-size: 135%;font-weight: 400;}
.welcome{font-size:200%;text-align:center;background-color: transparent;background: none;margin: 0;margin-top: 90px;}
#browse ul li a:hover {color:#3bb94f;}


#browse ul li a:hover {color:#3bb94f;}
.content h3{
font-size: 142%;
margin-top: 2.5em;
margin-bottom: 0.8em;
font-weight: 400;
}



/*///////////////////////////////////////////////////////////////////////////////
// THE INCREADIBLE EDIBLE HAMBURGER NAV
////////////////////////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -139,7 +144,7 @@ nav ul li a:visited:hover {
nav ul li a:not(:only-child):after,
nav ul li a:visited:not(:only-child):after {
padding-left: 4px;
content: ' â–¾';
content: ' â–¾';
}
nav ul li ul li {
min-width: 190px;
Expand Down Expand Up @@ -291,3 +296,29 @@ article {
bottom: 0;
/*height: 9999%;*/
}



#gs_tti50 #gsc-i-id1 {background-image:none !important}
.gsc-control-cse {background-color:transparent !important; border:none !important;}
.gsc-wrapper > div:first-of-type {display:none !important;}
.gcsc-branding {display: none !important;}
#___gcse_0{width: 60Vw;margin: 0 auto;padding: 10px 0;margin-bottom: 85px;margin-top: 16px;}
.gsc-search-box-tools .gsc-search-box .gsc-input {padding-right:0 !important;/* height: 30px !important; */}
.gsc-input-box {
height:45px !important;
border-radius:3px;
border:solid 2px #ccc !important;
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
padding-left: 10px;
}

.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;}
svg path {fill: #fafafa !important;}

input.gsc-search-button {border:solid 2px #ccc !important;/* margin: 0 !important; */height: 45px !important;width: auto !important;margin-left: 0;}


0 comments on commit 95bb1cf

Please sign in to comment.