PluginProbe
Polylang / 1.4
Polylang v1.4
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / js / term.js

term.js in Polylang 1.4, at js/term.js

92 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // quick edit
2 if ('undefined' != typeof(inlineEditTax)) {
3 (function($) {
4 var $wp_inline_edit = inlineEditTax.edit;
5
6 inlineEditTax.edit = function( id ) {
7 $wp_inline_edit.apply( this, arguments );
8 var $term_id = 0;
9 if ( typeof( id ) == 'object' )
10 $term_id = parseInt( this.getId( id ) );
11
12 if ( $term_id > 0 ) {
13 var $edit_row = $('#edit-' + $term_id);
14 var $select = $edit_row.find(':input[name="inline_lang_choice"]');
15 $select.find('option:selected').removeProp('selected');
16 var lang = $('#lang_' + $term_id).html();
17 $("input[name='old_lang']").val(lang);
18 $select.find('option[value="'+lang+'"]').prop('selected', true);
19 }
20 }
21 })(jQuery);
22 }
23
24 jQuery(document).ready(function($) {
25 // ajax for changing a translation in edit-tags.php
26 function change_translations() {
27 var td = $(this).parent().siblings('.pll-edit-column');
28 if (!td)
29 return;
30
31 td.children('a').hide();
32 td.children('.spinner').show();
33
34 var data = {
35 action: 'term_translation_choice',
36 lang: $('#term_lang_choice').attr('value'),
37 term_id: $("input[name='tag_ID']").attr('value'),
38 taxonomy: $("input[name='taxonomy']").attr('value'),
39 post_type: typenow,
40 value: $(this).attr('value')
41 }
42
43 $.post(ajaxurl, data , function(response) {
44 var res = wpAjax.parseAjaxResponse(response, 'ajax-response');
45 $.each(res.responses, function() {
46 switch (this.what) {
47 case 'link':
48 td.children('.spinner').hide();
49 td.html(this.data);
50 break;
51 default:
52 break;
53 }
54 });
55 });
56 }
57
58 $("select[name*='term_tr_lang']").change(change_translations);
59
60 // ajax for changing the term's language
61 $('#term_lang_choice').change(function() {
62 var data = {
63 action: 'term_lang_choice',
64 lang: $(this).attr('value'),
65 term_id: $("input[name='tag_ID']").attr('value'),
66 taxonomy: $("input[name='taxonomy']").attr('value'),
67 post_type: typenow
68 }
69
70 $.post(ajaxurl, data, function(response) {
71 var res = wpAjax.parseAjaxResponse(response, 'ajax-response');
72 $.each(res.responses, function() {
73 switch (this.what) {
74 case 'translations': // translations fields
75 $("#term-translations").html(this.data);
76 $("select[name*='term_tr_lang']").change(change_translations);
77 break;
78 case 'parent': // parent dropdown list for hierarchical taxonomies
79 $('#parent').replaceWith(this.data);
80 break;
81 case 'tag_cloud': // popular items
82 $('.tagcloud').replaceWith(this.data);
83 break;
84 default:
85 break;
86 }
87 });
88 });
89 });
90
91 });
92