Mercurial Hosting > lang
comparison src/site.js @ 2:78708fa556a0
add login
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Jul 2025 15:55:34 -0600 |
parents | 1c87f785eb42 |
children | b1adec083e44 |
comparison
equal
deleted
inserted
replaced
1:1c87f785eb42 | 2:78708fa556a0 |
---|---|
27 } | 27 } |
28 }; | 28 }; |
29 request.send(postData); | 29 request.send(postData); |
30 } | 30 } |
31 | 31 |
32 window.onerror = function(msg, url, line, col, error) { | |
33 if( !url ) | |
34 return; | |
35 let err = msg; | |
36 err += '\nurl = ' + url; | |
37 if( url != window.location ) | |
38 err += '\npage = ' + window.location; | |
39 err += '\nline = '+line; | |
40 if( col ) | |
41 err += '\ncolumn = ' + col; | |
42 if( error ) { | |
43 if( error.stack ) | |
44 err += '\nstack = ' + error.stack; | |
45 if( error.cause ) | |
46 err += '\ncause= ' + error.cause; | |
47 if( error.fileName ) | |
48 err += '\nfileName= ' + error.fileName; | |
49 } | |
50 if( window.err ) { | |
51 err += window.err; | |
52 window.err = null; | |
53 } | |
54 ajax( '/error_log.js', 'err='+encodeURIComponent(err) ); | |
55 }; | |
56 | |
57 function ajaxForm(url,form) { | |
58 let post = ''; | |
59 for( let i=0; i<form.length; i++ ) { | |
60 let input = form[i]; | |
61 let name = input.name; | |
62 if( name === '' ) | |
63 continue; | |
64 let type = input.type; | |
65 if( (type==='radio' || type==='checkbox') && !input.checked ) | |
66 continue; | |
67 post += name + '=' + encodeURIComponent(input.value) + '&'; | |
68 } | |
69 ajax(url,post,{form:form}); | |
70 } | |
71 | |
72 | |
32 function showWaitingAiIcon() { | 73 function showWaitingAiIcon() { |
33 document.querySelector('[waiting-ai-icon]').style.display = 'block'; | 74 document.querySelector('[waiting-ai-icon]').style.display = 'block'; |
34 } | 75 } |
35 | 76 |
36 const isMobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; | 77 const isMobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; |