wp/wp-admin/js/svg-painter.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    10 	'use strict';
    10 	'use strict';
    11 	var selector, base64, painter,
    11 	var selector, base64, painter,
    12 		colorscheme = {},
    12 		colorscheme = {},
    13 		elements = [];
    13 		elements = [];
    14 
    14 
    15 	$(document).ready( function() {
    15 	$( function() {
    16 		// Detection for browser SVG capability.
    16 		// Detection for browser SVG capability.
    17 		if ( document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
    17 		if ( document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
    18 			$( document.body ).removeClass( 'no-svg' ).addClass( 'svg' );
    18 			$( document.body ).removeClass( 'no-svg' ).addClass( 'svg' );
    19 			wp.svgPainter.init();
    19 			wp.svgPainter.init();
    20 		}
    20 		}
   158 				} else {
   158 				} else {
   159 					// Paint icon in base color.
   159 					// Paint icon in base color.
   160 					painter.paintElement( $element, 'base' );
   160 					painter.paintElement( $element, 'base' );
   161 
   161 
   162 					// Set hover callbacks.
   162 					// Set hover callbacks.
   163 					$menuitem.hover(
   163 					$menuitem.on( 'mouseenter', function() {
   164 						function() {
   164 						painter.paintElement( $element, 'focus' );
   165 							painter.paintElement( $element, 'focus' );
   165 					} ).on( 'mouseleave', function() {
   166 						},
   166 						// Match the delay from hoverIntent.
   167 						function() {
   167 						window.setTimeout( function() {
   168 							// Match the delay from hoverIntent.
   168 							painter.paintElement( $element, 'base' );
   169 							window.setTimeout( function() {
   169 						}, 100 );
   170 								painter.paintElement( $element, 'base' );
   170 					} );
   171 							}, 100 );
       
   172 						}
       
   173 					);
       
   174 				}
   171 				}
   175 			});
   172 			});
   176 		},
   173 		},
   177 
   174 
   178 		paintElement: function( $element, colorType ) {
   175 		paintElement: function( $element, colorType ) {