forked from ringcentral/slate
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from BonsaiAI/dariusgarza-bonsai
Dariusgarza bonsai
- Loading branch information
Showing
9 changed files
with
145 additions
and
11 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
---|---|---|
@@ -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 |
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,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'); | ||
|
||
}); | ||
}); | ||
|
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 @@ | ||
$("td.gsc-search-button").empty().html('<input type="button" value="search" title="search">'); |
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,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'); | ||
|
||
}); |
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
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