Merge in upstream changes.

This commit is contained in:
Jeremy Wall (zaphar) 2013-04-27 17:44:52 -04:00
commit 34de294ed1
2 changed files with 39 additions and 42 deletions

View File

@ -187,15 +187,8 @@ define(['jquery', 'reference', 'tagging', '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', 'tagging', 'jquery.ui'],
$("#result").css("font-family", fontfamily);
this.Save();
},
ChangeDisplayStrongsInDialog: function(fontfamily) {
ChangeDisplayStrongsInDialog: function() {
this.Save();
},
SaveResults: function() {
@ -299,35 +292,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
// TODO(jwall): hover should show tags for the verse.
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) {
Util.HandleHiddenLink(e);
});
t.find(".removeresult").click(function(e) {
Util.RemoveResult(e);
});
// TODO(jwall): support longtouch events on mobile?
t.find(".resultbody h2").tooltip({
items: ".resultbody h2",
content: function(tt) {
tagging.GetTags(
ref.toString(), {
success: function(data) {
var tags = data ?
(data.data ?
data.data.tagList : null) : null;
var hoverContent =
$("<div>Tags: </div>");
hoverContent.append(
tags ? tags.join(", ") : "N/A");
tt(hoverContent);
}});
}
});
t.find(".hiddenlink").tooltip(
{
items: ".hiddenlink"
}
);
Bible.AttachEvents(t, ref);
$("#result").prepend(t);
}
catch (err) {
@ -403,6 +368,32 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
Util.HandleError(err);
}
return null;
},
AttachEvents: function(t, ref){
t.find(".hiddenlink").click(function(e) {
Util.HandleHiddenLink(e);
});
t.find(".removeresult").click(function(e) {
Util.RemoveResult(e);
});
// TODO(jwall): support longtouch events on mobile?
t.find(".resultbody h2").tooltip({
items: ".resultbody h2",
content: function(tt) {
tagging.GetTags(
ref.toString(), {
success: function(data) {
var tags = data ?
(data.data ?
data.data.tagList : null) : null;
var hoverContent =
$("<div>Tags: </div>");
hoverContent.append(
tags ? tags.join(", ") : "N/A");
tt(hoverContent);
}});
}
});
}
};
var Strongs = {
@ -614,9 +605,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
var t = $(txt);
t.find(".link").click(function(e) {
Util.HandleLink(e);
});
Words.AttachEvents(t);
$("#searchresults").html(t);
$("#searchTotal").html(results.length);
@ -1042,6 +1031,11 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
Util.HandleError(err);
}
return null;
},
AttachEvents: function(t){
t.find(".link").click(function(e) {
Util.HandleLink(e);
});
}
};
return {

View File

@ -3,6 +3,9 @@ var tagStore = 'tags';
define(
['db', 'reference'], function(db, reference) {
return {
Capable: function() {
return db.Capable();
},
// UpdateTags updates a given references tags asynchronously.
// ref should be a Reference object.
// tags should be a list of strings representing the tags for this