PluginProbe ʕ •ᴥ•ʔ
File Manager Pro – Filester / trunk
File Manager Pro – Filester vtrunk
2.1.1 trunk 1.6.1 1.7.6 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 2.0 2.0.1 2.0.2 2.1.0
filester / assets / js / cross.js
filester / assets / js Last commit date
toastr 5 years ago cross.js 5 years ago file_manager_admin.js 9 months ago review.js 5 years ago
cross.js
131 lines
1 jQuery(document).ready(function () {
2 const fbv_cross = `<div id="filebird_cross" class="fbv-cross-wrap">
3 <div class="fbv-cross-popup">
4 <div class="fbv-cross-icon-wrap">
5 <i class="fbv-icon fbv-i-folder"></i>
6 <i class="dashicons dashicons-no-alt"></i>
7 </div>
8 <div class="fbv-cross-sub">
9 <span>Organize your files</span>
10 </div>
11 </div>
12 <div class="fbv-cross-window">
13 <div class="fbv-cross-window-mess">
14 <h3>Your WordPress media library is messy?</h3>
15 <span>Start using FileBird to organize your files into folders by drag and drop.</span>
16 </div>
17 <div class="fbv-cross-window-img-wrap">
18 <img src="https://ps.w.org/filebird/assets/screenshot-2.gif" alt="screenshot_demo">
19 </div>
20 <div class="fbv-cross-window-btn">
21 <div><a class="button button-primary fbv-cross-install" href="javascript:;"><i class="dashicons dashicons-wordpress-alt"></i>Install for free</a></div>
22 <div><a class="fbv-cross-link fbv-cross-hide-popup" href="javascript:;" rel="noopener noreferrer">Don't display again</a></div>
23 </div>
24 </div>
25 </div>`
26
27 const install_failed = `<div class="fbv-noti-install-failed"><div class="fbv-label-error">Oops! Installation failed.</div><div>Please try <a href="${njtCross.filebird_install_url}">manual installation</a>.</div></div>`
28
29 jQuery.fn.exists = function (callback) {
30 var args = [].slice.call(arguments, 1)
31 if (this.length) {
32 callback.call(this, args)
33 }
34 return this
35 }
36 jQuery('body.upload-php #wpfooter').exists(function () {
37 njtCross.show_popup && this.append(fbv_cross)
38 })
39 jQuery('.fbv-cross-popup').click(function () {
40 jQuery(this).parent().toggleClass('fbv-cross-popup-open')
41 })
42 jQuery('.fbv-cross-link.fbv-cross-hide-popup').click(function () {
43 const a = jQuery('#filebird_cross')
44
45 jQuery.ajax({
46 url: ajaxurl,
47 method: 'POST',
48 data: {
49 action: 'njt_filebird_cross_hide',
50 nonce: njtCross.nonce,
51 type: 'popup'
52 },
53 beforeSend: function(){
54 a.removeClass('fbv-cross-popup-open').addClass('fbv_permanent_hide')
55 },
56 success: function(){
57 // a.removeClass('fbv-cross-popup-open').addClass('fbv_permanent_hide')
58 setTimeout(function () {
59 a.remove()
60 }, 2000)
61 }
62 })
63 // const a = jQuery('#filebird_cross')
64 // a.removeClass('fbv-cross-popup-open').addClass('fbv_permanent_hide')
65 // setTimeout(function () {
66 // a.remove()
67 // }, 2000)
68 })
69 jQuery('.fbv-cross-link.fbv-cross-hide-notification').click(function(){
70 jQuery.ajax({
71 url: ajaxurl,
72 type: 'POST',
73 dataType: 'json',
74 data: {
75 action: 'njt_filebird_cross_hide',
76 nonce: njtCross.nonce,
77 type: 'notification'
78 }
79 }).done(function(result) {
80 if (result.success) {
81 jQuery('#njt-ads-wrapper button.notice-dismiss').click()
82 } else {
83 console.log("Error", result.data.status)
84 }
85 });
86 })
87 jQuery('.fbv-cross-install:not(.fbv_installing)').click(function (e) {
88 e.preventDefault()
89 const normal = '<i class="dashicons dashicons-wordpress-alt"></i>Install for free'
90 const loading = '<i class="dashicons dashicons-update-alt"></i>Installing<span class="text-dots"><span>.<span></span>'
91 const done = '<i class="dashicons dashicons-saved"></i>Installed! Organize files now'
92 const error = '<i class="dashicons dashicons-warning"></i>Install failed. Retry'
93 const a = jQuery(this)
94
95 jQuery.ajax({
96 url: ajaxurl,
97 method: 'POST',
98 data: {
99 action: 'njt_filebird_cross_install',
100 nonce: njtCross.nonce
101 },
102 beforeSend: function(){
103 a.focusout()
104 a.addClass('fbv_installing')
105 a.html(loading)
106 },
107 success: function(response){
108 if (response.success) {
109 a.removeClass('fbv_installing').addClass('fbv_done')
110 a.html(done)
111 a.off('click')
112 a.click(()=> { window.location.href = njtCross.media_url })
113 } else {
114 a.removeClass('fbv_installing').addClass('fbv_error')
115 a.parent().after(install_failed)
116 a.html(error)
117 }
118 },
119 error: function(response){
120 a.removeClass('fbv_installing').addClass('fbv_error')
121 a.parent().after(install_failed)
122 a.html(error)
123 }
124 })
125 // setTimeout(function () {
126 // a.removeClass('fbv_installing').addClass('fbv_done')
127 // a.html(done)
128 // }, 3000)
129 })
130 })
131