PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.0.0
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.0.0
4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Ends / Back / Settings / assets / js / settings.js
embedpress / EmbedPress / Ends / Back / Settings / assets / js Last commit date
settings.js 5 years ago
settings.js
216 lines
1 function embedPressRemoveURLParameter(url, parameter) {
2 //prefer to use l.search if you have a location/link object
3 let urlparts = url.split('?');
4 if (urlparts.length >= 2) {
5
6 let prefix = encodeURIComponent(parameter) + '=';
7 let pars = urlparts[1].split(/[&;]/g);
8
9 //reverse iteration as may be destructive
10 for (var i = pars.length; i-- > 0;) {
11 //idiom for string.startsWith
12 if (pars[i].lastIndexOf(prefix, 0) !== -1) {
13 pars.splice(i, 1);
14 }
15 }
16
17 return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : '');
18 }
19 return url;
20 }
21 jQuery(document).ready( function($){
22
23 // Sidebar Menu Toggle
24 $('.sidebar__dropdown .sidebar__link--toggler').on('click', function(e) {
25 e.preventDefault();
26 let $this = $(this);
27 let $sidebarItem = $('.sidebar__item');
28 $sidebarItem.removeClass('show');
29 $this.parent().addClass('show');
30 if($this.siblings('.dropdown__menu').hasClass('show')){
31 $this.siblings('.dropdown__menu').removeClass('show');
32 $this.siblings('.dropdown__menu').slideUp();
33 $sidebarItem.removeClass('show');
34 }else{
35 $('.dropdown__menu.show').slideUp().removeClass('show');
36 $this.siblings('.dropdown__menu').addClass('show');
37 // $('.sidebar__menu .dropdown__menu.show').slideUp();
38 $this.siblings('.dropdown__menu').slideDown();
39 }
40 })
41
42 // Sidebar Toggle
43 $('.sidebar__toggler').on('click', function(e) {
44 e.preventDefault();
45 $(this).siblings('.sidebar__menu').slideToggle();
46 })
47
48 // Logo Remove
49 $('#yt_preview__remove').on('click', function(e) {
50 e.preventDefault();
51 $('.preview__logo__input').val('');
52 $('#yt_logo_url').val('');
53 $('#yt_logo_id').val('');
54 $("#yt_logo_preview").attr('src', '');
55 $('.preview__box img').attr('src', '');
56 $("#yt_logo__upload__preview").hide();
57 $("#yt_logo_upload_wrap").show();
58 })
59
60 // Logo Controller
61 let rangeSlider = function(){
62 let slider = $('.logo__adjust__controller__inputs'),
63 previewImg = $('.preview__logo'),
64 opRange = $('.opacity__range'),
65 xRange = $('.x__range'),
66 yRange = $('.y__range'),
67 value = $('.range__value');
68
69 slider.each(function(){
70
71 value.each(function(){
72 var value = $(this).prev().attr('value');
73 $(this).html(value);
74 });
75
76 opRange.on('input', function(){
77 $(this).next(value).val(this.value);
78 console.log(this.value / 100);
79 previewImg.css('opacity', this.value / 100);
80 });
81 xRange.on('input', function(){
82 $(this).next(value).val(this.value);
83 previewImg.css('right', this.value + "%");
84 });
85 yRange.on('input', function(){
86 $(this).next(value).val(this.value);
87 previewImg.css('bottom', this.value + "%");
88 });
89 });
90 };
91
92 rangeSlider();
93
94 $('.template__wrapper .input__switch input').on('click', function() {
95 $(this).parents('.form__control__wrap').children('.logo__adjust__wrap').slideToggle();
96 })
97
98 let proFeatureAlert = function() {
99
100 $(document).on('click', '.isPro', function () {
101 $(this).siblings('.pro__alert__wrap').fadeIn();
102 });
103
104 $(document).on('click', '.pro__alert__card .button', function (e) {
105 e.preventDefault();
106 $(this).parents('.pro__alert__wrap').fadeOut();
107 });
108 }
109
110 proFeatureAlert();
111
112 // custom logo upload for youtube
113 $(document).on('click', '#yt_logo_upload_wrap', function(e){
114 e.preventDefault();
115 let curElement = $('.preview__logo');
116 let $yt_logo_upload_wrap = $("#yt_logo_upload_wrap");
117 let $yt_logo__upload__preview = $("#yt_logo__upload__preview");
118 let $yt_logo_preview = $("#yt_logo_preview");
119 let $yt_logo_url = $('#yt_logo_url');
120 let $yt_logo_id = $('#yt_logo_id');
121 let button = $(this),
122 yt_logo_uploader = wp.media({
123 title: 'Custom Logo',
124 library : {
125 uploadedTo : wp.media.view.settings.post.id,
126 type : 'image'
127 },
128 button: {
129 text: 'Use this image'
130 },
131 multiple: false
132 }).on('select', function() {
133 let attachment = yt_logo_uploader.state().get('selection').first().toJSON();
134 if (attachment && attachment.id && attachment.url){
135 $yt_logo_upload_wrap.hide();
136 $yt_logo_url.val(attachment.url);
137 $yt_logo_id.val(attachment.id);
138 $yt_logo_preview.attr('src', attachment.url);
139 $yt_logo__upload__preview.show();
140 curElement.attr('src', attachment.url);
141 }else{
142 console.log('something went wrong using selected image');
143 }
144 }).open();
145 });
146
147
148 // Elements
149 $(document).on('change', '.element-check', function (e) {
150 let $input = $(this);
151 $.ajax({
152 url: ajaxurl,
153 type: 'post',
154 data: {
155 action: 'embedpress_elements_action',
156 _wpnonce: embedpressObj.nonce,
157 element_type: $input.data('type'),
158 element_name: $input.data('name'),
159 checked: $input.is(":checked"),
160 },
161 success: function(response) {
162 if (response && response.success){
163 showSuccessMessage();
164 }else{
165 showErrorMessage();
166 }
167 },
168 error: function(error) {
169 showErrorMessage();
170 },
171 });
172 });
173 /**
174 * It shows success message in a toast alert
175 * */
176 function showSuccessMessage() {
177 let $success_message_node = $('.toast__message--success');
178 $success_message_node.addClass('show');
179 setTimeout(function (){
180 $success_message_node.removeClass('show');
181 }, 3000);
182 }
183 /**
184 * It shows error message in a toast alert
185 * */
186 function showErrorMessage(){
187 let $error_message_node = $('.toast__message--error');
188 $error_message_node.addClass('show');
189 setTimeout(function (){
190 $error_message_node.removeClass('show');
191 }, 3000);
192 }
193
194 $('.ep-color-picker').wpColorPicker();
195
196
197 // license
198 $(document).on('click', '.embedpress-license-deactivation-btn', function (e) {
199 let $this = $(this);
200 setTimeout(function (){
201 $this.attr('disabled', 'disabled');
202 }, 2000);
203 $this.html('Deactivating.....');
204 });
205 $(document).on('click', '.embedpress-license-activation-btn', function (e) {
206 let $this = $(this);
207 let val = $('#embedpress-pro-license-key').val();
208 if (val){
209 setTimeout(function (){
210 $this.attr('disabled', 'disabled');
211 }, 2000);
212 $this.html('Activating.....');
213 }
214 });
215 });
216