PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.65
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.65
1.2.76 1.2.75 1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 All 176 releases
userswp / vendor / ayecode / wp-deactivation-survey / ayecode-ds.js

ayecode-ds.js in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.65, at vendor/ayecode/wp-deactivation-survey/ayecode-ds.js

146 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($) {
2
3 if(!window.ayecodeds)
4 window.ayecodeds = {};
5
6 if(ayecodeds.DeactivateFeedbackForm)
7 return;
8
9 ayecodeds.DeactivateFeedbackForm = function(plugin)
10 {
11 var self = this;
12 var strings = ayecodeds_deactivate_feedback_form_strings;
13 var support_btn = plugin.support_url ? '<a class="button button-primary" href="'+plugin.support_url+'" target="_blank" >'+strings.get_support+'</a>' : '';
14 var documentation = plugin.documentation_url ? ' <a class="button button-primary" href="'+plugin.documentation_url+'" target="_blank" >'+strings.documentation+'</a>' : '';
15 this.plugin = plugin;
16
17 // Dialog HTML
18 var element = $('\
19 <div class="ayecodeds-deactivate-dialog" data-modal-id="' + plugin.slug + '">\
20 <form>\
21 <input type="hidden" name="plugin"/>\
22 <h2>' + strings.quick_feedback + '<span id="ayecodeds-plugin-name"></span></h2>\
23 <p>\
24 ' + strings.foreword + '\
25 </p>\
26 <ul class="ayecodeds-deactivate-reasons"></ul>\
27 <input id="ayecode-feedback-other" name="comments" placeholder="' + strings.brief_description + '" style="width: 100%;padding: 5px;display: none;"/>\
28 <p class="ayecodeds-help-buttons" style="float: left;display: none;">\
29 '+support_btn+documentation+'\
30 </p> \
31 <p class="ayecodeds-deactivate-dialog-buttons" style="float: right;">\
32 <input type="submit" class="button confirm" value="' + strings.skip_and_deactivate + '"/>\
33 <button data-modal-action="cancel" class="button button-primary" onclick="tb_remove();jQuery(\'#ayecode-deactivation-form\').html(\'\');return false;">' + strings.cancel + '</button>\
34 </p>\
35 </form><style>#TB_window {overflow-y:auto;border-radius: 4px;height: fit-content !important;width:auto !important; left: 50%;top: 50% !important;margin-left: unset !important; -webkit-transform: translate(-50%, -50%);transform: translate(-50%, -50%);}#TB_title{display:none;}#TB_ajaxContent {height: auto !important;}</style>\
36 </div>\
37 ')[0];
38 this.element = element;
39
40 var pluginNiceName = $("#the-list [data-slug='" + plugin.slug + "'] .plugin-title strong").text();
41
42 $(element).find("input[name='plugin']").val(JSON.stringify(plugin));
43
44 $(element).find("#ayecodeds-plugin-name").text(" - "+pluginNiceName);
45 //
46
47 $(element).on("click", "input[name='reason']", function(event) {
48 $(element).find("input[type='submit']").val(
49 strings.submit_and_deactivate
50 );
51
52 //hide then we can show if needed
53 jQuery("#ayecode-feedback-other,.ayecodeds-help-buttons").hide();
54 if(jQuery(this).val()=="other"){
55 jQuery("#ayecode-feedback-other").attr('placeholder',strings.brief_description ).show();
56 }else if(jQuery(this).val()=="found-better-plugin"){
57 jQuery("#ayecode-feedback-other").attr('placeholder',strings.better_plugins_name ).show();
58 }else if(jQuery(this).val()=="suddenly-stopped-working" || jQuery(this).val()=="plugin-broke-site" || jQuery(this).val()=="plugin-setup-difficult" || jQuery(this).val()=="plugin-design-difficult"){
59 jQuery(".ayecodeds-help-buttons").show();
60 }
61
62 });
63
64 $(element).find("form").on("submit", function(event) {
65 self.onSubmit(event);
66 });
67
68 // Reasons list
69 var ul = $(element).find("ul.ayecodeds-deactivate-reasons");
70 for(var key in plugin.reasons)
71 {
72 var li = $("<li><input type='radio' name='reason'/> <span></span></li>");
73
74 $(li).find("input").val(key);
75 $(li).find("span").html(plugin.reasons[key]);
76 $(ul).append(li);
77 }
78
79 // Listen for deactivate
80 $("#the-list [data-slug='" + plugin.slug + "'] .deactivate>a").on("click", function(event) {
81 self.onDeactivateClicked(event);
82 });
83 };
84
85 ayecodeds.DeactivateFeedbackForm.prototype.onDeactivateClicked = function(event)
86 {
87
88 var strings = ayecodeds_deactivate_feedback_form_strings;
89 this.deactivateURL = event.target.href;
90
91 event.preventDefault();
92
93 if(!$('#ayecode-deactivation-form').length){
94 $( "#wpfooter" ).after( "<div id='ayecode-deactivation-form' style='display: none;'></div>" );
95 }
96
97 $('#ayecode-deactivation-form').html(this.element);
98
99 tb_show(strings.quick_feedback,'#TB_inline?height=auto&inlineId=ayecode-deactivation-form');
100
101 };
102
103 ayecodeds.DeactivateFeedbackForm.prototype.onSubmit = function(event)
104 {
105 var element = this.element;
106 var strings = ayecodeds_deactivate_feedback_form_strings;
107 var self = this;
108 var data = $(element).find("form").serialize();
109
110 $(element).find("button, input[type='submit']").prop("disabled", true);
111
112 if($(element).find("input[name='reason']:checked").length)
113 {
114 $(element).find("input[type='submit']").val(strings.thank_you);
115
116 $.ajax({
117 type: "POST",
118 url: "https://wpgeodirectory.com/tracking/",
119 data: data,
120 complete: function() {
121 window.location.href = self.deactivateURL;
122 }
123 });
124 }
125 else
126 {
127 $(element).find("input[type='submit']").val(strings.please_wait);
128 window.location.href = self.deactivateURL;
129 }
130
131 event.preventDefault();
132 return false;
133 };
134
135 $(document).ready(function() {
136
137 for(var i = 0; i < ayecodeds_deactivate_feedback_form_plugins.length; i++)
138 {
139 var plugin = ayecodeds_deactivate_feedback_form_plugins[i];
140 new ayecodeds.DeactivateFeedbackForm(plugin);
141 // console.log(plugin);
142 }
143
144 });
145
146 })(jQuery);