├── .gitattributes ├── .gitignore ├── README.md ├── requirements .txt ├── version.txt ├── 专业版 ├── HTTP接口 │ ├── 001-必读!HTTP的使用方法.txt │ ├── WeChatApi.dll │ ├── inject_tool.exe │ └── 注入工具(图形界面版).exe └── Python接口 │ ├── WeChatPYAPI.cp36-win_amd64.pyd │ ├── WeChatPYAPI.cp37-win_amd64.pyd │ ├── WeChatPYAPI.cp38-win_amd64.pyd │ ├── WeChatPYAPI.cp39-win_amd64.pyd │ ├── demo.py │ └── libs │ ├── WeChatApi.dll │ └── inject_tool.exe ├── 常见问题及解决方案.html ├── 接口使用文档 ├── gitbook │ ├── fonts │ │ └── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ ├── gitbook-plugin-expandable-chapters │ │ ├── expandable-chapters.css │ │ └── expandable-chapters.js │ ├── gitbook-plugin-fontsettings │ │ ├── fontsettings.js │ │ └── website.css │ ├── gitbook-plugin-highlight │ │ ├── ebook.css │ │ └── website.css │ ├── gitbook-plugin-lunr │ │ ├── lunr.min.js │ │ └── search-lunr.js │ ├── gitbook-plugin-search │ │ ├── lunr.min.js │ │ ├── search-engine.js │ │ ├── search.css │ │ └── search.js │ ├── gitbook-plugin-sharing │ │ └── buttons.js │ ├── gitbook.js │ ├── images │ │ ├── apple-touch-icon-precomposed-152.png │ │ └── favicon.ico │ ├── style.css │ └── theme.js ├── images │ ├── 其它问题2.png │ ├── 常见问题1.png │ ├── 常见问题2.png │ ├── 常见问题3.png │ ├── 常见问题4.png │ ├── 常见问题5.png │ ├── 常见问题6-1.png │ ├── 常见问题6-2.png │ ├── 常见问题6.png │ └── 常见问题7.png ├── index.html ├── search_index.json ├── 常见问题及解决方案.html └── 教程 │ ├── 001-实例化API.html │ ├── 002-启动微信.html │ ├── 003-获取个人信息.html │ ├── 004-获取微信登录状态.html │ ├── 005-退出登录.html │ ├── 006-拉取列表.html │ ├── 007-获取群成员列表.html │ ├── 008-发送文本消息.html │ ├── 009-发送图片消息.html │ ├── 010-发送文件视频消息.html │ ├── 011-发送好友名片.html │ ├── 012-发送卡片链接.html │ ├── 013-发送GIF表情消息.html │ ├── 014-群聊发送消息并且@指定群成员.html │ ├── 015-群聊发送文本信息并且@所有人.html │ ├── 016-发送公众号卡片.html │ ├── 017-添加好友.html │ ├── 018-删除好友.html │ ├── 019-同意添加好友请求.html │ ├── 020-修改好友备注.html │ ├── 021-本地查询好友信息.html │ ├── 022-网络查询好友信息.html │ ├── 023-网络查询陌生人信息.html │ ├── 024-创建群聊.html │ ├── 025-修改群名称.html │ ├── 026-发送群公告.html │ ├── 027-邀请好友进群.html │ ├── 028-踢出群成员.html │ ├── 029-群聊保存取消保存到通讯录.html │ ├── 030-批量查询群成员的群昵称.html │ ├── 031-修改我在群里的昵称.html │ ├── 032-退出群聊.html │ ├── 033-开启关闭消息免打扰.html │ ├── 034-置顶取消置顶聊天.html │ ├── 035-关注公众号.html │ ├── 036-取消关注公众号.html │ ├── 037-获取朋友圈数据.html │ ├── 038-朋友圈点赞取消点赞.html │ ├── 039-朋友圈评论.html │ ├── 040-朋友圈删除评论.html │ ├── 041-获取小程序code.html │ ├── 042-获取所有数据库名称.html │ ├── 043-查询数据库.html │ ├── 044-收款.html │ ├── 045-退款.html │ ├── 046-保存图片.html │ ├── 047-开启关闭保存语音.html │ ├── 048-拉取标签列表.html │ ├── 049-发送XML消息.html │ ├── 050-转发任意消息.html │ ├── 051-OCR文字识别.html │ ├── 052-获取外部浏览器可访问的URL.html │ ├── 053-获取当前微信进程的PID.html │ ├── 054-自动下载图片视频文件.html │ ├── 055-获取当前聊天窗口信息.html │ ├── 056-同意好友邀请进群.html │ ├── 057-群二维码进群.html │ ├── 058-发送位置消息.html │ ├── 059-发送语音消息.html │ ├── 060-获取公众号文章.html │ ├── 061-显示微信窗口.html │ ├── 062-隐藏微信窗口.html │ ├── 063-获取指定好友的朋友圈.html │ ├── 064-朋友圈上传图片.html │ ├── 065-发送转发朋友圈.html │ ├── 066-发图文朋友圈.html │ ├── 067-发卡片链接朋友圈.html │ ├── 068-修改好友描述信息.html │ ├── 069-下载朋友圈图片.html │ ├── 070-下载朋友圈视频.html │ ├── 071-禁止微信自动更新.html │ ├── 072-搜一搜.html │ ├── 073-CDN下载图片.html │ ├── 074-CDN下载视频.html │ ├── 075-CDN下载文件.html │ ├── 接收消息.html │ └── 社区版跟专业版区别.html └── 社区版 ├── HTTP接口 ├── 001-必读!HTTP的使用方法.txt ├── WeChatApi.dll ├── inject_tool.exe └── 注入工具(图形界面版).exe └── Python接口 ├── WeChatPYAPI.cp36-win_amd64.pyd ├── WeChatPYAPI.cp37-win_amd64.pyd ├── WeChatPYAPI.cp38-win_amd64.pyd ├── WeChatPYAPI.cp39-win_amd64.pyd ├── demo.py └── libs ├── WeChatApi.dll └── inject_tool.exe /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=python 2 | *.css linguist-language=python 3 | *.html linguist-language=python 4 | *.pyd linguist-language=python -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .git/ 3 | *.py[cop] 4 | logs/log* 5 | WeChatSetup* 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WeChatPYAPI介绍 2 | 3 | 4 | 5 | 《WeChatPYAPI》是基于PC端的Python接口,开发者可通过Python轻松调用,也可通过HTTP调用。可进行二次开发,实现微信机器人、群管理等强大的功能! 6 | 7 | 8 | 9 | ### 社区版跟专业版的区别? 10 | 11 | - 社区版: 12 | - 麻雀虽小五脏俱全! 13 | - 不支持长时间运行 14 | - 不再维护更新 15 | - 微信版本:3.6.0.18 16 | - 专业版: 17 | - 功能更加强大、稳定! 18 | - 支持长时间运行 19 | - 持续更新迭代 20 | - 微信版本:3.9.10.19 21 | 22 | > 功能区别请打开《接口使用文档》进行查看 23 | 24 | 25 | 26 | > 如果对你有帮助,别吝啬你的小手留个star呗 27 | 28 | 29 | 30 | ## 使用教程 31 | 32 | 1. 克隆该项目(请关闭你的杀毒软件,否则可能会误删dll文件) 33 | 2. 选择对应python解释器环境(必须是64位的) 34 | 4. 执行文件夹中的demo.py 35 | 4. 使用前请先安装指定版本的微信 36 | 37 | > 指定版本微信安装包:https://pan.baidu.com/s/1dxBuvDgAeI0mFjGsY6NVNA 38 | > 39 | > 提取码:sszs 40 | 41 | 42 | 43 | ## 疑问解答、联系方式 44 | 45 | - 交流QQ群:54995858 46 | - tg讨论组:https://t.me/+yb0O_hNMqIVlODI1 47 | - 进群解决一切蛇皮问题! 48 | 49 | 50 | 51 | ## 学习 & 参考 52 | 53 | https://github.com/mrsanshui/WeChatApi.git 54 | 55 | 56 | 57 | ## help(WeChatPYApi) 58 | 59 | ```python 60 | class WeChatPYApi(builtins.object) 61 | | 基于PC微信的Python-API 62 | | 63 | | Methods defined here: 64 | | 65 | | __init__(self, msg_callback, **kwargs) 66 | | 初始化方法 67 | | :param msg_callback: 消息回调函数 68 | | :param exit_callback: 退出微信后的回调函数 69 | | :param logger: 日志器句柄 70 | | :param kwargs: 略 71 | | 72 | | add_friend(self, wx_id_or_v3, msg, method=30) 73 | | 添加好友 74 | | :param wx_id_or_v3: 要添加的微信ID或者v3数据 75 | | :param msg: 添加时的打招呼消息 76 | | :param method: 添加方式【默认30】 77 | | :return: 无 78 | | 79 | | agree_friend(self, msg_data) 80 | | 同意添加好友请求 81 | | :param msg_data: 好友请求时的消息数据 82 | | :return: 无 83 | | 84 | | agree_friend_invite_join_chat_room(self, msg_data) 85 | | 同意好友邀请进群 86 | | :param msg_data: 消息数据 87 | | :return: 群ID 88 | | 89 | | alter_chat_room_name(self, to_chat_room, name) 90 | | 修改群名称 91 | | :param to_chat_room: 群ID 92 | | :param name: 群名称 93 | | :return: 无 94 | | 95 | | alter_friend_desc(self, to_wx, desc) 96 | | 修改好友描述信息 97 | | :param to_wx: 好友微信ID 98 | | :param desc: 描述信息 99 | | :return: 无 100 | | 101 | | alter_friend_remark(self, to_wx, remark) 102 | | 修改好友备注 103 | | :param to_wx: 好友微信ID 104 | | :param remark: 备注内容 105 | | :return: 无 106 | | 107 | | alter_my_name_in_chat_room(self, to_chat_room, name) 108 | | 修改我在群里的昵称 109 | | :param to_chat_room: 群ID 110 | | :param name: 昵称 111 | | :return: 无 112 | | 113 | | batch_query_member_nick_name(self, to_chat_room, wx_id_list) 114 | | 批量查询群成员的群昵称 115 | | :param to_chat_room: 群ID 116 | | :param wx_id_list: 群成员的微信ID列表 117 | | :return: List数据 118 | | 119 | | cdn_download_file(self, file_size, file_id, aes_key, save_path) 120 | | CDN下载文件 121 | | :param file_size: 文件大小【消息回调中获取】 122 | | :param file_id: 文件ID【消息回调中获取】 123 | | :param aes_key: aes_key【消息回调中获取】 124 | | :param save_path: 保存路径 125 | | :return: 无 126 | | 127 | | cdn_download_img(self, img_type, file_id, aes_key, save_path) 128 | | CDN下载图片 129 | | :param img_type: 图片类型【1=缩略图 2=高清图 3=原图】 130 | | :param file_id: 文件ID【消息回调中获取】 131 | | :param aes_key: aes_key【消息回调中获取】 132 | | :param save_path: 保存路径 133 | | :return: 无 134 | | 135 | | cdn_download_video(self, file_id, aes_key, save_path) 136 | | CDN下载视频 137 | | :param file_id: 文件ID【消息回调中获取】 138 | | :param aes_key: aes_key【消息回调中获取】 139 | | :param save_path: 保存路径 140 | | :return: 无 141 | | 142 | | collection(self, msg_data) 143 | | 收款 144 | | :param msg_data: 消息数据 145 | | :return: 无 146 | | 147 | | comment_moments(self, moments_id, content) 148 | | 朋友圈评论 149 | | :param moments_id: 朋友圈ID 150 | | :param content: 评论内容 151 | | :return: 无 152 | | 153 | | create_chat_room(self, wx_id_list) 154 | | 创建群聊 155 | | :param wx_id_list: 邀请进群的微信ID列表 156 | | :return: 群ID 157 | | 158 | | del_comment_moments(self, moments_id, comment_id) 159 | | 朋友圈删除评论 160 | | :param moments_id: 朋友圈ID 161 | | :param comment_id: 评论ID 162 | | :return: 无 163 | | 164 | | delete_chat_room_member(self, to_chat_room, to_wx_list) 165 | | 踢出群成员 166 | | :param to_chat_room: 群ID 167 | | :param to_wx_list: 群成员微信ID列表 168 | | :return: 无 169 | | 170 | | delete_friend(self, to_wx) 171 | | 删除好友 172 | | :param to_wx: 要删除的微信ID 173 | | :return: 无 174 | | 175 | | exit_chat_room(self, to_chat_room) 176 | | 退出群聊 177 | | :param to_chat_room: 群ID 178 | | :return: 无 179 | | 180 | | follow_mp(self, mp_id) 181 | | 关注公众号 182 | | :param mp_id: 公众号ID 183 | | :return: 无 184 | | 185 | | forward_msg(self, to_wx, msg_id) 186 | | 转发任意消息 187 | | :param to_wx: 接收者的微信ID/群ID 188 | | :param msg_id: 消息ID 189 | | :return: 无 190 | | 191 | | get_access_url(self, url) 192 | | 获取外部浏览器可访问的URL 193 | | :param url: 只能在微信中打开的URL(如公众号链接) 194 | | :return: 可访问的URL 195 | | 196 | | get_chat_room_members(self, to_chat_room) 197 | | 获取群成员列表 198 | | :param to_chat_room: 群ID 199 | | :return: list数据 200 | | 201 | | get_cur_window_info(self) 202 | | 获取当前聊天窗口信息 203 | | :return: dict数据 204 | | 205 | | get_cur_wx_pid(self) 206 | | 获取当前微信进程的PID 207 | | :return: 进程PID 208 | | 209 | | get_db_name_list(self) 210 | | 获取所有数据库名称 211 | | :return: List数据 212 | | 213 | | get_login_state(self) 214 | | 获取微信登录状态 215 | | :return: True:已登录 False:未登录 216 | | 217 | | get_moments(self, last_id=None) 218 | | 获取朋友圈数据 219 | | :param last_id: 最后一条朋友圈的ID【翻页必传】 220 | | :return: List数据 221 | | 222 | | get_moments_by_friend(self, wx_id, last_id=None) 223 | | 获取指定好友的朋友圈 224 | | :param wx_id: 好友的微信ID 225 | | :param last_id: 最后一条朋友圈的ID【翻页必传】 226 | | :return: List数据 227 | | 228 | | get_mp_doc(self, gh_id, next_offset=None) 229 | | 获取公众号文章 230 | | :param gh_id: 公众号ID 231 | | :param next_offset: 下一页的偏移【翻页必传】 232 | | :return: Dict数据 233 | | 234 | | get_self_info(self) 235 | | 获取个人信息 236 | | :return: 未登录时返回None,登录成功返回字典数据 237 | | 238 | | get_small_app_code(self, app_id) 239 | | 获取小程序code 240 | | :param app_id: 小程序的AppId 241 | | :return: 小程序code 242 | | 243 | | hide_wx_windows(self) 244 | | 隐藏微信窗口 245 | | :return: 无 246 | | 247 | | invite_friend_enter_chat_room(self, to_chat_room, to_wx_list) 248 | | 邀请好友进群 249 | | :param to_chat_room: 群ID 250 | | :param to_wx_list: 好友微信ID列表 251 | | :return: 无 252 | | 253 | | like_moments(self, moments_id, state) 254 | | 朋友圈点赞/取消点赞 255 | | :param moments_id: 朋友圈ID 256 | | :param state: True:点赞 False:取消点赞 257 | | :return: 无 258 | | 259 | | logout(self) 260 | | 退出登录 261 | | :return: 无 262 | | 263 | | mask_msg_switch(self, to_id, switch) 264 | | 开启/关闭消息免打扰 265 | | :param to_id: 好友ID/群ID 266 | | :param switch: True:开启免打扰 False:关闭免打扰 267 | | :return: 无 268 | | 269 | | moments_upload_img(self, path) 270 | | 朋友圈上传图片 271 | | :param path: 图片的绝对路径 272 | | :return: Dict数据 273 | | 274 | | ocr_recognition(self, path, is_split=False) 275 | | OCR文字识别 276 | | :param path: 图片的绝对路径 277 | | :param is_split: 是否分段返回 278 | | :return: 识别结果(分段模式返回list) 279 | | 280 | | pull_label_list(self) 281 | | 拉取标签列表 282 | | :return: list数据 283 | | 284 | | pull_list(self, pull_type) 285 | | 拉取列表(好友/群/公众号/其他) 286 | | :param pull_type: 好友:1 群:2 公众号:3 其他:4 287 | | :return: list数据 288 | | 289 | | qr_code_join_chat_room(self, url) 290 | | 群二维码进群 291 | | :param url: 群二维码解析的URL 292 | | :return: 群ID 293 | | 294 | | query_friend_info(self, to_wx) 295 | | 查询好友信息 296 | | :param to_wx: 要查询的微信ID 297 | | :return: dict数据 298 | | 299 | | query_friend_info_by_net(self, to_wx) 300 | | 网络查询好友信息 301 | | :param to_wx: 要查询的微信ID 302 | | :return: dict数据 303 | | 304 | | query_wx_info_by_net(self, key) 305 | | 网络查询陌生人信息 306 | | :param key: 手机号/QQ号/微信号 307 | | :return: dict数据 308 | | 309 | | refund(self, msg_data) 310 | | 退款 311 | | :param msg_data: 消息数据 312 | | :return: 无 313 | | 314 | | save_img(self, save_path, msg_data) 315 | | 保存图片 316 | | :param save_path: 保存图片的绝对路径 317 | | :param msg_data: 消息数据 318 | | :return: 无 319 | | 320 | | save_to_addr_book(self, to_chat_room, switch) 321 | | 群聊保存/取消保存到通讯录 322 | | :param to_chat_room: 群ID 323 | | :param switch: True:保存 False:取消保存 324 | | :return: 无 325 | | 326 | | save_voice_switch(self, save_dir_path, switch) 327 | | 开启/关闭保存语音 328 | | :param save_dir_path: 保存语音的绝对路径【目录路径】 329 | | :param switch: True:开启 False:关闭 330 | | :return: 无 331 | | 332 | | select_db(self, db_name, sql_text) 333 | | 查询数据库,注意,返字段取决于你的查询语句,查询结果较多可能会导致崩溃,建议运用好sql语句中的limit 334 | | :param db_name: 数据库名称 335 | | :param sql_text: sql语句 336 | | :return: 查询结果【List数据】 337 | | 338 | | send_card_link(self, to_wx, title, desc, target_url, img_url) 339 | | 发送卡片链接 340 | | :param to_wx: 接收者的微信ID/群ID 341 | | :param title: 卡片标题 342 | | :param desc: 卡片描述 343 | | :param target_url: 目标地址 344 | | :param img_url: 卡片封面地址 345 | | :return: 无 346 | | 347 | | send_card_link_moments(self, text, title, desc, target_url, thumb_url, is_private=False) 348 | | 发卡片链接朋友圈 349 | | :param text: 文本内容 350 | | :param title: 卡片标题 351 | | :param desc: 卡片描述 352 | | :param target_url: 目标地址 353 | | :param thumb_url: 封面地址【上传接口返回的thumb_url】 354 | | :param is_private: False:所有人可见 True:仅自己可见【默认为False】 355 | | :return: 朋友圈ID 356 | | 357 | | send_file(self, to_wx, path) 358 | | 发送文件/视频消息 359 | | :param to_wx: 接收者的微信ID/群ID 360 | | :param path: 文件/视频的绝对路径 361 | | :return: 无 362 | | 363 | | send_friend_card(self, to_wx, friend_wx, friend_name) 364 | | 发送好友名片 365 | | :param to_wx: 接收者的微信ID/群ID 366 | | :param friend_wx: 好友微信ID 367 | | :param friend_name: 好友昵称 368 | | :return: 无 369 | | 370 | | send_gif(self, to_wx, path) 371 | | 发送GIF表情 372 | | :param to_wx: 接收者的微信ID/群ID 373 | | :param path: gif图片的绝对路径 374 | | :return: 无 375 | | 376 | | send_img(self, to_wx, path) 377 | | 发送图片消息 378 | | :param to_wx: 接收者的微信ID/群ID 379 | | :param path: 图片的绝对路径 380 | | :return: 无 381 | | 382 | | send_img_text_moments(self, text, img_url_list=None, is_private=False) 383 | | 发图文朋友圈 384 | | :param text: 文本内容 385 | | :param img_url_list: 上传接口返回的图片url列表【不传则是发纯文本】 386 | | :param is_private: False:所有人可见 True:仅自己可见【默认为False】 387 | | :return: 朋友圈ID 388 | | 389 | | send_location(self, to_wx, lon, lat, address, detail_address) 390 | | 发送位置消息 391 | | :param to_wx: 接收者的微信ID/群ID 392 | | :param lon: 经度 393 | | :param lat: 纬度 394 | | :param address: 地址 395 | | :param detail_address: 详细地址 396 | | :return: 无 397 | | 398 | | send_mp_card(self, to_wx, mp_id, mp_name) 399 | | 发送公众号名片 400 | | :param to_wx: 接收者的微信ID/群ID 401 | | :param mp_id: 公众号ID 402 | | :param mp_name: 公众号名称 403 | | :return: 无 404 | | 405 | | send_notice(self, to_chat_room, content) 406 | | 发送群公告 407 | | :param to_chat_room: 群ID 408 | | :param content: 公告内容 409 | | :return: 无 410 | | 411 | | send_or_forward_moments(self, xml_content, is_private=False) 412 | | 发送/转发朋友圈 413 | | :param xml_content: xml内容 414 | | :param is_private: False:所有人可见 True:仅自己可见【默认为False】 415 | | :return: 朋友圈ID 416 | | 417 | | send_text(self, to_wx, msg) 418 | | 发送文本消息 419 | | :param to_wx: 接收者的微信ID/群ID 420 | | :param msg: 消息内容 421 | | :return: 无 422 | | 423 | | send_text_and_at_all(self, to_chat_room, msg) 424 | | 群聊发送文本信息并且@所有人 425 | | :param to_chat_room: 群ID 426 | | :param msg: 文本消息 427 | | :return: 无 428 | | 429 | | send_text_and_at_member(self, to_chat_room, to_wx_list, msg, is_custom=False) 430 | | 群聊发送文本信息并且@指定群成员 431 | | :param to_chat_room: 群ID 432 | | :param to_wx_list: @人的微信ID列表 433 | | :param msg: 文本消息 434 | | :param is_custom: False:默认@位置 True:自行指定@位置【默认为False】 435 | | :return: 无 436 | | 437 | | send_voice(self, to_wx, path, voice_time) 438 | | 发送语音消息 439 | | :param to_wx: 接收者的微信ID/群ID 440 | | :param path: silk文件的绝对路径 441 | | :param voice_time: 语音时长,单位:毫秒 442 | | :return: True:成功 False:失败 443 | | 444 | | send_xml(self, to_wx, xml_str) 445 | | 发送XML消息 446 | | :param to_wx: 接收者的微信ID/群ID 447 | | :param xml_str: XML字符串 448 | | :return: 无 449 | | 450 | | show_wx_windows(self) 451 | | 显示微信窗口 452 | | :return: 无 453 | | 454 | | sns_download_img(self, url, md5, key, enc_idx, token, save_path) 455 | | 下载朋友圈图片 456 | | :param url: 图片地址 457 | | :param key: key 458 | | :param md5: md5 459 | | :param enc_idx: enc_idx 460 | | :param token: token 461 | | :param save_path: 保存路径 462 | | :return: True:成功 False:失败 463 | | 464 | | sns_download_video(self, url, md5, key, save_path) 465 | | 下载朋友圈视频 466 | | :param url: 视频地址 467 | | :param key: key 468 | | :param md5: md5 469 | | :param save_path: 保存路径 470 | | :return: True:成功 False:失败 471 | | 472 | | start_wx(self, path=None) 473 | | 启动微信,目前支持微信版本:V-3.9.10.19 474 | | :param path: 保存登录二维码的绝对路径 475 | | :return: (errno:状态码,errmsg:说明) 476 | | 477 | | top_chat_switch(self, to_id, switch) 478 | | 置顶/取消置顶聊天 479 | | :param to_id: 好友ID/群ID 480 | | :param switch: True:置顶 False:取消置顶 481 | | :return: 无 482 | | 483 | | un_follow_mp(self, mp_id) 484 | | 取消关注公众号 485 | | :param mp_id: 公众号ID 486 | | :return: 无 487 | | 488 | | wx_search(self, keyword, next_offset=0, search_type=0, filter_sort=0, filter_type=0, filter_time=0, filter_scope=0) 489 | | 搜一搜 490 | | :param keyword: 关键词 491 | | :param next_offset: 下一页的偏移【翻页必传】 492 | | :param search_type: 搜索类型 493 | | :param filter_sort: 过滤-排序 494 | | :param filter_type: 过滤-类型 495 | | :param filter_time: 过滤-时间 496 | | :param filter_scope: 过滤-范围 497 | | :return: Dict数据 498 | | 499 | | ---------------------------------------------------------------------- 500 | ``` 501 | 502 | 503 | 504 | ## 声明 505 | 506 | **本项目仅供技术研究,请勿用于非法用途,如有任何人凭此做何非法事情,均于作者无关,特此声明。** 507 | 508 | -------------------------------------------------------------------------------- /requirements .txt: -------------------------------------------------------------------------------- 1 | requests 2 | pycryptodomex 3 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | WeChatPYAPI V-7.3.2 2 | 1、更新接口使用文档 3 | 2、修复若干细节问题 -------------------------------------------------------------------------------- /专业版/HTTP接口/001-必读!HTTP的使用方法.txt: -------------------------------------------------------------------------------- 1 | 1、用HTTP的方式调用的话,就不用下载任何依赖包,直接使用就是了 2 | 3 | 2、《WeChatPYAPI》就是基于这个HTTP接口封装的 4 | (1)你要想开箱即用的话,建议使用《WeChatPYAPI》 5 | (2)如果你的主语言不是Python,那么建议你使用HTTP接口 6 | 7 | 3、HTTP接口文档:https://www.showdoc.com.cn/2228290215170955 8 | 9 | 4、不一定要用图形界面工具注入(只是为了方便测试),具体查看文档“更灵活的使用方法” 10 | 11 | 5、交流QQ群:54995858 -------------------------------------------------------------------------------- /专业版/HTTP接口/WeChatApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/HTTP接口/WeChatApi.dll -------------------------------------------------------------------------------- /专业版/HTTP接口/inject_tool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/HTTP接口/inject_tool.exe -------------------------------------------------------------------------------- /专业版/HTTP接口/注入工具(图形界面版).exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/HTTP接口/注入工具(图形界面版).exe -------------------------------------------------------------------------------- /专业版/Python接口/WeChatPYAPI.cp36-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/Python接口/WeChatPYAPI.cp36-win_amd64.pyd -------------------------------------------------------------------------------- /专业版/Python接口/WeChatPYAPI.cp37-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/Python接口/WeChatPYAPI.cp37-win_amd64.pyd -------------------------------------------------------------------------------- /专业版/Python接口/WeChatPYAPI.cp38-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/Python接口/WeChatPYAPI.cp38-win_amd64.pyd -------------------------------------------------------------------------------- /专业版/Python接口/WeChatPYAPI.cp39-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/Python接口/WeChatPYAPI.cp39-win_amd64.pyd -------------------------------------------------------------------------------- /专业版/Python接口/demo.py: -------------------------------------------------------------------------------- 1 | # 如果你是Python36。请删除37、38、39的pyd文件,其他版本同理 2 | # 小提示:因为Pycharm无法识别pyd文件,这句话可能会报红,无视或配置一下就行了,不影响使用 3 | from WeChatPYAPI import WeChatPYApi 4 | 5 | import time 6 | import logging 7 | from queue import Queue 8 | import os 9 | from datetime import datetime 10 | from multiprocessing.dummy import Pool 11 | 12 | # 当前目录路径 13 | BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 14 | 15 | logging.basicConfig(level=logging.INFO) # 日志器 16 | msg_queue = Queue() # 消息队列 17 | pool = Pool(5) # 线程池 18 | 19 | 20 | def forward(w, msg): 21 | """转发消息【异步】""" 22 | 23 | # 阻塞等待某些资源下载完毕 24 | time.sleep(0.5) 25 | 26 | # 如果是图片、视频、文件,要先判断本地是否已经下载好了 27 | if msg["msg_type"] in [3, 43, 493]: 28 | 29 | # 如果是视频的话,把后缀替换成mp4就是真实路径 30 | file_path = msg["file_path"].replace(".jpg", ".mp4") if msg["msg_type"] == 43 else msg["file_path"] 31 | 32 | # 1、这里循环是防止某些资源文件过大,还未完全下载完毕 33 | # 2、严谨点应该控制好循环次数与间隔时间,真的还未下载完(考虑本地网络问题)就放弃该资源吧 34 | for i in range(5): 35 | time.sleep(1) 36 | if os.path.exists(r"{}".format(file_path)): 37 | break 38 | 39 | # 文件类型会在下载完成之后,更新MsgSvrID,所以要从数据库中查询最新的MsgSvrID 40 | if msg["msg_type"] == 493: 41 | db_num = 0 42 | while True: 43 | # 查询数据库 44 | ret = w.select_db( 45 | "MSG{}.db".format(db_num), 46 | "select MsgSvrID from MSG where StrTalker='{}' AND localId='{}' AND CreateTime='{}';".format( 47 | msg["wx_id"], 48 | msg["local_id"], 49 | msg["time_stamp"] 50 | ) 51 | ) 52 | if ret is None: 53 | break 54 | if ret: 55 | msg["msg_id"] = ret[0]["MsgSvrID"] 56 | break 57 | db_num += 1 58 | 59 | # 转发消息 60 | w.forward_msg("filehelper", msg["msg_id"]) 61 | 62 | 63 | def on_message(msg): 64 | """消息回调,建议异步处理,防止阻塞""" 65 | print(msg) 66 | msg_queue.put(msg) 67 | 68 | 69 | def on_exit(event): 70 | """退出事件回调""" 71 | 72 | action = event["action"] 73 | wx_id = event["wx_id"] 74 | if action == 1: 75 | print("微信({}):进程结束,请重新启动微信".format(wx_id)) 76 | elif action == 2: 77 | print("微信({}):已退出登录,请重新登录".format(wx_id)) 78 | 79 | 80 | def main(): 81 | # 初次使用需要pip安装两个库: 82 | # pip install requests 83 | # pip install pycryptodomex 84 | 85 | # 查看帮助 86 | help(WeChatPYApi) 87 | 88 | # 实例化api对象【要多开的话就实例化多个《WeChatPYApi》对象】 89 | w = WeChatPYApi(msg_callback=on_message, exit_callback=on_exit, logger=logging) 90 | 91 | # 调试模式: 92 | # debug_pid=日志中输出的进程pid 93 | # 注意:你的微信必须使用start_wx方法登录成功后,才能使用调试模式 94 | # w = WeChatPYApi(msg_callback=on_message, exit_callback=on_exit, logger=logging, debug_pid=15396) 95 | 96 | # 启动微信【调试模式可不调用该方法】 97 | errno, errmsg = w.start_wx() 98 | # errno, errmsg = w.start_wx(path=os.path.join(BASE_DIR, "login_qrcode.png")) # 保存登录二维码 99 | if errno != 0: 100 | print(errmsg) 101 | if errmsg != "当前为调试模式,不需要调用“start_wx”": 102 | return 103 | 104 | # 这里需要阻塞,等待获取个人信息 105 | while not w.get_self_info(): 106 | time.sleep(2) 107 | 108 | my_info = w.get_self_info() 109 | print("登陆成功!") 110 | print(my_info) 111 | 112 | # 拉取列表(好友/群/公众号等)拉取可能会阻塞,可以自行做异步处理 113 | # 好友列表:pull_type = 1 114 | # 群列表:pull_type = 2 115 | # 公众号列表:pull_type = 3 116 | # 其他:pull_type = 4 117 | lists = w.pull_list(pull_type=3) 118 | print(lists) 119 | 120 | # 获取朋友圈数据 121 | # moments = w.get_moments() 122 | # if not moments: 123 | # print("没有最新的朋友圈") 124 | # else: 125 | # for item in moments: 126 | # print(item) 127 | 128 | # 获取群成员列表 129 | # lists = w.get_chat_room_members(to_chat_room="123@chatroom") 130 | # print(lists) 131 | 132 | # 发送文本消息 133 | # w.send_text(to_wx="filehelper", msg='作者QQ:\r437382693') 134 | # time.sleep(1) 135 | 136 | # 发送图片消息 137 | # w.send_img(to_wx="filehelper", path=r"C:\Users\Administrator\Desktop\1.png") 138 | # time.sleep(1) 139 | 140 | # 发送文件/视频 141 | # w.send_file(to_wx="filehelper", path=r"C:\Users\Administrator\Desktop\1.mp4") 142 | # time.sleep(1) 143 | 144 | # 发送好友名片 145 | # w.send_friend_card( 146 | # to_wx="filehelper", 147 | # friend_wx=my_info["wx_id"], 148 | # friend_name="三水君" 149 | # ) 150 | # time.sleep(1) 151 | 152 | # 发送卡片链接 153 | # w.send_card_link( 154 | # to_wx="filehelper", 155 | # title="QQ", 156 | # desc="437382693", 157 | # target_url="http://www.baidu.com", 158 | # img_url="https://img.alicdn.com/bao/uploaded/TB1AptvRKH2gK0jSZJnXXaT1FXa.png_310x310.jpg" 159 | # ) 160 | # time.sleep(1) 161 | 162 | # 处理消息回调【具体根据自己的业务来写,这里只是一个简陋的演示】 163 | while True: 164 | msg = msg_queue.get() 165 | 166 | # 正常消息 167 | if msg["type"] == 100: 168 | # 自己发送的消息 169 | if msg["is_self_msg"]: 170 | print("收到了自己发送的消息!") 171 | 172 | # 别人发送的消息 173 | else: 174 | if msg["msg_type"] == 37: 175 | # 同意添加好友申请 176 | w.agree_friend(msg_data=msg) 177 | 178 | # 处理图片消息 179 | elif msg["msg_type"] == 3: 180 | file_path, file_name = os.path.split(msg["file_path"]) 181 | if file_name.endswith("dat"): 182 | cur_time = datetime.now().strftime("%Y-%m-%d %H-%M-%S ") 183 | file_name = cur_time + file_name.replace(".dat", "") 184 | print(file_name) 185 | 186 | # 这里睡2秒是防止某些图片过大,还未完全下载完毕 187 | # time.sleep(2) 188 | 189 | # 保存图片 190 | # w.save_img( 191 | # save_path=os.path.join(BASE_DIR, "temp\\{}.png".format(file_name)), 192 | # msg_data=msg, 193 | # ) 194 | 195 | # 收款 196 | elif msg["msg_type"] == 490: 197 | is_recv = msg["detail"]["is_recv"] 198 | if is_recv: 199 | # 收款 200 | w.collection(msg_data=msg) 201 | 202 | # 如果是XXX发来的信息,转发消息【异步】 203 | if msg["wx_id"] == "wxid_xxx": 204 | pool.apply_async(forward, (w, msg)) 205 | 206 | # 撤回消息 207 | # 注意:撤回消息中的参数,跟正常消息的参数不一致,可自行判断type是否是666,分别放到不同的队列中处理 208 | elif msg["type"] == 666: 209 | print("{} 撤回消息:{}".format(msg["wx_id"], msg["content"])) 210 | 211 | 212 | if __name__ == '__main__': 213 | try: 214 | main() 215 | except KeyboardInterrupt: 216 | os._exit(1) 217 | -------------------------------------------------------------------------------- /专业版/Python接口/libs/WeChatApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/Python接口/libs/WeChatApi.dll -------------------------------------------------------------------------------- /专业版/Python接口/libs/inject_tool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/专业版/Python接口/libs/inject_tool.exe -------------------------------------------------------------------------------- /常见问题及解决方案.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 常见问题及解决方案 · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 | 30 |
31 | 32 |
33 |
34 | 35 |
36 |
37 | 38 |
39 | 40 |

