View Full Version : So i made this in my free time...

21st January 2017, 20:51

This is a global search bar. It doesn't really work. It's supposed to take you to a custom Google search but when I loaded it up on Liveweaver, it loaded the UI twice! So I am not sure if it actually works or not. Anyways, here's the code if the site admins wanna use it. It's actually a series of free to use tutorials involving the search bar but I changed them to fit the navbar. The Liveweaver did not let me edit the Navbar but I changed it's height a bit too.


<form class="form-wrapper">
<input type="text" id="search" placeholder="Search for..." required>
<input type="submit" value="go" id="submit">


.form-wrapper {


.form-wrapper #search {
border: 1px solid #CCC;
-webkit-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #FFF;
-moz-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #FFF;
box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #FFF;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 12px;
color: #999;
float: left;
font: 16px Lucida Sans, Trebuchet MS, Tahoma, sans-serif;
height: 12px;
padding: 11px;
width: 320px;

.form-wrapper #search:focus {
border-color: #aaa;
-webkit-box-shadow: 0 1px 1px #bbb inset;
-moz-box-shadow: 0 1px 1px #bbb inset;
box-shadow: 0 1px 1px #bbb inset;
outline: 1;

.form-wrapper #search:-moz-placeholder,
.form-wrapper #search:-ms-input-placeholder,
.form-wrapper #search::-webkit-input-placeholder {
color: #666;
font-weight: normal;

.form-wrapper #submit {
background-color: #FFEBCD
background-image: -webkit-gradient(linear, left top, left bottom, from(#ADFF2F), to( #FFEBCD));
background-image: -webkit-linear-gradient(top, #ADFF2F, #FFEBCD);
background-image: -moz-linear-gradient(top, #31b2c3, #0483a0);
background-image: -ms-linear-gradient(top, #31b2c3, #0483a0);
background-image: -o-linear-gradient(top, #31b2c3, #0483a0);
background-image: linear-gradient(top, #31b2c3, #0483a0);
border: 1px solid #00748f;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #FFF;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #FFF;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #FFF;
color: #F5F5DC;
cursor: pointer;
height: 32px;
float: left;
width: 50px;
font: 18px Arial, Helvetica;
padding: 0;
text-transform: uppercase;
text-shadow: 0 1px 0 rgba(0, 0 ,0, .3);


.form-wrapper #submit:hover,
.form-wrapper #submit:focus {
background-color: #31b2c3;
background-image: -webkit-gradient(linear, left top, left bottom, from(#0483a0), to(#31b2c3));
background-image: -webkit-linear-gradient(top, #0483a0, #31b2c3);
background-image: -moz-linear-gradient(top, #0483a0, #31b2c3);
background-image: -ms-linear-gradient(top, #0483a0, #31b2c3);
background-image: -o-linear-gradient(top, #0483a0, #31b2c3);
background-image: linear-gradient(top, #0483a0, #31b2c3);

.form-wrapper #submit:active {
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
outline: 0;

.form-wrapper #submit::-moz-focus-inner {
border: 0;

.navbar {
height: 73px;
background:#2f4456 none ;
margin:10px 0px 0px 0px;
color:rgb(255, 255, 255);
font: 11px Arial, Calibri, Verdana, Geneva, sans-serif;
border:0px solid rgb(255, 255, 255);



var config = {
siteURL : 'mugenarchive.com', // Change this to your site
searchSite : true,
type : 'web',
append : false,
perPage : 8, // A maximum of 8 is allowed by Google
page : 0 // The start page

// The small arrow that marks the active search icon:
var arrow = $('<span>',{className:'arrow'}).appendTo('ul.icons');

$('ul.icons li').click(function(){
var el = $(this);

// The icon is already active, exit
return false;


// Move the arrow below this icon
left : el.position().left,
marginLeft : (el.width()/2)-4

// Set the search type
config.type = el.attr('data-searchType');

// Adding the site domain as a label for the first radio button:
$('#siteNameLabel').append(' '+config.siteURL);

// Marking the Search tutorialzine.com radio as active:

// Marking the web search icon as active:

// Focusing the input text box:

return false;

// Listening for a click on one of the radio buttons.
// config.searchSite is either true or false.

config.searchSite = this.id == 'searchSite';

function googleSearch(settings){

// If no parameters are supplied to the function,
// it takes its defaults from the config object above:

settings = $.extend({},config,settings);
settings.term = settings.term || $('#s').val();

// Using the Google site:example.com to limit the search to a
// specific domain:
settings.term = 'site:'+settings.siteURL+' '+settings.term;

// URL of Google's AJAX search API
var apiURL = 'http://ajax.googleapis.com/ajax/services/search/'+settings.type+
var resultsDiv = $('#resultsDiv');

q : settings.term,
rsz : settings.perPage,
start : settings.page*settings.perPage

var results = r.responseData.results;


// If results were returned, add them to a pageContainer div,
// after which append them to the #resultsDiv:

var pageContainer = $('<div>',{className:'pageContainer'});

for(var i=0;i<results.length;i++){
// Creating a new result object and firing its toString method:
pageContainer.append(new result(results[i]) + '');

// This is executed when running a new search,
// instead of clicking on the More button:

pageContainer.append('<div class="clear"></div>')

var cursor = r.responseData.cursor;

// Checking if there are more pages with results,
// and deciding whether to show the More button:

if( +cursor.estimatedResultCount > (settings.page+1)*settings.perPage){
$('<div>',{id:'more'}).appendTo(resultsDiv).click(function (){
else {

// No results were found for this search.

className : 'notFound',
html : 'No Results Were Found!'

function result(r){

// This is class definition. Object of this class are created for
// each result. The markup is generated by the .toString() method.

var arr = [];

// GsearchResultClass is passed by the google API

case 'GwebSearch':
arr = [
'<div class="webResult">',
'<h2><a href="',r.url,'">',r.title,'</a></h2>',
'<a href="',r.url,'">',r.visibleUrl,'</a>',
case 'GimageSearch':
arr = [
'<div class="imageResult">',
'<a href="',r.url,'" title="',r.titleNoFormatting,
'" class="pic" style="width:',r.tbWidth,'px;height:',r.tbHeight,'px;">',
'<img src="',r.tbUrl,'" width="',r.tbWidth,'" height="',
r.tbHeight,'" /></a>','<div class="clear"></div>',
'<a href="',r.originalContextUrl,'">',r.visibleUrl,'</a>',
case 'GvideoSearch':
arr = [
'<div class="imageResult">',
'<a href="',r.url,'" title="',r.titleNoFormatting,'
" class="pic" style="width:150px;height:auto;">',
'<img src="',r.tbUrl,'" width="100%" /></a>',
'<div class="clear"></div>','<a href="',
case 'GnewsSearch':
arr = [
'<div class="webResult">',
'<h2><a href="',r.unescapedUrl,'">',r.title,'</a></h2>',
'<a href="',r.unescapedUrl,'">',r.publisher,'</a>',

// The toString method.
this.toString = function(){
return arr.join('');