npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

newsapp-open

v5.0.0

Published

Open netease newsapp

Downloads

18

Readme

打开客户端

npm

Usage

遇到iOS下点击没有反应的情况,需要对该元素增加css cursor: pointer

init

/*
 * param: String
 * channels: String | Array
 * projectId: String
 */
openNewsapp.init({
  channels: ['sps', 'sps_article'], // 必填,项目中所有用到的渠道ID,如果只有一个可以传String
  param: String,                    // 选填,默认打开的客户端页面
  args: String,                     // 选填,V4.5.0新增,默认打开客户端时所带的统计参数
  projectId: '4JHDPZUJ-1'           // 选填,项目ID,每个页面只能有一个projectId,open及bind方法可不传projectId
})

bind (推荐使用)

自动绑定事件,内部调用剪贴板,V3新增

// <button class="button" data-param="startup" data-channel="sps" data-args="spskw=111&spsother=xxx"></button>
// 其中param、channel对应open方法的param、channel参数 
openNewsapp.bind({
  selector: '.button',     // 必填,打开客户端按钮对应的选择器
  param: 'startup',        // 选填,若element未设置data-param,将选用此参数;且覆盖init中的param参数   
  args: String,            // 选填,V4.5.0新增,若element未设置data-param,将选用此参数;且覆盖init中的args参数 
  channel: 'sps_article',  // 选填,若element未设置data-channel,将选用此参数;且覆盖init中的channel参数  
  projectId: '4JHDPZUJ-1', // 选填,项目ID
  download: true,          // 选填, v4.5.4新增,直接下载;默认false
  beforeOpen: () => {}     // 选填,打开客户端之前的hook函数
})

open

此方法无法将内容插入到剪贴板中,所以无法完成闭环统计

/*
 * 首页: startup
 * 文章: 951C0KA70001124J
 * 专题: S1385797470941
 * 网页: http://www.163.com
 * 图集: 0096/32491
 * 跟贴: tie/C44U3PJ700097U7S
 * 直播: live/55474
 * 视频: VBV126LCH
 * 问吧: EX4064892651204023641
 * 话吧: SJ3699667062136051057
 * 萝卜: luobo/123123
 * 薄荷: mint/123123
 * 书籍: book/bd_18e4ef74840e4786a6adeb08fa7bd44d_4
 * 视频专题: SV1385797470941
 * 新闻栏目: channel/T1348649580692
 * 订阅(网易号): reader/T1374482883888
 * 问答问题详情: wt1231xx1231231
 * 问答答案详情: hd123321xx43233
 */

openNewsapp.open({
  param: '951C0KA70001124J',      // 必填,上述参数
  redirect: 'http://www.163.com', // 选填,如果未打开客户端,直接跳转该地址
  args: String,                   // 选填,V4.5.0新增,统计用参数 
  download: true,                 // 选填,直接下载
  channel: 'sps_article',         // 选填,渠道号
  projectId: '4JHDPZUJ-1'         // 选填,项目ID,V3新增
})

DEMO

demo

引用

<script src="//static.ws.126.net/utf8/3g/libs/open-newsapp/latest/open-newsapp.min.js"></script>  // 推荐
<script src="//static.ws.126.net/utf8/3g/libs/open-newsapp/@version//open-newsapp.min.js"></script>

Change log

v5.0.0

  • 请求渠道信息的接口,增加参数spsid、source

v4.5.3

  • 修复下载链接逻辑

v4.5.2

  • bind 方法增加 download 参数,与 open 方法一致

v4.5.0

  • 允许自定义统计参数,如: data-args="spskw=11&aa",此时,剪贴板中的scheme结尾会增加此值

v4.4.6

  • 兼容安卓微信应用宝配置不带android_schema的情况

v4.4.5

  • 统计增加spssurl

v4.4.2

  • 安卓微信直接跳转应用宝

v4.4.0

  • IMPORTANT增加未识别param的兼容性,如对于uploadLog之前会返回startup,现在会返回uploadLog

v4.3.13

  • 临时修改安卓微信跳转到中间页

v4.3.11

  • 修复应用宝中无法多维统计的bug

v4.3.10

  • 增加平台统计spsp=wx yx wb qq
  • 问题详情与答案详情scheme修改

v4.3.9

  • 严重修复闭环统计的bug,请尽快更新到此版本

v4.3.7

  • 增加打开问答的问题详情和答案详情

v4.3.4

  • 更改打开书籍页的实现方式

v4.3.3

  • 中间页地址有http改为https

v4.3.2

  • 新增打开短资讯页 shortnews/aaaaaa

v4.3.0

  • 打开视频专题由vtopic/SV1231231312 改为 SV1231231312
  • 修复安卓微信下 tentcentMarket不存在时的bug

v4.2.0

  • 增加打开视频专题页 vtopic/SV1231231312
  • 修复chrome下redirect不生效的问题

v4.1.0

更改之前使用未在init方法中声明过的channel会报错的设定,目前仅打印一段warn

v4.0.0

必须在页面初始化过程中调用init方法,将页面能用到的所有渠道写入channels参数中