PluginProbe ʕ •ᴥ•ʔ
Customizer Export/Import / 0.3
Customizer Export/Import v0.3
trunk 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.9.1 0.9.2 0.9.7 0.9.7.1 0.9.7.2 0.9.7.3 0.9.8
customizer-export-import / js / customizer.js
customizer-export-import / js Last commit date
customizer.js 11 years ago
customizer.js
40 lines
1 ( function( $ ) {
2
3 var CEI = {
4
5 init: function()
6 {
7 $( 'input[name=cei-export-button]' ).on( 'click', CEI._export );
8 $( 'input[name=cei-import-button]' ).on( 'click', CEI._import );
9 },
10
11 _export: function()
12 {
13 window.location.href = CEIConfig.customizerURL + '?cei-export=' + CEIConfig.exportNonce;
14 },
15
16 _import: function()
17 {
18 var win = $( window ),
19 body = $( 'body' ),
20 form = $( '<form class="cei-form" method="POST" enctype="multipart/form-data"></form>' ),
21 controls = $( '.cei-import-controls' ),
22 file = $( 'input[name=cei-import-file]' ),
23 message = $( '.cei-uploading' );
24
25 if ( '' == file.val() ) {
26 alert( CEIl10n.emptyImport );
27 }
28 else {
29 win.off( 'beforeunload' );
30 body.append( form );
31 form.append( controls );
32 message.show();
33 form.submit();
34 }
35 }
36 };
37
38 $( CEI.init );
39
40 })( jQuery );