All Projects → overtrue → Share.js

overtrue / Share.js

Licence: mit
一键分享到微博、QQ空间、QQ好友、微信、腾讯微博、豆瓣、Facebook、Twitter、Linkedin、Google+、点点等

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to Share.js

aboutmeinfo-telegram-bot
ℹ️ About Me Info Bot: Share your social media and links on Telegram
Stars: ✭ 20 (-99.43%)
Mutual labels:  social, share
Vuepress Plugin Social Share
📣 Social sharing plugin for VuePress
Stars: ✭ 27 (-99.24%)
Mutual labels:  share, social
Angular Socialshare
Angular social share module, share urls and content on social networks such as facebook, google+, twitter, pinterest and more ... - http://720kb.github.io/angular-socialshare
Stars: ✭ 508 (-85.63%)
Mutual labels:  share, social
React Awesome Button
React button component. Awesome button is a 3D UI, progress, social and share enabled, animated at 60fps, light weight, performant, production ready react UI button component. 🖥️ 📱
Stars: ✭ 943 (-73.32%)
Mutual labels:  share, social
vue-socials
💬 Social media share buttons and counts for Vue.js
Stars: ✭ 32 (-99.09%)
Mutual labels:  social, share
react-custom-share
Social media share buttons for ReactJS. Use one of the built-in button themes or create a custom one from scratch.
Stars: ✭ 47 (-98.67%)
Mutual labels:  social, share
Static Social Buttons
Static Social Buttons for Sharing and Tweeting
Stars: ✭ 18 (-99.49%)
Mutual labels:  share, social
React Native Really Awesome Button
React Native button component. Awesome Button is a 3D at 60fps, progress enabled, social ready, extendable, production ready component that renders an awesome animated set of UI buttons. 📱
Stars: ✭ 988 (-72.04%)
Mutual labels:  share, social
Vue Social Share
A Vue 2.x social share component
Stars: ✭ 136 (-96.15%)
Mutual labels:  share, social
YHThirdManager
一个快速、简单、易集成、扩展性好的社交化组件。摒弃友盟等三方库,使用原生SDK。支持微信支付、微信分享、微信登录、微信授权、QQ授权、QQ分享、QQ登录、新浪授权、新浪登录、新浪分享、微博评论、微博获取、支付宝支付。极大的减小了包体积;同时加入了自动管理提示框的功能
Stars: ✭ 41 (-98.84%)
Mutual labels:  social, share
Pix
🎨 Pix is an online pixel art community where everyone can unleash their creativity on a 16x16 canvas, built with React-Native for iOS devices. 🚀
Stars: ✭ 86 (-97.57%)
Mutual labels:  social, share
Instaclone
An instagram clone created with the MERN stack
Stars: ✭ 289 (-91.82%)
Mutual labels:  social
redesocial
Projeto do Curso de Sistemas de Informação sobre Rede Social
Stars: ✭ 38 (-98.92%)
Mutual labels:  social
Agorakit
Organization tool for citizen's collectives
Stars: ✭ 309 (-91.26%)
Mutual labels:  social
anon.land
open source Imageboard just like was Voxed.net
Stars: ✭ 16 (-99.55%)
Mutual labels:  social
Podcast Ios
An open-source iOS app for listening to podcasts.
Stars: ✭ 285 (-91.94%)
Mutual labels:  social
SocialSharer
最 Pure 的社会化分享按钮
Stars: ✭ 18 (-99.49%)
Mutual labels:  share
qr
🔲 Generate QR Codes straight in your terminal!
Stars: ✭ 34 (-99.04%)
Mutual labels:  share
wp-to-diaspora
Automatically share WordPress posts on diaspora*
Stars: ✭ 15 (-99.58%)
Mutual labels:  social
Patchwork
A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB).
Stars: ✭ 3,500 (-0.96%)
Mutual labels:  social

Share.js

🚨 此项目已经年久失修,其实分享就是一个个链接而已,每个链接里传递一些内容,所以定制需求比较高的话建议自己实现,没啥难度。 URL 写法请参考:https://github.com/overtrue/share.js/blob/master/src/js/social-share.js#L56-L64

一键分享到微博、QQ空间、QQ好友、微信、腾讯微博、豆瓣、Facebook、Twitter、Linkedin、Google+、点点等社交网站。

qq20151127-1 2x

安装

有3种安装方式:

  1. 使用 npm

    npm install social-share.js
  2. 使用 bower

    bower install social-share.js
  3. 使用 cdnjs,引入 share.min.csssocial-share.min.js 两个链接就好。 (感谢 @mdluo)

  4. 手动下载或者 git clone 本项目。

使用

HTML:

<div class="social-share"></div>

