Code Monkey home page Code Monkey logo

emilioicai.com.emilioicai.socialshare's Introduction

com.emilioicai.socialShare

What is this?

This widget is a standalone sharing buttons bar for the most popular social networks and messaging apps. It allows users to share a predefined string.

Usage

To include the widget in your app with Alloy just add this tag into your view:

<Require type="widget" src="com.emilioicai.socialShare" id="socialShare"/>

init(config)

Initializes the social sharing buttons. Config can contain the following properties:

  • text: text to be shared in all the social networks or messaging apps
  • title: title of the social post (where it makes sense i.e. facebook)
  • url: link to be added to the social post
  • picture: image included in the social post (where it makes sense i.e. facebook)
  • email.subject: subject to be added when sharing by email
  • email.errorMsg: error message to be displayed if the email client is not available in the device
  • twitter.errorMsg: error message to be displayed if twitter is not available in the device
  • twitter.text: text to be included in the tweet (optional, if not specified the general one will be twitted)
  • facebook.errorMsg: error message to be displayed if facebook is not available in the device
  • whatsapp.errorMsg: error message to be displayed if whatsapp is not available in the device
  • onSuccess: callback to be fired in case the sharing was successful

Example

<Require type="widget" src="com.emilioicai.socialShare" id="socialShare"/>
var shareUrl = "http://9gag.com";
var textForSocialPost = "Check this out!";
var title = "The best site in the interwebs";
var picture = "http://9gag.com/logo.jpg";
var socialOptions = {
	top: 5,
	text: textForSocialPost,
	title: title,
	url: shareUrl,
	picture: picture,
	email: {
		subject: L('sharing_emailsubject'),
		errorMsg: L('mail_not_supported_body')
	},
	twitter: {
		errorMsg: L('twitter_error'),
		text: textForSocialPost + " @9gag"
	},
	facebook: {
		errorMsg: L('facebook_error')
	},
	whatsapp: {
		errorMsg: L('no_whatsapp')
	},
	onSuccess: function(){}
};
$.socialShare.init(socialOptions);

emilioicai.com.emilioicai.socialshare's People

Contributors

emilioicai avatar

Watchers

James Cloos avatar Brenton House avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.