From 6f92a0eea02d52a7cc424d78b9665c641a69957e Mon Sep 17 00:00:00 2001 From: 2Abendsegler <2Abendsegler@users.noreply.github.com> Date: Wed, 18 Dec 2019 20:01:25 +0100 Subject: [PATCH] One click watching feature doesn't work in other languages than english. #1129 --- gc_little_helper_II.user.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/gc_little_helper_II.user.js b/gc_little_helper_II.user.js index 4c2c76089..9b2e608ca 100644 --- a/gc_little_helper_II.user.js +++ b/gc_little_helper_II.user.js @@ -2076,24 +2076,28 @@ var mainGC = function() { $(link)[0].style.backgroundImage = (buttonSetTo == 'Ignore' ? 'url(/images/icons/16/ignore.png)' : 'url('+global_stop_ignore_icon+')'); } +//xxxx // Improve Watch button handling. (Not for Stop Watching handling.) - if (is_page("cache_listing") && settings_use_one_click_watching && $('#ctl00_ContentBody_GeoNav_uxWatchlistBtn a')[0] && !$('#ctl00_ContentBody_GeoNav_uxWatchlistBtn a')[0].href.match(/action=rem/)) { +// if (is_page("cache_listing") && settings_use_one_click_watching && $('#ctl00_ContentBody_GeoNav_uxWatchlistBtn a')[0] && !$('#ctl00_ContentBody_GeoNav_uxWatchlistBtn a')[0].href.match(/action=rem/)) { + if (is_page("cache_listing") && settings_use_one_click_watching && $('#ctl00_ContentBody_GeoNav_uxWatchlistBtn a')[0]) { try { - // Set Watch. - changeWatchButton('Watch'); - // Prepare one click watching. var link = '#ctl00_ContentBody_GeoNav_uxWatchlistBtn a'; - $(link).attr('data-url', $(link)[0].href); - var wID = $(link)[0].href.match(/aspx\?w=([0-9]+)/); - $(link).attr('data-wID', wID[1]); - $(link)[0].href = 'javascript:void(0);'; - $(link)[0].addEventListener("click", oneClickWatching, false); - changeWatchButton($(link)[0].innerHTML); - var saved = document.createElement('span'); - saved.setAttribute('id', 'watchSaved'); - saved.appendChild(document.createTextNode('saved')); - $('#ctl00_ContentBody_GeoNav_uxWatchlistBtn')[0].append(saved); + if ($(link)[0].href.match(/action=rem/)) { + $(link)[0].innerHTML = 'Stop Watching'; + } else { + $(link)[0].innerHTML = 'Watch'; + $(link).attr('data-url', $(link)[0].href); + var wID = $(link)[0].href.match(/aspx\?w=([0-9]+)/); + $(link).attr('data-wID', wID[1]); + $(link)[0].href = 'javascript:void(0);'; + $(link)[0].addEventListener("click", oneClickWatching, false); + changeWatchButton($(link)[0].innerHTML); + var saved = document.createElement('span'); + saved.setAttribute('id', 'watchSaved'); + saved.appendChild(document.createTextNode('saved')); + $('#ctl00_ContentBody_GeoNav_uxWatchlistBtn')[0].append(saved); + } } catch(e) {gclh_error("Improve Watch button handling.",e);} } function oneClickWatching() {