diff --git a/js/tooltip.js b/js/laps.js similarity index 96% rename from js/tooltip.js rename to js/laps.js index f21b86b..8be7ff8 100644 --- a/js/tooltip.js +++ b/js/laps.js @@ -8,8 +8,6 @@ * ======================================================================== */ -// modified to use lapstooltip as plugin name - +function ($) { 'use strict'; @@ -24,7 +22,7 @@ this.hoverState = this.$element = null - this.init('lapstooltip', element, options) + this.init('tooltip', element, options) } Tooltip.VERSION = '3.2.0' @@ -433,27 +431,38 @@ function Plugin(option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs.lapstooltip') + var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option if (!data && option == 'destroy') return - if (!data) $this.data('bs.lapstooltip', (data = new Tooltip(this, options))) + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } - var old = $.fn.lapstooltip + var old = $.fn.tooltip - $.fn.lapstooltip = Plugin - $.fn.lapstooltip.Constructor = Tooltip + $.fn.tooltip = Plugin + $.fn.tooltip.Constructor = Tooltip // TOOLTIP NO CONFLICT // =================== - $.fn.lapstooltip.noConflict = function () { - $.fn.lapstooltip = old + $.fn.tooltip.noConflict = function () { + $.fn.tooltip = old return this } }(jQuery); + +jQuery.fn.lapstooltip = jQuery.fn.tooltip.noConflict(); + +jQuery(document).ready(function () { + jQuery(".laps-timeline .event").lapstooltip({ + container: '#wpadminbar', + placement: 'bottom', + html : true, + animation: false + }); +}); diff --git a/src/class-laps.php b/src/class-laps.php index 31bb5c0..be25f4b 100644 --- a/src/class-laps.php +++ b/src/class-laps.php @@ -184,11 +184,11 @@ class Laps { static function enqueue_scripts() { - wp_register_script( 'laps-tooltip', plugins_url( 'js/tooltip.js', __DIR__ ), array( 'jquery' ), '3.0.2', true ); + wp_register_script( 'laps', plugins_url( 'js/laps.js', __DIR__ ), array( 'jquery' ), '3.2.0', true ); wp_register_style( 'laps', plugins_url( 'css/laps.css', __DIR__ ) ); if ( is_admin_bar_showing() ) { - wp_enqueue_script( 'laps-tooltip' ); + wp_enqueue_script( 'laps' ); wp_enqueue_style( 'laps' ); } }