PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.9.4
Secure Custom Fields v6.9.4
6.9.5 6.9.4 6.9.3 6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / assets / build / js / pro / acf-pro-ui-options-page.js
secure-custom-fields / assets / build / js / pro Last commit date
acf-datastore.asset.php 3 months ago acf-datastore.js 3 months ago acf-datastore.js.map 3 months ago acf-datastore.min.asset.php 3 months ago acf-datastore.min.js 3 months ago acf-field-bindings.asset.php 3 months ago acf-field-bindings.js 3 months ago acf-field-bindings.js.map 3 months ago acf-field-bindings.min.asset.php 3 months ago acf-field-bindings.min.js 3 months ago acf-pro-blocks.asset.php 1 month ago acf-pro-blocks.js 1 month ago acf-pro-blocks.js.map 1 month ago acf-pro-blocks.min.asset.php 1 month ago acf-pro-blocks.min.js 1 month ago acf-pro-field-group.asset.php 11 months ago acf-pro-field-group.js 11 months ago acf-pro-field-group.js.map 9 months ago acf-pro-field-group.min.asset.php 9 months ago acf-pro-field-group.min.js 9 months ago acf-pro-input.asset.php 2 months ago acf-pro-input.js 2 months ago acf-pro-input.js.map 2 months ago acf-pro-input.min.asset.php 2 months ago acf-pro-input.min.js 2 months ago acf-pro-ui-options-page.asset.php 9 months ago acf-pro-ui-options-page.js 9 months ago acf-pro-ui-options-page.js.map 9 months ago acf-pro-ui-options-page.min.asset.php 9 months ago acf-pro-ui-options-page.min.js 9 months ago index.php 1 year ago
acf-pro-ui-options-page.js
260 lines
1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ "./assets/src/js/pro/_acf-ui-options-page.js":
5 /*!***************************************************!*\
6 !*** ./assets/src/js/pro/_acf-ui-options-page.js ***!
7 \***************************************************/
8 /***/ (() => {
9
10 (function ($, undefined) {
11 const parentPageSelectTemplate = function (selection) {
12 if ('undefined' === typeof selection.element) {
13 return selection;
14 }
15
16 // Hides the optgroup for the "No Parent" option.
17 if (selection.children && 'None' === selection.text) {
18 return;
19 }
20 if ('acfOptionsPages' === selection.text) {
21 selection.text = acf.__('Options Pages');
22 }
23 return $('<span class="acf-selection"></span>').data('element', selection.element).html(acf.strEscape(selection.text));
24 };
25 const defaultPillTemplate = function (selection) {
26 if ('undefined' === typeof selection.element) {
27 return selection;
28 }
29 const $selection = $('<span class="acf-selection"></span>');
30 $selection.html(acf.strEscape(selection.element.innerHTML));
31 if (selection.id === 'options' || selection.id === 'edit_posts') {
32 $selection.append('<span class="acf-select2-default-pill">' + acf.__('Default') + '</span>');
33 }
34 $selection.data('element', selection.element);
35 return $selection;
36 };
37 const UIOptionsPageManager = new acf.Model({
38 id: 'UIOptionsPageManager',
39 wait: 'ready',
40 events: {
41 'change .acf-options-page-parent_slug': 'toggleMenuPositionDesc'
42 },
43 initialize: function () {
44 if ('ui_options_page' !== acf.get('screen')) {
45 return;
46 }
47 acf.newSelect2($('select.acf-options-page-parent_slug'), {
48 field: false,
49 templateSelection: parentPageSelectTemplate,
50 templateResult: parentPageSelectTemplate,
51 dropdownCssClass: 'field-type-select-results'
52 });
53 acf.newSelect2($('select.acf-options-page-capability'), {
54 field: false,
55 templateSelection: defaultPillTemplate,
56 templateResult: defaultPillTemplate
57 });
58 acf.newSelect2($('select.acf-options-page-data_storage'), {
59 field: false,
60 templateSelection: defaultPillTemplate,
61 templateResult: defaultPillTemplate
62 });
63 this.toggleMenuPositionDesc();
64 },
65 toggleMenuPositionDesc: function (e, $el) {
66 const parentPage = $('select.acf-options-page-parent_slug').val();
67 if ('none' === parentPage) {
68 $('.acf-menu-position-desc-child').hide();
69 $('.acf-menu-position-desc-parent').show();
70 } else {
71 $('.acf-menu-position-desc-parent').hide();
72 $('.acf-menu-position-desc-child').show();
73 }
74 }
75 });
76 const optionsPageModalManager = new acf.Model({
77 id: 'optionsPageModalManager',
78 events: {
79 'change .location-rule-value': 'createOptionsPage'
80 },
81 createOptionsPage: function (e) {
82 const $locationSelect = $(e.target);
83 if ('add_new_options_page' !== $locationSelect.val()) {
84 return;
85 }
86 let popup = false;
87 const getForm = function () {
88 const fieldGroupTitle = $('.acf-headerbar-title-field').val();
89 const ajaxData = {
90 action: 'acf/create_options_page',
91 acf_parent_page_choices: this.acf.data.optionPageParentOptions ? this.acf.data.optionPageParentOptions : []
92 };
93 if (fieldGroupTitle.length) {
94 ajaxData.field_group_title = fieldGroupTitle;
95 }
96 $.ajax({
97 url: acf.get('ajaxurl'),
98 data: acf.prepareForAjax(ajaxData),
99 type: 'post',
100 dataType: 'json',
101 success: populateForm
102 });
103 };
104 const populateForm = function (response) {
105 popup = acf.newPopup({
106 title: response.data.title,
107 content: response.data.content,
108 width: '600px'
109 });
110 popup.$el.addClass('acf-create-options-page-popup');
111
112 // Hack to focus with the cursor at the end of the input.
113 const $pageTitle = popup.$el.find('#acf_ui_options_page-page_title');
114 const pageTitleVal = $pageTitle.val();
115 $pageTitle.trigger('focus').val('').val(pageTitleVal);
116 acf.newSelect2($('#acf_ui_options_page-parent_slug'), {
117 field: false,
118 templateSelection: parentPageSelectTemplate,
119 templateResult: parentPageSelectTemplate,
120 dropdownCssClass: 'field-type-select-results'
121 });
122 popup.on('submit', 'form', validateForm);
123 };
124 const validateForm = function (e) {
125 e.preventDefault();
126 acf.validateForm({
127 form: $('#acf-create-options-page-form'),
128 success: submitForm,
129 failure: onFail
130 });
131 };
132 const submitForm = function () {
133 const formValues = $('#acf-create-options-page-form').serializeArray();
134 const ajaxData = {
135 action: 'acf/create_options_page'
136 };
137 formValues.forEach(setting => {
138 ajaxData[setting.name] = setting.value;
139 });
140 $.ajax({
141 url: acf.get('ajaxurl'),
142 data: acf.prepareForAjax(ajaxData),
143 type: 'post',
144 dataType: 'json',
145 success: populateLocationSelect
146 });
147 };
148 const onFail = function (e) {
149 const $form = $('#acf-create-options-page-form');
150 const $fieldNotices = $form.find('.acf-field .acf-error-message');
151
152 // Hide the general validation failed notice.
153 $form.find('.acf-notice').first().remove();
154
155 // Update class for inline notices and move into field label.
156 $fieldNotices.each(function () {
157 const $label = $(this).closest('.acf-field').find('.acf-label:first');
158 $(this).attr('class', 'acf-options-page-modal-error').appendTo($label);
159 });
160 };
161 const populateLocationSelect = function (response) {
162 if (response.success && response.data.menu_slug) {
163 $locationSelect.prepend('<option value="' + response.data.menu_slug + '">' + response.data.page_title + '</option>');
164 $locationSelect.val(response.data.menu_slug);
165 popup.close();
166 } else if (!response.success && response.data.error) {
167 alert(response.data.error);
168 }
169 };
170 getForm();
171 }
172 });
173 })(jQuery);
174
175 /***/ })
176
177 /******/ });
178 /************************************************************************/
179 /******/ // The module cache
180 /******/ var __webpack_module_cache__ = {};
181 /******/
182 /******/ // The require function
183 /******/ function __webpack_require__(moduleId) {
184 /******/ // Check if module is in cache
185 /******/ var cachedModule = __webpack_module_cache__[moduleId];
186 /******/ if (cachedModule !== undefined) {
187 /******/ return cachedModule.exports;
188 /******/ }
189 /******/ // Create a new module (and put it into the cache)
190 /******/ var module = __webpack_module_cache__[moduleId] = {
191 /******/ // no module.id needed
192 /******/ // no module.loaded needed
193 /******/ exports: {}
194 /******/ };
195 /******/
196 /******/ // Execute the module function
197 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
198 /******/
199 /******/ // Return the exports of the module
200 /******/ return module.exports;
201 /******/ }
202 /******/
203 /************************************************************************/
204 /******/ /* webpack/runtime/compat get default export */
205 /******/ (() => {
206 /******/ // getDefaultExport function for compatibility with non-harmony modules
207 /******/ __webpack_require__.n = (module) => {
208 /******/ var getter = module && module.__esModule ?
209 /******/ () => (module['default']) :
210 /******/ () => (module);
211 /******/ __webpack_require__.d(getter, { a: getter });
212 /******/ return getter;
213 /******/ };
214 /******/ })();
215 /******/
216 /******/ /* webpack/runtime/define property getters */
217 /******/ (() => {
218 /******/ // define getter functions for harmony exports
219 /******/ __webpack_require__.d = (exports, definition) => {
220 /******/ for(var key in definition) {
221 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
222 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
223 /******/ }
224 /******/ }
225 /******/ };
226 /******/ })();
227 /******/
228 /******/ /* webpack/runtime/hasOwnProperty shorthand */
229 /******/ (() => {
230 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
231 /******/ })();
232 /******/
233 /******/ /* webpack/runtime/make namespace object */
234 /******/ (() => {
235 /******/ // define __esModule on exports
236 /******/ __webpack_require__.r = (exports) => {
237 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
238 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
239 /******/ }
240 /******/ Object.defineProperty(exports, '__esModule', { value: true });
241 /******/ };
242 /******/ })();
243 /******/
244 /************************************************************************/
245 var __webpack_exports__ = {};
246 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
247 (() => {
248 "use strict";
249 /*!******************************************************!*\
250 !*** ./assets/src/js/pro/acf-pro-ui-options-page.js ***!
251 \******************************************************/
252 __webpack_require__.r(__webpack_exports__);
253 /* harmony import */ var _acf_ui_options_page__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_acf-ui-options-page */ "./assets/src/js/pro/_acf-ui-options-page.js");
254 /* harmony import */ var _acf_ui_options_page__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_acf_ui_options_page__WEBPACK_IMPORTED_MODULE_0__);
255
256 })();
257
258 /******/ })()
259 ;
260 //# sourceMappingURL=acf-pro-ui-options-page.js.map