WIP of bug 1076706, and card_manager.js is a mess