equal
deleted
inserted
replaced
5 (function($) { |
5 (function($) { |
6 $(document).ready( function() { |
6 $(document).ready( function() { |
7 jQuery.bwsTooltip = function( pointer_options ) { |
7 jQuery.bwsTooltip = function( pointer_options ) { |
8 var pointer_buttons = pointer_options['buttons']; |
8 var pointer_buttons = pointer_options['buttons']; |
9 /* extend pointer options - add close button */ |
9 /* extend pointer options - add close button */ |
10 pointer_options = $.extend(pointer_options, { |
10 pointer_options = $.extend( pointer_options, { |
11 buttons: function(event, t) { |
11 buttons: function(event, t) { |
12 var button; |
12 var button; |
13 /* check and add dismiss-type buttons */ |
13 /* check and add dismiss-type buttons */ |
14 for( var but in pointer_buttons ) { |
14 for ( var but in pointer_buttons ) { |
15 if ( typeof pointer_buttons[ but ]['type'] != 'undefined' && pointer_buttons[ but ]['type'] == 'dismiss' && typeof pointer_buttons[ but ]['text'] != 'undefined' && pointer_buttons[ but ]['text'] != '' ) { |
15 if ( typeof pointer_buttons[ but ]['type'] != 'undefined' && pointer_buttons[ but ]['type'] == 'dismiss' && typeof pointer_buttons[ but ]['text'] != 'undefined' && pointer_buttons[ but ]['text'] != '' ) { |
16 button += '<a style="margin:0px 5px 2px;" class="button-secondary">' + pointer_buttons[ but ]['text'] + '</a>'; |
16 button += '<a style="margin:0px 5px 2px;" class="button-secondary">' + pointer_buttons[ but ]['text'] + '</a>'; |
17 } |
17 } |
18 } |
18 } |
19 button = jQuery( button ); |
19 button = jQuery( button ); |
32 action: 'dismiss-wp-pointer' |
32 action: 'dismiss-wp-pointer' |
33 }) |
33 }) |
34 }); |
34 }); |
35 /* function to display pointer */ |
35 /* function to display pointer */ |
36 function displayPointer( cssSelector ) { |
36 function displayPointer( cssSelector ) { |
37 cssSelector.pointer(pointer_options).pointer({ |
37 cssSelector.pointer( pointer_options ).pointer({ |
38 pointerClass: 'wp-pointer ' + pointer_options["tooltip_id"], |
38 pointerClass: 'wp-pointer ' + pointer_options["tooltip_id"], |
39 content: pointer_options['content'], |
39 content: pointer_options['content'], |
40 position: |
40 position: { |
41 { |
|
42 edge: pointer_options['position']['edge'], |
41 edge: pointer_options['position']['edge'], |
43 align: pointer_options['position']['align'], |
42 align: pointer_options['position']['align'], |
44 }, |
43 }, |
45 }).pointer('open'); |
44 }).pointer('open'); |
46 /* display buttons that are not type of dismiss */ |
45 /* display buttons that are not type of dismiss */ |
62 pointerZindex = parseInt( $( "." + pointer_options["tooltip_id"] ).css("z-index") ); |
61 pointerZindex = parseInt( $( "." + pointer_options["tooltip_id"] ).css("z-index") ); |
63 if ( pointerZindex != pointer_options['position']['zindex'] ) { |
62 if ( pointerZindex != pointer_options['position']['zindex'] ) { |
64 $( "." + pointer_options["tooltip_id"] ).css({ "z-index": pointer_options['position']['zindex'] }); |
63 $( "." + pointer_options["tooltip_id"] ).css({ "z-index": pointer_options['position']['zindex'] }); |
65 } |
64 } |
66 } |
65 } |
|
66 |
67 /* display pointer for the first time */ |
67 /* display pointer for the first time */ |
68 if ( pointer_options['actions']['onload'] ) { |
68 if ( pointer_options['actions']['onload'] ) { |
69 displayPointer( $( pointer_options['css_selector'] ) ); |
69 if ( pointer_options['set_timeout'] > 0 ) { |
|
70 var settime = parseInt( pointer_options['set_timeout'] ); |
|
71 setTimeout( function() { |
|
72 displayPointer( $( pointer_options['css_selector'] ) ); |
|
73 }, settime ); |
|
74 } else { |
|
75 displayPointer( $( pointer_options['css_selector'] ) ); |
|
76 } |
70 } |
77 } |
|
78 |
71 /* display pointer when clicked on selector */ |
79 /* display pointer when clicked on selector */ |
72 if ( pointer_options['actions']['click'] ) { |
80 if ( pointer_options['actions']['click'] ) { |
73 $( pointer_options['css_selector'] ).click( function () { |
81 $( pointer_options['css_selector'] ).click( function () { |
74 displayPointer( $( this ) ); |
82 displayPointer( $( this ) ); |
75 }); |
83 }); |