{"id":202,"date":"2026-03-26T15:37:12","date_gmt":"2026-03-26T15:37:12","guid":{"rendered":"https:\/\/dabudi.si\/?page_id=202"},"modified":"2026-09-21T14:01:17","modified_gmt":"2026-09-21T14:01:17","slug":"202-2","status":"publish","type":"page","link":"https:\/\/dabudi.si\/index.php\/202-2\/","title":{"rendered":""},"content":{"rendered":"\n<div id=\"app-wrapper\" style=\"\nfont-family: Arial, sans-serif;\nbackground: linear-gradient(135deg,#4facfe,#00f2fe);\ndisplay:flex;\njustify-content:center;\nalign-items:center;\nmin-height:100vh;\nmargin:0;\n\">\n\n<div style=\"\nbackground:white;\npadding:30px;\nmax-width:400px;\nwidth:100%;\nborder-radius:15px;\nbox-shadow:0 10px 25px rgba(0,0,0,0.2);\ntext-align:center;\n\">\n\n<h2>\ud83c\udf24\ufe0f Vremenska napoved<\/h2>\n\n<select id=\"city\" style=\"\npadding:10px;\nwidth:80%;\nborder-radius:8px;\nborder:1px solid #ccc;\nmargin:10px 0;\n\">\n<option value=\"Maribor\">Maribor<\/option>\n<option value=\"Ljubljana\">Ljubljana<\/option>\n<option value=\"Celje\">Celje<\/option>\n<\/select>\n\n<div id=\"weather\">\ud83d\udd04 Nalaganje&#8230;<\/div>\n\n<\/div>\n<\/div>\n\n<script>\n\nfunction getWeather() {\n\n    var coords = {\n        Maribor: [46.55, 15.64],\n        Ljubljana: [46.05, 14.50],\n        Celje: [46.23, 15.26]\n    };\n\n    var cityEl = document.getElementById(\"city\");\n    var weatherEl = document.getElementById(\"weather\");\n\n    if (!cityEl || !weatherEl) return;\n\n    var city = cityEl.value;\n    var lat = coords[city][0];\n    var lon = coords[city][1];\n\n    \/\/ timeout za\u0161\u010dita (\u010de API ne odgovori)\n    var timeout = setTimeout(function(){\n        weatherEl.innerHTML = \"\u26a0\ufe0f Predolgo nalaganje (WordPress blokira API)\";\n    }, 5000);\n\n    fetch(\"https:\/\/api.open-meteo.com\/v1\/forecast?latitude=\" + lat + \"&longitude=\" + lon + \"&daily=weathercode,temperature_2m_max,temperature_2m_min,wind_speed_10m_max&timezone=auto\")\n    .then(function(res){\n        clearTimeout(timeout);\n        if (!res.ok) throw new Error(\"API napaka\");\n        return res.json();\n    })\n    .then(function(data){\n\n        if (!data.daily) {\n            weatherEl.innerHTML = \"Ni podatkov\";\n            return;\n        }\n\n        var html = \"\";\n\n        for (var i = 0; i < 10; i++) {\n\n            var code = data.daily.weathercode[i];\n\n            var emoji = \"\ud83c\udf24\ufe0f\";\n            var text = \"Delno obla\u010dno\";\n\n            if(code == 0) { emoji=\"\u2600\ufe0f\"; text=\"Jasno\"; }\n            else if(code <= 3) { emoji=\"\u26c5\"; text=\"Obla\u010dno\"; }\n            else if(code <= 48) { emoji=\"\ud83c\udf2b\ufe0f\"; text=\"Megla\"; }\n            else if(code <= 67) { emoji=\"\ud83c\udf27\ufe0f\"; text=\"De\u017e\"; }\n            else if(code <= 77) { emoji=\"\u2744\ufe0f\"; text=\"Sneg\"; }\n            else if(code <= 99) { emoji=\"\u26c8\ufe0f\"; text=\"Nevihta\"; }\n\n            var wind = data.daily.wind_speed_10m_max \n                ? Math.round(data.daily.wind_speed_10m_max[i]) \n                : 0;\n\n            var windText = \"Rahel veter\";\n            if(wind > 20) windText = \"Zmeren veter\";\n            if(wind > 40) windText = \"Mo\u010dan veter\";\n            if(wind > 60) windText = \"Zelo mo\u010dan veter\";\n\n            html += \"<div style='background:#f5f5f5;margin:5px 0;padding:10px;border-radius:10px'>\" +\n                \"<b>\" + data.daily.time[i] + \"<\/b><br>\" +\n                emoji + \" \" + text + \"<br>\" +\n                \"\ud83c\udf21\ufe0f \" + data.daily.temperature_2m_max[i] + \"\u00b0C \/ \" + data.daily.temperature_2m_min[i] + \"\u00b0C<br>\" +\n                \"\ud83c\udf2c\ufe0f \" + wind + \" km\/h (\" + windText + \")\" +\n                \"<\/div>\";\n        }\n\n        weatherEl.innerHTML = html;\n\n    })\n    .catch(function(){\n        weatherEl.innerHTML = \"\u274c Napaka pri nalaganju (verjetno blokada WordPress)\";\n    });\n}\n\n\/\/ \ud83d\udcf1 ko se stran nalo\u017ei\ndocument.addEventListener(\"DOMContentLoaded\", function(){\n    getWeather();\n});\n\n\/\/ \ud83d\udd01 sprememba mesta\ndocument.addEventListener(\"change\", function(e){\n    if(e.target.id === \"city\"){\n        document.getElementById(\"weather\").innerHTML = \"\ud83d\udd04 Nalaganje...\";\n        getWeather();\n    }\n});\n\n\/\/ \ud83d\udd04 auto refresh vsakih 10 min\nsetInterval(getWeather, 600000);\n\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>\ud83c\udf24\ufe0f Vremenska napoved MariborLjubljanaCelje \ud83d\udd04 Nalaganje&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-202","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":5,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/202\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/202\/revisions\/208"}],"wp:attachment":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/media?parent=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}