Chinaunix首页 | 论坛 | 博客
  • 博客访问: 82807
  • 博文数量: 22
  • 博客积分: 10501
  • 博客等级: 准将
  • 技术积分: 215
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-27 22:14
文章分类
文章存档

2012年(22)

我的朋友

分类: 嵌入式

2012-02-27 17:53:19

编者按:基于Windows Phone 7 应用程序或游戏的开发工作并不容易,若要通过认证并具备在 Windows Phone 7 商城中上市的资格更有许多应该注意的事项。今天小编就来为WP的开发者们讲述整个应用提交的过程,并且为大家出谋划策,规避遭拒和下架的风险。

内容摘要:

第一部分

第二部分

第三部分

第四部分

第五部分

第六部分

每一个WP开发者都比较清楚,向微软的WP应用商店提交审核时,开发者被要求在提交过程中,微软要对其程序进行验证。该过程包括检查元数据和验证上传的XAP文件。程序集和数据文件必须打包成 XAP 文件包。Visual Studio 2010 Express for Windows Phone 可以生成必要的 XAP 包和清单文件。

图:WP应用提交和认证过程

第一部分 XAP软件包提交注意事项

XAP包文件的最大大小为225MB。也就是说,你不要试图开发超过225MB以上的大应用。例如大型的3D游戏,将超大容量的视频等内容打包等。

XAP包必须包含以下内容:

1. 一个名为 WMAppManifest.xml 的有效 Windows Phone 应用程序清单文件。有关更多信息可参看:。