使用前,请先保证

41 |
    42 |
  1. 你的Python环境是:Python36/37/38/39,并且是64位的
  2. 43 |
  3. 你的杀毒软件没有删除libs目录下的dll文件
  4. 44 |
  5. 安装的微信版本正确
  6. 45 |
46 |

常见问题及解决方案

47 |

48 | 常见问题1: 49 |

50 |

51 | 52 |

53 |
    54 |
  • 原因1:请检查你的微信版本是否是指定版本
  • 55 |
  • 原因2:请检查你的杀毒软件是否把libs文件夹中的dll文件拦截了
  • 56 |
  • 解决方案:安装指定版本的微信、把dll文件添加至你杀毒软件的白名单中
  • 57 |
58 |

59 | 常见问题2: 60 |

61 |

62 | 63 |

64 |
    65 |
  • 原因:这是因为你的Python环境不是36/37/38/39,或者不是64位的,再或者是没有安装依赖库。
  • 66 |
  • 解决方案: 67 |
      68 |
    • 使用对应版本的Python环境(必须是64位)
    • 69 |
    • 70 | 初次使用需要pip安装两个库: 71 |
        72 |
      • pip install requests
      • 73 |
      • pip install pycryptodomex
      • 74 |
      75 |
    • 76 |
    • 若还不行,请把其他pyd删除掉(你是Python36。就删除37、38、39的pyd文件,其他版本同理)
    • 77 |
    78 |
  • 79 |
80 |

81 | 常见问题3: 82 |

83 |

84 | 85 |

86 |
    87 |
  • 原因:如果遇到这种问题,请检查你的杀毒软件是否把libs目录下的dll文件误删了
  • 88 |
  • 解决方案:关闭杀毒软件或者把WeChatApi.dll设置为白名单
  • 89 |
90 |

91 | 常见问题4: 92 |

93 |

94 | 95 |

96 |
    97 |
  • 98 |

    导致原因1:你的Python环境是32位的,但是你正在使用64位的pyd文件

    99 |
  • 100 |
  • 101 |

    解决方案:使用64位的Python环境运行

    102 |
  • 103 |
104 |
    105 |
  • 106 |

    导致原因2:你可能误删了pyd文件,然后又把它从回收站恢复回来,导致编码错误

    107 |
  • 108 |
  • 109 |

    解决方案:此时你只能重新pull一遍项目了

    110 |
  • 111 |
112 |

113 | 常见问题5 114 |

115 |
    116 |
  • 我的Python环境没问题、用的也是对应版本的微信,为什么实例化的时候还是报错?
  • 117 |
  • 类似这种错误: 118 | 《ImportError: DLL load failed: 找不到指定的模块》 119 |
  • 120 |
121 |

122 | 123 |

124 |
    125 |
  • 126 |

    原因:包的版本太高也可能会导致实例化失败,主要是《pycryptodomex》这个包

    127 |
  • 128 |
  • 129 |

    解决方案:

    130 |
      131 |
    • 尝试降低或升高包的版本
    • 132 |
    • 133 | 以下是我本机环境的包版本,供参考: 134 |
        135 |
      • requests==2.23.0
      • 136 |
      • pycryptodomex==3.9.4
      • 137 |
      138 |
    • 139 |
    140 |
  • 141 |
142 |

143 | 常见问题6: 144 |

145 |

146 | 147 |

148 |
    149 |
  • 150 |

    原因:

    151 |
      152 |
    • 有很多小伙伴不太了解pyd文件,在导包时,Pycharm报红,以为这是一个error
    • 153 |
    154 |

    155 | 156 |

    157 |
      158 |
    • 于是他把文件名后缀改为.py
    • 159 |
    160 |
  • 161 |
  • 162 |

    解决方案:报红为正常现象,请不要随意改动文件后缀

    163 |
  • 164 |
165 |
    166 |
  • 167 |

    168 | 这里说一点:很多小伙伴觉得pyd文件名长的恶心,比如这样:【WeChatPYAPI.cp38-win_amd64.pyd】,其实中间那坨是可以删掉的,给你们的时候留着是为了你们好分辨版本,实际项目中可以改成下图这样: 169 |

    170 |

    171 | 172 |

    173 |
  • 174 |
175 |

176 | 常见问题7(一启动就崩溃): 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 |

    问题1:很多小伙伴会使用pyinstaller对自己的项目进行打包,但是打包后发现无法正常使用WeChatPYAPI

    207 |
  • 208 |
  • 209 |

    答:如果你使用“-F”打包为单文件,那么记得把libs文件夹载入你的虚拟目录中,如果你打包为多文件,那么直接把libs文件夹拷贝至你的项目目录中

    210 |
  • 211 |
212 |
    213 |
  • 214 |

    问题2:为什么使用pyinstaller打包时,出现包不存在的问题

    215 |
  • 216 |
  • 217 |

    答:因为pyinstaller打包时,会检测pyd中使用到的包,如果你使用pyinstaller打包,请在你的main文件头部添加以下代码:

    218 |
  • 219 |
  • 220 |
    import json, requests
    221 | from http.server import HTTPServer, BaseHTTPRequestHandler
    222 | from Cryptodome.Cipher import AES
    223 | try:
    224 |     import xml.etree.cElementTree as ET
    225 | except ImportError:
    226 |     import xml.etree.ElementTree as ET
    227 | 
    228 |
  • 229 |
230 |
    231 |
  • 232 |

    问题3:我可以自行指定libs目录路径吗?

    233 |
  • 234 |
  • 235 |

    答:可以,如果你不想在项目中有libs文件夹,在实例化WeChatPYApi的时候,传入参数:libs_dir=你自定义目录的绝对路径。虽然目录可更改,但是! 236 | WeChatApi.dll跟 237 | inject_tool.exe两个文件必须在同一级目录下:

    238 |

    239 | 240 |

    241 |
  • 242 |
243 |
    244 |
  • 问题4:如果你使用社区版本时出现了崩溃的问题,很不幸,这个问题在社区版没有得到解决。
  • 245 |
246 | 247 | 248 |
249 | 250 |
251 |
252 |
253 | 254 |

255 | results matching " 256 | "

