PluginProbe
WPGet API – Connect to any external REST API / 1.1.0
WPGet API – Connect to any external REST API v1.1.0
1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.10 2.2.2 2.2.3 All 97 releases
wpgetapi / assets / js / wpgetapi-admin.js

wpgetapi-admin.js in WPGet API – Connect to any external REST API 1.1.0, at assets/js/wpgetapi-admin.js

59 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 window.WpGetApi = window.WpGetApi || {};
2
3 (function (window, document, $, wpgetapi, undefined) {
4
5 'use strict';
6
7 /**
8 * Start the JS.
9 */
10 wpgetapi.onReady = function () {
11
12 var $page = wpgetapi.page();
13
14 wpgetapi.functionsHelp();
15
16 $page
17 .on( 'change keyup', '.field-id input', wpgetapi.functionsHelp )
18 .on( 'cmb2_remove_row cmb2_add_row cmb2_shift_row', wpgetapi.functionsHelp );
19
20 }
21
22 /**
23 * Adds the endpoint into the functions help section.
24 */
25 wpgetapi.functionsHelp = function ( e ) {
26
27 // set $this depending on how we call function
28 var $this = e ? $( this ) : $( '.field-id input' );
29 var $group = $this.parents( '.cmb-repeatable-grouping' );
30
31 // if we are adding a group, clear it
32 if( e && e.type == 'cmb2_add_row' ) {
33 $group = $( '.cmb-repeatable-grouping' ).last();
34 $group.find( '.functions .endpoint_id' ).html( '' );
35 }
36 if( $group.length > 0 )
37 $group.find( '.functions .endpoint_id' ).html( $this.val() );
38
39 }
40
41
42 /**
43 * Gets jQuery object containing all . Caches the result.
44 *
45 * @since 1.0.0
46 *
47 * @return {Object} jQuery object containing all.
48 */
49 wpgetapi.page = function() {
50 if ( wpgetapi.$page ) {
51 return wpgetapi.$page;
52 }
53 wpgetapi.$page = $('.wpgetapi');
54 return wpgetapi.$page;
55 };
56
57 $( wpgetapi.onReady );
58
59 }(window, document, jQuery, window.WpGetApi));