├── pages
├── news
│ ├── detail.json
│ ├── news.json
│ ├── news.wxml
│ ├── news.wxss
│ ├── news.js
│ ├── detail.wxml
│ ├── detail.wxss
│ └── detail.js
├── nodes
│ ├── list.json
│ ├── nodes.json
│ ├── nodes.wxml
│ ├── nodes.wxss
│ ├── nodes.js
│ ├── list.wxml
│ ├── list.wxss
│ └── list.js
├── user
│ ├── user.json
│ ├── user.wxml
│ ├── user.js
│ └── user.wxss
├── logs
│ ├── logs.json
│ ├── logs.wxss
│ ├── logs.wxml
│ └── logs.js
└── index
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ └── index.js
├── wxParse
├── emojis
│ ├── 00.gif
│ ├── 01.gif
│ ├── 02.gif
│ ├── 03.gif
│ ├── 04.gif
│ ├── 05.gif
│ ├── 06.gif
│ ├── 07.gif
│ ├── 08.gif
│ ├── 09.gif
│ ├── 10.gif
│ ├── 11.gif
│ ├── 12.gif
│ ├── 13.gif
│ ├── 14.gif
│ ├── 15.gif
│ ├── 16.gif
│ ├── 17.gif
│ ├── 18.gif
│ ├── 19.gif
│ ├── 20.gif
│ ├── 21.gif
│ ├── 22.gif
│ ├── 23.gif
│ ├── 24.gif
│ ├── 25.gif
│ ├── 26.gif
│ ├── 27.gif
│ ├── 28.gif
│ ├── 29.gif
│ ├── 30.gif
│ ├── 31.gif
│ ├── 32.gif
│ ├── 33.gif
│ ├── 34.gif
│ ├── 35.gif
│ ├── 36.gif
│ ├── 37.gif
│ ├── 38.gif
│ ├── 39.gif
│ ├── 40.gif
│ ├── 41.gif
│ ├── 42.gif
│ ├── 43.gif
│ ├── 44.gif
│ ├── 45.gif
│ ├── 46.gif
│ ├── 47.gif
│ ├── 48.gif
│ ├── 49.gif
│ ├── 50.gif
│ ├── 51.gif
│ ├── 52.gif
│ ├── 53.gif
│ ├── 54.gif
│ ├── 55.gif
│ ├── 56.gif
│ ├── 57.gif
│ ├── 58.gif
│ ├── 59.gif
│ ├── 60.gif
│ ├── 61.gif
│ ├── 62.gif
│ ├── 63.gif
│ ├── 64.gif
│ ├── 65.gif
│ ├── 66.gif
│ ├── 67.gif
│ ├── 68.gif
│ ├── 69.gif
│ ├── 70.gif
│ ├── 71.gif
│ ├── 72.gif
│ ├── 73.gif
│ ├── 74.gif
│ ├── 75.gif
│ ├── 76.gif
│ ├── 77.gif
│ ├── 78.gif
│ ├── 79.gif
│ ├── 80.gif
│ ├── 81.gif
│ ├── 82.gif
│ ├── 83.gif
│ ├── 84.gif
│ ├── 85.gif
│ ├── 86.gif
│ ├── 87.gif
│ ├── 88.gif
│ ├── 89.gif
│ ├── 90.gif
│ ├── 91.gif
│ ├── 92.gif
│ ├── 93.gif
│ ├── 94.gif
│ ├── 95.gif
│ ├── 96.gif
│ ├── 97.gif
│ ├── 98.gif
│ ├── 99.gif
│ ├── 100.gif
│ ├── 101.gif
│ ├── 102.gif
│ ├── 103.gif
│ ├── 104.gif
│ ├── 105.gif
│ ├── 106.gif
│ ├── 107.gif
│ ├── 108.gif
│ ├── 109.gif
│ ├── 110.gif
│ ├── 111.gif
│ ├── 112.gif
│ ├── 113.gif
│ ├── 114.gif
│ ├── 115.gif
│ ├── 116.gif
│ ├── 117.gif
│ ├── 118.gif
│ ├── 119.gif
│ ├── 120.gif
│ ├── 121.gif
│ ├── 122.gif
│ ├── 123.gif
│ ├── 124.gif
│ ├── 125.gif
│ ├── 126.gif
│ ├── 127.gif
│ ├── 128.gif
│ ├── 129.gif
│ ├── 130.gif
│ ├── 131.gif
│ ├── 132.gif
│ ├── 133.gif
│ └── 134.gif
├── wxParse.wxss
├── wxParse.js
├── htmlparser.js
├── wxDiscode.js
├── html2json.js
└── wxParse.wxml
├── preview
└── ezgif.com-optimize.gif
├── README.md
├── app.wxss
├── app.js
├── utils
├── util.wxs
└── util.js
├── project.config.json
└── app.json
/pages/news/detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "详情"
3 | }
--------------------------------------------------------------------------------
/pages/news/news.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "最新主题"
3 | }
--------------------------------------------------------------------------------
/pages/nodes/list.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "节点详情"
3 | }
--------------------------------------------------------------------------------
/pages/nodes/nodes.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "全部节点"
3 | }
--------------------------------------------------------------------------------
/pages/user/user.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "用户详情"
3 | }
--------------------------------------------------------------------------------
/pages/logs/logs.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看启动日志"
3 | }
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText":"最热主题"
3 | }
4 |
--------------------------------------------------------------------------------
/wxParse/emojis/00.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/00.gif
--------------------------------------------------------------------------------
/wxParse/emojis/01.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/01.gif
--------------------------------------------------------------------------------
/wxParse/emojis/02.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/02.gif
--------------------------------------------------------------------------------
/wxParse/emojis/03.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/03.gif
--------------------------------------------------------------------------------
/wxParse/emojis/04.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/04.gif
--------------------------------------------------------------------------------
/wxParse/emojis/05.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/05.gif
--------------------------------------------------------------------------------
/wxParse/emojis/06.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/06.gif
--------------------------------------------------------------------------------
/wxParse/emojis/07.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/07.gif
--------------------------------------------------------------------------------
/wxParse/emojis/08.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/08.gif
--------------------------------------------------------------------------------
/wxParse/emojis/09.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/09.gif
--------------------------------------------------------------------------------
/wxParse/emojis/10.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/10.gif
--------------------------------------------------------------------------------
/wxParse/emojis/11.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/11.gif
--------------------------------------------------------------------------------
/wxParse/emojis/12.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/12.gif
--------------------------------------------------------------------------------
/wxParse/emojis/13.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/13.gif
--------------------------------------------------------------------------------
/wxParse/emojis/14.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/14.gif
--------------------------------------------------------------------------------
/wxParse/emojis/15.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/15.gif
--------------------------------------------------------------------------------
/wxParse/emojis/16.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/16.gif
--------------------------------------------------------------------------------
/wxParse/emojis/17.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/17.gif
--------------------------------------------------------------------------------
/wxParse/emojis/18.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/18.gif
--------------------------------------------------------------------------------
/wxParse/emojis/19.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/19.gif
--------------------------------------------------------------------------------
/wxParse/emojis/20.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/20.gif
--------------------------------------------------------------------------------
/wxParse/emojis/21.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/21.gif
--------------------------------------------------------------------------------
/wxParse/emojis/22.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/22.gif
--------------------------------------------------------------------------------
/wxParse/emojis/23.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/23.gif
--------------------------------------------------------------------------------
/wxParse/emojis/24.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/24.gif
--------------------------------------------------------------------------------
/wxParse/emojis/25.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/25.gif
--------------------------------------------------------------------------------
/wxParse/emojis/26.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/26.gif
--------------------------------------------------------------------------------
/wxParse/emojis/27.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/27.gif
--------------------------------------------------------------------------------
/wxParse/emojis/28.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/28.gif
--------------------------------------------------------------------------------
/wxParse/emojis/29.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/29.gif
--------------------------------------------------------------------------------
/wxParse/emojis/30.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/30.gif
--------------------------------------------------------------------------------
/wxParse/emojis/31.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/31.gif
--------------------------------------------------------------------------------
/wxParse/emojis/32.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/32.gif
--------------------------------------------------------------------------------
/wxParse/emojis/33.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/33.gif
--------------------------------------------------------------------------------
/wxParse/emojis/34.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/34.gif
--------------------------------------------------------------------------------
/wxParse/emojis/35.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/35.gif
--------------------------------------------------------------------------------
/wxParse/emojis/36.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/36.gif
--------------------------------------------------------------------------------
/wxParse/emojis/37.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/37.gif
--------------------------------------------------------------------------------
/wxParse/emojis/38.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/38.gif
--------------------------------------------------------------------------------
/wxParse/emojis/39.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/39.gif
--------------------------------------------------------------------------------
/wxParse/emojis/40.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/40.gif
--------------------------------------------------------------------------------
/wxParse/emojis/41.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/41.gif
--------------------------------------------------------------------------------
/wxParse/emojis/42.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/42.gif
--------------------------------------------------------------------------------
/wxParse/emojis/43.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/43.gif
--------------------------------------------------------------------------------
/wxParse/emojis/44.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/44.gif
--------------------------------------------------------------------------------
/wxParse/emojis/45.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/45.gif
--------------------------------------------------------------------------------
/wxParse/emojis/46.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/46.gif
--------------------------------------------------------------------------------
/wxParse/emojis/47.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/47.gif
--------------------------------------------------------------------------------
/wxParse/emojis/48.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/48.gif
--------------------------------------------------------------------------------
/wxParse/emojis/49.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/49.gif
--------------------------------------------------------------------------------
/wxParse/emojis/50.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/50.gif
--------------------------------------------------------------------------------
/wxParse/emojis/51.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/51.gif
--------------------------------------------------------------------------------
/wxParse/emojis/52.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/52.gif
--------------------------------------------------------------------------------
/wxParse/emojis/53.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/53.gif
--------------------------------------------------------------------------------
/wxParse/emojis/54.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/54.gif
--------------------------------------------------------------------------------
/wxParse/emojis/55.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/55.gif
--------------------------------------------------------------------------------
/wxParse/emojis/56.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/56.gif
--------------------------------------------------------------------------------
/wxParse/emojis/57.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/57.gif
--------------------------------------------------------------------------------
/wxParse/emojis/58.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/58.gif
--------------------------------------------------------------------------------
/wxParse/emojis/59.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/59.gif
--------------------------------------------------------------------------------
/wxParse/emojis/60.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/60.gif
--------------------------------------------------------------------------------
/wxParse/emojis/61.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/61.gif
--------------------------------------------------------------------------------
/wxParse/emojis/62.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/62.gif
--------------------------------------------------------------------------------
/wxParse/emojis/63.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/63.gif
--------------------------------------------------------------------------------
/wxParse/emojis/64.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/64.gif
--------------------------------------------------------------------------------
/wxParse/emojis/65.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/65.gif
--------------------------------------------------------------------------------
/wxParse/emojis/66.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/66.gif
--------------------------------------------------------------------------------
/wxParse/emojis/67.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/67.gif
--------------------------------------------------------------------------------
/wxParse/emojis/68.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/68.gif
--------------------------------------------------------------------------------
/wxParse/emojis/69.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/69.gif
--------------------------------------------------------------------------------
/wxParse/emojis/70.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/70.gif
--------------------------------------------------------------------------------
/wxParse/emojis/71.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/71.gif
--------------------------------------------------------------------------------
/wxParse/emojis/72.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/72.gif
--------------------------------------------------------------------------------
/wxParse/emojis/73.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/73.gif
--------------------------------------------------------------------------------
/wxParse/emojis/74.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/74.gif
--------------------------------------------------------------------------------
/wxParse/emojis/75.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/75.gif
--------------------------------------------------------------------------------
/wxParse/emojis/76.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/76.gif
--------------------------------------------------------------------------------
/wxParse/emojis/77.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/77.gif
--------------------------------------------------------------------------------
/wxParse/emojis/78.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/78.gif
--------------------------------------------------------------------------------
/wxParse/emojis/79.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/79.gif
--------------------------------------------------------------------------------
/wxParse/emojis/80.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/80.gif
--------------------------------------------------------------------------------
/wxParse/emojis/81.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/81.gif
--------------------------------------------------------------------------------
/wxParse/emojis/82.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/82.gif
--------------------------------------------------------------------------------
/wxParse/emojis/83.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/83.gif
--------------------------------------------------------------------------------
/wxParse/emojis/84.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/84.gif
--------------------------------------------------------------------------------
/wxParse/emojis/85.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/85.gif
--------------------------------------------------------------------------------
/wxParse/emojis/86.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/86.gif
--------------------------------------------------------------------------------
/wxParse/emojis/87.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/87.gif
--------------------------------------------------------------------------------
/wxParse/emojis/88.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/88.gif
--------------------------------------------------------------------------------
/wxParse/emojis/89.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/89.gif
--------------------------------------------------------------------------------
/wxParse/emojis/90.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/90.gif
--------------------------------------------------------------------------------
/wxParse/emojis/91.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/91.gif
--------------------------------------------------------------------------------
/wxParse/emojis/92.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/92.gif
--------------------------------------------------------------------------------
/wxParse/emojis/93.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/93.gif
--------------------------------------------------------------------------------
/wxParse/emojis/94.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/94.gif
--------------------------------------------------------------------------------
/wxParse/emojis/95.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/95.gif
--------------------------------------------------------------------------------
/wxParse/emojis/96.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/96.gif
--------------------------------------------------------------------------------
/wxParse/emojis/97.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/97.gif
--------------------------------------------------------------------------------
/wxParse/emojis/98.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/98.gif
--------------------------------------------------------------------------------
/wxParse/emojis/99.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/99.gif
--------------------------------------------------------------------------------
/wxParse/emojis/100.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/100.gif
--------------------------------------------------------------------------------
/wxParse/emojis/101.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/101.gif
--------------------------------------------------------------------------------
/wxParse/emojis/102.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/102.gif
--------------------------------------------------------------------------------
/wxParse/emojis/103.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/103.gif
--------------------------------------------------------------------------------
/wxParse/emojis/104.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/104.gif
--------------------------------------------------------------------------------
/wxParse/emojis/105.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/105.gif
--------------------------------------------------------------------------------
/wxParse/emojis/106.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/106.gif
--------------------------------------------------------------------------------
/wxParse/emojis/107.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/107.gif
--------------------------------------------------------------------------------
/wxParse/emojis/108.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/108.gif
--------------------------------------------------------------------------------
/wxParse/emojis/109.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/109.gif
--------------------------------------------------------------------------------
/wxParse/emojis/110.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/110.gif
--------------------------------------------------------------------------------
/wxParse/emojis/111.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/111.gif
--------------------------------------------------------------------------------
/wxParse/emojis/112.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/112.gif
--------------------------------------------------------------------------------
/wxParse/emojis/113.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/113.gif
--------------------------------------------------------------------------------
/wxParse/emojis/114.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/114.gif
--------------------------------------------------------------------------------
/wxParse/emojis/115.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/115.gif
--------------------------------------------------------------------------------
/wxParse/emojis/116.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/116.gif
--------------------------------------------------------------------------------
/wxParse/emojis/117.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/117.gif
--------------------------------------------------------------------------------
/wxParse/emojis/118.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/118.gif
--------------------------------------------------------------------------------
/wxParse/emojis/119.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/119.gif
--------------------------------------------------------------------------------
/wxParse/emojis/120.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/120.gif
--------------------------------------------------------------------------------
/wxParse/emojis/121.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/121.gif
--------------------------------------------------------------------------------
/wxParse/emojis/122.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/122.gif
--------------------------------------------------------------------------------
/wxParse/emojis/123.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/123.gif
--------------------------------------------------------------------------------
/wxParse/emojis/124.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/124.gif
--------------------------------------------------------------------------------
/wxParse/emojis/125.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/125.gif
--------------------------------------------------------------------------------
/wxParse/emojis/126.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/126.gif
--------------------------------------------------------------------------------
/wxParse/emojis/127.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/127.gif
--------------------------------------------------------------------------------
/wxParse/emojis/128.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/128.gif
--------------------------------------------------------------------------------
/wxParse/emojis/129.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/129.gif
--------------------------------------------------------------------------------
/wxParse/emojis/130.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/130.gif
--------------------------------------------------------------------------------
/wxParse/emojis/131.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/131.gif
--------------------------------------------------------------------------------
/wxParse/emojis/132.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/132.gif
--------------------------------------------------------------------------------
/wxParse/emojis/133.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/133.gif
--------------------------------------------------------------------------------
/wxParse/emojis/134.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/wxParse/emojis/134.gif
--------------------------------------------------------------------------------
/preview/ezgif.com-optimize.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JiaZombie/v2exMiniProgram/HEAD/preview/ezgif.com-optimize.gif
--------------------------------------------------------------------------------
/pages/logs/logs.wxss:
--------------------------------------------------------------------------------
1 | .log-list {
2 | display: flex;
3 | flex-direction: column;
4 | padding: 40rpx;
5 | }
6 | .log-item {
7 | margin: 10rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/pages/nodes/nodes.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{node.title}}
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## v2ex非官方版 ##
2 | 一个 [v2ex](https://www.v2ex.com) 社区的非官方版小程序。
3 |
4 | ## 使用 ##
5 | 1. `clone` 到本地
6 | 2. 使用微信web开发者工具打开。
7 |
8 | (审核未通过)
9 | ## 预览 ##
10 | 
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | box-sizing: border-box;
9 | }
--------------------------------------------------------------------------------
/pages/logs/logs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{index + 1}}. {{log}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/nodes/nodes.wxss:
--------------------------------------------------------------------------------
1 | .node-wrap {
2 | display: flex;
3 | margin: 10px;
4 | flex-wrap:wrap;
5 | }
6 |
7 | .node {
8 | color: #778087;
9 | padding: 4px 10px 4px 10px;
10 | margin: 0px 5px 5px 0px;
11 | border-radius: 16px;
12 | border: 1px solid #e5e5e5;
13 | font-size:14px;
14 | flex: 1 1 auto;
15 | }
16 |
--------------------------------------------------------------------------------
/pages/logs/logs.js:
--------------------------------------------------------------------------------
1 | //logs.js
2 | var util = require('../../utils/util.js')
3 | Page({
4 | data: {
5 | logs: []
6 | },
7 | onLoad: function () {
8 | this.setData({
9 | logs: (wx.getStorageSync('logs') || []).map(function (log) {
10 | return util.formatTime(new Date(log))
11 | })
12 | })
13 | }
14 | })
15 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | //调用API从本地缓存中获取数据
5 | var logs = wx.getStorageSync('logs') || []
6 | logs.unshift(Date.now())
7 | wx.setStorageSync('logs', logs)
8 | },
9 | loading: function(title) {
10 | var tlt = title || '加载中';
11 | wx.showLoading({
12 | title: tlt,
13 | mask: true
14 | })
15 | }
16 | })
--------------------------------------------------------------------------------
/pages/news/news.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{item.title}}
6 | {{item.node.title}}
7 | {{item.member.username}}
8 |
9 | {{item.replies}}
10 |
11 |
--------------------------------------------------------------------------------
/utils/util.wxs:
--------------------------------------------------------------------------------
1 | function timeSince(timestamp) {
2 | var now = getDate().valueOf() / 1000; // 当前时间戳(秒)
3 | var diff = now - timestamp; // 时间差
4 |
5 | var periods = [
6 | [parseInt(diff / 31536000), '年前'],
7 | [parseInt(diff / 2592000), '个月前'],
8 | [parseInt(diff / 18144000), '周前'],
9 | [parseInt(diff / 86400), '天前'],
10 | [parseInt(diff / 3600), '小时前'],
11 | [parseInt(diff / 60), '分钟前'],
12 | [parseInt(diff), '秒前'],
13 | ];
14 |
15 | for(var i = 0; i < 7; i++) {
16 | if (periods[i][0]) {
17 | return periods[i].join(' ');
18 | }
19 | }
20 | return '刚刚';
21 | }
22 |
23 | module.exports = {
24 | timeSince: timeSince
25 | };
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{item.title}}
7 | {{item.node.title}}
8 | {{item.member.username}}
9 |
10 | {{item.replies}}
11 |
12 |
--------------------------------------------------------------------------------
/pages/nodes/nodes.js:
--------------------------------------------------------------------------------
1 | Page({
2 |
3 | /**
4 | * 页面的初始数据
5 | */
6 | data: {
7 | nodes: []
8 | },
9 |
10 | /**
11 | * 生命周期函数--监听页面加载
12 | */
13 | onLoad: function (options) {
14 | var self = this;
15 | var app = getApp();
16 |
17 | app.loading();
18 |
19 | wx.request({
20 | url: 'https://www.v2ex.com/api/nodes/all.json',
21 | success: function(res) {
22 | self.setData({
23 | nodes: res.data
24 | });
25 | },
26 | complete: function () {
27 | wx.hideLoading()
28 | }
29 | })
30 | },
31 |
32 | /**
33 | * 下拉刷新
34 | */
35 | onPullDownRefresh: function () {
36 | wx.reLaunch({
37 | url: 'pages/nodes/nodes',
38 | });
39 | }
40 | })
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": true,
5 | "es6": true,
6 | "postcss": true,
7 | "minified": true,
8 | "newFeature": true
9 | },
10 | "compileType": "miniprogram",
11 | "libVersion": "1.9.1",
12 | "appid": "wx1d5b40937a041cba",
13 | "projectname": "v2ex%E9%9D%9E%E5%AE%98%E6%96%B9%E7%89%88",
14 | "isGameTourist": false,
15 | "condition": {
16 | "search": {
17 | "current": -1,
18 | "list": []
19 | },
20 | "conversation": {
21 | "current": -1,
22 | "list": []
23 | },
24 | "miniprogram": {
25 | "current": -1,
26 | "list": []
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/pages/news/news.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | navigator {
3 | display: unset;
4 | }
5 | .item {
6 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
7 | margin-bottom: 5pt;
8 | text-align: left;
9 | width: 90%;
10 | padding: 5pt;
11 | display: flex;
12 | align-items: center;
13 | font-size: 16px;
14 | }
15 | .content {
16 | margin:0 10px 0 10px;
17 | flex:1 1 auto;
18 | }
19 |
20 | .avatar {
21 | width: 48px;
22 | height:48px;
23 | flex-shrink: 0;
24 | }
25 |
26 | .title {
27 | display:block;
28 | color: #778087;
29 | }
30 |
31 | .nodename {
32 | padding: 4px;
33 | background-color: #f5f5f5;
34 | color: #999;
35 | font-size: 12px;
36 | }
37 |
38 | .username {
39 | font-size: 12px;
40 | color: #778087;
41 | font-weight: bold;
42 | margin: 2px 6px 2px 6px;
43 | }
44 |
45 | .item>.reply {
46 | background-color: #ccc;
47 | color: #fff;
48 | border-radius: 12px;
49 | padding: 2px 10px 2px 10px;
50 | }
51 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | navigator {
3 | display: unset;
4 | }
5 | .item {
6 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
7 | margin-bottom: 5pt;
8 | text-align: left;
9 | width: 90%;
10 | padding: 5pt;
11 | display: flex;
12 | align-items: center;
13 | font-size: 16px;
14 | }
15 | .content {
16 | margin:0 10px 0 10px;
17 | flex:1 1 auto;
18 | }
19 |
20 | .avatar {
21 | width: 48px;
22 | height:48px;
23 | flex-shrink: 0;
24 | }
25 |
26 | .title {
27 | display:block;
28 | color: #778087;
29 | }
30 |
31 | .nodename {
32 | padding: 4px;
33 | background-color: #f5f5f5;
34 | color: #999;
35 | font-size: 12px;
36 | }
37 |
38 | .username {
39 | font-size: 12px;
40 | color: #778087;
41 | font-weight: bold;
42 | margin: 2px 6px 2px 6px;
43 | }
44 |
45 | .item>.reply {
46 | background-color: #ccc;
47 | color: #fff;
48 | border-radius: 12px;
49 | padding: 2px 10px 2px 10px;
50 | }
51 |
--------------------------------------------------------------------------------
/pages/nodes/list.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 | {{item.title}}
17 | {{item.member.username}}
18 |
19 | {{item.replies}}
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/news/news",
5 | "pages/nodes/nodes",
6 | "pages/user/user",
7 | "pages/news/detail",
8 | "pages/nodes/list"
9 | ],
10 | "window": {
11 | "navigationBarBackgroundColor": "#eeeeee",
12 | "navigationBarTextStyle": "black",
13 | "navigationBarTitleText": "v2ex",
14 | "backgroundColor": "#eeeeee",
15 | "backgroundTextStyle": "light",
16 | "enablePullDownRefresh": true
17 | },
18 | "tabBar": {
19 | "color": "#353535",
20 | "selectedColor": "#3cc51f",
21 | "borderStyle": "white",
22 | "backgroundColor": "#eeeeee",
23 | "list": [
24 | {
25 | "pagePath": "pages/index/index",
26 | "text": "最热主题"
27 | },
28 | {
29 | "pagePath": "pages/news/news",
30 | "text": "最新主题"
31 | },
32 | {
33 | "pagePath": "pages/nodes/nodes",
34 | "text": "节点信息"
35 | }
36 | ]
37 | },
38 | "networkTimeout": {
39 | "request": 10000,
40 | "downloadFile": 10000
41 | },
42 | "debug": false
43 | }
--------------------------------------------------------------------------------
/pages/news/news.js:
--------------------------------------------------------------------------------
1 | Page({
2 |
3 | /**
4 | * 页面的初始数据
5 | */
6 | data: {
7 | topics: []
8 | },
9 |
10 | /**
11 | * 下拉刷新
12 | */
13 | onPullDownRefresh: function () {
14 | wx.reLaunch({
15 | url: 'news',
16 | });
17 | },
18 | /**
19 | * 生命周期函数--监听页面加载
20 | */
21 | onLoad: function (options) {
22 | var that = this;
23 | var app = getApp();
24 |
25 | try {
26 | app.loading();
27 |
28 | // 请求数据
29 | wx.request({
30 | url: "https://www.v2ex.com/api/topics/latest.json",
31 | header: {
32 | 'cache-control': 'max-age=120'
33 | },
34 | success: function (res) {
35 | if (!res.data.rate_limit) {
36 | that.setData({
37 | topics: res.data
38 | });
39 | } else {
40 | wx.showToast({
41 | title: res.data.message,
42 | icon: 'none',
43 | duration: 2000
44 | })
45 | }
46 | },
47 | complete: function () {
48 | wx.hideLoading()
49 | }
50 | });
51 | } catch (e) {
52 | // Do something whe
53 | }
54 | },
55 | })
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //获取应用实例
2 | var app = getApp();
3 | var util = require('../../utils/util.js');
4 |
5 | var config = {
6 | data: {
7 | topics: []
8 | },
9 | onLoad: function (options) {
10 | var that = this;
11 | // var nodeId = options.nodeid;
12 |
13 | try {
14 | app.loading();
15 |
16 | // 请求数据
17 | wx.request({
18 | url: "https://www.v2ex.com/api/topics/hot.json",
19 | header: {
20 | 'cache-control': 'max-age=120'
21 | },
22 | success: function (res) {
23 | if (!res.data.rate_limit) {
24 | that.setData({
25 | topics: res.data
26 | });
27 | } else {
28 | wx.showToast({
29 | title: res.data.message,
30 | icon: 'none',
31 | duration: 2000
32 | })
33 | }
34 | },
35 | complete: function () {
36 | wx.hideLoading()
37 | wx.stopPullDownRefresh()
38 | }
39 | });
40 | } catch (e) {
41 | // Do something when catch error
42 | }
43 | },
44 | /**
45 | * 下拉刷新
46 | */
47 | onPullDownRefresh: function () {
48 | wx.reLaunch({
49 | url: 'index',
50 | });
51 | }
52 | };
53 | Page(config);
--------------------------------------------------------------------------------
/pages/news/detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {{item.member.username}}
21 | {{util.timeSince(item.created)}}
22 |
23 |
24 |
25 |
26 |
27 | {{1 + index}}
28 |
29 |
--------------------------------------------------------------------------------
/pages/user/user.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 | {{member.website}}
14 |
15 | {{member.psn}}
16 | {{member.github}}
17 | {{member.btc}}
18 | {{member.location}}
19 | {{member.bio}}
20 |
21 |
22 |
23 |
24 | {{item.title}}
25 | {{item.node.title}}
26 | {{util.timeSince(item.created)}}
27 |
28 | {{item.replies}}
29 |
--------------------------------------------------------------------------------
/pages/news/detail.wxss:
--------------------------------------------------------------------------------
1 | /* pages/news/detail.wxss */
2 | @import "/wxParse/wxParse.wxss";
3 |
4 | .container {
5 | padding: 10px;
6 | }
7 |
8 | .header {
9 | width: 100%;
10 | }
11 |
12 | .author, .created, .replynum {
13 | color: #778087;
14 | font-size: 0.8em;
15 | margin: 2px 4px 2px 4px;
16 | align-self: flex-start;
17 | }
18 |
19 | .author {
20 | font-weight: bold;
21 | display: unset;
22 | }
23 |
24 | .content {
25 | margin-top: 4px;
26 | font-size: 14px;
27 | overflow: hidden;
28 | }
29 |
30 | .embeded_image {
31 | max-width: 320px;
32 | max-height: 320px;
33 | flex: 0 0 auto;
34 | }
35 |
36 | .avatar {
37 | width: 48px;
38 | height: 48px;
39 | flex: 0 0 auto;
40 | margin-top: 10px;
41 | align-self: flex-start;
42 | }
43 |
44 | .mini-avatar {
45 | width: 24px;
46 | height: 24px;
47 | flex-shrink: 0;
48 | }
49 |
50 | .title {
51 | font-size: 1.2em;
52 | display: block;
53 | color: #778087;
54 | }
55 |
56 | .reply {
57 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
58 | margin-bottom: 5pt;
59 | text-align: left;
60 | width: 100%;
61 | padding: 5pt;
62 | display: flex;
63 | align-items: center;
64 | font-size: 16px;
65 | overflow: hidden;
66 | }
67 |
68 | .embedded_image {
69 | max-width: 100%;
70 | }
71 |
72 | .header + .content {
73 | width: 100%;
74 | padding-bottom: 10px;
75 | margin-bottom: 10px;
76 | }
77 |
78 | .reply-meta {
79 | align-self: flex-start;
80 | margin: 2px 6px 2px 6px;
81 | flex: 1 1 auto;
82 | word-break: break-word;
83 | }
84 |
85 | .floor-id {
86 | display: inline-block;
87 | background-color: #f0f0f0;
88 | color: #aaa;
89 | border-radius: 10px;
90 | padding: 2px 10px 2px 10px;
91 | font-size: 0.6em;
92 | flex: 0 0 auto;
93 | }
94 |
--------------------------------------------------------------------------------
/pages/nodes/list.wxss:
--------------------------------------------------------------------------------
1 | /* pages/nodes/list.wxss */
2 |
3 | /* pages/users/user.wxss */
4 |
5 | .info {
6 | display: flex;
7 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
8 | margin: 10px 6px 10px 6px;
9 | flex-direction: column;
10 | background-color: #001d25;
11 | color: #fff;
12 | }
13 |
14 | .header {
15 | display: flex;
16 | margin-bottom: 10px;
17 | padding: 4px;
18 | }
19 |
20 | .avatar {
21 | width: 48px;
22 | height: 48px;
23 | flex-shrink: 0;
24 | margin-top: 8px;
25 | }
26 |
27 | .header-right {
28 | display: flex;
29 | flex-direction: column;
30 | margin: 0 6px 0 6px;
31 | }
32 |
33 | .header-right>.username {
34 | font-size: 1.4em;
35 | }
36 |
37 | .header-right>.tagline {
38 | display: inline-block;
39 | }
40 |
41 | .header-right>.status {
42 | color: #999;
43 | font-size: 0.8em;
44 | }
45 | navigator {
46 | display: unset;
47 | }
48 | .item {
49 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
50 | margin-bottom: 5pt;
51 | text-align: left;
52 | margin: 0 6px 0 6px;
53 | padding: 5pt;
54 | display: flex;
55 | align-items: center;
56 | font-size: 16px;
57 | }
58 | .content {
59 | margin:0 10px 0 10px;
60 | flex:1 1 auto;
61 | }
62 |
63 | .avatar {
64 | width: 48px;
65 | height:48px;
66 | flex-shrink: 0;
67 | }
68 |
69 | .title {
70 | display:block;
71 | color: #778087;
72 | }
73 |
74 | .nodename {
75 | padding: 4px;
76 | background-color: #f5f5f5;
77 | color: #999;
78 | font-size: 12px;
79 | }
80 |
81 | .username {
82 | font-size: 12px;
83 | color: #778087;
84 | font-weight: bold;
85 | margin: 2px 6px 2px 6px;
86 | }
87 |
88 | .item>.reply {
89 | background-color: #ccc;
90 | color: #fff;
91 | border-radius: 12px;
92 | padding: 2px 10px 2px 10px;
93 | }
94 |
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 格式化时间 YYYY/MM/DD HH:II:SS
3 | */
4 | function formatTime(date) {
5 | date = typeof date === 'object' ? date : (new Date(date))
6 |
7 | var year = date.getFullYear()
8 | var month = date.getMonth() + 1
9 | var day = date.getDate()
10 |
11 | var hour = date.getHours()
12 | var minute = date.getMinutes()
13 | var second = date.getSeconds()
14 |
15 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
16 | }
17 | /**
18 | * 格式化时间日期数据
19 | */
20 | function formatNumber(n) {
21 | n = n.toString()
22 | return n[1] ? n : '0' + n
23 | }
24 |
25 |
26 | // 跳转页面
27 | function redirect(url) {
28 | wx.navigateTo({
29 | url: url,
30 | })
31 | }
32 |
33 | /**
34 | * html是否需要解析
35 | */
36 | function isNeedParse(html) {
37 | return html.indexOf(' 0) {
60 | wx.previewImage({
61 | current: nowImgUrl, // 当前显示图片的http链接
62 | urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
63 | })
64 | }
65 | }
66 |
67 | /**
68 | * 图片视觉宽高计算函数区
69 | **/
70 | function wxParseImgLoad(e) {
71 | var that = this;
72 | var tagFrom = e.target.dataset.from;
73 | var idx = e.target.dataset.idx;
74 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
75 | calMoreImageInfo(e, idx, that, tagFrom)
76 | }
77 | }
78 | // 假循环获取计算图片视觉最佳宽高
79 | function calMoreImageInfo(e, idx, that, bindName) {
80 | var temData = that.data[bindName];
81 | if (!temData || temData.images.length == 0) {
82 | return;
83 | }
84 | var temImages = temData.images;
85 | //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
86 | var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
87 | var index = temImages[idx].index
88 | var key = `${bindName}`
89 | for (var i of index.split('.')) key+=`.nodes[${i}]`
90 | var keyW = key + '.width'
91 | var keyH = key + '.height'
92 | that.setData({
93 | [keyW]: recal.imageWidth,
94 | [keyH]: recal.imageheight,
95 | })
96 | // ====v2ex非官方版改造=====
97 | // 更新解析的回复里图片的宽高
98 | var replieIndexNum = `${bindName}`.match(/\d+/);
99 | if (replieIndexNum) {
100 | var rplkey = 'parsedReplies[' + replieIndexNum[0] + ']';
101 |
102 | for (var i of index.split('.')) rplkey += `[${i}]`;
103 |
104 | var replyW = rplkey + '.width';
105 | var replyH = rplkey + '.height';
106 |
107 | that.setData({
108 | [replyW]:recal.imageWidth,
109 | [replyH]: recal.imageheight,
110 | });
111 | }
112 | // =========================
113 | }
114 |
115 | // 计算视觉优先的图片宽高
116 | function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
117 | //获取图片的原始长宽
118 | var windowWidth = 0, windowHeight = 0;
119 | var autoWidth = 0, autoHeight = 0;
120 | var results = {};
121 | var padding = that.data[bindName].view.imagePadding;
122 | windowWidth = realWindowWidth-2*padding;
123 | windowHeight = realWindowHeight;
124 | //判断按照那种方式进行缩放
125 | // console.log("windowWidth" + windowWidth);
126 | if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
127 | autoWidth = windowWidth;
128 | // console.log("autoWidth" + autoWidth);
129 | autoHeight = (autoWidth * originalHeight) / originalWidth;
130 | // console.log("autoHeight" + autoHeight);
131 | results.imageWidth = autoWidth;
132 | results.imageheight = autoHeight;
133 | } else {//否则展示原来的数据
134 | results.imageWidth = originalWidth;
135 | results.imageheight = originalHeight;
136 | }
137 | return results;
138 | }
139 |
140 | function wxParseTemArray(temArrayName,bindNameReg,total,that){
141 | var array = [];
142 | var temData = that.data;
143 | var obj = null;
144 | for(var i = 0; i < total; i++){
145 | var simArr = temData[bindNameReg+i].nodes;
146 | array.push(simArr);
147 | }
148 |
149 | temArrayName = temArrayName || 'wxParseTemArray';
150 | obj = JSON.parse('{"'+ temArrayName +'":""}');
151 | obj[temArrayName] = array;
152 | that.setData(obj);
153 | }
154 |
155 | /**
156 | * 配置emojis
157 | *
158 | */
159 |
160 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
161 | HtmlToJson.emojisInit(reg,baseSrc,emojis);
162 | }
163 |
164 | module.exports = {
165 | wxParse: wxParse,
166 | wxParseTemArray:wxParseTemArray,
167 | emojisInit:emojisInit
168 | }
169 |
170 |
171 |
--------------------------------------------------------------------------------
/wxParse/htmlparser.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
4 | *
5 | * author: Di (微信小程序开发工程师)
6 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7 | * 垂直微信小程序开发交流社区
8 | *
9 | * github地址: https://github.com/icindy/wxParse
10 | *
11 | * for: 微信小程序富文本解析
12 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13 | */
14 | // Regular Expressions for parsing tags and attributes
15 | var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
16 | endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
17 | attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
18 |
19 | // Empty Elements - HTML 5
20 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
21 |
22 | // Block Elements - HTML 5
23 | var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
24 |
25 | // Inline Elements - HTML 5
26 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
27 |
28 | // Elements that you can, intentionally, leave open
29 | // (and which close themselves)
30 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
31 |
32 | // Attributes that have their values filled in disabled="disabled"
33 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
34 |
35 | // Special Elements (can contain anything)
36 | var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
37 |
38 | function HTMLParser(html, handler) {
39 | var index, chars, match, stack = [], last = html;
40 | stack.last = function () {
41 | return this[this.length - 1];
42 | };
43 |
44 | while (html) {
45 | chars = true;
46 |
47 | // Make sure we're not in a script or style element
48 | if (!stack.last() || !special[stack.last()]) {
49 |
50 | // Comment
51 | if (html.indexOf("");
53 |
54 | if (index >= 0) {
55 | if (handler.comment)
56 | handler.comment(html.substring(4, index));
57 | html = html.substring(index + 3);
58 | chars = false;
59 | }
60 |
61 | // end tag
62 | } else if (html.indexOf("") == 0) {
63 | match = html.match(endTag);
64 |
65 | if (match) {
66 | html = html.substring(match[0].length);
67 | match[0].replace(endTag, parseEndTag);
68 | chars = false;
69 | }
70 |
71 | // start tag
72 | } else if (html.indexOf("<") == 0) {
73 | match = html.match(startTag);
74 |
75 | if (match) {
76 | html = html.substring(match[0].length);
77 | match[0].replace(startTag, parseStartTag);
78 | chars = false;
79 | }
80 | }
81 |
82 | if (chars) {
83 | index = html.indexOf("<");
84 | var text = ''
85 | while (index === 0) {
86 | text += "<";
87 | html = html.substring(1);
88 | index = html.indexOf("<");
89 | }
90 | text += index < 0 ? html : html.substring(0, index);
91 | html = index < 0 ? "" : html.substring(index);
92 |
93 | if (handler.chars)
94 | handler.chars(text);
95 | }
96 |
97 | } else {
98 |
99 | html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
100 | text = text.replace(/|/g, "$1$2");
101 | if (handler.chars)
102 | handler.chars(text);
103 |
104 | return "";
105 | });
106 |
107 |
108 | parseEndTag("", stack.last());
109 | }
110 |
111 | if (html == last)
112 | throw "Parse Error: " + html;
113 | last = html;
114 | }
115 |
116 | // Clean up any remaining tags
117 | parseEndTag();
118 |
119 | function parseStartTag(tag, tagName, rest, unary) {
120 | tagName = tagName.toLowerCase();
121 |
122 | if (block[tagName]) {
123 | while (stack.last() && inline[stack.last()]) {
124 | parseEndTag("", stack.last());
125 | }
126 | }
127 |
128 | if (closeSelf[tagName] && stack.last() == tagName) {
129 | parseEndTag("", tagName);
130 | }
131 |
132 | unary = empty[tagName] || !!unary;
133 |
134 | if (!unary)
135 | stack.push(tagName);
136 |
137 | if (handler.start) {
138 | var attrs = [];
139 |
140 | rest.replace(attr, function (match, name) {
141 | var value = arguments[2] ? arguments[2] :
142 | arguments[3] ? arguments[3] :
143 | arguments[4] ? arguments[4] :
144 | fillAttrs[name] ? name : "";
145 |
146 | attrs.push({
147 | name: name,
148 | value: value,
149 | escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
150 | });
151 | });
152 |
153 | if (handler.start) {
154 | handler.start(tagName, attrs, unary);
155 | }
156 |
157 | }
158 | }
159 |
160 | function parseEndTag(tag, tagName) {
161 | // If no tag name is provided, clean shop
162 | if (!tagName)
163 | var pos = 0;
164 |
165 | // Find the closest opened tag of the same type
166 | else {
167 | tagName = tagName.toLowerCase();
168 | for (var pos = stack.length - 1; pos >= 0; pos--)
169 | if (stack[pos] == tagName)
170 | break;
171 | }
172 | if (pos >= 0) {
173 | // Close all the open elements, up the stack
174 | for (var i = stack.length - 1; i >= pos; i--)
175 | if (handler.end)
176 | handler.end(stack[i]);
177 |
178 | // Remove the open elements from the stack
179 | stack.length = pos;
180 | }
181 | }
182 | };
183 |
184 |
185 | function makeMap(str) {
186 | var obj = {}, items = str.split(",");
187 | for (var i = 0; i < items.length; i++)
188 | obj[items[i]] = true;
189 | return obj;
190 | }
191 |
192 | module.exports = HTMLParser;
193 |
--------------------------------------------------------------------------------
/wxParse/wxDiscode.js:
--------------------------------------------------------------------------------
1 | // HTML 支持的数学符号
2 | function strNumDiscode(str){
3 | str = str.replace(/∀/g, '∀');
4 | str = str.replace(/∂/g, '∂');
5 | str = str.replace(/&exists;/g, '∃');
6 | str = str.replace(/∅/g, '∅');
7 | str = str.replace(/∇/g, '∇');
8 | str = str.replace(/∈/g, '∈');
9 | str = str.replace(/∉/g, '∉');
10 | str = str.replace(/∋/g, '∋');
11 | str = str.replace(/∏/g, '∏');
12 | str = str.replace(/∑/g, '∑');
13 | str = str.replace(/−/g, '−');
14 | str = str.replace(/∗/g, '∗');
15 | str = str.replace(/√/g, '√');
16 | str = str.replace(/∝/g, '∝');
17 | str = str.replace(/∞/g, '∞');
18 | str = str.replace(/∠/g, '∠');
19 | str = str.replace(/∧/g, '∧');
20 | str = str.replace(/∨/g, '∨');
21 | str = str.replace(/∩/g, '∩');
22 | str = str.replace(/∩/g, '∪');
23 | str = str.replace(/∫/g, '∫');
24 | str = str.replace(/∴/g, '∴');
25 | str = str.replace(/∼/g, '∼');
26 | str = str.replace(/≅/g, '≅');
27 | str = str.replace(/≈/g, '≈');
28 | str = str.replace(/≠/g, '≠');
29 | str = str.replace(/≤/g, '≤');
30 | str = str.replace(/≥/g, '≥');
31 | str = str.replace(/⊂/g, '⊂');
32 | str = str.replace(/⊃/g, '⊃');
33 | str = str.replace(/⊄/g, '⊄');
34 | str = str.replace(/⊆/g, '⊆');
35 | str = str.replace(/⊇/g, '⊇');
36 | str = str.replace(/⊕/g, '⊕');
37 | str = str.replace(/⊗/g, '⊗');
38 | str = str.replace(/⊥/g, '⊥');
39 | str = str.replace(/⋅/g, '⋅');
40 | return str;
41 | }
42 |
43 | //HTML 支持的希腊字母
44 | function strGreeceDiscode(str){
45 | str = str.replace(/Α/g, 'Α');
46 | str = str.replace(/Β/g, 'Β');
47 | str = str.replace(/Γ/g, 'Γ');
48 | str = str.replace(/Δ/g, 'Δ');
49 | str = str.replace(/Ε/g, 'Ε');
50 | str = str.replace(/Ζ/g, 'Ζ');
51 | str = str.replace(/Η/g, 'Η');
52 | str = str.replace(/Θ/g, 'Θ');
53 | str = str.replace(/Ι/g, 'Ι');
54 | str = str.replace(/Κ/g, 'Κ');
55 | str = str.replace(/Λ/g, 'Λ');
56 | str = str.replace(/Μ/g, 'Μ');
57 | str = str.replace(/Ν/g, 'Ν');
58 | str = str.replace(/Ξ/g, 'Ν');
59 | str = str.replace(/Ο/g, 'Ο');
60 | str = str.replace(/Π/g, 'Π');
61 | str = str.replace(/Ρ/g, 'Ρ');
62 | str = str.replace(/Σ/g, 'Σ');
63 | str = str.replace(/Τ/g, 'Τ');
64 | str = str.replace(/Υ/g, 'Υ');
65 | str = str.replace(/Φ/g, 'Φ');
66 | str = str.replace(/Χ/g, 'Χ');
67 | str = str.replace(/Ψ/g, 'Ψ');
68 | str = str.replace(/Ω/g, 'Ω');
69 |
70 | str = str.replace(/α/g, 'α');
71 | str = str.replace(/β/g, 'β');
72 | str = str.replace(/γ/g, 'γ');
73 | str = str.replace(/δ/g, 'δ');
74 | str = str.replace(/ε/g, 'ε');
75 | str = str.replace(/ζ/g, 'ζ');
76 | str = str.replace(/η/g, 'η');
77 | str = str.replace(/θ/g, 'θ');
78 | str = str.replace(/ι/g, 'ι');
79 | str = str.replace(/κ/g, 'κ');
80 | str = str.replace(/λ/g, 'λ');
81 | str = str.replace(/μ/g, 'μ');
82 | str = str.replace(/ν/g, 'ν');
83 | str = str.replace(/ξ/g, 'ξ');
84 | str = str.replace(/ο/g, 'ο');
85 | str = str.replace(/π/g, 'π');
86 | str = str.replace(/ρ/g, 'ρ');
87 | str = str.replace(/ς/g, 'ς');
88 | str = str.replace(/σ/g, 'σ');
89 | str = str.replace(/τ/g, 'τ');
90 | str = str.replace(/υ/g, 'υ');
91 | str = str.replace(/φ/g, 'φ');
92 | str = str.replace(/χ/g, 'χ');
93 | str = str.replace(/ψ/g, 'ψ');
94 | str = str.replace(/ω/g, 'ω');
95 | str = str.replace(/ϑ/g, 'ϑ');
96 | str = str.replace(/ϒ/g, 'ϒ');
97 | str = str.replace(/ϖ/g, 'ϖ');
98 | str = str.replace(/·/g, '·');
99 | return str;
100 | }
101 |
102 | //
103 |
104 | function strcharacterDiscode(str){
105 | // 加入常用解析
106 | str = str.replace(/ /g, ' ');
107 | str = str.replace(/"/g, "'");
108 | str = str.replace(/&/g, '&');
109 | // str = str.replace(/</g, '‹');
110 | // str = str.replace(/>/g, '›');
111 |
112 | str = str.replace(/</g, '<');
113 | str = str.replace(/>/g, '>');
114 | str = str.replace(/•/g, '•');
115 |
116 | return str;
117 | }
118 |
119 | // HTML 支持的其他实体
120 | function strOtherDiscode(str){
121 | str = str.replace(/Œ/g, 'Œ');
122 | str = str.replace(/œ/g, 'œ');
123 | str = str.replace(/Š/g, 'Š');
124 | str = str.replace(/š/g, 'š');
125 | str = str.replace(/Ÿ/g, 'Ÿ');
126 | str = str.replace(/ƒ/g, 'ƒ');
127 | str = str.replace(/ˆ/g, 'ˆ');
128 | str = str.replace(/˜/g, '˜');
129 | str = str.replace(/ /g, '');
130 | str = str.replace(/ /g, '');
131 | str = str.replace(/ /g, '');
132 | str = str.replace(//g, '');
133 | str = str.replace(//g, '');
134 | str = str.replace(//g, '');
135 | str = str.replace(//g, '');
136 | str = str.replace(/–/g, '–');
137 | str = str.replace(/—/g, '—');
138 | str = str.replace(/‘/g, '‘');
139 | str = str.replace(/’/g, '’');
140 | str = str.replace(/‚/g, '‚');
141 | str = str.replace(/“/g, '“');
142 | str = str.replace(/”/g, '”');
143 | str = str.replace(/„/g, '„');
144 | str = str.replace(/†/g, '†');
145 | str = str.replace(/‡/g, '‡');
146 | str = str.replace(/•/g, '•');
147 | str = str.replace(/…/g, '…');
148 | str = str.replace(/‰/g, '‰');
149 | str = str.replace(/′/g, '′');
150 | str = str.replace(/″/g, '″');
151 | str = str.replace(/‹/g, '‹');
152 | str = str.replace(/›/g, '›');
153 | str = str.replace(/‾/g, '‾');
154 | str = str.replace(/€/g, '€');
155 | str = str.replace(/™/g, '™');
156 |
157 | str = str.replace(/←/g, '←');
158 | str = str.replace(/↑/g, '↑');
159 | str = str.replace(/→/g, '→');
160 | str = str.replace(/↓/g, '↓');
161 | str = str.replace(/↔/g, '↔');
162 | str = str.replace(/↵/g, '↵');
163 | str = str.replace(/⌈/g, '⌈');
164 | str = str.replace(/⌉/g, '⌉');
165 |
166 | str = str.replace(/⌊/g, '⌊');
167 | str = str.replace(/⌋/g, '⌋');
168 | str = str.replace(/◊/g, '◊');
169 | str = str.replace(/♠/g, '♠');
170 | str = str.replace(/♣/g, '♣');
171 | str = str.replace(/♥/g, '♥');
172 |
173 | str = str.replace(/♦/g, '♦');
174 | str = str.replace(/'/g, '\'');
175 | return str;
176 | }
177 |
178 | function strMoreDiscode(str){
179 | str = str.replace(/\r\n/g,"");
180 | str = str.replace(/\n/g,"");
181 |
182 | str = str.replace(/code/g,"wxxxcode-style");
183 | return str;
184 | }
185 |
186 | function strDiscode(str){
187 | str = strNumDiscode(str);
188 | str = strGreeceDiscode(str);
189 | str = strcharacterDiscode(str);
190 | str = strOtherDiscode(str);
191 | str = strMoreDiscode(str);
192 | return str;
193 | }
194 | function urlToHttpUrl(url,rep){
195 |
196 | var patt1 = new RegExp("^//");
197 | var result = patt1.test(url);
198 | if(result){
199 | url = rep+":"+url;
200 | }
201 | return url;
202 | }
203 |
204 | module.exports = {
205 | strDiscode:strDiscode,
206 | urlToHttpUrl:urlToHttpUrl
207 | }
--------------------------------------------------------------------------------
/pages/user/user.wxss:
--------------------------------------------------------------------------------
1 | /* pages/users/user.wxss */
2 |
3 | .info {
4 | display: flex;
5 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
6 | margin: 10px 6px 20px 6px;
7 | flex-direction: column;
8 | padding: 4px;
9 | }
10 |
11 | .header {
12 | display: flex;
13 | margin-bottom: 10px;
14 |
15 | }
16 |
17 | .avatar {
18 | width: 48px;
19 | height: 48px;
20 | flex-shrink: 0;
21 | margin-top: 8px;
22 | }
23 |
24 | .header-right {
25 | display: flex;
26 | flex-direction: column;
27 | margin: 0 6px 0 6px;
28 | }
29 |
30 | .header-right>.username {
31 | font-size: 1.4em;
32 | }
33 |
34 | .header-right>.tagline {
35 | display: inline-block;
36 | }
37 |
38 | .header-right>.status {
39 | color: #999;
40 | font-size: 0.8em;
41 | }
42 |
43 | .social {
44 | display: flex;
45 | flex-wrap: wrap;
46 | align-items: center;
47 | }
48 |
49 | .social_label {
50 | color: #778087;
51 | background-color: #f9f9f9;
52 | padding: 4px 4px 4px 4px;
53 | font-size: 0.8em;
54 | margin: 5px;
55 | border-radius: 14px;
56 | line-height: 16px;
57 | }
58 |
59 | .social>.bio {
60 | font-size: 0.8em;
61 | }
62 |
63 | navigator {
64 | display: unset;
65 | }
66 |
67 | .item {
68 | box-shadow: 0px 2rpx 3rpx rgba(0, 0, 0, 0.1);
69 | margin-bottom: 5pt;
70 | text-align: left;
71 | margin: 0 6px 0 6px;
72 | padding: 5pt;
73 | display: flex;
74 | align-items: center;
75 | font-size: 16px;
76 | }
77 |
78 | .content {
79 | margin: 0 10px 0 10px;
80 | flex: 1 1 auto;
81 | }
82 |
83 | .avatar {
84 | width: 48px;
85 | height: 48px;
86 | flex-shrink: 0;
87 | }
88 |
89 | .title {
90 | display: block;
91 | color: #778087;
92 | }
93 |
94 | .nodename {
95 | padding: 4px;
96 | background-color: #f5f5f5;
97 | color: #999;
98 | font-size: 12px;
99 | }
100 |
101 | .username, .created {
102 | font-size: 12px;
103 | color: #778087;
104 | margin: 2px 6px 2px 6px;
105 | }
106 |
107 | .username {
108 | font-weight: bold;
109 | }
110 |
111 | .item>.reply {
112 | background-color: #ccc;
113 | color: #fff;
114 | border-radius: 12px;
115 | padding: 2px 10px 2px 10px;
116 | }
117 | .website::before {
118 | width: 16px;
119 | height: 16px;
120 | padding: 10px 5px 5px 4px;
121 | content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACwVBMVEUAAACKwUmKwUmJv0mKwUmKwUmKwkiKwUmKwUmKwUmKwUmJvkmKwUmKwUmKwUmKwUmKwUmJwEiKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmJwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUiKwUmKwUmJwEmKwUmKwUmKwEiKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmJwEeJwEeJwUiJwUiKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmJwUmKwUmKwUmJwUiJwUiKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmKwUmJwUiJwUiKwUmKwUmKwUmJwUiMwky52pO52pKMwkyJwEeJwEeKwUmKwUmJwUiOw1DG4abv9+bv9+bF4KWZyWChzW2RxVOKwUiKwUmJwEeSxVbQ5rbq9N7M5LDM5K/p89zv9+f3+/Ow1YSIwEaKwUmJwEeYyF7Z68Tm8tjR57j2+vD0+e7O5bLm8tj///+22I2HwEWJwUiezGnh79Hh79HW6b/5/Pb////3+/PP5rXf7s3j8NOezGiJwUiZyWDl8dfc7cnb7Mf8/fr6/PjT57rZ68Xl8deZyWCUx1mw1YS42pH9/vv7/fjh79Dh79D7/fj7/fm22I2w1YWUxlmKwUiGv0O12Iv////K46yOw1COw1DK463///6014qGv0OKwUiKwUmIwEa12Iz////8/fqp0XmIwEaIwEaq0nr8/fr///+014uIwEaKwUmIwEa12Iz////7/fmo0XeIwEaIwEao0Xj7/fn///+014uIwEaJwUidy2e/3Zu93JiYyF6JwUiJwUiYyF693Jm/3Zudy2eJwUiIwEaIwEaKwUiKwUmKwUiIwEaIwEaKwUmKwUmKwUlJZqRVAAAAWXRSTlMAAAAAAAAAAAAAAAAAAAAAAAdIp+P6+uKmSAcYke7ukRgYsP//rxgGkZAGSO3sSKal4uH6+fr64+Knpknt7UgGkpEGGLD//7AYGJLu7pEYB0in4/v646dIB4kHkIEAAAABYktHRJKWBO8gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gMaDSMDwCRoigAAARtJREFUGNMBEAHv/gAAAAEREhMUFRYXGBkaAgAAAAMEGxwdWVpbXF1eHh8gBQYAByEiI19gYWJjZGVmJCUmCAAnKGdoaWprbG1ub3BxcikqACssc3R1dnd4eXp7fH1+LS4AL3+AgYKDhIWGh4iJiot/MAAxjI2Oj5CRkpKTlJWWl5gyADOZmpucnZKSkpKen6ChojQANaOkpaaSp6ipqpKrrK2uNgA3r7CxspKztLW2kre4ubo4ADm7vL2+v8DBwsPExcbHyDoAOzzJysvMzc7P0NHS09Q9PgA/QNXW19jZ2tvc3d7f4EFCAAlDREXh4uPk5OXm50ZHSAoACwxJSkvou+np6shMTU4NDgAAAA9PUFFSU1RVVldYEAAAiPN0WXEavrQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMDMtMjZUMTM6MzU6MDMrMDg6MDBMkxTKAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTAzLTI2VDEzOjM1OjAzKzA4OjAwPc6sdgAAAE50RVh0c29mdHdhcmUASW1hZ2VNYWdpY2sgNi45LjEtMTAgUTE2IHg4Nl82NCAyMDE4LTAxLTI1IGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jn2DiO5wAAABh0RVh0VGh1bWI6OkRvY3VtZW50OjpQYWdlcwAxp/+7LwAAABh0RVh0VGh1bWI6OkltYWdlOjpIZWlnaHQAMTI4Q3xBgAAAABd0RVh0VGh1bWI6OkltYWdlOjpXaWR0aAAxMjjQjRHdAAAAGXRFWHRUaHVtYjo6TWltZXR5cGUAaW1hZ2UvcG5nP7JWTgAAABd0RVh0VGh1bWI6Ok1UaW1lADE1MjIwNDI1MDMuc6joAAAAE3RFWHRUaHVtYjo6U2l6ZQA2LjE5S0JC8a7YBQAAAEV0RVh0VGh1bWI6OlVSSQBmaWxlOi8vL3dvcmtzcGFjZS90bXAvbW9ncjJfOV8zNjEyZTU1YjU0YjU3NF8xMTkzMDRfM2JjWzBdzjAuygAAAABJRU5ErkJggg==');
122 | }
123 | .github::before {
124 | width: 16px;
125 | height: 16px;
126 | padding: 4px 4px 4px 4px;
127 | margin-top: 4px;
128 | content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAABQElEQVQ4EY2TMUsDQRBGjVapBMEqIAQEwdZKsPUH2IkgBKxS2dr6J2ythEBAsLUVBEEIBNLZKOkEEVKIouh7x47c6q34wcvtznyze7Oba82VtUJqOaUfeT6UrXlmj+kIPuE54diYuaLaZIYwg0NYg9AqA2Pm9Oj9pXMiV7ADFvyULW2DHr2ZfLUpLMIp+Moab2GcnsaOQc89ZO2MCByAOgPNTZhTeq2p1OH3FezLU3+HpuKIrSevNZ15frrgFb0YgAX4S0sk9VrTdYG67pi81QMNYwsz1VswsQ+lNk5Spe1WLaR5ddI9JhpcwEWPIPoeMN6CUI+Bt/Mtr8Sr8You4QJuIBa4ZhxqvEaTFnn37r4J/lligdjNnB69leqHuEvkCSawAR8Qsuc+mPPD0luUZ+COsXs8jZnL1Mpm+eRfn/MXAvJgvp4ENOkAAAAASUVORK5CYII=');
129 | }
130 | .btc::before {
131 | width: 16px;
132 | height: 16px;
133 | padding: 10px 5px 5px 4px;
134 | content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAADg0lEQVQ4EV1TW2wbVRA9e3fX6/U6Xr9j13bIw4GU0iaGNqQtrlSKWh6i4vEBQpQgAQLBHz88BCogFYki8cMHFAFq1SD6EVWloSqqS6Io0Ao1QYDtpDQhAZzUrl+x1++NvYvXFhVipHs1o5lz5tw7Ggr/sxPvDO0TePKs0+XezbKUr6Go0nomF07EU2dkhT3+ytFo7r8Q6t/gxHvDFoGtfb5918hjvh4/KEKgqu2sVpTLpvHj1PfZq0vJdy2bhj5+/s0zrWyL4Iu37hDdTmFq7wMPB1iWxfWlMMpVCpnVKKyeAQgcgbNnM1g9j9lL0/h24uKYpz84+tLh7xSi9bCKzCd7HzwYaNRlXJoYw2+XpyC4AkhKBKJ3BOs34pD+nkelkMWOPffinuD2p/9cmDmsYclXR3YMD969+0lWp0dk+jw2IEDsGobeYIC7dxCMjkWVmKAQCnJyGbWihOC+/c2mutePvHxbHxF46rmu3n4qE1sBp+NhcfjQu3UXrHY7DB0iyoU07rrvKSQrIjbqFUixReh5A4bu3KbLpWMvEofLtYemaZTSCXAcD64hIRdf0tTh2lwIsV8mUCzkYbQ4Ucjn0ajkUa+W0d3XB5pS9jM6jvUCKhhSR4dJaHo0ZI5rEWwZeQgWmwPGppK5mXPoZMqgFBob1QqMJjMoqH6iNhqN9rwUMCwFk2gAz7cJrkXnELkyifjqCoIHnkA6r6JWlUExDBRFgaKqLCkVCssagdFiBcug+U65eRotBaxagUlXg1zKgW6CVJYHRbPQGYzIpJJNtWSVia/GQpVyMcCZXciuJJFRRNwaGGoR7Lz/UPPDeDAMh/CVaVj0Mhw+P2iawdVIpKmAzBCid3+28OvPG5zoACOYUUotIjT+KeJrcfwQOov1jITJU0dBZ+Zgt3VC9PQimbiOSPh31WiyfUmPX/xrfWd/Te/xeoOOrn4IrAqqlofB2g0ptQyb0wePSYZgdsPuH4RKGIyPnUQiVTr7/ljmA1rT+sLo49PR2dBA5ybvls5bBmB2eiBLa7BZTEBdgsXrh8nbh1q9jtNfn0RkfmVetPsenZzNVm4u0zfHDpFcIvxad4/3jdu3DXZY7Q4QbaGawyoVC1hciGDqQgipbO2807t59NUPf0ppzW8SaIFmpz466EivRZ/R67lHCKVsLZWKQqWq3CiW5cusXjz+9rE/zrUr2/c/u31dH3GCM8IAAAAASUVORK5CYII=');
135 | }
136 | .twitter::before {
137 | width: 16px;
138 | height: 16px;
139 | padding: 10px 5px 5px 4px;
140 | content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdpJREFUeNqUU79v00AYfbYvNhcMCZXCwBKPFR1AYkFsCHUmCImx/wD8C4z8D1RdGBkzsTGwdQNVIMGAYhYU0go1UWPH95PvLonTAkL4pO90Pt973/vedxc8f/v+Vi9Nh902z9BgnBZlfnx2NmBdfmn4eKefXeesCR6TUmWvj74OWZrElNni+1w2ImAh0OE8Y1EQYFZpomg2AjdZA7aQEpU29Y9CaDw5+ODXb57dgfkHs8MSgYAwut5UxCqt5/eq7Dlt0pjfCAQRKAlxTgFvheDx0tCH+0f1/uU4wqu97QtqHZYJkiFJgV0lIjyiuPWH3CgOqRxDyZZqyTo4LKuUgqZC1YqB2xA2WSp48eAG+tc2ZNNKYp2fEYPDhm4yBHZluFBE1tviMEmMg08znFaWsgU+pNmccxiHZYImZ5RcGXmyMHi03cX+xylGhcHTdyd+P6XaXt7fwrhY+O8kCuCwoTPCiXfmuCiVxu0esLfTwdU0QZi06nA9WZ+ztYlaAb6ETSvHc42bnQi799ILRo5mBZW4csFj1NLEaVnS1YxQ0Ho9hDCY/vz79W4z5jGV9G1U+eEoz+5mffSvtP/vJc4LHObfyAOdM6PV4Mt4Mvz8Y9LoOQcWeWTt4JcAAwDEmRKkDQBEqwAAAABJRU5ErkJggg==');
141 | }
142 | .location::before {
143 | width: 16px;
144 | height: 16px;
145 | padding: 10px 5px 5px 4px;
146 | content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAhpJREFUeNqUU01oE0EU/jKZsGF1TWKCvweXBL1YqR4UilL0Uvy5BMFLD14EwbsInkQQREG8KIIgnjyIl4AgoqBQESnqoVhQxMS0QhGNNHWTbGZ3NnXeJLtmSy8ZeLtv3vczb4aZxK2Hj8YLuVwlu8myMcJo/nXqjeXlMt+cyVZOHT1iZ60NGMnAadtPX72p8Kxl2UnGsNLqRGDgOOi8fgY2/1bPe2OHYR47iaRlRRzSFHJZm6fTBrq+D6z2AanE4so5bCn9hLGvrWui+gG/Xj6GcfUBeGiSADjnYDIIIKWKoB+tu9dQ2C+xcaqIld/bdVBONcJCXqhhgfoMhz87g8zUISw9V119dHVQTjXC1vK5lFI59aK9eSIAzB1wvs+it9jSNcY6ukbYMJe0jFoJer3/rTETormK/IkJNBaFDsqpRljI0xql5cHAkdrRqx0/jYU7L1C8fAaT7270V2q5qF1/orGQRwdIWi4DSQeK0Cg9fRaNm0toTt9GfnJM1/7MzEOOT8BSWMhLcWWstJwcE4mEbikc5sVL8KpV1C6c1/PMvfswS6UYR2v0ISpHNpgMj6Rtwzh4IMrX4qQhre4gyeIdRDdyd38L62FaQx0IIeD5EkYqhU5XxEl7BwZB3MBUt5c0ruuCO+12/Vv9h72nuAtb87n4Mju3rfuQ2m4XX2sL6u/WuXIpv5/7VJn7/GWk5+x5fl14ovxPgAEA5kVEkDY5iHwAAAAASUVORK5CYII=');
147 | }
148 | .psn::before {
149 | width: 16px;
150 | height: 16px;
151 | padding: 10px 5px 5px 4px;
152 | content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+VJREFUeNo0U1tMW3Uc/v3P/1zbAz2ntLT0Mu52YNcNwgJjBjfZQtweDBI3zeblySd91CxxLlmMiZcXL4tGH9QtYTKmTEfisgUxiwxwqevYOigxo1DWFkp7WtpD6eVcLCZ+ye/39Lt8X7586MjAm8DQBDgdVhAEKywtp+hIJN6McNUCz3lgM7sCHG8677AbHZyxcENK4bG0tAbra1EA0ICodNB1HTDGgFCxQ9XZayzf8hnL1HnysvQiSYnv2J8aOFfSRGcpn9xbY0EXdB2DoqiVeQTE/8sA5VfmAg8G7S3dHY3tvYcXgrN/zswM/9zQ5vzk2JAP5gIPq6cnoyFZiqu76tkLdIV2qagAUTkCFM0OBIOrvuA898vzx/uKR446qcR6mGHpWnj7rcOwpxXAWF0+aG7svBxNeaOaKvTu3t30LSYBSEEw8ZpOHkgmhYuxGL5qhHDDc0fd0Ok9E+4/tM/S67M5d2ReHP9UvzEBaGYy+PHy43tgs0KHw2m9TppF4fhSeOM+pm3tJ17zevv2u4GkGH3ohYPNnT4DOxd8GH+yuk1PzsRrfh2bArUCs+DISkn5a4zVBEliqAUgunw9NZ533z9WTGTizB+/+8HrraFsTSY9urC9EvA7n751dQNEezU0dRzSEmuKWJAWukvbG19gl6utm2KIM0Aorts3/cqVS5tkMd6IXj/Rtd7oc8Rbm1zRbNTUWlVPaM+81EdksjxOx+JbtJ71kNS2C9vqmmoLea2US9ZZ/p4Om3lOSAy9sd84H1LlZIgT/roD7oXoouztp/Vowsj4b91EZsRjjo19VyjFECFYHPO0YdcHmo5GZXkZVMavn3y5ThNbNx3nPx81f/X9sEk3hQXE1VffnfiNCNweVTa3IlhFuWuiyKeIUj6Vd7n5HwwCpVI0WrY6q23j0xH46ccRbcb/YeTx2jdLslLW/bOL+O7kMGi6TMp56RxnxFRVlUnABtYiK8UUamxpP8vx9jzNZPjZqTvS9SujZU3Pr9IM0Wx1taGlhTkydH8KOdz77jldwqk2r/ujxVBoBLvdeyCfLwQ0NZUSRPZUVtqM/fMokslmkk6aRi5d1yiKo6hcRkK8oX7Caq897Wm3nZU24lJo/tGXqKdnsOI7teMv0LQ2wjL8SYbfC5mMBon44ppSLoYMvM5wHBzguJpJk2gOs4y6/mRl6b18QQHc4ukCAhOVIoFmmLSiFB+o5cRlk2CwipYGwWCgxyoSX6VJLcCxek5X5LFcLn0JEAWlsgLo2f7TlTjCfyAIrZIyDbZyGcCoUCVadg0qGkqnU6lxA2cCI0cD2slv5VmxoEE2twX/CjAAHH66h547rRYAAAAASUVORK5CYII=');
153 | }
154 |
--------------------------------------------------------------------------------
/wxParse/html2json.js:
--------------------------------------------------------------------------------
1 | /**
2 | * html2Json 改造来自: https://github.com/Jxck/html2json
3 | *
4 | *
5 | * author: Di (微信小程序开发工程师)
6 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7 | * 垂直微信小程序开发交流社区
8 | *
9 | * github地址: https://github.com/icindy/wxParse
10 | *
11 | * for: 微信小程序富文本解析
12 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13 | */
14 |
15 | var __placeImgeUrlHttps = "https";
16 | var __emojisReg = '';
17 | var __emojisBaseSrc = '';
18 | var __emojis = {};
19 | var wxDiscode = require('./wxDiscode.js');
20 | var HTMLParser = require('./htmlparser.js');
21 | // Empty Elements - HTML 5
22 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
23 | // Block Elements - HTML 5
24 | var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
25 |
26 | // Inline Elements - HTML 5
27 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
28 |
29 | // Elements that you can, intentionally, leave open
30 | // (and which close themselves)
31 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
32 |
33 | // Attributes that have their values filled in disabled="disabled"
34 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
35 |
36 | // Special Elements (can contain anything)
37 | var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
38 | function makeMap(str) {
39 | var obj = {}, items = str.split(",");
40 | for (var i = 0; i < items.length; i++)
41 | obj[items[i]] = true;
42 | return obj;
43 | }
44 |
45 | function q(v) {
46 | return '"' + v + '"';
47 | }
48 |
49 | function removeDOCTYPE(html) {
50 | return html
51 | .replace(/<\?xml.*\?>\n/, '')
52 | .replace(/<.*!doctype.*\>\n/, '')
53 | .replace(/<.*!DOCTYPE.*\>\n/, '');
54 | }
55 |
56 | function trimHtml(html) {
57 | return html
58 | .replace(/\r?\n+/g, '')
59 | .replace(//ig, '')
60 | .replace(/\/\*.*?\*\//ig, '')
61 | .replace(/[ ]+
189 | // add to parents
190 | var parent = bufArray[0] || results;
191 | if (parent.nodes === undefined) {
192 | parent.nodes = [];
193 | }
194 | parent.nodes.push(node);
195 | } else {
196 | bufArray.unshift(node);
197 | }
198 | },
199 | end: function (tag) {
200 | //debug(tag);
201 | // merge into parent tag
202 | var node = bufArray.shift();
203 | if (node.tag !== tag) console.error('invalid state: mismatch end tag');
204 |
205 | //当有缓存source资源时于于video补上src资源
206 | if(node.tag === 'video' && results.source){
207 | node.attr.src = results.source;
208 | delete results.source;
209 | }
210 |
211 | if (bufArray.length === 0) {
212 | results.nodes.push(node);
213 | } else {
214 | var parent = bufArray[0];
215 | if (parent.nodes === undefined) {
216 | parent.nodes = [];
217 | }
218 | parent.nodes.push(node);
219 | }
220 | },
221 | chars: function (text) {
222 | //debug(text);
223 | var node = {
224 | node: 'text',
225 | text: text,
226 | textArray:transEmojiStr(text)
227 | };
228 |
229 | if (bufArray.length === 0) {
230 | node.index = index.toString()
231 | index += 1
232 | results.nodes.push(node);
233 | } else {
234 | var parent = bufArray[0];
235 | if (parent.nodes === undefined) {
236 | parent.nodes = [];
237 | }
238 | node.index = parent.index + '.' + parent.nodes.length
239 | parent.nodes.push(node);
240 | }
241 | },
242 | comment: function (text) {
243 | //debug(text);
244 | // var node = {
245 | // node: 'comment',
246 | // text: text,
247 | // };
248 | // var parent = bufArray[0];
249 | // if (parent.nodes === undefined) {
250 | // parent.nodes = [];
251 | // }
252 | // parent.nodes.push(node);
253 | },
254 | });
255 | return results;
256 | };
257 |
258 | function transEmojiStr(str){
259 | // var eReg = new RegExp("["+__reg+' '+"]");
260 | // str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
261 |
262 | var emojiObjs = [];
263 | //如果正则表达式为空
264 | if(__emojisReg.length == 0 || !__emojis){
265 | var emojiObj = {}
266 | emojiObj.node = "text";
267 | emojiObj.text = str;
268 | array = [emojiObj];
269 | return array;
270 | }
271 | //这个地方需要调整
272 | str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
273 | var eReg = new RegExp("[:]");
274 | var array = str.split(eReg);
275 | for(var i = 0; i < array.length; i++){
276 | var ele = array[i];
277 | var emojiObj = {};
278 | if(__emojis[ele]){
279 | emojiObj.node = "element";
280 | emojiObj.tag = "emoji";
281 | emojiObj.text = __emojis[ele];
282 | emojiObj.baseSrc= __emojisBaseSrc;
283 | }else{
284 | emojiObj.node = "text";
285 | emojiObj.text = ele;
286 | }
287 | emojiObjs.push(emojiObj);
288 | }
289 |
290 | return emojiObjs;
291 | }
292 |
293 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
294 | __emojisReg = reg;
295 | __emojisBaseSrc=baseSrc;
296 | __emojis=emojis;
297 | }
298 |
299 | module.exports = {
300 | html2json: html2json,
301 | emojisInit:emojisInit
302 | };
303 |
304 |
--------------------------------------------------------------------------------
/wxParse/wxParse.wxml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | {{item.text}}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | \n
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
--------------------------------------------------------------------------------