1
0
This repository has been archived on 2021-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
gallery3-contrib/js/ui.init.js

133 lines
4.3 KiB
JavaScript
Raw Normal View History

2011-05-24 11:28:35 +00:00
/**
* Initialize jQuery UI and Gallery Plugins
*/
$(document).ready(function() {
// Initialize Superfish menus (hidden, then shown to address IE issue)
$("#g-site-menu .g-menu").hide().addClass("sf-menu");
$("#g-site-menu .g-menu").superfish({
delay: 500,
animation: {
opacity:'show',
height:'show'
},
pathClass: "g-selected",
speed: 'fast'
}).show();
// Initialize status message effects
$("#g-action-status li").gallery_show_message();
// Initialize dialogs
$(".g-dialog-link").gallery_dialog();
2011-05-24 11:28:35 +00:00
// Initialize short forms
$(".g-short-form").gallery_short_form();
// Apply jQuery UI icon, hover, and rounded corner styles
$("input[type=submit]:not(.g-short-form input)").addClass("ui-state-default ui-corner-all");
if ($("#g-view-menu").length) {
$("#g-view-menu ul").removeClass("g-menu").removeClass("sf-menu");
$("#g-view-menu a").addClass("ui-icon");
}
// Apply jQuery UI icon and hover styles to context menus
if ($(".g-context-menu").length) {
$(".g-context-menu li").addClass("ui-state-default");
$(".g-context-menu a").addClass("g-button ui-icon-left");
$(".g-context-menu a").prepend("<span class=\"ui-icon\"></span>");
$(".g-context-menu a span").each(function() {
var iconClass = $(this).parent().attr("class").match(/ui-icon-.[^\s]+/).toString();
$(this).addClass(iconClass);
});
Squashed '3.0/themes/pear4gallery3/' changes from b24d37b..11c3c2a 11c3c2a version 3.0 063ad6f move of context menu to top of thumb 0188d22 closes #4, now the form-dialog is just loaded once 508366d annoying " 4047609 fixes #8, support for slideshow duration 5ed2ff0 updated options page b65bc7b fixes #7, image animation d6d5319 Removed temporary sidebarToggle 9499b7b Attempt to fix #3, support for a sidebar 13b0419 fixes #5, issues with hovering thumbnails e0fcc41 Fix for broken slideshow, fixes #6 0bdd3c6 Fix for slideShowImages when album is empty. ca62330 Fix for broken dialogs f0d9e34 Copy of gallery.dialog.js from G3.0.0 e4a18f3 Updated jqury version. 7be51a8 Added support for breadcrumbs and sidebar (enable via theme options) fad0fe4 Hash update 9d3b519 Fix for detail hash Imgage preload a2cfa32 Fix for IE Support for using 'esc' to hide detailView 41a9863 fix so only Grid mode is supported if album does not contain any images 92c70a1 themeing the exif data 22386c3 Combined viewMode.png and removed some depricated files. dc10f0a New icons. cad0376 Fix for height of thumbs. 5c21b24 updated paginator with support for hash 6a13dab Updated theme b305613 fix for pageheight, with paginator ae87410 lNavBar fix 751bd86 New ui-theme 9a937a1 first attempt for item-option-overlay d024eba Fix for setTimeout. e167b2d JSLint take 2, reoder function reorder 82e0f38 Reindent and JSLint take 1. git-subtree-dir: 3.0/themes/pear4gallery3 git-subtree-split: 11c3c2ac87bc21b5daf5384e32d77492c5d6779a
2012-01-10 14:07:23 +00:00
$("ul.g-context-menu > li a span").addClass("ui-icon-carat-1-s");
2011-05-24 11:28:35 +00:00
}
// Remove titles for menu options since we're displaying that text anyway
$(".sf-menu a, .sf-menu li").removeAttr("title");
// Album and search results views
if ($("#g-album-grid").length) {
// Set equal height for album items and vertically align thumbnails/metadata
$('.g-item').equal_heights().gallery_valign();
// Initialize thumbnail hover effect
$(".g-item").hover(
function() {
// Insert a placeholder to hold the item's position in the grid
var placeHolder = $(this).clone().attr("id", "g-place-holder");
$(this).after($(placeHolder));
// Style and position the hover item
var position = $(this).position();
$(this).css("top", position.top).css("left", position.left);
$(this).addClass("g-hover-item");
// Initialize the contextual menu
$(this).gallery_context_menu();
// Set the hover item's height
$(this).height("auto");
var context_menu = $(this).find(".g-context-menu");
var adj_height = $(this).height() + context_menu.height();
if ($(this).next().height() > $(this).height()) {
$(this).height($(this).next().height());
} else if ($(this).prev().height() > $(this).height()) {
$(this).height($(this).prev().height());
} else {
$(this).height(adj_height);
}
},
function() {
// Reset item height and position
if ($(this).next().height()) {
var sib_height = $(this).next().height();
} else {
var sib_height = $(this).prev().height();
}
if ($.browser.msie && $.browser.version >= 8) {
sib_height = sib_height + 1;
}
$(this).css("height", sib_height);
$(this).css("position", "relative");
$(this).css("top", 0).css("left", 0);
// Remove the placeholder and hover class from the item
$(this).removeClass("g-hover-item");
$(this).gallery_valign();
$("#g-place-holder").remove();
}
);
// Realign any thumbnails that change so that when we rotate a thumb it stays centered.
$(".g-item").bind("gallery.change", function() {
$(".g-item").each(function() {
$(this).height($(this).find("img").height() + 2);
});
$(".g-item").equal_heights().gallery_valign();
});
}
// Photo/Item item view
if ($("#g-photo,#g-movie").length) {
// Ensure the resized image fits within its container
$("#g-photo,#g-movie").gallery_fit_photo();
// Initialize context menus
$("#g-photo,#g-movie").hover(function(){
$(this).gallery_context_menu();
});
// Add scroll effect for links to named anchors
$.localScroll({
queue: true,
duration: 1000,
hash: true
});
$(this).find(".g-dialog-link").gallery_dialog();
$(this).find(".g-ajax-link").gallery_ajax();
}
// Initialize button hover effect
$.fn.gallery_hover_init();
});