Changeset 18564

Show
Ignore:
Timestamp:
09/01/08 09:03:20 (5 years ago)
Author:
poolmmjp
Message:
  • fav状況を★マークで表示するようにした(Twitter/FriendFeed)。
  • ★マークをクリックしてfavできるようにした(Twitter/FriendFeed/Wassr/はてなハイク)。
Location:
lang/csharp/MMMMB/MMMMB
Files:
3 added
9 modified

Legend:

Unmodified
Added
Removed
  • lang/csharp/MMMMB/MMMMB/Entry.cs

    r10019 r18564  
    4646            set { image = value; } 
    4747        } 
    48          
     48 
     49        private Dictionary<string, IExtendedProperty> extendedProperties = new Dictionary<string, IExtendedProperty>(); 
     50 
     51        public Dictionary<string, IExtendedProperty> ExtendedProperties 
     52        { 
     53            get { return extendedProperties; } 
     54            set { extendedProperties = value; } 
     55        } 
    4956    } 
    5057} 
  • lang/csharp/MMMMB/MMMMB/MMMMB.csproj

    r18079 r18564  
    4040  <ItemGroup> 
    4141    <Compile Include="Entry.cs" /> 
     42    <Compile Include="FavoriteProperty.cs" /> 
    4243    <Compile Include="FileLogger.cs" /> 
     44    <Compile Include="IExtendedProperty.cs" /> 
    4345    <Compile Include="IFavoritable.cs" /> 
    4446    <Compile Include="ILogger.cs" /> 
     
    9294  <ItemGroup> 
    9395    <None Include="app.config" /> 
     96    <None Include="favorited.template"> 
     97      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     98    </None> 
    9499    <None Include="item.template"> 
    95100      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
  • lang/csharp/MMMMB/MMMMB/MiniBlogView.cs

    r14118 r18564  
    183183                item.SetValue("content", e.Content); 
    184184                item.SetValue("time", toShortDate(e.Date)); 
     185 
     186                string ex = ""; 
     187                if (miniBlog is IFavoritable) 
     188                { 
     189                    FavoriteProperty fav = (FavoriteProperty)e.ExtendedProperties["favorited"]; 
     190                    Template favorited = new Template("favorited"); 
     191                    favorited.SetValue("value", (fav.Favorited ? "on" : "off")); 
     192                    favorited.SetValue("permalink", e.Permalink.ToString()); 
     193                    favorited.SetValue("featurename", ((IFavoritable)miniBlog).FeatureName); 
     194                    ex += favorited.ToString(); 
     195                } 
     196                item.SetValue("extended", ex); 
     197 
    185198                sb.Insert(0, item.ToString()); 
    186199            } 
     
    220233        { 
    221234            ContextMenuStrip menu = new ContextMenuStrip(); 
    222  
    223             if (miniBlog is IFavoritable) 
    224             { 
    225                 IFavoritable favable = (IFavoritable)miniBlog; 
    226                 ToolStripItem fav = new ToolStripMenuItem(favable.FeatureName + "(&F)"); 
    227                 fav.Click += new EventHandler(delegate(object sender, EventArgs e){ 
    228                     favable.Create(permalink); 
    229                 }); 
    230                 menu.Items.Add(fav); 
    231                 menu.Items.Add(new ToolStripSeparator()); 
    232             } 
    233235 
    234236            ToolStripItem open = new ToolStripMenuItem("�J��(&O)"); 
     
    247249        } 
    248250 
     251        public void FavoriteClick(string permalink) 
     252        { 
     253            FavoriteProperty fav = null; 
     254            foreach (Entry e in entryList) 
     255            { 
     256                if (e.Permalink.ToString() == permalink) 
     257                { 
     258                    fav = (FavoriteProperty)e.ExtendedProperties["favorited"]; 
     259                } 
     260            } 
     261            if (fav == null) return; 
     262 
     263            IFavoritable favable = (IFavoritable)miniBlog; 
     264            if (!fav.Favorited) 
     265            { 
     266                favable.Create(permalink); 
     267                fav.Favorited = true; 
     268            } 
     269            else 
     270            { 
     271                favable.Destroy(permalink); 
     272                fav.Favorited = false; 
     273            } 
     274            Redraw(); 
     275        } 
     276 
    249277        public void OnScroll(int scrollY) 
    250278        { 
  • lang/csharp/MMMMB/MMMMB/MiniBlogs/FriendFeed.cs

    r13980 r18564  
    7676                e.Date = DateTime.Parse(node.SelectSingleNode("pubDate").InnerText); 
    7777                e.Image = new Uri(node.SelectSingleNode("ff:user/ff:profileUrl", ns).InnerText + "/picture?size=medium&v=1"); 
     78 
     79                // fav 
     80                FavoriteProperty fav = new FavoriteProperty(); 
     81                fav.Favorited = false; 
     82                XmlNodeList likes = node.SelectNodes("ff:likes/ff:like",ns); 
     83                foreach (XmlNode like in likes) 
     84                { 
     85                    if (like.SelectSingleNode("ff:user/ff:nickname", ns).InnerText == username) 
     86                    { 
     87                        fav.Favorited = true; 
     88                        break; 
     89                    } 
     90                } 
     91                e.ExtendedProperties.Add("favorited", fav); 
     92                 
    7893                entryList.Add(e); 
    7994            } 
  • lang/csharp/MMMMB/MMMMB/MiniBlogs/HatenaHaiku.cs

    r18372 r18564  
    7373                e.Date = DateTime.Parse(node.SelectSingleNode("created_at").InnerText); 
    7474                e.Image = new Uri(node.SelectSingleNode("user/profile_image_url").InnerText); 
     75 
     76                // fav 
     77                FavoriteProperty fav = new FavoriteProperty(); 
     78                //fav.Favorited = (node.SelectSingleNode("favorited").InnerText == "1"); // �����ȊO�̐l���X�^�[����Ă� �ɂȂ��ۂ� 
     79                fav.Favorited = false; // API �Ŏ������t�����X�^�[�̏�����Ȃ��̂Ŏd�� 
     80                e.ExtendedProperties.Add("favorited", fav); 
     81                 
    7582                entryList.Add(e); 
    7683            } 
  • lang/csharp/MMMMB/MMMMB/MiniBlogs/Twitter.cs

    r18427 r18564  
    6969                e.Date = DateTime.Parse(times[1] + " " + times[2] + "," + times[5] + " " + times[3] + " " + times[4]); 
    7070                e.Image = new Uri(node.SelectSingleNode("user/profile_image_url").InnerText); 
     71                 
     72                // fav 
     73                FavoriteProperty fav = new FavoriteProperty(); 
     74                fav.Favorited = (node.SelectSingleNode("favorited").InnerText == "true"); 
     75                e.ExtendedProperties.Add("favorited", fav); 
     76 
    7177                entryList.Add(e); 
    7278            } 
  • lang/csharp/MMMMB/MMMMB/MiniBlogs/Wassr.cs

    r18372 r18564  
    7070                e.Date = new DateTime(1970, 1, 1, 9, 0, 0).AddSeconds(long.Parse(node.SelectSingleNode("epoch").InnerText)); 
    7171                e.Image = new Uri("http://wassr.jp/user/" + user + "/profile_img.png.32"); 
     72 
     73                // fav 
     74                FavoriteProperty fav = new FavoriteProperty(); 
     75                fav.Favorited = false; // API �ŃC�C�l�̏�����Ȃ��̂Ŏd�� 
     76                e.ExtendedProperties.Add("favorited", fav); 
     77                 
    7278                entryList.Add(e); 
    7379            } 
  • lang/csharp/MMMMB/MMMMB/item.template

    r10019 r18564  
    66                        <span class="time">[[time]]</span> 
    77                        <a href="javascript:permalink_click('[[permalink]]');" class="permalink">Permalink</a> 
     8                        [[extended]] 
    89                    </h1> 
    910                    <p class="content">[[content]]</p> 
  • lang/csharp/MMMMB/MMMMB/main.template

    r18079 r18564  
    7070                font-size: 80%; 
    7171            } 
     72            a.favorite_on{ 
     73                text-decoration: none; 
     74                color: #f8b836; 
     75            } 
     76            a.favorite_off{ 
     77                text-decoration: none; 
     78                color: #dcdcdc; 
     79            } 
    7280            p.content{ 
    7381                margin: 0; 
     
    9098            function permalink_click(permalink){ 
    9199                window.external.PermalinkClick(permalink); 
     100            } 
     101            function favorite_click(permalink){ 
     102                window.external.FavoriteClick(permalink); 
    92103            } 
    93104            window.onload = function(){