- moved event hookups into functions

This commit is contained in:
walljm 2013-04-27 15:11:58 -04:00
parent 0857a03e47
commit 6fb1879256

View File

@ -187,15 +187,8 @@ define(['jquery', 'reference', 'jquery.ui'],
if (localStorage.Results !== "undefined" && localStorage.SearchResults !== "undefined") { if (localStorage.Results !== "undefined" && localStorage.SearchResults !== "undefined") {
$("#resultwrap").html(localStorage.Results); $("#resultwrap").html(localStorage.Results);
$("#searchresultswrap").html(localStorage.SearchResults); $("#searchresultswrap").html(localStorage.SearchResults);
$("#resultwrap").find(".hiddenlink").click(function(e) { Bible.AttachEvents($("#resultwrap"));
Util.HandleHiddenLink(e); Words.AttachEvents($("#searchresultswrap"));
});
$("#resultwrap").find(".removeresult").click(function(e) {
Util.RemoveResult(e);
});
$("#searchresultswrap").find(".link").click(function(e) {
Util.HandleLink(e);
});
} }
} }
}, },
@ -252,7 +245,7 @@ define(['jquery', 'reference', 'jquery.ui'],
$("#result").css("font-family", fontfamily); $("#result").css("font-family", fontfamily);
this.Save(); this.Save();
}, },
ChangeDisplayStrongsInDialog: function(fontfamily) { ChangeDisplayStrongsInDialog: function() {
this.Save(); this.Save();
}, },
SaveResults: function() { SaveResults: function() {
@ -298,12 +291,8 @@ define(['jquery', 'reference', 'jquery.ui'],
} }
var t = $("<div class='passage result'><a href='javascript:void();' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><span class='resultbody'>" + "<h2><a href='http://www.dynamicbible.com/?r="+ ref.toString() + "'>" + ref.toString() + "</a></h2>" + r + "</span><br clear='all' /></div>"); var t = $("<div class='passage result'><a href='javascript:void();' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><span class='resultbody'>" + "<h2><a href='http://www.dynamicbible.com/?r="+ ref.toString() + "'>" + ref.toString() + "</a></h2>" + r + "</span><br clear='all' /></div>");
t.find(".hiddenlink").click(function(e) { Bible.AttachEvents(t);
Util.HandleHiddenLink(e);
});
t.find(".removeresult").click(function(e) {
Util.RemoveResult(e);
});
$("#result").prepend(t); $("#result").prepend(t);
} }
catch (err) { catch (err) {
@ -379,6 +368,14 @@ define(['jquery', 'reference', 'jquery.ui'],
Util.HandleError(err); Util.HandleError(err);
} }
return null; return null;
},
AttachEvents: function(t){
t.find(".hiddenlink").click(function(e) {
Util.HandleHiddenLink(e);
});
t.find(".removeresult").click(function(e) {
Util.RemoveResult(e);
});
} }
}; };
var Strongs = { var Strongs = {
@ -590,9 +587,7 @@ define(['jquery', 'reference', 'jquery.ui'],
var t = $(txt); var t = $(txt);
t.find(".link").click(function(e) { Words.AttachEvents(t);
Util.HandleLink(e);
});
$("#searchresults").html(t); $("#searchresults").html(t);
$("#searchTotal").html(results.length); $("#searchTotal").html(results.length);
@ -1018,6 +1013,11 @@ define(['jquery', 'reference', 'jquery.ui'],
Util.HandleError(err); Util.HandleError(err);
} }
return null; return null;
},
AttachEvents: function(t){
t.find(".link").click(function(e) {
Util.HandleLink(e);
});
} }
}; };
return { return {