You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
41 KiB
1 line
41 KiB
9 months ago
|
!function(){"use strict";var e=window.wp.i18n,t=window.wp.hooks,s=window.wp.url;const o=e=>"#"===e[0]?document.getElementById(e.slice(1)):document.querySelectorAll(e);window.tp=window.tp||{},tp.made_changes=!1,tp.helpers=tp.helpers||{},tp.callbacks=tp.callbacks||{},tp.helpers.selection=tp.helpers.selection||{rows:[0],columns:[0]},tp.helpers.unsaved_changes=tp.helpers.unsaved_changes||{},tp.helpers.unsaved_changes.unload_dialog=function(e){e.preventDefault(),e.returnValue=""},tp.helpers.unsaved_changes.set=function(){tp.made_changes||(tp.made_changes=!0,window.addEventListener("beforeunload",tp.helpers.unsaved_changes.unload_dialog))},tp.helpers.unsaved_changes.unset=function(){tp.made_changes=!1,window.removeEventListener("beforeunload",tp.helpers.unsaved_changes.unload_dialog)},tp.helpers.options=tp.helpers.options||{},tp.helpers.options.load=function(){Object.keys(tp.table.options).forEach((function(e){if("last_editor"===e)return;if(""===(e=(0,t.applyFilters)("tablepress.optionsLoad",e)))return;let s=o(`#option-${e}`);s||(s=o(`#option-${e}-${tp.table.options[e]}`)),s&&(s instanceof HTMLInputElement&&"checkbox"===s.type?s.checked=tp.table.options[e]:s instanceof HTMLInputElement&&"radio"===s.type?s.checked=!0:s.value=tp.table.options[e])})),tp.table.options.use_datatables&&tp.helpers.editor.has_merged_cells()&&(tp.table.options.use_datatables=!1,o("#option-use_datatables").checked=!1),tp.helpers.options.check_dependencies()},tp.helpers.options.change=function(s){if(!s.target)return;const l=s.target.name||"";if(""===l)return;const n=s.target instanceof HTMLInputElement&&"checkbox"===s.target.type?"checked":"value";tp.table.options[l]=s.target[n],s.target instanceof HTMLInputElement&&"number"===s.target.type&&(tp.table.options[l]=parseInt(tp.table.options[l],10)),"use_datatables"===l&&tp.table.options.use_datatables&&tp.helpers.editor.has_merged_cells()&&(tp.table.options.use_datatables=!1,o("#option-use_datatables").checked=!1,window.alert((0,e.__)("You can not enable the Table Features for Site Visitors, because your table contains combined/merged cells.","tablepress"))),(0,t.doAction)("tablepress.optionsChange",l,n,s),tp.helpers.options.check_dependencies(),tp.helpers.unsaved_changes.set(),tp.editor.updateTable()},tp.helpers.options.check_dependencies=function(){o("#option-use_datatables").disabled=!tp.table.options.table_head,o("#notice-datatables-head-row").style.display=tp.table.options.table_head?"none":"block",o("#option-print_name_position").disabled=!tp.table.options.print_name,o("#option-print_description_position").disabled=!tp.table.options.print_description;const e=tp.table.options.use_datatables&&tp.table.options.table_head;o("#tablepress_edit-datatables-features").querySelectorAll(":scope input:not(#option-use_datatables), :scope textarea").forEach((t=>t.disabled=!e));const s=e&&tp.table.options.datatables_paginate;o("#option-datatables_lengthchange").disabled=!s,o("#option-datatables_paginate_entries").disabled=!s,(0,t.doAction)("tablepress.optionsCheckDependencies")},tp.helpers.options.validate_fields=function(){if(tp.table.options.datatables_paginate&&(isNaN(tp.table.options.datatables_paginate_entries)||tp.table.options.datatables_paginate_entries<1||tp.table.options.datatables_paginate_entries>9999)){window.alert((0,e.sprintf)((0,e.__)("The entered value in the “%1$s” field is invalid.","tablepress"),(0,e.__)("Pagination Entries","tablepress")));const t=o("#option-datatables_paginate_entries");return t.focus(),t.select(),!1}if(/[^A-Za-z0-9- _:]/.test(tp.table.options.extra_css_classes)){window.alert((0,e.sprintf)((0,e.__)("The entered value in the “%1$s” field is invalid.","tablepress"),(0,e.__)("Extra CSS Classes","tablepress")));const t=o("#option-extra_css_classes");return t.focus(),t.select(),!1}return(0,t.applyFilters)("tablepress.optionsValidateFields",!0)},tp.helpers.visibility=tp.helpers.visibility||{},tp.helpers.visibility.load=function(){const e=tp.table.visibility.rows.length,t=tp.table.visibility.columns.length,s={};for(let o=0;o<e;o++)if(1!==tp.table.visibility.rows[o])for(let e=
|