Changeset 3374

Show
Ignore:
Timestamp:
11/10/06 00:39:56 (2 years ago)
Author:
timothy
Message:

Adding back the fade in message code for Standard. Also added the ability to display an alert through JavaScript? for testing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Panels/JVChatTranscriptPanel.m

    r3333 r3374  
    670670} 
    671671 
     672- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame 
     673{ 
     674    NSRange range = [message rangeOfString:@"\t"]; 
     675    NSString *title = @"Alert"; 
     676    if (range.location != NSNotFound) { 
     677        title = [message substringToIndex:range.location]; 
     678        message = [message substringFromIndex:(range.location + range.length)]; 
     679    } 
     680 
     681    NSBeginInformationalAlertSheet(title, nil, nil, nil, [sender window], nil, NULL, NULL, NULL, message); 
     682} 
     683 
    672684- (void) webView:(WebView *) sender decidePolicyForNavigationAction:(NSDictionary *) actionInformation request:(NSURLRequest *) request frame:(WebFrame *) frame decisionListener:(id <WebPolicyDecisionListener>) listener { 
    673685        NSURL *url = [actionInformation objectForKey:WebActionOriginalURLKey]; 
  • trunk/Resources/Styles/Standard.colloquyStyle/Contents/Info.plist

    r1425 r3374  
    5050                        <key>style</key> 
    5151                        <array> 
    52                                 <string>.messageFadeIn { color: #000000; }</string> 
    53                                 <string>.messageFadeIn { color: #FFFFFF; }</string> 
     52                                <string>.messageFadeIn { content: "off"; }</string> 
     53                                <string>.messageFadeIn { content: "on"; }</string> 
    5454                        </array> 
    5555                        <key>default</key> 
  • trunk/Resources/Styles/Standard.colloquyStyle/Contents/Resources/genericTemplate.html

    r3369 r3374  
    1 <!-- Disabled until we have a better way to toggle things like fade in JS --> 
    2 <!-- <script type="text/javascript"> 
    3         function appendMessage( html ) { 
    4                 checkIfScrollToBottomIsNeeded(); 
    5                 removeConsecutiveInsertPoint(); 
     1<script type="text/javascript"> 
     2        document.body.addEventListener('DOMNodeInserted', startFadeIfNeeded); 
    63 
    7                 range = document.createRange(); 
    8                 range.selectNode( document.getElementsByTagName( "body" ).item( 0 ) ); 
    9                 documentFragment = range.createContextualFragment( html ); 
    10                 document.body.appendChild( documentFragment ); 
     4        function startFadeIfNeeded(event) { 
     5                if( event.target.className.indexOf('envelope') == -1) return; 
     6                if( ! document.styleSheets[3] ) return; 
    117 
    128                var fadeBool = false; 
    13                 var length = document.styleSheets[2].cssRules.length; 
     9                var rules = document.styleSheets[3].cssRules; 
     10                var length = rules.length; 
    1411                for( var i = 0; i < length; i++ ) { 
    15                         var rule = document.styleSheets[2].cssRules[i]; 
    16                         if( rule.selectorText == ".messageFadeIn" ) { 
    17                                 regex = /#FFFFFF/g; 
    18                                 fadeBool = regex.test( rule.style.cssText ); 
     12                        var rule = rules[i]; 
     13                        if( rule.selectorText.toLowerCase() == ".messagefadein" ) { 
     14                                regex = /content:\s*on/g; 
     15                                fadeBool = regex.test(rule.style.cssText); 
    1916                        } 
    2017                } 
    2118 
    2219                if( fadeBool ) { 
    23                         setOpacity( document.body.lastChild.previousSibling, '1.0' ); 
    24                         setOpacity( document.body.lastChild, '0.0' ); 
    25                         step = 0.0; 
     20                        if( fadeElement ) 
     21                                fadeElement.style.opacity = null; 
     22                        fadeStep = 0.0; 
     23                        fadeElement = event.target; 
    2624                        fadeIn(); 
    2725                } 
    28  
    29                 scrollToBottomIfNeeded(); 
    3026        } 
    3127 
     28        var fadeElement; 
     29        var fadeStep = 0.0; 
    3230        function fadeIn() { 
    33                 step += 0.25; 
    34                 if( step < 10 ) { 
    35                         setOpacity( document.body.lastChild, '0.' + step ); 
    36                         setTimeout( 'fadeIn()', 10 ); 
    37                 } else document.body.lastChild.style.opacity = '1.0'; 
     31                if( ! fadeElement || ! fadeElement.style ) return; 
     32                if( fadeStep < 1.0 ) { 
     33                        fadeElement.style.opacity = fadeStep; 
     34                        setTimeout(fadeIn, 10); 
     35                } else fadeElement.style.opacity = null; 
     36                fadeStep += 0.2; 
    3837        } 
    39  
    40         function setOpacity( element, value ) { 
    41                 element.style.setProperty( 'opacity', value, 'important' ); 
    42         } 
    43 </script> --> 
     38</script>