From 408dbca3782c1b9e479a3bef755aa18063d33527 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 25 Jun 2015 08:07:08 -0500 Subject: [PATCH] bug 1150118 - A bit of JS cleanup --- media/js/fonts.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/media/js/fonts.js b/media/js/fonts.js index dfa2dc76fbe..5cf610e5244 100644 --- a/media/js/fonts.js +++ b/media/js/fonts.js @@ -6,21 +6,21 @@ // what fonts are we loading? var fonts = [ { - "name" : "Open Sans Light", - "class" : "ffo-opensanslight", - "varient" : [ - {"weight" : "normal"}, - {"weight" : "bold"}, - {"style" : "italic"} + 'name' : 'Open Sans Light', + 'class' : 'ffo-opensanslight', + 'varient' : [ + {'weight' : 'normal'}, + {'weight' : 'bold'}, + {'style' : 'italic'} ] }, { - "name" : "Open Sans", - "class" : "ffo-opensans", - "varient" : [ - {"weight" : "normal"}, - {"weight" : "bold"}, - {"style" : "italic"} + 'name' : 'Open Sans', + 'class' : 'ffo-opensans', + 'varient' : [ + {'weight' : 'normal'}, + {'weight' : 'bold'}, + {'style' : 'italic'} ] } ]; @@ -33,8 +33,8 @@ // load the observer plug in $.getScript('/media/js/fontfaceobserver-min.js') - .done(ffoLoad) - .fail(ffoFinished); + .done(ffoLoad) + .fail(ffoFinished); // starts observers for all fonts in fonts array function ffoLoad() { @@ -80,11 +80,11 @@ $.each(fontsLoaded, function(){ var isLoaded = true; $.each(this, function(){ - if(this == false) { + if(!this) { isLoaded = false; } }) - if(isLoaded == false) { + if(!isLoaded) { allLoaded = false; } }); @@ -110,13 +110,14 @@ $.each(fontsLoaded, function(index) { var fontAttribute = index; var fontLoaded = true; + $.each(this, function() { - if(this == false) { + if(!this) { fontLoaded = false; } }) - if(fontLoaded == true) { - $('html').attr("data-"+fontAttribute, true); + if(fontLoaded) { + $('html').attr('data-' + fontAttribute, true); } }); }