/
## X-Category: Miscellaneous |
## X-eMail: ethan.centaurai@live.co.uk |
## X-Donate: PayPal:ethan.centaurai@live.co.uk |
## X-Embeds: Ace3, FuBarPlugin-2.0 |
## OptionalDeps: Ace3, FuBar |
## X-Embeds: Ace2, FuBarPlugin-2.0 |
## OptionalDeps: Ace2, FuBar |
## SavedVariables: uClockDB |
embeds.xml |
Core.lua |
--[[ $Id: Core.lua 4 2008-08-23 16:03:27Z DarkImakuni-16655 $ ]]-- |
--[[ $Id$ ]]-- |
uClock = AceLibrary("AceAddon-2.0"):new("AceDB-2.0", "AceEvent-2.0", "FuBarPlugin-2.0") |
uClock.date = ("$Date: 2008-08-23 17:03:27 +0100 (Sat, 23 Aug 2008) $"):match("%d%d%d%d%-%d%d%-%d%d") |
uClock.date = ("$Date$"):match("%d%d%d%d%-%d%d%-%d%d") |
uClock.blizzardTooltip = true |
uClock.cannotHideText = true |
function uClock:OnEnable() |
self:ScheduleRepeatingEvent(self.UpdateDisplay, 1, self) |
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("uClock", { |
name = "FuBar uClock", |
desc = "Minimalistic date/time display", |
get = function(k) return self.db.profile[k.arg] end, |
set = function(k, v) self.db.profile[k.arg] = v end, |
type = "group", |
self.OnMenuRequest = { |
type = 'group', |
args = { |
twentyFour = { |
name = "24 Hour Mode", |
type = "toggle", arg = "twentyFour", order = 1, |
type = "toggle", order = 1, |
get = function() return self.db.profile.twentyFour end, |
set = function() self.db.profile.twentyFour = not self.db.profile.twentyFour end, |
}, |
showSeconds = { |
name = "Show Seconds", |
type = "toggle", arg = "showSeconds", order = 2, |
type = "toggle", order = 2, |
get = function() return self.db.profile.showSeconds end, |
set = function() self.db.profile.showSeconds = not self.db.profile.showSeconds end, |
}, |
}, |
}) |
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("uClock", "FuBar uClock") |
} |
end |
function uClock:OnTextUpdate() |
if button == "LeftButton" then |
if IsShiftKeyDown() then ToggleCalendar() |
else ToggleTimeManager() end |
elseif button == "RightButton" then |
InterfaceOptionsFrame_OpenToCategory("FuBar uClock") |
end |
end |
if hour == 0 then hour = 12 end |
end |
time = ("%d:%02d"):format(hour, minute) |
time = ("|cffffffff%d:%02d"):format(hour, minute) |
if self.db.profile.showSeconds then |
time = time..date(":%S") |
time = time..(pm and " PM" or " AM") |
end |
return time |
return time.."|r" |
end |