$(document).ready(function() { $.ajaxSetup({ timeout: 10000, cache: true }) // apply default properties startRecord = 0; maximumRecords = 10; yconf = $.extend({ url : 'is a mandatory property - no default', theme : 'start', title : 'YaCy P2P Web Search', width : 420, height : 500, position: ['top',50], modal: false, resizable: true, show: '', hide: '' }, yconf); $('
').appendTo("#yacy"); var style1 = yconf.url + '/yacy/ui/css/yacyui-portalsearch.css'; var style2 = yconf.url + '/yacy/ui/css/themes/'+yconf.theme+'/ui.all.css'; var head = document.getElementsByTagName('head')[0]; $(document.createElement('link')) .attr({type:'text/css', href: style1, rel:'stylesheet', media:'screen'}) .appendTo(head); $(document.createElement('link')) .attr({type:'text/css', href: style2, rel:'stylesheet', media:'screen'}) .appendTo(head); var script1 = yconf.url + '/yacy/ui/js/jquery.query.js'; var script2 = yconf.url + '/yacy/ui/js/jquery.form.js'; var script3 = yconf.url + '/yacy/ui/js/jquery.field.min.js'; var script4 = yconf.url + '/yacy/ui/js/jquery-faviconize-1.0.js'; var script5 = yconf.url + '/yacy/ui/js/jquery.ui.all.min.js'; $.getScript(script1, function(){}); $.getScript(script2, function(){}); $.getScript(script3, function(){}); $.getScript(script4, function(){}); $.getScript(script5, function(){ maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue()); $("#ypopup").dialog({ autoOpen: false, height: yconf.height, width: yconf.width, minWidth: yconf.width, position: yconf.position, modal: yconf.modal, resizable: yconf.resizable, title: yconf.title, show: yconf.show, hide: yconf.hide, buttons: { Next: function() { startRecord = startRecord + maximumRecords; $('#ysearch').trigger('submit'); }, Prev: function() { startRecord = startRecord - maximumRecords; if(startRecord < 0) startRecord = 0; $('#ysearch').trigger('submit'); } } }); }); $('#ysearch').keyup(function() { startRecord = 0; $('#ysearch').trigger('submit'); return false; }); $('#ysearch').submit(function() { var url = yconf.url + '/yacysearch.json?callback=?' $('#ypopup').empty(); $('#ypopup').append(""+item.description+"
"; var date = ""+item.pubDate.substring(0,16); var size = " | "+item.sizename+"
"; $(title+desc+url+date+size).appendTo("#ypopup"); } } ); $(".linktitle a").faviconize({ position: "before", defaultImage: yconf.url + "/yacy/ui/img-2/article.png", className: "favicon" }); } ); return false; }); });