Skip to content
Snippets Groups Projects
Commit 301ee9fe authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Fehler im JavaScript behoben.

parent 340a64ef
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
{
"/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
...@@ -26,11 +26,11 @@ function readLocaleFromUrl (defaultLocale) { ...@@ -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; 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') { if (typeof $('meta[name="' + name + '"')[0] !== 'undefined') {
return $('meta[name="' + name + '"')[0].content || null; return $('meta[name="' + name + '"')[0].content || null;
} else { } else {
...@@ -38,12 +38,12 @@ function getMetaTag (name) { ...@@ -38,12 +38,12 @@ function getMetaTag (name) {
} }
} }
function activateJSOnlyContent () { function activateJSOnlyContent() {
$('#searchplugin').removeClass('hide'); $('#searchplugin').removeClass('hide');
$('.js-only').removeClass('js-only'); $('.js-only').removeClass('js-only');
} }
function tabs () { function tabs() {
$('#foki > li.tab-selector > a').each(function () { $('#foki > li.tab-selector > a').each(function () {
if ($(this).attr('target') != '_blank') { if ($(this).attr('target') != '_blank') {
$(this).attr('href', '#' + $(this).attr('aria-controls')); $(this).attr('href', '#' + $(this).attr('aria-controls'));
...@@ -68,7 +68,8 @@ function tabs () { ...@@ -68,7 +68,8 @@ function tabs () {
}); });
} }
function getDocumentReadyForUse (fokus, custom = false) { function getDocumentReadyForUse(fokus, custom) {
if (typeof custom == "undefined") custom = false;
activateJSOnlyContent(); activateJSOnlyContent();
clickLog(); clickLog();
popovers(); popovers();
...@@ -83,7 +84,7 @@ function getDocumentReadyForUse (fokus, custom = false) { ...@@ -83,7 +84,7 @@ function getDocumentReadyForUse (fokus, custom = false) {
$('iframe').addClass('resized'); $('iframe').addClass('resized');
} }
function pluginInfo () { function pluginInfo() {
if (localStorage) { if (localStorage) {
if (localStorage.getItem('pluginInfo') == 'off') $('#searchplugin').css('display', 'none'); if (localStorage.getItem('pluginInfo') == 'off') $('#searchplugin').css('display', 'none');
$('#searchplugin').on('close.bs.alert', function () { $('#searchplugin').on('close.bs.alert', function () {
...@@ -96,7 +97,7 @@ function pluginInfo () { ...@@ -96,7 +97,7 @@ function pluginInfo () {
} }
} }
function theme () { function theme() {
if (localStorage) { if (localStorage) {
var theme = localStorage.getItem('theme'); var theme = localStorage.getItem('theme');
if (theme != null) { if (theme != null) {
...@@ -110,7 +111,7 @@ function theme () { ...@@ -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').off();
$('.result a.title, .result div.link-link a').click(function () { $('.result a.title, .result div.link-link a').click(function () {
$.get('/clickstats', { $.get('/clickstats', {
...@@ -123,7 +124,7 @@ function clickLog () { ...@@ -123,7 +124,7 @@ function clickLog () {
}); });
} }
function botProtection () { function botProtection() {
if ($('meta[name=pqr]').length > 0) { if ($('meta[name=pqr]').length > 0) {
var link = atob($('meta[name=pqr]').attr('content')); var link = atob($('meta[name=pqr]').attr('content'));
var hash = $('meta[name=pq]').attr('content'); var hash = $('meta[name=pq]').attr('content');
...@@ -131,7 +132,7 @@ function botProtection () { ...@@ -131,7 +132,7 @@ function botProtection () {
} }
} }
function popovers () { function popovers() {
$('[data-toggle=popover]').each(function (e) { $('[data-toggle=popover]').each(function (e) {
$(this).popover({ $(this).popover({
// html : true, // html : true,
...@@ -141,14 +142,14 @@ function popovers () { ...@@ -141,14 +142,14 @@ function popovers () {
}); });
} }
function pagination () { function pagination() {
$('.pagination li:not(.active) > a').attr('href', '#'); $('.pagination li:not(.active) > a').attr('href', '#');
$('.pagination li.disabled > a').removeAttr('href'); $('.pagination li.disabled > a').removeAttr('href');
$('.pagination li:not(.active) > a').off(); $('.pagination li:not(.active) > a').off();
$('.pagination li:not(.active) > a').click(paginationHandler); $('.pagination li:not(.active) > a').click(paginationHandler);
} }
function paginationHandler () { function paginationHandler() {
var link = $(this).attr('data-href'); var link = $(this).attr('data-href');
if (link.length == 0) { if (link.length == 0) {
return; return;
...@@ -165,7 +166,7 @@ function paginationHandler () { ...@@ -165,7 +166,7 @@ function paginationHandler () {
}); });
} }
function imageLoader () { function imageLoader() {
if (typeof $('#container').masonry == 'undefined') { if (typeof $('#container').masonry == 'undefined') {
return; return;
} }
...@@ -180,7 +181,7 @@ function imageLoader () { ...@@ -180,7 +181,7 @@ function imageLoader () {
}); });
} }
function eliminateHost (host) { function eliminateHost(host) {
$('.result:not(.ad)').each(function (e) { $('.result:not(.ad)').each(function (e) {
var host2 = $(this).find('.link-link > a').attr('data-host'); var host2 = $(this).find('.link-link > a').attr('data-host');
if (host2.indexOf(host) === 0) { if (host2.indexOf(host) === 0) {
...@@ -189,7 +190,7 @@ function eliminateHost (host) { ...@@ -189,7 +190,7 @@ function eliminateHost (host) {
}); });
} }
function fokiChanger () { function fokiChanger() {
$('#fokiChanger ul > li').click(function () { $('#fokiChanger ul > li').click(function () {
document.location.href = $(this).attr('data-href'); document.location.href = $(this).attr('data-href');
}); });
...@@ -265,7 +266,7 @@ function fokiChanger () { ...@@ -265,7 +266,7 @@ function fokiChanger () {
/** /**
* Creates focus tab and tab selector for every stored focus in local storage * Creates focus tab and tab selector for every stored focus in local storage
*/ */
function createCustomFocuses () { function createCustomFocuses() {
for (var key in localStorage) { for (var key in localStorage) {
if (key.startsWith('focus_')) { if (key.startsWith('focus_')) {
var focus = loadFocusById(key); var focus = loadFocusById(key);
...@@ -297,7 +298,8 @@ function createCustomFocuses () { ...@@ -297,7 +298,8 @@ function createCustomFocuses () {
* </li> * </li>
* @endif * @endif
*/ */
function addFocus (focus, active = false) { function addFocus(focus, active) {
if (typeof active == "undefined") active = false;
var id = getIdFromName(focus.name); var id = getIdFromName(focus.name);
var foki = document.getElementById('foki'); var foki = document.getElementById('foki');
// create <input> // create <input>
...@@ -351,7 +353,8 @@ function addFocus (focus, active = false) { ...@@ -351,7 +353,8 @@ function addFocus (focus, active = false) {
* </div> * </div>
* @endif * @endif
*/ */
function addTab (focus, active = false) { function addTab(focus, active) {
if (typeof active == "undefined") active = false;
var id = getIdFromName(focus.name); var id = getIdFromName(focus.name);
// create tab div // create tab div
var tabPane = document.createElement('div'); var tabPane = document.createElement('div');
...@@ -378,19 +381,19 @@ function addTab (focus, active = false) { ...@@ -378,19 +381,19 @@ function addTab (focus, active = false) {
* Turns a name into an id * Turns a name into an id
* Converts special characters and spaces * Converts special characters and spaces
*/ */
function getIdFromName (name) { function getIdFromName(name) {
return 'focus_' + name.split(' ').join('_').toLowerCase(); return 'focus_' + name.split(' ').join('_').toLowerCase();
} }
/** /**
* Loads the focus object for the given id from local storage * Loads the focus object for the given id from local storage
*/ */
function loadFocusById (id) { function loadFocusById(id) {
return JSON.parse(localStorage.getItem(id)); return JSON.parse(localStorage.getItem(id));
} }
/** /**
* Gets the id of the currently active focus * Gets the id of the currently active focus
*/ */
function getActiveFocusId () { function getActiveFocusId() {
var search = window.location.search; var search = window.location.search;
var from = search.indexOf('focus=') + 'focus='.length; var from = search.indexOf('focus=') + 'focus='.length;
var to = search.substring(from).indexOf('&') + from; var to = search.substring(from).indexOf('&') + from;
...@@ -403,7 +406,7 @@ function getActiveFocusId () { ...@@ -403,7 +406,7 @@ function getActiveFocusId () {
* Turns the link of the current page into a search link for the given focus * 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? // TODO catch error if link is http://localhost:8000/meta/meta.ger3?
function generateSearchLinkForFocus (focus) { function generateSearchLinkForFocus(focus) {
var link = document.location.href; var link = document.location.href;
// remove old engine settings // remove old engine settings
// not yet tested, only for compability problems with old versions of bookmarks and plugins // not yet tested, only for compability problems with old versions of bookmarks and plugins
...@@ -431,7 +434,7 @@ function generateSearchLinkForFocus (focus) { ...@@ -431,7 +434,7 @@ function generateSearchLinkForFocus (focus) {
/** /**
* Replaces the focus in a given url with the "angepasst" focus * Replaces the focus in a given url with the "angepasst" focus
*/ */
function replaceFocusInUrl (url) { function replaceFocusInUrl(url) {
var from = url.indexOf('focus='); var from = url.indexOf('focus=');
var to = url.substring(from).indexOf('&') + from; var to = url.substring(from).indexOf('&') + from;
if (to === 0) { if (to === 0) {
...@@ -443,7 +446,7 @@ function replaceFocusInUrl (url) { ...@@ -443,7 +446,7 @@ function replaceFocusInUrl (url) {
/** /**
* Loads the content for a given fokus * Loads the content for a given fokus
*/ */
function initialLoadContent (fokus) { function initialLoadContent(fokus) {
var link = $('#' + fokus + 'TabSelector a').attr('data-href'); var link = $('#' + fokus + 'TabSelector a').attr('data-href');
$.get(link, function (data) { $.get(link, function (data) {
$('#' + fokus).html(data); $('#' + fokus).html(data);
...@@ -451,7 +454,7 @@ function initialLoadContent (fokus) { ...@@ -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 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 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(); var anzeigeLink = $('div.tab-pane.active .result[data-count=' + index + '] div.link-link > a').html();
...@@ -463,11 +466,14 @@ function resultSaver (index) { ...@@ -463,11 +466,14 @@ function resultSaver (index) {
var rank = parseFloat($('div.tab-pane.active .result[data-count=' + index + ']').attr('data-rank')); 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); new Result(title, link, anzeigeLink, gefVon, hoster, anonym, description, color, rank, undefined);
var to = $('#savedFokiTabSelector').length ? $('#savedFokiTabSelector') : $('#foki'); 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(); new Results().updateResultPageInterface();
} }
function loadQuicktips (search, locale, sprueche) { function loadQuicktips(search, locale, sprueche) {
var blacklist = []; var blacklist = [];
if (!sprueche) { if (!sprueche) {
blacklist.push('sprueche'); blacklist.push('sprueche');
...@@ -486,7 +492,7 @@ const QUICKTIP_SERVER = 'https://quicktips.metager3.de'; ...@@ -486,7 +492,7 @@ const QUICKTIP_SERVER = 'https://quicktips.metager3.de';
* @param {Array<String>} blacklist excluded loaders * @param {Array<String>} blacklist excluded loaders
* @param {Function} loadedHandler handler for loaded quicktips * @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; var getString = QUICKTIP_SERVER + '/quicktips.xml?search=' + search + '&locale=' + locale;
blacklist.forEach(function (value) { blacklist.forEach(function (value) {
getString += '&loader_' + value + '=false'; getString += '&loader_' + value + '=false';
...@@ -540,7 +546,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { ...@@ -540,7 +546,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
* *
* @param {Object} quicktips * @param {Object} quicktips
*/ */
function createQuicktips (quicktips, sprueche) { function createQuicktips(quicktips, sprueche) {
var quicktipsDiv = $('#quicktips'); var quicktipsDiv = $('#quicktips');
quicktips.sort(function (a, b) { quicktips.sort(function (a, b) {
return b.score - a.score; return b.score - a.score;
...@@ -591,4 +597,4 @@ function createQuicktips (quicktips, sprueche) { ...@@ -591,4 +597,4 @@ function createQuicktips (quicktips, sprueche) {
.append('<span class="gefVon">' + quicktip.gefVon + '</span>'); .append('<span class="gefVon">' + quicktip.gefVon + '</span>');
quicktipsDiv.append(quicktipDiv); quicktipsDiv.append(quicktipDiv);
}); });
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment