<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IE8 &#8211; 任平生</title>
	<atom:link href="https://rpsh.net/tag/ie8/feed/" rel="self" type="application/rss+xml" />
	<link>https://rpsh.net</link>
	<description>待从头</description>
	<lastBuildDate>Wed, 16 Sep 2015 16:09:18 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.2</generator>
	<item>
		<title>增加 Web Slices 支持</title>
		<link>https://rpsh.net/archives/create-web-slices-for-ie8/</link>
					<comments>https://rpsh.net/archives/create-web-slices-for-ie8/#comments</comments>
		
		<dc:creator><![CDATA[任平生]]></dc:creator>
		<pubDate>Thu, 12 Feb 2009 07:35:26 +0000</pubDate>
				<category><![CDATA[技术分享]]></category>
		<category><![CDATA[IE8]]></category>
		<category><![CDATA[Web Slices]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[原创]]></category>
		<guid isPermaLink="false">http://rpsh.net/?p=221</guid>

					<description><![CDATA[为 Rpsh.net 增加 Web Slices 支持，并且评论部分也具有 Web Slices 特性。如何给自己的博客添加 Web Slices 特性支持。]]></description>
										<content:encoded><![CDATA[<p>最近对这个主题进行了一些小改进，主要就是增加了对 IE8 Web Slices 特性的支持。</p>
<p>增加 <a href="https://rpsh.net/webslices/">Web Slices</a> 页面，提供了几个 Web Slices 供添加。不过感觉这似乎跟 RSS 基本无甚差别，然后又突发奇想给本Blog的评论增加 Web Slice 特性，得益于 WordPress Thread Comments 插件的嵌套评论让这一想法得以完美实现。</p>
<p><span id="more-221"></span></p>
<p>现在除了使用邮件获得自己评论是否被回复外，又多了一个途径：<a href="https://rpsh.net/archives/create-web-slices-for-ie8/">Web Slices</a>。</p>
<p>如果你正在使用 <a href="http://www.microsoft.com/ie8" target="_blank" class="external">Internet Explorer 8</a>，当你鼠标移过本博的每条评论时，就会注意到每条评论的周围都会出现一个绿色的矩形框，这就是IE8发现 Web Slice 的提示，点击那个绿绿的 Web Slice 图标即可添加一个 Web Slice 到你的IE8收藏栏。</p>
<p><img decoding="async" alt="鼠标在评论上移动时即可发现 Web Slices - 任平生 rpsh.net" src="http://lh5.ggpht.com/_aLmNmqD0H4M/SZPPo8eWIQI/AAAAAAAAAp0/ZKCzqAh4kK8/s800/comment-web-slice.png" width="540" height="154" /> </p>
<p>如此，当你的评论被回复时，IE8 的 Web Slices 会自动更新提醒你，这样你不用回到本博就可以看到对你评论的回复内容了 <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><img decoding="async" loading="lazy" alt="IE8可以自动提醒您Web Slices的更新 - 任平生 rpsh.net" src="http://lh3.ggpht.com/_aLmNmqD0H4M/SZPPpJHT83I/AAAAAAAAAp8/VbhIhUO1Gqw/s800/rpsh-comment-web-slice.png" width="540" height="343" /> </p>
<p>如果你也想给你的 WordPress 博客增加这样特性支持，十分容易。首先，我们了解一下 IE8 发现 Web Slices 的机制：</p>
<div style="padding-bottom: 10px; background-color: rgb(47,79,79); padding-left: 10px; padding-right: 10px; font-family: &#39;[object HTMLOptionElement]&#39;, consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; padding-top: 10px" class="source"><span style="color: rgb(176,196,222); font-weight: bold">&lt;div</span> <span style="color: rgb(255,255,255)">class=</span><span style="color: rgb(127,255,212)">&quot;hslice&quot;</span> <span style="color: rgb(255,255,255)">id=</span><span style="color: rgb(127,255,212)">&quot;mywebslice&quot;</span><span style="color: rgb(176,196,222); font-weight: bold">&gt;</span> <br /><span style="color: rgb(176,196,222); font-weight: bold">&lt;h1</span> <span style="color: rgb(255,255,255)">class=</span><span style="color: rgb(127,255,212)">&quot;entry-title&quot;</span><span style="color: rgb(176,196,222); font-weight: bold">&gt;</span><span style="color: rgb(245,222,179)">Web Slice 标题</span><span style="color: rgb(176,196,222); font-weight: bold">&lt;/h1&gt;</span> <br /><span style="color: rgb(176,196,222); font-weight: bold">&lt;div</span> <span style="color: rgb(255,255,255)">class=</span><span style="color: rgb(127,255,212)">&quot;entry-content&quot;</span><span style="color: rgb(176,196,222); font-weight: bold">&gt;</span> <br /><span style="color: rgb(245,222,179)">web slice 内容</span> <br /><span style="color: rgb(176,196,222); font-weight: bold">&lt;/div&gt;</span>  <br /><span style="color: rgb(176,196,222); font-weight: bold">&lt;/div&gt;</span></div>
<p>当IE8浏览器浏览这个页面时，发现了html 标签的 class 属性： &quot;hslice” ,&quot;entry-title”,&quot;entry-content”&#160; 按既定顺序出现，并且内容完整，就会将其标记为一个 Web Slice。&#160; 所以，你只需给你的页面添加如 &quot;hslice”，&quot;entry-title”，&quot;entry-content” 的属性就可以让你的页面支持 IE8 的 Web Slices 特性了。(注意：第一行代码中 id 也是必不可少的，id 用来确定一个页面中多个 web slice 的唯一性)</p>
<p>了解了这些，我们就可以对自己的主题文件中的 comments.php 进行修改了，这里提供一个修改后的代码供参考（以默认主题为例）：</p>
<div style="padding-bottom: 10px; background-color: rgb(47,79,79); padding-left: 10px; padding-right: 10px; font-family: &#39;[object HTMLOptionElement]&#39;, consolas, &#39;Lucida Console&#39;, &#39;Courier New&#39;; padding-top: 10px" class="source"><span style="color: rgb(245,222,179)">&lt;li </span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(176,196,222); font-weight: bold">echo</span> <span style="color: rgb(216,191,216)">$oddcomment</span>;<span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)">id=&quot;comment-</span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_ID</span>(<span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)">&quot; <span style="background-color: #1b2c2c">class=&quot;hslice&quot;</span>&gt;</span> <br /><span style="background-color: #1b2c2c"><span style="color: rgb(245,222,179)">&lt;div class=&quot;entry-title&quot; style=&quot;display:none&quot;&gt;</span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_author</span>() <span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)"> 的评论&lt;/div&gt;</span></span> <br /><span style="background-color: #1b2c2c; color: rgb(245,222,179)">&lt;div class=&quot;entry-content&quot;&gt;</span> <br /><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(176,196,222); font-weight: bold">echo</span> <span style="color: rgb(245,222,179)">get_avatar</span>( <span style="color: rgb(216,191,216)">$comment</span><span style="color: rgb(245,222,179)">,</span> <span style="color: rgb(173,216,230)">50</span> <span style="color: rgb(238,238,0)">?&gt;</span> <br /><span style="color: rgb(245,222,179)">&lt;cite&gt;</span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_author_link</span>(<span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)">&lt;/cite&gt; Says:</span> <br /><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(176,196,222); font-weight: bold">if</span> (<span style="color: rgb(216,191,216)">$comment</span><span style="color: rgb(245,222,179)">-&gt;</span><span style="color: rgb(255,255,255)">comment_approved</span> <span style="color: rgb(245,222,179)">==</span> <span style="color: rgb(127,255,212)">&#8216;0&#8217;</span>)<span style="color: rgb(245,222,179)">:</span> <span style="color: rgb(238,238,0)">?&gt;</span> <br /><span style="color: rgb(245,222,179)">&lt;em&gt;Your comment is awaiting moderation.&lt;/em&gt;</span>  <br /><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(176,196,222); font-weight: bold">endif</span>; <span style="color: rgb(238,238,0)">?&gt;</span>  <br /><span style="color: rgb(245,222,179)">&lt;br /&gt;</span> <br /><span style="color: rgb(245,222,179)">&lt;small class=&quot;commentmetadata&quot;&gt;&lt;a href=&quot;#comment-</span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_ID</span>(<span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)">&quot; title=&quot;&quot;&gt;</span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_date</span>(<span style="color: rgb(127,255,212)">&#8216;F jS, Y&#8217;</span><span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)"> at </span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_time </span><span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)">&lt;/a&gt; </span><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">edit_comment_link</span>(<span style="color: rgb(127,255,212)">&#8216;edit&#8217;</span><span style="color: rgb(245,222,179)">,</span><span style="color: rgb(127,255,212)">&#8216;&amp;nbsp;&amp;nbsp;&#8217;</span><span style="color: rgb(245,222,179)">,</span><span style="color: rgb(127,255,212)">&#8221;</span>)<span style="color: rgb(238,238,0)">?&gt;</span><span style="color: rgb(245,222,179)">&lt;/small&gt;</span> <br /><span style="color: rgb(238,238,0)">&lt;?php</span> <span style="color: rgb(245,222,179)">comment_text</span>(<span style="color: rgb(238,238,0)">?&gt;</span>  <br /><span style="background-color: #1b2c2c; color: rgb(245,222,179)">&lt;/div&gt;</span>  <br /><span style="color: rgb(245,222,179)">&lt;/li&gt;</span> </div>
<p>&#160;</p>
<p>Web Slices的确是个很棒的功能，它让人们可以订阅网页上自己需要持续关注的某一部分内容的更新而非整个页面，这是RSS所不能及的。如果有更多浏览器支持 Web Slices 特性就好了。</p>
<p>有关 IE8 Web Slices 开发的文档，可到<a href="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=ie8whitepapers&amp;ReleaseId=567" target="_blank" class="external">这里</a>下载。下边是 IE8 Web Slices 特性的介绍视频：</p>
<div style="text-align: center"><iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/qgsArP6P7iE" frameborder="0" allowfullscreen></iframe></div>
<p>ps. 如果你在浏览本博时发现页面错位，图片错乱等问题，先用 Ctrl + F5 强制刷新页面，如果问题依然存在，请留言告知 <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://rpsh.net/archives/create-web-slices-for-ie8/feed/</wfw:commentRss>
			<slash:comments>45</slash:comments>
		
		
			</item>
	</channel>
</rss>
