home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / gui / imwin / styles / basicmsgstyle.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  3.2 KB  |  28 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from gui.imwin.styles import MessageStyle
  5.  
  6. class BasicMessageStyle(MessageStyle):
  7.     template = '<html>\n<head>\n    <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n    <script type="text/ecmascript" defer="defer">\n\n        //Appending new content to the message view\n        function appendMessage(html) {\n            shouldScroll = nearBottom();\n\n            //Append the new message to the bottom of our chat block\n            chat = document.getElementById("Chat");\n            range = document.createRange();\n            range.selectNode(chat);\n            documentFragment = range.createContextualFragment(html);\n            chat.appendChild(documentFragment);\n\n            alignChat(shouldScroll);\n        }\n\n        function alignChat(shouldScroll) {\n            var windowHeight = window.innerHeight;\n\n            if (windowHeight > 0) {\n                var contentElement = document.getElementById(\'Chat\');\n                var contentHeight = contentElement.offsetHeight;\n                if (windowHeight - contentHeight > 0) {\n                    contentElement.style.position = \'relative\';\n                    contentElement.style.top = (windowHeight - contentHeight - 10) + \'px\';\n                } else {\n                    contentElement.style.position = \'static\';\n                }\n            }\n\n            if (shouldScroll) scrollToBottom();\n        }\n\n        function nearBottom() {\n            return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );\n        }\n        function scrollToBottom() {\n            document.body.scrollTop = document.body.offsetHeight;\n        }\n\n        function windowDidResize(){\n            alignChat(true/*nearBottom()*/); //nearBottom buggy with inactive tabs\n        }\n\n        window.onresize = windowDidResize;\n    </script>\n    <style type="text/css">\n        span.buddyname { font-size: 60%; font-family: Verdana; background-color: #efefef; }\n    </style>\n    </head>\n<body>\n<div id="Chat">\n</div>\n</body>\n</html>\n\n'
  8.     theme_name = 'basic'
  9.     variant = None
  10.     baseUrl = 'file:///'
  11.     allow_text_colors = True
  12.     
  13.     def initialContents(self, chatName, buddy, show_header):
  14.         return self.template
  15.  
  16.     
  17.     def show_header_script(self, show):
  18.         return ''
  19.  
  20.     
  21.     def format_message(self, messagetype, messageobj, next, context, **extra):
  22.         if messageobj.buddy is not None:
  23.             return ('appendMessage', u'<div><span class="buddyname">%s</span>: %s</div>' % (messageobj.buddy.name, messageobj.message))
  24.         else:
  25.             return ('appendMessage', u'<div>%s</div>' % messageobj.message)
  26.  
  27.  
  28.