First round injecting news articles into homepages using serverside precompiled snippets
This commit is contained in:
		
							
								
								
									
										26
									
								
								roles/Foundation/files/custom/public/assets/js/aninix.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								roles/Foundation/files/custom/public/assets/js/aninix.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
/* RSS Reading */
 | 
			
		||||
function insertNewsSnippet(snippet,tag) {
 | 
			
		||||
    /* DOM XML handling has been too problematic, so we are now using git-hooks to pre-generate the snippet. This function injects that snippet.
 | 
			
		||||
     * param snippet: URI for the snippet
 | 
			
		||||
     * param tag: div tag to overwrite
 | 
			
		||||
     */
 | 
			
		||||
    var http_request = false;
 | 
			
		||||
    http_request = new XMLHttpRequest();
 | 
			
		||||
    http_request.open("GET",snippet,true);
 | 
			
		||||
    http_request.setRequestHeader("Cache-Control", "no-cache");
 | 
			
		||||
    http_request.setRequestHeader("Pragma", "no-cache");
 | 
			
		||||
    http_request.onreadystatechange = function() {
 | 
			
		||||
        if (http_request.readyState == 4) {
 | 
			
		||||
            if (http_request.status == 200) {
 | 
			
		||||
                if (http_request.responseText != null) {
 | 
			
		||||
                    document.getElementById(tag).innerHTML = http_request.responseText;
 | 
			
		||||
                } else {
 | 
			
		||||
                    alert("Failed to receive RSS file from the server - file not found.");
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    http_request.send(null);
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user