Last active
January 6, 2017 19:39
-
-
Save Xinayder/01a1b339602ed89f08169177af4e952e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require(['gitbook', 'jquery'], (gitbook, $) => { | |
if (location.pathname == "/") { | |
// get the number of rows we'll need | |
var panels = $('div.search-noresults').find('div.panel.panel-default'); | |
var splat_panels = []; | |
for (;panels.length>0;) { | |
splat_panels.push(panels.splice(0, 2)); | |
} | |
// add the required number of rows | |
for (var i = 0; i < splat_panels.length; i++) { | |
var cols = []; | |
if (splat_panels[i].length == 2) { | |
cols = [ | |
$('<div class="col-md-6"></div>').append( | |
splat_panels[i][0] | |
), | |
$('<div class="col-md-6"></div>').append( | |
splat_panels[i][1] | |
) | |
]; | |
} else { | |
cols = [ | |
$('<div class="col-md-12"></div>').append( | |
splat_panels[i][0] | |
) | |
] | |
} | |
$('div.search-noresults').prepend( | |
$('<div class="row"></div>').append( | |
cols | |
) | |
); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment