Changeset 1288

Show
Ignore:
Timestamp:
12/30/06 17:11:32 (2 years ago)
Author:
jm3
Message:

ajax fade-out of messages using moo!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/index.php

    r1188 r1288  
    6363        if( $op == "add_comment" ) { 
    6464                addCommentToLink( $l, $comment, $u, $debug ); 
    65  
    66                 if( !$debug ) { 
    67 %> 
    68 <script language="javascript"> history.go( -1 ); </script> 
    69 <% 
    70                 } 
     65                $late_mesg = "Added comment!"; 
     66 
     67                if( !$debug ) 
     68                        bounceTo( "/$l/m/Added+your+comment." ); 
    7169        } 
    7270 
  • feedmelinks/modules/header.inc.php

    r1278 r1288  
    6262        if( ! $noMenu ) 
    6363                include( "$modules/menu.inc.php" );  
     64        if( $mesg ) 
     65                echo "<p/>" . ephemeral( $mesg ); 
    6466?> 
    6567 
  • feedmelinks/modules/scripts.inc.php

    r876 r1288  
    22        <script language="javascript" type="text/javascript" src="/script/behaviour.js"></script> 
    33        <script language="javascript" type="text/javascript" src="/script/fml-behaviours.js"></script> 
     4        <script language="javascript" type="text/javascript" src="/script/mootools.js"></script> 
     5 
  • feedmelinks/modules/track.inc.php

    r863 r1288  
    11<% 
    22        if( ! $noTrack ) { 
    3 %> 
    4 <script src="/mint/mint.js.php" type="text/javascript" language="javascript"></script> 
    5 <% 
     3                # script src="/mint/mint.js.php" type="text/javascript" language="javascript"/script 
    64        } 
    75%> 
  • feedmelinks/modules/utils.inc.php

    r1286 r1288  
    699699  } 
    700700 
    701   function startTell( $t = "", $wide = false ) { 
     701        function fade_out( $id ) { 
     702          $id = $id ? $id : "mesg"; 
     703                return "\n" . jsWrap( "\n    var my_oncomplete = function() { removeElement( '$id' ); };\n    var myFx = new Fx.Style('$id', 'opacity', {duration:2000,onComplete:my_oncomplete} ).custom(1,0);\n" ); 
     704        } 
     705 
     706        function ephemeral( $title, $message ) { 
     707                $id = "mesg_" . rand(); 
     708                $s = "<div id='$id' class='warning'>" . ($message ? "$title : $message" : $title) . "</div>"; 
     709                return $s . fade_out( $id ); 
     710        } 
     711 
     712  function startTell( $t = "", $wide = false, $id ) { 
    702713%> 
    703714<link rel="stylesheet" type="text/css" href="/style/notebox.css"> 
    704 <div class="notebox" <%= $wide ? 'style="width: 600px; margin-left: auto; margin-right: auto;"' : ""%>> 
     715<div id="<?= $id ?>" class="notebox" <%= $wide ? 'style="width: 600px; margin-left: auto; margin-right: auto;"' : ""%>> 
    705716  <div class="noteboxHead" <%= $wide ? 'style="font-size: 140%;"' : ""%>><h2><%= $t %></h2></div> 
    706717  <div class="noteboxBody" <%= $wide ? 'style="font-size: 140%;"' : ""%>> 
     
    716727  } 
    717728 
    718   function tell( $t, $m, $wide = false ) { 
    719     startTell( $t, $wide ); 
     729  function tell( $t, $m, $wide = false, $id ) { 
     730    startTell( $t, $wide, $id ); 
    720731    echo $m; 
    721732    endTell(); 
     
    29502961                                        if( $debug ) 
    29512962                                                echo "(DEBUG: WROTE $bytes_written BYTES TO $linkfile)<br />"; 
    2952                                         else 
    2953                                                 echo "Adding your comment... done!<br />"; 
    29542963                                         
    29552964                                        # NOW WE SEND MAIL: 
  • feedmelinks/modules/view-link.inc.php

    r1286 r1288  
    11<% 
     2 
     3        if( $late_mesg ) 
     4                echo ephemeral( $late_mesg ); 
     5 
    26        if( $l ) { 
    37                if( is_numeric( $l )) { 
     
    2630                        $owned = ( $user == $u ) ? 1 : 0; 
    2731 
    28                         if( $mesg ) { 
    29 %> 
    30 <div class="warning"> 
    31         <?= $mesg ?> 
    32 </div> 
    33 <% 
    34                         } 
    3532                        if( $owned ) { 
    3633%> 
     
    6057                <a class="biglink" title="<%= $name %>" href="/t/<%= $l %>"><%= $name %></a> <% if( $owned ) {makeAJAXEditLink( "name", "Rename this link" );} %> 
    6158<% if( $owned ) { %> 
    62                         Privacy: <%= makeAJAXToggle( "link_privacy", $l, $isPrivate ) %> 
     59                        Make&nbsp;<?= $private ? "public" : "private" ?>:&nbsp;<%= makeAJAXToggle( "link_privacy", $l, $isPrivate ) %> 
    6360<% } %> 
    6461        </div> 
  • feedmelinks/script/funcs.js

    r1188 r1288  
    7373                //_content.window.location = "/s/" + s[s.selectedIndex].value; 
    7474} 
     75 
     76function removeElement( el ) { 
     77  var parent = document.getElementById( el ).parentNode; 
     78        parent.removeChild( document.getElementById( el )); 
     79} 
     80