wpisz tutaj kod "Nie jest obsługiwany przez javascript, ponieważ próbuję również znaleźć metody, aby zebrać: odwiedzone linki danych, aby ukryć odwiedzany węzeł.
niektóre odniesienia: Prywatność i odwiedzone selektor - CSS | MDN
Jeśli wszystko, na czym zależy, to stylizacja, powinieneś być w stanie osiągnąć to poprzez CSS, ale to, co jest wyświetlane na ekranie, powinno być jedynym sposobem na obserwowanie jego odwiedzin.
Robię w ten sposób w usercriptu dla Greasemonkey, aby te strony bez stylu odwiedzonego wyświetlały te już odwiedzone linki.
// ==UserScript==
// @description ADD a:visited for CSS
// @include *annalscts.com*
// @include *thejns.org*
// @include *turkishneurosurgery.org.tr*
// @include *nature.com*
// @include *academic.oup.com*
// @include *sagepub.com*
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle('a:visited {color:#EE5665 !important}');
Aby zebrać dane do lokalnego używam Greasemonkey API
GM_setValue
GM_getValue
Właśnie oglądałem tutoriale na YouTube API i spróbuj napisać do userscript
Greasemonkey API: Wartości tylko szukaj tego tytułu na Youtube.
pisane Tutorial: http://nulleffort.com/greasemonkey-api-values/
Greasemonkey Docs: https://wiki.greasespot.net/Greasemonkey_Manual:API
niektóre części mojego userscript
//Firstly, var the ordinary variable preVisitedLinks and assigning to memory variable visitedLinks (At first the value should be undefined)
var preVisitedLinks = GM_getValue("visitedLinks");
unsafeWindow.aclick = function(tlink){
window.open(tlink, '_blank', 'toolbar=yes,scrollbars=yes,resizable=yes,top=10,left=10,width=10,height=10'); // click a button added and get the link visited in my script
//If the ordinary variable preVisitedLinks is undefined (First time running the script)
if(preVisitedLinks.includes('undefined')){
GM_setValue('preVisitedLinks', '|' + tlink.replace('http://paper.pubmed.cn/',''));
}
//If the ordinary variable preVisitedLinks is not undefined, continue to add each new string collect
else{
GM_setValue('preVisitedLinks', preVisitedLinks + '|' + tlink.replace('http://paper.pubmed.cn/',''));
}
//The ordinary variable preVisitedLinks assigning to memory variable visitedLinks value. The magic is the variable name the same.
preVisitedLinks = GM_getValue("preVisitedLinks");
if(preVisitedLinks.length > 27500){
preVisitedLinks = preVisitedLinks.substr(preVisitedLinks.length - 27500);
}
//The memory variable visitedLinks value assigning to the ordinary variable preVisitedLinks value
GM_setValue('visitedLinks',preVisitedLinks);
console.info(preVisitedLinks);
};
I w jakimś miejscu używam ciąg wykryć odwiedzanym kod linki
if(preVisitedLinks.includes(trs[i].querySelectorAll('li')[0].querySelector('a').href.replace('http://xxx.xxxx.com/',''))){
trs[i].remove();
}
Ten rodzaj wygląda jak nowe pytanie. Ponadto będziesz chciał umieścić tutaj odpowiedni kod i dokumentację, aby wesprzeć odpowiedź, a nie link do odpowiedzi. Mogą się zmieniać, wpływając na ważność tego, co odpowiadasz. – rfornal
Dzięki za wskazanie tego :) Poprawiłem moją odpowiedź. – Maciej