1# -*- coding: utf-8 -*- 2# Copyright: Damien Elmes <anki@ichi2.net> 3# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 4 5from ..hooks import addHook 6from ..lang import _ 7 8def hint(txt, extra, context, tag, fullname): 9 if not txt.strip(): 10 return "" 11 # random id 12 domid = "hint%d" % id(txt) 13 return """ 14<a class=hint href="#" 15onclick="this.style.display='none';document.getElementById('%s').style.display='block';return false;"> 16%s</a><div id="%s" class=hint style="display: none">%s</div> 17""" % (domid, _("Show %s") % tag, domid, txt) 18 19def install(): 20 addHook('fmod_hint', hint) 21