Agent code and restructuring
This commit is contained in:
@@ -26,6 +26,47 @@
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.webview.js"></script>
|
||||
<script src="javascript/download.js"></script>
|
||||
<script>
|
||||
window.DotNetReference = null;
|
||||
window.SetDotnetReference = function (dotnetReference) {
|
||||
window.DotNetReference = dotnetReference;
|
||||
};
|
||||
|
||||
window.getUserAgent = () => {
|
||||
return navigator.userAgent;
|
||||
};
|
||||
window.SetFocusToElement = (elementId) => {
|
||||
document.getElementById(elementId).focus();
|
||||
};
|
||||
|
||||
document.addEventListener("keydown", function (e) {
|
||||
DotNetReference?.invokeMethodAsync('OnKeyPress', e.key, e.ctrlKey, e.shiftKey, e.altKey, e.metaKey)
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
window.glossaryInterop = {
|
||||
dotNetRef: null,
|
||||
init: function(dotNetRef) {
|
||||
this.dotNetRef = dotNetRef;
|
||||
document.addEventListener('click', function(e) {
|
||||
var target = e.target;
|
||||
while (target) {
|
||||
if (target.classList && target.classList.contains('glossary-link')) {
|
||||
var id = target.getAttribute('data-glossary-id');
|
||||
if (id && window.glossaryInterop.dotNetRef) {
|
||||
window.glossaryInterop.dotNetRef.invokeMethodAsync('OpenGlossaryTerm', id);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
target = target.parentElement;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script crossorigin="anonymous"
|
||||
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
||||
src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user