mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Drop test if *_func is a function
This commit is contained in:
@@ -1593,7 +1593,7 @@ function ReaderLink:getButtonsForExternalLinkDialog(link_url)
|
||||
local button = fn_button(self, link_url)
|
||||
local show, button_title
|
||||
|
||||
if type(button.show_in_dialog_func) == "function" then
|
||||
if button.show_in_dialog_func then
|
||||
show, button_title = button.show_in_dialog_func(link_url)
|
||||
else
|
||||
-- If the button doesn't have the show_in_dialog_func, then assume that the button
|
||||
|
||||
@@ -80,7 +80,7 @@ function Button:init()
|
||||
end
|
||||
|
||||
-- Prefer an optional text_func over text
|
||||
if self.text_func and type(self.text_func) == "function" then
|
||||
if self.text_func then
|
||||
self.text = self.text_func()
|
||||
end
|
||||
|
||||
@@ -507,7 +507,7 @@ function Button:onTapSelectButton()
|
||||
end
|
||||
elseif self.tap_input then
|
||||
self:onInput(self.tap_input)
|
||||
elseif type(self.tap_input_func) == "function" then
|
||||
elseif self.tap_input_func then
|
||||
self:onInput(self.tap_input_func())
|
||||
end
|
||||
end
|
||||
@@ -546,7 +546,7 @@ function Button:onHoldSelectButton()
|
||||
elseif self.hold_input then
|
||||
self:onInput(self.hold_input, true)
|
||||
self._hold_handled = true
|
||||
elseif type(self.hold_input_func) == "function" then
|
||||
elseif self.hold_input_func then
|
||||
self:onInput(self.hold_input_func(), true)
|
||||
self._hold_handled = true
|
||||
end
|
||||
|
||||
@@ -127,7 +127,7 @@ function CheckButton:onTapCheckButton()
|
||||
if not self.enabled then return true end
|
||||
if self.tap_input then
|
||||
self:onInput(self.tap_input)
|
||||
elseif type(self.tap_input_func) == "function" then
|
||||
elseif self.tap_input_func then
|
||||
self:onInput(self.tap_input_func())
|
||||
else
|
||||
if G_reader_settings:isFalse("flash_ui") then
|
||||
@@ -184,7 +184,7 @@ function CheckButton:onHoldCheckButton()
|
||||
elseif self.hold_input then
|
||||
self:onInput(self.hold_input, true)
|
||||
self._hold_handled = true
|
||||
elseif type(self.hold_input_func) == "function" then
|
||||
elseif self.hold_input_func then
|
||||
self:onInput(self.hold_input_func(), true)
|
||||
self._hold_handled = true
|
||||
end
|
||||
|
||||
@@ -152,7 +152,7 @@ function IconButton:onHoldIconButton()
|
||||
self.hold_callback()
|
||||
elseif self.hold_input then
|
||||
self:onInput(self.hold_input)
|
||||
elseif type(self.hold_input_func) == "function" then
|
||||
elseif self.hold_input_func then
|
||||
self:onInput(self.hold_input_func())
|
||||
elseif not self.hold_callback then -- nil or false
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user