1/** 2 * Open Weather Map 3 * https://openweathermap.org/ 4 * 5 * Weather API 6 * Current weather data By city name 7 */ 8 9/** 10 * The World Air Quality Project 11 * http://aqicn.org/api/ 12 * 13 * Real-time Air Quality - JSON API 14 * This API is provided by the World Air Quality Index project 15 * City Feed - city/station feed 16 * http://aqicn.org/json-api/doc/ 17 */ 18 19$(document).ready(function() { 20 21 var city = "Jeju,KR"; //ëì,ëë¼ 22 var units = "metric"; //ì¨ë ë¨ì - ìì¨ ì¤ì 23 var apiKey = "d49bf60efc7b630f5a6594ea3a752eea"; 24 25 //ë ì¨ API ì°ë 26 $.ajax({ 27 url: window.document.location.protocol + "//api.openweathermap.org/data/2.5/weather?q="+ city +"&units="+ units +"&APPID="+ apiKey, 28 dataType: "json", 29 type: "GET", 30 success: function(weather) { 31 var code = weather.weather[0].icon; //ë ì¨ ì½ë 32 var weatherIcon = null; //ë ì¨ ìì´ì½ 33 34 //Clear Sky 35 if(code == "01d" || code == "01n") { 36 weatherIcon = "w_1"; //ë§ì 37 } 38 //Few Clouds 39 else if(code == "02d" || code == "02n") { 40 weatherIcon = "w_3"; //êµ¬ë¦ ì¡°ê¸ 41 } 42 //Scattered Clods 43 else if(code == "03d" || code == "03n") { 44 weatherIcon = "w_2"; //êµ¬ë¦ 45 } 46 //Broken Clouds 47 else if(code == "04d" || code == "04n") { 48 weatherIcon = "w_2"; //êµ¬ë¦ 49 } 50 //Shower Rain 51 else if(code == "09d" || code == "09n") { 52 weatherIcon = "w_5"; //ë¹ 53 } 54 //Rain 55 else if(code == "10d" || code == "10n") { 56 weatherIcon = "w_5"; //ë¹ 57 } 58 //Thunderstrom 59 else if(code == "11d" || code == "11n") { 60 weatherIcon = "w_7"; //ëì° 61 } 62 //Snow 63 else if(code == "13d" || code == "13n") { 64 weatherIcon = "w_4"; //ë 65 } 66 //Mist 67 else if(code == "50d" || code == "50n") { 68 weatherIcon = "w_6"; //ìê° 69 } 70 71 var aqiToken ="f0be0ee5f4027e54d48d458c05f8047ee567f448"; 72 73 //미ì¸ë¨¼ì§ API ì°ë 74 $.ajax({ 75 url: "https://api.waqi.info/feed/korea/jeju/jeju-si/?token="+aqiToken, 76 dataType: "json", 77 type: "GET", 78 success: function(dust) { 79 var aqi = dust.data.aqi; //ë기 ì§ ì§ì 80 81 var grade = ""; //ë±ê¸ 82 var gradeColor = ""; //ë±ê¸ë³ ììì½ë 83 var gradePosition = ""; //ë±ê¸ í°í¸ ìì¹ 84 var gradeSize = ""; //ë±ê¸ í°í¸ ì¬ì´ì¦ 85 86 //AQI: 0~51 - ì¢ì 87 if(aqi > 0 && aqi < 51) { 88 grade = "ì¢ì"; 89 gradeColor = "#0cb7c7"; 90 gradePosition = "12%"; 91 gradeSize = "28px"; 92 } 93 //AQI: 51~100 - ë³´íµ 94 else if(aqi > 50 && aqi < 101) { 95 grade = "ë³´íµ"; 96 gradeColor = "#00bc68"; 97 gradePosition = "12%"; 98 gradeSize = "28px"; 99 } 100 //AQI: 101~150 - ì½ê°ëì¨ 101 else if(aqi > 100 && aqi < 151) { 102 grade = "ì½ê°ëì¨"; 103 gradeColor = "#ffcb38"; 104 gradePosition = "5%"; 105 gradeSize = "25px"; 106 } 107 //AQI: 151~200 - ëì¨ 108 else if(aqi > 150 && aqi < 201) { 109 grade = "ëì¨"; 110 gradeColor = "#ff8f00"; 111 gradePosition = "12%"; 112 gradeSize = "28px"; 113 } 114 //AQI: 201~300ì´ì - 매ì°ëì¨ 115 else if(aqi > 200) { 116 grade = "매ì°ëì¨"; 117 gradeColor = "#ff0000"; 118 gradePosition = "5%"; 119 gradeSize = "25px"; 120 } 121 122 //ë ì¨ ë°°ë ì¶ê° 123 $(".weather_banner") 124 //.append("<img src='/www/images/common/weather/weather_bg.jpg' alt='ë ì¨&미ì¸ë¨¼ì§'/>") 125 .append($("<div class='weather_info'>") 126 .append($("<ul>") 127 //.append($("<li class='weather_area'>") 128 //.append($("<p>").append("ì 주, ì 주ì"))) 129 .append($("<li class='weather_icon'>") 130 .append("<img src='/www/images/common/weather/"+weatherIcon+".png'/>") 131 .append($("<p>").append("ì 주, ì 주ì") 132 //.append($("<span>").append(weather.main.temp+"<span>"+"â")) 133 .append($("<span>").append(Math.round(weather.main.temp)+"<span>"+"â")) 134 ) 135 ) 136 .append($("<li class='finedust_icon'>") 137 .append("<img src='/www/images/common/weather/mask.png'/>") 138 .append($("<span style='color: "+gradeColor+"; margin-left: "+gradePosition+"; font-size: "+gradeSize+";'>").append(grade))))); 139 140 $(".weather_banner").click(function() { 141 //ì¤ë´ ê´ê´ì§ ì¶ì² 142 if(code == "09d" || code == "09n" || code == "10d" || code == "10n" || code == "11d" || code == "11n" || code == "13d" || code == "13n" || code == "50d" || code == "50n" || aqi > 150) { 143 $(location).attr("href", "/www/item/coupon.html?sno=1025&s_cate=151"); 144 } 145 //ì¤ì¸ ê´ê´ì§ ì¶ì² 146 else { 147 $(location).attr("href", "/www/item/coupon.html?sno=1025&s_cate=167"); 148 } 149 });
150 } 151 }); 152 } 153 }); 154});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.