';
button += '';
$('div.EeWPwe').append(button);
// Missing CSS.
var css = '';
css += '.ZkkK1e.ZkkK1e {line-height: normal; font-family: arial,sans-serif;}';
css += '.ZkkK1e {-moz-box-sizing: border-box; box-sizing: border-box; border-radius: 18px; cursor: pointer; display: inline-block; height: 36px; min-width: 36px; position: relative; background: #fff; border: 1px solid #dadce0; color: #3c4043;}';
css += '.POUQwd.WN4Zxc {padding: 7px 0 7px 11px;}';
css += '.xlY4q, .POUQwd, .XqKfz {-moz-box-sizing: border-box; box-sizing: border-box; display: inline-block; height: 34px; vertical-align: bottom;}';
css += '.xlY4q.VIZLse {padding-right: 11px;}';
css += '.xlY4q {font-size: 14px; line-height: 34px; padding: 0 8px; padding-right: 8px;}';
css += '.VDgVie {text-align: center;}';
appendCssStyle(css);
}
// Categorie 4: Example: "Nil"
} else if ($('div.V1GY4c img')[0]) {
if (!$('div.V1GY4c img')[0].closest('a[href]:not([href=""]):not([href=" "])')) {
var map = $('div.V1GY4c')[0];
var link = document.createElement('a');
link.href = mapsUrl;
map.parentNode.insertBefore(link, map);
link.appendChild(map);
}
}
}
waitCount++; if (waitCount <= 25) setTimeout(function(){setGMapsLinks(waitCount);}, 200);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', setGMapsLinks(0));
else setGMapsLinks(0);
}
} catch(e) {gclh_error("mainGSearch",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 sel = getSelection();
if ($.param(sel).includes('=United+States') && !$.param(sel).includes('=United+States%7C')) {
html += '
Error:
';
html += '
Your country specification "United States" can not be specified on the PQ page.
';
html += '
';
$(side).append(html);
return;
}
var error_text = checkSelectErrorAvailable(sel);
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 += '
';
html += '
';
html += '
Output to email: ';
html += 'The secondary email will only work if you have two or more email addresses in your profile.
';
html += '';
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. How to change pop up blocker settings in browser Mozilla Firefox, Google Chrome.
';
html += '
This is a feature of GC little helper II.
';
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('.not_ignored')[0].addEventListener("click", function() {
setValue('settings_pq_splitter_not_ignored', $(this).prop('checked'));
});
$(side).find('.is_enabled')[0].addEventListener("click", function() {
setValue('settings_pq_splitter_is_enabled', $(this).prop('checked'));
});
$(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);
});
$(side).find('.include_pq_name')[0].addEventListener("click", function() {
setValue('settings_pq_splitter_include_pq_name', $(this).prop('checked'));
});
}
}
// Build css.
function buildCss() {
var css = '';
css += 'tfoot td {background-color: #d4edda !important;}';
css += 'tfoot h4, tfoot h5 {font-weight: bold;}';
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 not_ignored = $(current_table).find('.not_ignored').prop('checked') ? 1 : 0;
var is_enabled = $(current_table).find('.is_enabled').prop('checked') ? 1 : 0;
var email = $(current_table).find('.output_email').val();
var include_pq_name = $(current_table).find('.include_pq_name').prop('checked') ? 1 : 0;
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, ni: not_ignored, ie: is_enabled, in: include_pq_name};
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(sel) {
// 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 = '';
while (sel[name+"["+n+"]"]) {
var content = sel[name+"["+n+"]"];
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();
var items = location.search.substr(1).split("&");
var itemNameBefore = "";
var n = 0;
for (var index = 0; index < items.length; index++) {
var item = items[index].split("=");
var itemName = urldecode(item[0]);
if (itemName == itemNameBefore) ++n;
else n = 0;
if (itemName == "filter_ts_type[]") {
sel["type["+n+"]"] = item[1];
} else if (itemName == "filter_ts_size[]") {
sel["size["+n+"]"] = item[1];
} else if (itemName == "filter_fh_found") {
sel["hidefound"] = item[1];
} else if (itemName == "filter_fh_notFound") {
sel["hidenotfound"] = item[1];
} else if (itemName == "filter_fh_hides") {
sel["hideowned"] = item[1];
} else if (itemName == "filter_pmo_pmo") {
sel["hidepremium"] = item[1];
} else if (itemName == "filter_dt_difficulty[]") {
sel["difficulty["+n+"]"] = item[1];
} else if (itemName == "filter_dt_terrain[]") {
sel["terrain["+n+"]"] = item[1];
} else if (itemName == "filter_crc_countries[]") {
sel["multi_country["+n+"]"] = urldecode(item[1]);
} else if (itemName == "filter_crc_regions[]") {
sel["multi_countryregion["+n+"]"] = urldecode(item[1]);
} else if (itemName == "filter_cr_centerLocation") {
sel["location"] = urldecode(item[1]);
} else if (itemName == "filter_cr_radius") {
sel["max_distance"] = item[1];
} else if (itemName == "filter_cr_units") {
sel["unit"] = item[1];
} else if (itemName == "filter_hd_toDate") {
var hidden = item[1].split("-");
sel["hidden_toyyyy"] = hidden[0];
sel["hidden_tomm"] = hidden[1];
sel["hidden_todd"] = hidden[2];
}
itemNameBefore = itemName;
}
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 ($('#pgc-navbar-locale .nav-link img[src*="country_flags"]')[0]) {
var match = $('#pgc-navbar-locale .nav-link 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 ($('#pgc-navbar-locale .dropdown-menu a[data-locale*="_' + lang + '"]')[0]) {
var langReal = $('#pgc-navbar-locale .dropdown-menu a[data-locale*="_' + lang + '"]')[0].dataset.locale.replace('_'+lang, '');
return langReal;
}
}
}
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. Certitude ($$cap)
///////////////////////
// URLs for testing:
// https://www.certitudes.org/certitude?wp=GC8J1H9
// https://www.certitudes.org/certitude?wp=GC71TFG (with fileurl and filename)
// Certitude: GCLH
var mainCertitudes = function() {
// Certitude stay anonymous.
if (document.location.href.match(/^https:\/\/www\.certitudes\.org\/certitude\?wp=[A-Z0-9]{1,15}/) && settings_anonymous_on_certitude && document.getElementsByName('anonymous')[0]) {
try {
document.getElementsByName('anonymous')[0].checked = true;
} catch(e) {gclh_error("Certitude stay anonymous.",e);}
}
// Certitude compact information and copy to clipboard button.
if (document.location.href.match(/^https:\/\/www\.certitudes\.org\/certify/) && settings_show_compact_certitude_information && $('.user-input .embossed.success')[0] && $('.user-input .embossed.success')[0].innerHTML) {
try {
function copyElementByIdToClipboard(element) {
try {
var range = document.createRange();
range.selectNode(document.getElementById(element));
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand("copy");
window.getSelection().removeAllRanges();
} catch(e) {gclh_error("Certitude copy to clipboard",e);}
}
function addCompactCertitude() {
var output = ' ';
if ($('form.card')[0]) {
$('form.card:first').after(output);
var copyBtn = document.querySelector('.gclh_copy_btn');
copyBtn.addEventListener('click', function(event) {
copyElementByIdToClipboard('gclh_solution');
})
}
}
addCompactCertitude();
var css = '';
css += '.certifys-container {grid-template-columns: 300px auto 200px;}';
css += '.header {grid-template-columns: 300px auto;}';
appendCssStyle(css);
} catch(e) {gclh_error("mainCertitudes",e);}
}
}; // End of mainCertitudes.
///////////////////////////
// 5. 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 = '
';
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 lnglatString = [];
var poiString = [];
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, Bikerouter, Flopp's Map, GPSVisualizer, Openrouteservice and Copy Data links.
if ((settings_show_brouter_link || settings_show_bikerouter_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' }, 'STAMEN_TERRAIN': { maxZoom: 20, displayName: 'Stamen Terrain' }, 'HUMANITARIAN': { maxZoom: 20, displayName: 'Humanitarian' }, 'ARCGIS_WORLDIMAGERY': { maxZoom: 20, displayName: 'World Imagery' }, 'ARCGIS_WORLDIMAGERY_OVERLAY': { maxZoom: 20, displayName: 'World Imagery + Overlay' }},
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 Bikerouter with all waypoints of a cache.
if (settings_show_bikerouter_link) {
try {
const language = unsafeWindow.serverParameters["app:options"]?.localRegion?.split('-')[0] || 'en';
mapservice_link( {
uniqueServiceId: "bikerouter",
urlTemplate: 'https://bikerouter.de/?lng=' + language + '#map={zoom}/{center_latitude}/{center_longitude}/{map}&lonlats={waypoints}&profile=shortest',
layers: {'OpenStreetMap': { maxZoom: 18, displayName: 'OpenStreetMap' }, 'OpenStreetMap.de': { maxZoom: 18, displayName: 'OSM German Style' }, 'OpenTopoMap': { maxZoom: 15, 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 Bikerouter", icon : true, icondata : global_bikerouter_icon },
waypointtable : { linkText : "Show route on Bikerouter with …", icon : false },
maxUrlLength: 4000,
action: mapservice_open,
context : {},
useHomeCoords: false,
runWithOneWaypoint: true
});
} catch(e) {gclh_error("Show button Bikerouter and open Bikerouter",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);}
}
}
// Add link to admin tools to right sidebar.
if (is_page("cache_listing") && document.getElementById("ctl00_ContentBody_GeoNav_adminTools")) {
try {
if (document.getElementById('ctl00_ContentBody_GeoNav_uxArchivedLogType').children[0].href) {
var maintenance_link = document.getElementById('ctl00_ContentBody_GeoNav_uxArchivedLogType').children[0].href.replace('LogType=5', 'LogType=46')
$("#ctl00_ContentBody_GeoNav_adminTools").append('
";
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") && !global_isBasic) {
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 (settings_adapt_height_cache_notes) {
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);}
// Create Character Counter for Personal Cache Note.
try {
$('#cacheNoteText + div').append('');
createCounterElement('personalCacheNoteCount', $('#cacheNoteText')[0], {anchor: $('#gclh_char_count')[0], initLength: $('#srOnlyCacheNote').html().length})
} catch(e) {gclh_error("Create Character Counter for Personal Cache Note",e);}
// Append CSS.
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_code_no_brackets, 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");
}
// Log form, log edit, log view redesigned new log page:
// "side" als Objekt geht verloren, wenn zwischenzeitlich ein Refresh der Seitendaten stattfindet, deshalb immer neu ermitteln.
} else if (document.location.pathname.match(/\/live\/(?:log\/(?:gl|tl)|(?:geocache|trackable)\/(?:gc|tb))[a-z0-9]+/i)) {
let hiddenUsername = '';
let hiddenGuid = '';
let loggedUsername = '';
let loggedGuid = '';
function checkBuildSendIcons(waitCount, username, guid, sideX) {
side = $(sideX)[0];
if (!$('.gclh_send')[0] && side && username && guid) {
buildSendIcons(side, username, "per guid", guid);
}
waitCount++;
if (waitCount <= 50) setTimeout(function(){checkBuildSendIcons(waitCount, username, guid, sideX);}, 200);
}
function getUserGuid(sideX) {
side = $(sideX)[0];
var userParts = side.href.match(/\.com\/p(\?|\/\?)(id=|code=|u=)(.+)/);
if (userParts && userParts[3]) {
var userLink = "/p/default.aspx?" + userParts[2] + userParts[3] + "&tab=geocaches";
GM_xmlhttpRequest({
method: "GET",
url: userLink,
onload: function(response) {
if (response.responseText) {
var [username, guid] = getUserGuidFromProfile(response.responseText);
if (sideX.match(/hidden/)) {
hiddenUsername = username;
hiddenGuid = guid;
} else {
loggedUsername = username;
loggedGuid = guid;
}
if (username && guid) {
checkBuildSendIcons(0, username, guid, sideX);
}
}
}
});
}
}
let url = '';
const config = { childList: true, subtree: true };
const logviewSendIconsObserver = new MutationObserver(function(_, observer) {
observer.disconnect();
if (url !== document.location.pathname) {
if (is_page('logform') && $('.hidden-by a')[0]) {
if (hiddenUsername == '') getUserGuid('.hidden-by a');
else checkBuildSendIcons(0, hiddenUsername, hiddenGuid, '.hidden-by a');
url = document.location.pathname;
} else if (document.location.pathname.match(/\/live\/log\/(?:gl|tl)[a-z0-9]+/i) && $('.log-sub-header a')[0]) {
if (loggedUsername == '') getUserGuid('.log-sub-header a');
else checkBuildSendIcons(0, loggedUsername, loggedGuid, '.log-sub-header a');
url = document.location.pathname;
}
}
observer.observe(document.body, config);
});
logviewSendIconsObserver.observe(document.body, config);
// 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);}
// Remove banners (blue banners).
if (settings_remove_banner) {
try {
// To activate the (x) button for a new banner, just change the following jq selector (use a comma and a new banner selector)
$('div.blue-banner-content,div.banner').each(function( index ) {
const bannerEl = $(this);
const bannerTextSum = bannerEl.text().checksum();
if (settings_remove_banner_text_ids.find(link => link === bannerTextSum)) {
$(bannerEl)[0].style.display = 'none';
} else {
const closeElId = 'closeBanner' + index; // hack for bind event
bannerEl.prepend('✖');
bannerEl.find('#' + closeElId).bind({
click: function() {
settings_remove_banner_text_ids.push(bannerTextSum);
setValue("settings_remove_banner_text_ids", JSON.stringify(settings_remove_banner_text_ids));
$(bannerEl)[0].style.display = 'none';
}
});
}
});
} 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);}
}
// Set copy coordinates to clipboard button for Waypoints.
if (settings_listing_ctoc_coords_waypoints && is_page("cache_listing")) {
try {
var tbl = getWaypointTable();
var length = tbl.find("tbody > tr").length;
for (var i=0; i tr").eq(i*2);
var cellCoordinates = row1st.find("td:eq(5)");
var tmp_coords = toDec(cellCoordinates.text().trim());
if (typeof tmp_coords[0] !== 'undefined' && typeof tmp_coords[1] !== 'undefined') {
addCopyToClipboardLink(cellCoordinates.text().trim(), cellCoordinates[0].childNodes[0], "Coordinates");
}
}
} catch(e) {gclh_error("Set copy to clipboard button for Waypoints",e);}
}
// 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 {
var 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/)) {
console.error("GClh_ERROR (no header alert) - addElevationToWaypoints_GeonamesElevation() - " + document.location.href + ": Service Unavailable.");
console.log(responseDetails);
} else {
console.error("GClh_ERROR (no header alert) - addElevationToWaypoints_GeonamesElevation() - " + document.location.href + ": Unknown error, see details.");
console.log(responseDetails);
}
getElevations(context.retries+1,context.locations);
} else {
try {
var json = JSON.parse(responseDetails.responseText);
} catch(e) {
console.error("GClh_ERROR (no header alert) - addElevationToWaypoints_GeonamesElevation() - " + document.location.href + ": JSON.parse failed.");
console.log("responseDetails.responseText: "+responseDetails.responseText);
console.log(responseDetails);
getElevations(context.retries+1,context.locations);
return;
}
if (!json.geonames) {
console.error("GClh_ERROR (no header alert) - addElevationToWaypoints_GeonamesElevation() - " + document.location.href + ": json.geonames is undefined.");
console.log(responseDetails);
getElevations(context.retries+1,context.locations);
} else {
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, pass_through_field = '') { // Elevation pass through field step 2.
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|guid|ID|wp|LUID|PLogGuid|code)\=/) && 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);}
}
function buildCssACI(css) {
if (!css) var css = '';
css += '#aci {margin-left: 4px; margin-right: 2px; margin-top: 1px; 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){
// Add cache type icon and limit cachetitle
var type = $(text).find('.cacheDetailsTitle a')[0].getAttribute("title");
var typeIcon = $(text).find('.activity-type-icon svg')[0];
var linkHeader = document.getElementsByClassName('subheader')[0];
if (type && typeIcon && linkHeader) {
var cacheName = $('.subheader')[0].innerHTML;
typeIcon.setAttribute("style", "vertical-align: sub; height: 19px; width: 19px;");
var typeIconSpan = document.createElement("span");
typeIconSpan.setAttribute("class", "gclh_TypeIcon");
typeIconSpan.setAttribute("style", "margin-right: 4px; margin-top: 3px; float: left;");
typeIconSpan.setAttribute("title", type);
linkHeader.setAttribute("style", "white-space: nowrap; overflow: hidden; text-overflow: ellipsis;");
linkHeader.setAttribute("title", cacheName);
linkHeader.parentNode.insertBefore(typeIconSpan, linkHeader);
document.getElementsByClassName('gclh_TypeIcon')[0].appendChild(typeIcon);
}
// Favorite points and favorite percent.
var aci = '';
var favoritePoints = $(text).find('.favorite-value').html();
if (favoritePoints) {
favoritePoints = favoritePoints.replace('.','').replace(',','');
favoritePoints = parseInt(favoritePoints);
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 += '';
}
// Difficulty and Terrain
var difficulty = $(text).find('#ctl00_ContentBody_uxLegendScale img');
var terrain = $(text).find('#ctl00_ContentBody_Localize12 img')
if ((difficulty[0]) && (terrain[0])) {
difficulty = difficulty[0].getAttribute("alt").split(" ")[0];
terrain = terrain[0].getAttribute("alt").split(" ")[0];
aci += separator(aci);
aci += '';
aci += '';
aci += ' ' + difficulty + ' ';
aci += '';
aci += '';
aci += '';
aci += ' ' + terrain + '';
aci += '';
}
// Output and further load.
if (aci != '') {
$('#aci')[0].innerHTML = aci;
let gccode;
// Beim Ändern eines Logs steht der GC Code nicht zur Verfügung, deshalb gibt es dort auch keinen Prozentsatz für die Favoriten.
if ($('#uxNewLoggingBannerLink')[0]) {
gccode = $('#uxNewLoggingBannerLink').attr('href').split('/').at(-2);
}
if (favoritePoints && !gccode == '') getFavoriteScore(gccode, function(score) {
$('.favorite_percent')[0].innerHTML = ' ' + score + '%';
});
}
});
}
// Add copy to clipboard links to geocaches and trackables old log page for Log ID and Logtext.
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)\=/))) {
try {
if ($('.CoordInfoLink')[0] && $('#ctl00_ContentBody_LogBookPanel1_CoordInfoLinkControl1_uxCoordInfoCode')[0]) {
addCopyToClipboardLink($('#ctl00_ContentBody_LogBookPanel1_CoordInfoLinkControl1_uxCoordInfoCode')[0], $('.CoordInfoLink')[0], "Log ID");
}
if ($('.LogEdit')[0] && $('#ctl00_ContentBody_LogBookPanel1_LogText')[0]) {
addCopyToClipboardLink(document.getElementById('ctl00_ContentBody_LogBookPanel1_LogText').innerText, $('.LogEdit')[0], "Logtext", 'padding: 4px 14px; position: relative; bottom: 5px;');
}
} catch(e) {gclh_error("Copy to Clipboard on log page",e);}
}
// 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, aGCType] = 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);}
}
// Script für insert Smilie by click.
function insert_smilie_fkt(id) {
var code = "function gclh_insert_smilie(aTag,eTag){";
code += " var input = document.getElementById('"+id+"');";
code += " if (typeof input.selectionStart != 'undefined') {";
code += " var start = input.selectionStart;";
code += " var end = input.selectionEnd;";
code += " var insText = input.value.substring(start, end);";
code += " input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);";
code += " if (insText.length == 0) var pos = start + aTag.length;";
code += " else var pos = start + aTag.length + insText.length + eTag.length;";
code += " input.selectionStart = input.selectionEnd = pos;";
code += " }";
code += " input.focus();";
// Auch im Log Preview zur Anzeige bringen.
code += " input.dispatchEvent(new KeyboardEvent('keyup', {'keyCode': 32}));";
code += "}";
injectPageScript(code, 'body');
}
// Script für insert Log Template by click.
function insert_tpl_fkt() {
finds = global_findCount;
var [aDate, aTime, aDateTime] = getDateTime();
var me = global_me;
aOwner = aOwner.replace(/'/g,"\\'");
var code = "function gclh_insert_tpl(id){";
code += " var aLogDate = document.getElementById('uxDateVisited').value;";
code += " var input = document.getElementById('ctl00_ContentBody_LogBookPanel1_uxLogInfo');";
code += " var finds = '" + finds + "';";
code += " var aDate = '" + aDate + "';";
code += " var aTime = '" + aTime + "';";
code += " var aDateTime = '" + aDateTime + "';";
code += " var me = '" + me + "';";
code += " var aGCTBName = '" + aGCTBName + "';";
code += " var aGCTBLink = '" + aGCTBLink + "';";
code += " var aGCTBNameLink = '" + aGCTBNameLink + "';";
code += " var aGCType = '" + aGCType + "';";
code += " var settings_replace_log_by_last_log = " + settings_replace_log_by_last_log + ";";
code += " var owner = '" + aOwner + "';";
code += " var inhalt = document.getElementById(id).innerHTML;";
code += " inhalt = inhalt.replace(/\\&\\;/g,'&');";
code += " if (finds) {";
code += " inhalt = inhalt.replace(/#found_no-?(\\d+)?#/ig, (_match, p1) => p1 ? finds - p1 : finds);";
code += " finds++;";
code += " inhalt = inhalt.replace(/#found-?(\\d+)?#/ig, (_match, p1) => p1 ? finds - p1 : finds);";
code += " }";
code += " if (aDate) inhalt = inhalt.replace(/#Date#/ig, aDate);";
code += " if (aTime) inhalt = inhalt.replace(/#Time#/ig, aTime);";
code += " if (aDateTime) inhalt = inhalt.replace(/#DateTime#/ig, aDateTime);";
code += " if (me) inhalt = inhalt.replace(/#me#/ig, me);";
code += " if (aGCTBName) inhalt = inhalt.replace(/#GCTBName#/ig, aGCTBName);";
code += " if (aGCTBLink) inhalt = inhalt.replace(/#GCTBLink#/ig, aGCTBLink);";
code += " if (aGCTBNameLink) inhalt = inhalt.replace(/#GCTBNameLink#/ig, aGCTBNameLink);";
code += " if (aLogDate) inhalt = inhalt.replace(/#LogDate#/ig, aLogDate);";
code += " if (aGCType) inhalt = inhalt.replace(/#GCType#/ig, aGCType);";
code += " if (owner) inhalt = inhalt.replace(/#owner#/ig, owner);";
code += " if (id.match(/last_logtext/) && settings_replace_log_by_last_log) {";
code += " input.value = inhalt;";
code += " } else {";
code += " if (typeof input.selectionStart != 'undefined' && inhalt) {";
code += " var start = input.selectionStart;";
code += " var end = input.selectionEnd;";
code += " var insText = input.value.substring(start, end);";
code += " input.value = input.value.substr(0, start) + inhalt + input.value.substr(end);";
code += " var pos = start + inhalt.length;";
code += " input.selectionStart = input.selectionEnd = pos;";
code += " }";
code += " }";
code += " input.focus();";
// Auch im Log Preview zur Anzeige bringen.
code += " input.dispatchEvent(new KeyboardEvent('keyup', {'keyCode': 32}));";
code += "}";
injectPageScript(code, 'body');
}
// Smilies aufbauen.
function build_smilies() {
var o = "
";
liste += " " + o;
bs("[:)]", "🙂");
bs("[:D]", "😁");
bs("[8D]", "😎");
bs("[:I]", "🤭");
bs("[:P]", "😛");
liste += "
');
$.ajax({
url: url,
type: 'POST',
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ dto: { data: fav.data("id"), ut: 2, p: $(fav.children().get(0)).html() } }),
dataType: 'json',
success: function (result) {
fav[0].closest('td').nextElementSibling.innerHTML = (result.d.score ? (result.d.score > 100 ? 100 : result.d.score) : 0);
}
});
});
}
if ($('.gclh_last_line')[0]) {
// Button "Open in new tabs" for pqs and nearest.
if ((li0 == 'p' && settings_open_tabs_pqs) || (li0 == 'n' && settings_open_tabs_nearest)) {
$('.gclh_last_line').append(' ');
$('#gclh_open_tabs')[0].addEventListener("click", function() {
var caches = [];
$('table.Table tr').each(function() {
if ($(this).find('input.Checkbox')[0] && $(this).find('input.Checkbox')[0].checked && $(this).find('.lnk')[0] && $(this).find('.lnk')[0].href) {
var match = $(this).find('.lnk')[0].href.match(/\.com\/geocache\/(.*?)(_|$)/);
if (match && match[1]) {
if (browser == 'chrome') window.open('https://coord.info/'+match[1]);
else caches.push(match[1]);
}
}
});
if (browser != 'chrome') {
for (var i=caches.length-1; i>=0; i--) {
window.open('https://coord.info/'+caches[i]);
}
}
}, false);
}
}
appendCssStyle(css);
} catch(e) {gclh_error("Improve PQs ...",e);}
}
// Pocket query set default value for new one, set warning message.
if (document.location.href.match(/\.com\/pocket\/gcquery\.aspx/)) {
try {
function setDefaultsInPQ() {
var idCB = "#ctl00_ContentBody_";
var idOp = "#ctl00_ContentBody_cbOptions_";
var idDa = "#ctl00_ContentBody_cbDays_";
if ($("p.Success").length <= 0 &&
(document.location.href.match(/aspx$/) || // New PQ.
(document.location.href.match(/aspx\?ll=/) && settings_save_as_pq_set_defaults) || // Save as PQ from Browse Map.
(document.location.href.match(/aspx\?.*&gclh_saveAsPQ=true&gclh_setDefaults=true/)) )) { // Save as PQ from Search Map.
if (settings_pq_set_cachestotal) $(idCB+"tbResults").val(settings_pq_cachestotal);
if (settings_pq_option_ihaventfound) {
$(idOp+"0").prop('checked', true);
$(idOp+"1").prop('checked', false);
}
if (settings_pq_option_idontown) {
$(idOp+"2").prop('checked', true);
$(idOp+"3").prop('checked', false);
}
if (settings_pq_option_ignorelist) $(idOp+"6").prop('checked', true);
if (settings_pq_option_isenabled) {
$(idOp+"13").prop('checked', true);
$(idOp+"12").prop('checked', false);
}
if (settings_pq_option_filename) $(idCB+"cbIncludePQNameInFileName").prop('checked', true);
if (settings_pq_set_difficulty) {
$(idCB+"cbDifficulty").prop('checked', true);
$(idCB+"ddDifficulty").val(settings_pq_difficulty);
$(idCB+"ddDifficultyScore").val(settings_pq_difficulty_score);
}
if (settings_pq_set_terrain) {
$(idCB+"cbTerrain").prop('checked', true);
$(idCB+"ddTerrain").val(settings_pq_terrain);
$(idCB+"ddTerrainScore").val(settings_pq_terrain_score);
}
if (settings_pq_automatically_day) {
var time = $(idCB+'QueryPanel legend').first().text();
if (time.match(/.*Sunday.*/)) $(idDa+"0").prop('checked', true);
else if (time.match(/.*Monday.*/)) $(idDa+"1").prop('checked', true);
else if (time.match(/.*Tuesday.*/)) $(idDa+"2").prop('checked', true);
else if (time.match(/.*Wednesday.*/)) $(idDa+"3").prop('checked', true);
else if (time.match(/.*Thursday.*/)) $(idDa+"4").prop('checked', true);
else if (time.match(/.*Friday.*/)) $(idDa+"5").prop('checked', true);
else if (time.match(/.*Saturday.*/)) $(idDa+"6").prop('checked', true);
}
}
if (settings_pq_warning) {
$(idCB+"cbOptions").after("
One or more options are in conflict and creates an empty result set. Please change your selection.
");
for (var i=0; i<=13; i++) {$(idOp+i).change(verifyPqOpt);}
verifyPqOpt();
}
setValue('settings_save_as_pq_set_defaults', false);
}
setDefaultsInPQ();
} catch(e) {gclh_error("Pocket query set defaults, set warning",e);}
}
// Marks two PQ options, which are in rejection.
function markOptInRej(opt1, opt2) {
var st = "ctl00_ContentBody_cbOptions_";
if ($("#"+st+opt1).is(':checked') && $("#"+st+opt2).is(':checked')) {
$("label[for='"+st+opt1+"'], label[for='"+st+opt2+"']").css('background-color','#ffff00');
$("label[for='"+st+opt1+"'], label[for='"+st+opt2+"']").css('color','#ff0000');
return true;
} else {
$("label[for='"+st+opt1+"'], label[for='"+st+opt2+"']").css('background-color','#ffffff');
$("label[for='"+st+opt1+"'], label[for='"+st+opt2+"']").css('color','#000000');
return false;
}
}
// Find PQ options, which are in rejection.
function verifyPqOpt() {
var status = false;
status = status | markOptInRej("0", "1"); // I haven't found / I have found
status = status | markOptInRej("2", "3"); // I don't vs. own I own
status = status | markOptInRej("4", "5"); // Are available to all users vs. Are for members only
status = status | markOptInRej("8", "9"); // Found in the last 7 days vs. Have not been found
status = status | markOptInRej("12", "13"); // Is Disabled vs. is Enabled
if (status) $("#warning").show();
else $("#warning").hide();
}
// Save as PQ from Search Map.
if (document.location.href.match(/\.com\/pocket\/gcquery\.aspx\?.*&gclh_saveAsPQ=true/)) {
try {
// Calculate the radius.
function getRadius(lat, zoom, px) {
metersPerPx = 156543.03392 * Math.cos(lat * Math.PI / 180) / Math.pow(2, zoom);
return Number(Math.ceil((metersPerPx*px/2/1000)+'e'+3)+'e-'+3);
}
// From Origin - By Coordinates: Is automatically set from the url parameters lat and lng.
// Radius.
let lat = getURLParam('lat');
let zoom = getURLParam('zoom');
let px = getURLParam('gclh_px');
let radius = getRadius(lat, zoom, px);
// Cache Types.
let cacheTypes = getURLParam('ct') ? getURLParam('ct').split('%2C') : false;
// Found Status.
let showFound = getURLParam('hf') && getURLParam('hf') == 0 ? true : false;
let hideFound = getURLParam('hf') && getURLParam('hf') == 1 ? true : false;
// Hide Status.
let showOwn = getURLParam('ho') && getURLParam('ho') == 0 ? true : false;
let hideOwn = getURLParam('ho') && getURLParam('ho') == 1 ? true : false;
// Difficult and terrin rating.
let difficulity = new Array();
let terrain = new Array();
difficulity = getURLParam('d') ? getURLParam('d').split('%2C') : [];
terrain = getURLParam('t') ? getURLParam('t').split('%2C') : [];
// Cache Size.
let cacheSize = getURLParam('cs') ? getURLParam('cs').split('%2C') : false;
// Membership type.
let basic = getURLParam('sp') && getURLParam('sp') == 0 ? true : false;
let premium = getURLParam('sp') && getURLParam('sp') == 1 ? true : false;
// Cache Status.
let enabled = getURLParam('sd') && getURLParam('sd') == 0 ? true : false;
let disabled = getURLParam('sd') && getURLParam('sd') == 1 ? true : false;
// Placed Date.
let placedDateStart = false;
if (getURLParam('pad')) placedDateStart = getURLParam('pad');
if (getURLParam('psd')) placedDateStart = getURLParam('psd');
if (getURLParam('pod')) placedDateStart = getURLParam('pod');
let placedDateEnd = false;
if (getURLParam('pbd')) placedDateEnd = getURLParam('pbd');
if (getURLParam('ped')) placedDateEnd = getURLParam('ped');
if (getURLParam('pod')) placedDateEnd = getURLParam('pod');
// Attribute.
let attr = getURLParam('att') ? getURLParam('att').split('%2C') : false;
// Warning if filters are not available at PQ.
let warningHTML = '
Warning: You have set filters that cannot be implemented in Pocket Queries. This applies to the following filters:
';
if (getURLParam('nfb') && getURLParam('nfb') != global_me) unavailableFilters += '
Not found by
';
if (getURLParam('hb') && getURLParam('hb') != global_me) unavailableFilters += '
Hidden by
';
if (getURLParam('cc')) unavailableFilters += '
Corrected coordinates
';
if (getURLParam('cn')) unavailableFilters += '
Geocache name contains
';
if (getURLParam('fp')) unavailableFilters += '
Minimum Favorite points
';
if (getURLParam('m')) unavailableFilters += '
Fill in your D/T grid
';
$('#gclh_warning ul')[0].innerHTML += unavailableFilters;
}
// Set available filters.
setTimeout(function() {
$('#ctl00_ContentBody_tbResults').val(1000);
// Radius.
$('#ctl00_ContentBody_tbRadius').val(radius);
$('#ctl00_ContentBody_rbUnitType_1').click();
// Cache types.
if (cacheTypes !== false) {
cacheTypes.forEach(function(elem) {$('#ctl00_ContentBody_cbTaxonomy input[value="'+elem+'"]').click();});
}
// Found Status.
if (settings_save_as_pq_set_all || getURLParam('hf')) {
$('#ctl00_ContentBody_cbOptions_1').prop('checked', showFound);
$('#ctl00_ContentBody_cbOptions_0').prop('checked', hideFound);
}
// Hide Status.
if (settings_save_as_pq_set_all || getURLParam('ho')) {
$('#ctl00_ContentBody_cbOptions_3').prop('checked', showOwn);
$('#ctl00_ContentBody_cbOptions_2').prop('checked', hideOwn);
}
// Difficult and terrin rating.
if (difficulity.length !== 0) {
let min = Math.min(...difficulity);
let max = Math.max(...difficulity);
// Check if the values are a straight and start at 1 or end with 5
if ((max-min)*2+1 == difficulity.length && !(min > 1 && max < 5 && min != max)) {
if (min == max) {
$('#ctl00_ContentBody_ddDifficulty')[0].selectedIndex = 1;
$('#ctl00_ContentBody_ddDifficultyScore')[0].selectedIndex = min*2 - 2;
} else if (min > 1) {
$('#ctl00_ContentBody_ddDifficultyScore')[0].selectedIndex = min*2 - 2;
} else if ((max < 5)) {
$('#ctl00_ContentBody_ddDifficulty')[0].selectedIndex = 2;
$('#ctl00_ContentBody_ddDifficultyScore')[0].selectedIndex = max*2 - 2;
}
$('#ctl00_ContentBody_cbDifficulty').prop('checked', true);
} else {
if (!$('#gclh_warning')[0]) $('#ctl00_ContentBody_QueryPanel').before(warningHTML);
let unavailableFilters = '
The difficulty rating does not match to the criteria of PQs
';
$('#gclh_warning ul')[0].innerHTML += unavailableFilters;
}
}
if (terrain.length !== 0) {
let min = Math.min(...terrain);
let max = Math.max(...terrain);
// Check if the values are a straight and start at 1 or end with 5
if ((max-min)*2+1 == terrain.length && !(min > 1 && max < 5 && min != max)) {
if (min == max) {
$('#ctl00_ContentBody_ddTerrain')[0].selectedIndex = 1;
$('#ctl00_ContentBody_ddTerrainScore')[0].selectedIndex = min*2 - 2;
} else if (min > 1) {
$('#ctl00_ContentBody_ddTerrainScore')[0].selectedIndex = min*2 - 2;
} else if ((max < 5)) {
$('#ctl00_ContentBody_ddTerrain')[0].selectedIndex = 2;
$('#ctl00_ContentBody_ddTerrainScore')[0].selectedIndex = max*2 - 2;
}
$('#ctl00_ContentBody_cbTerrain').prop('checked', true);
} else {
if (!$('#gclh_warning')[0]) $('#ctl00_ContentBody_QueryPanel').before(warningHTML);
let unavailableFilters = '
The terrain rating does not match to the criteria of PQs
';
$('#gclh_warning ul')[0].innerHTML += unavailableFilters;
}
}
// Cache Size.
if (cacheSize !== false) {
cacheSize.forEach(function(elem) {
$('#ctl00_ContentBody_cbContainers input[value="'+elem+'"]').click();
});
}
// Membership type.
if (settings_save_as_pq_set_all || getURLParam('sp')) {
if (basic) $('#ctl00_ContentBody_cbOptions_4').click();
if (premium) $('#ctl00_ContentBody_cbOptions_5').click();
}
// Cache Status.
if (settings_save_as_pq_set_all || getURLParam('sd')) {
$('#ctl00_ContentBody_cbOptions_13').prop('checked', enabled);
$('#ctl00_ContentBody_cbOptions_12').prop('checked', disabled);
}
// Date.
if (placedDateStart !== false || placedDateEnd !== false) {
$('#ctl00_ContentBody_rbPlacedBetween').click();
// Start Date.
if (placedDateStart !== false) {
let date = placedDateStart.split('-');
let yearIndex = $('#ctl00_ContentBody_DateTimeBegin_Year')[0].selectedIndex;
let yearNumber = $('#ctl00_ContentBody_DateTimeBegin_Year option')[yearIndex].innerHTML;
let difference = yearNumber-date[0];
$('#ctl00_ContentBody_DateTimeBegin_Month')[0].selectedIndex = date[1]-1;
$('#ctl00_ContentBody_DateTimeBegin_Day')[0].selectedIndex = date[2]-1;
$('#ctl00_ContentBody_DateTimeBegin_Year')[0].selectedIndex = yearIndex+difference;
} else {
$('#ctl00_ContentBody_DateTimeBegin_Month')[0].selectedIndex = 0;
$('#ctl00_ContentBody_DateTimeBegin_Day')[0].selectedIndex = 0;
$('#ctl00_ContentBody_DateTimeBegin_Year')[0].selectedIndex = $('#ctl00_ContentBody_DateTimeBegin_Year option').length-1;
}
// End Date
if (placedDateEnd !== false) {
let date = placedDateEnd.split('-');
let yearIndex = $('#ctl00_ContentBody_DateTimeEnd_Year')[0].selectedIndex;
let yearNumber = $('#ctl00_ContentBody_DateTimeEnd_Year option')[yearIndex].innerHTML;
let difference = yearNumber-date[0];
$('#ctl00_ContentBody_DateTimeEnd_Month')[0].selectedIndex = date[1]-1;
$('#ctl00_ContentBody_DateTimeEnd_Day')[0].selectedIndex = date[2]-1;
$('#ctl00_ContentBody_DateTimeEnd_Year')[0].selectedIndex = yearIndex+difference;
}
}
// Attributes
if (attr !== false) {
attr.forEach(function(elem) {
$('#ctl00_ContentBody_ctlAttrInclude_dtlAttributeIcons input[attid="'+elem+'"]').parent().find('.btn-attribute img').click();
});
}
setDefaultsInPQ();
}, 1000);
} catch(e) {gclh_error("Save as PQ from Search Map",e);}
}
// Map on create pocket query page.
if (settings_pq_previewmap && document.location.href.match(/\.com\/pocket\/gcquery\.aspx/)) {
try {
leafletInit();
$('.LatLongTable').after('').parent().css("style", "relative");
var previewMap = L.map('gclh_map', {
dragging: false,
zoomControl: true,
}).setView([0, 0],0); // to avoid problems;
var layer = (settings_pq_previewmap_layer == "" || settings_pq_previewmap_layer == "Geocaching") ? all_map_layers['OpenStreetMap Default'] : all_map_layers[settings_pq_previewmap_layer];
var layerObj = L.tileLayer( layer.tileUrl, layer ).addTo(previewMap);
// Delayed load of Groudspeaks map layer (we need an access token).
if (settings_pq_previewmap_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);
});
});
}
var marker = L.marker([0, 0],{icon: L.icon({
iconUrl: map_marker,
shadowUrl: map_marker_shadow,
iconSize: [25, 41], // size of the icon
shadowSize: [41, 41], // size of the shadow
iconAnchor: [11, 41], // point of the icon which will correspond to marker's location
shadowAnchor: [11, 41], // the same for the shadow
})}).addTo(previewMap);
var radius = L.circle([0,0], 0).addTo(previewMap);
var group = new L.featureGroup([marker, radius]);
$('#ctl00_ContentBody_rbOriginNone').closest('fieldset')[0].id = "gclh_Origin";
$('.LatLongTable input, #gclh_Origin, #ctl00_ContentBody_tbRadius, #ctl00_ContentBody_rbUnitType_0, #ctl00_ContentBody_rbUnitType_1').change(function() {
var coordType = document.getElementsByName("ctl00$ContentBody$LatLong")[0].value;
var northField = $('#ctl00_ContentBody_LatLong\\:_selectNorthSouth')[0];
var northSouth = $(northField.options[northField.selectedIndex]).text().replace('.', '');
var westField = $('#ctl00_ContentBody_LatLong\\:_selectEastWest')[0];
var westEast = $(westField.options[westField.selectedIndex]).text().replace('.', '');
var lat = "";
var lng = "";
if (coordType == "2") { // DMS
lat = northSouth + " " + $('#ctl00_ContentBody_LatLong__inputLatDegs')[0].value + " " + $('#ctl00_ContentBody_LatLong__inputLatMins')[0].value + ' ' + $('#ctl00_ContentBody_LatLong__inputLatSecs')[0].value;
lng = westEast + " " + $('#ctl00_ContentBody_LatLong__inputLongDegs')[0].value + " " + $('#ctl00_ContentBody_LatLong__inputLongMins')[0].value + ' ' + $('#ctl00_ContentBody_LatLong__inputLongSecs')[0].value;
var converted = toDec(lat + " " + lng);
lat = converted[0];
lng = converted[1];
} else if (coordType == "1") { // MinDec
lat = northSouth + " " + $('#ctl00_ContentBody_LatLong__inputLatDegs')[0].value + " " + $('#ctl00_ContentBody_LatLong__inputLatMins')[0].value;
lng = westEast + " " + $('#ctl00_ContentBody_LatLong__inputLongDegs')[0].value + " " + $('#ctl00_ContentBody_LatLong__inputLongMins')[0].value;
var converted = toDec(lat + " " + lng);
lat = converted[0];
lng = converted[1];
} else if (coordType == "0") { // DegDec
lat = (northSouth == "S" ? "-" : "") + $('#ctl00_ContentBody_LatLong__inputLatDegs')[0].value;
lng = (westEast == "W" ? "-" : "") + $('#ctl00_ContentBody_LatLong__inputLongDegs')[0].value;
}
if (!$('#ctl00_ContentBody_rbOriginWpt')[0].checked) {
lat = lng = "";
$('#gclh_map').hide();
} else {
$('#gclh_map').show();
previewMap.setView([lat, lng]);
marker.setLatLng([lat, lng]);
radius.setLatLng([lat, lng]);
var factor = (($("input[name='ctl00$ContentBody$rbUnitType']:checked").val() == "mi")?1609:1000);
radius.setRadius(parseInt($("#ctl00_ContentBody_tbRadius").val())*factor);
previewMap.fitBounds(group.getBounds(), { padding: [20, 20] });
}
});
$('.LatLongTable input').change();
} catch(e) {gclh_error("Map on create pocket query page",e);}
}
// Name for PQ from bookmark.
if ((document.location.href.match(/\.com\/pocket\/bmquery\.aspx/)) && $('#ctl00_ContentBody_lnkListName')[0]) {
try {
if ($('#ctl00_ContentBody_tbName')[0].value == "") $('#ctl00_ContentBody_tbName')[0].value = $('#ctl00_ContentBody_lnkListName')[0].innerHTML;
$('#ctl00_ContentBody_cbIncludePQNameInFileName')[0].checked = true;
} catch(e) {gclh_error("Name for PQ from bookmark",e);}
}
// Improve new lists page with my lists, bookmark lists, favorites list and ignore list.
if (is_page('lists')) {
try {
// Set lines in color for user and in zebra.
// Set correct number of columns in longtext. BMLs and Ignore List.
function setLinesInColorAndCorrectColspan() {
if ($('.rt-table .rt-tbody .rt-tr')[0] || ($('.geocache-table tbody tr')[0])) {
var lines = $('.rt-table .rt-tbody .rt-tr, .geocache-table tbody tr');
if (lines && $('.geocache-table tbody tr')[0]) {
if (settings_show_common_lists_color_user && $('.list-details')[0]) {
setLinesColorUser('settings_show_common_lists_color', 'user', lines, 1, '', 'new');
}
var numberOfColumns = $(lines[0]).find($('td')).length - 1;
$('.geocache-table tbody tr td.cache-description').each(function() {
$(this).attr('colspan', numberOfColumns);
});
}
if (lines && settings_show_common_lists_in_zebra) {
setLinesColorInZebra(settings_show_common_lists_in_zebra, lines, 1);
}
}
}
// Build dropdown with gclh stuff.
function buildDDLists() {
if (!settings_lists_show_dd) return;
if (!$('.geocache-cta-controls, .list-cta-controls')[0]) return;
// css for all stuff.
var css = '';
// css for dropdown for BML, foreign BML and ignore list.
css += '.section-controls .control-group button {';
css += ' margin-right: 12px;}';
// css for dropdown for favorites list.
css += '.list-cta-controls li {';
css += ' display: block !important;';
css += ' text-align: unset !important;';
css += ' height: unset !important;';
css += ' width: unset !important;}';
css += '.list-favorites .list-cta-controls button {';
css += ' margin-right: 12px;}';
// css for dropdown entry 'Show/hide cache descriptions'.
css += '.geocache-table tr.gclh_dd-hidden {';
css += ' display: none;}';
// Build dropdown for own BML.
if ($('.list-details .owner-view')[0]) {
buildDD(settings_lists_show_dd, '.geocache-cta-controls', css);
// Build dropdown for ignore list.
} else if ($('.list-details .ignore-header')[0]) {
buildDD(settings_lists_show_dd, '.geocache-cta-controls', css);
// Build dropdown for favorites list.
} else if ($('.list-favorites')[0]) {
buildDD(settings_lists_show_dd, '.list-cta-controls', css);
// Build dropdown for foreign BML.
} else if ($('.list-details :not(.owner-view,.ignore-header)')[0]) {
buildDD(settings_lists_show_dd, '.list-cta-controls', css);
}
// Build and run dropdown entry 'Show/hide cache descriptions' for own BML, ignore list and for foreign BML.
if ($('.list-details .owner-view')[0] || $('.list-details .ignore-header')[0] || $('.list-details :not(.owner-view,.ignore-header)')[0]) {
buildChildDD(settings_lists_hide_desc, 'gclh_hide_desc', '', hideDescLists, 'Hide cache descriptions', 'Show/hide cache descriptions', true);
hideDescLists(false);
}
// Build dropdown entry 'Upload caches from file' for own BML.
if ($('.list-details .owner-view')[0]) {
buildChildDD(settings_lists_upload_file, 'gclh_upload_file', '', uploadFileLists, 'Upload caches from file', '.gpx or .loc files, or files with separators', true, disableUploadFileLists);
}
// Build dropdown entry 'Open selected caches in new browser tabs' for own BML, ignore list and for foreign BML.
if ($('.list-details .owner-view')[0] || $('.list-details .ignore-header')[0] || $('.list-details :not(.owner-view,.ignore-header)')[0]) {
buildChildDD(settings_lists_open_tabs, 'gclh_open_tabs', '', openTabsLists, 'Open caches in new tabs', 'Open selected caches in new browser tabs', true, disableOpenTabsLists);
}
}
// Disable entry 'Open selected caches in new browser tabs' if no caches are selected.
function disableOpenTabsLists(mouseover) {
if (!$('table.geocache-table tbody tr input:checked')[0]) {
$('#gclh_open_tabs').addClass('disabled');
}
}
// 'Open selected caches in new browser tabs'.
function openTabsLists(click, entryDD) {
if (!$('#gclh_open_tabs')[0]) return;
var caches = [];
$('table.geocache-table tbody tr').each(function() {
if ($(this).find('input:checked')[0] && $(this).find('.geocache-name a')[0] && $(this).find('.geocache-name a')[0].href) {
if (browser == 'chrome') window.open($(this).find('.geocache-name a')[0].href);
else caches.push($(this).find('.geocache-name a')[0].href);
}
});
if (browser != 'chrome') {
for (var i=caches.length-1; i>=0; i--) {
window.open(caches[i]);
}
}
}
// Disable entry 'upload caches from file' if add caches functionality is not available.
function disableUploadFileLists(mouseover) {
if (!$('button.add-geocache-cta')[0] || $('button.add-geocache-cta').prop('disabled') == true) {
$('#gclh_upload_file').addClass('disabled');
}
}
// Upload caches from file.
function uploadFileLists(click, entryDD) {
if (!$('#gclh_upload_file')[0]) return;
internalCallFileAPI($('#gclh_upload_file')[0], addCachesBML);
}
// Show/hide cache descriptions.
function hideDescLists(click, entryDD) {
if (!$('#gclh_hide_desc')[0]) return;
if (click == true) {
$('#gclh_hide_desc').toggleClass('gclh_dd-hide');
if ($('#gclh_hide_desc').hasClass('gclh_dd-hide')) changeValueDD('gclh_hide_desc', 'Hide', 'Show');
else changeValueDD('gclh_hide_desc', 'Show', 'Hide');
}
if ($('#gclh_hide_desc').hasClass('gclh_dd-hide')) {
$('.geocache-table .cache-description').closest('tr').each(function() {
if (!$(this).hasClass('gclh_dd-hidden')) $(this).addClass('gclh_dd-hidden');
});
} else {
$('.geocache-table .cache-description').closest('tr').each(function() {
$(this).removeClass('gclh_dd-hidden');
});
}
}
// Improve layout.
function improveLayoutHead() {
if ($('.rt-table .rt-thead .rt-tr')[0] || $('.geocache-table thead tr')[0]) {
if ($('.gclh_improveLayoutHead')[0]) return;
var css = '';
// Compact layout.
if (settings_lists_compact_layout) {
// BML: Disable back button.
css += '.breadcrumb {display: none;}';
// BML: Set icon edit description upwards.
if ($('.edit-description')[0] && $('.structure header h1')[0]) {
$('.structure header h1 span').before($('.edit-description:first').remove().get().reverse());
css += '.edit-description {margin-left: 12px; margin-right: 4px;}';
}
// BML: Disable "Add a description about your List".
css += '.list-description.faded {display: none;}';
// BML: Disable ratings in own BML if no ratings available.
if (!$('.list-details-ratings .rate-list-link')[0] && !$('.list-details-ratings .list-ratings-link')[0]) {
css += '.list-details-ratings {display: none;}';
}
// FAVORITES: Disable description.
if ($('header.section-header')[0]) {
css += '.section-description {display: none;}';
}
// IGNORE: Disable description.
if ($('header.ignore-header')[0]) {
css += '.list-description {display: none !important;}';
}
// Description BMLs, distance.
if (!$('.gc-button-group')[0]) {
css += '.list-description {margin-bottom: 6px !important;}';
}
// Gray bar, distance and size.
css += '.section-controls {height: 40px; margin-top: 8px; margin-bottom: 8px; padding: 0 6px;}';
css += '.section-controls .page-size-controls {margin-right: 0px;}';
css += '.section-controls .pagination-controls {padding-left: 10px;}';
css += '.pagination-controls .pagination-control {height: 24px; width: 24px;}';
css += '.pagination-controls .pagination-control svg {height: 20px; width: 20px;}';
css += '.gc-labeled-select .gc-select select {padding: 6px 12px;}';
css += '.gc-labeled-select .gc-select select + svg {top: 8px;}';
// Owner BMLs, distance.
css += '.list-meta .byline {margin: 8px 0px;}';
// Multiselect action bar, distance and size.
css += '.multi-select-action-bar {padding: 5px;}';
css += '.multi-select-action-bar .multi-select-action-bar-count-section {padding-left: 0px;}';
css += '.gc-button.gc-button-has-type {line-height: 1.15; padding: 8px;}';
css += 'button.multi-select-action-bar-button:nth-child(2) {border-bottom-width: 2px; padding-bottom: 5px; padding-top: 5px; margin-right: 5px;}';
css += '#multi-select-action-bar-add-button {padding-top: 5px; padding-bottom: 5px;}';
// Button list of BMLs, size.
css += '.list-hub button.gc-button:nth-child(2) {padding-top: 1px; padding-bottom: 1px;}';
css += '.list-hub .section-header svg {width: 20px;}';
// Überschriften.
css += '.geocache-table thead th.header-multiselect {width: 42px !important;}';
css += '.geocache-table thead th {padding: 8px 4px !important; width: unset !important;}';
css += '.geocache-table .header-geocache-name {padding-left: 50px !important;}';
// My Lists, header, distance.
css += '.rt-thead .rt-tr {padding-left: 7px;}';
// My Lists, header progress bar, distance and size.
css += '.rt-thead .rt-th.list-progress-header {margin-left: 30px;}';
css += '.rt-thead .rt-th.list-status-header {margin-left: 20px;}';
// Listname and visibility, size.
css += '.structure header h1 {font-size: 21px;}';
css += '.structure header .visibility-tag {font-size: 16px;}';
}
// Disable "Back to top" button.
if (settings_lists_back_to_top) css += '.scroll-to-top {display: none;}';
// Change cursor from not allowed to default.
css += '.gc-button.gc-button-disabled {cursor: default;}';
if (!css == '') appendCssStyle(css);
if ($('table')[0]) $('table').addClass('gclh_improveLayoutHead');
if ($('.rt-table')[0]) $('.rt-table').addClass('gclh_improveLayoutHead');
}
}
function improveLayoutBody(waitCount) {
if ($('.rt-table .rt-tbody .rt-tr')[0] || $('.geocache-table tbody tr')[0]) {
var css = '';
// Compact layout.
if (settings_lists_compact_layout) {
// Column distance.
css += '.geocache-table tbody td {padding: 4px 4px;}';
// Column width.
css += '.geocache-table tbody td.cell-multiselect {width: 42px !important;}';
// Cache icon size.
css += '.geocache-type-icon {height: 35px !important; min-width: 35px !important; width: 35px !important; vertical-align: middle;}';
// GC name.
css += '.geocache-table .cell-geocache-name {align-items: unset;}';
// GC name and GC code distance.
css += '.geocache-name {margin-bottom: 0px !important; margin-top: 0px;}';
// Edit button size.
css += '.edit-geocache-button {height: 35px; width: 35px;}';
// Do not break column distance.
css += '.geocache-distance-display {white-space: nowrap;}';
// Do not break column location.
css += '.cell-geocache-location {white-space: nowrap;}';
// On the favorites a flex element is missing. That is the reason because the lines are so high.
css += '.geocache-table .cell-geocache-name {display: flex;}';
// My Lists, lines list name, size.
css += '.rt-tbody .list-name {font-size: 14px; font-weight: bold;}';
// My Lists, lines, distance.
css += '.rt-tbody .rt-tr {padding-left: 12px;}';
// My Lists, lines progress bar, distance and size.
css += '.rt-tbody .rt-tr {height: 40px;}';
css += '.rt-tbody .gc-progress-bar .meta {margin-top: 0px; position: absolute; top: 10px; margin-left: 155px; width: 72px; text-align: center;}';
css += '.rt-tbody .rt-td.list-status {margin-left: 50px;}';
// Show number of bookmark lists.
if ($('.rt-tbody .rt-tr')[0] && $('.structure header h1')[0] && $('.structure header h1')[0].childNodes[0]) {
if (!$('.gclh_number_of_lines')[0]) {
var span = document.createElement('span');
span.setAttribute('class', 'gclh_number_of_lines');
span.setAttribute('title', 'Number of lists');
$('.structure header h1')[0].childNodes[0].after(span);
}
$('.gclh_number_of_lines')[0].innerHTML = ' (' + $('.rt-tbody .rt-tr').length + ')';
}
// Indent of longtext until cache name on BMLs and Ignore List.
if ($('.list-details')[0]) css += '.cache-description {padding-left: 51px !important;}';
}
// Improve disabled caches.
if (settings_lists_disabled) {
var items = $('.geocache-details .geocache-status.disabled').closest('.geocache-details');
if (items) {
for (var i = 0; i < items.length; i++) {
if ($(items[i]).find($('.geocache-name'))[0]) {
if (!$(items[i]).find($('.geocache-name')).hasClass('disabled')) {
$(items[i]).find($('.geocache-name')).addClass('disabled');
}
if (!$(items[i]).find($('.geocache-name'))[0].getAttribute('title') == 'disabled') {
$(items[i]).find($('.geocache-name'))[0].setAttribute('title', 'disabled');
}
}
}
}
css += '.geocache-name.disabled a {color: #' + settings_lists_disabled_color + ';}';
css += '.geocache-name.disabled a {text-decoration: ' + (settings_lists_disabled_strikethrough == true ? "line-through" : "none") + '}';
}
// Improve archived caches.
if (settings_lists_archived) {
var items = $('.geocache-details .geocache-status.archived').closest('.geocache-details');
if (items) {
for (var i = 0; i < items.length; i++) {
if ($(items[i]).find($('.geocache-name'))[0]) {
if (!$(items[i]).find($('.geocache-name')).hasClass('archived')) {
$(items[i]).find($('.geocache-name')).addClass('archived');
}
if (!$(items[i]).find($('.geocache-name'))[0].getAttribute('title') == 'archived') {
$(items[i]).find($('.geocache-name'))[0].setAttribute('title', 'archived');
}
}
}
}
css += '.geocache-name.archived a {color: #' + settings_lists_archived_color + ';}';
css += '.geocache-name.archived a {text-decoration: ' + (settings_lists_archived_strikethrough == true ? "line-through" : "none") + '}';
}
// Set premium identifier in own column.
if (settings_lists_premium_column) {
if (!$('.header-premium-gclh')[0]) {
$('table thead th.header-geocache-name').after('
PMO
');
}
$('table tbody tr').each(function() {
if (!$(this).find('.cell-premium-gclh')[0]) {
if ($(this).find('.cell-geocache-name .geocache-status')[0] && $(this).find('.cell-geocache-name .geocache-status')[0].innerHTML.match(/premium/i)) {
$(this).find('.cell-geocache-name').after('
');
}
});
css += '.found-gclh {height: 16px; width: 16px; vertical-align: sub;}';
css += '.header-found-gclh {cursor: default;}';
}
// Show GClh "Log it" icon on BMLs.
if (settings_lists_show_log_it && !$('.gc-button-group')[0]) {
$('table tbody tr .geocache-details').each(function() {
if (!$(this).find('.gclh_log_it')[0]) {
var gccode = $(this).find('.geocache-code')[0].innerHTML.match(/\|\s(.*)$/);
if (gccode && gccode[1]) {
$(this).find('.geocache-name a').after(' ');
}
}
});
css += '.gclh_log_it img {vertical-align: top;}';
}
// Set cache type icons visible.
if (settings_lists_icons_visible) {
if (settings_lists_cache_type_icons_visible) setIconsVisible('svg.geocache-type-icon use', true);
else setIconsVisible('svg.geocache-type-icon use', false);
}
// Set log status icons visible.
if (settings_lists_icons_visible) {
if (settings_lists_log_status_icons_visible) setIconsVisible('svg.log-status use', true);
else setIconsVisible('svg.log-status use', false);
}
function setIconsVisible(pfad, visible) {
var items = $('.list-item-details');
if (items) {
for (var i = 0; i < items.length; i++) {
if ($(items[i]).find('.geocache-status.archived, .geocache-status.disabled')[0]) {
if ($(items[i]).find(pfad)[0]) {
var attrib = $(items[i]).find(pfad)[0].getAttribute('xlink:href');
if (visible == true) {
if (attrib && attrib.match(/#(.*)_disabled/)) {
$(items[i]).find(pfad)[0].setAttribute('xlink:href', attrib.replace('_disabled', ''));
}
} else {
if (attrib && !attrib.match(/#(.*)_disabled/)) {
$(items[i]).find(pfad)[0].setAttribute('xlink:href', attrib + '_disabled');
}
}
}
}
}
}
}
setLinesInColorAndCorrectColspan();
if (!$('.gclh_improveLayoutBody')[0] && !css == '') appendCssStyle(css);
if ($('table')[0] && !$('table').hasClass('gclh_improveLayoutBody')) $('table').addClass('gclh_improveLayoutBody');
if ($('.rt-table')[0] && !$('table').hasClass('gclh_improveLayoutBody')) $('.rt-table').addClass('gclh_improveLayoutBody');
}
// Solution for:
// - If a delete of a cache is done not on the first page, the columns are not positioned correctly.
// - If a delete of a cache is done, the line color is not correct.
waitCount++;
if (waitCount <= 200) setTimeout(function(){improveLayoutBody(waitCount);}, 50);
}
// Processing all steps.
function processAll() {
improveLayoutHead();
improveLayoutBody(0);
setLinesInColorAndCorrectColspan();
buildDDLists();
}
// Build mutation observer for target.
function buildObserverLists(target) {
var observerLists = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
processAll();
checkForBuildAllObserverLists();
});
});
var config = { attributes: true, childList: true, characterData: true };
observerLists.observe($(target)[0], config);
}
// Check if mutation observer for target can be build.
function checkForBuildObserverLists(waitCount, target, observerClass) {
if ($(target)[0]) {
if ($('.'+observerClass)[0]) return;
$(target).addClass(observerClass);
buildObserverLists(target);
} else {waitCount++; if (waitCount <= 200) setTimeout(function(){checkForBuildObserverLists(waitCount, target, observerClass);}, 50);}
}
// Check if mutation observer can be build.
function checkForBuildAllObserverLists() {
checkForBuildObserverLists(0, '#app-root', 'gclh_observer_app-root');
checkForBuildObserverLists(0, '#app-root .structure', 'gclh_observer_structure');
checkForBuildObserverLists(0, '#app-root .structure .content', 'gclh_observer_content');
}
processAll();
checkForBuildAllObserverLists();
} catch(e) {gclh_error("Improve new lists page",e);}
}
// Add buttons to old bookmark lists and watchlist to select caches.
var current_page;
if (document.location.href.match(/\.com\/bookmarks/) && !document.location.href.match(/\.com\/bookmarks\/default/)) current_page = "bookmark";
else if (document.location.href.match(/\.com\/my\/watchlist\.aspx/)) current_page = "watch";
if (!!current_page) {
try {
var checkbox_selector = 'input[type=checkbox]';
var table = $('table.Table').first();
var rows = table.find('tbody tr');
var checkboxes = table.find(checkbox_selector);
if (table.length > 0 && rows.length > 0 && checkboxes.length > 0) {
var button_wrapper = $('
').append(button_wrapper));
table.append(tfoot);
checkboxes.prop('checked', false);
sumsChangeAllFields();
if ($('#ctl00_ContentBody_WatchListControl1_uxWatchList_ctl00_uxChkAll')[0]) $('#ctl00_ContentBody_WatchListControl1_uxWatchList_ctl00_uxChkAll')[0].style.display = "none";
if ($('#ctl00_ContentBody_ListInfo_uxUncheckAllImage')[0]) $('#ctl00_ContentBody_ListInfo_uxUncheckAllImage')[0].style.display = "none";
}
} catch(e) {gclh_error("Add buttons to bookmark list and watchlist",e);}
}
function prepare_events() {
var today = new Date();
table.find('img[src*="/sm/6."],img[src*="/sm/13."],img[src*="/sm/453."],img[src*="/sm/7005."]').closest('td').each(function() {
var url = (current_page == "bookmark" ? this.children[0].href : this.nextElementSibling.children[0].href)
$.get(url, null, function(text){
url = url.replace("https://www.geocaching.com", "");
var name = $(text).find('#ctl00_ContentBody_CacheName').closest('span')[0];
// Date looks like "end: new Date(2014, 06-1, 21,".
var tDate = text.match(/end:\snew\sDate\((([12]\d{3}),\s(0[1-9]|1[0-2])-\d,\s(0[1-9]|[12]\d|3[01])),/);
if (name && name.innerHTML && tDate && tDate[2] && tDate[3] && tDate[4]) {
var date = new Date(tDate[2], tDate[3]-1, tDate[4]);
if ($('#ctl00_ContentBody_ListInfo_uxListOwner')[0]) var a = table.find('a[href*="'+url+'"]').find('img').closest('a')[0];
else var a = table.find('a[href*="'+url+'"]').closest('a')[0];
if ($(a).find('span')[0]) {
$(a).find('span')[0].innerText = "";
if ($(a).find('span')[0].nextSibling) $(a).find('span')[0].nextSibling.data = ""; }
else if ($(a).find('img')[0]) $(a).find('img')[0].nextSibling.data = "";
else a.innerText = "";
var span = document.createElement('span');
a.append(span);
$(a).find('span')[0].innerText = " " + name.innerHTML;
var span = document.createElement('span');
span.innerHTML = " (" + date.toLocaleDateString() + ")";
a.parentNode.insertBefore(span, a.nextSibling);
if (today.getTime() > date) {
$(a).find('span')[0].className += " gclhPastEvent";
$(a).find('span')[0].title += "Past Event";
a.nextSibling.title = "Past Event";
a.nextSibling.style.color = "#8c0b0b";
sums["PastEvents"]++;
sumsChangeFields("PastEvents", sums["chPastEvents"], sums["PastEvents"]);
} else a.nextSibling.title = "Event Date";
}
});
});
}
// Summenfelder Anzahl Caches definieren, Configparameter setzen.
function sumsCreateFields(configParameter) {
var sums = new Object();
sums["All"] = sums["chAll"] = sums["Found"] = sums["chFound"] = sums["Archived"] = sums["chArchived"] = sums["Deactivated"] = sums["chDeactivated"] = sums["chPastEvents"] = 0;
sums["configParameter"] = configParameter;
return sums;
}
// Anzahl Caches.
function sumsCountAll() {
if (sums["configParameter"] == false) return;
sums["All"] = table.find('tbody tr').find(checkbox_selector).length;
sums["Found"] = table.find('tbody tr').find('img[src*="found"]').length;
sums["Archived"] = table.find('tbody tr').find('span.Strike.OldWarning,span.Strike.Warning').length;
sums["Deactivated"] = table.find('tbody tr').find('span.Strike:not(.OldWarning,.Warning)').length;
sums["PastEvents"] = table.find('tbody tr').find('.gclhPastEvent').length;
}
// Events für Checkboxen setzen.
function sumsSetEventsForCheckboxes(checkboxes) {
if (sums["configParameter"] == false) return;
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].addEventListener("click", function() {sumsCountChecked_Click(this);} , false);
}
}
// Platzhalter für Anzahl Caches.
function sumsOutputFields(side, kind) {
if (sums["configParameter"] == false) return;
var out = document.createElement('span');
out.setAttribute("style", "font-size: 85%; font-style: italic; margin-left: -6px; margin-right: 10px;");
out.setAttribute("id", "sums_caches_" + kind);
out.appendChild(document.createTextNode(""));
side.append(out);
}
// Werte für Anzahl Caches ändern.
function sumsChangeAllFields() {
if (sums["configParameter"] == false) return;
sumsChangeFields("All", sums["chAll"], sums["All"]);
sumsChangeFields("Found", sums["chFound"], sums["Found"]);
sumsChangeFields("Archived", sums["chArchived"], sums["Archived"]);
sumsChangeFields("Deactivated", sums["chDeactivated"], sums["Deactivated"]);
sumsChangeFields("PastEvents", sums["chPastEvents"], sums["PastEvents"]);
}
function sumsChangeFields(kind, sums_ch, sums) {
if (sums["configParameter"] == false) return;
var outSums = "(" + sums_ch + "|" + sums + ")";
var outTitle = sums_ch + " of " + sums + " caches selected";
var outId = "sums_caches_" + kind;
if (document.getElementById(outId)) {
var side = document.getElementById(outId);
side.setAttribute("title", outTitle);
side.innerHTML = outSums;
}
}
// Anzahl markierte Caches für Selektion All, None, Invert.
function sumsCountChecked_SelectionAll() {
if (sums["configParameter"] == false) return;
sums["chAll"] = sums["All"];
sums["chFound"] = sums["Found"];
sums["chArchived"] = sums["Archived"];
sums["chDeactivated"] = sums["Deactivated"];
sums["chPastEvents"] = sums["PastEvents"];
sumsChangeAllFields();
}
function sumsCountChecked_SelectionNone() {
if (sums["configParameter"] == false) return;
sums["chAll"] = sums["chFound"] = sums["chArchived"] = sums["chDeactivated"] = sums["chPastEvents"] = 0;
sumsChangeAllFields();
}
function sumsCountChecked_SelectionInvert() {
if (sums["configParameter"] == false) return;
sums["chAll"] = sums["All"] - sums["chAll"];
sums["chFound"] = sums["Found"] - sums["chFound"];
sums["chArchived"] = sums["Archived"] - sums["chArchived"];
sums["chDeactivated"] = sums["Deactivated"] - sums["chDeactivated"];
sums["chPastEvents"] = sums["PastEvents"] - sums["chPastEvents"];
sumsChangeAllFields();
}
// Anzahl markierte Caches für Click auf Checkbox.
function sumsCountChecked_Click(checkbox) {
if (checkbox.checked) sums["chAll"]++;
else sums["chAll"]--;
var cbId = checkbox.id;
if ($('#'+cbId).closest('tr').find('img[src*="found"]').length > 0) {
if (checkbox.checked) sums["chFound"]++;
else sums["chFound"]--;
}
if ($('#'+cbId).closest('tr').find('span.Strike.OldWarning,span.Strike.Warning').length > 0) {
if (checkbox.checked) sums["chArchived"]++;
else sums["chArchived"]--;
}
if ($('#'+cbId).closest('tr').find('span.Strike:not(.OldWarning,.Warning)').length > 0) {
if (checkbox.checked) sums["chDeactivated"]++;
else sums["chDeactivated"]--;
}
if ($('#'+cbId).closest('tr').find('.gclhPastEvent').length > 0) {
if (checkbox.checked) sums["chPastEvents"]++;
else sums["chPastEvents"]--;
}
sumsChangeAllFields();
}
// Anzahl markierter Caches für alles.
function sumsCountCheckedAll() {
if (sums["configParameter"] == false) return;
sums["chAll"] = table.find('tbody tr').find(checkbox_selector + ':checked').length;
sums["chFound"] = table.find('tbody tr').find('img[src*="found"]').closest('tr').find(checkbox_selector + ':checked').length;
sums["chArchived"] = table.find('tbody tr').find('span.Strike.OldWarning,span.Strike.Warning').closest('tr').find(checkbox_selector + ':checked').length;
sums["chDeactivated"] = table.find('tbody tr').find('span.Strike:not(.OldWarning,.Warning)').closest('tr').find(checkbox_selector + ':checked').length;
sums["chPastEvents"] = table.find('tbody tr').find('.gclhPastEvent').closest('tr').find(checkbox_selector + ':checked').length;
sumsChangeAllFields();
}
// Improve friends list.
if (document.location.href.match(/\.com\/my\/myfriends\.aspx/) && $('#invitation-button-root')[0]) {
try {
var friends = document.getElementsByClassName("FriendText");
var day = new Date().getDate();
var last_check = parseInt(getValue("friends_founds_last", "0"), 10);
if (settings_automatic_friend_reset && last_check != day) {
for (var i = 0; i < friends.length; i++) {
var friend = friends[i];
var name = friend.getElementsByTagName("a")[0];
if (getValue("friends_founds_new_" + name.innerHTML)) setValue("friends_founds_" + name.innerHTML, getValue("friends_founds_new_" + name.innerHTML));
if (getValue("friends_hides_new_" + name.innerHTML)) setValue("friends_hides_" + name.innerHTML, getValue("friends_hides_new_" + name.innerHTML));
}
setValue("friends_founds_last", day);
var last_autoreset = getValue("friends_founds_last_autoreset");
if (typeof(last_autoreset) != "undefined") setValue("friends_founds_last_reset", last_autoreset);
setValue("friends_founds_last_autoreset", new Date().getTime());
}
var myf =
"a.myfriends:hover {" +
" text-decoration:underline;}" +
"a.myfriends {" +
" color:#00AA00;" +
" text-decoration:none;} " +
"#invitation-button-root {display: flex;}" +
"#invitation-button-root button {padding: 8px; margin-left: 4px; line-height: 1.3; min-width: unset;}" +
".AddFriendTextbox {" +
" width:48%;}";
appendCssStyle(myf);
var sNewF = "";
var sNewH = "";
var myvips = getValue("vips", false);
if (!myvips) myvips = new Array();
else {
myvips = myvips.replace(/, (?=,)/g, ",null");
myvips = JSON.parse(myvips);
}
for (var i = 0; i < friends.length; i++) {
var friend = friends[i];
var name = friend.getElementsByTagName("a")[0];
var add = "";
// Founds.
var founds = parseInt(trim(friend.getElementsByTagName("dd")[3].innerHTML).replace(/[,.]*/g, ""));
if (isNaN(founds)) founds = 0;
var last_founds = getValue("friends_founds_" + name.innerHTML);
if (typeof(last_founds) == "undefined") {
last_founds = founds;
setValue("friends_founds_" + name.innerHTML, last_founds);
}
if ((founds - last_founds) > 0) add = " (+" + (founds - last_founds) + ")";
setValue("friends_founds_new_" + name.innerHTML, founds);
// Wenn neue Founds, dann User und Funddifferenz als Link zu string hinzufuegen (ggf. nur VIPs).
if ((settings_friendlist_summary_viponly && in_array(name.innerHTML, myvips)) || (!settings_friendlist_summary_viponly)) {
if ((founds - last_founds) > 0) {
if (sNewF != "") sNewF = sNewF + ", ";
var sHlp = name.innerHTML + " (";
if ((founds - last_founds) > 0) sHlp = sHlp + "+";
else sHlp = sHlp + "-";
sHlp = sHlp + (founds - last_founds) + ")";
sNewF = sNewF + "" + sHlp + "";
}
}
if (founds == 0) friend.getElementsByTagName("dd")[3].innerHTML = founds + " ";
else friend.getElementsByTagName("dd")[3].innerHTML = "" + founds + " " + add;
// Hides.
add = "";
var hides = parseInt(trim(friend.getElementsByTagName("dd")[4].innerHTML).replace(/[,.]*/g, ""));
if (isNaN(hides)) hides = 0;
var last_hides = getValue("friends_hides_" + name.innerHTML);
if (typeof(last_hides) == "undefined") {
last_hides = hides;
setValue("friends_hides_" + name.innerHTML, last_hides);
}
if ((hides - last_hides) > 0) add = " (+" + (hides - last_hides) + ")";
setValue("friends_hides_new_" + name.innerHTML, hides);
// Wenn neue Hides, dann User und Funddifferenz als Link zu string hinzufuegen (ggf. nur VIPs).
if ((settings_friendlist_summary_viponly && in_array(name.innerHTML, myvips)) || (!settings_friendlist_summary_viponly)) {
if ((hides - last_hides) > 0) {
if (sNewH != "") sNewH = sNewH + ", ";
var sHlp = name.innerHTML + " (";
if ((hides - last_hides) > 0) sHlp = sHlp + "+";
else sHlp = sHlp + "-";
sHlp = sHlp + (hides - last_hides) + ")";
sNewH = sNewH + "" + sHlp + "";
}
}
if (hides == 0) friend.getElementsByTagName("dd")[4].innerHTML = hides + " ";
else friend.getElementsByTagName("dd")[4].innerHTML = "" + hides + " " + add;
// Location.
var friendlocation = trim(friend.getElementsByTagName("dd")[2].getElementsByTagName("span")[0].innerHTML);
if (friendlocation != "" && friendlocation != "not listed" && friendlocation.length > 3) {
friend.getElementsByTagName("dd")[2].getElementsByTagName("span")[0].innerHTML = "" + friendlocation + "";
}
// Bottom line.
friend.getElementsByTagName("p")[0].innerHTML = "Gallery | " + friend.getElementsByTagName("p")[0].innerHTML;
}
function gclh_reset_counter(e) {
e.preventDefault();
var friends = document.getElementsByClassName("FriendText");
var resetTime = new Date().getTime();
setValue("friends_founds_last_reset", resetTime);
if (settings_automatic_friend_reset) setValue("friends_founds_last_autoreset", resetTime);
for (var i = 0; i < friends.length; i++) {
var friend = friends[i];
var name = friend.getElementsByTagName("a")[0];
var founds = 0;
var hides = 0;
founds = getValue("friends_founds_new_" + name.innerHTML, 0);
setValue("friends_founds_" + name.innerHTML, founds);
if (founds == 0) friend.getElementsByTagName("dd")[3].innerHTML = "0 ";
else friend.getElementsByTagName("dd")[3].innerHTML = "" + founds + "";
hides = getValue("friends_hides_new_" + name.innerHTML, 0);
setValue("friends_hides_" + name.innerHTML, hides);
if (hides == 0) friend.getElementsByTagName("dd")[4].innerHTML = "0 ";
else friend.getElementsByTagName("dd")[4].innerHTML = "" + hides + " ";
}
if (settings_friendlist_summary) {
// Wenn Reset, dann Differenzen nicht mehr anzeigen...
var divFH = document.getElementsByClassName("divFHclass");
for (var i = 0; i < divFH.length; i++) {
var divC = divFH[i];
divC.innerHTML = "";
}
// Und "last reset" aktualisieren.
var spanTTs = document.getElementsByClassName("spanTclass");
var ld1 = getValue("friends_founds_last_reset", 0);
spanTTs[0].innerHTML = '
Last reset was 0 seconds ago (' + new Date(parseInt(ld1, 10)).toLocaleString() + ') ';
}
}
function buildFriendlistSummary() {
// "last reset" anzeigen.
var spanT = document.createElement("span");
var ld = getValue("friends_founds_last_reset", 0);
if (ld == 0) {
ld = new Date().getTime();
setValue("friends_founds_last_reset", ld);
}
spanT.className = "spanTclass";
spanT.style.color = "gray";
spanT.style.fontSize = "smaller";
spanT.innerHTML = ' Last reset was ' + getDateDiffString(new Date().getTime(), ld) + ' ago (' + new Date(parseInt(ld, 10)).toLocaleString() + ') ';
if ((sNewH == "") && (sNewF == "")) spanT.innerHTML = ' ' + spanT.innerHTML;
document.getElementById('invitation-button-root').parentNode.insertBefore(spanT, document.getElementById('invitation-button-root').nextSibling);
// Wenn neue Hides -> anzeigen.
if (sNewH != "") {
var boxH = document.createElement("div");
boxH.innerHTML = " New hides by: " + sNewH;
boxH.className = 'divFHclass';
document.getElementById('invitation-button-root').parentNode.insertBefore(boxH, document.getElementById('invitation-button-root').nextSibling);
}
// Wenn neue Founds -> anzeigen.
if (sNewF != "") {
var boxF = document.createElement("div");
boxF.innerHTML = " New finds by: " + sNewF;
boxF.className = 'divFHclass';
document.getElementById('invitation-button-root').parentNode.insertBefore(boxF, document.getElementById('invitation-button-root').nextSibling);
}
}
function waitForInvitationButton(waitCount) {
if ($('#invitation-button-root button')[0] && $('#invitation-button-root button')[0].className) {
var buttonClasses = $('#invitation-button-root button')[0].className;
buttonClasses = buttonClasses.replace('disabled','');
buttonClasses = buttonClasses + ' gclh_resetBtn';
var button = document.createElement("button");
button.setAttribute("class", buttonClasses);
button.setAttribute("href", "javascript:void(0);");
button.addEventListener("click", gclh_reset_counter, false);
button.innerHTML = "Reset Counter";
document.getElementById("invitation-button-root").lastChild.after(button);
if (settings_friendlist_summary) buildFriendlistSummary();
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForInvitationButton(waitCount);}, 100);}
}
waitForInvitationButton(0);
} catch(e) {gclh_error("Improve friends list",e);}
}
// Improve drafts new page.
if (settings_modify_new_drafts_page && is_page('drafts')) {
try {
const logTypes = {
'Found it:': 2,
'Didn\'t find it:': 3,
'Write note:': 4,
'Archive:': 5,
'Will attend:': 9,
'Attended:': 10,
'Disable:': 22,
'Enable:': 23,
'Webcam photo taken:': 11,
'Needs maintenance:': 45,
'Owner maintenance:': 46,
'Announcement:': 74,
};
// Loading pop up.
let loadingPopup = `
message
`;
// Statistic of cache types and log types.
// type: count Tradi Multi Virtual Letterbox Event Mystery APE Webcam Locationless (Reverse) Cache CITO EC Mega GPS Maze Wherigo CC Event GC HQ GC HQ Celebration GC HQ Block Party Giga
let cacheTypesFoundCount={2:0, 3:0, 4:0, 5:0, 6:0, 8:0, 9:0, 11:0, 12:0, 13:0, 137:0, 453:0, 1304:0, 1858:0, 3653:0, 3773:0, 3774:0, 4738:0, 7005:0};
// type: count Found it Didn't find it Write note Archive Will attend Attended Disable Enable Webcam photo taken Needs maintenance Owner maintenance Announcement
let logTypesCount={2:0, 3:0, 4:0, 5:0, 9:0, 10:0, 22:0, 23:0, 11:0, 45:0, 46:0, 74:0};
function statsBtn() {
if ($('#gclh_stats_btn')[0]) return;
let html = '';
$('.sort-action').after(html);
$('#gclh_stats_btn').bind('click', showStats);
}
function showStats() {
// Remember scroll position.
var scrollPosition = window.pageYOffset;
// Loading all Drafts.
var count = $('.draft-list li:not(.drafts-empty)').length;
function scrollAndCheck() {
// Bei kleinen Bildschirmen wurde mit "top: document.body.scrollHeight" zu weit und zu schnell nach unten gescrollt, so dass der
// Spinner keine Zeit hatte anzulaufen. Mit dem Scrollen zum letzten Draft passiert das nicht.
$('.draft-item:last')[0].scrollIntoView({behavior: 'smooth'});
function waitForDrafts(waitCount) {
if ($('.draft-list li:not(.drafts-empty)').length > count) {
count = $('.draft-list li:not(.drafts-empty)').length;
scrollAndCheck();
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForDrafts(waitCount);}, 100);}
}
if ($('#draftsHub > div h1')[0] && $('#draftsHub > div h1')[0].innerHTML && $('#draftsHub > div h1')[0].innerHTML.match(/\s\((\d+)\)/)) {
if (count != $('#draftsHub > div h1')[0].innerHTML.match(/\s\((\d+)\)/)[1]) waitForDrafts(0);
else statsUpdateUi();
} else statsUpdateUi();
}
// Loading
$('body').append(loadingPopup.replace('message', 'The GClh loads all your Drafts and counts cache and log types, as well as mark double Logs.'));
scrollAndCheck();
function statsUpdateUi() {
$(window).scrollTop(scrollPosition);
for (type in cacheTypesFoundCount) {
cacheTypesFoundCount[type] = Array.from(document.querySelectorAll(`li[cache_type="${type}"]`))
.map(elem => elem.innerHTML)
.filter(elem => elem.match(/(Found it:|Attended:|Webcam photo taken:)/))
.length;
}
for (type in logTypes) {
logTypesCount[logTypes[type]] = Array.from(document.querySelectorAll('.meta dt')).map(elem => elem.innerHTML).filter(elem => elem == type).length;
}
let html = `
';
var css = "";
// Log Text und User Bereich noch etwas ausrichten, keinen Platz in der Höhe verlieren.
css += ".LogDisplayRight .LogText {min-height: unset; padding-top: 0; margin-bottom: 8px;} .LogType img {vertical-align: top; z-index: 1; position: relative;}";
css += ".favoritePoint {color: rgb(0 125 70); margin-right: 0px; margin-left: -7px; vertical-align: top;}";
css += ".logOwnerProfileName {padding-top: 0; margin-bottom: 8px;} .logIcons, .logOwnerAvatar {margin-bottom: 4px;} .logOwnerStats {margin-bottom: 0;} .logOwnerStats img {vertical-align: sub;}";
css += ".compact_logbook tbody tr > td:nth-child(1) {padding-top: 6px; padding-bottom: 0px;}";
css += ".markdown-output {margin: unset;}";
if (!settings_hide_avatar) css += ".markdown-output {min-height: 5.5em;}";
// Bilderrahmen im Log ausrichten.
css += ".LogImagesTable {margin-left: 0;} .LogImagesTable a.lnk {white-space: initial;}";
css += ".LogImagesTable a.gclh_thumb img {margin-bottom: 1px !important; margin-top: 1px; vertical-align: sub;}";
// Länge der Usernamen in den Logs beschränken, damit sie nicht umgebrochen werden.
css += ".logOwnerProfileName {max-width: 135px; display: inline-block; overflow: hidden; vertical-align: bottom; white-space: nowrap; text-overflow: ellipsis;}";
// For upvotes functionality.
if (isUpvoteActive) css += ".upvotes{display: block;}";
css += ".TableLogContent {padding-left: 0; border-left: none; margin-bottom: 0.5em;}";
css += ".log-cta {margin-bottom: 0;}";
css += ".gclh_hide_upvotes div.sort-logs, .gclh_hide_upvotes div.upvotes {display: none!important;}";
if (settings_no_wiggle_upvotes_click) css += ".upvotes .loading-container {height: " + (settings_smaller_upvotes_icons ? 20:26) +"px;}";
if (settings_no_wiggle_upvotes_click) css += "#sort_logs_working {display: none;}";
css += "#new_sort_element_upvote {width: unset; background-position-x: 95%;" + (settings_smaller_upvotes_icons ? " background-position-y: 60%; background-size: 22px; padding-top: 4px; padding-bottom: 4px;":"") + "}";
appendCssStyle(css);
} catch(e) {gclh_error("Define log-template",e);}
}
// Overwrite Log-Template (Logtemplate) and Log-Load-Function. (Muß unbedingt nach VIP laufen.)
overwrite_log_template:
if (settings_load_logs_with_gclh && is_page("cache_listing") && !document.getElementById("ctl00_divNotSignedIn") && document.getElementById('tmpl_CacheLogRow') && document.getElementById("cache_logs_table")) {
try {
// IDs der Cache Logs Tables.
var logsTab = '#cache_logs_table2, #cache_logs_table';
// To Top Link.
var a = document.createElement("a");
a.setAttribute("href", "#");
a.setAttribute("name", "gclh_top");
$('body')[0].insertBefore(a, $('body')[0].childNodes[0]);
var new_tmpl_block = document.createElement("script");
new_tmpl_block.type = "text/x-jquery-tmpl";
new_tmpl_block.innerHTML = new_tmpl;
new_tmpl_block.setAttribute("id", "tmpl_CacheLogRow_gclh");
$('body')[0].appendChild(new_tmpl_block);
// Override standard templates.
function override_standard_templates(waitCount) {
if (typeof unsafeWindow.$ !== "undefined" &&
typeof unsafeWindow.$("#tmpl_CacheLogRow").template !== "undefined" &&
typeof unsafeWindow.initialLogs !== "undefined" &&
unsafeWindow.initialLogs !== null &&
(typeof chromeUserData.includeAvatars !== "undefined" || typeof unsafeWindow.includeAvatars !== "undefined" || typeof includeAvatars !== "undefined")) {
document.getElementById('tmpl_CacheLogRow').innerHTML = new_tmpl;
var elem = unsafeWindow.$('#tmpl_CacheLogRow')[0];
unsafeWindow.$.removeData(elem, "tmpl");
unsafeWindow.$("#tmpl_CacheLogRow").template("tmplCacheLogRow");
if (browser === "chrome" || browser === "firefox") {
injectPageScriptFunction(function() {
var elem = window.$('#tmpl_CacheLogRow')[0];
window.$.removeData(elem, "tmpl");
window.$("#tmpl_CacheLogRow").template("tmplCacheLogRow");
}, "()");
}
// Reinit initalLogs.
// Timeout is necessary because otherwise the fancybox for images is not working (WTF??).
setTimeout(function(){
unsafeWindow.$("#cache_logs_table tbody").children().remove();
var initialLogs = unsafeWindow.initialLogs;
var inclAvatars = chromeUserData.includeAvatars || unsafeWindow.includeAvatars || includeAvatars;
for (var i = 0; i < initialLogs.data.length; i++) {
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(initialLogs.data[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table")).append(newBody.children());
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
unsafeWindow.$("#cache_logs_container").addClass('gclh_override_standard_templates_done');
}, 0);
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){override_standard_templates(waitCount);}, 100);}
}
override_standard_templates(0);
if (settings_hide_found_count) {
var css = "#cache_logs_container .logOwnerStats"
+ "{display:none;}";
appendCssStyle(css);
}
function loadListener(e) {
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
}
(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).addEventListener('DOMNodeInserted', loadListener);
function disablePageAutoScroll() {
var unsafeWindow = (typeof(unsafeWindow) == "undefined" ? window : unsafeWindow);
unsafeWindow.currentPageIdx = 2;
unsafeWindow.totalPages = 1;
unsafeWindow.isBusy = true;
unsafeWindow.initalLogs = initalLogs = {
"status": "success",
"data": [],
"pageInfo": {"idx": 2, "size": 0, "totalRows": 1, "totalPages": 1, "rows": 1}
};
}
// Build VIP Icons.
function gclh_add_vip_icon() {
if (!settings_show_vip_list) return;
var elements = $(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).find("a.gclh_vip").not(".gclh_vip_hasIcon");
for (var i = 0; i < elements.length; i++) {
var link = elements[i];
link = gclh_build_vipvup(link.name, global_vips, "vip", link); // Ist oben bei VIP. VUP.
unsafeWindow.$(link).addClass("gclh_vip_hasIcon");
}
if (settings_process_vup) gclh_add_vup_icon();
}
// Build VUP Icons.
function gclh_add_vup_icon() {
if (!settings_show_vip_list) return;
var elements = $(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).find("a.gclh_vup").not(".gclh_vup_hasIcon");
for (var i = 0; i < elements.length; i++) {
var link = elements[i];
link = gclh_build_vipvup(link.name, global_vups, "vup", link); // Ist oben bei VIP. VUP.
unsafeWindow.$(link).addClass("gclh_vup_hasIcon");
}
}
// Build event for bigger avatar.
function buildEventShowBiggerAvatar() {
if (!settings_show_thumbnails || !settings_listing_bigger_avatar_with_mouse) return;
var elements = $(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).find("p.logOwnerAvatar").not(".gclh_avatar_hasEvent");
for (var i = 0; i < elements.length; i++) {
var link = elements[i];
link.addEventListener('mouseover', showBiggerAvatar);
unsafeWindow.$(link).addClass("gclh_avatar_hasEvent");
}
}
var lastFired = 0;
var global_logs = false;
var global_num = 0;
// Dynamic load with full control.
function gclh_dynamic_load(logs, num) {
if (lastFired == 0 && !global_logs) {
// First run, so we set the global logs/num and add the Event listener.
global_logs = logs;
global_num = num;
window.addEventListener("scroll", function (event) {
gclh_dynamic_load(logs, num);
event.stopPropagation();
}, true);
}
var currentTime = + new Date();
if ((currentTime - lastFired) > 500) {
// Fire every 500ms at maximum.
lastFired = + new Date();
var isBusy = false;
var startReloadAtThisPixel = $(document).height() - $("#cache_logs_container").offset()?.top + 50;
var currentPosition = $(this).scrollTop();
if (currentPosition > startReloadAtThisPixel) {
// If dynamic log load is busy, disabled or all logs are already loaded, no need to continue.
if (!isBusy && !document.getElementById("gclh_all_logs_marker") && global_num < global_logs.length) {
isBusy = true;
$("#pnlLazyLoad").show();
var log_ids = [];
for (var i = 0; i < 10; i++) {
if (global_logs[global_num]) {
log_ids.push(global_logs[global_num].LogID);
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(global_logs[global_num]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
global_num++; // Num kommt vom vorherigen laden "aller" logs.
}
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
if (isUpvoteActive) updateUpvoteEvents(logs);
// Display log counters for dynamically loaded logs, if the display of the log counters is active.
if ($('.gclh_logCounter')[0] && !$('.gclh_logCounter')[0].innerHTML == "") showLogCounter();
if (!settings_hide_top_button) $("#topScroll").fadeIn();
$("#pnlLazyLoad").hide();
isBusy = false;
}
}
}
}
// Load all logs.
function gclh_load_all(logs) {
function gclh_load_all_logs() {
searchLogsReset(logs, true);
}
var para = document.getElementById('ctl00_ContentBody_lblFindCounts').nextSibling.nextSibling.nextSibling.nextSibling;
if (para && para.nodeName == 'P') para.className = para.className + ' Clear';
if (settings_show_all_logs_but) addButtonOverLogs(gclh_load_all_logs, "gclh_load_all_logs", false, "Show all logs", "", "Show all logs");
if (settings_hide_upvotes) showHideUpvotes();
if (isUpvoteActive && settings_show_hide_upvotes_but) showHideUpvotesLink();
if (settings_show_bigger_avatars_but && !settings_hide_avatar && !isMemberInPmoCache() && settings_show_thumbnails) showBiggerAvatarsLink();
if (settings_show_log_counter_but) showLogCounterLink();
if (isUpvoteActive) {
$('#new_sort_element_upvote').prop( "disabled", false );
$('#new_sort_element_upvote').removeClass("isDisabled");
}
if (settings_show_compact_logbook_but) {
addButtonOverLogs(toggle_compact_logbook, "toggle_compact_logbook", false, "Show compact logs", "", "Show/hide compact logs");
var unimportant_css = ".compact_logbook .logIcons, .compact_logbook .logOwnerAvatar, .compact_logbook .logOwnerStats, .compact_logbook .LogContent, .compact_logbook .TableLogContent, .compact_logbook .AlignRight small {display:none;}"
+ ".compact_logbook .upvotes {display:none !important;}";
appendCssStyle(unimportant_css);
}
}
// Load number of logs.
function loadNumLogs(logs, countLogs) {
setTimeout(function() {
if (logs) {
$(logsTab).find('tbody').children().remove();
for (var i = 0; i < countLogs; i++) {
if (logs[i]) {
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(logs[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
}
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
if (isUpvoteActive) updateUpvoteEvents(logs);
if (countLogs === logs.length) setMarkerDisableDynamicLogLoad(); // all logs loaded
else removeMarkerDisableDynamicLogLoad();
global_num = countLogs; // set dynamic log counter to current number of logs
}
activateLoadAndSearch();
$('#gclh_show_log_counter').removeClass("working");
if ($('#gclh_show_log_counter input')[0] && !$('#gclh_show_log_counter').hasClass('isDisabled')) {
$('#gclh_show_log_counter input')[0].removeAttribute('disabled', '');
}
}, 100);
}
// Filter logs.
function gclh_filter(logs) {
function gclh_filter_logs() {
if (!this.childNodes[0]) return false;
var log_type = '';
var title = this.childNodes[0].title;
if (!title) return false;
if (title.match(/VIP/)) log_type = "VIP";
if (title.match(/Favorite/)) log_type = "FAV";
if (log_type == '') {
var logTypeId = this.childNodes[0].src.match(/\/logtypes\/(\d+).png/);
if (logTypeId && logTypeId[1]) log_type = logTypeId[1];
}
if (log_type == '') return false;
if (this.name && this.name == "vip_list") {
document.getElementById("ctl00_ContentBody_lblFindCounts").scrollIntoView();
window.scrollBy(0, -30);
}
if (settings_show_owner_vip_list) var vip_owner = get_real_owner();
else var vip_owner = "#";
if (!logs) return false;
searchLogsReset('');
setTimeout(function() { // Force direct display refresh.
$(logsTab).find('tbody').children().remove();
for (var i = 0; i < logs.length; i++) {
if (logs[i] && (logs[i].LogTypeID == log_type || (log_type == "VIP" && (in_array(logs[i].UserName, global_vips) || logs[i].UserName == vip_owner)) || (log_type === "FAV" && logs[i].LogTypeID === 2 && logs[i].FavoritePointUsed === true))) {
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(logs[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
}
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
if (isUpvoteActive) updateUpvoteEvents(logs);
setMarkerDisableDynamicLogLoad();
activateLoadAndSearch();
}, 0);
}
if (!document.getElementById("ctl00_ContentBody_lblFindCounts").childNodes[0]) return false;
var legend = document.getElementById("ctl00_ContentBody_lblFindCounts").childNodes[0];
var new_legend = document.createElement("ul");
new_legend.className = "LogTotals";
for (var i = 0; i < legend.childNodes.length; i++) {
var li = document.createElement("li");
var link = document.createElement("a");
link.setAttribute("href", "javascript:void(0);");
link.style.textDecoration = 'none';
link.addEventListener("click", gclh_filter_logs, false);
link.appendChild(legend.childNodes[i].childNodes[0].cloneNode(true));
link.appendChild(legend.childNodes[i].childNodes[1].cloneNode(true));
li.appendChild(link);
new_legend.appendChild(li);
}
var favAvailable = false;
for (var i = 0; i < logs.length; i++) {
if (logs[i].FavoritePointUsed == true) {
favAvailable = true;
break;
}
}
if (favAvailable) {
let li = document.createElement("li");
let link = document.createElement("a");
link.setAttribute("href", "javascript:void(0);");
link.setAttribute("style", "text-decoration: none;");
link.id = "gclh_show_favorite_logs";
link.addEventListener("click", gclh_filter_logs, false);
let img = document.createElement("img");
img.setAttribute("src", "/images/icons/fave_fill_16.svg");
img.setAttribute("title", "Favorite logs");
link.appendChild(img);
link.innerHTML += ' ' + $('.favorite-value').text().trim();
li.appendChild(link);
new_legend.appendChild(li);
}
if (settings_show_vip_list) {
var li = document.createElement("li");
var link = document.createElement("a");
link.setAttribute("href", "javascript:void(0);");
link.setAttribute("name", "logs");
link.addEventListener("click", gclh_filter_logs, false);
var img = document.createElement("img");
img.setAttribute("src", global_logs_vip_icon);
img.setAttribute("title", "VIP logs");
link.appendChild(img);
li.appendChild(link);
new_legend.appendChild(li);
}
document.getElementById('ctl00_ContentBody_lblFindCounts').replaceChild(new_legend, legend);
if (document.getElementById("lnk_gclh_vip_list")) {
var side = document.getElementById("lnk_gclh_vip_list").parentNode;
var link = document.createElement("a");
link.setAttribute("href", "javascript:void(0);");
link.setAttribute("style", "padding-left: 12px;");
link.setAttribute("name", "vip_list");
link.addEventListener("click", gclh_filter_logs, false);
var img = document.createElement("img");
img.setAttribute("src", global_logs_vip_icon);
img.setAttribute("style", "margin-bottom: -2px;");
img.setAttribute("title", "VIP logs");
link.appendChild(img);
side.appendChild(link);
}
if (settings_show_log_totals) {
function waitForLogTotalsToSetLinks(waitCount) {
if ($('.gclh_LogTotals')[0] && $('.gclh_LogTotals')[0].childNodes[0]) {
var legend = $('.gclh_LogTotals')[0].childNodes[0];
for (var i = 0; i < legend.childNodes.length; i++) {
legend.childNodes[i].childNodes[0].setAttribute("href", clearUrlAppendix(document.location.href, false) + 'logs_section');
legend.childNodes[i].childNodes[0].addEventListener("click", gclh_filter_logs, false);
}
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForLogTotalsToSetLinks(waitCount);}, 100);}
}
waitForLogTotalsToSetLinks(0);
}
}
// Search logs.
function gclh_search(logs) {
function gclh_search_logs(e) {
if (e.type == 'keyup' && (e.keyCode != 13 || noSpecialKey(e) == false)) return false;
if (!logs) return false;
var search_text = $('#search_logs_input')[0].value;
if (!search_text) return false;
if ($('#search_logs_input.working')[0]) return;
deactivateLoadAndSearch();
var regexp = new RegExp("(" + search_text + ")", (getValue('set_switch_search_logs_case_sensitive', false) ? "" : "i"));
var regexpSplitComplete = new RegExp("(<.*?>|" + search_text + ")", (getValue('set_switch_search_logs_case_sensitive', false) ? "" : "i"));
var regexpSplitNotUse = new RegExp("(<.*?>)", (getValue('set_switch_search_logs_case_sensitive', false) ? "" : "i"));
$(logsTab).find('tbody').children().remove();
for (var i = 0; i < logs.length; i++) {
if (logs[i] && logs[i].UserName.match(regexp)) {
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(logs[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
} else if (logs[i] && logs[i].LogText.match(regexp)) {
var splits = logs[i].LogText.split(regexpSplitComplete);
if (splits && splits.length > 0) {
for (var j = 0; j < splits.length; j++) {
if (!splits[j].match(regexpSplitNotUse) && splits[j].match(regexp)) {
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(logs[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
break;
}
}
}
}
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
if (isUpvoteActive) updateUpvoteEvents(logs);
setMarkerDisableDynamicLogLoad();
// Mark the hits.
var numberOfHits = 0;
$(logsTab).find('tbody tr.log-row').each(function() {
var oldBackgroundColor = window.getComputedStyle(this).backgroundColor;
if (oldBackgroundColor == 'rgba(0, 0, 0, 0)') oldBackgroundColor = 'white';
$(this).find('.logOwnerProfileName a, .LogContent').each(function() {
var oldColor = window.getComputedStyle(this).color;
if (oldColor == 'rgba(0, 0, 0, 0)') oldColor = 'white';
var splits = $(this)[0].innerHTML.split(regexpSplitComplete);
var html = "";
if (splits && splits.length > 0) {
for (var i = 0; i < splits.length; i++) {
if (splits[i].match(regexpSplitNotUse)) {
html += splits[i];
} else if (splits[i].match(regexpSplitComplete)) {
html += '' + splits[i];
numberOfHits++;
} else {
html += '' + splits[i];
}
}
$(this)[0].innerHTML = html;
}
});
});
$('#search_logs_number_of_hits')[0].innerHTML = numberOfHits + ' / ' + $('#cache_logs_table2 .log-row').length;
activateLoadAndSearch();
}
if (!$('#ctl00_ContentBody_lblFindCounts ul')[0]) return false;
$('#ctl00_ContentBody_lblFindCounts ul').append('
Search in logs:
');
if (!settings_add_search_in_logs_func) $('#search_logs')[0].style.display = 'none';
$('#search_logs').append('');
$('#search_logs_input')[0].addEventListener("keyup", gclh_search_logs, false);
function setCaseSensitive() {
$('#search_logs_case_sensitive')[0].title = (getValue('set_switch_search_logs_case_sensitive', false) ? 'search is case sensitive' : 'search is not case sensitive');
$('#search_logs_case_sensitive')[0].checked = getValue('set_switch_search_logs_case_sensitive', false);
}
function clickCaseSensitive() {
setValue('set_switch_search_logs_case_sensitive', $('#search_logs_case_sensitive')[0].checked);
setCaseSensitive();
}
$('#search_logs').append('');
setCaseSensitive();
$('#search_logs_case_sensitive')[0].addEventListener("click", clickCaseSensitive, false);
addButtonOverLogs(gclh_search_logs, "search_logs_go", false, "Go", "", "", $('#search_logs'));
addButtonOverLogs(function(){searchLogsReset(logs);}, "search_logs_reset", false, "Reset", "", "", $('#search_logs'));
$('#search_logs').append('');
}
// Reset search logs.
function searchLogsReset(logs, all) {
try {
if ($('#search_logs_reset.working')[0]) return;
deactivateLoadAndSearch();
$('#search_logs_input')[0].value = '';
$('#search_logs_number_of_hits')[0].innerHTML = '';
if (!logs) return; // Filter action is active.
if (all) loadNumLogs(logs, logs.length);
else if (settings_show_all_logs) loadNumLogs(logs, countOfLogsInListing());
else loadNumLogs(logs, 30);
} catch(e) {gclh_error("function searchLogsReset",e);}
}
// Deactivate/activate load and search buttons and fields.
function deactivateLoadAndSearch() {
$('#gclh_load_all_logs, #search_logs_input, #search_logs_go, #search_logs_reset, #gclh_show_log_counter').addClass("working");
if ($('#gclh_load_all_logs input')[0]) $('#gclh_load_all_logs input')[0].setAttribute('disabled', '');
if ($('#search_logs_input')[0]) $('#search_logs_input')[0].setAttribute('disabled', '');
if ($('#search_logs_go input')[0]) $('#search_logs_go input')[0].setAttribute('disabled', '');
if ($('#search_logs_reset input')[0]) $('#search_logs_reset input')[0].setAttribute('disabled', '');
if ($('#gclh_show_log_counter input')[0]) $('#gclh_show_log_counter input')[0].setAttribute('disabled', '');
}
function activateLoadAndSearch() {
setTimeout(function() {
$('#gclh_load_all_logs, #search_logs_input, #search_logs_go, #search_logs_reset').removeClass("working");
if ($('#gclh_load_all_logs input')[0]) $('#gclh_load_all_logs input')[0].removeAttribute('disabled', '');
if ($('#search_logs_input')[0]) $('#search_logs_input')[0].removeAttribute('disabled');
if ($('#search_logs_go input')[0]) $('#search_logs_go input')[0].removeAttribute('disabled');
if ($('#search_logs_reset input')[0]) $('#search_logs_reset input')[0].removeAttribute('disabled');
}, 200);
}
// Set marker to disable dynamic log load.
function setMarkerDisableDynamicLogLoad() {
if (!$('#gclh_all_logs_marker')[0]) { // add marker only once
var marker = document.createElement("a");
marker.setAttribute("id", "gclh_all_logs_marker");
document.getElementsByTagName("body")[0].appendChild(marker);
}
}
// Remove marker that disabled dynamic log load.
function removeMarkerDisableDynamicLogLoad() {
$('#gclh_all_logs_marker').remove();
}
// Load "num" Logs.
function gclh_load_logs(num) {
var data = new Array();
var requestCount = 1;
var logs = new Array();
var numPages = 1;
var curIdx = 1;
if (document.getElementById("gclh_vip_list")) {
var span_loading = document.createElement("span");
span_loading.innerHTML = 'Loading Cache Logs...';
document.getElementById("gclh_vip_list").appendChild(span_loading);
}
if (document.getElementById("gclh_vip_list_nofound")) {
var span_loading = document.createElement("span");
span_loading.innerHTML = 'Loading Cache Logs...';
document.getElementById("gclh_vip_list_nofound").appendChild(span_loading);
}
if (isUpvoteActive) {
// Remove the sorting select.
var new_sort_element = document.createElement('select');
new_sort_element.setAttribute('id', 'new_sort_element_upvote');
new_sort_element.classList.add("isDisabled");;
new_sort_element.disabled = true;
new_sort_element.onchange = function() {
searchLogsReset(logs);
var sorting_key = this.value;
// Deactivate buttons "Show log counter" and "Hide upvotes".
if (sorting_key != 'newest') {
$('#gclh_show_log_counter').addClass('isDisabled');
if ($('#gclh_show_log_counter input')[0]) $('#gclh_show_log_counter input')[0].setAttribute('disabled', '');
$('#gclh_show_hide_upvotes').addClass('isDisabled');
if ($('#gclh_show_hide_upvotes input')[0]) $('#gclh_show_hide_upvotes input')[0].setAttribute('disabled', '');
}
$(this).after(' ');
// Sort all the logs.
logs.sort(function(a, b) {
if ((sorting_key == 'newest') || (b[sorting_key] == a[sorting_key])) {
return a['newest'] - b['newest'];
} else {
return b[sorting_key] - a[sorting_key];
}
});
setTimeout(function() {
if (logs) {
// IDs der Cache Logs Tables.
var count = $('tbody',$('#cache_logs_table2, #cache_logs_table')).first().children().length;
$('tbody',$('#cache_logs_table2, #cache_logs_table')).first().children().remove();
for (var i = 0; i < count; i++) {
if (logs[i]) {
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(logs[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
}
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
gclh_add_vip_icon();
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
updateUpvoteEvents(logs);
}
// Activate buttons "Show log counter" and "Hide upvotes".
if (sorting_key == 'newest') {
$('#gclh_show_log_counter').removeClass('isDisabled');
if ($('#gclh_show_log_counter')[0] && !$('#gclh_show_log_counter').hasClass('working')) {
if ($('#gclh_show_log_counter input')[0]) $('#gclh_show_log_counter input')[0].removeAttribute('disabled', '');
}
$('#gclh_show_hide_upvotes').removeClass('isDisabled');
if ($('#gclh_show_hide_upvotes input')[0]) $('#gclh_show_hide_upvotes input')[0].removeAttribute('disabled', '');
}
$('#sort_logs_working').remove();
}, 100);
}
var newest = document.createElement('option');
newest.innerHTML = 'Newest';
newest.value = 'newest';
new_sort_element.appendChild(newest);
var beststory = document.createElement('option');
beststory.innerHTML = 'Best story';
beststory.value = 'greatStory';
new_sort_element.appendChild(beststory);
var mosthelpful = document.createElement('option');
mosthelpful.innerHTML = 'Most helpful';
mosthelpful.value = 'helpful';
new_sort_element.appendChild(mosthelpful);
$("#cache_logs_container #sortOrder").before(new_sort_element);
$('#cache_logs_container #sortOrder').remove();
}
function gclh_load_helper(count) {
var url = http + "://www.geocaching.com/seek/geocache.logbook?tkn=" + userToken + "&idx=" + curIdx + "&num=100&decrypt=false";
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: function(response) {
requestCount--;
var dataElement = JSON.parse(response.responseText);
data[dataElement.pageInfo.idx] = dataElement;
if (numPages == 1) {
numPages = data[count].pageInfo.totalPages;
for (curIdx = 2; curIdx <= numPages; curIdx++) {
requestCount++;
gclh_load_helper(curIdx);
}
}
if (requestCount <= 0) gclh_load_dataHelper(0);
}
});
}
function getUpvoteData(logIds,starting_index) {
$.ajax({
type: "GET",
url: "/api/proxy/web/v1/Geocaches/logs/upvote",
dataType: 'json',
data: {
geocacheLogIds: logIds.join(',')
},
success: function (data) {
for (var i = 0; i < logIds.length; i++) {
// Add the upvotes data Great Story and Helpful to the loaded logs data.
logs[i+starting_index].greatStory = data[logIds[i]].greatStory.count;
logs[i+starting_index].greatStoryupvotedByUser = data[logIds[i]].greatStory.upvotedByUser;
logs[i+starting_index].helpful = data[logIds[i]].helpful.count;
logs[i+starting_index].helpfulupvotedByUser = data[logIds[i]].helpful.upvotedByUser;
logs[i+starting_index].newest = i+starting_index;
// Update already displayed logs.
if (logs[i+starting_index].greatStory > 0 && $('#'+logIds[i])[0] && $('#'+logIds[i]).closest('tr').find('.great-story-btn span')[0]) {
if (logs[i+starting_index].greatStoryupvotedByUser) $('#'+logIds[i]).closest('tr').find('.great-story-btn').addClass('upvoted');
$('#'+logIds[i]).closest('tr').find('.great-story-btn span')[0].innerHTML = "Great story (" + logs[i+starting_index].greatStory + ")";
}
if (logs[i+starting_index].helpful > 0 && $('#'+logIds[i])[0] && $('#'+logIds[i]).closest('tr').find('.helpful-btn span')[0]) {
if (logs[i+starting_index].helpfulupvotedByUser) $('#'+logIds[i]).closest('tr').find('.helpful-btn').addClass('upvoted');
$('#'+logIds[i]).closest('tr').find('.helpful-btn span')[0].innerHTML = "Helpful (" + logs[i+starting_index].helpful + ")";
}
}
}
});
}
function gclh_load_dataHelper(waitCount) {
if (typeof unsafeWindow.$ !== "undefined" && $('.gclh_override_standard_templates_done')[0]) {
logs = new Array();
// Disable scroll Function on Page.
if (browser === "chrome" || browser === "firefox") injectPageScriptFunction(disablePageAutoScroll, "()");
else disablePageAutoScroll();
(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).removeEventListener('DOMNodeInserted', loadListener);
// Hide initial Logs.
var tbodys = document.getElementById("cache_logs_table").getElementsByTagName("tbody");
if (tbodys.length > 0) {
var shownLogs = tbodys[0].children.length;
if (shownLogs > 0 && num < shownLogs) num = shownLogs;
}
var tableContent = unsafeWindow.$("#cache_logs_table").after('
').hide().children().remove();
unsafeWindow.$(tableContent).find('tbody').children().remove();
unsafeWindow.$('#cache_logs_table2').append(tableContent);
$(tableContent).find('.log-row').remove();
for (var z = 1; z <= numPages; z++) {
var all_ids = new Array();
var json = data[z];
logs = logs.concat(json.data);
for (var i = 0; i < json.data.length; i++) {
var user = json.data[i].UserName;
all_ids.push(json.data[i].LogID);
if (settings_show_vip_list) {
all_users.push(user);
if (!log_infos[user]) log_infos[user] = new Array();
log_infos[user][index] = new Object();
log_infos[user][index]["icon"] = "/images/logtypes/" + json.data[i].LogTypeImage;
log_infos[user][index]["id"] = json.data[i].LogID;
log_infos[user][index]["date"] = json.data[i].Visited;
log_infos[user][index]["log"] = json.data[i].LogText;
log_infos[user][index]["membership_level"] = json.data[i].creator.GroupTitle;
log_infos_long[index] = new Object();
log_infos_long[index]["user"] = user;
log_infos_long[index]["icon"] = "/images/logtypes/" + json.data[i].LogTypeImage;
log_infos_long[index]["id"] = json.data[i].LogID;
log_infos_long[index]["date"] = json.data[i].Visited;
log_infos_long[index]["log"] = json.data[i].LogText;
log_infos_long[index]["membership_level"] = json.data[i].creator.GroupTitle;
if (json.data[i].LogType == "Publish Listing") {
log_infos[user][index]["membership_level"] = "Reviewer";
log_infos_long[index]["membership_level"] = "Reviewer";
}
index++;
}
}
// Load the upvotes data Great Story and Helpful to the loaded logs data and update already displayed logs. Give index of first log.
if (isUpvoteActive) getUpvoteData(all_ids,((z-1)*100));
}
// Add Links.
gclh_load_all(logs);
gclh_filter(logs);
gclh_search(logs);
var log_ids = [];
for (var i = 0; i < num; i++) {
if (logs[i]) {
log_ids.push(logs[i].LogID);
var newBody = unsafeWindow.$(document.createElement("TBODY"));
unsafeWindow.$("#tmpl_CacheLogRow_gclh").tmpl(logs[i]).appendTo(newBody);
unsafeWindow.$(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).append(newBody.children());
}
}
unsafeWindow.$('a.tb_images').fancybox({'type': 'image', 'titlePosition': 'inside'});
if (isUpvoteActive) updateUpvoteEvents(logs);
gclh_dynamic_load(logs, num);
if (settings_show_vip_list) {
gclh_build_vip_list();
gclh_add_vip_icon();
}
buildEventShowBiggerAvatar();
setLinesColorInCacheListing();
// Remove GC logs, so that the links to the log ids, e.g. from the VIPs or the Latest logs, work again.
// (Apparently GS simply creates the 25 logs again when they are gone. And that in the form
, there is
// no
. There was earlier an error in the Release Notes that no logs are shown.)
function removeGCLogs(waitCount) {
if (unsafeWindow.$("#cache_logs_table").children().length > 0) {
unsafeWindow.$("#cache_logs_table").children().remove();
}
waitCount++; if (waitCount <= 100) setTimeout(function(){removeGCLogs(waitCount);}, 100);
}
removeGCLogs(0)
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){gclh_load_dataHelper(waitCount);}, 100);}
}
gclh_load_helper(1);
}
function updateUpvoteEvents(all_logs){
$('.great-story-btn').each(function(){
$(this).unbind('click');
$(this).click(function(){
// there is a bug (or a feature) in jQuery(?):
// if you have a data attribute (like data-upvoted="false") and you also have set objekt.data(upvoted,"true")
// JQuery will override your data value with the data value from the dom. So we check here, if the button has
// a class "upvoted", and if yes, we reset the object.data("upvoted") to true. Otherwise, when the button is
// upvoted, the first click would not result in "not upvoting" the log, but the secound.
if ($(this).hasClass('upvoted')) $(this).data('upvoted', true);
// also we have to update our internal counter of votes for the log to display it correctly on sorting
var log_index = false;
for (var i = 0; i < all_logs.length; i++) {
if (all_logs[i].LogID == $(this).data('log-id')) {
log_index = i;
}
}
if (log_index === false) {
return upvoteLog($(this));
throw Error('Could not find Log coresponding to Upvote clicked.');
}
if ($(this).hasClass('upvoted')) {
all_logs[log_index].greatStory -= 1;
all_logs[log_index].greatStoryupvotedByUser = false;
} else {
all_logs[log_index].greatStory += 1;
all_logs[log_index].greatStoryupvotedByUser = true;
}
return upvoteLog($(this));
});
});
$('.helpful-btn').each(function(){
$(this).unbind('click');
$(this).click(function(){
// there is a bug (or a feature) in jQuery(?):
// if you have a data attribute (like data-upvoted="false") and you also have set objekt.data(upvoted,"true")
// JQuery will override your data value with the data value from the dom. So we check here, if the button has
// a class "upvoted", and if yes, we reset the object.data("upvoted") to true. Otherwise, when the button is
// upvoted, the first click would not result in "not upvoting" the log, but the secound.
if ($(this).hasClass('upvoted')) $(this).data('upvoted', true);
// also we have to update our internal counter of votes for the log to display it correctly on sorting
var log_index = false;
for (var i = 0; i < all_logs.length; i++) {
if (all_logs[i].LogID == $(this).data('log-id')) {
log_index = i;
}
}
if (log_index === false) {
return upvoteLog($(this));
throw Error('Could not find Log coresponding to Upvote clicked.');
}
if ($(this).hasClass('upvoted')) {
all_logs[log_index].helpful -= 1;
all_logs[log_index].helpfulupvotedByUser = false;
} else {
all_logs[log_index].helpful += 1;
all_logs[log_index].helpfulupvotedByUser = true;
}
return upvoteLog($(this));
});
});
}
if (settings_show_all_logs) gclh_load_logs(countOfLogsInListing());
else gclh_load_logs(30);
} catch(e) {gclh_error("Replace Log-Loading function",e);}
}
// Zeilen in Cache Listings in Zebra und für User, Owner, Reviewer und VIP einfärben.
function setLinesColorInCacheListing() {
if (is_page("cache_listing")) {
// ('find("tr")' reicht hier nicht wegen der Bilder.)
var lines = $(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).find("tbody").find("tr.log-row:not(.gclh_colored,.display_none)");
lines.addClass("gclh_colored");
var owner = get_real_owner();
setLinesColorInZebra(settings_show_cache_listings_in_zebra, lines, 1);
setLinesColorUser("settings_show_cache_listings_color", "user,owner,reviewer,vips", lines, 1, owner);
// Show an overflowed username in a cache listing log when hovering over with the mouse.
$('.logOwnerProfileName').each(function() {
if (window.getComputedStyle(this).width == '135px') {
this.setAttribute('title', $(this).find('a')[0].innerHTML);
}
});
}
}
// Bei Click auf VIP Icon, Einfärbung für VIP neu machen.
function setLinesColorVip(user) {
if (is_page("cache_listing")) {
var lines = $(document.getElementById("cache_logs_table2") || document.getElementById("cache_logs_table")).find("tbody").find("tr.log-row");
var count = 1;
var owner = get_real_owner();
var paraStamm = "settings_show_cache_listings_color";
} else if (document.location.href.match(/\.com\/track\/details\.aspx/)) {
var lines = $("table.Table").find("tbody").find("tr");
var count = 2;
var owner = document.getElementById("ctl00_ContentBody_BugDetails_BugOwner").innerHTML;
var paraStamm = "settings_show_tb_listings_color";
}
if (!lines) return;
var linesNew = new Array();
for (var i = 0; i < lines.length; i++) {
var aTags = lines[i].getElementsByTagName("a");
for (var j = 0; j < aTags.length; j++) {
if (aTags[j].getAttribute("name") == user) {
for (var k = 0; k < count; k++) {linesNew.push(lines[i+k]);}
}
}
}
if (linesNew.length > 0) setLinesColorUser(paraStamm, "user,owner,reviewer,vips", linesNew, count, owner);
}
// Farben für Zeilen in gewöhnlichen Listen und TB Listing setzen. Im Cache Listing wird nur css benötigt.
try {
var css = "table.Table tr.AlternatingRow td, .AlternatingRow, table.Table tr td.AlternatingRow {background-color: #" + getValue("settings_lines_color_zebra") + " !important;}"
+ "table.Table tr.TertiaryRow td, .TertiaryRow, table.Table tr td.TertiaryRow {background-color: #" + getValue("settings_lines_color_user") + " !important;}"
+ "table.Table tr.QuaternaryRow td, .QuaternaryRow, table.Table tr td.QuaternaryRow {background-color: #" + getValue("settings_lines_color_owner") + " !important;}"
+ "table.Table tr.QuinaryRow td, .QuinaryRow, table.Table tr td.QuinaryRow {background-color: #" + getValue("settings_lines_color_reviewer") + " !important;}"
+ "table.Table tr.SenaryRow td, .SenaryRow, table.Table tr td.SenaryRow {background-color: #" + getValue("settings_lines_color_vip") + " !important;}";
// TB Listing:
if (document.location.href.match(/\.com\/track\/details\.aspx\?/)) {
css += "table.Table tr.AlternatingRow th {background-color: #" + getValue("settings_lines_color_zebra") + " !important;}"
+ "table.Table tr.TertiaryRow th {background-color: #" + getValue("settings_lines_color_user") + " !important;}"
+ "table.Table tr.QuaternaryRow th {background-color: #" + getValue("settings_lines_color_owner") + " !important;}"
+ "table.Table tr.QuinaryRow th {background-color: #" + getValue("settings_lines_color_reviewer") + " !important;}"
+ "table.Table tr.SenaryRow th {background-color: #" + getValue("settings_lines_color_vip") + " !important;}";
}
appendCssStyle(css);
// TB Listing: Zeilen in Zebra, für User, Owner, Reviewer und VIP einfärben.
if (document.location.href.match(/\.com\/track\/details\.aspx\?/)) {
var lines = $("table.TrackableItemLogTable").find("tbody").find("tr");
if (lines && lines[0] && lines[0].getAttribute('class').match(/BorderTop/)) {
var linesNew = lines.slice(0, -1);
var owner = document.getElementById("ctl00_ContentBody_BugDetails_BugOwner").innerHTML;
setLinesColorInZebra(settings_show_tb_listings_in_zebra, linesNew, 2);
setLinesColorUser("settings_show_tb_listings_color", "user,owner,reviewer,vips", linesNew, 2, owner);
}
// Andere Listen: In Zeilen gegebenenfalls Einfärbung für Zebra oder User entfernen.
} else if (!is_page("cache_listing")) {
if (document.location.href.match(/\.com\/my\/recentlyviewedcaches\.aspx/)) {
var lines = $("table").find("tbody").find("tr");
var replaceSpec = /(AlternatingRow)(\s*)/g;
setLinesColorNone(lines, replaceSpec);
var replaceSpec = /(TertiaryRow)(\s*)/g;
setLinesColorNone(lines, replaceSpec);
if (settings_show_common_lists_in_zebra == true) {
var lines = $("table.Table").find("tbody").find("tr").slice(1);
setLinesColorInZebra(settings_show_common_lists_in_zebra, lines, 1);
}
if (settings_show_common_lists_color_user == true) {
setLinesColorUser("settings_show_common_lists_color", "user", lines, 1, "", true);
}
} else {
if (settings_show_common_lists_in_zebra == false) {
var lines = $("table").find("tbody").find("tr");
var replaceSpec = /(AlternatingRow)(\s*)/g;
setLinesColorNone(lines, replaceSpec);
}
if (settings_show_common_lists_color_user == false) {
var lines = $("table").find("tbody").find("tr");
var replaceSpec = /(TertiaryRow)(\s*)/g;
setLinesColorNone(lines, replaceSpec);
// Wenn User nicht eingefärbt werden soll, Zebra aber ausgewählt ist, dann muss Zebra explizit gesetzt werden, weil nur ein Wert im Standard
// gesetzt wurde, hier eben Wert für User.
if (settings_show_common_lists_in_zebra) {
if (document.location.href.match(/\.com\/seek\/nearest\.aspx\?/)) {
// Überschrift weglassen, einzeilig.
var lines = $("table.Table").find("tbody").find("tr").slice(1);
setLinesColorInZebra(settings_show_common_lists_in_zebra, lines, 1);
}
}
}
}
}
} catch(e) {gclh_error("Color lines in lists",e);}
// Improve old dashboard. (Muß nach VIP laufen.)
if (is_page("profile")) {
try {
var css = ".YourProfileWidget h3 {padding-left: 0.5em;} .YourProfileWidget h3 img {padding-right: 0.2em;}";
// Show/Hide einbauen in rechter Spalte.
var code = "function hide_box(i){";
code += " if (document.getElementById('box_'+i).style.display == 'none') {";
code += " document.getElementById('box_'+i).style.display = 'block';";
code += " document.getElementById('lnk_'+i).src = '/images/minus.gif';";
code += " document.getElementById('lnk_'+i).title = 'hide';";
code += " }else{";
code += " document.getElementById('box_'+i).style.display = 'none';";
code += " document.getElementById('lnk_'+i).src = '/images/plus.gif';";
code += " document.getElementById('lnk_'+i).title = 'show';";
code += " }";
code += "}";
injectPageScript(code, "body");
var boxes = $('.WidgetHeader');
function saveStates() {
// Wenn Linklist angezeigt wird, dann mit Speicherindex "i" von Linklist beginnen, er ist 0. Ansonsten mit 1 beginnen.
if (settings_bookmarks_show) var i = 0;
else var i = 1;
// Alle gefundenen WidgetBody "wb" verarbeiten und ihnen den zugehörigen Speicherindex "i" zuordnen.
for (var wb = 0; wb < boxes.length; wb++) {
var box = boxes[wb].parentNode.getElementsByClassName('WidgetBody')[0];
if (typeof(box) == "undefined") continue;
var show = box.style.display;
if (typeof(show) == "undefined" || show != "none") show = "block";
setValue("show_box[" + i + "]", show);
i++;
}
}
// Wenn Linklist angezeigt wird, dann mit Speicherindex "i" von Linklist beginnen, er ist 0. Ansonsten mit 1 beginnen.
if (settings_bookmarks_show) var i = 0;
else var i = 1;
// Alle gefundenen WidgetBody "wb" verarbeiten und ihnen den zugehörigen Speicherindex "i" zuordnen.
for (var wb = 0; wb < boxes.length; wb++) {
var box = boxes[wb].parentNode.getElementsByClassName('WidgetBody')[0];
if (typeof(box) != "undefined") {
box.setAttribute("id", "box_" + i);
if (typeof(getValue("show_box[" + i + "]")) != "undefined") box.style.display = getValue("show_box[" + i + "]");
if (box.style.display == "none") {
boxes[wb].innerHTML = " " + boxes[wb].innerHTML;
} else {
boxes[wb].innerHTML = " " + boxes[wb].innerHTML;
}
$('#lnk_' + i)[0].addEventListener("click", saveStates, false);
}
i++;
}
if ($('#ctl00_ContentBody_WidgetMiniProfile1_LoggedInPanel').length > 0) {
// Hide TBs/Coins.
if (settings_hide_visits_in_profile) {
$(".Table.WordWrap tr").filter(function(index) {
return $(this).find("img[src$='logtypes/75.png']").length !== 0;
}).remove();
}
// Remove fixed column width in last 30 days logs for fewer linebreaks.
if ($('.Table.WordWrap tr').length > 0) {
$('.Table.WordWrap')[0].setAttribute("style", "table-layout: unset;");
$('.Table.WordWrap tr td').each(function() {
this.setAttribute("style", "width: unset;" + (in_array(this.cellIndex, [0,1,4]) ? " white-space: nowrap;" : ""));
});
}
}
appendCssStyle(css);
} catch(e) {gclh_error("Improve old dashboard",e);}
}
// Improve new dashboard.
if (is_page("dashboard")) {
try {
var css = '';
// Compact layout.
if (settings_compact_layout_new_dashboard) {
// Link at the top of the container.
if ($('.alert')[0]) {
css += ".alert {padding: 6px 20px 0px 20px;}";
css += ".container {padding-top: 8px !important;}";
}
// User block in the first block in the left column.
css += ".user-bio {padding-bottom: 0px !important;}";
css += "#user-bio-root > div {margin-top: 0px !important; padding: 12px 16px !important;}";
css += ".gclh_parent_profile_button a {margin-top: 8px !important; padding-top: 6px !important; padding-bottom: 6px !important;}";
// Primary navigation links (quick links) in the second block in the left column.
css += "#quickLinks ul:not(.link-block):not(.gclh) {padding-top: 3px !important;}";
css += "#quickLinks ul:not(.link-block):not(.gclh) li {padding: 1px 0 1px 0 !important;}";
css += "#quickLinks ul:not(.link-block):not(.gclh) li > a {padding: 4px 8px !important;}";
// Secondary navigation links in further blocks in the left column.
css += "#sidebarNavigation > nav ul:not(.gclh) {margin-bottom: 0px !important; padding-bottom: 5px !important;}";
css += "#sidebarNavigation > nav ul:not(.gclh) li {padding-top: 2px !important;}";
css += "#sidebarNavigation > nav ul:not(.gclh) ul {padding-top: 0px !important; padding-bottom: 0px !important; margin-top: 0px !important; gap: 0px !important;}";
css += "button[aria-controls='trackableInventoryItems'] {margin-top: -2px !important;}";
css += "button[aria-controls='trackableInventoryItems'] svg {margin-right: 5px !important;}";
// Button to display or hide the configuration to hide rows in left column.
css += ".clickSum {position: absolute; margin-top: -23px; margin-left: 1px; cursor: pointer;}";
css += ".clickSum svg {height: 20px; width: 20px; fill: #777; transition: all .3s ease; transform-origin: 50% 50%;}";
css += ".clickSumHide .clickSum svg {transform: rotate(90deg);}";
// Buttons to mark rows for display or hide in left column.
css += ".clickPoint {position: absolute; padding: 2px 3px 0px 2px !important; cursor: pointer; color: rgb(110, 110, 110);}";
css += ".bio-data .clickPoint {margin: 120px 0px 0px -1px !important; display: block;}";
css += "#user-bio-root .clickPoint {margin: 1px 0px 0px -17px !important;}";
css += "#user-bio-root .gclh_parent_profile_button .clickPoint {margin: 15px 0px 0px -17px !important;}";
css += "#user-bio-root .gclh_parent_profile_button a {display: block !important;}";
css += "#quickLinks ul .clickPoint {margin: 3px 0px 0px -17px !important;}";
css += "#sidebarNavigation > nav ul .clickPoint {margin: -1px 0px 0px -24px !important;}";
css += ".clickPoint:hover {background-color: rgb(245 245 245);}";
css += ".clickPoint svg {height: 12px !important; width: 12px !important; opacity: 0.4;}";
css += ".clickPointHide svg {opacity: 1;}";
// Hide rows which are marked for hide in left column.
css += ".clickSumHide .clickPointHide, .clickSumHide .clickPoint {display: none !important;}";
// In the middle and in the right column.
css += ".activity-item, .panel-header {padding: 5px 15px !important;}";
css += ".activity-tray {padding: 5px 40px !important;}";
// Latest Acitivity item images in the middle column.
css += ".activity-image-summary {margin-top: 2px !important;}";
// Events block in the right column.
css += ".clndr-controls button {padding-top: 4px !important;}";
css += "#eventsListSelectedDay {padding-top: 2px !important; padding-bottom: 5px !important;}";
css += ".event-list-item {padding: 5px 0 5px 0 !important;}";
css += ".event-list-item-details {padding-top: 0px !important; padding-bottom: 0px !important;}";
css += ".event-list-item-map {margin-top: 5px !important;}";
css += ".event-list-item > div:not(.event-list-item-details) > div:not(.event-list-item-map) {padding-top: 8px !important; padding-bottom: 3px !important;}";
css += "#EventsList > div > div:not(.events-list-container) {padding: 5px 40px !important;}";
// Hide tips and instruction container in the right column.
css += "#_Geocaching101Container {display: none;}";
}
// Save uid of own trackables from new dashboard.
function saveUidOfOwnTrackables() {
try {
var link = $('a[href*="/track/search.aspx?o=1&uid="]')[0];
if (link) {
var uid = link.href.match(/\/track\/search\.aspx\?o=1\&uid=(.*)/);
if (uid && uid[1]) {
if (getValue("uid", "") != uid[1]) setValue("uid", uid[1]);
}
}
} catch(e) {gclh_error("Save uid of own trackables from new dashboard",e);}
}
// Build menu under the header of the old dashboard in the new dashbaord.
if (settings_dashboard_build_menu_old_db_in_new_db) {
css += ".alert, .gclh_menu_old_db {padding: 6px 20px 0px 20px; text-align: center;}";
css += ".container {padding-top: 8px !important;}";
}
function buildMenuOfOldDBInNewDB() {
if (settings_dashboard_build_menu_old_db_in_new_db) {
var html = '';
html += '
';
$('.container').before(html);
}
}
// Improve left sidebar.
function improveLeftSidebar() {
// Search / Browse Map buttons and Search Map button as quick links in left sidebar.
if ($('#quickLinks ul li')[0]) {
if (settings_but_searchmap) { // Search Map
var searchmapButt = $( $('#quickLinks ul li')[0] ).clone()[0];
}
if (settings_but_search_map) { // Search and Browse Map
var mapButt = $( $('#quickLinks ul li')[0] ).clone()[0];
var searchButt = $( $('#quickLinks ul li')[0] ).clone()[0];
}
if (searchmapButt && $(searchmapButt).find('a')[0] && $(searchmapButt).find('a')[0].childNodes[1] && $(searchmapButt).find('svg')[0]) {
$(searchmapButt).find('a')[0].href = '/play/map';
$(searchmapButt).find('a')[0].target = settings_but_searchmap_new_tab ? "_blank" : "";
$(searchmapButt).find('a')[0].childNodes[1].innerText = 'Search Map';
$(searchmapButt).find('svg')[0].innerHTML = '';
$('#quickLinks ul li')[0].before(searchmapButt);
css += "#map--inline path {stroke-width: 2.0;}";
}
if (mapButt && $(mapButt).find('a')[0] && $(mapButt).find('a')[0].childNodes[1] && $(mapButt).find('svg')[0]) {
$(mapButt).find('a')[0].href = '/map';
$(mapButt).find('a')[0].target = settings_but_search_map_new_tab ? "_blank" : "";
$(mapButt).find('a')[0].childNodes[1].innerText = 'Browse Map';
$(mapButt).find('svg')[0].innerHTML = $(browse_map_icon)[0].innerHTML;
$(mapButt).find('svg').attr('viewBox', '0 0 24 24');
$(mapButt).find('path').attr('stroke-width', '1.2');
$('#quickLinks ul li')[0].before(mapButt);
}
if (searchButt && $(searchButt).find('a')[0] && $(searchButt).find('a')[0].childNodes[1] && $(searchButt).find('svg')[0]) {
$(searchButt).find('a')[0].href = '/play/search';
$(searchButt).find('a')[0].target = settings_but_search_map_new_tab ? "_blank" : "";
$(searchButt).find('a')[0].childNodes[1].innerText = 'Search';
$(searchButt).find('svg')[0].innerHTML = '';
$('#quickLinks ul li')[0].before(searchButt);
css += "#search--inline path {stroke-width: 1.0; stroke: currentColor;}";
}
}
// Add link to Ignore List into dashboard sidebar.
if (settings_embedded_smartlink_ignorelist && $("#user-bio-root")[0].innerHTML.match(/Premium/) && $('#sidebarNavigation > nav ul:not(".gclh") li a[href*="/plan/lists"]')[0]) {
var ignorelist = $( $('#sidebarNavigation > nav ul:not(".gclh") li a[href*="/plan/lists"]').closest('li') ).clone()[0];
$(ignorelist).find('a')[0].href = $(ignorelist).find('a')[0].href + '/ignored';
$(ignorelist).find('a')[0].innerHTML = 'Ignore List';
$('#sidebarNavigation > nav ul:not(".gclh") li a[href*="/plan/lists"]').closest('li').after(ignorelist);
}
// Build Show/Hide buttons for areas in left column.
var list = $('#sidebarNavigation > nav > h3:not(.gclh), #sidebarNavigation > nav > ul:not(.gclh)');
var ident = 0;
for (var i = 0; i < list.length; i=i+2) {
ident++;
$(list[i]).addClass(getValue("show_box_dashboard_" + ident, true) == true ? "gclh" : "gclh isHide");
$(list[i+1]).addClass(getValue("show_box_dashboard_" + ident, true) == true ? "" : "isHide");
list[i].setAttribute("name", "head_" + ident);
list[i].innerHTML += "";
list[i].addEventListener("click", showHideBoxDashboard, false);
}
// Build configuration to Show/Hide rows in left column.
function setClickSumDB() {
if (getValue('show_box_dashboard_0', false) == true) {
$('.clickSum').closest('#DashboardSidebar').addClass('clickSumHide');
$('.clickSum')[0].title = 'Click here to view the configuration for hiding rows';
} else {
$('.clickSum').closest('#DashboardSidebar').removeClass('clickSumHide');
$('.clickSum')[0].title = 'Click here to hide the configuration for hiding rows';
}
}
function saveClickSumDB() {
if ($('.clickSumHide')[0]) setValue('show_box_dashboard_0', false);
else setValue('show_box_dashboard_0', true);
setClickSumDB();
}
function setClickPointDB(row) {
var name = $(row).attr('name')
if (getValue(name, false) == true) {
$(row).parent().addClass('clickPointHide');
$(row)[0].title = 'Click to mark the row for display\nAfter the configuration is complete, click the icon at the top of the column';
} else {
$(row).parent().removeClass('clickPointHide');
$(row)[0].title = 'Click to mark the row for hide\nAfter the configuration is complete, click the icon at the top of the column';
}
}
function saveClickPointDB() {
if ($(this).parent().hasClass('clickPointHide')) setValue($(this).attr('name'), false);
else setValue($(this).attr('name'), true);
setClickPointDB(this);
}
if (settings_compact_layout_new_dashboard && settings_row_hide_new_dashboard && $('.bio-data')[0] && $('#user-bio-root')[0] && $('#quickLinks ul li')[0] && $('#sidebarNavigation > nav > ul li')[0]) {
// Build button to display or hide the configuration to hide rows.
if ($('#user-bio-root')[0]) {
$($('#user-bio-root')[0]).prepend('');
$('.clickSum')[0].addEventListener("click", saveClickSumDB, false);
setClickSumDB();
// Build buttons to mark rows for display or hide.
function buildButtonToMarkRowDB(row, name) {
if (row && row.length == 1 && name && name != '') {
$(row).prepend('');
$(row).find('.clickPoint')[0].addEventListener("click", saveClickPointDB, false);
setClickPointDB($(row).find('.clickPoint')[0]);
}
}
// Build button for user cover image and profile image.
var row = $('.bio-data');
buildButtonToMarkRowDB(row, 'set_switch_db_bio-userImages');
// Build button for user name.
var row = $('#user-bio-root > div > div > h1:first').closest('div');
buildButtonToMarkRowDB(row, 'set_switch_db_bio-userName');
// Build button for user profile button (has no parent).
var row = $('#user-bio-root > div > a[href*="/p/default.aspx"]');
if (row && row.length == 1) {
var div = document.createElement('div');
div.setAttribute('class', 'gclh_parent_profile_button');
row.after(div);
$('.gclh_parent_profile_button').append($('#user-bio-root > div > a').remove().get().reverse());
var row = $('.gclh_parent_profile_button');
buildButtonToMarkRowDB(row, 'set_switch_db_bio-userProfile');
}
// Build buttons for user data in list like Joined, Renewal Date, finds and hides, and foreign data like gclh and send2cgeo.
function buildButtonsForUserDataInList(waitCount) {
var rows = $('#user-bio-root > div > ul > li');
for (var i = 0; i < rows.length; i++) {
if (!$(rows[i]).find('.clickPoint')[0]) {
if ($(rows[i]).find('svg:first use')[0] && !$(rows[i]).find('svg:first use').attr('href') == '') {
var name = 'set_switch_db_bio-' + $(rows[i]).find('svg:first use').attr('href').replace(/(#|_no-outline|--inline)/ig, '');
buildButtonToMarkRowDB($(rows[i]), name);
} else if ($(rows[i]).find('img:first')[0] && !$(rows[i]).find('img:first').attr('src') == '') {
var name = 'set_switch_db_bio-' + $(rows[i]).find('img:first').attr('src').replace(/(http:|https:|www|\/|\.png|\.jpg|\.)/ig, '');
buildButtonToMarkRowDB($(rows[i]), name);
}
}
}
waitCount++; if (waitCount <= 1000) setTimeout(function(){buildButtonsForUserDataInList(waitCount);}, 10);
}
buildButtonsForUserDataInList(0);
// Build buttons for primary links (quick links) and for secondary links (without gclh areas).
var rows = $('#quickLinks ul > li, #sidebarNavigation > nav > ul:not(.gclh) > li');
if (rows) {
for (var i = 0; i < rows.length; i++) {
if ($(rows[i]).find('a:first')[0] && $(rows[i]).find('a:first')[0].href) {
if (!$(rows[i]).find('a:first')[0].href.match(/\?upgrade=true/)) {
if ($(rows[i]).find('a:first')[0]) {
var rel = $(rows[i]).find('a:first')[0].href.match(/https:\/\/(www|payments)\.geocaching\.com\/(.*?)($|\.aspx)/)
if (rel && rel[2]) {
if ($(rows[i]).closest('#quickLinks')[0]) var name = 'set_switch_db_prim-';
else var name = 'set_switch_db_second-';
name = name + rel[2].replace(/\//ig, '');
// Link to my/inventory is not available if a list of trackables is shown.
name = name.replace(/trackdetails/, 'myinventory');
buildButtonToMarkRowDB($(rows[i]), name);
}
}
}
}
}
}
}
}
// Linklist, Default Links on new dashboard.
try {
buildDashboardCss();
if (settings_bookmarks_show) {
buildBoxDashboard("linklist", "Linklist", "Linklist");
var box = document.getElementsByName("box_linklist")[0];
box.innerHTML = "";
buildBoxElementsLinklist(box);
}
if (settings_show_default_links) {
bm_tmp = buildCopyOfBookmarks();
sortBookmarksByDescription(true, bm_tmp);
buildBoxDashboard("links", "Default Links", "Default Links for the Linklist");
var box = document.getElementsByName("box_links")[0];
box.innerHTML = "";
buildBoxElementsLinks(box, bm_tmp);
}
} catch(e) {gclh_error("Linklist, Default Links on new dashboard",e);}
}
function waitForLeftSidebar(waitCount) {
if ($('.container')[0] && $('#DashboardSidebar')[0] && $('.user-bio')[0] && $('#user-bio-root')[0] && $('#quickLinks ul')[0] && $('#sidebarNavigation > nav')[0]) {
saveUidOfOwnTrackables();
buildMenuOfOldDBInNewDB();
improveLeftSidebar();
} else {waitCount++; if (waitCount <= 200) setTimeout(function(){waitForLeftSidebar(waitCount);}, 50);}
}
waitForLeftSidebar(0);
// Set real edit link in logs in area Latest Activity.
// (Ich habe keinen Weg gefunden mit MutationObserver Logs beim Wechsel zwischen Community Logs und Your Logs abzugreifen.)
function buildLinksAF(log) {
if (!settings_show_edit_links_for_logs) return;
if (!$(log).find('.gclh_view-link')[0]) {
$(log).find('.edit-link')[0].innerHTML = 'View log';
$(log).find('.edit-link').addClass('gclh_view-link');
}
if ($(log).find('.activity-details > div h3 > a')[0].href.match(serverParameters["user:info"].referenceCode)) {
if (!$(log).find('.gclh_edit-link')[0] && $(log).find('.edit-link')[0].href.match(/coord.info\/(?:GL|TL)/i)) {
// Build area for the two buttons.
var span = document.createElement('span');
span.setAttribute('class', 'gclh_buttons');
$(log).find('.edit-link')[0].before(span);
// Build new button Edit log.
let gccode = $(log).find('.text-xs')[0].innerHTML.trim();
var editLink = $( $(log).find('.edit-link')[0] ).clone()[0];
var href = $(editLink).prop('href');
let type = href.match(/GL/) ? 'geocache' : 'trackable';
href = href.replace(
/coord.info\/((?:GL|TL)\w+)/i,
`www.geocaching.com/live/${type}/${gccode}/log/$1/edit`
);
$(editLink).prop('href', href).text('Edit log');
$(editLink).addClass('gclh_edit-link');
$(editLink).removeClass('edit-link');
$(log).find('.gclh_buttons')[0].append(editLink);
// Move standard button in area.
var editLink = $( $(log).find('.edit-link')[0] ).clone()[0];
$(log).find('.edit-link')[0].remove();
$(log).find('.gclh_buttons')[0].append(editLink);
}
buildEventMoreAF(log);
}
}
if (settings_show_edit_links_for_logs) {
css += '.gclh_buttons {display: flex;}';
css += '.gclh_edit-link {margin-right: 12px;}';
}
// Build log texts in Markdown.
css += '.markdown-output a {color: #2358a1 !important; text-decoration: underline !important;} .markdown-output a:hover {text-decoration: none !important; border-bottom: none !important;}';
function buildLogtextMarkdownAF(log) {
if (!settings_dashboard_show_logs_in_markdown || $(log).find('.gclh_logText')[0] || !$(log).hasClass('active') || !$(log).attr('logId') || !$(log).find('.note-text')[0]) return;
var logText = decode_innerHTML($('#gclh_logId_' + $(log).attr('logId'))[0]);
$(log).find('.note-text').after('');
$(log).find('.gclh_logText').after('');
$(log).find('.note-text')[0].style.display = 'none';
showInMarkdown($(log).find('.gclh_logText'), resizebar = false, toolbar = false);
$('.mdd_preview').removeClass('mdd_preview');
}
// Back up log texts for Markdown.
// Die Logtexte stehen nicht immer in guter Qualität zur Verfügung, weil GS scheinbar manuell an den Logtexten rumbastelt, beispielsweise
// wenn der more Button gedrückt wurde. Manchmal gibt es sichtbare " " oder unsichtbare Steuerzeichen, die die Markdown Verarbeitung nicht
// behandeln kann. Das passiert insbesonder wenn Markdown Elemente im Text vorhanden sind. Deshalb werden die Logtexte hier in ihrem
// Anfangszustand gesichert, um immer wieder darauf zuzugreifen.
var logId = 0;
function backupLogtextMarkdownAF(log) {
if (!settings_dashboard_show_logs_in_markdown || $(log).attr('logId') || !$(log).find('.note-text')[0]) return;
if (!$('#gclh_logs')[0]) $('#_ActivityFeed').append('
');
logId++;
var logIdLocal = logId;
var logText = decode_innerHTML($(log).find('.note-text')[0]);
$('#gclh_logs ul').append('
' + logText + '
');
$(log).attr('logId', logIdLocal);
}
// Copy to clipboard button for log text in Latest Activity list.
css += '.gclh_copyLogToClipboard {margin-left: auto; padding-right: 12px;}';
css += '.gclh_buttons .ctoc_link img {vertical-align: sub !important;}';
css += '.ctoc_link {box-shadow: none !important;} .ctoc_link img {vertical-align: bottom !important;}';
function buildCopyLogtextToClipboard(log) {
if (!$(log).find('.gclh_copyLogToClipboard')[0] && $(log).find('.note-text')[0]) {
var firstLink = $(log).find('.gclh_edit-link')[0] ? '.gclh_edit-link' : '.edit-link';
$(log).find(firstLink).before('');
var logText = decode_innerHTML($(log).find('.note-text')[0]).replace(/ /g,'\n');
addCopyToClipboardLink(logText, $(log).find('.gclh_copyToClipboard')[0], "Log");
}
}
// Hide TB Activity
function hideTBActivity(log) {
if (settings_dashboard_hide_tb_activity && !$(log).hasClass('gclh_hidden_log') && $(log).find('.text-xs')[0] && $(log).find('.text-xs')[0].innerHTML.match(/TB\w+/ig)) {
$(log).addClass('gclh_hidden_log');
checkDay($(log).parent());
}
}
// Removes the Date for Days Without Logs
function checkDay(container) {
let unfilterd = $(container).find('.activity-item');
let filtered = Array.from(unfilterd).filter(li => $(li).hasClass('gclh_hidden_log'));
if (unfilterd.length <= filtered.length) {
$(container).parents('li:not(.activity-item)').addClass('gclh_hidden_day');
}
// The Date of the current Date is displayed outside the list of days
if ($('.activity-groups > li:first').hasClass('gclh_hidden_day')) {
let firstDay = $('.activity-groups > li:not(.gclh_hidden_day)')[0];
$('div > .activity-block-header h2')[0].innerHTML = $(firstDay).find('h2').html();
$(firstDay).find('.activity-block-header')[0].style.display = 'none';
}
}
if (settings_dashboard_hide_tb_activity) {
css += '.gclh_hidden_day, .gclh_hidden_log {display: none !important;}';
}
// Common functions for features in Latest Activity list.
function buildWaitAF(log, waitCount) {
buildLinksAF(log);
buildLogtextMarkdownAF(log);
buildCopyLogtextToClipboard(log);
waitCount++; if (waitCount <= 500) setTimeout(function(){buildWaitAF(log, waitCount);}, 10);
}
function buildEventMoreAF(log) {
if (!$(log).find('.activity-details').hasClass('gclh_event')) {
$(log).find('.activity-details')[0].addEventListener("click", function(){buildWaitAF($(this).closest('.activity-item'), 0);}, false);
$($(log).find('.activity-details')[0]).addClass('gclh_event');
}
}
function processLogsAF(waitCount) {
if ($('#_ActivityFeed .activity-item').length > 0) {
for (i=0; i<$('#_ActivityFeed .activity-item').length; i++) {
if ($($('#_ActivityFeed .activity-item')[i]).find('.activity-details > div h3 > a')[0].href.match(serverParameters["user:info"].referenceCode)) {
buildEventMoreAF($('#_ActivityFeed .activity-item')[i]);
}
backupLogtextMarkdownAF($($('#_ActivityFeed .activity-item')[i]));
hideTBActivity($($('#_ActivityFeed .activity-item')[i]));
}
}
waitCount++; if (waitCount <= 500) setTimeout(function(){processLogsAF(waitCount);}, 10);
}
function buildEventQtipAF(waitCount) {
if ($('#_ActivityFeed .btn-settings')[0] && $('#_ActivityFeed .btn-settings').attr('data-hasqtip') && $('#qtip-' + $('#_ActivityFeed .btn-settings').attr('data-hasqtip') + '-content')[0] && !$( $('#qtip-' + $('#_ActivityFeed .btn-settings').attr('data-hasqtip') + '-content')[0] ).hasClass('gclh_event')) {
var qtip = $('#qtip-' + $('#_ActivityFeed .btn-settings').attr('data-hasqtip') + '-content');
qtip[0].addEventListener("click", function(){startAF();}, false);
$(qtip[0]).addClass('gclh_event');
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){buildEventQtipAF(waitCount);}, 50);}
}
function buildEventLatestActivityAF(waitCount) {
if ($('#_ActivityFeed .btn-settings')[0] && !$($('#_ActivityFeed .btn-settings')[0]).hasClass('gclh_event')) {
$('#_ActivityFeed .btn-settings')[0].addEventListener("click", function(){buildEventQtipAF(0);}, false);
$($('#_ActivityFeed .btn-settings')[0]).addClass('gclh_event');
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){buildEventLatestActivityAF(waitCount);}, 50);}
}
function buildEventLatestActivityPanelAF(waitCount) {
if ($('#_ActivityFeed .panel-header')[0] && !$($('#_ActivityFeed .panel-header')[0]).hasClass('gclh_event')) {
$('#_ActivityFeed .panel-header')[0].addEventListener("click", function(){startAF();}, false);
$($('#_ActivityFeed .panel-header')[0]).addClass('gclh_event');
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){buildEventLatestActivityPanelAF(waitCount);}, 50);}
}
function startAF() {
buildEventLatestActivityPanelAF(0);
buildEventLatestActivityAF(0);
processLogsAF(0);
}
if (settings_show_edit_links_for_logs || settings_dashboard_hide_tb_activity) {
startAF();
}
// Show unpublished hides.
if (settings_showUnpublishedHides) {
function waitForGeocachesNearbyContainer(waitCount) {
if ($('#sidebarNavigation > nav')[0] && $('#_GeocachesNearbyContainer svg')[0]) {
var panel = '
';
panel += '
';
panel += '
Unpublished Hides
';
panel += '
';
panel += '
';
panel += '
';
panel += '
';
panel += '
';
panel += '
';
$('#_GeocachesNearbyContainer').after(panel);
var button = $( $('#_GeocachesNearbyContainer button')[0] ).clone()[0];
$('#gclh_unpublishedCaches .panel-header')[0].append(button);
if (!getValue('unpublishedCaches_visible', false)) {
$('#gclh_unpublishedCaches .panel-header').removeClass('isActive');
$('#gclh_unpublishedCaches .panel-body').fadeOut(0);
}
$('#gclh_unpublishedCaches .panel-header').bind('click', function() {
if (getValue('unpublishedCaches_visible', true)) {
$('#gclh_unpublishedCaches .panel-header').removeClass('isActive');
$('#gclh_unpublishedCaches .panel-body').fadeOut(300);
setValue('unpublishedCaches_visible', false);
} else {
$('#gclh_unpublishedCaches .panel-header').addClass('isActive');
$('#gclh_unpublishedCaches .panel-body').fadeIn(300);
setValue('unpublishedCaches_visible', true);
}
});
// If the link to unpublished hides is shown in bold, there are some.
if ($('a[href*="/play/owner/unpublished"]:has(> strong)')[0]) {
// Build the area to list the unpublished caches and events.
function buildListArea() {
if ($('#gclh_unpublishedCaches_list')[0]) return;
var list = '
';
$('#gclh_unpublishedCaches_body').html(list);
}
// Build the list of unpublished caches.
function buildCachesList(caches) {
buildListArea();
if (settings_set_showUnpublishedHides_sort) {
if (settings_showUnpublishedHides_sort == 'abc') caches.sort(abc);
else if (settings_showUnpublishedHides_sort == 'gcNew') caches.sort(gcNew);
else if (settings_showUnpublishedHides_sort == 'gcOld') caches.sort(gcOld);
}
var list = '';
for (let i=0; i';
list += '
';
list += '';
}
$('#gclh_unpublishedCaches_cachesList').html(list);
if ($('#gclh_unpublishedCaches_eventsList li')[0]) {
$('#gclh_unpublishedCaches_eventsList li')[0].setAttribute('style', 'border-top: 1px solid #e4e4e4;');
}
}
// Build the list of unpublished events.
function buildEventsList(events) {
buildListArea();
var list = '';
for (let i=0; i';
list += '
', {
id: 'gclh_right_sidebar_wrapper',
height: 'fit-content'
});
$sidebar_right.wrap($wrapper);
const title_hide = 'Click to hide all sections on the right side';
const title_show = 'Click to show all sections on the right side';
const $btn = $('
');
$('#gclh_search_map').append($('#search-map-cta').remove().get().reverse());
$('#gclh_search_map a')[0].childNodes[2].remove();
var css = '';
css += '.leaflet-top.leaflet-right {top: unset;}';
css += '.map-cta {opacity: 0.8; background-color: rgb(248, 248, 249); width: 36px; height: 36px; border: unset; box-shadow: unset; line-height: unset; padding: unset; position: unset;}';
css += '#gclh_search_map, #gclh_search_map > a {z-index: 1018;}';
css += '#gclh_search_map svg {margin: 0; padding: 9px 7px 6px 7px; color: #02874d;}';
css += '.map-cta:hover {background-color: #e6f7ef;}';
appendCssStyle(css);
}
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){relocatingSearchMapButton(waitCount);}, 100);}
}
relocatingSearchMapButton(0);
} catch(e) {gclh_error("Relocate button search geocaches on Browse Map",e);}
}
// Hide found/hidden Caches on Map. Add Buttons for hiding/showing all Caches.
function hideCachesOnBrowseMap() {
try {
$('#LegendRed ul')[0].innerHTML += '';
if ($('#Legend6')[0]) {
$('#Legend6')[0].addEventListener("click", function() {$('#Legend3653').click(); $('#Legend1304').click();}, false);
$('#Legend6')[0].title = $('#Legend6')[0].title + " / Community Celebration Event";
}
if ($('#Legend2')[0]) $('#Legend2')[0].addEventListener("click", function() {$('#Legend9').click();}, false);
function hideFoundCaches() {
// Kartenfilter bei externen Filtern (beispielsweise aus play/search) nicht verändern.
if (document.location.href.match(/&asq=/)) return;
var button = unsafeWindow.document.getElementById("m_myCaches").childNodes[1];
if (button) button.click();
}
if (settings_map_hide_found) isMapLoad(hideFoundCaches);
function hideHiddenCaches() {
if (document.location.href.match(/&asq=/)) return;
var button = unsafeWindow.document.getElementById("m_myCaches").childNodes[3];
if (button) button.click();
}
if (settings_map_hide_hidden) isMapLoad(hideHiddenCaches);
function removeDNFSmileys() {
if (document.location.href.match(/&asq=/)) return;
var button = unsafeWindow.document.getElementById("m_myCaches").childNodes[5];
if (button) button.click();
}
if (settings_map_hide_dnfs) isMapLoad(removeDNFSmileys);
function getAllCachetypeButtons() {
return ['Legend2', 'Legend9', 'Legend3', 'Legend6', 'Legend13', 'Legend453', 'Legend7005', 'Legend1304', 'Legend137', 'Legend4', 'Legend11', 'Legend8', 'Legend5', 'Legend1858'];
}
function hideAllCacheTypes() {
var cacheTypes = getAllCachetypeButtons();
cacheTypes.forEach(hideCacheType);
}
function hideCacheType(item) {
if (document.getElementById(item).className.indexOf('ct_untoggled') === -1) document.getElementById(item).click();
}
function showCacheType(item) {
if (document.getElementById(item).className.indexOf('ct_untoggled') !== -1) document.getElementById(item).click();
}
function showAllCacheTypes() {
var cacheTypes = getAllCachetypeButtons();
cacheTypes.forEach(showCacheType);
}
var ul = document.getElementById("m_cacheTypes");
var li = document.createElement("li");
var a = document.createElement('a');
a.appendChild(document.createTextNode("Hide all Cachetypes"));
a.title = "Hide all Caches";
a.href = "#";
li.appendChild(a);
ul.appendChild(li);
li.onclick = function() {hideAllCacheTypes();};
li = document.createElement("li");
a = document.createElement('a');
a.appendChild(document.createTextNode("Show all Cachetypes"));
a.title = "Show all Caches";
a.href = "#";
li.appendChild(a);
ul.appendChild(li);
li.onclick = function() {showAllCacheTypes();};
// Apply Cache Type Filter.
function hideCacheTypes() {
if (document.location.href.match(/&asq=/)) return;
// Cache Types auf hidden setzen.
if (settings_map_hide_2 && $('#Legend2')[0]) {$('#Legend2')[0].click(); $('#Legend2')[0].setAttribute("class", "ct_toggle ct2 ct_untoggled");}
if (settings_map_hide_9 && $('#Legend9')[0]) {$('#Legend9')[0].click(); $('#Legend9')[0].setAttribute("class", "ct_toggle ct9 ct_untoggled");}
if (settings_map_hide_5 && $('#Legend5')[0]) {$('#Legend5')[0].click(); $('#Legend5')[0].setAttribute("class", "ct_toggle ct5 ct_untoggled");}
if (settings_map_hide_3 && $('#Legend3')[0]) {$('#Legend3')[0].click(); $('#Legend3')[0].setAttribute("class", "ct_toggle ct3 ct_untoggled");}
if (settings_map_hide_6 && $('#Legend6')[0]) {$('#Legend6')[0].click(); $('#Legend6')[0].setAttribute("class", "ct_toggle ct6 ct_untoggled");}
if (settings_map_hide_453 && $('#Legend453')[0]) {$('#Legend453')[0].click(); $('#Legend453')[0].setAttribute("class", "ct_toggle ct453 ct_untoggled");}
if (settings_map_hide_7005 && $('#Legend7005')[0]) {$('#Legend7005')[0].click(); $('#Legend7005')[0].setAttribute("class", "ct_toggle ct7005 ct_untoggled");}
if (settings_map_hide_13 && $('#Legend13')[0]) {$('#Legend13')[0].click(); $('#Legend13')[0].setAttribute("class", "ct_toggle ct13 ct_untoggled");}
if (settings_map_hide_1304 && $('#Legend1304')[0]) {$('#Legend1304')[0].click(); $('#Legend1304')[0].setAttribute("class", "ct_toggle ct1304 ct_untoggled");}
if (settings_map_hide_4 && $('#Legend4')[0]) {$('#Legend4')[0].click(); $('#Legend4')[0].setAttribute("class", "ct_toggle ct4 ct_untoggled");}
if (settings_map_hide_11 && $('#Legend11')[0]) {$('#Legend11')[0].click(); $('#Legend11')[0].setAttribute("class", "ct_toggle ct11 ct_untoggled");}
if (settings_map_hide_137 && $('#Legend137')[0]) {$('#Legend137')[0].click(); $('#Legend137')[0].setAttribute("class", "ct_toggle ct137 ct_untoggled");}
if (settings_map_hide_8 && $('#Legend8')[0]) {$('#Legend8')[0].click(); $('#Legend8')[0].setAttribute("class", "ct_toggle ct8 ct_untoggled");}
if (settings_map_hide_1858 && $('#Legend1858')[0]) {$('#Legend1858')[0].click(); $('#Legend1858')[0].setAttribute("class", "ct_toggle ct1858 ct_untoggled");}
// Gesamte Reihen zu den Cache Types auf hidden setzen.
if (settings_map_hide_2) $('#LegendGreen')[0].childNodes[0].setAttribute("class", "a_cat_displayed cat_untoggled");
if (settings_map_hide_3) $('#LegendYellow')[0].childNodes[0].setAttribute("class", "a_cat_displayed cat_untoggled");
if (settings_map_hide_6 && settings_map_hide_453 && settings_map_hide_7005 && settings_map_hide_13) $('#LegendRed')[0].childNodes[0].setAttribute("class", "a_cat_displayed cat_untoggled");
if (settings_map_hide_4 && settings_map_hide_11 && settings_map_hide_137) $('#chkLegendWhite')[0].childNodes[0].setAttribute("class", "a_cat_displayed cat_untoggled");
if (settings_map_hide_8 && settings_map_hide_5 && settings_map_hide_1858) $('#chkLegendBlue')[0].childNodes[0].setAttribute("class", "a_cat_displayed cat_untoggled");
}
isMapLoad(hideCacheTypes);
} catch(e) {gclh_error("Hide found/hidden Caches / Cache Types on Map",e);}
}
// Save as PQ and set defaults for Browse Map.
function saveAsPQOnBrowseMap() {
setValue('settings_save_as_pq_set_defaults', false);
try {
function waitForSavePQ(waitCount) {
if ($('.pq-dl')[0] && $('#lnk_savepq')[0]) {
$('.pq-dl').append('
| Set defaults
');
$('.pq-dl .gclh_toggle-handle')[0].onclick = function() {
$('.pq-dl .gclh_toggle-handle').toggleClass('on');
setValue('set_switch_browsemap_set_defaults', $('.pq-dl .gclh_toggle-handle.on')[0] ? true:false);
};
$('#lnk_savepq')[0].onclick = function() {
setValue('settings_save_as_pq_set_defaults', $('.pq-dl .gclh_toggle-handle.on')[0] ? true:false);
};
if ($('.gclh_toggle-handle')[0] && getValue('set_switch_browsemap_set_defaults', false) == true) {$('.gclh_toggle-handle').addClass('on');}
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForSavePQ(waitCount);}, 50);}
}
waitForSavePQ(0)
var css = '.pq-dl {margin-top: 1em; margin-bottom: 0 !important; display: flex; cursor: default;}';
css += '.set_defaults {margin-right: 6px;}';
appendCssStyle(css);
} catch(e) {gclh_error("Save as PQ and set defaults for Browse Map",e);}
}
// Display more informations on Browse Map pop up for a cache.
function cachePopupOnBrowseMap() {
try {
var template = $("#cacheDetailsTemplate").html().trim();
// {{=gc}} will be replaced by the GC-Code, so the div is unique
var new_template = '';
new_template += '
';
}
// Get number of trackables in cache.
var trachables = 0;
if ($(text).find('#ctl00_ContentBody_uxTravelBugList_uxViewAllTrackableItems')[0]) {
trachables = $(text).find('#ctl00_ContentBody_uxTravelBugList_uxViewAllTrackableItems')[0].innerHTML.replace(/\D/g, '');
}
if ((trachables == 0 || trachables == '') && $(text).find('#ctl00_ContentBody_uxTravelBugList_uxInventoryLabel')[0]) {
trachables = ($(text).find('#ctl00_ContentBody_uxTravelBugList_uxInventoryLabel').closest('.CacheDetailNavigationWidget')[0].innerHTML.match(/
/g)||[]).length;
}
// Get the number of favorite points.
var fav_points = $(text).find('.favorite-value').html();
if (fav_points == null) {
// Couldn't get Number of Favorits. This happens with event caches for example.
fav_points = 0;
} else {
fav_points = fav_points.replace('.','');
fav_points = fav_points.replace(',','');
fav_points = parseInt(fav_points);
}
// Set dummy favorite score.
var fav_percent = ' ';
// Get the place, where the cache was placed.
if ($(text).find('#ctl00_ContentBody_Location a')[0]) var place = $(text).find('#ctl00_ContentBody_Location a')[0].innerHTML;
else var place = $(text).find('#ctl00_ContentBody_Location')[0].innerHTML.replace(/(.*?)\s/,'');
// Put all together.
var new_text = 'Logs:' + all_logs + ' ';
new_text += $(last_logs).prop('outerHTML');
new_text += '
';
// Premium icon.
if (premium_only) {
new_text += ' | ';
}
// Number of trackables.
new_text += ' ' + trachables + ' | ';
// Get link to image gallery and image count.
var a = $(text).find('.CacheDetailNavigation ul li').find('a[href*="/seek/gallery.aspx?guid="]');
if (a) {
var galleryLink = a[0].href;
var imgCount = a[0].innerHTML.match(/(\s*)\((\d+)\)/);
if (galleryLink && imgCount && imgCount[2]) {
if (imgCount[2] == "0") new_text += '';
else new_text += '';
new_text += '' + imgCount[2] + ' | ';
}
}
// Get personal cache note.
if ($(text).find('#srOnlyCacheNote')[0]) {
if (!$(text).find('#srOnlyCacheNote')[0].innerHTML || $(text).find('#srOnlyCacheNote')[0].innerHTML == '') {
new_text += ' | ';
} else {
new_text += '' + $(text).find('#srOnlyCacheNote').html().replace(/\n/gi,' ') + ' | ';
}
}
// Favorite percentage.
new_text += ' ' + fav_percent + ' | ';
// Placeholder for elevation.
if (settings_show_elevation_of_waypoints) {
new_text += '';
}
// Place and placeholder for county.
if (settings_show_country_in_place) new_text += '' + place + '';
else new_text += '' + place.replace(/(,.*)/,'') + '';
new_text += '
';
// Get coordinates.
var coords = $(text).find('#uxLatLon')[0].innerHTML;
var original_coords = "";
var original_coords_span = "";
var corrected = "";
if (text.match(/"isUserDefined":true/gm)) {
var original_coords = text.match(/oldLatLngDisplay":"(N|S).*(E|W).*?'"/gm);
original_coords = String(original_coords[0]);
original_coords = original_coords.replace("oldLatLngDisplay\":\"","");
original_coords = original_coords.replace("\"","");
original_coords = original_coords.replace(new RegExp('\'', 'g'),'');
original_coords_span = ' ( ' + original_coords + ' )';
corrected = "corrected ";
}
if (settings_show_enhanced_map_coords) {
new_text += '' + coords + '' + original_coords_span + '';
}
$('#popup_additional_info_' + local_gc_code).html(new_text);
// Open latest logs and personal cache note slightly late so it doesn't flutter.
function doNotFlutter(pos) {
$(pos).each(function() {
this.addEventListener('mouseover', function() {
var a = this;
setTimeout(function() {$(a).addClass('mouseover');}, 250);
})
this.addEventListener('mouseleave', function() {
$(this).removeClass('mouseover');
var a = this;
setTimeout(function() {$(a).removeClass('mouseover');}, 250);
})
});
}
doNotFlutter('.gclh_latest_log');
doNotFlutter('.gclh_cache_note');
// Get count and names of own bookmarklists.
if ($('#popup_additional_info_' + local_gc_code).closest('.map-item')[0]) {
var item = $('#popup_additional_info_' + local_gc_code).closest('.map-item')[0];
if ( !$(item).find('#ownBMLsCount')[0] && $(item).find('.btn-add-to-list > span')[0] ) {
var [ownBMLsCount, ownBMLsText, ownBMLsList] = getOwnBMLs(text);
$(item).find('.btn-add-to-list')[0].after($(' (' + ownBMLsCount + ')')[0]);
$(item).find('.btn-add-to-list > span')[0].setAttribute('title', ownBMLsText);
$(item).find('#ownBMLsCount')[0].setAttribute('title', ownBMLsList);
}
}
// Add Copy to Clipboard Links.
if (settings_show_enhanced_map_coords) {
if (original_coords != "") {
addCopyToClipboardLink(original_coords, $('#popup_additional_info_' + local_gc_code + ' span.coordinates.original .anker')[0], "original Coordinates", 'vertical-align: bottom; margin-right: -6px;');
}
addCopyToClipboardLink(coords, $('#popup_additional_info_' + local_gc_code + ' span.coordinates.current')[0], corrected+"Coordinates", 'vertical-align: bottom; margin-right: -6px;');
}
// Get favorite score.
getFavoriteScore(local_gc_code, function(score) {
var id = '#popup_additional_info_' + local_gc_code + ' .favi_points';
if ($(id)[0] && $(id)[0].childNodes[1]) $(id)[0].childNodes[1].data = " "+score+"%";
});
// Add county (Landkreis) to place.
if (settings_maps_add_county_to_place) {
try {
let [lat, lon] = toDec(coords);
insertCountyInformation(lat, lon, (placeWithCountry, placeWithoutCountry, placeComplet) => {
var id = '#popup_additional_info_' + local_gc_code + ' .Place';
if ($(id)[0]) {
if (settings_show_country_in_place) $(id)[0].innerHTML = placeWithCountry;
else $(id)[0].innerHTML = placeWithoutCountry;
$(id)[0].title = placeComplet;
}
});
} catch(e) {gclh_error("Add county (Landkreis) to place",e);}
}
// Get elevations.
if (settings_show_elevation_of_waypoints) {
var coords = toDec($(text).find('#uxLatLon')[0].innerHTML);
locations.push(coords[0]+","+coords[1]);
if (locations && locations.length == countMapItems) getElevations(0,locations);
}
// Show Weekday for Events.
if (settings_show_eventday && text.match(/eventCacheData/)) {
var matchDate = text.match(/new Date\((\d{4}), (\d{2})-1, (\d{2})/);
if (matchDate != null) {
var date = new Date(matchDate[1], matchDate[2]-1, matchDate[3]);
if (date != "Invalid Date") {
$('#gclh_weekday_'+local_gc_code).html(` (${date.getWeekday(short = true)})`);
}
}
}
});
// Improve Original Box Content.
side = $(this).find('dl dd a');
guid = side.attr('href').substring(15,36+15);
username = side.text();
buildSendIcons(side[0], username, "per guid", guid);
if (settings_show_vip_list) {
var link = gclh_build_vipvup(username, global_vips, "vip");
link.children[0].style.marginLeft = "5px";
link.children[0].style.marginRight = "3px";
side[0].appendChild(link);
// Build VUP Icon.
if (settings_process_vup && username != global_activ_username) {
link = gclh_build_vipvup(username, global_vups, "vup");
link.children[0].setAttribute("style", "margin-left: 0px; margin-right: 0px");
side[0].appendChild(link);
}
}
addCopyToClipboardLink(gccode, $(this).find('h4')[0], "GC Code", "float: right;");
});
});
});
// Configuration of the observer.
var config = { attributes: true, childList: true, characterData: true };
// Pass in the target node, as well as the observer options.
observer.observe(target, config);
} catch(e) {gclh_error("enhance cache pop up",e);}
}
// Trackable map resizing and zooming with mouse wheel.
if (document.location.href.match(/\.com\/track\/map/)) {
try {
function waitForTrackableMap(waitCount) {
if (unsafeWindow.map !== null) {
$('#map_canvas').append('');
appendCssStyle('#map_canvas {height: 450px;} .leaflet-bottom.leaflet-right {margin-right: 16px;}');
$('#map_canvas').resizable({minHeight: 300, maxHeight: 700});
var scriptText = "map.invalidateSize(); map.scrollWheelZoom.enable();";
injectPageScript(scriptText, 'head');
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForTrackableMap(waitCount);}, 100);}
}
waitForTrackableMap(0);
} catch(e) {gclh_error("Trackable map resizing and zooming with mouse wheel",e);}
}
// Dimmed style for lost trackabels on owned trackables view.
if (document.location.href.match(/\.com\/track\/search\.aspx\?o=1&uid=/) && settings_dim_lost_trackables) {
try {
const $rows = $('table.Table td:nth-child(5)').not(':has(img[src^="/images/"])').closest('tr');
$rows.find('td, a').css({ color: '#AFAFAF', textDecoration: 'line-through' });
$rows.find('img').css({ opacity: 0.35 });
} catch(e) {gclh_error("Dimmed style for lost trackabels on owned trackables view",e);}
}
// Improve cache matrix on statistics page and public profile page and handle cache search links in list or map.
try {
if ((settings_count_own_matrix || settings_count_own_matrix_show_next) && isOwnStatisticsPage()) {
var own = true;
} else if (settings_count_foreign_matrix && is_page("publicProfile") && $('#ctl00_ContentBody_lblUserProfile')[0] && !$('#ctl00_ContentBody_lblUserProfile')[0].innerHTML.match(": " + global_me)) {
var own = false;
} else var own = "";
if (own !== "") {
// Matrix ermitteln.
if (document.getElementById('ctl00_ContentBody_StatsDifficultyTerrainControl1_uxDifficultyTerrainTable')) {
var table = document.getElementById('ctl00_ContentBody_StatsDifficultyTerrainControl1_uxDifficultyTerrainTable');
} else if (document.getElementById("ctl00_ContentBody_ProfilePanel1_StatsDifficultyTerrainControl1_uxDifficultyTerrainTable")) {
var table = document.getElementById("ctl00_ContentBody_ProfilePanel1_StatsDifficultyTerrainControl1_uxDifficultyTerrainTable");
}
if (table) {
// Matrixerfüllung berechnen.
var smallest = parseInt(table.getElementsByClassName("stats_cellfooter_grandtotal")[0].innerHTML);
var count = 0;
var cells = table.getElementsByTagName('td');
for (var i = 0; i < cells.length; i++) {
var cell = cells[i];
if (cell.id.match(/^([1-9]{1})(_{1})([1-9]{1})$/)) {
if (parseInt(cell.children[0].innerHTML) == smallest) count++;
else if (parseInt(cell.children[0].innerHTML) < smallest) {
smallest = parseInt(cell.children[0].innerHTML);
count = 1;
}
}
}
// Matrixerfüllung ausgeben.
if ((own == true && settings_count_own_matrix == true) || (own == false && settings_count_foreign_matrix == true)) {
if (smallest > 0) var matrix = " (" + smallest + " complete and (" + (81 - count) + "/81))";
else var matrix = " (" + (81 - count) + "/81)";
if (document.getElementById('uxDifficultyTerrainHelp').previousSibling) {
var side = document.getElementById('uxDifficultyTerrainHelp').previousSibling;
side.nodeValue += matrix;
}
}
// Nächste mögliche Matrix farblich kennzeichnen und Search Link und Title überall ergänzen.
if (own == true && settings_count_own_matrix_show_next == true) {
var from = smallest;
var to = smallest - 1 + parseInt(settings_count_own_matrix_show_count_next);
var color = "#" + settings_count_own_matrix_show_color_next;
for (var i = 0; i < cells.length; i++) {
var cell = cells[i];
if (cell.id.match(/^([1-9]{1})(_{1})([1-9]{1})$/)) {
if (from <= parseInt(cell.children[0].innerHTML) && parseInt(cell.children[0].innerHTML) <= to) {
cell.children[0].style.color = "black";
var diff = parseInt(cell.children[0].innerHTML) - from;
cell.style.backgroundColor = color;
cell.children[0].style.backgroundColor = 'unset';
if (diff == 1) cell.style.backgroundColor = cell.style.backgroundColor.replace(/rgb/i, "rgba").replace(/\)/, ",0.6)");
else if (diff == 2) cell.style.backgroundColor = cell.style.backgroundColor.replace(/rgb/i, "rgba").replace(/\)/, ",0.4)");
else if (diff == 3) cell.style.backgroundColor = cell.style.backgroundColor.replace(/rgb/i, "rgba").replace(/\)/, ",0.25)");
}
if (settings_count_own_matrix_links_radius != 0) {
cell.children[0].href +=
"&origin=" + DectoDeg(getValue("home_lat"), getValue("home_lng")) +
"&radius=" + settings_count_own_matrix_links_radius + "km" +
"&nfb[0]=" + global_me + "&o=2&gclhmatrix=1";
if (settings_count_own_matrix_links == "map") {
var zoom = Math.round(24 - Math.log2(settings_count_own_matrix_links_radius * 1000));
var dt = cell.children[0].href.match(/d=(.*?)&t=(.*?)&/i);
cell.children[0].href = 'https://www.geocaching.com/play/map?lat=' + (getValue("home_lat") / 10000000)
+ '&lng=' + (getValue("home_lng") / 10000000) + '&zoom=' + zoom
+ '&asc=true&sort=distance&ot=coords&r=' + settings_count_own_matrix_links_radius
+ '&d=' + dt[1] + '&t=' + dt[2] + '&hf=1&nfb=' + global_me + '&gclhmatrix=1';
cell.children[0].title += ", on map";
} else {
cell.children[0].href += "#searchResultsTable";
cell.children[0].title += ", on list";
}
cell.children[0].title += ", with radius " + settings_count_own_matrix_links_radius + " km from home";
cell.children[0].target = '_blank';
}
}
}
}
}
}
if ($('#ctl00_ContentBody_ProfilePanel1_lnkStatistics').length == 0 && isOwnStatisticsPage()) appendCssStyle("dl.ProfileDataList dt {float: left; clear: both; margin-right: 10px;}");
} catch(e) {gclh_error("Improve cache matrix",e);}
// Improve own statistics page and own profile page with own log statistic.
if (settings_log_statistic && isOwnStatisticsPage()) {
try {
getLogSt("cache", "/my/logs.aspx?s=1");
getLogSt("track", "/my/logs.aspx?s=2");
} catch(e) {gclh_error("Improve own log statistic",e);}
}
function getLogSt(type, url, manual) {
var logsName = (type == "cache" ? "Cache":"Trackable") + " logs";
var logsId = "gclh_" + type + "_logs_";
var get_last = parseInt(getValue(logsId + "get_last"), 10);
if (!get_last) get_last = 0;
var reload_after = (settings_log_statistic_reload === "" ? "0" : parseInt(settings_log_statistic_reload, 10) * 60 * 60 * 1000);
var time = new Date().getTime();
if ((reload_after != 0 && (get_last + reload_after) < time) || manual == true) {
if (manual != true) setLogStHF(type, logsName, logsId, url);
setLogStClear(type, logsName, logsId);
setLogStAddWait(type, logsName, logsId);
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: function(response) {
var logCount = new Array();
for (var i = 0; i < 101; i++) {
var count = response.responseText.match(new RegExp("/images/logtypes/" + i + ".png", "g"));
if (count) {
// Das "?" in "(.*?)" bedeutet "nicht gierig", das heißt es wird das erste Vorkommen verwendet.
var title = response.responseText.match('/images/logtypes/' + i + '.png"(.*?)title="(.*?)"');
if (title && title[2]) {
if (type == "track") {
if (i == 4) var lt = "<=3";
else if (i == 13) var lt = "<=5";
else if (i == 14) var lt = "<=10";
else if (i == 19) var lt = "<=2";
else if (i == 48) var lt = "<=48";
else if (i == 75) var lt = "<=75";
else var lt = "";
} else var lt = "<=" + i;
var logType = new Object();
logType["src"] = "/images/logtypes/" + i + ".png";
logType["title"] = title[2];
logType["href"] = url + lt;
logType["count"] = count.length;
logType["no"] = i;
logCount[logCount.length] = logType;
}
}
}
if (logCount.length > 0) setValue(logsId + "get_last", time);
setValue(logsId + "count", JSON.stringify(logCount));
var now = new Date().getTime();
var generated = Math.ceil((now - time) / (60 * 1000)); // In Minuten.
setLogStClear(type, logsName, logsId);
setLogSt(type, logsName, logsId, generated);
}
});
} else if (reload_after == 0 && get_last == 0) {
setLogStHF(type, logsName, logsId, url);
setLogStDummy(type, logsName, logsId);
} else {
var generated = Math.ceil((time - get_last) / (60 * 1000)); // In Minuten.
setLogStHF(type, logsName, logsId, url);
setLogStClear(type, logsName, logsId);
setLogSt(type, logsName, logsId, generated);
}
}
function setLogStHF(type, logsName, logsId, url) {
if ($('#ctl00_ContentBody_StatsChronologyControl1_YearlyBreakdown, #ctl00_ContentBody_ProfilePanel1_StatsChronologyControl1_YearlyBreakdown')[0]) {
var side = $('#ctl00_ContentBody_StatsChronologyControl1_YearlyBreakdown, #ctl00_ContentBody_ProfilePanel1_StatsChronologyControl1_YearlyBreakdown')[0];
}
if (side) {
var div = document.createElement("div");
div.className = (type == "cache" ? "span-9":"span-9 last");
var html = '';
html += '
';
tr.innerHTML = html;
side.appendChild(tr);
}
if ($('#'+logsId+'total')[0]) $('#'+logsId+'total')[0].innerHTML = total;
if ($('#'+logsId+'generated')[0]) {
$('#'+logsId+'generated')[0].innerHTML = "Generated " + buildTimeString(generated) + " ago";
var reload_after = parseInt(settings_log_statistic_reload, 10) * 60;
if (reload_after > 0) $('#'+logsId+'generated')[0].title = "Automated reload in " + buildTimeString(reload_after - generated);
}
if ($('#'+logsId+'reload')[0]) {
$('#'+logsId+'reload')[0].innerHTML = "Reload";
$('#'+logsId+'reload')[0].title = "Reload " + logsName;
}
} else setLogStDummy(type, logsName, logsId);
}
function setLogStClear(type, logsName, logsId) {
$('#'+logsId+'body').children().each(function() {this.remove();});
if ($('#'+logsId+'total')[0]) $('#'+logsId+'total')[0].innerHTML = "";
if ($('#'+logsId+'generated')[0]) $('#'+logsId+'generated')[0].innerHTML = $('#'+logsId+'generated')[0].title = "";
if ($('#'+logsId+'reload')[0]) $('#'+logsId+'reload')[0].innerHTML = $('#'+logsId+'reload')[0].title = "";
}
function setLogStAddWait(type, logsName, logsId) {
if ($('#'+logsId+'body')[0]) {
var side = $('#'+logsId+'body')[0];
var load = document.createElement("span");
load.setAttribute("style", "line-height: 36px; margin-left: 5px;");
load.innerHTML = ' Loading ' + logsName + ' ...';
side.appendChild(load);
}
}
function setLogStDummy(type, logsName, logsId) {
if ($('#'+logsId+'body')[0]) {
var side = $('#'+logsId+'body')[0];
var dummy = document.createElement("span");
dummy.setAttribute("style", "margin-left: 5px;");
side.appendChild(dummy);
}
if ($('#'+logsId+'reload')[0]) {
$('#'+logsId+'reload')[0].innerHTML = "Load";
$('#'+logsId+'reload')[0].title = "Load " + logsName;
}
}
// Improve Finds for Each Day of the Year on own statistics page.
if (isOwnStatisticsPage()) {
try {
// Mark current date
var today = new Date();
$('#'+(today.getMonth()+1)+'_'+today.getDate()).css("border","2px solid red");
} catch(e) {gclh_error("Improve Finds for Each Day of the Year",e);}
}
// Improve statistic map page with links to caches for every country and state.
if (settings_map_links_statistic) {
try {
function buildLinkForItem(para, item, side) {
var a = document.createElement("a");
if (isOwnStatisticsPage()) {
a.setAttribute("title", "Show caches you have found in " + item["n"]);
a.setAttribute("href", "/play/search?" + para + item["id"] + "&hf=0&sa=1&f=1&sort=FoundDate&asc=false#myListsLink");
} else {
if ($('#ctl00_ProfileHead_ProfileHeader_lblMemberName')[0]) {
a.setAttribute("title", "Show caches " + $('#ctl00_ProfileHead_ProfileHeader_lblMemberName')[0].innerHTML + " has found in " + item["n"]);
// Important: If the user does not allow the display of found caches, all caches will be displayed. The user in the url
// will then not be taken into account.
a.setAttribute("href", "/play/search?" + para + item["id"] + "&fb=" + urlencode($('#ctl00_ProfileHead_ProfileHeader_lblMemberName')[0].innerHTML) + "&sa=1&sort=FoundDate&asc=false#myListsLink");
}
}
a.setAttribute("style", "color: #3d76c5;");
a.innerHTML = side.innerHTML;
side.innerHTML = "";
side.appendChild(a);
}
var maps = $('#stats_tabs-maps .StatisticsWrapper');
for (var j = 0; j < maps.length; j++) {
if ($(maps[j]).find('.ProfileStats > div')[0].id && !$(maps[j]).find('.ProfileStats > div')[0].id == '') {
var mapName = $(maps[j]).find('.ProfileStats > div')[0].id;
var items = $(maps[j]).find('table.Table tr');
for (var i = 0; i < items.length; i++) {
if (items[i].children[0] && items[i].children[0].childNodes[1] && !items[i].children[0].childNodes[1].textContent == '') {
var itemName = items[i].children[0].childNodes[1].textContent;
if (itemName) {
// Maps from US states and Canadian provinces and territories. All other maps are country maps.
if (mapName.match(/(UnitedStatesOfAmerica_Map|Canada_Map)/)) {
var para = 'ot=region&oid=';
var state = $.grep(states_id, function(e){return e.n == itemName;});
if (state && state[0]) {
buildLinkForItem(para, state[0], items[i].children[0]);
}
} else {
var para = 'ot=country&c=';
var country = $.grep(country_id, function(e){return e.n == itemName;});
if (country && country[0]) {
buildLinkForItem(para, country[0], items[i].children[0]);
}
}
}
}
}
}
}
} catch(e) {gclh_error("Improve statistic map page with links to caches for every country and state",e);}
}
// Improve statistic map page with name of country and state in maps and make it clickable in own maps.
if ((document.location.href.match(/\.com\/my\/statistics\.aspx/)) || (is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkStatistics.Active')[0])) {
try {
// Expand tooltip of map to make room for the name of country or state.
function expandTooltip(bCalc) {
var path = $('#stats_tabs-maps g.google-visualization-tooltip path').attr('d').match(/^M(.*?),(.*?)A(.*?)L(.*?),(.*?)A(.*?)L(.*?),(.*?)A/);
if (path && path[1] && path[2] && path[7]) {
var x = parseInt(path[1]);
var y = parseInt(path[2]);
var bMin = path[7] - path[1];
var b = bCalc < bMin ? bMin : bCalc;
d = 'M'+x+','+y+' L'+x+','+(y-45)+' L'+(x+b)+','+(y-45)+' L'+(x+b)+','+y+' Z';
$('#stats_tabs-maps g.google-visualization-tooltip path').attr('d',d);
}
}
// Calculate width of tooltip of map for the expanded content. (I couldn't determine the width directly in the tooltip of map.)
function calcwidth(itemShortName, itemName) {
if (!$('#stats_tabs-maps')[0]) return;
if (!$('#calcWidth')[0]) $('#stats_tabs-maps').append('');
$('#calcWidth')[0].innerHTML = '' + itemShortName + ' ' + itemName + '';
return $('#calcWidth span')[0].offsetWidth + $('#calcWidth span')[1].offsetWidth + 18;
}
// Get shortname of country or state from tooltip of map and get the name and link for country or state.
function getDataFromTooltip() {
var itemName = undefined; var itemLink = undefined; var width = undefined;
if ($('#stats_tabs-maps g.google-visualization-tooltip text')[0]) {
var itemShortName = $('#stats_tabs-maps g.google-visualization-tooltip text')[0].childNodes[0].data.trim();
var mapElem = $('#stats_tabs-maps g.google-visualization-tooltip text').closest('.StatisticsWrapper')[0];
if (itemShortName && mapElem) {
var mapName = $(mapElem).find('.ProfileStats > div')[0].id;
// Maps from US states and Canadian provinces and territories. All other maps are country maps.
if (mapName.match(/(UnitedStatesOfAmerica_Map|Canada_Map)/)) {
var state = $.grep(states_short, function(e){return e.sn == itemShortName;});
if (state && state[0]) {
var itemName = state[0]['n'];
var width = calcwidth(itemShortName, itemName);
var links = $(mapElem).find('table.Table a');
for (var i = 0; i < links.length; i++) {
if (links[i].innerText == itemName) var itemLink = links[i].href;
}
}
} else {
var f = 'table.Table img[src="/images/icons/flags/png/' + itemShortName.toLowerCase() + '.png"]';
if ($(mapElem).find(f)[0] && $(mapElem).find(f).parent()[0]) {
var itemName = $(mapElem).find(f).parent()[0].innerText;
var width = calcwidth(itemShortName, itemName);
var itemLink = $(mapElem).find(f).parent()[0].href;
}
}
}
}
return [itemName, itemLink, width];
}
if ($('#stats_tabs-maps')[0] && (settings_map_statistic_set_name_in_map || settings_map_links_statistic)) {
const config = { childList: true, subtree: true };
const tooltipObserver = new MutationObserver(function(_, observer) {
observer.disconnect();
// Set name of country or state in tooltip of map.
if (settings_map_statistic_set_name_in_map) {
var [name1, link1, width1] = getDataFromTooltip();
if (name1 && width1 && !$('#stats_tabs-maps g.google-visualization-tooltip text tspan')[0]) {
expandTooltip(width1);
$('#stats_tabs-maps g.google-visualization-tooltip text')[0].innerHTML += ' ' + name1 + '';
}
}
// Set click event for country or state in tooltip of map.
if (settings_map_links_statistic) {
if ($('#stats_tabs-maps g.google-visualization-tooltip').closest('.StatisticsWrapper:not(.gclh_click) svg')[0]) {
$('#stats_tabs-maps g.google-visualization-tooltip').closest('.StatisticsWrapper:not(.gclh_click) svg')[0].addEventListener('click', function() {
var [name2, link2] = getDataFromTooltip();
if (link2) window.open(link2, '_blank');
}, false);
$('#stats_tabs-maps g.google-visualization-tooltip').closest('.StatisticsWrapper').addClass('gclh_click');
}
}
observer.observe($('#stats_tabs-maps')[0], config);
});
tooltipObserver.observe($('#stats_tabs-maps')[0], config);
}
} catch(e) {gclh_error("Improve statistic map page in the maps",e);}
}
// Improve statistic map page with total and percentage.
if ((document.location.href.match(/\.com\/my\/statistics\.aspx/)) || (is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkStatistics.Active')[0])) {
try {
$('#stats_tabs-maps .StatisticsWrapper').each(function() {
var total = 0;
$(this).find('table tbody').each(function() {
$(this).find('tr > td:nth-child(2) > strong').each(function() {
total += JSON.parse($(this)[0].innerHTML.replace(/\s/g, ''));
});
if (settings_map_percentage_statistic) {
$(this).find('tr > td:nth-child(2) > strong').each(function() {
var count = JSON.parse($(this)[0].innerHTML.replace(/\s/g, ''));
var perc = (Math.round(count * 100 * 100 / total) / 100).toFixed(2);
var td = document.createElement('td');
td.innerHTML = '' + perc + '%';
td.setAttribute('title', count + (count == 1 ? ' cache are ':' caches are ') + perc + '% of the total of ' + total + ' caches.');
$(this)[0].parentNode.parentNode.appendChild(td);
});
}
});
$(this)[0].previousElementSibling.innerHTML = total + ' ' + $(this)[0].previousElementSibling.innerHTML;
});
} catch(e) {gclh_error("Improve statistic map page",e);}
}
// Improve finds per month chart in statistics: change chart height dynamically.
if ((document.location.href.match(/\.com\/my\/statistics\.aspx/) || (is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkStatistics.Active')[0])) && $('#uxFindsPerMonthChartContainer')[0]) {
try {
(function makeChartResizable(waitCount) {
// Use more actual jquery from page, otherwise resize handler stays invisible.
if (typeof unsafeWindow.$?.fn?.resizable === 'function') {
// Don't use chart container 'div#uxFindsPerMonthChartContainer' for resizables directly
// (otherwise resizable gets invalid after each chart update).
// Rather use its parent container and resize both, then everything works.
let $chartContainer = unsafeWindow.$('#uxFindsPerMonthChartContainer');
let $chartContainerParent = $chartContainer.parent();
// Style horizontal resize handle and hide overflow.
appendCssStyle('.ui-resizable-s {left: 50%; background-image: url("https://www.geocaching.com/js/vendor/jquery-ui-1.12.1/images/ui-icons_4A4A4A_256x240.png") !important;}');
$chartContainerParent.css('overflow', 'hidden');
// Get draw chart script from page and modify as necessary.
let drawChartScript_str = $chartContainer.next()[0].text.replace('drawChart()','drawChart_gclh(height)')
.replace("'left':50","'left':50,'height':height").replace(/google\.charts\.load[\s\S]*/, '');
// Make draw chart function 'drawChart_gclh(height)' available.
eval(drawChartScript_str);
// Add resize handler to chart container parent.
const height_default = 223.4;
const offset = 85;
$chartContainerParent.resizable({
alsoResize: '#uxFindsPerMonthChartContainer',
classes: {"ui-resizable-s": "ui-icon ui-icon-grip-solid-horizontal"},
handles: "s",
minHeight: height_default,
create: function (_event, _ui) {
// Remove initial chart.
waitForElementThenRun('#uxFindsPerMonthChartContainer>div', () => {
unsafeWindow.$('#uxFindsPerMonthChartContainer>div').remove();
});
// At own statistics page, restore height from last visit, on public profiles use default value.
// Note: If global gclh parameter 'settings_new_width' is specified, then page resizing must be finished
// before chart is drawn (otherwise chart width isn't correct).
setTimeout(() => {
let height = isOwnStatisticsPage() ? getValue("finds_per_month_chart_statistic", height_default) : height_default;
$chartContainerParent.height(height);
$chartContainer.height(height);
drawChart_gclh(height - offset);
}, 2000);
},
resize: function (_event, ui) {
drawChart_gclh(ui.size.height - offset);
},
stop: function (_event, ui) {
// For own statistics, store actual height.
if (isOwnStatisticsPage()) setValue("finds_per_month_chart_statistic", ui.size.height);
}
});
} else {
if (++waitCount <= 500) setTimeout(() => {makeChartResizable(waitCount);}, 10);
}
})(0);
} catch (e) { gclh_error("Improve finds per month chart in statistics", e); }
}
// Post log from listing (inline).
try {
// iframe aufbauen und verbergen.
if (settings_log_inline && is_page("cache_listing") && $('#ctl00_ContentBody_bottomSection')[0] && $('#ctl00_ContentBody_bottomSection')[0].children[0]) {
var css = "";
var links = document.getElementsByTagName('a');
var menu = false;
var watch = false;
var gallery = false;
for (var i = 0; i < links.length; i++) {
if (links[i].href.match(/log\.aspx\?ID/) && !menu) {
menu = links[i];
} else if (links[i].href.match(/gallery\.aspx/) && !gallery && links[i].parentNode.tagName.toLowerCase() == "li") {
gallery = links[i];
} else if (links[i].href.match(/watchlist\.aspx/) && !watch) {
watch = links[i];
}
}
var head = document.getElementById("ctl00_ContentBody_bottomSection").children[0];
function hide_iframe() {
var frame = document.getElementById('gclhFrame');
if (frame.style.display == "") frame.style.display = "none";
else frame.style.display = "";
}
if (head && menu) {
var match = menu.href.match(/\?ID=(.*)/);
if (match && match[1]) {
var iframe = document.createElement("iframe");
iframe.setAttribute("id", "gclhFrame");
iframe.setAttribute("width", "100%");
iframe.setAttribute("height", "600px");
iframe.setAttribute("style", "border-top: 1px solid #b0b0b0; border-right: 0px; border-bottom: 1px solid #b0b0b0; border-left: 0px; overflow: auto; display: none;");
iframe.setAttribute("src", "/seek/log.aspx?ID=" + match[1] + "&gclh=small");
css += ".logItButton {background-image: url(/images/stockholm/16x16/comment_add.gif); background-repeat: no-repeat; margin-bottom: 20px;}";
css += ".logItButton:hover {background-color: aliceblue;}";
var span = document.createElement("span");
span.innerHTML = '';
span.addEventListener("click", hide_iframe, false);
head.parentNode.insertBefore(span, head);
head.parentNode.insertBefore(iframe, head);
}
var a = document.createElement("a");
a.setAttribute("href", "#gclhLogIt");
a.setAttribute("class", "lnk");
a.setAttribute("style", "padding:0px;");
a.innerHTML = "Log your visit (inline)";
a.addEventListener("click", hide_iframe, false);
var li = document.createElement('li');
li.appendChild(a);
var link = false;
if (gallery) link = gallery;
else link = watch;
if (link) link.parentNode.parentNode.insertBefore(li, link.parentNode);
if (css != '') appendCssStyle(css);
}
}
// Im aufgebauten iframe, quasi nicht im Cache Listing. Nur auf old log page Veränderungen vornehmen.
if (document.location.href.match(/\.com\/seek\/log\.aspx\?(.*)\&gclh\=small/)) hideForInlineLogging();
} catch(e) {gclh_error("Post log from listing (inline)",e);}
// Post log from PMO-Listing as Basic Member (inline).
try {
// iframe aufbauen und verbergen.
var css = "";
if (is_page("cache_listing") && $('.ul__cache-details.unstyled')[0]) {
var idParameter = null;
if (document.URL.match(/wp=[a-zA-Z0-9]*|guid=[a-zA-Z0-9-]*|id=[0-9]*/)) idParameter = document.URL.match(/wp=[a-zA-Z0-9]*|guid=[a-zA-Z0-9-]*|id=[0-9]*/)[0];
if (!idParameter | idParameter == "") idParameter = "wp=" + document.URL.match(/\/geocache\/([^_]*)/)[1];
var banner = $('.ul__cache-details.unstyled')[0].parentNode.nextSibling;
css += "section header {min-width: unset !important;}";
var div = document.createElement("div");
div.setAttribute("style", "text-align: center;");
div.innerHTML = ' Log your visit';
banner.parentNode.insertBefore(div, banner);
}
if (settings_log_inline_pmo4basic && is_page("cache_listing") && $('.ul__cache-details.unstyled')[0]) {
function hide_iframe() {
var frame = document.getElementById('gclhFrame');
if (frame.style.display == "") frame.style.display = "none";
else frame.style.display = "";
}
css += ".logItButton {background-image: url(/images/stockholm/16x16/comment_add.gif); background-repeat: no-repeat; margin-top: 20px; margin-bottom: 20px;}";
css += ".logItButton:hover {background-color: aliceblue;}";
var iframe = document.createElement("iframe");
iframe.setAttribute("id", "gclhFrame");
iframe.setAttribute("width", "100%");
iframe.setAttribute("height", "600px");
iframe.setAttribute("style", "margin-bottom: 50px; border-top: 1px solid #b0b0b0; border-right: 0px; border-bottom: 1px solid #b0b0b0; border-left: 0px; overflow: auto; display: none;");
iframe.setAttribute("src", "/seek/log.aspx?" + idParameter + "&gclh=small");
var div = document.createElement("div");
div.setAttribute("style", "text-align: center;");
var span = document.createElement("span");
span.innerHTML = '';
span.addEventListener("click", hide_iframe, false);
div.appendChild(span);
banner.parentNode.insertBefore(div, banner);
banner.parentNode.insertBefore(iframe, banner);
}
if (css != '') appendCssStyle(css);
// Im aufgebauten iframe, quasi nicht im Cache Listing. Nur auf old log page Veränderungen vornehmen.
if (document.location.href.match(/\.com\/seek\/log\.aspx\?(.*)\&gclh\=small/)) hideForInlineLogging(true);
} catch(e) {gclh_error("Post log from PMO-Listing as Basic Member (inline)",e);}
// Hide for both inline loggings.
function hideForInlineLogging(pmo) {
if ($('html')[0]) $('html')[0].style.backgroundColor = "#FFFFFF";
if ($('header')[0]) $('header')[0].style.display = "none";
if ($('#ctl00_divBreadcrumbs')[0]) $('#ctl00_divBreadcrumbs')[0].style.display = "none";
if ($('.BottomSpacing')[0]) $('.BottomSpacing')[0].style.display = "none";
if ($('.BottomSpacing')[1]) $('.BottomSpacing')[1].style.display = "none";
if ($('#divAdvancedOptions')[0]) $('#divAdvancedOptions')[0].style.display = "none";
if ($('#ctl00_ContentBody_uxVistOtherListingLabel')[0]) $('#ctl00_ContentBody_uxVistOtherListingLabel')[0].style.display = "none";
if ($('#ctl00_ContentBody_uxVistOtherListingGC')[0]) $('#ctl00_ContentBody_uxVistOtherListingGC')[0].style.display = "none";
if ($('#ctl00_ContentBody_uxVisitOtherListingButton')[0]) $('#ctl00_ContentBody_uxVisitOtherListingButton')[0].style.display = "none";
if ($('#ctl00_divContentSide')[0]) $('#ctl00_divContentSide')[0].style.display = "none";
if ($('#UtilityNav')[0]) $('#UtilityNav')[0].style.display = "none";
if ($('footer')[0]) $('footer')[0].style.display = "none";
if ($('.container')[1]) $('.container')[1].style.display = "inline";
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
if (!links[i].id.match(/(AllDroppedOff|AllVisited|AllClear)/i)) links[i].setAttribute("target", "_blank");
}
var css = "";
if (pmo) css += "#Content, #Content .container, .span-20 {width: 780px;}";
else {
css += "#Content, #Content .container, .span-20 {width: " + (parseInt(getValue("settings_new_width")) - 60) + "px;}";
if ($('#Navigation')[0]) $('#Navigation')[0].style.display = "none";
}
css += ".PostLogList .Textarea {height: 175px;}";
appendCssStyle(css);
}
// Show amount of different coins in public profile.
if (is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkCollectibles.Active')[0]) {
try {
function gclh_coin_stats(table_id) {
var table = $('#'+table_id+' table');
var rows = table.find('tbody').first().find('tr');
var sums = new Object();
sums["tbs"] = sums["coins"] = sums["patches"] = sums["signal"] = sums["unknown"] = 0;
var diff = new Object();
diff["tbs"] = diff["coins"] = diff["patches"] = diff["signal"] = diff["unknown"] = 0;
for (var i = 0; i < (rows.length - 1); i++) {
if (rows[i].innerHTML.match(/travel bug/i)) {
diff["tbs"]++;
sums["tbs"] += parseInt(rows[i].childNodes[5].innerHTML, 10);
} else if (rows[i].innerHTML.match(/geocoin/i)) {
diff["coins"]++;
sums["coins"] += parseInt(rows[i].childNodes[5].innerHTML, 10);
} else if (rows[i].innerHTML.match(/geopatch/i)) {
diff["patches"]++;
sums["patches"] += parseInt(rows[i].childNodes[5].innerHTML, 10);
} else if (rows[i].innerHTML.match(/signal/i)) {
diff["signal"]++;
sums["signal"] += parseInt(rows[i].childNodes[5].innerHTML, 10);
} else {
diff["unknown"]++;
sums["unknown"] += parseInt(rows[i].childNodes[5].innerHTML, 10);
}
}
var tfoot = table.find('tfoot')[0];
var tr = document.createElement("tr");
var td = document.createElement("td");
var new_table = "";
td.colSpan = 3;
new_table += "
";
}
td.innerHTML = new_table;
tr.appendChild(td);
tfoot.appendChild(tr);
}
if ($('#ctl00_ContentBody_ProfilePanel1_dlCollectibles')[0]) gclh_coin_stats("ctl00_ContentBody_ProfilePanel1_dlCollectibles");
if ($('#ctl00_ContentBody_ProfilePanel1_dlCollectiblesOwned')[0]) gclh_coin_stats("ctl00_ContentBody_ProfilePanel1_dlCollectiblesOwned");
} catch(e) {gclh_error("Show Coin-Sums",e);}
}
// Show TB, Coin Series in TB-Listing.
if (document.location.href.match(/\.com\/track\/details\.aspx/)) {
try {
if ($('.BugDetailsList')[0]) {
var dl = $('.BugDetailsList')[0];
var dt = document.createElement("dt");
var dd = document.createElement("dd");
dt.innerHTML = "Series:";
if ($('#ctl00_ContentBody_BugTypeImage')[0] && $('#ctl00_ContentBody_BugTypeImage')[0].alt) {
dd.innerHTML = $('#ctl00_ContentBody_BugTypeImage')[0].alt;
dd.title = '(Determined from trackable icon)';
} else if ($('#ctl00_ContentBody_lbHeading')[0] && $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0] && $('head title')[0]) {
dd.innerHTML = $('head title')[0].innerHTML.replace('(' + $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML + ') ', '').replace(' - ' + $('#ctl00_ContentBody_lbHeading')[0].innerHTML, '').trim();
dd.title = '(Determined from page title)';
}
if (!dd.innerHTML == '') {
dl.appendChild(dt);
dl.appendChild(dd);
}
}
} catch(e) {gclh_error("Show TB, Coin Series",e);}
}
// Copy TB Code in TB Listing to clipboard.
if (document.location.href.match(/\.com\/track\/details\.aspx/) && $('.CoordInfoLink')[0] && $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0]) {
addCopyToClipboardLink($('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0], $('.CoordInfoLink')[0], "TB Code");
}
// Improve favorites and profile lists page.
if (document.location.href.match(/\.com\/my\/favorites\.aspx/) && $('table.Table tbody tr')[0]) {
try {
// Count favorite points.
buildFavSum();
// No line-breaks in column location.
if (settings_new_width >= 1000) appendCssStyle('table.Table tbody tr td:nth-child(4) {white-space: nowrap;}');
} catch(e) {gclh_error("Count favorite points",e);}
}
if (is_page("publicProfile") && $('#ctl00_ContentBody_ProfilePanel1_lnkLists.Active')[0] && $('table.Table tbody tr')[0]) {
try {
// Sum up FP and BM entries.
$('#ctl00_ContentBody_ProfilePanel1_pnlBookmarks h3').each(function(i, e) {
$(e).text($(e).text() + ' (' + $(e).next().find('tbody tr').length + ')');
});
// Count favorite points.
buildFavSum(true);
// No line-breaks in column location.
if (settings_new_width >= 1000) appendCssStyle('table.Table tbody tr td:nth-child(3) {white-space: nowrap;}');
} catch(e) {gclh_error("Sum up FP and BM entries, count favorite points",e);}
}
function buildFavSum(pp) {
function buildSL(tag) {
var tr = document.createElement('tr');
var t = '<'+tag+' style="background-color: #DFE1D2; font-weight: normal; font-size: 1em;">';
if (pp) var html = t+''+tag+'>'+t;
else var html = t+''+tag+'>'+t+''+tag+'>'+t;
for (src in stats) {html += ' '+stats[src];}
html += 'Sum: '+count+''+tag+'>'+t+''+tag+'>';
tr.innerHTML = html;
return tr;
}
var imgs = $('table.Table tbody').first().find('tr a:not([href*="mail"],[href*="message"])').find('img');
var stats = new Object();
var count = 0;
for (var i = 0; i < imgs.length; i++) {
if (imgs[i].src) {
if (!stats[imgs[i].src]) stats[imgs[i].src] = 0;
stats[imgs[i].src]++;
count++;
}
}
tr = buildSL("td", pp);
$('table.Table tbody')[0].append(tr);
tr = buildSL("th",pp);
$('table.Table thead')[0].append(tr);
}
// Hide feedback icon.
if (settings_hide_feedback_icon) {
try {
function hideFbIcon(waitCount) {
if ($('#_hj_feedback_container')[0]) $('#_hj_feedback_container')[0].style.display = "none";
if ($('._hj-widget-container')[0]) $('._hj-widget-container')[0].style.display = "none";
waitCount++;
if (waitCount <= 50) setTimeout(function(){hideFbIcon(waitCount);}, 200);
}
hideFbIcon(0);
} catch(e) {gclh_error("Hide feedback icon",e);}
}
// Edit and Image Links to own caches in profile.
if (document.location.href.match(/\.com\/my\/owned\.aspx/)) {
try {
var links = $('a');
for (var i = 0; i < links.length; i++) {
if (links[i].href.match(/\/seek\/cache_details\.aspx\?/)) {
if (!$(links[i]).find('img').length) {
var match = links[i].href.match(/\/seek\/cache_details\.aspx\?guid=(.*)/);
if (match[1]) {
links[i].parentNode.innerHTML += " ";
}
}
}
}
} catch(e) {gclh_error("Edit and Image Links to own caches in profile",e);}
}
// Improve owned caches list.
if (document.location.href.match(/\.com\/my\/owned\.aspx/)) {
try {
function showActive() {
for (var i = 0; i < links.length; i++) {
var archived = links[i].classList.contains("OldWarning");
if (archived) links[i].parentNode.parentNode.setAttribute('style', 'display: none');
else links[i].parentNode.parentNode.removeAttribute('style');
}
if (settings_show_button_for_hide_archived) {
button.value = 'Show all';
button.onclick = showAll;
}
}
function showAll() {
for (var i = 0; i < links.length; i++) {
var archived = links[i].classList.contains("OldWarning");
if (archived) links[i].parentNode.parentNode.removeAttribute('style');
}
button.value = 'Show archived';
button.onclick = showArchived;
}
function showArchived() {
for (var i = 0; i < links.length; i++) {
var archived = links[i].classList.contains("OldWarning");
if (archived) links[i].parentNode.parentNode.removeAttribute('style');
else links[i].parentNode.parentNode.setAttribute('style', 'display: none');
}
button.value = 'Show active';
button.onclick = showActive;
}
var links = $('#divContentMain tbody tr a.lnk');
var archivedCaches = 0;
for (let i=0; i loaded) {
if ($('tr')[loaded-1].children[2] && $('tr')[loaded-1].children[2].innerHTML.match(/(\S+)/)) var lastLog = loaded-1;
else if ($('tr')[loaded-2].children[2] && $('tr')[loaded-2].children[2].innerHTML.match(/(\S+)/)) var lastLog = loaded-2;
else var lastLog = "";
if (lastLog != "") var dateLastLog = ". Last date is " + $('tr')[lastLog].children[2].innerHTML.replace(/\s/g, "");
else var dateLastLog = "";
result.innerHTML = result.innerHTML + " (Only " + loaded + " logs loaded" + dateLastLog + ".)";
}
}
// Do not break the "View log" column.
$('table.Table tr').find('td:last').css('white-space', 'nowrap');
} catch(e) {gclh_error("Stopped logs loading",e);}
}
}
// Add selectable month and year in calendar of cache and trackable logs.
function onChangeCalendarSelect(event) {
const selectedYear = $("#selectYearEl").val();
const selectedMonth = $("#selectMonthEl").val();
const ONE_DAY = 1000 * 60 * 60 * 24;
const GC_ERA_MS = new Date(2000, 0, 2).getTime();
const selectedDate = new Date(selectedYear, selectedMonth, 1);
const difference_ms = Math.abs(selectedDate.getTime() - GC_ERA_MS);
const daysFromGCEra = Math.round(difference_ms/ONE_DAY) + 1;
__doPostBack('ctl00$ContentBody$MyCalendar', 'V'+daysFromGCEra);
}
function appendOptionalEl(selectEl, value, text, isSelected) {
const optEl = document.createElement("option");
optEl.setAttribute("value", value);
if (isSelected) optEl.setAttribute("selected", "selected");
const textNode = document.createTextNode(text);
optEl.appendChild(textNode);
selectEl.appendChild(optEl);
}
if (document.location.href.match(/\.com\/my\/geocaches\.aspx/) || document.location.href.match(/\.com\/my\/travelbugs\.aspx/)) {
try {
const selectYearEl = document.createElement("select");
selectYearEl.id = 'selectYearEl';
selectYearEl.onchange = onChangeCalendarSelect;
const selectMonthEl = document.createElement("select");
selectMonthEl.id = 'selectMonthEl';
selectMonthEl.onchange = onChangeCalendarSelect;
var calendarHeaderElements = $("#ctl00_ContentBody_MyCalendar").find("tbody tr:first td table tbody tr td:nth-child(2)");
if (calendarHeaderElements.length > 0) {
var selectedCalendar = calendarHeaderElements.text().split(" ");
var CURRENT_YEAR = selectedCalendar[0];
var CURRENT_MONTH = selectedCalendar[1];
calendarHeaderElements.empty();
calendarHeaderElements.append(selectYearEl);
calendarHeaderElements.append(document.createTextNode(" "));
calendarHeaderElements.append(selectMonthEl);
const LAST_YEAR = new Date().getFullYear();
for (var year = 2000; year <= LAST_YEAR; year++) {
appendOptionalEl(selectYearEl, year, year, (year == CURRENT_YEAR));
}
for (var month = 0; month < 12; month++) {
var objDate = new Date();
objDate.setMonth(month);
var locale = "en-us";
var monthText = objDate.toLocaleString(locale, { month: "long" });
appendOptionalEl(selectMonthEl, month, monthText, (monthText == CURRENT_MONTH));
}
}
appendCssStyle('select {color: #594a42;}');
} catch(e) {gclh_error("Add selectable month and year in calendar",e);}
}
// Show warning for not available images.
if (settings_img_warning && is_page("cache_listing")) {
try {
// Images in listing.
function checkImage(element, newUrl, oldUrl) {
if (!element.src) return;
var img = new Image();
img.onerror =
function(){
var hlp = element.title + '\n\n';
element.title = hlp.trim() + element.src;
element.src = newUrl;
element.ondblclick =
function(){
alert('Original image URL:\n\n' + oldUrl);
};
};
img.src = element.src;
}
// Background image.
function checkBGImage(element, newUrl) {
var img = new Image();
if (element.background.length == 0) return;
img.onerror =
function(){
element.background = newUrl;
};
img.src = element.background;
}
// Check images in listing.
var a = $('#ctl00_ContentBody_ShortDescription img, #ctl00_ContentBody_LongDescription img');
for (var i = 0; i < a.length; i++) {
checkImage(a[i], urlImagesSvg+'image_not_available.svg', a[i].src);
}
// Check background image.
var a = $('body');
for (var i = 0; i < a.length; i++) {
checkBGImage(a[i], urlImagesSvg+'image_not_available_background.svg');
}
} catch(e) {gclh_error("Show warning for not available images",e);}
}
// Save home coords.
if (document.location.href.match(/\.com\/account\/settings\/homelocation/)) {
try {
function saveHomeCoordsWait(waitCount) {
if ($('#Query')[0] && $('#map-canvas')[0]) {
// Handle current home coords.
saveHomeCoords();
// Handle changed home coords.
var observerBody = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
saveHomeCoords();
});
});
var target = document.querySelector('#map-canvas');
var config = { attributes: true, subtree: true };
observerBody.observe(target, config);
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){saveHomeCoordsWait(waitCount);}, 100);}
}
saveHomeCoordsWait(0);
} catch(e) {gclh_error('Save home coords',e);}
}
function saveHomeCoords() {
var link = $('#Query')[0];
if (link) {
var latlng = toDec(link.value);
if (latlng) {
if (getValue('home_lat', 0) != parseInt(latlng[0] * 10000000) || getValue('home_lng', 0) != parseInt(latlng[1] * 10000000)) {
// Save home coords.
setValue('home_lat', parseInt(latlng[0] * 10000000));
setValue('home_lng', parseInt(latlng[1] * 10000000));
// Set home coords in config, if opened.
if ($('#settings_home_lat_lng')[0]) {
$('#settings_home_lat_lng')[0].value = DectoDeg(getValue("home_lat"), getValue("home_lng"));
}
// Set home coords in links of linklist.
setSpecialLinks();
}
}
}
}
// Save uid of own trackables from old dashboard.
if (is_page("profile")) {
try {
var link = $('a[href*="/track/search.aspx?o=1&uid="]')[0];
if (link) {
var uid = link.href.match(/\/track\/search\.aspx\?o=1\&uid=(.*)/);
if (uid && uid[1]) {
if (getValue("uid", "") != uid[1]) setValue("uid", uid[1]);
}
}
} catch(e) {gclh_error("Save uid of own trackable",e);}
}
// Add links to finds and hides on new profilpage.
if (is_page("publicProfile") && $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(1)')[0] && $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(2)')[0]) {
try {
$('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(1)')[0].innerHTML = '' + $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(1)')[0].innerHTML + '';
$('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(2)')[0].innerHTML = '' + $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(2)')[0].innerHTML + '';
function deleteSpaceBeforeCounts(waitCount) {
if ($('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(1)')[0].innerHTML.match(/\s/)) $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(1)')[0].innerHTML = $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(1)')[0].innerHTML.replace(/\s/, '');
if ($('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(2)')[0].innerHTML.match(/>\s/)) $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(2)')[0].innerHTML = $('#ctl00_ProfileHead_ProfileHeader_divStats ul > li:nth-child(2)')[0].innerHTML.replace(/>\s/, '>');
waitCount++;
if (waitCount <= 50) setTimeout(function(){deleteSpaceBeforeCounts(waitCount);}, 100);
}
deleteSpaceBeforeCounts(0);
appendCssStyle('#ctl00_ProfileHead_ProfileHeader_divStats a:hover {color: #02874d;} #ctl00_ProfileHead_ProfileHeader_divStats a {color: #4a4a4a;} #ctl00_ProfileHead_ProfileHeader_divStats img {vertical-align: text-top;}');
} catch(e) {gclh_error("Add links to finds and hides on new profilpage",e);}
}
// Change new links to found/hide caches to the old link on profile page.
if (settings_profile_old_links && is_page("publicProfile") && document.location.search.match(/tab=geocaches/)) {
// All founds.
if ($('.finds-col-header .minorDetails a')[0]) $('.finds-col-header .minorDetails a')[0].href = '/seek/nearest.aspx?ul='+urlencode($('#ctl00_ProfileHead_ProfileHeader_lblMemberName')[0].innerHTML);
// All hides.
if ($('.hides-col-header .minorDetails a')[0]) $('.hides-col-header .minorDetails a')[0].href = '/seek/nearest.aspx?u='+urlencode($('#ctl00_ProfileHead_ProfileHeader_lblMemberName')[0].innerHTML);
$('.finds-col table tbody tr a, .hides-col table tbody tr a').each(function() {
let match = /\/play\/results\?ct=(\d+).*&(fb|hb)=.*/gi.exec(this.href);
if (match) {
let [_full, type, foundOrHide] = match;
foundOrHide = foundOrHide == 'fb' ? 'ul' : 'u';
this.href =
`/seek/nearest.aspx?${foundOrHide}=` +
urlencode($('#ctl00_ProfileHead_ProfileHeader_lblMemberName')[0].innerHTML) +
getCacheTx(type);
}
});
}
// Hide GC Avatar Option.
if (settings_load_logs_with_gclh && document.location.href.match(/\.com\/account\/settings\/preferences/) && $('#ShowAvatarsInCacheLogs')[0]) {
try {
var check = $('#ShowAvatarsInCacheLogs')[0];
check.checked = !settings_hide_avatar;
check.disabled = true;
var head = check.parentNode;
head.style.cursor = "unset";
head.style.opacity = "0.5";
var link = document.createElement("a");
link.setAttribute("href", "/my/default.aspx#GClhShowConfig#a#settings_hide_avatar");
link.appendChild(document.createTextNode("here"));
var hinweis = document.createElement("span");
hinweis.setAttribute("class", "label");
hinweis.appendChild(document.createTextNode("You are using GC little helper II - you have to change this option "));
hinweis.appendChild(link);
hinweis.appendChild(document.createTextNode("."));
head.appendChild(hinweis);
var units = $("#DistanceUnits:checked").val();
if (units != settings_distance_units) {
setValue('settings_distance_units', units);
settings_distance_units = units;
}
} catch(e) {gclh_error("Hide GC Avatar Option",e);}
}
// Aufbau Links zum Aufruf von Config, Sync und Find Player (2. Schritt). Und Changelog im Profile.
try {
// (1. Schritt: Siehe function buildSpecialLinklistLinks.)
// GClh Config, Sync und Find Player Aufrufe mit Zusatz #GClhShowConfig bzw. #GClhShowSync bzw. #GClhShowFindPlayer.
// 2. Schritt derzeit im Link bei Settings, Preferences Avatar, teils in den Links aus der Linklist, mit rechter Maustaste aus Links neben
// Avatar auf Profile Seite und teils F4 bei Aufruf Config.
if (document.location.href.match(/#GClhShowConfig/)) {
document.location.href = clearUrlAppendix(document.location.href, true);
setTimeout(gclh_showConfig, 5);
}
if (document.location.href.match(/#GClhShowSync/)) {
document.location.href = clearUrlAppendix(document.location.href, true);
setTimeout(gclh_showSync, 5);
}
if (document.location.href.match(/#GClhShowFindPlayer/)) {
document.location.href = clearUrlAppendix(document.location.href, true);
setTimeout(createFindPlayerForm, 5);
}
// Old Dashboard (Profile). (Hier sind noch Teile vom new dashboard mit drin, das stört aber nicht.)
if (is_page('profile') && $('#ctl00_ContentBody_WidgetMiniProfile1_memberProfileLink')[0]) {
// Config, Sync und Changelog Links beim Avatar in Profile, Dashboard.
var lnk_config = "GClh II Config";
var lnk_sync = " | GClh II Sync";
var lnk_changelog = " | Changelog";
if (is_page('profile')) $('#ctl00_ContentBody_WidgetMiniProfile1_memberProfileLink')[0].parentNode.innerHTML += " | " + lnk_config + lnk_sync + lnk_changelog;
else $('.bio-meta')[0].innerHTML += '' + lnk_config + lnk_sync + lnk_changelog + '';
appendCssStyle(".bio-meta {font-size: 12px;}");
$('#gclh_config_lnk')[0].addEventListener('click', gclh_showConfig, false);
$('#gclh_sync_lnk')[0].addEventListener('click', gclh_showSync, false);
// Linklist Ablistung rechts im Profile.
if (document.getElementsByName("lnk_gclhconfig_profile")[0]) {
document.getElementsByName("lnk_gclhconfig_profile")[0].href = "#GClhShowConfig";
document.getElementsByName("lnk_gclhconfig_profile")[0].addEventListener('click', gclh_showConfig, false);
}
if (document.getElementsByName("lnk_gclhsync_profile")[0]) {
document.getElementsByName("lnk_gclhsync_profile")[0].href = "#GClhShowSync";
document.getElementsByName("lnk_gclhsync_profile")[0].addEventListener('click', gclh_showSync, false);
}
if (document.getElementsByName("lnk_findplayer_profile")[0]) {
document.getElementsByName("lnk_findplayer_profile")[0].href = "#GClhShowFindPlayer";
document.getElementsByName("lnk_findplayer_profile")[0].addEventListener('click', createFindPlayerForm, false);
}
}
// New dashboard: Config, Sync and Changelog Links.
if (is_page("dashboard")) {
function waitForLeftSidebarForGClhLinks(waitCount) {
if ($('#user-bio-root ul li')[0]) {
var lnk_config = "GClh II Config";
var lnk_sync = " | GClh II Sync";
var lnk_changelog = " | Changelog";
var custIcon = "";
var row = '
' + custIcon + '
' + lnk_config + lnk_sync + lnk_changelog + '
';
if ($('#user-bio-root ul li a[id="s2cg_open_sendList"]')[0]) {
$($('#user-bio-root ul li a[id="s2cg_open_sendList"]')[0].closest('li')).before(row);
} else {
$('#user-bio-root ul').append('
' + custIcon + '
' + lnk_config + lnk_sync + lnk_changelog + '
');
}
$('#gclh_config_lnk')[0].addEventListener('click', gclh_showConfig, false);
$('#gclh_sync_lnk')[0].addEventListener('click', gclh_showSync, false);
} else {waitCount++; if (waitCount <= 200) setTimeout(function(){waitForLeftSidebarForGClhLinks(waitCount);}, 50);}
}
waitForLeftSidebarForGClhLinks(0);
}
} catch(e) {gclh_error("Aufbau Links zum Aufruf von Config, Sync und Find Player (2. Schritt)",e);}
// Build link to config and sync in script manager menue.
try {
function configFromMenuCommand() {
if (checkTaskAllowed('Config', false) == true) gclh_showConfig();
else document.location.href = defaultConfigLink;
}
function syncFromMenuCommand() {
if (checkTaskAllowed('Sync', false) == true) gclh_showSync();
else document.location.href = defaultSyncLink;
}
if (settings_call_config_via_sriptmanager) GM_registerMenuCommand('configure', configFromMenuCommand);
if (settings_call_sync_via_sriptmanager) GM_registerMenuCommand('synchronize', syncFromMenuCommand);
} catch(e) {} // Ignore error.
// Eingaben im Search Field verarbeiten.
if (document.location.href.match(/\.com\/seek\/nearest\.aspx\?navi_search=/)) {
try {
var matches = document.location.href.match(/\?navi_search=(.*)/);
if (matches && matches[1]) {
$('#OriginText')[0].value = urldecode(matches[1]).replace(/%20/g, " ");
function clickSearch() {$('#btnLocale')[0].click();}
window.addEventListener("load", clickSearch, false);
}
} catch(e) {gclh_error("Eingaben im Search Field verarbeiten",e);}
}
// Append '&visitcount=1' to all geochecker.com links.
if (settings_visitCount_geocheckerCom && is_page("cache_listing")) {
try {
$('#ctl00_ContentBody_LongDescription a[href^="https://www.geochecker.com/index.php?code="]').filter(':not([href*="visitcount=1"])').attr('href', function(i, str) {
return str + '&visitcount=1';
}).attr('rel', 'noreferrer');
} catch(e) {gclh_error("Append '&visitcount=1' to all geochecker.com links",e);}
}
// Auto check checkbox on hide cache process.
if (settings_hide_cache_approvals && document.location.href.match(/\.com\/hide\/(report|description|edit)\.aspx/)) {
try {
$("#ctl00_ContentBody_cbAgreement").prop('checked', true);
$("#ctl00_ContentBody_chkUnderstand").prop('checked', true);
$("#ctl00_ContentBody_chkDisclaimer").prop('checked', true);
$("#ctl00_ContentBody_chkAgree").prop('checked', true);
} catch(e) {gclh_error("Auto check checkbox on hide cache process",e);}
}
// Show length of hint, cachename and placed by on hide edit page.
if (document.location.href.match(/\.com\/hide\/(report|description|edit)\.aspx/)) {
try {
var name = ($('#tbNickname')[0] ? $('#tbNickname')[0] : $('#ctl00_ContentBody_tbGeocacheName')[0]);
var placedBy = ($('#tbPlacedBy')[0] ? $('#tbPlacedBy')[0] : $('#ctl00_ContentBody_tbPlacedBy')[0]);
var hint = ($('#tbHints')[0] ? $('#tbHints')[0] : $('#tbHint')[0])
createCounterElement('nameCounter', name);
createCounterElement('placedByCounter', placedBy);
createCounterElement('hintCounter', hint);
var css = '#nameCounter, #placedByCounter, #hintCounter {text-align: right;}';
css += '#nameCounter, #placedByCounter {width: 400px;}';
appendCssStyle(css);
} catch(e) {gclh_error("Show length of hint, cachename and placed by on hide edit page",e);}
}
// Improve Souvenirs.
if ( is_page("souvenirs") || is_page("publicProfile") ) {
try {
var css = '';
css += '.gclhShow {margin-right: 4px;}';
css += '.gclhShow input {background-image: inherit;}';
css += '.gclhShow input.active {background-color: #a9a9a9cf;}';
css += '.gclhShow input:hover {cursor: pointer; background-color: aliceblue;}';
css += '.gclhShowCountry:not(.active), .gclhShowState:not(.active), .gclhShowOther:not(.active) {display: none;}';
css += '.ProfileSouvenirsList div {margin-left: 0 !important;}';
css += '.souvenir-gallery-list li {width: 175px !important;}';
// Display "Sort by" selection in full width.
css += '#sortSouvenirsSelect {padding-right: 34px !important;}';
appendCssStyle(css);
var Souvenirs = $("#souvenirsList li");
var htmlFragment = " ("+Souvenirs.length+")";
$("#divContentMain > h2").append(htmlFragment); // private profile
$("#ctl00_ContentBody_ProfilePanel1_pnlSouvenirs > h3").append(htmlFragment); // new public profile
function checkSouvenirsDashboard(waitCount) {
var SouvenirsDashboard = $("#souvenirsControlsContainer .sort-select-group");
if (SouvenirsDashboard.length) {
function correctSouvenirName(name) {
name = name.replace(/(^\s|\s$)/g,'');
if (name == 'Åland Islands') name = 'Aland Islands';
if (name == 'Česká Republika') name = 'Czechia';
if (name == 'China (中国)') name = 'China';
if (name == 'Commonwealth of the Bahamas') name = 'Bahamas';
if (name == 'Deutschland') name = 'Germany';
if (name == 'Montenegro | Црна Гора | Crna Gora') name = 'Montenegro';
if (name == 'România') name = 'Romania';
if (name == 'Rzeczpospolita Polska') name = 'Poland';
if (name == 'Singapore (Republik Singapura)') name = 'Singapore';
if (name == 'Slovenská republika') name = 'Slovakia';
if (name == 'United States of America') name = 'United States';
if (name == 'Yukon') name = 'Yukon Territory';
return name;
}
function prepareSouvenirs() {
$('#souvenirsList li').each(function() {
var ident = '';
var name = $(this).find('a:first')[0].title;
if (name) {
name = correctSouvenirName(name);
var country = $.grep(country_id, function(e){return e.n == name;});
if (country && country[0]) {
ident = 'gclhShowCountry';
} else {
var name = name.replace(/\sstate$/i,'');
var state = $.grep(states_id, function(e){return e.n == name;});
if (state && state[0]) {
ident = 'gclhShowState';
} else {
ident = 'gclhShowOther';
}
}
$(this).addClass(ident+' active');
}
});
$('.gclhShow input').each(function() {
$(this)[0].disabled = "";
$(this)[0].style.opacity = "1";
});
}
function showSouvenirs(button) {
if ($(button).hasClass('active')) {
$(button).removeClass('active');
$('#souvenirsList li.'+$(button)[0].id).each(function() {$(this).removeClass('active');});
} else {
$(button).addClass('active');
$('#souvenirsList li.'+$(button)[0].id).each(function() {$(this).addClass('active');});
}
var nr = $('#souvenirsList .active').length;
if (nr == Souvenirs.length) $('#gclhNumberSouvenirs')[0].innerHTML = '(' + Souvenirs.length + ')';
else $('#gclhNumberSouvenirs')[0].innerHTML = '(' + nr + '/' + Souvenirs.length + ')';
}
SouvenirsDashboard.append(' | Show ');
SouvenirsDashboard.append('');
SouvenirsDashboard.append('');
prepareSouvenirs();
$("#gclhShowCountry").click(function() {showSouvenirs(this);});
$("#gclhShowState").click(function() {showSouvenirs(this);});
$("#gclhShowOther").click(function() {showSouvenirs(this);});
} else {waitCount++; if (waitCount <= 25) setTimeout(function(){checkSouvenirsDashboard(waitCount);}, 200);}
}
checkSouvenirsDashboard(0);
} catch(e) {gclh_error("Improve Souvenirs",e);}
}
// Show smaller privacy buttons - has to run after Souveniers.
if (settings_public_profile_smaller_privacy_btn && isOwnPublicProfile()) {
try {
let url = document.location.href;
if (url.match(/tab=geocaches/i)) {
if (!$('#ctl00_ContentBody_ProfilePanel1_geocachesPrivacyIcon')[0]) return;
let link = $('#full-privacy-text a').attr('href');
let icon = $('#ctl00_ContentBody_ProfilePanel1_geocachesPrivacyIcon').attr('src');
$('#ctl00_ContentBody_ProfilePanel1_geocachesOwnerViewSettings').hide();
$('.finds-col-header h3').append(` `);
$('.finds-col-header .minorDetails').html(' '+$('.finds-col-header .minorDetails').html());
$('#ctl00_ContentBody_ProfilePanel1_geocachesHideOwnerViewSettings').hide();
$('.hides-col-header h3').append(` `);
$('.hides-col-header .minorDetails').html(' '+$('.hides-col-header .minorDetails').html());
} else if (url.match(/tab=trackables/i)) {
if (!$('#ctl00_ContentBody_ProfilePanel1_trackablesOwnerViewSettings')[0]) return;
let link = $('#ctl00_ContentBody_ProfilePanel1_trackablesOwnerViewSettings a').attr('href');
$('#ctl00_ContentBody_ProfilePanel1_trackablesOwnerViewSettings').hide();
$('h3').append(` `);
} else if (url.match(/tab=souvenirs/i)) {
if (!$('#ctl00_ContentBody_ProfilePanel1_souvenirsPrivacyIcon')[0]) return;
let link = $('#ctl00_ContentBody_ProfilePanel1_souvenirsOwnerViewSettings a').attr('href');
let icon = $('#ctl00_ContentBody_ProfilePanel1_souvenirsPrivacyIcon').attr('src');
$('#ctl00_ContentBody_ProfilePanel1_souvenirsOwnerViewSettings').hide();
$('h3').append(` `);
} else if (url.match(/tab=gallery/i)) {
if (!$('#ctl00_ContentBody_ProfilePanel1_galleryPrivacyIcon')[0]) return;
let link = $('#ctl00_ContentBody_ProfilePanel1_galleryOwnerViewSettings a').attr('href');
let icon = $('#ctl00_ContentBody_ProfilePanel1_galleryPrivacyIcon').attr('src');
$('#ctl00_ContentBody_ProfilePanel1_galleryOwnerViewSettings').hide();
$('h3').append(` `);
} else if (url.match(/tab=stats/i)) {
if (!$('#ctl00_ContentBody_ProfilePanel1_statisticsPrivacyIcon')[0]) return;
let link = $('#ctl00_ContentBody_ProfilePanel1_statisticsOwnerViewSettings a').attr('href');
let icon = $('#ctl00_ContentBody_ProfilePanel1_statisticsPrivacyIcon').attr('src');
$('#ctl00_ContentBody_ProfilePanel1_statisticsOwnerViewSettings').hide();
$('h3').first().append(` `);
} else if (!url.match(/tab=lists/i)) { // Profilinformationen
if (!$('#ctl00_ContentBody_ProfilePanel1_profilePrivacyIcon')[0]) return;
let link = $('#ctl00_ContentBody_ProfilePanel1_profileOwnerViewSettings a').attr('href');
let icon = $('#ctl00_ContentBody_ProfilePanel1_profilePrivacyIcon').attr('src');
$('#ctl00_ContentBody_ProfilePanel1_profileOwnerViewSettings').hide();
$('h3').append(` `);
}
let css = 'h3 {display:flex;}';
css += '.gclh_privacy {display: inline-flex;}';
css += '.gclh_privacy img {align-self: end;}';
css += '.minorDetails {align-self: center; padding-top: 4px;}';
appendCssStyle(css);
} catch(e) {gclh_error("Replace privacy text links by icon link",e);}
}
// Improve view log and edit log page.
if (document.location.href.match(/\.com\/(seek|track)\/log\.aspx\?/)) {
// Improve alignment of icons.
appendCssStyle('.logPanel h3 img {vertical-align: baseline;}');
}
// Improve trackable search page.
if (document.location.href.match(/\.com\/track\/travelbug\.aspx/)) {
try {
function waitForTrackablePage(waitCount) {
if ($('#ctl00_ContentBody_txtTBCode')[0] && $('#ctl00_ContentBody_btnTBLookup')[0]) {
// Place the cursor directly in the input field with the start of the page.
$('#ctl00_ContentBody_txtTBCode')[0].focus();
// Enable the search to be started by pressing the Enter key.
$('#ctl00_ContentBody_txtTBCode')[0].addEventListener("keyup", searchTrackable, false);
function searchTrackable(e) {
if (e.type == 'keyup' && e.keyCode == 13 && noSpecialKey(e) == true) {
$('#ctl00_ContentBody_btnTBLookup')[0].click();
}
}
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForTrackablePage(waitCount);}, 100);}
}
waitForTrackablePage(0);
} catch(e) {gclh_error("Improve trackable search page",e);}
}
// Improve notification list and notifications.
if (document.location.href.match(/\.com\/notify\/(default|edit)\.aspx/) && settings_improve_notifications) {
try {
function disableAllFieldsNotif() {
$('input,select').each(function(){
$(this)[0].setAttribute('disabled', '');
$(this)[0].style.opacity = '0.5';
});
}
function enableAllFieldsNotif(all) {
$('input,select').each(function(){
$(this)[0].removeAttribute('disabled', '');
if (all) $(this)[0].style.opacity = '1';
});
}
function setValueNotif(c, sel) {
if ($(c).find(sel)[0] && $(c).find(sel)[0].value != $(sel)[0].value) {
$(sel)[0].value = $(c).find(sel)[0].value;
}
}
function setSelectOptionNotif(c, sel) {
if ($(c).find(sel)[0] && $(c).find(sel)[0].selectedIndex != $(sel)[0].selectedIndex) {
$(sel+' option')[$(c).find(sel)[0].selectedIndex].selected = true;
}
}
function successMessageNotif(mess) {
$('#ctl00_ContentBody_divPremiumMemberText').before('
' + mess + '
');
}
function prepareCopyNotif(nid) {
disableAllFieldsNotif();
$.get('https://www.geocaching.com/notify/edit.aspx?NID=' + nid, null, function(c){
// First call of the page.
if (document.location.href.match(/#first/)) {
// Set notification name to 10 blanks, so we can recognize the second call of the page.
$('#ctl00_ContentBody_LogNotify_tbName')[0].value = ' ';
// Select cachetype and trigger a reload of the page.
if ($('#ctl00_ContentBody_LogNotify_ddTypeList')[0].selectedIndex == 0) {
setSelectOptionNotif(c, '#ctl00_ContentBody_LogNotify_ddTypeList');
enableAllFieldsNotif();
$("#ctl00_ContentBody_LogNotify_ddTypeList").trigger("change");
}
} else {
// Set the log type fields.
$('#ctl00_ContentBody_LogNotify_cblLogTypeList input').each(function(){
$(this)[0].removeAttribute('checked');
});
$(c).find('#ctl00_ContentBody_LogNotify_cblLogTypeList input[checked="checked"]').each(function(){
if ($(this)[0].value && $('#ctl00_ContentBody_LogNotify_cblLogTypeList input[value="'+$(this)[0].value+'"]')[0]) {
$('#ctl00_ContentBody_LogNotify_cblLogTypeList input[value="'+$(this)[0].value+'"]')[0].checked = 'checked';
}
});
// Second call of the page where all fields are copied.
if ($('#ctl00_ContentBody_LogNotify_tbName')[0].value == ' ') {
setValueNotif(c, '#ctl00_ContentBody_LogNotify_tbName');
setSelectOptionNotif(c, '#ctl00_ContentBody_LogNotify_LatLong\\:_selectNorthSouth');
setSelectOptionNotif(c, '#ctl00_ContentBody_LogNotify_LatLong\\:_selectEastWest');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_LatLong__inputLatDegs');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_LatLong__inputLatMins');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_LatLong__inputLatSecs');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_LatLong__inputLongDegs');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_LatLong__inputLongMins');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_LatLong__inputLongSecs');
setValueNotif(c, '#ctl00_ContentBody_LogNotify_tbDistance');
setSelectOptionNotif(c, '#ctl00_ContentBody_LogNotify_ddlAltEmails');
successMessageNotif('Input fields copied.');
} else {
successMessageNotif('Log type fields copied.');
}
enableAllFieldsNotif(true);
processCoordsNotif(first = true, e = false, field = false);
}
});
}
function getCoordsFromFieldsNotif(data) {
var coords = '';
var sel = '#ctl00_ContentBody_LogNotify_LatLong\\:_selectNorthSouth';
coords += $(data).find(sel+' option')[$(data).find(sel)[0].selectedIndex].innerHTML;
coords += $(data).find('#ctl00_ContentBody_LogNotify_LatLong__inputLatDegs')[0].value + ' ';
coords += $(data).find('#ctl00_ContentBody_LogNotify_LatLong__inputLatMins')[0].value + ' ';
var sel = '#ctl00_ContentBody_LogNotify_LatLong\\:_selectEastWest';
coords += $(data).find(sel+' option')[$(data).find(sel)[0].selectedIndex].innerHTML;
coords += $(data).find('#ctl00_ContentBody_LogNotify_LatLong__inputLongDegs')[0].value + ' ';
coords += $(data).find('#ctl00_ContentBody_LogNotify_LatLong__inputLongMins')[0].value;
return coords;
}
function setCoordsToFieldsNotif(NS, LatD, LatM, EW, LongD, LongM) {
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectNorthSouth option[value="' + (NS == 'N' ? '1':'-1') + '"]').attr('selected', true);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatDegs').val(LatD);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatDegs').trigger("change");
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatMins').val(LatM);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatMins').trigger("change");
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectEastWest option[value="' + (EW == 'E' ? '1':'-1') + '"]').attr('selected', true);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongDegs').val(LongD);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongDegs').trigger("change");
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongMins').val(LongM);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongMins').trigger("change");
}
function processCoordsNotif(first, e, field) {
setTimeout(function() {
if (first || (e && (e.type == 'focusout' || e.type == 'change' || e.type == 'keydown' && e.keyCode == 13))) {
// Set coords from standard fields to new field.
if (first || field.id != 'gclh_degs_value') {
if (window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__requiredLatDeg')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__validatorLatDegs')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__requiredLatMins')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__validatorLatMins')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__requiredLongDeg')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__validatorLongDegs')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__requiredLongMins')[0]).display != 'none' || window.getComputedStyle($('#ctl00_ContentBody_LogNotify_LatLong__validatorLongMins')[0]).display != 'none') {
$('#gclh_degs span')[0].innerHTML = 'The coordinates entered above are incorrect. Fields are marked.';
} else {
var coords = getCoordsFromFieldsNotif($('table.LatLongTable tbody')[0]);
if (!coords || coords == 'N E ') $('#gclh_degs_value')[0].value = '';
else $('#gclh_degs_value')[0].value = coords;
$('#gclh_degs span')[0].innerHTML = '';
}
// Set coords from new field to standard fields.
} else {
setCoordsToFieldsNotif('N', '', '', 'W', '', '');
$('#gclh_degs span')[0].innerHTML = '';
var m = $('#gclh_degs_value')[0].value.match(/^\s*(N|n|S|s)\s*(\d{1,3})(\s*°\s*|\s+)(\d{1,2}[\.,;]?\d{0,3})(\s*['`´]\s*|\s+)(E|e|W|w)\s*(\d{1,3})(\s*°\s*|\s+)(\d{1,2}[\.,;]?\d{0,3})(\s*['`´]\s*|\s*)$/);
if (m && m.length == 11) {
setCoordsToFieldsNotif(m[1].replace('n','N').replace('s','S'), m[2], m[4].replace(/(,|;)/,'.'), m[6].replace('e','E').replace('w','W'), m[7], m[9].replace(/(,|;)/,'.'));
} else if ($('#gclh_degs_value')[0].value != '') {
$('#gclh_degs span')[0].innerHTML = 'The coordinates entered are incorrect.';
}
}
}
}, 50);
}
function getNIDFromLineListNotif(notif) {
return $(notif).find('td a')[0].id;
}
function expandLinesListNotif() {
$('table.Table tbody tr').each(function(){
let nid = getNIDFromLineListNotif(this);
var item = $(this);
$(item).find('td.gclh_icons').before('
');
$.get('https://www.geocaching.com/notify/edit.aspx?NID=' + nid, null, function(c){
var coords = getCoordsFromFieldsNotif(c);
$(item).find('.gclh_coords')[0].innerHTML = coords;
$(item).find('.gclh_dist')[0].innerHTML = $(c).find('#ctl00_ContentBody_LogNotify_tbDistance')[0].value;
$(item).find('.gclh_mail')[0].innerHTML = $(c).find('#ctl00_ContentBody_LogNotify_ddlAltEmails')[0]?.value || $(c).find('a[href="/account/settings/emailpreferences"]').parent().prev('dd').html().trim();
$(item).find('.gclh_mail').addClass('gclh_add_last');
});
});
}
function setTitleCheckboxListNotif(a) {
a.title = (a.children[0].src.match('checkbox_off') ? 'click to enable\n(right click to enable all with same name)' : 'click to disable\n(right click to disable all with same name)');
}
function clickEnableCheckboxListNotif(nid, a) {
if ($(a).closest('tr').hasClass('gclh_disabled')) return;
var img = $(a).find('img')[0];
if (img.src.match('ajax-loader.gif')) return;
img.src = urlImages + 'ajax-loader.gif';
$.get('https://www.geocaching.com/notify/default.aspx?did=' + nid, null, function(c){
img.src = $(c).find('a[href="?did='+nid+'"] img')[0].src;
img.alt = $(c).find('a[href="?did='+nid+'"] img')[0].alt;
setTitleCheckboxListNotif(a);
});
}
function clickEnableCheckboxWithSameNameListNotif(a) {
if ($(a).closest('tr').hasClass('gclh_disabled')) return;
var imgA = $(a).find('img')[0];
if (imgA.src.match('ajax-loader.gif')) return;
var srcA = imgA.src;
var nameA = $(a).closest('tr').find('td:nth-child(3) a strong')[0].innerText;
$('table.Table tbody tr').each(function(){
var nidB = getNIDFromLineListNotif(this);
var cbB = $(this).find('td a')[0];
var srcB = $(cbB).find('img')[0].src;
var nameB = $(cbB).closest('tr').find('td:nth-child(3) a strong')[0].innerText;
if (srcB == srcA && nameB == nameA) clickEnableCheckboxListNotif(nidB, cbB);
});
}
function enableIconAdditionalDataListNotif(waitCount) {
if ($('table.Table tbody tr').length == $('table.Table tbody .gclh_add_last').length) {
$('#gclh_more').removeClass('gclh_working');
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){enableIconAdditionalDataListNotif(waitCount);}, 100);}
}
function sortTableListNotif(table, item, item2) {
var tb = table.tBodies[0];
var tr = Array.prototype.slice.call(tb.rows, 0);
// Set sort class and sort direction.
if (!$(item).hasClass('gclh_sort_cur')) {
$(table).find('.gclh_sort_cur').removeClass('gclh_sort_cur');
$(item).addClass('gclh_sort_cur');
} else if ($(item).hasClass('gclh_sort_asc')) {
$(item).removeClass('gclh_sort_asc');
$(item).addClass('gclh_sort_desc');
} else if ($(item).hasClass('gclh_sort_desc')) {
$(item).removeClass('gclh_sort_desc');
$(item).addClass('gclh_sort_asc');
}
if (!$(item).hasClass('gclh_sort_asc') && !$(item).hasClass('gclh_sort_desc')) {
$(item).addClass('gclh_sort_asc');
}
if ($(item).hasClass('gclh_sort_asc')) var dir = 1;
else var dir = -1;
// Do sort.
tr = tr.sort(function (a, b) {
// First sort criteria.
if ($(item).hasClass('gclh_col_enable')) {
var aa = $(a.cells[item.cellIndex]).find('a img')[0].alt;
var bb = $(b.cells[item.cellIndex]).find('a img')[0].alt;
} else if ($(item).hasClass('gclh_col_icon')) {
var aa = a.cells[item.cellIndex+2].textContent.trim();
var bb = b.cells[item.cellIndex+2].textContent.trim();
} else {
var aa = a.cells[item.cellIndex].textContent.trim();
var bb = b.cells[item.cellIndex].textContent.trim();
}
// Second sort criteria.
if (item2 != '') {
aa += a.cells[item2.cellIndex].textContent.trim();
bb += b.cells[item2.cellIndex].textContent.trim();
}
return dir * (aa .localeCompare(bb));
});
// Set zebra background in lines.
for (i = 0; i < tr.length; i = i+2) {
$(tr[i]).removeClass('AlternatingRow');
if (tr[i+1]) $(tr[i+1]).addClass('AlternatingRow');
}
// Build new table in sorted order.
for(i = 0; i < tr.length; ++i) tb.appendChild(tr[i]);
}
function processAdditionalDataListNotif() {
$('table.Table thead th:last').append('');
$('#gclh_more')[0].addEventListener('click', function() {
if ($('#gclh_more').hasClass('gclh_working')) return;
$('#gclh_more').addClass('gclh_working');
if (!$('table.Table thead th.gclh_add')[0]) {
$('table.Table thead th.gclh_icons').before('
Coordinates
km
Send to
');
$('table .gclh_col_coords')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_name')[0])});
$('table .gclh_col_dist')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_name')[0])});
$('table .gclh_col_mail')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_name')[0])});
expandLinesListNotif();
}
enableIconAdditionalDataListNotif(0);
if ($('#gclh_more').hasClass('gclh_icon_rotate_top')) {
$('#gclh_more')[0].title = 'Hide additional data';
$('table.Table').removeClass('gclh_hide_add');
$('#gclh_more').removeClass('gclh_icon_rotate_top');
} else {
$('#gclh_more')[0].title = 'Show additional data';
$('table.Table').addClass('gclh_hide_add');
$('#gclh_more').addClass('gclh_icon_rotate_top');
}
}, false);
}
function processHidePageInfoListNotif() {
$('table.Table thead th:last').append('');
$('.BreadcrumbWidget, #divContentMain h2, #ctl00_ContentBody_divPremiumMemberText').addClass('gclh_info');
$('p img[src="/images/icons/16/checkbox_on.png"]').closest('p').addClass('gclh_info');
$('#gclh_info')[0].addEventListener('click', function() {
if ($('#gclh_info').hasClass('gclh_icon_rotate_top')) {
$('#gclh_info')[0].title = 'Hide page info';
$('#divContentMain').removeClass('gclh_hide_info');
$('#gclh_info').removeClass('gclh_icon_rotate_top');
setValue('set_switch_notification_show_page_info', true);
} else {
$('#gclh_info')[0].title = 'Show page info';
$('#divContentMain').addClass('gclh_hide_info');
$('#gclh_info').addClass('gclh_icon_rotate_top');
setValue('set_switch_notification_show_page_info', false);
}
}, false);
if (!getValue('set_switch_notification_show_page_info', true)) $('#gclh_info')[0].click();
}
function getObjectsFromLineListNotif(line) {
let notif = $(line).closest('tr');
let nid = getNIDFromLineListNotif(notif);
let delIcon = $(notif).find('a.gclh_delete');
let workIcon = $(notif).find('span.gclh_work');
let undoIcon = $(notif).find('a.gclh_undo');
return [notif, nid, delIcon, workIcon, undoIcon];
}
function deactivateLinksInLineListNotif(notif) {
notif.addClass('gclh_disabled');
$(notif).find('a:not(.gclh_delete, .gclh_undo)').each(function(){
$(this)[0].setAttribute('save_href', $(this)[0].href);
$(this)[0].href = 'javascript:void(0);';
});
}
function activateLinksInLineListNotif(notif) {
notif.removeClass('gclh_disabled');
$(notif).find('a:not(.gclh_delete, .gclh_undo)').each(function(){
$(this)[0].href = $(this)[0].getAttribute('save_href');
});
}
function openPopupForLineListNotif(nid, name) {
var openPopup = window.open('https://www.geocaching.com/notify/edit.aspx?NID=' + nid + '&' + name, nid, 'width=240, height=100, top=0, left=10000');
// Eigentlich sollte bei einem einzigen Pop up nach einem Klick gar kein Pop up Blocker anspringen. Falls das Pop up nicht geöffnet werden
// kann, sollte aber auf jeden Fall eine Nachricht erfolgen.
if (openPopup == null) {
alert('The pop up could not be opened. A pop up blocker may be running. To use this feature, pop ups must be allowed for this website.');
} else {
return openPopup;
}
}
function checkStatusPopupForLineListNotif(waitCount, openPopup, beforeIcon, afterIcon, notifToActivate) {
if (typeof openPopup !== 'undefined' && openPopup !== false && openPopup.closed) {
beforeIcon.addClass('gclh_hide_icon');
afterIcon.removeClass('gclh_hide_icon');
if (notifToActivate) {
activateLinksInLineListNotif(notifToActivate);
}
} else {setTimeout(function(){checkStatusPopupForLineListNotif(waitCount, openPopup, beforeIcon, afterIcon, notifToActivate);}, 250);}
}
function improveLinesListNotif() {
$('table.Table tbody tr').each(function(){
var nid = $(this).find('a[href*="edit.aspx?NID="]')[0].href.match(/NID=(\d*)/);
if (nid && nid[1]) {
nid = nid[1];
var cellIcons = $(this).find('a[href*="edit.aspx?NID="]').closest('td')[0];
var itemCeckbox = $(this).find('a[href="?did='+nid+'"]')[0];
var itemCachetype = $(this).find('img[src*="/images/WptTypes/sm/"]').closest('td')[0];
var itemName = $(this).find('td:nth-child(3)')[0];
var itemCacheTypeName = $(this).find('td:nth-child(4)')[0];
var itemEdit = $(this).find('a[href*="edit.aspx?NID="]')[0];
// Mark the icons cell.
$(cellIcons).addClass('gclh_icons');
// Handle checkbox for enable a notification.
itemCeckbox.setAttribute('id', nid);
itemCeckbox.setAttribute('href', 'javascript:void(0);');
setTitleCheckboxListNotif(itemCeckbox);
itemCeckbox.addEventListener('click', function() {clickEnableCheckboxListNotif(nid, this);}, false);
itemCeckbox.oncontextmenu = function(){return false;};
$(itemCeckbox).bind('contextmenu.new', function() {clickEnableCheckboxWithSameNameListNotif(this);});
// Replace cache type icon.
var iconNo = itemCachetype.innerHTML.match(/images\/WptTypes\/sm\/(.+)\.gif/);
var icon = '';
if (iconNo && iconNo[1] && iconNo[1].match(/^\d+$/)) icon = iconNo[1];
else if (iconNo[1] == 'earthcache') icon = 137;
else if (iconNo[1] == 'maze') icon = 1304;
if (icon != '') {
itemCachetype.innerHTML = '';
$(itemCachetype).append('');
}
// Build an edit link for Name / Log types.
var name = itemName.innerHTML;
itemName.innerHTML = '';
$(itemName).append('' + name + '');
// Build span tag for cache type name.
var name = itemCacheTypeName.innerHTML;
itemCacheTypeName.innerHTML = '';
$(itemCacheTypeName).append('' + name + '');
// Change edit link to icon.
itemEdit.innerHTML = '';
itemEdit.setAttribute('title', 'Edit notification');
$(itemEdit).addClass('gclh_icon');
$(itemEdit).append('');
$(itemEdit).closest('td')[0].setAttribute('style', 'white-space: nowrap;');
// Build copy icon behind the edit icon.
$(itemEdit).after('');
// Build delete icon, work icon and undo icon behind the edit icon.
var itemDelete = '';
var itemWork = '';
var itemUndo = '';
$(itemEdit).after(itemDelete + itemWork + itemUndo);
$(this).find('.gclh_delete')[0].addEventListener("click", function() {
var [notif, nid, delIcon, workIcon, undoIcon] = getObjectsFromLineListNotif(this);
if (delIcon.hasClass('gclh_hide_icon')) return;
delIcon.addClass('gclh_hide_icon');
workIcon.prop('title', 'Waiting for deletion');
workIcon.removeClass('gclh_hide_icon');
deactivateLinksInLineListNotif(notif);
var openPopup = openPopupForLineListNotif(nid, 'GClhDelete');
checkStatusPopupForLineListNotif(0, openPopup, workIcon, undoIcon);
}, false);
$(this).find('.gclh_undo')[0].addEventListener("click", function() {
var [notif, nid, delIcon, workIcon, undoIcon] = getObjectsFromLineListNotif(this);
if (undoIcon.hasClass('gclh_hide_icon')) return;
undoIcon.addClass('gclh_hide_icon');
workIcon.prop('title', 'Waiting for undo deletion');
workIcon.removeClass('gclh_hide_icon');
var openPopup = openPopupForLineListNotif(nid, 'GClhUndo');
checkStatusPopupForLineListNotif(0, openPopup, workIcon, delIcon, notif);
}, false);
}
});
}
let css = '';
css += 'table.Table thead th {white-space: nowrap}';
css += 'table.Table.gclh_hide_add th.gclh_add, table.Table.gclh_hide_add td.gclh_add {display: none;}';
css += '.gclh_name {color: #4a4a4a !important; text-decoration: none !important;}';
css += '.gclh_disabled td > a:not(.gclh_delete, .gclh_undo), .gclh_disabled td > span:not(.gclh_work), .gclh_disabled td > svg {opacity: 0.4;}';
css += '.gclh_disabled a:not(.gclh_delete, .gclh_undo) {cursor: default;}';
css += '.gclh_hide_icon {display: none;}';
css += '.gclh_icons {width: 80px;}';
css += '.gclh_icon svg, .gclh_icon img {height: 18px; width: 18px; padding: 4px; vertical-align: middle; color: #4a4a4a;}';
css += '.gclh_delete svg {height: 20px; width: 20px; margin-top: 1px;}';
css += '.gclh_undo svg {height: 16px; width: 16px; margin-right: 2px; margin-left: 2px;}';
css += '.gclh_work img {height: 11px; width: 18px; vertical-align: middle; padding-left: 5px; padding-right: 5px;}';
css += '.gclh_icon_add svg {height: 20px; width: 20px; padding: 3px;}';
css += '.gclh_icon_cachetype {height: 24px; width: 24px;}';
css += '.gclh_hide_info .gclh_info {display: none;}';
css += '.gclh_icon_rotate_top svg {transform: rotate(180deg);}';
css += '.gclh_sortable {cursor: pointer;}';
css += '.gclh_sortable span::after {color: #4a4a4a; content: " "; background-image: url(/plan/public/429af344f6d770066f9793d26c2739a7.svg); background-repeat: no-repeat; display: inline-block; visibility: hidden; height: 12px; width: 12px; vertical-align: middle;}';
css += '.gclh_sort_cur span::after {visibility: visible;}';
css += '.gclh_sort_desc span::after {transform: rotate(180deg);}';
css += '#gclh_degs span {position: absolute; margin-left: 4px; margin-top: 3.5px;}';
css += 'table.LatLongTable td {padding-left: 0px;}';
css += '.Checkbox label {top: 0px;}';
css += '.EditNotificationForm table {margin-bottom: 0px;}';
// Improve notification list page.
if (document.location.href.match(/\.com\/notify\/default\.aspx/) && $('table.Table tbody tr')[0]) {
// Build headline for the notification list.
$('table.Table tbody').before('
Name / Log types
Cache type
');
// Build 'create' icon.
$('table.Table thead th:last').append('');
// Process load, hide, show additional data.
processAdditionalDataListNotif();
// Process hide, show page info.
processHidePageInfoListNotif();
// Improve the notification lines.
improveLinesListNotif();
// Build table sort.
$('table .gclh_col_enable')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_name')[0])});
$('table .gclh_col_icon')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_name')[0])});
$('table .gclh_col_name')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_cachetype')[0])});
$('table .gclh_col_cachetype')[0].addEventListener('click', function() {sortTableListNotif($('table.Table')[0], this, $('table .gclh_col_name')[0])});
}
// Improve notification.
if (document.location.href.match(/\.com\/notify\/edit\.aspx/)) {
// Alignment, white space tuning.
$('table.LatLongTable tbody tr td').each(function(){
if (this.innerHTML.match(/^(\s*)$/)) $(this).remove();
});
var sel = 'input[name="ctl00$ContentBody$LogNotify$LatLong:_currentLatLongFormat"]';
if ($(sel)[0] && $(sel)[0].nextSibling && $(sel)[0].nextSibling.data) $(sel)[0].nextSibling.data = ' ';
if ($('#ctl00_ContentBody_LogNotify_cbEnable')[0]) $('#ctl00_ContentBody_LogNotify_cbEnable')[0].parentNode.parentNode.style.marginLeft = '0';
if ($('#ctl00_ContentBody_LogNotify_btnGo')[0]) $('#ctl00_ContentBody_LogNotify_btnGo')[0].parentNode.style.marginLeft = '0';
// Handle coordinates of a notification in one field.
if ($('select[name="ctl00$ContentBody$LogNotify$LatLong"]"')[0].selectedIndex == 1) {
var side = $('table.LatLongTable tbody select[id*="selectEastWest"]')[0].closest('tr');
$(side).after('
Alternative input option:
');
processCoordsNotif(first = true, e = false, field = false);
$('#gclh_degs_value')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#gclh_degs_value')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectNorthSouth')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectNorthSouth')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectNorthSouth')[0].addEventListener('change', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatDegs')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatDegs')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatMins')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLatMins')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectEastWest')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectEastWest')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong\\:_selectEastWest')[0].addEventListener('change', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongDegs')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongDegs')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongMins')[0].addEventListener('focusout', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__inputLongMins')[0].addEventListener('keydown', function(e) {processCoordsNotif(first = false, e, field = this);}, false);
$('#ctl00_ContentBody_LogNotify_LatLong__requiredLatDeg, #ctl00_ContentBody_LogNotify_LatLong__validatorLatDegs, #ctl00_ContentBody_LogNotify_LatLong__requiredLatMins, #ctl00_ContentBody_LogNotify_LatLong__validatorLatMins, #ctl00_ContentBody_LogNotify_LatLong__requiredLongDeg, #ctl00_ContentBody_LogNotify_LatLong__validatorLongDegs, #ctl00_ContentBody_LogNotify_LatLong__requiredLongMins, #ctl00_ContentBody_LogNotify_LatLong__validatorLongMins').addClass('Warning');
}
}
// Get the notification to copy and prepare a copy of the notification.
if (document.location.href.match(/\.com\/notify\/edit\.aspx\?CopyNID=(\d+)/)) {
var nid = document.location.href.match(/\.com\/notify\/edit\.aspx\?CopyNID=(\d+)/);
if (nid && nid[1]) {
prepareCopyNotif(nid[1]);
}
}
// Delete notification via popup. We are here in the popup.
if (document.location.href.match(/\.com\/notify\/edit\.aspx\?NID=(\d+)&GClhDelete/)) {
if ($('#ctl00_ContentBody_LogNotify_btnArchive')[0] && !$('#divContentMain p.Success')[0]) {
$('#ctl00_ContentBody_LogNotify_btnArchive').click();
} else if ($('#divContentMain p.Success')[0]) {
setTimeout(function() {window.close();},10);
}
}
// Undo deletion of notification via popup. We are here in the popup.
if (document.location.href.match(/\.com\/notify\/edit\.aspx\?NID=(\d+)&GClhUndo/)) {
if ($('#ctl00_ContentBody_LogNotify_btnGo')[0] && !$('#divContentMain p.Success')[0]) {
$('#ctl00_ContentBody_LogNotify_btnGo').click();
} else if ($('#divContentMain p.Success')[0]) {
setTimeout(function() {window.close();},10);
}
}
appendCssStyle(css);
} catch(e) {gclh_error("Improve notifications",e);}
}
// Check for update.
try {
function checkForUpdate(manual) {
function manualNegativInfo(newVersionFound) {
if (manual == true && newVersionFound == false) {
alert("Version " + scriptVersion + " of script GC little helper II \nis the latest and actual version.\n");
}
}
var newVersionFound = false;
var next_check = parseInt(getValue("update_next_check"), 10);
if (!next_check) next_check = 0;
var time = new Date().getTime();
if (next_check < time || manual == true) {
time += 1 * 60 * 60 * 1000; // 1 Stunde warten, bis zum nächsten Check.
setValue('update_next_check', time.toString());
if (typeof GM_xmlhttpRequest === 'function') {
// Prüfen der Version in Datei "last_version.txt" im master.
GM_xmlhttpRequest({
method: "GET",
url: urlLastVersion,
onload: function(result) {
try {
var newLastVersion = result.responseText.replace(/\s/g, "");
if (result.status == 200 && newLastVersion && newLastVersion != scriptVersion) {
// Prüfen der Version im Script im master.
// (Zusätzlich notwendig, weil die raw.githubusercontent.com Inhalte zeitverzögert auf GitHub bereitgestellt werden.)
GM_xmlhttpRequest({
method: "GET",
url: urlScript,
onload: function(result) {
try {
var newScriptVersion = result.responseText.match(/\/\/\s\@version(.*)/);
if (result.status == 200 && newScriptVersion && newScriptVersion[1]) {
newScriptVersion = newScriptVersion[1].replace(/\s/g, "");
// Nur weitermachen, wenn die Versionen aus Datei "last_version.txt" und Script vom master identisch sind,
// es sich also nicht um den Fall von zeitverzögerten raw.githubusercontent.com Inhalten handelt.
if (newLastVersion == newScriptVersion) {
newVersionFound = true;
var text = "Version " + newScriptVersion + " of script GC little helper II is available.\n" +
"You are currently using version " + scriptVersion + ".\n\n" +
"Click OK to update.\n\n" +
"(After update, please refresh your page.)";
if (window.confirm(text)) {
btnClose();
document.location.href = urlScript;
} else {
time += 7 * 60 * 60 * 1000; // 1+7 Stunden warten, bis zum nächsten Check.
setValue('update_next_check', time.toString());
}
}
}
manualNegativInfo(newVersionFound);
} catch(e) {gclh_error("Check for update, onload ScriptVersion",e);}
}
});
} else manualNegativInfo(newVersionFound);
} catch(e) {gclh_error("Check for update, onload LastVersion",e);}
}
});
} else manualNegativInfo(newVersionFound);
}
}
checkForUpdate(false);
} catch(e) {gclh_error("Check for update",e);}
// Special days.
if (is_page("cache_listing")) {
try {
var now = new Date();
var year = now.getYear() + 1900;
var month = now.getMonth() + 1;
var date = now.getDate();
// Ostern 2020.
if ((date >= 10 && date <= 13 && month == 4 && year == 2020)) {
$(".CacheDetailNavigation:first > ul:first").append('
');
}
// Weihnachten 2023.
if (month == 12 && year == 2023) {
var max = 0;
if ((date >= 5 && date <= 6) || (date >= 24 && date <= 26)) max = 100;
if (max > 0) {
function checkChristmasData(waitCount) {
if ($('.gclh_latest_log').length > 0) {
setTimeout(function() {
var icons = $('#gclh_latest_logs').find('img[src*="/images/logtypes/2.png"]');
var count = 0;
for (var i = 0; i < icons.length; i += 2) {
var num = random(max, 1);
if (num > 0 && num < 9) {
icons[i].src = urlImages+"nicolaus_head_0" + num + ".png";
icons[i].style = "margin-top: -12px; vertical-align: sub;";
count++;
if (count >= 2) break;
}
}
}, 1000);
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){checkChristmasData(waitCount);}, 100);}
}
checkChristmasData(0);
}
}
} catch(e) {gclh_error("Special days",e);}
}
/////////////////////////////
// 6.2 GC - Functions ($$cap) (Functions for the geocaching webpages.)
/////////////////////////////
// Leaflet init.
function leafletInit() {
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" ) {
console.error("Unexpected version of leaflet. Version 0.7.2 required, version "+L.version+" is loaded.");
}
} catch(e) {gclh_error("function leafletInit",e);}
}
// Searches for the owner's original username from the listing.
function get_real_owner() {
if ($('#ctl00_ContentBody_bottomSection')) {
var links = $('#ctl00_ContentBody_bottomSection a[href*="/play/search?owner[0]="], #ctl00_ContentBody_bottomSection a[href*="/seek/nearest.aspx?u="]');
for (var i = 0; i < links.length; i++) {
// Das "?" in "(.*?)" bedeutet "nicht gierig", das heißt es wird nur bis zum ersten Vorkommen des "&" verwendet.
var match = links[i].href.match(/\/play\/search\?owner\[0\]=(.*?)&/);
if (match) return urldecode(match[1]);
var match = links[i].href.match(/\/seek\/nearest\.aspx\?u\=(.*)$/);
if (match) return urldecode(match[1], true);
}
return false;
} else return false;
}
// Hide header in map.
function hide_map_header() {
if ($('nav')[0].style.display != "none") {
$('nav')[0].style.display = "none";
$('#Content')[0].style.top = 0;
} else {
$('nav')[0].style.display = "block";
$('#Content')[0].style.top = "80px";
}
}
// "Shorten" lines that are too long so that they do not wrap.
function noBreakInLine(n_side, n_maxwidth, n_title) {
if (n_side == "" || n_side == undefined || n_maxwidth == 0) return;
n_side.setAttribute("style", "max-width: " + n_maxwidth + "px; display: inline-block; overflow: hidden; vertical-align: bottom; white-space: nowrap; text-overflow: ellipsis;");
if (n_title != "") n_side.setAttribute("title", n_title);
}
// Mail Icons, Message Icons.
// Cache, TB, Aktiv User Infos ermitteln.
function getGcTbUserInfo() {
var g_gc = false; var g_tb = false;
var g_code = ""; var g_code_no_brackets = ""; var g_name = ""; var g_link = ""; var g_founds = ""; var g_date = ""; var g_time = ""; var g_dateTime = ""; var g_activ_username = "";
if ((settings_show_mail || settings_show_message)) {
// Cache Listing.
if ($('#ctl00_ContentBody_CacheName')[0]) {
g_gc = true;
g_name = $('#ctl00_ContentBody_CacheName')[0].innerHTML;
if ($('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0]) g_code = $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML;
// TB Listing.
} else if ($('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0]) {
g_tb = true;
g_code = $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].innerHTML;
if ($('#ctl00_ContentBody_lbHeading')[0]) g_name = $('#ctl00_ContentBody_lbHeading')[0].innerHTML;
// Log view.
} else if ($('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0]) {
// Cache.
if ($('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0].childNodes[4] &&
$('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0].childNodes[4].href.match(/\/cache_details\.aspx\?guid=/)) {
g_gc = true;
g_name = $('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0].childNodes[4].innerHTML;
}
// TB.
if ($('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0].childNodes[4] &&
$('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0].childNodes[4].href.match(/\/track\/details\.aspx\?guid=/)) {
g_tb = true;
g_name = $('#ctl00_ContentBody_LogBookPanel1_lbLogText')[0].childNodes[4].innerHTML;
}
// Log post.
} else if ($('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0]) {
// Cache old log page.
if ($('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].parentNode.children[2] &&
$('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].parentNode.children[2].href.match(/\/cache_details\.aspx\?guid=/)) {
g_gc = true;
g_name = $('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].parentNode.children[2].innerHTML;
}
// TB.
if ($('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].parentNode.children[2] &&
$('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].parentNode.children[2].href.match(/\/track\/details\.aspx\?guid=/)) {
g_tb = true;
g_name = $('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].parentNode.children[2].innerHTML;
}
// Log post cache new log page.
} else if ($('#logType a')[0] && $('#logType a')[0].innerHTML) {
g_gc = true;
g_name = $('#logType a')[0].innerHTML;
}
if (g_code != "") {
g_link = "(https://coord.info/" + g_code + ")";
g_code_no_brackets = g_code;
g_code = "(" + g_code + ")";
}
g_founds = global_findCount;
[g_date, g_time, g_dateTime] = getDateTime();
g_activ_username = global_me;
}
return [g_gc, g_tb, g_code, g_code_no_brackets, g_name, g_link, g_activ_username, g_founds, g_date, g_time, g_dateTime];
}
// Message Icon, Mail Icon aufbauen.
function buildSendIcons(b_side, b_username, b_art, guidSpecial) {
if (b_art == "per guid") {
// guid aus besonderen Proceduren (zB: post cache log new page).
if (guidSpecial) guid = guidSpecial;
if (guid == "" || guid == undefined) return;
if (guid.match(/\#/)) return;
// Keine Verarbeitung für Stat Bar.
if (b_side.innerHTML.match(/https?:\/\/img\.geocaching\.com\/stats\/img\.aspx/)) return;
} else {
if (b_username == "") return;
}
if (b_side == "" || b_side == undefined || b_username == undefined || global_activ_username == "" || global_activ_username == undefined || b_username == global_activ_username) return;
// Wenn Owner, dann echten Owner setzen und nicht gegebenenfalls abweichenden Owner aus Listing "A cache by".
if (b_side.parentNode.id == "ctl00_ContentBody_mcd1") {
var owner = get_real_owner();
b_username = owner;
}
// Wenn User "In the hands of ..." im TB Listing, prüfen ob aktiver Username dort enthalten ist und Mail, Message nicht erzeugen.
var username_send = b_username;
if (b_side.id == "ctl00_ContentBody_BugDetails_BugLocation") {
if (b_username.match(global_activ_username)) return;
b_username = "";
username_send = "user";
}
// Message, Mail Template aufbauen.
template_message = urlencode(buildSendTemplate());
template = urlencode(buildSendTemplate().replace(/#Receiver#/ig, b_username), convertPlus = false);
// Message Icon erzeugen.
if (settings_show_message && b_art == "per guid") {
var mess_link = document.createElement("a");
var mess_img = document.createElement("img");
mess_img.setAttribute("class", "gclh_send");
mess_img.setAttribute("style", "margin-left: 0px; margin-right: 0px");
mess_img.setAttribute("title", "Send a message to " + username_send);
mess_img.setAttribute("src", global_message_icon);
mess_link.appendChild(mess_img);
if (settings_message_icon_new_win) mess_link.setAttribute("target", "_blank");
mess_link.setAttribute("href", buildMessageCenterHref(guid, template_message));
b_side.parentNode.insertBefore(mess_link, b_side.nextSibling);
b_side.parentNode.insertBefore(document.createTextNode(" "), b_side.nextSibling);
// "Message this owner" und Icon entfernen.
$('#ctl00_ContentBody_mcd1').find(".message__owner").remove(); // Cache Listing
$('.BugDetailsList').find(".message__owner").remove(); // TB Listing
}
// Mail Icon erzeugen.
if (settings_show_mail) {
var mail_link = document.createElement("a");
var mail_img = document.createElement("img");
mail_img.setAttribute("class", "gclh_send");
mail_img.setAttribute("style", "margin-left: 0px; margin-right: 0px");
mail_img.setAttribute("title", "Send a mail to " + username_send);
mail_img.setAttribute("src", global_mail_icon);
mail_link.appendChild(mail_img);
if (settings_mail_icon_new_win) mail_link.setAttribute("target", "_blank");
if (b_art == "per guid") {
mail_link.setAttribute("href", "/email/?guid=" + guid + "&text=" + template);
b_side.parentNode.insertBefore(mail_link, b_side.nextSibling);
b_side.parentNode.insertBefore(document.createTextNode(" "), b_side.nextSibling);
} else {
b_side.appendChild(document.createTextNode(" "));
mail_link.setAttribute("href", "/email/?u=" + urlencode(b_username, convertPlus = false) + "&text=" + template);
b_side.appendChild(mail_link);
b_side.appendChild(document.createTextNode(" "));
}
}
}
// Message, Mail Template aufbauen, bis auf Empfänger.
function buildSendTemplate() {
var tpl = getValue("settings_mail_signature", "");
var trimIt = (tpl.length == tpl.trim().length);
tpl = tpl.replace(/#Found-?(\d+)?#/ig, (_match, p1) => p1 ? global_founds+1 - p1 : global_founds+1).replace(/#Found_no-?(\d+)?#/ig, (_match, p1) => p1 ? global_founds - p1 : global_founds)
tpl = tpl.replace(/#Me#/ig, global_activ_username).replace(/#Date#/ig, global_date).replace(/#Time#/ig, global_time).replace(/#DateTime#/ig, global_dateTime);
tpl = tpl.replace(/#GCTBName#/ig, global_name).replace(/#GCTBCode#/ig, global_code).replace(/#GCTBLink#/ig, global_link);
tpl = tpl.replace(/#GCTBCodeNoBrackets#/ig, global_code_no_brackets);
if (trimIt) tpl = tpl.trim();
return tpl;
}
// Message Center Href containing gcCode
function buildMessageCenterHref(guid, text) {
var mess_link_href = "/account/messagecenter?recipientId=" + guid + "&text=" + text;
if (global_code_no_brackets && !text && settings_message_add_gc_code) mess_link_href += "&gcCode=" + global_code_no_brackets;
return mess_link_href;
}
// Zebra look: colorize or remove.
function setLinesColorInZebra(para, lines, linesTogether) {
if (lines.length == 0) return;
var replaceSpec = /(AlternatingRow)(\s*)/g;
var setSpec = "AlternatingRow";
// Wenn Einfärbung nicht stattfinden soll.
if (para == false) setLinesColorNone(lines, replaceSpec);
// Wenn Einfärbung stattfinden soll.
else {
if (is_page('lists')) {
var hell = true;
for (var i = 0; i < lines.length; i++) {
if (hell == true) {
hell = false;
if ($(lines[i]).hasClass(setSpec)) $(lines[i]).removeClass(setSpec);
if ($(lines[i]).hasClass('has-description') && lines[i+1]) {
if ($(lines[i+1]).hasClass(setSpec)) $(lines[i+1]).removeClass(setSpec);
i++;
}
} else {
hell = true;
if (!$(lines[i]).hasClass(setSpec)) $(lines[i]).addClass(setSpec);
if ($(lines[i]).hasClass('has-description') && lines[i+1]) {
if (!$(lines[i+1]).hasClass(setSpec)) $(lines[i+1]).addClass(setSpec);
i++;
}
}
}
} else {
// Zeilen im ersten Zeilenbereich gegebenenfalls auf hell zurücksetzen.
for (var i = 0; i < lines.length; i += (2 * linesTogether)) {
for (var j = 0; j < linesTogether; j++) {
if (lines[i+j].className.match(replaceSpec)) {
var newClass = lines[i+j].className.replace(replaceSpec, "");
lines[i+j].setAttribute("class", newClass);
}
}
}
// Zeilen im zweiten Zeilenbereich gegebenenfalls an erster Stelle auf dunkel setzen.
for (var i = linesTogether; i < lines.length; i += (2 * linesTogether)) {
for (var j = 0; j < linesTogether; j++) {
if (lines[i+j].className.match(replaceSpec));
else {
if (lines[i+j].getAttribute("class") == (undefined|null|"")) var oldClass = "";
else var oldClass = " " + lines[i+j].getAttribute("class");
if (!$(lines[i+j]).hasClass('UserOwned')) {
lines[i+j].setAttribute("class", setSpec + oldClass);
}
}
}
}
}
}
}
// User, Owner, Reviewer, VIPs: colorize or remove.
function setLinesColorUser(paraStamm, tasks, lines, linesTogether, owner, bookmarklist) {
if (lines.length == 0) return;
var user = global_me;
if (owner == undefined) var owner = "";
var vips = getValue("vips");
if (vips != false) {
vips = vips.replace(/, (?=,)/g, ",null");
vips = JSON.parse(vips);
}
var setSpecUser = "TertiaryRow";
var setSpecOwner = "QuaternaryRow";
var setSpecReviewer = "QuinaryRow";
var setSpecVip = "SenaryRow";
var replaceSpecUser = /(TertiaryRow)(\s*)/g;
var replaceSpecVip = /(SenaryRow)(\s*)/g;
var para = new Array();
if (tasks.match("user")) para["user"] = getValue(paraStamm + "_user");
else para["user"] = "";
if (tasks.match("owner")) para["owner"] = getValue(paraStamm + "_owner");
else para["owner"] = "";
if (tasks.match("reviewer")) para["reviewer"] = getValue(paraStamm + "_reviewer");
else para["reviewer"] = "";
if (tasks.match("vip")) para["vip"] = getValue(paraStamm + "_vip");
else para["vip"] = "";
// Wenn Einfärbung für User nicht stattfinden soll, entfernen.
if (para["user"] == false) setLinesColorNone(lines, replaceSpecUser);
// Wenn Einfärbung stattfinden soll.
if (para["user"] == true || para["owner"] == true || para["reviewer"] == true || para["vip"] == true) {
for (var i = 0; i < lines.length; i += linesTogether) {
var newClass = "";
var aTags = lines[i].getElementsByTagName("a");
var imgTags = lines[i].getElementsByTagName("img");
if (bookmarklist == 'new') var useTags = lines[i].getElementsByTagName("use");
// Cache, TB Listing. Anhand guid prüfen, ob Einfärbung für User oder Owner notwendig ist.
if (para["user"] || para["owner"]) {
for (var j = 0; j < aTags.length; j++) {
if (aTags[j].href.match(/\/(profile|p)\/\?guid=/)) {
if (decode_innerHTML(aTags[j]) == user && para["user"]) newClass = setSpecUser;
else if (decode_innerHTML(aTags[j]) == owner && para["owner"]) newClass = setSpecOwner;
break;
}
}
// Bookmark Listen ALT. Anhand Found Icon prüfen, ob Einfärbung für User notwendig ist.
// (Originallogs würden wegen src mit found noch hier reingehen -> para bookmarklist.)
if (newClass == "" && para["user"] && bookmarklist == true) {
for (var j = 0; j < imgTags.length; j++) {
if (imgTags[j].src.match(/\/found\./)) {
newClass = setSpecUser;
break;
}
}
}
// Bookmark Listen NEU. Anhand xlink:href="#smiley" prüfen, ob Einfärbung für User notwendig ist.
if (newClass == "" && para["user"] && bookmarklist == 'new' && useTags.length > 0) {
for (var j = 0; j < useTags.length; j++) {
if (useTags[j].getAttribute('xlink:href').match(/#smiley/)) {
newClass = setSpecUser;
break;
}
}
}
}
// Cache, TB Listing. Anhand Admin Icon prüfen, ob Einfärbung für Reviewer notwendig ist.
// (Logs von ehemaligen Reviewern werden nicht mehr eingefärbt. Besser wäre wohl Icons abzufragen.)
if (newClass == "" && para["reviewer"]) {
for (var j = 0; j < imgTags.length; j++) {
if (imgTags[j].src.match(/\/icon_admin\./)) {
newClass = setSpecReviewer;
break;
}
}
}
// Cache, TB Listing. Anhand titles zum VIP Icon und guid der VIP prüfen, ob Einfärbung für VIP notwendig ist. VIP kann sich während Seitendarstellung ändern.
if (newClass == "" && para["vip"] && vips) {
// Farbe für VIP zurücksetzen.
for (var j = 0; j < linesTogether; j++) {
if (lines[i+j].className.match(replaceSpecVip)) {
var replaceClass = lines[i+j].className.replace(replaceSpecVip, "");
lines[i+j].setAttribute("class", replaceClass);
}
}
// Wenn VIP Icon gesetzt und guid in VIPS Area vorhanden, merken, dass Farbe für VIP gesetzt werden muss.
for (var j = 0; j < imgTags.length; j++) {
if (imgTags[j].title.match(/from VIP-List/)) {
for (var k = 0; k < aTags.length; k++) {
if (aTags[k].href.match(/\/(profile|p)\/\?guid=/)) {
if (in_array(decode_innerHTML(aTags[k]), vips)) {
newClass = setSpecVip;
}
break;
}
}
break;
}
}
}
// Wenn Einfärbung notwendig ist. Prüfen, ob Einfärbung nicht vorhanden ist, gegebenenfalls dann an erster Stelle einbauen.
if (newClass != "") {
for (var j = 0; j < linesTogether; j++) {
if (lines[i+j].className.match(newClass));
else {
if (lines[i+j].getAttribute("class") == null) var oldClass = "";
else var oldClass = " " + lines[i+j].getAttribute("class");
lines[i+j].setAttribute("class", newClass + oldClass);
if (bookmarklist == 'new' && $(lines[i+j]).hasClass('has-description') && lines[i+j+1]) {
lines[i+j+1].setAttribute("class", newClass + oldClass);
}
}
}
}
}
}
}
// Remove specification for coloring line.
function setLinesColorNone(lines, replSpez) {
if (lines.length == 0) return;
for (var i = 0; i < lines.length; i++) {
if (lines[i].className.match(replSpez)) {
var newClass = lines[i].className.replace(replSpez, "");
lines[i].setAttribute("class", newClass);
}
}
}
// Simulate installation counter.
function instCount(declaredVersion) {
var side = $('body')[0];
var div = document.createElement("div");
div.id = "gclh_simu";
div.setAttribute("style", "margin-top: -50px;");
var prop = ' style="border: none; visibility: hidden; width: 2px; height: 2px;" alt="">';
var code = ' $$002
code += ' span > svg > title')[0]) var GCType = $('.loggable-header > span > svg > title')[0].innerHTML;
return [GCTBName, GCTBLink, GCTBNameLink, LogDate, GCType];
}
function getGCTBInfo() {
var GCTBName = ""; var GCTBLink = ""; var GCTBNameLink = ""; var LogDate = ""; var GCType = "";
if ($('#uxDateVisited')[0]) var LogDate = $('#uxDateVisited')[0].value;
if ($('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].nextSibling.nextSibling) {
var GCTBName = $('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].nextSibling.nextSibling.nextSibling.innerHTML;
GCTBName = GCTBName.replace(/'/g,"");
var GCTBLink = $('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].href;
var GCTBNameLink = "[" + GCTBName + "](" + GCTBLink + ")";
var GCType = $('#ctl00_ContentBody_LogBookPanel1_WaypointLink')[0].nextSibling.children[0].title;
}
return [GCTBName, GCTBLink, GCTBNameLink, LogDate, GCType];
}
function getDraftData(pageData) {
var DraftLogDate = ""; var DraftLogTime = "";
if (pageData && pageData.logValues && pageData.logValues.dateLoggedGeocacheTime) {
var date = new Date(pageData.logValues.dateLoggedGeocacheTime);
var DraftLogDate = date.toLocaleDateString(window.navigator.language, {year: 'numeric', month: '2-digit', day: '2-digit'})
var DraftLogTime = date.toLocaleTimeString(window.navigator.language, {hour: '2-digit', minute: '2-digit'});
}
return [DraftLogDate, DraftLogTime];
}
// Show, hide box. e.g.: Both VIP boxes in the cache listing.
function showHideBoxCL(id_lnk, first) {
if (id_lnk.match("lnk_gclh_config_")) var is_config = true;
else is_config = false;
var name_show_box = id_lnk.replace("lnk_", "show_box_");
var id_box = id_lnk.replace("lnk_", "");
var show_box = getValue(name_show_box, true);
if (document.getElementById(id_lnk)) var lnk = document.getElementById(id_lnk);
if (document.getElementById(id_box)) var box = $('#' + id_box);
if (!box) {
if (document.getElementsByClassName(id_box)) var box = $('.' + id_box);
}
if (lnk && box) {
if ((show_box == true && first == true) || (show_box == false && first == false)) {
setShowHide(lnk, "hide", is_config);
box.show();
var showHide = "hide";
setValue(name_show_box, true);
if (!first && is_config) {
document.getElementById(id_lnk).scrollIntoView();
window.scrollBy(0, -15);
}
} else {
setShowHide(lnk, "show", is_config);
box.hide();
var showHide = "show";
setValue(name_show_box, false);
}
return showHide;
}
}
function setShowHide(row, whatToDo, is_config) {
if (whatToDo == "show") {
row.title = "show";
if (is_config == true) {
row.src = global_plus_config2;
row.parentNode.className += " gclh_hide";
} else row.src = "/images/plus.gif";
} else {
row.title = "hide";
if (is_config == true) {
row.src = global_minus_config2;
row.parentNode.className = row.parentNode.className.replace(" gclh_hide","");
} else row.src = "/images/minus.gif";
}
if (is_config == true) row.title += " topic\n(all topics with right mouse)";
}
// Waypoint evaluations.
function getWaypointTable() {
var tbl = $("#ctl00_ContentBody_Waypoints");
if (tbl.length <= 0) tbl = $("#ctl00_ContentBody_WaypointList");
return tbl;
}
// Determine waypoints.
function queryListingWaypoints(original) {
var waypoints = [];
if (check_wpdata_evaluable() == false) return waypoints;
try {
var gccode = ($('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0]) ? $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode')[0].textContent : "n/a";
for ( var i=0; i nav ul.gclh {padding-top: 2px !important;}";
css += "#sidebarNavigation > nav ul.isHide {display: none !important} .link-block {border-bottom: unset;}";
css += "#sidebarNavigation > nav h3.gclh {cursor: pointer; margin-top: 4px !important;}";
css += "#sidebarNavigation > nav h3.gclh svg {height: 23px; width: 22px; fill: #777; float: right; margin-top: -3px; margin-right: -2px; transition: all .3s ease; transform-origin: 50% 50%;}";
css += "#sidebarNavigation > nav h3.gclh.isHide svg {transform: rotate(90deg);}";
appendCssStyle(css);
}
function buildBoxDashboard(ident, name, title) {
var head = document.createElement("h3");
head.setAttribute("class", (getValue("show_box_dashboard_" + ident, true) == true ? "link-header gclh" : "link-header gclh isHide") + " bg-gray-50 text-xs py-1 px-2 m-0 mt-2 rounded");
head.setAttribute("name", "head_" + ident);
if (title) head.setAttribute("title", title);
if (name) head.innerHTML = name + " ";
head.addEventListener("click", showHideBoxDashboard, false);
var box = document.createElement("ul");
box.setAttribute("class", (getValue("show_box_dashboard_" + ident, true) == true ? "link-block gclh" : "link-block gclh isHide") + " pl-2");
box.setAttribute("name", "box_" + ident);
if (ident == 'vip') {
$("#sidebarNavigation > nav > ul:not(.gclh)").last().after(box).after(head);
} else if (ident == 'vup') {
$("#sidebarNavigation > nav > ul[name*='box_vip']").after(box).after(head);
} else {
$("#sidebarNavigation > nav > ul").last().after(box).after(head);
}
}
function buildCopyOfBookmarks() {
var bm_tmp = new Array();
for (var i = 0; i < bookmarks.length; i++) {
bm_tmp[i] = new Object();
for (attr in bookmarks[i]) {bm_tmp[i][attr] = bookmarks[i][attr];}
}
return bm_tmp;
}
function buildBoxElementsLinklist(box) {
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 a = document.createElement("a");
a.setAttribute("class", "no-underline rounded hover:text-gray-600 hover:underline focus:text-gray-600");
for (attr in bookmarks[x]) {
if (attr == "custom" || attr == "title") continue;
if (attr == "name" || attr == "id") a.setAttribute(attr, bookmarks[x][attr]+"_profile");
else a.setAttribute(attr, bookmarks[x][attr]);
}
a.appendChild(document.createTextNode(bookmarks[x]['title']));
var li = document.createElement("li");
li.appendChild(a);
box.appendChild(li);
}
}
function buildBoxElementsLinks(box, bm_tmp) {
for (var i = 0; i < bm_tmp.length; i++) {
if (bm_tmp[i]['origTitle'] == "(empty)" || bm_tmp[i]['href'] == "" || bm_tmp[i]['href'] == "#") continue;
var a = document.createElement("a");
a.setAttribute("class", "no-underline rounded hover:text-gray-600 hover:underline focus:text-gray-600");
for (attr in bm_tmp[i]) {
if (attr == "custom" || attr == "title" || attr == "origTitle") continue;
if (attr == "name" || attr == "id") a.setAttribute(attr, bm_tmp[i][attr]+"_profile");
else a.setAttribute(attr, bm_tmp[i][attr]);
}
a.appendChild(document.createTextNode(bm_tmp[i]['origTitle']));
var li = document.createElement("li");
li.appendChild(a);
box.appendChild(li);
}
}
// Show, Hide box on dashboard.
function showHideBoxDashboard() {
if (!$(this.nextElementSibling)) return;
var ident = this.getAttribute("name").replace("head_", "");
(this.className.match("isHide") ? setValue("show_box_dashboard_" + ident, true) : setValue("show_box_dashboard_" + ident, false));
(this.className.match("isHide") ? $(this.nextElementSibling).removeClass("isHide") : $(this.nextElementSibling).addClass("isHide"));
(this.className.match("isHide") ? $(this).removeClass("isHide") : $(this).addClass("isHide"));
}
// Show/hide upvotes with "Order by", "Great story" and "Helpful".
function showHideUpvotesLink() {
addButtonOverLogs(showHideUpvotes, "gclh_show_hide_upvotes", true, "Hide upvotes", "", "Show/hide upvotes with \"Order by\", \"Great story\" and \"Helpful\"");
setUpvotesButTitle();
}
function showHideUpvotes() {
if (isUpvoteActive == false || $('#gclh_show_hide_upvotes.working')[0]) return;
$('#cache_logs_container').toggleClass('gclh_hide_upvotes');
if ($('#gclh_show_hide_upvotes')[0]) {
$('#gclh_show_hide_upvotes input')[0].setAttribute('disabled', '');
$('#gclh_show_hide_upvotes').addClass("working");
setTimeout(function() {
setUpvotesButTitle();
$('#gclh_show_hide_upvotes').removeClass("working");
$('#gclh_show_hide_upvotes input')[0].removeAttribute('disabled');
}, 100);
}
}
function setUpvotesButTitle() {
if ($('#gclh_show_hide_upvotes')[0] && $('#cache_logs_container')[0]) {
if ($('#cache_logs_container').hasClass('gclh_hide_upvotes')) {
$('#gclh_show_hide_upvotes')[0].children[0].value = 'Show upvotes';
} else {
$('#gclh_show_hide_upvotes')[0].children[0].value = 'Hide upvotes';
}
}
}
// Show log counter.
function showLogCounterLink() {
addButtonOverLogs(showLogCounter, "gclh_show_log_counter", true, "Show log counter", "Log counter", "Show log counter for log type and total");
if (settings_show_log_counter_but && settings_show_log_counter) showLogCounter();
appendCssStyle(".gclh_logCounter {font-size: 10px !important; padding-left: 6px; font-style: italic;}");
}
function showLogCounter() {
try {
if ($('#gclh_show_log_counter.working')[0]) return;
$('#gclh_show_log_counter').addClass("working");
$('#gclh_show_log_counter input')[0].setAttribute('disabled', '');
setTimeout(function() {
var logCounter = new Object();
logCounter["all"] = 0;
var logTypes = $('#ctl00_ContentBody_lblFindCounts .LogTotals a');
for (var i = 0; i < logTypes.length; i++) {
var matches = logTypes[i].innerHTML.replace(/(,|\.)/g, "").match(/>(\s*)(\d+)/);
// exclude Favorite logs filter
if (matches && matches[2] && !logTypes[i].innerHTML.match('fave_fill_16.svg')) {
logCounter[logTypes[i].childNodes[0].title] = parseInt(matches[2]);
logCounter["all"] += parseInt(matches[2]);
}
}
if (logCounter["all"] != 0) {
var logs = $('#cache_logs_table2').find('tbody tr td').find('.LogType');
for (var i = 0; i < logs.length; i++) {
var log = logs[i];
if (log && log.children[1] && log.children[0].children[0].title && logCounter[log.children[0].children[0].title]) {
var logTyp = log.children[0].children[0].title;
log.children[1].innerHTML = " Log " + logCounter[logTyp] + " / Total Log " + logCounter["all"];
logCounter[logTyp]--;
logCounter["all"]--;
}
}
}
$('#gclh_show_log_counter').removeClass("working");
$('#gclh_show_log_counter input')[0].removeAttribute('disabled');
}, 100);
} catch(e) {gclh_error("showLogCounter",e);}
}
// Show/Hide compact logs.
function toggle_compact_logbook(){
if ($('#toggle_compact_logbook.working')[0]) return;
$('#toggle_compact_logbook input')[0].setAttribute('disabled', '');
$('#toggle_compact_logbook').addClass("working");
setTimeout(function() {
$('#cache_logs_container').toggleClass('compact_logbook');
if ($('#cache_logs_container').hasClass('compact_logbook')) {
$('#toggle_compact_logbook')[0].children[0].value = 'Hide compact logs';
} else {
$('#toggle_compact_logbook')[0].children[0].value = 'Show compact logs';
}
$('#toggle_compact_logbook').removeClass("working");
$('#toggle_compact_logbook input')[0].removeAttribute('disabled');
}, 100);
}
// Add button over logs in cache listing.
function addButtonOverLogs(func, id, right, txt, txtshort, title, adhere) {
if (!$('#ctl00_ContentBody_uxLogbookLink')[0]) return;
var span = document.createElement("span");
span.id = id;
if (title != "") span.title = title;
if (txtshort != "" && settings_new_width < 1040 && settings_show_all_logs_but && settings_show_compact_logbook_but && settings_show_log_counter_but && settings_show_bigger_avatars_but && settings_show_hide_upvotes_but) {
var text = txtshort;
} else {
var text = txt;
}
span.innerHTML = '';
span.addEventListener("click", func, false);
if (right) span.className = "gclh_rlol";
else span.className = "gclh_llol";
if ($('.gclh_llol').length == 0 && $('.gclh_rlol').length == 0) {
if ($('#ctl00_ContentBody_uxLogbookLink')[0]) $('#ctl00_ContentBody_uxLogbookLink')[0].innerHTML = $('#ctl00_ContentBody_uxLogbookLink')[0].innerHTML.replace("View ", "").replace(" anzeigen", "").replace("Zobrazit l", "L");
if ($('#ctl00_ContentBody_uxGalleryImagesLink')[0]) $('#ctl00_ContentBody_uxGalleryImagesLink')[0].innerHTML = $('#ctl00_ContentBody_uxGalleryImagesLink')[0].innerHTML.replace("View the ", "").replace(" anzeigen", "").replace("Zobrazit f", "F");
var css = "";
css += ".gclh_llol {margin-right: 4px;} .gclh_rlol {float: right; margin-left: 4px;}";
css += ".gclh_llol input, .gclh_rlol input {padding-left: 4px; padding-right: 4px; cursor: pointer;}";
appendCssStyle(css);
$('#ctl00_ContentBody_uxLogbookLink')[0].parentNode.style.width = "100%";
$('#ctl00_ContentBody_uxLogbookLink')[0].parentNode.style.margin = "0";
}
if (adhere) adhere.append(span);
else $('#ctl00_ContentBody_uxLogbookLink')[0].parentNode.append(span);
}
// Determine user, guid from the read old or new public profile.
function getUserGuidFromProfile(respText) {
var user = respText.match(/id="ctl00_(ProfileHead_ProfileHeader|ContentBody_ProfilePanel1)_lblMemberName">(.*?)<\/span>/);
var guid = respText.match(/href="\/account\/messagecenter\?recipientId=([a-zA-Z0-9-]*)"/);
if (user && user[1] && user[2]) {
var span = document.createElement('span');
span.innerHTML = user[2];
var username = decode_innerHTML(span);
if (guid && guid[1]) return [username, guid[1]];
else return [username, false];
}
return [false, false];
}
// Determine user from url.
function getUrlUser() {
var urluser = document.location.href.match(/\.com\/seek\/nearest\.aspx(.*)(\?ul|\?u|&ul|&u)=(.*)/);
urluser = urldecode(urluser[3].replace(/&([A-Za-z0-9]+)=(.*)/, ""));
urluser = urluser.replace(/&disable_redirect=/, "");
if (!urluser.match(/^#/)) urluser = urluser.replace(/#(.*)/, "");
return urluser;
}
// Alternative to event load on map. (Load event on map doesn't work always with open in new tab.)
function isMapLoad(fkt) {
if (waitCount == undefined) var waitCount = 0;
if ($('.groundspeak-control-findmylocation')[0] && $('.leaflet-control-scale')[0]) fkt();
else {waitCount++; if (waitCount <= 50) setTimeout(function(){isMapLoad(fkt);}, 200);}
}
function insertAfter(newNode, referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
function removeElement(element) {
if (element) element.parentNode.removeChild(element);
}
// Determine cache listing coordinates.
function determineListingCoords(whichCoords) {
var CorrCoords = ""; var OrgCoords = ""; var GCTourCoords = "";
if (unsafeWindow.mapLatLng.isUserDefined == true ) {
OrgCoords = unsafeWindow.mapLatLng.oldLatLngDisplay.replace(new RegExp('\'', 'g'),'');
}
if ($('#uxLatLon')[0].innerHTML.match(/GCTour/)) {
// Hier kann es gerade keinen update durch GC-internen Solution-Checker gegeben haben, sonst wäre "GCTour" nicht mehr vorhanden.
var coords = $('#uxLatLon')[0].innerHTML.match(/([A-Z0-9°\.\s]*)([A-Za-z&;-\s]*)GCTour/);
if (coords && coords[1]) {
GCTourCoords = coords[1].replace(/° /g, '°').replace(/°/g, '° ');
}
var coords = $('#uxLatLon')[0].innerHTML.match(/GCTour<\/div>\s\W([A-Z0-9°\.\s]*)/);
if (coords && coords[1]) {
if (OrgCoords == "") {
OrgCoords = coords[1].replace(/° /g, '°').replace(/°/g, '° ');
} else {
CorrCoords = coords[1].replace(/° /g, '°').replace(/°/g, '° ');
}
}
} else {
if (OrgCoords == "") {
// Gerade wurde update durch GC-internen Solution-Checker durchgeführt.
var uxLatLon = $('#uxLatLon')[0].innerHTML.replace(/(°|'|\s)/g, "");
if (is_page('unpublished_cache')) {
OrgCoords = $('#uxLatLon')[0].innerHTML;
} else {
var oldLatLng = unsafeWindow.mapLatLng.oldLatLngDisplay.replace(/(°|'|\s)/g, "");
if (uxLatLon !== oldLatLng) {
OrgCoords = unsafeWindow.mapLatLng.oldLatLngDisplay.replace(new RegExp('\'', 'g'),'');
CorrCoords = $('#uxLatLon')[0].innerHTML;
} else {
OrgCoords = $('#uxLatLon')[0].innerHTML;
}
}
} else {
CorrCoords = $('#uxLatLon')[0].innerHTML;
}
}
if (whichCoords == 'Corr') return CorrCoords;
else if (whichCoords == 'Org') return OrgCoords;
else if (whichCoords == 'GCTour') return GCTourCoords;
else if (whichCoords == 'CorrOrg') return (CorrCoords !== "" ? CorrCoords : OrgCoords);
else return "";
}
// Get count and names of own bookmarklists.
function getOwnBMLs(content) {
var count = 0;
var text = '';
var ary = [];
var list = '';
$(content).find('ul.BookmarkList li').each(function() {
if ( $(this).find('a[href*="/profile/?guid="], a[href*="/p/?guid="]')[0] && $(this).find('a[href*="/profile/?guid="], a[href*="/p/?guid="]')[0].innerHTML.match(global_me) &&
$(this).find('a[href*="/bookmarks/view.aspx?guid="], a[href*="/plan/lists/BM"]')[0] && $(this).find('a[href*="/bookmarks/view.aspx?guid="], a[href*="/plan/lists/BM"]')[0].innerHTML ) {
if (!ary.includes($(this).find('a[href*="/bookmarks/view.aspx?guid="], a[href*="/plan/lists/BM"]')[0].innerHTML)) {
count++;
ary.push($(this).find('a[href*="/bookmarks/view.aspx?guid="], a[href*="/plan/lists/BM"]')[0].innerHTML);
}
}
});
ary.sort(caseInsensitiveSort);
for (var i = 0; i < ary.length; i++) {
list += (list == '' ? '' : '\n') + ary[i];
}
text = 'Currently available in ' + count + (count == 1 ? ' own list' : ' own lists');
return [count, text, list];
}
// Build dropdown with caret-down icon and own specified dropdown entries for gclh stuff.
// Implement css, symbol and icon for dropdown functionality.
function buildDD(show, place, styles) {
if (show == false || !$(place)[0]) return;
// Implement css for dropdown functionality.
if (!$('#gclh_dd-css')[0]) {
var css = ' ';
if (styles && styles != '') css += styles;
if (css != ' ') appendCssStyle(css, place, 'gclh_dd-css');
}
// Implement symbol caret-down for dropdown icon.
if (!$('#gclh_dd-caret-down')[0]) {
var symbol = $('#caret-down').clone();
symbol[0].id = 'gclh_dd-caret-down';
$('#caret-down').after(symbol);
}
// Implement dropdown icon.
if (!$('#gclh_dd')[0] && $('#gclh_dd-caret-down')[0]) {
var dd = document.createElement(($(place)[0].tagName == 'UL' ? 'li' : 'div'));
dd.innerHTML = '';
dd.id = 'gclh_dd';
$(place).append(dd);
}
}
// Implement dropdown menue and dropdown entry.
function buildChildDD(show, id, className, clickFunction, value, title, menuFloatLeft, mouseoverFunction) {
if (show == false || !$('#gclh_dd')[0] || !id || id == '' || !value || value == '' || !clickFunction || clickFunction == '') return;
// Implement dropdown menue if not already available.
if (!$('#gclh_dd .gclh_dd-menu')[0]) {
$('#gclh_dd').append('
');
// Mouseleave event to enable disabled childs.
$('#gclh_dd')[0].addEventListener("mouseleave", function() {
$('.gclh_dd-menu li.disabled').each(function() {
$(this).removeClass('disabled');
});
}, false);
}
// Implement dropdown entry if not already available.
if (!$('#'+id)[0]) {
$('#gclh_dd .gclh_dd-menu ul').append('
');
// Implement click event for child.
$('#gclh_dd .gclh_dd-menu ul')[0].children[($('#gclh_dd .gclh_dd-menu ul li').length - 1)].addEventListener("click", function() {
clickFunction(true, this);
// Hide dropdown menue after functional click to an entry.
hideDD();
}, false);
// Implement mouseover event to prepare child before showing, if requested.
if (mouseoverFunction && mouseoverFunction != '') {
$('#gclh_dd')[0].addEventListener("mouseover", function() {
mouseoverFunction(this);
}, false);
}
// Make dropdown visible because dropdown entry is available.
$('#gclh_dd .gclh_dd-icon').removeClass('gclh_dd-hidden');
// Set dropdown menue with entries on the left side.
setMenuLeftDD(menuFloatLeft);
}
}
// Set dropdown menu with entries on the left side.
function setMenuLeftDD(menuFloatLeft) {
if (menuFloatLeft) {
if (!$('.gclh_dd-menu').hasClass('gclh_dd-left')) {
$('.gclh_dd-menu').addClass('gclh_dd-left');
}
var width = window.getComputedStyle($('.gclh_dd-menu')[0]).width.match(/(\d*\.*\d*)/);
if (width && width[0]) {
$('.gclh_dd-menu')[0].style.marginLeft = '-' + (parseInt(width[0]) - 32) + 'px';
}
}
}
// Hide dropdown menue after functional click to an entry.
function hideDD() {
$('#gclh_dd .gclh_dd-menu').addClass('gclh_dd-hidden');
function removeHiddenClassDD(waitCount) {
if (!$('#gclh_dd .gclh_dd-menu').is(":hover")) {
$('#gclh_dd .gclh_dd-menu').removeClass('gclh_dd-hidden');
} else {
waitCount++;
if (waitCount <= 20) setTimeout(function(){removeHiddenClassDD(waitCount);}, 50);
else $('#gclh_dd .gclh_dd-menu').removeClass('gclh_dd-hidden');
}
}
removeHiddenClassDD(0);
}
// Change the value in the dropdown menue entry.
function changeValueDD(id, from, to) {
if (id && id != '' && $('#'+id)[0] && from && from != '' && to) {
// Get entry with id.
var entryDD = $('#'+id)[0];
// Change value of entry.
if (entryDD && entryDD.children[0] && entryDD.children[0].innerHTML) {
entryDD.children[0].innerHTML = entryDD.children[0].innerHTML.replace(from, to);
// Set dropdown menu with entries again on the left side.
setMenuLeftDD($('.gclh_dd-menu.gclh_dd-left')[0])
}
}
}
// Internal call of File API.
function internalCallFileAPI(comeFrom, callBack) {
if (!comeFrom || !$(comeFrom) || !callBack) return;
// Check if File API is fully supported.
if (window.File && window.FileReader && window.FileList && window.Blob) {
} else {
alert('The File APIs are not fully supported in your browser.');
return;
}
// Build internal call of File API.
if (comeFrom && $(comeFrom).find('input')[0] == undefined) {
// Build input for File API.
$(comeFrom).append('');
// File selection, file reader and callback.
$(comeFrom).find('.gclh_file_input')[0].addEventListener('change', function() {
if (this.files[0]) {
var file = this.files[0];
const reader = new FileReader();
reader.readAsText(file);
reader.onload = function() {
callBack(file, reader.result);
};
}
});
}
// Click to file selection of File API.
$(comeFrom).find('.gclh_file_input').click();
}
// Callback from internal call of File API for adding Caches to a bookmark list.
function addCachesBML(file, content) {
var [gcText, gcCount] = getCachesFromContent(file, content);
bulkUpdateBML(gcText, gcCount, file);
}
// Get caches from content like for example uploaded file content.
function getCachesFromContent(contentFrom, content) {
if (contentFrom == 'undefined' || content == 'undefined') return ['', 0];
var from = (contentFrom.name ? contentFrom.name : contentFrom);
if (from.match(/\.gpx/i)) {
var gcCodes = content.match(/GC[A-Z0-9]{1,6}<\/name>/ig);
} else if (from.match(/\.loc/i)) {
var gcCodes = content.match(/|$)/ig);
}
var gcText = '';
var gcCount = 0;
if (gcCodes) {
for (var i = 0; i < gcCodes.length; i++) {
var gcCode = gcCodes[i].replace(/(|<\/name>|)/ig,'');
if (gcText.match(gcCode)) continue;
if (gcText == '') gcText = gcCode;
else gcText += ',' + gcCode;
gcCount++;
}
}
return [gcText, gcCount];
}
// Bulk update to BML with caches.
function bulkUpdateBML(gcText, gcCount, contentFrom) {
if (gcText == 'undefined' || gcCount == 'undefined' ) return;
if (!contentFrom) var from = '';
else if (contentFrom.name) var from = ' from file ' + contentFrom.name + '';
else var from = ' from ' + contentFrom + '';
if (gcText == '' || gcCount == 0) {
alert ('No GC Codes' + from.replace(/(|<\/b>)/g,'"'))
return;
}
// Call add functionality of bookmark list page.
function buildBulkUpdate() {
let input = document.getElementById('bulk-input-field');
let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
nativeInputValueSetter.call(input, gcText);
input.dispatchEvent(new Event('input', { bubbles: true }));
$('#bulk-input-form').after('
' + gcCount + ' GC Codes' + from + ' Please click "Add geocaches" if this seems to be ok.
');
}
function waitForBulkUpdate(waitCount) {
if ($('button.bulk-add-toggle')[0] && !$('#bulk-input-form')[0] && !$('button.bulk-add-toggle.gclh_click')[0]) {
$('button.bulk-add-toggle').click();
$('button.bulk-add-toggle').addClass('gclh_click');
}
if ($('button.bulk-add-toggle')[0] && $('#bulk-input-form')[0] &&
$('#bulk-input-field')[0] && $('#bulk-input-form')[0]) {
buildBulkUpdate();
return;
}
waitCount++;
if (waitCount <= 100) {
setTimeout(function(){waitForBulkUpdate(waitCount);}, 50);
} else {
var mess = "ERROR: Can not find the place for bulk updates. Probably changes on the bookmark list page are responsible for that.\nPlease contact the development team of the script with a new issue on this page: https://github.com/2Abendsegler/GClh/issues";
gclh_error("Upload caches from gpx file", {'message': '\n'+mess, 'stack': '' });
alert(mess);
}
}
if ($('button.add-geocache-cta')[0]) $('button.add-geocache-cta').click();
waitForBulkUpdate(0);
}
// Set focus to a field.
function setFocusToField(waitCount, field) {
if ($(field)[0]) {
$(field).focus();
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){setFocusToField(waitCount, field);}, 50);}
}
// Convert cache type to cache tx.
function getCacheTx(type) {
let tx;
if (type == '2' ) tx = '&tx=32bc9333-5e52-4957-b0f6-5a2c8fc7b257'; // Tradi
else if (type == '3' ) tx = '&tx=a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74'; // Multi
else if (type == '4' ) tx = '&tx=294d4360-ac86-4c83-84dd-8113ef678d7e'; // Virtual
else if (type == '5' ) tx = '&tx=4bdd8fb2-d7bc-453f-a9c5-968563b15d24'; // Letterbox
else if (type == '6' ) tx = '&tx=69eb8534-b718-4b35-ae3c-a856a55b0874'; // Event
else if (type == '8' ) tx = '&tx=40861821-1835-4e11-b666-8d41064d03fe'; // Mystery
else if (type == '9' ) tx = '&tx=2555690d-b2bc-4b55-b5ac-0cb704c0b768'; // APE
else if (type == '11' ) tx = '&tx=31d2ae3c-c358-4b5f-8dcd-2185bf472d3d'; // WebCam
else if (type == '12' ) tx = '&tx=8F6DD7BC-FF39-4997-BD2E-225A0D2ADF9D'; // Reverse
else if (type == '13' ) tx = '&tx=57150806-bc1a-42d6-9cf0-538d171a2d22'; // Cito
else if (type == '137' ) tx = '&tx=c66f5cf3-9523-4549-b8dd-759cd2f18db8'; // Earth Cache
else if (type == '453' ) tx = '&tx=69eb8535-b718-4b35-ae3c-a856a55b0874'; // Mega
else if (type == '1304') tx = '&tx=72e69af2-7986-4990-afd9-bc16cbbb4ce3'; // GPS Adventures Exhibit
else if (type == '1858') tx = '&tx=0544fa55-772d-4e5c-96a9-36a51ebcf5c9'; // Wherigo
else if (type == '3653') tx = '&tx=3ea6533d-bb52-42fe-b2d2-79a3424d4728'; // Community Celebration
else if (type == '4738') tx = '&tx=bc2f3df2-1aab-4601-b2ff-b5091f6c02e3'; // Geocaching HQ Block Party
else if (type == '3773') tx = '&tx=416f2494-dc17-4b6a-9bab-1a29dd292d8c'; // Geocaching HQ
else if (type == '3774') tx = '&tx=af820035-787a-47af-b52b-becc8b0c0c88'; // Geocaching HQ Celebration
else if (type == '7005') tx = '&tx=51420629-5739-4945-8bdd-ccfd434c0ead'; // Giga
else tx = '&tx=9a79e6ce-3344-409c-bbe9-496530baf758'; // Alle Caches
return tx;
}
// Prepare keydown F2 in filter screens of Search Map and search page.
function prepareKeydownF2InFilterScreen() {
if (settings_submit_log_button && $('button.gc-filter-toggle')[0] && !$('.clickevent_to_filter_button_set')[0]) {
$('button.gc-filter-toggle').addClass('clickevent_to_filter_button_set');
$('button.gc-filter-toggle')[0].addEventListener('click', function() {
function waitForFilterScreen(waitCount) {
if ($('.gc-search-filter-header')[0] && $('button[data-event-label="Filters - Apply"]')[0]) {
$('button[data-event-label="Filters - Apply"]').each(function() {
if (!$(this)[0].innerHTML.match(/(F2)/)) {
$(this)[0].innerHTML += " (F2)";
}
});
if ($('.gc-search-filter-header:not(.keydownF2_to_window_set)')) {
function keydownF2InFilterScreen(e) {
// Remove click event. Otherwise it can be executed multiple times which can lead to an Error (Error: Abort fetching component).
window.removeEventListener('keydown', keydownF2InFilterScreen, true);
$('.gc-search-filter-header').removeClass('keydownF2_to_window_set');
if (e.keyCode == 113 && noSpecialKey(e)) {
$('button[data-event-label="Filters - Apply"]:first').click();
}
}
$('.gc-search-filter-header').addClass('keydownF2_to_window_set');
window.addEventListener('keydown', keydownF2InFilterScreen, true);
}
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForFilterScreen(waitCount);}, 50);}
}
waitForFilterScreen(0);
}, false);
}
}
// Count of logs displayed when starting the listing.
function countOfLogsInListing() {
var logsCountSign = ' 0' + settings_show_all_logs_count;
var logsCount = parseInt(logsCountSign);
if (logsCount < 30) logsCount = 30;
else if (logsCount > 500) logsCount = 500;
else if (logsCount%2 != 0) logsCount += 1;
return logsCount;
}
// Output field separator.
function separator(output) {
if (output == '') return '';
else return ' | ';
}
// Get favorite score and use in custom function.
function getFavoriteScore(gccode, func) {
$.ajax({
type: "GET",
cache: false,
url: '/api/proxy/web/v1/geocache/'+gccode+'/favoritepoints/score',
success: function(scoreResult) {
var score = 0;
if (scoreResult) score = scoreResult;
if (score > 100) score = 100;
func(score);
}
});
}
// Show text in Markdown.
// If HTML code is also to be processed, SafeMode must not be used.
// If toolbar (class mdd_toolbar) or resizebar (class mdd_resizebar) is not built, it must be noted here.
function showInMarkdown(side, SafeMode = true, toolbar = true, resizebar = true) {
var md = side.MarkdownDeep({
SafeMode: SafeMode,
toolbar: toolbar,
resizebar: resizebar,
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()
});
}
////////////////////////////////////////
// 6.3 GC - User defined searchs ($$cap) (User defined searchs on the geocaching webpages.)
////////////////////////////////////////
function create_config_css_search() {
var css = "";
css += ".btn-context {";
css += " border: 0;";
css += " height: 40px;";
css += " margin-top: -4px;";
css += " text-indent: -9999px;";
css += " width: 30px;";
css += " margin-left: -8px;";
css += " margin-right: 10px;}";
css += ".btn-user {";
css += " background-color: transparent;";
css += " background-image: none;";
css += " border-color: #fff;";
css += " border-radius: 3px;";
css += " clear: both;";
css += " color: #fff;";
css += " margin-top: 0px;}";
css += ".filters-toggle {";
css += " display: inline-flex;}";
css += ".btn-user-active, .btn-user:hover, .btn-user:active {";
css += " background-color: #00b265;";
css += " border-color: #00b265;}";
css += ".btn-iconsvg {";
css += " -webkit-appearance: none;";
css += " width: unset !important;}";
css += ".btn-iconsvg svg {";
css += " width: 22px;";
css += " height: 22px;";
css += " margin-right: 3px;}";
css += ".add-list li {";
css += " padding: 2px 0;}";
css += ".add-list {";
css += " padding-bottom: 5px;}";
appendCssStyle(css);
}
function saveFilterSet() {setValue("settings_search_data", JSON.stringify(settings_search_data));}
function actionOpen(id) {
for (var i = 0; i < settings_search_data.length; i++) {
if (settings_search_data[i].id == id) {
document.location.href = settings_search_data[i].url;
break;
}
}
}
function actionRename(id, name) {
for (var i = 0; i < settings_search_data.length; i++) {
if (settings_search_data[i].id == id) {
settings_search_data[i].name = name;
saveFilterSet();
break;
}
}
}
function actionUpdate(id, page) {
for (var i = 0; i < settings_search_data.length; i++) {
if (settings_search_data[i].id == id) {
settings_search_data[i].url = page.split("#")[0];
settings_search_data[i].url = settings_search_data[i].url.replace(/&MfsId=(\d+)/, "") + "&MfsId=" + settings_search_data[i].id;
saveFilterSet();
break;
}
}
}
function actionNew(name, page) {
// Find latest id.
var i = settings_search_data.length;
var id = -1;
for (var i = 0; i < settings_search_data.length; i++) {
if (id < settings_search_data[i].id) id = settings_search_data[i].id;
}
settings_search_data[i] = {};
settings_search_data[i].id = id+1;
settings_search_data[i].name = name;
settings_search_data[i].url = page.split("#")[0];
settings_search_data[i].url = settings_search_data[i].url.replace(/&MfsId=(\d+)/, "") + "&MfsId=" + settings_search_data[i].id;
saveFilterSet();
}
function actionSearchDelete(id) {
var tmp = [];
for (var i = 0; i < settings_search_data.length; i++) {
if (settings_search_data[i].id != id) tmp[tmp.length] = settings_search_data[i];
}
settings_search_data = tmp;
saveFilterSet();
}
function updateUI() {
if ($("#searchContextMenu").length == 0) {
var html = "";
html += '
';
html += '
';
html += '
';
html += '
Save
';
html += '
';
html += '
';
html += '
Rename
';
html += '
Update
';
$("#ctxMenu").html(html);
$('#btn-save').click(function() {
var name = $("#nameSearch").val();
if (name == "") {
alert("Insert name!");
$("#nameSearch").css('background-color', '#ffc9c9');
return;
} else {
actionNew(name, document.location.href);
$("#nameSearch").css('background-color', '#ffffff');
}
hideCtxMenu();
});
$('#btn-rename').click(function() {
var id = $(this).data('id');
var name = $("#filter-name-rename").val();
actionRename(id, name);
updateUI();
});
$('#btn-update').click(function() {
var id = $(this).data('id');
var update = (document.location.href.indexOf("?")>=0?true:false);
if (update) {
actionUpdate(id, document.location.href);
hideCtxMenu();
}
});
}
$("#filter-edit").hide();
if ($(".results").length != 0) $("#filter-new").show();
var html = "";
if (settings_search_data.length) {
settings_search_data.sort(function(a, b){return a.name.toUpperCase()>b.name.toUpperCase();});
}
for (var i = 0; i < settings_search_data.length; i++) {
html += '
';
var id = 'data-id="'+settings_search_data[i].id+'"';
var t = (settings_search_data[i].url == document.location.href.split("#")[0])?true:false;
html += ''+(t?'':'')+settings_search_data[i].name+(t?'':'')+'';
html += '';
html += '';
html += '
';
}
$("#filterlist").html(html);
$('.action-open').click(function() {
var id = $(this).data('id');
actionOpen(id);
});
$('.action-delete').click(function() {
var id = $(this).data('id');
actionSearchDelete(id);
updateUI();
});
$('.action-rename').click(function() {
var id = $(this).data('id');
$('#filter-new').hide();
$('#filter-edit').show();
$('#btn-rename').data('id', id);
$('#btn-update').data('id', id);
var update = (document.location.href.indexOf("?")>=0?true:false);
if (update) $('#div-btn-update').show();
else $('#div-btn-update').hide();
$("#filter-name-rename").val("n/a");
for (var i = 0; i < settings_search_data.length; i++) {
if (settings_search_data[i].id == id) {
$("#filter-name-rename").val(settings_search_data[i].name);
$('#filterName').text(settings_search_data[i].name);
break;
}
}
});
}
function hideCtxMenu() {
$('#ctxMenu').hide();
$('#filterCtxMenu').removeClass('btn-user-active');
}
//--> #2170 #2055 Temporäre Deaktivierung des "Manage Filter Sets" Buttons bis die Funktionalität wieder hergestellt ist.
settings_search_enable_user_defined = false;
//<-- #2170 #2055
if (settings_search_enable_user_defined && is_page("find_cache")) {
try {
if (!($(".results").length || settings_search_data.length)) {
} else {
function waitForSearchForm(waitCount) {
if ($("#gc-search-form")[0]) {
$("#gc-search-form").append('Manage Filter Sets');
$("#gc-search-form").append('');
$('#filterCtxMenu').click(function(e) {
e.preventDefault();
var element = $('#ctxMenu');
if (element.css('display') == 'none') {
updateUI();
element.show();
$(this).addClass('btn-user-active');
} else {
element.hide();
$(this).removeClass('btn-user-active');
}
});
var currentFilter = "";
for (var i = 0; i < settings_search_data.length; i++) {
if (settings_search_data[i].url == document.location.href.split("#")[0]) {
currentFilter = "Current Filter Set: "+settings_search_data[i].name;
}
}
$(".button-group-dynamic").append(''+currentFilter+'');
// Close the dialog div if a mouse click outside.
$(document).mouseup(function(e) {
var container = $('#ctxMenu');
if (container.css('display') != 'none') {
if (!container.is(e.target) && !($('#filterCtxMenu').is(e.target)) && // If the target of the click isn't the container...
container.has(e.target).length === 0) { // ... nor a descendant of the container
container.hide();
$('#filterCtxMenu').removeClass('btn-user-active');
}
}
return false;
});
// Prepare keydown F2 in filter screen of search page.
prepareKeydownF2InFilterScreen();
} else {waitCount++; if (waitCount <= 100) setTimeout(function(){waitForSearchForm(waitCount);}, 100);}
}
waitForSearchForm(0);
}
} catch(e) {gclh_error("User defined search",e);}
}
///////////////////////////////
// 6.4 GC - Find Player ($$cap) (Find Player on the geocaching webpages.)
///////////////////////////////
// Create and hide the "Find Player" Form.
function createFindPlayerForm() {
btnClose();
if (checkTaskAllowed("Find Player", true) == false) return;
if ($('#bg_shadow')[0]) {
if ($('#bg_shadow')[0].style.display == "none") $('#bg_shadow')[0].style.display = "";
} else buildBgShadow();
if ($('#findplayer_overlay')[0] &&$('#findplayer_overlay')[0].style.display == "none") $('#findplayer_overlay')[0].style.display = "";
else {
// Overlay erstellen
var html = "";
html += "
";
html += "" + show_help("This option should help you to come back to an efficient configuration set, after some experimental or other motivated changes. This option load a reasonable standard configuration and overwrite your configuration data in parts.
The following data are not overwrited: Home coordinates; homezone circle and multi homezone circles; custom links for listing; own \"copy data to clipboard\" entries; date format; log templates; cache log, trackable log and other signatures; friends data; links in Linklist and differing description and custom links in Linklist. Dynamic data, like for example autovisits for named trackables, are not overwrited too.
After reset, choose button \"Close\" and go to GClh II Config to skim over the set of data.") + " ";
html += "" + show_help("This option reorganize the configuration set. Unused parameters of older script versions are deleted. And the dynamic data like the autovisit settings for every trackable, the seen friends data of founds and hides, the DropBox token and the hidden banners are deleted too. Especially the VIPs, VUPs and Linklist settings are not deleted of course.
After reset, choose button \"Close\".") + "
";
html += "" + show_help("This option could help you with problems around your home coordinates, like for example with your main homezone, with nearest lists or with your home coordinates itself. Your home coordinates are not deleted at GC, but only in GClh II Config.
After reset, you have to go to the account settings page of GC to the area \"Home Location\", so that GC little helper II can save your home coordinates again automatically. You have only to go to this page, you have nothing to do at this page, GC little helper II save your home coordinates automatically. Or you enter your home coordinates manually in GClh II Config.
At last, choose button \"Close\".");
html += " (After reset, go to Home Location )" + " ";
html += "" + show_help("This option could help you with problems with your own trackables lists, which based on an special id, the uid. The uid are not deleted at GC, but only in GClh II Config.
After reset, you have to go to your dashboard, so that GC little helper II can save your uid again automatically. You have only to go to this page, you have nothing to do at this page, GC little helper II save the uid automatically.
At last, choose button \"Close\".");
html += " (After reset, go to Dashboard )" + "
";
html += "
";
html += " ";
html += "
";
html += "";
html += "
";
html += "
";
html += "
";
html += "
";
html += "There are numerous persons who have shaped and advanced the tool with their time and their know-how. Many thanks to all of you!
";
html += "
";
html += " ";
html += "
Project Management
Development Lead
Development
Bug Reporting" + show_help("Bugs reported to the issue system on GitHub.") + "
";
html += " ";
html += " ";
//--> $$006
// Bezeichnung: GC Name Abw. GitHub Name ProjM DevL Dev BugR Separator
html += thanksLineBuild("2Abendsegler", "", true, true, true, true, false);
html += thanksLineBuild("capoaira", "", false, true, true, true, false);
html += thanksLineBuild("Die Batzen", "DieBatzen", false, true, true, true, false);
html += thanksLineBuild("Ruko2010", "", false, 'grey', true, true, true );
// Rangliste Development von hier https://github.com/2Abendsegler/GClh/graphs/contributors.
html += thanksLineBuild("CachingFoX", "", false, false, true, true, false);
html += thanksLineBuild("marGEOcus", "", false, false, true, true, false); // Changed from "Herr Ma".
html += thanksLineBuild("Dratenik", "", false, false, true, false, false);
html += thanksLineBuild("ChristianGK", "ChristianGK-GC", false, false, true, true, false);
html += thanksLineBuild("DrakMrak", "", false, false, true, false, false);
html += thanksLineBuild("radlerandi", "", false, false, true, false, false);
html += thanksLineBuild("Nicole1338", "", false, false, true, false, false);
html += thanksLineBuild("CastParo", "LittleJohn-DD", false, false, true, true, false);
html += thanksLineBuild("ramirez_", "ramirezhr", false, false, true, false, false);
html += thanksLineBuild("king-ton", "", false, false, true, false, false);
html += thanksLineBuild("dontpänic", "haarspalter", false, false, true, false, false);
html += thanksLineBuild("Bananeweizen", "", false, false, true, false, false);
html += thanksLineBuild("sunhillduo", "Yannick-XY", false, false, true, false, false);
html += thanksLineBuild("ColleIsarco", "", false, false, true, true, false);
html += thanksLineBuild("Pzi", "PetziAt", false, false, true, false, false);
html += thanksLineBuild("", "sdennler", false, false, true, false, false);
html += thanksLineBuild("bruzie", "", false, false, true, false, false);
html += thanksLineBuild("", "ztNFny", false, false, true, true, false); // GC user changed from ztNFny. Could not find new name.
html += thanksLineBuild("FoxFil", "", false, false, true, true, false);
html += thanksLineBuild("rambii", "", false, false, true, false, true);
// Bug Reporting alphabetisch.
html += thanksLineBuild("", "allyourcodearebelongtous", false, false, false, true, false);
html += thanksLineBuild("", "AndyPuma", false, false, false, true, false);
html += thanksLineBuild("", "anvanlaer", false, false, false, true, false);
html += thanksLineBuild("arbor95", "", false, false, false, true, false);
html += thanksLineBuild("Arnos99", "", false, false, false, true, false);
html += thanksLineBuild("barnold", "barnoldGEOC", false, false, false, true, false); // Further GitHub name barnoldbert.
html += thanksLineBuild("bogmen", "Bogmen", false, false, false, true, false);
html += thanksLineBuild("BlueEagle23", "", false, false, false, true, false);
html += thanksLineBuild("Cappa-d", "", false, false, false, true, false);
html += thanksLineBuild("Chrono81", "", false, false, false, true, false);
html += thanksLineBuild("", "dcjkfgdjhd", false, false, false, true, false);
html += thanksLineBuild("dennistreysa", "", false, false, false, true, false);
html += thanksLineBuild("Die C-SAU Bande", "UJstr", false, false, false, true, false);
html += thanksLineBuild("Donnerknispel", "", false, false, false, true, false);
html += thanksLineBuild("Fassenachterin", "", false, false, false, true, false);
html += thanksLineBuild("", "gboye", false, false, false, true, false);
html += thanksLineBuild("", "jet2mike", false, false, false, true, false);
html += thanksLineBuild("Jipem", "", false, false, false, true, false);
html += thanksLineBuild("joemadder", "", false, false, false, true, false);
html += thanksLineBuild("lostinthegarden", "Gitve3jf", false, false, false, true, false);
html += thanksLineBuild("Lineflyer", "", false, false, false, true, false);
html += thanksLineBuild("Magpie42", "MagpieFourtyTwo", false, false, false, true, false);
html += thanksLineBuild("☺Mitchsa & firefly70", "Mitchsa", false, false, false, true, false);
html += thanksLineBuild("muddypuddles", "MuddyPuddles", false, false, false, true, false);
html += thanksLineBuild("MrZaibot", "", false, false, false, true, false);
html += thanksLineBuild("PHIL", "gcPhil", false, false, false, true, false);
html += thanksLineBuild("Pontiac_CZ", "PontiacCZ", false, false, false, true, false);
html += thanksLineBuild("reodor09", "", false, false, false, true, false);
html += thanksLineBuild("RoRo", "RolandRosenfeld", false, false, false, true, false);
html += thanksLineBuild("stepborc", "", false, false, false, true, false);
html += thanksLineBuild("TiBaWe", "", false, false, false, true, false);
html += thanksLineBuild("Tungstène", "Tungstene", false, false, false, true, false);
html += thanksLineBuild("V60", "V60GC", false, false, false, true, false);
html += thanksLineBuild("vylda", "", false, false, false, true, false);
html += thanksLineBuild("winkamol", "", false, false, false, true, false);
var thanksLastUpdate = "15.02.2026";
//<-- $$006
html += " ";
html += "
";
html += "Last update: " + thanksLastUpdate + " ";
html += "
";
html += " ";
html += "
";
html += "
";
html += " ";
html += "
"+prepareHideable.replace("#id#","global")+"
";
html += "
";
html += "" + show_help("Your home coordinates are automatically updated if you change them on the geocaching page. You can also enter it here manually. These coordinates are used to show your home zone on the map and also for various links to find nearby caches.") + " ";
html += checkboxy('settings_set_default_langu', 'Set default language ');
html += "" + show_help("Here you can set the default language for the geocaching pages. In the case that apps change the language on the geocaching pages, the default language is automatically set again.") + " ";
html += " " + "Page width px" + show_help("With this option you can expand the page width on the geocaching pages. The default value on the geocaching pages is 950 pixels.") + " ";
html += checkboxy('settings_submit_log_button', 'Activate F2 key to finish certain operations') + show_help("With this option you are able to finish certain operations by pressing the F2 key or by pressing the Ctrl and s keys together, instead of scrolling to the button and pressing the button with the mouse.
Supported operations: - Logging: Post new cache log - Logging: Post changed cache log - Logging: Post new trackable log - Logging: Post changed trackable log - Cache listing: Save Personal Cache Note - Pocket Query: Save Pocket Query - Search Map: Apply filters - Search caches: Apply filters - Hide a cache: Complete process - Create a bookmark for a cache (old bookmark process)") + " ";
html += "
Header Layout" + "
";
html += checkboxy('settings_change_header_layout', "Change header layout") + show_help("This allows you to redesign the header layout on the geocaching pages.") + " ";
html += " " + checkboxy('settings_show_smaller_gc_link', 'Show smaller GC logo top left') + " ";
html += " " + checkboxy('settings_remove_logo', 'Remove GC logo top left') + show_help("With this option you can remove the GC logo top left on GC pages. This feature is not fully integrated in the diverse possibilities of the header layout and the navigation menus.") + " ";
html += " " + checkboxy('settings_remove_message_in_header', 'Remove message center icon top right') + show_help("With this option you can remove the message center icon top right on GC pages. You will not be informed longer about new messages.") + " ";
html += " " + checkboxy('settings_gc_tour_is_working', 'Reserve place for GC Tour icon') + show_help("If the script GC Tour is running, you can reserve a place top left on GC pages for the GC Tour icon.") + " ";
html += " " + checkboxy('settings_fixed_header_layout', 'Arrange header layout on content') + show_help("With this option you can arrange the header width on the width of the content of GC pages. This is an easy feature with some restrictions, like for example the available place, especially for horizontal navigation menues.
This feature is available on GC pages in the oldest design like for example cache and trackable listings, pocket queries, nearest lists, old dashboards (profiles), statistics, watchlists and drafts, to name just a few.
On map page and on pages in the newer and newest design it is not available, partly because the content on these pages are not yet in an accurate width, like the newer search cache page or the message center page. Also this feature is not fully integrated in the diverse possibilities of the header layout and the navigation menus. But we hope the friends of this specific header design can deal with it.") + " ";
html += checkboxy('settings_bookmarks_on_top', "Show Linklist on top") + show_help("Show the Linklist on the top of GC pages, beside the other links. You can configure the links in the Linklist at the end of this configuration page.") + " ";
html += checkboxy('settings_upgrade_button_header_remove', 'Remove Upgrade button (basic members)') + " ";
html += "
User Related Layout" + "
";
var content_settings_show_vip_list = "The VIPs (Very Important Persons) feature consist of - the user related icon on numerous pages, - the VIP lists in the cache and event listings and - the VIP list in the dashboard.
You can add any user on numerous pages to your VIP lists by clicking the little VIP icon beside the user. If it is green, this person is a VIP.
The VIP lists in the cache and event listings are lists, displayed at the right side in the cache and event listings. The main VIP list only shows VIPs and the logs of VIPs, which already posted a log to this listing. So, you are able to see which of your VIPs already found this cache.
On your dashboard page there is an overview list of all your VIPs.";
html += checkboxy('settings_show_vip_list', 'Process VIPs') + show_help(content_settings_show_vip_list + "
You can adjust details about this feature in the Listing and Dashboard topics.") + " ";
var content_settings_process_vup = "The VUPs (Very Unimportant Persons) feature consist of - the user related icon on numerous pages, - the restrict display of content from this user in the cache and event listings and - the VUP list in the dashboard.
You can add any user on numerous pages to your VUP list by clicking the little VUP icon beside the user. If it is red, this person is a VUP.
In the logs of VUPs in the cache and event listings will only shown \"censored\" instead of the log text.
On your dashboard page there is an overview of all your VUPs.";
html += " " + checkboxy('settings_process_vup', 'Process VUPs') + show_help(content_settings_process_vup + "
You can adjust details about this feature in the Listing and Dashboard topics.") + " ";
html += checkboxy('settings_show_mail', 'Show mail link beside user') + show_help("With this option there will be an small mail icon beside every user on numerous pages. With this icon you get directly to the mail form to mail to this user. If you click it for example when you are in a listing, the cachename or GC code can be inserted into the mail form about placeholders in the mail / message form template.") + " ";
html += " " + checkboxy('settings_mail_icon_new_win', 'Open mail form in new browser tab') + " ";
html += checkboxy('settings_show_message', 'Show message link beside user') + " ";
html += " " + checkboxy('settings_message_icon_new_win', 'Open message form in new browser tab') + " ";
html += "
Hiding" + "
";
html += checkboxy('settings_hide_advert_link', 'Hide link to advertisement instructions') + " ";
html += checkboxy('settings_hide_facebook', 'Hide login procedures via Facebook, Google, Apple') + " ";
html += checkboxy('settings_hide_socialshare', 'Hide social sharing via Facebook, Twitter (X)') + " ";
html += checkboxy('settings_hide_feedback_icon', 'Hide feedbacks and surveys') + show_help('With this option you can hide for example the green feedback icon bottom right on a page or the survey about the purpose of the visit of the cache owner dashboard page.') + " ";
html += checkboxy('settings_remove_banner', 'Hide a blue banner (added close button to each of them)') + show_help("With blue banners below the page header, new page layouts or new features are pointed out. If you don't want that, you don't have the option to hide the annoying banner. This parameter adds a button to decide which banners to hide. If the parameter is deactivated, the hidden banners are deleted again.") + " ";
html += "
List Layout" + "
";
html += "
";
html += " ";
html += "
Show lines in
";
html += "
lists" + show_help("Lists are all common lists but not the trackable listings and not the cache or event listings.") + "
";
html += "
cache listings
";
html += "
trackable listings
";
html += "
in color
";
html += " ";
html += " ";
html += "
for zebra" + show_help("With this options you can color every second line in the specified lists in the specified \"alternating\" color.") + "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
for you" + show_help("With this options you can color your logs respectively your founds in the specified lists in the specified color.") + "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
for owners
";
html += "
";
html += "
";
html += "
";
html += "
for reviewers
";
html += "
";
html += "
";
html += "
";
html += "
for VIPs
";
html += "
";
html += "
";
html += "
";
html += " ";
html += "
";
html += "
";
html += "
"+prepareHideable.replace("#id#","config") + "" + show_help("This topic contains the settings for the current page itself, the GClh II Config or short Config.") + "
";
html += "
";
html += checkboxy('settings_f4_call_gclh_config', 'Call via F4 key') + show_help("This option allows you to access the GClh II Config (this page) by pressing the F4 key on your keyboard from any GC page.") + " ";
html += checkboxy('settings_call_config_via_sriptmanager', 'Call via the script manager') + show_help("This option creates a link to the GClh II Config in the menu of the script manager (Tampermonkey, Violentmonkey ...). With a click on the icon of the script manager you get to the menu of the script manager. The link to the GClh II Config is then located below the GC little helper II. The link is available on any GC page.") + " ";
html += checkboxy('settings_f2_save_gclh_config', 'Save via F2 key') + show_help("This option allows you to save the GClh II Config (this page) by pressing the F2 key or by pressing the Ctrl and s keys together on your keyboard instead of scrolling down and selecting the Save button.") + " ";
html += checkboxy('settings_esc_close_gclh_config', 'Close via ESC key') + show_help("This option allows you to close the GClh II Config (this page) by pressing the ESC key on your keyboard instead of scrolling down and selecting the Close button.") + " ";
html += checkboxy('settings_show_save_message', 'Show info message when data are saved') + " ";
html += checkboxy('settings_sort_default_bookmarks', 'Sort the default links for the Linklist') + show_help("This option allows you to sort the default links for the Linklist by description. You can configure these default links for use in your Linklist at the bottom of this GClh II Config.
Changing this option will only take effect after saving.") + " ";
html += checkboxy('settings_make_config_main_areas_hideable', 'Make the main areas hideable') + show_help("With this option you can show and hide the main areas in the GClh II Config (this page) with a left mouse click. With a right click you can show and hide all main areas in the GClh II Config.
Changing this option will only take effect after saving.") + " ";
html += "
Color Scheme" + show_help("With these parameters the color scheme of the GClh II screens and fields can be adjusted. The settings affect the screens of the GClh II Config, with the main, reset and thanks screens, as well as the GClh II Sync screen and the GClh II Find player screen.
To change a color, click on a color code. With the small buttons behind the color codes you can go back to the default color. With the preview buttons you can view and try out the settings for the colors before you save your own color scheme. In the first line there are ready-made color schemes.
The settings also have an effect on the search field in the header of the geocaching pages, provided this feature is activated.
Within the GClh II Config main screen there is also the color scheme for the versions, in which the last three versions are highlighted in color. The last version is given the color. For the previous two, the intensity of the color is reduced.") + "
";
html += "
";
html += "
Color Schemes
";
var c = "
#1
Preview
";
html += c.replace(/#1/g, 'Coloring background').replace(/#2/g, 'bg').replace(/#3/, settings_color_bg);
html += c.replace(/#1/g, 'Coloring help texts').replace(/#2/g, 'ht').replace(/#3/, settings_color_ht);
html += c.replace(/#1/g, 'Coloring input fields').replace(/#2/g, 'if').replace(/#3/, settings_color_if);
html += c.replace(/#1/g, 'Coloring buttons with mouse' + show_help("The color of the buttons can be set here, in case the mouse is over it.")).replace(/#2/g, 'bh').replace(/#3/, settings_color_bh);
html += c.replace(/#1/g, 'Coloring buttons').replace(/#2/g, 'bu').replace(/#3/, settings_color_bu);
html += c.replace(/#1/g, 'Coloring frame of fields, screens').replace(/#2/g, 'bo').replace(/#3/, settings_color_bo);
html += c.replace(/#1/g, 'Coloring new versions').replace(/#2/g, 'nv').replace(/#3/, settings_color_nv);
html += "
";
html += checkboxy('settings_color_navi_search', 'Coloring also search field in page header') + " ";
html += checkboxy('settings_hide_colored_versions', 'Hide color scheme of the versions') + show_help("With this option the color representation of the versions and the version numbers in the GClh II Config (this page) can be selected.
Changing this option will only take effect after saving.") + " ";
html += "";
html += "
"+prepareHideable.replace("#id#","sync") + "" + show_help("This topic contains the settings for the GClh II Sync or short Sync.") + "
";
html += "
";
html += checkboxy('settings_f10_call_gclh_sync', 'Call via F10 key') + show_help("This option allows you to access the GClh II Sync by pressing the F10 key on your keyboard from any GC page.") + " ";
html += checkboxy('settings_call_sync_via_sriptmanager', 'Call via the script manager') + show_help("This option creates a link to the GClh II Sync in the menu of the script manager (Tampermonkey, Violentmonkey ...). With a click on the icon of the script manager you get to the menu of the script manager. The link to the GClh II Sync is then located below the GC little helper II. The link is available on any GC page.") + " ";
html += checkboxy('settings_show_save_messageX0', 'Show info message when data are imported') + " ";
html += checkboxy('settings_sync_autoImport', 'Automatic synchronization with your Dropbox') + show_help("With this option you can automatically synchronize the data every 10 hours via the GClh II Sync from your Dropbox. That means uploading the data from your Dropbox to the GClh II Sync.") + " ";
html += "
";
html += checkboxy('settings_show_create_pq_from_pq_splitter', "Show feature to create PQs on Project-GC's PQ Splitter page") + show_help("On the Project-GC page there is a feature to split caches in pocket queries into packets of 1000 and 500 caches. For this purpose, lists with entries with publish date from and publish date to are generated. Thank you for this feature!
With the help of the GC little helper II feature, the entries in these lists can be used to create corresponding pocket queries automatically. Deactivate this option if you do not want this feature to be displayed on the Project-GC page.") + " ";
html += "
List of Pocket Queries
";
html += checkboxy('settings_fixed_pq_header', 'Show fixed header and footer') + show_help("Convenient for large list of pocket queries. With this option, you get a permanent view of the headers (weekday information) and footer (the number of running / remaining PQs) even if your list of pocket quieries is larger than your monitor.") + " "
html += checkboxy('settings_compact_layout_list_of_pqs', 'Show compact layout') + " ";
html += " " + checkboxy('settings_both_tabs_list_of_pqs_one_page', 'Show both tabs of one page') + show_help("Show the both tabs \"Active Pocket Queries\" and \"Pocket Queries Ready for Download\" together of one page.") + " ";
html += "
Pocket Query
";
html += checkboxy('settings_pq_warning', "Show a message in case of wrong settings") + show_help("Show a message if one or more options are in conflict. This helps to avoid pocket queries without results.") + " ";
html += checkboxy('settings_pq_previewmap','Show preview map for coordinates from origin') + " ";
html += ''+ " ";
html += "
Default Values for a New Pocket Query
";
html += checkboxy('settings_pq_set_cachestotal', "Set number of caches to ") + " ";
html += checkboxy('settings_pq_option_ihaventfound', "Enable option \"I haven't found\"") + " ";
html += checkboxy('settings_pq_option_idontown', "Enable option \"I don't own\"") + " ";
html += checkboxy('settings_pq_option_ignorelist', "Enable option \"Are not on my ignore list\"") + " ";
html += checkboxy('settings_pq_option_isenabled', "Enable option \"Is Enabled\"") + " ";
html += checkboxy('settings_pq_option_filename', "Enable option \"Include pocket query name in download file name\"") + " ";
html += checkboxy('settings_pq_set_difficulty', "Set difficulity ") + gclh_createSelectOptionCode("settings_pq_difficulty", dt_display, settings_pq_difficulty) + ' ' + gclh_createSelectOptionCode("settings_pq_difficulty_score", dt_score, settings_pq_difficulty_score) + " ";
html += checkboxy('settings_pq_set_terrain', "Set terrain ") + gclh_createSelectOptionCode("settings_pq_terrain", dt_display, settings_pq_terrain) + ' ' + gclh_createSelectOptionCode("settings_pq_terrain_score", dt_score, settings_pq_terrain_score) + " ";
html += checkboxy('settings_pq_automatically_day', "Generate pocket query today") + show_help("The server time is used to determine the day of the week for the creation of the pocket query.") + " ";
html += "
Pocket Query Caches List
";
var content_settings_show_log_it = checkboxy('settings_show_log_it', 'Show \"Log it\" icon in PQ, nearest and recently viewed caches list') + show_help("The GC little helper II \"Log it\" icon is displayed beside cache titles in a pocket query caches list, in a nearest caches list and in a recently viewed caches list. If you click it, you will be redirected directly to the log form.
You can use it too as basic member to log premium member only (PMO) caches.") + " ";
html += content_settings_show_log_it;
html += checkboxy('settings_compact_layout_pqs', 'Show compact layout') + " ";
html += " " + checkboxy('settings_fav_proz_pqs', 'Show favorites percentage') + " ";
var content_settings_open_tabs = " " + checkboxy('settings_open_tabs_pqs', 'Show a button to open selected caches in new browser tabs') + show_help("This option displays a button to open selected caches in new browser tabs. The feature is available in a pocket query caches list and in a nearest caches list if the compact layout feature for the pocket query caches list respectively the compact layout for the nearest caches list is activated.
If you have only two or three caches to open, you can also open the listings manually. However, if you want to do this for a full page with for example twenty caches, this feature can be helpful.") + " ";
html += content_settings_open_tabs;
html += "
";
html += "
"+prepareHideable.replace("#id#","nearestlist")+"
";
html += "
";
html += checkboxy('settings_redirect_to_map', 'Redirect cache search lists to map display') + show_help("If you enable this option, you will be automatically redirected from the older cache search lists (nearest lists) to map display. This is only possible in search lists with a link to the map display.
Please note that a display of the search list is no longer possible, because it is always redirected to the map display.") + " ";
html += checkboxy('settings_show_nearestuser_profil_link', 'Show profile link at search lists for caches created or found by user') + show_help("This option adds an link to the public user profile, when you are searching for caches created or found by a certain user.") + " ";
html += content_settings_show_log_it.replace("show_log_it","show_log_itX0");
html += checkboxy('settings_compact_layout_nearest', 'Show compact layout') + " ";
html += " " + checkboxy('settings_fav_proz_nearest', 'Show favorites percentage') + " ";
html += content_settings_open_tabs.replace('settings_open_tabs_pqs','settings_open_tabs_nearest');
html += "
";
html += "
"+prepareHideable.replace("#id#","recview")+"
";
html += "
";
html += content_settings_show_log_it.replace("show_log_it","show_log_itX1");
html += checkboxy('settings_compact_layout_recviewed', 'Show compact layout') + " ";
html += " " + checkboxy('settings_fav_proz_recviewed', 'Show favorites percentage') + " ";
html += "
";
html += checkboxy('settings_lists_compact_layout', 'Show compact layout') + show_help("With this option the list of bookmark lists, the bookmark lists, the favorites list and the ignore list is displayed in compact layout.") + " ";
var content_status_line = "If the name of disabled and archived caches are specially represented and the identifier of premium member only caches are shown in an own column, the cache status line above the cache name is hidden.";
html += checkboxy('settings_lists_disabled', 'Show name of disabled caches ') + checkboxy('settings_lists_disabled_strikethrough', 'strike through, in color ');
html += "";
html += "" + show_help(content_status_line) + " ";
html += checkboxy('settings_lists_archived', 'Show name of archived caches ') + checkboxy('settings_lists_archived_strikethrough', 'strike through, in color ');
html += "";
html += "" + show_help(content_status_line) + " ";
html += checkboxy('settings_lists_icons_visible', 'Set visibility of cache type icons and log status icons') + show_help("The cache type icon and the log status icon are sometimes slightly invisible and sometimes visible, if the cache is disabled or archived. With this and the following options, you can set it consistently, if the cache is disabled or archived.") + " ";
html += " " + checkboxy('settings_lists_cache_type_icons_visible', 'Make the cache type icon visible when the cache is disabled or archived') + " ";
html += " " + checkboxy('settings_lists_log_status_icons_visible', 'Make the cache status icon visible when the cache is disabled or archived') + " ";
html += checkboxy('settings_lists_premium_column', 'Set identifier of premium member only caches in own column') + show_help(content_status_line) + " ";
html += checkboxy('settings_lists_found_column_bml', 'Set found smiley in own column') + show_help("Only in bookmark lists, not in favorites list and ignore list.") + " ";
html += checkboxy('settings_lists_show_log_it', 'Show \"Log it\" icon') + show_help("The GC little helper II \"Log it\" icon is displayed beside cache titles. If you click it, you will be redirected directly to the log form. It is only available in bookmark lists, not in favorites list and ignore list.
You can use it too as basic member to log premium member only (PMO) caches.") + " ";
html += checkboxy('settings_lists_back_to_top', 'Hide \"Back to top\" icon') + " ";
html += checkboxy('settings_lists_show_dd', 'Show dropdown menu with additional stuff') + show_help("Add an icon with dropdown menu in own and foreign bookmark lists, in the favorites list and in the ignore list with additional GC little helper II functionality.") + " ";
html += " " + checkboxy('settings_lists_hide_desc', 'Show/hide cache descriptions') + show_help("Add an entry in the dropdown menu to show and hide the cache descriptions.") + " ";
html += " " + checkboxy('settings_lists_upload_file', 'Upload caches from file') + show_help("Add an entry in the dropdown menu to upload caches from a file into the bookmark list.
The caches in .gpx and .loc files are expected in the standard scheme of such files.
The caches in other files are expected with an usual separator like for example a blank, a komma or an other usual sign.") + " ";
html += " " + checkboxy('settings_lists_open_tabs', 'Open selected caches in new browser tabs') + show_help("This feature add an entry in the dropdown menu to open selected caches in new browser tabs. The feature is available in own and foreign bookmark lists and in the ignore list.
If you have only two or three caches to open, you can also open the listings manually. However, if you want to do this for a full page with for example twenty caches, this feature can be helpful.") + " ";
html += checkboxy('settings_bm_changed_and_go', 'After change of old bookmark go to bookmark list automatically') + show_help("With this option you can switch to the bookmark list automatically after a change of a bookmark (old form). The confirmation page of this change will skip.") + " ";
html += "
";
html += "
"+prepareHideable.replace("#id#","friends")+"
";
html += "
";
html += checkboxy('settings_automatic_friend_reset', 'Reset difference counter on friends list automatically') + show_help("If you enable this option, the difference counter at friends list will automatically reset if you have seen the difference and if the day changed.") + " ";
html += checkboxy('settings_friendlist_summary', 'Show summary for new finds/hides in friends list') + show_help("With this option you can show a summary of all new finds/hides of your friends on the friends list page") + " ";
html += " " + checkboxy('settings_friendlist_summary_viponly', 'Show summary only for friends in VIP list') + " ";
html += checkboxy('settings_show_vup_friends', 'Show VUP icons on friends list') + show_help("With this option you can choose if VUP icons are shown addional on friends list or not. If you deactivate this option and a friend is a VUP, then the VIP icon is replaced by the VUP icon anyway. (VUP: Very unimportant person) (VIP: Very important person)") + " ";
html += "
";
html += "
"+prepareHideable.replace("#id#","hide")+"
";
html += "
";
html += checkboxy('settings_hide_cache_approvals', 'Auto set approval in hide cache process') + show_help("This option activates the checkbox for approval the \"terms of use agreement\" and the \"geocache hiding guidelines\" in the hide cache process.") + " ";
html += "
";
html += "
"+prepareHideable.replace("#id#","others")+"
";
html += "
";
html += checkboxy('settings_search_enable_user_defined', 'Enable user defined filter sets for geocache searchs') + show_help("This features enables you to store favorites filter settings in the geocache search and call them quickly.") + prem + " ";
html += checkboxy('settings_show_sums_in_watchlist', 'Show number of caches in your watchlist') + show_help("With this option the number of caches and the number of selected caches in the categories \"All\", \"Archived\" and \"Deactivated\", corresponding to the select buttons, are shown in your watchlist at the end of the list.") + " ";
html += checkboxy('settings_hide_archived_in_owned', 'Hide archived caches in owned list') + " ";
html += checkboxy('settings_show_button_for_hide_archived', 'Show button to display all, active or archived caches in owned list') + show_help('With this option a button is shown in owned caches list to display all caches, only active caches or only archived caches in the owned caches list.') + " ";
html += checkboxy('settings_compact_layout_cod', 'Show compact layout on your cache owner dashboard') + " ";
html += checkboxy('settings_show_button_fav_proz_cod', 'Show button to show the favorite percentage of your hidden caches') + show_help("Only for published and archived caches, not for events and unpublished caches.") + " ";
html += checkboxy('settings_show_compact_certitude_information', 'Show information overview on Certitude\'s solution page') + show_help("Show a compact information overview and a Copy to Clipboard button after successfully passing a Certitude page.") + " ";
html += checkboxy('settings_anonymous_on_certitude', 'Do not get listed on Certitude\'s solvers rank page') + show_help("Always activate the \"Stay anonymous\" checkbox. If the solution is correct, the nickname will not be listed in the ranking.") + " ";
html += newParameterOn2;
html += checkboxy('settings_improve_notifications', 'Improve notification list and notifications') + " ";
html += newParameterVersionSetzen('0.15') + newParameterOff;
html += newParameterOn1;
html += checkboxy('settings_dim_lost_trackables', 'Dim lost trackables in owned trackables view') + show_help("Lost trackables in owned trackables view can be visually dimmed so they are easier to distinguish from active trackables.") + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += "
";
html += "
"+prepareHideable.replace("#id#","maps")+"
";
html += "
";
html += checkboxy('settings_relocate_other_map_buttons', 'Relocate the buttons \"Search\" and \"Browse geocaches\" to other buttons above') + " ";
html += checkboxy('settings_searchmap_autoupdate_after_dragging', 'Automatic search for new caches after dragging or zooming') + show_help("Displayed caches are automatically updated when the map is moved or zoomed, the 'Search this area' button no longer needs to be pressed. The behavior is therefore similar to that of the browse map.
This feature requires Replace map layers in Search Map to be activated.") + onlySearchMap + " ";
html += checkboxy('settings_searchmap_compact_layout', 'Show compact layout on cache detail screen') + show_help("If compact layout is enabled and the name of disabled caches are specially represented, the cache status line above the cache name is hidden.") + onlySearchMap + " ";
html += checkboxy('settings_searchmap_disabled', 'Show name of disabled caches ') + checkboxy('settings_searchmap_disabled_strikethrough', 'strike through, in color ');
html += "";
html += "";
html += show_help("If compact layout is enabled and the name of disabled caches are specially represented, the cache status line above the cache name is hidden.") + onlySearchMap + ' ';
html += checkboxy('settings_searchmap_show_hint', 'Show hint of cache automatically on cache detail screen') + onlySearchMap + " ";
html += checkboxy('settings_searchmap_show_btn_save_as_pq', 'Show button "Save as Pocket Query"') + show_help("Adds a button in the sidebar of the Search Map to save the actual map view as a pocket query (like on the Browse Map). Note that not all filters on the map are also available on Pocket Query.") + onlySearchMap + " ";
html += " " + checkboxy('settings_save_as_pq_set_all', 'Set filter values "All"') + show_help("If filter values \"All\" are set and the map parameter \"Set defaults\" is enabled, the default values are still prevented from asserting themselves. Otherwise, the defaults prevail. This makes it possible, for example, to see caches found and not found on the map, this is \"All\". So you can see on the map whether you have been around here before. At the same time, however, a default value for \"I haven't found\" may be set in the PQ. After all, the caches found are of little interest in the PQ. That might sound complicated, but it can be valuable if you understand it because you don't have to make any more changes to the map's filter before generating the PQ.") + " ";
html += checkboxy('settings_map_show_btn_hide_header', 'Show button "Hide Header"') + ' '
html += checkboxy('settings_show_eventdayX0', 'Show weekday of an event') + show_help("With this option the day of the week will be displayed next to the event date.") + " ";
html += newParameterOn1;
html += checkboxy('settings_searchmap_show_cache_display_options', 'Show button for additional geocache display options') + show_help("With this option you can show a button for additional geocache display options on Search Map, e.g. show finds at corrected coordinates, hide DNFs or filter cache types.
This feature requires Replace map layers in Search Map to be activated.") + onlySearchMap + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += checkboxy('settings_searchmap_improve_add_to_list', 'Show compact layout in \"Add to list\" pop up to bookmark a cache') + onlySearchMap + prem + " ";
html += " " + "Maximum height of pop up px" + show_help("With this option you can choose the maximum height of the \"Add to list\" pop up to bookmark a cache from 130 up to 520 pixel. The default is 130 pixel, similar to the standard.") + " ";
html += "
Homezone Circles" + onlyBrowseMap + "
";
html += checkboxy('settings_show_homezone', 'Show homezone circles') + show_help("This option allows to draw homezone circles around coordinates on the map.") + " ";
html += "
";
html += "
";
html += "
";
html += "
Radius
";
html += "
Color" + show_help("Default color is \"0000FF\".") + "
";
html += "
Opacity" + show_help("Higher number is darker. Default opacity is \"10\".") + "
";
html += "
Coordinates
";
html += "
";
html += "
";
html += " ";
// Template.
var hztp = "
";
hztp += "
km
";
hztp += "
";
hztp += "
%
";
hztp += "
";
hztp += "
";
// Homezone circle.
var newHzEl = $('
').append($(hztp));
newHzEl.find('tr').attr('class', 'homezone_element');
newHzEl.find('.radius').attr('id', 'settings_homezone_radius');
newHzEl.find('.color').attr('id', 'settings_homezone_color');
newHzEl.find('.opacity').attr('id', 'settings_homezone_opacity');
newHzEl.find('.coords').attr('disabled', '');
newHzEl.find('.coords').attr('class', 'gclh_form coords disabled');
newHzEl.find('.remove').attr('title', '');
newHzEl.find('.remove').attr('disabled', '');
newHzEl.find('.remove').attr('class', 'remove disabled');
html += newHzEl.html();
// Multi homezone circles.
for (var i in settings_multi_homezone) {
var hzel = settings_multi_homezone[i];
var newHzEl = $('
').append($(hztp));
newHzEl.find('.radius').attr('value', hzel.radius);
newHzEl.find('.color').attr('value', hzel.color);
newHzEl.find('.opacity').attr('value', hzel.opacity);
newHzEl.find('.coords').attr('value', DectoDeg(hzel.lat, hzel.lng));
html += newHzEl.html();
}
html += "
";
html += "
Create
";
html += "
";
html += "
Hide Map Elements
";
html += checkboxy('settings_map_hide_sidebar', 'Hide sidebar by default') + " ";
html += checkboxy('settings_hide_map_header', 'Hide header by default') + show_help("Note that you can only hide the header by default if you have activated the setting Show button \"Hide Header\".") + " ";
html += checkboxy('settings_map_hide_found', 'Hide found caches by default') + onlyBrowseMap + prem + " ";
html += checkboxy('settings_map_hide_hidden', 'Hide own caches by default') + onlyBrowseMap + prem + " ";
html += checkboxy('settings_map_hide_dnfs', 'Hide DNF smileys by default') + onlyBrowseMap + prem + " ";
html += " " + "Hide cache types by default " + onlyBrowseMap + prem + " ";
var imgStyle = "style='padding-top: 4px; vertical-align: bottom;'";
var imageBaseUrl = "/map/images/mapicons/";
html += " " + checkboxy('settings_map_hide_2', "") + " ";
html += " " + checkboxy('settings_map_hide_3', "") + " ";
html += " " + checkboxy('settings_map_hide_6', "");
html += " " + checkboxy('settings_map_hide_13', "");
html += " " + checkboxy('settings_map_hide_453', "");
html += " " + checkboxy('settings_map_hide_7005', "") + " ";
html += " " + checkboxy('settings_map_hide_137', "");
html += " " + checkboxy('settings_map_hide_4', "");
html += " " + checkboxy('settings_map_hide_11', "") + " ";
html += " " + checkboxy('settings_map_hide_8', "");
html += " " + checkboxy('settings_map_hide_5', "");
html += " " + checkboxy('settings_map_hide_1858', "") + " ";
html += "
Layers in Map" + show_help("Here you can select the map layers which should be added into the map layers menu of the maps. With this option you can reduce the long list to the map layers you really need. If the right list of map layers is empty, all will be displayed. If you use other scripts like \"Geocaching Map Enhancements\", GC little helper II will overwrite its layercontrol. With this option you can disable GC little helper II map layers to use the map layers for example from \"Geocaching Map Enhancements\" or also from \"geocaching.com\".
It is important, that GC little helper II run at first, particularly in front of other map layer used scripts like \"Geocaching Map Enhancements\".") + "
";
html += checkboxy('settings_use_gclh_layercontrol', 'Replace map layers') + show_help("This option can be used to disable the complete replacement of map layers in both maps, Browse Map and Search Map. If this parameter is disabled, all other parameters related to the map layers will be hidden.") + " ";
html += "
";
html += checkboxy('settings_use_gclh_layercontrol_on_browse_map', 'Replace map layers in Browse Map') + show_help("This option enables the use of map layers on the (Leaflet) Browse Map. If this parameter is enabled, the map layers in the right list will be used in (Leaflet) Browse Map.") + onlyBrowseMap + " ";
html += checkboxy('settings_use_gclh_layercontrol_on_search_map', 'Replace map layers in Search Map') + show_help("This option enables the use of map layers on the Search Map. If this parameter is enabled, the map layers in the right list will be used in Search Map.") + onlySearchMap + " ";
html += "
Available map layers
Used map layers
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
Default map layer " + (settings_map_default_layer ? settings_map_default_layer:"not available") +"";
html += " " + show_help("Here you can select the map source you want to use as default in the map. Mark a map layer from the right list and push the button \"Set default map layer\".");
html += " ";
//>> Issue 2016
//html += checkboxy('settings_show_hillshadow', 'Show hillshadow by default') + show_help("If you want 3D-like-Shadow to be displayed by default, activate this feature.") + " ";
//<< Issue 2016
html += "
";
html += "
";
html += checkboxy('settings_sort_map_layers', 'Sort map layers in map') + " ";
html += newParameterOn1;
html += "
Available map overlays" + show_help("Here you can select additional layers to be added as overlays to the map layer menu.") + "
";
html += checkboxy('settings_add_overlay_wmthiking', 'Waymarked Trails Hiking') + " ";
html += checkboxy('settings_add_overlay_wmtcycling', 'Waymarked Trails Cycling') + " ";
html += checkboxy('settings_add_overlay_wmtmtb', 'Waymarked Trails MTB') + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += "
";
html += "
Google Maps Page
";
html += checkboxy('settings_hide_left_sidebar_on_google_maps', 'Hide left sidebar on Google Maps by default') + " ";
html += checkboxy('settings_add_link_gc_map_on_google_maps', 'Add link to Browse Map on Google Maps') + show_help("With this option an icon is placed on the Google Maps page to link to the same area in Browse Map.") + " ";
html += " " + checkboxy('settings_switch_from_google_maps_to_gc_map_in_same_tab', 'Switch in same browser tab') + " ";
html += checkboxy('settings_add_link_new_gc_map_on_google_maps', 'Add link to Search Map on Google Maps') + show_help("With this option an icon is placed on the Google Maps page to link to the same area in Search Map.") + " ";
html += " " + checkboxy('settings_switch_from_google_maps_to_new_gc_map_in_same_tab', 'Switch in same browser tab') + " ";
html += checkboxy('settings_add_link_google_maps_on_gc_map', 'Add link to Google Maps on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Google Maps.") + " ";
html += " " + checkboxy('settings_switch_to_google_maps_in_same_tab', 'Switch in same browser tab') + " ";
html += newParameterOn2;
html += checkboxy('settings_add_links_google_maps_on_google_search', 'Add link to Google Maps on maps of the Google Search Results pages') + show_help("Since March 2024 Google Maps not being linked from Google Search Results pages in the European Union. With this option some of these links to Google Maps will be restored, so that the links to GC Maps on Google Maps can be used again. In particular, the links and buttons on the maps on the Google Search Results pages have been restored, so that the maps are clickable again.
It is only relevant for the Member States of the European Union (EU) and for the Member States in the Europäischen Wirtschaftsraum (EWS) respectively for the Google Search Results pages with their top level domains. You can find details on googles support page here: https://support.google.com/websearch/thread/261655134") + " ";
html += newParameterVersionSetzen('0.15') + newParameterOff;
html += "
Openstreetmap Page
";
html += checkboxy('settings_add_link_gc_map_on_osm', 'Add link to Browse Map on Openstreetmap') + show_help("With this option an icon is placed on the Openstreetmap page to link to the same area in Browse Map.") + " ";
html += " " + checkboxy('settings_switch_from_osm_to_gc_map_in_same_tab', 'Switch in same browser tab') + " ";
html += checkboxy('settings_add_link_new_gc_map_on_osm', 'Add link to Search Map on Openstreetmap') + show_help("With this option an icon is placed on the Openstreetmap page to link to the same area in Search Map.") + " ";
html += " " + checkboxy('settings_switch_from_osm_to_new_gc_map_in_same_tab', 'Switch in same browser tab') + " ";
html += checkboxy('settings_add_link_osm_on_gc_map', 'Add link to Openstreetmap on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Openstreetmap.") + " ";
html += " " + checkboxy('settings_switch_to_osm_in_same_tab', 'Switch in same browser tab') + " ";
html += "
Flopp's Map Page
";
html += checkboxy('settings_add_link_flopps_on_gc_map', 'Add link to Flopp\'s Map on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Flopp\'s Map.") + " ";
html += " " + checkboxy('settings_switch_to_flopps_in_same_tab', 'Switch in same browser tab') + " ";
html += "
GeoHack Page
";
html += checkboxy('settings_add_link_geohack_on_gc_map', 'Add link to GeoHack on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in GeoHack.") + " ";
html += " " + checkboxy('settings_switch_to_geohack_in_same_tab', 'Switch in same browser tab') + " ";
html += newParameterOn2;
html += "
Komoot Page
";
html += checkboxy('settings_add_link_komoot_on_gc_map', 'Add link to Komoot on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Komoot.") + " ";
html += " " + checkboxy('settings_switch_to_komoot_in_same_tab', 'Switch in same browser tab') + " ";
html += newParameterVersionSetzen('0.15') + newParameterOff;
html += newParameterOn1;
html += "
Waymarked Trails Pages
";
html += checkboxy('settings_add_link_wmthiking_on_gc_map', 'Add link to Waymarked Trails Hiking on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Waymarked Trails Hiking.") + " ";
html += " " + checkboxy('settings_switch_to_wmthiking_in_same_tab', 'Switch in same browser tab') + " ";
html += checkboxy('settings_add_link_wmtcycling_on_gc_map', 'Add link to Waymarked Trails Cycling on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Waymarked Trails Cycling.") + " ";
html += " " + checkboxy('settings_switch_to_wmtcycling_in_same_tab', 'Switch in same browser tab') + " ";
html += checkboxy('settings_add_link_wmtmtb_on_gc_map', 'Add link to Waymarked Trails MTB on Browse and Search Map') + show_help("With this option an icon is placed on the Browse Map and on the Search Map page to link to the same area in Waymarked Trails MTB.") + " ";
html += " " + checkboxy('settings_switch_to_wmtmtb_in_same_tab', 'Switch in same browser tab') + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += "
Enhanced Cache Data" + "
";
html += checkboxy('settings_show_enhanced_map_popup', 'Show enhanced cache data') + show_help("With this option, additional cache data will be shown in the pop up on the Browse Map and in the cache detail screen on the left side of the Search Map. Additional cache data are for example the latest log symbols, the elevation data, the favorites in percentage, the number of the trackables, the personal cache note and further data.") + " ";
html += " " + "Show the latest log icons" + show_help("With this option, the choosen count of the latest logs icons is shown. If you move the mouse over a log icon, the log text is displayed in a pop up.") + " ";
html += " " + checkboxy('settings_show_country_in_place', 'Show country as part of the location') + show_help("With this option the location of the cache is displayed with state and country separated by a comma or only with state. In the latter case the complete location is displayed if you hover with the mouse over the field.
You can use this also to prevent the line from being broken.") + " ";
html += newParameterOn3;
html += " " + checkboxy('settings_maps_add_county_to_place', 'Add county to location (only countries de, at)') + show_help("With this option, the county is added to the location of the cache if the cache location is in Germany or Austria. If you hover with your mouse over the field, the full address will be displayed.
The data comes from OpenStreetMap. They are not always completely accurate, which is why the parameter is deactivated by default. Other countries work with different data structures and the quality of the data does not always seem sufficient, which is why we have decided to only provide the named countries for this feature.") + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += " " + checkboxy('settings_show_enhanced_map_coords', 'Show the cache coordinates') + " ";
html += "
";
html += "
"+prepareHideable.replace("#id#","profile")+"
";
html += "
";
html += checkboxy('settings_public_profile_avatar_show_thumbnail', 'Show bigger avatar image while hovering with the mouse') + show_help("This option requires \"Show thumbnails of images\".") + " ";
html += checkboxy('settings_public_profile_smaller_privacy_btn', 'Show smaller privacy buttons') + show_help("Replace the text and links for privacy with a clickable icon button.") + " ";
html += "
Geocaches
";
html += checkboxy('settings_profile_old_links', 'Use old links to finds and hides caches') + show_help("The links to finds and hides caches in the public profile run through the new search. With this option you can use the old search again.") + " ";
html += "
Trackables
";
html += checkboxy('settings_faster_profile_trackables', 'Load trackables faster without images') + show_help("With this option you can stop the load on the trackable pages after the necessary data are loaded. You disclaim of the lengthy load of the images of the trackables. This procedure is much faster as load all data, because every image is loaded separate and not in a bigger bundle like it is for the non image data.") + " ";
html += "
Gallery
";
var content_settings_show_thumbnails = checkboxy('settings_show_thumbnails', 'Show thumbnails of images') + show_help("With this option the images are displayed as thumbnails to have a preview. If you hover with your mouse over a thumbnail, you can see the big one.
This works for images in cache and trackable logs, for avatars in cache logs, for images in the cache and trackable image galleries and for images in the public profile image gallery.
And after pressing button \"Show bigger avatars\" in cache listing, it also works for the avatars in the displayed logs in cache listing.
And if you activate \"Show bigger avatar image while hovering with the mouse\" in section \"Public Profile\", it also works for the avatar in public profiles.
And if you activate \"Show bigger avatar image while hovering with the mouse\" in section \"Listing - Logs\", it also works for the avatars in cache logs.") + " Max size of big image px ";
html += content_settings_show_thumbnails.replace("show_thumbnails", "show_thumbnailsX1").replace("max_size", "max_sizeX1");
html += " " + checkboxy('settings_imgcaption_on_topX1', 'Show caption on top');
var content_geothumbs = " (Alternative Geothumbs" + show_help("A great alternative to the GC little helper II bigger image functionality with \"Show thumbnails of images\" and \"Show bigger images in gallery\", provides the script Geothumbs (Geocaching Thumbnails).
The script works like GC little helper II with Firefox, Google Chrome and Opera via Tampermonkey script.
If you use Geothumbs, you have to uncheck both GC little helper II bigger image functionality \"Show thumbnails of images\" and \"Show bigger images in gallery\".") + ")" + " ";
html += content_geothumbs;
html += checkboxy('settings_show_big_gallery', 'Show bigger images in gallery') + show_help("With this option the images in the galleries of caches, trackables and public profiles are displayed bigger and not in 4 columns, but in 2 columns.
It runs not together with \"Show thumbnails of images\".");
html += "
Statistic" + prem + "
";
html += checkboxy('settings_count_own_matrix', 'Calculate your cache matrix') + show_help("With this option the count of found difficulty and terrain combinations and the count of complete matrixes are calculated and shown above the cache matrix on your statistic page.") + " ";
html += checkboxy('settings_count_foreign_matrix', 'Calculate other users cache matrix') + show_help("With this option the count of found difficulty and terrain combinations and the count of complete matrixes are calculated and shown above the cache matrix on other users statistic page.") + " ";
html += checkboxy('settings_count_own_matrix_show_next', 'Mark D/T combinations for your next possible cache matrix') + show_help("With this option the necessary difficulty and terrain combinations to reach the next possible complete matrixes are marked in your cache matrix on your statistic page.") + " ";
html += " " + "Highlight next matrixes in color ";
html += "" + show_help("With this option you can choose the count and the color of highlighted next possible complete matrixes in your cache matrix on your statistic page.") + " ";
html += " " + "Generate cache search links with radius km" + show_help("With this option cache search links with the inserted radius in km are generated for all difficulty and terrain combinations. With a radius of 0 km there are no links generated. The default radius is 25 km.") + " ";
html += " " + "Show the searched caches in a " + " ";
html += checkboxy('settings_log_statistic', 'Calculate number of cache and trackable logs for each logtype') + show_help("With this option, you can build a statistic for your own cache and trackable logs for each logtype on your own statistic pages.") + " ";
html += " " + checkboxy('settings_log_statistic_percentage', 'Show percentage column') + " ";
html += " " + "Automated load/reload after hours" + show_help("Choose no hours, if you want to load/reload only manual.") + " ";
html += newParameterOn3;
html += checkboxy('settings_map_statistic_set_name_in_map', 'Show name of country and state on maps') + show_help("Show additional to the short country and state names also the full country and state names on statistic maps when hover with mouse.") + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += checkboxy('settings_map_links_statistic', 'Set links to found caches for each country and state on maps') + show_help("You can improve the maps on statistic maps page with links to caches which have found in each country and in each state. Links are available on the lists on country and state names on the right side and on the maps on countries and states. For states there are only statistic maps for the US states and Canadian provinces and territories. Please note: If the user does not allow the display of found caches, all caches in the area will be displayed. The user will not be considered.") + " ";
html += checkboxy('settings_map_percentage_statistic', 'Show percentage of found caches for every country and state on maps') + " ";
html += "
";
html += "
"+prepareHideable.replace("#id#","db")+"
";
html += "
";
html += checkboxy('settings_bookmarks_show', "Show Linklist on your dashboard") + show_help("Show the Linklist at the sidebar on your dashboard. You can configure the links in the Linklist at the end of this configuration page.") + " ";
html += checkboxy('settings_show_mail_in_allmyvips', 'Show mail link beside user in "All my VIPs/VUPs" list on your dashboard') + show_help("With this option there will be an small mail icon beside every user in the list with all your VIPs (All my VIPs) on your dashboard page. With this icon you get directly to the mail page to mail to this user. (VIP: Very important person)
If VUP processing is activated, this also applies to your VUPs (All my VUPs). (VUP: Very unimportant person)") + " ";
html += "
New Dashboard Only
";
html += checkboxy('settings_show_default_links', 'Show all default links on your dashboard') + show_help("Show all the default links for the Linklist sorted at the sidebar on your dashboard.") + " ";
html += checkboxy('settings_but_search_map', 'Show buttons "Search" and "Browse Map" on your dashboard') + " ";
html += " " + checkboxy('settings_but_search_map_new_tab', 'Open links in new browser tab') + " ";
html += newParameterOn1;
html += checkboxy('settings_but_searchmap', 'Show button "Search Map" on your dashboard') + " ";
html += " " + checkboxy('settings_but_searchmap_new_tab', 'Open links in new browser tab') + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += checkboxy('settings_compact_layout_new_dashboard', 'Show compact layout on your dashboard') + " ";
html += newParameterOn3;
html += " " + checkboxy('settings_row_hide_new_dashboard', 'Hide individual rows in the navigation column of your dashboard') + show_help("This feature allows you to hide individual rows in the left column (navigation column) of your dashboard. Each row has an icon for marking it. Above all rows, there's another icon for activating the configuration.") + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += checkboxy('settings_embedded_smartlink_ignorelist', 'Show link to ignore list in sidebar section Lists') + show_help("Embedded a link in the section Lists to your Ignore List into the sidebar of the new dashboard.") + " ";
html += checkboxy('settings_showUnpublishedHides', 'Show unpublished caches on your dashboard') + " ";
html += " " + checkboxy('settings_set_showUnpublishedHides_sort', 'Sort unpublished caches on your dashboard') + " ";
html += " ";
html += checkboxy('settings_show_edit_links_for_logs', 'Show edit links for your own logs') + show_help("With this option direct edit links are shown in your own logs on your dashboard. If you choose such a link, you are immediately in edit mode in your log.") + " ";
html += checkboxy('settings_dashboard_show_logs_in_markdown', 'Show log text in Markdown as it is in cache listing') + " ";
html += newParameterOn2;
html += checkboxy('settings_dashboard_hide_tb_activity', 'Hide all trackable logs in the Latest Activity') + " ";
html += newParameterVersionSetzen('0.15') + newParameterOff;
html += newParameterOn1;
html += checkboxy('settings_dashboard_hide_right_sidebar', 'Hide the sidebar on the far right (“Events nearby” etc.) by default') + show_help('This option allows you to hide the sidebar on the far right by default. This hides, for example, “Events nearby”, “Geocaches nearby”, “Unpublished Hides”.') + " ";
html += checkboxy('settings_dashboard_build_menu_old_db_in_new_db', 'Show menu under the header as in the old dashboard') + show_help('This option allows you to show a menu below the header, similar to what you know from the old dashboard.') + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += "
Old Dashboard Only
";
html += checkboxy('settings_hide_visits_in_profile', 'Hide trackable visits on your dashboard') + " ";
var content_settings_logit_for_basic_in_pmo = checkboxy('settings_logit_for_basic_in_pmo', 'Log PMO caches by standard \"Log It\" icon (for basic members)') + show_help("With this option basic members are able to choose the standard \"Log It\" icon to call the logging screen for premium member only (PMO) caches. The tool tipp blocked not longer this call. You can have the same result by using the right mouse across the \"Log It\" icon and then new tab. The \"Log It\" icon is besides the caches for example in the \"Recently viewed caches list\" and next to the caches on your old dashboard.") + " ";
html += content_settings_logit_for_basic_in_pmo;
html += "
";
html += "
"+prepareHideable.replace("#id#","listing")+"
";
html += "
";
html += "
Listing Header" + "
";
html += checkboxy('settings_cache_type_icon_visible', 'Set cache type icon always visible') + show_help("With this option, the cache type icon is always displayed complete, even if the cache is deactivated or archived.") + " ";
html += checkboxy('settings_log_status_icon_visible', 'Set log status icon always visible') + show_help("With this option, the log status icon is always displayed complete, even if the cache is deactivated or archived. The log status icon is located above the cache type icons and indicates for example if a cache was found, if there is a personal note or if there are corrected coordinates.") + " ";
html += checkboxy('settings_strike_archived', 'Strike through title of archived and disabled caches') + " ";
html += checkboxy('settings_show_real_owner', 'Show real owner name') + show_help("If this option is enabled, the alias that an owner used to publish the cache is replaced with the real owner name.") + " ";
html += checkboxy('settings_show_eventday', 'Show weekday of an event') + show_help("With this option the day of the week will be displayed next to the event date in the header of the cache listing and in the event info at the beginning of the cache description.") + " ";
html += checkboxy('settings_show_eventtime_with_24_hours', 'Show event time in 24 hours format') + show_help("The start time and end time of an event are generated on the website using the language in which you are signed in. In English, the preferred language when using the GClh, but also in some other languages, the start time and end time of an event is shown in 12 hour format with AM and PM. If you want to change it to a 24 hour format, you can activate this parameter. It will then be changed in the header of the cache listing and in the event info at the beginning of the cache description.") + " ";
html += checkboxy('settings_show_latest_logs_symbols', 'Show the ');
html += " latest logs symbols at the top" + show_help("With this option, the choosen count of the latest logs symbols is shown at the top of the cache listing.") + " ";
html += checkboxy('settings_show_fav_percentage', 'Show percentage of favorite points') + show_help("This option loads the favorite stats of a cache in the backround and display the percentage under the amount of favorites a cache got.") + " ";
html += checkboxy('settings_show_log_totals', 'Show the log totals icons at the top') + " ";
html += checkboxy('settings_log_inline_pmo4basic', 'Log cache from listing for PMO (for basic members)') + show_help("With this option you can select, if inline logs should appear for premium member only (PMO) caches althought you are a basic member.
If you're using an ad-blocking add-on, such as uBlock, the embedded screen may not be allowed. To turn this off, you have to add \"www.geocaching.com\/geocache\/GC*\" to the whitelist, or something similar, of your add-on.") + " ";
html += "
Location" + "
";
html += " " + "Highlight user changed coordinates with " + checkboxy('settings_highlight_usercoords', 'red textcolor ') + checkboxy('settings_highlight_usercoords_bb', 'underline ') + checkboxy('settings_highlight_usercoords_it', 'italic') + " ";
html += checkboxy('settings_show_elevation_of_waypoints', '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 += " " + "First service ";
html += " " + "Second service ";
html += newParameterOn3;
html += checkboxy('settings_listing_add_county_to_place', 'Add county to location of cache (only countries de, at)') + show_help("With this option, the county is added to the location of the cache if the cache location is in Germany or Austria. If you hover with your mouse over the field, the full address will be displayed.
The data comes from OpenStreetMap. They are not always completely accurate, which is why the parameter is deactivated by default. Other countries work with different data structures and the quality of the data does not always seem sufficient, which is why we have decided to only provide the named countries for this feature.") + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += checkboxy('settings_show_link_to_browse_map', 'Show link to Browse Map') + show_help("With this option, a link called \"Map this Location\" is shown under the listing coordinates.") + " ";
html += "
Disclaimer" + "
";
html += checkboxy('settings_hide_disclaimer', 'Hide disclaimer') + " ";
html += "
Personal Cache Note" + prem + "
";
html += " " + "Personal cache note minimum size px" + " ";
html += checkboxy('settings_adapt_height_cache_notes', 'Adapt the height of the personal cache note edit field') + show_help("The height of the personal cache note edit field will be expand to show the complete note.") + " ";
html += checkboxy('settings_hide_empty_cache_notes', 'Hide personal cache notes if empty') + show_help("You can hide the personal cache notes if they are empty. There will be a link to show them to add a note.") + " ";
html += checkboxy('settings_hide_cache_notes', 'Hide personal cache notes completely') + show_help("You can hide the personal cache notes completely, if you don't want to use them.") + " ";
html += checkboxy('settings_change_font_cache_notes', 'Change font of personal cache notes to monospace') + " ";
html += "
Cache Detail Navigation (right sidebar)" + "
";
html += checkboxy('settings_log_inline', 'Log cache from listing (inline)') + show_help("With the inline log you can open a log form inside the listing, without loading a new page.
If you're using an ad-blocking add-on, such as uBlock, the embedded screen may not be allowed. To turn this off, you have to add \"www.geocaching.com\/geocache\/GC*\" to the whitelist, or something similar, of your add-on.") + " ";
html += checkboxy('settings_prevent_watchclick_popup', 'Prevent pop up when clicking on "Watch" or "Stop Watching"') + " ";
html += checkboxy('settings_improve_add_to_list', 'Show compact layout in \"Add to list\" pop up to bookmark a cache') + prem + " ";
html += " " + "Maximum height of pop up px" + show_help("With this option you can choose the maximum height of the \"Add to list\" pop up to bookmark a cache from 100 up to 520 pixel. The default is 205 pixel, similar to the standard.") + " ";
html += newParameterOn1;
html += checkboxy('settings_hide_view_treasures_link', 'Hide \"View Treasures\" link') + prem + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += checkboxy('settings_show_remove_ignoring_link', 'Show \"Stop Ignoring\", if cache is already ignored') + show_help("This option replace the \"Ignore\" link description with the \"Stop Ignoring\" link description in the cache listing, if the cache is already ignored.") + prem + " ";
html += " " + checkboxy('settings_use_one_click_ignoring', 'One click ignoring/restoring') + show_help("With this option you will be able to ignore respectively restore a cache in cache listing with only one click.") + " ";
html += newParameterOn1;
var placeholder_ilinks = "Possible placeholders for custom links: #GCCode# : GC code #CoordsLat# : Coordinates latitude in decimal format (DD.DDDDD) #CoordsLng# : Coordinates longitude in decimal format (DD.DDDDD) (Upper and lower case is not required in the placeholders name.)";
var nameHelp = "The name of a custom link is displayed in listings in the right navigation sidebar. Ideally, a name should not be too long so that the display of it does not wrap.";
var listingHelp = "The display of a custom link can be restricted for cache listings or event listings.";
var cachetypeHelp = "The display of a custom link can also be restricted for a cache type.";
var linkHelp = "A custom link is usually an URL. For a custom link, there is no check to see if the link actually leads to an existing address. If it doesn't, you'll likely end up on a DNF page. A custom link can contain various placeholders, such as the GC code or coordinates. These placeholders are then replaced by the values in the listing when displayed in the listing. For details see \"Possible placeholders\" above. A custom link can be opened in a new browser tab.
Under certain conditions, local files and directories on the computer can also be used as a custom link. For security purposes, all browser block links to local files and directories. If you still want to use local links and you are willing to accept the possible risk of linking to local content, you can override the security policy in your browser settings. Please see there, how you can do that.";
var completeHelp = "This feature allows you to create custom links that are displayed in listings in the right navigation sidebar. Custom links can be deactivated for display in listings using the checkboxes.
" + nameHelp + "
" + listingHelp + " " + cachetypeHelp + "
" + linkHelp;
html += checkboxy('settings_show_individual_links', 'Show custom links in sidebar') + show_help(completeHelp);
html += " ( Possible placeholders" + show_help(placeholder_ilinks) + ")" + " ";
html += "
";
html += " ";
for (var i in settings_individual_links) {
html += buildBothTableRows_ilinks(settings_individual_links[i], i);
}
html += "
";
html += "
Create
";
html += "
";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += checkboxy('settings_show_flopps_link', 'Show Flopp\'s Map links in sidebar and under the "Additional Waypoints"') + " ";
html += " " + checkboxy('settings_show_radius_on_flopps', 'Show radius around caches on Flopp\'s Map') + " ";
html += checkboxy('settings_show_brouter_link', 'Show BRouter links in sidebar and under the "Additional Waypoints"') + " ";
html += newParameterOn1;
html += checkboxy('settings_show_bikerouter_link', 'Show Bikerouter links in sidebar and under the "Additional Waypoints"') + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
html += checkboxy('settings_show_gpsvisualizer_link', 'Show GPSVisualizer links in sidebar and under the "Additional Waypoints"') + " ";
html += " " + checkboxy('settings_show_gpsvisualizer_gcsymbols', 'Use geocaching icons on GPSVisualizer map') + show_help("Instead of default icons, geocaching icons are used. If the URL is too long, disable this option.") + " ";
html += " " + checkboxy('settings_show_gpsvisualizer_typedesc', 'Transfer type of the waypoint as description') + show_help("Transfer for every waypoint the type as text in the description. If the URL is too long, disable this option.") + " ";
html += checkboxy('settings_show_openrouteservice_link', 'Show Openrouteservice links in sidebar and under the "Add. Waypoints"') + " ";
html += " " + checkboxy('settings_show_openrouteservice_home', 'Use home coordinates as start point') + show_help("You can use your home coordinates, here in the GClh II Config, as start point and first waypoint for the route calculation.") + " ";
html += " " + "Medium for locomotion " + " ";
html += checkboxy('settings_show_copydata_menu', 'Show "Copy Data to Clipboard" menu in sidebar') + show_help("Shows a menu to copy various cache data to the clipboard.") + " ";
var help = "This feature allows you not only to copy something to the clipboard after clearing the clipboard, but also to add "
+ "something to the clipboard without clearing it. This is how you can collect things on the clipboard.
"
+ "You can use it for example to collect GC codes with the feature \"Add Bulk GC codes\" on the \"My Lists\" page.";
html += " " + checkboxy('settings_show_copydata_plus', 'Activate adding to Clipboard') + show_help(help) + " ";
html += " " + 'Separator between addings ';
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 += "
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 += ' 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 += " " + 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 += "
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 += " " + 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 += " " + checkboxy('settings_show_lackey_as_vip', 'Show lackey in VIP list') + show_help("If you enable this option, lackeys which logged the cache are VIPs for the cache. Behind the logs of lackeys are primarily employees of Groundspeak who cache. In addition, administrative logs can also be performed by these lackeys. Administrative user of Groundspeak may also be flagged as lackeys. An example of the latter are the logs for archiving older events.") + " ";
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 += newParameterOn3;
html += checkboxy('settings_show_eventinfo_in_desc', 'Show event info at the beginning of the cache description') + show_help("With this option an event info with the event startdate, the event weekday, the event starttime and the event endtime can be displayed.") + " ";
html += " " + checkboxy('settings_show_eventinfo_in_desc_bold', 'Show event info bold') + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += " " + checkboxy('settings_show_eventdayX1', 'Show weekday of an event') + show_help("With this option the day of the week will be displayed next to the event date in the header of the cache listing and in the event info at the beginning of the cache description.") + " ";
html += " " + checkboxy('settings_show_eventtime_with_24_hoursX0', 'Show event time in 24 hours format') + show_help("The start time and end time of an event are generated on the website using the language in which you are signed in. In English, the preferred language when using the GClh, but also in some other languages, the start time and end time of an event is shown in 12 hour format with AM and PM. If you want to change it to a 24 hour format, you can activate this parameter. It will then be changed in the header of the cache listing and in the event info at the beginning of the 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 += 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 += "
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 += newParameterOn3;
html += checkboxy('settings_listing_ctoc_coords_waypoints', 'Show "Copy Coordinates to Clipboard" button for every waypoint') + show_help("Shows for every waypoint in the waypoint list a button to copy the coordinates of the waypoint to the clipboard.") + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
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 += " " + "First service ";
html += " " + "Second service ";
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 += 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 += "
Map Preview" + "
";
html += checkboxy('settings_larger_map_as_browse_map', 'Replace link to larger map with the Browse Map') + " ";
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 += checkboxy('settings_add_search_in_logs_func', 'Add "Search in logs" feature') + " ";
html += checkboxy('settings_show_all_logs_but', 'Show button \"Show all logs\" above the logs') + " ";
html += checkboxy('settings_show_compact_logbook_but', 'Show button \"Show compact logs\" above the logs') + " ";
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') + " ";
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 += checkboxy('settings_hide_spoilerwarning', 'Hide spoiler warning') + " ";
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 += 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 in the listing. 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 += newParameterOn3;
html += checkboxy('settings_listing_bigger_avatar_with_mouse', 'Show bigger avatar image while hovering with the mouse') + show_help("With this option you can choose if a bigger avatar image will load and shown while hovering with the mouse over the small avatar image.
This option requires \"Show thumbnails of images\".") + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
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 += "
";
html += "
"+prepareHideable.replace("#id#","draft")+"
";
html += "
";
html += checkboxy('settings_modify_new_drafts_page', 'Change the look and functionality of draft items') + " ";
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') + show_help("If you enable this option, you always get the old log form instead of the new one to log drafts related logs.
Please look also the parameter \"Use old-fashioned log form to log non drafts related logs\" in the \"Log\" area.") + " ";
html += " " + checkboxy('settings_drafts_log_icons', 'Show logtype icon instead of text') + " ";
var content_settings_after_sending_draft_related_log1 = checkboxy('settings_drafts_go_automatic_back', 'After sending a draft related cache log, automatic go back to drafts') + show_help('If it was a draft related cache log, you can enable this option to automatic go back to the drafts page, instead of going to cache listing.') + " ";
var content_settings_after_sending_draft_related_log2 = checkboxy('settings_drafts_after_new_logging_view_log', 'After sending a draft related cache log, automatic view log') + show_help('If it was a draft related cache log, you can enable this option to automatic go to view log page, instead of going to cache listing.') + " ";
var content_settings_after_sending_draft_related_log2_button = " " + checkboxy('settings_drafts_after_new_logging_view_log_button', 'Show button "Back to Drafts" on view log page') + " ";
html += content_settings_after_sending_draft_related_log1;
html += content_settings_after_sending_draft_related_log2;
html += newParameterOn3;
html += content_settings_after_sending_draft_related_log2_button;
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += checkboxy('settings_drafts_download_show_button', 'Enable draft download feature') + show_help("With this option you can activate the draft download feature. A download button will then appear next to the upload button on the draft page.") + " ";
html += " " + checkboxy('settings_drafts_download_change_logdate', 'Change log dates of the drafts in download file') + show_help("With this option you can choose whether the log dates in the drafts is reduced by one second. This is necessary if you might want to upload the drafts in the download file later, after deleting the drafts on the drafts page, as uploading with the same log date is not possible.") + " ";
html += "
";
html += "
"+prepareHideable.replace("#id#","logging")+"
";
html += "
";
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 += 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 += 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 += 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.
For basic members, no data is displayed for premium member only caches.") + " ";
html += content_settings_after_sending_draft_related_log1.replace("settings_drafts_go_automatic_back", "settings_drafts_go_automatic_backX0");
html += content_settings_after_sending_draft_related_log2.replace("settings_drafts_after_new_logging_view_log", "settings_drafts_after_new_logging_view_logX0");
html += newParameterOn3;
html += content_settings_after_sending_draft_related_log2_button.replace("settings_drafts_after_new_logging_view_log_button", "settings_drafts_after_new_logging_view_log_buttonX0");
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += checkboxy('settings_after_new_logging_view_log', 'After sending or edit a non draft related cache log, automatic view log') + show_help('If it was not a draft related cache log or it was an edit of a cache log, you can enable this option to automatic go to view log page, instead of going to cache listing.') + " ";
var placeholderDescription = "Possible placeholders: #Found# : Your founds + 1 (reduce it with a minus followed by a number) #Found_no# : Your founds (reduce it with a minus followed by a number) #Me# : Your username #Owner# : Username of the owner #Date# : Actual date #Time# : Actual time in format hh:mm #DateTime# : Actual date actual time #GCTBName# : Cache or trackable name #GCTBLink# : Cache or trackable link #GCTBNameLink# : Cache or trackable name as a link #GCType# : Cache type #LogDate# : Content of field \"Date Logged\" #DraftLogDate# : Log date of draft (1) (2) #DraftLogTime# : Log time of draft (1) (2) (1) Only available in new log form. (2) No data, then empty. (Upper and lower case is not required in the placeholders name.)";
html += newParameterOn2;
html += checkboxy('settings_hide_locked_tbs_log_form', 'Hide locked trackables from trackable inventory') + show_help("A trackable can be marked as locked in the trackable listing. Locked trackables cannot be logged. With this option you can hide such trackables from trackable inventory.
This feature is only available for the first 20 trackables displayed in the trackable inventory.") + " ";
html += checkboxy('settings_hide_own_tbs_log_form', 'Hide own trackables from trackable inventory') + show_help("With this option you can hide your own trackables from trackable inventory.
This feature is only available for the first 20 trackables displayed in the trackable inventory.") + " ";
html += checkboxy('settings_hide_share_log_button_log_view', 'Hide \"Share log\" button on view log page') + show_help("With this option you can hide the \"Share log\" button on page view geocache log.
If you just want to hide the social sharing icons for Facebook, Twitter (X) behind the \"Share log\" button instead, you can do this with the parameter \"Hide social sharing via Facebook, Twitter (X)\" in the \"Global - Hiding\" area.") + " ";
html += checkboxy('settings_remove_target_log_form', 'Do not open links on log form page automatic in new browser tab') + show_help("The links on the pages \"Log this geocache\" and \"Edit log\" will automatically open in a new tab. If you want to decide for yourself whether a link should open in the same browser tab or in a new one, you can choose this option.") + " ";
html += checkboxy('settings_remove_target_log_view', 'Do not open links on view log page automatic in new browser tab') + show_help("The links on the page \"View geocache log\" will automatically open in a new tab. If you want to decide for yourself whether a link should open in the same browser tab or in a new one, you can choose this option.") + " ";
html += checkboxy('settings_button_sort_tbs_by_name_log_form', 'Enable sorting of trackables by name') + " ";
html += checkboxy('settings_larger_content_width_log_form', 'Larger page width') + show_help("With this option you can expand the page width according to the setting in the parameter \"Page width\" in the \"Global\" section.") + " ";
html += checkboxy('settings_less_space_log_lines_log_form', 'Less space between the lines of the log') + " ";
html += checkboxy('settings_add_log_templates', 'Add log templates') + show_help("Log templates are predefined texts. All of your templates will be displayed on 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.") + " ( Possible placeholders" + show_help(placeholderDescription) + ") ";
html += newParameterVersionSetzen('0.15') + newParameterOff;
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 += newParameterOn2;
html += " " + checkboxy('settings_add_cache_log_signature_as_log_template', 'Add cache log signature as a log template') + " ";
html += " " + checkboxy('settings_add_tb_log_signature_as_log_template', 'Add trackable log signature as a log template') + " ";
html += checkboxy('settings_add_cache_log_signature', 'Add 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 += newParameterVersionSetzen('0.15') + newParameterOff;
html += " " + " ";
html += " " + checkboxy('settings_log_signature_on_fieldnotes', 'Add cache 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 += newParameterOn2;
html += checkboxy('settings_add_tb_log_signature', 'Add trackable log signature') + show_help("The signature is automatically added to your trackable logs. You can also use placeholders for variables that will be replaced in the log.") + " ( Possible placeholders" + show_help("Possible placeholders: #Found# : Your founds + 1 (reduce it with a minus followed by a number) #Found_no# : Your founds (reduce it with a minus followed by a number) #Me# : Your username #Owner# : Username of the owner #Date# : Actual date #Time# : Actual time in format hh:mm #DateTime# : Actual date actual time #GCTBName# : Cache or trackable name #GCTBLink# : Cache or trackable link #GCTBNameLink# : Cache or trackable name as a link #LogDate# : Content of field \"Date Logged\" (Upper and lower case is not required in the placeholders name.)") + ") ";
html += newParameterVersionSetzen('0.15') + newParameterOff;
html += " " + " ";
html += newParameterOn3;
html += checkboxy('settings_default_logtype_control', 'Set default log types') + " ";
html += newParameterVersionSetzen('0.16') + newParameterOff;
html += "
";
html += "
Default log type
";
html += "
";
html += "
Default event log type
";
html += "
";
html += "
Default owner log type
";
html += "
";
html += "
Default trackable log type
";
html += "
";
html += "
";
html += "
New Log Page Only
";
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 += "
Old Log Page Only
";
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 += "
";
html += "
"+prepareHideable.replace("#id#","mail")+"
";
html += "
";
html += newParameterOn1;
html += checkboxy('settings_message_add_gc_code', 'Set GC Code reference in message if no template was specified') + show_help("If this option is enabled and no template was specified, a message will include the default GC code reference at the beginning of the message, if the GC code is known. This is the default behavior of the website. For example: \"Regarding GC8FXW4: Dracula 2.0 NC –\". If you prefer an empty message, then please disable it.") + " ";
html += newParameterVersionSetzen('0.17') + newParameterOff;
var placeholderDescriptionMail = "Possible placeholders in the mail and message form: #Found# : Your founds + 1 (reduce it with a minus followed by a number) #Found_no# : Your founds (reduce it with a minus followed by a number) #Me# : Your username #Receiver# : Username of the receiver #Date# : Actual date #Time# : Actual time in format hh:mm #DateTime# : Actual date actual time #GCTBName# : Cache or trackable name #GCTBCode# : Cache or trackable code in brackets #GCTBCodeNoBrackets# : Cache or trackable code not in brackets #GCTBLink# : Cache or trackable 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 += "
";
html += " " + "Remove from navigation" + show_help("Here you can select, which of the original GC dropdown lists should be removed.") + " ";
html += " " + checkboxy('remove_navi_play', 'Play') + " ";
html += " " + checkboxy('remove_navi_community', 'Community') + " ";
html += " " + checkboxy('remove_navi_shop', 'Shop') + " ";
html += checkboxy('settings_bookmarks_search', 'Show navigation/search field. Default value ') + "" + show_help("If you enable this option, there will be a navigation/search field on the top of all GC pages. In this field you can navigate respectively search to respectively for geocaches (GC), trackables (TB), geotours (GT), bookmark lists (BM), User codes (PR), geocache logs (GL), tracking code of trackables (6 digits), coordinates, ... . If a 6 diget number starts with GC, TB, etc, you can force searching for a tracking number by pressing ctrl+enter
Also you can define a default value like for example \"GC\" if you want.
This option requires \"Show Linklist on top\".") + " ";
html += checkboxy('settings_show_draft_indicator', 'Show draft indicator') + " ";
html += "" + show_help("With this option your Linklist will be shown at the navigation menu as a dropdown list beside the others.") + " ";
html += "
";
html += checkboxy('settings_menu_float_right', 'Arrange the menu right') + show_help("With this option you can arrange the navigation menu with the Linklist and the other dropdown lists in the right direction. The default is an orientation in the left direction.
" + t_reqChlSLoT) + " ";
html += " " + "Font color at menu ";
html += "" + show_help("With this option you can choose the font color at the navigation menu.
" + t_reqChl) + " ";
html += " " + "Font size at menu px" + show_help("With this option you can choose the font size at the navigation menu in pixel. The default font size is 16 pixel.
" + t_reqChl) + " ";
html += " " + "Distance between menu entries px" + show_help("With this option you can choose the distance between the navigation menu entries in horizontal direction in pixel.
" + t_reqChl) + " ";
html += " " + "Font color at dropdown lists ";
html += "" + show_help("With this option you can choose the font color at the dropdown lists.
" + t_reqChl) + " ";
html += " " + "Font size at dropdown lists px" + show_help("With this option you can choose the font size at the drop-down lists in pixel. The default font size is 15 pixel.
" + t_reqChl) + " ";
html += " " + "Distance between dropdown links px" + show_help("With this option you can choose the distance between the drop-down links in vertical direction in pixel.
" + t_reqChl) + " ";
html += "
";
html += "" + show_help("If you enable this option, the links in your Linklist will be shown direct on the top of the page, side by side.
" + t_reqChlSLoT) + " ";
html += "
";
html += " " + "Font color at menu ";
html += "" + show_help("With this option you can choose the font color at the links.
" + t_reqChlSLoT) + " ";
html += " " + "Font size at the links: px" + show_help("With this option you can choose the font size at the links in pixel. The default font size is 16 pixel.
" + t_reqChlSLoT) + " ";
html += " " + "Distance between the links px" + show_help("With this option you can choose the distance between the links in horizontal direction in pixel.
" + t_reqChlSLoT) + " ";
html += " " + "Number of lines for all links " + show_help("With this option you can choose the number of lines which are necessary to include all the links of the Linklist in the header of the page.
" + t_reqChlSLoT) + " ";
html += "Show separator between the links" + show_help(t_reqChlSLoT) + " ";
html += " " + "Font color at GC drop-down lists ";
html += "" + show_help("With this option you can choose the font color at the GC drop-down lists.
" + t_reqChlSLoT) + " ";
html += " " + "Font size at GC drop-down lists px" + show_help("With this option you can only choose the font size at the remaining GC drop-down lists in pixel. The default font size is 15 pixel.
" + t_reqChlSLoT) + " ";
html += " " + "Distance between GC drop-down links px" + show_help("With this option you can only choose the distance between the remaining GC drop-down links in vertical direction in pixel.
" + t_reqChlSLoT) + " ";
html += "
";
html += " ";
// Linklist: Rechte Spalte mit den ausgewählten BMs.
// ---------
var firstCust = 0;
for (var j = 0; j < bookmarks.length; j++) {
if (bookmarks[j].custom) {
firstCust = j;
break;
}
}
html += "
";
// Überschrift, rechte Spalte.
html += "
Linklist" + show_help("In this column you can organize your Linklist. With the left button you can grab and move an element forwards or backwards. With the right button you can delete an element from the Linklist. You delete the element only from the Linklist, in the left columns the element is preserved.
The Linklist requires \"Show Linklist on top\" or \"Show Linklist on your dashboard\".") + "
";
html += "
";
// Ausgewählte BMs für Linklist, rechte Spalte.
html += " ";
var order = JSON.parse(getValue("settings_bookmarks_list", "[]").replace(/, (?=,)/g, ",null"));
// Platzhalter, falls keine BMs ausgewählt.
if (order.length == 0) {
html += "
";
html += "
Drop here...
";
} else {
for (var i = 0; i < order.length; i++) {
if (typeof(order[i]) == "undefined") continue;
if (typeof(order[i]) == "object") continue;
if (typeof(bookmarks[order[i]]) == "undefined") continue;
if (bookmarks[order[i]].custom) {
var text = (typeof(bookmarks_orig_title[order[i]]) != "undefined" && bookmarks_orig_title[order[i]] != "" ? bookmarks_orig_title[order[i]] : bookmarks[order[i]]['title']);
var textTitle = "Custom" + (order[i] - firstCust);
if (!text.match(/(\S+)/)) text = textTitle;
} else {
var text = bookmarks[order[i]]['title'];
var textTitle = (typeof(bookmarks_orig_title[order[i]]) != "undefined" && bookmarks_orig_title[order[i]] != "" ? bookmarks_orig_title[order[i]] : bookmarks[order[i]]['title']);
}
var textName = textTitle;
html += "
";
html += "
";
html += " ";
html += text;
html += "
";
html += "
";
}
}
html += " ";
html += "
";
html += "
";
// Linklist: Beide linken Spalten mit möglichen BMs und abweichenden Bezeichnungen und Seitenbuttons.
// ---------
// BMs nach Bezeichnung sortieren.
sortBookmarksByDescription(settings_sort_default_bookmarks, bookmarks);
html += "
";
// Überschrift.
html += " ";
html += "
Default Links" + show_help("In this column are the default links for the Linklist. There are standard links and custom links.
You can choose the standard links you want to use in your Linklist.
If there is a text field, then it is a custom link. In this text field you can type any URL you want to be added to the Linklist. The checkbox behind defines, if the link should be opened in a new window.
With the left button you can grab and move an element to the Linklist.
If you have problems to drag & drop the lower links because the Linklist area is not on the screen, then use the arrow high key on your keyboard during you hold the mouseclick.") + "
";
html += "
Description" + show_help("In this column you can type a differing description for the standard link, if it is a standard link.
If it is a custom link, you have to type a decription for the custom link.
If you have problems to drag & drop the lower links because the Linklist area is not on the screen, then use the arrow high key on your keyboard during you hold the mouseclick.") + "
";
html += " ";
// Beide linken Spalten.
html += " ";
var cust = 0;
for (var i = 0; i < bookmarks.length; i++) {
var num = bookmarks[i]['number'];
html += "
";
// Erste linke Spalte mit möglichen BMs:
html += "
";
html += " ";
if (typeof(bookmarks[i]['custom']) != "undefined" && bookmarks[i]['custom'] == true) {
html += " ";
html += "";
cust++;
} else {
html += "" + outTitle + "";
// if (num >= 75 && num <= 88) html += newParameterLL1; // Zeile belassen als Beispiel für zukünftige Einträge.
}
html += "
";
// Zweite linke Spalte mit abweichenden Bezeichnungen:
html += "
";
if (typeof(bookmarks[i]['custom']) != "undefined" && bookmarks[i]['custom'] == true) {
html += "";
} else {
html += "";
// if (num >= 75 && num <= 88) html += newParameterLLVersionSetzen("0.10"); // Zeile belassen als Beispiel für zukünftige Einträge.
}
html += "
";
}
html += " ";
html += "
";
html += "
";
// Section Development.
html += "
"+prepareHideable.replace("#id#","development")+"
";
html += "
";
html += checkboxy('settings_gclherror_alert', 'Show an alert if an internal error occurs') + " ";
html += checkboxy('settings_test_log_console', 'Checks log to console') + " ";
html += "
").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();
});
// Custom links for cache listing:
// -------------------------------
// Fill options for select field of cache type.
function createOptionsForCachetype_ilinks(listing, cachetype) {
var selectedIsSet = false;
var options = '';
for (var i = 0; i < cache_types.length; i++) {
if (listing == 'Events' && !cache_types[i].isEvent) continue;
if (listing == 'Caches' && cache_types[i].isEvent) continue;
if (cachetype == cache_types[i].icon) {
selectedIsSet = true;
var selected = " selected=\"selected\"";
} else var selected = "";
options += "";
}
if (cachetype == 'All' || !selectedIsSet) var selected = "selected=\"selected\"";
else var selected = "";
options = "" + options;
return options;
}
// Prepare both table rows for a custom link.
function buildBothTableRows_ilinks(ilink, idnr) {
var html = '';
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";;
html += "
";
html += "
";
html += "
";
html += "
";
html += "
new tab
";
html += "
";
return html;
}
// Build change event for select of listing, so the options for select field of cache type can be changed.
function buildChangeEventForListing_ilinks(lines) {
for (var i = 0; i < lines.length; i++) {
$(lines[i]).find('.ilinks_listing').each(function() {
$(this)[0].addEventListener('change', function() {
var listing = $(this).find('option')[$(this)[0].selectedIndex].innerText;
var cachetype = $(this).closest('.ilinks_element_first').find('.ilinks_cachetype option')[$(this).closest('.ilinks_element_first').find('.ilinks_cachetype')[0].selectedIndex].value;
var options = createOptionsForCachetype_ilinks(listing, cachetype);
$(this).closest('.ilinks_element_first').find('.ilinks_cachetype').children().remove();
$(this).closest('.ilinks_element_first').find('.ilinks_cachetype').append(options);
}, false);
});
}
}
var lines = $('.ilinks_element_first');
buildChangeEventForListing_ilinks(lines);
// Build click event for delete button with deleting the custom link.
function buildDeleteEventForRows_ilinks(lines) {
for (var i = 0; i < lines.length; i++) {
$(lines[i]).find('.ilinks_delete').each(function() {
$(this)[0].addEventListener("click", function() {
$(this).closest('tr')[0].nextElementSibling.remove();
$(this).closest('tr').remove();
}, false);
});
}
}
buildDeleteEventForRows_ilinks($('.ilinks_element_first'));
// Build dependencies.
function setEvForDepPara_ilinks(lines) {
for (var i = 0; i < lines.length; i=i+2) {
$(lines[i]).find('.ilinks_dep').each(function() {
setEvForDepPara($(lines[i]).find('.ilinks_display')[0].id, $(this)[0].id);
});
$(lines[i+1]).find('.ilinks_dep').each(function() {
setEvForDepPara($(lines[i]).find('.ilinks_display')[0].id, $(this)[0].id);
});
}
}
var lines = $('table.individual_links tbody tr');
setEvForDepPara_ilinks(lines);
// Build click event for create button with creating a new custom link.
var ilinks_idnr = $('.ilinks_element_first').length;
$('#ilinks_create')[0].addEventListener("click", function() {
ilinks_idnr++;
var ilink = {};
ilink.display = true;
ilink.name = '';
ilink.listing = 'All';
ilink.cachetype = 'All';
ilink.href = '';
ilink.newtab = true;
var html = buildBothTableRows_ilinks(ilink, ilinks_idnr);
$('table.individual_links tbody').append(html);
// Build change event for select of listing, so the options for select field of cache type can be changed.
buildChangeEventForListing_ilinks($('.ilinks_element_first:last'));
// Build click event for delete button with deleting the custom link.
buildDeleteEventForRows_ilinks($('.ilinks_element_first:last'));
// Build dependencies.
var lines = $('.ilinks_element_first:last');
lines[1] = $('.ilinks_element_first:last')[0].nextElementSibling;
setEvForDepPara_ilinks(lines);
});
// Build click event to Show/Hide custom links block.
$("#settings_show_individual_links").click(function() { $("#settings_show_individual_links_block").toggle(); });
// Scroll to the first place in the fields name and href. Without this, the content of the fields remains displayed as it was previously left.
$('.ilinks_name, .ilinks_href').each(function() { this.scrollTo(0,0); });
// 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, #ilinks_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_update')[0].addEventListener("click", function() {checkForUpdate(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);
$('#settings_drafts_go_automatic_back')[0].addEventListener("click", function() {
if ($('#settings_drafts_go_automatic_back').prop('checked') && $('#settings_drafts_after_new_logging_view_log').prop('checked')) {
$('#settings_drafts_after_new_logging_view_log')[0].click();
}
}, false);
$('#settings_drafts_go_automatic_backX0')[0].addEventListener("click", function() {
if ($('#settings_drafts_go_automatic_backX0').prop('checked') && $('#settings_drafts_after_new_logging_view_logX0').prop('checked')) {
$('#settings_drafts_after_new_logging_view_logX0')[0].click();
}
}, false);
$('#settings_drafts_after_new_logging_view_log')[0].addEventListener("click", function() {
if ($('#settings_drafts_after_new_logging_view_log').prop('checked') && $('#settings_drafts_go_automatic_back').prop('checked')) {
$('#settings_drafts_go_automatic_back')[0].click();
}
}, false);
$('#settings_drafts_after_new_logging_view_logX0')[0].addEventListener("click", function() {
if ($('#settings_drafts_after_new_logging_view_logX0').prop('checked') && $('#settings_drafts_go_automatic_backX0').prop('checked')) {
$('#settings_drafts_go_automatic_backX0')[0].click();
}
}, 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_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");
setEvForDouPara("settings_show_eventday", "click");
setEvForDouPara("settings_show_eventtime_with_24_hours", "click");
setEvForDouPara("settings_drafts_go_automatic_back", "click");
setEvForDouPara("settings_drafts_after_new_logging_view_log", "click");
setEvForDouPara("settings_drafts_after_new_logging_view_log_button", "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_lackey_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_lackey_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_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_thumbnails", "settings_public_profile_avatar_show_thumbnail");
setEvForDepPara("settings_show_thumbnails", "settings_listing_bigger_avatar_with_mouse");
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_thumbnailsX0", "settings_public_profile_avatar_show_thumbnail");
setEvForDepPara("settings_show_thumbnailsX0", "settings_listing_bigger_avatar_with_mouse");
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_show_thumbnailsX1", "settings_public_profile_avatar_show_thumbnail");
setEvForDepPara("settings_show_thumbnailsX1", "settings_listing_bigger_avatar_with_mouse");
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_browse_map_icon_new_tab");
setEvForDepPara("settings_map_overview_build", "settings_map_overview_search_map_icon");
setEvForDepPara("settings_map_overview_build", "settings_map_overview_search_map_icon_new_tab");
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_add_link_komoot_on_gc_map", "settings_switch_to_komoot_in_same_tab");
setEvForDepPara("settings_add_link_wmthiking_on_gc_map", "settings_switch_to_wmthiking_in_same_tab");
setEvForDepPara("settings_add_link_wmtcycling_on_gc_map", "settings_switch_to_wmtcycling_in_same_tab");
setEvForDepPara("settings_add_link_wmtmtb_on_gc_map", "settings_switch_to_wmtmtb_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_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_but_searchmap", "settings_but_searchmap_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_add_log_templates","settings_log_template_name[0]");
setEvForDepPara("settings_add_log_templates","settings_log_template[0]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[1]");
setEvForDepPara("settings_add_log_templates","settings_log_template[1]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[2]");
setEvForDepPara("settings_add_log_templates","settings_log_template[2]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[3]");
setEvForDepPara("settings_add_log_templates","settings_log_template[3]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[4]");
setEvForDepPara("settings_add_log_templates","settings_log_template[4]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[5]");
setEvForDepPara("settings_add_log_templates","settings_log_template[5]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[6]");
setEvForDepPara("settings_add_log_templates","settings_log_template[6]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[7]");
setEvForDepPara("settings_add_log_templates","settings_log_template[7]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[8]");
setEvForDepPara("settings_add_log_templates","settings_log_template[8]");
setEvForDepPara("settings_add_log_templates","settings_log_template_name[9]");
setEvForDepPara("settings_add_log_templates","settings_log_template[9]");
setEvForDepPara("settings_add_log_templates","settings_add_cache_log_signature_as_log_template");
setEvForDepPara("settings_add_log_templates","settings_add_tb_log_signature_as_log_template");
setEvForDepPara("settings_add_cache_log_signature","settings_log_signature");
setEvForDepPara("settings_add_cache_log_signature","settings_log_signature_on_fieldnotes");
setEvForDepPara("settings_add_tb_log_signature","settings_tb_signature");
setEvForDepPara("settings_default_logtype_control","settings_default_logtype");
setEvForDepPara("settings_default_logtype_control","settings_default_logtype_event");
setEvForDepPara("settings_default_logtype_control","settings_default_logtype_owner");
setEvForDepPara("settings_default_logtype_control","settings_default_tb_logtype");
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");
setEvForDepPara("settings_drafts_download_show_button", "settings_drafts_download_change_logdate");
setEvForDepPara("settings_searchmap_improve_add_to_list","settings_searchmap_improve_add_to_list_height");
setEvForDepPara("settings_drafts_after_new_logging_view_log", "settings_drafts_after_new_logging_view_log_button");
setEvForDepPara("settings_drafts_after_new_logging_view_log", "settings_drafts_after_new_logging_view_log_buttonX0");
setEvForDepPara("settings_drafts_after_new_logging_view_logX0", "settings_drafts_after_new_logging_view_log_button");
setEvForDepPara("settings_drafts_after_new_logging_view_logX0", "settings_drafts_after_new_logging_view_log_buttonX0");
setEvForDepPara("settings_show_eventinfo_in_desc", "settings_show_eventinfo_in_desc_bold");
setEvForDepPara("settings_show_eventinfo_in_desc", "settings_show_eventdayX1");
setEvForDepPara("settings_show_eventinfo_in_desc", "settings_show_eventtime_with_24_hoursX0");
setEvForDepPara("settings_compact_layout_new_dashboard", "settings_row_hide_new_dashboard");
setEvForDepPara("settings_use_gclh_layercontrol","settings_searchmap_autoupdate_after_dragging");
setEvForDepPara("settings_use_gclh_layercontrol","settings_searchmap_show_cache_display_options");
setEvForDepPara("settings_use_gclh_layercontrol_on_search_map","settings_searchmap_autoupdate_after_dragging");
setEvForDepPara("settings_use_gclh_layercontrol_on_search_map","settings_searchmap_show_cache_display_options");
// 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));
// Custom links for cache listing.
var settings_individual_links = {};
var lines = $('table.individual_links tbody tr');
var nr = 0;
for (var i = 0; i < lines.length; i=i+2) {
settings_individual_links[nr] = {};
settings_individual_links[nr].display = $(lines[i]).find('.ilinks_display')[0].checked;
settings_individual_links[nr].name = $(lines[i]).find('.ilinks_name')[0].value.trim();
settings_individual_links[nr].listing = $(lines[i]).find('.ilinks_listing option')[$(lines[i]).find('.ilinks_listing')[0].selectedIndex].innerText;
settings_individual_links[nr].cachetype = $(lines[i]).find('.ilinks_cachetype option')[$(lines[i]).find('.ilinks_cachetype')[0].selectedIndex].value;
settings_individual_links[nr].href = $(lines[i+1]).find('.ilinks_href')[0].value.trim();
settings_individual_links[nr].newtab = $(lines[i+1]).find('.ilinks_newtab')[0].checked;
nr++;
}
setValue("settings_individual_links", JSON.stringify(settings_individual_links));
// 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("#",""));
setValue("settings_searchmap_improve_add_to_list_height", document.getElementById('settings_searchmap_improve_add_to_list_height').value);
// 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_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_eventtime_with_24_hours',
'settings_show_eventinfo_in_desc',
'settings_show_eventinfo_in_desc_bold',
'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_hide_view_treasures_link',
'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_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_links_google_maps_on_google_search',
'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_add_link_komoot_on_gc_map',
'settings_switch_to_komoot_in_same_tab',
'settings_add_link_wmthiking_on_gc_map',
'settings_switch_to_wmthiking_in_same_tab',
'settings_add_link_wmtcycling_on_gc_map',
'settings_switch_to_wmtcycling_in_same_tab',
'settings_add_link_wmtmtb_on_gc_map',
'settings_switch_to_wmtmtb_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_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_add_log_templates',
'settings_add_cache_log_signature_as_log_template',
'settings_add_tb_log_signature_as_log_template',
'settings_add_cache_log_signature',
'settings_log_signature_on_fieldnotes',
'settings_add_tb_log_signature',
'settings_vip_show_nofound',
'settings_use_gclh_layercontrol',
'settings_use_gclh_layercontrol_on_browse_map',
'settings_use_gclh_layercontrol_on_search_map',
'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_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_statistic_set_name_in_map',
'settings_map_percentage_statistic',
'settings_improve_add_to_list',
'settings_show_individual_links',
'settings_show_flopps_link',
'settings_show_brouter_link',
'settings_show_bikerouter_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_but_search_map',
'settings_but_search_map_new_tab',
'settings_but_searchmap',
'settings_but_searchmap_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_row_hide_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_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_show_lackey_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_searchmap_show_cache_display_options',
'settings_compact_layout_cod',
'settings_show_button_fav_proz_cod',
'settings_show_compact_certitude_information',
'settings_anonymous_on_certitude',
'settings_change_font_cache_notes',
'settings_larger_map_as_browse_map',
'settings_fav_proz_cod',
'settings_prevent_watchclick_popup',
'settings_upgrade_button_header_remove',
'settings_unsaved_log_message',
'settings_sort_map_layers',
'settings_add_overlay_wmthiking',
'settings_add_overlay_wmtcycling',
'settings_add_overlay_wmtmtb',
'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_drafts_after_new_logging_view_log',
'settings_drafts_after_new_logging_view_log_button',
'settings_after_new_logging_view_log',
'settings_listing_hide_external_link_warning',
'settings_listing_links_new_tab',
'settings_public_profile_avatar_show_thumbnail',
'settings_drafts_download_show_button',
'settings_drafts_download_change_logdate',
'settings_dashboard_show_logs_in_markdown',
'settings_public_profile_smaller_privacy_btn',
'settings_searchmap_improve_add_to_list',
'settings_improve_notifications',
'settings_dim_lost_trackables',
'settings_remove_target_log_form',
'settings_remove_target_log_view',
'settings_hide_locked_tbs_log_form',
'settings_hide_own_tbs_log_form',
'settings_hide_share_log_button_log_view',
'settings_dashboard_hide_tb_activity',
'settings_dashboard_hide_right_sidebar',
'settings_dashboard_build_menu_old_db_in_new_db',
'settings_button_sort_tbs_by_name_log_form',
'settings_larger_content_width_log_form',
'settings_less_space_log_lines_log_form',
'settings_listing_bigger_avatar_with_mouse',
'settings_listing_ctoc_coords_waypoints',
'settings_default_logtype_control',
'settings_listing_add_county_to_place',
'settings_maps_add_county_to_place',
'settings_message_add_gc_code',
);
for (var i = 0; i < checkboxes.length; i++) {
if (document.getElementById(checkboxes[i])) setValue(checkboxes[i], document.getElementById(checkboxes[i]).checked);
}
// Remove hidden banners.
if (!settings_remove_banner) {
settings_remove_banner_text_ids = [];
setValue("settings_remove_banner_text_ids", JSON.stringify(settings_remove_banner_text_ids));
}
// 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);
}
}
}
///////////////////////////////////
// 6.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("#", "10");
newParameterOn2 = d.replace("#", "03");
newParameterOn3 = d.replace("#", "06");
newParameterLL1 = s.replace("#", "10");
newParameterLL2 = s.replace("#", "03");
newParameterLL3 = s.replace("#", "06");
//<-- $$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 "
";}
// 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 += "
";
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;
}
///////////////////////////////
// 6.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|settings_remove_banner_text_ids|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);
}
//////////////////////////////
// 6.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 += "
working...
";
html += "authenticate";
html += " ";
html += "";
html += "
";
html += "
Manual (click to hide/show)
";
html += "
";
html += "";
html += " ";
html += "";
html += " | ";
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);
});
}
//////////////////////////////////////
// 6.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) {
return a.name.localeCompare(b.name, undefined, {'numeric': true });
}
function gcOld(a, b) {
return a.referenceCode.localeCompare(b.referenceCode);
}
function gcNew(a, b) {
return b.referenceCode.localeCompare(a.referenceCode);
}
// 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()) {
if (doAlert != false) alert("This GC little helper II functionality is not available at this page. Please go to the \"Dashboard\" page, there is anyway all of these functionality available.");
return false;
}
return true;
}
// Is page own public profile?
function isOwnPublicProfile() {
return is_page('publicProfile') && $('#ctl00_ProfileHead_ProfileHeader_lblMemberName').html() == global_me;
}
// 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;}
// Convert a 12 hour time string to a 24 hour time string.
// Examples: 12:00 AM->00:00 / 12:30 AM->00:30 / 01:30 AM->01:30 / 00:00 PM->12:00 / 01:30 PM->13:30
function convert12To24Hour(str) {
let dString = '01 Jan 2000 ' + str;
let dParse = Date.parse(dString);
let date = new Date(dParse);
let tString = date.toLocaleTimeString(window.navigator.language, {hour: '2-digit', minute: '2-digit'});
return tString;
}
// 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(format = 'dd.mm.yy') {
var now = new Date();
var aDate = $.datepicker.formatDate(format, now);
var hrs = now.getHours();
var min = now.getMinutes();
var sec = now.getSeconds();
hrs = ((hrs < 10) ? '0' + hrs : hrs);
min = ((min < 10) ? '0' + min : min);
sec = ((sec < 10) ? '0' + sec : sec);
var aTime = hrs+':'+min;
var aDateTime = aDate+' '+aTime;
var aDateBigtime = aDate+' '+hrs+':'+min+':'+sec;
return [aDate, aTime, aDateTime, aDateBigtime];
}
// 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: 9998; 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';
else if (cacheType.match(/GPS Adventures Exhibit Cache/i)) cacheSymbol = '#gpsa';
else if (cacheType.match(/Block Party/i)) cacheSymbol = '#blockparty'
}
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: Before 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 createCounterElement(countername, textarea, options={maxLength: undefined, showWords: false, anchor: null, initLength: 0}) {
let counterelement = document.createElement('span');
let counterspan = document.createElement('p');
const maxLength = options.maxLength || textarea.maxLength;
counterspan.style = 'margin-bottom: 0px';
counterspan.id = countername;
counterspan.innerHTML = "Length: ";
const length = $(textarea).val().length || options.initLength;
if (length >= maxLength)
counterelement.innerHTML = `${length}/${maxLength}`;
else counterelement.innerHTML = `${length}/${maxLength}`;
counterspan.appendChild(counterelement);
if (options.anchor) options.anchor.append(counterspan);
else textarea.parentNode.append(counterspan);
textarea.addEventListener("keyup", function() {
limitedField(textarea, $(counterelement).find('span')[0], maxLength, options.showWords);
}, false);
textarea.addEventListener("change", function() {
limitedField(textarea, $(counterelement).find('span')[0], maxLength, options.showWords);
}, false);
}
function limitedField(editor, counterelement, maxLength, showWords) {
changed = true;
var length = $(editor).val().length;
if (length >= maxLength)
counterelement.innerHTML = `${length}/${maxLength}`;
else counterelement.innerHTML = length + '/' + maxLength;
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.
//////////////////////////////
// 7. 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;
}
/**
* Can be used to get and insert county (and other location) informations.
* The informations are requested from nominatim.openstreetmap.org
* @param {float} lat The latitude of the cache.
* @param {float} lon The longitude of the cache.
* @param {function} func A function with three arguments, the data of the request. The function can be used to insert the data to the page.
*/
const insertCountyInformation = (lat, lon, func) => {
try {
let url1 = `https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lon}&accept-language=en&format=json`;
fetch(url1).then(res => {
if (res.ok) return res.json();
else {
console.error("GClh_ERROR (no header alert) - insertCountyInformation - " + `Request to nominatim.openstreetmap.org language en fails\nHTTP-Status-Code: ${res.status}\nResponse details:`);
console.log(res);
}
}).then(data1 => {
if (data1 && data1.address) {
var a1 = data1.address;
if (a1 && a1.country_code && a1.country_code.match(/(de|at)/) && a1.country) {
let url2 = `https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lon}&accept-language=de&format=json`;
fetch(url2).then(res => {
if (res.ok) return res.json();
else {
console.error("GClh_ERROR (no header alert) - insertCountyInformation - " + `Request to nominatim.openstreetmap.org language de fails\nHTTP-Status-Code: ${res.status}\nResponse details:`);
console.log(res);
}
}).then(data2 => {
if (data2 && data2.address) {
var a2 = data2.address;
if (a2 && (a2.state || a2.city) && (a2.county || a2.city) && data2.display_name) {
var county = a2.county ? a2.county : a2.city;
var state = a2.state ? a2.state : a2.city;
var placeWithCountry = county + ', ' + state + ', ' + a1.country;
var placeWithoutCountry = county + ', ' + state;
var placeComplete = data2.display_name;
func(placeWithCountry, placeWithoutCountry, placeComplete);
}
}
});
}
}
});
} catch (e) {gclh_error("insertCountyInformation", e);}
}
// 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 decode_innerText(v_mit_innerHTML) {
var elem = document.createElement('textarea');
elem.innerHTML = v_mit_innerHTML.innerText;
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;
}
// Convert special characters to HTML entities.
function convertForHTML(s) {
s = s.replace(/"/g,'"').replace(/'/g,''').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('
');
}
$("#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(/^(\/live|)\/play\/map/)) status = true;
} else if (name == "map") {
if (url.match(/^\/map/)) status = true;
} else if (name == "find_cache") {
if (url.match(/^\/play\/(results|search|geocache)/)) status = true;
} else if (name == "collection_1") {
if (url.match(/^\/play\/(friendleague|leaderboard|treasure|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|live\/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 if (name == "logbook") { // View all logs.
if (url.match(/^\/seek\/geocache_logs\.aspx/)) status = true;
} else if (name == 'logform') {
if (url.match(/^\/live\/(?:geocache|trackable)\/(?:gc|tb)[a-z0-9]+/i)) 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 + ";");}
// Run a function as soon as a specific element is available.
function waitForElementThenRun(elem, func, timeout=5000, waitTime=10, totalTime=0) {
if ($(elem)[0]) func();
else {
if ((totalTime += waitTime) < timeout) setTimeout(() => waitForElementThenRun(elem, func, timeout, waitTime, totalTime), waitTime);
else console.error(elem + ' not found within ' + totalTime/1000 + 's');
}
}
// 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;
}
// Simple a quick schnaader's checksum function.
String.prototype.checksum = function () {
try {
// We use the TextEncoder to use UFT-8, so the seed will never get out of range.
let encoder = new TextEncoder();
let data = encoder.encode(this);
let seed = 0x12345678;
for (let i = 0; i < data.length; i++) {
seed += (data[i] * (i + 1));
}
return (seed & 0xffffffff).toString(16);
} catch (e) {gclh_error("Error bulding checksum", e);}
}
Date.prototype.getWeekday = function(short = false) {
let weekdays = short ? ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] :
['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
return weekdays[this.getDay()];
}
start(this);