From 6fb187925684152fbc41e4031f2b08f6dad5c23b Mon Sep 17 00:00:00 2001 From: walljm Date: Sat, 27 Apr 2013 15:11:58 -0400 Subject: [PATCH] - moved event hookups into functions --- js/common.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/js/common.js b/js/common.js index edbcff19..0ec0018c 100644 --- a/js/common.js +++ b/js/common.js @@ -187,15 +187,8 @@ define(['jquery', 'reference', 'jquery.ui'], if (localStorage.Results !== "undefined" && localStorage.SearchResults !== "undefined") { $("#resultwrap").html(localStorage.Results); $("#searchresultswrap").html(localStorage.SearchResults); - $("#resultwrap").find(".hiddenlink").click(function(e) { - Util.HandleHiddenLink(e); - }); - $("#resultwrap").find(".removeresult").click(function(e) { - Util.RemoveResult(e); - }); - $("#searchresultswrap").find(".link").click(function(e) { - Util.HandleLink(e); - }); + Bible.AttachEvents($("#resultwrap")); + Words.AttachEvents($("#searchresultswrap")); } } }, @@ -252,7 +245,7 @@ define(['jquery', 'reference', 'jquery.ui'], $("#result").css("font-family", fontfamily); this.Save(); }, - ChangeDisplayStrongsInDialog: function(fontfamily) { + ChangeDisplayStrongsInDialog: function() { this.Save(); }, SaveResults: function() { @@ -298,12 +291,8 @@ define(['jquery', 'reference', 'jquery.ui'], } var t = $("
" + "

" + ref.toString() + "

" + r + "

"); - t.find(".hiddenlink").click(function(e) { - Util.HandleHiddenLink(e); - }); - t.find(".removeresult").click(function(e) { - Util.RemoveResult(e); - }); + Bible.AttachEvents(t); + $("#result").prepend(t); } catch (err) { @@ -379,6 +368,14 @@ define(['jquery', 'reference', 'jquery.ui'], Util.HandleError(err); } 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 = { @@ -590,9 +587,7 @@ define(['jquery', 'reference', 'jquery.ui'], var t = $(txt); - t.find(".link").click(function(e) { - Util.HandleLink(e); - }); + Words.AttachEvents(t); $("#searchresults").html(t); $("#searchTotal").html(results.length); @@ -1018,6 +1013,11 @@ define(['jquery', 'reference', 'jquery.ui'], Util.HandleError(err); } return null; + }, + AttachEvents: function(t){ + t.find(".link").click(function(e) { + Util.HandleLink(e); + }); } }; return {