mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
Update to jquery ui 1.10.3
Fix conflict & ui bugs Remove debug
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
* Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com)
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* This basically means you can use this code however you want for
|
||||
* free, but don't claim to have written it yourself!
|
||||
* Donations always accepted: http://www.JavascriptToolbox.com/donate/
|
||||
*
|
||||
*
|
||||
* Please do not link to the .js files on javascripttoolbox.com from
|
||||
* your site. Copy the files locally to your server instead.
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* jquery.contextmenu.js
|
||||
@@ -16,7 +16,7 @@
|
||||
* http://www.JavascriptToolbox.com/lib/contextmenu/
|
||||
*
|
||||
* Copyright (c) 2008 Matt Kruse (javascripttoolbox.com)
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*
|
||||
* @version 1.0
|
||||
* @history 1.0 2008-10-20 Initial Release
|
||||
@@ -33,7 +33,7 @@
|
||||
//
|
||||
openEvt:"contextmenu", // ouverture sur right-click
|
||||
closeTimer:null, // fermer le menu apres 100ms de mouseout
|
||||
|
||||
|
||||
shadow:true,
|
||||
dropDown:false,
|
||||
shadowOffset:0,
|
||||
@@ -50,14 +50,14 @@
|
||||
appendTo:'body',
|
||||
direction:'down',
|
||||
constrainToScreen:true,
|
||||
|
||||
|
||||
showTransition:'show',
|
||||
hideTransition:'hide',
|
||||
showSpeed:'',
|
||||
hideSpeed:'',
|
||||
showCallback:null,
|
||||
hideCallback:null,
|
||||
|
||||
|
||||
className:'context-menu',
|
||||
itemClassName:'context-menu-item',
|
||||
itemHoverClassName:'context-menu-item-hover',
|
||||
@@ -75,15 +75,15 @@
|
||||
bgiframe:null, // The iframe object for IE6
|
||||
shown:false, // Currently being shown?
|
||||
useIframe:/*@cc_on @*//*@if (@_win32) true, @else @*/false,/*@end @*/ // This is a better check than looking at userAgent!
|
||||
|
||||
|
||||
// Create the menu instance
|
||||
create: function(menu,opts) {
|
||||
var cmenu = $.extend({},this,opts); // Clone all default properties to created object
|
||||
|
||||
|
||||
// If a selector has been passed in, then use that as the menu
|
||||
if (typeof menu=="string") {
|
||||
cmenu.menu = $(menu);
|
||||
}
|
||||
}
|
||||
// If a function has been passed in, call it each time the menu is shown to create the menu
|
||||
else if (typeof menu=="function") {
|
||||
cmenu.menuFunction = menu;
|
||||
@@ -96,7 +96,7 @@
|
||||
cmenu.menu.css({display:'none'});
|
||||
$(cmenu.appendTo).append(cmenu.menu);
|
||||
}
|
||||
|
||||
|
||||
// Create the shadow object if shadow is enabled
|
||||
if (cmenu.shadow) {
|
||||
cmenu.createShadow(cmenu); // Extracted to method for extensibility
|
||||
@@ -105,7 +105,7 @@
|
||||
$('body').bind(cmenu.openEvt,function(){cmenu.hide();}); // If right-clicked somewhere else in the document, hide this menu
|
||||
return cmenu;
|
||||
},
|
||||
|
||||
|
||||
// Create an iframe object to go behind the menu
|
||||
createIframe: function() {
|
||||
return $('<iframe frameborder="0" tabindex="-1" src="javascript:false" style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=0);"/>');
|
||||
@@ -120,7 +120,7 @@
|
||||
var $tr = $('<tr></tr>');
|
||||
var $td = $('<td></td>');
|
||||
var $div = cmenu._div = $('<div class="'+className+'"></div>');
|
||||
|
||||
|
||||
cmenu._div.hover(
|
||||
function()
|
||||
{
|
||||
@@ -136,15 +136,15 @@
|
||||
function timerRelay()
|
||||
{
|
||||
myClass.hide();
|
||||
}
|
||||
}
|
||||
myClass.closeTimer = setTimeout(timerRelay, 500);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Each menu item is specified as either:
|
||||
// title:function
|
||||
// or title: { property:value ... }
|
||||
/*
|
||||
/*
|
||||
for (var i=0; i<menu.length; i++) {
|
||||
var m = menu[i];
|
||||
if (m==$.contextMenu.separator) {
|
||||
@@ -175,7 +175,7 @@
|
||||
$t.append($tr.append($td.append($div)));
|
||||
return $t;
|
||||
},
|
||||
|
||||
|
||||
// Create an individual menu item
|
||||
createMenuItem: function(obj) {
|
||||
var cmenu = this;
|
||||
@@ -224,49 +224,49 @@
|
||||
$div.append($idiv);
|
||||
return $div;
|
||||
},
|
||||
|
||||
|
||||
// Create a separator row
|
||||
createSeparator: function() {
|
||||
return $('<div class="'+this.separatorClassName+'"></div>');
|
||||
},
|
||||
|
||||
|
||||
// Determine if an individual item is currently disabled. This is called each time the item is hovered or clicked because the disabled status may change at any time
|
||||
isItemDisabled: function(item) { return $(item).is('.'+this.disabledItemClassName); },
|
||||
|
||||
|
||||
// Functions to fire on hover. Extracted to methods for extensibility
|
||||
hoverItem: function(c) { $(this).addClass(c); },
|
||||
hoverItemOut: function(c) { $(this).removeClass(c); },
|
||||
|
||||
|
||||
// Create the shadow object
|
||||
createShadow: function(cmenu) {
|
||||
cmenu.shadowObj = $('<div class="'+cmenu.shadowClass+'"></div>').css( {display:'none',position:"absolute", zIndex:9998, opacity:cmenu.shadowOpacity, backgroundColor:cmenu.shadowColor } );
|
||||
$(cmenu.appendTo).append(cmenu.shadowObj);
|
||||
},
|
||||
|
||||
|
||||
// Display the shadow object, given the position of the menu itself
|
||||
showShadow: function(x,y,e) {
|
||||
var cmenu = this;
|
||||
if (cmenu.shadow) {
|
||||
cmenu.shadowObj.css( {
|
||||
width:(cmenu.menu.width()+cmenu.shadowWidthAdjust)+"px",
|
||||
height:(cmenu.menu.height()+cmenu.shadowHeightAdjust)+"px",
|
||||
top:(y+cmenu.shadowOffsetY)+"px",
|
||||
width:(cmenu.menu.width()+cmenu.shadowWidthAdjust)+"px",
|
||||
height:(cmenu.menu.height()+cmenu.shadowHeightAdjust)+"px",
|
||||
top:(y+cmenu.shadowOffsetY)+"px",
|
||||
left:(x+cmenu.shadowOffsetX)+"px"
|
||||
}).addClass(cmenu.shadowClass)[cmenu.showTransition](cmenu.showSpeed);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// A hook to call before the menu is shown, in case special processing needs to be done.
|
||||
// Return false to cancel the default show operation
|
||||
beforeShow: function() { return true; },
|
||||
|
||||
|
||||
// Show the context menu
|
||||
show: function(t,e) {
|
||||
var cmenu=this, x=e.pageX, y=e.pageY;
|
||||
|
||||
|
||||
if(cmenu._div)
|
||||
cmenu._div.css('height', 'auto').css('overflow-y', 'auto');
|
||||
|
||||
|
||||
cmenu.target = t; // Preserve the object that triggered this context menu so menu item click methods can see it
|
||||
cmenu._showEvent = e; // Preserve the event that triggered this context menu so menu item click methods can see it
|
||||
if (cmenu.beforeShow()!==false) {
|
||||
@@ -288,9 +288,9 @@
|
||||
if(cmenu.dropDown)
|
||||
{
|
||||
$c.css('visibility','hidden').show();
|
||||
|
||||
|
||||
var bodySize = {x:$(window).width(), y:$(window).height()};
|
||||
|
||||
|
||||
if($(t).offset().top+$(t).outerHeight()+$c.height()>bodySize.y)
|
||||
{
|
||||
if($(t).offset().left+$(t).outerWidth()+$c.width()>bodySize.x)
|
||||
@@ -305,7 +305,7 @@
|
||||
$c.css( {top:($(t).offset().top+$(t).outerHeight())+"px", left:($(t).offset().left-$c.outerWidth())+"px", position:"absolute",zIndex:9999} )[cmenu.showTransition](cmenu.showSpeed,((cmenu.showCallback)?function(){cmenu.showCallback.call(cmenu);}:null));
|
||||
else
|
||||
$c.css( {top:($(t).offset().top+$(t).outerHeight())+"px", left:($(t).offset().left)+"px", position:"absolute",zIndex:9999} )[cmenu.showTransition](cmenu.showSpeed,((cmenu.showCallback)?function(){cmenu.showCallback.call(cmenu);}:null));
|
||||
|
||||
|
||||
}$c.css('visibility','visible');
|
||||
}
|
||||
else
|
||||
@@ -314,7 +314,7 @@
|
||||
$(document).one('click',null,function(){cmenu.hide();}); // Handle a single click to the document to hide the menu
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// Find the position where the menu should appear, given an x,y of the click event
|
||||
getPosition: function(clickX,clickY,cmenu,e) {
|
||||
var x = clickX+cmenu.offsetX;
|
||||
@@ -358,7 +358,7 @@
|
||||
{
|
||||
// menu ok en bas
|
||||
}
|
||||
|
||||
|
||||
var maxRight = x+w-$w.scrollLeft();
|
||||
if (maxRight > ww)
|
||||
{
|
||||
@@ -367,7 +367,7 @@
|
||||
}
|
||||
return {'x':x,'y':y};
|
||||
},
|
||||
|
||||
|
||||
// Hide the menu, of course
|
||||
hide: function() {
|
||||
var cmenu=this;
|
||||
@@ -379,7 +379,7 @@
|
||||
cmenu.shown = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// This actually adds the .contextMenu() function to the jQuery namespace
|
||||
$.fn.contextMenu = function(menu,options) {
|
||||
var cmenu = $.contextMenu.create(menu,options);
|
||||
|
Reference in New Issue
Block a user