Skip to content
GitLab
Menu
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
81a456c4
Commit
81a456c4
authored
May 29, 2017
by
Phil Höfer
Browse files
Anfang neue (heterogene) Ausgabe
parent
ee01455a
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/MetaGer.php
View file @
81a456c4
...
...
@@ -4,11 +4,11 @@ namespace App;
use
App
;
use
Cache
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Redis
;
use
Jenssegers\Agent\Agent
;
use
LaravelLocalization
;
use
Log
;
use
Predis\Connection\ConnectionException
;
use
Illuminate\Support\Facades\Redis
;
class
MetaGer
{
...
...
@@ -24,7 +24,7 @@ class MetaGer
protected
$site
;
protected
$hostBlacklist
=
[];
protected
$domainBlacklist
=
[];
private
$urlBlacklist
=
[];
private
$urlBlacklist
=
[];
protected
$stopWords
=
[];
protected
$phrases
=
[];
protected
$engines
=
[];
...
...
@@ -141,6 +141,15 @@ class MetaGer
->
with
(
'suspendheader'
,
"yes"
)
->
with
(
'browser'
,
(
new
Agent
())
->
browser
());
break
;
case
'rich'
:
return
view
(
'metager3rich'
)
->
with
(
'eingabe'
,
$this
->
eingabe
)
->
with
(
'mobile'
,
$this
->
mobile
)
->
with
(
'warnings'
,
$this
->
warnings
)
->
with
(
'errors'
,
$this
->
errors
)
->
with
(
'metager'
,
$this
)
->
with
(
'browser'
,
(
new
Agent
())
->
browser
());
break
;
case
'rss20'
:
return
view
(
'metager3resultsrss20'
)
->
with
(
'results'
,
$viewResults
)
...
...
@@ -541,7 +550,7 @@ class MetaGer
if
(
$this
->
requestIsCached
(
$request
))
{
$engines
=
$this
->
getCachedEngines
(
$request
);
# We need to edit some Options of the Cached Search Engines
foreach
(
$engines
as
$engine
){
foreach
(
$engines
as
$engine
)
{
$engine
->
setResultHash
(
$this
->
getHashCode
());
}
}
else
{
...
...
@@ -800,33 +809,38 @@ class MetaGer
public
function
waitForResults
(
$enginesToLoad
,
$overtureEnabled
,
$canBreak
)
{
$timeStart
=
microtime
(
true
);
$results
=
null
;
$timeStart
=
microtime
(
true
);
$results
=
null
;
while
(
true
)
{
$results
=
Redis
::
hgetall
(
'search.'
.
$this
->
getHashCode
());
$ready
=
true
;
// When every
// When every
$connected
=
true
;
foreach
(
$results
as
$key
=>
$value
){
if
(
$value
===
"waiting"
||
$value
===
"connected"
){
foreach
(
$results
as
$key
=>
$value
)
{
if
(
$value
===
"waiting"
||
$value
===
"connected"
)
{
$ready
=
false
;
}
if
(
$value
===
"waiting"
){
if
(
$value
===
"waiting"
)
{
$connected
=
false
;
}
}
// If $ready is false at this point, we're waiting for more searchengines
// But we have to check for the timeout, too
if
(
!
$connected
)
$timeStart
=
microtime
(
true
);
if
(
!
$connected
)
{
$timeStart
=
microtime
(
true
);
}
$time
=
(
microtime
(
true
)
-
$timeStart
)
*
1000
;
// We will apply the timeout only if it's not Yahoo we're waiting for since they are one the most
// important search engines.
$canTimeout
=
!
((
isset
(
$results
[
"overture"
])
&&
$results
[
"overture"
]
===
"waiting"
)
||
(
isset
(
$results
[
"overtureAds"
])
&&
$results
[
"overtureAds"
]
===
"waiting"
));
if
(
$time
>
$this
->
time
&&
$canTimeout
)
$ready
=
true
;
if
(
$time
>
$this
->
time
&&
$canTimeout
)
{
$ready
=
true
;
}
if
(
$ready
){
if
(
$ready
)
{
break
;
}
usleep
(
50000
);
...
...
@@ -981,7 +995,7 @@ class MetaGer
}
$this
->
out
=
$request
->
input
(
'out'
,
"html"
);
# Standard output format html
if
(
$this
->
out
!==
"html"
&&
$this
->
out
!==
"json"
&&
$this
->
out
!==
"results"
&&
$this
->
out
!==
"results-with-style"
&&
$this
->
out
!==
"result-count"
&&
$this
->
out
!==
"rss20"
)
{
if
(
$this
->
out
!==
"html"
&&
$this
->
out
!==
"json"
&&
$this
->
out
!==
"results"
&&
$this
->
out
!==
"results-with-style"
&&
$this
->
out
!==
"result-count"
&&
$this
->
out
!==
"rss20"
&&
$this
->
out
!==
"rich"
)
{
$this
->
out
=
"html"
;
}
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
...
...
@@ -1076,7 +1090,7 @@ class MetaGer
foreach
(
$this
->
urlBlacklist
as
$url
)
{
$urlString
.
=
$url
.
", "
;
}
$urlString
=
rtrim
(
$urlString
,
", "
);
$urlString
=
rtrim
(
$urlString
,
", "
);
$this
->
warnings
[]
=
trans
(
'metaGer.formdata.urlBlacklist'
,
[
'url'
=>
$urlString
]);
}
}
...
...
public/css/material-default.css
0 → 100644
View file @
81a456c4
/* Mobile styles */
body
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
stretch
;
margin
:
0px
;
padding
:
0px
;
background-color
:
#FAFAFA
;
font-family
:
Roboto
,
"Noto Sans"
,
sans-serif
;
}
.card
{
background-color
:
#FFFFFF
;
margin
:
8px
;
padding
:
8px
;
border-radius
:
2px
;
display
:
block
;
}
.card-inline
{
background-color
:
#FFFFFF
;
margin
:
8px
;
padding
:
8px
;
border-radius
:
2px
;
}
.elevation-1
{
box-shadow
:
0px
1px
1.5px
0px
rgba
(
0
,
0
,
0
,
0.12
),
1px
0px
1px
0px
rgba
(
0
,
0
,
0
,
0.24
);
}
.elevation-2
{
box-shadow
:
0px
3px
3px
0px
rgba
(
0
,
0
,
0
,
0.16
),
3px
0px
3px
0px
rgba
(
0
,
0
,
0
,
0.23
);
}
.search-card
{
height
:
30px
;
display
:
flex
;
justify-content
:
space-between
;
position
:
sticky
;
top
:
10px
;
z-index
:
100
;
}
.persistent-search
{
top
:
0px
;
position
:
sticky
;
z-index
:
100
;
background
:
linear-gradient
(
to
bottom
,
rgba
(
255
,
255
,
255
,
1
)
0%
,
rgba
(
255
,
255
,
255
,
1
)
50%
,
rgba
(
255
,
255
,
255
,
0
)
60%
,
rgba
(
255
,
255
,
255
,
0
)
100%
);
}
.search-card
button
,
.search-card
input
{
border
:
none
;
background
:
none
;
margin
:
0px
;
padding
:
0px
;
}
.search-card
input
[
type
=
text
]
{
font-size
:
18px
;
overflow-x
:
hidden
;
}
.search-card
.back
{
height
:
100%
;
margin-right
:
8px
;
}
.search-button
{
width
:
50px
;
}
.search-button
img
{
height
:
100%
;
}
.search-card
.back
img
{
height
:
100%
;
}
.search-card
.query-input
{
flex-grow
:
1
;
}
.results-container
{
z-index
:
10
;
}
.search-result
{
position
:
relative
;
}
.result-content
{
margin
:
16px
8px
8px
8px
;
}
.result-title
{
font-size
:
18px
;
font-weight
:
500
;
color
:
hsl
(
0
,
0%
,
13%
);
margin
:
0px
;
padding
:
0px
;
}
.result-display-link
{
color
:
hsl
(
0
,
0%
,
13%
);
font-size
:
14px
;
font-weight
:
400
;
margin
:
0px
;
padding
:
0px
;
}
.result-description
{
font-size
:
16px
;
}
.result-source
{
display
:
none
;
}
.result-thumbnail
{
position
:
absolute
;
right
:
16px
;
top
:
16px
;
max-width
:
80px
;
max-height
:
80px
;
}
.result-action-area
{
display
:
flex
;
flex-wrap
:
wrap
;
align-items
:
baseline
;
margin
:
0px
;
padding
:
0px
;
}
.result-action
{
color
:
hsl
(
0
,
0%
,
13%
);
font-size
:
14px
;
font-weight
:
500
;
text-decoration
:
none
;
text-transform
:
uppercase
;
margin
:
0px
0px
0px
0px
;
padding
:
8px
;
border-radius
:
2px
;
}
.result-action
:hover
,
.result-action
:focus
{
background-color
:
hsla
(
0
,
0%
,
13%
,
12%
);
}
.result-action
:active
{
background-color
:
hsla
(
0
,
0%
,
13%
,
40%
);
}
.result-action
:first-child
.primary
{
color
:
hsl
(
21
,
100%
,
50%
);
}
.result-action
:first-child
.primary
:hover
,
.result-action
:first-child
.primary
:focus
{
background-color
:
hsla
(
21
,
100%
,
50%
,
12%
);
}
.result-action
:first-child
.primary
:active
{
background-color
:
hsla
(
21
,
100%
,
50%
,
40%
);
}
.result-action.more
{
float
:
right
;
}
.footer-text
{
margin-top
:
20px
;
margin-bottom
:
10px
;
color
:
hsl
(
0
,
0%
,
46%
);
text-align
:
center
;
}
.pagenav-button-next
{
color
:
hsl
(
0
,
0%
,
13%
);
font-size
:
20px
;
text-decoration
:
none
;
padding
:
12px
;
height
:
27px
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
baseline
;
}
.pagenav-button-first
{
color
:
hsl
(
0
,
0%
,
13%
);
font-size
:
20px
;
text-decoration
:
none
;
height
:
27px
;
padding
:
12px
;
align-self
:
flex-start
;
}
.pagenav-following
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
baseline
;
}
.pagenav-current
{
color
:
hsl
(
0
,
0%
,
46%
);
font-size
:
18px
;
padding
:
12px
;
}
.icon-right
{
margin-left
:
5px
;
}
.focus-card
{
background-color
:
hsl
(
0
,
0%
,
50%
);
}
.focus-cell
{
line-height
:
34px
;
display
:
flex
;
justify-content
:
space-between
;
}
.focus-cell-label
b
{
font-weight
:
500
;
}
.focus-cell-action
{
font-size
:
14px
;
text-decoration
:
none
;
text-transform
:
uppercase
;
}
.focus-cell
{
text-decoration
:
none
;
background-color
:
hsl
(
0
,
0%
,
50%
);
color
:
rgba
(
255
,
255
,
255
,
1
);
padding
:
0px
5px
;
}
li
.focus-cell
:hover
{
background-color
:
hsl
(
0
,
0%
,
55%
);
}
.focus-card
[
open
]
.focus-cell
.focus-cell-action
{
display
:
none
;
}
.focus-list
{
list-style-type
:
none
;
margin-top
:
0px
;
margin-bottom
:
0px
;
padding-left
:
0px
;
}
@media
(
max-width
:
330px
)
{
/*für sehr kleine mobile Viewports (z.B. iPhone 5S)*/
.result-action
{
font-size
:
13px
;
}
.pagenav-current-annotation
{
display
:
none
;
}
.pagenav-current
{
color
:
hsl
(
0
,
0%
,
46%
);
font-size
:
20px
;
padding
:
12px
;
}
}
public/css/material-inverse.css
0 → 100644
View file @
81a456c4
/* Mobile styles */
body
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
stretch
;
margin
:
0px
;
padding
:
0px
;
color
:
#fff
;
background-color
:
#050505
;
font-family
:
Roboto
,
"Noto Sans"
,
sans-serif
;
}
.card
{
background-color
:
hsl
(
0
,
0%
,
20%
);
;
margin
:
8px
;
padding
:
8px
;
border-radius
:
2px
;
display
:
block
;
}
.card-inline
{
background-color
:
#000
;
margin
:
8px
;
padding
:
8px
;
border-radius
:
2px
;
}
.elevation-1
{
box-shadow
:
0px
1px
1.5px
0px
rgba
(
255
,
255
,
255
,
0.12
),
1px
0px
1px
0px
rgba
(
255
,
255
,
255
,
0.24
);
}
.elevation-2
{
box-shadow
:
0px
3px
3px
0px
rgba
(
255
,
255
,
255
,
0.16
),
3px
0px
3px
0px
rgba
(
255
,
255
,
255
,
0.23
);
}
.search-card
{
height
:
30px
;
display
:
flex
;
justify-content
:
space-between
;
position
:
sticky
;
top
:
10px
;
z-index
:
100
;
}
.persistent-search
{
top
:
0px
;
position
:
sticky
;
z-index
:
100
;
background
:
linear-gradient
(
to
bottom
,
rgba
(
0
,
0
,
0
,
1
)
0%
,
rgba
(
0
,
0
,
0
,
1
)
50%
,
rgba
(
0
,
0
,
0
,
0
)
60%
,
rgba
(
0
,
0
,
0
,
0
)
100%
);
}
.search-card
button
,
.search-card
input
{
border
:
none
;
background
:
none
;
margin
:
0px
;
padding
:
0px
;
}
.search-card
input
[
type
=
text
]
{
font-size
:
18px
;
overflow-x
:
hidden
;
color
:
#fff
;
}
.search-card
.back
{
height
:
100%
;
margin-right
:
8px
;
}
.search-button
{
width
:
50px
;
color
:
#fff
;
}
.search-button
img
{
height
:
100%
;
}
.search-card
.back
img
{
height
:
100%
;
}
.search-card
.query-input
{
flex-grow
:
1
;
}
.results-container
{
z-index
:
10
;
}
.search-result
{
position
:
relative
;
}
.result-content
{
margin
:
16px
8px
8px
8px
;
}
.result-title
{
font-size
:
18px
;
font-weight
:
500
;
color
:
hsl
(
0
,
0%
,
87%
);
margin
:
0px
;
padding
:
0px
;
}
.result-display-link
{
color
:
hsl
(
0
,
0%
,
87%
);
font-size
:
14px
;
font-weight
:
400
;
margin
:
0px
;
padding
:
0px
;
}
.result-description
{
font-size
:
16px
;
}
.result-source
{
display
:
none
;
}
.result-thumbnail
{
position
:
absolute
;
right
:
16px
;
top
:
16px
;
max-width
:
80px
;
max-height
:
80px
;
}
.result-action-area
{
display
:
flex
;
flex-wrap
:
wrap
;
align-items
:
baseline
;
margin
:
0px
;
padding
:
0px
;
}
.result-action
{
color
:
hsl
(
0
,
0%
,
87%
);
font-size
:
14px
;
font-weight
:
500
;
text-decoration
:
none
;
text-transform
:
uppercase
;
margin
:
0px
0px
0px
0px
;
padding
:
8px
;
border-radius
:
2px
;
}
.result-action
:hover
,
.result-action
:focus
{
background-color
:
hsla
(
0
,
0%
,
87%
,
12%
);
}
.result-action
:active
{
background-color
:
hsla
(
0
,
0%
,
87%
,
40%
);
}
.result-action
:first-child
.primary
{
color
:
hsl
(
21
,
100%
,
50%
);
}
.result-action
:first-child
.primary
:hover
,
.result-action
:first-child
.primary
:focus
{
background-color
:
hsla
(
21
,
100%
,
50%
,
12%
);
}
.result-action
:first-child
.primary
:active
{
background-color
:
hsla
(
21
,
100%
,
50%
,
40%
);
}
.result-action.more
{
float
:
right
;
}
.footer-text
{
margin-top
:
20px
;
margin-bottom
:
10px
;
color
:
hsl
(
0
,
0%
,
54%
);
text-align
:
center
;
}
.pagenav-button-next
{
color
:
hsl
(
0
,
0%
,
87%
);
font-size
:
20px
;
text-decoration
:
none
;
padding
:
12px
;
height
:
27px
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
baseline
;
}
.pagenav-button-first
{
color
:
hsl
(
0
,
0%
,
87%
);
font-size
:
20px
;
text-decoration
:
none
;
height
:
27px
;
padding
:
12px
;
align-self
:
flex-start
;
}
.pagenav-following
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
baseline
;
}
.pagenav-current
{
color
:
hsl
(
0
,
0%
,
64%
);
font-size
:
18px
;
padding
:
12px
;
}
.icon-right
{
margin-left
:
5px
;
}
.focus-card
{
background-color
:
hsl
(
0
,
0%
,
50%
);
}
.focus-cell
{
line-height
:
34px
;
display
:
flex
;
justify-content
:
space-between
;
}
.focus-cell-label
b
{
font-weight
:
500
;
}
.focus-cell-action
{
font-size
:
14px
;
text-decoration
:
none
;
text-transform
:
uppercase
;
}
.focus-cell
{
text-decoration
:
none
;
background-color
:
hsl
(
0
,
0%
,
50%
);
color
:
rgba
(
255
,
255
,
255
,
1
);
padding
:
0px
5px
;
}