|
170 | 170 | function update_taxonomy() { |
171 | 171 | const selected = $(this).val(); |
172 | 172 | let tax_selected = $(this).data('tax'); |
| 173 | + const custom_tag = $(this).data('custom-tag'); |
173 | 174 | if (typeof tax_selected !== 'undefined') { |
174 | 175 | tax_selected = tax_selected.split(','); |
175 | 176 | } else { |
|
239 | 240 | tax_selected = tax_selected.filter(function (item) { |
240 | 241 | return '' !== item; |
241 | 242 | }); |
| 243 | + const selected_tax_length = tax_selected.length; |
| 244 | + if (!feedzy.i10n.is_pro) { |
| 245 | + options += |
| 246 | + '<optgroup class="feedzy-pro-terms" label="Pro">'; |
| 247 | + } |
| 248 | + options += |
| 249 | + '<option class="feedzy-separator">separator</option>'; |
| 250 | + $.each(custom_tag, function (key, customTag) { |
| 251 | + let is_selected = ''; |
| 252 | + if (in_array(key, tax_selected)) { |
| 253 | + is_selected = 'selected'; |
| 254 | + const index = tax_selected.indexOf(key); |
| 255 | + |
| 256 | + if (-1 !== index) { |
| 257 | + tax_selected.splice(index, 1); |
| 258 | + } |
| 259 | + } |
| 260 | + options += |
| 261 | + '<option class="' + |
| 262 | + (!feedzy.i10n.is_pro ? 'feedzy-pro-term' : '') + |
| 263 | + '" value="' + |
| 264 | + key + |
| 265 | + '"' + |
| 266 | + is_selected + |
| 267 | + '>' + |
| 268 | + customTag + |
| 269 | + '</option></a>'; |
| 270 | + }); |
| 271 | + |
242 | 272 | if ( |
243 | | - tax_selected.length > 0 && |
| 273 | + selected_tax_length > 0 && |
244 | 274 | $('#feedzy_post_terms').hasClass('fz-chosen-custom-tag') |
245 | 275 | ) { |
246 | 276 | $.each(tax_selected, function (index, customTag) { |
|
252 | 282 | '</option>'; |
253 | 283 | }); |
254 | 284 | } |
| 285 | + |
| 286 | + if (!feedzy.i10n.is_pro) { |
| 287 | + options += '</optgroup>'; |
| 288 | + } |
255 | 289 | } else { |
256 | 290 | show_terms = false; |
257 | 291 | options = $('#empty_select_tpl').html(); |
|
1146 | 1180 | } |
1147 | 1181 |
|
1148 | 1182 | function feedzyTab() { |
1149 | | - $(".fz-tabs-menu a").click(function () { |
1150 | | - $(this).parents(".fz-tabs-menu").find("a").removeClass("active"); |
1151 | | - $(this).addClass("active"); |
1152 | | - var tagid = $(this).data("id"); |
| 1183 | + $('.fz-tabs-menu a').click(function () { |
| 1184 | + $(this).parents('.fz-tabs-menu').find('a').removeClass('active'); |
| 1185 | + $(this).addClass('active'); |
| 1186 | + const tagid = $(this).data('id'); |
1153 | 1187 | $(this) |
1154 | | - .parents(".feedzy-accordion-item__content") |
1155 | | - .find(".fz-tabs-content .fz-tab-content") |
| 1188 | + .parents('.feedzy-accordion-item__content') |
| 1189 | + .find('.fz-tabs-content .fz-tab-content') |
1156 | 1190 | .hide(); |
1157 | | - $("#" + tagid).show(); |
| 1191 | + $('#' + tagid).show(); |
1158 | 1192 | }); |
1159 | | - $(".fz-tabs-content .fz-tab-content").hide(); |
1160 | | - $(".fz-tabs-menu").each(function() { |
1161 | | - $(this).find("a").first().addClass("active"); |
| 1193 | + $('.fz-tabs-content .fz-tab-content').hide(); |
| 1194 | + $('.fz-tabs-menu').each(function () { |
| 1195 | + $(this).find('a').first().addClass('active'); |
1162 | 1196 | }); |
1163 | | - $(".fz-tabs-content").each(function() { |
1164 | | - $(this).find(".fz-tab-content").first().show(); |
| 1197 | + $('.fz-tabs-content').each(function () { |
| 1198 | + $(this).find('.fz-tab-content').first().show(); |
1165 | 1199 | }); |
1166 | 1200 | } |
1167 | 1201 |
|
|
1279 | 1313 |
|
1280 | 1314 | $('.feedzy-remove-media').on('click', function () { |
1281 | 1315 | if ( |
1282 | | - $('#use-inherited-thumbnail').length && |
| 1316 | + $('#use-inherited-thumbnail').length && |
1283 | 1317 | $('#use-inherited-thumbnail').is(':checked') |
1284 | 1318 | ) { |
1285 | 1319 | return false; |
|
1290 | 1324 | 'change', |
1291 | 1325 | function () { |
1292 | 1326 | const selectedValue = $(this).val(); |
1293 | | - const thumbnailValue = $('input[name="feedzy_meta_data[default_thumbnail_id]"]').val(); |
1294 | | - const hasImagePreview = $('#custom-fallback-section .feedzy-media-preview').length > 0; |
1295 | | - const hasThumbnails = (thumbnailValue && thumbnailValue !== '' && thumbnailValue !== '0') || hasImagePreview; |
| 1327 | + const thumbnailValue = $( |
| 1328 | + 'input[name="feedzy_meta_data[default_thumbnail_id]"]' |
| 1329 | + ).val(); |
| 1330 | + const hasImagePreview = |
| 1331 | + $('#custom-fallback-section .feedzy-media-preview').length > |
| 1332 | + 0; |
| 1333 | + const hasThumbnails = |
| 1334 | + (thumbnailValue && |
| 1335 | + thumbnailValue !== '' && |
| 1336 | + thumbnailValue !== '0') || |
| 1337 | + hasImagePreview; |
1296 | 1338 |
|
1297 | 1339 | if (selectedValue === 'custom') { |
1298 | 1340 | $('#custom-fallback-section').show(); |
1299 | 1341 | $('#general-fallback-preview').hide(); |
1300 | | - |
| 1342 | + |
1301 | 1343 | if (hasThumbnails) { |
1302 | | - $('.feedzy-open-media').html(feedzy.i10n.action_btn_text_2); |
| 1344 | + $('.feedzy-open-media').html( |
| 1345 | + feedzy.i10n.action_btn_text_2 |
| 1346 | + ); |
1303 | 1347 | $('.feedzy-remove-media').addClass('is-show'); |
1304 | 1348 | } else { |
1305 | | - $('.feedzy-open-media').html(feedzy.i10n.action_btn_text_1); |
| 1349 | + $('.feedzy-open-media').html( |
| 1350 | + feedzy.i10n.action_btn_text_1 |
| 1351 | + ); |
1306 | 1352 | $('.feedzy-remove-media').removeClass('is-show'); |
1307 | 1353 | } |
1308 | 1354 | } else if (selectedValue === 'general') { |
1309 | 1355 | $('#custom-fallback-section').hide(); |
1310 | 1356 | $('#general-fallback-preview').show(); |
1311 | | - $('input[name="feedzy_meta_data[default_thumbnail_id]"]').val(''); |
| 1357 | + $( |
| 1358 | + 'input[name="feedzy_meta_data[default_thumbnail_id]"]' |
| 1359 | + ).val(''); |
1312 | 1360 | } |
1313 | 1361 | } |
1314 | 1362 | ); |
|
0 commit comments