PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 8.2
Jetpack – WP Security, Backup, Speed, & Growth v8.2
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / custom-css / custom-css / js / css-editor.js
css-editor.js
91 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global postboxes, addLoadEvent */
2
3 ( function( $ ) {
4 var safe, win, safecssResize, safecssInit;
5
6 safecssResize = function() {
7 safe.height( win.height() - safe.offset().top - 250 );
8 };
9
10 safecssInit = function() {
11 safe = $( '#safecss' );
12 win = $( window );
13
14 postboxes.add_postbox_toggles( 'editcss' );
15 safecssResize();
16
17 // Bound on a parent to ensure that this click event executes last.
18 $( '#safecssform' ).on( 'click', '#preview', function( e ) {
19 e.preventDefault();
20
21 document.forms.safecssform.target = 'csspreview';
22 document.forms.safecssform.action.value = 'preview';
23 document.forms.safecssform.submit();
24 document.forms.safecssform.target = '';
25 document.forms.safecssform.action.value = 'save';
26 } );
27 };
28
29 window.onresize = safecssResize;
30 addLoadEvent( safecssInit );
31 } )( jQuery );
32
33 jQuery( function( $ ) {
34 $( '.edit-preprocessor' ).bind( 'click', function( e ) {
35 e.preventDefault();
36
37 $( '#preprocessor-select' ).slideDown();
38 $( this ).hide();
39 } );
40
41 $( '.cancel-preprocessor' ).bind( 'click', function( e ) {
42 e.preventDefault();
43
44 $( '#preprocessor-select' ).slideUp( function() {
45 $( '.edit-preprocessor' ).show();
46 $( '#preprocessor_choices' ).val( $( '#custom_css_preprocessor' ).val() );
47 } );
48 } );
49
50 $( '.save-preprocessor' ).bind( 'click', function( e ) {
51 e.preventDefault();
52
53 $( '#preprocessor-select' ).slideUp();
54 $( '#preprocessor-display' ).text( $( '#preprocessor_choices option:selected' ).text() );
55 $( '#custom_css_preprocessor' )
56 .val( $( '#preprocessor_choices' ).val() )
57 .change();
58 $( '.edit-preprocessor' ).show();
59 } );
60
61 $( '.edit-css-mode' ).bind( 'click', function( e ) {
62 e.preventDefault();
63
64 $( '#css-mode-select' ).slideDown();
65 $( this ).hide();
66 } );
67
68 $( '.cancel-css-mode' ).bind( 'click', function( e ) {
69 e.preventDefault();
70
71 $( '#css-mode-select' ).slideUp( function() {
72 $( '.edit-css-mode' ).show();
73 $( 'input[name=add_to_existing_display][value=' + $( '#add_to_existing' ).val() + ']' ).attr(
74 'checked',
75 true
76 );
77 } );
78 } );
79
80 $( '.save-css-mode' ).bind( 'click', function( e ) {
81 e.preventDefault();
82
83 $( '#css-mode-select' ).slideUp();
84 $( '#css-mode-display' ).text(
85 $( 'input[name=add_to_existing_display]:checked' ).val() === 'true' ? 'Add-on' : 'Replacement'
86 );
87 $( '#add_to_existing' ).val( $( 'input[name=add_to_existing_display]:checked' ).val() );
88 $( '.edit-css-mode' ).show();
89 } );
90 } );
91