PluginProbe
WPGet API – Connect to any external REST API / 1.4.6
WPGet API – Connect to any external REST API v1.4.6
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
← All changes | assets/js/wpgetapi-admin.js +3 -74 2.2.2 → 1.4.6 View file →
@@ -11,78 +11,18 @@
11 11
12 12 var $page = wpgetapi.page();
13 13
14 14 wpgetapi.functionsHelp();
15 - wpgetapi.tooltips();
16 -
15 +
17 16 $page
18 - .on( 'click', '.functions .copy-this', wpgetapi.copyThis )
19 17 .on( 'change keyup', '.field-id input', wpgetapi.functionsHelp )
20 - .on( 'cmb2_remove_row cmb2_add_row cmb2_shift_row', wpgetapi.functionsHelp )
21 - .on( 'cmb2_add_row', wpgetapi.disableTestUntilSave );
18 + .on( 'cmb2_remove_row cmb2_add_row cmb2_shift_row', wpgetapi.functionsHelp );
22 19
23 20 }
24 21
25 -
26 22 /**
27 - * Do the tooltips
23 + * Adds the endpoint into the functions help section.
28 24 */
29 - wpgetapi.tooltips = function () {
30 - $( ".wrap.wpgetapi .dashicons-editor-help" ).tooltip({
31 - items: "[data-tip]",
32 - content: function () {
33 - return $(this).data("tip");
34 - },
35 - classes: {
36 - "ui-tooltip": "wpgetapi-tooltip"
37 - },
38 - position: { my: 'center bottom-10', at: 'center top' },
39 - close: function (event, ui) {
40 - ui.tooltip.hover(
41 - function () {
42 - $(this).stop(true).fadeTo(400, 1);
43 - },
44 - function () {
45 - $(this).fadeOut("400", function () {
46 - $(this).remove();
47 - })
48 - });
49 - }
50 - });
51 - }
52 -
53 - /**
54 - * Copy the template tag or the shortcode
55 - */
56 - wpgetapi.copyThis = function ( e ) {
57 -
58 - const $this = $( this );
59 - const textToCopy = $this.prev( '.wpgetapi-copy' ).text();
60 -
61 - navigator.clipboard.writeText(textToCopy).then(
62 - function() {
63 - /* clipboard successfully set */
64 - $this.after( '<span class="copied">Copied</span>' );
65 - setTimeout(
66 - function() {
67 - $( '.copied' ).remove();
68 - }, 3000
69 - );
70 -
71 - },
72 - function() {
73 - /* clipboard write failed */
74 - $this.append('Oops! Your browser doesn\'t support this.')
75 - }
76 - )
77 -
78 - }
79 -
80 -
81 - /**
82 - * Adds the endpoint into the functions help section,
83 - * meaning the Template tag and the shortcode.
84 - */
85 25 wpgetapi.functionsHelp = function ( e ) {
86 26
87 27 // change, keyup, add_row etc
88 28 if( e && e.type.length > 0 ) {
@@ -111,19 +51,8 @@
111 51
112 52 }
113 53
114 54 }
115 -
116 -
117 - /**
118 - * Disable the Test Endpoint button on adding new row.
119 - *
120 - */
121 - wpgetapi.disableTestUntilSave = function ( evt, row ) {
122 - var $row = $( row );
123 - $row.find( '.wpgetapi .test-endpoint-button' ).attr( 'disabled', true );
124 - }
125 -
126 55
127 56 /**
128 57 * Gets jQuery object containing all . Caches the result.
129 58 *