Removed chained ifs

By using a for loop.  This allows for detection of elements like the
bold button and the indent (all which have shortcuts!)