clipbucket/upload/js/jquery_plugs/jquery.cbphoto-actions.js
Fawaz ef791c0b7c Fixed : Admin Area Recreate thumbs page
Added : Set as avatar code
Added : Avatar Collection for user
Added : new param avatar_collection in get_collections() method
Fixed : crop value in thumbs_dimensions
Added : is_avatar param in get_photos() method
Added : photo_dimensions filter in generate_photos() method
Fixed : insert_photo() method
Moved : insert_photo_colors in insert_photo() method from view_item.php page
Updated : get_image_type() method
Updated : getFileSmarty() method
Added : An anchor in getFileSmarty() 'photo_thumb'
Fixed : cropping cases in resizer.class.php
Updated : $Upload->upload_user_file to upload_new_avatar
Removed : cb_create_user_avatar_collection() from common.php
Registered : delete_photo_avatar() function @delete_photo
Added : validate_image_file() function. It uses our old image.class.php method
Added : get_mature_thumb() function. It has three parameters, object_array, size, output. You can also register custom thumb @mature_thumb
Added : Few new functions for photos. get_all_custom_size_photos(), get_photo_dimensions(), clean_custom_photo_size(), get_avatar_photos() and is_photo_viewable()
Added : new js function, displayConfirm(). It accepts four parameters. id( modal box id), confirmMessage( modal box body), onConfirm( either url or function ) and heading(modal box header)
2012-05-28 07:10:27 +00:00

92 lines
No EOL
2.2 KiB
JavaScript

(function($){
$.clipbucket = $.clipbucket || {
'prefix' : 'cb-',
'version' : '1.0'
};
$.clipbucket.photo_actions = {
version : '1.0',
prefix : 'photo-actions-',
_this : null,
options : {
menu_items : null ,
menu_wrapper : "<ul></ul>",
menu_item : "<li></li>"
}
}
function CBPhotoActions ( element, options ) {
var _this = this;
ActionsSelf( _this );
if ( options.menu_items == null ) {
return false; // No menu items provided return
}
menu = $( options.menu_wrapper).attr({
id : getID('wrapper')
}).addClass('cbphoto-actions-wrapper nav nav-list');
$.each( options.menu_items, function( index, val ) {
if ( val.href && val.text ) {
item = $( options.menu_item ).attr({
id : getID('item-'+index)
}).addClass('cbphoto-actions-item');
link = $("<a>").attr({
href : val.href,
target : val.target || null,
style : val.style || null
}).html( val.text );
if ( val.icon ) {
link.html(' '+link.html());
icon = $("<i>").addClass('icon-'+val.icon).prependTo( link );
}
if ( val.tags && typeof val.tags == 'object' ) {
link.attr( val.tags );
}
link.appendTo( item );
item.appendTo( menu );
}
});
menu.appendTo( element );
/*
href, target, style, name, class
*/
}
function getPrefix() {
return $.clipbucket.prefix+$.clipbucket.photo_actions.prefix;
}
function getID(id) {
return getPrefix()+id;
}
function ActionsSelf( set ) {
if ( set ) {
$.clipbucket.photo_actions._this = set;
}
return $.clipbucket.photo_actions._this;
}
// jQuery
$.fn.photoactions = function(options) {
var actions = $(this).data("photoactions");
if ( actions ) {
return actions;
}
options = $.extend( true, {}, $.clipbucket.photo_actions.options, options );
this.each(function(){
actions = new CBPhotoActions( $(this), options );
$(this).data("photoactions",actions);
});
return options.actions ? actions : this;
}
})(jQuery);