connect@nabeelshahid.com
  • Facebook
  • Twitter
  • Google
  • Facebook
  • Twitter
  • Google
NABEEL SHAHID, Solution Architect for Cloud Applications
  • Home
  • Projects
  • Experience
  • Blogs
    • UI/UX Designs & Layout
      • Bootstrap
      • WebFonts / Font Icons
      • jQuery Charts / Graphs Plotting
      • jQuery Dropdown Lists
      • jQuery Calenders / Date Pickers
    • Microsoft SQL Server
      • TSQL
      • SQL Server 2012
      • SQL Server 2008
      • SQL Server 2005
    • Microsoft Sharepoint
      • Sharepoint 2010
    • Desktop Development
      • Visual Basic
    • Mobile Development
      • Android Development
    • Management
      • Project Management
      • Team Management And Leadership
  • About Me
  • Contact
Select Page

jQuery Tapatar – A lightweight, extensible plugin, that lets users pick an avatar from a social network, disk, or other source

Jan 12, 2016 | UI/UX Designs & Layout, Utilities & Plug-ins | 0 comments

jQuery Tapatar – A lightweight, extensible plugin, that lets users pick an avatar from a social network, disk, or other source

 

Tapatar is a lightweight, extensible jQuery plugin, that lets users pick an avatar from a social network, disk, or other source. By default, Gravatar, Local and Facebook sources are included. Tapatar has been built to make it very easy to add additional sources.

 

jQuery Tapatar Avatar 2016-01-12_8-33-29

Getting started

First download Tapatar and add it to your project. Next initiate Tapatar, by attaching it to a hidden input:

$('input.tapatar').tapatar({  sources: {    gravatar: {      email: 'foo@bar.com'    },    facebook: {      appId: 1657455811156921    }  }});

After the user has succesfully picked an avatar from one of the sources, the image will be set as a data uri to the value of the input to which Tapatar was bound.

Tapatar options

The Tapatar object provides the following properties and methods.

Properties

PropertyTypeDescription
sourcesobjectEach object key represents a source
sources.sourceNameobjectEach object key represents a source
sources.sourceName.enabledbooleanWheter or not this source is enabled
sources.sourceName.orderintThe position at which this source will be showed in the picker
image_url_prefixstringThe path to the folder that contains the images for Tapatar. Default: ‘img/’
default_imagestring|functionEither a path, or a function returning a path to the default image.
templatesobjectAn object containing the templates for the widget, overlay, picker and source. See source for more info

Methods

MethodDescription
registerSource(TapatarSource)Use this method to add a new source at runtime
pickSource(TapatarSource)Set a specific source as the picked source. This is method is usually called from within the actual source (which has the Tapatar object set as its delegate)
imageDataSet(TapatarSource, pick)Set the image data for the input. This is method is usually called from within the actual source (which has the Tapatar object set as its delegate)

Creating your own avatar source

The TapatarSource object provides a common base to create additional sources.

Tptr.sources.placeKitten = new Tptr.TapatarSource({  id: 'placeKitten',  title: 'Placekitten',  action: {    content: 'Pick',    onClick: function(evt) {        if (this.image_data) {          this.setImageData(this.image_data, true);        }    }  },  onAdd: function() {    var url = 'https://placekitten.com/g/200/300';    var self = this;    this.downloadImage(url, function(dataUri){        if (dataUri) {          self.setImageData(dataUri);        } else {          try {            self.delegate.options.sources.placeKitten.enabled = false;          } catch(err) {}        }    })  },});

Properties

PropertyTypeDescription
idstringThe id for this source. This should correspond to the object key in the options.sources object for this source
titlestringThe source’s title
action.contentstringThe text on the “pick” button for this source
action.onClickfunctionThe click handler for the “pick” button for this source.
onAddfunctionThis callback is called when the source is added to the inited. Here you can do preliminary work, like checking if an image is available at a certain url
Inherited properties
delegateTptrA reference back to the Tptr object
image_datastringThe downloaded image data. This can be set through the setImageData() method
iconstring|functionEither a path, or a function returning a path to the icon for this source.

Methods

MethodDescription
setImageData(data, pick)Set the downloaded image data for this source
pick()Set this source as the picked source
downloadImage(url, callback)Download image data from a url

Website: https://tapfiliate.com/open-source/tapatar/

Source : https://github.com/tapfiliate/tapatar/archive/master.zip

Demo: https://tapfiliate.com/open-source/tapatar/demo/

 


 

Thanks for reading,
Nabeel Shahid.

Submit a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Job – Job Planning Lines missing Task Description
  • Notify.js – A jQuery plugin to provide simple browser based notifications with customization
  • jQuery Tapatar – A lightweight, extensible plugin, that lets users pick an avatar from a social network, disk, or other source
  • jQuery SignField – Provides signature field as jQuery component, using either a sketch pad or an uploaded signature file for E-Sign (Electronic Signature) features
  • jQuery Capitalize – A Plugin that provides capitalization for your input fields (or any other element) for proper names, places

Recent Comments

  • Mathew on Flot Charts – An attractive javascript based plotting library for jQuery!
  • SYED NABEEL SHAHID on Simple-dtpicker – Locale supported Date & Time picker – A very good jQuery plugin with lot’s of parameters
  • Micheal on Simple-dtpicker – Locale supported Date & Time picker – A very good jQuery plugin with lot’s of parameters
  • SYED NABEEL SHAHID on T-SQL script to REFRESH all views in a SQL Server Database
  • Ryan on T-SQL script to REFRESH all views in a SQL Server Database
  • Facebook
  • Twitter
  • Google

Designed by NabeelShahid [https://nabeelshahid.com]