diff --git a/web/index.html b/web/index.html index 471360455..0a78fdcb1 100755 --- a/web/index.html +++ b/web/index.html @@ -11,6 +11,7 @@ + - @@ -334,105 +334,103 @@ -
-
+ + diff --git a/web/javascript/common.js b/web/javascript/common.js index 5eccb4d03..f21dbbaf0 100644 --- a/web/javascript/common.js +++ b/web/javascript/common.js @@ -64,11 +64,7 @@ $(document).ready(function() { $("label[for=torrent_upload_url]").text("URL: "); } else { // Fix for non-Safari-3 browsers: dark borders to replace shadows. - // Opera messes up the menu if we use a border on .trans_menu - // div.outerbox so use ul instead - $('.trans_menu ul, div#jqContextMenu, div.dialog_container div.dialog_window').css('border', '1px solid #777'); - // and this kills the border we used to have - $('.trans_menu div.outerbox').css('border', 'none'); + $('div.dialog_container div.dialog_window').css('border', '1px solid #777'); } // Initialise the dialog controller diff --git a/web/javascript/jquery/Makefile.am b/web/javascript/jquery/Makefile.am index a0627b8c3..34970f868 100644 --- a/web/javascript/jquery/Makefile.am +++ b/web/javascript/jquery/Makefile.am @@ -4,6 +4,6 @@ dist_data_DATA = \ jquery-ui.min.js \ jquery-migrate.min.js \ jquery.min.js \ - jquery.contextmenu.min.js \ + jquery.ui-contextmenu.min.js \ jquery.transmenu.min.js \ json2.min.js diff --git a/web/javascript/jquery/jquery.contextmenu.min.js b/web/javascript/jquery/jquery.contextmenu.min.js deleted file mode 100644 index e90df8c30..000000000 --- a/web/javascript/jquery/jquery.contextmenu.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(a){function i(d,h,i,k){var l=f[d],m=i[l.eventPosY],n=i[l.eventPosX];e=a("#"+l.id).find("ul:first").clone(!0),e.css(l.menuStyle).find("li").css(l.itemStyle).hover(function(){a(this).css(l.itemHoverStyle)},function(){a(this).css(l.itemStyle)}).find("img").css({verticalAlign:"middle",paddingRight:"2px"}),b.html(e),!l.onShowMenu||(b=l.onShowMenu(i,b)),a.each(l.bindings,function(c,d){a("#"+c,b).bind("click",function(a){j(),d(h,g)})}),m+b.height()>a(window).height()&&(m=m-b.height()),n+b.width()>a(window).width()&&(n=n-b.width()),b.css({left:n,top:m}).show(),l.shadow&&c.css({width:b.width(),height:b.height(),left:i.pageX+2,top:i.pageY+2}).show(),setTimeout(function(){a(document).click(function(){return a(document).unbind("click"),j(),!1})},0)}function j(){b.hide(),c.hide()}var b,c,d,e,f,g,h={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:!0,onContextMenu:null,onShowMenu:null};a.fn.contextMenu=function(d,e){b||(b=a('
').hide().css({position:"absolute",zIndex:"500"}).appendTo("body").bind("click",function(a){a.stopPropagation()})),c||(c=a("
").css({backgroundColor:"#000",position:"absolute",opacity:.2,zIndex:499}).appendTo("body").hide()),f=f||[],f.push({id:d,menuStyle:a.extend({},h.menuStyle,e.menuStyle||{}),itemStyle:a.extend({},h.itemStyle,e.itemStyle||{}),itemHoverStyle:a.extend({},h.itemHoverStyle,e.itemHoverStyle||{}),bindings:e.bindings||{},shadow:e.shadow||e.shadow===!1?e.shadow:h.shadow,onContextMenu:e.onContextMenu||h.onContextMenu,onShowMenu:e.onShowMenu||h.onShowMenu,eventPosX:e.eventPosX||h.eventPosX,eventPosY:e.eventPosY||h.eventPosY});var g=f.length-1;return a(this).bind("contextmenu",function(a){var b=f[g].onContextMenu?f[g].onContextMenu(a):!0;return b&&i(g,this,a,e),!1}),this},a.contextMenu={defaults:function(b){a.each(b,function(b,c){typeof c=="object"&&h[b]?a.extend(h[b],c):h[b]=c})}}})(jQuery),$(function(){$("div.contextMenu").hide()}) \ No newline at end of file diff --git a/web/javascript/jquery/jquery.contextmenu.r2.js b/web/javascript/jquery/jquery.contextmenu.r2.js deleted file mode 100644 index a026a0f62..000000000 --- a/web/javascript/jquery/jquery.contextmenu.r2.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * ContextMenu - jQuery plugin for right-click context menus - * - * Author: Chris Domigan - * Contributors: Dan G. Switzer, II - * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Version: r2 - * Date: 16 July 2007 - * - * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/ - * - */ - -(function($) { - - var menu, shadow, trigger, content, hash, currentTarget; - var defaults = { - 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, options) { - if (!menu) { // Create singleton menu - menu = $('
') - .hide() - .css({position:'absolute', zIndex:'500'}) - .appendTo('body') - .bind('click', function(e) { - e.stopPropagation(); - }); - } - if (!shadow) { - shadow = $('
') - .css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499}) - .appendTo('body') - .hide(); - } - hash = hash || []; - hash.push({ - id : id, - menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}), - itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}), - itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}), - bindings: options.bindings || {}, - shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow, - onContextMenu: options.onContextMenu || defaults.onContextMenu, - onShowMenu: options.onShowMenu || defaults.onShowMenu, - eventPosX: options.eventPosX || defaults.eventPosX, - eventPosY: options.eventPosY || defaults.eventPosY - }); - - var index = hash.length - 1; - $(this).bind('contextmenu', function(e) { - // Check if onContextMenu() defined - var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true; - if (bShowContext) display(index, this, e, options); - return false; - }); - return this; - }; - - function display(index, trigger, e, options) { - var cur = hash[index]; - var top = e[cur.eventPosY]; - var left = e[cur.eventPosX]; - content = $('#'+cur.id).find('ul:first').clone(true); - content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover( - function() { - $(this).css(cur.itemHoverStyle); - }, - function(){ - $(this).css(cur.itemStyle); - } - ).find('img').css({verticalAlign:'middle',paddingRight:'2px'}); - - // Send the content to the menu - menu.html(content); - - // if there's an onShowMenu, run it now -- must run after content has been added - // if you try to alter the content variable before the menu.html(), IE6 has issues - // updating the content - if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu); - - $.each(cur.bindings, function(id, func) { - $('#'+id, menu).bind('click', function(e) { - hide(); - func(trigger, currentTarget); - }); - }); - - - if( top + menu.height() > $(window).height() ) top = top - menu.height(); - if( left + menu.width() > $(window).width() ) left = left - menu.width(); - menu.css({'left':left,'top':top}).show(); - if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show(); - - setTimeout( function() { // Delay for Mozilla - $(document).click( function() { - $(document).unbind('click'); - hide(); - return false; - }); - }, 0); - } - - function hide() { - menu.hide(); - shadow.hide(); - } - - // Apply defaults - $.contextMenu = { - defaults : function(userDefaults) { - $.each(userDefaults, function(i, val) { - if (typeof val == 'object' && defaults[i]) { - $.extend(defaults[i], val); - } - else defaults[i] = val; - }); - } - }; - -})(jQuery); - -$(function() { - $('div.contextMenu').hide(); -}); \ No newline at end of file diff --git a/web/javascript/jquery/jquery.transmenu.js b/web/javascript/jquery/jquery.transmenu.js index e05e91d4b..764c847ff 100644 --- a/web/javascript/jquery/jquery.transmenu.js +++ b/web/javascript/jquery/jquery.transmenu.js @@ -1,364 +1,99 @@ -/* transMenu - v0.1.5 (2007-07-07) - * Copyright (c) 2007 Roman Weich - * http://p.sohei.org - * - */ - -(function($) -{ - var defaults = { - onClick: function(){ - $(this).find('>a').each(function(){ - if ( this.href ) - { - window.location = this.href; - } - }); - }, - arrow_char: '►', - selected_char: '✓', - subDelay: 300, - direction: 'down', - mainDelay: 10 - }; - - var transMenuSettings; - - $.fn.transMenu = function(options) - { - var shown = false; - var liOffset = 2; - - transMenuSettings = $.extend({}, defaults, options); - - var hideDIV = function(div, delay) { - //a timer running to show the div? - if ( div.timer && !div.isVisible ) { - clearTimeout(div.timer); - } else if (div.timer) { - return; //hide-timer already running - } - if ( div.isVisible ) { - div.timer = setTimeout( function() { - //remove events - $(div).find('ul li').unbind('mouseover', liHoverIn).unbind('mouseout', liHoverOut).unbind('click', transMenuSettings.onClick); - $(div).hide(); - div.isVisible = false; - div.timer = null; - }, delay); - } - }; - - var showDIV = function(div, delay) { - if ( div.timer ) { - clearTimeout(div.timer); - } - if ( !div.isVisible ) { - div.timer = setTimeout( function() { - //check if the mouse is still over the parent item - if not dont show the submenu - if (! $(div).parent().is('.hover')) { - return; - } - //assign events to all div>ul>li-elements - $(div).find('ul li').mouseover(liHoverIn).mouseout(liHoverOut).click(transMenuSettings.onClick); - //positioning - if (! $(div).parent().is('.main')) { - $(div).css('left', $(div).parent().parent().width() - liOffset); - } - - if (transMenuSettings.direction == 'up') { - $(div).css('top', ($(div).height() * -1) + $(div).parent().parent().height()); - } - - div.isVisible = true; //we use this over :visible to speed up traversing - $(div).show(); - div.timer = null; - }, delay); - } - }; - - //same as hover.handlehover in jquery - just can't use hover() directly - need the ability to unbind only the one hover event - var testHandleHover = function(e) { - // Check if mouse(over|out) are still within the same parent element - var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; - // Traverse up the tree - while ( p && p != this ) { - try { - p = p.parentNode; - } catch(e) { - p = this; - } - } - // If we actually just moused on to a sub-element, ignore it - if ( p == this ) { - return false; - } - return true; - }; - - var mainHoverIn = function(e) { - $(this).addClass('hover').siblings('li.hover').removeClass('hover'); - if ( shown ) { - hoverIn(this, transMenuSettings.mainDelay); - } - }; - - var liHoverIn = function(e) { - if ( !testHandleHover(e) ) { - return false; - } - if ( e.target != this ) { - //look whether the target is a direct child of this (maybe an image) - if ( !isChild(this, e.target) ) { - return; - } - } - hoverIn(this, transMenuSettings.subDelay); - }; - - var hoverIn = function(li, delay) { - //stop running timers from the other menus on the same level - a little faster than $('>*>div', li.parentNode) - var n = li.parentNode.firstChild; - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType == 1 && n.nodeName.toUpperCase() == 'LI' ) { - var div = getOneChild(n, 'DIV'); - //clear show-div timer - if ( div && div.timer && !div.isVisible ) { - clearTimeout(div.timer); - div.timer = null; - } - } - } - //is there a timer running to hide one of the parent divs? stop it - var pNode = li.parentNode; - for ( ; pNode; pNode = pNode.parentNode ) { - if ( pNode.nodeType == 1 && pNode.nodeName.toUpperCase() == 'DIV' ) { - if (pNode.timer) { - clearTimeout(pNode.timer); - pNode.timer = null; - $(pNode.parentNode).addClass('hover'); - } - } - } - //highlight the current element - $(li).addClass('hover'); - var innerDiv = $(li).children('div'); - innerDiv = innerDiv.length ? innerDiv[0] : null; - //is the submenu already visible? - if ( innerDiv && innerDiv.isVisible ) { - //hide-timer running? - if ( innerDiv.timer ) { - clearTimeout(innerDiv.timer); - innerDiv.timer = null; - } else { - return; - } - } - //hide all open menus on the same level and below and unhighlight the li item (but not the current submenu!) - $(li.parentNode.getElementsByTagName('DIV')).each( function() { - if ( this != innerDiv && this.isVisible ) { - hideDIV(this, delay); - $(this.parentNode).removeClass('hover'); - } - }); - //show the submenu, if there is one - if ( innerDiv ) { - showDIV(innerDiv, delay); - } - }; - - var liHoverOut = function(e) { - if ( !testHandleHover(e) ) { - return false; - } - if ( e.target != this ) { - //return only if the target is no direct child of this - if ( !isChild(this, e.target) ) { - return; - } - } - // Remove the hover from the submenu item, if the mouse is hovering out of the - // menu (this is only for the last open (levelwise) (sub-)menu) - var div = getOneChild(this, 'DIV'); - if ( !div ) { - $(this).removeClass('hover'); - } else { - if ( !div.isVisible ) { - $(this).removeClass('hover'); - } - } - }; - - var mainHoverOut = function(e) { - //no need to test e.target==this, as no child has the same event bound - var div = getOneChild(this, 'DIV'); - var relTarget = e.relatedTarget || e.toElement; //this is undefined sometimes (e.g. when the mouse moves out of the window), so dont remove hover then - var p; - if ( !shown ) { - $(this).removeClass('hover'); - - //menuitem has no submenu, so dont remove the hover if the mouse goes outside the menu - } else if ( !div && relTarget ) { - p = $(e.target).parents('UL.trans_menu'); - if ( p.contains(relTarget)) { - $(this).removeClass('hover'); - } - } else if ( relTarget ) { - //remove hover only when moving to anywhere inside the trans_menu - p = $(e.target).parents('UL.trans_menu'); - if ( !div.isVisible && (p.contains(relTarget)) ) { - $(this).removeClass('hover'); - } - } - }; - - var mainClick = function() { - var div = getOneChild(this, 'DIV'); - //clicked on an open main-menu-item - if ( div && div.isVisible ) { - clean(); - $(this).addClass('hover'); - } else { - hoverIn(this, transMenuSettings.mainDelay); - shown = true; - $('ul.trans_menu li').addClass('active'); - $(document).bind('mousedown', checkMouse); - } - }; - - var checkMouse = function(e) { - //is the mouse inside a trans_menu? if yes, is it an open (the current) one? - var vis = false; - $(e.target).parents('UL.trans_menu').find('div').each( function(){ - if ( this.isVisible ) { - vis = true; - } - }); - if ( !vis ) { - clean(); - } - }; - - var clean = function() { - //remove timeout and hide the divs - $('ul.trans_menu div.outerbox').each(function(){ - if ( this.timer ) { - clearTimeout(this.timer); - this.timer = null; - } - if ( this.isVisible ) { - $(this).hide(); - this.isVisible = false; - } - }); - $('ul.trans_menu li').removeClass('hover'); - //remove events - $('ul.trans_menu>li li').unbind('mouseover', liHoverIn).unbind('mouseout', liHoverOut).unbind('click', transMenuSettings.onClick); - $(document).unbind('mousedown', checkMouse); - shown = false; - $('ul.trans_menu li').removeClass('active'); - }; - - var getOneChild = function(elem, name) { - if ( !elem ) { - return null; - } - var n = elem.firstChild; - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name ) { - return n; - } - } - return null; - }; - - var isChild = function(elem, childElem) { - var n = elem.firstChild; - for ( ; n; n = n.nextSibling ) { - if ( n == childElem ) { - return true; - } - } - return false; - }; - - return this.each(function() { - //add .contains() to mozilla - http://www.quirksmode.org/blog/archives/2006/01/contains_for_mo.html - if (window.Node && Node.prototype && !Node.prototype.contains) { - Node.prototype.contains = function(arg) { - return !!(this.compareDocumentPosition(arg) & 16); - }; - } - if (! $(this).is('.trans_menu')) { - $(this).addClass('trans_menu'); - } - //add shadows - $('ul', this).shadowBox(); - - //assign events - $(this).bind('closemenu', function(){clean();}); //assign closemenu-event, through wich the menu can be closed from outside the plugin - //add click event handling, if there are any elements inside the main menu - var liElems = $(this).children('li'); - for ( var j = 0; j < liElems.length; j++ ) { - if ( getOneChild(getOneChild(getOneChild(liElems[j], 'DIV'), 'UL'), 'LI') ) { - $(liElems[j]).click(mainClick); - } - } - //add hover event handling and assign classes - $(liElems).hover(mainHoverIn, mainHoverOut).addClass('main').find('>div').addClass('inner'); - //add the little arrow before each submenu - if ( transMenuSettings.arrow_char ) { - var arrow_markup = $("" + transMenuSettings.arrow_char + ''); - // Mozilla float/position hack - if ($.browser.mozilla && +$.browser.version.replace(/\./g,'').slice(0,3) < 191) { - arrow_markup.css('margin-top', '-13px'); - } - $('div.inner div.outerbox', this).before(arrow_markup); - } - - //the floating list elements are destroying the layout..so make it nice again.. - $(this).wrap('
').after('
'); - }); - }; - - $.fn.transMenu.setDefaults = function(o) { - $.extend(defaults, o); - }; - - $.fn.shadowBox = function() { - return this.each(function() { - var outer = $('
').get(0); - if ( $(this).css('position') == 'absolute' ) { - //if the child(this) is positioned abolute, we have to use relative positioning and shrink the outerbox accordingly to the innerbox - $(outer).css({position:'relative', width:this.offsetWidth, height:this.offsetHeight}); - } else { - //shrink the outerbox - $(outer).css('position', 'absolute'); - } - //add the boxes - $(this).addClass('innerBox').wrap(outer). - before('
'); - }); - }; - - $.fn.selectMenuItem = function() { - if (this.find('span.selected').length == 0) { - this.prepend($("" + transMenuSettings.selected_char + "")); - } - return this; - }; - - $.fn.deselectMenuItem = function() { - return this.find('span.selected').remove(); - }; - - $.fn.menuItemIsSelected = function() { - return (this.find('span.selected').length > 0); - }; - - $.fn.deselectMenuSiblings = function() { - this.parent().find('span.selected').remove(); - this.selectMenuItem(); - return this; - }; -})(jQuery); +/* + * This file Copyright (C) 2015 Mnemosyne LLC + * + * It may be used under the GNU GPL versions 2 or 3 + * or any future license endorsed by Mnemosyne LLC. + */ + +$.widget('tr.transMenu', $.ui.menu, { + options: { + open: null, + close: null + }, + + _create: function() { + this.selectImpl = this.options.select; + this.options.select = $.proxy(this._select, this); + this.element.hide(); + this._superApply(arguments); + }, + + _select: function(event, ui) { + if (ui.item.is("[aria-haspopup='true']")) + return; + ui.id = ui.item.attr("id"); + ui.group = ui.item.attr("radio-group"); + ui.target = $(event.currentTarget); + if (this.selectImpl(event, ui) !== false) + this.close(); + }, + + open: function(event) { + this.element.show(); + this.element.css({ position: "absolute", left: 4, top: -this.element.height() - 4 }); + + $(document).bind("keydown" + this.eventNamespace, $.proxy(function(event) { + if (event.which === $.ui.keyCode.ESCAPE) + this.close(); + }, this)); + $(document).bind("mousedown" + this.eventNamespace + " touchstart" + this.eventNamespace, $.proxy(function(event) { + if (!$(event.target).closest(".ui-menu-item").length) + this.close(); + }, this)); + + this._trigger("open", event); + }, + + close: function(event) { + $(document).unbind("keydown" + this.eventNamespace); + $(document).unbind("mousedown" + this.eventNamespace); + $(document).unbind("touchstart" + this.eventNamespace); + + this._close(this.element); + this.element.hide(); + + this._trigger("close", event); + } +}); + +(function($) +{ + function indicatorClass(type) + { + return ['ui-icon', 'ui-icon-' + type]; + } + + function findIndicator(item, type) + { + return $(item).find('span.' + indicatorClass(type).join('.')); + } + + function createIndicator(item, type) + { + $(item).prepend($("")); + } + + function indicatorType(item) + { + var group = item.attr('radio-group'); + return { type: group !== undefined ? 'bullet' : 'check', group: group }; + } + + $.fn.selectMenuItem = function() { + var t = indicatorType(this); + if (t.type == 'bullet') + this.parent().find('li[radio-group=' + t.group + '] span.' + indicatorClass(t.type).join('.')).remove(); + if (findIndicator(this, t.type).length == 0) + createIndicator(this, t.type); + return this; + }; + + $.fn.deselectMenuItem = function() { + var t = indicatorType(this); + return findIndicator(this, t.type).remove(); + }; + + $.fn.menuItemIsSelected = function() { + return findIndicator(this, 'bullet').length > 0 || findIndicator(this, 'check').length > 0; + }; +})(jQuery); diff --git a/web/javascript/jquery/jquery.transmenu.min.js b/web/javascript/jquery/jquery.transmenu.min.js index dce01452c..6398f9133 100644 --- a/web/javascript/jquery/jquery.transmenu.min.js +++ b/web/javascript/jquery/jquery.transmenu.min.js @@ -1 +1 @@ -(function(a){var b={onClick:function(){a(this).find(">a").each(function(){this.href&&(window.location=this.href)})},arrow_char:"►",selected_char:"✓",subDelay:300,direction:"down",mainDelay:10},c;a.fn.transMenu=function(d){var e=!1,f=2;c=a.extend({},b,d);var g=function(b,d){if(b.timer&&!b.isVisible)clearTimeout(b.timer);else if(b.timer)return;b.isVisible&&(b.timer=setTimeout(function(){a(b).find("ul li").unbind("mouseover",k).unbind("mouseout",m).unbind("click",c.onClick),a(b).hide(),b.isVisible=!1,b.timer=null},d))},h=function(b,d){b.timer&&clearTimeout(b.timer),b.isVisible||(b.timer=setTimeout(function(){if(!a(b).parent().is(".hover"))return;a(b).find("ul li").mouseover(k).mouseout(m).click(c.onClick),a(b).parent().is(".main")||a(b).css("left",a(b).parent().parent().width()-f),c.direction=="up"&&a(b).css("top",a(b).height()*-1+a(b).parent().parent().height()),b.isVisible=!0,a(b).show(),b.timer=null},d))},i=function(a){var b=(a.type=="mouseover"?a.fromElement:a.toElement)||a.relatedTarget;while(b&&b!=this)try{b=b.parentNode}catch(a){b=this}return b==this?!1:!0},j=function(b){a(this).addClass("hover").siblings("li.hover").removeClass("hover"),e&&l(this,c.mainDelay)},k=function(a){if(!i(a))return!1;if(a.target!=this&&!s(this,a.target))return;l(this,c.subDelay)},l=function(b,c){var d=b.parentNode.firstChild;for(;d;d=d.nextSibling)if(d.nodeType==1&&d.nodeName.toUpperCase()=="LI"){var e=r(d,"DIV");e&&e.timer&&!e.isVisible&&(clearTimeout(e.timer),e.timer=null)}var f=b.parentNode;for(;f;f=f.parentNode)f.nodeType==1&&f.nodeName.toUpperCase()=="DIV"&&f.timer&&(clearTimeout(f.timer),f.timer=null,a(f.parentNode).addClass("hover"));a(b).addClass("hover");var i=a(b).children("div");i=i.length?i[0]:null;if(i&&i.isVisible)if(i.timer)clearTimeout(i.timer),i.timer=null;else return;a(b.parentNode.getElementsByTagName("DIV")).each(function(){this!=i&&this.isVisible&&(g(this,c),a(this.parentNode).removeClass("hover"))}),i&&h(i,c)},m=function(b){if(!i(b))return!1;if(b.target!=this&&!s(this,b.target))return;var c=r(this,"DIV");c?c.isVisible||a(this).removeClass("hover"):a(this).removeClass("hover")},n=function(b){var c=r(this,"DIV"),d=b.relatedTarget||b.toElement,f;e?!c&&d?(f=a(b.target).parents("UL.trans_menu"),f.contains(d)&&a(this).removeClass("hover")):d&&(f=a(b.target).parents("UL.trans_menu"),!c.isVisible&&f.contains(d)&&a(this).removeClass("hover")):a(this).removeClass("hover")},o=function(){var b=r(this,"DIV");b&&b.isVisible?(q(),a(this).addClass("hover")):(l(this,c.mainDelay),e=!0,a("ul.trans_menu li").addClass("active"),a(document).bind("mousedown",p))},p=function(b){var c=!1;a(b.target).parents("UL.trans_menu").find("div").each(function(){this.isVisible&&(c=!0)}),c||q()},q=function(){a("ul.trans_menu div.outerbox").each(function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.isVisible&&(a(this).hide(),this.isVisible=!1)}),a("ul.trans_menu li").removeClass("hover"),a("ul.trans_menu>li li").unbind("mouseover",k).unbind("mouseout",m).unbind("click",c.onClick),a(document).unbind("mousedown",p),e=!1,a("ul.trans_menu li").removeClass("active")},r=function(a,b){if(!a)return null;var c=a.firstChild;for(;c;c=c.nextSibling)if(c.nodeType==1&&c.nodeName.toUpperCase()==b)return c;return null},s=function(a,b){var c=a.firstChild;for(;c;c=c.nextSibling)if(c==b)return!0;return!1};return this.each(function(){window.Node&&Node.prototype&&!Node.prototype.contains&&(Node.prototype.contains=function(a){return!!(this.compareDocumentPosition(a)&16)}),a(this).is(".trans_menu")||a(this).addClass("trans_menu"),a("ul",this).shadowBox(),a(this).bind("closemenu",function(){q()});var b=a(this).children("li");for(var d=0;ddiv").addClass("inner");if(c.arrow_char){var e=a(""+c.arrow_char+"");a.browser.mozilla&&+a.browser.version.replace(/\./g,"").slice(0,3)<191&&e.css("margin-top","-13px"),a("div.inner div.outerbox",this).before(e)}a(this).wrap('
').after('
')})},a.fn.transMenu.setDefaults=function(c){a.extend(b,c)},a.fn.shadowBox=function(){return this.each(function(){var b=a('
').get(0);a(this).css("position")=="absolute"?a(b).css({position:"relative",width:this.offsetWidth,height:this.offsetHeight}):a(b).css("position","absolute"),a(this).addClass("innerBox").wrap(b).before('
')})},a.fn.selectMenuItem=function(){return this.find("span.selected").length==0&&this.prepend(a(""+c.selected_char+"")),this},a.fn.deselectMenuItem=function(){return this.find("span.selected").remove()},a.fn.menuItemIsSelected=function(){return this.find("span.selected").length>0},a.fn.deselectMenuSiblings=function(){return this.parent().find("span.selected").remove(),this.selectMenuItem(),this}})(jQuery) \ No newline at end of file +$.widget("tr.transMenu",$.ui.menu,{options:{open:null,close:null},_create:function(){this.selectImpl=this.options.select,this.options.select=$.proxy(this._select,this),this.element.hide(),this._superApply(arguments)},_select:function(e,t){t.item.is("[aria-haspopup='true']")||(t.id=t.item.attr("id"),t.group=t.item.attr("radio-group"),t.target=$(e.currentTarget),this.selectImpl(e,t)!==!1&&this.close())},open:function(e){this.element.show(),this.element.css({position:"absolute",left:4,top:-this.element.height()-4}),$(document).bind("keydown"+this.eventNamespace,$.proxy(function(e){e.which===$.ui.keyCode.ESCAPE&&this.close()},this)),$(document).bind("mousedown"+this.eventNamespace+" touchstart"+this.eventNamespace,$.proxy(function(e){$(e.target).closest(".ui-menu-item").length||this.close()},this)),this._trigger("open",e)},close:function(e){$(document).unbind("keydown"+this.eventNamespace),$(document).unbind("mousedown"+this.eventNamespace),$(document).unbind("touchstart"+this.eventNamespace),this._close(this.element),this.element.hide(),this._trigger("close",e)}}),function($){function e(e){return["ui-icon","ui-icon-"+e]}function t(t,n){return $(t).find("span."+e(n).join("."))}function n(t,n){$(t).prepend($(""))}function i(e){var t=e.attr("radio-group");return{type:void 0!==t?"bullet":"check",group:t}}$.fn.selectMenuItem=function(){var s=i(this);return"bullet"==s.type&&this.parent().find("li[radio-group="+s.group+"] span."+e(s.type).join(".")).remove(),0==t(this,s.type).length&&n(this,s.type),this},$.fn.deselectMenuItem=function(){var e=i(this);return t(this,e.type).remove()},$.fn.menuItemIsSelected=function(){return t(this,"bullet").length>0||t(this,"check").length>0}}(jQuery); \ No newline at end of file diff --git a/web/javascript/jquery/jquery.ui-contextmenu.js b/web/javascript/jquery/jquery.ui-contextmenu.js new file mode 100644 index 000000000..f8245420d --- /dev/null +++ b/web/javascript/jquery/jquery.ui-contextmenu.js @@ -0,0 +1,469 @@ +/******************************************************************************* + * jquery.ui-contextmenu.js plugin. + * + * jQuery plugin that provides a context menu (based on the jQueryUI menu widget). + * + * @see https://github.com/mar10/jquery-ui-contextmenu + * + * Copyright (c) 2013-2015, Martin Wendt (http://wwWendt.de). Licensed MIT. + */ + +(function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { + // AMD. Register as an anonymous module. + define([ "jquery", "jquery-ui/menu" ], factory ); + } else { + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +"use strict"; + +var supportSelectstart = "onselectstart" in document.createElement("div"), + match = $.ui.menu.version.match(/^(\d)\.(\d+)/), + uiVersion = { + major: parseInt(match[1], 10), + minor: parseInt(match[2], 10) + }, + isLTE110 = ( uiVersion.major < 2 && uiVersion.minor < 11 ); + +$.widget("moogle.contextmenu", { + version: "@VERSION", + options: { + addClass: "ui-contextmenu", // Add this class to the outer