mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-11-04 01:52:55 +00:00 
			
		
		
		
	Rework button handler
This commit is contained in:
		@@ -2,13 +2,16 @@ let ws = new WebSocket('ws://' + document.location.host + '/ws');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$('#container').on('click', '.anchor', ( function (event) {
 | 
					$('#container').on('click', '.anchor', ( function (event) {
 | 
				
			||||||
 | 
					    let anchorName = $(this).attr('id').replace('_event', '');
 | 
				
			||||||
 | 
					    let data = JSON.stringify({
 | 
				
			||||||
 | 
					        'anchor': anchorName,
 | 
				
			||||||
 | 
					        'data': $('#' + anchorName).text()
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    console.log('Sending: ');
 | 
				
			||||||
 | 
					    console.log(data);
 | 
				
			||||||
 | 
					    ws.send(data);
 | 
				
			||||||
 | 
					}));
 | 
				
			||||||
        let anchorName = $(this).attr('id').replace('_event', '');
 | 
					        let anchorName = $(this).attr('id').replace('_event', '');
 | 
				
			||||||
        let data = JSON.stringify({
 | 
					 | 
				
			||||||
            'anchor': anchorName,
 | 
					 | 
				
			||||||
            'data': $('#' + anchorName).text()
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        console.log("Sending: " + data);
 | 
					 | 
				
			||||||
        ws.send(data);
 | 
					 | 
				
			||||||
    }));
 | 
					    }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ws.onmessage = function (messageEvent) {
 | 
					ws.onmessage = function (messageEvent) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user