Update the test for webfonts
This was broken when jquery.uls moved to github Change-Id: I874fb96301726792e7d22d66e71406192c44cf9f
This commit is contained in:
@@ -1,32 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8" />
|
||||||
|
<title>jQuery WebFonts Example</title>
|
||||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
<meta name="description" content="" />
|
||||||
Remove this if you use the .htaccess -->
|
<meta name="author" content="Santhosh Thottingal" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
|
||||||
|
<script src="../lib/jquery.webfonts.js"></script>
|
||||||
<title>jQuery WebFonts Example</title>
|
<script src="../lib/jquery.uls/jquery.uls.js"></script>
|
||||||
<meta name="description" content=""/>
|
<script src="../resources/js/ext.uls.webfonts.repository.js"></script>
|
||||||
<meta name="author" content="Santhosh Thottingal"/>
|
<script>
|
||||||
<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
|
$( document ).ready( function () {
|
||||||
<link rel="shortcut icon" href="/favicon.ico"/>
|
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png"/>
|
|
||||||
<script src="../lib/jquery.uls/examples/resources/jquery.js"></script>
|
|
||||||
<script src="../lib/jquery.webfonts.js"></script>
|
|
||||||
<script src="../lib/jquery.uls/src/jquery.uls.data.js"></script>
|
|
||||||
<script src="../lib/jquery.uls/src/jquery.uls.data.utils.js"></script>
|
|
||||||
<script src="../resources/js/ext.uls.webfonts.repository.js"></script>
|
|
||||||
<script>
|
|
||||||
$( document ).ready(
|
|
||||||
function () {
|
|
||||||
$( 'div#webfonts-preview-area' ).webfonts( {
|
$( 'div#webfonts-preview-area' ).webfonts( {
|
||||||
repository: $.webfonts.repository
|
repository: $.webfonts.repository
|
||||||
} );
|
} );
|
||||||
// get an instance of WebFonts
|
// get an instance of WebFonts
|
||||||
var $webfonts = $( 'div#webfonts-preview-area' ).data(
|
var $webfonts = $( 'div#webfonts-preview-area' ).data( 'webfonts' );
|
||||||
'webfonts' );
|
|
||||||
// Get a list of all fonts provided by WebFonts
|
// Get a list of all fonts provided by WebFonts
|
||||||
var fonts = $webfonts.list();
|
var fonts = $webfonts.list();
|
||||||
var languages = $webfonts.languages();
|
var languages = $webfonts.languages();
|
||||||
@@ -35,44 +24,43 @@
|
|||||||
var $langselector = $( 'select#language' );
|
var $langselector = $( 'select#language' );
|
||||||
|
|
||||||
function listFonts ( fonts ) {
|
function listFonts ( fonts ) {
|
||||||
$.merge( fonts, ['Sans', 'Serif'] );
|
$.merge( fonts, [ 'Sans', 'Serif' ] );
|
||||||
$fontSelector.find( 'option' ).remove();
|
$fontSelector.find( 'option' ).remove();
|
||||||
$.each( fonts, function ( key, font ) {
|
$.each( fonts, function ( key, font ) {
|
||||||
$fontSelector.append( $( "<option></option>" ).attr(
|
$fontSelector.append( $( "<option></option>" )
|
||||||
"value", font ).text( font ) );
|
.attr( "value", font ).text( font ) );
|
||||||
} );
|
} );
|
||||||
$fontSelector.trigger( 'change' );
|
$fontSelector.trigger( 'change' );
|
||||||
}
|
}
|
||||||
|
|
||||||
listFonts( fonts );
|
listFonts( fonts );
|
||||||
$.each( languages, function ( lang, language ) {
|
$.each( languages, function ( lang, language ) {
|
||||||
$langselector.append( $( "<option></option>" ).attr(
|
$langselector.append( $( "<option></option>" )
|
||||||
"value", language ).text( language + " - " +
|
.attr( "value", language )
|
||||||
$.uls.data.autonym( language ) ) );
|
.text( language + " - " + $.uls.data.autonym( language ) ) );
|
||||||
} );
|
} );
|
||||||
$fontSelector.on( 'change', function () {
|
$fontSelector.on( 'change', function () {
|
||||||
var font = $fontSelector.find( 'option:selected' ).val();
|
var font = $fontSelector.find( 'option:selected' ).val();
|
||||||
$webfonts.apply( font );
|
$webfonts.apply( font );
|
||||||
} );
|
} );
|
||||||
$langselector.on( 'change', function () {
|
$langselector.on( 'change', function () {
|
||||||
var language = $langselector.find( 'option:selected' )
|
var language = $langselector.find( 'option:selected' ).val();
|
||||||
.val();
|
|
||||||
listFonts( $webfonts.list( language ) );
|
listFonts( $webfonts.list( language ) );
|
||||||
$( '#webfonts-preview-area' ).text( $.uls.data.autonym( language ) );
|
$( '#webfonts-preview-area' ).text( $.uls.data.autonym( language ) );
|
||||||
} );
|
} );
|
||||||
} )
|
} )
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
div#webfonts-preview-toolbar {
|
div#webfonts-preview-toolbar {
|
||||||
background-color: #F9F9F9;
|
background-color: #F9F9F9;
|
||||||
border: 1px solid #CCCCCC;
|
border: 1px solid #CCCCCC;
|
||||||
border-radius: 4px 4px 0 0;
|
border-radius: 4px 4px 0 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#webfonts-preview-area {
|
div#webfonts-preview-area {
|
||||||
border: 1px solid #CCCCCC;
|
border: 1px solid #CCCCCC;
|
||||||
border-radius: 0 0 4px 4px;
|
border-radius: 0 0 4px 4px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
@@ -81,22 +69,22 @@
|
|||||||
padding: 10px 5px;
|
padding: 10px 5px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.langselector, .fontselector {
|
.langselector,.fontselector {
|
||||||
float: left;
|
float: left;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
<header>
|
<header>
|
||||||
<h1>jQuery WebFonts example</h1>
|
<h1>jQuery WebFonts example</h1>
|
||||||
</header>
|
</header>
|
||||||
@@ -110,10 +98,8 @@
|
|||||||
Font : <select id="fontselector"></select>
|
Font : <select id="fontselector"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div contenteditable="true" id="webfonts-preview-area">The quick brown fox jumps over the
|
<div contenteditable="true" id="webfonts-preview-area"></div>
|
||||||
lazy dog
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user