Changeset 1381

Show
Ignore:
Timestamp:
03/04/07 04:50:05 (2 years ago)
Author:
jm3
Message:

show/hide-able news box from blog, via magpie-rss

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/modules/main-interface.inc.php

    r1379 r1381  
    1414                else echo "ERROR: running $qs"; 
    1515?> 
    16 <big style='margin-left: 6px;'> 
     16<h2 style='margin-left: 6px;'> 
    1717        You have <?= number_format( $num_links ) ?> links and <?= number_format( $num_tags ) ?> tags. 
    1818        <p/> 
    1919        <a href="/export">Export a copy of your links</a> 
    20 </big
     20</h2
    2121<?php 
    2222                } 
     
    104104 
    105105<div id="rightColumn"> 
     106 
     107        <?php  
     108                $width = 342; 
     109                include( "$modules/news.inc.php" );  
     110        ?> 
    106111         
    107112        <?php include( "$modules/my-recent.inc.php" ); ?> 
     
    110115 
    111116        <?php include( "$modules/random-links.inc.php" ); ?> 
    112          
    113         <div id="news" class="box"> 
    114                 <?php include( "$modules/news-divs.inc.php" ); ?> 
    115         </div> 
     117 
    116118</div> 
    117119 
  • feedmelinks/modules/news.inc.php

    r1377 r1381  
     1<?php 
     2        include_once( "utils.inc.php" ); 
     3        $path = get_webserver_root() . "/lib/magpie-rss"; 
     4        require_once("$path/rss_fetch.inc"); 
     5 
     6        $url = "http://blog.feedmelinks.com/rss"; 
     7        $width = $width ? $width : 250; 
     8 
     9        $format = $format ? $format : "divs"; 
     10 
     11?> 
     12<div id="newsfeed" class="box" style="width: <?= $width ?>px;"> 
     13 
     14<?php 
     15if( $_COOKIE["show_newsfeed"] != "false" ) { 
     16?> 
     17 
     18<?php 
     19if ( $url ) { 
     20        $rss = fetch_rss( $url ); 
     21  echo "<div class='subhead'><div style='float: left;'><a style='color: white;' href='http://blog.feedmelinks.com/'>" .  preg_replace( "/Blog/", "News", $rss->channel['title']) . "</a></div><div style='float: right'> 
     22        (<a class='subtle' href='javascript:show_news()'>to hide, just click</a>) 
     23        <input type='checkbox' onChange='javascript:hide_news();'/> 
     24        </div><br/></div>"; 
     25        #echo "<ul>"; 
     26        $c = 0; 
     27        foreach ($rss->items as $item) { 
     28                $href = $item['link']; 
     29                $title = $item['title'];         
     30                $class = $c % 2 ? "r1" : "r0"; 
     31                $class = $c == sizeof( $rss->items ) - 1 ? $class . " last" : $class; 
     32                echo "<div class='$class'><a href=$href>$title</a></div>"; 
     33                #echo "<li><a href=$href>$title</a></li>"; 
     34                $c++; 
     35        } 
     36        #echo "</ul>"; 
     37} 
     38?> 
     39 
     40<?php 
     41} else { 
     42?> 
     43 
     44<div id="ihatecss" class="r0 last" > 
     45        <div style="float: left;"> 
     46        (<a class="subtle" href="javascript:show_news()">To show the recent news box again, just click</a>) 
     47        </div> 
     48        <div style="float: right;"> 
     49                <input type="checkbox" onChange="javascript:show_news();"/> 
     50        </div> 
     51        <br /> 
     52</div> 
     53 
     54<?php 
     55} 
     56?> 
     57 
     58</div> 
     59 
     60<script type="text/javascript"> 
     61        function show_news() { 
     62                set_cookie( "show_newsfeed", "true", 5, "/", ".feedmelinks.com" ); 
     63                location.href = "/" ; 
     64        } 
     65        function hide_news() { 
     66                set_cookie( "show_newsfeed", "false", 30, "/", ".feedmelinks.com" ); 
     67 
     68                var my_oncomplete = function() { removeElement( 'newsfeed' ); }; 
     69                var myFx = new Fx.Style('newsfeed', 'opacity', {duration:2000,onComplete:my_oncomplete} ).custom(1,0); 
     70        } 
     71 
     72</script> 
  • feedmelinks/portal-uncached.php

    r1329 r1381  
    3434 
    3535        <div class="title box center" style="border: inherit;"> 
    36                 <h1 style="color: #ff6600">Feed Me Links!</h1> 
     36                <h1 style="color: #ff6600"><a href="/" class="hot">Feed Me Links!</a></h1> 
    3737                <span class="header"><small>Social Bookmarking since 2002</small> 
    3838                </span> 
     
    227227        </div> 
    228228 
     229<?php  
     230        $width = 340; 
     231        include( "$modules/news.inc.php" );  
     232?> 
     233 
    229234        <?php 
    230235                echo get_their_links_html( "New Links" ); 
     
    249254                </div> 
    250255                <% include( "$modules/highest-linking-users.inc.php"); %> 
    251         </div> 
    252  
    253         <div id="news" class="box"> 
    254                 <% include( "$modules/news-divs.inc.php" ); %> 
    255256        </div> 
    256257 
  • feedmelinks/script/funcs.js

    r1350 r1381  
    8787} 
    8888 
     89function set_cookie( name, value, num_days, path, domain, secure ) { 
     90        var today = new Date(); 
     91        today.setTime( today.getTime() ); 
     92 
     93        if ( num_days ) 
     94                num_days = num_days * 1000 * 60 * 60 * 24; 
     95        var expires_date = new Date( today.getTime() + (num_days) ); 
     96 
     97        document.cookie = name + "=" +escape( value ) + 
     98        ( ( num_days ) ? ";expires=" + expires_date.toGMTString() : "" ) +  
     99        ( ( path ) ? ";path=" + path : "" ) +  
     100        ( ( domain ) ? ";domain=" + domain : "" ) + 
     101        ( ( secure ) ? ";secure" : "" ); 
     102} 
     103 
  • feedmelinks/style/main.css

    r1352 r1381  
    241241} 
    242242div.r1 { 
    243         background-color: #E0E0E0
     243        background-color: #e7e7e7
    244244} 
    245245 
     
    377377        background-color: #EEEEEE; 
    378378} 
     379 
     380.newsfeed ul li { 
     381        color: #ff6600; 
     382        list-style-type: disc; 
     383        margin-left: -25px; 
     384        padding-left: 0px; 
     385}