Code:make-nutrition0.9-url-from-sql-results.html: Difference between revisions

new domain name
(Created page with "The main use-case of this code, is to show the global food supply in the [//olam.wiki/nutrition.html Nutrition Calculator]. This code will take the results of certain SQL queries (see Code:food1.sql) and convert them into URLs. The input (SQL query results) must be formatted like the following example: <pre> 50|Molasses 150|Onions, raw </pre> For each row, there must be the ''number of grams'', followed by the {{!}} character, followed by the ''name of the food'...")
 
(new domain name)
 
Line 1: Line 1:
The main use-case of this code, is to show the global [[food]] supply in the [//olam.wiki/nutrition.html Nutrition Calculator].
The main use-case of this code, is to show the global food supply in the [{{SERVER}}/nutrition.html Nutrition Calculator].


This code will take the results of certain SQL queries (see [[Code:food1.sql]]) and convert them into URLs. The input (SQL query results) must be formatted like the following example:
This code will take the results of certain SQL queries (see [[Code:food1.sql]]) and convert them into URLs. The input (SQL query results) must be formatted like the following example:
Line 12: Line 12:
<html><head><script>
<html><head><script>
  function generate() {
  function generate() {
   var url = 'https://olam.wiki/nutrition.html?targets=averaged&timescale=1';
   var url = 'https://thechange.wiki/nutrition.html?targets=averaged&timescale=1';
   var title = document.getElementById("title").value;
   var title = document.getElementById("title").value;
   if (title) url += '&title='+encodeURIComponent(title);
   if (title) url += '&title='+encodeURIComponent(title);