'cofeescript showing entire url line instead of executing function
I am very new to coding and I decided to try my hand at altering an Übersicht weather widget on my Mac. I have managed to figure out everything besides how to show the icons I want based off of the "icon" code in Openweathermap. I know that the url works but its not showing up how it should. I've attached the one of the image url's and the coffee script below for reference (I have not styled it much yet on purpose). If you have any suggestions I'd really appreciate it!
svg image picture of widget' `
refreshFrequency: 60000
apiKey ='******'
lat = '36.*****'
lon = '-94.*****
exclude = "hourly,alerts"
command: "curl -s 'https://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}&appid=#{apiKey}&units=imperial'"
render: (o) -> """
<div class='weather'>
<div class='icon'></div>
<div class='temp'></div>
<div class='summary'></div>
<div class='city'></div>
</div>
"""
update: (output, domEl) ->
data = JSON.parse(output)
$domEl = $(domEl)
$domEl.find('.temp').html """
<div class='now'>#{Math.round(data.main.temp)}°F</div>
"""
#$domEl.find('.summary').text "#{data.currently.summary}, #{data.minutely.summary}"
$domEl.find('.summary').html """
#{(data.weather[0].description)}
"""
$domEl.find('.city').html """
#{(data.name)}
"""
$(domEl).find('.icon').html """
`https://warrynsicons.s3.us-east-2.amazonaws.com/appimages/' +
#{(data.weather[0].icon)} + '.svg'
"""
renderForecast: (data) ->
"""
<div class='entry'>
<div class='icon'>#{@getIcon data}</div>
<div class='temp'>#{Math.round(data.main)}°</div>
<div class='summary'>#{data.weather.description}</div>
<div class='city'>.text("#{location}")
</div>
"""
style: """
top: 1%
left: 10%
margin-left: -100px
.weather {
background: rgba(255, 255, 255, .5);
width: 700px;
height: 200px;
border-radius: 7px;
box-shadow: 0 0 20px 0 rgba(0,0,0, 0.4);
-webkit-backdrop-filter: blur(5px);
display: flex;
overflow: hidden;
font-family: '-apple-system';
border-top: none;
display: inline-block;
position: relative;
padding: 1em
}
.icon {
position: absolute;
filter: invert(90%) sepia(90%) saturate(2979%) hue-rotate(179deg) brightness(110%) contrast(105%);
font-size: 20px
line-height: 70px
position: absolute
left: 150px
top: 5px
vertical-align: middle
}
"""
`
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
