mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-22 14:55:18 -04:00
Rename gallery.common.js functions to conform to our naming standards
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
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
(function ($) {
|
||||
$.fn.showMessage = function(message) {
|
||||
$.fn.gallery_show_message = function(message) {
|
||||
return this.each(function(i){
|
||||
$(this).effect("highlight", {"color": "white"}, 3000);
|
||||
$(this).animate({opacity: 1.0}, 6000);
|
||||
@@ -7,7 +7,7 @@
|
||||
};
|
||||
|
||||
// Vertically align a block element's content
|
||||
$.fn.vAlign = function(container) {
|
||||
$.fn.gallery_valign = function(container) {
|
||||
return this.each(function(i){
|
||||
if (container == null) {
|
||||
container = 'div';
|
||||
@@ -22,7 +22,7 @@
|
||||
};
|
||||
|
||||
// Get the viewport size
|
||||
$.getViewportSize = function() {
|
||||
$.gallery_get_viewport_size = function() {
|
||||
return {
|
||||
width : function() {
|
||||
return $(window).width();
|
||||
@@ -37,7 +37,7 @@
|
||||
* Toggle the processing indicator, both large and small
|
||||
* @param elementID Target ID, including #, to apply .gLoadingSize
|
||||
*/
|
||||
$.fn.showLoading = function() {
|
||||
$.fn.gallery_show_loading = function() {
|
||||
return this.each(function(i){
|
||||
var size;
|
||||
switch ($(this).attr("id")) {
|
||||
@@ -52,5 +52,4 @@
|
||||
$(this).toggleClass("gLoading" + size);
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
}
|
||||
$("#gDialog").dialog(self.options);
|
||||
|
||||
$("#gDialog").showLoading();
|
||||
$("#gDialog").gallery_show_loading();
|
||||
|
||||
$.get(sHref, function(data) {
|
||||
$("#gDialog").html(data).showLoading();
|
||||
$("#gDialog").html(data).gallery_show_loading();
|
||||
|
||||
if ($("#gDialog form").length) {
|
||||
self._trigger("form_loaded", null, $("#gDialog form"));
|
||||
|
||||
@@ -1,76 +1,78 @@
|
||||
/**
|
||||
* @todo Move inline CSS out to external style sheet (theme style sheet)
|
||||
*/
|
||||
var show_full_size = function(image_url, image_width, image_height) {
|
||||
/*
|
||||
* Calculate the size of the image panel based on the size of the image and the size of the
|
||||
* window. Scale the image so the entire panel fits in the view port.
|
||||
*/
|
||||
function _auto_fit(imageWidth, imageHeight) {
|
||||
// ui-dialog gives a padding of 2 pixels
|
||||
var windowWidth = $(window).width() - 10;
|
||||
var windowHeight = $(window).height() - 10;
|
||||
(function($) {
|
||||
/**
|
||||
* @todo Move inline CSS out to external style sheet (theme style sheet)
|
||||
*/
|
||||
$.gallery_show_full_size = function(image_url, image_width, image_height) {
|
||||
/*
|
||||
* Calculate the size of the image panel based on the size of the image and the size of the
|
||||
* window. Scale the image so the entire panel fits in the view port.
|
||||
*/
|
||||
function _auto_fit(imageWidth, imageHeight) {
|
||||
// ui-dialog gives a padding of 2 pixels
|
||||
var windowWidth = $(window).width() - 10;
|
||||
var windowHeight = $(window).height() - 10;
|
||||
|
||||
/* If the width is greater then scale the image width first */
|
||||
if (imageWidth > windowWidth) {
|
||||
var ratio = windowWidth / imageWidth;
|
||||
imageWidth *= ratio;
|
||||
imageHeight *= ratio;
|
||||
}
|
||||
/* after scaling the width, check that the height fits */
|
||||
if (imageHeight > windowHeight) {
|
||||
var ratio = windowHeight / imageHeight;
|
||||
imageWidth *= ratio;
|
||||
imageHeight *= ratio;
|
||||
}
|
||||
/* If the width is greater then scale the image width first */
|
||||
if (imageWidth > windowWidth) {
|
||||
var ratio = windowWidth / imageWidth;
|
||||
imageWidth *= ratio;
|
||||
imageHeight *= ratio;
|
||||
}
|
||||
/* after scaling the width, check that the height fits */
|
||||
if (imageHeight > windowHeight) {
|
||||
var ratio = windowHeight / imageHeight;
|
||||
imageWidth *= ratio;
|
||||
imageHeight *= ratio;
|
||||
}
|
||||
|
||||
// handle the case where the calculation is almost zero (2.14e-14)
|
||||
return {
|
||||
top: Number((windowHeight - imageHeight) / 2),
|
||||
left: Number((windowWidth - imageWidth) / 2),
|
||||
width: Number(imageWidth),
|
||||
height: Number(imageHeight)
|
||||
};
|
||||
}
|
||||
// handle the case where the calculation is almost zero (2.14e-14)
|
||||
return {
|
||||
top: Number((windowHeight - imageHeight) / 2),
|
||||
left: Number((windowWidth - imageWidth) / 2),
|
||||
width: Number(imageWidth),
|
||||
height: Number(imageHeight)
|
||||
};
|
||||
}
|
||||
|
||||
var width = $(document).width();
|
||||
var height = $(document).height();
|
||||
var width = $(document).width();
|
||||
var height = $(document).height();
|
||||
|
||||
$("body").append('<div id="gFullsizeOverlay" class="ui-dialog-overlay" ' +
|
||||
'style="border: none; margin: 0; padding: 0; background-color: #000; ' +
|
||||
'position: absolute; top: 0px; left: 0px; ' +
|
||||
'width: ' + width + 'px; height: ' + height + 'px; opacity: 0.7; filter: alpha(opacity=70);' +
|
||||
'-moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; ' +
|
||||
'-moz-background-inline-policy: -moz-initial; z-index: 1001;"> </div>');
|
||||
$("body").append('<div id="gFullsizeOverlay" class="ui-dialog-overlay" ' +
|
||||
'style="border: none; margin: 0; padding: 0; background-color: #000; ' +
|
||||
'position: absolute; top: 0px; left: 0px; ' +
|
||||
'width: ' + width + 'px; height: ' + height + 'px; opacity: 0.7; filter: alpha(opacity=70);' +
|
||||
'-moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; ' +
|
||||
'-moz-background-inline-policy: -moz-initial; z-index: 1001;"> </div>');
|
||||
|
||||
var image_size = _auto_fit(image_width, image_height);
|
||||
var image_size = _auto_fit(image_width, image_height);
|
||||
|
||||
$("body").append('<div id="gFullsize" class="ui-dialog ui-widget" ' +
|
||||
'style="overflow: hidden; display: block; ' +
|
||||
'position: absolute; z-index: 1002; outline-color: -moz-use-text-color; ' +
|
||||
'outline-style: none; outline-width: 0px; ' +
|
||||
'height: ' + image_size.height + 'px; ' +
|
||||
'width: ' + image_size.width + 'px; ' +
|
||||
'top: ' + image_size.top + 'px; left: ' + image_size.left + 'px;">' +
|
||||
'<img id="gFullSizeImage" src="' + image_url + '"' +
|
||||
'height="' + image_size.height + '" width="' + image_size.width + '"/></div>');
|
||||
$("body").append('<div id="gFullsize" class="ui-dialog ui-widget" ' +
|
||||
'style="overflow: hidden; display: block; ' +
|
||||
'position: absolute; z-index: 1002; outline-color: -moz-use-text-color; ' +
|
||||
'outline-style: none; outline-width: 0px; ' +
|
||||
'height: ' + image_size.height + 'px; ' +
|
||||
'width: ' + image_size.width + 'px; ' +
|
||||
'top: ' + image_size.top + 'px; left: ' + image_size.left + 'px;">' +
|
||||
'<img id="gFullSizeImage" src="' + image_url + '"' +
|
||||
'height="' + image_size.height + '" width="' + image_size.width + '"/></div>');
|
||||
|
||||
$("#gFullsize").append('<span id="gFullsizeClose" class="fg-button ui-icon ui-state-default ' +
|
||||
'ui-icon-closethick ui-corner-all" style="z-index: 1003; position: absolute; ' +
|
||||
'right: 1em; top: 1em;"></span>');
|
||||
$("#gFullsizeClose").click(function() {
|
||||
$("#gFullsizeOverlay*").remove();
|
||||
$("#gFullsize").remove();
|
||||
});
|
||||
$(window).resize(function() {
|
||||
$("#gFullsizeOverlay").width($(document).width());
|
||||
$("#gFullsizeOverlay").height($(document).height());
|
||||
image_size = _auto_fit(image_width, image_height);
|
||||
$("#gFullsize").height(image_size.height);
|
||||
$("#gFullsize").width(image_size.width);
|
||||
$("#gFullsize").css("top", image_size.top);
|
||||
$("#gFullsize").css("left", image_size.left);
|
||||
$("#gFullSizeImage").height(image_size.height);
|
||||
$("#gFullSizeImage").width(image_size.width);
|
||||
});
|
||||
};
|
||||
$("#gFullsize").append('<span id="gFullsizeClose" class="fg-button ui-icon ui-state-default ' +
|
||||
'ui-icon-closethick ui-corner-all" style="z-index: 1003; position: absolute; ' +
|
||||
'right: 1em; top: 1em;"></span>');
|
||||
$("#gFullsizeClose").click(function() {
|
||||
$("#gFullsizeOverlay*").remove();
|
||||
$("#gFullsize").remove();
|
||||
});
|
||||
$(window).resize(function() {
|
||||
$("#gFullsizeOverlay").width($(document).width())
|
||||
.height($(document).height());
|
||||
image_size = _auto_fit(image_width, image_height);
|
||||
$("#gFullsize").height(image_size.height)
|
||||
.width(image_size.width)
|
||||
.css("top", image_size.top)
|
||||
.css("left", image_size.left);
|
||||
$("#gFullSizeImage").height(image_size.height)
|
||||
.width(image_size.width);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
@@ -391,7 +391,7 @@ function organize_dialog_init() {
|
||||
$(".gBranchText").droppable(treeDroppable);
|
||||
$(".gBranchText").click(organizeOpenFolder);
|
||||
retrieveMicroThumbs(item_id);
|
||||
//showLoading("#gDialog");
|
||||
//$.gallery_show_loading("#gDialog");
|
||||
|
||||
$("#gMicroThumbPanel").droppable(thumbDroppable);
|
||||
$("#gMicroThumbPanel").selectable(selectable);
|
||||
|
||||
@@ -17,7 +17,7 @@ $("document").ready(function() {
|
||||
zIndex: 75
|
||||
});
|
||||
|
||||
//showLoading("#gDialog");
|
||||
//$.gallery_show_loading("#gDialog");
|
||||
|
||||
$.get(href, function(data) {
|
||||
$("#gDialog").html(data);
|
||||
|
||||
@@ -14,7 +14,7 @@ $(document).ready(function(){
|
||||
$("#gSiteAdminMenu").css("display", "block");
|
||||
|
||||
// Initialize status message effects
|
||||
$("#gMessage li").showMessage();
|
||||
$("#gMessage li").gallery_show_message();
|
||||
|
||||
// Initialize modal dialogs
|
||||
$(".gDialogLink").gallery_dialog();
|
||||
@@ -24,7 +24,7 @@ $(document).ready(function(){
|
||||
|
||||
if ($("#gPhotoStream").length) {
|
||||
// Vertically align thumbs in photostream
|
||||
$(".gItem").vAlign();
|
||||
$(".gItem").gallery_valign();
|
||||
}
|
||||
|
||||
// Apply jQuery UI button css to submit inputs
|
||||
|
||||
@@ -29,7 +29,7 @@ $(document).ready(function() {
|
||||
$("#gSiteMenu").css("display", "block");
|
||||
|
||||
// Initialize status message effects
|
||||
$("#gMessage li").showMessage();
|
||||
$("#gMessage li").gallery_show_message();
|
||||
|
||||
// Initialize dialogs
|
||||
$(".gMenuLink").addClass("gDialogLink");
|
||||
@@ -53,9 +53,9 @@ $(document).ready(function() {
|
||||
// Album view only
|
||||
if ($("#gAlbumGrid").length) {
|
||||
// Vertical align thumbnails/metadata in album grid
|
||||
$(".gItem").vAlign();
|
||||
$(".gItem").gallery_valign();
|
||||
$(".gQuick").ajaxStop(function(){
|
||||
$(".gItem").vAlign();
|
||||
$(".gItem").gallery_valign();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".gFullSizeLink").click(function() {
|
||||
show_full_size("<?= $theme->item()->file_url() ?>", "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
|
||||
$.gallery_show_full_size("<?= $theme->item()->file_url() ?>", "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user