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
eda31b2a
Commit
eda31b2a
authored
Mar 01, 2018
by
Dominik Hebeler
Browse files
Fehler im JavaScript behoben.
parent
66bf77ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/mix-manifest.json
deleted
100644 → 0
View file @
66bf77ae
{
"/mix.js"
:
"/mix.15a8298dca310d950683.js"
,
"/css/themes/default.css"
:
"/css/themes/default.18a73848aef046e1f26d4be8b1943354.css"
,
"/css/beitritt.css"
:
"/css/beitritt.06d76d542b6d72f798550d175b882ad0.css"
,
"/css/utility.css"
:
"/css/utility.d1813cd0619156f94fffaeecd269986d.css"
,
"/js/scriptSubPages.js"
:
"/js/scriptSubPages.910ba0aaabf252608adf3e2ab626fa65.js"
,
"/js/scriptStartPage.js"
:
"/js/scriptStartPage.d18de68749c9bfe551c21629f9efe6c9.js"
,
"/js/scriptResultPage.js"
:
"/js/scriptResultPage.a0cfde7bc774620a3511ae4862a98d5e.js"
,
"/js/utility.js"
:
"/js/utility.adebb567f4c83cfc347d2a1e018ada8e.js"
,
"/js/scriptJoinPage.js"
:
"/js/scriptJoinPage.5de8271d1cf069bb717b6b6176787d8e.js"
,
"/js/lib.js"
:
"/js/lib.e8632eeefb6dfa1cbd5b103440676a79.js"
,
"/js/editLanguage.js"
:
"/js/editLanguage.86f3614c410f556f184f79b6a98d6000.js"
,
"/js/settings.js"
:
"/js/settings.55fc8f258c6af748e6821c3dcaa9d2d2.js"
,
"/js/widget.js"
:
"/js/widget.d41d8cd98f00b204e9800998ecf8427e.js"
,
"/js/widgets.js"
:
"/js/widgets.858904fda2b3f22315b8cb2d222d0c5d.js"
,
"/css/material-default.css"
:
"/css/material-default.3cb8e728cfde880aa6fc843b8ea1b342.css"
,
"/css/material-inverse.css"
:
"/css/material-inverse.bb4e7ea69a1ecfc3de331ffac61ad4f0.css"
}
\ No newline at end of file
resources/assets/js/scriptResultPage.js
View file @
eda31b2a
...
...
@@ -26,11 +26,11 @@ function readLocaleFromUrl (defaultLocale) {
}
*/
function
getURLParameter
(
name
)
{
function
getURLParameter
(
name
)
{
return
decodeURIComponent
((
new
RegExp
(
'
[?|&]
'
+
name
+
'
=
'
+
'
([^&;]+?)(&|#|;|$)
'
).
exec
(
location
.
search
)
||
[
null
,
''
])[
1
].
replace
(
/
\+
/g
,
'
%20
'
))
||
null
;
}
function
getMetaTag
(
name
)
{
function
getMetaTag
(
name
)
{
if
(
typeof
$
(
'
meta[name="
'
+
name
+
'
"
'
)[
0
]
!==
'
undefined
'
)
{
return
$
(
'
meta[name="
'
+
name
+
'
"
'
)[
0
].
content
||
null
;
}
else
{
...
...
@@ -38,12 +38,12 @@ function getMetaTag (name) {
}
}
function
activateJSOnlyContent
()
{
function
activateJSOnlyContent
()
{
$
(
'
#searchplugin
'
).
removeClass
(
'
hide
'
);
$
(
'
.js-only
'
).
removeClass
(
'
js-only
'
);
}
function
tabs
()
{
function
tabs
()
{
$
(
'
#foki > li.tab-selector > a
'
).
each
(
function
()
{
if
(
$
(
this
).
attr
(
'
target
'
)
!=
'
_blank
'
)
{
$
(
this
).
attr
(
'
href
'
,
'
#
'
+
$
(
this
).
attr
(
'
aria-controls
'
));
...
...
@@ -68,7 +68,8 @@ function tabs () {
});
}
function
getDocumentReadyForUse
(
fokus
,
custom
=
false
)
{
function
getDocumentReadyForUse
(
fokus
,
custom
)
{
if
(
typeof
custom
==
"
undefined
"
)
custom
=
false
;
activateJSOnlyContent
();
clickLog
();
popovers
();
...
...
@@ -83,7 +84,7 @@ function getDocumentReadyForUse (fokus, custom = false) {
$
(
'
iframe
'
).
addClass
(
'
resized
'
);
}
function
pluginInfo
()
{
function
pluginInfo
()
{
if
(
localStorage
)
{
if
(
localStorage
.
getItem
(
'
pluginInfo
'
)
==
'
off
'
)
$
(
'
#searchplugin
'
).
css
(
'
display
'
,
'
none
'
);
$
(
'
#searchplugin
'
).
on
(
'
close.bs.alert
'
,
function
()
{
...
...
@@ -96,7 +97,7 @@ function pluginInfo () {
}
}
function
theme
()
{
function
theme
()
{
if
(
localStorage
)
{
var
theme
=
localStorage
.
getItem
(
'
theme
'
);
if
(
theme
!=
null
)
{
...
...
@@ -110,7 +111,7 @@ function theme () {
}
}
function
clickLog
()
{
function
clickLog
()
{
$
(
'
.result a.title, .result div.link-link a
'
).
off
();
$
(
'
.result a.title, .result div.link-link a
'
).
click
(
function
()
{
$
.
get
(
'
/clickstats
'
,
{
...
...
@@ -123,7 +124,7 @@ function clickLog () {
});
}
function
botProtection
()
{
function
botProtection
()
{
if
(
$
(
'
meta[name=pqr]
'
).
length
>
0
)
{
var
link
=
atob
(
$
(
'
meta[name=pqr]
'
).
attr
(
'
content
'
));
var
hash
=
$
(
'
meta[name=pq]
'
).
attr
(
'
content
'
);
...
...
@@ -131,7 +132,7 @@ function botProtection () {
}
}
function
popovers
()
{
function
popovers
()
{
$
(
'
[data-toggle=popover]
'
).
each
(
function
(
e
)
{
$
(
this
).
popover
({
// html : true,
...
...
@@ -141,14 +142,14 @@ function popovers () {
});
}
function
pagination
()
{
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
()
{
function
paginationHandler
()
{
var
link
=
$
(
this
).
attr
(
'
data-href
'
);
if
(
link
.
length
==
0
)
{
return
;
...
...
@@ -165,7 +166,7 @@ function paginationHandler () {
});
}
function
imageLoader
()
{
function
imageLoader
()
{
if
(
typeof
$
(
'
#container
'
).
masonry
==
'
undefined
'
)
{
return
;
}
...
...
@@ -180,7 +181,7 @@ function imageLoader () {
});
}
function
eliminateHost
(
host
)
{
function
eliminateHost
(
host
)
{
$
(
'
.result:not(.ad)
'
).
each
(
function
(
e
)
{
var
host2
=
$
(
this
).
find
(
'
.link-link > a
'
).
attr
(
'
data-host
'
);
if
(
host2
.
indexOf
(
host
)
===
0
)
{
...
...
@@ -189,7 +190,7 @@ function eliminateHost (host) {
});
}
function
fokiChanger
()
{
function
fokiChanger
()
{
$
(
'
#fokiChanger ul > li
'
).
click
(
function
()
{
document
.
location
.
href
=
$
(
this
).
attr
(
'
data-href
'
);
});
...
...
@@ -265,7 +266,7 @@ function fokiChanger () {
/**
* Creates focus tab and tab selector for every stored focus in local storage
*/
function
createCustomFocuses
()
{
function
createCustomFocuses
()
{
for
(
var
key
in
localStorage
)
{
if
(
key
.
startsWith
(
'
focus_
'
))
{
var
focus
=
loadFocusById
(
key
);
...
...
@@ -297,7 +298,8 @@ function createCustomFocuses () {
* </li>
* @endif
*/
function
addFocus
(
focus
,
active
=
false
)
{
function
addFocus
(
focus
,
active
)
{
if
(
typeof
active
==
"
undefined
"
)
active
=
false
;
var
id
=
getIdFromName
(
focus
.
name
);
var
foki
=
document
.
getElementById
(
'
foki
'
);
// create <input>
...
...
@@ -351,7 +353,8 @@ function addFocus (focus, active = false) {
* </div>
* @endif
*/
function
addTab
(
focus
,
active
=
false
)
{
function
addTab
(
focus
,
active
)
{
if
(
typeof
active
==
"
undefined
"
)
active
=
false
;
var
id
=
getIdFromName
(
focus
.
name
);
// create tab div
var
tabPane
=
document
.
createElement
(
'
div
'
);
...
...
@@ -378,19 +381,19 @@ function addTab (focus, active = false) {
* Turns a name into an id
* Converts special characters and spaces
*/
function
getIdFromName
(
name
)
{
function
getIdFromName
(
name
)
{
return
'
focus_
'
+
name
.
split
(
'
'
).
join
(
'
_
'
).
toLowerCase
();
}
/**
* Loads the focus object for the given id from local storage
*/
function
loadFocusById
(
id
)
{
function
loadFocusById
(
id
)
{
return
JSON
.
parse
(
localStorage
.
getItem
(
id
));
}
/**
* Gets the id of the currently active focus
*/
function
getActiveFocusId
()
{
function
getActiveFocusId
()
{
var
search
=
window
.
location
.
search
;
var
from
=
search
.
indexOf
(
'
focus=
'
)
+
'
focus=
'
.
length
;
var
to
=
search
.
substring
(
from
).
indexOf
(
'
&
'
)
+
from
;
...
...
@@ -403,7 +406,7 @@ function getActiveFocusId () {
* Turns the link of the current page into a search link for the given focus
*/
// TODO catch error if link is http://localhost:8000/meta/meta.ger3?
function
generateSearchLinkForFocus
(
focus
)
{
function
generateSearchLinkForFocus
(
focus
)
{
var
link
=
document
.
location
.
href
;
// remove old engine settings
// not yet tested, only for compability problems with old versions of bookmarks and plugins
...
...
@@ -431,7 +434,7 @@ function generateSearchLinkForFocus (focus) {
/**
* Replaces the focus in a given url with the "angepasst" focus
*/
function
replaceFocusInUrl
(
url
)
{
function
replaceFocusInUrl
(
url
)
{
var
from
=
url
.
indexOf
(
'
focus=
'
);
var
to
=
url
.
substring
(
from
).
indexOf
(
'
&
'
)
+
from
;
if
(
to
===
0
)
{
...
...
@@ -443,7 +446,7 @@ function replaceFocusInUrl (url) {
/**
* Loads the content for a given fokus
*/
function
initialLoadContent
(
fokus
)
{
function
initialLoadContent
(
fokus
)
{
var
link
=
$
(
'
#
'
+
fokus
+
'
TabSelector a
'
).
attr
(
'
data-href
'
);
$
.
get
(
link
,
function
(
data
)
{
$
(
'
#
'
+
fokus
).
html
(
data
);
...
...
@@ -451,7 +454,7 @@ function initialLoadContent (fokus) {
});
}
function
resultSaver
(
index
)
{
function
resultSaver
(
index
)
{
var
title
=
$
(
'
div.tab-pane.active .result[data-count=
'
+
index
+
'
] a.title
'
).
html
();
var
link
=
$
(
'
div.tab-pane.active .result[data-count=
'
+
index
+
'
] a.title
'
).
attr
(
'
href
'
);
var
anzeigeLink
=
$
(
'
div.tab-pane.active .result[data-count=
'
+
index
+
'
] div.link-link > a
'
).
html
();
...
...
@@ -463,11 +466,14 @@ function resultSaver (index) {
var
rank
=
parseFloat
(
$
(
'
div.tab-pane.active .result[data-count=
'
+
index
+
'
]
'
).
attr
(
'
data-rank
'
));
new
Result
(
title
,
link
,
anzeigeLink
,
gefVon
,
hoster
,
anonym
,
description
,
color
,
rank
,
undefined
);
var
to
=
$
(
'
#savedFokiTabSelector
'
).
length
?
$
(
'
#savedFokiTabSelector
'
)
:
$
(
'
#foki
'
);
$
(
'
div.tab-pane.active .result[data-count=
'
+
index
+
'
]
'
).
transfer
({
to
:
to
,
duration
:
1000
});
$
(
'
div.tab-pane.active .result[data-count=
'
+
index
+
'
]
'
).
transfer
({
to
:
to
,
duration
:
1000
});
new
Results
().
updateResultPageInterface
();
}
function
loadQuicktips
(
search
,
locale
,
sprueche
)
{
function
loadQuicktips
(
search
,
locale
,
sprueche
)
{
var
blacklist
=
[];
if
(
!
sprueche
)
{
blacklist
.
push
(
'
sprueche
'
);
...
...
@@ -486,7 +492,7 @@ const QUICKTIP_SERVER = 'https://quicktips.metager3.de';
* @param {Array<String>} blacklist excluded loaders
* @param {Function} loadedHandler handler for loaded quicktips
*/
function
getQuicktips
(
search
,
locale
,
blacklist
,
loadedHandler
)
{
function
getQuicktips
(
search
,
locale
,
blacklist
,
loadedHandler
)
{
var
getString
=
QUICKTIP_SERVER
+
'
/quicktips.xml?search=
'
+
search
+
'
&locale=
'
+
locale
;
blacklist
.
forEach
(
function
(
value
)
{
getString
+=
'
&loader_
'
+
value
+
'
=false
'
;
...
...
@@ -540,7 +546,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
*
* @param {Object} quicktips
*/
function
createQuicktips
(
quicktips
,
sprueche
)
{
function
createQuicktips
(
quicktips
,
sprueche
)
{
var
quicktipsDiv
=
$
(
'
#quicktips
'
);
quicktips
.
sort
(
function
(
a
,
b
)
{
return
b
.
score
-
a
.
score
;
...
...
@@ -591,4 +597,4 @@ function createQuicktips (quicktips, sprueche) {
.
append
(
'
<span class="gefVon">
'
+
quicktip
.
gefVon
+
'
</span>
'
);
quicktipsDiv
.
append
(
quicktipDiv
);
});
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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