/*! * jQuery Contextify v1.0.8 (http://contextify.js.org) * Copyright (c) 2018 Adam Bouqdib * Licensed under GPL-2.0 (http://abemedia.co.uk/license) */ /*! * jQuery Contextify v1.0.8 (http://contextify.js.org) * Copyright (c) 2016 Adam Bouqdib * Licensed under GPL-2.0 (http://abemedia.co.uk/license) */ /*global define */ ;(function( factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define([ "jquery" ], factory ); } else { // Browser globals factory( jQuery, window ); } }(function ( $, window ) { var pluginName = 'contextify', defaults = { items: [], action: "contextmenu", menuId: "contextify-menu", menuClass: "dropdown-menu", itemClass: "dropdown-item", headerClass: "dropdown-header", dividerClass: "dropdown-divider", before: false }, contextifyId = 0, $window = $(window); function Plugin( element, options ) { this.element = element; this.options = $.extend( {}, defaults, options) ; this._defaults = defaults; this._name = pluginName; this.init(); } Plugin.prototype.init = function () { var options = $.extend( {}, this.options, $(this.element).data()); options.id = contextifyId; $(this.element) .attr('data-contextify-id', options.id) .on('contextmenu', function (e) { e.preventDefault(); // run before if(typeof(options.before) === 'function') { options.before(this, options); } var menu = $('