| Conditions | 1 |
| Paths | 1 |
| Total Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** global: GLSR, jQuery */ |
||
| 2 | ;(function( x ) { |
||
| 3 | |||
| 4 | 'use strict'; |
||
| 5 | |||
| 6 | var Pointers = function() { |
||
| 7 | x.each( GLSR.pointers, function( i, pointer ) { |
||
| 8 | this.init_( pointer ); |
||
| 9 | }.bind( this )); |
||
| 10 | }; |
||
| 11 | |||
| 12 | Pointers.prototype = { |
||
| 13 | /** @return void */ |
||
| 14 | close_: function( pointerId ) { // string |
||
| 15 | x.post( GLSR.ajaxurl, { |
||
| 16 | pointer: pointerId, |
||
| 17 | action: 'dismiss-wp-pointer', |
||
| 18 | }); |
||
| 19 | }, |
||
| 20 | |||
| 21 | /** @return void */ |
||
| 22 | init_: function( pointer ) { // object |
||
| 23 | x( pointer.target ).pointer({ |
||
| 24 | content: pointer.options.content, |
||
| 25 | position: pointer.options.position, |
||
| 26 | close: this.close_.bind( pointer.id ), |
||
| 27 | }) |
||
| 28 | .pointer( 'open' ) |
||
| 29 | .pointer( 'sendToTop' ); |
||
| 30 | x( document ).on( 'wp-window-resized', function() { |
||
| 31 | x( pointer.target ).pointer( 'reposition' ); |
||
| 32 | }); |
||
| 33 | }, |
||
| 34 | }; |
||
| 35 | |||
| 36 | GLSR.Pointers = Pointers; |
||
| 37 | })( jQuery ); |
||
| 38 |