<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>search box test</title>
<style type="text/css">
/*Initial definitions for base column.Define the (minimum) width here, and optionally a padding */
.columnized div
{
float : left;
width : 9.5em;
padding : 0px; /* You may use a padding... but thanks to IE you can only use pixels! */
text-align : left;
margin : 0; /* Don't use a margin! */
}
body
{
text-align : center;
font-family : verdana, arial, sans-serif;
color : #555555;
line-height : 0.82em;
font-size : 87%;
background-color : white;
}
p
{
margin : 0px;
padding : 0px;
whitespace : nowrap;
}
#container
{
width :100%;
text-align :center;
}
#searchDiv
{
width:100%;
margin-bottom : 10px;
}
</style>
<script type="text/javascript">
/*
MultiColumn text reflower v1.4 by Randy Simons
see http://randysimons.com/overige/multicolumn/multicolumn.js for more details.
License: (BSD-license)
Copyright (c) 2007, Randy Simons
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-Neither the name of Randy Simons nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
More information and contact:
http://randysimons.com
*/
//Some stuff needs to be maintained in a global variable.
MultiColumnResizeTimer=null;
MultiColumnList=null;
function MultiColumnSettings()
{
this.extraHeight = 0; //Add extra height to a column. Increase this if the last column 'sticks out' too much.
this.minSplitHeight = 0; //If the base column is smaller than minSplitHeight, the column does not split.
this.minHeight = 0; //Minimum height of a column
this.readOnText = null; //Add the "read on" notice a the bottom of each column
this.classNameScreen = null; //Set the classname of *container* of the rendered columns for screen-media. Use to differentiate between JS/non-JS base column widths.
this.classNamePrint = null; //Set the classname of *container* of the rendered columns for print-media. (optional, may be null)
this.numberOfColumns = null; //null: calculate number of columns based on minimum width. Number >0: use specified number of columns, always adapt width.
}
function MultiColumn(columnContainerIn,settingsIn)
{
//IE6 doesn't support HTMLElement prototyping. IE7 probably won't too. Let's aim for IE8! *sigh*
//But thank you, www.quirksmode.org!
this.getStyle= function (element,stylePropW3,stylePropIE)
{
var y = null;
if (element.currentStyle)
y = element.currentStyle[stylePropIE];
else if (window.getComputedStyle && document.defaultView.getComputedStyle(element,null))
{
y = document.defaultView.getComputedStyle(element,null).getPropertyValue(stylePropW3);
}
return y;
}
this.generateColumns= function ()
{
var i=0;
var numColumns;
//Obtain the base column. This column contains the original text.
var baseColumn=this.columnContainer.getElementsByTagName('div').item(0);
//Add a node with style: "clear: both;" to stretch the container-node.
var clearingNode=document.createElement('span');
clearingNode.style.display="block";
clearingNode.style.clear="both";
clearingNode.style.zoom="1"; //yet another work-around for a certain obsolete browser.
this.columnContainer.appendChild(clearingNode);
//Use specified number of columns, or calculate number based on minimum width?
if (this.settings.numberOfColumns!=null)
{
//Use specified number of columns
numColumns=this.settings.numberOfColumns;
}
else
{
//Calculate the number of columns that can be added, based on width.
numColumns=Math.floor(this.columnContainer.offsetWidth/(baseColumn.offsetWidth)); //baseColumn.getStyle('width') gives wrong value in Opera
}
//Calculate the available width for one column.
var availableWidth = Math.floor((this.columnContainer.offsetWidth-10)/numColumns)-parseInt(this.getStyle(baseColumn,'padding-right','paddingRight'))-parseInt(this.getStyle(baseColumn,'padding-left','paddingLeft'));
//First, set the new width for the existing column..
baseColumn.style.width=availableWidth+'px';
//Add new columns
for (i=1;i<numColumns;i++)
{
this.columnContainer.insertBefore(baseColumn.cloneNode(false),this.columnContainer.firstChild);
}
//Get all columns in the container
var columns=this.columnContainer.getElementsByTagName('div');
//..then calculate the average needed height for other .
var minHeight;
if( baseColumn.offsetHeight <= this.settings.minSplitHeight )
{
var minHeight = baseColumn.offsetHeight;
}
else
{
var minHeight = Math.max( Math.ceil( baseColumn.offsetHeight / columns.length ), this.settings.minHeight );
}
//Cut/paste blocks from the baseColumn to the new columns, until the reached the minHeight.
for (i=0;i<columns.length-1;i++)
{
var currentColumn=columns.item(i);
currentColumn.style.width=availableWidth+'px';
//Cut/paste blocks from the baseColumn to the current column, while the
//current column has not reach the minHeight
while( currentColumn.offsetHeight < minHeight && baseColumn.hasChildNodes() )
{
if (baseColumn.firstChild.nodeType==1) //Node.ELEMENT_NODE Doesn't work in ^%@$#@$!!! IE6
{
currentColumn.appendChild(baseColumn.firstChild);
}
else
{
baseColumn.removeChild(baseColumn.firstChild);
}
}
}
//Stretch all columns to equal height
var maxHeight=0;
for (i=0;i<columns.length;i++) {
maxHeight=Math.max(maxHeight,columns.item(i).offsetHeight);
}
for (i=0;i<columns.length;i++) {
columns.item(i).style.height=maxHeight+"px";
}
}
//Initialisation starts here
this.settings=settingsIn;
this.columnContainer=columnContainerIn;
//If a screen class name is set,
if (this.settings.classNameScreen!=null) {
//assign the classname.
this.columnContainer.className=this.settings.classNameScreen;
}
//Store a copy of the original column
this.originalContent=columnContainerIn.cloneNode(true);
//Add this MultiColumn to the listener.
if (MultiColumnList === null) {
MultiColumnList = new Array;
if (window.addEventListener) {
window.addEventListener('resize',multiColumnSetResizeTimer,false);
} else {
window.attachEvent('onresize',multiColumnSetResizeTimer);
}
}
MultiColumnList.push(this);
//And do the magic!
this.generateColumns();
}
//Regenerates the columns after a short delay after the user stopped resizing.
function multiColumnSetResizeTimer() {
if (MultiColumnResizeTimer) {
clearTimeout(MultiColumnResizeTimer);
}
MultiColumnResizeTimer=setTimeout(multiColumnResize,100);
}
//Called when window is resized.
function multiColumnResize() {
if (!window.addEventListener && window.attachEvent) { //Damned IE keeps fireing events when reflowing the text!
window.detachEvent('onresize',multiColumnSetResizeTimer);
}
for (var i=0; i<MultiColumnList.length;i++) {
var object = MultiColumnList[i];
//Restore original situation
var newCopy=object.originalContent.cloneNode(true);
object.columnContainer.parentNode.replaceChild(newCopy,object.columnContainer);
object.columnContainer=newCopy;
//Regenerate columns
object.generateColumns();
}
if (!window.addEventListener && window.attachEvent) {
setTimeout("window.attachEvent('onresize',multiColumnSetResizeTimer)",0);
}
}
</script>
<script type="text/javascript">
// Minimalistic settings. You can tweak the settings by re-assigning the defaults in MultiColumnSettings.
multiColumnSettings = new MultiColumnSettings;
multiColumnSettings.classNameScreen ='columnized';
window.onload = function ()
{
new MultiColumn( document.getElementById( "container" ), multiColumnSettings );
}
</script>
<script type="text/javascript">
function countWords( str )
{
var regex = /[^\/\-\\\]\"\s.+|?!()§@#^{}[$£*`'%:;,=~·<>]+[\/\-\\\]\"\s.+|?!()§@#^{}[$£*`'%:;,=~·<>]*/g, // count the words in the query.
matches = str.match( regex );
return matches.length;
}
function addHosters( cBoxes )
{
var queries = [];
queries['4shared'] = "4shared.com";
queries['badongo'] = "badongo.com/file";
queries['bonpoo'] = "bonpoo.com/cgi-bin/download";
queries['boxNet'] = "box.net/shared";
queries['depositFiles'] = "depositfiles.com/files/";
queries['divshare'] = "divshare.com/download/";
queries['filefactory'] = "filefactory.com/file/";
queries['filefront'] = "filefront.com/file/\"|\"files.filefront.com";
queries['filesTo'] = "files.to/get/";
queries['flyupload'] = "flyupload.com";
queries['hidelinker'] = "hidelinker.com/show.php";
queries['justupit'] = "justupit.com/download.php";
queries['megashares'] = "megashares.com/";
queries['megaupload'] = "MegaUpload.com/?d=";
queries['mediafire'] = "mediafire.com/download.php";
queries['mihdNet'] = "Mihd.net\"|\"iFile.it";
queries['mybloop'] = "mybloop.com";
queries['oxyshare'] = "oxyshare.com/get";
queries['rapidshare'] = "rapidshare.com/files\"|\"rapidshare.de/files";
queries['rnbload'] = "RnbLoad.com/file/";
queries['sendspace'] = "sendspace.com/file/";
queries['yastorage'] = "yastorage.com/download.php";
var finalQueries = [],
hosts = [],
queryNum = 0,
inputWordsCount = countWords( document.forms.searchForm.lineEdit.value ),
outputWordsCount = inputWordsCount;
if( inputWordsCount > 30 )
{
alert( "You try to search for " + inputWordsCount + " words. Please note that Google limits the length of their queries to 32 words. This means that if you try to search for more than 30 words, it is impossible to add any more hosters to your query. Please specify less search terms and try again." );
return;
}
for( var i = 0; i < cBoxes.length; i++ )
{
if( !cBoxes[i].checked ) continue;
var hostWords = countWords( queries[ cBoxes[i].id ] );
if( outputWordsCount + hostWords > 32 )
{
finalQueries[ queryNum++ ] = document.forms.searchForm.lineEdit.value.concat( ' "', hosts.join( "\"|\"" ), '"' );
outputWordsCount = inputWordsCount;
hosts = [];
}
hosts.push( queries[ cBoxes[i].id ] );
outputWordsCount += hostWords;
}
finalQueries[ queryNum ] = document.forms.searchForm.lineEdit.value.concat( ' "', hosts.join( "\"|\"" ), '"' );
function postIt()
{
document.forms.searchForm.q.value = finalQueries.shift();
document.forms.searchForm.submit();
}
for( var i = finalQueries.length; i; --i )
{
setTimeout( postIt, ( i-1 )*2000 );
}
}
function checkAll( cBoxes )
{
for( i = 0; i < cBoxes.length; i++ )
cBoxes[i].checked = true ;
}
function uncheckAll( cBoxes )
{
for( i = 0; i < cBoxes.length; i++ )
cBoxes[i].checked = false ;
}
function enterPressed( e, form )
{
var key = e.keyCode || e.which;
if (key==13) addHosters( document.searchForm.hosters );
}
</script>
</head><body>
<form name="searchForm" action="http://www.google.com/search" target="_blank" onsubmit="return false;">
<div id="searchDiv">
<input name="CheckAll" value="Check All" onclick="checkAll( document.searchForm.hosters );" type="button">
<input name="UnCheckAll" value="Clear All" onclick="uncheckAll( document.searchForm.hosters );" type="button">
<input name="reset" id="reset" value="Reset" type="reset">
<input name="hl" value="en" type="hidden">
<input name="q" title="Google Search" value="" type="hidden">
<input maxlength="2048" name="lineEdit" size="70" title="Google Search" value="" onkeypress="enterPressed( event,this.form );">
<input name="btnG" value="Google Search" onclick="addHosters( document.searchForm.hosters );" type="button">
</div>
<div class="columnized" id="container">
<div>
<p> <input name="hosters" id="4shared" checked="1" type="checkbox">4shared.com </p>
<p> <input name="hosters" id="badongo" checked="1" type="checkbox">Badongo </p>
<p> <input name="hosters" id="bonpoo" type="checkbox">Bonpoo </p>
<p> <input name="hosters" id="boxNet" type="checkbox">Box.net </p>
<p> <input name="hosters" id="depositFiles" checked="1" type="checkbox">DepositFiles </p>
<p> <input name="hosters" id="divshare" type="checkbox">Divshare </p>
<p> <input name="hosters" id="filefactory" type="checkbox">Filefactory </p>
<p> <input name="hosters" id="filefront" type="checkbox">Filefront </p>
<p> <input name="hosters" id="filesTo" type="checkbox">Files.to </p>
<p> <input name="hosters" id="flyupload" type="checkbox">Flyupload </p>
<p> <input name="hosters" id="justupit" type="checkbox">JustUpit.com </p>
<p> <input name="hosters" id="megashares" type="checkbox">MegaShares </p>
<p> <input name="hosters" id="megaupload" checked="1" type="checkbox">MegaUpload </p>
<p> <input name="hosters" id="mediafire" checked="1" type="checkbox">MediaFire </p>
<p> <input name="hosters" id="mihdNet" type="checkbox">Mihd.net/iFile.it</p>
<p> <input name="hosters" id="mybloop" type="checkbox">MyBloop </p>
<p> <input name="hosters" id="oxyshare" type="checkbox">OxyShare </p>
<p> <input name="hosters" id="rapidshare" checked="1" type="checkbox">Rapidshare </p>
<p> <input name="hosters" id="rnbload" type="checkbox">RnbLoad </p>
<p> <input name="hosters" id="sendspace" checked="1" type="checkbox">SendSpace </p>
<p> <input name="hosters" id="yastorage" type="checkbox">Yastorage </p></div>
</div>
</div>
</form>
</body></html>