// ==UserScript== // @name GC little helper II // @description Some little things to make life easy (on www.geocaching.com). //--> $$000 // @version 0.11.15 //<-- $$000 // @copyright 2010-2016 Torsten Amshove, 2016-2022 2Abendsegler, 2017-2022 Ruko2010 // @author Torsten Amshove; 2Abendsegler; Ruko2010 // @license GNU General Public License v2.0 // @supportURL https://github.com/2Abendsegler/GClh/issues // @namespace http://www.amshove.net // @icon https://raw.githubusercontent.com/2Abendsegler/GClh/master/images/gclh_logo.png // @include https://www.geocaching.com/* // @include https://maps.google.tld/* // @include https://www.google.tld/maps* // @include https://project-gc.com/Tools/PQSplit* // @include https://www.openstreetmap.org* // @exclude /^https?://www\.geocaching\.com/(login|jobs|careers|brandedpromotions|promotions|blog|help|seek/sendtogps|profile/profilecontent)/ // @require https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/init.js // @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js // @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/dropbox.js/2.5.2/Dropbox-sdk.min.js // @require https://www.geocaching.com/scripts/MarkdownDeepLib.min.js // @require https://www.geocaching.com/scripts/SmileyConverter.js // @resource maincss https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/main.css // @resource headerhtml https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/header.html // @resource jscolor https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/jscolor.js // @resource leafletjs https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/leaflet.js // @resource leafletcss https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/leaflet.css // @connect maps.googleapis.com // @connect raw.githubusercontent.com // @connect api.open-elevation.com // @connect api.geonames.org // @connect coord.info // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @grant GM_log // @grant GM_xmlhttpRequest // @grant GM_getResourceText // @grant GM_info // @grant GM.info // @grant GM_addStyle // @grant GM_registerMenuCommand // ==/UserScript== ////////////////////////////////////// // 1. Declaration, Init, Start ($$cap) ////////////////////////////////////// var start = function(c) { checksBeforeRunning(); setTestLogConsole(); quitOnAdFrames() .then(function() {return jqueryInit(c);}) .then(function() {return browserInit(c);}) .then(function() {return constInit(c);}) .then(function() {return variablesInit(c);}) .done(function() { function checkBodyContent(waitCount) { if ($('body').children().length > 1) { tlc('BodyContent found'); if (document.location.href.match(/^https?:\/\/maps\.google\./) || document.location.href.match(/^https?:\/\/www\.google\.[a-zA-Z.]*\/maps/)) { mainGMaps(); } else if (document.location.href.match(/^https?:\/\/www\.openstreetmap\.org/)) { mainOSM(); } else if (document.location.href.match(/^https?:\/\/www\.geocaching\.com/)) { mainGCWait(); } else if (document.location.href.match(/^https?:\/\/project-gc\.com\/Tools\/PQSplit/)) { mainPGC(); } } else {waitCount++; if (waitCount <= 5000) setTimeout(function(){checkBodyContent(waitCount);}, 10);} } tlc('START checkBodyContent'); checkBodyContent(0); }); }; var checksBeforeRunning = function() { if (typeof GM.info != "undefined" && typeof GM.info.scriptHandler != "undefined" && GM.info.scriptHandler == 'Greasemonkey') { var text = 'Sorry, the script GC little helper II does not run with script manager Greasemonkey. Please use the script manager Tampermonkey or an other similar script manager.\n\nDo you want to see the "Tips for the installation"?\n '; var url = 'https://github.com/2Abendsegler/GClh/blob/master/docu/tips_installation.md#en'; if (window.confirm(text)) window.open(url, '_blank'); throw Error('Abort because of GClh II installation under script manager Greasemonkey.'); } if (document.getElementsByTagName('head')[0] && document.getElementById('GClh_II_running')) { var text = 'Sorry, the script GC little helper II is already running. Please make sure that it runs only once.\n\nDo you want to see tips on how this could happen and what you can do about it?'; var url = 'https://github.com/2Abendsegler/GClh/blob/master/docu/faq.md#1-en'; if (window.confirm(text)) window.open(url, '_blank'); throw Error('Abort because of GClh II already running.'); } else appendMetaId("GClh_II_running"); function checkForOldGClh(waitCount) { var linklists = 0; $('gclh_nav ul li a.Dropdown').each(function() {if ($(this)[0].innerHTML == 'Linklist') linklists++;} ); if (linklists > 1) { var text = 'Sorry, the script GC little helper II does not run together with the OLDER GC little helper (without the "II").\n\nYou have installed also the older GC little helper as script in your script manager or as add on in your browser. This older GC little helper has not been maintained since 2016 and works not correctly.\n\nPlease delete this older GC little helper.\n'; alert(text); throw Error('Abort because of older GClh installation.'); } else {waitCount++; if (waitCount <= 20) setTimeout(function(){checkForOldGClh(waitCount);}, 500);} } checkForOldGClh(0); }; var setTestLogConsole = function() { test_log_console = GM_getValue('test_log_console', false); GM_setValue('test_log_console', test_log_console); }; var quitOnAdFrames = function(c) { tlc('START quitOnAdFrames'); var quitOnAdFramesDeref = new jQuery.Deferred(); if (window.name) { if (window.name.substring(0, 18) !== 'google_ads_iframe_') quitOnAdFramesDeref.resolve(); else quitOnAdFramesDeref.reject(); } else { quitOnAdFramesDeref.resolve(); } return quitOnAdFramesDeref.promise(); }; var jqueryInit = function(c) { tlc('START jqueryInit'); if (typeof c.$ === "undefined") c.$ = c.$ || unsafeWindow.$ || window.$ || null; if (typeof c.jQuery === "undefined") c.jQuery = c.jQuery || unsafeWindow.jQuery || window.jQuery || null; var jqueryInitDeref = new jQuery.Deferred(); jqueryInitDeref.resolve(); return jqueryInitDeref.promise(); }; var browserInit = function(c) { tlc('START browserInit'); var browserInitDeref = new jQuery.Deferred(); c.CONFIG = JSON.parse(GM_getValue("CONFIG", '{}')); if (test_log_console != getValue('settings_test_log_console', false)) setValue('settings_test_log_console', test_log_console); c.browser = (typeof(chrome) !== "undefined") ? "chrome" : "firefox"; c.GM_setValue("browser", c.browser); tlc('Browser is '+c.browser); if (typeof GM_info != "undefined" && typeof GM_info.scriptHandler != "undefined") c.scriptHandler = GM_info.scriptHandler; else c.scriptHandler = false; c.GM_setValue("scriptHandler", c.scriptHandler); tlc('Script manager is '+c.scriptHandler); browserInitDeref.resolve(); return browserInitDeref.promise(); }; var constInit = function(c) { tlc('START constInit'); var constInitDeref = new jQuery.Deferred(); c.scriptVersion = GM_info.script.version; c.scriptName = GM_info.script.name; c.anzCustom = 10; c.anzTemplates = 10; c.bookmarks_def = new Array(31, 69, 14, 16, 32, 33, 48, "0", 8, 18, 54, 51, 55, 47, 10, 2, 35, 9, 17, 22, 66, 68); c.defaultConfigLink = "/my/default.aspx#GClhShowConfig"; c.defaultSyncLink = "/my/default.aspx#GClhShowSync"; c.defaultFindPlayerLink = "/my/default.aspx#GClhShowFindPlayer"; c.urlScript = "https://raw.githubusercontent.com/2Abendsegler/GClh/master/gc_little_helper_II.user.js"; c.urlConfigSt = "https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/config_standard.txt"; c.urlChangelog = "https://github.com/2Abendsegler/GClh/blob/master/docu/changelog.md#readme"; c.urlFaq = "https://github.com/2Abendsegler/GClh/blob/master/docu/faq.md#readme"; c.urlFaqHelp = "https://github.com/2Abendsegler/GClh/blob/master/docu/faq.md#8-en"; c.urlFaqReport = "https://github.com/2Abendsegler/GClh/blob/master/docu/faq.md#9-en"; c.urlDocu = "https://github.com/2Abendsegler/GClh/blob/master/docu/"; c.urlImages = "https://raw.githubusercontent.com/2Abendsegler/GClh/master/images/"; c.urlImagesSvg = "https://rawgit.com/2Abendsegler/GClh/master/images/"; c.urlGoogleMaps = "https://maps.google.de/maps?q={markerLat},{markerLon}&z={zoom}&ll={lat},{lon}"; c.urlOSM = "https://www.openstreetmap.org/?#map={zoom}/{lat}/{lon}"; c.urlFlopps = "https://flopp.net/?c={lat}:{lon}&z={zoom}&t=OSM&f=n&m=&d="; c.urlGeoHack = "https://tools.wmflabs.org/geohack/geohack.php?pagename=Geocaching¶ms={latDeg}_{latMin}_{latSec}_{latOrient}_{lonDeg}_{lonMin}_{lonSec}_{lonOrient}"; c.idCopyName = "idName"; c.idCopyCode = "idCode"; c.idCopyUrl = "idUrl"; c.idCopyOrgCoords = "idOrgCoords"; c.idCopyCorrCoords = "idCorrCoords"; c.idCopyGCTourCoords = "idGCTourCoords"; // Define bookmarks: c.bookmarks = new Array(); // WICHTIG: Die Reihenfolge darf hier auf keinen Fall geändert werden, weil dadurch eine falsche Zuordnung zu den gespeicherten Userdaten erfolgen würde! bookmark("Watchlist", "/my/watchlist.aspx", c.bookmarks); bookmark("Logs Geocaches", "/my/geocaches.aspx", c.bookmarks); bookmark("Own Geocaches", "/my/owned.aspx", c.bookmarks); bookmark("Logs Trackables", "/my/travelbugs.aspx", c.bookmarks); bookmark("Trackables Inventory", "/my/inventory.aspx", c.bookmarks); bookmark("Trackables Collection", "/my/collection.aspx", c.bookmarks); bookmark("Logs Benchmarks", "/my/benchmarks.aspx", c.bookmarks); bookmark("Member Features", "/my/subscription.aspx", c.bookmarks); bookmark("Friends", "/my/myfriends.aspx", c.bookmarks); bookmark("Account Details", "/account/default.aspx", c.bookmarks); bookmark("Public Profile", "/profile/", c.bookmarks); bookmark("Search GC (old adv.)", "/seek/nearest.aspx", c.bookmarks); bookmark("Routes", "/my/userroutes.aspx#find", c.bookmarks); bookmark("Drafts Upload", "/my/uploadfieldnotes.aspx", c.bookmarks); bookmark("Pocket Queries", "/pocket/default.aspx", c.bookmarks); bookmark("Pocket Queries Saved", "/pocket/default.aspx#DownloadablePQs", c.bookmarks); bookmark("Bookmark Lists", "/account/lists", c.bookmarks); bookmark("Notifications", "/notify/default.aspx", c.bookmarks); profileSpecialBookmark("Find Player", defaultFindPlayerLink, "lnk_findplayer", c.bookmarks); bookmark("E-Mail", "/email/default.aspx", c.bookmarks); bookmark("Statbar", "/my/statbar.aspx", c.bookmarks); bookmark("Guidelines", "/about/guidelines.aspx", c.bookmarks); profileSpecialBookmark("GClh II Config", "/my/default.aspx#GClhShowConfig", "lnk_gclhconfig", c.bookmarks); externalBookmark("Forum Groundspeak", "https://forums.groundspeak.com/", c.bookmarks); externalBookmark("Blog Groundspeak", "/blog/", c.bookmarks); bookmark("Favorites", "/my/favorites.aspx", c.bookmarks); externalBookmark("Geoclub", "https://www.geoclub.de/", c.bookmarks); bookmark("Public Profile Geocaches", "/p/default.aspx?tab=geocaches#profilepanel", c.bookmarks); bookmark("Public Profile Trackables", "/p/default.aspx?tab=trackables#profilepanel", c.bookmarks); bookmark("Public Profile Gallery", "/p/default.aspx?tab=gallery#profilepanel", c.bookmarks); bookmark("Public Profile Lists", "/p/default.aspx?tab=lists#profilepanel", c.bookmarks); bookmark("Dashboard", "/my/", c.bookmarks); profileSpecialBookmark("Nearest List", "/seek/nearest.aspx?#gclhpb#errhomecoord", "lnk_nearestlist", c.bookmarks); profileSpecialBookmark("Nearest Map", "/seek/nearest.aspx?#gclhpb#errhomecoord", "lnk_nearestmap", c.bookmarks); profileSpecialBookmark("Nearest List (w/o Founds)", "/seek/nearest.aspx?#gclhpb#errhomecoord", "lnk_nearestlist_wo", c.bookmarks); profileSpecialBookmark("Own Trackables", "/track/search.aspx?#gclhpb#errowntrackables", "lnk_my_trackables", c.bookmarks); // Custom Bookmarks. var num = c.bookmarks.length; for (var i = 0; i < c.anzCustom; i++) { c.bookmarks[num] = Object(); if (getValue("settings_custom_bookmark[" + i + "]", "") != "") c.bookmarks[num]['href'] = getValue("settings_custom_bookmark[" + i + "]"); else c.bookmarks[num]['href'] = "#"; if (getValue("settings_bookmarks_title[" + num + "]", "") != "") c.bookmarks[num]['title'] = getValue("settings_bookmarks_title[" + num + "]"); else { c.bookmarks[num]['title'] = "Custom" + i; setValue("settings_bookmarks_title[" + num + "]", bookmarks[num]['title']); } if (getValue("settings_custom_bookmark_target[" + i + "]", "") != "") { c.bookmarks[num]['target'] = getValue("settings_custom_bookmark_target[" + i + "]"); c.bookmarks[num]['rel'] = "external"; } else c.bookmarks[num]['target'] = ""; c.bookmarks[num]['custom'] = true; num++; } // More Bookmarks. bookmark("Public Profile Souvenirs", "/p/default.aspx?tab=souvenirs#profilepanel", c.bookmarks); bookmark("Statistics", "/my/statistics.aspx", c.bookmarks); bookmark("Drafts", "/my/fieldnotes.aspx", c.bookmarks); bookmark("Public Profile Statistics", "/p/default.aspx?tab=stats#profilepanel", c.bookmarks); bookmark("Geocaches RecViewed", "/my/recentlyviewedcaches.aspx", c.bookmarks); bookmark("Search TB", "/track/travelbug.aspx", c.bookmarks); bookmark("Search Geocoin", "/track/geocoin.aspx", c.bookmarks); externalBookmark("Geocaches Labs", "https://labs.geocaching.com/", c.bookmarks); bookmark("Search GC", "/play/search/", c.bookmarks); bookmark("Geocache Hide", "/play/hide/", c.bookmarks); bookmark("Message Center", "/account/messagecenter", c.bookmarks); bookmark("Search GC (old)", "/seek/", c.bookmarks); bookmark("Glossary of Terms", "/about/glossary.aspx", c.bookmarks); bookmark("Event Calendar", "/calendar/", c.bookmarks); bookmark("Geocache Adoption", "/adopt/", c.bookmarks); externalBookmark("Flopps Karte", "https://flopp.net/", c.bookmarks); externalBookmark("Geokrety", "https://geokrety.org/", c.bookmarks); externalBookmark("Project Geocaching", "https://project-gc.com/", c.bookmarks); bookmark("Search TB adv.", "/track/search.aspx", c.bookmarks); bookmark("Browse Map", "/map/", c.bookmarks); profileSpecialBookmark("GClh II Sync", defaultSyncLink, "lnk_gclhsync", c.bookmarks); externalBookmark("Forum Geoclub", "https://geoclub.de/forum/index.php", c.bookmarks); externalBookmark("Changelog GClh II", urlChangelog, c.bookmarks); bookmark("Lists", "/my/lists.aspx", c.bookmarks); bookmark("Souvenirs", "/my/souvenirs.aspx", c.bookmarks); bookmark("Leaderboard", "/play/leaderboard", c.bookmarks); bookmark("Trackables", "/track/", c.bookmarks); bookmark("GeoTours", "/play/geotours", c.bookmarks); bookmark("Unpublished Hides", "/play/owner/unpublished", c.bookmarks); bookmark("Search Map", "/play/map", c.bookmarks); bookmark("Ignore List", "/plan/lists/ignored", c.bookmarks); bookmark("Found Geocaches", "/seek/nearest.aspx?ul={me}", c.bookmarks); bookmark("Hidden Geocaches", "/seek/nearest.aspx?u={me}", c.bookmarks); bookmark("Archived Hides", "/play/owner/archived", c.bookmarks); bookmark("Cache owner dashboard", "/play/owner", c.bookmarks); bookmark("Published Disabled", "/play/owner/published?filter=disabledPublished", c.bookmarks); bookmark("Published Hides", "/play/owner/published", c.bookmarks); bookmark("Published Needs Maintenance", "/play/owner/published?filter=needsMaintenance", c.bookmarks); bookmark("Published Reviewer Note", "/play/owner/published?filter=publishedReviewerNote", c.bookmarks); bookmark("Unpublished Reviewer Note", "/play/owner/unpublished?filter=unpublishedReviewerNote", c.bookmarks); bookmark("Published Events", "/play/owner/published/events", c.bookmarks); bookmark("Unpublished Events", "/play/owner/unpublished/events", c.bookmarks); bookmark("Archived Events", "/play/owner/archived/events", c.bookmarks); // Custom Bookmark-title. c.bookmarks_orig_title = new Array(); for (var i = 0; i < c.bookmarks.length; i++) { if (getValue("settings_bookmarks_title[" + i + "]", "") != "") { c.bookmarks_orig_title[i] = c.bookmarks[i]['title']; c.bookmarks[i]['title'] = getValue("settings_bookmarks_title[" + i + "]"); } } c.gclhConfigKeysIgnoreForBackup = {"declared_version": true, "update_next_check": true}; tlc('START iconsInit'); iconsInit(c); tlc('START layersInit'); layersInit(c); tlc('START elevationServicesDataInit'); elevationServicesDataInit(c); tlc('START country_idInit'); country_idInit(c); tlc('START states_idInit'); states_idInit(c); tlc('START collectionInit'); collectionInit(c); // Old header of GS. tlc('START headerhtml'); c.header_old = GM_getResourceText('headerhtml'); // Part of core css of GS, Config and others. tlc('START maincss'); c.main_css = GM_getResourceText('maincss'); constInitDeref.resolve(); return constInitDeref.promise(); }; var variablesInit = function(c) { tlc('START variablesInit'); var variablesInitDeref = new jQuery.Deferred(); c.userInfo = c.userInfo || window.userInfo || null; c.isLoggedIn = c.isLoggedIn || window.isLoggedIn || null; c.userDefinedCoords = c.userDefinedCoords || window.userDefinedCoords || null; c.userToken = c.userToken || window.userToken || null; c.http = "http"; if (document.location.href.toLowerCase().indexOf("https") === 0) c.http = "https"; c.global_dependents = new Array(); c.global_mod_reset = false; c.global_rc_data = ""; c.global_rc_status = ""; c.global_me = false; c.global_isBasic = false; c.global_avatarUrl = false; c.global_findCount = false; c.global_locale = false; c.global_running = false; c.global_open_popup_count = 0; c.global_open_popups = new Array(); c.map_url = "https://www.geocaching.com/map/default.aspx"; c.new_map_url = "https://www.geocaching.com/play/map/"; c.remove_navi_play = getValue("remove_navi_play", false); c.remove_navi_community = getValue("remove_navi_community", false); c.remove_navi_shop = getValue("remove_navi_shop", false); c.settings_submit_log_button = getValue("settings_submit_log_button", true); c.settings_log_inline = getValue("settings_log_inline", false); c.settings_log_inline_tb = getValue("settings_log_inline_tb", false); c.settings_log_inline_pmo4basic = getValue("settings_log_inline_pmo4basic", true); c.settings_bookmarks_show = getValue("settings_bookmarks_show", true); c.settings_change_header_layout = getValue("settings_change_header_layout", true); c.settings_fixed_header_layout = getValue("settings_fixed_header_layout", false); c.settings_remove_logo = getValue("settings_remove_logo", false); c.settings_remove_message_in_header = getValue("settings_remove_message_in_header", false); c.settings_bookmarks_on_top = getValue("settings_bookmarks_on_top", true); c.settings_bookmarks_top_menu = getValue("settings_bookmarks_top_menu", "true"); c.settings_bookmarks_search = getValue("settings_bookmarks_search", "true"); c.settings_bookmarks_search_default = repApo(getValue("settings_bookmarks_search_default", "")); c.settings_redirect_to_map = getValue("settings_redirect_to_map", false); c.settings_new_width = getValue("settings_new_width", 1000); c.settings_hide_facebook = getValue("settings_hide_facebook", false); c.settings_hide_socialshare = getValue("settings_hide_socialshare", false); c.settings_hide_disclaimer = getValue("settings_hide_disclaimer", true); c.settings_hide_cache_notes = getValue("settings_hide_cache_notes", false); c.settings_adapt_height_cache_notes = getValue("settings_adapt_height_cache_notes", true); c.settings_hide_empty_cache_notes = getValue("settings_hide_empty_cache_notes", true); c.settings_show_all_logs = getValue("settings_show_all_logs", true); c.settings_show_all_logs_count = getValue("settings_show_all_logs_count", "30"); c.settings_decrypt_hint = getValue("settings_decrypt_hint", true); c.settings_visitCount_geocheckerCom = getValue("settings_visitCount_geocheckerCom", true); c.settings_show_bbcode = getValue("settings_show_bbcode", true); c.settings_show_mail = getValue("settings_show_mail", true); c.settings_font_size_menu = getValue("settings_font_size_menu", 16); c.settings_font_size_submenu = getValue("settings_font_size_submenu", 15); c.settings_distance_menu = getValue("settings_distance_menu", 16); c.settings_distance_submenu = getValue("settings_distance_submenu", 8); c.settings_font_color_menu_submenu = getValue("settings_font_color_menu_submenu", "93B516"); c.settings_font_color_menu = getValue("settings_font_color_menu", getValue("settings_font_color_menu_submenu", "93B516")); c.settings_font_color_submenu = getValue("settings_font_color_submenu", getValue("settings_font_color_menu_submenu", "93B516")); c.settings_menu_number_of_lines = getValue("settings_menu_number_of_lines", 1); c.settings_menu_show_separator = getValue("settings_menu_show_separator", false); c.settings_menu_float_right = getValue("settings_menu_float_right", false); c.settings_gc_tour_is_working = getValue("settings_gc_tour_is_working", false); c.settings_show_smaller_gc_link = getValue("settings_show_smaller_gc_link", true); c.settings_show_message = getValue("settings_show_message", true); c.settings_show_remove_ignoring_link = getValue("settings_show_remove_ignoring_link", true); c.settings_use_one_click_ignoring = getValue("settings_use_one_click_ignoring", true); c.settings_show_common_lists_in_zebra = getValue("settings_show_common_lists_in_zebra", true); c.settings_show_common_lists_color_user = getValue("settings_show_common_lists_color_user", true); c.settings_show_cache_listings_in_zebra = getValue("settings_show_cache_listings_in_zebra", false); c.settings_show_cache_listings_color_user = getValue("settings_show_cache_listings_color_user", true); c.settings_show_cache_listings_color_owner = getValue("settings_show_cache_listings_color_owner", true); c.settings_show_cache_listings_color_reviewer = getValue("settings_show_cache_listings_color_reviewer", true); c.settings_show_cache_listings_color_vip = getValue("settings_show_cache_listings_color_vip", true); c.settings_show_tb_listings_in_zebra = getValue("settings_show_tb_listings_in_zebra", true); c.settings_show_tb_listings_color_user = getValue("settings_show_tb_listings_color_user", true); c.settings_show_tb_listings_color_owner = getValue("settings_show_tb_listings_color_owner", true); c.settings_show_tb_listings_color_reviewer = getValue("settings_show_tb_listings_color_reviewer", true); c.settings_show_tb_listings_color_vip = getValue("settings_show_tb_listings_color_vip", true); c.settings_lines_color_zebra = getValue("settings_lines_color_zebra", "EBECED"); c.settings_lines_color_user = getValue("settings_lines_color_user", "C2E0C3"); c.settings_lines_color_owner = getValue("settings_lines_color_owner", "E0E0C3"); c.settings_lines_color_reviewer = getValue("settings_lines_color_reviewer", "EAD0C3"); c.settings_lines_color_vip = getValue("settings_lines_color_vip", "F0F0A0"); c.settings_show_mail_in_allmyvips = getValue("settings_show_mail_in_allmyvips", true); c.settings_show_mail_in_viplist = getValue("settings_show_mail_in_viplist", true); c.settings_process_vup = getValue("settings_process_vup", true); c.settings_show_vup_friends = getValue("settings_show_vup_friends", false); c.settings_vup_hide_avatar = getValue("settings_vup_hide_avatar", false); c.settings_vup_hide_log = getValue("settings_vup_hide_log", false); c.settings_f2_save_gclh_config = getValue("settings_f2_save_gclh_config", true); c.settings_esc_close_gclh_config = getValue("settings_esc_close_gclh_config", true); c.settings_f4_call_gclh_config = getValue("settings_f4_call_gclh_config", true); c.settings_call_config_via_sriptmanager = getValue("settings_call_config_via_sriptmanager", true); c.settings_f10_call_gclh_sync = getValue("settings_f10_call_gclh_sync", true); c.settings_call_sync_via_sriptmanager = getValue("settings_call_sync_via_sriptmanager", true); c.settings_show_sums_in_bookmark_lists = getValue("settings_show_sums_in_bookmark_lists", true); c.settings_show_sums_in_watchlist = getValue("settings_show_sums_in_watchlist", true); c.settings_hide_warning_message = getValue("settings_hide_warning_message", true); c.settings_show_save_message = getValue("settings_show_save_message", true); c.settings_map_overview_build = getValue("settings_map_overview_build", true); c.settings_map_overview_zoom = getValue("settings_map_overview_zoom", 11); c.settings_map_overview_layer = getValue("settings_map_overview_layer", "Geocaching"); c.settings_logit_for_basic_in_pmo = getValue("settings_logit_for_basic_in_pmo", true); c.settings_log_statistic = getValue("settings_log_statistic", true); c.settings_log_statistic_percentage = getValue("settings_log_statistic_percentage", true); c.settings_log_statistic_reload = getValue("settings_log_statistic_reload", 8); c.settings_count_own_matrix = getValue("settings_count_own_matrix", true); c.settings_count_foreign_matrix = getValue("settings_count_foreign_matrix", true); c.settings_count_own_matrix_show_next = getValue("settings_count_own_matrix_show_next", true); c.settings_count_own_matrix_show_count_next = getValue("settings_count_own_matrix_show_count_next", 2); c.settings_count_own_matrix_show_color_next = getValue("settings_count_own_matrix_show_color_next", "5151FB"); c.settings_count_own_matrix_links_radius = getValue("settings_count_own_matrix_links_radius", 25); c.settings_count_own_matrix_links = getValue("settings_count_own_matrix_links", "map"); c.settings_hide_left_sidebar_on_google_maps = getValue("settings_hide_left_sidebar_on_google_maps", true); c.settings_add_link_gc_map_on_google_maps = getValue("settings_add_link_gc_map_on_google_maps", true); c.settings_switch_from_google_maps_to_gc_map_in_same_tab = getValue("settings_switch_from_google_maps_to_gc_map_in_same_tab", false); c.settings_add_link_new_gc_map_on_google_maps = getValue("settings_add_link_new_gc_map_on_google_maps", true); c.settings_switch_from_google_maps_to_new_gc_map_in_same_tab = getValue("settings_switch_from_google_maps_to_new_gc_map_in_same_tab", false); c.settings_add_link_google_maps_on_gc_map = getValue("settings_add_link_google_maps_on_gc_map", true); c.settings_switch_to_google_maps_in_same_tab = getValue("settings_switch_to_google_maps_in_same_tab", false); c.settings_add_link_gc_map_on_osm = getValue("settings_add_link_gc_map_on_osm", true); c.settings_switch_from_osm_to_gc_map_in_same_tab = getValue("settings_switch_from_osm_to_gc_map_in_same_tab", false); c.settings_add_link_new_gc_map_on_osm = getValue("settings_add_link_new_gc_map_on_osm", true); c.settings_switch_from_osm_to_new_gc_map_in_same_tab = getValue("settings_switch_from_osm_to_new_gc_map_in_same_tab", false); c.settings_add_link_osm_on_gc_map = getValue("settings_add_link_osm_on_gc_map", true); c.settings_switch_to_osm_in_same_tab = getValue("settings_switch_to_osm_in_same_tab", false); c.settings_add_link_flopps_on_gc_map = getValue("settings_add_link_flopps_on_gc_map", true); c.settings_switch_to_flopps_in_same_tab = getValue("settings_switch_to_flopps_in_same_tab", false); c.settings_add_link_geohack_on_gc_map = getValue("settings_add_link_geohack_on_gc_map", true); c.settings_switch_to_geohack_in_same_tab = getValue("settings_switch_to_geohack_in_same_tab", false); c.settings_sort_default_bookmarks = getValue("settings_sort_default_bookmarks", true); c.settings_make_vip_lists_hideable = getValue("settings_make_vip_lists_hideable", true); c.settings_show_latest_logs_symbols = getValue("settings_show_latest_logs_symbols", true); c.settings_show_latest_logs_symbols_count = getValue("settings_show_latest_logs_symbols_count", 10); c.settings_set_default_langu = getValue("settings_set_default_langu", false); c.settings_default_langu = getValue("settings_default_langu", "English"); c.settings_hide_colored_versions = getValue("settings_hide_colored_versions", false); c.settings_make_config_main_areas_hideable = getValue("settings_make_config_main_areas_hideable", true); c.settings_faster_profile_trackables = getValue("settings_faster_profile_trackables", false); c.settings_show_eventday = getValue("settings_show_eventday", true); c.settings_show_google_maps = getValue("settings_show_google_maps", true); c.settings_show_log_it = getValue("settings_show_log_it", true); c.settings_show_nearestuser_profil_link = getValue("settings_show_nearestuser_profil_link", true); c.settings_show_homezone = getValue("settings_show_homezone", true); c.settings_homezone_radius = getValue("settings_homezone_radius", "10"); c.settings_homezone_color = getValue("settings_homezone_color", "#0000FF"); c.settings_homezone_opacity = getValue("settings_homezone_opacity", 10); c.settings_multi_homezone = JSON.parse(getValue("settings_multi_homezone", "{}")); c.settings_show_hillshadow = getValue("settings_show_hillshadow", false); c.settings_map_layers = getValue("settings_map_layers", "").split("###"); c.settings_default_logtype = getValue("settings_default_logtype", "-1"); c.settings_default_logtype_event = getValue("settings_default_logtype_event", c.settings_default_logtype); c.settings_default_logtype_owner = getValue("settings_default_logtype_owner", c.settings_default_logtype); c.settings_default_tb_logtype = getValue("settings_default_tb_logtype", "-1"); c.settings_bookmarks_list = JSON.parse(getValue("settings_bookmarks_list", JSON.stringify(c.bookmarks_def)).replace(/, (?=,)/g, ",null")); if (c.settings_bookmarks_list.length == 0) c.settings_bookmarks_list = c.bookmarks_def; c.settings_sync_last = new Date(getValue("settings_sync_last", "Thu Jan 01 1970 01:00:00 GMT+0100 (Mitteleuropäische Zeit)")); c.settings_sync_hash = getValue("settings_sync_hash", ""); c.settings_sync_time = getValue("settings_sync_time", 36000000); // 10 Stunden c.settings_sync_autoImport = getValue("settings_sync_autoImport", false); c.settings_hide_advert_link = getValue('settings_hide_advert_link', true); c.settings_hide_spoilerwarning = getValue('settings_hide_spoilerwarning', true); c.settings_hide_hint = getValue('settings_hide_hint', true); c.settings_strike_archived = getValue('settings_strike_archived', true); c.settings_highlight_usercoords = getValue('settings_highlight_usercoords', true); c.settings_highlight_usercoords_bb = getValue('settings_highlight_usercoords_bb', false); c.settings_highlight_usercoords_it = getValue('settings_highlight_usercoords_it', true); c.settings_map_hide_found = getValue('settings_map_hide_found', true); c.settings_map_hide_hidden = getValue('settings_map_hide_hidden', true); c.settings_map_hide_dnfs = getValue('settings_map_hide_dnfs', true); c.settings_map_hide_2 = getValue('settings_map_hide_2', false); c.settings_map_hide_9 = getValue('settings_map_hide_9', false); c.settings_map_hide_5 = getValue('settings_map_hide_5', false); c.settings_map_hide_3 = getValue('settings_map_hide_3', false); c.settings_map_hide_6 = getValue('settings_map_hide_6', false); c.settings_map_hide_453 = getValue('settings_map_hide_453', false); c.settings_map_hide_7005 = getValue('settings_map_hide_7005', false); c.settings_map_hide_13 = getValue('settings_map_hide_13', false); c.settings_map_hide_1304 = getValue('settings_map_hide_1304', false); c.settings_map_hide_4 = getValue('settings_map_hide_4', false); c.settings_map_hide_11 = getValue('settings_map_hide_11', false); c.settings_map_hide_137 = getValue('settings_map_hide_137', false); c.settings_map_hide_8 = getValue('settings_map_hide_8', false); c.settings_map_hide_1858 = getValue('settings_map_hide_1858', false); c.settings_show_fav_percentage = getValue('settings_show_fav_percentage', true); c.settings_show_vip_list = getValue('settings_show_vip_list', true); c.settings_show_owner_vip_list = getValue('settings_show_owner_vip_list', true); c.settings_autovisit = getValue("settings_autovisit", true); c.settings_autovisit_default = getValue("settings_autovisit_default", false); c.settings_show_thumbnails = getValue("settings_show_thumbnails", true); c.settings_imgcaption_on_top = getValue("settings_imgcaption_on_top", false); c.settings_hide_avatar = getValue("settings_hide_avatar", false); c.settings_link_big_listing = getValue("settings_link_big_listing", true); c.settings_show_big_gallery = getValue("settings_show_big_gallery", false); c.settings_automatic_friend_reset = getValue("settings_automatic_friend_reset", false); c.settings_show_long_vip = getValue("settings_show_long_vip", false); c.settings_load_logs_with_gclh = getValue("settings_load_logs_with_gclh", true); c.settings_map_add_layer = getValue("settings_map_add_layer", true); c.settings_map_default_layer = getValue("settings_map_default_layer", "OpenStreetMap Default"); c.settings_hide_map_header = getValue("settings_hide_map_header", false); c.settings_spoiler_strings = repApo(getValue("settings_spoiler_strings", "spoiler|hinweis")); c.settings_replace_log_by_last_log = getValue("settings_replace_log_by_last_log", false); c.settings_hide_top_button = getValue("settings_hide_top_button", false); c.settings_show_real_owner = getValue("settings_show_real_owner", false); c.settings_hide_archived_in_owned = getValue("settings_hide_archived_in_owned", false); c.settings_show_button_for_hide_archived = getValue("settings_show_button_for_hide_archived", true); c.settings_hide_visits_in_profile = getValue("settings_hide_visits_in_profile", false); c.settings_log_signature_on_fieldnotes = getValue("settings_log_signature_on_fieldnotes", true); c.settings_map_hide_sidebar = getValue("settings_map_hide_sidebar", true); c.settings_hover_image_max_size = getValue("settings_hover_image_max_size", 600); c.settings_vip_show_nofound = getValue("settings_vip_show_nofound", true); c.settings_use_gclh_layercontrol = getValue("settings_use_gclh_layercontrol", true); c.settings_fixed_pq_header = getValue("settings_fixed_pq_header", true); c.settings_friendlist_summary = getValue("settings_friendlist_summary", true); c.settings_friendlist_summary_viponly = getValue("settings_friendlist_summary_viponly", false); c.settings_search_data = JSON.parse(getValue("settings_search_data", "[]")); c.settings_search_enable_user_defined = getValue("settings_search_enable_user_defined",true); c.settings_pq_warning = getValue("settings_pq_warning",true); c.settings_pq_set_cachestotal = getValue("settings_pq_set_cachestotal",true); c.settings_pq_cachestotal = getValue("settings_pq_cachestotal",1000); c.settings_pq_option_ihaventfound = getValue("settings_pq_option_ihaventfound",true); c.settings_pq_option_idontown = getValue("settings_pq_option_idontown",true); c.settings_pq_option_ignorelist = getValue("settings_pq_option_ignorelist",true); c.settings_pq_option_isenabled = getValue("settings_pq_option_isenabled",true); c.settings_pq_option_filename = getValue("settings_pq_option_filename",true); c.settings_pq_set_terrain = getValue("settings_pq_set_terrain",true); c.settings_pq_set_difficulty = getValue("settings_pq_set_difficulty",true); c.settings_pq_difficulty = getValue("settings_pq_difficulty",">="); c.settings_pq_difficulty_score = getValue("settings_pq_difficulty_score","1"); c.settings_pq_terrain = getValue("settings_pq_terrain",">="); c.settings_pq_terrain_score = getValue("settings_pq_terrain_score","1"); c.settings_pq_automatically_day = getValue("settings_pq_automatically_day",false); c.settings_pq_previewmap = getValue("settings_pq_previewmap",true); c.settings_pq_previewmap_layer = getValue("settings_pq_previewmap_layer","Geocaching"); c.settings_mail_icon_new_win = getValue("settings_mail_icon_new_win",false); c.settings_message_icon_new_win = getValue("settings_message_icon_new_win",false); c.settings_hide_cache_approvals = getValue("settings_hide_cache_approvals", true); c.settings_driving_direction_link = getValue("settings_driving_direction_link",true); c.settings_driving_direction_parking_area = getValue("settings_driving_direction_parking_area",false); c.settings_show_elevation_of_waypoints = getValue("settings_show_elevation_of_waypoints", true); c.settings_primary_elevation_service = getValue("settings_primary_elevation_service", 3); c.settings_secondary_elevation_service = getValue("settings_secondary_elevation_service", 2); c.settings_distance_units = getValue("settings_distance_units", ""); c.settings_img_warning = getValue("settings_img_warning", false); c.settings_remove_banner = getValue("settings_remove_banner", false); c.settings_remove_banner_for_garminexpress = getValue("settings_remove_banner_for_garminexpress", false); c.settings_remove_banner_blue = getValue("settings_remove_banner_blue", false); c.settings_compact_layout_bm_lists = getValue("settings_compact_layout_bm_lists", true); c.settings_compact_layout_pqs = getValue("settings_compact_layout_pqs", true); c.settings_compact_layout_list_of_pqs = getValue("settings_compact_layout_list_of_pqs", true); c.settings_compact_layout_nearest = getValue("settings_compact_layout_nearest", true); c.settings_compact_layout_recviewed = getValue("settings_compact_layout_recviewed", true); c.settings_map_links_statistic = getValue("settings_map_links_statistic", true); c.settings_map_percentage_statistic = getValue("settings_map_percentage_statistic", true); c.settings_improve_add_to_list_height = getValue("settings_improve_add_to_list_height", 205); c.settings_improve_add_to_list = getValue("settings_improve_add_to_list", true); c.settings_show_flopps_link = getValue("settings_show_flopps_link", true); c.settings_show_brouter_link = getValue("settings_show_brouter_link", true); c.settings_show_gpsvisualizer_link = getValue("settings_show_gpsvisualizer_link", true); c.settings_show_gpsvisualizer_gcsymbols = getValue("settings_show_gpsvisualizer_gcsymbols", true); c.settings_show_gpsvisualizer_typedesc = getValue("settings_show_gpsvisualizer_typedesc", true); c.settings_show_openrouteservice_link = getValue("settings_show_openrouteservice_link", true); c.settings_show_openrouteservice_home = getValue("settings_show_openrouteservice_home", false); c.settings_show_openrouteservice_medium = getValue("settings_show_openrouteservice_medium", "2b"); c.settings_show_copydata_menu = getValue("settings_show_copydata_menu", true); c.settings_show_default_links = getValue("settings_show_default_links", true); c.settings_bm_changed_and_go = getValue("settings_bm_changed_and_go", true); c.settings_bml_changed_and_go = getValue("settings_bml_changed_and_go", true); c.settings_show_tb_inv = getValue("settings_show_tb_inv", true); c.settings_but_search_map = getValue("settings_but_search_map", true); c.settings_but_search_map_new_tab = getValue("settings_but_search_map_new_tab", false); c.settings_show_pseudo_as_owner = getValue("settings_show_pseudo_as_owner", true); c.settings_fav_proz_nearest = getValue("settings_fav_proz_nearest", true); c.settings_open_tabs_nearest = getValue("settings_open_tabs_nearest", true); c.settings_fav_proz_pqs = getValue("settings_fav_proz_pqs", true); c.settings_open_tabs_pqs = getValue("settings_open_tabs_pqs", true); c.settings_fav_proz_recviewed = getValue("settings_fav_proz_recviewed", true); c.settings_show_all_logs_but = getValue("settings_show_all_logs_but", true); c.settings_show_log_counter_but = getValue("settings_show_log_counter_but", true); c.settings_show_log_counter = getValue("settings_show_log_counter", false); c.settings_show_bigger_avatars_but = getValue("settings_show_bigger_avatars_but", true); c.settings_hide_feedback_icon = getValue("settings_hide_feedback_icon", false); c.settings_compact_layout_new_dashboard = getValue("settings_compact_layout_new_dashboard", false); c.settings_show_draft_indicator = getValue("settings_show_draft_indicator", true); c.settings_show_enhanced_map_popup = getValue("settings_show_enhanced_map_popup", true); c.settings_show_enhanced_map_coords = getValue("settings_show_enhanced_map_coords", true); c.settings_show_latest_logs_symbols_count_map = getValue("settings_show_latest_logs_symbols_count_map", 16); c.settings_modify_new_drafts_page = getValue("settings_modify_new_drafts_page", true); c.settings_gclherror_alert = getValue("settings_gclherror_alert", false); c.settings_auto_open_tb_inventory_list = getValue("settings_auto_open_tb_inventory_list", true); c.settings_embedded_smartlink_ignorelist = getValue("settings_embedded_smartlink_ignorelist", true); c.settings_both_tabs_list_of_pqs_one_page = getValue("settings_both_tabs_list_of_pqs_one_page", false); c.settings_past_events_on_bm = getValue("settings_past_events_on_bm", true); c.settings_show_log_totals = getValue("settings_show_log_totals", true); c.settings_show_reviewer_as_vip = getValue("settings_show_reviewer_as_vip", true); c.settings_hide_found_count = getValue("settings_hide_found_count", false); c.settings_show_compact_logbook_but = getValue("settings_show_compact_logbook_but", true); c.settings_log_status_icon_visible = getValue("settings_log_status_icon_visible", true); c.settings_cache_type_icon_visible = getValue("settings_cache_type_icon_visible", true); c.settings_showUnpublishedHides = getValue("settings_showUnpublishedHides", true); c.settings_set_showUnpublishedHides_sort = getValue("settings_set_showUnpublishedHides_sort", true); c.settings_showUnpublishedHides_sort = getValue("settings_showUnpublishedHides_sort", "abc"); c.settings_lists_compact_layout = getValue("settings_lists_compact_layout", false); c.settings_lists_disabled = getValue("settings_lists_disabled", false); c.settings_lists_disabled_color = getValue("settings_lists_disabled_color", "4A4A4A"); c.settings_lists_disabled_strikethrough = getValue("settings_lists_disabled_strikethrough", true); c.settings_lists_archived = getValue("settings_lists_archived", false); c.settings_lists_archived_color = getValue("settings_lists_archived_color", "8C0B0B"); c.settings_lists_archived_strikethrough = getValue("settings_lists_archived_strikethrough", true); c.settings_lists_icons_visible = getValue("settings_lists_icons_visible", false); c.settings_lists_log_status_icons_visible = getValue("settings_lists_log_status_icons_visible", true); c.settings_lists_cache_type_icons_visible = getValue("settings_lists_cache_type_icons_visible", true); c.settings_lists_premium_column = getValue("settings_lists_premium_column", false); c.settings_lists_found_column_bml = getValue("settings_lists_found_column_bml", false); c.settings_lists_show_log_it = getValue("settings_lists_show_log_it", false); c.settings_lists_back_to_top = getValue("settings_lists_back_to_top", false); c.settings_searchmap_autoupdate_after_dragging = getValue("settings_searchmap_autoupdate_after_dragging", true); c.settings_improve_character_counter = getValue("settings_improve_character_counter", true); c.settings_searchmap_compact_layout = getValue("settings_searchmap_compact_layout", true); c.settings_searchmap_disabled = getValue("settings_searchmap_disabled", false); c.settings_searchmap_disabled_strikethrough = getValue("settings_searchmap_disabled_strikethrough", true); c.settings_searchmap_disabled_color = getValue("settings_searchmap_disabled_color", '4A4A4A'); c.settings_searchmap_show_hint = getValue("settings_searchmap_show_hint", false); c.settings_show_copydata_own_stuff_show = getValue("settings_show_copydata_own_stuff_show", false); c.settings_show_copydata_own_stuff_name = getValue("settings_show_copydata_own_stuff_name", 'Photo file name'); c.settings_show_copydata_own_stuff_value = getValue("settings_show_copydata_own_stuff_value", '#yyyy#.#mm#.#dd# - #GCName# - #GCCode# - 01'); c.settings_show_copydata_own_stuff = JSON.parse(getValue("settings_show_copydata_own_stuff", "{}")); c.settings_relocate_other_map_buttons = getValue("settings_relocate_other_map_buttons", true); c.settings_show_radius_on_flopps = getValue("settings_show_radius_on_flopps", true); c.settings_show_edit_links_for_logs = getValue("settings_show_edit_links_for_logs", true); c.settings_show_copydata_plus = getValue("settings_show_copydata_plus", false); c.settings_show_copydata_separator = getValue("settings_show_copydata_separator", "\n"); c.settings_lists_show_dd = getValue("settings_lists_show_dd", true); c.settings_lists_hide_desc = getValue("settings_lists_hide_desc", true); c.settings_lists_upload_file = getValue("settings_lists_upload_file", true); c.settings_lists_open_tabs = getValue("settings_lists_open_tabs", true); c.settings_profile_old_links = getValue("settings_profile_old_links", false); c.settings_listing_old_links = getValue("settings_listing_old_links", false); c.settings_searchmap_show_btn_save_as_pq = getValue("settings_searchmap_show_btn_save_as_pq", true); c.settings_map_overview_browse_map_icon = getValue("settings_map_overview_browse_map_icon", true); c.settings_map_overview_browse_map_icon_new_tab = getValue("settings_map_overview_browse_map_icon_new_tab", false); c.settings_map_overview_search_map_icon = getValue("settings_map_overview_search_map_icon", true); c.settings_map_overview_search_map_icon_new_tab = getValue("settings_map_overview_search_map_icon_new_tab", false); c.settings_cache_notes_min_size = getValue("settings_cache_notes_min_size", 54); c.settings_show_link_to_browse_map = getValue("settings_show_link_to_browse_map", false); c.settings_show_hide_upvotes_but = getValue("settings_show_hide_upvotes_but", false); c.settings_hide_upvotes = getValue("settings_hide_upvotes", false); c.settings_smaller_upvotes_icons = getValue("settings_smaller_upvotes_icons", true); c.settings_no_wiggle_upvotes_click = getValue("settings_no_wiggle_upvotes_click", true); c.settings_show_country_in_place = getValue("settings_show_country_in_place", true); c.settings_color_bg = getValue("settings_color_bg", "D8CD9D"); c.settings_color_if = getValue("settings_color_if", "D8CD9D"); c.settings_color_ht = getValue("settings_color_ht", "D8CD9D"); c.settings_color_bh = getValue("settings_color_bh", "D8CD9D"); c.settings_color_bu = getValue("settings_color_bu", "D8CD9D)"); c.settings_color_bo = getValue("settings_color_bo", "778555"); c.settings_color_nv = getValue("settings_color_nv", "F0DFC6"); c.settings_color_navi_search = getValue("settings_color_navi_search", false); c.settings_map_show_btn_hide_header = getValue("settings_map_show_btn_hide_header", true); c.settings_save_as_pq_set_defaults = getValue("settings_save_as_pq_set_defaults", false); c.settings_save_as_pq_set_all = getValue("settings_save_as_pq_set_all", true); c.settings_compact_layout_cod = getValue("settings_compact_layout_cod", false); c.settings_show_button_fav_proz_cod = getValue("settings_show_button_fav_proz_cod", true); c.settings_change_font_cache_notes = getValue("settings_change_font_cache_notes", false); c.settings_larger_map_as_browse_map = getValue("settings_larger_map_as_browse_map", false); c.settings_fav_proz_cod = getValue("settings_fav_proz_cod", true); c.settings_logs_old_fashioned = getValue("settings_logs_old_fashioned", false); c.settings_prevent_watchclick_popup = getValue("settings_prevent_watchclick_popup", false); c.settings_upgrade_button_header_remove = getValue("settings_upgrade_button_header_remove", false); c.settings_unsaved_log_message = getValue("settings_unsaved_log_message", true); c.settings_sort_map_layers = getValue("settings_sort_map_layers", false); c.settings_add_search_in_logs_func = getValue("settings_add_search_in_logs_func", true); c.settings_show_add_cache_info_in_log_page = getValue("settings_show_add_cache_info_in_log_page", true); c.settings_pq_splitter_pqname = getValue("settings_pq_splitter_pqname", 'PQ_Splitter_'); c.settings_pq_splitter_how_often = getValue("settings_pq_splitter_how_often", 2); c.settings_pq_splitter_email = getValue("settings_pq_splitter_email", 1); c.settings_show_create_pq_from_pq_splitter = getValue("settings_show_create_pq_from_pq_splitter", true); c.settings_drafts_cache_link = getValue("settings_drafts_cache_link", true); c.settings_drafts_cache_link_new_tab = getValue("settings_drafts_cache_link_new_tab", false); c.settings_drafts_color_visited_link = getValue("settings_drafts_color_visited_link", true); c.settings_drafts_old_log_form = getValue("settings_drafts_old_log_form", false); c.settings_drafts_log_icons = getValue("settings_drafts_log_icons", true); c.settings_drafts_go_automatic_back = getValue("settings_drafts_go_automatic_back", false); c.settings_listing_hide_external_link_warning = getValue("settings_listing_hide_external_link_warning", false); c.settings_listing_links_new_tab = getValue("settings_listing_links_new_tab", false); tlc('START userToken'); try { if (c.userToken === null) { c.userData = $('#aspnetForm script:not([src])').filter(function() { return this.innerHTML.indexOf("ccConversions") != -1; }).html(); if (c.userData !== null) { if (typeof c.userData !== "undefined") { c.userData = c.userData.replace('{ID: ', '{"ID": '); var regex = /([a-zA-Z0-9öÖäÄüÜß]+)([ ]?=[ ]?)(((({.+})(;)))|(((\[.+\])(;)))|(((".+")(;)))|((('.+')(;)))|(([^'"{\[].+)(;)))/g; var match; while (match = regex.exec(userData)) { if (match[1] == "eventCacheData") continue; var data = (match[6] || match[10] || match[14] || match[18] || match[21]).trim(); if (data.charAt(0) == '"' || data.charAt(0) == "'") data = data.slice(1, data.length - 1); data = data.trim(); if (data.charAt(0) == '{' || data.charAt(0) == '[') data = JSON.parse(data); if (typeof c.chromeUserData === "undefined") c.chromeUserData = {}; c.chromeUserData[match[1].replace('"', '').replace("'", "").trim()] = data; } if (c.chromeUserData["userInfo"]) c.userInfo = chromeUserData["userInfo"]; if (c.chromeUserData["isLoggedIn"]) c.isLoggedIn = chromeUserData["isLoggedIn"]; if (c.chromeUserData["userDefinedCoords"]) c.userDefinedCoords = c.chromeUserData["userDefinedCoords"]; if (c.chromeUserData["userToken"]) c.userToken = c.chromeUserData["userToken"]; } } } } catch(e) {gclh_error("Error parsing userdata from page",e);} variablesInitDeref.resolve(); return variablesInitDeref.promise(); }; ///////////////////////// // 2. Google Maps ($$cap) ///////////////////////// var mainGMaps = function() { try { // Add links to GC Maps on Google Maps page. if (settings_add_link_gc_map_on_google_maps || settings_add_link_new_gc_map_on_google_maps) { function addGcButton(waitCount) { if (document.getElementById("gbwa")) { var code = ""; code += "function openGcMap(mapType, switchToSameTab){"; code += " var matches = document.location.href.match(/@(-?[0-9.]*),(-?[0-9.]*),([0-9.]*)z/);"; code += " if (matches != null) {"; code += " var zoom = matches[3];"; code += " } else {"; // Bei Earth gibt es kein z für Zoom sondern ein m für Meter. Meter in Zoom umrechnen. code += " var matches = document.location.href.match(/@(-?[0-9.]*),(-?[0-9.]*),([0-9.]*)m/);"; code += " if (matches != null) {"; code += " var zoom = 26 - Math.round(Math.log2(matches[3]));"; code += " }"; code += " }"; code += " if (matches != null) {"; code += " var matchesMarker = document.location.href.match(/!3d(-?[0-9.]*)!4d(-?[0-9.]*)/);"; code += " if (matchesMarker != null) {"; code += " if (mapType == 'old') var url = '" + map_url + "?lat=' + matchesMarker[1] + '&lng=' + matchesMarker[2] + '#?ll=' + matches[1] + ',' + matches[2] + '&z=' + zoom;"; code += " else var url = '" + new_map_url + "?lat=' + matchesMarker[1] + '&lng=' + matchesMarker[2] + '&zoom=' + zoom;"; code += " } else {"; code += " if (mapType == 'old') var url = '" + map_url + "?lat=' + matches[1] + '&lng=' + matches[2] + '&z=' + zoom;"; code += " else var url = '" + new_map_url + "?lat=' + matches[1] + '&lng=' + matches[2] + '&zoom=' + zoom;"; code += " }"; code += " if (switchToSameTab) location = url;"; code += " else window.open(url);"; code += " } else {"; code += " alert('This map has no geographical coordinates in its link. Just zoom or drag the map, afterwards this will work fine.');"; code += " }"; code += "}"; injectPageScript(code, "body"); var div = document.createElement("div"); div.id = "gclh_map_links"; div.setAttribute("style", "display: inline-block;"); if (settings_add_link_new_gc_map_on_google_maps) { div.innerHTML += '' + search_map_icon + ''; } if (settings_add_link_gc_map_on_google_maps) { div.innerHTML += '' + browse_map_icon + ''; } var side = document.getElementById("gbwa"); side.parentNode.insertBefore(div, side); var css = ''; css += '#gclh_map_links {margin-right: -11px;}'; css += '#gclh_map_links a {margin-left: 8px;}'; css += '#gclh_map_links svg {width: 25px; height: 25px; vertical-align: middle; color: black; opacity: 0.55;}'; css += '#gclh_map_links svg:hover {opacity: 0.85;}'; css += '.search_map_icon {height: 20px !important;}'; css += '.gb_nd {padding-left: 4px;}'; appendCssStyle(css); } else {waitCount++; if (waitCount <= 50) setTimeout(function(){addGcButton(waitCount);}, 200);} } addGcButton(0); } // Hide left sidebar on Google Maps. if (settings_hide_left_sidebar_on_google_maps) { function hideLeftSidebar(waitCount) { if ($('#gbwa')[0] && $('.widget-pane-toggle-button')[0] && $('.widget-pane')[0]) { if (!$('.widget-pane')[0].className.match("widget-pane-collapsed")) $('.widget-pane-toggle-button')[0].click(); } else {waitCount++; if (waitCount <= 60) setTimeout(function(){hideLeftSidebar(waitCount);}, 250);} } hideLeftSidebar(0); } } catch(e) {gclh_error("mainGMaps",e);} }; //////////////////////////////// // 3. Project GC ($$cap) // 3.1 Project GC - Main ($$cap) //////////////////////////////// var mainPGC = function() { try { // Tables with PQ definitions are available. if ($('.row table').length > 0 && settings_show_create_pq_from_pq_splitter) { // No errors available for month name related functions. global_error = false; // Get user language of the page. var lang = getLanguage(); // Build output boxes for both tables with the PQ definitions. $('.row table').each(function(table_index) { buildOutputBox(this, table_index); }); // Build css. buildCss(); } } catch(e) {gclh_error("mainPGC",e);} ///////////////////////////////////// // 3.2 Project GC - Functions ($$cap) ///////////////////////////////////// // Build output box. function buildOutputBox(side, table_index) { var html = ''; html += ''; html += '

Create PQ(s) on geocaching.com'; html += '0 | 0 | 0

'; var error_text = checkSelectErrorAvailable(); if (error_text != '') { html += '
Error:
'; html += '

' + error_text + '

'; html += ''; $(side).append(html); } else { html += '

PQ name (prefix): '; html += ' '; html += '

'; html += '
Configuration:
'; html += '

Choose how often your PQ(s) should run:
'; html += '
'; html += '
'; html += '

'; html += '

Output to email:
'; html += 'The secondary email will only work if you have two or more email addresses in your profile.

'; html += '
Instruction:
'; html += '

If you click the "Create PQ(s)" button, the GC little helper II will open as many pop-ups as PQs should be created. The number of simultaneously loaded pop-ups is limited to 5. All PQs will get the name that you entered in the field above and an ongoing digit prefix. The pop-ups close by themselves after the associated PQ has been created. We will display a message if all PQs are created. Please wait until all pop-ups are loaded.

'; html += '

Please make sure you do not have a pop-up blocker enabled. Otherwise this feature will not work as expected.

'; html += ''; $(side).append(html); $(side).find('.pq_name')[0].addEventListener("change", function() { if ($(this)[0].value != '') setValue('settings_pq_splitter_pqname', $(this)[0].value); }); $(side).find('.button_create_pq')[0].addEventListener("click", prepareCreatePQ, false); $(side).find('#how_often_' + table_index + '_' + settings_pq_splitter_how_often).attr('checked', true); $(side).find('.how_often').each(function() { $(this)[0].addEventListener("click", function() { setValue('settings_pq_splitter_how_often', $(this).attr('index')); }); }); $(side).find('.output_email')[0].value = settings_pq_splitter_email; $(side).find('.output_email')[0].addEventListener("change", function() { setValue('settings_pq_splitter_email', $(this)[0].value); }); } } // Build css. function buildCss() { var css = ''; css += 'tfoot {background-color: #d4edda;}'; css += 'tfoot h4 > span {font-size: 14px; font-weight: normal; float: right; margin-top: 2px;}'; css += 'tfoot h5 {margin-top: 18px;}'; css += 'tfoot label {padding-left: 4px; margin-bottom: 0px; font-weight: normal;}'; css += 'tfoot h4, tfoot h5, tfoot p {margin-left: 9px; margin-right: 9px;}'; css += '.working {opacity: 0.6;}'; css += '.gclh_counter.gclh_running {display: block;}'; css += '.gclh_counter {display: none; cursor: default;}'; appendCssStyle(css); } // Prepare create PQ(s). function prepareCreatePQ() { var urls_for_pqs_to_create = []; var current_table = $(this).closest('table'); // Determine number of PQs and number of digits for the ongoing digit prefix. var nPQs = 0; $(current_table).find('tr').each(function() { if ($(this).context.rowIndex > 0 && $(this).children().eq(1).text() != "") { nPQs++; } }); var nDigits = parseInt((nPQs + '').length); // Build urls. $(current_table).find('tr').each(function() { if ($(this).context.rowIndex > 0 && $(this).children().eq(1).text() != "") { var [start_month, start_day, start_year] = getDateParts($(this).children().eq(1).text()); var [end_month, end_day, end_year] = getDateParts($(this).children().eq(2).text()); var cache_count = parseInt($(current_table).find('.pq_name').attr('cache_count')); var pq_name = $(current_table).find('.pq_name').val() + $(this).context.rowIndex.toString(10).padStart(nDigits, '0'); var how_often = $(current_table).find('.how_often:checked').attr('index'); var email = $(current_table).find('.output_email').val(); var param = {PQSplit: 1, n: pq_name, c: cache_count, ho: how_often, e: email, sm: start_month, sd: start_day, sy: start_year, em: end_month, ed: end_day, ey: end_year}; var sel = getSelection(); var new_url = "https://www.geocaching.com/pocket/gcquery.aspx?" + $.param(param) + '&' + $.param(sel); urls_for_pqs_to_create.push(new_url); } }); // Process error or rather create PQs. if (checkEndErrorAvailable(urls_for_pqs_to_create)) { setRunSettings(false); return false; } else { setRunSettings(true); $(current_table).find('.gclh_counter_total')[0].innerHTML = urls_for_pqs_to_create.length; $(current_table).find('.gclh_counter').addClass('gclh_running'); create_pqs(urls_for_pqs_to_create, true); } } // Check whether select errors are available. function checkSelectErrorAvailable() { // There are restrictions for difficulty and terrain. Not all combinations can be specified on the PQ page. function checkDT(name) { var error = ''; var n = 0; var first = false; var last = false; var next = ''; var all = ''; $('#' + name + 'select option[selected=""]').each(function() { var content = $(this).val(); if (!first || content < first) first = content; if (!last || content > last) last = content; if (next == '' || next == parseInt(content.replace(/(\.|,)/, ''))) { next = parseInt(content.replace(/(\.|,)/, '')) + 5; } else if (!next) { } else { next = false; } all += (n == 0 ? '' : '/') + content; n++; }); if (n <= 1 || (n > 1 && first == '1.0' && next) || (n > 1 && last == '5.0' && next)) { } else { error = "Your " + name + " specifications " + all + " can not be specified on the PQ page.
"; } return error; } return checkDT('difficulty') + checkDT('terrain'); } // Get selection parameter. function getSelection() { var sel = new Object(); $('#filtertoggle2div > div:not(.row) select, #filtertoggle2div > div:not(.row) input').each(function() { if ($(this).val() != null && $(this).val() != '') { var name = $(this).attr('name').replace(/(\[|\])/g, ''); if ($(this).attr('multiple')) { for (var i = 0; i < $(this).val().length; i++) { sel[name+"["+i+"]"] = $(this).val()[i]; } } else if ($(this)[0].id.match(/hidden_to(yyyy|mm|dd)/)) { sel[name] = $(this).val(); } else if ($(this)[0].type == 'checkbox' && $(this)[0].checked) { sel[name] = $(this).val(); } else if ($(this)[0].type == 'text' && $(this).val() != '') { sel[name] = $(this).val(); } } }); return sel; } // Create PQ(s). function create_pqs(urls_for_pqs_to_create, first_run) { // Cleanup last run, if there is one. if (first_run) { if (typeof global_open_popups !== 'undefined' && global_open_popups != null && Array.isArray(global_open_popups)) { for (var i = 0; i < global_open_popups.length; i++) { if (typeof global_open_popups[i] !== 'undefined' && global_open_popups[i] != null && global_open_popups[i] !== false) { global_open_popups[i].close(); } } } global_open_popups = new Array(urls_for_pqs_to_create.length); global_open_popup_count = 0; $('.gclh_running .gclh_counter_total').innerHTML = urls_for_pqs_to_create.length; } // Handle pop-ups. var already_done_count = 0; for (var i = 0; i < urls_for_pqs_to_create.length; i++) { if (urls_for_pqs_to_create[i] != '') { if (global_open_popup_count < 5) { global_open_popups[i] = window.open(urls_for_pqs_to_create[i], 'PQ_' + i, 'scrollbars=1, menubar=0, resizable=1, width=400, height=250, top=0, left=10000'); $('.gclh_running .gclh_counter_started').innerHTML = $('.gclh_running .gclh_counter_started').innerHTML + 1; // A pop-up could not be opened in browser, probably because of a pop-up blocker, so we'll stop here and inform the user. if (global_open_popups[i] == null) { setRunSettings(false); alert("A pop-up blocker was detected. Please allow pop-ups for this site, reload the page and try again. Please be aware, that the first two PQs should already be created. So please go to geocaching.com and delete them."); return false; } global_open_popup_count++; urls_for_pqs_to_create[i] = ''; $('.gclh_running .gclh_counter_started')[0].innerHTML = parseInt($('.gclh_running .gclh_counter_started')[0].innerHTML) + 1; } } else { already_done_count++; } if (typeof global_open_popups[i] !== 'undefined' && global_open_popups[i] !== false && global_open_popups[i].closed) { global_open_popup_count--; global_open_popups[i] = false; $('.gclh_running .gclh_counter_completed')[0].innerHTML = parseInt($('.gclh_running .gclh_counter_completed')[0].innerHTML) + 1; } } // Restart creating of PQs until everything is finished. if (already_done_count < urls_for_pqs_to_create.length || global_open_popup_count > 0) { setTimeout(function(){create_pqs(urls_for_pqs_to_create, false);}, 250); } else { setRunSettings(false); alert("The GC little helper II is done creating your " + already_done_count + " PQ(s)."); } } // Set or stop the running environment. function setRunSettings(set) { if (set) { $('.gclh_running').removeClass('gclh_running'); $('.gclh_counter span').each(function(){this.innerHTML = 0;}); $('.button_create_pq').prop("disabled", true); $('.button_create_pq').addClass('working'); } else { $('.button_create_pq').prop("disabled", false); $('.button_create_pq').removeClass('working'); } } // Check whether errors during the identification of the language related month names or the length of the URLs are available. function checkEndErrorAvailable(urls) { var err = ''; if (global_error) { err += "One or more of the determined, month name and language related, start and end dates are failed. Please select another language, such as English or German, at the top right of the page and try again.\n"; } for (var i = 0; i < urls.length; i++) { if (urls[i].length > 2000) { err += "One or more of the determined URLs to calling geocaching.com and creating PQ(s) are too long. You are using too many filters. Please reduce the filters and try again.\n"; break; } } if (err != '') { alert(err); return true; } else return false; } // Get user language of the page. function getLanguage() { if ($('ul.navbar-right .drowdown-toggle img[src*="country_flags"]')[0]) { var match = $('ul.navbar-right .drowdown-toggle img[src*="country_flags"]')[0].src.match(/country_flags(2\/png|_manual)\/(.*)\./); if (match && match[1] && match[2]) { lang = match[2].replace(/catalonia/, 'es').toUpperCase(); if ($('#menu_locales a[href*="_' + lang + '"]')[0]) { var match = $('#menu_locales a[href*="_' + lang + '"]')[0].href.match(/#(.{2})/); if (match && match[1]) { return match[1]; } } } } return false; } // Break down the date string and return its components. function getDateParts(str) { if (str.indexOf("/") == -1) return ['', '', '']; var arr = str.split('/'); var m = convertMonthNameToNumber(lang, arr[0]); var d = parseInt(arr[1]); var y = parseInt(arr[2]); return [m, d, y]; } // Convert the name of a month with a given language to the month number. function convertMonthNameToNumber(lang, name) { var name_l = name.toLowerCase(); for (var nr = 1; nr <= 12; nr++) { var [month, month_l] = convertMonthNumberToName(lang, nr); if (name == month || name_l == month_l) return nr; } global_error = true; return false; } // Convert the number of a month to the month name with a given language. function convertMonthNumberToName(lang, nr) { if (new Intl.DateTimeFormat(lang, {month:'long'}).format(new Date(nr + '/1/2000'))) { var month = new Intl.DateTimeFormat(lang, {month:'long'}).format(new Date(nr + '/1/2000')); } else { var month = false; } var month_l = month.toLowerCase(); return [month, month_l]; } }; // End of mainPGC. /////////////////////////// // 4. Openstreetmap ($$cap) /////////////////////////// var mainOSM = function() { try { // Add link to GC Map on Openstreetmap. function addGCButton(waitCount) { if (document.location.href.match(/^https?:\/\/www\.openstreetmap\.org\/(.*)#map=/) && $(".control-key").length) { if (settings_add_link_new_gc_map_on_osm) { var code = '
' + search_map_icon + '
'; $(".control-share").after(code); } if (settings_add_link_gc_map_on_osm) { var code = '
' + browse_map_icon + '
'; $(".control-share").after(code); } $(".control-gc").click(function() { var matches = document.location.href.match(/=([0-9]+)\/(-?[0-9.]*)\/(-?[0-9.]*)/); if (matches != null) { if ($(this).find('.gc-map')[0]) { var url = map_url + '?lat=' + matches[2] + '&lng=' + matches[3] + '#?ll=' + matches[2] + ',' + matches[3] + '&z=' + matches[1]; if (settings_switch_from_osm_to_gc_map_in_same_tab) location = url; else window.open(url); } else { var url = new_map_url + '?lat=' + matches[2] + '&lng=' + matches[3] + '&zoom=' + matches[1]; if (settings_switch_from_osm_to_new_gc_map_in_same_tab) location = url; else window.open(url); } } else alert('This map has no geographical coordinates in its link. Just zoom or drag the map, afterwards this will work fine.'); }); var css = ''; css += '.control-gc svg {width: 25px; height: 25px; margin-left: 9px; margin-top: 8px; vertical-align: middle; color: white;}'; css += '#search_map_icon {margin-top: 11px;}'; appendCssStyle(css); } else {waitCount++; if (waitCount <= 50) setTimeout(function(){addGCButton(waitCount);}, 1000);} } addGCButton(0); } catch(e) {gclh_error("mainOSM",e);} }; //////////////////////////// // 5. GC ($$cap) (For the geocaching webpages.) // 5.1 GC - Main ($$cap) (For the geocaching webpages.) // 5.1.1 GC - Main 1 ($$cap) (For the geocaching webpages.) //////////////////////////// var mainGCWait = function() { tlc('START mainGCWait'); // Hide login procedures via Facebook, Google, Apple ... . if (settings_hide_facebook && (document.location.href.match(/\.com\/(account\/register|login|account\/login|account\/signin|account\/join)/))) { try { if ($('.btn.btn-facebook')[0]) $('.btn.btn-facebook')[0].style.display = "none"; if ($('.divider-flex')[0]) $('.divider-flex')[0].style.display = "none"; if ($('.divider')[0]) $('.divider')[0].style.display = "none"; if ($('.disclaimer')[0]) $('.disclaimer')[0].style.display = "none"; if ($('.login-with-facebook')[0]) $('.login-with-facebook')[0].style.display = "none"; if ($('.horizontal-rule')[0]) $('.horizontal-rule')[0].style.display = "none"; if ($('.oauth-providers-login')[0]) $('.oauth-providers-login')[0].style.display = "none"; } catch(e) {gclh_error("Hide Facebook",e);} } // Improve print page cache listing. tlc('START Improve print page'); if (document.location.href.match(/\.com\/seek\/cdpf\.aspx/)) { try { // Hide disclaimer. if (settings_hide_disclaimer) { var d = ($('.Note.Disclaimer')[0] || $('.DisclaimerWidget')[0] || $('.TermsWidget.no-print')[0]); if (d) d.remove(); } // Decrypt hints. if (settings_decrypt_hint) { if ($('#uxDecryptedHint')[0]) $('#uxDecryptedHint')[0].style.display = 'none'; if ($('#uxEncryptedHint')[0]) $('#uxEncryptedHint')[0].style.display = ''; if ($('.EncryptionKey')[0]) $('.EncryptionKey')[0].remove(); } // Show other coord formats. var box = document.getElementsByClassName("UTM Meta")[0]; var coords = document.getElementsByClassName("LatLong Meta")[0]; if (box && coords) { var match = coords.innerHTML.match(/((N|S) [0-9][0-9]. [0-9][0-9]\.[0-9][0-9][0-9] (E|W) [0-9][0-9][0-9]. [0-9][0-9]\.[0-9][0-9][0-9])/); if (match && match[1]) { coords = match[1]; otherFormats(box, coords, "
"); } } // Hide side rights. if ($('#Footer')[0]) $('#Footer')[0].remove(); // Display listing images in maximum available width for FF and chrome. Only for display, print was ok. appendCssStyle('.item-content img {max-width: -moz-available; max-width: -webkit-fill-available;}'); } catch(e) {gclh_error("Improve print page cache listing",e);} } // Set global user data and check if logged in. tlc('START waitingForUserData'); function waitingForUserData(waitCount) { if (typeof headerSettings !== 'undefined' && typeof headerSettings.username !== 'undefined' && headerSettings.username !== null) { tlc('Global user data headerSettings found'); if (typeof headerSettings.username !== 'undefined') global_me = headerSettings.username; if (typeof headerSettings.avatarUrl !== 'undefined') global_avatarUrl = headerSettings.avatarUrl; if (typeof headerSettings.locale !== 'undefined') global_locale = headerSettings.locale; if (typeof headerSettings.findCount !== 'undefined') global_findCount = headerSettings.findCount; if (typeof headerSettings.isBasic !== 'undefined') global_isBasic = headerSettings.isBasic; } if (typeof chromeSettings !== 'undefined' && typeof chromeSettings.username !== 'undefined' && chromeSettings.username !== null) { tlc('Global user data chromeSettings found'); if (typeof chromeSettings.username !== 'undefined') global_me = chromeSettings.username; if (typeof chromeSettings.avatarUrl !== 'undefined') global_avatarUrl = chromeSettings.avatarUrl; if (typeof chromeSettings.locale !== 'undefined') global_locale = chromeSettings.locale; if (typeof chromeSettings.findCount !== 'undefined') global_findCount = chromeSettings.findCount; if (typeof chromeSettings.isBasic !== 'undefined') global_isBasic = chromeSettings.isBasic; } if (typeof _gcUser !== 'undefined' && typeof _gcUser.username !== 'undefined' && _gcUser.username !== null) { tlc('Global user data _gcUser found'); if (typeof _gcUser.username !== 'undefined') global_me = _gcUser.username; if (typeof _gcUser.image !== 'undefined' && typeof _gcUser.image.imageUrl !== 'undefined') global_avatarUrl = _gcUser.image.imageUrl.replace(/\{0\}/,'avatar'); if (typeof _gcUser.locale !== 'undefined') global_locale = _gcUser.locale; if (typeof _gcUser.findCount !== 'undefined') global_findCount = _gcUser.findCount; if (typeof _gcUser.membershipLevel !== 'undefined' && _gcUser.membershipLevel == 1) global_isBasic = true; } if (global_me !== false && global_avatarUrl !== false && global_locale !== false && global_findCount !== false) { tlc('All global user data found'); tlc('- global_me: '+global_me+' / global_avatarUrl: '+global_avatarUrl); tlc('- global_findCount: '+global_findCount+' / global_locale: '+global_locale+' / global_isBasic: '+global_isBasic); mainGC(); } else { waitCount++; if (waitCount <= 200) {setTimeout(function(){waitingForUserData(waitCount);}, 50);} else { tlc('STOP not all global user data found'); tlc('- global_me: '+global_me+' / global_avatarUrl: '+global_avatarUrl); tlc('- global_findCount: '+global_findCount+' / global_locale: '+global_locale+' / global_isBasic: '+global_isBasic); } } } waitingForUserData(0); }; //////////////////////////// // 5.1.2 GC - Main 2 ($$cap) (For the geocaching webpages.) //////////////////////////// var mainGC = function() { tlc('START maingc'); // Part of core css of GS, Config and others. var css = main_css; // Css for config, sync ... coloring. css += create_coloring_css(); // Special css for searchmap. if (is_page('searchmap')) { css += 'gclh_nav .wrapper {z-index: 1006;} gclh_nav li input {height: unset !important;}'; css += '.profile-panel .li-user-toggle svg {height: 13px;}'; } appendCssStyle(css); // After change of a bookmark respectively a bookmark list go automatically from confirmation screen to bookmark list. tlc('START After change'); if (((settings_bm_changed_and_go && document.location.href.match(/\.com\/bookmarks\/mark\.aspx\?(guid=|ID=|view=legacy&guid=|view=legacy&ID=)/)) || (settings_bml_changed_and_go && document.location.href.match(/\.com\/bookmarks\/edit\.aspx/))) && $('#divContentMain')[0] && $('p.Success a[href*="/bookmarks/view.aspx?guid="]')[0]) { $('#divContentMain').css("visibility", "hidden"); document.location.href = $('p.Success a')[0].href; } // Set language to default language. tlc('START Set language'); try { var langu_string = langus_code[langus.indexOf(settings_default_langu)] + '-'; if (settings_set_default_langu && !global_locale.match(langu_string)) { function waitForLanguageSelector(waitCount) { if ($('.language-selector button')[0]) { $('.language-selector button')[0].click(); function waitForLanguagePopover(waitCount) { if ($('.language-popover button')[0]) { if ($('.language-popover button[data-lang*="'+langu_string+'"]')[0]) { $('.language-popover button[data-lang*="'+langu_string+'"]')[0].click(); } else { $('.language-selector button')[0].click(); } } else {waitCount++; if (waitCount <= 500) setTimeout(function(){waitForLanguagePopover(waitCount);}, 10);} window.scroll(0, 0); } waitForLanguagePopover(0); } else {waitCount++; if (waitCount <= 500) setTimeout(function(){waitForLanguageSelector(waitCount);}, 10);} } waitForLanguageSelector(0); } } catch(e) {gclh_error("Set language to default language",e);} // Faster loading trackables without images. tlc('START Faster loading'); if (settings_faster_profile_trackables && is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkCollectibles.Active')[0]) { try { $('table.Table tbody tr td a img').each(function() {this.src = "/images/icons/16/watch.png"; this.title = ""; this.style.paddingLeft = "15px";}); } catch(e) {gclh_error("Faster loading trackables without images",e);} } // Migration: Installationszähler. Migrationsaufgaben erledigen. tlc('START Migration'); var declaredVersion = getValue("declared_version"); if (declaredVersion != scriptVersion) { try { instCount(declaredVersion); migrationTasks(); } catch(e) {gclh_error("Migration",e);} } // Redirect to Map (von Search Liste direkt in Karte springen). tlc('START Redirect'); if (settings_redirect_to_map && document.location.href.match(/\.com\/seek\/nearest\.aspx\?/)) { if (!document.location.href.match(/&disable_redirect=/) && !document.location.href.match(/key=/) && !document.location.href.match(/ul=/) && $('#ctl00_ContentBody_LocationPanel1_lnkMapIt')[0]) { $('#ctl00_ContentBody_LocationPanel1_lnkMapIt')[0].click(); } } // F2, F4, F10 keys. tlc('START F-keys'); try { // F2 key. // (For F2 key in filter screens of Search Map and search page, see "prepareKeydownF2InFilterScreen".) if (settings_submit_log_button) { function setButtonDescInnerHTMLF2(waitCount, id) { if (document.getElementById(id) && document.getElementById(id).innerHTML && !document.getElementById(id).innerHTML.match(/(F2)/)) { document.getElementById(id).innerHTML += " (F2)"; } if (waitCount <= 20) setTimeout(function(){setButtonDescInnerHTMLF2(waitCount, id);}, 100); } // Log abschicken (Cache und TB). if (document.location.href.match(/\.com\/(seek|track)\/log\.aspx\?(id|wid|guid|ID|wp|LUID|PLogGuid|code)\=/)) var id = "ctl00_ContentBody_LogBookPanel1_btnSubmitLog"; // PQ speichern | "Bookmark Pocket Query", aus BM PQ erzeugen | PQ zu Routen. if (document.location.href.match(/\.com\/pocket\/(gcquery|bmquery|urquery)\.aspx/)) var id = "ctl00_ContentBody_btnSubmit"; // "Create a Bookmark" entry, "Edit a Bookmark" entry. if (document.location.href.match(/\.com\/bookmarks\/mark\.aspx/)) var id = "ctl00_ContentBody_Bookmark_btnCreate"; // "Create New Bookmark List", Edit a Bookmark list. if (document.location.href.match(/\.com\/bookmarks\/edit\.aspx/)) var id = "ctl00_ContentBody_BookmarkListEditControl1_btnSubmit"; // Hide cache process speichern. if (document.location.href.match(/\.com\/hide\//)) { if ($('#btnContinue')[0]) var id = "btnContinue"; else if ($('#ctl00_ContentBody_btnSaveAndPreview')[0]) var id = "ctl00_ContentBody_btnSaveAndPreview"; else if ($('#btnSubmit')[0]) var id = "btnSubmit"; else if ($('#btnNext')[0]) var id = "btnNext"; else if ($('#ctl00_ContentBody_btnSubmit')[0]) var id = "ctl00_ContentBody_btnSubmit"; else if ($('#ctl00_ContentBody_Attributes_btnUpdate')[0]) var id = "ctl00_ContentBody_Attributes_btnUpdate"; else if ($('#ctl00_ContentBody_WaypointEdit_uxSubmitIt')[0]) var id = "ctl00_ContentBody_WaypointEdit_uxSubmitIt"; } // "Save" personal cache note in cache listing. if (is_page("cache_listing") && $('.js-pcn-submit')[0]) { var id = "gclh_js-pcn-submit"; $('.js-pcn-submit')[0].id = id; setButtonDescInnerHTMLF2(0, id); } if (id && document.getElementById(id)) { function keydownF2(e) { if (!check_config_page() && $('#'+id)[0].offsetParent != null) { if (e.keyCode == 113 && noSpecialKey(e)) { document.getElementById(id).click(); } if (e.keyCode == 83 && e.ctrlKey == true && e.altKey == false && e.shiftKey == false) { e.preventDefault(); document.getElementById(id).click(); } } } document.getElementById(id).value += " (F2)"; window.addEventListener('keydown', keydownF2, true); } } // Aufruf Config per F4 Taste. Nur auf erlaubten Seiten. Nicht im Config. if (settings_f4_call_gclh_config && !check_config_page()) { function keydownF4(e) { if (e.keyCode == 115 && noSpecialKey(e) && !check_config_page()) { if (checkTaskAllowed('Config', false) == true) gclh_showConfig(); else document.location.href = defaultConfigLink; } } window.addEventListener('keydown', keydownF4, true); } // Aufruf Sync per F10 Taste. Nur auf erlaubten Seiten. Nicht im Sync. Nicht im Config Reset Modus. if (settings_f10_call_gclh_sync && !check_sync_page()) { function keydownF10(e) { if (e.keyCode == 121 && noSpecialKey(e) && !check_sync_page() && !global_mod_reset) { if (checkTaskAllowed('Sync', false) == true) gclh_showSync(); else document.location.href = defaultSyncLink; } } window.addEventListener('keydown', keydownF10, true); } } catch(e) {gclh_error("F2, F4, F10 keys",e);} // Wait for header and build up header. tlc('START buildUpHeader'); try { function buildUpHeader(waitCount) { if ($('#gc-header, #GCHeader')[0]) { tlc('Header found'); // Integrate old header. ($('#gc-header') || $('#GCHeader')).after(header_old); // Run header relevant features. tlc('START setUserParameter'); setUserParameter(); tlc('START setMessageIndicator'); setMessageIndicator(0); tlc('START setUpgradeButton'); setUpgradeButton(); tlc('START changeHeaderLayout'); changeHeaderLayout(); tlc('START newWidth'); newWidth(); tlc('START removeGCMenues'); removeGCMenues(); tlc('START linklistOnTop'); linklistOnTop(); tlc('START buildSpecialLinklistLinks'); buildSpecialLinklistLinks(); tlc('START setSpecialLinks'); setSpecialLinks(); tlc('START runAfterRedirect'); runAfterRedirect(); tlc('START showDraftIndicatorInHeader'); showDraftIndicatorInHeader(); // User profile menu bend into shape. tlc('START User profile'); $('#ctl00_uxLoginStatus_divSignedIn button.li-user-toggle')[0].addEventListener('click', function(){ $('#ctl00_uxLoginStatus_divSignedIn li.li-user:not(#pgc_gclh)').toggleClass('gclh_open'); }); // Disable user profile menu by clicking anywhere else. $(document).click(function(){ if (!$(this)[0].activeElement.className.match(/li-user-toggle/)) { $('#ctl00_uxLoginStatus_divSignedIn li.li-user').removeClass('gclh_open'); } }); tlc('START OK'); } else { waitCount++; if (waitCount <= 1000) {setTimeout(function(){buildUpHeader(waitCount);}, 10);} else {tlc('STOP No header found');} } } buildUpHeader(0); } catch(e) {gclh_error("Wait for header and build up header",e);} // Set user avatar, user and found count in new header. function setUserParameter() { if ($('#ctl00_uxLoginStatus_hlHeaderAvatar')[0]) $('#ctl00_uxLoginStatus_hlHeaderAvatar')[0].src = global_avatarUrl; if ($('.li-user-info .user-name')[0]) $('.li-user-info .user-name')[0].innerHTML = global_me; if ($('.li-user-info .cache-count')[0]) $('.li-user-info .cache-count')[0].innerHTML = global_findCount + ' Finds'; } // Set message center message indicator. function setMessageIndicator(waitCount) { if ($('.message-center i')[0] && $('.gclh_message-center')[0]) { $('.gclh_message-center svg').before(' '); } else {waitCount++; if (waitCount <= 20) setTimeout(function(){setMessageIndicator(waitCount);}, 500);} } // Set upgrade button. function setUpgradeButton() { if (global_isBasic && !settings_upgrade_button_header_remove) { $('.messagecenterheaderwidget.li-messages').before('
  • Upgrade
  • '); } } // Change Header layout. function changeHeaderLayout() { try { if (settings_change_header_layout) { if (isMemberInPmoCache()) { if ($('#ctl00_siteHeader')[0]) $('#ctl00_siteHeader')[0].remove(); return; } // Alle Seiten: Grundeinstellungen: // ---------- var css = ""; // Font-Size für Menüs, Font-Size für Untermenüs in Pixel. var font_size_menu = parseInt(settings_font_size_menu); if ((font_size_menu == 0) || (font_size_menu < 0) || (font_size_menu > 16)) font_size_menu = 16; var font_size_submenu = parseInt(settings_font_size_submenu); if ((font_size_submenu == 0) || (font_size_submenu < 0) || (font_size_submenu > 16)) font_size_submenu = 15; // Abstand zwischen Menüs, Abstand zwischen Untermenüs in Pixel. var distance_menu = parseInt(settings_distance_menu); if ((distance_menu < 0) || (distance_menu > 99)) distance_menu = (50 / 2); else distance_menu = (distance_menu / 2); if (settings_bookmarks_top_menu == false && settings_menu_show_separator == true) distance_menu = (distance_menu / 2); var distance_submenu = parseInt(settings_distance_submenu); if ((distance_submenu < 0) || (distance_submenu > 32)) distance_submenu = (8); // (8/2) else distance_submenu = (distance_submenu); // (.../2) // Font-Color in Menüs, Untermenüs. var font_color_menu = settings_font_color_menu; if (font_color_menu == "") font_color_menu = "93B516"; var font_color_submenu = settings_font_color_submenu; if (font_color_submenu == "") font_color_submenu = "93B516"; // Background color and cursor on submenu if hover. css += '.#sm a.noLink, .#sm li.noLink {opacity: 0.7;}'; css += '.#sm a.noLink:hover, .#sm li.noLink:hover {background-color: unset; cursor: default;}'; css += '.#sm a:hover, .#sm li:hover {background-color: #e8f6ef;}'; // Menüweite berechnen. var new_width = 950; var new_width_menu = 950; var new_width_menu_cut_old = 0; var new_padding_right = 0; if (getValue("settings_new_width") > 0) new_width = parseInt(getValue("settings_new_width")); new_padding_right = 261 - 14; if (settings_show_smaller_gc_link) { new_width_menu = new_width - 261 + 20 - 28; new_width_menu_cut_old = 28; } else { new_width_menu = new_width - 261 + 20 - 190; new_width_menu_cut_old = 190; } // Im neuen Dashboard Upgrade Erinnerung entfernen. $('.sidebar-upsell').remove(); // Icons aus Play Menü entfernen. $('.charcoal').remove(); $('.li-attention').removeClass('li-attention').addClass('li-attention_gclh'); css += // Schriftfarbe Menü. ".#m li a, .#m li a:link, .#m li a:visited, .#m li {color: #" + font_color_menu + " !important;}" + ".#m li a:hover, .#m li a:focus {color: #FFFFFF !important; outline: unset !important;}" + // Schriftfarbe Search Field. "#navi_search {color: #4a4a4a;} #navi_search:focus, #navi_search:focus-visible, #navi_search:active {outline: none; box-shadow: none;}" + // Submenü im Vordergrund. ".#m .#sm {z-index: 1001;}" + // Schriftfarbe Untermenü. ".#m .#sm li a, .#m .#sm li a:link, .#m .#sm li a:visited, .#m .#sm li {color: #" + font_color_submenu + " !important;}" + // Schriftgröße Menü. ".#m {font-size: 16px !important;}" + ".#m li, .#m li a, .#m li input {font-size: " + font_size_menu + "px !important;}" + // Abstände Menü. "ul.#m > li {margin-left: " + distance_menu + "px !important; margin-right: " + distance_menu + "px !important;} ul.#m li a {padding: .25em .25em .25em 0 !important;}" + // Schriftgröße Untermenü. ".#m ul.#sm, .#m ul.#sm li {font-size: 16px !important;}" + ".#m ul.#sm li a {font-size: " + font_size_submenu + "px !important;}" + // Abstände Untermenü und Seiten. "ul.#sm li a, ul.#sm li button {padding: " + (distance_submenu / 2) + "px 9px !important; margin: 0px !important;} .#sm a {line-height: unset;} .#m a {overflow: initial}" + "ul.#sm li {margin: -1px 9px 1px 9px;} ul.#sm li form {margin: 0px !important; padding: 0px !important}" + // Menühöhe. ".#m {height: 35px !important;}" + // Markierung eines neuen Untermenüs. "ul.#sm li span.flag-new {color: #3d76c5; margin-left: 16px;}" + // Verschieben Submenüs unterbinden. ".#m .#sm {margin-left: 0 !important}"; // Vertikales Menü ausrichten. if (settings_bookmarks_top_menu) { // Menüzeilenhöhe, Menü nicht flex. css += "ul.#m {line-height: 16px; display: block;}"; // Zwischen Menüname und Submenü keine Lücke lassen, sonst klappts nicht mit einfachem Aufklappen. css += ".#m li a, .#m li a:link, .#m li a:visited {margin-bottom: 13px;} .#m ul.#sm {margin-top: -6px;}"; // Horizontales Menü ausrichten. } else { // Menüzeilenhöhe. css += "ul.#m {line-height: 16px !important;}"; css += "ul.#m > li{margin-bottom: 2px;}"; // Zeilenabstand in Abhängigkeit von Anzahl Zeilen. if (settings_menu_number_of_lines == 2) css += "ul.#m li a {padding-top: 4px !important; padding-bottom: 4px !important;}"; else if (settings_menu_number_of_lines == 3) css += "ul.#m li a {padding-top: 1px !important; padding-bottom: 1px !important;}"; } // Message Center Icon entfernen. if (settings_remove_message_in_header) $('.messagecenterheaderwidget').remove(); // Geocaching Logo ersetzen, verschieben oder entfernen. if ($('.logo')[0]) { var side = $('.logo')[0]; changeGcLogo(side); } css += "#l {flex: unset; overflow: unset; margin-left: -32px} #newgclogo {width: 30px !important;}" + ".#m {width: " + new_width_menu + "px !important; margin-left: 6px !important;}" + "nav .wrapper, gclh_nav .wrapper {min-width: " + (new_width + 40) + "px !important; max-width: unset;}"; // Bereich links ausrichten in Abhängigkeit davon, ob Logo geändert wird und ob GC Tour im Einsatz ist. if (!settings_show_smaller_gc_link && !settings_gc_tour_is_working) css += "#l {margin-top: 0px; fill: #ffffff;}"; else if (!settings_show_smaller_gc_link && settings_gc_tour_is_working) css += "#l {margin-top: -47px; fill: #ffffff;}"; else if (settings_show_smaller_gc_link && !settings_gc_tour_is_working) css += "#l {margin-top: 6px; width: 30px;}"; else if (settings_show_smaller_gc_link && settings_gc_tour_is_working) css += "#l {margin-top: -41px; width: 30px;}"; // Account Settings, Message Center, Cache suchen, Cache verstecken, Geotours, Karten, account/dashboard und track: // ---------- if (is_page("settings") || is_page("messagecenter") || is_page("find_cache") || is_page("collection_1") || is_page("geotours") || is_page("map") || is_page("dashboard-section") || is_page("track")) { css += "nav .wrapper {padding-right: " + new_padding_right + "px !important; width: unset;}"; // Vertikales Menü ausrichten. if (settings_bookmarks_top_menu) { css += ".#m ul.#sm {margin-top: 0px; margin-left: 32px !important;} .#m .submenu::after {left: 4px; width: 26px;}"; // Menü, Searchfield ausrichten in Abhängigkeit von Schriftgröße. Menü nicht flex. if (settings_menu_float_right) { css += "ul.#m > li {margin-top: " + (3 + (16 - font_size_menu) / 2) + "px;}"; } else { if (is_page("map")) css += "ul.#m > li {margin-top: " + (3 + (16 - font_size_menu) / 2) + "px;}"; else css += "ul.#m > li {margin-top: " + (4 + (16 - font_size_menu) / 2) + "px;}"; } // Menü in Karte ausrichten. if (is_page("map") && !settings_menu_float_right) css += ".#m {height: unset !important;}"; if (is_page("map") && settings_menu_float_right) css += "#navi_search {margin: 0 !important;}"; } // Altes Seiten Design und restliche Seiten: // ---------- } else { if (settings_fixed_header_layout && !is_page("searchmap")) { css += "nav .wrapper, gclh_nav .wrapper {width: " + new_width + "px !important; padding-left: 50px; padding-right: 30px; min-width: unset}"; if (settings_remove_logo && settings_show_smaller_gc_link) css += ".#m {margin-left: -28px !important;}"; } // Vertikales Menü ausrichten. if (settings_bookmarks_top_menu) { if (is_page("cache_listing") && $('.ul__cache-details.unstyled')[0]) { css += ".#m ul.#sm {margin-top: -10px; margin-left: 32px !important;} .#m .submenu::after {left: 4px; width: 26px;}"; } else { css += ".#m ul.#sm {margin-top: 17px; margin-left: 32px !important;} .#m .submenu::after {left: 4px; width: 26px;}"; } // Zwischen Menüname und Submenü keine Lücke lassen, sonst klappt das nicht mit dem einfachen Aufklappen. css += ".#m > li .dropdown {padding-bottom: 14px !important;}"; // Menü, Searchfield ausrichten in Abhängigkeit von Schriftgröße. Menü nicht flex. if (settings_menu_float_right) { css += "ul.#m > li {margin-top: " + (7 + (16 - font_size_menu) / 2) + "px;}"; } else { css += "ul.#m > li {margin-top: " + (5 + (16 - font_size_menu) / 2) + "px;}"; } // Horizontales Menü ausrichten in Abhängigkeit von Anzahl Zeilen. } else { if (settings_menu_number_of_lines == 1) css += "ul.#m {top: 4px !important;}"; else if (settings_menu_number_of_lines == 2) css += "ul.#m {top: -8px !important;}"; else if (settings_menu_number_of_lines == 3) css += "ul.#m {top: -13px !important;}"; } } // Alle Seiten: Platzhalter umsetzen: // ---------- css = css.replace(/#m/gi, "menu").replace(/#sm/gi, "submenu").replace(/#l/gi, "nav .logo, gclh_nav .logo"); appendCssStyle(css); } } catch(e) {gclh_error("Change header layout",e);} } // GC Logo. function changeGcLogo(side) { if (settings_show_smaller_gc_link && side && side.children[0]) { side.children[0].remove(); if (!settings_remove_logo) { var gc_link = document.createElement("a"); var gc_img = document.createElement("img"); gc_img.setAttribute("style", "clip: unset; width: 35px; margin-top: -3px;"); gc_img.setAttribute("title", "Geocaching"); gc_img.setAttribute("id", "newgclogo"); gc_img.setAttribute("src", global_gc_icon2); gc_link.appendChild(gc_img); gc_link.setAttribute("href", "/"); side.appendChild(gc_link); } } } // New Width. (Menüweite wird bei Change Header Layout gesetzt.) function newWidth() { try { // Keine Anpassungen. if (is_page('lists') || is_page('searchmap') || is_page("messagecenter") || is_page("settings") || is_page("hide_cache") || is_page("collection_1") || is_page("find_cache") || is_page("geotours") || is_page("map") || is_page("dashboard-section") || is_page("track") || is_page("owner_dashboard") || is_page("promos")) return; if (getValue("settings_new_width") > 0) { var new_width = parseInt(getValue("settings_new_width")); var css = ""; // Header- und Fußbereich: css += "header, nav, footer {min-width: " + (new_width + 40) + "px !important;}"; css += "header .container, nav .container {max-width: unset;}"; // Keine weiteren Anpassungen. if (document.location.href.match(/\.com\/pocket\/gcquery\.aspx/) || // Pocket Query: Einstellungen zur Selektion document.location.href.match(/\.com\/pocket\/bmquery\.aspx/)); // Pocket Query aus Bockmarkliste: Einstellungen zur Selektion else { css += "#Content .container, #Content .span-24, .span-24 {width: " + new_width + "px;}"; css += ".CacheStarLabels.span-6 {width: " + ((new_width - 300 - 190 - 10 - 10) / 2) + "px !important;}"; css += ".span-6.right {width: " + ((new_width - 300 - 190 - 10 - 10) / 2) + "px !important;}"; css += ".span-8 {width: " + ((new_width - 330 - 10) / 2) + "px !important;}"; css += ".span-10 {width: " + ((new_width - 170) / 2) + "px !important;}"; css += ".span-15 {width: " + (new_width - 360) + "px !important;}"; css += ".span-16 {width: " + (new_width - 320 - 10) + "px !important;}"; css += ".span-17 {width: " + (new_width - 300) + "px !important;}"; css += ".span-19 {width: " + (new_width - 200) + "px !important;}"; css += ".span-20 {width: " + (new_width - 160) + "px;}"; css += ".LogDisplayRight {width: " + (new_width - 180) + "px !important;}"; css += "#log_tabs .LogDisplayRight {width: " + (new_width - 355) + "px !important;}"; css += "#uxBookmarkListName {width: " + (new_width - 470 - 5) + "px !important;}"; css += "table.TrackableItemLogTable div {width: " + (new_width - 160) + "px !important; max-width: unset;}"; css += ".UserSuppliedContent {max-width: unset;}"; // Besonderheiten: if (!is_page("cache_listing")) css += ".UserSuppliedContent {width: " + (new_width - 200) + "px;}"; if (is_page("publicProfile")) css += ".container .profile-panel {width: " + (new_width - 160) + "px;}"; if (is_page("cache_listing")) css += ".span-9 {width: " + (new_width - 300 - 270 - 13 - 13 - 10 - 6) + "px !important;}"; else if (document.location.href.match(/\.com\/my\/statistics\.aspx/) || (is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkStatistics.Active')[0])) { css += ".span-9 {width: " + ((new_width - 280) / 2) + "px !important; margin-right: 30px;} .last {margin-right: 0px;}"; css += ".StatsTable {width: " + (new_width - 250) + "px !important;}"; if (is_page("publicProfile")) { css += ".ProfileStats {overflow-x: hidden; width: " + (new_width - 210) + "px;}"; } else { css += ".ProfileStats {overflow-x: hidden; width: " + (new_width - 180) + "px;}"; } css += "#ctl00_ContentBody_ProfilePanel1_StatsChronologyControl1_FindsPerMonth, #ctl00_ContentBody_ProfilePanel1_StatsChronologyControl1_CumulativeFindsPerMonth, #CacheTypesFound, #ctl00_ContentBody_StatsChronologyControl1_FindsPerMonth, #ctl00_ContentBody_StatsChronologyControl1_CumulativeFindsPerMonth {margin-left: -15px;}"; css += "#ctl00_ContentBody_ProfilePanel1_StatsChronologyControl1_FindsPerMonth h3, #ctl00_ContentBody_ProfilePanel1_StatsChronologyControl1_CumulativeFindsPerMonth h3, #CacheTypesFound h3, #ctl00_ContentBody_StatsChronologyControl1_FindsPerMonth h3, #ctl00_ContentBody_StatsChronologyControl1_CumulativeFindsPerMonth h3 {margin-left: 15px;}"; } else if (is_page("publicProfile")) { if ($('#ctl00_ContentBody_ProfilePanel1_lnkCollectibles.Active')[0]) { css += ".span-9 {width: " + ((new_width - 250) / 2) + "px !important;} .prepend-1 {padding-left: 10px;}"; } else { css += ".span-9 {width: " + ((new_width - 250) / 2) + "px !important;}"; css += ".StatsTable {width: " + (new_width - 250 - 30) + "px !important;}"; } } } appendCssStyle(css); } } catch(e) {gclh_error("New width",e);} } // Remove GC Menüs. function removeGCMenues() { try { var m = $('ul.(Menu|menu) li a.dropdown'); for (var i = 0; i < m.length; i++) { if ((m[i].href.match(/\/play\/search/) && getValue('remove_navi_play')) || (m[i].href.match(/\/forums\/$/) && getValue('remove_navi_community')) || (m[i].href.match(/shop\.geocaching\.com/) && getValue('remove_navi_shop'))) { m[i].parentNode.remove(); } if (m[i].href.match(/\/play\/search/) || m[i].href.match(/\/forums\/$/) || m[i].href.match(/shop\.geocaching\.com/)) { m[i].href = '#'; } } } catch(e) {gclh_error("Remove GC Menüs",e);} } // Linklist on top. function linklistOnTop() { try { // Replace {me} and apostrophes in bookmarks. for (var i = 0; i < bookmarks.length; i++) { if (bookmarks[i]['href'].match('{me}') && global_me && global_me != "") { bookmarks[i]['href'] = bookmarks[i]['href'].replace('{me}', global_me); } } // Auch ohne Change Header Layout zwischen Menüname und Submenü keine Lücke lassen, sonst klappts nicht mit einfachem Aufklappen. if (!settings_change_header_layout) { if (is_page("map")) { appendCssStyle(".menu > li, .Menu > li {height: 100%; padding-top: 2.0em;} .submenu, .SubMenu {margin-top: 1.9em;}"); } else if (is_page("find_cache") || is_page("hide_cache") || is_page("collection_1") || is_page("geotours") || is_page("dashboard-section") || is_page("track")) { appendCssStyle(".menu > li, .Menu > li {height: 100%; padding-top: 2.1em;} .submenu, .SubMenu {margin-top: 2.0em;}"); } else { appendCssStyle(".menu > li, .Menu > li {height: 100%; padding-top: 2.0em;} .submenu, .SubMenu {margin-top: 2.0em;}"); } } if (settings_bookmarks_on_top && $('.Menu, .menu').length > 0) { var nav_list = $('.Menu, .menu')[0]; var menu = document.createElement("li"); var headline = document.createElement("a"); if (settings_bookmarks_top_menu || settings_change_header_layout == false) { // Navi vertikal headline.setAttribute("href", "#"); headline.setAttribute("class", "Dropdown dropdown"); headline.setAttribute("accesskey", "7"); headline.innerHTML = "Linklist"; menu.appendChild(headline); var submenu = document.createElement("ul"); $(submenu).addClass("SubMenu").addClass("submenu"); menu.appendChild(submenu); for (var i = 0; i < settings_bookmarks_list.length; i++) { var x = settings_bookmarks_list[i]; if (typeof(x) == "undefined" || x == "" || typeof(x) == "object") continue; var sublink = document.createElement("li"); var hyperlink = document.createElement("a"); for (attr in bookmarks[x]) { if (attr != "custom" && attr != "title") hyperlink.setAttribute(attr, bookmarks[x][attr]); } if (bookmarks[x]['href'].match(/^([#\s]*)$/)) { hyperlink.setAttribute('class', 'noLink'); sublink.setAttribute('class', 'noLink'); } hyperlink.appendChild(document.createTextNode(bookmarks[x]['title'])); sublink.appendChild(hyperlink); submenu.appendChild(sublink); } nav_list.appendChild(menu); } else { // Navi horizontal for (var i = 0; i < settings_bookmarks_list.length; i++) { var x = settings_bookmarks_list[i]; if (typeof(x) == "undefined" || x == "" || typeof(x) == "object") continue; var sublink = document.createElement("li"); var hyperlink = document.createElement("a"); for (attr in bookmarks[x]) { if (attr != "custom" && attr != "title") hyperlink.setAttribute(attr, bookmarks[x][attr]); } hyperlink.appendChild(document.createTextNode(bookmarks[x]['title'])); sublink.appendChild(hyperlink); nav_list.appendChild(sublink); } } // Search field. if (settings_bookmarks_search) { var code = "function gclh_search_logs(){"; code += " var search = document.getElementById('navi_search').value.trim();"; code += " if (search.match(/^(GC|TB|GT|PR|BM|GL)[A-Z0-9]{1,10}\\b/i)) document.location.href = 'https://coord.info/'+search;"; code += " else if (search.match(/^[A-Z0-9]{6}\\b$/i)) document.location.href = '/track/details.aspx?tracker='+search;"; code += " else document.location.href = '/seek/nearest.aspx?navi_search='+search;"; code += "}"; injectPageScript(code, "body"); var searchfield = "
  • "; $(".Menu, .menu").append(searchfield); } if (settings_menu_show_separator) { if (settings_bookmarks_top_menu || settings_change_header_layout == false); // Navi vertikal else { // Navi horizontal var menuChilds = $('ul.Menu, ul.menu')[0].children; for (var i = 1; i < menuChilds.length; i += 2) { var separator = document.createElement("li"); separator.appendChild(document.createTextNode("|")); menuChilds[i].parentNode.insertBefore(separator, menuChilds[i]); } } } // Vertikale Menüs rechts ausrichten. if (settings_bookmarks_top_menu && settings_menu_float_right && settings_change_header_layout) { if ($('ul.Menu, ul.menu')[0]) { var menu = $('ul.Menu, ul.menu')[0]; var menuChilds = $('ul.Menu, ul.menu')[0].children; for (var i = 0; i < menuChilds.length; i++) { var child = menu.removeChild(menu.children[menuChilds.length-1-i]); child.setAttribute("style", "float: right;"); menu.appendChild(child); } } } } // Hover für alle Dropdowns aufbauen, auch für die von GS. if ($('.Menu, .menu').length > 0) { buildHover(); } } catch(e) {gclh_error("Linklist on top",e);} } // Hover aufbauen. Muss nach Menüaufbau erfolgen. function buildHover() { $('ul.Menu, ul.menu').children().hover(function() { $(this).addClass('hover'); $(this).addClass('open'); $('ul:first', this).css('visibility', 'visible'); }, function() { $(this).removeClass('hover'); $(this).removeClass('open'); $('ul:first', this).css('visibility', 'hidden'); } ); } // Aufbau Links zum Aufruf von Config, Sync und Find Player aus Linklist (1. Schritt). function buildSpecialLinklistLinks() { try { // GClh Config, Sync und Find Player Aufrufe aus Linklist heraus. if (checkTaskAllowed('Config', false) == true && document.getElementsByName("lnk_gclhconfig")[0]) { document.getElementsByName("lnk_gclhconfig")[0].href = "#GClhShowConfig"; document.getElementsByName("lnk_gclhconfig")[0].addEventListener('click', gclh_showConfig, false); } if (checkTaskAllowed('Sync', false) == true && document.getElementsByName("lnk_gclhsync")[0]) { document.getElementsByName("lnk_gclhsync")[0].href = "#GClhShowSync"; document.getElementsByName("lnk_gclhsync")[0].addEventListener('click', gclh_showSync, false); } if (checkTaskAllowed("Find Player", false) == true && document.getElementsByName("lnk_findplayer")[0]) { document.getElementsByName("lnk_findplayer")[0].href = "#GClhShowFindPlayer"; document.getElementsByName("lnk_findplayer")[0].addEventListener('click', createFindPlayerForm, false); } } catch(e) {gclh_error("Aufbau Links zum Aufruf von Config, Sync und Find Player aus Linklist (1. Schritt)",e);} } // Special Links aus Linklist bzw. Default Links versorgen. function setSpecialLinks() { try { // Links zu Nearest Lists/Map in Linklist und Default Links setzen. if (getValue("home_lat", 0) != 0 && getValue("home_lng") != 0) { var link = "/seek/nearest.aspx?lat=" + (getValue("home_lat") / 10000000) + "&lng=" + (getValue("home_lng") / 10000000) + "&dist=25&disable_redirect="; setLnk("lnk_nearestlist", link); setLnk("lnk_nearestlist_profile", link); var link = map_url + "?lat=" + (getValue("home_lat") / 10000000) + "&lng=" + (getValue("home_lng") / 10000000); setLnk("lnk_nearestmap", link); setLnk("lnk_nearestmap_profile", link); var link = "/seek/nearest.aspx?lat=" + (getValue("home_lat") / 10000000) + "&lng=" + (getValue("home_lng") / 10000000) + "&dist=25&f=1&disable_redirect="; setLnk("lnk_nearestlist_wo", link); setLnk("lnk_nearestlist_wo_profile", link); } // Links zu den eigenen Trackables in Linklist und Default Links setzen. if (getValue("uid", "") != "") { var link = "/track/search.aspx?o=1&uid=" + getValue("uid"); setLnk("lnk_my_trackables", link); setLnk("lnk_my_trackables_profile", link); } } catch(e) {gclh_error("Special Links",e);} } function setLnk(lnk, link) { if (document.getElementsByName(lnk)[0]) document.getElementsByName(lnk)[0].href = link; if (document.getElementsByName(lnk)[1]) document.getElementsByName(lnk)[1].href = link; } // Run after redirect. function runAfterRedirect() { try { var splitter = document.location.href.split("#"); if (splitter && splitter[1] && splitter[1] == "gclhpb" && splitter[2] && splitter[2] != "") { var postbackValue = splitter[2]; // Adopt home coords in GClh. if (postbackValue == "errhomecoord") { var mess = "To use this link, the GC little helper II has to know your home coordinates. " + "Do you want to go to the special area and let GC little helper II save " + "your home coordinates automatically?\n\n" + "GC little helper II will save it automatically. You have nothing to do at the " + "following page \"Home Location\", except, to choose your link again.\n" + "(But, please wait until page \"Home Location\" is loading complete.)"; if (window.confirm(mess)) document.location.href = "/account/settings/homelocation"; else document.location.href = document.location.href.replace("?#"+splitter[1]+"#"+splitter[2]+"#", ""); // Adopt uid of own trackables in GClh. } else if (postbackValue == "errowntrackables") { var mess = "To use this link, GC little helper II has to know the identification of " + "your trackables. Do you want to go to your dashboard and " + "let GC little helper II save the identification (uid) automatically?\n\n" + "GC little helper II will save it automatically. You have nothing to do at the " + "following page \"Dashboard\", except, to choose your link again.\n" + "(But, please wait until page \"Dashboard\" is loading complete.)"; if (window.confirm(mess)) document.location.href = "/my/default.aspx"; else document.location.href = document.location.href.replace("?#"+splitter[1]+"#"+splitter[2], ""); } } } catch(e) {gclh_error("Run after redirect",e);} } // Show draft indicator in header. function showDraftIndicatorInHeader() { if (settings_show_draft_indicator) { try { $.get('https://www.geocaching.com/account/dashboard', null, function(text) { // Look for drafts in old layout. draft_list = $(text).find('#uxDraftLogs span'); if (draft_list != null) drafts = draft_list[0]; else drafts = false; if (!drafts) { // If not found, Look for drafts in new layout. draft_list = $(text).find("nav a[href='/my/fieldnotes.aspx']"); if (draft_list != null) drafts = draft_list[0]; else drafts = false; } if (drafts) { draft_count = parseInt(drafts.innerHTML.match(/\d+/)); if (Number.isInteger(draft_count) && draft_count > 0) { $('.li-user-info .user-avatar, .player-profile').prepend('' + draft_count + ''); } } }); } catch(e) {gclh_error("Show draft indicator in header",e);} } } // Collection of css for cache listings. if (is_page("cache_listing")) { var css = '' // Define class "working". css += ".working {opacity: 0.4; cursor: default !important; text-decoration: none !important;}"; // Display listing images not over the maximum available width for FF and chrome. css += ".UserSuppliedContent img {max-width: -moz-available; max-width: -webkit-fill-available;}"; appendCssStyle(css); } // Disabled and archived ... if (is_page("cache_listing")) { try { // Ist die letzte Meldung oberhalb des Cachenamens eine archiert oder locked Meldung, dann Cachename in rot. if (($('#ctl00_ContentBody_archivedMessage')[0] || $('#ctl00_ContentBody_lockedMessage')[0]) && $('#ctl00_ContentBody_CacheName')[0]) $('#ctl00_ContentBody_CacheName')[0].style.color = '#8C0B0B'; // Ist die letzte Meldung oberhalb des Cachenamens eine archiert, locked oder disabled Meldung, dann Cachename durchstreichen. if (settings_strike_archived && $('#ctl00_ContentBody_CacheName')[0] && ($('#ctl00_ContentBody_archivedMessage')[0] || $('#ctl00_ContentBody_disabledMessage')[0] || $('#ctl00_ContentBody_lockedMessage')[0])) { $('#ctl00_ContentBody_CacheName')[0].style.textDecoration = 'line-through'; } if ($('.more-cache-logs-link')[0] && $('.more-cache-logs-link')[0].href) $('.more-cache-logs-link')[0].href = "#logs_section"; if (settings_log_status_icon_visible && $('#activityBadge use')[0]) { $('#activityBadge use')[0].setAttribute('xlink:href', $('#activityBadge use')[0].getAttribute('xlink:href').replace('-disabled', '')); } if (settings_cache_type_icon_visible && $('#uxCacheImage use')[0]) { $('#uxCacheImage use')[0].setAttribute('xlink:href', $('#uxCacheImage use')[0].getAttribute('xlink:href').replace('-disabled', '')); } } catch(e) {gclh_error("Disabled and archived",e);} } // Improve calendar link in events. (Im Google Link den Cache Link von &location nach &details verschieben.) if (is_page("cache_listing") && document.getElementById("calLinks")) { try { function impCalLink(waitCount) { if ($('#calLinks').find('a[title*="Google"]')[0]) { var calL = $('#calLinks').find('a[title*="Google"]')[0]; if (calL && calL.href) calL.href = calL.href.replace(/&det(.*)&loc/, "&loc").replace(/%20\(http/, "&details=http").replace(/\)&spr/, "&spr"); } else {waitCount++; if (waitCount <= 20) setTimeout(function(){impCalLink(waitCount);}, 100);} } impCalLink(0); } catch(e) {gclh_error("Improve calendar link",e);} } // Show eventday beside date. if (settings_show_eventday && is_page("cache_listing") && $('#cacheDetails svg.cache-icon use')[0] && $('#cacheDetails svg.cache-icon use')[0].href.baseVal.match(/\/cache-types.svg\#icon-(6$|6-|453$|453-|13$|13-|7005$|7005-|3653$|3653-)/)) { // Event, MegaEvent, Cito, GigaEvent, CommunityCelebrationEvents try { var match = $('meta[name="og:description"]')[0].content.match(/([0-9]{2})\/([0-9]{2})\/([0-9]{4})/); if (match == null) { match = $('meta[name="description"]')[1].content.match(/([0-9]{2})\/([0-9]{2})\/([0-9]{4})/); } if (match != null) { var date = new Date(match[3], match[1]-1, match[2]); if (date != "Invalid Date") { var weekday = new Array(7); weekday[0] = "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; weekday[6] = "Saturday"; var name = " (" + weekday[date.getDay()] + ") "; var elem = document.createTextNode(name); var side = $('#ctl00_ContentBody_mcd2')[0]; side.insertBefore(elem, side.childNodes[1]); } } } catch(e) {gclh_error("Show eventday beside date",e);} } // Show real owner. if (is_page("cache_listing") && $('#ctl00_ContentBody_mcd1')) { try { var real_owner = get_real_owner(); var link_owner = $('#ctl00_ContentBody_mcd1 a[href*="/profile/?guid="], #ctl00_ContentBody_mcd1 a[href*="/p/?guid="]')[0]; if (link_owner && real_owner) { var pseudo = link_owner.innerText; link_owner.innerHTML = (settings_show_real_owner ? real_owner : pseudo); link_owner.title = (settings_show_real_owner ? pseudo : real_owner); } } catch(e) {gclh_error("Show real owner",e);} } // Hide disclaimer on cache listing. if (settings_hide_disclaimer && is_page("cache_listing")) { try { var d = ($('.Note.Disclaimer')[0] || $('.DisclaimerWidget')[0] || $('.TermsWidget.no-print')[0]); if (d) d.remove(); } catch(e) {gclh_error("Hide disclaimer",e);} } // Highlight related web page link. if (is_page("cache_listing") && $('#ctl00_ContentBody_uxCacheUrl')[0]) { try { var lnk = $('#ctl00_ContentBody_uxCacheUrl')[0]; var html = "
    Please note

    "+lnk.parentNode.innerHTML+"

    "; lnk.parentNode.innerHTML = html; } catch(e) {gclh_error("Highlight related web page link",e);} } // Show the latest logs symbols. if (is_page("cache_listing") && settings_show_latest_logs_symbols && settings_load_logs_with_gclh) { try { function showLatestLogsSymbols(waitCount) { var gcLogs = false; if (waitCount == 0) { var logs = $('#cache_logs_table tbody tr.log-row').clone(); // GC Logs if (logs.length >= settings_show_latest_logs_symbols_count) gcLogs = true; } if (!gcLogs) var logs = $('#cache_logs_table2 tbody tr.log-row'); // GClh Logs if (logs.length > 0) { var lateLogs = new Array(); for (var i = 0; i < logs.length; i++) { if (settings_show_latest_logs_symbols_count == i) break; var lateLog = new Object(); if (gcLogs) { // Using initial GCLogs, they look different. lateLog['user'] = $(logs[i]).find('a[href*="/profile/?guid="], a[href*="/p/?guid="]').text(); lateLog['id'] = $(logs[i]).attr('class').match(/l-\d+/)[0].substr(2); } else { lateLog['user'] = $(logs[i]).find('.logOwnerProfileName a[href*="/profile/?guid="], .logOwnerProfileName a[href*="/p/?guid="]').text(); lateLog['id'] = $(logs[i]).find('.logOwnerProfileName a[href*="/profile/?guid="], .logOwnerProfileName a[href*="/p/?guid="]').attr('id'); } lateLog['src'] = $(logs[i]).find('.LogType img[src*="/images/logtypes/"]').attr('src'); lateLog['type'] = $(logs[i]).find('.LogType img[src*="/images/logtypes/"]').attr('title'); lateLog['date'] = $(logs[i]).find('.LogDate').text(); if (gcLogs) lateLog['log'] = $(logs[i]).find('.LogText').children().clone(); else lateLog['log'] = $(logs[i]).find('.LogContent').children().clone(); lateLogs[i] = lateLog; } if (lateLogs.length > 0 && $('#ctl00_ContentBody_mcd1')[0].parentNode) { var div = document.createElement("div"); var divTitle = ""; div.id = "gclh_latest_logs"; div.appendChild(document.createTextNode("Latest logs:")); if (isEventInCacheListing() == true) { // Alte Events ohne Zeitangabe. if ($('#mcd4')[0] && $('#mcd4')[0].innerHTML.match(/^(\s*)$/)) { div.setAttribute("style", "float: right; padding-right: 0; padding-top: 0px; font-size: 12px"); } else { div.setAttribute("style", "float: right; padding-right: 0; padding-top: 0px; margin-top: -16px; font-size: 12px"); } var side = $('#ctl00_ContentBody_mcd1')[0].parentNode.parentNode; } else { div.setAttribute("style", "float: right; padding-right: 0; padding-top: 2px;"); var side = $('#ctl00_ContentBody_mcd1')[0].parentNode; side.style.display = "initial"; } for (var i = 0; i < lateLogs.length; i++) { var a = document.createElement("a"); a.className = "gclh_latest_log"; if (gcLogs) { a.href = "#"; a.style.cursor = "unset"; } else a.href = "#" + lateLogs[i]['id']; var img = document.createElement("img"); img.src = lateLogs[i]['src']; img.setAttribute("style", "padding-left: 2px; vertical-align: bottom; "); img.title = img.alt = ""; var log_text = document.createElement("span"); log_text.title = ""; log_text.innerHTML = " " + lateLogs[i]['user'] + " - " + lateLogs[i]['date'] + "
    "; a.appendChild(img); for (var j = 0; j < lateLogs[i]['log'].length; j++) { if (j == 0 && !gcLogs) continue; log_text.appendChild(lateLogs[i]['log'][j]); } a.appendChild(log_text); div.appendChild(a); divTitle += (divTitle == "" ? "" : "\n" ) + lateLogs[i]['type'] + " - " + lateLogs[i]['date'] + " - " + lateLogs[i]['user']; } div.title = divTitle; side.appendChild(div); if (getValue("settings_new_width") > 0) var new_width = parseInt(getValue("settings_new_width")) - 310 - 180; else var new_width = 950 - 310 - 180; var css = "a.gclh_latest_log:hover {position: relative;}" + "a.gclh_latest_log span {display: none; position: absolute; left: -" + new_width + "px; width: " + new_width + "px; padding: 5px; text-decoration:none; text-align:left; vertical-align:top; color: #000000;}" + "a.gclh_latest_log:hover span {font-size: 13px; display: block; top: 16px; border: 1px solid #8c9e65; background-color:#dfe1d2; z-index:10000;}"; appendCssStyle(css); // In den GC Logs ist die Id für die Logs immer die Gleiche ..., ja doch ..., is klar ne ..., GS halt. // Deshalb müssen die Ids der Latest logs nachträglich in den GClh Logs ermittelt werden. function corrLatestLogsIds(waitCount) { if ($('#cache_logs_table2 tbody tr.log-row').length > 0) { var logsIds = $('#cache_logs_table2 tbody tr.log-row .logOwnerProfileName a'); var latestLogsIds = $('#gclh_latest_logs .gclh_latest_log'); for (var i = 0; i < 10; i++) { if (!logsIds[i] || !latestLogsIds[i]) break; latestLogsIds[i].href = '#'+logsIds[i].id; latestLogsIds[i].style.cursor = "pointer"; } } else {waitCount++; if (waitCount <= 250) setTimeout(function(){corrLatestLogsIds(waitCount);}, 200);} } if (gcLogs) corrLatestLogsIds(0); } } else {waitCount++; if (waitCount <= 250) setTimeout(function(){showLatestLogsSymbols(waitCount);}, 200);} } showLatestLogsSymbols(0); } catch(e) {gclh_error("Show the latest logs symbols",e);} } // Show log totals symbols at the top of cache listing. if (is_page("cache_listing") && settings_show_log_totals && $('.LogTotals')[0] && $('#ctl00_ContentBody_size')[0]) { try { var div = document.createElement('div'); div.className = "gclh_LogTotals Clear"; var span = document.createElement('span'); span.innerHTML = $('.LogTotals')[0].outerHTML; div.appendChild(span); $('#ctl00_ContentBody_size')[0].parentNode.insertBefore(div, $('#ctl00_ContentBody_size')[0].nextSibling.nextSibling.nextSibling); appendCssStyle('.gclh_LogTotals {float: right;} .gclh_LogTotals img {vertical-align: bottom;} .LogTotals li + li {margin-left: 8px;} .LogTotals {margin-bottom: 0px;}'); } catch(e) {gclh_error("Show log totals symbols at the top",e);} } // Copy coordinates to clipboard. if (is_page("cache_listing") && $('#uxLatLon')[0]) { try { var cc2c = false; var span2 = document.createElement('span'); span2.innerHTML = ' '; var cc2c_pos = ($('#uxLatLonLink')[0] ? $('#uxLatLonLink')[0] : $('#uxLatLon')[0]) cc2c_pos.parentNode.insertBefore(span2, cc2c_pos); function copyCoordinatesToClipboard(waitCount) { if ( typeof unsafeWindow.mapLatLng !== "undefined" && unsafeWindow.mapLatLng !== null && (typeof unsafeWindow.mapLatLng.isUserDefined !== "undefined" || is_page("unpublished_cache")) ) { $('#gclh_cc2c').removeClass('working'); $('#gclh_cc2c')[0].setAttribute('title', (determineListingCoords('Corr') !== "" ? "Copy Corrected Coordinates to Clipboard" : "Copy Coordinates to Clipboard")); $('#gclh_cc2c')[0].addEventListener('click', function() { // Tastenkombination Strg+c ausführen für eigene Verarbeitung. cc2c = true; document.execCommand('copy'); }, false); document.addEventListener('copy', function(e){ // Normale Tastenkombination Strg+c für markierter Bereich hier nicht verarbeiten. Nur eigene Tastenkombination Strg+c hier verarbeiten. if (!cc2c) return; // Gegebenenfalls markierter Bereich wird hier nicht beachtet. e.preventDefault(); // Angezeigte Koordinaten werden hier verarbeitet. e.clipboardData.setData('text/plain', determineListingCoords('CorrOrg')); animateClick($('#gclh_cc2c')[0]); cc2c = false; }); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){copyCoordinatesToClipboard(waitCount);}, 100);} } copyCoordinatesToClipboard(0); } catch(e) {gclh_error("Copy coordinates to clipboard",e);} } // Copy GC Code to clipboard. if (is_page('cache_listing') && $('.CoordInfoLink')[0] && $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0]) { addCopyToClipboardLink($('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0], $('.CoordInfoLink')[0], "GC Code"); } // Show favorite percentage. if (settings_show_fav_percentage && is_page("cache_listing") && $('#uxFavContainerLink')[0]) { try { function gclh_load_score(waitCount) { if ($('.favorite-container')[0] && $('.favorite-dropdown')[0]) { var fav = $('.favorite-container')[0]; // Eigener Favoritenpunkt. Class hideMe -> kein Favoritenpunkt. Keine class hideMe -> Favoritenpunkt. var myfav = $('#pnlFavoriteCache')[0]; var myfavHTML = ""; if (myfav) { if (myfav.className.match("hideMe")) myfavHTML = ' '; else myfavHTML = ' '; } fav.getElementsByTagName('span')[0].nextSibling.remove(); fav.innerHTML += myfavHTML; var dd = $('.favorite-dropdown')[0]; dd.style.borderTop = "1px solid #f0edeb"; dd.style.borderTopLeftRadius = "5px"; dd.style.minWidth = "190px"; getFavoriteScore(userToken); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){gclh_load_score(waitCount);}, 100);} } gclh_load_score(0); } catch(e) {gclh_error("Show favorite percentage",e);} } // Get favorite score. function getFavoriteScore(userToken) { $.ajax({ type: "POST", cache: false, url: '/datastore/favorites.svc/score?u=' + userToken, success: function (scoreResult) { var score = 0; if (scoreResult) score = scoreResult; if (score > 100) score = 100; if ($('.favorite-value')[0]) $('.favorite-value').after(''+score+"%"+''); } }); } // Highlight usercoords. Improve screen "Enter solved coordinates" (only in english). if (is_page("cache_listing")) { try { var css = (settings_highlight_usercoords ? ".myLatLon {color: #FF0000; " : ".myLatLon {color: unset; ") + (settings_highlight_usercoords_bb ? "border-bottom: 2px solid #999; " : "border-bottom: unset; ") + (settings_highlight_usercoords_it ? "font-style: italic;}" : "font-style: unset;}"); if ($('#tmpl_CacheCoordinateUpdate')[0] && $('#tmpl_CacheCoordinateUpdate')[0].innerHTML.match(/Enter solved coordinates/)) { css += '#coordinateParse dl dd {padding-bottom: 7px;}'; css += '#newCoordinates {width: unset; padding: 6px 6px; margin-top: -7px; margin-bottom: 0px;}'; css += '#updatedCoords {font-style: normal;}'; $('#tmpl_CacheCoordinateUpdate')[0].innerHTML = $('#tmpl_CacheCoordinateUpdate')[0].innerHTML.replace('size="35"', 'size="30"'); } appendCssStyle(css); } catch(e) {gclh_error("Highlight usercoords",e);} } // Show other coord formats cache listing. if (is_page("cache_listing") && $('#uxLatLon')[0]) { try { var box = $('#ctl00_ContentBody_LocationSubPanel')[0]; box.innerHTML = box.innerHTML.replace("
    ", ""); var coords = $('#uxLatLon')[0].innerHTML; otherFormats(box, coords, " - "); box.innerHTML = "" + box.innerHTML + "
    "; } catch(e) {gclh_error("Show other coord formats listing",e);} } // Map this Location. if (is_page("cache_listing") && settings_show_link_to_browse_map && $('#uxLatLon')[0]) { try { var coords = toDec($('#uxLatLon')[0].innerHTML); var link = $('#uxLatLon').parents(".NoBottomSpacing"); var small = document.createElement("small"); small.innerHTML = 'Map this Location'; link.append(small); } catch(e) {gclh_error("Map this Location",e);} } // Prevent popup when clicking on "Watch" or "Stop Watching". if (is_page("cache_listing") && settings_prevent_watchclick_popup) { appendCssStyle('.qtip.qtip-light.qtip-pos-rc:not(.qtip-shadow):not(.pop-modal) {display: none !important;}'); } // Improve Ignore, Stop Ignoring button handling. if (is_page("cache_listing") && (settings_show_remove_ignoring_link && settings_use_one_click_ignoring)) { appendCssStyle("#ignoreSaved {display: none; color: #E0B70A; float: right; padding-left: 0px;}"); } if (is_page("cache_listing") && settings_show_remove_ignoring_link && $('#ctl00_ContentBody_GeoNav_uxIgnoreBtn')[0]) { try { // Set Ignore. changeIgnoreButton('Ignore'); // Prepare one click Ignore, Stop Ignoring. if (settings_use_one_click_ignoring) { var link = '#ctl00_ContentBody_GeoNav_uxIgnoreBtn a'; $(link).attr('data-url', $(link)[0].href); $(link)[0].href = 'javascript:void(0);'; $(link)[0].addEventListener("click", oneClickIgnoring, false); changeIgnoreButton('Ignore'); var saved = document.createElement('span'); saved.setAttribute('id', 'ignoreSaved'); saved.appendChild(document.createTextNode('saved')); $('#ctl00_ContentBody_GeoNav_uxIgnoreBtn')[0].append(saved); } // Set Stop Ignoring. var bmLs = $('.BookmarkList').last().find('li a[href*="/bookmarks/view.aspx?guid="], li a[href*="/profile/?guid="], li a[href*="/p/?guid="]'); for (var i=0; (i+1) < bmLs.length; i=i+2) { if (bmLs[i].innerHTML.match(/^Ignore List$/) && bmLs[i+1] && bmLs[i+1].innerHTML == global_me) { changeIgnoreButton('Stop Ignoring'); break; } } } catch(e) {gclh_error("Improve Ignore, Stop Ignoring button handling",e);} } function oneClickIgnoring() { var link = '#ctl00_ContentBody_GeoNav_uxIgnoreBtn a'; if ($(link+'.working')[0]) return; $(link).addClass('working'); var url = $(link)[0].getAttribute('data-url'); GM_xmlhttpRequest({ method: 'GET', url: url, onload: function(response) { var viewstate = encodeURIComponent(response.responseText.match(/id="__VIEWSTATE" value="([0-9a-zA-Z+-\/=]*)"/)[1]); var viewstategenerator = (response.responseText.match(/id="__VIEWSTATEGENERATOR" value="([0-9A-Z]*)"/))[1]; var postData = '__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=' + viewstate + '&__VIEWSTATEGENERATOR=' + viewstategenerator + '&navi_search=&ctl00%24ContentBody%24btnYes=Yes.+Ignore+it.'; GM_xmlhttpRequest({ method: 'POST', url: url, data: postData, headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': url }, onload: function(response) { if (response.responseText.indexOf('

    ') !== -1) { // If cache was just ignored, set button to stop ignoring. if (response.responseText.indexOf('') !== -1) { changeIgnoreButton('Stop Ignoring', 'saved'); // If cache was just restored, set button to ignore. } else { changeIgnoreButton('Ignore', 'saved'); } } $(link).removeClass('working'); }, onerror: function(response) {$(link).removeClass('working');}, ontimeout: function(response) {$(link).removeClass('working');}, onabort: function(response) {$(link).removeClass('working');} }); } }); } function changeIgnoreButton(buttonSetTo, saved) { var link = '#ctl00_ContentBody_GeoNav_uxIgnoreBtn a'; if (saved && saved == 'saved') { $('#ignoreSaved')[0].style.display = 'inline'; $('#ignoreSaved').fadeOut(2000, 'swing'); } $(link)[0].innerHTML = buttonSetTo; $(link)[0].style.backgroundImage = (buttonSetTo == 'Ignore' ? 'url(/images/icons/16/ignore.png)' : 'url('+global_stop_ignore_icon+')'); } // Improve Add to list in cache listing. if (is_page("cache_listing") && settings_improve_add_to_list && $('.add-to-list')[0]) { try { var height = ((parseInt(settings_improve_add_to_list_height) < 100) ? parseInt(100) : parseInt(settings_improve_add_to_list_height)); var css = ".add-list {max-height: " + height + "px !important;}" + ".add-list li {padding: 2px 0 !important;}" + ".add-list li button {font-size: 14px !important; margin: 0 !important; height: 18px !important;}" + ".status {font-size: 14px !important; width: unset !important;}" + ".status.success, .success-message {right: 2px !important; padding: 0 5px !important; background-color: white !important; color: #E0B70A !important;}" + ".CacheDetailNavigation .add_to_list_count {padding-left: 4px; color: inherit;}"; // Ugly display in Add to List Popup (GS bug since weeks). css += "#newListName {height: 42px;} .add-list-submit {display: inline-block;}"; appendCssStyle(css); $('.add-to-list').addClass('working'); function check_for_add_to_list(waitCount) { if ( typeof $('#fancybox-loading')[0] !== "undefined") { $('.add-to-list').removeClass('working'); $('.add-to-list')[0].addEventListener("click", function() { window.scroll(0, 0); setFocusToField(0, '#newListName'); }); $('.add-to-list')[0].innerHTML = '' + $('.add-to-list')[0].innerHTML + ''; if ($('.sidebar')[0] && $('#ctl00_ContentBody_GeoNav_uxAddToListBtn')[0]) { var [ownBMLsCount, ownBMLsText, ownBMLsList] = getOwnBMLs($('.sidebar')[0]); $('#ctl00_ContentBody_GeoNav_uxAddToListBtn a')[0].append($('(' + ownBMLsCount + ')')[0]); $('.add-to-list a')[0].setAttribute('title', ownBMLsText); $('.add_to_list_count')[0].setAttribute('title', ownBMLsList); } } else {waitCount++; if (waitCount <= 100) setTimeout(function(){check_for_add_to_list(waitCount);}, 100);} } check_for_add_to_list(0); } catch(e) {gclh_error("Improve Add to list",e);} } // Add link to waypoint list and cache logs to right sidebar. if (is_page("cache_listing") && $("#cache_logs_container")[0] && $(".InformationWidget")[0]) { try { if (getWaypointTable().length > 0) { $(".CacheDetailNavigation:first > ul:first").append('

  • Go to Waypoint List
  • '); } $(".InformationWidget").attr('id','logs_section'); $(".CacheDetailNavigation:first > ul:first").append('
  • Go to Logs
  • '); var css = ""; css += '.CacheDetailNavigation a[href*="#ctl00_ContentBody_bottomSection"]{background-image:url(/images/icons/16/waypoints.png);}'; css += '.CacheDetailNavigation a[href*="#logs_section"]{background-image:url(' + global_logs_icon + ');}'; appendCssStyle(css); } catch(e) {gclh_error("Add link to waypoint list and cache logs",e);} } // Button to copy data to clipboard at right sidebar. function create_copydata_menu() { var css = ""; css += ".copydata-content-layer.plus {"; css += " cursor: pointer;"; css += " padding: 0px;}"; css += ".copydata-content-layer.plus span {"; css += " color: black;"; css += " width: 154px;"; css += " text-decoration: none;"; css += " padding: 5px 8px;}"; css += ".copydata-content-layer.plus a {"; css += " padding: 5px 8px;}"; css += ".copydata-content-layer.plus img {"; css += " width: 16px;"; css += " height: 16px;"; css += " vertical-align: sub;}"; css += ".copydata-content-layer.plus:hover {"; css += " background-color: #f9f9f9;}"; css += ".copydata-content-layer.plus span:hover {"; css += " text-decoration: none;"; css += " background-color: #e1e1e1;}"; css += ".copydata-content-layer.plus a:hover {"; css += " background-color: #e1e1e1;}"; css += ".copydata-content-layer {"; css += " color: black;"; css += " padding: 5px 12px 5px 14px;"; css += " text-decoration: none;"; css += " display: block;}"; css += ".copydata-content-layer:hover {"; css += " background-color: #e1e1e1;"; css += " cursor: pointer;}"; css += ".copydata-sidebar-icon {"; css += " background-image: url(" + global_copy_icon + ")}"; appendCssStyle(css); var html = ""; html += '
    '; html += ' Copy Data to Clipboard'; html += '
    ' $('.CacheDetailNavigation ul').first().append('
  • '+html+'
  • '); check_for_copydata_menu(0); } function check_for_copydata_menu(waitCount) { if ( typeof unsafeWindow.mapLatLng !== "undefined" && unsafeWindow.mapLatLng !== null && (typeof unsafeWindow.mapLatLng.isUserDefined !== "undefined" || is_page("unpublished_cache") )) { $('.copydata_click').removeClass('working'); $('.copydata_head')[0].addEventListener('mouseover', create_copydata_menu_content); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){check_for_copydata_menu(waitCount);}, 100);} } function create_copydata_menu_content() { if ($('#CopyDropDown.hover')[0]) return; remove_copydata_menu_content(); var html = ""; html += '
    '; html += '
    {plus2}Cache Name{plus3}
    '; html = replacePlus(html); html += '
    {plus2}GC Code{plus3}
    '; html = replacePlus(html); html += '
    {plus2}Cache Link{plus3}
    '; html = replacePlus(html); if (determineListingCoords("Corr") !== "") { html += '
    {plus2}Corrected Coordinates{plus3}
    '; html = replacePlus(html); html += '
    {plus2}Original Coordinates{plus3}
    '; html = replacePlus(html); } else { html += '
    {plus2}Coordinates{plus3}
    '; html = replacePlus(html); } if (determineListingCoords("GCTour") !== "") { html += '
    {plus2}GCTour Coordinates{plus3}
    '; html = replacePlus(html); } if (settings_show_copydata_menu) { if (settings_show_copydata_own_stuff_show) { html += '
    {plus2}'+repApo(settings_show_copydata_own_stuff_name)+'{plus3}
    '; html = replacePlus(html); } for (var i in settings_show_copydata_own_stuff) { if (settings_show_copydata_own_stuff[i].show) { html += '
    {plus2}'+repApo(settings_show_copydata_own_stuff[i].name)+'{plus3}
    '; html = replacePlus(html); } } } html += '
    '; $('.copydata_click')[0].parentNode.innerHTML += html; $('#CopyDropDown').addClass('hover'); $('.copydata_head')[0].addEventListener('mouseleave', remove_copydata_menu_content); if (settings_show_copydata_plus) { $('.copydata_click span').click(function() { copydata_copy($(this).closest('div'), false); }); $('.copydata_click a').click(function() { copydata_copy($(this).closest('div'), true); }); } else { $('.copydata_click').click(function() { copydata_copy($(this)); }); } } function replacePlus(html) { var dataName = ""; if (html.match(/\{plus2\}(.*)\{plus3\}/)) { var dataNameTmp = html.match(/\{plus2\}(.*)\{plus3\}/); if (dataNameTmp && dataNameTmp[0] && dataNameTmp[1]) { dataName = dataNameTmp[1]; } } if (settings_show_copydata_plus) { html = html.replace(/\{plus0\}/, ' plus'); html = html.replace(/\{plus1\}/, ''); html = html.replace(/\{plus2\}/, ''); html = html.replace(/\{plus3\}/, ''); } else { html = html.replace(/\{plus0\}/, '').replace(/\{plus2\}/, '').replace(/\{plus3\}/, ''); html = html.replace(/\{plus1\}/, ' title="Clear Clipboard and copy \'' + dataName + '\' to Clipboard"'); } return html; } function remove_copydata_menu_content() { $('#CopyDropDown').remove(); } function copydata_copy(thisObject, plus) { const el = document.createElement('textarea'); if ($(thisObject).data('id') == idCopyName) { el.value = $('#ctl00_ContentBody_CacheName')[0].innerHTML.replace(new RegExp(' ', 'g'),' '); } else if ($(thisObject).data('id') == idCopyCode) { el.value = $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML; } else if ($(thisObject).data('id') == idCopyUrl) { el.value = "https://coord.info/"+$('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML; } else if ($(thisObject).data('id') == idCopyCorrCoords) { el.value = determineListingCoords('Corr'); } else if ($(thisObject).data('id') == idCopyOrgCoords) { el.value = determineListingCoords('Org'); } else if ($(thisObject).data('id') == idCopyGCTourCoords) { el.value = determineListingCoords('GCTour'); } else if ($(thisObject).data('id') == 'idOwnStuff') { if ($(thisObject).data('value')) { el.value = $(thisObject).data('value'); var [year, month, day] = determineCurrentDate(); el.value = el.value.replace(/#yyyy#/ig, year); el.value = el.value.replace(/#mm#/ig, month); el.value = el.value.replace(/#dd#/ig, day); var [aDate, aTime, aDateTime] = getDateTime(); el.value = el.value.replace(/#Date#/ig, aDate); el.value = el.value.replace(/#Time#/ig, aTime); el.value = el.value.replace(/#DateTime#/ig, aDateTime); var GCName = $('#ctl00_ContentBody_CacheName')[0].innerHTML.replace(new RegExp(' ', 'g'),' '); var GCCode = $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML; var GCLink = "https://coord.info/"+$('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML; el.value = el.value.replace(/#GCName#/ig, GCName); el.value = el.value.replace(/#GCCode#/ig, GCCode); el.value = el.value.replace(/#GCLink#/ig, GCLink); el.value = el.value.replace(/#GCNameLink#/ig, "[" + GCName + "](" + GCLink + ")"); el.value = el.value.replace(/#GCType#/ig, ($('.cacheImage')[0] ? $('.cacheImage').attr('title').replace(/(\sgeocache|\scache|-cache|\shybrid)/i,'') : '')) el.value = el.value.replace(/#Coords#/ig, determineListingCoords('CorrOrg')); el.value = el.value.replace(/#Elevation#/ig, ($('#elevation-waypoint-0 span')[0] ? $('#elevation-waypoint-0 span')[0].innerHTML : ($('#elevation-waypoint-0')[0] ? $('#elevation-waypoint-0')[0].innerHTML : ''))); el.value = el.value.replace(/#Founds#/ig, ($('#ctl00_ContentBody_lblFindCounts img[src*="/2.png"]')[0] ? parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/2.png"]')[0].nextSibling.data.replace(/(,|\.)/g,'')) : 0)); el.value = el.value.replace(/#Attended#/ig, ($('#ctl00_ContentBody_lblFindCounts img[src*="/10.png"]')[0] ? parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/10.png"]')[0].nextSibling.data.replace(/(,)/,'.')) : 0)); var foundsPlus = 0; if ($('#ctl00_ContentBody_lblFindCounts img[src*="/2.png"]')[0]) foundsPlus += parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/2.png"]')[0].nextSibling.data.replace(/(,|\.)/g,'')); if ($('#ctl00_ContentBody_lblFindCounts img[src*="/10.png"]')[0]) foundsPlus += parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/10.png"]')[0].nextSibling.data.replace(/(,|\.)/g,'')); if ($('#ctl00_ContentBody_lblFindCounts img[src*="/11.png"]')[0]) foundsPlus += parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/11.png"]')[0].nextSibling.data.replace(/(,|\.)/g,'')); el.value = el.value.replace(/#FoundsPlus#/ig, foundsPlus); el.value = el.value.replace(/#WillAttend#/ig, ($('#ctl00_ContentBody_lblFindCounts img[src*="/9.png"]')[0] ? parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/9.png"]')[0].nextSibling.data.replace(/(,|\.)/g,'')) : 0)); el.value = el.value.replace(/#DNFs#/ig, ($('#ctl00_ContentBody_lblFindCounts img[src*="/3.png"]')[0] ? parseInt($('#ctl00_ContentBody_lblFindCounts img[src*="/3.png"]')[0].nextSibling.data.replace(/(,|\.)/g,'')) : 0)); el.value = el.value.replace(/#Diff#/ig, $('#ctl00_ContentBody_uxLegendScale img').attr('src').match(/stars(\d|\d_\d).gif/)[1].replace('_','.')); el.value = el.value.replace(/#Terr#/ig, $('#ctl00_ContentBody_Localize12 img').attr('src').match(/stars(\d|\d_\d).gif/)[1].replace('_','.')); el.value = el.value.replace(/#Size#/ig, $('#ctl00_ContentBody_size .minorCacheDetails small')[0].innerHTML.replace('(','').replace(')','')); el.value = el.value.replace(/#Owner#/ig, get_real_owner().replace(/'/g,"\\'")); el.value = el.value.replace(/#Favo#/ig, (($('#uxFavContainerLink')[0] && $('#uxFavContainerLink .favorite-value')[0]) ? $('#uxFavContainerLink .favorite-value')[0].innerHTML.replace(/(\s*)/g,'') : '')); el.value = el.value.replace(/#FavoPerc#/ig, ($('.gclh_favorite-score')[0] ? $('.gclh_favorite-score')[0].innerHTML : '')); el.value = el.value.replace(/#Hints#/ig, (($('#div_hint')[0] && $('#div_hint')[0].innerHTML) ? $('#div_hint')[0].innerHTML.replace(/^(\s*)/,'').replace(/
    /g,'\n') : '')); el.value = el.value.replace(/#GCNote#/ig, $('#srOnlyCacheNote').html().replace(new RegExp('>', 'g'),'>').replace(new RegExp('<', 'g'),'<')); // Photo file name: Remove the impossible characters for the file name "<>/\|:*? if ($(thisObject)[0].innerHTML && $(thisObject)[0].innerHTML.match(/Photo file name/)) { el.value = el.value.replace(/(\/|\\|\||\*|\?|:|"|<|>)/g, ''); } } } else { el.value = ""; } var cb = document.createElement('textarea'); cb.value = GM_getValue('clipboard', ''); if (plus && cb.value !== '') { cb.value += settings_show_copydata_separator.replace(/‌/g, "") + el.value; } else { cb.value = el.value; } GM_setValue('clipboard', cb.value); document.body.appendChild(cb); cb.select(); document.execCommand('copy'); document.body.removeChild(cb); remove_copydata_menu_content(); } // Links BRouter, Flopps Map, GPSVisualizer and Openrouteservice at right sidebar. const LatLonDigits = 6; function mapservice_link( service_configuration ) { var uniqueServiceId = service_configuration.uniqueServiceId; var css = ""; css += "."+uniqueServiceId+"-content-layer {"; css += " color: black;"; css += " padding: 5px 16px 5px 16px;"; css += " text-decoration: none;"; css += " display: block;}"; css += "."+uniqueServiceId+"-content-layer:hover {"; css += " background-color: #e1e1e1;"; css += " cursor: pointer;}"; if ( service_configuration.sidebar.icon ) { css += "."+uniqueServiceId+"-sidebar-icon {"; css += " background-image: url(" + service_configuration.sidebar.icondata + ")}"; } if ( service_configuration.waypointtable.icon ) { css += "."+uniqueServiceId+"-waypointtable-icon {"; css += " background-image: url(" + service_configuration.waypointtable.icondata + ")}"; } css += ".noGClhdropbtn {"; css += " display: none !important;}"; appendCssStyle(css); var html = ""; html += '
    '; html += '{linkText}'; var nodropbtn = (service_configuration.defaultMap == "" ? "noGClhdropbtn" : ""); html += '
    '; for ( var layer in service_configuration.layers ) { html += '
    '+service_configuration.layers[layer].displayName+'
    '; } html += '
    '; html += '
    '; html = html.replace(/{uniqueServiceId}/g,uniqueServiceId); // Add map service link to the right sidebar. var htmlSidebar = html.replace('{linkText}', service_configuration.sidebar.linkText); htmlSidebar = htmlSidebar.replace('{customclasses}', ( service_configuration.sidebar.icon )?uniqueServiceId+'-sidebar-icon':''); $('.CacheDetailNavigation ul').first().append('
  • '+htmlSidebar+'
  • '); // Add map service link under waypoint table. var tbl = getWaypointTable(); if (tbl.length > 0) { var htmlWaypointTable = html.replace('{linkText}', service_configuration.waypointtable.linkText); htmlWaypointTable = htmlWaypointTable.replace('{customclasses}',( service_configuration.waypointtable.icon )?uniqueServiceId+'-waypointable-icon':''); tbl.next("p").append('
    '+htmlWaypointTable); } function check_wpdata_mapservice(waitCount, uniqueServiceId) { if (check_wpdata_evaluable()) { $('.mapservice_click-'+uniqueServiceId).removeClass('working'); $('.mapservice_click-'+uniqueServiceId).each(function(){ var parent = $(this)[0].parentNode; $(parent).find('.GClhdropdown-content').removeClass('working'); }); $('.mapservice_click-'+uniqueServiceId).click(function() { service_configuration.action( this, service_configuration ); }); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){check_wpdata_mapservice(waitCount, uniqueServiceId);}, 100);} } check_wpdata_mapservice(0, uniqueServiceId); } function mapservice_open( thisObject, service_configuration ) { var waypoints = queryListingWaypoints(true); if (service_configuration.useHomeCoords == true) { var homeCoords = { name: 'Home coordinates', gccode: $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML, prefix: "", source: "GClh II Config", typeid: '', latitude: (getValue("home_lat") / 10000000), longitude: (getValue("home_lng") / 10000000), prefixedName: $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML, }; waypoints.unshift(homeCoords); // Vorne anfügen. } if (!service_configuration.runWithOneWaypoint && waypoints.length == 1) { waypoints.push(waypoints[0]); } var map = $(thisObject).data('map'); var data = { urlTemplate: service_configuration.urlTemplate, map: map, maxZoomLevel: service_configuration.layers[map].maxZoom, waypoints: waypoints, waypointSeparator: service_configuration.waypointSeparator, waypointFunction: service_configuration.waypointFunction, context: service_configuration.context, mapOffset: service_configuration.mapOffset, useHomeCoords: service_configuration.useHomeCoords, runWithOneWaypoint: service_configuration.runWithOneWaypoint }; var url = data.urlTemplate; var waypointString = ""; var boundarybox = undefined; if ( data.context == undefined ) data.context = {}; if ( data.temp == undefined ) data.context.temp = {}; data.context.temp.count = 0; for (var i=0; i service_configuration.maxUrlLength ) { alert("Pay attention the URL is very long ("+url.length+" characters). Data loss is possible."); } window.open(url); } function BoundaryBox( boundarybox, latitude, longitude ) { boundarybox = boundarybox == undefined ? { Latmax : -90.0, Latmin : 90.0, Lonmax : -180.0, Lonmin : 180.0, center : { latitude : 0.0, longitude : 0.0 } } : boundarybox; boundarybox.Latmax = Math.max(boundarybox.Latmax, latitude); boundarybox.Latmin = Math.min(boundarybox.Latmin, latitude); boundarybox.Lonmax = Math.max(boundarybox.Lonmax, longitude); boundarybox.Lonmin = Math.min(boundarybox.Lonmin, longitude); boundarybox.center.latitude = ((boundarybox.Latmax+90.0)+(boundarybox.Latmin+90.0))/2-90.0; boundarybox.center.longitude = ((boundarybox.Lonmax+180.0)+(boundarybox.Lonmin+180.0))/2-180.0; return boundarybox; } function TileMapZoomLevelForBoundaryBox( boundarybox, widthOffset, heightOffset, maxZoom ) { var browserZoomLevel = window.devicePixelRatio; var mapWidth = Math.round(window.innerWidth*browserZoomLevel)+widthOffset; var mapHeigth = Math.round(window.innerHeight*browserZoomLevel)+heightOffset; var zoom=-1; for (zoom=23; zoom>=0; zoom--) { // Calculate tile boundary box. var tileY_min = lat2tile(boundarybox.Latmin,zoom); var tileY_max = lat2tile(boundarybox.Latmax,zoom); var tiles_Y = Math.abs(tileY_min-tileY_max+1); // boundary box heigth in number of tiles var tileX_min = long2tile(boundarybox.Lonmin,zoom); var tileX_max = long2tile(boundarybox.Lonmax,zoom); var tiles_X = Math.abs(tileX_max-tileX_min+1); // boundary box width in number of tiles // Calculate width and height of boundary rectangle (in pixel). var latDelta = Math.abs(tile2lat(tileY_max,zoom)-tile2lat(tileY_min+1,zoom)); var latPixelPerDegree = tiles_Y*256/latDelta; var boundaryHeight = latPixelPerDegree*Math.abs(boundarybox.Latmax-boundarybox.Latmin); var longDelta = Math.abs(tile2long(tileX_max+1,zoom)-tile2long(tileX_min,zoom)); var longPixelPerDegree = tiles_X*256/longDelta; var boundaryWidth = longPixelPerDegree*Math.abs(boundarybox.Lonmax-boundarybox.Lonmin); if ( ((boundaryHeight < mapHeigth) && (boundaryWidth < mapWidth)) && zoom<=maxZoom ) break; } return zoom; } function normalizeName( name ) {return name.replace(/[^a-zA-Z0-9_\-]/g,'_');} function floppsMapWaypoint(waypoint, name, radius, context) { var id = ""; if (waypoint.source == "waypoint") { id = String.fromCharCode(65+Math.floor(context.temp.count%26))+Math.floor(context.temp.count/26+1); // create Flopp's Map id: A1, B1, C1, ..., Z1, A2, B2, C3, .. } else if (waypoint.source == "original" ) { id = "O"; } else if (waypoint.source == "listing" ) { id = "L"; } return id+':'+roundTO(waypoint.latitude,LatLonDigits)+':'+roundTO(waypoint.longitude,LatLonDigits)+':'+radius+':'+name; } function gpsvisualizerWaypoint(waypoint, name, radius, context) { var symbol = ( settings_show_gpsvisualizer_gcsymbols && waypoint.typeid in urlPinIcons ) ? urlPinIcons[waypoint.typeid] : ""; var type = ( settings_show_gpsvisualizer_typedesc && waypoint.typeid in waypointNames ) ? waypointNames[waypoint.typeid] : ""; return name+","+roundTO(waypoint.latitude,LatLonDigits)+','+roundTO(waypoint.longitude,LatLonDigits)+','+radius+"m,"+type+","+symbol; } function brouterWaypoint(waypoint, name, radius, context) { var value = ""; if (waypoint.source == "waypoint" || waypoint.source == "listing") { value = roundTO(waypoint.longitude,LatLonDigits)+','+roundTO(waypoint.latitude,LatLonDigits); } else if (waypoint.source == "original" ) { value = ""; } return value; } function openrouteserviceWaypoint(waypoint, name, radius, context) { return roundTO(waypoint.latitude,LatLonDigits)+','+roundTO(waypoint.longitude,LatLonDigits); } // CSS for BRouter, Flopp's Map, GPSVisualizer, Openrouteservice and Copy Data links. if ((settings_show_brouter_link || settings_show_flopps_link || settings_show_gpsvisualizer_link || settings_show_openrouteservice_link || settings_show_copydata_menu) && is_page("cache_listing")) { css += ".GClhdropbtn {"; css += " white-space: nowrap;"; css += " cursor: pointer;}"; css += ".GClhdropdown {"; css += " position: relative;"; css += " display: inline-block;}"; css += ".GClhdropdown-content {"; css += " display: none;"; css += " position: absolute;"; css += " background-color: #f9f9f9;"; css += " min-width: 202px;"; css += " box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);"; css += " z-index: 1001;}"; css += ".GClhdropdown-content-info {"; css += " color: black;"; css += " background-color: #ffffa5;"; css += " padding: 5px 16px 5px 16px;"; css += " text-decoration: none;"; css += " display: none;}"; css += ".GClhdropdown-content-info:hover {"; css += " background-color: #ffffa5;"; css += " cursor: default;}"; css += ".GClhdropdown:hover .GClhdropdown-content.working {"; css += " display: none;}"; css += ".GClhdropdown:hover .GClhdropdown-content {"; css += " display: block;}"; appendCssStyle(css); // Show links which open Flopp's Map with all waypoints of a cache. if (settings_show_flopps_link) { try { mapservice_link( { uniqueServiceId: "flopps", urlTemplate: 'https://flopp.net/?c={center_latitude}:{center_longitude}&z={zoom}&t={map}&d=O:L&m={waypoints}', layers: {'OSM': { maxZoom: 18, displayName: 'Openstreetmap' }, 'OSM/DE': { maxZoom: 18, displayName: 'OSM German Style' }, 'TOPO': { maxZoom: 15, displayName: 'OpenTopMap' }, 'roadmap':{ maxZoom: 20, displayName: 'Google Maps' }, 'hybrid': { maxZoom: 20, displayName: 'Google Maps Hybrid' }, 'terrain':{ maxZoom: 20, displayName: 'Google Maps Terrain' }, 'satellite':{ maxZoom: 20, displayName: 'Google Maps Satellite' }}, waypointSeparator : '*', waypointFunction : floppsMapWaypoint, mapOffset : { width: -280, height: -50 }, defaultMap : 'OSM', sidebar : { linkText : "Show on Flopp\'s Map", icon : true, icondata : global_flopps_map_icon }, waypointtable : { linkText : "Show waypoints on Flopp\'s Map with …", icon : false }, maxUrlLength: 2000, action: mapservice_open, context : {}, useHomeCoords: false, runWithOneWaypoint: true }); } catch(e) {gclh_error("Show Flopp's Map links",e);} } // Show links which open BRouter with all waypoints of a cache. if (settings_show_brouter_link) { try { mapservice_link( { uniqueServiceId: "brouter", urlTemplate: 'https://brouter.de/brouter-web/#map={zoom}/{center_latitude}/{center_longitude}/{map}&lonlats={waypoints}', layers: {'OpenStreetMap': { maxZoom: 18, displayName: 'OpenStreetMap' }, 'OpenStreetMap.de': { maxZoom: 17, displayName: 'OSM German Style' }, 'OpenTopoMap': { maxZoom: 17, displayName: 'OpenTopoMap' }, 'Esri World Imagery': { maxZoom: 18, displayName: 'Esri World Imagery' }}, waypointSeparator : ';', waypointFunction : brouterWaypoint, mapOffset : { width: 0, height: 0 }, defaultMap : 'OpenStreetMap', sidebar : { linkText : "Show on BRouter", icon : true, icondata : global_brouter_icon }, waypointtable : { linkText : "Show route on BRouter with …", icon : false }, maxUrlLength: 4000, action: mapservice_open, context : {}, useHomeCoords: false, runWithOneWaypoint: true }); } catch(e) {gclh_error("Show button BRouter and open BRouter",e);} } // Show links which open GPSVisualizer with all waypoints of a cache. if (settings_show_gpsvisualizer_link) { try { mapservice_link( { uniqueServiceId: "gpsvisualizer", urlTemplate: 'https://www.gpsvisualizer.com/map_input?&width=1244&height=700&trk_list=0&wpt_list=desc_border&bg_map={map}&google_zoom_level=auto&google_street_view=1&google_wpt_labels=1&form:data=name,latitude,longitude,circle_radius,desc,symbol\n{waypoints}', layers: { 'google_map' : { displayName: 'Google street map', maxZoom: 20 }, 'google_satellite' : { displayName: 'Google satellite', maxZoom: 20 }, 'google_hybrid' : { displayName: 'Google hybrid', maxZoom: 20 }, 'google_physical' : { displayName: 'Google terrain', maxZoom: 20 }, 'google_openstreetmap' : { displayName: 'OpenStreetMap', maxZoom: 20 }, 'google_openstreetmap_tf' : { displayName: 'OSM ThunderForest', maxZoom: 20 }, 'google_openstreetmap_komoot' : { displayName: 'OSM Komoot', maxZoom: 20 }, 'google_opencyclemap' : { displayName: 'OpenCycleMap', maxZoom: 20 }, 'google_opentopomap' : { displayName: 'OpenTopoMap', maxZoom: 20 }, 'google_4umaps' : { displayName: 'World topo maps', maxZoom: 20 }}, waypointSeparator : '\n', waypointFunction : gpsvisualizerWaypoint, mapOffset : { width: 0, height: 0 }, defaultMap : 'google_map', sidebar : { linkText : "Show on GPSVisualizer", icon : true, icondata : global_gpsvisualizer_icon }, waypointtable : { linkText : "Show waypoints on GPSVisualizer with …", icon : false }, maxUrlLength: 4000, action: mapservice_open, context : {}, useHomeCoords: false, runWithOneWaypoint: true }); } catch(e) {gclh_error("Show button GPSVisualizer and open GPSVisualizer",e);} } // Show links which open Openrouteservice with all waypoints of a cache. if (settings_show_openrouteservice_link) { try { mapservice_link( { uniqueServiceId: "openrouteservice", urlTemplate: 'https://classic-maps.openrouteservice.org/directions?b='+settings_show_openrouteservice_medium+'&c=0&a={waypoints}', layers: {'': { maxZoom: '', displayName: ''}}, waypointSeparator: ',', waypointFunction: openrouteserviceWaypoint, mapOffset: {width: 0, height: 0}, defaultMap: '', sidebar: {linkText: "Show on Openrouteservice", icon: true, icondata: global_openrouteservice_icon}, waypointtable: {linkText: "Show route on Openrouteservice", icon: false}, maxUrlLength: 4000, action: mapservice_open, context: {}, useHomeCoords: settings_show_openrouteservice_home, runWithOneWaypoint: false }); } catch(e) {gclh_error("Show button Openrouteservice and open Openrouteservice",e);} } // Create 'Copy Data to Clipboard' menu. if (settings_show_copydata_menu) { try { create_copydata_menu(); } catch(e) {gclh_error("Create 'Copy Data to Clipboard' menu",e);} } } // Build map overview. if (settings_map_overview_build && is_page("cache_listing") && $('#ctl00_ContentBody_detailWidget')[0]) { try { leafletInit(); var css = ''; css += '.mapIcons {position: relative; z-index: 1000; margin-top: 10px; margin-right: 10px; float: right; height: 23px; border-radius: 4px; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65); background-color: #fff;}'; css += '.mapIcon {margin-top: 0px; margin-right: 0px; box-shadow: unset;}'; css += '.mapIconLeft {border-radius: 4px 0px 0px 4px;}'; css += '.mapIconRight {border-radius: 0px 4px 4px 0px; border-left: 1px solid #ccc;}'; css += '.mapIcon:hover {background-color: #f4f4f4;}'; css += '.mapIcons svg {width: 18px; height: 18px; color: #4a4a4a; opacity: 0.85; padding: 2px;}'; css += '.mapIconRight svg {padding: 3px;}'; css += '.search_map_icon {margin-left: 2px !important;}'; if (!settings_map_overview_search_map_icon) css += '.browse_map_icon {margin-top: 1px;}'; appendCssStyle(css); var html = ""; html += "
    "; html += "
    "; if (settings_map_overview_search_map_icon || settings_map_overview_browse_map_icon) { if (settings_map_overview_search_map_icon && settings_map_overview_browse_map_icon) var bothIcons = true; else var bothIcons = false; html += ""; if (settings_map_overview_browse_map_icon) { html += "" + browse_map_icon + ""; } if (settings_map_overview_search_map_icon) { html += "" + search_map_icon + ""; } html += "'>"; } html += "
    "; html += "
    "; $(".CacheDetailNavigation").after(html); $(".mapIcons svg").each(function(){$(this)[0].setAttribute("viewBox", "0 0 25 25");}); function build_map_overview(waitCount) { if (typeof lat !== "undefined" && typeof lng !== "undefined") { var previewMap = L.map('gclh_map_overview', { dragging: true, zoomControl: true, }).setView([lat, lng],settings_map_overview_zoom); var layer = ( settings_map_overview_layer == "" || settings_map_overview_layer == "Geocaching" ) ? all_map_layers['OpenStreetMap Default'] : all_map_layers[settings_map_overview_layer]; var layerObj = L.tileLayer( layer.tileUrl, layer ).addTo(previewMap); // Delayed load of GS map layer (we need an access token). if ( settings_map_overview_layer == "Geocaching" ) { gclh_GetGcAccessToken( function(r) { all_map_layers["Geocaching"].accessToken = r.access_token; var layer = all_map_layers['Geocaching']; L.tileLayer( layer.tileUrl, layer ).addTo(previewMap); previewMap.eachLayer(function (layer) { if ( layerObj == layer ) previewMap.removeLayer(layer); }); }); } // Make buttons of zoom control smaller only for overview map. $("#gclh_map_overview .leaflet-bar").attr("style","width: 20px; height: 41px; line-height: 40px;"); $("#gclh_map_overview .leaflet-control-zoom-in").attr("style","width: 20px; height: 20px; line-height: 20px; font-size: 11px; padding-right: 1px;"); $("#gclh_map_overview .leaflet-control-zoom-out").attr("style","width: 20px; height: 20px; line-height: 20px; font-size: 11px; padding-right: 1px;"); // Länge der Kartenbezeichnung ... begrenzen. $("#gclh_map_overview .leaflet-control-attribution").attr("style","max-width: 238px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"); function build_map_overview_marker(waitCount) { if (typeof unsafeWindow.mapLatLng !== "undefined" && unsafeWindow.mapLatLng !== null) { var marker = L.marker([lat, lng],{icon: L.icon({ iconUrl: 'https://www.geocaching.com/images/wpttypes/pins/' + unsafeWindow.mapLatLng.type + '.png', iconSize: [20, 23], iconAnchor: [10, 23], })}).addTo(previewMap); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){build_map_overview_marker(waitCount);}, 100);} } build_map_overview_marker(0); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){build_map_overview(waitCount);}, 100);} } build_map_overview(0); } catch(e) {gclh_error("Build map overview",e);} } // Personal cache note at cache listing. if (is_page("cache_listing")) { var css = ''; // Improve cursor when displaying or editing the personal cache note. It's upside down. css += '#viewCacheNote {cursor: pointer;} #cacheNoteText {cursor: text;}'; // Adapt height of edit field for personal cache note. $('h3.h4').append($('#pcn_help').remove().get().reverse()); css += '#viewCacheNote {text-decoration: none !important;}'; // Personal cache note: Adapt height of edit field for personal cache note. function calcHeightOfCacheNote() { return ($("#viewCacheNote").parent().height()*1.02+36 > settings_cache_notes_min_size ? $("#viewCacheNote").parent().height()*1.02+36 : settings_cache_notes_min_size); } if (settings_adapt_height_cache_notes) { try { var note = ($('.Note.PersonalCacheNote')[0] || $('.NotesWidget')[0]); if (note) $("#cacheNoteText").height(calcHeightOfCacheNote()); } catch(e) {gclh_error("Adapt size of edit field for personal cache note",e);} } // Change font to monospace. if (settings_change_font_cache_notes) $("#viewCacheNote, #cacheNoteText").css("font-family", "monospace"); // Hide complete and Show/Hide Cache Note. try { var note = ($('.Note.PersonalCacheNote')[0] || $('.NotesWidget')[0]); if (settings_hide_cache_notes && note) note.remove(); if (settings_hide_empty_cache_notes && !settings_hide_cache_notes && note) { var desc = decode_innerHTML(note.getElementsByTagName("label")[0]).replace(":", ""); var noteText = $('#viewCacheNote')[0].innerHTML; var link = document.createElement("font"); link.setAttribute("style", "font-size: 12px;"); link.innerHTML = "Hide "+desc+""; note.setAttribute("id", "gclh_note"); note.parentNode.insertBefore(link, note); if (noteText != null && (noteText == "" || noteText == "Click to enter a note" || noteText == "Klicken zum Eingeben einer Notiz" || noteText == "Pro vložení poznámky klikni sem")) { note.style.display = "none"; if ($('#gclh_hide_note')[0]) $('#gclh_hide_note')[0].innerHTML = 'Show '+desc; } var code = "function gclhHideNote() {" + " if (document.getElementById('gclh_note').style.display == 'none') {" + " document.getElementById('gclh_note').style.display = 'block';" + " if (document.getElementById('gclh_hide_note')) {" + " document.getElementById('gclh_hide_note').innerHTML = 'Hide "+desc+"'" + " }" + " } else {" + " document.getElementById('gclh_note').style.display = 'none';" + " if (document.getElementById('gclh_hide_note')) {" + " document.getElementById('gclh_hide_note').innerHTML = 'Show "+desc+"'" + " }" + " }" + "}"; injectPageScript(code, 'body'); } } catch(e) {gclh_error("Hide complete and Show/Hide Cache Note",e);} // Focus Cachenote-Textarea on Click of the Note (to avoid double click to edit). try { var editCacheNote = document.querySelector('#editCacheNote'); if (editCacheNote) { var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type == "attributes") { if (document.getElementById('editCacheNote').style.display == '') { document.getElementById('cacheNoteText').focus(); } else { // Take the parent, because empty lines are not handle by span-element #viewCacheNote. if ($("#cacheNoteText").height() != calcHeightOfCacheNote()) { $("#cacheNoteText").height(calcHeightOfCacheNote()); } } } }); }); observer.observe(editCacheNote, {attributes: true}); } } catch(e) {gclh_error("Focus Cachenote-Textarea on Click of the Note",e);} appendCssStyle(css); } // Show eMail and Message Center Link beside user. (Nicht in Cache Logs im Listing, das erfolgt später bei Log-Template.) show_mail_and_message_icon: try { // Cache, TB, Aktiv User Infos ermitteln. var [global_gc, global_tb, global_code, global_name, global_link, global_activ_username, global_founds, global_date, global_time, global_dateTime] = getGcTbUserInfo(); // Nicht auf Mail, Message Seite ausführen. if ($('#ctl00_ContentBody_SendMessagePanel1_SendEmailPanel')[0] || $('#messageArea')[0]) break show_mail_and_message_icon; if ((settings_show_mail || settings_show_message)) { // Public Profile: if (is_page("publicProfile")) { if ($('#lnkSendMessage')[0] || $('#ctl00_ProfileHead_ProfileHeader_lnkSendMessage')[0]) { var guid = ($('#lnkSendMessage')[0] || $('#ctl00_ProfileHead_ProfileHeader_lnkSendMessage')[0]).href.match(/https?:\/\/www\.geocaching\.com\/account\/messagecenter\?recipientId=([a-zA-Z0-9-]*)/); guid = guid[1]; if ($('#ctl00_ContentBody_ProfilePanel1_lblMemberName, #ctl00_ProfileHead_ProfileHeader_lblMemberName')[0]) { var username = decode_innerHTML($('#ctl00_ContentBody_ProfilePanel1_lblMemberName, #ctl00_ProfileHead_ProfileHeader_lblMemberName')[0]); var side = $('#ctl00_ContentBody_ProfilePanel1_lblMemberName, #ctl00_ProfileHead_ProfileHeader_lblStatusText')[0]; } buildSendIcons(side, username, "per guid"); } // Post Cache new log page: } else if (document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/)) { var id = $('.hidden-by a')[0].href.match(/\/profile\/\?id=(\d+)/); if (id && id[1]) { var idLink = "/p/default.aspx?id=" + id[1] + "&tab=geocaches"; GM_xmlhttpRequest({ method: "GET", url: idLink, onload: function(response) { if (response.responseText) { var [username, guid] = getUserGuidFromProfile(response.responseText); if (username && guid) { var side = $('.hidden-by a')[0]; buildSendIcons(side, username, "per guid", guid); } } } }); } // Rest: } else { if (is_page("cache_listing")) var links = $('#divContentMain .span-17, #divContentMain .sidebar').find('a[href*="/profile/?guid="], a[href*="/p/?guid="]'); else var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { if (links[i].href.match(/https?:\/\/www\.geocaching\.com\/(profile|p)\/\?guid=/)) { // Avatare haben auch mal guid, hier keine Icons erzeugen. if (links[i].children[0] && (links[i].children[0].tagName == "IMG" || links[i].children[0].tagName == "img")) continue; var guid = links[i].href.match(/https?:\/\/www\.geocaching\.com\/(profile|p)\/\?guid=([a-zA-Z0-9-]*)/); guid = guid[2]; var username = decode_innerHTML(links[i]); buildSendIcons(links[i], username, "per guid"); } } } } } catch(e) {gclh_error("Show mail and message icon",e);} // Banner zu neuen Themen entfernen. if (settings_remove_banner) { try { if (settings_remove_banner_for_garminexpress) $('#Content').find('div.banner').find('#uxSendToGarminBannerLink').closest('div.banner').remove(); if (settings_remove_banner_blue) { if ($('div.banner').length == 1 && $('div.banner').find('div.wrapper a.btn').length == 1) { var styles = window.getComputedStyle($('div.banner')[0]); if (styles && (styles.backgroundColor == "rgb(70, 135, 223)" || styles.backgroundColor == "rgb(61, 118, 197)")) $('div.banner').remove(); } $('#activationAlert').find('div.container').find('a[href*="/my/lists.aspx"]').closest('#activationAlert').remove(); } } catch(e) {gclh_error("Remove banner",e);} } // Improve cache description. if (is_page("cache_listing")) { try { // Activate fancybox for pictures in the description. function check_for_fancybox(waitCount) { if (typeof unsafeWindow.$ !== "undefined" && typeof unsafeWindow.$.fancybox !== "undefined") { unsafeWindow.$('.CachePageImages a[rel="lightbox"]').fancybox(); } else {waitCount++; if (waitCount <= 50) setTimeout(function(){check_for_fancybox(waitCount);}, 200);} } check_for_fancybox(0); // Deactivate external link warning. (Thanks to mustakorppi for the template: https://greasyfork.org/de/scripts/439287) if (settings_listing_hide_external_link_warning || settings_listing_links_new_tab) { $('.UserSuppliedContent a').each(function(){ if (settings_listing_hide_external_link_warning) { $(this)[0].addEventListener("click", function() { event.stopImmediatePropagation(); }, true); } if (settings_listing_links_new_tab) { $(this).attr('target', '_blank'); } }); } } catch(e) {gclh_error("Activate fancybox",e);} } // Link to bigger pictures for owner added images. if (settings_link_big_listing && is_page("cache_listing")) { try { var img = $('#ctl00_ContentBody_LongDescription, .CachePageImages').find('img[src*="geocaching.com/cache/large/"]'); var a = $('#ctl00_ContentBody_LongDescription, .CachePageImages').find('a[href*="geocaching.com/cache/large/"]'); for (var i = 0; i < img.length; i++) {img[i].src = img[i].src.replace("/large/", "/");} for (var i = 0; i < a.length; i++) {a[i].href = a[i].href.replace("/large/", "/");} } catch(e) {gclh_error("Link to bigger pictures for owner added images",e);} } // Decrypt hints. if (settings_decrypt_hint && !settings_hide_hint && is_page("cache_listing")) { try { if ($('#ctl00_ContentBody_EncryptionKey')[0] && $('#ctl00_ContentBody_lnkDH')[0]) { decrypt_hints(0); var decryptKey = $('#dk')[0]; if (decryptKey) decryptKey.parentNode.removeChild(decryptKey); } } catch(e) {gclh_error("Decrypt hints",e);} } // Hide hints. if (settings_hide_hint && is_page("cache_listing") && $('#dk')[0]) { try { // Replace hints by a link which shows the hints dynamically. decrypt_hints(0, true); // Remove hint description. var decryptKey = $('#dk')[0]; if (decryptKey) decryptKey.parentNode.removeChild(decryptKey); } catch(e) {gclh_error("Hide hints",e);} } function decrypt_hints(waitCount, hideHints) { $('#ctl00_ContentBody_lnkDH').click(); if ($('#ctl00_ContentBody_lnkDH')[0].getAttribute('title') != 'Decrypt') { if (hideHints) hide_hints(); } else {waitCount++; if (waitCount <= 50) setTimeout(function(){decrypt_hints(waitCount, hideHints);}, 200);} } function hide_hints() { var hint = $('#div_hint')[0]; var label = $('#ctl00_ContentBody_hints strong')[0]; if (hint && label && trim(hint.innerHTML).length > 0) { var code = "function hide_hint() {" + " var hint = document.getElementById('div_hint');" + " if (hint.style.display == 'none') {" + " hint.style.display = 'block';" + " if (document.getElementById('ctl00_ContentBody_lnkDH')) {" + " document.getElementById('ctl00_ContentBody_lnkDH').innerHTML = 'Hide'" + " }" + " } else {" + " hint.style.display = 'none';" + " if (document.getElementById('ctl00_ContentBody_lnkDH')) {" + " document.getElementById('ctl00_ContentBody_lnkDH').innerHTML = 'Show'" + " }" + " }" + " hint.innerHTML = convertROTStringWithBrackets(hint.innerHTML);" + " return false;" + "}"; injectPageScript(code, 'body'); if ($('#ctl00_ContentBody_lnkDH')[0]) { var link = $('#ctl00_ContentBody_lnkDH')[0]; link.setAttribute('onclick', 'hide_hint();'); link.setAttribute('title', 'Show/Hide ' + decode_innerHTML(label)); link.setAttribute('href', 'javascript:void(0);'); link.setAttribute('style', 'font-size: 12px;'); link.innerHTML = 'Show'; } hint.style.marginBottom = '1.5em'; hint.style.display = 'none'; } } // Improve inventory list in cache listing. if (is_page("cache_listing")) { try { // Trackable Namen kürzen, damit nicht umgebrochen wird, und Title setzen. var inventory = $('#ctl00_ContentBody_uxTravelBugList_uxInventoryLabel').closest('.CacheDetailNavigationWidget').find('.WidgetBody span'); for (var i = 0; i < inventory.length; i++) {noBreakInLine(inventory[i], 201, inventory[i].innerHTML);} } catch(e) {gclh_error("Improve inventory list",e);} } // Replace link to larger map in preview map in cache listing with the Browse Map. if (settings_larger_map_as_browse_map && is_page("cache_listing") && $('#uxLatLon')[0]) { try { var newstrPROStyle = 'View Larger Browse Map'; document.getElementById('ctl00_ContentBody_uxViewLargerMap').outerHTML = newstrPROStyle; } catch(e) {gclh_error("Replace link to larger map in preview map in cache listing with the Browse Map",e);} } // Show Google-Maps Link on Cache Listing Page. if (settings_show_google_maps && is_page("cache_listing") && $('#ctl00_ContentBody_uxViewLargerMap')[0] && $('#uxLatLon')[0] && $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0]) { try { var ref_link = $('#ctl00_ContentBody_uxViewLargerMap')[0]; var box = ref_link.parentNode; box.appendChild(document.createElement("br")); var link = document.createElement("a"); link.setAttribute("class", "lnk"); link.setAttribute("target", "_blank"); link.setAttribute("title", "Show area on Google Maps"); var coords = toDec($('#uxLatLon')[0].innerHTML); var latlng = coords[0] + "," + coords[1]; // &ll sorgt für Zentrierung der Seite beim Marker auch wenn linke Sidebar aufklappt. Zoom 18 setzen, weil GC Map eigentlich nicht mehr kann. link.setAttribute("href", "https://maps.google.de/maps?q=" + latlng + "&ll=" + latlng + "&z=18"); var img = document.createElement("img"); img.setAttribute("src", "/images/silk/map_go.png"); link.appendChild(img); link.appendChild(document.createTextNode(" ")); var span = document.createElement("span"); span.appendChild(document.createTextNode("Show area on Google Maps")); link.appendChild(span); box.appendChild(link); } catch(e) {gclh_error("Show google maps link",e);} } // Hide spoilerwarning above the logs. if (settings_hide_spoilerwarning && is_page("cache_listing")) { try { if ($('.InformationWidget .NoBottomSpacing a[href*="/glossary.aspx#spoiler"]')[0]) { var sp = $('.InformationWidget .NoBottomSpacing a[href*="/glossary.aspx#spoiler"]')[0].closest('p'); if (sp) { sp.innerHTML = " "; sp.style.height = "0"; sp.className += " Clear"; } } } catch(e) {gclh_error("Hide spoilerwarning",e);} } // Hide warning message. if (settings_hide_warning_message) { if ($('.WarningMessage')[0]) { try { var content = '"' + $('.WarningMessage')[0].innerHTML + '"'; if (content == getValue("warningMessageContent")) { warnMessagePrepareMouseEvents(); } else { // Button in Warnmeldung aufbauen, um Meldung erstes Mal zu verbergen. var div = document.createElement("div"); div.setAttribute("class", "GoAwayWarningMessage"); div.setAttribute("title", "Go away message"); div.setAttribute("style", "float: right; width: 70px; color: rgb(255, 255, 255); box-sizing: border-box; border: 2px solid rgb(255, 255, 255); opacity: 0.7; cursor: pointer; border-radius: 3px; margin-right: 2px; margin-top: 2px; text-align: center;"); div.appendChild(document.createTextNode("Go away")); div.addEventListener("click", warnMessageHideAndSave, false); $('.WarningMessage')[0].parentNode.insertBefore(div, $('.WarningMessage')[0]); } } catch(e) {gclh_error("Hide warning message",e);} } } // Warnmeldung verbergen und Inhalt sichern. function warnMessageHideAndSave() { $('.WarningMessage').fadeOut(1000, "linear"); var content = '"' + $('.WarningMessage')[0].innerHTML + '"'; setValue("warningMessageContent", content); $('.GoAwayWarningMessage')[0].style.display = "none"; warnMessagePrepareMouseEvents(); } // Mouse Events vorbereiten für show/hide Warnmeldung. function warnMessagePrepareMouseEvents() { // Balken im rechten Headerbereich zur Aktivierung der Warnmeldung. var divShow = document.createElement("div"); divShow.setAttribute("class", "ShowWarningMessage"); divShow.setAttribute("style", "z-index: 1004; float: right; right: 0px; width: 6px; background-color: rgb(224, 183, 10); height: 65px; position: absolute;"); $('.WarningMessage')[0].parentNode.insertBefore(divShow, $('.WarningMessage')[0]); // Bereich für Mouseout Event, um Warnmeldung zu verbergen. Notwendig, weil eigentliche Warnmeldung nicht durchgängig da und zukünftiges Aussehen unklar. var divHide = document.createElement("div"); divHide.setAttribute("class", "HideWarningMessage"); divHide.setAttribute("style", "z-index: 1004; height: 110px; position: absolute; right: 0px; left: 0px;"); $('.WarningMessage')[0].parentNode.insertBefore(divHide, $('.WarningMessage')[0]); warnMessageMouseOut(); } // Show Warnmeldung. function warnMessageMouseOver() { $('.ShowWarningMessage')[0].style.display = "none"; $('.WarningMessage')[0].style.display = ""; $('.HideWarningMessage')[0].style.display = ""; $('.HideWarningMessage')[0].addEventListener("mouseout", warnMessageMouseOut, false); } // Hide Warnmeldung. function warnMessageMouseOut() { $('.WarningMessage')[0].style.display = "none"; $('.HideWarningMessage')[0].style.display = "none"; $('.ShowWarningMessage')[0].style.display = ""; $('.ShowWarningMessage')[0].addEventListener("mouseover", warnMessageMouseOver, false); } // Driving direction for every waypoint. if (settings_driving_direction_link && (is_page("cache_listing") || document.location.href.match(/\.com\/hide\/wptlist.aspx/))) { try { var tbl = getWaypointTable(); var length = tbl.find("tbody > tr").length; for (var i=0; i tr").eq(i*2); var name = row1st.find("td:eq(4)").text().trim(); var icon = row1st.find("td:eq(1) > img").attr('src'); var cellCoordinates = row1st.find("td:eq(5)"); var tmp_coords = toDec(cellCoordinates.text().trim()); if ((!settings_driving_direction_parking_area || icon.match(/pkg.jpg/g)) && typeof tmp_coords[0] !== 'undefined' && typeof tmp_coords[1] !== 'undefined') { if (getValue("home_lat", 0) != 0 && getValue("home_lng") != 0) { var link = "https://maps.google.com/maps?f=d&hl=en&saddr="+getValue("home_lat", 0)/10000000+","+getValue("home_lng", 0)/10000000+"%20(Home%20Location)&daddr="; row1st.find("td:last").append(''); } else { var link = document.location + "&#gclhpb#errhomecoord"; row1st.find("td:last").append(''); } } } } catch(e) {gclh_error("Driving direction for Waypoints",e);} } // Added elevation to every additional waypoint with shown coordinates. if (settings_show_elevation_of_waypoints && ((is_page("cache_listing") && !isMemberInPmoCache()) || is_page("map") || is_page("searchmap") )) { try { function formatElevation(elevation) { return ((elevation>0)?"+":"")+((settings_distance_units != "Imperial")?(Math.round(elevation) + "m"):(Math.round(elevation*3.28084) + "ft")); } elevationServicesData[1]['function'] = addElevationToWaypoints_GoogleElevation; elevationServicesData[2]['function'] = addElevationToWaypoints_OpenElevation; elevationServicesData[3]['function'] = addElevationToWaypoints_GeonamesElevation; function addElevationToWaypoints_GoogleElevation(responseDetails) { try { context = responseDetails.context; json = JSON.parse(responseDetails.responseText); if ( json.status != "OK") { var mess = "\naddElevationToWaypoints_GoogleElevation():\n- Get elevations: retries: "+context.retries+"\n- json-status: "+json.status+"\n- json.error_message: "+json.error_message; gclh_log(mess); getElevations(context.retries+1,context.locations); return; } var elevations = []; for (var i=0; i/)) { if (responseDetails.responseText.match(/Service Unavailable/)) { gclh_log("\naddElevationToWaypoints_GeonamesElevation():\n- Info: Service Unavailable\n- url: "+responseDetails.finalUrl); } else { gclh_log("\naddElevationToWaypoints_GeonamesElevation():\n- Error:\n"+responseDetails.responseText+"\n- url: "+responseDetails.finalUrl); } getElevations(context.retries+1,context.locations); return; } else { json = JSON.parse(responseDetails.responseText); var elevations = []; for (var i=0; i   Elevation: '); // Prepare cache listing - waypoint table. var tbl = getWaypointTable(); if (tbl.length > 0) { tbl.find("thead > tr > th:eq(5)").after('Elevation'); var length = tbl.find("tbody > tr").length; for (var i=0; i tr:eq("+(i*2+1)+") > td:eq(1)"); var colspan = cellNote.attr('colspan'); cellNote.attr('colspan',colspan+1); var row1st = tbl.find("tbody > tr").eq(i*2); var cellPrefix = row1st.find("td:eq(2)").text().trim(); classAttribute = "waypoint-elevation-na"; idAttribute = ""; for ( var j=0; j'); } } return locations; } var elevationServices = []; if (settings_primary_elevation_service > 0) { elevationServices.push(elevationServicesData[settings_primary_elevation_service]); } if (settings_secondary_elevation_service > 0) { elevationServices.push(elevationServicesData[settings_secondary_elevation_service]); } // This function can be re-entered. function getElevations(serviceIndex,locations) { if (serviceIndex >= elevationServices.length || elevationServices < 0) { $('.waypoint-elevation').each(function (index, value) { $(this).html('???'); }); return; } $('.waypoint-elevation').each(function (index, value) { $(this).html(''); }); $('.waypoint-elevation-na').each(function (index, value) { $(this).html('n/a'); }); var additionalListingIndex = 0; if (elevationServices[serviceIndex].name == "Geonames-Elevation") { var maxLocations = 20; var countLocations = 0; var lats = ""; var lngs = ""; for (var i=0; i 0 ) getElevations(0,locations); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){check_wpdata_elevation(waitCount);}, 100);} } check_wpdata_elevation(0); } } catch(e) {gclh_error("Add elevation",e);} } // Change new links for find caches to the old links. if (is_page("cache_listing") && settings_listing_old_links) { try { var links = $('#ctl00_ContentBody_bottomSection a[href*="/play/search?"]'); for (var i = 0; i < links.length; i++) { // Other caches hidden by this user. var match = links[i].href.match(/\/play\/search\?owner\[0\]=(.*?)&.*/); if (match && match[1]) {links[i].href = "/seek/nearest.aspx?u="+urlencode(urldecode(match[1])); continue;} // Other caches found by this user. var match = links[i].href.match(/\/play\/search\?fb=(.*?)&.*/); if (match && match[1]) {links[i].href = "/seek/nearest.aspx?ul="+urlencode(urldecode(match[1])); continue;} // Nearby caches of this type, that I haven't found. var match = links[i].href.match(/\/play\/search\?types=(.*?)&origin=(.*?),(.*?)&f=2&o=2/); if (match && match[1] && match[2] && match[3]) {links[i].href = "/seek/nearest.aspx?lat="+match[2]+"&lng="+match[3]+"&ex=1"+getCacheTx(match[1]); continue;} // Nearby caches of this type. var match = links[i].href.match(/\/play\/search\?types=(.*?)&origin=(.*?),(.*?)(&|$)/); if (match && match[1] && match[2] && match[3]) {links[i].href = "/seek/nearest.aspx?lat="+match[2]+"&lng="+match[3]+getCacheTx(match[1]); continue;} // All nearby caches, that I haven't found. var match = links[i].href.match(/\/play\/search\?origin=(.*?),(.*?)&f=2&o=2/); if (match && match[1] && match[2]) {links[i].href = "/seek/nearest.aspx?lat="+match[1]+"&lng="+match[2]+"&ex=1"; continue;} // All nearby caches. var match = links[i].href.match(/\/play\/search\?origin=(.*?),(.*?)(&|$)/); if (match && match[1] && match[2]) {links[i].href = "/seek/nearest.aspx?lat="+match[1]+"&lng="+match[2]; continue;} } } catch(e) {gclh_error("Change new links for find caches to the old links",e);} } // Set language in Driving Directions links for the cache coordinates and the waypoints. if (is_page("cache_listing") && $('#ctl00_ContentBody_lnkPrintDirectionsSimple')[0]) { $('#ctl00_ContentBody_lnkPrintDirectionsSimple')[0].href = $('#ctl00_ContentBody_lnkPrintDirectionsSimple')[0].href.replace('http://', 'https://'); $('a[href*="https://maps.google.com/maps?f=d&hl=en&saddr="]').each((_i, elem) => { elem.href = elem.href.replace('&hl=en', ''); }); } // Hide greenToTopButton. if (settings_hide_top_button) $("#topScroll").attr("id", "_topScroll").hide(); // Show additional cache info in old log page. if (document.location.href.match(/\.com\/seek\/log\.aspx\?(ID|wp|PLogGuid)\=/) && settings_show_add_cache_info_in_log_page && $('.PostLogList > dd:nth-child(2)')[0]) { try { $('.PostLogList > dd:nth-child(2)')[0].append(createAreaACI()); buildContentACI($('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].nextSibling.href); buildCssACI(); } catch(e) {gclh_error("Show additional cache info in old log page",e);} } // Show additional cache info in new log page. if (document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/) && settings_show_add_cache_info_in_log_page) { try { function waitForNewLogPageForACI(waitCount) { if ($('#logType .log-subheading')[0]) { $('#logType .log-subheading')[0].after(createAreaACI()); buildContentACI($('#logType .log-subheading')[0].href); buildCssACI(); } else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForNewLogPageForACI(waitCount);}, 100);} } waitForNewLogPageForACI(0); } catch(e) {gclh_error("Show additional cache info in new log page",e);} } function buildCssACI(css) { if (!css) var css = ''; css += '#aci {margin-left: 20px; margin-right: 2px; cursor: default; float: right;} '; css += '#aci svg {vertical-align: text-bottom;} '; css += '#aci img {vertical-align: sub;} '; appendCssStyle(css); } function createAreaACI() { var span = document.createElement('span'); span.id = 'aci'; return span; } function buildContentACI(url) { $.get(url, null, function(text){ var aci = ''; // Favorite points and favorite percent. var favoritePoints = $(text).find('.favorite-value').html(); if (favoritePoints) { favoritePoints = favoritePoints.replace('.','').replace(',',''); favoritePoints = parseInt(favoritePoints); var from = text.indexOf('userToken', text.indexOf('MapTilesEnvironment')) + 13; var length = text.indexOf("';", from) - from; var userTokenACI = text.substr(from, length); aci += separator(aci) + ''; aci += ''; aci += ' ' + favoritePoints + ''; aci += ''; aci += ''; } // Watcher. var watchNumber = $(text).find('#watchlistLinkMount'); if (watchNumber[0]) { watchNumber = watchNumber[0].getAttribute("data-watchcount"); aci += separator(aci) + ''; aci += ''; aci += ' ' + watchNumber + ''; aci += ''; } // Output and further load. if (aci != '') { $('#aci')[0].innerHTML = aci; if (favoritePoints) getFavoritePercent(userTokenACI, $('.favorite_percent')[0]); } }); } // Show Smilies und Log Templates old log page. if ((document.location.href.match(/\.com\/seek\/log\.aspx\?(id|guid|ID|wp|LUID|PLogGuid|code)\=/) || document.location.href.match(/\.com\/track\/log\.aspx\?(id|wid|guid|ID|LUID|PLogGuid|code)\=/)) && $('#litDescrCharCount')[0] && $('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0] && $('#ctl00_ContentBody_LogBookPanel1_uxLogInfo')[0] && $('#uxDateVisited')[0]) { try { var [aGCTBName, aGCTBLink, aGCTBNameLink, aLogDate] = getGCTBInfo(); var aOwner = decode_innerHTML($('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].nextSibling.nextSibling.nextSibling.nextSibling.nextSibling); insert_smilie_fkt("ctl00_ContentBody_LogBookPanel1_uxLogInfo"); insert_tpl_fkt(); var liste = ""; if (settings_show_bbcode) build_smilies(); build_tpls(); var box = $('#litDescrCharCount')[0]; box.innerHTML = liste; } catch(e) {gclh_error("Smilies and Log Templates old log page",e);} } // Show Smilies und Log Templates new log page. if (document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/) && $('#LogDate')[0] && $('#logContent')[0] && $('#LogText')[0] && $('#reportProblemInfo')[0]) { try { var [aGCTBName, aGCTBLink, aGCTBNameLink, aLogDate] = getGCTBInfo(true); var aOwner = decode_innerHTML($('.hidden-by a')[0]); aOwner = aOwner.match(/(.*)(  ";} } // Log Templates aufbauen. function build_tpls(newLogPage) { var texts = ""; var logicOld = ""; var logicNew = ""; for (var i = 0; i < anzTemplates; i++) { if (getValue("settings_log_template_name["+i+"]", "") != "") { texts += ""; logicOld += " - " + repApo(getValue("settings_log_template_name["+i+"]", "")) + "
    "; logicNew += ""; } } if (getValue("last_logtext", "") != "") { texts += ""; logicOld += " - [Last Cache-Log]
    "; logicNew += ""; } if (newLogPage) { liste += texts; liste += ""; } else liste += "

    Templates:

    " + texts + logicOld; } // Vorschau für Log, Log preview. if (document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/)) { try { var log_preview_wrapper = '
    ' + '
    ' + '' + '
    ' + '
    ' + '
    ' + '
    ' + '
    '; // Add divs for Markdown Editor $('textarea.log-text').before('
    '); $('textarea.log-text').after('
    '); $('#trackablesPanel').before(log_preview_wrapper); var $mdEditor = $("textarea.log-text").MarkdownDeep({ SafeMode :true, AllowInlineImages: false, ExtraMode: false, RequireHeaderClosingTag: true, disableShortCutKeys: true, DisabledBlockTypes: [ BLOCKTYPE_CONST.h4, BLOCKTYPE_CONST.h5, BLOCKTYPE_CONST.h6 ], help_location: "/guide/markdown.aspx", active_modal_class: "modal-open", active_modal_selector: "html", additionalPreviewFilter: SmileyConvert() }); $('#log-preview-button').click(function(){ $('#log-preview-content').toggle(); $('#log-previewPanel button').toggleClass('handle-open'); }); } catch(e) {gclh_error("Logpage Log Preview",e);} } // Replicate TB-Header to bottom if (document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/)) { try { var checkExistTBHeader = setInterval(function() { if ($('#tbHeader .trackables-header').length) { var visit_link = document.createElement("a"); visit_link.setAttribute("href", "javascript:void(0);"); visit_link.appendChild(document.createTextNode('Visit all')); visit_link.addEventListener("click", function(){ $('#tbHeader .btn-visit').trigger( "click" ); }); var drop_link = document.createElement("a"); drop_link.setAttribute("href", "javascript:void(0);"); drop_link.appendChild(document.createTextNode('Drop all')); drop_link.addEventListener("click", function(){ $('#tbHeader .btn-drop').trigger( "click" ); }); var clear_link = document.createElement("a"); clear_link.setAttribute("href", "javascript:void(0);"); clear_link.appendChild(document.createTextNode('Clear all')); clear_link.addEventListener("click", function(){ $('#tbHeader .btn-clear').trigger( "click" ); }); var li = document.createElement("li"); li.classList.add('tb_action_buttons'); li.appendChild(clear_link); li.appendChild(visit_link); li.appendChild(drop_link); $(".trackables-list").append(li); var css = ".tb_action_buttons{text-align:right;} " + ".tb_action_buttons a{margin-right: 12px; text-decoration:underline;}" + ".tb_action_buttons a:last-child{margin-right:0px;}" appendCssStyle(css); // Open Trackable Inventory. if (settings_auto_open_tb_inventory_list && $('#trackablesPanel .inventory-panel').css('display') == 'none') { $("#trackablesPanel button.btn-handle").trigger( "click" ); } clearInterval(checkExistTBHeader); } }, 500); } catch(e) {gclh_error("Logpage Replicate TB-Header",e);} } // Maxlength of logtext and unsaved warning. if (((document.location.href.match(/\.com\/seek\/log\.aspx\?(id|guid|ID|wp|LUID|PLogGuid|code)\=/) || document.location.href.match(/\.com\/track\/log\.aspx\?(id|wid|guid|ID|LUID|PLogGuid|code)\=/)) && $('#litDescrCharCount')[0]) || document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/)) { try { var newLogpage = document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/); var changed = false; // Meldung bei ungespeichertem Log. window.onbeforeunload = function(e) { if (changed && settings_unsaved_log_message) { var mess = "You have changed a log and haven't saved it yet. Do you want to leave this page and lose your changes?"; e.returnValue = mess; return mess; } }; if ($('#ctl00_ContentBody_LogBookPanel1_btnSubmitLog')[0]) $('#ctl00_ContentBody_LogBookPanel1_btnSubmitLog')[0].addEventListener("click", function() {changed = false;}, false); // Keine Meldung beim Submit. if ($('#submitLog')[0]) $('#submitLog')[0].addEventListener("click", function() {changed = false;}, false); // Keine Meldung beim Submit. var counterelement = document.createElement('span'); function waitForLoadingLoggingPage(waitCount) { if (!document.getElementsByClassName('loading')[0]) { if (!newLogpage || (newLogpage && settings_improve_character_counter)) { var logfield = (!newLogpage ? $('#ctl00_ContentBody_LogBookPanel1_uxLogInfo')[0] : $('#LogText')[0]); var counterspan = document.createElement('p'); counterspan.id = "logtextcounter"; var wordsArr = $(logfield).val().replace(/\n/g, ' ').split(' '); var words = 0; for (let i=0; i"); counterelement.innerHTML = '' + $(logfield).val().replace(/\n/g, "\r\n").length + '/4000 (' + words + ' words)'; counterspan.appendChild(counterelement); if (!newLogpage) document.getElementById('litDescrCharCount').parentNode.appendChild(counterspan); else { document.querySelector('.btn-group-grow').insertBefore(counterspan, (document.querySelector('.btn-favorite') ? document.querySelector('.btn-favorite') : document.querySelector('.btn-problem'))); var observerNewLog = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (!document.querySelector('#logtextcounter')) document.querySelector('.btn-group-grow').insertBefore(counterspan, (document.querySelector('.btn-favorite') ? document.querySelector('.btn-favorite') : document.querySelector('.btn-problem'))); }); }); var target = document.querySelector('body'); var config = {attributes: true, childList: true, characterData: true, subtree: true}; observerNewLog.observe(target, config); } logfield.addEventListener("keyup", function() {limitedField(logfield, document.querySelector('#logtextcounter span'), 4000, true);}, false); logfield.addEventListener("change", function() {limitedField(logfield, document.querySelector('#logtextcounter span'), 4000, true);}, false); } } else {waitCount++; if (waitCount <= 200) setTimeout(function(){waitForLoadingLoggingPage(waitCount);}, 50);} } waitForLoadingLoggingPage(0); var css = '#logtextcounter {font-weight: normal !important;}'; if (newLogpage && settings_improve_character_counter) { css += 'span.character-counter {display: none !important;}'; css += '#logtextcounter {margin: 0 !important;}' css += '.btn-group-grow {flex: unset !important; display: flex; justify-content: space-between; width: 100%; align-items: center;}'; css += '.btn-problem {float: unset !important; margin-left: 0 !important;}' } appendCssStyle(css); } catch(e) {gclh_error("Maxlength of logtext and unsaved warning",e);} } // Autovisit Old Log Page. if (settings_autovisit && document.location.href.match(/\.com\/seek\/log\.aspx/) && !document.location.href.match(/\.com\/seek\/log\.aspx\?LUID=/) && !document.getElementById('ctl00_ContentBody_LogBookPanel1_CoordInfoLinkControl1_uxCoordInfoCode')) { try { var tbs = getTbsO(); if (tbs.length != 0) { for (var i = 0; i < tbs.length; i++) { var [tbC, tbN] = getTbO(tbs[i].parentNode); if (!tbC || !tbN) continue; var auto = document.createElement("input"); auto.setAttribute("type", "checkbox"); auto.setAttribute("id", "gclh_"+tbC); auto.setAttribute("value", tbN); auto.addEventListener("click", setAutoO, false); tbs[i].appendChild(auto); tbs[i].appendChild(document.createTextNode(" AutoVisit")); } $('#ctl00_ContentBody_LogBookPanel1_ddLogType')[0].addEventListener("input", buildAutosO, false); buildAutosO(true); window.addEventListener("load", function(){buildAutosO(true);}, false); } function buildAutosO(start) { var type = getTypeO(); var tbs = getTbsO(); for (var i = 0; i < tbs.length; i++) { var [tbC, tbN] = getTbO(tbs[i].parentNode); setAutoO(tbC, tbN, type, start, true); } if (unsafeWindow.setSelectedActions) unsafeWindow.setSelectedActions(); } function setAutoO(tbC, tbN, type, start, allTbs) { if (!type) var type = getTypeO(); if (!tbC || !tbN) var [tbC, tbN] = getTbO(this.parentNode.parentNode); var options = $('#gclh_'+tbC)[0].parentNode.getElementsByTagName('option'); var select = $('#gclh_'+tbC)[0].parentNode.getElementsByTagName('select'); var autos = $('#gclh_'+tbC)[0]; if (!type || !tbC || !tbN || !select[0] || options.length < 2 || !autos) return; if (start) { if (getValue("autovisit_"+tbC, settings_autovisit_default)) autos.checked = true; else autos.checked = false; } if (options.length == 2 || (options.length == 3 && select[0].selectedIndex != 1)) { if (autos.checked == true) { if (type == 2 || type == 10 || type == 11) select[0].selectedIndex = options.length - 1; else select[0].selectedIndex = 0; } else { if (allTbs != true && (type == 2 || type == 10 || type == 11)) select[0].selectedIndex = 0; } } setValue("autovisit_"+tbC, (autos.checked ? true:false)); } function getTypeO() {return $('#ctl00_ContentBody_LogBookPanel1_ddLogType')[0].value;} function getTbsO() {return $('#tblTravelBugs tbody tr td select').closest('td');} function getTbO(tb) {return [$(tb).find('td a')[0].innerHTML, $(tb).find('td select option')[0].value];} } catch(e) {gclh_error("Autovisit Old",e);} } // Autovisit New Log Page. if (settings_autovisit && document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/i)) { try { function getTbs() {return $('#tbList .trackables-list li:not(.tb_action_buttons)');} function getType() {return $('.log-types').val();} // returns the log type. function getTb(tb) {return $(tb).find('.stats dd')[1].innerHTML;}; // returns the tb code. function getTbType(tb) { let r = $(tb).find('input[type="radio"]'); for (let i=0; i<3; i++) { if (r[i].checked) return r[i].value; } } function buildAutos() { let tbs = getTbs(); if (tbs.length > 0) { for (let i=0; i 1) { var tbs = getTbs(); if (tbs.length > 0) { for (let i=0; i
    '); $(tbs[i]).find('.actions.radio-toggle-group').appendTo('#gclh_action_list_'+tbC+''); let html = '
    ' + ' ' + ' ' + '
    '; $('#gclh_action_list_'+tbC).append(html); // Save TB in autovisit if it new. if (getValue("autovisit_"+tbC, "new") === "new") { setValue("autovisit_"+tbC, settings_autovisit_default); } // Save autovisit status onchange $(tbs[i]).find('.gclh_autovisit input').each(function() { this.addEventListener('change', function(evt) { setValue(evt.target.name, (evt.target.value==1 ? true : false)); buildAutos(); }) }); } // Set Autovisit. buildAutos(); // Change autovisit if the logtype changed $('select.log-types').bind('change', buildAutos); } } else {waitCount++; if (waitCount <= 1000) setTimeout(function(){waitForContent(waitCount);}, 100);} } waitForContent(0); } catch(e) {gclh_error("Autovisit New",e);} } // Default Log Type and Log Signature Old Log Page. // Cache: if (document.location.href.match(/\.com\/seek\/log\.aspx\?(id|guid|ID|PLogGuid|wp)\=/) && $('#ctl00_ContentBody_LogBookPanel1_ddLogType')[0] && $('#ctl00_ContentBody_LogBookPanel1_lbConfirm').length == 0) { try { // Logtype. if (!document.location.href.match(/\&LogType\=/) && !document.location.href.match(/PLogGuid/)) { var cache_type = document.getElementById("ctl00_ContentBody_LogBookPanel1_WaypointLink").nextSibling.childNodes[0].title; var select_val = "-1"; if (cache_type.match(/event/i)) { select_val = settings_default_logtype_event; } else if ($('.PostLogList').find('a[href*="https://www.geocaching.com/profile/?guid="], a[href*="https://www.geocaching.com/p/?guid="]').text().trim() == global_me.trim()) { select_val = settings_default_logtype_owner; } else select_val = settings_default_logtype; var select = document.getElementById('ctl00_ContentBody_LogBookPanel1_ddLogType'); var childs = select.children; if (select.value == "-1") { for (var i = 0; i < childs.length; i++) { if (childs[i].value == select_val) select.selectedIndex = i; } } } // Signature. var logtext = document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').value; var signature = getValue("settings_log_signature", ""); // Cursorposition gegebenenfalls hinter Draft ermitteln. document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').innerHTML += ""; var initial_cursor_position = document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').selectionEnd; // Draft. if (document.location.href.match(/\.com\/seek\/log\.aspx\?PLogGuid\=/)) { if (settings_log_signature_on_fieldnotes && !logtext.includes(signature.replace(/^\s*/, ''))) { document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').innerHTML += signature; } // Kein Draft. } else { if (!logtext.includes(signature)) { document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').innerHTML += signature; } } replacePlaceholder(); document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').selectionEnd = initial_cursor_position; // Auch im Log Preview zur Anzeige bringen. document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').dispatchEvent(new KeyboardEvent('keyup', {'keyCode': 32})); } catch(e) {gclh_error("Default Log-Type and Signature Old Log Page (CACHE)",e);} } // TB: if (document.location.href.match(/\.com\/track\/log\.aspx/) && $('#ctl00_ContentBody_LogBookPanel1_ddLogType')[0]) { try { // Logtype. if (settings_default_tb_logtype != "-1" && !document.location.href.match(/\&LogType\=/)) { var select = document.getElementById('ctl00_ContentBody_LogBookPanel1_ddLogType'); var childs = select.children; for (var i = 0; i < childs.length; i++) { if (childs[i].value == settings_default_tb_logtype) select.selectedIndex = i; } } // Signature. if ($('#ctl00_ContentBody_LogBookPanel1_uxLogInfo')[0] && $('#ctl00_ContentBody_LogBookPanel1_uxLogInfo')[0].innerHTML == "") $('#ctl00_ContentBody_LogBookPanel1_uxLogInfo')[0].innerHTML = getValue("settings_tb_signature", ""); replacePlaceholder(); document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').selectionEnd = 0; // Auch im Log Preview zur Anzeige bringen. document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo').dispatchEvent(new KeyboardEvent('keyup', {'keyCode': 32})); } catch(e) {gclh_error("Default Log-Type and Signature (TB)",e);} } // Log Signature New Log Page. if (document.location.href.match(/\.com\/play\/geocache\/gc\w+\/log/)) { try { checkLogType(0); function checkLogType(waitCount) { // Drafts ohne Signatur. if (document.location.href.match(/log\?d\=/) && document.getElementById('LogText').value != "" && !settings_log_signature_on_fieldnotes) { // Auch im Log Preview zur Anzeige bringen. document.getElementById('LogText').dispatchEvent(new KeyboardEvent('keyup', {'keyCode': 32})); } // Kein Draft oder Draft mit Signatur. if ((!document.location.href.match(/log\?d\=/)) || // Kein Draft (document.location.href.match(/log\?d\=/) && document.getElementById('LogText').value != "" && settings_log_signature_on_fieldnotes)) { // Draft var initial_cursor_position = document.getElementById('LogText').selectionEnd; var logtext = document.getElementById('LogText').value; var signature = getValue("settings_log_signature", ""); if (!logtext.includes(signature.replace(/^\s*/, ''))) { document.getElementById('LogText').innerHTML = signature; } replacePlaceholder(true); if (document.location.href.match(/log\?d\=/)) { // Draft // 2 Zeilen sinngemäß von DieBatzen ausgeliehen, um "<" und ">" richtig darzustellen. var textarea = document.createElement('textarea'); var value = $(''; html += ""; html += show_help("Here you can enter a separator to use between the addings. The default value is a line feed.") + '
    '; // Own entries in copy data to clipboard menu (copy data own stuff, cdos). var ph = "Possible placeholders:
      #GCName# : GC name
      #GCCode# : GC code
      #GCLink# : GC link
      #GCNameLink# : GC name as a link
      #GCType# : GC type (short form)
    " + "  #Owner# : Username of the owner
      #Diff# : Difficulty
      #Terr# : Terrain
      #Size# : Size of the cache box
      #Favo# : Favorites
      #FavoPerc# : Favorites percentage
    " + "  #Elevation# : Elevation
      #Coords# : Shown coordinates
      #Hints# : Additional hints
      #GCNote# : User note
      #Founds# : Number of found logs
      #Attended# : Number of attended logs
      #FoundsPlus# : Number of found, attended or webcam photo taken logs
      #WillAttend# : Number of will attend logs
      #DNFs# : Number of DNF logs
    " + "  #Date# : Actual date
      #Time# : Actual time in format hh:mm
      #DateTime# : Actual date actual time
      #yyyy# : Current year
      #mm# : Current month
      #dd# : Current day
    " + "(Upper and lower case is not required in the placeholders name.)"; var header = "Show own copy data entries" + show_help("With the checkbox and the two input fields, you can generate entries in the menu \"Copy data to Clipbord\".

    With the checkbox you can activate or deactivate an entry. The first input field contains the name that is displayed in the menu \"Copy data to Clipbord\" for an entry. The second input field contains the content that is copied to the clipboard if you click to an entry in the menu \"Copy data to Clipbord\". You can use different placeholders in the second input field.") + "   " + "( Possible placeholders" + show_help(ph) + ")
    "; var titleName = 'Name of entry in menu \"Copy data to Clipbord\".'; var titleValue = 'Data in the clipboard when clicking on entry in menu \"Copy data to Clipbord\".'; html += openCff('cdos', header, titleName, titleValue, 'settings_show_copydata_menu'); // First entry from non array. var cdosData = buildDataCff(settings_show_copydata_own_stuff_show, repApo(settings_show_copydata_own_stuff_name), settings_show_copydata_own_stuff_value); var idNr = 1; html += buildEntryCff('cdos', cdosData, idNr, 'settings_show_copydata_own_stuff', false); // Further entries from array. for (var i in settings_show_copydata_own_stuff) { settings_show_copydata_own_stuff[i].name = repApo(settings_show_copydata_own_stuff[i].name); var cdosData = settings_show_copydata_own_stuff[i]; idNr++; html += buildEntryCff('cdos', cdosData, idNr, false, false); } html += closeCff('cdos'); cssCff('cdos', '14', '200', '460', '54'); html += newParameterVersionSetzen("0.10") + newParameterOff; html += "
    Overview Map (right sidebar)" + "
    "; html += checkboxy('settings_map_overview_build', 'Show cache location in overview map') + show_help("With this option there will be an additional map top right in the cache listing as an overview of the cache location.") + "
    "; html += newParameterOn3; html += '    Map layer '; html += "  " + "Map zoom " + show_help("With this option you can choose the zoom value to start in the map. \"1\" is the hole world and \"19\" is the maximal enlargement. Default is \"11\".") + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += newParameterOn2; html += "  " + checkboxy('settings_map_overview_browse_map_icon', 'Show icon with link to Browse Map in overview map') + "
    "; html += "     " + checkboxy('settings_map_overview_browse_map_icon_new_tab', 'Open link in new browser tab') + "
    "; html += "  " + checkboxy('settings_map_overview_search_map_icon', 'Show icon with link to Search Map in overview map') + "
    "; html += "     " + checkboxy('settings_map_overview_search_map_icon_new_tab', 'Open link in new browser tab') + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += "
    VIP-Lists (right sidebar)" + "
    "; html += checkboxy('settings_show_vip_listX0', 'Process VIPs') + show_help(content_settings_show_vip_list + "

    You can adjust details about this feature also in the Dashboard topic.") + "
    "; html += "  " + checkboxy('settings_show_owner_vip_list', 'Show owner in VIP list') + show_help("If you enable this option, the owner is a VIP for the cache, so you can see, what happened with the cache (disable, maint, enable, ...). Then the owner is shown not only in VIP list but also in VIP logs.")+ "
    "; html += newParameterOn3; html += "  " + checkboxy('settings_show_reviewer_as_vip', 'Show reviewer/publisher in VIP list') + show_help("If you enable this option, the reviewer or publisher of the cache is a VIP for the cache.") + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += "  " + checkboxy('settings_show_long_vip', 'Show long VIP list (one row per log)') + show_help("This is another type of displaying the VIP list. If you disable this option you get the short list, one row per VIP and the logs as icons beside the VIP. If you enable this option, there is a row for every log.") + "
    "; html += "  " + checkboxy('settings_vip_show_nofound', 'Show a list of VIPs who have not found the cache') + "
    "; html += "  " + checkboxy('settings_make_vip_lists_hideable', 'Make VIP lists in listing hideable') + show_help("With this option you can hide and show the VIP lists \"VIP-List\" and \"VIP-List not found\" in cache listing with one click.") + "
    "; html += "  " + checkboxy('settings_show_mail_in_viplist', 'Show mail link beside user in "VIP-List" in listing') + "
    "; html += "  " + checkboxy('settings_process_vupX0', 'Process VUPs') + show_help(content_settings_process_vup + "

    You can adjust details about this feature also in the Dashboard topic.") + "
    "; html += "     " + checkboxy('settings_vup_hide_avatar', 'Also hide name, avatar and counter from log') + "
    "; html += "       " + checkboxy('settings_vup_hide_log', 'Hide complete log') + "
    "; html += "
    Cache Description" + "
    "; html += checkboxy('settings_img_warning', 'Show warning for unavailable images') + show_help("With this option the images in the cache listing will be checked for existence before trying to load it. If an image is unreachable or dosen't exists, a placeholder is shown. The mouse over the placeholder will shown the image link. A mouse click to the placeholder will open the link in a new tab.") + "
    "; html += checkboxy('settings_visitCount_geocheckerCom', 'Show statistic on geochecker.com pages') + show_help("This option adds '&visitCount=1' to all geochecker.com links. This will show some statistics on geochecker.com page like the count of page visits and the count of right and wrong attempts.") + "
    "; html += newParameterOn2; html += checkboxy('settings_listing_hide_external_link_warning', 'Hide external link warning message') + show_help("With this option you can hide the warning message for external links in the cache listing description. The warning message is a security feature and is intended to inform you that the external link has not been reviewed by the operator of the website.") + "
    "; html += checkboxy('settings_listing_links_new_tab', 'Open links in cache description in a new tab') + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += "
    Additional Hints" + "
    "; html += checkboxy('settings_decrypt_hint', 'Decrypt hints') + show_help("This option decrypt the hints on cache listing and print page and remove also the description of the decryption.") + "
    "; html += checkboxy('settings_hide_hint', 'Hide the additional hints behind a link') + show_help("This option hides the hints behind a link. You have to click it to display the hints (already decrypted). This option remove also the description of the decryption.") + "
    "; html += "
    Additional Waypoints" + "
    "; html += checkboxy('settings_driving_direction_link', 'Show link to Google driving direction for every waypoint') + show_help("Shows for every waypoint in the waypoint list a link to Google driving direction from home location to coordinates of the waypoint.") + "
    "; html += "  " + checkboxy('settings_driving_direction_parking_area', 'Only for parking area waypoints') + "
    "; html += checkboxy('settings_show_elevation_of_waypointsX0', 'Show elevations for listing coordinates and additional waypoints') + show_help("Shows the elevation of the listing coordinates and of every additional waypoint. Select the order of the elevation service or deactivate it. Queries to the Google Elevation service are limited. Hover of the elevation data of a waypoint shows a tooltip with the used service.") + "
    "; html += "    " + "Measure unit can be set in preferences" + "
    "; html += newParameterOn3; html += "   " + "First service "; html += "  " + "Second service
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += "
    Owner Images" + "
    "; html += checkboxy('settings_link_big_listing', 'Replace image links in cache listing to bigger image') + show_help("With this option the links of owner images in the cache listing points to the bigger, original image.") + "
    "; html += content_settings_show_thumbnails; html += "  " + checkboxy('settings_imgcaption_on_top', 'Show caption on top'); html += content_geothumbs; html += "    " + "Spoiler filter " + show_help("If one of these words is found in the caption of the image, there will be no real thumbnail. It is to prevent seeing spoilers. Words have to be divided by |. If the field is empty, no checking is done. Default is \"spoiler|hinweis\".") + "
    "; html += "
    Links to Find Caches" + "
    "; html += newParameterOn2; html += checkboxy('settings_listing_old_links', 'Use old links to find caches') + show_help("The links to find caches run through the new search. With this option you can use the old search.") + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += "
    Map Preview" + "
    "; html += newParameterOn2; html += checkboxy('settings_larger_map_as_browse_map', 'Replace link to larger map with the Browse Map') + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += checkboxy('settings_show_google_maps', 'Show link to Google Maps') + show_help("This option shows a link at the top of the second map in the listing. With this link you get directly to Google Maps in the area, where the cache is.") + "
    "; html += "
    Logs Header" + "
    "; html += newParameterOn2; html += checkboxy('settings_add_search_in_logs_func', 'Add "Search in logs" feature') + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += newParameterOn3; html += checkboxy('settings_show_all_logs_but', 'Show button \"Show all logs\" above the logs') + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += newParameterOn1; html += checkboxy('settings_show_compact_logbook_but', 'Show button \"Show compact logs\" above the logs') + "
    "; html += newParameterVersionSetzen("0.10") + newParameterOff; html += newParameterOn3; html += checkboxy('settings_show_log_counter_but', 'Show button \"Show log counter\" above the logs') + "
    "; html += "  " + checkboxy('settings_show_log_counter', 'Show log counter when opening cache listing') + "
    "; html += checkboxy('settings_show_bigger_avatars_but', 'Show button \"Show bigger avatars\" above the logs') + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += newParameterOn2; var content_upvotes_help = show_help("With this option you can show/hide the whole upvotes feature consist of the logs sort button \"Order by\" above the logs and the buttons \"Great story\" and \"Helpful\" in the logs."); html += checkboxy('settings_show_hide_upvotes_but', 'Show button \"Hide upvotes\" above the logs') + content_upvotes_help + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += checkboxy('settings_hide_spoilerwarning', 'Hide spoiler warning') + "
    "; html += newParameterOn2; var content_settings_hide_upvotes = checkboxy('settings_hide_upvotes', 'Hide upvotes elements "Order by", "Great story" and "Helpful"') + content_upvotes_help + "
    "; html += content_settings_hide_upvotes; var content_settings_smaller_upvotes_icons = checkboxy('settings_smaller_upvotes_icons', 'Make upvotes elements "Order by", "Great story" and "Helpful" smaller') + show_help("This option makes the upvotes elements \"Order by\", \"Great story\" and \"Helpful\" smaller, as is the case with other elements.") + "
    "; html += content_settings_smaller_upvotes_icons; var content_settings_no_wiggle_upvotes_click = checkboxy('settings_no_wiggle_upvotes_click', 'No wiggle on click to upvotes elements "Order by", "Great story" and ...') + show_help("With this option you can prevent the page wiggle if you click to the upvotes elements \"Order by\", \"Great story\" and \"Helpful\".") + "
    "; html += content_settings_no_wiggle_upvotes_click; html += newParameterVersionSetzen('0.11') + newParameterOff; html += checkboxy('settings_hide_top_button', 'Hide the green "To Top" button') + show_help("Hide the green \"To Top\" button, which appears if you are reading logs.") + "
    "; html += "
    Logs" + "
    "; html += checkboxy('settings_load_logs_with_gclh', 'Load logs with GClh II') + show_help("This option should be enabled.

    You just should disable it, if you have problems with loading the logs.

    If this option is disabled, there are no VIP-, VUP-, mail-, message- and top icons, no line colors and no mouse activated big images at the logs. Also the VIP and VUP lists, hide avatars, log filter and log search won't work.") + "
    "; html += checkboxy('settings_show_all_logs', 'Show at least ') + " logs" + show_help("With this option you can choose how many logs should be shown at least if you start with the listing. The default and the minimum are 30 logs. The maximum are 500 logs, because of performance reasons.

    (If you want to list more then 500 logs, you can use the button \"Show all logs\" above the logs section. And if you go to the end of the listed logs, the logs will be dynamically loaded there anyway.)") + "
    "; html += checkboxy('settings_hide_avatar', 'Hide avatars in logs') + show_help("This option hides the avatars in logs. This prevents loading the hundreds of images. You have to change the option here, because GC little helper II overrides the log-load-logic of GC, so the avatar option of GC doesn't work with GC little helper II.") + "
    "; html += checkboxy('settings_hide_found_count', 'Hide found count') + "
    "; html += content_settings_show_thumbnails.replace("show_thumbnails", "show_thumbnailsX0").replace("max_size", "max_sizeX0"); html += "  " + checkboxy('settings_imgcaption_on_topX0', 'Show caption on top'); html += content_geothumbs; html += "    " + "Spoiler filter " + show_help("If one of these words is found in the caption of the image, there will be no real thumbnail. It is to prevent seeing spoilers. Words have to be divided by |. If the field is empty, no checking is done. Default is \"spoiler|hinweis\".") + "
    "; html += newParameterOn2; html += content_settings_hide_upvotes.replace("settings_hide_upvotes", "settings_hide_upvotesX0"); html += content_settings_smaller_upvotes_icons.replace("settings_smaller_upvotes_icons", "settings_smaller_upvotes_iconsX0"); html += content_settings_no_wiggle_upvotes_click.replace("settings_no_wiggle_upvotes_click", "settings_no_wiggle_upvotes_clickX0"); html += newParameterVersionSetzen('0.11') + newParameterOff; html += ""; html += "

    "+prepareHideable.replace("#id#","draft")+"

    "; html += "
    "; html += newParameterOn3; html += checkboxy('settings_modify_new_drafts_page', 'Change the look and functionality of draft items') + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += newParameterOn2; html += "  " + checkboxy('settings_drafts_cache_link', 'Use cache name as link to the cache listing') + "
    "; html += "     " + checkboxy('settings_drafts_cache_link_new_tab', 'Open link in new browser tab') + "
    "; html += "  " + checkboxy('settings_drafts_color_visited_link', 'Color a visited link') + "
    "; html += "  " + checkboxy('settings_drafts_old_log_form', 'Use old-fashioned log form to log a draft') + "
    "; html += "  " + checkboxy('settings_drafts_log_icons', 'Show logtype icon instead of text') + "
    "; html += checkboxy('settings_drafts_go_automatic_back', 'Automatic go back to Drafts after sending to log') + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += "
    "; html += "

    "+prepareHideable.replace("#id#","logging")+"

    "; html += "
    "; html += checkboxy('settings_show_bbcode', 'Show smilies') + show_help("This option displays smilies options beside the log form. If you click on a smilie, it is inserted into your log.") + "
    "; html += checkboxy('settings_replace_log_by_last_log', 'Replace log by last log template') + show_help("If you enable this option, the last log template will replace the whole log. If you disable it, it will be appended to the log.") + "
    "; html += newParameterOn3; html += checkboxy('settings_auto_open_tb_inventory_list', 'Auto open trackable inventory') + show_help("If you enable this option, the list of your trackables is automatically expended when you load the log page.") + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += checkboxy('settings_autovisit', 'Enable \"AutoVisit\" feature for trackables') + show_help("With this option you are able to select trackables which should be automatically set from \"No action\" to \"Visited\" on every log, if the logtype is \"Found It\", \"Webcam Photo Taken\" or \"Attended\". For other logtypes trackables are automatically set from \"Visited\" to \"No action\". You can select \"AutoVisit\" for each trackable in the list on the bottom of the log form.") + "
    "; html += "  " + checkboxy('settings_autovisit_default', 'Set \"AutoVisit\" for all TBs by default') + show_help("With this option all new TBs in your inventory are automatically set to \"AutoVisit\".") + "
    " html += content_settings_show_log_it.replace("show_log_it", "show_log_itX2"); html += content_settings_logit_for_basic_in_pmo.replace("basic_in_pmo","basic_in_pmoX0"); html += newParameterOn1; html += checkboxy('settings_improve_character_counter', 'Show length of logtext') + show_help("If you enable this option, a counter shows the length of your logtext and the maximum length.\nOn the old logging page this feature ist auto-enabled.") + "
    "; html += newParameterVersionSetzen('0.10') + newParameterOff; html += newParameterOn2; html += checkboxy('settings_unsaved_log_message', 'Show message in case of unsaved log') + "
    "; html += checkboxy('settings_show_add_cache_info_in_log_page', 'Show additional cache info') + show_help("If you enable this option, additional cache information such as the favorite points or the favorite percent are shown in the log form next to the cache name.") + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; var placeholderDescription = "Possible placeholders:
      #Found# : Your founds + 1
      #Found_no# : Your founds
      #Me# : Your username
      #Owner# : Username of the owner
      #Date# : Actual date
      #Time# : Actual time in format hh:mm
      #DateTime# : Actual date actual time
      #GCTBName# : GC or TB name
      #GCTBLink# : GC or TB link
      #GCTBNameLink# : GC or TB name as a link
      #LogDate# : Content of field \"Date Logged\"
    (Upper and lower case is not required in the placeholders name.)"; html += " " + "Log templates" + show_help("Log templates are predefined texts. All of your templates will be displayed next to the log form. All you have to do is click on a template and it will be placed in your log. You can also use placeholders for variables that will be replaced in the log. The smilies option must be activated.") + "   ( Possible placeholders" + show_help(placeholderDescription) + ")
    "; html += "Please note that log templates are useful for automatically entering the number of finds, the date of discovery and the like in the log, but that cache owners are people who are happy about individual logs for their cache. Geocaching is not just about pushing your own statistics, but also about experiencing something. Please take some time to give something back to the owners by telling them about your experiences and writing them good logs. Then there will also be cachers in the future who like to take the trouble to set up new caches. The log templates are useful, but can never replace a complete log."; for (var i = 0; i < anzTemplates; i++) { html += " " + " "; html += "
    "; html += ""; } html += " " + "Cache log signature" + show_help("The signature is automatically added to your logs. You can also use placeholders for variables that will be replaced in the log.") + "   ( Possible placeholders" + show_help(placeholderDescription) + ")
    "; html += " " + "
    "; html += checkboxy('settings_log_signature_on_fieldnotes', 'Add log signature on drafts logs') + show_help('If this option is disabled, the log signature will not be used by logs coming from drafts. You can use it, if you already have an signature in your drafts.') + "
    "; html += " " + "TB log signature" + show_help("The signature is automatically added to your TB logs. You can also use placeholders for variables that will be replaced in the log.") + "   ( Possible placeholders" + show_help(placeholderDescription) + ")
    "; html += " " + "
    "; html += "
    New Log Page Only
    "; html += newParameterOn3; html += checkboxy('settings_show_pseudo_as_owner', 'Replace placeholder owner, although there could be a pseudonym') + show_help("If you disable this option, the placeholder for the owner cannot be replaced on the newly designed log page.

    If you enable this option, the placeholder for the owner is replaced possibly by the pseudonym of the owner if the real owner is not known.

    On the new designed log page there is shown as owner of the cache not the real owner but possibly the pseudonym of the owner for the cache as it is shown in the cache listing under \"A cache by\". The real owner is not available in this cases.") + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += "
    Old Log Page Only
    "; html += newParameterOn2; html += checkboxy('settings_logs_old_fashioned', 'Log caches always old-fashioned') + show_help("If you enable this option, you always get the old log page instead of the new one. This does not apply to drafts / field notes.
    Background: geocaching.com saves the log page you are using in a cookie. If you always delete cookies when you close your browser, the data will be lost.
    To get the old design for Fieldnotes, you have to use the old Fieldnotes page and activate \"Logging drafts old-fashioned\" here in the GClh config.") + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += ""; html += " "; html += " "; html += " "; html += " "; html += " "; html += " "; html += " "; html += " "; html += "
    Default log type
    Default event log type
    Default owner log type
    Default TB log type
    "; html += "
    "; html += "

    "+prepareHideable.replace("#id#","mail")+"

    "; html += "
    "; var placeholderDescriptionMail = "Possible placeholders in the mail and message form:
      #Found# : Your founds + 1
      #Found_no# : Your founds
      #Me# : Your username
      #Receiver# : Username of the receiver
      #Date# : Actual date
      #Time# : Actual time in format hh:mm
      #DateTime# : Actual date actual time
      #GCTBName# : GC or TB name
      #GCTBCode# : GC or TB code in brackets
      #GCTBLink# : GC or TB link in brackets
    (Upper and lower case is not required in the placeholders name.)"; html += " " + "Template" + show_help("The template is automatically added to your mails and messages. You can also use placeholders for variables that will be replaced in the mail and in the message.") + "   ( Possible placeholders" + show_help(placeholderDescriptionMail) + ")
    "; html += " " + "
    "; html += "
    "; html += "

    "+prepareHideable.replace("#id#","linklist")+"" + show_help("In this topic you can configure your personal Linklist which is shown on the top of the page and/or on your dashboard. You can activate it in the \"Global\" and \"Dashboard\" topic.") + "

    "; html += ""; // Section Development. html += "

    "+prepareHideable.replace("#id#","development")+"

    "; html += "
    "; html += newParameterOn3; html += checkboxy('settings_gclherror_alert', 'Show an alert if an internal error occurs') + "
    "; html += newParameterVersionSetzen(0.9) + newParameterOff; html += newParameterOn2; html += checkboxy('settings_test_log_console', 'Checks log to console') + "
    "; html += newParameterVersionSetzen('0.11') + newParameterOff; html += "
    "; // Footer. html += "

    "; html += " " + " "; html += "
    License: GPLv2 | Warranty: NO

    "; var end = (new Date()).getFullYear(); html += "
    Copyright © 2010-2016 Torsten Amshove, 2016-"+end+" 2Abendsegler, 2017-"+end+" Ruko2010
    "; html += ""; // Config Content: Aufbauen, Reset Area verbergen, Special Links Nearest List/Map, Own Trackables versorgen. Adapt map icons. // --------------- div.innerHTML = html; $('body')[0].appendChild(div); $('x').each(function() { if ($(this)[0].parentNode) { $(this)[0].parentNode.innerHTML = $(this)[0].parentNode.innerHTML.replace(/Drop here...').appendTo(tablebody); // BM als nicht vorhanden in Linklist kennzeichnen. var index = this.parentNode.parentNode.id.replace("gclh_LinkListTop_", ""); flagBmInLl(document.getElementById("gclh_LinkListElement_" + index), false, "grab", "1", "Grab it"); }); // Linklist: Drag and Drop von linker Spalte in rechte Spalte und sortieren in rechter Spalte. // --------- $(".gclh_LinkListElement").draggable({ revert: "invalid", helper: "clone", start: function(event, ui) { $(ui.helper).addClass("gclh_form"); }, stop: function(event, ui) { $(ui.helper).removeClass("gclh_form"); } }); $("#gclh_LinkListTop").droppable({ accept: function(d) { if (!d.hasClass("gclh_LinkListInlist") && d.hasClass("gclh_LinkListElement")) { // Wenn dragging stattfindet, Cursor und Opacity passend setzen. if ($('.gclh_LinkListElement.ui-draggable-dragging').length != 0) { var index = d[0].id.replace("gclh_LinkListElement_", ""); if (document.getElementById("gclh_LinkListTop_" + index)) { flagBmInLl(d[0].parentNode.children[2], true, "not-allowed", "1", ""); } else { flagBmInLl(d[0].parentNode.children[2], true, "grabbing", "1", ""); return true; } } } }, drop: function(event, ui) { // Platzhalter entfernen. $(this).find(".gclh_LinkListPlaceHolder").remove(); // Index ermitteln. var index = ui.draggable[0].id.replace("gclh_LinkListElement_", ""); // Custom BM? if (ui.draggable[0].children[1].id.match("custom")) { var textTitle = "Custom" + ui.draggable[0].children[1].id.replace("settings_custom_bookmark[", "").replace("]", ""); } else var textTitle = ui.draggable[0].children[1].innerHTML; // Abweichende Bezeichnung ermitteln. Falls leer, default nehmen. var text = document.getElementById("bookmarks_name["+index+"]").value; if (!text.match(/(\S+)/)) text = textTitle; var textName = textTitle; // BM in Linklist aufbauen. var htmlRight = ""; htmlRight += ""; htmlRight += " "; htmlRight += text; htmlRight += ""; htmlRight += ""; htmlRight += " "; htmlRight += ""; var row = $("").html(htmlRight); // Entsprechende Bookmark als vorhanden in Linklist kennzeichnen. flagBmInLl(document.getElementById("gclh_LinkListElement_" + index), false, "not-allowed", "0.4", "Already available in Linklist"); // Click Event für Delete Icon aufbauen. row.find(".gclh_LinkListDelIcon").click(function() { var row = this.parentNode.parentNode; var tablebody = row.parentNode; $(row).remove(); if (tablebody.children.length == 0) $('Drop here...').appendTo(tablebody); }); $(row).appendTo(this); } }).sortable({ items: "tr:not(.gclh_LinkListPlaceHolder)" }); // Map / Layers: // ------------- function layerOption(name, selected) { return ""; } $("#btn_map_layer_right").click(function() { animateClick(this); var source = "#settings_maplayers_unavailable"; var destination = "#settings_maplayers_available"; $(source+" option:selected").each(function() { var name = $(this).html(); if (name == settings_map_default_layer) $("#settings_mapdefault_layer").html(name); $(destination).append(layerOption(name, (settings_map_default_layer == name))); }); $(source+" option:selected").remove(); }); $("#btn_map_layer_left").click(function() { animateClick(this); var source = "#settings_maplayers_available"; var destination = "#settings_maplayers_unavailable"; $(source+" option:selected").each(function() { var name = $(this).html(); if (name == settings_map_default_layer) { $("#settings_mapdefault_layer").html("not available"); settings_map_default_layer = ""; } $(destination).append(layerOption(name, false)); }); $(source+" option:selected").remove(); }); $("#btn_set_default_layer").click(function() { animateClick(this); $("#settings_maplayers_available option:selected").each(function() { var name = $(this).html(); $("#settings_mapdefault_layer").html(name); settings_map_default_layer = name; }); }); // Fill layer lists. var layerListAvailable = ""; var layerListUnAvailable = ""; // Wenn bisher keine Layer ausgewählt, alle auswählen. if (settings_map_layers == "" || settings_map_layers.length < 1) { for (name in all_map_layers) { $("#settings_maplayers_available").append(layerOption(name, (settings_map_default_layer == name))); } } else { for (name in all_map_layers) { if (settings_map_layers.indexOf(name) != -1) $("#settings_maplayers_available").append(layerOption(name, (settings_map_default_layer == name))); else $("#settings_maplayers_unavailable").append(layerOption(name, false)); } } // Show/Hide Einstellungen zu Layers in Map. $("#settings_use_gclh_layercontrol").click(function() { $("#MapLayersConfiguration").toggle(); }); // Colorpicker: // ------------ var code = GM_getResourceText("jscolor"); code += 'new jscolor.init();'; injectPageScript(code, "body"); // Multi homezone: // --------------- function gclh_init_multi_homecoord_remove_listener($el) { $el.find('.remove').click(function() { $(this).closest('.multi_homezone_element').remove(); }); } // Initialize remove listener for present elements. gclh_init_multi_homecoord_remove_listener($('.multi_homezone_settings')); // Initialize add listener for multi homecoord entries. $('.multi_homezone_settings .addentry').click(function() { var $newEl = $(hztp); $('.multi_homezone_settings tbody').append($newEl); // Initialize remove listener for new element. gclh_init_multi_homecoord_remove_listener($newEl); // Reinit jscolor. if (typeof(chrome) != "undefined") { $('.gclh_form.color:not(.withPicker)').each(function(i, e) { var homezonepic = new jscolor.color(e, { required: true, adjust: true, hash: true, caps: true, pickerMode: 'HSV', pickerPosition: 'right' }); $(e).addClass("withPicker"); }); } else injectPageScript('new jscolor.init();', "body"); }); // Show/Hide Einstellungen zu homezone circels. $("#settings_show_homezone").click(function() { $("#ShowHomezoneCircles").toggle(); }); // Own entries in copy data to clipboard menu: // ------------------------------------------- $('#cdos_main .cff_element').each(function() {buildAroundCff('cdos', this);}); buildEventCreateCff('cdos'); // Rest: // ----- function gclh_show_linklist() { if (document.getElementById('lnk_gclh_config_linklist').title == "show") document.getElementById('lnk_gclh_config_linklist').click(); } // Open Helptexts slightly late so it doesn't flutter so often. $('.gclh_info').each(function() { this.addEventListener('mouseover', function() { var a = this; setTimeout(function() {$(a).addClass('mouseover');}, 400); }) this.addEventListener('mouseleave', function() { $(this).removeClass('mouseover'); var a = this; setTimeout(function() {$(a).removeClass('mouseover');}, 400); }) }); // Monitor select of color scheme. $('#settings_color_schemes')[0].addEventListener('click', checkColorSchemeSelected); var lastColorScheme = 0; function checkColorSchemeSelected() { var value = $('#settings_color_schemes')[0].value; if (value && value != lastColorScheme && value > 0) { setColorOfScheme(colorSchemes[value].bg, 'bg'); setColorOfScheme(colorSchemes[value].ht, 'ht'); setColorOfScheme(colorSchemes[value].if, 'if'); setColorOfScheme(colorSchemes[value].bh, 'bh'); setColorOfScheme(colorSchemes[value].bu, 'bu'); setColorOfScheme(colorSchemes[value].bo, 'bo'); setColorOfScheme(colorSchemes[value].nv, 'nv'); lastColorScheme == $('#settings_color_schemes option[selected="selected"]').value; } } function setColorOfScheme(color, name) { if ($('#settings_color_'+name)[0] && $('#settings_color_'+name)[0].value && $('#settings_color_'+name)[0].value != color) { $('#settings_color_'+name)[0].value = $('#settings_color_'+name)[0].defaultValue = color; $('#settings_color_'+name)[0].focus(); $('#set_color_'+name).focus(); $('#set_color_'+name).click(); } } $('#create_homezone, #cff_create, #btn_close2, #btn_saveAndUpload, #btn_save, #thanks_close_button, #rc_close_button, #rc_reset_button').click(function() {if ($(this)[0]) animateClick(this);}); $('#check_for_upgrade')[0].addEventListener("click", function() {checkForUpgrade(true);}, false); $('#rc_link')[0].addEventListener("click", rcPrepare, false); $('#rc_reset_button')[0].addEventListener("click", rcReset, false); $('#rc_close_button')[0].addEventListener("click", rcClose, false); $('#thanks_link')[0].addEventListener("click", thanksShow, false); $('#thanks_close_button')[0].addEventListener("click", gclh_showConfig, false); $('#gclh_linklist_link_1')[0].addEventListener("click", gclh_show_linklist, false); $('#gclh_linklist_link_2')[0].addEventListener("click", gclh_show_linklist, false); $('#btn_close2')[0].addEventListener("click", btnClose, false); $('#btn_save')[0].addEventListener("click", function() {btnSave("normal");}, false); $('#btn_saveAndUpload')[0].addEventListener("click", function() {btnSave("upload");}, false); $('#settings_bookmarks_on_top')[0].addEventListener("click", handleRadioTopMenu, false); $('#settings_bookmarks_top_menu')[0].addEventListener("click", handleRadioTopMenu, false); $('#settings_bookmarks_top_menu_h')[0].addEventListener("click", handleRadioTopMenu, false); handleRadioTopMenu(true); $('#settings_load_logs_with_gclh')[0].addEventListener("click", alert_settings_load_logs_with_gclh, false); $('#restore_settings_lines_color_zebra')[0].addEventListener("click", restoreField, false); $('#restore_settings_lines_color_user')[0].addEventListener("click", restoreField, false); $('#restore_settings_lines_color_owner')[0].addEventListener("click", restoreField, false); $('#restore_settings_lines_color_reviewer')[0].addEventListener("click", restoreField, false); $('#restore_settings_lines_color_vip')[0].addEventListener("click", restoreField, false); $('#restore_settings_font_color_menu')[0].addEventListener("click", restoreField, false); $('#restore_settings_font_color_menuX0')[0].addEventListener("click", restoreField, false); $('#restore_settings_font_color_submenu')[0].addEventListener("click", restoreField, false); $('#restore_settings_font_color_submenuX0')[0].addEventListener("click", restoreField, false); $('#restore_settings_count_own_matrix_show_color_next')[0].addEventListener("click", restoreField, false); $('#settings_process_vup')[0].addEventListener("click", alert_settings_process_vup, false); $('#restore_settings_lists_disabled_color')[0].addEventListener("click", restoreField, false); $('#restore_settings_lists_archived_color')[0].addEventListener("click", restoreField, false); $('#restore_settings_searchmap_disabled_color')[0].addEventListener("click", restoreField, false); $('#restore_settings_show_copydata_own_stuff_name')[0].addEventListener("click", restoreField, false); $('#restore_settings_show_copydata_own_stuff_value')[0].addEventListener("click", restoreField, false); $('#restore_settings_show_copydata_separator')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_bg')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_ht')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_if')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_bu')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_bh')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_bo')[0].addEventListener("click", restoreField, false); $('#restore_settings_color_nv')[0].addEventListener("click", restoreField, false); // Events setzen für Parameter, die im GClh Config mehrfach ausgegeben wurden, weil sie zu mehreren Themen gehören. Es handelt // sich hier um den Parameter selbst. In der Function werden Events für den Parameter selbst (ZB: "settings_show_vip_list") // und dessen Clone gesetzt, die hinten mit "X" und Nummerierung von 0-9 enden können (ZB: "settings_show_vip_listX0"). setEvForDouPara("settings_show_save_message", "click"); setEvForDouPara("settings_show_vip_list", "click"); setEvForDouPara("settings_process_vup", "click"); setEvForDouPara("settings_log_inline_tb", "click"); setEvForDouPara("settings_font_color_menu", "input"); setEvForDouPara("settings_font_color_menu", "change"); setEvForDouPara("settings_font_color_submenu", "input"); setEvForDouPara("settings_font_color_submenu", "change"); setEvForDouPara("settings_font_size_menu", "input"); setEvForDouPara("settings_distance_menu", "input"); setEvForDouPara("settings_font_size_submenu", "input"); setEvForDouPara("settings_distance_submenu", "input"); setEvForDouPara("settings_show_log_it", "click"); setEvForDouPara("settings_logit_for_basic_in_pmo", "click"); setEvForDouPara("settings_show_thumbnails", "click"); setEvForDouPara("settings_hover_image_max_size", "input"); setEvForDouPara("settings_imgcaption_on_top", "click"); setEvForDouPara("settings_spoiler_strings", "input"); setEvForDouPara("settings_show_elevation_of_waypoints", "click"); setEvForDouPara("settings_primary_elevation_service", "input"); setEvForDouPara("settings_secondary_elevation_service", "input"); setEvForDouPara("settings_hide_upvotes", "click"); setEvForDouPara("settings_smaller_upvotes_icons", "click"); setEvForDouPara("settings_no_wiggle_upvotes_click", "click"); // Events setzen für Parameter, die im GClh Config eine Abhängigkeit derart auslösen, dass andere Parameter aktiviert bzw. // deaktiviert werden müssen. ZB. können Mail Icons in VIP List (Parameter "settings_show_mail_in_viplist") nur aufgebaut // werden, wenn die VIP Liste erzeugt wird (Parameter "settings_show_vip_list"). Clone müssen hier auch berücksichtigt werden. setEvForDepPara("settings_change_header_layout", "settings_show_smaller_gc_link"); setEvForDepPara("settings_change_header_layout", "settings_remove_logo"); setEvForDepPara("settings_show_smaller_gc_link", "settings_remove_logo"); setEvForDepPara("settings_change_header_layout", "settings_remove_message_in_header"); setEvForDepPara("settings_change_header_layout", "settings_gc_tour_is_working"); setEvForDepPara("settings_change_header_layout", "settings_fixed_header_layout"); setEvForDepPara("settings_change_header_layout", "settings_font_color_menu"); setEvForDepPara("settings_change_header_layout", "restore_settings_font_color_menu"); setEvForDepPara("settings_change_header_layout", "settings_font_color_submenu"); setEvForDepPara("settings_change_header_layout", "restore_settings_font_color_submenu"); setEvForDepPara("settings_change_header_layout", "settings_bookmarks_top_menu_h"); setEvForDepPara("settings_change_header_layout", "settings_menu_float_right"); setEvForDepPara("settings_change_header_layout", "settings_font_size_menu"); setEvForDepPara("settings_change_header_layout", "settings_distance_menu"); setEvForDepPara("settings_change_header_layout", "settings_font_size_submenu"); setEvForDepPara("settings_change_header_layout", "settings_distance_submenu"); setEvForDepPara("settings_change_header_layout", "settings_menu_number_of_lines"); setEvForDepPara("settings_change_header_layout", "settings_menu_show_separator"); setEvForDepPara("settings_bookmarks_on_top", "settings_bookmarks_top_menu_h"); setEvForDepPara("settings_bookmarks_on_top", "settings_bookmarks_search"); setEvForDepPara("settings_bookmarks_on_top", "settings_bookmarks_search_default"); setEvForDepPara("settings_bookmarks_on_top", "settings_menu_float_right"); setEvForDepPara("settings_bookmarks_on_top", "settings_menu_number_of_lines"); setEvForDepPara("settings_bookmarks_on_top", "settings_menu_show_separator"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_mail_in_viplist"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_cache_listings_in_zebra"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_cache_listings_color_user"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_cache_listings_color_owner"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_cache_listings_color_reviewer"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_cache_listings_color_vip"); setEvForDepPara("settings_show_vip_list", "settings_show_cache_listings_color_vip"); setEvForDepPara("settings_show_vip_list", "settings_show_tb_listings_color_vip"); setEvForDepPara("settings_show_vip_list", "settings_lines_color_vip"); setEvForDepPara("settings_show_vip_list", "restore_settings_lines_color_vip"); setEvForDepPara("settings_show_vip_list", "settings_show_reviewer_as_vip"); setEvForDepPara("settings_show_vip_list", "settings_show_owner_vip_list"); setEvForDepPara("settings_show_vip_list", "settings_show_long_vip"); setEvForDepPara("settings_show_vip_list", "settings_vip_show_nofound"); setEvForDepPara("settings_show_vip_list", "settings_show_mail_in_viplist"); setEvForDepPara("settings_show_vip_list", "settings_show_mail_in_allmyvips"); setEvForDepPara("settings_show_vip_list", "settings_make_vip_lists_hideable"); setEvForDepPara("settings_show_vip_list", "settings_process_vup"); setEvForDepPara("settings_show_vip_list", "settings_show_vup_friends"); setEvForDepPara("settings_show_vip_list", "settings_vup_hide_avatar"); setEvForDepPara("settings_show_vip_list", "settings_vup_hide_log"); setEvForDepPara("settings_show_vip_listX0", "settings_show_cache_listings_color_vip"); setEvForDepPara("settings_show_vip_listX0", "settings_show_tb_listings_color_vip"); setEvForDepPara("settings_show_vip_listX0", "settings_lines_color_vip"); setEvForDepPara("settings_show_vip_listX0", "restore_settings_lines_color_vip"); setEvForDepPara("settings_show_vip_listX0", "settings_show_reviewer_as_vip"); setEvForDepPara("settings_show_vip_listX0", "settings_show_owner_vip_list"); setEvForDepPara("settings_show_vip_listX0", "settings_show_long_vip"); setEvForDepPara("settings_show_vip_listX0", "settings_vip_show_nofound"); setEvForDepPara("settings_show_vip_listX0", "settings_show_mail_in_viplist"); setEvForDepPara("settings_show_vip_listX0", "settings_show_mail_in_allmyvips"); setEvForDepPara("settings_show_vip_listX0", "settings_make_vip_lists_hideable"); setEvForDepPara("settings_show_vip_listX0", "settings_process_vup"); setEvForDepPara("settings_show_vip_listX0", "settings_show_vup_friends"); setEvForDepPara("settings_show_vip_listX0", "settings_vup_hide_avatar"); setEvForDepPara("settings_show_vip_listX0", "settings_vup_hide_log"); setEvForDepPara("settings_process_vup", "settings_show_vup_friends"); setEvForDepPara("settings_process_vup", "settings_vup_hide_avatar"); setEvForDepPara("settings_process_vup", "settings_vup_hide_log"); setEvForDepPara("settings_process_vupX0", "settings_show_vup_friends"); setEvForDepPara("settings_process_vupX0", "settings_vup_hide_avatar"); setEvForDepPara("settings_process_vupX0", "settings_vup_hide_log"); setEvForDepPara("settings_vup_hide_avatar", "settings_vup_hide_log"); setEvForDepPara("settings_log_inline_pmo4basic", "settings_log_inline_tb", false); setEvForDepPara("settings_log_inline", "settings_log_inline_tb", false); setEvForDepPara("settings_show_mail", "settings_show_mail_in_viplist"); setEvForDepPara("settings_show_mail", "settings_show_mail_in_allmyvips"); setEvForDepPara("settings_show_mail", "settings_mail_icon_new_win"); setEvForDepPara("settings_show_message", "settings_message_icon_new_win"); setEvForDepPara("settings_show_thumbnails", "settings_hover_image_max_size"); setEvForDepPara("settings_show_thumbnails", "settings_imgcaption_on_top"); setEvForDepPara("settings_show_thumbnails", "settings_spoiler_strings"); setEvForDepPara("settings_show_thumbnailsX0", "settings_hover_image_max_size"); setEvForDepPara("settings_show_thumbnailsX0", "settings_imgcaption_on_top"); setEvForDepPara("settings_show_thumbnailsX0", "settings_spoiler_strings"); setEvForDepPara("settings_show_thumbnailsX1", "settings_hover_image_max_size"); setEvForDepPara("settings_show_thumbnailsX1", "settings_imgcaption_on_top"); setEvForDepPara("settings_show_thumbnailsX1", "settings_spoiler_strings"); setEvForDepPara("settings_map_overview_build", "settings_map_overview_zoom"); setEvForDepPara("settings_map_overview_build", "settings_map_overview_layer"); setEvForDepPara("settings_map_overview_build", "settings_map_overview_browse_map_icon"); setEvForDepPara("settings_map_overview_build", "settings_map_overview_search_map_icon"); setEvForDepPara("settings_count_own_matrix_show_next", "settings_count_own_matrix_show_count_next"); setEvForDepPara("settings_count_own_matrix_show_next", "settings_count_own_matrix_show_color_next"); setEvForDepPara("settings_count_own_matrix_show_next", "restore_settings_count_own_matrix_show_color_next"); setEvForDepPara("settings_count_own_matrix_show_next", "settings_count_own_matrix_links_radius"); setEvForDepPara("settings_count_own_matrix_show_next", "settings_count_own_matrix_links"); setEvForDepPara("settings_add_link_gc_map_on_google_maps", "settings_switch_from_google_maps_to_gc_map_in_same_tab"); setEvForDepPara("settings_add_link_new_gc_map_on_google_maps", "settings_switch_from_google_maps_to_new_gc_map_in_same_tab"); setEvForDepPara("settings_add_link_google_maps_on_gc_map", "settings_switch_to_google_maps_in_same_tab"); setEvForDepPara("settings_add_link_gc_map_on_osm", "settings_switch_from_osm_to_gc_map_in_same_tab"); setEvForDepPara("settings_add_link_new_gc_map_on_osm", "settings_switch_from_osm_to_new_gc_map_in_same_tab"); setEvForDepPara("settings_add_link_osm_on_gc_map", "settings_switch_to_osm_in_same_tab"); setEvForDepPara("settings_add_link_flopps_on_gc_map", "settings_switch_to_flopps_in_same_tab"); setEvForDepPara("settings_add_link_geohack_on_gc_map", "settings_switch_to_geohack_in_same_tab"); setEvForDepPara("settings_show_latest_logs_symbols", "settings_show_latest_logs_symbols_count"); setEvForDepPara("settings_load_logs_with_gclh", "settings_show_latest_logs_symbols"); setEvForDepPara("settings_log_statistic", "settings_log_statistic_reload"); setEvForDepPara("settings_log_statistic", "settings_log_statistic_percentage"); setEvForDepPara("settings_friendlist_summary", "settings_friendlist_summary_viponly"); setEvForDepPara("settings_remove_banner", "settings_remove_banner_for_garminexpress"); setEvForDepPara("settings_remove_banner", "settings_remove_banner_blue"); setEvForDepPara("settings_driving_direction_link", "settings_driving_direction_parking_area"); setEvForDepPara("settings_improve_add_to_list", "settings_improve_add_to_list_height"); setEvForDepPara("settings_set_default_langu", "settings_default_langu"); setEvForDepPara("settings_pq_set_cachestotal", "settings_pq_cachestotal"); setEvForDepPara("settings_pq_set_difficulty", "settings_pq_difficulty"); setEvForDepPara("settings_pq_set_difficulty", "settings_pq_difficulty_score"); setEvForDepPara("settings_pq_set_terrain", "settings_pq_terrain"); setEvForDepPara("settings_pq_set_terrain", "settings_pq_terrain_score"); setEvForDepPara("settings_pq_previewmap", "settings_pq_previewmap_layer"); setEvForDepPara("settings_show_all_logs", "settings_show_all_logs_count"); setEvForDepPara("settings_strike_archived", "settings_highlight_usercoords"); setEvForDepPara("settings_strike_archived", "settings_highlight_usercoords_bb"); setEvForDepPara("settings_strike_archived", "settings_highlight_usercoords_it"); setEvForDepPara("settings_but_search_map", "settings_but_search_map_new_tab"); setEvForDepPara("settings_compact_layout_nearest", "settings_fav_proz_nearest"); setEvForDepPara("settings_compact_layout_nearest", "settings_open_tabs_nearest"); setEvForDepPara("settings_compact_layout_pqs", "settings_fav_proz_pqs"); setEvForDepPara("settings_compact_layout_pqs", "settings_open_tabs_pqs"); setEvForDepPara("settings_compact_layout_recviewed", "settings_fav_proz_recviewed"); setEvForDepPara("settings_show_elevation_of_waypoints","settings_primary_elevation_service"); setEvForDepPara("settings_show_elevation_of_waypoints","settings_secondary_elevation_service"); setEvForDepPara("settings_show_elevation_of_waypointsX0","settings_primary_elevation_service"); setEvForDepPara("settings_show_elevation_of_waypointsX0","settings_secondary_elevation_service"); setEvForDepPara("settings_show_gpsvisualizer_link","settings_show_gpsvisualizer_gcsymbols"); setEvForDepPara("settings_show_gpsvisualizer_link","settings_show_gpsvisualizer_typedesc"); setEvForDepPara("settings_show_openrouteservice_link","settings_show_openrouteservice_home"); setEvForDepPara("settings_show_openrouteservice_link","settings_show_openrouteservice_medium"); setEvForDepPara("settings_show_log_counter_but","settings_show_log_counter"); setEvForDepPara("settings_show_remove_ignoring_link","settings_use_one_click_ignoring"); setEvForDepPara("settings_set_showUnpublishedHides_sort","settings_showUnpublishedHides_sort"); setEvForDepPara("settings_showUnpublishedHides","settings_set_showUnpublishedHides_sort"); setEvForDepPara("settings_showUnpublishedHides","settings_showUnpublishedHides_sort"); setEvForDepPara("settings_lists_disabled","settings_lists_disabled_color"); setEvForDepPara("settings_lists_disabled","restore_settings_lists_disabled_color"); setEvForDepPara("settings_lists_disabled","settings_lists_disabled_strikethrough"); setEvForDepPara("settings_lists_archived","settings_lists_archived_color"); setEvForDepPara("settings_lists_archived","restore_settings_lists_archived_color"); setEvForDepPara("settings_lists_archived","settings_lists_archived_strikethrough"); setEvForDepPara("settings_lists_icons_visible","settings_lists_log_status_icons_visible"); setEvForDepPara("settings_lists_icons_visible","settings_lists_cache_type_icons_visible"); setEvForDepPara("settings_searchmap_disabled","settings_searchmap_disabled_strikethrough"); setEvForDepPara("settings_searchmap_disabled","settings_searchmap_disabled_color"); setEvForDepPara("settings_searchmap_disabled","restore_settings_searchmap_disabled_color"); setEvForDepPara("settings_show_copydata_menu","settings_show_copydata_own_stuff_show"); setEvForDepPara("settings_show_copydata_menu","settings_show_copydata_plus"); setEvForDepPara("settings_show_copydata_menu","settings_show_copydata_separator"); setEvForDepPara("settings_show_copydata_menu","restore_settings_show_copydata_separator"); setEvForDepPara("settings_show_copydata_plus","settings_show_copydata_separator"); setEvForDepPara("settings_show_copydata_plus","restore_settings_show_copydata_separator"); setEvForDepPara("settings_show_copydata_menu","settings_show_copydata_own_stuff_name"); setEvForDepPara("settings_show_copydata_menu","restore_settings_show_copydata_own_stuff_name"); setEvForDepPara("settings_show_copydata_menu","settings_show_copydata_own_stuff_value"); setEvForDepPara("settings_show_copydata_menu","restore_settings_show_copydata_own_stuff_value"); setEvForDepPara("settings_show_copydata_own_stuff_show","settings_show_copydata_own_stuff_name"); setEvForDepPara("settings_show_copydata_own_stuff_show","restore_settings_show_copydata_own_stuff_name"); setEvForDepPara("settings_show_copydata_own_stuff_show","settings_show_copydata_own_stuff_value"); setEvForDepPara("settings_show_copydata_own_stuff_show","restore_settings_show_copydata_own_stuff_value"); setEvForDepPara("settings_lists_show_dd","settings_lists_hide_desc"); setEvForDepPara("settings_lists_show_dd","settings_lists_upload_file"); setEvForDepPara("settings_lists_show_dd","settings_lists_open_tabs"); setEvForDepPara("settings_autovisit","settings_autovisit_default"); setEvForDepPara("settings_map_overview_browse_map_icon", "settings_map_overview_browse_map_icon_new_tab"); setEvForDepPara("settings_map_overview_search_map_icon", "settings_map_overview_search_map_icon_new_tab"); setEvForDepPara("settings_map_show_btn_hide_header","settings_hide_map_header"); setEvForDepPara("settings_searchmap_show_btn_save_as_pq","settings_save_as_pq_set_all"); setEvForDepPara("settings_show_enhanced_map_popup","settings_show_latest_logs_symbols_count_map"); setEvForDepPara("settings_show_enhanced_map_popup","settings_show_country_in_place"); setEvForDepPara("settings_show_enhanced_map_popup","settings_show_enhanced_map_coords"); setEvForDepPara("settings_modify_new_drafts_page", "settings_drafts_cache_link"); setEvForDepPara("settings_modify_new_drafts_page", "settings_drafts_cache_link_new_tab"); setEvForDepPara("settings_modify_new_drafts_page", "settings_drafts_color_visited_link"); setEvForDepPara("settings_modify_new_drafts_page", "settings_drafts_old_log_form"); setEvForDepPara("settings_modify_new_drafts_page", "settings_drafts_log_icons"); setEvForDepPara("settings_drafts_cache_link", "settings_drafts_cache_link_new_tab"); // Abhängigkeiten der Linklist Parameter. for (var i = 0; i < 100; i++) { // 2. Spalte: Links für Custom BMs. if (document.getElementById("gclh_LinkListElement_" + i)) { setEvForDepPara("settings_bookmarks_on_top", "gclh_LinkListElement_" + i, false); setEvForDepPara("settings_bookmarks_show", "gclh_LinkListElement_" + i, false); } if (document.getElementById("settings_custom_bookmark[" + i + "]")) { setEvForDepPara("settings_bookmarks_on_top", "settings_custom_bookmark[" + i + "]", false); setEvForDepPara("settings_bookmarks_show", "settings_custom_bookmark[" + i + "]", false); } // 3. Spalte: Target für Links für Custom BMs. if (document.getElementById("settings_custom_bookmark_target[" + i + "]")) { setEvForDepPara("settings_bookmarks_on_top", "settings_custom_bookmark_target[" + i + "]", false); setEvForDepPara("settings_bookmarks_show", "settings_custom_bookmark_target[" + i + "]", false); } // 4. Spalte: Bezeichnungen. if (document.getElementById("bookmarks_name[" + i + "]")) { setEvForDepPara("settings_bookmarks_on_top", "bookmarks_name[" + i + "]", false); setEvForDepPara("settings_bookmarks_show", "bookmarks_name[" + i + "]", false); } else break; } // 5. Spalte: Linklist. setEvForDepPara("settings_bookmarks_on_top", "gclh_LinkListTop", false); setEvForDepPara("settings_bookmarks_show", "gclh_LinkListTop", false); // Anfangsbesetzung herstellen bei Abhängigkeiten. setStartForDepPara(); // Save, Close Buttons dynamisch mit F2 bzw. ESC Beschriftung versehen. $('#settings_f2_save_gclh_config')[0].addEventListener("click", setValueInSaveButton, false); $('#settings_esc_close_gclh_config')[0].addEventListener("click", setValueInCloseButton, false); // Positionierung innerhalb des GClh Config bei Aufrufen. if (document.location.href.match(/#a#/i)) { document.location.href = document.location.href.replace(/#a#/i, "#"); var diff = 4; if (document.location.href.match(/#llb#/i)) { if (document.getElementById('settings_bookmarks_top_menu').checked) diff += 141 - 6; else diff += 165 - 25; } if (document.location.href.match(/#(ll|llb)#/i)) { document.location.href = document.location.href.replace(/#(ll|llb)#/i, "#"); gclh_show_linklist(); } if (document.location.href.match(/#(\S+)/)) { var arg = document.location.href.match(/#(.*)/); if (arg) { document.location.href = clearUrlAppendix(document.location.href, false); $('html,body').animate({scrollTop: ($('#'+arg[1]).offset().top) - diff}, 1500, "swing"); } } } } if ($('.hover.open')[0]) $('.hover.open')[0].className = ""; // Save by pressing the F2 key or by pressing the Ctrl+s keys together. Close by pressing the ESC key. if (check_config_page()) window.addEventListener('keydown', keydown, true); function keydown(e) { if (check_config_page()) { if ($('#settings_f2_save_gclh_config')[0].checked && !global_mod_reset) { if (e.keyCode == 113 && noSpecialKey(e)) $('#btn_save')[0].click(); if (e.keyCode == 83 && e.ctrlKey == true && e.altKey == false && e.shiftKey == false) { e.preventDefault(); $('#btn_save')[0].click(); } } if ($('#settings_esc_close_gclh_config')[0].checked && !global_mod_reset) { if (e.keyCode == 27 && noSpecialKey(e)) $('#btn_close2')[0].click(); } } } // Save Button. function btnSave(type) { window.scroll(0, 0); $("#settings_overlay").fadeOut(300); document.location.href = clearUrlAppendix(document.location.href, false); if ($('#settings_show_save_message')[0].checked) showSaveForm(); var settings = {}; function setValue(key, value) {settings[key] = value;} var value = document.getElementById("settings_home_lat_lng").value; var latlng = toDec(value); if (latlng) { if (getValue("home_lat", 0) != parseInt(latlng[0] * 10000000)) setValue("home_lat", parseInt(latlng[0] * 10000000)); // * 10000000 because GM don't know float. if (getValue("home_lng", 0) != parseInt(latlng[1] * 10000000)) setValue("home_lng", parseInt(latlng[1] * 10000000)); } setValue("settings_bookmarks_search_default", document.getElementById('settings_bookmarks_search_default').value); settings_show_all_logs_count = document.getElementById('settings_show_all_logs_count').value; setValue("settings_show_all_logs_count", countOfLogsInListing()); // Homezone circle. setValue("settings_homezone_radius", document.getElementById('settings_homezone_radius').value); setValue("settings_homezone_color", document.getElementById('settings_homezone_color').value.replace("#","")); if (document.getElementById('settings_homezone_opacity').value <= 100 && document.getElementById('settings_homezone_opacity').value >= 0) setValue("settings_homezone_opacity", document.getElementById('settings_homezone_opacity').value); // Multi homezone circles. var settings_multi_homezone = {}; var $hzelements = $('.multi_homezone_element'); for (var i = 0; i < $hzelements.length; i++) { var $curEl = $hzelements.eq(i); settings_multi_homezone[i] = {}; var latlng = toDec($curEl.find('.coords:eq(0)').val()); settings_multi_homezone[i].lat = parseInt(latlng[0] * 10000000); settings_multi_homezone[i].lng = parseInt(latlng[1] * 10000000); settings_multi_homezone[i].radius = $curEl.find('.radius:eq(0)').val(); settings_multi_homezone[i].color = $curEl.find('.color:eq(0)').val().replace("#",""); settings_multi_homezone[i].opacity = $curEl.find('.opacity:eq(0)').val(); } setValue("settings_multi_homezone", JSON.stringify(settings_multi_homezone)); // Own entries in copy data to clipboard menu. var settings_show_copydata_own_stuff = setDataCff('cdos'); setValue("settings_show_copydata_own_stuff", JSON.stringify(settings_show_copydata_own_stuff)); setValue("settings_new_width", document.getElementById('settings_new_width').value); setValue("settings_default_logtype", document.getElementById('settings_default_logtype').value); setValue("settings_default_logtype_event", document.getElementById('settings_default_logtype_event').value); setValue("settings_default_logtype_owner", document.getElementById('settings_default_logtype_owner').value); setValue("settings_default_tb_logtype", document.getElementById('settings_default_tb_logtype').value); setValue("settings_mail_signature", document.getElementById('settings_mail_signature').value.replace(/‌/g, "")); // Entfernt Steuerzeichen. setValue("settings_log_signature", document.getElementById('settings_log_signature').value.replace(/‌/g, "")); setValue("settings_tb_signature", document.getElementById('settings_tb_signature').value.replace(/‌/g, "")); setValue("settings_map_default_layer", settings_map_default_layer); setValue("settings_hover_image_max_size", document.getElementById('settings_hover_image_max_size').value); setValue("settings_spoiler_strings", document.getElementById('settings_spoiler_strings').value); setValue("settings_font_size_menu", document.getElementById('settings_font_size_menu').value); setValue("settings_font_size_submenu", document.getElementById('settings_font_size_submenu').value); setValue("settings_distance_menu", document.getElementById('settings_distance_menu').value); setValue("settings_distance_submenu", document.getElementById('settings_distance_submenu').value); setValue("settings_font_color_menu", document.getElementById('settings_font_color_menu').value.replace("#","")); setValue("settings_font_color_submenu", document.getElementById('settings_font_color_submenu').value.replace("#","")); setValue("settings_menu_number_of_lines", document.getElementById('settings_menu_number_of_lines').value); setValue("settings_lines_color_zebra", document.getElementById('settings_lines_color_zebra').value.replace("#","")); setValue("settings_lines_color_user", document.getElementById('settings_lines_color_user').value.replace("#","")); setValue("settings_lines_color_owner", document.getElementById('settings_lines_color_owner').value.replace("#","")); setValue("settings_lines_color_reviewer", document.getElementById('settings_lines_color_reviewer').value.replace("#","")); setValue("settings_lines_color_vip", document.getElementById('settings_lines_color_vip').value.replace("#","")); setValue("settings_map_overview_zoom", document.getElementById('settings_map_overview_zoom').value); setValue("settings_map_overview_layer", document.getElementById('settings_map_overview_layer').value); setValue("settings_count_own_matrix_show_count_next", document.getElementById('settings_count_own_matrix_show_count_next').value); setValue("settings_count_own_matrix_show_color_next", document.getElementById('settings_count_own_matrix_show_color_next').value.replace("#","")); setValue("settings_count_own_matrix_links_radius", document.getElementById('settings_count_own_matrix_links_radius').value); setValue("settings_count_own_matrix_links", document.getElementById('settings_count_own_matrix_links').value); setValue("settings_show_latest_logs_symbols_count", document.getElementById('settings_show_latest_logs_symbols_count').value); setValue("settings_default_langu", document.getElementById('settings_default_langu').value); setValue("settings_log_statistic_reload", document.getElementById('settings_log_statistic_reload').value); setValue("settings_pq_cachestotal", document.getElementById('settings_pq_cachestotal').value); setValue("settings_pq_difficulty", document.getElementById('settings_pq_difficulty').value); setValue("settings_pq_difficulty_score", document.getElementById('settings_pq_difficulty_score').value); setValue("settings_pq_terrain", document.getElementById('settings_pq_terrain').value); setValue("settings_pq_terrain_score", document.getElementById('settings_pq_terrain_score').value); setValue("settings_pq_previewmap_layer", document.getElementById('settings_pq_previewmap_layer').value); setValue("settings_improve_add_to_list_height", document.getElementById('settings_improve_add_to_list_height').value); setValue("settings_primary_elevation_service", document.getElementById('settings_primary_elevation_service').value); setValue("settings_secondary_elevation_service", document.getElementById('settings_secondary_elevation_service').value); setValue("settings_show_latest_logs_symbols_count_map", document.getElementById('settings_show_latest_logs_symbols_count_map').value); setValue("settings_show_openrouteservice_medium", document.getElementById('settings_show_openrouteservice_medium').value); setValue("settings_showUnpublishedHides_sort", document.getElementById('settings_showUnpublishedHides_sort').value); setValue("settings_lists_disabled_color", document.getElementById('settings_lists_disabled_color').value.replace("#","")); setValue("settings_lists_archived_color", document.getElementById('settings_lists_archived_color').value.replace("#","")); setValue("settings_searchmap_disabled_color", document.getElementById('settings_searchmap_disabled_color').value.replace("#","")); setValue("settings_show_copydata_own_stuff_name", document.getElementById('settings_show_copydata_own_stuff_name').value); setValue("settings_show_copydata_own_stuff_value", document.getElementById('settings_show_copydata_own_stuff_value').value); setValue("settings_show_copydata_separator", document.getElementById('settings_show_copydata_separator').value); setValue("settings_cache_notes_min_size", document.getElementById('settings_cache_notes_min_size').value); setValue("settings_color_bg", document.getElementById('settings_color_bg').value.replace("#","")); setValue("settings_color_ht", document.getElementById('settings_color_ht').value.replace("#","")); setValue("settings_color_if", document.getElementById('settings_color_if').value.replace("#","")); setValue("settings_color_bu", document.getElementById('settings_color_bu').value.replace("#","")); setValue("settings_color_bh", document.getElementById('settings_color_bh').value.replace("#","")); setValue("settings_color_bo", document.getElementById('settings_color_bo').value.replace("#","")); setValue("settings_color_nv", document.getElementById('settings_color_nv').value.replace("#","")); // Map Layers in vorgegebener Reihenfolge übernehmen. var new_map_layers_available = document.getElementById('settings_maplayers_available'); var new_settings_map_layers = new Array(); for (name in all_map_layers) { for (var i = 0; i < new_map_layers_available.options.length; i++) { if (name == new_map_layers_available.options[i].value) { new_settings_map_layers.push(new_map_layers_available.options[i].value); break; } } } setValue('settings_map_layers', new_settings_map_layers.join("###")); // Checkboxes übernehmen. var checkboxes = new Array( 'settings_submit_log_button', 'settings_log_inline', 'settings_log_inline_pmo4basic', 'settings_log_inline_tb', 'settings_bookmarks_show', 'settings_bookmarks_on_top', 'settings_change_header_layout', 'settings_fixed_header_layout', 'settings_remove_logo', 'settings_remove_message_in_header', 'settings_bookmarks_search', 'settings_redirect_to_map', 'settings_hide_facebook', 'settings_hide_socialshare', 'settings_hide_disclaimer', 'settings_hide_cache_notes', 'settings_hide_empty_cache_notes', 'settings_adapt_height_cache_notes', 'settings_show_all_logs', 'settings_decrypt_hint', 'settings_visitCount_geocheckerCom', 'settings_show_bbcode', 'settings_show_eventday', 'settings_show_mail', 'settings_gc_tour_is_working', 'settings_show_smaller_gc_link', 'settings_menu_show_separator', 'settings_menu_float_right', 'settings_show_message', 'settings_show_remove_ignoring_link', 'settings_use_one_click_ignoring', 'settings_show_common_lists_in_zebra', 'settings_show_common_lists_color_user', 'settings_show_cache_listings_in_zebra', 'settings_show_cache_listings_color_user', 'settings_show_cache_listings_color_owner', 'settings_show_cache_listings_color_reviewer', 'settings_show_cache_listings_color_vip', 'settings_show_tb_listings_in_zebra', 'settings_show_tb_listings_color_user', 'settings_show_tb_listings_color_owner', 'settings_show_tb_listings_color_reviewer', 'settings_show_tb_listings_color_vip', 'settings_show_mail_in_allmyvips', 'settings_show_mail_in_viplist', 'settings_process_vup', 'settings_show_vup_friends', 'settings_vup_hide_avatar', 'settings_vup_hide_log', 'settings_f2_save_gclh_config', 'settings_esc_close_gclh_config', 'settings_f4_call_gclh_config', 'settings_call_config_via_sriptmanager', 'settings_f10_call_gclh_sync', 'settings_call_sync_via_sriptmanager', 'settings_show_sums_in_bookmark_lists', 'settings_show_sums_in_watchlist', 'settings_hide_warning_message', 'settings_show_save_message', 'settings_map_overview_build', 'settings_logit_for_basic_in_pmo', 'settings_log_statistic', 'settings_log_statistic_percentage', 'settings_count_own_matrix', 'settings_count_foreign_matrix', 'settings_count_own_matrix_show_next', 'settings_hide_left_sidebar_on_google_maps', 'settings_add_link_gc_map_on_google_maps', 'settings_switch_from_google_maps_to_gc_map_in_same_tab', 'settings_add_link_new_gc_map_on_google_maps', 'settings_switch_from_google_maps_to_new_gc_map_in_same_tab', 'settings_add_link_google_maps_on_gc_map', 'settings_switch_to_google_maps_in_same_tab', 'settings_add_link_gc_map_on_osm', 'settings_switch_from_osm_to_gc_map_in_same_tab', 'settings_add_link_new_gc_map_on_osm', 'settings_switch_from_osm_to_new_gc_map_in_same_tab', 'settings_add_link_osm_on_gc_map', 'settings_switch_to_osm_in_same_tab', 'settings_add_link_flopps_on_gc_map', 'settings_switch_to_flopps_in_same_tab', 'settings_add_link_geohack_on_gc_map', 'settings_switch_to_geohack_in_same_tab', 'settings_sort_default_bookmarks', 'settings_make_vip_lists_hideable', 'settings_show_latest_logs_symbols', 'settings_set_default_langu', 'settings_hide_colored_versions', 'settings_make_config_main_areas_hideable', 'settings_faster_profile_trackables', 'settings_show_google_maps', 'settings_show_log_it', 'settings_show_nearestuser_profil_link', 'settings_show_homezone', 'settings_show_hillshadow', 'remove_navi_play', 'remove_navi_community', 'remove_navi_shop', 'settings_bookmarks_top_menu', 'settings_hide_advert_link', 'settings_hide_spoilerwarning', 'settings_hide_top_button', 'settings_hide_hint', 'settings_strike_archived', 'settings_highlight_usercoords', 'settings_highlight_usercoords_bb', 'settings_highlight_usercoords_it', 'settings_map_hide_found', 'settings_map_hide_hidden', 'settings_map_hide_dnfs', 'settings_map_hide_2', 'settings_map_hide_9', 'settings_map_hide_5', 'settings_map_hide_3', 'settings_map_hide_6', 'settings_map_hide_453', 'settings_map_hide_7005', 'settings_map_hide_13', 'settings_map_hide_1304', 'settings_map_hide_4', 'settings_map_hide_11', 'settings_map_hide_137', 'settings_map_hide_8', 'settings_map_hide_1858', 'settings_show_fav_percentage', 'settings_show_vip_list', 'settings_show_owner_vip_list', 'settings_autovisit', 'settings_autovisit_default', 'settings_show_thumbnails', 'settings_imgcaption_on_top', 'settings_hide_avatar', 'settings_link_big_listing', 'settings_show_big_gallery', 'settings_automatic_friend_reset', 'settings_show_long_vip', 'settings_load_logs_with_gclh', 'settings_hide_map_header', 'settings_replace_log_by_last_log', 'settings_show_real_owner', 'settings_hide_archived_in_owned', 'settings_show_button_for_hide_archived', 'settings_hide_visits_in_profile', 'settings_log_signature_on_fieldnotes', 'settings_vip_show_nofound', 'settings_use_gclh_layercontrol', 'settings_fixed_pq_header', 'settings_sync_autoImport', 'settings_map_hide_sidebar', 'settings_friendlist_summary', 'settings_friendlist_summary_viponly', 'settings_search_enable_user_defined', 'settings_pq_warning', 'settings_pq_set_cachestotal', 'settings_pq_option_ihaventfound', 'settings_pq_option_idontown', 'settings_pq_option_ignorelist', 'settings_pq_option_isenabled', 'settings_pq_option_filename', 'settings_pq_set_difficulty', 'settings_pq_set_terrain', 'settings_pq_automatically_day', 'settings_pq_previewmap', 'settings_mail_icon_new_win', 'settings_message_icon_new_win', 'settings_hide_cache_approvals', 'settings_driving_direction_link', 'settings_driving_direction_parking_area', 'settings_show_elevation_of_waypoints', 'settings_img_warning', 'settings_remove_banner', 'settings_remove_banner_for_garminexpress', 'settings_remove_banner_blue', 'settings_compact_layout_bm_lists', 'settings_compact_layout_pqs', 'settings_compact_layout_list_of_pqs', 'settings_compact_layout_nearest', 'settings_compact_layout_recviewed', 'settings_map_links_statistic', 'settings_map_percentage_statistic', 'settings_improve_add_to_list', 'settings_show_flopps_link', 'settings_show_brouter_link', 'settings_show_gpsvisualizer_link', 'settings_show_gpsvisualizer_gcsymbols', 'settings_show_gpsvisualizer_typedesc', 'settings_show_openrouteservice_link', 'settings_show_openrouteservice_home', 'settings_show_copydata_menu', 'settings_show_copydata_plus', 'settings_show_copydata_own_stuff_show', 'settings_show_default_links', 'settings_bm_changed_and_go', 'settings_bml_changed_and_go', 'settings_show_tb_inv', 'settings_but_search_map', 'settings_but_search_map_new_tab', 'settings_show_pseudo_as_owner', 'settings_fav_proz_nearest', 'settings_open_tabs_nearest', 'settings_fav_proz_pqs', 'settings_open_tabs_pqs', 'settings_fav_proz_recviewed', 'settings_show_all_logs_but', 'settings_show_log_counter_but', 'settings_show_log_counter', 'settings_show_bigger_avatars_but', 'settings_hide_feedback_icon', 'settings_compact_layout_new_dashboard', 'settings_show_draft_indicator', 'settings_show_enhanced_map_popup', 'settings_show_enhanced_map_coords', 'settings_modify_new_drafts_page', 'settings_gclherror_alert', 'settings_auto_open_tb_inventory_list', 'settings_embedded_smartlink_ignorelist', 'settings_both_tabs_list_of_pqs_one_page', 'settings_past_events_on_bm', 'settings_show_log_totals', 'settings_show_reviewer_as_vip', 'settings_hide_found_count', 'settings_show_compact_logbook_but', 'settings_log_status_icon_visible', 'settings_cache_type_icon_visible', 'settings_showUnpublishedHides', 'settings_set_showUnpublishedHides_sort', 'settings_lists_compact_layout', 'settings_lists_disabled', 'settings_lists_disabled_strikethrough', 'settings_lists_archived', 'settings_lists_archived_strikethrough', 'settings_lists_icons_visible', 'settings_lists_log_status_icons_visible', 'settings_lists_cache_type_icons_visible', 'settings_lists_premium_column', 'settings_lists_found_column_bml', 'settings_lists_show_log_it', 'settings_lists_back_to_top', 'settings_searchmap_autoupdate_after_dragging', 'settings_improve_character_counter', 'settings_searchmap_compact_layout', 'settings_searchmap_disabled', 'settings_searchmap_disabled_strikethrough', 'settings_searchmap_show_hint', 'settings_relocate_other_map_buttons', 'settings_show_radius_on_flopps', 'settings_show_edit_links_for_logs', 'settings_lists_show_dd', 'settings_lists_hide_desc', 'settings_lists_upload_file', 'settings_lists_open_tabs', 'settings_profile_old_links', 'settings_listing_old_links', 'settings_searchmap_show_btn_save_as_pq', 'settings_save_as_pq_set_all', 'settings_map_overview_browse_map_icon', 'settings_map_overview_search_map_icon', 'settings_show_link_to_browse_map', 'settings_show_hide_upvotes_but', 'settings_hide_upvotes', 'settings_smaller_upvotes_icons', 'settings_no_wiggle_upvotes_click', 'settings_show_country_in_place', 'settings_test_log_console', 'settings_map_overview_browse_map_icon_new_tab', 'settings_map_overview_search_map_icon_new_tab', 'settings_color_navi_search', 'settings_map_show_btn_hide_header', 'settings_compact_layout_cod', 'settings_show_button_fav_proz_cod', 'settings_change_font_cache_notes', 'settings_larger_map_as_browse_map', 'settings_fav_proz_cod', 'settings_logs_old_fashioned', 'settings_prevent_watchclick_popup', 'settings_upgrade_button_header_remove', 'settings_unsaved_log_message', 'settings_sort_map_layers', 'settings_add_search_in_logs_func', 'settings_show_add_cache_info_in_log_page', 'settings_show_create_pq_from_pq_splitter', 'settings_drafts_cache_link', 'settings_drafts_color_visited_link', 'settings_drafts_cache_link_new_tab', 'settings_drafts_old_log_form', 'settings_drafts_log_icons', 'settings_drafts_go_automatic_back', 'settings_listing_hide_external_link_warning', 'settings_listing_links_new_tab', ); for (var i = 0; i < checkboxes.length; i++) { if (document.getElementById(checkboxes[i])) setValue(checkboxes[i], document.getElementById(checkboxes[i]).checked); } // Save Log-Templates. for (var i = 0; i < anzTemplates; i++) { var name = document.getElementById('settings_log_template_name[' + i + ']'); var text = document.getElementById('settings_log_template[' + i + ']'); if (name && text) { setValue('settings_log_template_name[' + i + ']', name.value); setValue('settings_log_template[' + i + ']', text.value.replace(/‌/g, "")); // Entfernt das Steuerzeichen. } } // Save Linklist Rechte Spalte. var queue = $("#gclh_LinkListTop tr:not(.gclh_LinkListPlaceHolder)"); var tmp = new Array(); for (var i = 0; i < queue.length; i++) {tmp[i] = queue[i].id.replace("gclh_LinkListTop_", "");} setValue("settings_bookmarks_list", JSON.stringify(tmp)); // Save Linklist Abweichende Bezeichnungen, 2. Spalte. for (var i = 0; i < bookmarks.length; i++) { if (document.getElementById('bookmarks_name[' + i + ']') && document.getElementById('bookmarks_name[' + i + ']') != "") { // Set custom name. setValue("settings_bookmarks_title[" + i + "]", document.getElementById('bookmarks_name[' + i + ']').value); } } // Save Linklist Custom Links, URL, target, linke Spalte. for (var i = 0; i < anzCustom; i++) { setValue("settings_custom_bookmark[" + i + "]", document.getElementById("settings_custom_bookmark[" + i + "]").value); if (document.getElementById('settings_custom_bookmark_target[' + i + ']').checked) setValue('settings_custom_bookmark_target[' + i + ']', "_blank"); else setValue('settings_custom_bookmark_target[' + i + ']', ""); } setValueSet(settings).done(function() { if (type === "upload") { gclh_sync_DB_CheckAndCreateClient() .done(function(){ gclh_sync_DBSave().done(function() { window.location.reload(false); }); }) .fail(function(){ alert('The GC little helper II is not authorized to use your Dropbox. Please go to the GClh II Sync and authenticate it for your Dropbox first. Nevertheless your configuration is saved localy.'); window.location.reload(false); }); } else window.location.reload(false); }); GM_setValue('test_log_console', getValue('settings_test_log_console', false)); if (getValue("settings_show_save_message")) { setTimeout(function() { $('#save_overlay_h3')[0].innerHTML = "saved"; $("#save_overlay").fadeOut(250); }, 150); } } } /////////////////////////////////// // 5.5.2 Config - Functions ($$cap) (Functions for GClh Config on the geocaching webpages.) /////////////////////////////////// // Highlight new parameters in GClh Config and set version info. var d = "
    "; var s = ""; //--> $$001 newParameterOn1 = d.replace("#", "06"); newParameterOn2 = d.replace("#", "10"); newParameterOn3 = d.replace("#", "03"); newParameterLL1 = s.replace("#", "06"); newParameterLL2 = s.replace("#", "10"); newParameterLL3 = s.replace("#", "03"); //<-- $$001 function newParameterVersionSetzen(version) { var newParameterVers = "" + version + ""; else newParameterVers += ">"; if (settings_hide_colored_versions) newParameterVers = ""; return newParameterVers; } newParameterOff = "
    "; function newParameterLLVersionSetzen(version) { var newParameterVers = '' + version + ''; else newParameterVers += '>'; if (settings_hide_colored_versions) newParameterVers = ""; return newParameterVers; } if (settings_hide_colored_versions) newParameterOn1 = newParameterOn2 = newParameterOn3 = newParameterLL1 = newParameterLL2 = newParameterLL3 = newParameterOff = ""; // Reload page. function reloadPage() { if (document.location.href.indexOf("#") == -1 || document.location.href.indexOf("#") == document.location.href.length - 1) { $('html, body').animate({scrollTop: 0}, 0); document.location.reload(true); } else document.location.replace(document.location.href.slice(0, document.location.href.indexOf("#"))); } // Radio Buttons zur Linklist. function handleRadioTopMenu(first) { if (first == true) { var time = 0; var timeShort = 0; } else { var time = 500; var timeShort = 450; } // Wenn Linklist nicht on top angezeigt wird, dann muss unbedingt vertikales Menü aktiv sein, falls nicht vertikales Menü setzen. if (!$('#settings_bookmarks_on_top')[0].checked && !$('#settings_bookmarks_top_menu')[0].checked) $('#settings_bookmarks_top_menu')[0].click(); if ($('#settings_bookmarks_top_menu')[0].checked) { if ($('#box_top_menu_v')[0].style.display != "block") { $('#box_top_menu_v').animate({height: "152px"}, time); $('#box_top_menu_v')[0].style.display = "block"; setTimeout(function() { $('#box_top_menu_h').animate({height: "0px"}, time); setTimeout(function() {$('#box_top_menu_h')[0].style.display = "none";}, timeShort); }, time); } } if ($('#settings_bookmarks_top_menu_h')[0].checked) { if ($('#box_top_menu_h')[0].style.display != "block") { $('#box_top_menu_h').animate({height: "188px"}, time); $('#box_top_menu_h')[0].style.display = "block"; setTimeout(function() { $('#box_top_menu_v').animate({height: "0px"}, time); setTimeout(function() {$('#box_top_menu_v')[0].style.display = "none";}, timeShort); }, time); } } } // Events setzen für Parameter, die im GClh Config mehrfach ausgegeben wurden, weil sie zu mehreren Themen gehören. Es handelt // sich hier um den Parameter selbst. In der Function werden Events für den Parameter selbst (ZB: "settings_show_vip_list") // und dessen Clone gesetzt, die hinten mit "X" und Nummerierung von 0-9 enden können (ZB: "settings_show_vip_listX0"). function setEvForDouPara(paraName, event) { var paId = paraName; if (document.getElementById(paId)) { document.getElementById(paId).addEventListener(event, function() {handleEvForDouPara(this);}, false); for (var i = 0; i < 10; i++) { var paIdX = paId + "X" + i; if (document.getElementById(paIdX)) { document.getElementById(paIdX).addEventListener(event, function() {handleEvForDouPara(this);}, false); } } } } // Handling von Events zu Parametern, die im GClh Config mehrfach ausgegeben wurden, weil sie zu mehreren Themen gehören. Es kann sich hier um den Parameter selbst // handeln (ZB: "settings_show_vip_list"), oder um dessen Clone, die hinten mit "X" und Nummerierung von 0-9 enden können (ZB: "settings_show_vip_listX0"). Hier wird // Wert des eventauslösenden Parameters, das kann auch Clone sein, an den eigentlichen Parameter und dessen Clone weitergereicht. function handleEvForDouPara(para) { var paId = para.id.replace(/(X[0-9]*)/, ""); if (document.getElementById(paId)) { if (document.getElementById(paId).type == "checkbox") { document.getElementById(paId).checked = para.checked; for (var i = 0; i < 10; i++) { var paIdX = paId + "X" + i; if (document.getElementById(paIdX)) document.getElementById(paIdX).checked = para.checked; } } else if (para.id.match(/_color_/)) { document.getElementById(paId).value = para.value; document.getElementById(paId).style.backgroundColor = "#" + para.value; document.getElementById(paId).style.color = para.style.color; for (var i = 0; i < 10; i++) { var paIdX = paId + "X" + i; if (document.getElementById(paIdX)) { document.getElementById(paIdX).value = para.value; document.getElementById(paIdX).style.backgroundColor = "#" + para.value; document.getElementById(paIdX).style.color = para.style.color; } } } else { document.getElementById(paId).value = para.value; for (var i = 0; i < 10; i++) { var paIdX = paId + "X" + i; if (document.getElementById(paIdX)) document.getElementById(paIdX).value = para.value; } } } } // Events setzen für Parameter, die im GClh Config eine Abhängigkeit derart auslösen, dass andere Parameter aktiviert bzw. // deaktiviert werden müssen. ZB. können Mail Icons in VIP List (Parameter "settings_show_mail_in_viplist") nur aufgebaut // werden, wenn die VIP Liste erzeugt wird (Parameter "settings_show_vip_list"). Clone müssen hier auch berücksichtigt werden. function setEvForDepPara(paraName, paraNameDep, allActivated) { var paId = paraName; var paIdDep = paraNameDep; var countDep = global_dependents.length; if (allActivated != false) allActivated = true; // Wenn Parameter und abhängiger Parameter existieren, dann für Parameter Event setzen, falls nicht vorhanden und Parameter, abhängigen Parameter merken. if (document.getElementById(paId) && document.getElementById(paIdDep)) { var available = false; for (var i = 0; i < countDep; i++) { if (global_dependents[i]["paId"] == paId) { available = true; break; } } if (available == false) { document.getElementById(paId).addEventListener("click", function() {handleEvForDepPara(this);}, false); } global_dependents[countDep] = new Object(); global_dependents[countDep]["paId"] = paId; global_dependents[countDep]["paIdDep"] = paIdDep; global_dependents[countDep]["allActivated"] = allActivated; // Alle möglichen Clone zum abhängigen Parameter suchen. for (var i = 0; i < 10; i++) { var paIdDepX = paIdDep + "X" + i; // Wenn Clone zum abhängigen Parameter existiert, dann Parameter und Clone zum abhängigen Parameter merken. if (document.getElementById(paIdDepX)) { countDep++; global_dependents[countDep] = new Object(); global_dependents[countDep]["paId"] = paId; global_dependents[countDep]["paIdDep"] = paIdDepX; global_dependents[countDep]["allActivated"] = allActivated; } else break; } } } // Anfangsbesetzung herstellen. function setStartForDepPara() { var countDep = global_dependents.length; var paIdCompare = ""; // Sort nach paId. global_dependents.sort(function(a, b){ if (a.paId < b.paId) return -1; if (a.paId > b.paId) return 1; return 0; }); var copy_global_dependents = global_dependents; for (var i = 0; i < countDep; i++) { if (paIdCompare != copy_global_dependents[i]["paId"]) { if (document.getElementById(copy_global_dependents[i]["paId"])) { var para = document.getElementById(copy_global_dependents[i]["paId"]); handleEvForDepPara(para); } paIdCompare = copy_global_dependents[i]["paId"]; } } } // Handling Events. function handleEvForDepPara(para) { var paId = para.id; var countDep = global_dependents.length; var copy_global_dependents = global_dependents; // Wenn Parameter existiert, dann im Array der abhängigen Parameter nachsehen, welche abhängigen Parameter es dazu gibt. if (document.getElementById(paId)) { for (var i = 0; i < countDep; i++) { if (global_dependents[i]["paId"] == paId) { // Wenn abhängige Parameter existiert. if (document.getElementById(global_dependents[i]["paIdDep"])) { // Wenn Parameter markiert, dann soll abhängiger Parameter aktiviert werden. Zuvor prüfen, ob alle Parameter zu diesem abhängigen Parameter aktiviert // werden sollen. Nur dann darf abhängiger Parameter aktiviert werden. (ZB: Abh. Parameter "settings_show_mail_in_viplist", ist von zwei Parametern abhängig. if (para.checked) { if (checkDisabledForDepPara(global_dependents[i]["paIdDep"])) { var activate = true; if (global_dependents[i]["allActivated"]) { for (var k = 0; k < countDep; k++) { if (copy_global_dependents[k]["paIdDep"] == global_dependents[i]["paIdDep"] && copy_global_dependents[k]["paId"] != global_dependents[i]["paId"]) { if (document.getElementById(copy_global_dependents[k]["paId"]) && document.getElementById(copy_global_dependents[k]["paId"]).checked); else { activate = false; break; } } } } if (activate) disableDepPara(global_dependents[i]["paIdDep"], false); } // Wenn Parameter nicht markiert, dann soll abhängiger Parameter deaktiviert werden. Zuvor prüfen, ob alle Parameter zu diesem abhängigen Parameter deaktiviert // werden sollen. Nur dann darf abhängiger Parameter deaktiviert werden. (ZB: Abhängiger Parameter Linklistparameter, sind von zwei Parametern abhängig.) } else { if (!checkDisabledForDepPara(global_dependents[i]["paIdDep"])) { var deactivate = true; if (global_dependents[i]["allActivated"] != true) { for (var k = 0; k < countDep; k++) { if (copy_global_dependents[k]["paIdDep"] == global_dependents[i]["paIdDep"] && copy_global_dependents[k]["paId"] != global_dependents[i]["paId"]) { if (document.getElementById(copy_global_dependents[k]["paId"]) && document.getElementById(copy_global_dependents[k]["paId"]).checked) { deactivate = false; break; } } } } if (deactivate) disableDepPara(global_dependents[i]["paIdDep"], true); } } } } } } } // Prüfen, ob disabled. function checkDisabledForDepPara(id) { var elem = document.getElementById(id); var elem$ = $("#"+id); if ((elem.disabled) || (elem$.hasClass("ui-droppable") && elem$.hasClass("ui-droppable-disabled")) || (elem$.hasClass("ui-draggable") && elem$.hasClass("ui-draggable-disabled"))) { return true; } else return false; } // Disabled setzen bzw. entfernen. function disableDepPara(id, set) { var elem = document.getElementById(id); var elem$ = $("#"+id); if (elem$.hasClass("ui-droppable")) { elem$.droppable("option", "disabled", set); elem$.sortable("option", "disabled", set); if (set == true) elem.parentNode.style.opacity = "0.5"; else elem.parentNode.style.opacity = "1"; } else if (elem$.hasClass("ui-draggable")) { elem$.draggable("option", "disabled", set); if (set == true) elem.parentNode.style.opacity = "0.5"; else elem.parentNode.style.opacity = "1"; } else { elem.disabled = set; if (set == true) elem.style.opacity = "0.5"; else elem.style.opacity = "1"; // Alle möglichen Clone zum abhängigen Parameter suchen und ebenfalls verarbeiten. for (var j = 0; j < 10; j++) { var paIdDepX = id + "X" + j; if (document.getElementById(paIdDepX)) { document.getElementById(paIdDepX).disabled = set; if (set == true) document.getElementById(paIdDepX).style.opacity = "0.5"; else document.getElementById(paIdDepX).style.opacity = "1"; } else break; } } } // Warnung, wenn Logs nicht durch GClh geladen werden sollen. function alert_settings_load_logs_with_gclh() { if (!document.getElementById("settings_load_logs_with_gclh").checked) { var mess = "If this option is disabled, there are no VIP-, VUP-, mail-, message- " + "and top icons, no line colors and no mouse activated big images " + "at the logs. Also the VIP and VUP lists, hide avatars, log filter and " + "log search and the latest logs won't work."; alert(mess); } } // Wenn VUPs im Config deaktiviert wird und es sind VUPs vorhanden, dann Confirm Meldung, dass die VUPs gelöscht werden. // Ansonsten können Konstellationen mit Usern entstehen, die gleichzeitig VIP und VUP sind. function alert_settings_process_vup() { if (!document.getElementById("settings_process_vup").checked && getValue("vups")) { var vups = getValue("vups"); vups = vups.replace(/, (?=,)/g, ",null"); vups = JSON.parse(vups); if (vups.length > 0) { var text = "You have " + vups.length + " VUPs (very unimportant persons) saved. If you disable this feature of VUP processing, the VUPs are deleted. Please note, it can not be revoked.\n\n" + "Click OK to delete the VUPs now and disable the feature."; if (window.confirm(text)) { var vups = new Array(); setValue("vups", JSON.stringify(vups)); } else { document.getElementById("settings_process_vup").checked = "checked"; } } } } // Feldinhalt auf default zurücksetzen. function restoreField() { if (document.getElementById(this.id).disabled) return; animateClick(this); var fieldId = this.id.replace(/restore_/, ""); var field = document.getElementById(fieldId); if (this.id.match(/_color/)) { field.value = "93B516"; field.style.color = "black"; if (fieldId == "settings_lines_color_zebra") field.value = "EBECED"; else if (fieldId == "settings_lines_color_user") field.value = "C2E0C3"; else if (fieldId == "settings_lines_color_owner") field.value = "E0E0C3"; else if (fieldId == "settings_lines_color_reviewer") field.value = "EAD0C3"; else if (fieldId == "settings_lines_color_vip") field.value = "F0F0A0"; else if (fieldId == "settings_lists_disabled_color") field.value = "4A4A4A"; else if (fieldId == "settings_lists_archived_color") field.value = "8C0B0B"; else if (fieldId == "settings_searchmap_disabled_color") field.value = "4A4A4A"; else if (fieldId == "settings_font_color_menu") restoreColor("settings_font_color_menuX0", "restore_settings_font_color_menuX0", field.value); else if (fieldId == "settings_font_color_menuX0") restoreColor("settings_font_color_menu", "restore_settings_font_color_menu", field.value); else if (fieldId == "settings_font_color_submenu") restoreColor("settings_font_color_submenuX0", "restore_settings_font_color_submenuX0", field.value); else if (fieldId == "settings_font_color_submenuX0") restoreColor("settings_font_color_submenu", "restore_settings_font_color_submenu", field.value); else if (fieldId == "settings_count_own_matrix_show_color_next") {field.value = "5151FB"; field.style.color = "white";} else if (fieldId.match(/settings_color_(bg|ht|if|bh|bu)/)) field.value = "D8CD9D"; else if (fieldId == "settings_color_bo") field.value = "778555"; else if (fieldId == "settings_color_nv") field.value = "F0DFC6"; field.style.backgroundColor = "#" + field.value; } else { if (fieldId == "settings_show_copydata_own_stuff_name") field.value = "Photo file name"; else if (fieldId == "settings_show_copydata_own_stuff_value") field.value = "#yyyy#.#mm#.#dd# - #GCName# - #GCCode# - 01"; else if (fieldId == "settings_show_copydata_separator") field.value = "\n"; $(field)[0].focus(); } } function restoreColor(p, r, v) { if ($('#'+r)[0] && $('#'+p)[0].value != v) $('#'+r)[0].click(); } // Bezeichnung Save, Close Button setzen. function setValueInSaveButton() { var cont = setValueInButton("Save", "(F2)", "settings_f2_save_gclh_config", "btn_save"); return cont; } function setValueInCloseButton() { var cont = setValueInButton("Close", "(ESC)", "settings_esc_close_gclh_config", "btn_close2"); return cont; } function setValueInButton(cont, fKey, para, butt) { if ($('#'+para)[0]) { // Nach Aufbau Config. if ($('#'+para)[0].checked) cont += " "+fKey; $('#'+butt)[0].setAttribute("value", cont); } else { // Vor Aufbau Config. if (getValue(para,"")) cont += " "+fKey; return cont; } } // Temporäry coloring of config, reset and thanks, to look what happens by click of the color and show buttons. function showColor(setButton, area) { $('#set_color_' + setButton)[0].addEventListener("click", function() { animateClick(this); var color = '#' + $('#' + this.id.replace('set', 'settings'))[0].value; if (area.match('hover')) { appendCssStyle(area + ' {background-color:' + color + ' !important;}'); } else { $(area).each(function() { var setcolor = color; if ($(this)[0].className && $(this)[0].className.match('gclh_new_para06')) setcolor = color + '99'; if ($(this)[0].className && $(this)[0].className.match('gclh_new_para03')) setcolor = color + '47'; $(this)[0].style.backgroundColor = setcolor; }); } if (setButton == 'bu') $('#set_color_bh').click(); }, false); } function showBorder(setButton, bostyle, area) { $('#set_color_' + setButton)[0].addEventListener("click", function() { animateClick(this); var color = '#' + $('#' + this.id.replace('set', 'settings'))[0].value; $(area).each(function() { $(this)[0].style.border = ' ' + bostyle + ' ' + color; }); }, false); } function tempConfigColoring() { showColor('bg', '.settings_overlay'); showColor('ht', 'a.gclh_info span'); showColor('if', '.gclh_content input[type="text"]:not(.color), .gclh_content textarea, .gclh_content select, .gclh_content pre'); showColor('bh', '.gclh_content button:hover, .gclh_content input[type="button"]:hover, .gclh_rc_content input[type="button"]:hover'); showColor('bu', '.gclh_content button, .gclh_content input[type="button"], .gclh_rc_content input[type="button"]'); showColor('bo', '.gclh_headline'); showColor('nv', '.gclh_new_para10, .gclh_new_para06, .gclh_new_para03'); showBorder('bo', '1.5px solid', '.settings_overlay, .gclh_headline, .gclh_content input, .gclh_content button, .gclh_content textarea, .gclh_content select, .gclh_content pre, .gclh_linklist_right'); showBorder('bo', '1px solid', 'a.gclh_info span, .gclh_rc_area, .gclh_thanks_area'); showBorder('bg', '2px solid', '.gclh_thanks_table'); } // Info gespeichert ausgeben. function showSaveForm() { if (document.getElementById('save_overlay')) { } else { var css = ""; css += "#save_overlay {width:560px; margin-left: 20px; overflow: auto; padding:10px; position: absolute; left:30%; top:70px; z-index:1004; border-radius: 10px;}"; css += "h3 {margin: 0;}"; appendCssStyle(css); var side = $('body')[0]; var html = "

    "; var div = document.createElement("div"); div.setAttribute("id", "save_overlay"); div.setAttribute("align", "center"); div.innerHTML = html; div.appendChild(document.createTextNode("")); side.appendChild(div); } $('#save_overlay_h3')[0].innerHTML = "save..."; $('#save_overlay')[0].style.display = ""; } // Änderungen an abweichenden Bezeichnungen in Spalte 2, in Value in Spalte 3 updaten. function updateByInputDescription() { // Ids ermitteln für linke und rechte Spalte. var idColLeft = this.id.replace("bookmarks_name[", "gclh_LinkListElement_").replace("]", ""); var idColRight = this.id.replace("bookmarks_name[", "gclh_LinkListTop_").replace("]", ""); // Bezeichnung ermitteln. if (this.value.match(/(\S+)/)) var description = this.value; else { if (document.getElementById(idColLeft).children[1].id.match("custom")) { var description = "Custom" + document.getElementById(idColLeft).children[1].id.replace("settings_custom_bookmark[", "").replace("]", ""); this.value = description; } else var description = document.getElementById(idColLeft).children[1].innerHTML; } // Update. if (document.getElementById(idColRight) && document.getElementById(idColRight).children[0].childNodes[2]) { document.getElementById(idColRight).children[0].childNodes[2].nodeValue = description; } } // Attribute ändern bei Mousedown, Mouseup in rechter Spalte, Move Icon und Bezeichnung. function changeAttrMouse(event, elem, obj) { if (event.type == "mousedown") elem.style.cursor = "grabbing"; else { if (obj == "move") elem.style.cursor = "grab"; else if (obj == "desc") elem.style.cursor = "unset"; } } // BM kennzeichnen wenn sie in Linklist ist. function flagBmInLl(tdBmEntry, doDragging, setCursor, setOpacity, setTitle) { if (doDragging) { tdBmEntry.style.cursor = setCursor; tdBmEntry.style.opacity = setOpacity; tdBmEntry.children[0].style.cursor = setCursor; tdBmEntry.children[0].style.opacity = setOpacity; tdBmEntry.children[1].style.cursor = setCursor; tdBmEntry.children[1].style.opacity = setOpacity; } else { tdBmEntry.children[0].style.cursor = setCursor; tdBmEntry.children[0].style.opacity = setOpacity; tdBmEntry.children[0].title = setTitle; } } // Sort Linklist. function sortBookmarksByDescription(sort, bm) { // BMs für Sortierung aufbereiten. Wird immer benötigt, auch wenn nicht sortiert wird. var cust = 0; for (var i = 0; i < bm.length; i++) { bm[i]['number'] = i; if (typeof(bm[i]['custom']) != "undefined" && bm[i]['custom'] == true) { bm[i]['origTitle'] = "Custom" + cust + ": " + bm[i]['title']; bm[i]['sortTitle'] = cust; cust++; } else { bm[i]['origTitle'] = bm[i]['sortTitle'] = (typeof(bookmarks_orig_title[i]) != "undefined" && bookmarks_orig_title[i] != "" ? bookmarks_orig_title[i] : bm[i]['title']); bm[i]['sortTitle'] = bm[i]['sortTitle'].toLowerCase().replace(/ä/g,"a").replace(/ö/g,"o").replace(/ü/g,"u").replace(/ß/g,"s"); } } // BMs nach sortTitle sortieren. if (sort) { bm.sort(function(a, b){ if ((typeof(a.custom) != "undefined" && a.custom == true) && !(typeof(b.custom) != "undefined" && b.custom == true)) { // a nach hinten, also a > b. return 1; } else if (!(typeof(a.custom) != "undefined" && a.custom == true) && (typeof(b.custom) != "undefined" && b.custom == true)) { // b nach hinten, also a < b. return -1; } if (a.sortTitle < b.sortTitle) return -1; if (a.sortTitle > b.sortTitle) return 1; return 0; }); } return bm; } // Show, hide all areas in config with one click of right mouse. function showHideConfigAll(show, id_lnk) { setShowHideConfig(show, "global"); setShowHideConfig(show, "config"); setShowHideConfig(show, "sync"); setShowHideConfig(show, "nearestlist"); setShowHideConfig(show, "pq"); setShowHideConfig(show, "bm"); setShowHideConfig(show, "recview"); setShowHideConfig(show, "friends"); setShowHideConfig(show, "hide"); setShowHideConfig(show, "others"); setShowHideConfig(show, "maps"); setShowHideConfig(show, "profile"); setShowHideConfig(show, "db"); setShowHideConfig(show, "listing"); setShowHideConfig(show, "draft"); setShowHideConfig(show, "logging"); setShowHideConfig(show, "mail"); setShowHideConfig(show, "linklist"); setShowHideConfig(show, "development"); if (show) { document.getElementById(id_lnk).scrollIntoView(); window.scrollBy(0, -9); } else window.scroll(0, 0); } // Show, hide area in config. function showHideConfig(show, configArea) { setShowHideConfig(show, configArea); var id_lnk = 'lnk_gclh_config_'+configArea; if (show) { document.getElementById(id_lnk).scrollIntoView(); window.scrollBy(0, -9); } } function setShowHideConfig(show, configArea) { var lnk = '#lnk_gclh_config_'+configArea; var content = '#gclh_config_'+configArea; if (show) { $(lnk)[0].closest('span').setAttribute('title', 'hide topic\n(all topics with right mouse)'); $(lnk).closest('h4').removeClass('gclh_hide'); $(content).show(); } else { $(lnk)[0].closest('span').setAttribute('title', 'show topic\n(all topics with right mouse)'); $(lnk).closest('h4').addClass('gclh_hide'); $(content).hide(); } setValue('show_box_gclh_config_'+configArea, show); } // Show config screen "thanks". function thanksShow() { if (document.getElementById('settings_overlay')) document.getElementById('settings_overlay').style.overflow = "hidden"; $('#gclh_config_content1').hide(); $('#gclh_config_content3').hide(); $('#gclh_config_content_thanks').show(600); } // Build line with user and contribution on config screen "thanks". function thanksLineBuild(gcname, ghname, proj, devl, dev, err, sepa) { return "" + "" + (gcname != "" ? ""+gcname+"" : ghname) + "" + thanksFlagBuild(proj) + thanksFlagBuild(devl) + thanksFlagBuild(dev) + thanksFlagBuild(err) + ""; } function thanksFlagBuild(flag) {return "";} // Functions to provide cff (checkbox, input field and textarea field). function openCff(ident, header, titleName, titleValue, depId) { var c = ''; c += "
    "; c += "
    " + header + "
    "; c += "
    "; return c; } function buildEntryCff(ident, cffData, idNr, nonArray, createAction) { var id = ident + '_#_' + idNr; var c = ''; if (createAction) { var div = document.createElement("div"); div.id = id.replace('#', 'element'); div.className = 'cff_element'; } else { c += "
    "; } c += ""; c += ""; if (nonArray) { c += ""; } c += ""; c += ""; if (!nonArray) { c += ""; } c += ""; c += "
    "; c += ""; if (nonArray) { c += ""; } c += "
    "; c += "
    "; if (createAction) { div.innerHTML = c; return div; } else { return c; } } function buildDoubleEditCff(ident, idNr) { var id = '#' + ident + '_main'; if ($(id + ' .cff_element')[0] && $(id + ' .cff_edit.first').length == 0) { var a = document.createElement("a"); a.className = 'cff_edit_double'; a.href = 'javascript:void(0);'; a.innerHTML += ""; a.innerHTML += ""; $(id + ' .cff_edit_delete')[0].after(a); a.addEventListener("click", function() { animateClick($(this).closest('a')[0]); var displayOrg = window.getComputedStyle($(this).closest('.cff_element').find('.cff_content')[0]).display; if (displayOrg == 'none') var displayNew = 'block'; else var displayNew = 'none'; $(this).closest('.cff_elements').find('.cff_content').each(function() { $(this)[0].style.display = displayNew; }); if (displayNew == 'block') $(this).closest('.cff_element').find('.cff_value')[0].focus(); }); } } function closeCff(ident) { var c = ''; c += "
    "; c += ""; c += "
    "; return c; } function cssCff(ident, blockRight, widthName, widthValue, heightValue) { var id = '#' + ident + '_main'; var css = ''; css += id + '{margin-left: ' + blockRight + 'px;}'; css += id + ' .cff_show {margin-left: 0px;}'; css += id + ' .cff_name {margin-top: 2px; margin-right: 12px; width: ' + widthName + 'px;}'; css += id + ' .cff_name_restore {margin-left: -12px;}'; css += id + ' a {cursor: default;}'; css += id + ' .cff_edit, ' + id + ' .cff_delete {margin-left: 4px; height: 16px; cursor: pointer; vertical-align: text-top; border: 0;}'; css += id + ' .cff_edit.first {margin-top: -2px; margin-left: 20px; height: 14px;}'; css += id + ' .cff_edit.last {margin-top: 3px; margin-left: -8px; height: 14px;}'; css += id + ' .cff_content {margin-left: 32px; margin-bottom: -2px; margin-top: 2px; display: none;}'; css += id + ' .cff_value {width: ' + widthValue + 'px; height: ' + heightValue + 'px;}'; css += id + ' .cff_create {margin-left: 0px; margin-top: 2px;}'; appendCssStyle(css, '', ident + '_main_css'); } function getLastIdNrCff(ident) { var id = '#' + ident + '_main'; if ($(id + ' .cff_element:last')[0]) { var idNr = $(id + ' .cff_element:last')[0].id.match(/(\d*)$/); if (idNr && idNr[1]) idNr = idNr[1]; } if (!idNr) var idNr = 0; idNr = parseInt(idNr); return idNr; } function buildDataCff(show, name, value) { var cffData = {}; cffData.show = show; cffData.name = name; cffData.value = value; return cffData; } function buildAroundCff(ident, cff) { $(cff).find('.cff_edit_delete .cff_edit')[0].addEventListener("click", function() { animateClick(this); $(this).closest('.cff_element').find('.cff_content').toggle(); if (window.getComputedStyle($(this).closest('.cff_element').find('.cff_content')[0]).display != 'none') { $(this).closest('.cff_element').find('.cff_value')[0].focus(); } }); if ($(cff).find('.cff_delete')[0]) { $(cff).find('.cff_delete')[0].addEventListener("click", function() { $(this).closest('.cff_element').remove(); buildDoubleEditCff(ident); }); } if ($(cff).find('.cff_show')[0].id.match('^'+ident)) { if ($(cff).closest('.cff_main').attr('data-depId')) { setEvForDepPara($(cff).closest('.cff_main').attr('data-depId'), $(cff).find('.cff_show')[0].id); setEvForDepPara($(cff).closest('.cff_main').attr('data-depId'), $(cff).find('.cff_name')[0].id); setEvForDepPara($(cff).closest('.cff_main').attr('data-depId'), $(cff).find('.cff_value')[0].id); } setEvForDepPara($(cff).find('.cff_show')[0].id, $(cff).find('.cff_name')[0].id); setEvForDepPara($(cff).find('.cff_show')[0].id, $(cff).find('.cff_value')[0].id); setStartForDepPara(); } $(cff).find('.cff_name').attr('title', $(cff).closest('.cff_main').attr('data-titleName')); $(cff).find('.cff_value').attr('title', $(cff).closest('.cff_main').attr('data-titleValue')); buildDoubleEditCff(ident); } function buildEventCreateCff(ident) { var id = '#' + ident + '_main'; $(id + ' .cff_create')[0].addEventListener("click", function() { var ident = $(this).closest('.cff_main')[0].id.replace('_main',''); var idNr = getLastIdNrCff(ident) + 1; var cffData = buildDataCff(true, idNr, ''); $(id + ' .cff_elements')[0].append(buildEntryCff(ident, cffData, idNr, false, true)); $(id + ' .cff_name:last')[0].focus(); buildAroundCff(ident, $(id + ' .cff_element:last')[0]); }); } function setDataCff(ident) { var cffElements = $('#' + ident + '_main .cff_element'); var settingsElements = {}; var count = 0; for (var i = 0; i < cffElements.length; i++) { if (!$(cffElements[i]).find('.cff_show')[0].id.match('^'+ident)) continue; if ($(cffElements[i]).find('.cff_name')[0].value.match(/^(\s*)$/) || $(cffElements[i]).find('.cff_value')[0].value.match(/^(\s*)$/)) continue; settingsElements[count] = {}; settingsElements[count].show = $(cffElements[i]).find('.cff_show')[0].checked; settingsElements[count].name = $(cffElements[i]).find('.cff_name')[0].value; settingsElements[count].value = $(cffElements[i]).find('.cff_value')[0].value; count++; } return settingsElements; } /////////////////////////////// // 5.5.3 Config - Reset ($$cap) (Functions for GClh Config Reset on the geocaching webpages.) /////////////////////////////// function rcPrepare() { global_mod_reset = true; if (document.getElementById('settings_overlay')) document.getElementById('settings_overlay').style.overflow = "hidden"; $('#gclh_config_content1').hide(); $('#gclh_config_content3').hide(); $('#gclh_config_content2').show(600); } function rcReset() { try { if (document.getElementById("rc_standard").checked || document.getElementById("rc_temp").checked) { if (!window.confirm("Click OK to reset the data. \nPlease note, this process can not be revoked.")) return; } if (document.getElementById("rc_doing")) document.getElementById("rc_doing").src = "/images/loading2.gif"; if (document.getElementById("rc_reset_button")) document.getElementById("rc_reset_button").disabled = true; if (document.getElementById("rc_homecoords").checked) { var keysDel = new Array(); keysDel[keysDel.length] = "home_lat"; keysDel[keysDel.length] = "home_lng"; rcConfigDataDel(keysDel); } if (document.getElementById("rc_uid").checked) { var keysDel = new Array(); keysDel[keysDel.length] = "uid"; rcConfigDataDel(keysDel); } if (document.getElementById("rc_standard").checked) { //--> $$004 rcGetData(urlConfigSt, "st"); //<-- $$004 } if (document.getElementById("rc_temp").checked) { rcGetData(urlScript, "js"); } } catch(e) {gclh_error("Reset config data",e);} } function rcGetData(url, name) { global_rc_data = global_rc_status = ""; GM_xmlhttpRequest({ method: "GET", url: url, onload: function(response) { global_rc_status = parseInt(response.status); global_rc_data = response.responseText; } }); function rcCheckDataLoad(waitCount, name) { if (global_rc_data == "" || global_rc_status != 200) { waitCount++; if (waitCount <= 25) setTimeout(function(){rcCheckDataLoad(waitCount, name);}, 200); else { alert("Can not load file with " + (name == "st" ? "standard configuration data":"script data") + ".\nNothing changed."); if (document.getElementById("rc_doing")) setTimeout(function(){document.getElementById("rc_doing").src = "";}, 500); } } else { if (name == "st") rcConfigDataChange(global_rc_data); if (name == "js") rcConfigDataNotInUseDel(global_rc_data); } } rcCheckDataLoad(0, name); } function rcConfigDataDel(data) { var config_tmp = {}; var changed = false; for (key in CONFIG) { var del = false; for (var i = 0; i < data.length; i++) { if (key == data[i]) { changed = true; del = true; document.getElementById('rc_configData').innerText += "delete: " + data[i] + ": " + CONFIG[key] + "\n"; break; } } if (!del) config_tmp[key] = CONFIG[key]; } CONFIG = config_tmp; rcConfigUpdate(changed); } function rcConfigDataChange(stData) { var data = JSON.parse(stData); var changed = false; var changedData = ""; for (key in data) { if (data[key] != CONFIG[key]) { changed = true; changedData += "change: " + key + ": " + CONFIG[key] + " -> " + data[key] + "\n"; CONFIG[key] = data[key]; } } document.getElementById('rc_configData').innerText += changedData; rcConfigUpdate(changed); } function rcConfigDataNotInUseDel(data) { var config_tmp = {}; var changed = false; var changedData = ""; for (key in CONFIG) { var kkey = key.split("["); var kkey = kkey[0]; //--> $$005 if (kkey.match(/^(show_box|set_switch)/) || kkey.match(/^gclh_(.*)(_logs_get_last|_logs_count)$/)) { config_tmp[key] = CONFIG[key]; //<-- $$005 } else if (kkey.match(/autovisit_(\d+)/) || kkey.match(/^(friends_founds_|friends_hides_)/) || kkey.match(/^(settings_DB_auth_token|new_version|class|token)$/)) { changed = true; changedData += "delete: " + key + ": " + CONFIG[key] + "\n"; } else if (data.match(kkey)) { config_tmp[key] = CONFIG[key]; } else { changed = true; changedData += "delete: " + key + ": " + CONFIG[key] + "\n"; } } //--> $$007 // Reset data outside of CONFIG. [changed, changedData] = rcNoConfigDataDel('clipboard', false, changed, changedData); //<-- $$007 document.getElementById('rc_configData').innerText = changedData; CONFIG = config_tmp; rcConfigUpdate(changed); } function rcNoConfigDataDel(dataName, dataNew, changed, changedData) { var data = GM_getValue(dataName); if (data != undefined && data != false) { changed = true; changedData += "delete: " + dataName + "\n"; GM_setValue(dataName, dataNew); } return [changed, changedData]; } function rcConfigUpdate(changed) { setTimeout(function(){ if (document.getElementById("rc_doing")) document.getElementById("rc_doing").src = ""; if (document.getElementById("rc_reset_button")) document.getElementById("rc_reset_button").disabled = false; }, 500); if (changed) { var defer = $.Deferred(); GM_setValue("CONFIG", JSON.stringify(CONFIG)); defer.resolve(); return defer.promise(); } else document.getElementById('rc_configData').innerText += "(nothing to change)\n"; } function rcClose() { window.scroll(0, 0); $("#settings_overlay").fadeOut(400); document.location.href = clearUrlAppendix(document.location.href, false); window.location.reload(false); } ////////////////////////////// // 5.5.4 Config - Sync ($$cap) (Functions for GClh Config Sync on the geocaching webpages.) ////////////////////////////// // Get/Set Config Data. function sync_getConfigData() { var data = {}; var value = null; for (key in CONFIG) { if (!gclhConfigKeysIgnoreForBackup[key]) { value = getValue(key, null); if (value != null) data[key] = value; } } return JSON.stringify(data, undefined, 2); } function sync_setConfigData(data) { var parsedData = JSON.parse(data); var settings = {}; for (key in parsedData) { if (!gclhConfigKeysIgnoreForBackup[key]) settings[key] = parsedData[key]; } setValueSet(settings).done(function() {}); } var dropbox_client = null; var dropbox_save_path = '/GCLittleHelperSettings.json'; // Dropbox auth token bereitstellen. (function(window){ window.utils = { parseQueryString: function(str) { try { var ret = Object.create(null); if (typeof str !== 'string') return ret; str = str.trim().replace(/^(\?|#|&)/, ''); if (!str) return ret; str.split('&').forEach(function(param) { var parts = param.replace(/\+/g, ' ').split('='); // Firefox (pre 40) decodes `%3D` to `=` (https://github.com/sindresorhus/query-string/pull/37) var key = parts.shift(); var val = parts.length > 0 ? parts.join('=') : undefined; key = decodeUnicodeURIComponent(key); // missing `=` should be `null`: (https://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters) val = val === undefined ? null : decodeUnicodeURIComponent(val); if (ret[key] === undefined) ret[key] = val; else if (Array.isArray(ret[key])) ret[key].push(val); else ret[key] = [ret[key], val]; }); return ret; } catch(e) {gclh_error("parseQueryString()",e)}; } }; })(window); // Save dropbox auth token if one is passed (from Dropbox). var DB_token = utils.parseQueryString(window.location.hash).access_token; var AppId = utils.parseQueryString(window.location.search).AppId; // Von Dropbox zurück, schaue ob Token von uns angefordert wurde. if (AppId == 'GClh') { if (DB_token) { // Gerade von DB zurück, also Show config. setValue('settings_DB_auth_token', DB_token); gclh_showSync(); document.getElementById('syncDBLabel').click(); } else { // Maybe the user denies Access (this is mostly an unwanted click), so show him, that he // has refused to give us access to his dropbox and that he can re-auth if he want to. error = utils.parseQueryString(window.location.hash).error_description; if (error) alert('We received the following error from dropbox: "' + error + '" If you think this is a mistake, you can try to re-authenticate in the GClh II Sync.'); } } // Created the Dropbox Client with the given auth token from config. function gclh_sync_DB_CheckAndCreateClient() { var deferred = $.Deferred(); token = getValue('settings_DB_auth_token'); if (token) { // Try to create an instance and test it with the current token dropbox_client = new Dropbox({accessToken: token}); dropbox_client.usersGetCurrentAccount() .then(function(response) { deferred.resolve(); }) .catch(function(error) { console.error('gclh_sync_DB_CheckAndCreateClient: Error while creating Dropbox Client:'); console.error(error); deferred.reject(); }); } else { // No token was given, user has to (re)auth GClh for dropbox dropbox_client = null; deferred.reject(); } return deferred.promise(); } // If the Dropbox Client could not be instantiated (because of wrong token, App deleted or not authenticated at all), this will show the Auth link. function gclh_sync_DB_showAuthLink() { var APP_ID = 'zp4u1zuvtzgin6g'; // If client could not created, try to get a new Auth token. Set the login anchors href using dropbox_client.getAuthenticationUrl() dropbox_auth_client = new Dropbox({clientId: APP_ID}); authlink = document.getElementById('authlink'); // Dropbox redirect URL and AppId. authlink.href = dropbox_auth_client.getAuthenticationUrl('https://www.geocaching.com/account/settings/profile?AppId=GClh'); $(authlink).show(); $('#btn_DBSave').hide(); $('#btn_DBLoad').hide(); $('#syncDBLoader').hide(); } // If the Dropbox Client is instantiated and the connection stands, this funciton shows the load and save buttons. function gclh_sync_DB_showSaveLoadLinks() { $('#btn_DBSave').show(); $('#btn_DBLoad').show(); $('#syncDBLoader').hide(); $('#authlink').hide(); } // Saves the current config to dropbox. function gclh_sync_DBSave() { var deferred = $.Deferred(); gclh_sync_DB_CheckAndCreateClient() .fail(function(){ // Should not be reached, because we checked the client earlier alert('Something went wrong. Please reload the page and try again.'); deferred.reject(); $('#syncDBLoader').hide(); return deferred.promise(); }); $('#syncDBLoader').show(); dropbox_client.filesUpload({ path: dropbox_save_path, contents: sync_getConfigData(), mode: 'overwrite', autorename: false, mute: false }) .then(function(response) { deferred.resolve(); $('#syncDBLoader').hide(); }) .catch(function(error) { console.error('gclh_sync_DBSave: Error while uploading config file:'); console.error(error); deferred.reject(); $('#syncDBLoader').hide(); }); return deferred.promise(); } // Loads the config from dropbox and replaces the current configuration with it. function gclh_sync_DBLoad() { var deferred = $.Deferred(); gclh_sync_DB_CheckAndCreateClient() .fail(function(){ // Should not be reached, because we checked the client earlier alert('Something went wrong. Please reload the page and try again.'); deferred.reject(); return deferred.promise(); }); $('#syncDBLoader').show(); dropbox_client.filesDownload({path: dropbox_save_path}) .then(function(data) { var blob = data.fileBlob; var reader = new FileReader(); reader.addEventListener("loadend", function() { sync_setConfigData(reader.result); deferred.resolve(); }); reader.readAsText(blob); $('#syncDBLoader').hide(); }) .catch(function(error) { console.error('gclh_sync_DBLoad: Error while downloading config file:'); console.error(error); deferred.reject(); $('#syncDBLoader').hide(); }); return deferred.promise(); } // Gets the hash of the saved config, so we can determine if we have to apply the config loaded from dropbox via autosync. function gclh_sync_DBHash() { var deferred = $.Deferred(); gclh_sync_DB_CheckAndCreateClient() .fail(function(){ deferred.reject('Dropbox client is not initiated.'); return deferred.promise(); }); dropbox_client.filesGetMetadata({ "path": dropbox_save_path, "include_media_info": false, "include_deleted": false, "include_has_explicit_shared_members": false }) .then(function(response) { // console.log('content_hash:' + response.content_hash); if (response != null && response != "") deferred.resolve(response.content_hash); else deferred.reject('Error: response had no file or file was empty.'); }) .catch(function(error) { console.log('gclh_sync_DBHash: Error while getting hash for config file:'); console.log(error); deferred.reject(error); }); return deferred.promise(); } // Sync anzeigen. function gclh_showSync() { btnClose(); scroll(0, 0); if ($('#bg_shadow')[0]) { if ($('#bg_shadow')[0].style.display == "none") $('#bg_shadow')[0].style.display = ""; } else buildBgShadow(); if ($('#sync_settings_overlay')[0] && $('#sync_settings_overlay')[0].style.display == "none") $('#sync_settings_overlay')[0].style.display = ""; else { var div = document.createElement("div"); div.setAttribute("id", "sync_settings_overlay"); div.setAttribute("class", "settings_overlay"); var html = ""; html += "

    GC little helper II Synchronizer v" + scriptVersion + "

    "; html += "
    "; html += "

    DropBox (click to hide/show)

    "; html += ""; html += "

    Manual (click to hide/show)

    "; html += ""; html += "

    "; html += ""; html += "
    "; div.innerHTML = html; $('body')[0].appendChild(div); $('#btn_close3, #btn_DBLoad, #btn_DBSave, #btn_DownloadConfig, #btn_ImportConfig, #btn_ExportConfig, #syncDBLabel, #syncManualLabel').click(function() {if ($(this)[0]) animateClick(this);}); $('#btn_close3')[0].addEventListener("click", btnClose, false); $('#btn_ExportConfig')[0].addEventListener("click", function() { $('#configData')[0].innerText = sync_getConfigData(); }, false); $('#btn_DownloadConfig')[0].addEventListener("click", function() { var element = document.createElement('a'); var [year, month, day] = determineCurrentDate(); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(sync_getConfigData())); element.setAttribute('download', year + "_" + month + "_" + day + "_" + "config.txt"); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); }, false); $('#btn_ImportConfig')[0].addEventListener("click", function() { var data = $('#configData')[0].innerText; if (data == null || data == "" || data == " ") { alert("No data"); return; } try { sync_setConfigData(data); window.scroll(0, 0); $('#sync_settings_overlay').fadeOut(300); if (settings_show_save_message) { showSaveForm(); setTimeout(function() { $('#save_overlay_h3')[0].innerHTML = "imported"; $("#save_overlay").fadeOut(250); }, 150); } reloadPage(); } catch(e) {alert("Invalid format");} }, false); $('#btn_DBSave')[0].addEventListener("click", function() { gclh_sync_DBSave(); }, false); $('#btn_DBLoad')[0].addEventListener("click", function() { gclh_sync_DBLoad().done(function() {reloadPage();}); }, false); $('#syncDBLabel').click(function() { $('#syncDB').toggle(); gclh_sync_DB_CheckAndCreateClient() .done(function() {gclh_sync_DB_showSaveLoadLinks();}) .fail(function() {gclh_sync_DB_showAuthLink();}); }); $('#syncManualLabel').click(function() { $('#syncManual').toggle(); }); } if ($('.hover.open')[0]) $('.hover.open')[0].className = ""; } // Auto import from Dropbox. if (settings_sync_autoImport && (settings_sync_last.toString() === "Invalid Date" || (new Date() - settings_sync_last) > settings_sync_time) && document.URL.indexOf("#access_token") === -1) { gclh_sync_DBHash() .done(function(hash) { if (hash != settings_sync_hash) { gclh_sync_DBLoad().done(function() { settings_sync_last = new Date(); settings_sync_hash = hash; setValue("settings_sync_last", settings_sync_last.toString()).done(function() { setValue("settings_sync_hash", settings_sync_hash).done(function() { if (is_page("profile")) reloadPage(); }); }); }); } }) .fail(function(error) { console.log('Autosync: Hash function was not successful:'); console.log(error); }); } ////////////////////////////////////// // 5.6. GC - General Functions ($$cap) (Functions generally usable on geocaching webpages.) ////////////////////////////////////// // Search in array. function in_array(search, arr) { for (var i = 0; i < arr.length; i++) {if (arr[i] == search) return true;} return false; } // Sort case insensitive. function caseInsensitiveSort(a, b) { var ret = 0; a = a.toLowerCase(); b = b.toLowerCase(); if (a > b) ret = 1; if (a < b) ret = -1; return ret; } // Sort functions for unpublished in Dashboard. function abc(a, b) { var sort = ($(a).find('.geocache-name div a').html().trim() < $(b).find('.geocache-name div a').html().trim()) ? -1 : ($(b).find('.geocache-name div a').html().trim() < $(a).find('.geocache-name div a').html().trim()) ? 1 : 0; return sort; } function gcOld(a, b) { var sort = ($(a).find('.geocache-details').html().trim().split(' ')[0].split('<')[0] < $(b).find('.geocache-details').html().trim().split(' ')[0].split('<')[0]) ? -1 : ($(b).find('.geocache-details').html().trim().split(' ')[0].split('<')[0] < $(a).find('.geocache-details').html().trim().split(' ')[0].split('<')[0]) ? 1 : 0; return sort; } function gcNew(a, b) { var sort = ($(a).find('.geocache-details').html().trim().split(' ')[0].split('<')[0] > $(b).find('.geocache-details').html().trim().split(' ')[0].split('<')[0]) ? -1 : ($(b).find('.geocache-details').html().trim().split(' ')[0].split('<')[0] > $(a).find('.geocache-details').html().trim().split(' ')[0].split('<')[0]) ? 1 : 0; return sort; } // Trim. function trim(s) { var whitespace = ' \n '; for (var i = 0; i < whitespace.length; i++) { while (s.substring(0, 1) == whitespace.charAt(i)) { s = s.substring(1, s.length); } while (s.substring(s.length - 1, s.length) == whitespace.charAt(i)) { s = s.substring(0, s.length - 1); } } if (s.substring(s.length - 6, s.length) == " ") s = s.substring(0, s.length - 6); return s; } // Trim decimal value to a given number of digits. function roundTO(val, decimals) {return Number(Math.round(val+'e'+decimals)+'e-'+decimals);} // Calculate tile numbers X/Y from latitude/longitude or reverse. function lat2tile(lat,zoom) {return (Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom)));} function long2tile(lon,zoom) {return (Math.floor((lon+180)/360*Math.pow(2,zoom)));} function tile2long(x,z) {return (x/Math.pow(2,z)*360-180);} function tile2lat(y,z) {var n=Math.PI-2*Math.PI*y/Math.pow(2,z); return (180/Math.PI*Math.atan(0.5*(Math.exp(n)-Math.exp(-n))));} // Ist Config aktiv? function check_config_page() { var config_page = false; if ($('#bg_shadow')[0] && $('#bg_shadow')[0].style.display == "" && $('#settings_overlay')[0] && $('#settings_overlay')[0].style.display == "") config_page = true; return config_page; } // Ist Sync aktiv? function check_sync_page() { var sync_page = false; if ($('#bg_shadow')[0] && $('#bg_shadow')[0].style.display == "" && $('#sync_settings_overlay')[0] && $('#sync_settings_overlay')[0].style.display == "") sync_page = true; return sync_page; } // Is special processing allowed on the current page? function checkTaskAllowed(task, doAlert) { if ((document.location.href.match(/^https?:\/\/(www\.wherigo|www\.waymarking|labs\.geocaching)\.com/) || isMemberInPmoCache()) || (task != "Find Player" && document.location.href.match(/(\.com\/map\/|\.com\/play\/map)/))) { if (doAlert != false) alert("This GC little helper II functionality is not available at this page.\n\nPlease go to the \"Dashboard\" page, there is anyway all of these \nfunctionality available. ( www.geocaching.com/my )"); return false; } return true; } // Is page own statistics? function isOwnStatisticsPage() { if ((document.location.href.match(/\.com\/my\/statistics\.aspx/)) || (is_page("publicProfile") && $('#ctl00_ContentBody_lblUserProfile')[0].innerHTML.match(global_me) && $('#ctl00_ContentBody_ProfilePanel1_lnkStatistics.Active')[0])) { return true; } else return false; } // Is event in cache listing. function isEventInCacheListing() { if (is_page("cache_listing") && $('#cacheDetails svg.cache-icon use')[0] && $('#cacheDetails svg.cache-icon use')[0].href.baseVal.match(/\/cache-types.svg\#icon-(6$|6-|453$|453-|13$|13-|7005$|7005-|3653$|3653-)/)) { return true; } else return false; } // Is Basic Member in PMO Cache? function isMemberInPmoCache() { if (is_page("cache_listing") && $('#premium-upgrade-widget')[0]) return true; else return false; } // Random number between max and min. function random(max, min) {return Math.floor(Math.random() * (max - min + 1)) + min;} // Determine current date and deliver year, month and day. function determineCurrentDate() { var now = new Date(); var day = now.getDate().toString().length < 2 ? "0"+now.getDate() : now.getDate(); var month = (now.getMonth()+1).toString().length < 2 ? "0"+(now.getMonth()+1) : (now.getMonth()+1); var year = now.getFullYear(); return [year, month, day]; } // Current date, time. function getDateTime() { var now = new Date(); var aDate = $.datepicker.formatDate('dd.mm.yy', now); var hrs = now.getHours(); var min = now.getMinutes(); hrs = ((hrs < 10) ? '0' + hrs : hrs); min = ((min < 10) ? '0' + min : min); var aTime = hrs+':'+min; var aDateTime = aDate+' '+aTime; return [aDate, aTime, aDateTime]; } // Build time string. function buildTimeString(min) { if (min < 2) return (min + " minute"); else if (min < 121) return (min + " minutes"); else if (min < 2881) return ("more than " + Math.floor(min / 60) + " hours"); else return ("more than " + Math.floor(min / (60*24)) + " days"); } // Calculates difference between two dates and returns it as a "humanized" string. function adjustPlural(singularWord, timesNumber) {return singularWord + ((Math.abs(timesNumber) != 1) ? "s" : "");} function getDateDiffString(dateNew, dateOld) { var dateDiff = new Date(dateNew - dateOld); dateDiff.setUTCFullYear(dateDiff.getUTCFullYear() - 1970); var strDateDiff = "", timeunitValue = 0; var timeunitsHash = {year: "getUTCFullYear", month: "getUTCMonth", day: "getUTCDate", hour: "getUTCHours", minute: "getUTCMinutes", second: "getUTCSeconds", millisecond: "getUTCMilliseconds"}; for (var timeunitName in timeunitsHash) { timeunitValue = dateDiff[timeunitsHash[timeunitName]]() - ((timeunitName == "day") ? 1 : 0); if (timeunitValue !== 0) { if ((timeunitName == "millisecond") && (strDateDiff.length !== 0)) continue; // Milliseconds won't be added unless difference is less than 1 second. strDateDiff += ((strDateDiff.length === 0) ? "" : ", ") + timeunitValue + " " + adjustPlural(timeunitName, timeunitValue); } } // Replaces last comma with "and" to humanize the string. strDateDiff = strDateDiff.replace(/,([^,]*)$/, " and$1"); return strDateDiff; } // Close Overlays, Find Player, Config, Sync. function btnClose(clearUrl) { if (global_mod_reset) { rcClose(); return; } if ($('#bg_shadow')[0]) $('#bg_shadow')[0].style.display = "none"; if ($('#settings_overlay')[0]) $('#settings_overlay')[0].style.display = "none"; if ($('#sync_settings_overlay')[0]) $('#sync_settings_overlay')[0].style.display = "none"; if ($('#findplayer_overlay')[0]) $('#findplayer_overlay')[0].style.display = "none"; if (clearUrl != false) document.location.href = clearUrlAppendix(document.location.href, false); } // Darken the side. function buildBgShadow() { var shadow = document.createElement("div"); shadow.setAttribute("id", "bg_shadow"); shadow.setAttribute("style", "z-index:1000; width: 100%; height: 100%; background-color: #000000; position:fixed; top: 0; left: 0; opacity: 0.5; filter: alpha(opacity=50);"); $('body')[0].appendChild(shadow); $('#bg_shadow')[0].addEventListener("click", btnClose, false); } // Get Geocaching Access Token. function gclh_GetGcAccessToken( handler ) { setTimeout(function() { $.ajax({ type: "POST", url: "/account/oauth/token", timeout: 10000 }) .done( function(r) { try { handler(r); } catch(e) {gclh_error("gclh_GetGcAccessToken()",e);} }); }, 0); } // Convert cache type to cache symbol. function convertCachetypeToCachesymbol(cacheType) { var cacheSymbol = ''; if (cacheType) { if (cacheType.match(/traditional/i)) cacheSymbol = '#traditional'; else if (cacheType.match(/multi/i)) cacheSymbol = '#multi'; else if (cacheType.match(/mystery/i)) cacheSymbol = '#mystery'; else if (cacheType.match(/earth/i)) cacheSymbol = '#earth'; else if (cacheType.match(/letterbox/i)) cacheSymbol = '#letterbox'; else if (cacheType.match(/webcam/i)) cacheSymbol = '#webcam'; else if (cacheType.match(/wherigo/i)) cacheSymbol = '#wherigo'; else if (cacheType.match(/virtual/i)) cacheSymbol = '#virtual'; else if (cacheType.match(/mega/i)) cacheSymbol = '#mega'; else if (cacheType.match(/giga/i)) cacheSymbol = '#giga'; else if (cacheType.match(/trash/i)) cacheSymbol = '#cito'; else if (cacheType.match(/Community Celebration/i)) cacheSymbol = '#celebration'; else if (cacheType.match(/HQ Celebration/i)) cacheSymbol = '#hq_celebration'; else if (cacheType.match(/(Project A\.P\.E\.|Project APE)/i)) cacheSymbol = '#ape'; else if (cacheType.match(/Groundspeak HQ/i)) cacheSymbol = '#hq'; else if (cacheType.match(/event/i)) cacheSymbol = '#event'; } return cacheSymbol; } // Animate Click. function animateClick(element) { element.animate({opacity: 0.3}, {duration: 200, direction: 'reverse'}); } // Consideration of special keys ctrl, alt, shift on keyboard input. function noSpecialKey(e) { if (e.ctrlKey != false || e.altKey != false || e.shiftKey != false) return false; else return true; } // Addition in url, introduced by "#", reset to "#". function clearUrlAppendix(url, onlyTheFirst) { var urlSplit = url.split('#'); var newUrl = ""; if (onlyTheFirst) newUrl = url.replace(urlSplit[1], "").replace("##", "#"); else newUrl = urlSplit[0] + "#"; return newUrl; } // Add a link to copy to clipboard. // element_to_copy: innerHtml of this element will be copied. If you pass // a string, the string will be the copied text. In this // case you have to pass an anker_element!!! // anker_element: After this element the copy marker will be inserted, // if you set this to null, the element_to_copy will be // used as an anker. // title: You can enter a text that will be displayed between // Copy --TEXT OF TITLE-- to clipboard. If you leave it // blank, it will just "Copy to clipboard" be displayed. // style: You can add styles to the surrounding span by passing // it in this variable. function addCopyToClipboardLink(element_to_copy, anker_element= null, title="", style= "") { try { var ctoc = false; var span = document.createElement('span'); span.setAttribute("class",'ctoc_link'); span.innerHTML = ' '; if (style != "") span.setAttribute("style", style); if (!anker_element) anker_element = element_to_copy; if (!anker_element.parentNode) return; anker_element.parentNode.insertBefore(span, anker_element); appendCssStyle(".ctoc_link:link {text-decoration: none ;}", null, 'ctoc_link_style_id'); span.addEventListener('click', function() { // Tastenkombination Strg+c ausführen für eigene Verarbeitung. ctoc = true; document.execCommand('copy'); }, false); document.addEventListener('copy', function(e){ // Normale Tastenkombination Strg+c für markierter Bereich hier nicht verarbeiten. Nur eigene Tastenkombination Strg+c hier verarbeiten. if (!ctoc) return; // Gegebenenfalls markierter Bereich wird hier nicht beachtet. e.preventDefault(); // Copy Data wird hier verarbeitet. if (typeof element_to_copy === 'string' || element_to_copy instanceof String) { e.clipboardData.setData('text/plain', element_to_copy); } else { e.clipboardData.setData('text/plain', element_to_copy.innerHTML); } animateClick(span); ctoc = false; }); } catch(e) {gclh_error("Copy to clipboard",e);} } // Length, Maxlength of field and number of words. function limitedField(editor, counterelement, limitNum, showWords) { changed = true; var length = $(editor).val().replace(/\n/g, "\r\n").length; if (length >= limitNum) { counterelement.innerHTML = '' + length + '/' + limitNum + ''; } else counterelement.innerHTML = length + '/' + limitNum; if (showWords) { var wordsArr = $(editor).val().replace(/\n/g, ' ').split(' '); var words = 0; for (let i=0; i 0) return pair[1]; } } return undefined; }; }; // End of mainGC. ////////////////////////////// // 6. Global Functions ($$cap) (Functions global usable.) ////////////////////////////// // Change coordinates from N/S/E/W Deg Min.Sec to Dec. function toDec(coords) { var match = coords.match(/([0-9]+)°([0-9]+)\.([0-9]+)′(N|S), ([0-9]+)°([0-9]+)\.([0-9]+)′(W|E)/); if (match) { var dec1 = parseInt(match[1], 10) + (parseFloat(match[2] + "." + match[3]) / 60); if (match[4] == "S") dec1 = dec1 * -1; dec1 = Math.round(dec1 * 10000000) / 10000000; var dec2 = parseInt(match[5], 10) + (parseFloat(match[6] + "." + match[7]) / 60); if (match[8] == "W") dec2 = dec2 * -1; dec2 = Math.round(dec2 * 10000000) / 10000000; return new Array(dec1, dec2); } else { match = coords.match(/(N|S)\s?([0-9]+)°?\s?([0-9]+)\.([0-9]+)′?'?\s?(E|W)\s?([0-9]+)°?\s?([0-9]+)\.([0-9]+)/); if (match) { var dec1 = parseInt(match[2], 10) + (parseFloat(match[3] + "." + match[4]) / 60); if (match[1] == "S") dec1 = dec1 * -1; dec1 = Math.round(dec1 * 10000000) / 10000000; var dec2 = parseInt(match[6], 10) + (parseFloat(match[7] + "." + match[8]) / 60); if (match[5] == "W") dec2 = dec2 * -1; dec2 = Math.round(dec2 * 10000000) / 10000000; return new Array(dec1, dec2); } else { match = coords.match(/(N|S) ([0-9]+) ([0-9]+) ([0-9]+)\.([0-9]+) (E|W) ([0-9]+) ([0-9]+) ([0-9]+)\.([0-9]+)/); if (match) { var dec1 = parseInt(match[2], 10) + (parseFloat(match[3]) / 60) + (parseFloat(match[4] + "." + match[5]) / 3600); if (match[1] == "S") dec1 = dec1 * -1; dec1 = Math.round(dec1 * 10000000) / 10000000; var dec2 = parseInt(match[7], 10) + (parseFloat(match[8]) / 60) + (parseFloat(match[9] + "." + match[10]) / 3600); if (match[6] == "W") dec2 = dec2 * -1; dec2 = Math.round(dec2 * 10000000) / 10000000; return new Array(dec1, dec2); } else { match = coords.match(/(N|S) ([0-9]+) ([0-9]+) ([0-9]+\..[0-9].) (E|W) ([0-9]+) ([0-9]+) ([0-9]+\..[0-9].)/); if (match) { var dec1 = parseInt(match[2], 10) + (parseFloat(match[3]) / 60) + (parseFloat(match[4]) / 3600); if (match[1] == "S") dec1 = dec1 * -1; dec1 = Math.round(dec1 * 10000000) / 10000000; var dec2 = parseInt(match[6], 10) + (parseFloat(match[7]) / 60) + (parseFloat(match[8]) / 3600); if (match[5] == "W") dec2 = dec2 * -1; dec2 = Math.round(dec2 * 10000000) / 10000000; return new Array(dec1, dec2); } else return false; } } } } // Change coordinates from Deg to DMS. function DegtoDMS(coords) { var match = coords.match(/^(N|S) ([0-9][0-9]). ([0-9][0-9])\.([0-9][0-9][0-9]) (E|W) ([0-9][0-9][0-9]). ([0-9][0-9])\.([0-9][0-9][0-9])$/); if (!match) return ""; var lat1 = parseInt(match[2], 10); var lat2 = parseInt(match[3], 10); var lat3 = parseFloat("0." + match[4]) * 60; lat3 = Math.round(lat3 * 10000) / 10000; var lng1 = parseInt(match[6], 10); var lng2 = parseInt(match[7], 10); var lng3 = parseFloat("0." + match[8]) * 60; lng3 = Math.round(lng3 * 10000) / 10000; return match[1] + " " + lat1 + "° " + lat2 + "' " + lat3 + "\" " + match[5] + " " + lng1 + "° " + lng2 + "' " + lng3 + "\""; } // Change coordinates from Dec to Deg. function DectoDeg(lat, lng) { var n = "000"; lat = lat / 10000000; var pre = ""; if (lat > 0) pre = "N"; else { pre = "S"; lat = lat * -1; } var tmp1 = parseInt(lat); var tmp2 = (lat - tmp1) * 60; tmp1 = String(tmp1); if (tmp1.length == 1) tmp1 = "0" + tmp1; tmp2 = Math.round(tmp2 * 10000) / 10000; tmp2 = String(tmp2); if (tmp2.length == 0) tmp2 = tmp2 + "0.000"; else if (tmp2.indexOf(".") == -1) tmp2 = tmp2 + ".000"; else if (tmp2.indexOf(".") != -1) tmp2 = tmp2 + n.slice(tmp2.length - tmp2.indexOf(".") - 1); var new_lat = pre + " " + tmp1 + "° " + tmp2; lng = lng / 10000000; var pre = ""; if (lng > 0) pre = "E"; else { pre = "W"; lng = lng * -1; } var tmp1 = parseInt(lng); var tmp2 = (lng - tmp1) * 60; tmp1 = String(tmp1); if (tmp1.length == 2) tmp1 = "0" + tmp1; else if (tmp1.length == 1) tmp1 = "00" + tmp1; tmp2 = Math.round(tmp2 * 10000) / 10000; tmp2 = String(tmp2); if (tmp2.length == 0) tmp2 = tmp2 + "0.000"; else if (tmp2.indexOf(".") == -1) tmp2 = tmp2 + ".000"; else if (tmp2.indexOf(".") != -1) tmp2 = tmp2 + n.slice(tmp2.length - tmp2.indexOf(".") - 1); var new_lng = pre + " " + tmp1 + "° " + tmp2; return new_lat + " " + new_lng; } // Show other coordinates. function otherFormats(box, coords, trenn) { var dec = toDec(coords); var lat = dec[0]; var lng = dec[1]; if (lat < 0) lat = "S "+(lat * -1); else lat = "N "+lat; if (lng < 0) lng = "W "+(lng * -1); else lng = "E "+lng; box.innerHTML += trenn+"Dec: "+lat+" "+lng; var dms = DegtoDMS(coords); box.innerHTML += trenn+"DMS: "+dms; } // Decode URI component for non-standard unicode encoding (issue-818). function decodeUnicodeURIComponent(s) { function unicodeToChar(text) { return text.replace(/%u[\dA-F]{4}/gi, function (match) { return String.fromCharCode(parseInt(match.replace(/%u/g, ''), 16)); }); } return decodeURIComponent(unicodeToChar(s)); } // Encode in URL. function urlencode(s, convertPlus) { s = s.replace(/&/g, "&"); s = s.replace(/</g, "%3C"); s = s.replace(/>/g, "%3E"); s = encodeURIComponent(s); // Alles außer: A bis Z, a bis z und - _ . ! ~ * ' ( ) s = s.replace(/~/g, "%7e"); s = s.replace(/'/g, "%27"); s = s.replace(/%26amp%3b/g, "%26"); s = s.replace(/%26nbsp%3B/g, "%20"); if (convertPlus != false) { s = s.replace(/%2B/ig, "%252b"); } s = s.replace(/ /g, "+"); return s; } // Decode from URL. function urldecode(s, convertSpace=false) { s = s.replace(/\+/g, " "); s = s.replace(/%252b/ig, "+"); s = s.replace(/%7e/g, "~"); s = s.replace(/%27/g, "'"); s = s.replace(/%253C/ig, "<"); s = s.replace(/%253E/ig, ">"); s = decodeUnicodeURIComponent(s); if (convertSpace) { s = s.replace(/%20/g, " "); } return s; } // Decode HTML, e.g.: "&" in "&" (e.g.: User "Rajko & Dominik"). function decode_innerHTML(v_mit_innerHTML) { var elem = document.createElement('textarea'); elem.innerHTML = v_mit_innerHTML.innerHTML; v_decode = elem.value; v_new = v_decode.trim(); return v_new; } function html_to_str(s) { s = s.replace(/\&/g, "&"); s = s.replace(/\ /g, " "); return s; } // Create bookmark to GC page. function bookmark(title, href, bookmarkArray) { var bm = new Object(); bookmarkArray[bookmarkArray.length] = bm; bm['href'] = href; bm['title'] = title; return bm; } // Create BM to external page. function externalBookmark(title, href, bookmarkArray) { var bm = bookmark(title, href, bookmarkArray); bm['rel'] = "external"; bm['target'] = "_blank"; } // Create BM to a profile sub page. function profileBookmark(title, id, bookmarkArray) { var bm = bookmark(title, "#", bookmarkArray); bm['id'] = id; bm['name'] = id; } // Create BM mit doppeltem Link. function profileSpecialBookmark(title, href, name, bookmarkArray) { var bm = bookmark(title, href, bookmarkArray); bm['name'] = name; } // Replace apostrophes. function repApo(s) { return s.replace(/'/g, '''); } // Add CSS Style. function appendCssStyle(css, name, id) { if (document.getElementById(id)) return; if (css == "") return; if (name) var tag = $(name)[0]; else var tag = $('head')[0]; var style = document.createElement('style'); style.innerHTML = 'GClhII{} ' + css; style.type = 'text/css'; if (id) style.id = id; tag.appendChild(style); } // Add Meta Info. function appendMetaId(id) { var head = document.getElementsByTagName('head')[0]; var meta = document.createElement('meta'); meta.id = id; head.appendChild(meta); } // Console logging. function gclh_log(log) { var txt = "GClh_LOG - " + document.location.href + ": " + log; if (typeof(console) != "undefined") console.info(txt); else if (typeof(GM_log) != "undefined") GM_log(txt); } // Console error logging. function gclh_error(modul, err) { var txt = "GClh_ERROR - " + modul + " - " + document.location.href + ": " + err.message + "\nStacktrace:\n" + err.stack + (err.stacktrace ? ("\n" + err.stacktrace) : ""); if (typeof(console) != "undefined") console.error(txt); else if (typeof(GM_log) != "undefined") GM_log(txt); if (settings_gclherror_alert) { if ($("#gclh-gurumeditation").length == 0) { $("body").before('
    '); $("#gclh-gurumeditation").append('
    '); $("#gclh-gurumeditation > div").append('

    GC little helper II Error

    '); $("#gclh-gurumeditation > div").append('
    '); $("#gclh-gurumeditation > div").append('

    For more information see the console. Create a new issue / bug report at GitHub.

    '); } $("#gclh-gurumeditation > div > div").append( "

    "+modul + ": " + err.message+"

    "); } } // Test log console. function tlc(output) { if (test_log_console && output != '') console.info('GClh: '+output); } // Set Get Values. function setValue(name, value) { var defer = $.Deferred(); CONFIG[name] = value; GM_setValue("CONFIG", JSON.stringify(CONFIG)); defer.resolve(); return defer.promise(); } function setValueSet(data) { var defer = $.Deferred(); var data2Store = {}; for (key in data) { CONFIG[key] = data[key]; data2Store[key] = data[key]; } GM_setValue("CONFIG", JSON.stringify(CONFIG)); defer.resolve(); return defer.promise(); } function getValue(name, defaultValue) { if (CONFIG[name] === undefined) { CONFIG[name] = GM_getValue(name, defaultValue); if (defaultValue === undefined) return undefined; setValue(name, CONFIG[name]); } return CONFIG[name]; } // Which webpage is it? function is_page(name) { var status = false; var url = document.location.pathname; if (name == "cache_listing") { if (url.match(/^\/(seek\/cache_details\.aspx|geocache\/)/) && !document.getElementById("cspSubmit") && !document.getElementById("cspGoBack")) status = true; // Exclude (new) Log Page if (url.match(/^\/(geocache\/).*\/log/)) status = false; // Exclude unpublished Caches if (document.getElementsByClassName('UnpublishedCacheSearchWidget').length > 0) status = false; } else if (name == "unpublished_cache") { if (document.getElementById("unpublishedMessage") !== null || document.getElementById("ctl00_ContentBody_GeoNav_uxPostReviewerNoteLogType") !== null) status = true; } else if (name == "profile") { if (url.match(/^\/my(\/default\.aspx)?/)) status = true; } else if (name == "publicProfile") { if (url.match(/^\/(profile|p\/)/)) status = true; } else if (name == "lists") { if (url.match(/^\/plan\/lists/)) status = true; } else if (name == "searchmap") { if (url.match(/^\/play\/map/)) status = true; } else if (name == "map") { if (url.match(/^\/map/)) status = true; } else if (name == "find_cache") { if (url.match(/^\/play\/(search|geocache)/)) status = true; } else if (name == "collection_1") { if (url.match(/^\/play\/(friendleague|leaderboard|souvenircampaign|guidelines|promotions)/)) status = true; } else if (name == "hide_cache") { if (url.match(/^\/play\/hide/)) status = true; } else if (name == "geotours") { if (url.match(/^\/play\/geotours/)) status = true; } else if (name == "drafts") { if (url.match(/^\/account\/drafts/)) status = true; } else if (name == "settings") { if (url.match(/^\/account\/(settings|lists|drafts|documents)/)) status = true; } else if (name == "messagecenter") { if (url.match(/^\/account\/messagecenter/)) status = true; } else if (name == "dashboard") { if (url.match(/^\/account\/dashboard$/)) status = true; } else if (name == "owner_dashboard") { if (url.match(/^\/play\/owner/)) status = true; } else if (name == "dashboard-section") { if (url.match(/^\/account\/dashboard/)) status = true; } else if (name == "promos") { // Like 'Wonders of the World'. if (url.match(/^\/promos/)) status = true; } else if (name == "track") { if (url.match(/^\/track\/($|#$|edit|upload|default.aspx)/)) status = true; } else if (name == "souvenirs") { if (url.match(/^\/my\/souvenirs\.aspx/)) status = true; } else { gclh_error("is_page", "is_page("+name+", ... ): unknown name"); } return status; } // Inject script into site context. function injectPageScript(scriptContent, TagName, IdName) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); if (IdName !== undefined) { script.setAttribute("id", IdName); } script.innerHTML = scriptContent; var pageHead = document.getElementsByTagName(TagName?TagName:"head")[0]; pageHead.appendChild(script); } function injectPageScriptFunction(funct, functCall) {injectPageScript("(" + funct.toString() + ")" + functCall + ";");} // Convert GCCode to id. String.prototype.gcCodeToID = function () { let gcCode = this.trim().toUpperCase().substring(2); let abc = '0123456789ABCDEFGHJKMNPQRTVWXYZ'; let base = 31; let id = -411120; if (gcCode.length <= 3 || (gcCode.length == 4 && gcCode.match(/[0-9A-F]/))) { abc = '0123456789ABCDEF'; base = 16; id = 0; } gcCode.split('').reverse().forEach((letter, i) => { id += abc.indexOf(letter) * Math.pow(base, i); }); return id; } start(this);