Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
fd9ba88a
Commit
fd9ba88a
authored
Nov 10, 2016
by
Karl
Browse files
Die Wettersuche ist jetzt unter den Quicktips eingebaut
parent
727cc257
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/MetaGerSearch.php
View file @
fd9ba88a
...
...
@@ -85,8 +85,44 @@ class MetaGerSearch extends Controller
fclose
(
$file
);
}
# Wikipedia Quicktip
$quicktips
=
[];
# Das Wetter
try
{
if
(
App
::
isLocale
(
'en'
))
{
$url
=
"http://api.openweathermap.org/data/2.5/weather?type=like&units=metric&lang=en&q="
.
urlencode
(
$q
)
.
"&APPID="
.
getenv
(
"openweathermap"
);
}
else
{
$url
=
"http://api.openweathermap.org/data/2.5/weather?type=like&units=metric&lang=de&q="
.
urlencode
(
$q
)
.
"&APPID="
.
getenv
(
"openweathermap"
);
}
$result
=
json_decode
(
$this
->
get
(
$url
),
true
);
$weather
=
[];
$weather
[
"title"
]
=
"Wetter in "
.
$result
[
"name"
];
$weather
[
"URL"
]
=
"http://openweathermap.org/city/"
.
$result
[
"id"
];
$descr
=
'<b class="detail-short">'
.
$result
[
"main"
][
"temp"
]
.
" °C, "
.
$result
[
"weather"
][
0
][
"description"
]
.
"</b>"
;
$details
=
'<table class="table table-condensed"><tr><td>Temperatur</td><td>'
.
$result
[
"main"
][
"temp_min"
]
.
" bis "
.
$result
[
"main"
][
"temp_max"
]
.
" °C</td></tr>"
;
$details
.
=
"<tr><td>Druck</td><td>"
.
$result
[
"main"
][
"pressure"
]
.
" hPa</td></tr>"
;
$details
.
=
"<tr><td>Luftfeuchtigkeit</td><td>"
.
$result
[
"main"
][
"humidity"
]
.
" %</td></tr>"
;
$details
.
=
"<tr><td>Wind</td><td>"
.
$result
[
"wind"
][
"speed"
]
.
" m/s, "
.
$result
[
"wind"
][
"deg"
]
.
"°</td></tr>"
;
$details
.
=
"<tr><td>Bewölkung</td><td>"
.
$result
[
"clouds"
][
"all"
]
.
" %</td></tr>"
;
if
(
isset
(
$result
->
rain
))
{
$details
.
=
" | Regen letzte drei Stunden: "
.
$result
[
"rain"
][
"3h"
]
.
" h"
;
}
$details
.
=
"</table>"
;
$weather
[
"descr"
]
=
$descr
;
$weather
[
"details"
]
=
$details
;
$weather
[
"gefVon"
]
=
"von <a href =
\"
https://openweathermap.org
\"
target=
\"
_blank
\"
rel=
\"
noopener
\"
>Openweathermap</a>"
;
$requestData
=
[];
$requestData
[
"url"
]
=
"http://openweathermap.org/img/w/"
;
$weather
[
"image"
]
=
action
(
'Pictureproxy@get'
,
$requestData
)
.
$result
[
"weather"
][
0
][
"icon"
]
.
".png"
;
$weather
[
"image-alt"
]
=
$result
[
"weather"
][
0
][
"main"
];
$mquicktips
[]
=
$weather
;
}
catch
(
\
ErrorException
$e
)
{
}
# Wikipedia Quicktip
if
(
App
::
isLocale
(
'en'
))
{
$url
=
"https://en.wikipedia.org/w/api.php?action=opensearch&search="
.
urlencode
(
$q
)
.
"&limit=1&namespace=0&format=json"
;
}
else
{
...
...
public/css/themes/default.css
View file @
fd9ba88a
...
...
@@ -6672,6 +6672,22 @@ button.close {
display
:
none
!important
;
}
}
.qtheader
{
font-size
:
16px
;
margin
:
0px
;
font-weight
:
bold
;
}
.info-details-available
{
cursor
:
pointer
;
}
.detail-short
{
font-weight
:
bold
;
font-size
:
18px
;
line-height
:
60px
;
}
.qt-icon
{
height
:
60px
;
}
#spruch
.author
{
font-size
:
14px
;
color
:
#888
;
...
...
public/css/themes/default.css.map
View file @
fd9ba88a
This diff is collapsed.
Click to expand it.
resources/assets/less/metager/metager.less
View file @
fd9ba88a
//@import "./result-page.less";
@import "./quicktips.less";
#spruch .author {
...
...
resources/assets/less/metager/quicktips.less
0 → 100644
View file @
fd9ba88a
.qtheader {
font-size: 16px;
margin: 0px;
font-weight: bold;
}
.info-details-available {
cursor: pointer;
}
.detail-short {
font-weight: bold;
font-size: 18px;
line-height: 60px;
}
.qt-icon {
height: 60px;
}
\ No newline at end of file
resources/views/quicktip.blade.php
View file @
fd9ba88a
...
...
@@ -9,11 +9,32 @@
@endif
@foreach( $mqs as $mq)
<div
class=
"quicktip"
>
<b
class=
"qtheader"
><a
href=
"{{ $mq['URL'] }}"
target=
"_blank"
rel=
"noopener"
>
{{ $mq['title'] }}
</a></b><br>
<div>
{!! $mq['descr'] !!}
</div>
@if( isset($mq['gefVon']) )
<div
class=
"pull-right"
>
{!! $mq['gefVon'] !!}
</div>
@endif
<h2
class=
"qtheader"
><a
href=
"{{ $mq['URL'] }}"
target=
"_blank"
rel=
"noopener"
>
{{ $mq['title'] }}
</a></h2>
<details>
<summary>
<div
class=
"media"
>
@if( isset($mq['image'])
&&
isset($mq['image-alt'] ))
<div
class=
"media-left"
>
<img
class=
"qt-icon"
src=
"{!! $mq['image'] !!}"
alt=
"{!! $mq['image-alt'] !!}"
>
</div>
@endif
<div
class=
"media-body"
>
<div>
{!! $mq['descr'] !!}
</div>
</div>
@if( isset($mq['details']) )
<div
class=
"media-right"
>
<span
class=
"glyphicon glyphicon-info-sign info-details-available"
aria-hidden=
"true"
></span>
</div>
@endif
</div>
</summary>
@if( isset($mq['details']) )
{!! $mq['details'] !!}
@endif
</details>
@if( isset($mq['gefVon']) )
<div
class=
"pull-right"
>
{!! $mq['gefVon'] !!}
</div>
@endif
</div>
@endforeach
</body>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment