Plugins: Events

Plugin Events are Javascript functions that are automatically beeing called when a certain plugin or user action takes place. The onload event is for example fired when the plugin has been loaded completely.

Example

In this example we added a spinner indicating that the plugin is beeing loaded to our plugin container. First of all we created a new class spinner and added it to the plugin container. Then we added a new onload event to our plugin and used this event to remove the spinner class once the plugin has been loaded.

HTML / CSS

		<div id="plugin_container" class="spinner"></div>
 #plugin_container {
  background-color: #F1F1F1;
  border: 1px dashed #CCCCCC;
  padding: 20px;
  height:60px;
 }
 
 #plugin_container.spinner {
  background: url("http://cdn.oneall.com/img/spinner/3.gif") no-repeat scroll 50% 50% #F1F1F1; 
 }

Plugin Code

The following code is an example, you have to adapt it to your own Site.

$(document).ready(function(){	
 		oneall.api.plugins.social_link.build("plugin_container", {
  		'providers' :  ['facebook', 'google', 'twitter'], 
  		'callback_uri': 'YOUR CALLBACK_URI',
  		'css_theme_uri': 'http://cdn.oneall.com/css/api/socialize/link/themes/link_horizontal.css',
  		'user_token': 'USER_TOKEN',
  		'events' :{
				'onload' : function(){$('#plugin_container').removeClass('spinner');}		
			} 
 	});