<!--  css & js -->
<link rel="stylesheet" href="dist/css/share.min.css">
<script src="dist/js/social-share.min.js"></script>

// 当你使用类名为 `social-share` 时不需要手动初始化

自定义配置

所有配置可选, 通常默认就满足需求:

可用的配置有:

url                 : '', // 网址,默认使用 window.location.href
source              : '', // 来源(QQ空间会用到), 默认读取head标签:<meta name="site" content="http://overtrue" />
title               : '', // 标题,默认读取 document.title 或者 <meta name="title" content="share.js" />
origin              : '', // 分享 @ 相关 twitter 账号
description         : '', // 描述, 默认读取head标签:<meta name="description" content="PHP弱类型的实现原理分析" />
image               : '', // 图片, 默认取网页中第一个img标签
sites               : ['qzone', 'qq', 'weibo','wechat', 'douban'], // 启用的站点
disabled            : ['google', 'facebook', 'twitter'], // 禁用的站点
wechatQrcodeTitle   : '微信扫一扫:分享', // 微信二维码提示文字
wechatQrcodeHelper  : '<p>微信里点“发现”,扫一下</p><p>二维码便可将本文分享至朋友圈。</p>'

示例代码:

var $config = {
    title               : '234',
    description         : '123',
    wechatQrcodeTitle   : "微信扫一扫:分享", // 微信二维码提示文字
    wechatQrcodeHelper  : '<p>微信里点“发现”,扫一下</p><p>二维码便可将本文分享至朋友圈。</p>',
};

socialShare('.social-share-cs', $config);

以上选项均可通过标签 data-xxx 来设置:

驼峰转为中横线,如wechatQrcodeHelper 的data标签为data-wechat-qrcode-helper

禁用 google、twitter、facebook 并设置分享的描述
<div class="share-component" data-disabled="google,twitter,facebook" data-description="Share.js - 一键分享到微博,QQ空间,腾讯微博,人人,豆瓣"></div>
设置微信二维码标题
<div class="social-share" data-wechat-qrcode-title="请打开微信扫一扫"></div>
针对特定站点使用不同的属性(title, url, description,image...)
<div class="social-share" data-weibo-title="这个标题只有的分享到微博时有用,其它标题为全局标题" data-qq-title="分享到QQ时用此标题"></div>

你也可以自定义图标

使用: data-initialized="true" 标签或者 initialized 配置项来禁用自动生成icon功能。

<div class="social-share" data-initialized="true">
    <a href="#" class="social-share-icon icon-weibo"></a>
    <a href="#" class="social-share-icon icon-qq"></a>
    <a href="#" class="social-share-icon icon-qzone"></a>
</div>

以上a标题会自动加上分享链接(a 标签必须带 icon-NAME 属性,不然分享链接不会自动加上)。

如果你想在分享icon列表中内置一些元素,比如放一个收藏按钮在分享按钮的后面:

<div class="social-share">
    <a href="javascript:;" class="social-share-icon icon-heart"></a>
</div>

这样并没有实现,因为结果是所有的分享按钮都创建在了收藏按钮的后面了,这时候你就可以用 data-mode="prepend" 来确定分享按钮创建的方式。

<div class="social-share" data-mode="prepend">
    <a href="javascript:;" class="social-share-icon icon-heart"></a>
</div>

这样,所有的分享图标就会创建在容器的内容前面,反之可以用 append 创建在容器内容后面,当然这是默认的,也不需要这么做。

指定移动设备上显示的图标

<div class="share-component" data-mobile-sites="weibo,qq,qzone,tencent"></div>

当在手机上打开该页面的时候就只会显示这4个图标了。

欢迎贡献代码及提建议!

Requirejs

本插件支持使用Requirejs加载,Jquery版本参考如下:

requirejs.config({
  paths: {
    jquery: '//cdn.bootcss.com/jquery/2.2.4/jquery.min',
    share: '//cdn.bootcss.com/social-share.js/1.0.15/js/jquery.share.min'
  },
  shim: {
    share:['jquery']
  }
})

requirejs(['jquery','share'],function ($){
  $('.target').share({
    // settings
  })
})

无依赖版本直接加载即可,使用参考如下:

requirejs.config({
  paths: {
    share: '//cdn.bootcss.com/social-share.js/1.0.15/js/social-share.min'
  },
})

requirejs(['share'],function (){
//   ele:指定初始化的元素,可以是单个元素也可以是元素数组
  window.socialShare(ele,{
    // settings
  })
})

引用

本项目中二维码生成部分用到了开源组件:lrsjng/jquery-qrcode (MIT License)

贡献你的代码

安装node_modules

npm install

进入开发模式

npm run dev

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].