r85674 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85673‎ | r85674 | r85675 >
Date:16:57, 8 April 2011
Author:santhosh
Status:deferred
Tags:
Comment:
UI changes - checkbox instead of link to select font.
Modified paths:
  • /trunk/extensions/WebFonts/js/webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/js/webfonts.js
@@ -88,14 +88,17 @@
8989 // Build font dropdown
9090 $select = $( '<ul />' );
9191 for ( var scheme in config ) {
92 - $fontlink = $( '<a />' )
93 - .css( { "font-size": "1.2em" } )
94 - .text( config[scheme] );
95 -
 92+ $fontlink = $( '<input>' )
 93+ .attr("type","radio")
 94+ .attr("name","font")
 95+ .attr("id","webfont-"+config[scheme])
 96+ .attr("value",config[scheme] );
 97+
9698 $fontItem = $( '<li />' )
9799 .val( config[scheme] )
98 - .append( $fontlink );
99 -
 100+ .append( $fontlink )
 101+ .append( config[scheme] );
 102+
100103 haveSchemes = true;
101104 //some closure trick :)
102105 (function (font) {
@@ -106,15 +109,17 @@
107110
108111 $select.append($fontItem);
109112 }
110 - $fontlink = $( '<a />' )
111 - .text( 'Reset' )
112 - .css( { "font-size": "1.2em" } )
113 - .click( function( event ) {
114 - $.webfonts.set( 'none');
115 - });
 113+ $fontlink = $( '<input >' )
 114+ .attr("type","radio")
 115+ .attr("name","font")
 116+ .attr("name","webfont-none")
 117+ .click( function( event ) {
 118+ $.webfonts.set( 'none');
 119+ });
116120 $fontItem = $( '<li />' )
117121 .val( 'none')
118 - .append( $fontlink );
 122+ .append( $fontlink )
 123+ .append( "Reset");
119124
120125 $select.append($fontItem);
121126
@@ -144,10 +149,14 @@
145150
146151 if(cookie_font == null){
147152 $.webfonts.set( config[0]);
 153+ //mark it as checked
 154+ $('#webfont-'+config[0]).attr('checked', 'checked');
148155 }
149156 else{
150157 if (cookie_font !=='none'){
151158 $.webfonts.set( cookie_font);
 159+ //mark it as checked
 160+ $('#webfont-'+cookie_font).attr('checked', 'checked');
152161 }
153162 }
154163

Status & tagging log