mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
2.2 KiB
9 lines
2.2 KiB
7 years ago
|
/*!
|
||
|
* jQuery Contextify v1.0.8 (http://contextify.js.org)
|
||
|
* Copyright (c) 2016 Adam Bouqdib
|
||
|
* Licensed under GPL-2.0 (http://abemedia.co.uk/license)
|
||
|
*/
|
||
|
|
||
|
|
||
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery,window)}(function(a,b){function c(b,c){this.element=b,this.options=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="contextify",e={items:[],action:"contextmenu",menuId:"contextify-menu",menuClass:"dropdown-menu",headerClass:"dropdown-header",dividerClass:"divider",before:!1},f=0,g=a(b);c.prototype.init=function(){var b=a.extend({},this.options,a(this.element).data());b.id=f,a(this.element).attr("data-contextify-id",b.id).on("contextmenu",function(c){c.preventDefault(),"function"==typeof b.before&&b.before(this,b);var d=a('<ul class="'+b.menuClass+'" role="menu" id="'+b.menuId+'" data-contextify-id="'+b.id+'"/>');d.data(b);var e,f=b.items.length;for(e=0;e<f;e++){var h=b.items[e],i=a("<li/>");if(h.divider)i.addClass(b.dividerClass);else if(h.header)i.addClass(b.headerClass),i.html(h.header);else{i.append("<a/>");var j=i.find("a");if(h.href&&j.attr("href",h.href),h.onclick&&(j.on("click",b,h.onclick),j.css("cursor","pointer")),h.data){for(var k in h.data)d.attr("data-"+k,h.data[k]);j.data(h.data)}j.html(h.text)}d.append(i)}var l=a("#"+b.menuId);l.length>0?l!==d&&l.replaceWith(d):a("body").append(d);var m=g.width(),n=g.height(),o=d.outerWidth(),p=d.outerHeight(),q=o+c.clientX<m?c.clientX:m-o,r=p+c.clientY<n?c.clientY:n-p;d.css("top",r).css("left",q).css("position","fixed").show();if($("#rmenu").is(":visible")) d.hide()}).parents().on("mouseup",function(){a("#"+b.menuId).hide()}),g.on("scroll",function(){a("#"+b.menuId).hide()}),f++},c.prototype.destroy=function(){var b=a(this.element),c=a.extend({},this.options,b.data());b.removeAttr("data-contextify-id").off("contextmenu").parents().off("mouseup",function(){a("#"+c.menuId).hide()}),g.off("scroll",function(){a("#"+c.menuId).hide()}),a("#"+c.menuId).remove()},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)&&"[object String]"===Object.prototype.toString.call(b)?a.data(this,"plugin_"+d)[b]():a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}});
|
||
|
//# sourceMappingURL=jquery.contextify.min.js.map
|