Giter VIP home page Giter VIP logo

bitlr's Introduction

#Bitlr

A simple, lightweight jQuery plugin used to shorten a link using Bit.ly.

See a demo

##Instructions

Include jQuery and the plugin in the head or footer of your page.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    
<script src="/js/plugins/bitlr.js"></script>

Initialize the plugin and pass the function your api key, the link you want to shorten and the success callback function.

$.bitlr({
	apiKey: 'XXXXXXXXXXXXXXXXXXXXX',
	link: 'http://google.com',
	success: function(newLink) {
	    console.log(newLink);
	}
});

####Required Properties

  1. apiKey: string
    A string that defines your api key provided by Bit.ly.
  2. link: string
    A string that defines the link you'd like to shorten.
  3. success: function(newLink)
    A callback function that is triggered after the request is sucessful. The callback returns the new shortened link.

####Optional Properties

  1. anchor: bollean
    A boolean value that indicates whether or not the shortened link should be returned as an anchor (default: false).
  2. error: function()
    A callback function that is triggered after the request if the request is not sucessful.

#####Example:

$(function() {
	
	$.bitlr({
		apiKey: 'XXXXXXXXXXXXXXXXXXXXX',
		link: 'http://google.com',
		success: function(newLink) {
    		console.log(newLink);
		},
		error: function() {
			console.log('There was an error.');
		}
	});
		
});

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.