PluginProbe ʕ •ᴥ•ʔ
External Links – nofollow, noopener & new window / 1.41
External Links – nofollow, noopener & new window v1.41
2.66 0.31 0.32 0.33 0.34 0.35 1.01 1.02 1.03 1.10 1.20 1.21 1.30 1.31 1.40 1.41 1.50 1.51 1.52 1.53 1.54 1.55 1.56 1.60 1.61 1.62 1.70 1.80 1.81 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 2.3 2.32 2.35 2.40 2.42 2.43 2.45 2.46 2.47 2.48 2.50 2.51 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 trunk 0.10 0.11 0.12 0.20 0.21 0.30
wp-external-links / includes / wp-plugin-dev-classes / wp-option-forms.js
wp-external-links / includes / wp-plugin-dev-classes Last commit date
class-wp-meta-box-page.php 13 years ago class-wp-option-forms.php 13 years ago wp-option-forms.js 13 years ago
wp-option-forms.js
56 lines
1 /* WP Options Form */
2 /*global jQuery, ajaxurl*/
3 jQuery(function ($) {
4 'use strict';
5
6 // save function
7 var saveAjaxForm = function (target) {
8 var $this = $(target),
9 $form = $this.parents('form'),
10 // get ajax post values
11 vals = $form.serializeArray();
12
13 // disable button
14 $this.attr('disabled', true);
15
16 // show ajax loader
17 $form.find('.ajax-feedback').css('visibility', 'visible');
18
19 // save option values
20 $.post(ajaxurl, vals, function (result) {
21 var $msg = $('<strong>').insertBefore($this);
22
23 if (result === '1') {
24 $msg.html('Saved');
25 } else {
26 // save options, non-ajax fallback
27 $form.find('[name="action"]').val('update');
28 // normal submit
29 $form.submit();
30 }
31
32 $msg.css({ margin: '0 5px' })
33 .delay(1000)
34 .fadeOut(function(){
35 $(this).remove();
36 });
37
38 // enable button
39 $this.attr('disabled', false);
40
41 // hide ajax loader
42 $form.find('.ajax-feedback').css('visibility', 'hidden');
43
44 // trigger ajax_saved_options
45 $form.trigger('ajax_saved_options', [result]);
46 });
47 };
48
49 // add ajax post
50 $('form.ajax-form input[type="submit"]').click(function(e) {
51 saveAjaxForm(this);
52 e.preventDefault();
53 });
54
55 });
56