Adding a dynamic “cover processing fees” checkbox to CiviCRM contribution form
It's pretty late to be answering this, but the Percentage Price Field extension supports something very much like this.


  This extension allows you to add an "Additional Percentage" field to
  any price set, which will automatically calculate and add an
  additional amount to a transaction, as a configurable percentage of
  other selected price set options.
  
  Want to ask donors to give an extra 3% to cover credit card processing
  fees? Or to give an additional 10% of their membership fee to support
  a special project?   Then you're in the right place.
  
  Because it's a price set field, this option will appear as a line item
  in contribution records and receipts, allow configuration of financial
  type, label, help text, and other standard price field options, and
  work equally well for contributions, memberships, events -- anywhere
  you can use a price set.


https://civicrm.org/extensions/percentage-price-field

[Disclosure: I'm the author of this extension.]