Changeset 12789


Ignore:
Timestamp:
Aug 29, 2011, 8:28:19 PM (10 years ago)
Author:
jordan
Message:

#4455 'Action on N>1 torrents doesn't work properly in web interface' -- fix bug in jquery.contextmenu that clobbered jQuery.delegate bindings.

Location:
trunk/web/javascript/jquery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/javascript/jquery/jquery.contextmenu.min.js

    r11679 r12789  
    1 (function($){var _1,_2,_3,_4,_5,_6;var _7={menuStyle:{listStyle:"none",padding:"1px",margin:"0px",backgroundColor:"#fff",border:"1px solid #999",width:"100px"},itemStyle:{margin:"0px",color:"#000",display:"block",cursor:"default",padding:"3px",border:"1px solid #fff",backgroundColor:"transparent"},itemHoverStyle:{border:"1px solid #0a246a",backgroundColor:"#b6bdd2"},eventPosX:"pageX",eventPosY:"pageY",shadow:true,onContextMenu:null,onShowMenu:null};$.fn.contextMenu=function(id,_8){if(!_1){_1=$("<div id=\"jqContextMenu\"></div>").hide().css({position:"absolute",zIndex:"500"}).appendTo("body").bind("click",function(e){e.stopPropagation();});}if(!_2){_2=$("<div></div>").css({backgroundColor:"#000",position:"absolute",opacity:0.2,zIndex:499}).appendTo("body").hide();}_5=_5||[];_5.push({id:id,menuStyle:$.extend({},_7.menuStyle,_8.menuStyle||{}),itemStyle:$.extend({},_7.itemStyle,_8.itemStyle||{}),itemHoverStyle:$.extend({},_7.itemHoverStyle,_8.itemHoverStyle||{}),bindings:_8.bindings||{},shadow:_8.shadow||_8.shadow===false?_8.shadow:_7.shadow,onContextMenu:_8.onContextMenu||_7.onContextMenu,onShowMenu:_8.onShowMenu||_7.onShowMenu,eventPosX:_8.eventPosX||_7.eventPosX,eventPosY:_8.eventPosY||_7.eventPosY});var _9=_5.length-1;$(this).bind("contextmenu",function(e){var _a=(!!_5[_9].onContextMenu)?_5[_9].onContextMenu(e):true;if(_a){_b(_9,this,e,_8);}return false;});return this;};function _b(_c,_d,e,_e){var _f=_5[_c];var top=e[_f.eventPosY];var _10=e[_f.eventPosX];_4=$("#"+_f.id).find("ul:first").clone(true);_4.css(_f.menuStyle).find("li").css(_f.itemStyle).hover(function(){$(this).css(_f.itemHoverStyle);},function(){$(this).css(_f.itemStyle);}).find("img").css({verticalAlign:"middle",paddingRight:"2px"});_1.html(_4);if(!!_f.onShowMenu){_1=_f.onShowMenu(e,_1);}$.each(_f.bindings,function(id,_11){$("#"+id,_1).bind("click",function(e){_12();_11(_d,_6);});});if(top+_1.height()>$(window).height()){top=top-_1.height();}if(_10+_1.width()>$(window).width()){_10=_10-_1.width();}_1.css({"left":_10,"top":top}).show();if(_f.shadow){_2.css({width:_1.width(),height:_1.height(),left:e.pageX+2,top:e.pageY+2}).show();}setTimeout(function(){$(document).click(function(){$(document).unbind("click");_12();return false;});},0);};function _12(){_1.hide();_2.hide();};$.contextMenu={defaults:function(_13){$.each(_13,function(i,val){if(typeof val=="object"&&_7[i]){$.extend(_7[i],val);}else{_7[i]=val;}});}};})(jQuery);$(function(){$("div.contextMenu").hide();});
     1(function(f){var a,j,c,h,e,b;var d={menuStyle:{listStyle:"none",padding:"1px",margin:"0px",backgroundColor:"#fff",border:"1px solid #999",width:"100px"},itemStyle:{margin:"0px",color:"#000",display:"block",cursor:"default",padding:"3px",border:"1px solid #fff",backgroundColor:"transparent"},itemHoverStyle:{border:"1px solid #0a246a",backgroundColor:"#b6bdd2"},eventPosX:"pageX",eventPosY:"pageY",shadow:true,onContextMenu:null,onShowMenu:null};f.fn.contextMenu=function(m,l){if(!a){a=f('<div id="jqContextMenu"></div>').hide().css({position:"absolute",zIndex:"500"}).appendTo("body").bind("click",function(n){n.stopPropagation()})}if(!j){j=f("<div></div>").css({backgroundColor:"#000",position:"absolute",opacity:0.2,zIndex:499}).appendTo("body").hide()}e=e||[];e.push({id:m,menuStyle:f.extend({},d.menuStyle,l.menuStyle||{}),itemStyle:f.extend({},d.itemStyle,l.itemStyle||{}),itemHoverStyle:f.extend({},d.itemHoverStyle,l.itemHoverStyle||{}),bindings:l.bindings||{},shadow:l.shadow||l.shadow===false?l.shadow:d.shadow,onContextMenu:l.onContextMenu||d.onContextMenu,onShowMenu:l.onShowMenu||d.onShowMenu,eventPosX:l.eventPosX||d.eventPosX,eventPosY:l.eventPosY||d.eventPosY});var k=e.length-1;f(this).bind("contextmenu",function(o){var n=(!!e[k].onContextMenu)?e[k].onContextMenu(o):true;if(n){i(k,this,o,l)}return false});return this};function i(m,l,p,k){var q=e[m];var o=p[q.eventPosY];var n=p[q.eventPosX];h=f("#"+q.id).find("ul:first").clone(true);h.css(q.menuStyle).find("li").css(q.itemStyle).hover(function(){f(this).css(q.itemHoverStyle)},function(){f(this).css(q.itemStyle)}).find("img").css({verticalAlign:"middle",paddingRight:"2px"});a.html(h);if(!!q.onShowMenu){a=q.onShowMenu(p,a)}f.each(q.bindings,function(s,r){f("#"+s,a).bind("click",function(t){g();r(l,b)})});if(o+a.height()>f(window).height()){o=o-a.height()}if(n+a.width()>f(window).width()){n=n-a.width()}a.css({left:n,top:o}).show();if(q.shadow){j.css({width:a.width(),height:a.height(),left:p.pageX+2,top:p.pageY+2}).show()}setTimeout(function(){f(document).click(function(){a.unbind("click");g();return false})},0)}function g(){a.hide();j.hide()}f.contextMenu={defaults:function(k){f.each(k,function(l,m){if(typeof m=="object"&&d[l]){f.extend(d[l],m)}else{d[l]=m}})}}})(jQuery);$(function(){$("div.contextMenu").hide()});
  • trunk/web/javascript/jquery/jquery.contextmenu.r2.js

    r11679 r12789  
    126126    setTimeout( function() { // Delay for Mozilla
    127127                $(document).click( function() {
    128                         $(document).unbind('click');
     128                        menu.unbind('click');
    129129                        hide();
    130130                        return false;
Note: See TracChangeset for help on using the changeset viewer.