257 |
    258 | 259 |
    260 |
    261 | 262 |

    No results matching " 263 | "

    264 | 265 |
    266 |
    267 |
    268 | 269 |
    270 |
    271 | 272 |
    273 | 274 |
    275 | 276 | 282 |
    283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css: -------------------------------------------------------------------------------- 1 | .book .book-summary .chapter > .articles { 2 | overflow: hidden; 3 | max-height: 0px; 4 | } 5 | 6 | .book .book-summary .chapter.expanded > .articles { 7 | max-height: 9999px; 8 | } 9 | 10 | .book .book-summary .exc-trigger { 11 | position: absolute; 12 | left: 12px; 13 | top: 12px; 14 | } 15 | 16 | .book .book-summary ul.summary li a, 17 | .book .book-summary ul.summary li span { 18 | padding-left: 30px; 19 | cursor: pointer; 20 | } 21 | 22 | .book .book-summary .exc-trigger:before { 23 | content: "\f054"; 24 | } 25 | 26 | .book .book-summary .expanded > a .exc-trigger:before, 27 | .book .book-summary .expanded > span .exc-trigger:before { 28 | content: "\f078"; 29 | } 30 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jQuery'], function(gitbook, $) { 2 | var TOGGLE_CLASSNAME = 'expanded', 3 | CHAPTER = '.chapter', 4 | ARTICLES = '.articles', 5 | TRIGGER_TEMPLATE = '', 6 | LS_NAMESPACE = 'expChapters'; 7 | var init = function () { 8 | // adding the trigger element to each ARTICLES parent and binding the event 9 | $(ARTICLES) 10 | .parent(CHAPTER) 11 | .children('a,span') 12 | .append(TRIGGER_TEMPLATE) 13 | .on('click', function(e) { 14 | if (!$(e.target).is('a')) { 15 | e.preventDefault(); 16 | e.stopPropagation(); 17 | toggle($(e.target).closest(CHAPTER)); 18 | } 19 | }); 20 | 21 | expand(lsItem()); 22 | //expand current selected chapter with it's parents 23 | var activeChapter = $(CHAPTER + '.active'); 24 | expand(activeChapter); 25 | expand(activeChapter.parents(CHAPTER)); 26 | 27 | 28 | } 29 | var toggle = function ($chapter) { 30 | if ($chapter.hasClass('expanded')) { 31 | collapse($chapter); 32 | } else { 33 | expand($chapter); 34 | } 35 | } 36 | var collapse = function ($chapter) { 37 | if ($chapter.length && $chapter.hasClass(TOGGLE_CLASSNAME)) { 38 | $chapter.removeClass(TOGGLE_CLASSNAME); 39 | lsItem($chapter); 40 | } 41 | } 42 | var expand = function ($chapter) { 43 | if ($chapter.length && !$chapter.hasClass(TOGGLE_CLASSNAME)) { 44 | $chapter.addClass(TOGGLE_CLASSNAME); 45 | lsItem($chapter); 46 | } 47 | } 48 | var lsItem = function () { 49 | var map = JSON.parse(localStorage.getItem(LS_NAMESPACE)) || {} 50 | if (arguments.length) { 51 | var $chapters = arguments[0]; 52 | $chapters.each(function (index, element) { 53 | var level = $(this).data('level'); 54 | var value = $(this).hasClass(TOGGLE_CLASSNAME); 55 | map[level] = value; 56 | }) 57 | localStorage.setItem(LS_NAMESPACE, JSON.stringify(map)); 58 | } else { 59 | return $(CHAPTER).map(function(index, element){ 60 | if (map[$(this).data('level')]) { 61 | return this; 62 | } 63 | }) 64 | } 65 | } 66 | gitbook.events.bind('page.change', function() { 67 | init() 68 | }); 69 | }); 70 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-fontsettings/fontsettings.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | // Configuration 3 | var MAX_SIZE = 4, 4 | MIN_SIZE = 0, 5 | BUTTON_ID; 6 | 7 | // Current fontsettings state 8 | var fontState; 9 | 10 | // Default themes 11 | var THEMES = [ 12 | { 13 | config: 'white', 14 | text: 'White', 15 | id: 0 16 | }, 17 | { 18 | config: 'sepia', 19 | text: 'Sepia', 20 | id: 1 21 | }, 22 | { 23 | config: 'night', 24 | text: 'Night', 25 | id: 2 26 | } 27 | ]; 28 | 29 | // Default font families 30 | var FAMILIES = [ 31 | { 32 | config: 'serif', 33 | text: 'Serif', 34 | id: 0 35 | }, 36 | { 37 | config: 'sans', 38 | text: 'Sans', 39 | id: 1 40 | } 41 | ]; 42 | 43 | // Return configured themes 44 | function getThemes() { 45 | return THEMES; 46 | } 47 | 48 | // Modify configured themes 49 | function setThemes(themes) { 50 | THEMES = themes; 51 | updateButtons(); 52 | } 53 | 54 | // Return configured font families 55 | function getFamilies() { 56 | return FAMILIES; 57 | } 58 | 59 | // Modify configured font families 60 | function setFamilies(families) { 61 | FAMILIES = families; 62 | updateButtons(); 63 | } 64 | 65 | // Save current font settings 66 | function saveFontSettings() { 67 | gitbook.storage.set('fontState', fontState); 68 | update(); 69 | } 70 | 71 | // Increase font size 72 | function enlargeFontSize(e) { 73 | e.preventDefault(); 74 | if (fontState.size >= MAX_SIZE) return; 75 | 76 | fontState.size++; 77 | saveFontSettings(); 78 | } 79 | 80 | // Decrease font size 81 | function reduceFontSize(e) { 82 | e.preventDefault(); 83 | if (fontState.size <= MIN_SIZE) return; 84 | 85 | fontState.size--; 86 | saveFontSettings(); 87 | } 88 | 89 | // Change font family 90 | function changeFontFamily(configName, e) { 91 | if (e && e instanceof Event) { 92 | e.preventDefault(); 93 | } 94 | 95 | var familyId = getFontFamilyId(configName); 96 | fontState.family = familyId; 97 | saveFontSettings(); 98 | } 99 | 100 | // Change type of color theme 101 | function changeColorTheme(configName, e) { 102 | if (e && e instanceof Event) { 103 | e.preventDefault(); 104 | } 105 | 106 | var $book = gitbook.state.$book; 107 | 108 | // Remove currently applied color theme 109 | if (fontState.theme !== 0) 110 | $book.removeClass('color-theme-'+fontState.theme); 111 | 112 | // Set new color theme 113 | var themeId = getThemeId(configName); 114 | fontState.theme = themeId; 115 | if (fontState.theme !== 0) 116 | $book.addClass('color-theme-'+fontState.theme); 117 | 118 | saveFontSettings(); 119 | } 120 | 121 | // Return the correct id for a font-family config key 122 | // Default to first font-family 123 | function getFontFamilyId(configName) { 124 | // Search for plugin configured font family 125 | var configFamily = $.grep(FAMILIES, function(family) { 126 | return family.config == configName; 127 | })[0]; 128 | // Fallback to default font family 129 | return (!!configFamily)? configFamily.id : 0; 130 | } 131 | 132 | // Return the correct id for a theme config key 133 | // Default to first theme 134 | function getThemeId(configName) { 135 | // Search for plugin configured theme 136 | var configTheme = $.grep(THEMES, function(theme) { 137 | return theme.config == configName; 138 | })[0]; 139 | // Fallback to default theme 140 | return (!!configTheme)? configTheme.id : 0; 141 | } 142 | 143 | function update() { 144 | var $book = gitbook.state.$book; 145 | 146 | $('.font-settings .font-family-list li').removeClass('active'); 147 | $('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active'); 148 | 149 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); 150 | $book.addClass('font-size-'+fontState.size); 151 | $book.addClass('font-family-'+fontState.family); 152 | 153 | if(fontState.theme !== 0) { 154 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); 155 | $book.addClass('color-theme-'+fontState.theme); 156 | } 157 | } 158 | 159 | function init(config) { 160 | // Search for plugin configured font family 161 | var configFamily = getFontFamilyId(config.family), 162 | configTheme = getThemeId(config.theme); 163 | 164 | // Instantiate font state object 165 | fontState = gitbook.storage.get('fontState', { 166 | size: config.size || 2, 167 | family: configFamily, 168 | theme: configTheme 169 | }); 170 | 171 | update(); 172 | } 173 | 174 | function updateButtons() { 175 | // Remove existing fontsettings buttons 176 | if (!!BUTTON_ID) { 177 | gitbook.toolbar.removeButton(BUTTON_ID); 178 | } 179 | 180 | // Create buttons in toolbar 181 | BUTTON_ID = gitbook.toolbar.createButton({ 182 | icon: 'fa fa-font', 183 | label: 'Font Settings', 184 | className: 'font-settings', 185 | dropdown: [ 186 | [ 187 | { 188 | text: 'A', 189 | className: 'font-reduce', 190 | onClick: reduceFontSize 191 | }, 192 | { 193 | text: 'A', 194 | className: 'font-enlarge', 195 | onClick: enlargeFontSize 196 | } 197 | ], 198 | $.map(FAMILIES, function(family) { 199 | family.onClick = function(e) { 200 | return changeFontFamily(family.config, e); 201 | }; 202 | 203 | return family; 204 | }), 205 | $.map(THEMES, function(theme) { 206 | theme.onClick = function(e) { 207 | return changeColorTheme(theme.config, e); 208 | }; 209 | 210 | return theme; 211 | }) 212 | ] 213 | }); 214 | } 215 | 216 | // Init configuration at start 217 | gitbook.events.bind('start', function(e, config) { 218 | var opts = config.fontsettings; 219 | 220 | // Generate buttons at start 221 | updateButtons(); 222 | 223 | // Init current settings 224 | init(opts); 225 | }); 226 | 227 | // Expose API 228 | gitbook.fontsettings = { 229 | enlargeFontSize: enlargeFontSize, 230 | reduceFontSize: reduceFontSize, 231 | setTheme: changeColorTheme, 232 | setFamily: changeFontFamily, 233 | getThemes: getThemes, 234 | setThemes: setThemes, 235 | getFamilies: getFamilies, 236 | setFamilies: setFamilies 237 | }; 238 | }); 239 | 240 | 241 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-fontsettings/website.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Theme 1 3 | */ 4 | .color-theme-1 .dropdown-menu { 5 | background-color: #111111; 6 | border-color: #7e888b; 7 | } 8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { 9 | border-bottom: 9px solid #111111; 10 | } 11 | .color-theme-1 .dropdown-menu .buttons { 12 | border-color: #7e888b; 13 | } 14 | .color-theme-1 .dropdown-menu .button { 15 | color: #afa790; 16 | } 17 | .color-theme-1 .dropdown-menu .button:hover { 18 | color: #73553c; 19 | } 20 | /* 21 | * Theme 2 22 | */ 23 | .color-theme-2 .dropdown-menu { 24 | background-color: #2d3143; 25 | border-color: #272a3a; 26 | } 27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { 28 | border-bottom: 9px solid #2d3143; 29 | } 30 | .color-theme-2 .dropdown-menu .buttons { 31 | border-color: #272a3a; 32 | } 33 | .color-theme-2 .dropdown-menu .button { 34 | color: #62677f; 35 | } 36 | .color-theme-2 .dropdown-menu .button:hover { 37 | color: #f4f4f5; 38 | } 39 | .book .book-header .font-settings .font-enlarge { 40 | line-height: 30px; 41 | font-size: 1.4em; 42 | } 43 | .book .book-header .font-settings .font-reduce { 44 | line-height: 30px; 45 | font-size: 1em; 46 | } 47 | .book.color-theme-1 .book-body { 48 | color: #704214; 49 | background: #f3eacb; 50 | } 51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section { 52 | background: #f3eacb; 53 | } 54 | .book.color-theme-2 .book-body { 55 | color: #bdcadb; 56 | background: #1c1f2b; 57 | } 58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section { 59 | background: #1c1f2b; 60 | } 61 | .book.font-size-0 .book-body .page-inner section { 62 | font-size: 1.2rem; 63 | } 64 | .book.font-size-1 .book-body .page-inner section { 65 | font-size: 1.4rem; 66 | } 67 | .book.font-size-2 .book-body .page-inner section { 68 | font-size: 1.6rem; 69 | } 70 | .book.font-size-3 .book-body .page-inner section { 71 | font-size: 2.2rem; 72 | } 73 | .book.font-size-4 .book-body .page-inner section { 74 | font-size: 4rem; 75 | } 76 | .book.font-family-0 { 77 | font-family: Georgia, serif; 78 | } 79 | .book.font-family-1 { 80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 81 | } 82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { 83 | color: #704214; 84 | } 85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { 86 | color: inherit; 87 | } 88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, 90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, 91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, 92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, 93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 94 | color: inherit; 95 | } 96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { 98 | border-color: inherit; 99 | } 100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 101 | color: inherit; 102 | } 103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { 104 | background-color: inherit; 105 | } 106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { 107 | border-color: inherit; 108 | } 109 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, 110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { 111 | background: #fdf6e3; 112 | color: #657b83; 113 | border-color: #f8df9c; 114 | } 115 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { 116 | background-color: inherit; 117 | } 118 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, 119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { 120 | border-color: #f5d06c; 121 | } 122 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { 123 | color: inherit; 124 | background-color: #fdf6e3; 125 | border-color: #444444; 126 | } 127 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 128 | background-color: #fbeecb; 129 | } 130 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { 131 | color: #bdcadb; 132 | } 133 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { 134 | color: #3eb1d0; 135 | } 136 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, 138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, 139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, 140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, 141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 142 | color: #fffffa; 143 | } 144 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { 146 | border-color: #373b4e; 147 | } 148 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 149 | color: #373b4e; 150 | } 151 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { 152 | background-color: #373b4e; 153 | } 154 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { 155 | border-color: #373b4e; 156 | } 157 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, 158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { 159 | color: #9dbed8; 160 | background: #2d3143; 161 | border-color: #2d3143; 162 | } 163 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { 164 | background-color: #282a39; 165 | } 166 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, 167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { 168 | border-color: #3b3f54; 169 | } 170 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { 171 | color: #b6c2d2; 172 | background-color: #2d3143; 173 | border-color: #3b3f54; 174 | } 175 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 176 | background-color: #35394b; 177 | } 178 | .book.color-theme-1 .book-header { 179 | color: #afa790; 180 | background: transparent; 181 | } 182 | .book.color-theme-1 .book-header .btn { 183 | color: #afa790; 184 | } 185 | .book.color-theme-1 .book-header .btn:hover { 186 | color: #73553c; 187 | background: none; 188 | } 189 | .book.color-theme-1 .book-header h1 { 190 | color: #704214; 191 | } 192 | .book.color-theme-2 .book-header { 193 | color: #7e888b; 194 | background: transparent; 195 | } 196 | .book.color-theme-2 .book-header .btn { 197 | color: #3b3f54; 198 | } 199 | .book.color-theme-2 .book-header .btn:hover { 200 | color: #fffff5; 201 | background: none; 202 | } 203 | .book.color-theme-2 .book-header h1 { 204 | color: #bdcadb; 205 | } 206 | .book.color-theme-1 .book-body .navigation { 207 | color: #afa790; 208 | } 209 | .book.color-theme-1 .book-body .navigation:hover { 210 | color: #73553c; 211 | } 212 | .book.color-theme-2 .book-body .navigation { 213 | color: #383f52; 214 | } 215 | .book.color-theme-2 .book-body .navigation:hover { 216 | color: #fffff5; 217 | } 218 | /* 219 | * Theme 1 220 | */ 221 | .book.color-theme-1 .book-summary { 222 | color: #afa790; 223 | background: #111111; 224 | border-right: 1px solid rgba(0, 0, 0, 0.07); 225 | } 226 | .book.color-theme-1 .book-summary .book-search { 227 | background: transparent; 228 | } 229 | .book.color-theme-1 .book-summary .book-search input, 230 | .book.color-theme-1 .book-summary .book-search input:focus { 231 | border: 1px solid transparent; 232 | } 233 | .book.color-theme-1 .book-summary ul.summary li.divider { 234 | background: #7e888b; 235 | box-shadow: none; 236 | } 237 | .book.color-theme-1 .book-summary ul.summary li i.fa-check { 238 | color: #33cc33; 239 | } 240 | .book.color-theme-1 .book-summary ul.summary li.done > a { 241 | color: #877f6a; 242 | } 243 | .book.color-theme-1 .book-summary ul.summary li a, 244 | .book.color-theme-1 .book-summary ul.summary li span { 245 | color: #877f6a; 246 | background: transparent; 247 | font-weight: normal; 248 | } 249 | .book.color-theme-1 .book-summary ul.summary li.active > a, 250 | .book.color-theme-1 .book-summary ul.summary li a:hover { 251 | color: #704214; 252 | background: transparent; 253 | font-weight: normal; 254 | } 255 | /* 256 | * Theme 2 257 | */ 258 | .book.color-theme-2 .book-summary { 259 | color: #bcc1d2; 260 | background: #2d3143; 261 | border-right: none; 262 | } 263 | .book.color-theme-2 .book-summary .book-search { 264 | background: transparent; 265 | } 266 | .book.color-theme-2 .book-summary .book-search input, 267 | .book.color-theme-2 .book-summary .book-search input:focus { 268 | border: 1px solid transparent; 269 | } 270 | .book.color-theme-2 .book-summary ul.summary li.divider { 271 | background: #272a3a; 272 | box-shadow: none; 273 | } 274 | .book.color-theme-2 .book-summary ul.summary li i.fa-check { 275 | color: #33cc33; 276 | } 277 | .book.color-theme-2 .book-summary ul.summary li.done > a { 278 | color: #62687f; 279 | } 280 | .book.color-theme-2 .book-summary ul.summary li a, 281 | .book.color-theme-2 .book-summary ul.summary li span { 282 | color: #c1c6d7; 283 | background: transparent; 284 | font-weight: 600; 285 | } 286 | .book.color-theme-2 .book-summary ul.summary li.active > a, 287 | .book.color-theme-2 .book-summary ul.summary li a:hover { 288 | color: #f4f4f5; 289 | background: #252737; 290 | font-weight: 600; 291 | } 292 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-highlight/ebook.css: -------------------------------------------------------------------------------- 1 | pre, 2 | code { 3 | /* http://jmblog.github.io/color-themes-for-highlightjs */ 4 | /* Tomorrow Comment */ 5 | /* Tomorrow Red */ 6 | /* Tomorrow Orange */ 7 | /* Tomorrow Yellow */ 8 | /* Tomorrow Green */ 9 | /* Tomorrow Aqua */ 10 | /* Tomorrow Blue */ 11 | /* Tomorrow Purple */ 12 | } 13 | pre .hljs-comment, 14 | code .hljs-comment, 15 | pre .hljs-title, 16 | code .hljs-title { 17 | color: #8e908c; 18 | } 19 | pre .hljs-variable, 20 | code .hljs-variable, 21 | pre .hljs-attribute, 22 | code .hljs-attribute, 23 | pre .hljs-tag, 24 | code .hljs-tag, 25 | pre .hljs-regexp, 26 | code .hljs-regexp, 27 | pre .hljs-deletion, 28 | code .hljs-deletion, 29 | pre .ruby .hljs-constant, 30 | code .ruby .hljs-constant, 31 | pre .xml .hljs-tag .hljs-title, 32 | code .xml .hljs-tag .hljs-title, 33 | pre .xml .hljs-pi, 34 | code .xml .hljs-pi, 35 | pre .xml .hljs-doctype, 36 | code .xml .hljs-doctype, 37 | pre .html .hljs-doctype, 38 | code .html .hljs-doctype, 39 | pre .css .hljs-id, 40 | code .css .hljs-id, 41 | pre .css .hljs-class, 42 | code .css .hljs-class, 43 | pre .css .hljs-pseudo, 44 | code .css .hljs-pseudo { 45 | color: #c82829; 46 | } 47 | pre .hljs-number, 48 | code .hljs-number, 49 | pre .hljs-preprocessor, 50 | code .hljs-preprocessor, 51 | pre .hljs-pragma, 52 | code .hljs-pragma, 53 | pre .hljs-built_in, 54 | code .hljs-built_in, 55 | pre .hljs-literal, 56 | code .hljs-literal, 57 | pre .hljs-params, 58 | code .hljs-params, 59 | pre .hljs-constant, 60 | code .hljs-constant { 61 | color: #f5871f; 62 | } 63 | pre .ruby .hljs-class .hljs-title, 64 | code .ruby .hljs-class .hljs-title, 65 | pre .css .hljs-rules .hljs-attribute, 66 | code .css .hljs-rules .hljs-attribute { 67 | color: #eab700; 68 | } 69 | pre .hljs-string, 70 | code .hljs-string, 71 | pre .hljs-value, 72 | code .hljs-value, 73 | pre .hljs-inheritance, 74 | code .hljs-inheritance, 75 | pre .hljs-header, 76 | code .hljs-header, 77 | pre .hljs-addition, 78 | code .hljs-addition, 79 | pre .ruby .hljs-symbol, 80 | code .ruby .hljs-symbol, 81 | pre .xml .hljs-cdata, 82 | code .xml .hljs-cdata { 83 | color: #718c00; 84 | } 85 | pre .css .hljs-hexcolor, 86 | code .css .hljs-hexcolor { 87 | color: #3e999f; 88 | } 89 | pre .hljs-function, 90 | code .hljs-function, 91 | pre .python .hljs-decorator, 92 | code .python .hljs-decorator, 93 | pre .python .hljs-title, 94 | code .python .hljs-title, 95 | pre .ruby .hljs-function .hljs-title, 96 | code .ruby .hljs-function .hljs-title, 97 | pre .ruby .hljs-title .hljs-keyword, 98 | code .ruby .hljs-title .hljs-keyword, 99 | pre .perl .hljs-sub, 100 | code .perl .hljs-sub, 101 | pre .javascript .hljs-title, 102 | code .javascript .hljs-title, 103 | pre .coffeescript .hljs-title, 104 | code .coffeescript .hljs-title { 105 | color: #4271ae; 106 | } 107 | pre .hljs-keyword, 108 | code .hljs-keyword, 109 | pre .javascript .hljs-function, 110 | code .javascript .hljs-function { 111 | color: #8959a8; 112 | } 113 | pre .hljs, 114 | code .hljs { 115 | display: block; 116 | background: white; 117 | color: #4d4d4c; 118 | padding: 0.5em; 119 | } 120 | pre .coffeescript .javascript, 121 | code .coffeescript .javascript, 122 | pre .javascript .xml, 123 | code .javascript .xml, 124 | pre .tex .hljs-formula, 125 | code .tex .hljs-formula, 126 | pre .xml .javascript, 127 | code .xml .javascript, 128 | pre .xml .vbscript, 129 | code .xml .vbscript, 130 | pre .xml .css, 131 | code .xml .css, 132 | pre .xml .hljs-cdata, 133 | code .xml .hljs-cdata { 134 | opacity: 0.5; 135 | } 136 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-highlight/website.css: -------------------------------------------------------------------------------- 1 | .book .book-body .page-wrapper .page-inner section.normal pre, 2 | .book .book-body .page-wrapper .page-inner section.normal code { 3 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 4 | /* Tomorrow Comment */ 5 | /* Tomorrow Red */ 6 | /* Tomorrow Orange */ 7 | /* Tomorrow Yellow */ 8 | /* Tomorrow Green */ 9 | /* Tomorrow Aqua */ 10 | /* Tomorrow Blue */ 11 | /* Tomorrow Purple */ 12 | } 13 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, 14 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-comment, 15 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-title, 16 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-title { 17 | color: #8e908c; 18 | } 19 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, 20 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-variable, 21 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, 22 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, 23 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-tag, 24 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-tag, 25 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, 26 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, 27 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, 28 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, 29 | .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant, 30 | .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant, 31 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title, 32 | .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title, 33 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi, 34 | .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi, 35 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype, 36 | .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype, 37 | .book .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype, 38 | .book .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype, 39 | .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id, 40 | .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-id, 41 | .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class, 42 | .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-class, 43 | .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, 44 | .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo { 45 | color: #c82829; 46 | } 47 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-number, 48 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-number, 49 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, 50 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, 51 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, 52 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, 53 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, 54 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, 55 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-literal, 56 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-literal, 57 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-params, 58 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-params, 59 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, 60 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-constant { 61 | color: #f5871f; 62 | } 63 | .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title, 64 | .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title, 65 | .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute, 66 | .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute { 67 | color: #eab700; 68 | } 69 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-string, 70 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-string, 71 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-value, 72 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-value, 73 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance, 74 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance, 75 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-header, 76 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-header, 77 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, 78 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-addition, 79 | .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol, 80 | .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol, 81 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, 82 | .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { 83 | color: #718c00; 84 | } 85 | .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor, 86 | .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor { 87 | color: #3e999f; 88 | } 89 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-function, 90 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-function, 91 | .book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator, 92 | .book .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator, 93 | .book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title, 94 | .book .book-body .page-wrapper .page-inner section.normal code .python .hljs-title, 95 | .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title, 96 | .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title, 97 | .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword, 98 | .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword, 99 | .book .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub, 100 | .book .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub, 101 | .book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title, 102 | .book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title, 103 | .book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title, 104 | .book .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title { 105 | color: #4271ae; 106 | } 107 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, 108 | .book .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, 109 | .book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function, 110 | .book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function { 111 | color: #8959a8; 112 | } 113 | .book .book-body .page-wrapper .page-inner section.normal pre .hljs, 114 | .book .book-body .page-wrapper .page-inner section.normal code .hljs { 115 | display: block; 116 | background: white; 117 | color: #4d4d4c; 118 | padding: 0.5em; 119 | } 120 | .book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript, 121 | .book .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript, 122 | .book .book-body .page-wrapper .page-inner section.normal pre .javascript .xml, 123 | .book .book-body .page-wrapper .page-inner section.normal code .javascript .xml, 124 | .book .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, 125 | .book .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, 126 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .javascript, 127 | .book .book-body .page-wrapper .page-inner section.normal code .xml .javascript, 128 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript, 129 | .book .book-body .page-wrapper .page-inner section.normal code .xml .vbscript, 130 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .css, 131 | .book .book-body .page-wrapper .page-inner section.normal code .xml .css, 132 | .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, 133 | .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { 134 | opacity: 0.5; 135 | } 136 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, 137 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { 138 | /* 139 | 140 | Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull 141 | 142 | */ 143 | /* Solarized Green */ 144 | /* Solarized Cyan */ 145 | /* Solarized Blue */ 146 | /* Solarized Yellow */ 147 | /* Solarized Orange */ 148 | /* Solarized Red */ 149 | /* Solarized Violet */ 150 | } 151 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs, 152 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs { 153 | display: block; 154 | padding: 0.5em; 155 | background: #fdf6e3; 156 | color: #657b83; 157 | } 158 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, 159 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-comment, 160 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-template_comment, 161 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-template_comment, 162 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-header, 163 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-header, 164 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-doctype, 165 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-doctype, 166 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pi, 167 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pi, 168 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-string, 169 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-string, 170 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-javadoc, 171 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-javadoc { 172 | color: #93a1a1; 173 | } 174 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, 175 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, 176 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-winutils, 177 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-winutils, 178 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .method, 179 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .method, 180 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, 181 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-addition, 182 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-tag, 183 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-tag, 184 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-request, 185 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-request, 186 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-status, 187 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-status, 188 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .nginx .hljs-title, 189 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .nginx .hljs-title { 190 | color: #859900; 191 | } 192 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-number, 193 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-number, 194 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-command, 195 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-command, 196 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-string, 197 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-string, 198 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag .hljs-value, 199 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-tag .hljs-value, 200 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-rules .hljs-value, 201 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-rules .hljs-value, 202 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-phpdoc, 203 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-phpdoc, 204 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, 205 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, 206 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, 207 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, 208 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-hexcolor, 209 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-hexcolor, 210 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_url, 211 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_url { 212 | color: #2aa198; 213 | } 214 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-title, 215 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-title, 216 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-localvars, 217 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-localvars, 218 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-chunk, 219 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-chunk, 220 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-decorator, 221 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-decorator, 222 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, 223 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, 224 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-identifier, 225 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-identifier, 226 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .vhdl .hljs-literal, 227 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .vhdl .hljs-literal, 228 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-id, 229 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-id, 230 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-function, 231 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-function { 232 | color: #268bd2; 233 | } 234 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, 235 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, 236 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, 237 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-variable, 238 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-body, 239 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-body, 240 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .smalltalk .hljs-number, 241 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .smalltalk .hljs-number, 242 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, 243 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-constant, 244 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-class .hljs-title, 245 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-class .hljs-title, 246 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-parent, 247 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-parent, 248 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .haskell .hljs-type, 249 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .haskell .hljs-type, 250 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_reference, 251 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_reference { 252 | color: #b58900; 253 | } 254 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, 255 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, 256 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor .hljs-keyword, 257 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor .hljs-keyword, 258 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, 259 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, 260 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-shebang, 261 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-shebang, 262 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol, 263 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol, 264 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol .hljs-string, 265 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol .hljs-string, 266 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-change, 267 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-change, 268 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-special, 269 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-special, 270 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attr_selector, 271 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attr_selector, 272 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-subst, 273 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-subst, 274 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-cdata, 275 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-cdata, 276 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .clojure .hljs-title, 277 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .clojure .hljs-title, 278 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, 279 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo, 280 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-header, 281 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-header { 282 | color: #cb4b16; 283 | } 284 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, 285 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, 286 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-important, 287 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-important { 288 | color: #dc322f; 289 | } 290 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_label, 291 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_label { 292 | color: #6c71c4; 293 | } 294 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, 295 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula { 296 | background: #eee8d5; 297 | } 298 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, 299 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { 300 | /* Tomorrow Night Bright Theme */ 301 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 302 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 303 | /* Tomorrow Comment */ 304 | /* Tomorrow Red */ 305 | /* Tomorrow Orange */ 306 | /* Tomorrow Yellow */ 307 | /* Tomorrow Green */ 308 | /* Tomorrow Aqua */ 309 | /* Tomorrow Blue */ 310 | /* Tomorrow Purple */ 311 | } 312 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, 313 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-comment, 314 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-title, 315 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-title { 316 | color: #969896; 317 | } 318 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, 319 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-variable, 320 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, 321 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, 322 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag, 323 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-tag, 324 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, 325 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, 326 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, 327 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, 328 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant, 329 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant, 330 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title, 331 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title, 332 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi, 333 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi, 334 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype, 335 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype, 336 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype, 337 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype, 338 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id, 339 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-id, 340 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class, 341 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-class, 342 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, 343 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo { 344 | color: #d54e53; 345 | } 346 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-number, 347 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-number, 348 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, 349 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, 350 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, 351 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, 352 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, 353 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, 354 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-literal, 355 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-literal, 356 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-params, 357 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-params, 358 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, 359 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-constant { 360 | color: #e78c45; 361 | } 362 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title, 363 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title, 364 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute, 365 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute { 366 | color: #e7c547; 367 | } 368 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-string, 369 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-string, 370 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-value, 371 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-value, 372 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance, 373 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance, 374 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-header, 375 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-header, 376 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, 377 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-addition, 378 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol, 379 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol, 380 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, 381 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { 382 | color: #b9ca4a; 383 | } 384 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor, 385 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor { 386 | color: #70c0b1; 387 | } 388 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-function, 389 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-function, 390 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator, 391 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator, 392 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title, 393 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-title, 394 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title, 395 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title, 396 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword, 397 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword, 398 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub, 399 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub, 400 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title, 401 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title, 402 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title, 403 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title { 404 | color: #7aa6da; 405 | } 406 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, 407 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, 408 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function, 409 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function { 410 | color: #c397d8; 411 | } 412 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs, 413 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs { 414 | display: block; 415 | background: black; 416 | color: #eaeaea; 417 | padding: 0.5em; 418 | } 419 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript, 420 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript, 421 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .xml, 422 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .xml, 423 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, 424 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, 425 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .javascript, 426 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .javascript, 427 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript, 428 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .vbscript, 429 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .css, 430 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .css, 431 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, 432 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { 433 | opacity: 0.5; 434 | } 435 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-lunr/lunr.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 3 | * Copyright (C) 2015 Oliver Nightingale 4 | * MIT Licensed 5 | * @license 6 | */ 7 | !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;no;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n element for each result 48 | res.results.forEach(function(res) { 49 | var $li = $('
  • ', { 50 | 'class': 'search-results-item' 51 | }); 52 | 53 | var $title = $('

    '); 54 | 55 | var $link = $('', { 56 | 'href': gitbook.state.basePath + '/' + res.url, 57 | 'text': res.title 58 | }); 59 | 60 | var content = res.body.trim(); 61 | if (content.length > MAX_DESCRIPTION_SIZE) { 62 | content = content.slice(0, MAX_DESCRIPTION_SIZE).trim()+'...'; 63 | } 64 | var $content = $('

    ').html(content); 65 | 66 | $link.appendTo($title); 67 | $title.appendTo($li); 68 | $content.appendTo($li); 69 | $li.appendTo($searchList); 70 | }); 71 | } 72 | 73 | function launchSearch(q) { 74 | // Add class for loading 75 | $body.addClass('with-search'); 76 | $body.addClass('search-loading'); 77 | 78 | // Launch search query 79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS) 80 | .then(function(results) { 81 | displayResults(results); 82 | }) 83 | .always(function() { 84 | $body.removeClass('search-loading'); 85 | }), 1000); 86 | } 87 | 88 | function closeSearch() { 89 | $body.removeClass('with-search'); 90 | $bookSearchResults.removeClass('open'); 91 | } 92 | 93 | function launchSearchFromQueryString() { 94 | var q = getParameterByName('q'); 95 | if (q && q.length > 0) { 96 | // Update search input 97 | $searchInput.val(q); 98 | 99 | // Launch search 100 | launchSearch(q); 101 | } 102 | } 103 | 104 | function bindSearch() { 105 | // Bind DOM 106 | $searchInput = $('#book-search-input input'); 107 | $bookSearchResults = $('#book-search-results'); 108 | $searchList = $bookSearchResults.find('.search-results-list'); 109 | $searchTitle = $bookSearchResults.find('.search-results-title'); 110 | $searchResultsCount = $searchTitle.find('.search-results-count'); 111 | $searchQuery = $searchTitle.find('.search-query'); 112 | 113 | // Launch query based on input content 114 | function handleUpdate() { 115 | var q = $searchInput.val(); 116 | 117 | if (q.length == 0) { 118 | closeSearch(); 119 | } 120 | else { 121 | launchSearch(q); 122 | } 123 | } 124 | 125 | // Detect true content change in search input 126 | // Workaround for IE < 9 127 | var propertyChangeUnbound = false; 128 | $searchInput.on('propertychange', function(e) { 129 | if (e.originalEvent.propertyName == 'value') { 130 | handleUpdate(); 131 | } 132 | }); 133 | 134 | // HTML5 (IE9 & others) 135 | $searchInput.on('input', function(e) { 136 | // Unbind propertychange event for IE9+ 137 | if (!propertyChangeUnbound) { 138 | $(this).unbind('propertychange'); 139 | propertyChangeUnbound = true; 140 | } 141 | 142 | handleUpdate(); 143 | }); 144 | 145 | // Push to history on blur 146 | $searchInput.on('blur', function(e) { 147 | // Update history state 148 | if (usePushState) { 149 | var uri = updateQueryString('q', $(this).val()); 150 | history.pushState({ path: uri }, null, uri); 151 | } 152 | }); 153 | } 154 | 155 | gitbook.events.on('page.change', function() { 156 | bindSearch(); 157 | closeSearch(); 158 | 159 | // Launch search based on query parameter 160 | if (gitbook.search.isInitialized()) { 161 | launchSearchFromQueryString(); 162 | } 163 | }); 164 | 165 | gitbook.events.on('search.ready', function() { 166 | bindSearch(); 167 | 168 | // Launch search from query param at start 169 | launchSearchFromQueryString(); 170 | }); 171 | 172 | function getParameterByName(name) { 173 | var url = window.location.href; 174 | name = name.replace(/[\[\]]/g, '\\$&'); 175 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'), 176 | results = regex.exec(url); 177 | if (!results) return null; 178 | if (!results[2]) return ''; 179 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 180 | } 181 | 182 | function updateQueryString(key, value) { 183 | value = encodeURIComponent(value); 184 | 185 | var url = window.location.href; 186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), 187 | hash; 188 | 189 | if (re.test(url)) { 190 | if (typeof value !== 'undefined' && value !== null) 191 | return url.replace(re, '$1' + key + '=' + value + '$2$3'); 192 | else { 193 | hash = url.split('#'); 194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); 195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 196 | url += '#' + hash[1]; 197 | return url; 198 | } 199 | } 200 | else { 201 | if (typeof value !== 'undefined' && value !== null) { 202 | var separator = url.indexOf('?') !== -1 ? '&' : '?'; 203 | hash = url.split('#'); 204 | url = hash[0] + separator + key + '=' + value; 205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 206 | url += '#' + hash[1]; 207 | return url; 208 | } 209 | else 210 | return url; 211 | } 212 | } 213 | }); 214 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/gitbook-plugin-sharing/buttons.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | var SITES = { 3 | 'facebook': { 4 | 'label': 'Facebook', 5 | 'icon': 'fa fa-facebook', 6 | 'onClick': function(e) { 7 | e.preventDefault(); 8 | window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href)); 9 | } 10 | }, 11 | 'twitter': { 12 | 'label': 'Twitter', 13 | 'icon': 'fa fa-twitter', 14 | 'onClick': function(e) { 15 | e.preventDefault(); 16 | window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href)); 17 | } 18 | }, 19 | 'google': { 20 | 'label': 'Google+', 21 | 'icon': 'fa fa-google-plus', 22 | 'onClick': function(e) { 23 | e.preventDefault(); 24 | window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href)); 25 | } 26 | }, 27 | 'weibo': { 28 | 'label': 'Weibo', 29 | 'icon': 'fa fa-weibo', 30 | 'onClick': function(e) { 31 | e.preventDefault(); 32 | window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)); 33 | } 34 | }, 35 | 'instapaper': { 36 | 'label': 'Instapaper', 37 | 'icon': 'fa fa-instapaper', 38 | 'onClick': function(e) { 39 | e.preventDefault(); 40 | window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href)); 41 | } 42 | }, 43 | 'vk': { 44 | 'label': 'VK', 45 | 'icon': 'fa fa-vk', 46 | 'onClick': function(e) { 47 | e.preventDefault(); 48 | window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href)); 49 | } 50 | } 51 | }; 52 | 53 | 54 | 55 | gitbook.events.bind('start', function(e, config) { 56 | var opts = config.sharing; 57 | 58 | // Create dropdown menu 59 | var menu = $.map(opts.all, function(id) { 60 | var site = SITES[id]; 61 | 62 | return { 63 | text: site.label, 64 | onClick: site.onClick 65 | }; 66 | }); 67 | 68 | // Create main button with dropdown 69 | if (menu.length > 0) { 70 | gitbook.toolbar.createButton({ 71 | icon: 'fa fa-share-alt', 72 | label: 'Share', 73 | position: 'right', 74 | dropdown: [menu] 75 | }); 76 | } 77 | 78 | // Direct actions to share 79 | $.each(SITES, function(sideId, site) { 80 | if (!opts[sideId]) return; 81 | 82 | gitbook.toolbar.createButton({ 83 | icon: site.icon, 84 | label: site.text, 85 | position: 'right', 86 | onClick: site.onClick 87 | }); 88 | }); 89 | }); 90 | }); 91 | -------------------------------------------------------------------------------- /接口使用文档/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /接口使用文档/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /接口使用文档/images/其它问题2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/其它问题2.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题1.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题2.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题3.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题4.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题5.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题6-1.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题6-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题6-2.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题6.png -------------------------------------------------------------------------------- /接口使用文档/images/常见问题7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/接口使用文档/images/常见问题7.png -------------------------------------------------------------------------------- /接口使用文档/教程/005-退出登录.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 5、退出登录 · GitBook 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |

    72 |
    73 | 74 | 75 | 78 | 79 | 80 | 1382 | 1383 | 1384 |
    1385 | 1386 |
    1387 | 1388 |
    1389 | 1390 | 1391 | 1392 | 1401 | 1402 | 1403 | 1404 | 1405 |
    1406 |
    1407 | 1408 |
    1409 |
    1410 | 1411 |
    1412 | 1413 |

    退出登录

    1414 |

    调用方法:

    1415 |
    w.logout()
    1416 | 
    1417 | 1418 | 1419 |
    1420 | 1421 |
    1422 |
    1423 |
    1424 | 1425 |

    results matching ""

    1426 |
      1427 | 1428 |
      1429 |
      1430 | 1431 |

      No results matching ""

      1432 | 1433 |
      1434 |
      1435 |
      1436 | 1437 |
      1438 |
      1439 | 1440 |
      1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | 1448 | 1449 | 1450 | 1451 |
      1452 | 1453 | 1459 |
      1460 | 1461 | 1462 | 1463 | 1464 | 1465 | 1466 | 1467 | 1468 | 1469 | 1470 | 1471 | 1472 | 1473 | 1474 | 1475 | 1476 | 1477 | 1478 | 1479 | 1480 | 1481 | 1482 | 1483 | 1484 | 1485 | 1486 | 1487 | 1488 | 1489 | 1490 | 1491 | 1492 | 1493 | 1494 | 1495 | 1496 | 1497 | -------------------------------------------------------------------------------- /社区版/HTTP接口/001-必读!HTTP的使用方法.txt: -------------------------------------------------------------------------------- 1 | 1、用HTTP的方式调用的话,就不用下载任何依赖包,直接使用就是了 2 | 3 | 2、《WeChatPYAPI》就是基于这个HTTP接口封装的 4 | (1)你要想开箱即用的话,建议使用《WeChatPYAPI》 5 | (2)如果你的主语言不是Python,那么建议你使用HTTP接口 6 | 7 | 3、HTTP接口文档:https://www.showdoc.com.cn/2228290215170955 8 | 9 | 4、不一定要用图形界面工具注入(只是为了方便测试),具体查看文档“更灵活的使用方法” 10 | 11 | 5、交流QQ群:54995858 -------------------------------------------------------------------------------- /社区版/HTTP接口/WeChatApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/HTTP接口/WeChatApi.dll -------------------------------------------------------------------------------- /社区版/HTTP接口/inject_tool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/HTTP接口/inject_tool.exe -------------------------------------------------------------------------------- /社区版/HTTP接口/注入工具(图形界面版).exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/HTTP接口/注入工具(图形界面版).exe -------------------------------------------------------------------------------- /社区版/Python接口/WeChatPYAPI.cp36-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/Python接口/WeChatPYAPI.cp36-win_amd64.pyd -------------------------------------------------------------------------------- /社区版/Python接口/WeChatPYAPI.cp37-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/Python接口/WeChatPYAPI.cp37-win_amd64.pyd -------------------------------------------------------------------------------- /社区版/Python接口/WeChatPYAPI.cp38-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/Python接口/WeChatPYAPI.cp38-win_amd64.pyd -------------------------------------------------------------------------------- /社区版/Python接口/WeChatPYAPI.cp39-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/Python接口/WeChatPYAPI.cp39-win_amd64.pyd -------------------------------------------------------------------------------- /社区版/Python接口/demo.py: -------------------------------------------------------------------------------- 1 | # 如果你是Python36。请删除37、38、39的pyd文件,其他版本同理 2 | # 小提示:因为Pycharm无法识别pyd文件,这句话可能会报红,无视或配置一下就行了,不影响使用 3 | from WeChatPYAPI import WeChatPYApi 4 | 5 | import time 6 | import logging 7 | from queue import Queue 8 | import os 9 | 10 | 11 | # 当前目录路径 12 | BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 13 | 14 | 15 | logging.basicConfig(level=logging.INFO) # 日志器 16 | msg_queue = Queue() # 消息队列 17 | 18 | 19 | def on_message(msg): 20 | """消息回调,建议异步处理,防止阻塞""" 21 | print(msg) 22 | msg_queue.put(msg) 23 | 24 | 25 | def on_exit(wx_id): 26 | """退出事件回调""" 27 | print("微信({}):已退出登录,请重新登录".format(wx_id)) 28 | 29 | 30 | def main(): 31 | # 初次使用需要pip安装两个库: 32 | # pip install requests 33 | # pip install pycryptodomex 34 | 35 | # 查看帮助 36 | help(WeChatPYApi) 37 | 38 | # 实例化api对象【要多开的话就实例化多个《WeChatPYApi》对象】 39 | w = WeChatPYApi(msg_callback=on_message, exit_callback=on_exit, logger=logging) 40 | 41 | # 调试模式: 42 | # debug_pid=日志中输出的进程pid 43 | # 注意:你的微信必须使用start_wx方法登录成功后,才能使用调试模式 44 | # w = WeChatPYApi(msg_callback=on_message, exit_callback=on_exit, logger=logging, debug_pid=8256) 45 | 46 | # 启动微信【调试模式可不调用该方法】 47 | errno, errmsg = w.start_wx() 48 | # errno, errmsg = w.start_wx(path=os.path.join(BASE_DIR, "login_qrcode.png")) # 保存登录二维码 49 | if errno != 0: 50 | print(errmsg) 51 | if errmsg != "当前为调试模式,不需要调用“start_wx”": 52 | return 53 | 54 | # 这里需要阻塞,等待获取个人信息 55 | while not w.get_self_info(): 56 | time.sleep(2) 57 | 58 | my_info = w.get_self_info() 59 | print("登陆成功!") 60 | print(my_info) 61 | 62 | # 拉取列表(好友/群/公众号等)第一次拉取可能会阻塞,可以自行做异步处理 63 | # 好友列表:pull_type = 1 64 | # 群列表:pull_type = 2 65 | # 公众号列表:pull_type = 3 66 | # 其他:pull_type = 4 67 | lists = w.pull_list(pull_type=3) 68 | print(lists) 69 | 70 | # 获取群成员列表 71 | # lists = w.get_chat_room_members(to_chat_room="123@chatroom") 72 | # print(lists) 73 | 74 | # 发送文本消息 75 | w.send_text(to_wx="filehelper", msg='作者QQ:\r437382693') 76 | time.sleep(1) 77 | 78 | # 发送图片消息 79 | # w.send_img(to_wx="filehelper", path=r"C:\1.png") 80 | # time.sleep(1) 81 | 82 | # 发送卡片链接 83 | w.send_card_link( 84 | to_wx="filehelper", 85 | title="QQ", 86 | desc="437382693", 87 | target_url="http://www.baidu.com", 88 | img_url="https://img.alicdn.com/bao/uploaded/TB1AptvRKH2gK0jSZJnXXaT1FXa.png_310x310.jpg" 89 | ) 90 | 91 | # 处理消息回调 92 | while True: 93 | msg = msg_queue.get() 94 | 95 | # 收款 96 | if msg["msg_type"] == 490: 97 | is_recv = msg["detail"]["is_recv"] 98 | if is_recv: 99 | # 收款 100 | w.collection(msg_data=msg) 101 | 102 | 103 | if __name__ == '__main__': 104 | try: 105 | main() 106 | except KeyboardInterrupt: 107 | os._exit(1) 108 | 109 | -------------------------------------------------------------------------------- /社区版/Python接口/libs/WeChatApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/Python接口/libs/WeChatApi.dll -------------------------------------------------------------------------------- /社区版/Python接口/libs/inject_tool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsanshui/WeChatPYAPI/16dd43d04a3c4ab3774b73bc4d2b4148fc48c76b/社区版/Python接口/libs/inject_tool.exe --------------------------------------------------------------------------------