DonationMessagePlugin.py 976 B

12345678910111213141516171819202122
  1. import re
  2. from Plugin import PluginManager
  3. # Warning: If you modify the donation address then renmae the plugin's directory to "MyDonationMessage" to prevent the update script overwrite
  4. @PluginManager.registerTo("UiRequest")
  5. class UiRequestPlugin(object):
  6. # Inject a donation message to every page top right corner
  7. def renderWrapper(self, *args, **kwargs):
  8. body = super(UiRequestPlugin, self).renderWrapper(*args, **kwargs) # Get the wrapper frame output
  9. inject_html = """
  10. <style>
  11. #donation_message { position: absolute; bottom: 0px; right: 20px; padding: 7px; font-family: Arial; font-size: 11px }
  12. </style>
  13. <a id='donation_message' href='https://blockchain.info/address/1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX' target='_blank'>Please donate to help to keep this ZeroProxy alive</a>
  14. </body>
  15. </html>
  16. """
  17. return re.sub(r"</body>\s*</html>\s*$", inject_html, body)