Skip to content

Commit

Permalink
Update index and apptexviewer
Browse files Browse the repository at this point in the history
  • Loading branch information
wsricardo committed Jun 26, 2024
1 parent cea81d2 commit cc170d0
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 20 deletions.
84 changes: 70 additions & 14 deletions apptexviewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
<head>
<meta charset="utf-8">
<title>LaTex View Page</title>
<script type="text/javascript" id="MathJax-script" defer
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
},
svg: {
fontCache: 'global'
}
};
</script>


<style>

Expand Down Expand Up @@ -99,18 +113,26 @@
}
};
</script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>


<script>
//let m;
//let content;
//const Promise = Promise.resolve();

//const scriptLoad = document.querySelector("#MathJax-script");
//scriptLoad.addEventListener( 'load', () => {
// let sl = new Promise( ( resolve ) => {
// resolve( scriptLoad['src'] );
//
// } );
//} );



function insertElem(elem_tag, elem_content, elem_where=document) {
var tage = document.createElement(elem_tag);
var tagcont = document.createTextNode(elem_content)
var tage = document.createElement( elem_tag );
var tagcont = document.createTextNode( elem_content )
//tage.appendChild(tagcont);
//elem_where.appendChild(tage);
}
Expand All @@ -136,30 +158,65 @@
}*/
var tagcontent = document.createTextNode(out_text);
//out.appendChild(tagcontent);

out.insertAdjacentHTML("beforeend", out_text);


console.log('>> ', out_text);
console.log(">", out.outerText);
//console.log("post> ", post);

MathJax.typeset();
MathJax.typeset( );

}
function docprint(){
setTimeout( window.print() , 2000 );
MathJax.typeset();
}

function saveprint2(){
const text = document.getElementsByTagName("textarea");
document.body.innerHTML = '<div onload="print();">'+text["textarea"].value+'</div>';
MathJax.typeset();
print();
}

async function saveprint(){
function saveprint(){
console.log("save called!");
var text = document.getElementsByTagName("textarea");
var out = document.createTextNode(text["textarea"].value);

const out_content = document.createTextNode( text["textarea"].value );

var out = document.createElement("div");

document.body.innerHTML = "";
document.body.style="padding: 12px; font-size: 22pt; margin: 8px; color: black; width: auto;";
document.body.appendChild(out);
out.append( out_content );


document.body.append(out);
out.setAttribute( "onload", "print();" );

console.log("value textarea ", out );

//convert() ;
//return document;

//docprint();

MathJax.typeset();

window.print();
/*await new Promise( ( resolve ) => {
console.log("Run promisse for window print.")
resolve( docprint() );
} );*/

}

async function checkParamURL( ) {
// If param text in url insert latex text in texfield and render latex.

const textField = document.querySelector("textarea");

const url = new URL( window.location.href )
Expand All @@ -180,8 +237,7 @@

textField.value = text;
}

convert();
await convert();
//console.log('if text');
return text;
} else {
Expand All @@ -193,10 +249,10 @@


}

checkParamURL()



</script>


Expand Down
7 changes: 1 addition & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@
</head>
<body>
<div style="display: inline-grid; font-size: 18pt; text-decoration: none; color: white; background-color: gray; padding: 20px 6px 2px 6px; margin: 20% 25% 20% 25%; width: 40%; height: auto; border-radius: 10px; box-shadow: whitesmoke 4px 6px 6px 4px;">
<a style="text-decoration: none; text-align: center; margin: 10px; padding: 12px; float: center;" href="apptexviewer">Welcome to Latex & Tex Viewer </a>
<a style="text-decoration: none; text-align: center; margin: 10px; padding: 12px; float: center;" href="apptexviewer.html">Welcome to Latex & Tex Viewer </a>
<a style="text-align: center; padding: 4px; font-size: 12pt;" href="https://wsricardo.blogspot.com">Blog WSRicardo</a>
<br /><br>
<div style="text-align: center; float: center; padding: 2px;">
<form action="https://www.paypal.com/donate" method="post" target="_top">
<input type="hidden" name="hosted_button_id" value="PRD59UQUD5NPG" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_BR/i/scr/pixel.gif" width="1" height="1" />
</form>
</div>
</div>
</body>
Expand Down

0 comments on commit cc170d0

Please sign in to comment.