1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
|
(function(e,t){function v(e){var t=e.split(/\s+/),n=[];for(var r=0,i;i=t[r];r++){i=i[0].toUpperCase();n.push(i)}return n}function m(t){return t.id&&e('label[for="'+t.id+'"]').val()||t.name}function g(n,r,i){if(!i){i=0}r.each(function(){var r=e(this),s=this,o=this.nodeName.toLowerCase(),u,a;if(o=="label"&&r.find("input, textarea, select").length){u=r.text();r=r.children().first();s=r.get(0);o=s.nodeName.toLowerCase()}switch(o){case"menu":a={name:r.attr("label"),items:{}};i=g(a.items,r.children(),i);break;case"a":case"button":a={name:r.text(),disabled:!!r.attr("disabled"),callback:function(){return function(){r.click()}}()};break;case"menuitem":case"command":switch(r.attr("type")){case t:case"command":case"menuitem":a={name:r.attr("label"),disabled:!!r.attr("disabled"),callback:function(){return function(){r.click()}}()};break;case"checkbox":a={type:"checkbox",disabled:!!r.attr("disabled"),name:r.attr("label"),selected:!!r.attr("checked")};break;case"radio":a={type:"radio",disabled:!!r.attr("disabled"),name:r.attr("label"),radio:r.attr("radiogroup"),value:r.attr("id"),selected:!!r.attr("checked")};break;default:a=t}break;case"hr":a="-------";break;case"input":switch(r.attr("type")){case"text":a={type:"text",name:u||m(s),disabled:!!r.attr("disabled"),value:r.val()};break;case"checkbox":a={type:"checkbox",name:u||m(s),disabled:!!r.attr("disabled"),selected:!!r.attr("checked")};break;case"radio":a={type:"radio",name:u||m(s),disabled:!!r.attr("disabled"),radio:!!r.attr("name"),value:r.val(),selected:!!r.attr("checked")};break;default:a=t;break}break;case"select":a={type:"select",name:u||m(s),disabled:!!r.attr("disabled"),selected:r.val(),options:{}};r.children().each(function(){a.options[this.value]=e(this).text()});break;case"textarea":a={type:"textarea",name:u||m(s),disabled:!!r.attr("disabled"),value:r.val()};break;case"label":break;default:a={type:"html",html:r.clone(true)};break}if(a){i++;n["key"+i]=a}});return i}e.support.htmlMenuitem="HTMLMenuItemElement"in window;e.support.htmlCommand="HTMLCommandElement"in window;e.support.eventSelectstart="onselectstart"in document.documentElement;if(!e.ui||!e.ui.widget){var n=e.cleanData;e.cleanData=function(t){for(var r=0,i;(i=t[r])!=null;r++){try{e(i).triggerHandler("remove")}catch(s){}}n(t)}}var r=null,i=false,s=e(window),o=0,u={},a={},f={},l={selector:null,appendTo:null,trigger:"right",autoHide:false,delay:200,reposition:true,determinePosition:function(t){if(e.ui&&e.ui.position){t.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none")}else{var n=this.offset();n.top+=this.outerHeight();n.left+=this.outerWidth()/2-t.outerWidth()/2;t.css(n)}},position:function(e,t,n){var r=this,i;if(!t&&!n){e.determinePosition.call(this,e.$menu);return}else if(t==="maintain"&&n==="maintain"){i=e.$menu.position()}else{i={top:n,left:t}}var o=s.scrollTop()+s.height(),u=s.scrollLeft()+s.width(),a=e.$menu.height(),f=e.$menu.width();if(i.top+a>o){i.top-=a}if(i.left+f>u){i.left-=f}e.$menu.css(i)},positionSubmenu:function(t){if(e.ui&&e.ui.position){t.css("display","block").position({my:"left top",at:"right top",of:this,collision:"flipfit fit"}).css("display","")}else{var n={top:0,left:this.outerWidth()};t.css(n)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:e.noop,hide:e.noop},callback:null,items:{}},c={timer:null,pageX:null,pageY:null},h=function(e){var t=0,n=e;while(true){t=Math.max(t,parseInt(n.css("z-index"),10)||0);n=n.parent();if(!n||!n.length||"html body".indexOf(n.prop("nodeName").toLowerCase())>-1){break}}return t},p={abortevent:function(e){e.preventDefault();e.stopImmediatePropagation()},contextmenu:function(t){var n=e(this);t.preventDefault();t.stopImmediatePropagation();if(t.data.trigger!="right"&&t.originalEvent){return}if(n.hasClass("context-menu-active")){return}if(!n.hasClass("context-menu-disabled")){r=n;if(t.data.build){var i=t.data.build(r,t);if(i===false){return}t.data=e.extend(true,{},l,t.data,i||{});if(!t.data.items||e.isEmptyObject(t.data.items)){if(window.console){(console.er
|