2013-04-19 17:08:46 -04:00

73 lines
2.4 KiB
JavaScript

require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui"],
function($, db, common, ref) {
$(document).ready(function()
{
$("#searchform").submit(function()
{
common.Search($("#searchvalue").val());
return false;
});
$("#growfont").click(function()
{
common.Settings.IncreaseResultFontSize();
return false;
});
$("#shrinkfont").click(function()
{
common.Settings.DecreaseResultFontSize();
return false;
});
$("#switch-panes").click(function()
{
common.Settings.SwitchPanes();
return false;
});
$("#showhelp").click(function()
{
$("#help").dialog({
draggable:true,
width: 700,
height: 650,
resizable: true
});
});
$("#showhidesearch").click(function()
{
common.Settings.ShowHideSearch();
return false;
});
$("#changefont").change(function()
{
common.Settings.ChangeResultFont($("#changefont").val());
return false;
});
$("#result").sortable({
handle: ".p-handle"
});
// load querystring
var ref = decodeURIComponent(common.Util.GetUrlVars().r);
if (ref !== "undefined") {
// remember the settings, first, because if you have results, the load process would wipe out the passage you want to load.
common.Settings.Load();
// now load the passage from the querystring.
common.Search(ref);
$("#searchvalue").val(ref);
} else {
common.Settings.Load();
}
// you need to do this last, otherwise the settings load resets the window height.
$(window).bind("resize", function()
{
$("#searchresults").css("height", window.innerHeight - 200);
return false;
});
$("#searchresults").css("height", window.innerHeight - 200);
});
});