move some code for event handler for testability
move some code for event handler for testability

movabletype/mt-plugin-Loupe,movabletype/mt-plugin-Loupe,movabletype/mt-plugin-Loupe,movabletype/mt-plugin-Loupe,movabletype/mt-plugin-Loupe