mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
and have some basic namespacing: showMessage --> gallery_show_message vAlign --> gallery_valign showLoading --> gallery_show_loading Convert gallery.show_full_size.js to be a jQuery function and give it a namespace: show_full_size --> gallery_show_full_size
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
(function ($) {
|
|
$.fn.gallery_show_message = function(message) {
|
|
return this.each(function(i){
|
|
$(this).effect("highlight", {"color": "white"}, 3000);
|
|
$(this).animate({opacity: 1.0}, 6000);
|
|
});
|
|
};
|
|
|
|
// Vertically align a block element's content
|
|
$.fn.gallery_valign = function(container) {
|
|
return this.each(function(i){
|
|
if (container == null) {
|
|
container = 'div';
|
|
}
|
|
$(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
|
|
var el = $(this).children(container + ":first");
|
|
var elh = $(el).height();
|
|
var ph = $(this).height();
|
|
var nh = (ph - elh) / 2;
|
|
$(el).css('margin-top', nh);
|
|
});
|
|
};
|
|
|
|
// Get the viewport size
|
|
$.gallery_get_viewport_size = function() {
|
|
return {
|
|
width : function() {
|
|
return $(window).width();
|
|
},
|
|
height : function() {
|
|
return $(window).height();
|
|
}
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Toggle the processing indicator, both large and small
|
|
* @param elementID Target ID, including #, to apply .gLoadingSize
|
|
*/
|
|
$.fn.gallery_show_loading = function() {
|
|
return this.each(function(i){
|
|
var size;
|
|
switch ($(this).attr("id")) {
|
|
case "#gDialog":
|
|
case "#gPanel":
|
|
size = "Large";
|
|
break;
|
|
default:
|
|
size = "Small";
|
|
break;
|
|
}
|
|
$(this).toggleClass("gLoading" + size);
|
|
});
|
|
};
|
|
})(jQuery);
|