Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
77fb3d0c
Commit
77fb3d0c
authored
Feb 26, 2019
by
Dominik Hebeler
Browse files
removed unnecessary js
parent
11c12e4f
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
resources/js/scriptResultPage.js
View file @
77fb3d0c
$
(
document
).
ready
(
function
()
{
getDocumentReadyForUse
(
focus
,
custom
);
botProtection
();
var
search
=
getMetaTag
(
'
q
'
)
||
''
;
var
locale
=
getMetaTag
(
'
l
'
)
||
'
de
'
;
// loadQuicktips(search, locale, sprueche) // load the quicktips
enableFormResetter
();
});
/*
function readLocaleFromUrl (defaultLocale) {
return location.pathname.substr(1, location.pathname.indexOf('/meta', 0) - 1) || 'de'
}
*/
function
getURLParameter
(
name
,
defaultValue
)
{
return
decodeURIComponent
((
new
RegExp
(
'
[?|&]
'
+
name
+
'
=
'
+
'
([^&;]+?)(&|#|;|$)
'
).
exec
(
location
.
search
)
||
[
null
,
''
])[
1
].
replace
(
/
\+
/g
,
'
%20
'
))
||
defaultValue
;
}
function
getMetaTag
(
name
)
{
if
(
typeof
$
(
'
meta[name="
'
+
name
+
'
"
'
)[
0
]
!==
'
undefined
'
)
{
return
$
(
'
meta[name="
'
+
name
+
'
"
'
)[
0
].
content
||
null
;
}
else
{
return
null
;
}
}
function
getDocumentReadyForUse
(
fokus
,
custom
)
{
if
(
typeof
custom
==
'
undefined
'
)
custom
=
false
;
activateJSOnlyContent
();
popovers
();
if
(
fokus
===
'
bilder
'
)
imageLoader
();
if
(
custom
)
initialLoadContent
(
fokus
);
// pagination()
tabs
();
fokiChanger
();
//pluginInfo();
$
(
'
iframe:not(.resized)
'
).
iFrameResize
();
$
(
'
iframe
'
).
addClass
(
'
resized
'
);
addListeners
();
}
function
addListeners
()
{
$
(
'
#search-delete-btn
'
).
click
(
resetSearchbar
);
}
function
resetSearchbar
()
{
$
(
'
.search-input input
'
).
val
(
''
).
focus
();
}
/*
function pluginInfo() {
if (localStorage) {
if (localStorage.getItem('pluginInfo') == 'off') $('#searchplugin').css('display', 'none');
$('#searchplugin').on('close.bs.alert', function () {
$.get('/pluginClose');
localStorage.setItem('pluginInfo', 'off');
});
$('#searchplugin a.btn').click(function () {
$.get('/pluginInstall');
});
}
}
*/
function
botProtection
()
{
$
(
'
.result
'
).
find
(
'
a
'
).
click
(
function
()
{
var
link
=
$
(
this
).
attr
(
'
href
'
);
...
...
@@ -93,144 +30,24 @@ function botProtection() {
});
}
function
popovers
()
{
$
(
'
[data-toggle=popover]
'
).
each
(
function
(
e
)
{
$
(
this
).
popover
({
// html : true,
// title : "<i class="fa fa-cog" aria-hidden="true"></i> Optionen",
content
:
$
(
this
).
parent
().
find
(
'
.content
'
).
html
()
});
});
}
function
pagination
()
{
$
(
'
.pagination li:not(.active) > a
'
).
attr
(
'
href
'
,
'
#
'
);
$
(
'
.pagination li.disabled > a
'
).
removeAttr
(
'
href
'
);
$
(
'
.pagination li:not(.active) > a
'
).
off
();
$
(
'
.pagination li:not(.active) > a
'
).
click
(
paginationHandler
);
}
function
paginationHandler
()
{
var
link
=
$
(
this
).
attr
(
'
data-href
'
);
if
(
link
.
length
==
0
)
{
return
;
}
var
tabPane
=
$
(
'
.tab-pane.active
'
);
$
(
tabPane
).
html
(
'
<div class="loader"><img src="/img/ajax-loader.gif" alt="" /></div>
'
);
$
.
get
(
link
,
function
(
data
)
{
$
(
tabPane
).
html
(
data
);
$
(
'
.pagination li:not(.active) > a
'
).
attr
(
'
href
'
,
'
#
'
);
$
(
'
.pagination li.disabled > a
'
).
removeAttr
(
'
href
'
);
$
(
'
.pagination li:not(.active) > a
'
).
off
();
$
(
'
.pagination li:not(.active) > a
'
).
click
(
paginationHandler
);
getDocumentReadyForUse
();
});
}
function
imageLoader
()
{
if
(
typeof
$
(
'
#container
'
).
masonry
==
'
undefined
'
)
{
return
;
}
var
$grid
=
$
(
'
#container
'
).
masonry
({
columnWidth
:
150
,
itemSelector
:
'
.item
'
,
gutter
:
10
,
isFitWidth
:
true
});
$grid
.
imagesLoaded
().
progress
(
function
(
instance
,
image
)
{
$grid
.
masonry
(
'
layout
'
);
});
}
function
eliminateHost
(
host
)
{
$
(
'
.result:not(.ad)
'
).
each
(
function
(
e
)
{
var
host2
=
$
(
this
).
find
(
'
.link-link > a
'
).
attr
(
'
data-host
'
);
if
(
host2
.
indexOf
(
host
)
===
0
)
{
$
(
this
).
css
(
'
display
'
,
'
none
'
);
function
enableFormResetter
()
{
var
deleteButton
=
$
(
"
#search-delete-btn
"
);
var
timeout
=
null
;
$
(
deleteButton
).
click
(
function
()
{
if
(
timeout
!=
null
)
{
clearTimeout
(
timeout
);
timeout
=
null
;
}
$
(
"
input[name=eingabe]
"
).
val
(
""
);
$
(
"
input[name=eingabe]
"
).
focus
();
});
}
function
fokiChanger
()
{
$
(
'
#fokiChanger ul > li
'
).
click
(
function
()
{
document
.
location
.
href
=
$
(
this
).
attr
(
'
data-href
'
);
$
(
"
input[name=eingabe]
"
).
focusin
(
function
()
{
$
(
deleteButton
).
css
(
"
display
"
,
"
initial
"
);
});
}
// Polyfill for form attribute
(
function
(
$
)
{
/**
* polyfill for html5 form attr
*/
// detect if browser supports this
var
sampleElement
=
$
(
'
[form]
'
).
get
(
0
);
var
isIE11
=
!
(
window
.
ActiveXObject
)
&&
'
ActiveXObject
'
in
window
;
if
(
sampleElement
&&
window
.
HTMLFormElement
&&
sampleElement
.
form
instanceof
HTMLFormElement
&&
!
isIE11
)
{
// browser supports it, no need to fix
return
;
}
/**
* Append a field to a form
*
*/
$
.
fn
.
appendField
=
function
(
data
)
{
// for form only
if
(
!
this
.
is
(
'
form
'
))
return
;
// wrap data
if
(
!
$
.
isArray
(
data
)
&&
data
.
name
&&
data
.
value
)
{
data
=
[
data
];
}
var
$form
=
this
;
// attach new params
$
.
each
(
data
,
function
(
i
,
item
)
{
$
(
'
<input/>
'
).
attr
(
'
type
'
,
'
hidden
'
).
attr
(
'
name
'
,
item
.
name
).
val
(
item
.
value
).
appendTo
(
$form
);
});
return
$form
;
};
/**
* Find all input fields with form attribute point to jQuery object
*
*/
$
(
'
form[id]
'
).
submit
(
function
(
e
)
{
var
$form
=
$
(
this
);
// serialize data
var
data
=
$
(
'
[form=
'
+
$form
.
attr
(
'
id
'
)
+
'
]
'
).
serializeArray
();
// append data to form
$form
.
appendField
(
data
);
}).
each
(
function
()
{
var
form
=
this
,
$form
=
$
(
form
),
$fields
=
$
(
'
[form=
'
+
$form
.
attr
(
'
id
'
)
+
'
]
'
);
$fields
.
filter
(
'
button, input
'
).
filter
(
'
[type=reset],[type=submit]
'
).
click
(
function
()
{
var
type
=
this
.
type
.
toLowerCase
();
if
(
type
===
'
reset
'
)
{
// reset form
form
.
reset
();
// for elements outside form
$fields
.
each
(
function
()
{
this
.
value
=
this
.
defaultValue
;
this
.
checked
=
this
.
defaultChecked
;
}).
filter
(
'
select
'
).
each
(
function
()
{
$
(
this
).
find
(
'
option
'
).
each
(
function
()
{
this
.
selected
=
this
.
defaultSelected
;
});
});
}
else
if
(
type
.
match
(
/^submit|image$/i
))
{
$
(
form
).
appendField
({
name
:
this
.
name
,
value
:
this
.
value
}).
submit
();
}
});
});
})(
jQuery
);
/**
* Loads the content for a given fokus
*/
function
initialLoadContent
(
fokus
)
{
var
link
=
$
(
'
#
'
+
fokus
+
'
TabSelector a
'
).
attr
(
'
data-href
'
);
$
.
get
(
link
,
function
(
data
)
{
$
(
'
#
'
+
fokus
).
html
(
data
);
getDocumentReadyForUse
(
fokus
);
$
(
"
input[name=eingabe]
"
).
focusout
(
function
()
{
timeout
=
window
.
setTimeout
(
function
()
{
$
(
deleteButton
).
css
(
"
display
"
,
"
none
"
);
timeout
=
null
;
},
500
);
});
}
\ No newline at end of file
resources/less/metager/parts/searchbar.less
View file @
77fb3d0c
...
...
@@ -102,6 +102,10 @@
background-color: white;
font-size: 25px;
font-weight: normal;
display: none;
&:hover {
color: red;
}
}
}
.search-submit {
...
...
resources/views/parts/searchbar.blade.php
View file @
77fb3d0c
...
...
@@ -11,7 +11,7 @@
</div>
<div class="search-input">
<input type="text" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif" required="" @if(\Request::is('
/
')) autofocus @endif autocomplete="off" class="form-control" placeholder="{{ trans('
index
.
placeholder
'
)
}}
" tabindex="
2
">
<button
class="
hidden
"
id="
search
-
delete
-
btn
" type="
button
">
<button id="
search
-
delete
-
btn
" type="
button
">
×
</button>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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