OSDN Git Service

'new!' pluign update.
authorarino <arino>
Wed, 30 Apr 2003 08:17:15 +0000 (17:17 +0900)
committerarino <arino>
Wed, 30 Apr 2003 08:17:15 +0000 (17:17 +0900)
plugin/new.inc.php
skin/default.en.css
skin/default.ja.css

index 80862c6..bf3ebcd 100644 (file)
@@ -2,23 +2,29 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: new.inc.php,v 1.1 2003/04/13 04:47:58 arino Exp $
+// $Id: new.inc.php,v 1.2 2003/04/30 08:17:15 arino Exp $
 //
 
-// ¿·Ãåɽ¼¨¤Î´ü¸Â(Æü¿ô)
-define('NEW_LIMIT',3);
-
-// ´ü¸ÂÆâ¤Î¤È¤­É½¼¨¤¹¤ë¥¿¥°
-define('NEW_FORMAT','<span class="new">%s</span>');
-
-// É½¼¨¥Õ¥©¡¼¥Þ¥Ã¥È
+// Á´ÂΤÎɽ¼¨¥Õ¥©¡¼¥Þ¥Ã¥È
 define('NEW_MESSAGE','<span class="comment_date">%s</span>');
 
-// ¥Ç¥Õ¥©¥ë¥È¤Îɽ¼¨Ê¸»úÎó
-define('NEW_STR','New');
-
+function plugin_new_init()
+{
+       global $_plugin_new_elapses;
+       
+       // ·Ð²áÉÿô => ¿·Ãåɽ¼¨¥¿¥°
+       $messages = array(
+               '_plugin_new_elapses' => array(
+                       1*60*60*24 => ' <span class="new1">New!</span>',
+                       5*60*60*24 => ' <span class="new5">New</span>',
+               ),
+       );
+       set_plugin_messages($messages);
+}
 function plugin_new_inline()
 {
+       global $_plugin_new_elapses;
+       
        if (func_num_args() < 1)
        {
                return FALSE;
@@ -31,28 +37,16 @@ function plugin_new_inline()
        {
                return FALSE;
        }
-       $timestamp -= LOCALZONE;
-
-       $str = NEW_STR;
-       $limit = NEW_LIMIT;
-       
-       switch (count($args))
-       {
-               case 2:
-                       $str = $args[1];
-               case 1:
-                       if (is_numeric($args[0]))
-                       {
-                               $limit = $args[0];
-                       }
-       }
-       $limit *= 60 * 60 * 24;
-       
        $retval = htmlspecialchars($date);
-       
-       if ((UTIME - $timestamp) <= $limit)
+
+       $erapse = UTIME - $timestamp + LOCALZONE;
+       foreach ($_plugin_new_elapses as $limit=>$tag)
        {
-               $retval .= sprintf(NEW_FORMAT,htmlspecialchars($str));
+               if ($erapse <= $limit)
+               {
+                       $retval .= $tag;
+                       break;
+               }
        }
        return sprintf(NEW_MESSAGE,$retval);
 }
index 2f34ce2..b938fbb 100644 (file)
@@ -604,14 +604,17 @@ div.jumpmenu{
 {
        font-size:x-small;
 }
-.new
+.new1
 {
-       color:white;
-       background-color:darkcyan;
+       color:red;
+       background-color:transparent;
+       font-size:x-small;
+}
+.new5
+{
+       color:green;
+       background-color:transparent;
        font-size:xx-small;
-       font-weight:bold;
-       padding:1px;
-       margin:0px .5em 0px .5em;
 }
 
 /* aname.inc.php */
index ee295e8..92fe819 100644 (file)
@@ -605,14 +605,17 @@ div.jumpmenu{
 {
        font-size:x-small;
 }
-.new
+.new1
 {
-       color:white;
-       background-color:darkcyan;
+       color:red;
+       background-color:transparent;
+       font-size:x-small;
+}
+.new5
+{
+       color:green;
+       background-color:transparent;
        font-size:xx-small;
-       font-weight:bold;
-       padding:1px;
-       margin:0px .5em 0px .5em;
 }
 
 /* aname.inc.php */