View previous topic :: View next topic |
Author |
Message |
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Jun 18, 2016 5:45 pm Post subject: View Your Own Posts (egosearch) Fix |
|
|
Based on this thread.
Here is a script that will fix the forum links so that you can view your own posts (egosearch) and navigate all sub-pages correctly when viewing member posts.
EDIT:
Script updated. Credit goes to mgr.inz.Player for the sub-pages fix.
You may need a plugin for your browser to be able to run user scripts (e.g. greasemonkey, tampermonkey or one of the other monkeys).
Important:
You will need to replace my handle with your own, as shown below:
Code: | // ==UserScript==
// @name CE Link Fixer
// @namespace CE Link Fixer
// @include *forum.cheatengine.org/*
// @version 1
// @grant None
// ==/UserScript==
var lianks = document.evaluate(
"//a[contains(@href, 'search_id=egosearch')]",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < lianks.snapshotLength; i++) {
var link = lianks.snapshotItem(i);
link.href = link.href.replace("search_id=egosearch","search_author=%2B%2BMETHOS") //Change %2B%2BMETHOS to your username.
}
//Credit goes to mgr.inz.Player for remaining code
(function () {
var links = document.evaluate("//a[contains(@href, 'search_id')]", document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var author = window.location.href.match(/search_author=(\S+)[$|\/|&]?/i)[1];
for (var i=0; i < links.snapshotLength; i++)
{
var thisLink = links.snapshotItem(i);
thisLink.href = thisLink.href.replace(/search_id=\d+/, "search_author="+author);
}
}()); |
Last edited by ++METHOS on Sun Jun 19, 2016 2:40 am; edited 3 times in total |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Jun 18, 2016 6:14 pm Post subject: |
|
|
All scrunched up to run in your browser's address bar.
Code: | javascript:l=document.getElementsByTagName("a");for(i=0;i<l.length;++i)if(l[i].href.includes("search_id="))l[i].href=window.location.href+l[i].href.substring(l[i].href.lastIndexOf('&'));l=nil |
Code: | l=document.getElementsByTagName("a")
for(i=0i<l.length;++i)
if(l[i].href.includes("search_id="))
l[i].href=window.location.href+l[i].href.substring(l[i].href.lastIndexOf('&'))
l=nil |
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Jun 18, 2016 6:26 pm Post subject: |
|
|
Thanks, Zanzer.
Did you test this, by chance?
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Jun 18, 2016 7:14 pm Post subject: |
|
|
Not really. Just ran it once and saw it changed the links.
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Jun 19, 2016 2:04 am Post subject: |
|
|
Hmm. What browser are you using? It's not working on my end (firefox 47.0).
Thanks.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Jun 19, 2016 2:29 am Post subject: |
|
|
That works!
Thanks, mgr.inz.Player. Combining yours with mine fixes everything:
Code: | var lianks = document.evaluate(
"//a[contains(@href, 'search_id=egosearch')]",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < lianks.snapshotLength; i++) {
var link = lianks.snapshotItem(i);
link.href = link.href.replace("search_id=egosearch","search_author=%2B%2BMETHOS") //Change %2B%2BMETHOS to your username.
}
(function () {
var links = document.evaluate("//a[contains(@href, 'search_id')]", document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var author = window.location.href.match(/search_author=(\S+)[$|\/|&]?/i)[1];
for (var i=0; i < links.snapshotLength; i++)
{
var thisLink = links.snapshotItem(i);
thisLink.href = thisLink.href.replace(/search_id=\d+/, "search_author="+author);
}
}()); |
OP updated.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Jun 19, 2016 9:40 pm Post subject: |
|
|
Firefox likes to delete the beginning "javascript:" line when you paste into the address bar. Security "feature".
Also, you need to set a property to let it execute JavaScript from the address bar.
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Jun 19, 2016 9:46 pm Post subject: |
|
|
I noticed that. I also tested in Chrome Browser, after thinking that one of my blockers might've been interfering with it. I had no luck with that, also. But, I'm sure it was just my own stupidity that was the problem.
|
|
Back to top |
|
|
|