mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
use original lookup word in wikipedia lookup
This commit is contained in:
@@ -30,7 +30,7 @@ function ReaderDictionary:stardictLookup(word, box)
|
||||
local ok, results = pcall(JSON.decode, JSON, results_str)
|
||||
if ok and results then
|
||||
DEBUG("lookup result table:", word, results)
|
||||
self:showDict(results, box)
|
||||
self:showDict(word, results, box)
|
||||
else
|
||||
-- dummy results
|
||||
results = {
|
||||
@@ -41,18 +41,20 @@ function ReaderDictionary:stardictLookup(word, box)
|
||||
}
|
||||
}
|
||||
DEBUG("dummy result table:", word, results)
|
||||
self:showDict(results, box)
|
||||
self:showDict(word, results, box)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderDictionary:showDict(results, box)
|
||||
function ReaderDictionary:showDict(word, results, box)
|
||||
if results and results[1] then
|
||||
DEBUG("showing quick lookup window")
|
||||
UIManager:show(DictQuickLookup:new{
|
||||
ui = self.ui,
|
||||
highlight = self.highlight,
|
||||
dialog = self.dialog,
|
||||
-- original lookup word
|
||||
word = word,
|
||||
results = results,
|
||||
dictionary = self.default_dictionary,
|
||||
width = Screen:getWidth() - Screen:scaleByDPI(80),
|
||||
|
||||
@@ -44,7 +44,7 @@ function ReaderWikipedia:onLookupWikipedia(word, box)
|
||||
table.insert(results, result)
|
||||
end
|
||||
DEBUG("lookup result:", word, results)
|
||||
self:showDict(results, box)
|
||||
self:showDict(word, results, box)
|
||||
else
|
||||
DEBUG("error:", pages)
|
||||
-- dummy results
|
||||
@@ -56,7 +56,7 @@ function ReaderWikipedia:onLookupWikipedia(word, box)
|
||||
}
|
||||
}
|
||||
DEBUG("dummy result table:", word, results)
|
||||
self:showDict(results, box)
|
||||
self:showDict(word, results, box)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -404,7 +404,7 @@ function DictQuickLookup:closeInputDialog()
|
||||
end
|
||||
|
||||
function DictQuickLookup:lookupWikipedia()
|
||||
self.ui:handleEvent(Event:new("LookupWikipedia", self.lookupword, self.word_box))
|
||||
self.ui:handleEvent(Event:new("LookupWikipedia", self.word, self.word_box))
|
||||
end
|
||||
|
||||
return DictQuickLookup
|
||||
|
||||
Reference in New Issue
Block a user