1+ < html >
2+ < head >
3+ < meta name ='viewport ' content ='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no '/>
4+ < style type ="text/css ">
5+ html , body {
6+ margin : 0 ;
7+
8+ width : 100% ;
9+ height : 100% ;
10+ min-width : 100% ;
11+ min-height : 100% ;
12+ }
13+
14+ body {
15+ display : flex;
16+ flex-direction : column;
17+ align-items : center;
18+ justify-content : center;
19+ }
20+
21+ .git-commit-info {
22+ font-family : Consolas, 'Courier New' , Courier, monospace;
23+ background-color : # f1f1f1 ;
24+ padding : 2px ;
25+ text-align : left;
26+ }
27+ # git-hash {
28+ text-align : center;
29+ }
30+ # output {
31+ margin : 0 ;
32+ padding : 0 ;
33+ }
34+ </ style >
35+ </ head >
36+ < body >
37+ < div id ="git-hash "> </ div >
38+ < p id ="output ">
39+ < canvas id ="canvas "> </ canvas >
40+ </ p >
41+ < script src ="gitrev.js "> </ script >
42+ < script >
43+ var siteURL = new URL ( window . location . href ) ;
44+ var w = siteURL . searchParams . get ( "w" ) || "800" ;
45+ var h = siteURL . searchParams . get ( "h" ) || "480" ;
46+ var canvas = document . getElementById ( 'canvas' ) ;
47+ canvas . setAttribute ( "width" , w ) ;
48+ canvas . setAttribute ( "height" , h ) ;
49+ console . log ( "Requested " + w + "x" + h + " px" ) ;
50+ var Module = {
51+ print : function ( text ) {
52+ console . log ( text ) ;
53+ } ,
54+ printErr : function ( text ) {
55+ console . error ( text ) ;
56+ } ,
57+ canvas : ( function ( ) {
58+ return canvas ;
59+ } ) ( ) ,
60+ arguments : [ siteURL . searchParams . get ( "w" ) || "800" , siteURL . searchParams . get ( "h" ) || "480" , siteURL . searchParams . get ( "example" ) ?? "default" ]
61+ } ;
62+ if ( typeof window . git_hash != 'undefined' ) {
63+ var gitHashDiv = document . querySelector ( "#git-hash" ) ;
64+ var gitLink = document . createElement ( "div" ) ;
65+ var gitHashComponents = window . git_hash . split ( " " ) . filter ( component => component . trim ( ) . length > 0 ) ;
66+ for ( var i = 0 ; i < gitHashComponents . length ; i ++ ) {
67+ console . log ( gitHashComponents [ i ] , gitHashComponents [ i ] . length ) ;
68+ /* This is an extremely lazy way of checking for a Git hash, but it works */
69+ if ( gitHashComponents [ i ] . length == 40 ) {
70+ gitHashComponents [ i ] = `<a href="https://github.com/lvgl/${ gitHashComponents [ i + 1 ] } /commit/${ gitHashComponents [ i ] } ">${ gitHashComponents [ i ] } </a>` ;
71+ } else {
72+ /* Repository name */
73+ gitHashComponents [ i ] += "<br/>" ;
74+ }
75+ }
76+ gitLink . classList . add ( "git-commit-info" ) ;
77+ gitLink . innerHTML = gitHashComponents . join ( " " ) ;
78+ gitHashDiv . textContent = "LVGL compiled to Emscripten. Git commit information:" ;
79+ gitHashDiv . appendChild ( gitLink ) ;
80+ }
81+ window . addEventListener ( "click" , ( ) => window . focus ( ) ) ;
82+ </ script >
83+ {{{ SCRIPT }}}
84+ </ body >
85+ </ html >
0 commit comments