SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.9 KiB

<html>
<head>
<title>dojo.html.metrics tests</title>
<script type="text/javascript">
var djConfig={ isDebug:true };
</script>
<script type="text/javascript" src="../../dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.html.metrics");
dojo.require("dojo.json");
dojo.require("dojo.string.Builder");
var html="<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p> "
+"<p>Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.</p>"
+"<h2>Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.</h2> "
+"<p>Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima,</p>"
+"<p><strong>Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.</strong></p>";
dojo.addOnLoad(function(){
var m=dojo.byId("measurements");
var scr=dojo.html.getScrollbar().width;
var h=dojo.html.getFontMeasurements();
var sb=new dojo.string.Builder();
sb.append('<div>Scrollbar width: <strong>' + scr + '</strong></div>');
for(var p in h){
sb.append('<div>' + p + ': <strong>' + h[p] + '</strong> pixels</div>');
}
dojo.byId("fragSource").innerHTML = html;
sb.append("<div>Measure fragment: " + dojo.json.serialize(dojo.html.measureFragment(dojo.byId("fragmeasure"), html)) + "</div>");
m.innerHTML = sb;
dojo.byId("singleline").value = dojo.html.getFittedFragment(dojo.byId("fragment"), html);
dojo.byId("fragremainder").value = dojo.html.fitToElement(dojo.byId("fragment"), html);
});
</script>
</head>
<body>
<h2>Scrollbar and font measurements</h2>
<div id="measurements"></div>
<h2>Fragment tests</h2>
<div>
<div id="fragment" style="width:300px;height:300px;border:1px solid #ccc;margin:0 12px;float:left;"></div>
<div>Remaining fragment</div>
<div style="margin:12px;width:auto;"><textarea id="fragremainder" style="width:300px;height:160px;overflow:auto;font-size:11px;">values</textarea></div>
<div>Single line fit to fragment box</div>
<div style="margin:12px;width:auto;"><textarea id="singleline" style="width:300px;height:160px;overflow:auto;font-size:11px;">values</textarea></div>
<div id="fragmeasure" style="clear:both;"></div>
</div>
<h2>source fragment</h2>
<div id="fragSource" style="border:1px solid #ccc;margin:12px;padding:12px;"></div>
</body>
</html>