about.js
2 weeks ago
admin-notifications.js
2 weeks ago
builders-preview-handler.js
2 weeks ago
callout.js
2 weeks ago
cff-admin-scripts.js
2 weeks ago
divi-handler.min.js
2 weeks ago
extensions.js
2 weeks ago
oembeds.js
2 weeks ago
settings.js
2 weeks ago
smash-usage-session.js
2 weeks ago
support.js
2 weeks ago
vue.min.js
2 weeks ago
about.js
137 lines
| 1 | var extensions_data = { |
| 2 | genericText: cff_about.genericText, |
| 3 | links: cff_about.links, |
| 4 | extentions_bundle: cff_about.extentions_bundle, |
| 5 | supportPageUrl: cff_about.supportPageUrl, |
| 6 | plugins: cff_about.pluginsInfo, |
| 7 | socialWallActivated: cff_about.socialWallActivated, |
| 8 | socialWallLinks: cff_about.socialWallLinks, |
| 9 | recommendedPlugins: cff_about.recommendedPlugins, |
| 10 | social_wall: cff_about.social_wall, |
| 11 | aboutBox: cff_about.aboutBox, |
| 12 | ajax_handler: cff_about.ajax_handler, |
| 13 | nonce: cff_about.nonce, |
| 14 | buttons: cff_about.buttons, |
| 15 | icons: cff_about.icons, |
| 16 | btnClicked: null, |
| 17 | btnStatus: null, |
| 18 | btnName: null, |
| 19 | isSetupPage : false |
| 20 | } |
| 21 | |
| 22 | var cffAbout = new Vue({ |
| 23 | el: "#cff-about", |
| 24 | http: { |
| 25 | emulateJSON: true, |
| 26 | emulateHTTP: true |
| 27 | }, |
| 28 | data: extensions_data, |
| 29 | methods: { |
| 30 | activatePlugin: function( plugin, name, index, type ) { |
| 31 | this.btnClicked = index + 1; |
| 32 | this.btnStatus = 'loading'; |
| 33 | this.btnName = name; |
| 34 | |
| 35 | let data = new FormData(); |
| 36 | data.append( 'action', 'cff_activate_addon' ); |
| 37 | data.append( 'nonce', this.nonce ); |
| 38 | data.append( 'plugin', plugin ); |
| 39 | data.append( 'type', 'plugin' ); |
| 40 | if ( this.extentions_bundle && type == 'extension' ) { |
| 41 | data.append( 'extensions_bundle', this.extentions_bundle ); |
| 42 | } |
| 43 | fetch(this.ajax_handler, { |
| 44 | method: "POST", |
| 45 | credentials: 'same-origin', |
| 46 | body: data |
| 47 | }) |
| 48 | .then(response => response.json()) |
| 49 | .then(data => { |
| 50 | if( data.success == true ) { |
| 51 | if ( name === 'social_wall' ) { |
| 52 | this.social_wall.activated = true; |
| 53 | } else if ( type === 'recommended_plugin' ) { |
| 54 | this.recommendedPlugins[name].activated = true; |
| 55 | } else { |
| 56 | this.plugins[name].activated = true; |
| 57 | } |
| 58 | this.btnClicked = null; |
| 59 | this.btnStatus = null; |
| 60 | this.btnName = null; |
| 61 | } |
| 62 | }); |
| 63 | }, |
| 64 | deactivatePlugin: function( plugin, name, index, type ) { |
| 65 | this.btnClicked = index + 1; |
| 66 | this.btnStatus = 'loading'; |
| 67 | this.btnName = name; |
| 68 | |
| 69 | let data = new FormData(); |
| 70 | data.append( 'action', 'cff_deactivate_addon' ); |
| 71 | data.append( 'nonce', this.nonce ); |
| 72 | data.append( 'plugin', plugin ); |
| 73 | data.append( 'type', 'plugin' ); |
| 74 | if ( this.extentions_bundle && type == 'extension' ) { |
| 75 | data.append( 'extensions_bundle', this.extentions_bundle ); |
| 76 | } |
| 77 | fetch(this.ajax_handler, { |
| 78 | method: "POST", |
| 79 | credentials: 'same-origin', |
| 80 | body: data |
| 81 | }) |
| 82 | .then(response => response.json()) |
| 83 | .then(data => { |
| 84 | if( data.success == true ) { |
| 85 | if ( name === 'social_wall' ) { |
| 86 | this.social_wall.activated = false; |
| 87 | } else if ( type === 'recommended_plugin' ) { |
| 88 | this.recommendedPlugins[name].activated = false; |
| 89 | } else { |
| 90 | this.plugins[name].activated = false; |
| 91 | } |
| 92 | this.btnClicked = null; |
| 93 | this.btnName = null; |
| 94 | this.btnStatus = null; |
| 95 | } |
| 96 | return; |
| 97 | }); |
| 98 | }, |
| 99 | installPlugin: function( plugin, name, index, type ) { |
| 100 | this.btnClicked = index + 1; |
| 101 | this.btnStatus = 'loading'; |
| 102 | this.btnName = name; |
| 103 | |
| 104 | let data = new FormData(); |
| 105 | data.append( 'action', 'cff_install_addon' ); |
| 106 | data.append( 'nonce', this.nonce ); |
| 107 | data.append( 'plugin', plugin ); |
| 108 | data.append( 'type', 'plugin' ); |
| 109 | fetch(this.ajax_handler, { |
| 110 | method: "POST", |
| 111 | credentials: 'same-origin', |
| 112 | body: data |
| 113 | }) |
| 114 | .then(response => response.json()) |
| 115 | .then(data => { |
| 116 | if( data.success == true ) { |
| 117 | if ( type === 'recommended_plugin' ) { |
| 118 | this.recommendedPlugins[name].installed = true; |
| 119 | this.recommendedPlugins[name].activated = true; |
| 120 | } else { |
| 121 | this.plugins[name].installed = true; |
| 122 | this.plugins[name].activated = true; |
| 123 | } |
| 124 | this.btnClicked = null; |
| 125 | this.btnName = null; |
| 126 | this.btnStatus = null; |
| 127 | } |
| 128 | return; |
| 129 | }); |
| 130 | }, |
| 131 | buttonIcon: function() { |
| 132 | if ( this.btnStatus == 'loading' ) { |
| 133 | return this.icons.loaderSVG |
| 134 | } |
| 135 | }, |
| 136 | } |
| 137 | }) |