// ==UserScript== // @name GC little helper II // @namespace http://www.amshove.net //--> $$000 // @version 0.10.11 //<-- $$000 // @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)/ // @resource jscolor https://raw.githubusercontent.com/2Abendsegler/GClh/master/data/jscolor.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://raw.githubusercontent.com/2Abendsegler/GClh/master/data/gclh_defi.js // @require https://www.geocaching.com/scripts/MarkdownDeepLib.min.js // @require https://www.geocaching.com/scripts/SmileyConverter.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 // @description Some little things to make life easy (on www.geocaching.com). // @copyright 2010-2016 Torsten Amshove, 2016-2020 2Abendsegler, 2017-2020 Ruko2010 // @author Torsten Amshove; 2Abendsegler; Ruko2010 // @icon https://raw.githubusercontent.com/2Abendsegler/GClh/master/images/gclh_logo.png // @license GNU General Public License v2.0 // @grant GM_getValue // @grant GM_setValue // @grant GM_log // @grant GM_xmlhttpRequest // @grant GM_getResourceText // @grant GM_info // @grant GM_addStyle // @grant GM_registerMenuCommand // ==/UserScript== ////////////////////////////////////// // 1. Declaration, Init, Start ($$cap) ////////////////////////////////////// var start = function(c) { checkRunningOnce(); 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) { // GDPR if ($('body').children().length > 1) { // GDPR 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/)) { if (is_page('lists') || is_page('searchmap') || is_page('owner_dashboard') || is_page('promos') || is_page('hide_cache')) { mainGCAsyn(); } else { mainGC(); } }else if (document.location.href.match(/^https?:\/\/project-gc\.com\/Tools\/PQSplit/)) { mainPGC(); } } else {waitCount++; if (waitCount <= 1000) setTimeout(function(){checkBodyContent(waitCount);}, 10);} // GDPR } checkBodyContent(0); // GDPR }); }; var checkRunningOnce = function(c) { if (document.getElementsByTagName('head')[0]) { if (document.getElementById('GClh_II_running')){ var text = 'The script "GC little helper II" is already running.\nPlease make sure that it runs only once.\n\nDo you want to see tips on how this could happen \nand what you can do about it?'; var url = 'https://github.com/2Abendsegler/GClh/blob/master/docu/faq.md'; if (window.confirm(text)) window.open(url, '_blank'); } else appendMetaId("GClh_II_running"); } }; var quitOnAdFrames = function(c) { 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) { 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 leafletInit = function(c) { try { if ( typeof L == "undefined" ) { if ( !$('#gclh_leafletjs').length ) { var newCSS = GM_getResourceText ("leafletcss"); GM_addStyle (newCSS); var newJS = GM_getResourceText("leafletjs"); injectPageScript(newJS, "body", 'gclh_leafletjs'); } } if ( L.version != "0.7.2" ) { gclh_error("Unexpected vesion of leaflet. Version 0.7.2 required, version "+L.version+" is loaded."); } } catch(e) { gclh_error("leafletInit failed",e);} }; var browserInit = function(c) { var browserInitDeref = new jQuery.Deferred(); c.CONFIG = {}; // Browser ermitteln. Opera ... ist auch chrome. c.browser = (typeof(chrome) !== "undefined") ? "chrome" : "firefox"; c.GM_setValue("browser", browser); c.CONFIG = JSON.parse(GM_getValue("CONFIG", '{}')); // Ist Tampermonkey der Scriptmanager. c.isTM = (typeof GM_info != "undefined" && typeof GM_info.scriptHandler != "undefined" && GM_info.scriptHandler == "Tampermonkey") ? true : false; c.GM_setValue("isTampermonkey", isTM); browserInitDeref.resolve(); return browserInitDeref.promise(); }; var constInit = function(c) { var constInitDeref = new jQuery.Deferred(); c.scriptName = GM_info.script.name; c.scriptVersion = GM_info.script.version; c.scriptNameConfig = c.scriptName.replace("helper", "helper Config"); c.scriptNameSync = c.scriptName.replace("helper", "helper Sync"); c.scriptShortNameConfig = "GClh Config II"; c.scriptShortNameSync = "GClh Sync II"; 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.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(c.scriptShortNameConfig, "/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); profileSpecialBookmark("Public Profile Geocaches", "/profile/default.aspx?#gclhpb#ctl00_ContentBody_ProfilePanel1_lnkUserStats", "lnk_profilegeocaches", c.bookmarks); profileSpecialBookmark("Public Profile Trackables", "/profile/default.aspx?#gclhpb#ctl00_ContentBody_ProfilePanel1_lnkCollectibles", "lnk_profiletrackables", c.bookmarks); profileSpecialBookmark("Public Profile Gallery", "/profile/default.aspx?#gclhpb#ctl00_ContentBody_ProfilePanel1_lnkGallery", "lnk_profilegallery", c.bookmarks); profileSpecialBookmark("Public Profile Lists", "/profile/default.aspx?#gclhpb#ctl00_ContentBody_ProfilePanel1_lnkLists", "lnk_profilebookmarks", 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. profileSpecialBookmark("Public Profile Souvenirs", "/profile/default.aspx?#gclhpb#ctl00_ContentBody_ProfilePanel1_lnkSouvenirs", "lnk_profilesouvenirs", c.bookmarks); bookmark("Statistics", "/my/statistics.aspx", c.bookmarks); bookmark("Drafts", "/my/fieldnotes.aspx", c.bookmarks); profileSpecialBookmark("Public Profile Statistics", "/profile/default.aspx?#gclhpb#ctl00_ContentBody_ProfilePanel1_lnkStatistics", "lnk_profilestatistics", 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-caching.de/", 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(scriptShortNameSync, 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, "migration_task_01": true, "update_next_check": true}; iconsInit(c); langInit(c); layersInit(c); elevationServicesDataInit(c); corecssInit(c); country_idInit(c); states_idInit(c); constInitDeref.resolve(); return constInitDeref.promise(); }; var variablesInit = function(c) { 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.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 = 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", true); c.settings_hide_socialshare = getValue("settings_hide_socialshare", true); 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_use_one_click_watching = getValue("settings_use_one_click_watching", 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_f10_call_gclh_sync = getValue("settings_f10_call_gclh_sync", 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.map_url = "https://www.geocaching.com/map/default.aspx"; c.new_map_url = "https://www.geocaching.com/play/map/"; 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_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 = 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_fieldnotes_old_fashioned = getValue("settings_fieldnotes_old_fashioned", 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.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_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_pqs = getValue("settings_fav_proz_pqs", true); c.settings_fav_proz_nearest = getValue("settings_fav_proz_nearest", 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); 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) //////////////////////// var mainPGC = function() { try { // CSS Style hinzufügen. function appendCssStyle(css, name) { 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'; tag.appendChild(style); } function createRadioElement( name, id = false, checked = false ) { var radioInput; try { var radioHtml = ' 0) ){ // Restart function until everything is finished setTimeout(function(){create_pqs(false);}, 1000); }else{ alert('We are done creating your Pocket Querys.'); $("button[data='PQCreateButton']").prop("disabled",false); } } if($('.row table').length > 0){ // Add some CSS var css = ""; css += "tfoot{"; css += " background-color: #d4edda;"; css += "}"; appendCssStyle(css); var urls_for_pqs_to_create = []; // Only one of the Multiselects has a value. Either the Country or the Region // Check if other Filters are set! var error_text = ''; if($('#inputlist li').length > 1){ error_text = "More than one filter was set! You can not use this function. Please remove all filters except country/region."; } if($('#multi_countryselect').val() != null){ name = $('#multi_countryselect').val(); type = "country"; }else if($('#multi_countryregionselect').val() != null){ name = $('#multi_countryregionselect').val(); type = "region"; }else{ error_text = 'No Country/Region selected.'; } $('.row table').each(function(table_index){ var tfoot = document.createElement('tfoot'); var tr = document.createElement('tr'); var td = document.createElement('td'); td.colSpan = "5"; var heading = document.createElement("h4"); heading.appendChild(document.createTextNode("Create PQ(s) on geocaching.com")); var info_text = document.createElement("span"); info_text.appendChild(heading); // Check if we need to add the function, or if we have an error before if(error_text != ''){ info_text.appendChild(document.createTextNode(error_text)); td.appendChild(info_text); tr.appendChild(td); tfoot.appendChild(tr); $(this).append(tfoot); return; } info_text.appendChild(document.createTextNode("PQ-Name (Prefix):")); var button = document.createElement('button'); var t = document.createTextNode("Create PQ(s)"); button.appendChild(t); button.setAttribute("data", "PQCreateButton"); var input = document.createElement("input"); input.setAttribute("type", "text"); input.setAttribute("value", "PQName"); input.setAttribute("id", "pq_name_"+table_index); button.addEventListener("click", function(){ var current_table = $(this).closest('table'); var counter = 0; var language; var data = new Array(); // Cleanup old Data (if there is any) urls_for_pqs_to_create = []; $("button[data='PQCreateButton']").prop("disabled",true); $(current_table).find('tr').each(function(){ counter++; if(counter == 1){ // first tr, determine Language var lang_text = $(this).children().eq(1).text(); if(lang_text == 'Startdatum'){ language = 'DE'; }else if(lang_text == 'Start date'){ language = 'EN'; }else{ // Lang not supported alert('Language not supported. Please switch to German or English to use this funktion'); language = 'NONE'; } }else{ // Other td, here is the Data we need // Only process if the first column has Data in it if($(this).children().eq(1).text() != ""){ var start = $(this).children().eq(1).text(); var start_array = start.split('/'); var start_month = getMonthNumber(language,start_array[0]); var start_day = parseInt(start_array[1]); var start_year = parseInt(start_array[2]); var end = $(this).children().eq(2).text(); if(end.indexOf("/") != -1){ var end_array = end.split('/'); var end_month = getMonthNumber(language,end_array[0]); var end_day = parseInt(end_array[1]); var end_year = parseInt(end_array[2]); }else{ var end_month = ""; var end_day = ""; var end_year = ""; } var cache_count = 1000; if(table_index == 1) cache_count = 500; var pq_name = $("#pq_name_"+table_index).val()+"_"+(counter-1); if(counter <= 10){ pq_name = $("#pq_name_"+table_index).val()+"_0"+(counter-1); } var temp_id = $("input[name=how_often_"+table_index+"]:checked").attr('id'); var how_often = temp_id.substr(temp_id.lastIndexOf("_")+1); var email = $("#output_email_"+table_index).val(); var param = { PQSplit: 1, n: pq_name, t: type, s: 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 new_url = "https://www.geocaching.com/pocket/gcquery.aspx?"+$.param( param ); if(new_url.length > 2000){ alert("The URL is too long! Please use fewer countries/regions or you can't use this funciton. Some of the PQs could already be created!"); return false; }else{ urls_for_pqs_to_create.push(new_url); } // Only one for now... // return false; } } }); create_pqs(); }, false); td.appendChild(info_text); td.appendChild(input); td.appendChild(button); var heading_instructions = document.createElement("h5"); heading_instructions.appendChild(document.createTextNode("Instruction")); td.appendChild(heading_instructions); td.appendChild(document.createTextNode("This function will only work, if you don't set any other filter except country or region!")); td.appendChild(document.createElement("br")); td.appendChild(document.createTextNode("If you click the \"Create PQ(s)\" Button GClh will open as many Pop-ups as PQs should be created. Please wait until all Pop-ups are loaded. The number of simultaneously loaded Popups is limited to 5. We will display a message if all PQs are created. The Popups will close themselves after the PQs are created. ")); var span = document.createElement('span'); span.innerHTML = 'Please make sure you do not have a Pop-up-Blocker enabled. Otherwise this function will not work as expected. '; span.style.fontWeight = 'bold'; td.appendChild(span); td.appendChild(document.createTextNode("All PQs will get the Name that you enter in the text field and an ongoing number.")); var heading_config = document.createElement("h5"); heading_config.appendChild(document.createTextNode("Configuration")); td.appendChild(heading_config); td.appendChild(document.createTextNode("Choose how often your query should run:")); td.appendChild(document.createElement("br")); td.appendChild(createRadioElement('how_often_'+table_index, 'how_often_'+table_index+'_1', true)); td.appendChild(document.createTextNode(" Uncheck the day of the week after the query runs")); td.appendChild(document.createElement("br")); td.appendChild(createRadioElement('how_often_'+table_index, 'how_often_'+table_index+'_2', false)); td.appendChild(document.createTextNode(" Run this query every week on the days checked")); td.appendChild(document.createElement("br")); td.appendChild(createRadioElement('how_often_'+table_index, 'how_often_'+table_index+'_3', false)); td.appendChild(document.createTextNode(" Run this query once then delete it")); td.appendChild(document.createElement("br")); td.appendChild(document.createElement("br")); td.appendChild(document.createTextNode("Output to Email:")); td.appendChild(document.createElement("br")); var output_email = document.createElement("select"); output_email.setAttribute("id", "output_email_"+table_index); output_email.appendChild(new Option("Primary", "1")); output_email.appendChild(new Option("Secondary", "2")); td.appendChild(output_email); td.appendChild(document.createElement("br")); td.appendChild(document.createTextNode("Attention: This will only work if you have 2 or more Email addresses in your Profile.")); td.appendChild(document.createElement("br")); tr.appendChild(td); tfoot.appendChild(tr); $(this).append(tfoot); }); } } catch(e) {gclh_error("mainPGC",e);} }; /////////////////////////// // 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 asynchron ($$cap) ////////////////////////// var mainGCAsyn = function() { try { // Build header and start mainGC. function buildUpHeaderAndStart(waitCount, html) { if ($('#gc-header, #GCHeader')[0] && !html == "") { // Part of core CSS of Groundspeak. var css = corecss; // Integrate html for new header. $('#gc-header, #GCHeader').before(html); // Make GC header invisible. $('#gc-header, #GCHeader')[0].style.display = 'none'; // User profile menu bend into shape. css += '.gclh_open ul.submenu {visibility: visible; display: block;}'; $('#ctl00_uxLoginStatus_divSignedIn button.li-user-toggle')[0].addEventListener('click', function(){ $('#ctl00_uxLoginStatus_divSignedIn li.li-user').toggleClass('gclh_open'); }); // Logout bend into shape. $('.js-sign-out')[0].addEventListener('click', function(){ GM_xmlhttpRequest({ method: 'POST', url: 'https://www.geocaching.com/account/logout', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': document.location.pathname }, onload: function(response) { window.location.reload(false); } }); }); // 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); // Start mainGC. mainGC(); } else {waitCount++; if (waitCount <= 200) setTimeout(function(){buildUpHeaderAndStart(waitCount, html);}, 50);} } // Get header replacement from other GC page. function getHeaderReplacement(lang) { $.get('https://www.geocaching.com/adopt', null, function(response){ var von = response.indexOf('