├── README.md ├── assets └── javascripts │ └── initializers │ └── chinese-sharing-sources.js.es6 ├── config └── locales │ └── client.zh_CN.yml └── plugin.rb /README.md: -------------------------------------------------------------------------------- 1 | chinese-share-links 2 | =================== 3 | 4 | 将随 Discourse 1.5 正式版被[集合插件](https://meta.discoursecn.org/localization-pack#迁移至-05-版本) 取代。Discourse 1.6 正式版后该插件会被删除。 5 | 6 | Chinese share links is a plugin for Discourse to add share links for Weibo & Renren. 7 | 8 | 为 Discourse 添加分享到微博和人人的支持。 9 | 10 | ## Installation / 安装 11 | 12 | 在 `app.yml` 的 13 | 14 | hooks: 15 | after_code: 16 | - exec: 17 | cd: $home/plugins 18 | cmd: 19 | - mkdir -p plugins 20 | - git clone https://github.com/discourse/docker_manager.git 21 | 22 | 最后一行 `- git clone https://github.com/discourse/docker_manager.git` 后添加: 23 | 24 | - git clone https://github.com/fantasticfears/chinese-share-links.git 25 | 26 | ## Usage / 使用 27 | 28 | Go to Site Settings's basic category, add services in the share_links. 29 | 30 | 进入站点设置的基本设置分类,在share_links中添加服务。 31 | 32 | ## Changelog 33 | 34 | Current version: 0.2.0 35 | 36 | 0.1.1:增加了微信支持(弹出窗口) 37 | 0.2.0:支持 Discourse 1.3 38 | 39 | 40 | -------------------------------------------------------------------------------- /assets/javascripts/initializers/chinese-sharing-sources.js.es6: -------------------------------------------------------------------------------- 1 | import Sharing from 'discourse/lib/sharing'; 2 | 3 | export default { 4 | name: 'chinese-sharing-sources', 5 | 6 | initialize() { 7 | Sharing.addSource({ 8 | id: 'weibo', 9 | faIcon: 'fa-weibo', 10 | title: I18n.t('share.weibo'), 11 | generateUrl(link, title) { 12 | return "http://service.weibo.com/share/share.php?url=" + encodeURIComponent(link) + "&title=" + encodeURIComponent(title); 13 | }, 14 | shouldOpenInPopup: true, 15 | popupHeight: 370 16 | }); 17 | 18 | Sharing.addSource({ 19 | id: 'renren', 20 | faIcon: 'fa-renren', 21 | title: I18n.t('share.renren'), 22 | generateUrl(link, title) { 23 | return "http://widget.renren.com/dialog/share?resourceUrl=" + encodeURIComponent(link) + "&title=" + encodeURIComponent(title) + "&description=" + encodeURIComponent(title); 24 | }, 25 | shouldOpenInPopup: true, 26 | popupHeight: 628 27 | }); 28 | 29 | Sharing.addSource({ 30 | id: 'wechat', 31 | faIcon: 'fa-weixin', 32 | title: I18n.t('share.wechat'), 33 | generateUrl(link) { 34 | return "http://s.jiathis.com/qrcode.php?url=" + encodeURIComponent(link); 35 | }, 36 | shouldOpenInPopup: true, 37 | popupHeight: 200 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /config/locales/client.zh_CN.yml: -------------------------------------------------------------------------------- 1 | zh_CN: 2 | js: 3 | share: 4 | weibo: '分享这个链接到微博' 5 | renren: '分享这个链接到人人网' 6 | wechat: '分享这个链接到微信' 7 | -------------------------------------------------------------------------------- /plugin.rb: -------------------------------------------------------------------------------- 1 | # name: chinese-share-links; 废弃 DEPRECATED;请迁移至集合插件 2 | # about: chinese-share-links; 废弃 DEPRECATED;请迁移至集合插件 3 | # version: 0.9 4 | # authors: Erick Guan 5 | # url: https://meta.discoursecn.org/localization-pack#迁移至-05-版本 6 | --------------------------------------------------------------------------------