mirror of
				https://github.com/KevinMidboe/Node-Com-Handler.git
				synced 2025-10-29 17:50:27 +00:00 
			
		
		
		
	Start of a skeleton where a searchresult is displayed by pure JS.
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								v1/__pycache__/tmdb.cpython-34.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								v1/__pycache__/tmdb.cpython-34.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										57
									
								
								v1/searchDisplay.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								v1/searchDisplay.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
	<title>tmdb.org Search Displayer</title>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
	<p id="display"></p>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
	function request(id){
 | 
			
		||||
		console.log(id);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var data = "{}";
 | 
			
		||||
 | 
			
		||||
	var xhr = new XMLHttpRequest();
 | 
			
		||||
	xhr.withCredentials = true;
 | 
			
		||||
 | 
			
		||||
	xhr.addEventListener("readystatechange", function () {
 | 
			
		||||
	  if (this.readyState === this.DONE) {
 | 
			
		||||
	  	var display = document.getElementById("display");
 | 
			
		||||
	  	var jsonObj = JSON.parse(this.responseText);
 | 
			
		||||
	  	console.log(jsonObj.movies);
 | 
			
		||||
 | 
			
		||||
	  	Object.keys(jsonObj.movies).forEach(function(key) {
 | 
			
		||||
	  		var id = jsonObj.movies[key].id;
 | 
			
		||||
	  		var title = jsonObj.movies[key].title;
 | 
			
		||||
	  		var poster_path = "http://image.tmdb.org/t/p/w500"+jsonObj.movies[key].poster_path;
 | 
			
		||||
	  		
 | 
			
		||||
	  		var node = document.createElement("li");                 // Create a <li> node
 | 
			
		||||
			var imageNode = document.createElement('img');
 | 
			
		||||
			var textNode = document.createTextNode(title);         // Create a text node
 | 
			
		||||
			var buttonNode = document.createElement("span");
 | 
			
		||||
			var button2Node = document.createElement("span");
 | 
			
		||||
			buttonNode.innerHTML = '<button onclick="request('+ id +')">REQUEST</button>';
 | 
			
		||||
			button2Node.innerHTML = '<button onclick="request('+ id +')">FORCE REQUEST</button>';
 | 
			
		||||
			
 | 
			
		||||
			imageNode.src = poster_path;
 | 
			
		||||
 | 
			
		||||
			node.appendChild(textNode);       	                    // Append the text to <li>
 | 
			
		||||
			node.appendChild(imageNode);
 | 
			
		||||
			node.appendChild(buttonNode);
 | 
			
		||||
			node.appendChild(button2Node);
 | 
			
		||||
 | 
			
		||||
			display.appendChild(node);
 | 
			
		||||
 | 
			
		||||
	  	});
 | 
			
		||||
	  }
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	xhr.open("GET", "http://localhost:63590/api/v1/plex/request?query=star+wars");
 | 
			
		||||
 | 
			
		||||
	xhr.send(data);
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user