2. WMAppManifest.xml 文件中的 元素必须包含应用程序标题。<Title> 元素不得为空。在提交过程的步骤 2 中输入 Windows Phone 商城 的“应用程序标题”和显示在该手机上的标题必须相同。有关设置该应用程序和磁贴标题的更多信息,请参阅如何:。</P> <P>3. 一个名为 AppManifest.xml 的有效 .NET 应用程序清单文件。</P> <P>4.AppManifest.xml 文件中指定的程序集文件。</P> <P>如果你希望显示在手机“应用”列表上的手机应用小磁贴。游戏必须使用手机应用大磁贴替换手机应用小磁贴。手机应用小磁贴必须为 62 x 62 像素的 PNG 文件。</P> <P>要在用户将应用程序固定到手机“开始”屏幕体验上的快速启动区域时显示的手机应用大磁贴。手机应用大磁贴必须为 173 x 173 像素的 PNG 文件。</P> <P style="TEXT-ALIGN: center"><IMG style="CURSOR: pointer" height=266 alt="" src="" width=500 border=0></P> <P id=wppage2><STRONG>第二</STRONG><STRONG>部分</STRONG><STRONG> 应用程序代码验证</STRONG></P> <P>WP开发者要想顺利提交应用,必须使用Windows Phone应用程序平台 上应用程序目标操作系统版本支持的规定API开发应用程序。有关更多信息,请参阅 主题。</P> <P>有关适用于 Windows Phone OS 7.1 的新 API 和更改的 API 的更多信息,以及有关这两个 Windows Phone 操作系统版本的应用程序兼容性的信息,请参阅 部分。</P> <P>应用程序不得通过 PInvoke 或 COM 互操作调用本机代码。如果调用,则认证过程会失败。</P> <P>应用程序必须使用发布配置而不是调试进行编译。应用程序不得包含调试符号或输出。</P> <P>应用程序不得重新分发 Windows Phone 程序集。但是可以重新分发全景图、数据透视图和地图程序集。</P> <P>在使用  命名空间中的任何方法时,应用程序不得调用 Microsoft.Xna.Framework.Game 程序集或 Microsoft.Xna.Framework.Graphics 程序集中的任何API。</P> <P id=wppage3><STRONG>第三</STRONG><STRONG>部分</STRONG><STRONG> 各种应用截图提交注意事项</STRONG></P> <P><STRONG>1.Windows Phone 商城图解</STRONG></P> <P>对于每个应用程序,必须提交一个图标以将你的应用程序显示在 Windows Phone 商城 目录中。此图标必须密切匹配 XAP 包中提供的图标。当用户在购买前浏览手机上的应用程序目录时,会看到此图标。</P> <P>切记:不要将透明 PNG 图像文件用于以下手机应用程序图标。 </P> <P>·手机应用小磁贴图标(必选),用于手机 Windows Phone 商城,大小为 99 x 99 像素。</P> <P>·手机应用大磁贴图标(可选),用于手机 Windows Phone 商城,大小为 173 x 173 像素。</P> <P>·PC 应用大磁贴图标(必选),用于手机 Windows Phone 商城,大小为 200 x 200 像素。</P> <P>·背景照片(可选),用于背景全景图,大小为 1000 x 800 像素。</P> <P style="TEXT-ALIGN: center"><IMG style="CURSOR: pointer" height=400 alt="" src="" width=452 border=0></P> <P><STRONG>2.应用程序屏幕截图</STRONG></P> <P>对于每个应用程序,必须提供至少一个或最多八个屏幕截图。用户在购买之前,会在目录的详细信息页面中看到这些屏幕截图。</P> <P>屏幕截图必须只包含应用程序图形,不得包含任何模拟器镶边、帧速率计数器或调试信息。不能以图形方式增强屏幕截图,但添加由微软指定和预先批准的信息性覆盖内容除外。</P> <P>有关更多信息,请参阅如何:为 Windows Phone 商城创建屏幕截图。“详细信息”页面屏幕截图必须为480 x 800像素的PNG文件。</P> <P><STRONG>3.应用程序磁贴图像</STRONG></P> <P>手机应用大磁贴和小磁贴图像必须代表应用程序。</P> <P><STRONG>第四</STRONG><STRONG>部分</STRONG><STRONG> 微软的应用程序策略</STRONG></P> <P>为了保护Windows Phone商城服务和服务的用户,也为了满足手机运营商的要求,微软已为Windows Phone商城中提供分发的应用程序建立了一些策略和条款,<STRONG>并且特别指明:微软保留根据需要更新这些策略的权利。(你懂的)</STRONG>作为WP应用开发者这些条款都是需要在开发之前就牢记在心的。</P> <P><STRONG>1.</STRONG>当从Windows Phone商城中获取时,应用程序必须功能完善(除了下面允许的其他数据以外)。除非与用户预先存在帐单关系,否则应用程序可不得要求用户提供支付信息(在该应用程序体验内)来激活、解锁或延长应用程序使用期。</P> <P><STRONG>2.</STRONG>应用程序不得出售、链接到或推销手机语音计划。</P> <P><STRONG>3.</STRONG>应用程序不得危害Windows Phone手机或Windows Phone 商城的安全或功能。</P> <P><STRONG>4.</STRONG>如果应用程序包含或显示广告,则该广告必须遵守微软广告创意接受政策指南,并且该应用程序除了显示广告之外,还必须具有鲜明的、实质性的、合法的内容和目的。</P> <P><STRONG>5.</STRONG>如果应用程序需要下载其他大型数据包(例如,大于50MB的地图)才能使该应用程序按上述方式运行,则该应用程序描述必须显示该数据包的近似大小以及可能收取的额外费用,具体取决于用于获取数据的连接。</P> <P><STRONG>6.</STRONG>如果应用程序允许聊天、收发即时消息或进行其他面对面的通信,而且允许用户从移动设备中设置或创建自己的帐户或 ID,则该应用程序必须包含一个机制,用来验证<STRONG>创建帐户或ID的用户至少有13岁。</STRONG></P> <P><STRONG>7.</STRONG>以下要求适用于接收用户移动设备的位置的应用程序:</P> <P>(1)应用程序必须使用<STRONG>微软定位服务API</STRONG>确定位置。</P> <P>(2)应用程序的<STRONG>隐私策略必须通知用户</STRONG>如何使用和显示定位服务API中的位置数据,以及用户对位置数据使用和共享的控制。位置数据可以由应用程序承载,或直接与应用程序相链接。</P> <P>(3)应用程序必须<STRONG>提供应用程序内设置</STRONG>,允许用户启用或禁用对定位服务API中位置的访问和使用。</P> <P>(4)如果应用程序将从定位服务API获取的可用位置数据发布到其他服务或透露给其他人员(包括广告网络),则应用程序必须实现一种方法来获得选择性同意。要<STRONG>“实现一种获得‘选择性’同意的方法”</STRONG>,该应用程序必须:</P> <P style="MARGIN-LEFT: 2em">(a) 首先介绍使用或共享位置信息的方式;</P> <P style="MARGIN-LEFT: 2em">(b) 在按上述方式发布位置信息之前,先获取用户的明确权限;</P> <P style="MARGIN-LEFT: 2em">(c) 提供一个机制,通过该机制用户可以稍后不再发布位置信息。应用程序必须定期提醒用户或提供可视指示器,表明位置数据已被发送到任何其他服务或个人。</P> <P>(5)应用程序不得覆盖、回避或禁止任何与定位服务 API 相关的 Microsoft Toast 通知或提示。</P> <P>(6)应用程序不得覆盖或回避用户在移动设备上禁用定位服务的选项。</P> <P>(7)必须仅在交付应用程序向用户提供的位置感知功能时,应用程序才请求位置并保留和使用来自位置服务 API 的位置数据。</P> <P>(8)应用程序必须采取措施,阻止未经授权的访问、使用或泄露从定位服务 API 中接收的位置数据。</P> <P><STRONG>8.</STRONG>如果应用程序与第三方(例如其他服务或个人)共享用户的个人信息(包括,但不限于联系人、照片、电话号码、短信、浏览历史记录或合并了用户信息的唯一手机或用户 ID),则该应用程序必须<STRONG>实现一种方法以获取“选择性”同意。</STRONG>要“实现一种获得‘选择性’同意的方法”,该应用程序必须:</P> <P>提供隐私策略,其中至少必须描述将如何使用或共享个人信息;在按上述方式共享信息之前,请先获取用户的明确权限;以及提供一个机制,通过该机制用户可以稍后不再共享信息。</P> <P style="TEXT-ALIGN: center"><IMG style="CURSOR: pointer" height=333 alt="" src="" width=500 border=0></P> <P style="TEXT-ALIGN: center">图:用户隐私是微软重点保护的对象</P> <P><STRONG>9.</STRONG>如果应用程序使用微软推送通知服务,则应用程序和微软推送通知服务的使用必须遵守以下要求:</P> <P> (1)应用程序必须首先介绍要提供的通知并获取用户的明确许可(选择性获取),而且必须提供一个机制,通过该机制用户可以不接收推送通知。使用微软推送通知服务提供的所有通知必须与提供给用户的介绍保持一致,并且必须遵守所有适用的应用程序策略、内容策略和特定应用程序类型的其他要求。</P> <P> (2)该应用程序及其使用微软推送通知服务不得过度使用微软推送通知服务的网络容量或带宽,否则过多的推送通知会加重 Windows Phone 或其他微软设备或服务的负担(由微软经过合理的考虑决定),而且不得损害或干扰任何微软网络或服务器或任何连接到微软推送通知服务的第三方服务器或网络。</P> <P> (3)微软推送通知服务不得用于发送包含重要任务的通知,否则可能会影响性命攸关的事情,包括但不仅限于与医疗设备或条件相关的重要通知。微软特别声明不会对使用微软推送通知服务或提供微软推送通知服务通知将不会被中断、不会出现错误或保证实时出现提供任何保证。</P> <P><STRONG>10.</STRONG>应用程序必须具有独特、实用且<STRONG>合法的内容和用途。</STRONG>应用程序必须提供相关功能,而不是用来启动网页。</P> <P><STRONG>第五</STRONG><STRONG>部分</STRONG><STRONG> 特定应用程序类型的其他审核要求</STRONG></P> <P>除却严格的提交格式和API函数之外,微软对于WP应用中一些较为特别的功能,还有一些追加的要求。这些也是开发者应该注意和遵循的。</P> <P><STRONG>一、位置感知应用程序</STRONG></P> <P>用户可以从“系统设置”页面关闭手机上的定位服务。在手机上的定位服务关闭时,位置感知应用程序必须仍然保持响应能力。</P> <P><STRONG>建议:</STRONG>显示用户友好消息以指示位置数据不可用。</P> <P style="TEXT-ALIGN: center"><IMG style="CURSOR: pointer" height=200 alt="" src="" width=200 border=0></P> <P><STRONG>二、推送通知应用程序</STRONG></P> <P>微软推送通知服务会提供一个灵活持久的专用通道,用于将通知从 Web 服务推送到移动设备。但在 UI 或“设置”菜单中,该应用程序必须向用户提供单独禁用 Toast 通知的功能。你的应用程序第一次使用 BindToShellToast()()()() 方法时,该应用程序必须要求用户提供显式权限才能接收 Toast 通知。</P> <P><STRONG>建议:</STRONG>使用“允许 Toast 通知”作为此设置的文本标签。只需要在第一次使用 BindToShellToast 方法时要求用户提供权限即可。不需要再次要求用户提供权限。例如,如果每次加载应用程序时该应用程序都要调用 BindToShellToast,则只需在第一次启动该应用程序时提示用户即可。</P> <P style="TEXT-ALIGN: center"><IMG style="CURSOR: pointer" height=206 alt="" src="" width=524 border=0></P> <P><STRONG>三、在锁定屏幕下运行的应用程序</STRONG></P> <P>通过设置 ApplicationIdleDetectionMode 属性,前台中的应用程序就能够在锁定手机屏幕的情况下继续运行。当应用程序在锁定屏幕下运行时,消耗的电量可能不受用户控制,并且可能会无意中增加自身的数据费用。因此,必须最大限度地降低你的应用程序在锁定屏幕下运行时的用电量。(微软对于耗电大的应用,会把关很严格。)</P> <P>应用程序在锁定条件下运行时,微软强烈建议你使用以下新功能,而不是设置 ApplicationIdleDetectionMode 属性。</P> <P style="MARGIN-LEFT: 2em"><STRONG>对于锁屏状态下微软要求:</STRONG></P> <P style="MARGIN-LEFT: 2em">当通知锁定屏幕时,在锁定屏幕下运行的所有应用程序均必须停止全部 UI 更新、活动定时器及其他不重要的处理工作。</P> <P style="MARGIN-LEFT: 2em">应用程序在锁定屏幕下播放音频时,手机电池的最短使用时间必须大于六小时。</P> <P style="MARGIN-LEFT: 2em">如果手机锁定时应用程序未播放音频,则手机屏幕锁定时该应用程序必须仍然保持空闲。</P> <P style="MARGIN-LEFT: 2em">应用程序在锁定屏幕下运行时,手机电池的最短使用时间必须大于 120 小时。</P> <P style="TEXT-ALIGN: center"><IMG style="CURSOR: pointer" height=430 alt="" src="" width=600 border=0></P> <P><STRONG>四、“音乐 + 视频”中心应用程序</STRONG></P> <P>“音乐 + 视频”中心的应用程序在手机上提供综合音乐和视频体验,这也是它的主要功能。当应用程序调用 MediaHistory 或 MediaHistoryItem 类时,如果手机上已安装该应用程序,则会视为“音乐 + 视频”中心应用程序并将显示在“附加程序”列表中(在 Windows Phone OS 7.0 中称为“字幕”列表)。提交过程会检测该应用程序是否使用这些类,并自动将中心类型更新到 Windows Phone 应用程序清单文件中的“音乐 + 视频”。</P> <P><STRONG>微软的要求:</STRONG></P> <P>应用程序功能必须与视频和/或音乐媒体播放相关。</P> <P>当用户点按的磁贴与“音乐 + 视频”中心的“历史记录”或“正在播放”列表中的应用程序相关联时,该应用程序必须 (a) 启动该磁贴中标识的内容的播放体验,或者 (b) 启动提供先前播放的媒体内容相关信息的视图并允许用户继续播放。当用户在“音乐 + 视频”中心的“历史记录”、“正在播放”或新列表中点按内容磁贴时,该应用程序不得启动主登录页面或默认登录页面。</P> <P>当应用程序播放媒体时,该应用程序必须更新“音乐 + 视频”中心的“历史记录”列表。</P> <P>当媒体被添加到手机或用户在应用程序中创建“对象”时(例如,创建收音机电台、创建音乐标记),该应用程序必须更新“音乐 + 视频”中心的“新建”列表。</P> <P>当媒体与容器相关联时,“音乐 + 视频”中心的“新建”列表和“历史记录”列表中的中心磁贴必须表示一个有效的容器(例如相册、艺术家、播放列表、收音机电台,而不是各个媒体项目)。</P> <P>“音乐 + 视频”中心的中心磁贴不得包含广告、媒体源或其他未经请求的内容。</P> <P><STRONG>五、播放媒体的非“音乐 + 视频”中心应用程序</STRONG></P> <P>应用程序运行时可以在后台播放媒体,即使在其主要功能与音乐或视频不相关的情况下也是如此。微软对播放音乐、音频或声音效果的应用程序提出了以下要求:</P> <P><STRONG>在程序的初始启动时</STRONG>,如果应用程序启动时用户已在手机上播放音乐,则该应用程序不得通过调用 Microsoft.Xna.Framework.Media.MediaPlayer 类暂停、继续或停止手机 MediaQueue 中播放的音乐。如果应用程序播放自带的背景音乐或调整背景音乐的音量,则必须征得用户同意才能停止播放/调整背景音乐(例如消息对话框或设置菜单)。此提示必须在每次启动应用程序时出现,除非已为用户提供选择设置并且用户已采用此设置进行选择。</P> <P><STRONG>可配置的功能方面</STRONG>,如果应用程序播放背景音乐,则该应用程序必须向用户提供背景音乐和背景音乐音量的可配置设置。</P> <P>在播放时,应用程序无需征得用户同意即可中断手机上当前正在播放的音乐,以播放非交互式的全动态视频或非交互式的音频段(例如影片剪輯或媒体剪辑)。关闭应用程序后,该应用程序必须继续播放先前播放的音乐。</P> <P><STRONG>特效方面</STRONG>,SoundEffect 类不得用于在应用程序中播放连续的背景音乐曲目。</P> <P><STRONG>第六</STRONG><STRONG>部分</STRONG><STRONG> 心得总结</STRONG></P> <P>微软为开发者制定了许多严格的条款,作为WP应用平台的开发者,对这些内容一定要有深刻的了解,而微软设下的这道“门”也必有其道理。</P> <P> <TABLE style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0> <TBODY> <TR> <TD style="WORD-WRAP: break-word" bgColor=#fdfddf><FONT color=#000000>我一直认为门是用来打开的,所以才会装了合叶和把手。你设置了阻碍,而其他人必定会设法跨越。人类就是这样好奇未知,而忽视显而易见的真知本性。因此,门的存在是有其必然的道理。</FONT></TD></TR></TBODY></TABLE></P> <P>微软正在高压打击的方面一定不要去尝试跨越。另一方面,这些严苛的条款对于最终的用户是好的。我们可以明显看到,微软在尽力保障用户的电池续航时间,在严格的保护用户敏感的隐私。同时微软也在极力的保证其Metro UI的设计理念能够深入的贯彻到每一个应用中。总之,上述的这些条款都是微软该作的,也是不得不作的。最后预祝各位开发者的应用提交流程一帆风顺。</P></DIV> </div> <!-- <div class="Blog_con3_1">管理员在2009年8月13日编辑了该文章文章。</div> --> <div class="Blog_con2_1 Blog_con3_2"> <div> <!--<img src="/image/default/tu_8.png">--> <!-- JiaThis Button BEGIN --> <div class="bdsharebuttonbox"><A class=bds_more href="#" data-cmd="more"></A><A class=bds_qzone title=分享到QQ空间 href="#" data-cmd="qzone"></A><A class=bds_tsina title=分享到新浪微博 href="#" data-cmd="tsina"></A><A class=bds_tqq title=分享到腾讯微博 href="#" data-cmd="tqq"></A><A class=bds_renren title=分享到人人网 href="#" data-cmd="renren"></A><A class=bds_weixin title=分享到微信 href="#" data-cmd="weixin"></A></div> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> <!-- JiaThis Button END --> </div> 阅读(2861) | 评论(0) | 转发(0) | <div class="HT_line3"></div> </div> <div class="Blog_con3_3"> <div><span id='digg_num'>0</span><a href="javascript:void(0)" id='digg' bid='3084579' url='/blog/digg.html' ></a></div> <p>上一篇:<a href="/uid-10766711-id-3081889.html">撼动IT界的10大编程语言</a></p> <p>下一篇:<a href="/uid-10766711-id-3084588.html">Facebook为何兵败电子商务</a></p> </div> </div> <!-- <div class="Blog_con3_4 Blog_con3_5"> <div class="Blog_tit2 Blog_tit7">热门推荐</div> <ul> <li><a href="" title="" target='blank' ></a></li> </ul> </div> --> </div> </div> <div class="Blog_right1_7" id='replyList'> <div class="Blog_tit3">给主人留下些什么吧!~~</div> <!--暂无内容--> <!-- 评论分页--> <div class="Blog_right1_6 Blog_right1_12"> </div> <!-- 评论分页--> <div class="Blog_right1_10" style="display:none"> <div class="Blog_tit3">评论热议</div> <!--未登录 --> <div class="Blog_right1_8"> <div class="nologin_con1"> 请登录后评论。 <p><a href="http://account.chinaunix.net/login" onclick="link(this)">登录</a> <a href="http://account.chinaunix.net/register?url=http%3a%2f%2fblog.chinaunix.net">注册</a></p> </div> </div> </div> <div style="text-align:center;margin-top:10px;"> <script type="text/javascript" smua="d=p&s=b&u=u3118759&w=960&h=90" src="//www.nkscdn.com/smu0/o.js"></script> </div> </div> </div> </div> <input type='hidden' id='report_url' value='/blog/ViewReport.html' /> <script type="text/javascript"> //测试字符串的长度 一个汉字算2个字节 function mb_strlen(str) { var len=str.length; var totalCount=0; for(var i=0;i<len;i++) { var c = str.charCodeAt(i); if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) { totalCount++; }else{ totalCount+=2; } } return totalCount; } /* var Util = {}; Util.calWbText = function (text, max){ if(max === undefined) max = 500; var cLen=0; var matcher = text.match(/[^\x00-\xff]/g), wlen = (matcher && matcher.length) || 0; //匹配url链接正则 http://*** var pattern = /http:\/\/([\w-]+\.)+[\w-]+(\/*[\w-\.\/\?%&=][^\s^\u4e00-\u9fa5]*)?/gi; //匹配的数据存入数组 var arrPt = new Array(); var i = 0; while((result = pattern.exec(text)) != null){ arrPt[i] = result[0]; i++; } //替换掉原文本中的链接 for(var j = 0;j<arrPt.length;j++){ text = text.replace(arrPt[j],""); } //减掉链接所占的长度 return Math.floor((max*2 - text.length - wlen)/2 - 12*i); }; */ var allowComment = '0'; //举报弹出层 function showJuBao(url, cid){ $.cover(false); asyncbox.open({ id : 'report_thickbox', url : url, title : '举报违规', width : 378, height : 240, scroll : 'no', data : { 'cid' : cid, 'idtype' : 2 , 'blogurl' : window.location.href }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); } $(function(){ //创建管理员删除的弹出层 $('#admin_article_del').click(function(){ $.cover(false); asyncbox.open({ id : 'class_thickbox', html : '<div class="HT_layer3_1"><ul><li class="HT_li1">操作原因:<select class="HT_sel7" id="del_type" name="del_type"><option value="广告文章">广告文章</option><option value="违规内容">违规内容</option><option value="标题不明">标题不明</option><option value="文不对题">文不对题</option></select></li><li class="HT_li1" ><input class="HT_btn4" id="admin_delete" type="button" /></li></ul></div>', title : '选择类型', width : 300, height : 150, scroll : 'no', callback : function(action){ if(action == 'close'){ $.cover(false); } } }); }); $('#admin_delete').live('click' , function(){ ///blog/logicdel/id/3480184/url/%252Fblog%252Findex.html.html var type = $('#del_type').val(); var url = '/blog/logicdel/id/3084579/url/%252Fuid%252F10766711.html.html'; window.location.href= url + '?type=' + type; }); //顶 js中暂未添加&过滤 $('#digg').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $('#digg').attr('bid'); var url = $('#digg').attr('url'); var digg_str = $.cookie('digg_id'); if(digg_str != null) { var arr= new Array(); //定义一数组 arr = digg_str.split(","); //字符分割 for( i=0 ; i < arr.length ; i++ ) { if(bid == arr[i]) { showErrorMsg('已经赞过该文章', '消息提示'); return false; } } } $.ajax({ type:"POST", url:url, data: { 'bid' : bid }, dataType: 'json', success:function(msg){ if(msg.error == 0) { var num = parseInt($('#digg_num').html(),10); num += 1; $('#digg_num').html(num); $('#digg').die(); if(digg_str == null) { $.cookie('digg_id', bid, {expires: 30 , path: '/'}); } else { $.cookie('digg_id', digg_str + ',' + bid, {expires: 30 , path: '/'}); } showSucceedMsg('谢谢' , '消息提示'); } else if(msg.error == 1) { //showErrorMsg(msg.error_content , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); } else if(msg.error == 2) { showErrorMsg(msg.error_content , '消息提示'); } } }); }); //举报弹出层 /*$('.box_report').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var url = $('#report_url').val(); var cid = $(this).attr('cid'); $.cover(false); asyncbox.open({ id : 'report_thickbox', url : url, title : '举报违规', width : 378, height : 240, scroll : 'no', data : { 'cid' : cid, 'idtype' : 2 }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); });*/ //评论相关代码 //点击回复显示评论框 $('.Blog_a10').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } if(allowComment == 1) { showErrorMsg('该博文不允许评论' , '消息提示'); return false; } var tid = $(this).attr('toid');//留言作者id var bid = $(this).attr('bid');//blogid var cid = $(this).attr('cid');//留言id var tname = $(this).attr('tname'); var tpl = '<div class="Blog_right1_9">'; tpl += '<div class="div2">'; tpl += '<textarea name="" cols="" rows="" class="Blog_ar1_1" id="rmsg">文明上网,理性发言...</textarea>'; tpl += '</div>'; tpl += '<div class="div3">'; tpl += '<div class="div3_2"><a href="javascript:void(0);" class="Blog_a11" id="quota_sbumit" url="/Comment/PostComment.html" tid="'+tid+'" bid="'+bid+'" cid="'+cid+'" tname="'+tname+'" ></a><a href="javascript:void(0)" id="qx_comment" class="Blog_a12"></a></div>'; tpl += '<div class="div3_1"><a href="javascript:void(0);" id="mface"><span></span>表情</a></div>'; tpl += '<div class="clear"></div>'; tpl += '</div>'; tpl += '</div>'; $('.z_move_comment').html(''); $(this).parents('.Blog_right1_8').find('.z_move_comment').html(tpl).show(); }); //引用的评论提交 $('#quota_sbumit').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $(this).attr('bid'); var tid = $(this).attr('tid');//被引用人的id var qid = $(this).attr('cid');//引用的id var url = $(this).attr('url'); var text = $('#rmsg').val(); var tname = $(this).attr('tname'); if(text == '' || text=='文明上网,理性发言...') { showErrorMsg('评论内容不能为空!' , '消息提示'); return false; } else { if(mb_strlen(text) > 1000){ showErrorMsg('评论内容不能超过500个汉字' , '消息提示'); return false; } } $.ajax({ type: "post", url: url , data: {'bid': bid , 'to' : tid , 'qid' : qid , 'text': text , 'tname' : tname }, dataType: 'json', success: function(data){ if(data.code == 1){ var tpl = '<div class="Blog_right1_8">'; tpl+= '<div class="Blog_right_img1"><a href="' +data.info.url+ '" >' + data.info.header + '</a></div>'; tpl+= '<div class="Blog_right_font1">'; tpl+= '<p class="Blog_p5"><span><a href="' +data.info.url+ '" >' + data.info.username + '</a></span>' + data.info.dateline + '</p>'; tpl+= '<p class="Blog_p7"><a href="' + data.info.quota.url + '">' + data.info.quota.username + '</a>:'+ data.info.quota.content + '</p>'; tpl+= '<p class="Blog_p8">' + data.info.content + '</p><span class="span_text1"><a href="javascript:void(0);" class="Blog_a10" toid=' + data.info.fuid + ' bid=' + data.info.bid + ' cid=' + data.info.cid + ' tname = ' + data.info.username + ' >回复</a> |  <a class="comment_del_mark" style="cursor:pointer" url="' + data.info.delurl + '" >删除</a> |  <a href="javascript:showJuBao(\'/blog/ViewReport.html\','+data.info.cid+')" class="box_report" cid="' + data.info.cid + '" >举报</a></span></div>'; tpl+= '<div class="z_move_comment" style="display:none"></div>'; tpl+= '<div class="Blog_line1"></div></div>'; $('#replyList .Blog_right1_8:first').before(tpl); $('.z_move_comment').html('').hide(); } else if(data.code == -1){ //showErrorMsg(data.info , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); } }, error: function(){//请求出错处理 } }); }); //底部发表评论 $('#submitmsg').click(function(){ if(allowComment == 1) { showErrorMsg('该博文不允许评论' , '消息提示'); return false; } var bid = $(this).attr('bid'); var toid = $(this).attr('toid'); var text = $('#reply').val(); var url = $(this).attr('url'); if(text == '' || text=='文明上网,理性发言...') { showErrorMsg('评论内容不能为空!' , '消息提示'); return false; } else { if(mb_strlen(text) > 1000){ showErrorMsg('评论内容不能超过500个汉字' , '消息提示'); return false; } } $.ajax({ type: "post", url: url , data: {'bid': bid , 'to' : toid ,'text': text}, dataType: 'json', success: function(data){ if(data.code == 1) { var tpl = '<div class="Blog_right1_8">'; tpl += '<div class="Blog_right_img1"><a href="' +data.info.url+ '" >' + data.info.header + '</a></div>'; tpl += '<div class="Blog_right_font1">'; tpl += '<p class="Blog_p5"><span><a href="' +data.info.url+ '" >' + data.info.username + '</a></span>' + data.info.dateline + '</p>'; tpl += '<p class="Blog_p6">' + data.info.content + '</p>'; tpl += '<div class="div1"><a href="javascript:void(0);" class="Blog_a10" toid=' + data.info.fuid + ' bid=' + data.info.bid + ' cid=' + data.info.cid + '>回复</a> |  <a class="comment_del_mark" style="cursor:pointer" url="' + data.info.delurl + '">删除</a> |  <a href="javascript:showJuBao(\'/blog/ViewReport.html\','+data.info.cid+')" class="box_report" cid="' + data.info.cid + '">举报</a></div>'; tpl += '<div class="z_move_comment" style="display:none"></div>'; tpl += '</div><div class="Blog_line1"></div></div>'; $('.Blog_tit3:first').after(tpl); $('#reply').val('文明上网,理性发言...'); } else if(data.code == -1) { showErrorMsg(data.info , '消息提示'); } }, error: function(){//请求出错处理 } }); }); //底部评论重置 $('#reset_comment').click(function(){ $('#reply').val('文明上网,理性发言...'); }); //取消回复 $('#qx_comment').live('click' , function(){ $('.z_move_comment').html('').hide(); }); $('#rmsg, #reply').live({ focus:function(){ if($(this).val() == '文明上网,理性发言...'){ $(this).val(''); } }, blur:function(){ if($(this).val() == ''){ $(this).val('文明上网,理性发言...'); } } }); //删除留言确认 $('.comment_del_mark').live('click' , function(){ var url = $(this).attr('url'); asyncbox.confirm('删除留言','确认', function(action){ if(action == 'ok') { location.href = url; } }); }); //删除时间确认 $('.del_article_id').click(function(){ var delurl = $(this).attr('delurl'); asyncbox.confirm('删除文章','确认', function(action){ if(action == 'ok') { location.href = delurl; } }); }); /* //字数限制 $('#rmsg, #reply').live('keyup', function(){ var id = $(this).attr('id'); var left = Util.calWbText($(this).val(), 500); var eid = '#errmsg'; if(id == 'reply') eid = '#rerrmsg'; if (left >= 0) $(eid).html('您还可以输入<span>' + left + '</span>字'); else $(eid).html('<font color="red">您已超出<span>' + Math.abs(left) + '</span>字 </font>'); }); */ //加载表情 $('#face').qqFace({id : 'facebox1', assign : 'reply', path : '/image/qqface/'}); $('#mface').qqFace({id : 'facebox', assign : 'rmsg', path:'/image/qqface/'}); /* $('#class_one_id').change(function(){ alert(123213); var id = parseInt($(this).val() , 10); if(id == 0) return false; $('.hidden_son_class span').each(function( index , dom ){ if( dom.attr('cid') == id ) { } }); }); */ //转载文章 var turn_url = "/blog/viewClassPart.html"; $('#repost_bar').click(function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var id = $(this).attr('bid'); asyncbox.open({ id : 'turn_class_thickbox', url : turn_url, title : '转载文章', width : 330, height : 131, scroll : 'no', data : { 'id' : id }, callback : function(action){ if(action == 'close'){ $.cover(false); } } }); }); /* //转发文章 $('#repost_bar').live('click' , function(){ if(isOnLine == '' ) { //showErrorMsg('登录之后才能进行此操作' , '消息提示'); showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); return false; } var bid = $(this).attr('bid'); var url = $(this).attr('url'); asyncbox.confirm('转载文章','确认', function(action){ if(action == 'ok'){ $.ajax({ type:"POST", url:url, data: { 'bid' : bid }, dataType: 'json', success:function(msg){ if(msg.error == 0){ showSucceedMsg('转发成功!', '消息提示'); }else if(msg.error == 1){ //location.href = '/index.php?r=site/login'; showErrorMsg('操作失败,您需要先登录!', '消息提示', 'http://account.chinaunix.net/login'); }else{ showErrorMsg(msg.error_content, '消息提示'); } } }); } }); }); */ }); </script> <!--该部分应该放在输出代码块的后面才起作用 --> <script type="text/javascript"> SyntaxHighlighter.autoloader( 'applescript /highlight/scripts/shBrushAppleScript.js', 'actionscript3 as3 /highlight/scripts/shBrushAS3.js', 'bash shell /highlight/scripts/shBrushBash.js', 'coldfusion cf /highlight/scripts/shBrushColdFusion.js', 'cpp c /highlight/scripts/shBrushCpp.js', 'c# c-sharp csharp /highlight/scripts/shBrushCSharp.js', 'css /highlight/scripts/shBrushCss.js', 'delphi pascal /highlight/scripts/shBrushDelphi.js', 'diff patch pas /highlight/scripts/shBrushDiff.js', 'erl erlang /highlight/scripts/shBrushErlang.js', 'groovy /highlight/scripts/shBrushGroovy.js', 'java /highlight/scripts/shBrushJava.js', 'jfx javafx /highlight/scripts/shBrushJavaFX.js', 'js jscript javascript /highlight/scripts/shBrushJScript.js', 'perl pl /highlight/scripts/shBrushPerl.js', 'php /highlight/scripts/shBrushPhp.js', 'text plain /highlight/scripts/shBrushPlain.js', 'py python /highlight/scripts/shBrushPython.js', 'ruby rails ror rb /highlight/scripts/shBrushRuby.js', 'scala /highlight/scripts/shBrushScala.js', 'sql /highlight/scripts/shBrushSql.js', 'vb vbnet /highlight/scripts/shBrushVb.js', 'xml xhtml xslt html /highlight/scripts/shBrushXml.js' ); SyntaxHighlighter.all(); function code_hide(id){ var code = document.getElementById(id).style.display; if(code == 'none'){ document.getElementById(id).style.display = 'block'; }else{ document.getElementById(id).style.display = 'none'; } } </script> <!--回顶部js2011.12.30--> <script language="javascript"> lastScrollY=0; function heartBeat(){ var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop else {/*Netscape stuff*/} percent=.1*(diffY-lastScrollY); if(percent>0)percent=Math.ceil(percent); else percent=Math.floor(percent); document.getElementById("full").style.top=parseInt(document.getElementById("full").style.top)+percent+"px"; lastScrollY=lastScrollY+percent; if(lastScrollY<200) { document.getElementById("full").style.display="none"; } else { document.getElementById("full").style.display="block"; } } var gkuan=document.body.clientWidth; var ks=(gkuan-960)/2-30; suspendcode="<div id=\"full\" style='right:-30px;POSITION:absolute;TOP:500px;z-index:100;width:26px; height:86px;cursor:pointer;'><a href=\"javascript:void(0)\" onclick=\"window.scrollTo(0,0);\"><img src=\"\/image\/top.png\" /></a></div>" document.write(suspendcode); window.setInterval("heartBeat()",1); </script> <!-- footer --> <div class="Blog_footer" style='clear:both'> <div><a href="http://www.chinaunix.net/about/index.shtml" target="_blank" rel="nofollow">关于我们</a> | <a href="http://www.it168.com/bottomfile/it168.shtml" target="_blank" rel="nofollow">关于IT168</a> | <a href="http://www.chinaunix.net/about/connect.html" target="_blank" rel="nofollow">联系方式</a> | <a href="http://www.chinaunix.net/about/service.html" target="_blank" rel="nofollow">广告合作</a> | <a href="http://www.it168.com//bottomfile/flgw/fl.htm" target="_blank" rel="nofollow">法律声明</a> | <a href="http://account.chinaunix.net/register?url=http%3a%2f%2fblog.chinaunix.net" target="_blank" rel="nofollow">免费注册</a> <p>Copyright 2001-2010 ChinaUnix.net All Rights Reserved 北京皓辰网域网络信息技术有限公司. 版权所有 </p> <div>感谢所有关心和支持过ChinaUnix的朋友们 <p><a href="http://beian.miit.gov.cn/">16024965号-6 </a></p> </div> </div> </div> </div> <script language="javascript"> //全局错误提示弹出框 function showErrorMsg(content, title, url){ var url = url || ''; var title = title || '消息提示'; var html = ''; html += '<div class="HT_layer3_1 HT_layer3_2"><ul><li><p><span class="login_span1"></span>' + content + '</p></li>'; if(url == '' || url.length == 0){ html += '<li class="HT_li1"><input type="button" class="HT_btn2" onclick=\'close_windows("error_msg")\'></li>'; } else { html += '<li class="HT_li1"><input type="button" class="login_btn1" onclick="location.href=\'' + url + '\'"></li>'; } html += '</ul></div>'; $.cover(true); asyncbox.open({ id: 'error_msg', title : title, html : html, 'callback' : function(action){ if(action == 'close'){ $.cover(false); } } }); } //全局正确提示 function showSucceedMsg(content, title , url ){ var url = url || ''; var title = title || '消息提示'; var html = ''; html += '<div class="HT_layer3_1 HT_layer3_2"><ul><li><p><span class="login_span2"></span>' + content + '</p></li>'; if(url == '' || url.length == 0){ html += '<li class="HT_li1"><input type="button" class="HT_btn2" onclick=\'close_windows("error_msg")\'></li>'; } else { html += '<li class="HT_li1"><input type="button" class="HT_btn2" onclick="location.href=\'' + url + '\'"></li>'; } html += '</ul></div>'; $.cover(true); asyncbox.open({ id: 'error_msg', title : title, html : html, 'callback' : function(action){ if(action == 'close'){ $.cover(false); } } }); } //关闭指定id的窗口 function close_windows(id){ $.cover(false); $.close(id); } //公告 var tID; var tn; // 高度 var nStopTime = 5000; // 不同行间滚动时间隔的时间,值越小,移动越快 var nSpeed = 50; // 滚动时,向上移动一像素间隔的时间,值越小,移动越快 var isMove = true; var nHeight = 25; var nS = 0; var nNewsCount = 3; /** * n 用于表示是否为第一次运行 **/ function moveT(n) { clearTimeout(tID) var noticev2 = document.getElementById("noticev2") nS = nSpeed; // 只在第一次调用时运行,初始化环境(有没有参数) if (n) { // 设置行高 noticev2.style.lineHeight = nHeight + "px"; // 初始化显示位置 tn = 0; // 刚进入时在第一行停止时间 nS = nStopTime; } // 判断鼠标是否指向层 if (isMove) { // 向上移动一像素 tn--; // 如果移动到最下面一行了,则移到顶行 if (Math.abs(tn) == nNewsCount * nHeight) { tn = 0; } // 设置位置 noticev2.style.marginTop = tn + "px"; // 完整显示一行时,停止一段时间 if (tn % nHeight == 0) { nS = nStopTime; } } tID = setTimeout("moveT()", nS); } moveT(1); // 此处可以传入任何参数 </script> <script type="text/javascript"> // var _gaq = _gaq || []; // _gaq.push(['_setAccount', 'UA-20237423-2']); // _gaq.push(['_setDomainName', '.chinaunix.net']); // _gaq.push(['_trackPageview']); // // (function() { // var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; // ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; // var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); // })(); </script> <script type="text/javascript"> var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F0ee5e8cdc4d43389b3d1bfd76e83216b' type='text/javascript'%3E%3C/script%3E")); function link(t){ var href= $(t).attr('href'); href+="?url="+encodeURIComponent(location.href); $(t).attr('href',href); //setCookie("returnOutUrl", location.href, 60, "/"); } </script> <script type="text/javascript" src="/js/jquery.qqFace.js"></script> </body> </html>