Skip to content

Commit

Permalink
hi
Browse files Browse the repository at this point in the history
  • Loading branch information
coolmodi committed Aug 12, 2019
1 parent 8fe0ac1 commit ddbec5e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CompactChatFrame.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Interface: 11302
## Title: Compact Chat Frame
## Author: coolmodi
## Notes: Shortens channel names to the uppercase letters, removes zone name, puts editbox on top and unclamps chat frame.
## Version: 1.0

main.lua
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# CompactChatFrame
A super small addon that:

* Shortens channel names down to their uppercase letters.
* Removes zone names from general and local defense.
* Positions editbox on top of chat frames.
* Makes chat frame freely movable to position it right at the border of the screen

>[1. General - The Barrens] [coolmodi]: I like turtles
>[4. LookingForGroup] [coolmodi]: Need friends
becomes

>[1. G] [coolmodi]: I like turtles
>[4. LFG] [coolmodi]: Need friends
There's also the `/ccfreset` command to reset chat frame positions, in case you manage to put them off screen completely. By default resets the default chat frame, `/ccfreset 2` would reset the second chat frame.
36 changes: 36 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-- Unclamp chat frames and put editbox on top
for i=1, NUM_CHAT_WINDOWS, 1 do
local cf = _G["ChatFrame"..i];
cf:SetClampedToScreen(false);
cf.editBox:ClearAllPoints();
cf.editBox:SetPoint("BOTTOMLEFT", cf, "TOPLEFT", -5, 5);
cf.editBox:SetPoint("BOTTOMRIGHT", cf, "TOPRIGHT", 5, 5);
end

-- Shorten channel names.
-- This particular function is only used for outputting names in chat, so it has no side effects.
local origfunc = ChatFrame_ResolvePrefixedChannelName;
function ChatFrame_ResolvePrefixedChannelName(communityChannel)
local channelName = origfunc(communityChannel);

if channelName:find("%u") then
local start = channelName:find("-");
if start then
channelName = channelName:sub(1, start-2);
end
return channelName:gsub("%l", "");
end

return channelName;
end

-- Every command has it's history...
SLASH_CCFSLASH1 = "/ccfreset";
SlashCmdList["CCFSLASH"] = function(arg)
local argnum = tonumber(arg);
if argnum == nil or argnum > NUM_CHAT_WINDOWS then
argnum = 1;
end
_G["ChatFrame"..argnum]:ClearAllPoints();
_G["ChatFrame"..argnum]:SetPoint("BOTTOMLEFT", UIParent, 100, 100);
end;

0 comments on commit ddbec5e

Please sign in to comment.