PluginProbe
ezCache / 1.3
ezCache v1.3
2.6.5 2.6.4 2.6.2 2.6.3 2.6.1 2.6.0 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5 2.2.1 2.2.2 trunk 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.3 1.3.1 1.3.10 1.3.11 All 49 releases
ezcache / assets / src / js / options.js

options.js in ezCache 1.3, at assets/src/js/options.js

54 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import Vue from 'vue';
2 import UniqueId from 'vue-unique-id';
3 import VueRouter from 'vue-router'
4 import axios from 'axios';
5 import Fragment from 'vue-fragment';
6 import VueSweetalert2 from 'vue-sweetalert2';
7
8 import OptionsScreen from './Pages/OptionsScreen';
9 import Stats from './Pages/Stats';
10 import Settings from './Pages/Settings';
11 import AdvancedSettings from './Pages/AdvancedSettings';
12 import License from './Pages/License';
13
14 window.axios = axios;
15 window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
16 window.axios.defaults.headers.common['X-WP-Nonce'] = window.ezcache.rest_nonce;
17
18 Vue.use(UniqueId);
19 Vue.use(VueRouter);
20 Vue.use(Fragment.Plugin);
21 Vue.use(VueSweetalert2);
22
23 let {trans, ...ezcache} = window.ezcache;
24
25 Vue.prototype.$window = window;
26 Vue.prototype.$eventBus = new Vue();
27 Vue.prototype.$wp = {
28 ...ezcache,
29 trans(key) {
30 return trans[key] ? trans[key] : `__${key}__`;
31 }
32 };
33
34 Vue.component('ezc-options', OptionsScreen);
35
36 Vue.mixin({
37 methods: {
38 toast(text, type='success') {
39 return this.$swal({ position: 'bottom-start', type: type, text: text, timer: 2000, toast: true, showCancelButton: false, showCloseButton: false, showConfirmButton: false });
40 }
41 }
42 });
43
44 const routes = [
45 { path: '/', component: Stats },
46 { path: '/settings', component: Settings },
47 { path: '/advanced', component: AdvancedSettings },
48 { path: '/license', component: License },
49 ];
50
51 const router = new VueRouter({ routes });
52
53 new Vue({ router }).$mount('#ezcache-options');
54