2013-05-15 14:53:31 -06:00
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
$ ( document ) . ready ( function ( ) {
// This function creates and styles the "qTip" tooltip that displays the resource uri and the rdf link when the user clicks the uri/rdf icon.
2013-05-31 09:23:05 -06:00
$ ( 'span#downloadResults' ) . children ( 'img#downloadIcon' ) . each ( function ( )
2013-05-15 14:53:31 -06:00
{
$ ( this ) . qtip (
{
content : {
prerender : true , // We need this for the .click() event listener on 'a.close'
2013-05-31 09:23:05 -06:00
text : '<div style="float:right; width:150px">'
+ '<p><label for="amount" style="font-size:14px;">Maximum Records:</label>'
+ '<input disabled type="text" id="amount" style="margin-left:35px; border: 0; color: #f6931f; font-weight: bold; width:45px" /></p>'
+ '<div id="slider-vertical" style="margin-left:60px; margin-top: -20px; height: 100px; background-color:white"></div>'
+ '</div>'
+ '<div style="float:left; width:300px"><h5>Download the results from this search</h5> '
+ '<h5 class ="download-url"><a id=xmlDownload href="' + urlsBase + '/search?' + queryText + '&xml=1&hitsPerPage=500">download results in XML format</a></h5>'
+ '<h5 class ="download-url"><a id=csvDownload href="' + urlsBase + '/search?' + queryText + '&csv=1&hitsPerPage=500">download results in CSV format</a></h5>'
+ '<br /><a class="close" href="#">close</a></div>'
2013-05-15 14:53:31 -06:00
} ,
position : {
corner : {
target : 'bottomLeft' ,
tooltip : 'topLeft'
}
} ,
show : {
when : { event : 'click' }
} ,
hide : {
fixed : true , // Make it fixed so it can be hovered over and interacted with
when : {
target : $ ( 'a.close' ) ,
event : 'click'
}
} ,
style : {
padding : '1em' ,
2013-05-31 09:23:05 -06:00
width : 500 ,
2013-05-15 14:53:31 -06:00
backgroundColor : '#f1f2ee'
}
} ) ;
2013-05-31 09:23:05 -06:00
2013-05-15 14:53:31 -06:00
} ) ;
2013-05-31 09:23:05 -06:00
$ ( "#slider-vertical" ) . slider ( {
orientation : "vertical" ,
range : "min" ,
min : 10 ,
max : 1000 ,
value : 500 ,
slide : function ( event , ui ) {
$ ( "#amount" ) . val ( ui . value ) ;
$ ( '#csvDownload' ) . attr ( "href" , urlsBase + '/search?' + queryText + '&csv=1&hitsPerPage=' + ui . value ) ;
$ ( '#xmlDownload' ) . attr ( "href" , urlsBase + '/search?' + queryText + '&xml=1&hitsPerPage=' + ui . value ) ;
}
} ) ;
$ ( "#amount" ) . val ( $ ( "#slider-vertical" ) . slider ( "value" ) ) ;
2013-05-15 14:53:31 -06:00
// Prevent close link for URI qTip from requesting bogus '#' href
$ ( 'a.close' ) . click ( function ( ) {
$ ( '#downloadIcon' ) . qtip ( "hide" ) ;
return false ;
} ) ;
2013-05-31 09:23:05 -06:00
2013-05-15 14:53:31 -06:00
} ) ;