PluginProbe ʕ •ᴥ•ʔ
Advanced Ads – Ad Manager & AdSense / 2.0.5
Advanced Ads – Ad Manager & AdSense v2.0.5
2.0.26 2.0.25 2.0.24 2.0.23 2.0.22 2.0.21 1.38.0 1.39.0 1.39.1 1.39.2 1.39.3 1.39.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.40.0 1.40.1 1.40.2 1.41.0 1.42.0 1.42.1 1.42.2 1.43.0 1.44.0 1.44.1 1.45.0 1.45.1 1.46.0 1.47.0 1.47.1 1.47.2 1.47.3 1.47.4 1.47.5 1.48.0 1.48.1 1.49.0 1.5.0 1.5.0.1 1.5.1 1.5.2 1.5.2.1 1.5.4 1.5.4.1 1.5.5 1.50.0 1.51.0 1.51.1 1.51.2 1.51.3 1.52.0 1.52.1 1.52.2 1.52.3 1.52.4 1.53.0 1.53.1 1.53.2 1.54.0 1.54.1 1.55.0 1.56.0 1.56.1 1.56.2 1.56.3 1.56.4 1.6 1.6.1 1.6.10 1.6.10.1 1.6.10.2 1.6.11 1.6.11.1 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.17.1 1.6.17.2 1.6.2 1.6.2.1 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.6.1 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.6.8.3 1.6.9 1.6.9.1 1.6.9.2 1.6.9.3 1.6.9.4 1.7 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.1.1 1.7.1.2 1.7.1.3 1.7.1.4 1.7.1.5 1.7.10 trunk 1.7.11 1.0.1 1.7.12 1.0.2 1.7.13 1.0.3 1.7.14 1.1.0 1.7.15 1.1.1 1.7.16 1.1.2 1.7.17 1.1.3 1.7.18 1.10 1.7.19 1.10.1 1.7.2 1.10.10 1.7.2.1 1.10.11 1.7.20 1.10.12 1.7.21 1.10.2 1.7.22 1.10.3 1.7.23 1.10.4 1.7.24 1.10.5 1.7.25 1.10.6 1.7.3 1.10.7 1.7.4 1.10.8 1.7.4.1 1.10.9 1.7.4.2 1.11 1.7.4.3 1.11.1 1.7.4.4 1.11.2 1.7.4.5 1.12 1.7.5 1.13 1.7.5.1 1.13.1 1.7.6 1.13.2 1.7.7 1.13.3 1.7.8 1.13.4 1.7.9 1.13.5 1.7.9.1 1.13.6 1.7.9.2 1.13.7 1.7.9.3 1.13.8 1.8 1.14 1.8.1 1.14.1 1.8.10 1.14.10 1.8.11 1.14.11 1.8.12 1.14.2 1.8.13 1.14.3 1.8.14 1.14.4 1.8.15 1.14.5 1.8.16 1.14.6 1.8.17 1.14.7 1.8.18 1.14.8 1.8.19 1.14.9 1.8.2 1.15 1.8.20 1.16 1.8.21 1.16.1 1.8.22 1.17 1.8.23 1.17.1 1.8.24 1.17.10 1.8.25 1.17.10-rc.1 1.8.26 1.17.11 1.8.27 1.17.12 1.8.28 1.17.12-rc.1 1.8.29 1.17.2 1.8.3 1.17.3 1.8.30 1.17.4 1.8.4 1.17.5 1.8.5 1.17.6 1.8.6 1.17.7 1.8.7 1.17.8 1.8.8 1.17.9 1.8.9 1.17.9-beta.1 1.9 1.18.0 2.0.0 1.19.0 2.0.1 1.19.1 2.0.10 1.2 2.0.11 1.2.1 2.0.12 1.2.2 2.0.13 1.2.3 2.0.14 1.2.4 2.0.15 1.2.5 2.0.16 1.2.6 2.0.17 1.2.7 2.0.18 1.20.0 2.0.19 1.20.0-rc.1 2.0.2 1.20.0-rc.2 2.0.20 1.20.1 2.0.3 1.20.2 2.0.4 1.20.3 2.0.5 1.21.0 2.0.6 1.21.1 2.0.7 1.22.0 2.0.8 1.22.1 2.0.9 1.22.2 1.23.0 1.23.1 1.23.2 1.24.0 1.24.1 1.24.2 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.29.0 1.29.1 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.30.0 1.30.1 1.30.2 1.30.2-rc.1 1.30.3 1.30.4 1.30.4-rc.1 1.30.5 1.31.0 1.31.1 1.32.0 1.32.0-rc.1 1.33.0 1.33.1 1.33.2 1.34.0 1.35.0 1.35.1 1.36.0 1.36.1 1.36.2 1.36.3 1.37.0 1.37.1 1.37.2
advanced-ads / admin / assets / js / wizard.js
advanced-ads / admin / assets / js Last commit date
adblocker-image-data.js 1 year ago admin-global.js 1 year ago admin.js 1 year ago admin.min.js 1 year ago advertisement.js 9 years ago conditions.js 1 year ago dialog-advads-modal.js 1 year ago groups.js 1 year ago termination.js 1 year ago ui.js 3 years ago wizard.js 1 year ago
wizard.js
214 lines
1 /* eslint-disable camelcase */
2
3 const advads_wizard = {
4 box_order: [
5 // selectors of elements in the wizard in the correct order
6 '#post-body-content, #ad-types-box', // show title and type together
7 '#ad-parameters-box',
8 '#ad-targeting-box', // display and visitor conditions
9 ],
10 current_box: '#post-body-content, #ad-types-box', // current active box
11 one_column: false, // whether the edit screen is in one-column mode
12 status: false, // what is the current status? true if running, else false
13 init() {
14 // status can be "start" to start wizard or nothing to not start it
15 const _this = this;
16 jQuery('#advads-wizard-controls-next').on('click', function () {
17 _this.next();
18 });
19
20 jQuery('#advads-wizard-controls-prev').on('click', function () {
21 _this.prev();
22 });
23
24 jQuery('#advads-wizard-controls-save').on('click', function (e) {
25 e.preventDefault();
26 jQuery('#publish').trigger('click');
27 }); // save ad
28
29 jQuery('#advads-wizard-display-conditions-show').on(
30 'click',
31 function () {
32 _this.show_conditions('#ad-targeting-box');
33 }
34 );
35
36 jQuery('#advads-wizard-visitor-conditions-show').on(
37 'click',
38 function () {
39 _this.show_conditions('#ad-targeting-box');
40 }
41 );
42
43 jQuery('.advads-show-in-wizard').hide();
44 jQuery('#advads-start-wizard').on('click', function () {
45 _this.start();
46 });
47
48 // end wizard when the button was clicked
49 jQuery('.advads-stop-wizard').on('click', function () {
50 _this.close();
51 });
52
53 // jump to next box when ad type is selected
54 jQuery('#advanced-ad-type input').on('change', function () {
55 _this.next();
56 });
57 },
58 show_current_box() {
59 jQuery(this.current_box).removeClass('advads-hide');
60 },
61 start() {
62 // do stuff when wizard is started
63 if (!this.is_form_valid()) {
64 return;
65 }
66 // show page in 1-column stype
67 this.status = true;
68 if (jQuery('#post-body').hasClass('columns-1')) {
69 this.one_column = true;
70 } else {
71 jQuery('#post-body').addClass('columns-1').removeClass('columns-2');
72 }
73 // hide all boxes, messages and the headline by adding a hide css class
74 jQuery(
75 '#post-body-content, .postbox-container .postbox, h1 ~ div:not(.advads-admin-notice):not(#message.updated), h1'
76 ).addClass('advads-hide');
77 // display first box
78 this.show_current_box();
79 // display close button and controls
80 jQuery('#advads-stop-wizard, #advads-wizard-controls').removeClass(
81 'hidden'
82 );
83 this.update_nav();
84 // initially hide some elemente
85 jQuery('#advads-ad-description').addClass('advads-hide'); // ad description
86 jQuery('#advads-ad-info').addClass('advads-hide'); // shortcode and php function info
87 // hide all elements with 'advads-hide-for-wizard' class
88 jQuery('.advads-hide-in-wizard').hide();
89 jQuery('.advads-show-in-wizard').show();
90 jQuery('#advads-start-wizard').hide();
91 // remove close-class from ad type box
92 jQuery('#ad-types-box').removeClass('closed');
93 this.save_hide_wizard(false);
94 },
95 close() {
96 // close the wizard by showing all elements again
97 this.status = false;
98 jQuery('.advads-hide').removeClass('advads-hide');
99 jQuery('#advads-stop-wizard, #advads-wizard-controls').addClass(
100 'hidden'
101 );
102 if (this.one_column !== true) {
103 jQuery('#post-body').addClass('columns-2').removeClass('columns-1');
104 }
105 // reset current box
106 this.current_box = this.box_order[0];
107 jQuery('#advads-wizard-welcome').remove(); // close wizard welcome message
108 // show all elements with 'advads-hide-for-wizard' class
109 jQuery('.advads-hide-in-wizard').show();
110 jQuery('.advads-show-in-wizard').hide();
111 jQuery('#advads-start-wizard').show();
112 this.save_hide_wizard(true);
113 },
114 update_nav() {
115 // update navigation, display only valid buttons
116 // display all buttons
117 jQuery('#advads-wizard-controls button').removeClass('hidden');
118 // hide next button if there is no next widget
119 const i = this.box_order.indexOf(this.current_box);
120 if (i === this.box_order.length - 1) {
121 jQuery('#advads-wizard-controls-next').addClass('hidden');
122 }
123 if (i === 0) {
124 jQuery('#advads-wizard-controls-prev').addClass('hidden');
125 }
126 // hide save button for first boxes
127 if (i <= 1) {
128 jQuery('#advads-wizard-controls-save').addClass('hidden');
129 } else {
130 jQuery('#advads-wizard-controls-save').removeClass('hidden');
131 }
132 },
133
134 /**
135 * Check the form just before some of its fields become hidden.
136 */
137 is_form_valid() {
138 const form = jQuery('form#post')[0];
139
140 if (form.checkValidity && form.reportValidity) {
141 if (!form.checkValidity()) {
142 // Highlight invalid fields.
143 form.reportValidity();
144 return false;
145 }
146 return true;
147 }
148 // Disable validation so that hidden invalid fields do not prevent the form from being sent.
149 form.setAttribute('novalidate', true);
150 return true;
151 },
152 next() {
153 // show next box
154 if (!this.is_form_valid()) {
155 return;
156 }
157 if (!this.status) {
158 return;
159 }
160 // get index of current item in box-array
161 const i = this.box_order.indexOf(this.current_box);
162 // check if there is a next index
163 if (this.box_order[i + 1] === undefined) {
164 return;
165 }
166 // hide current element
167 jQuery(this.current_box).addClass('advads-hide');
168 // load next element into current
169 this.current_box = this.box_order[i + 1];
170 this.show_current_box();
171 this.update_nav();
172 },
173 prev() {
174 // show previous box
175 if (!this.is_form_valid()) {
176 return;
177 }
178 // get index of current item in box-array
179 const i = this.box_order.indexOf(this.current_box);
180 // check if there is a previous index
181 if (this.box_order[i - 1] === undefined) {
182 return;
183 }
184 // hide current element
185 jQuery(this.current_box).addClass('advads-hide');
186 // load next element into current
187 this.current_box = this.box_order[i - 1];
188 this.show_current_box();
189 this.update_nav();
190 },
191 save_hide_wizard(hideWizard) {
192 // update wizard state (started by default or not?)
193
194 jQuery.ajax({
195 type: 'POST',
196 url: ajaxurl,
197 data: {
198 action: 'advads-save-hide-wizard-state',
199 hideWizard,
200 nonce: advadsglobal.ajax_nonce,
201 },
202 });
203 },
204 show_conditions(box) {
205 // show the conditions options in display and visitor conditions
206 jQuery(box).find('.advads-show-in-wizard').hide();
207 jQuery(box).find('.advads-hide-in-wizard').show();
208 },
209 };
210
211 jQuery(document).ready(function () {
212 advads_wizard.init();
213 });
214