Forums

RS-Linkify Thread is sticky

Quick find code: 261-262-33-65181208

Hevilmystic
Feb Member 2022

Hevilmystic

Posts: 60,012 Emerald Posts by user Forum Profile RuneMetrics Profile
Hey!

I'm a fond user of the "Make it a different colour if I've viewed it" option, but is there any chance we could have it change the colour if we've viewed the last post by a forum or Jagex mod?

I wouldn't mind if it was a user defined colour, but I'd like a lighter green/a lighter gold colour respectively, if possible.
Unslain Bosses - Clan

07-Jun-2016 21:35:44

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
I can't even remember what's prioritised when it comes to visited colours. I'm assuming J-Mod/F-Mod colours are not overwritten by the last viewed colours.

I really need dig though my code and check as I don't use that feature.

To answer your question, probably not. Linkify can't determine what links you've visited, and even determine the colour of visited links.

Sounds strange but there is reason for it. It comes under privacy. If you can get the visited link colour that means you can determine a persons history. This is a technique used by naughty spammers and advertisers. They run a load of virtual links through a script and get the colour values and then determine where to redirect/target you. Determining your history by a process of elimination kind of thing.

Chrome simply wont allow this.

Now I've said that, I may be able to change the link colour priorities so a visited link (last post J-Mod) will lose its custom colour. But that's assuming I'm remembering how it all works correctly :)

08-Jun-2016 03:18:12

Hevilmystic
Feb Member 2022

Hevilmystic

Posts: 60,012 Emerald Posts by user Forum Profile RuneMetrics Profile
I've caught Linkify being slow, it originally shows it as the custom 'last viewed' colour, and then colours over it with the dark green and gold - so I am guessing it's how you described it :o

I am at a bit of a loss reading through your post because I'm not too sure how that relates to what I mean (this could just be because I'm sleepy) - but this is the option I mean:

http://i.imgur.com/8nW1qAS.png

I meant this:

http://i.imgur.com/6D385An.png

Shows as:

http://i.imgur.com/LZ1adDN.png

Or

http://i.imgur.com/UDT0Mnd.png

Regardless of whether I've viewed it or not. D:
Unslain Bosses - Clan

08-Jun-2016 05:09:15

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Sorry I wasn't very clear.

What I mean is I can't determine if the link is visited or not. The browser can, but RS Linkify can't. The reason for this is due to the privacy issues that I explained rather badly.

Using your image as an example...
http://i.imgur.com/LZ1adDN.png
RS Linkify can assign a colour to the link as it has done here. But it can't read the colour of visited links. I don't think it can even read colour it has assigned to visited links.

So I think the best way to get around this would be to change how RS Linkify prioritises the colouring. Meaning J-Mod/F-Mod posts are not coloured when they have been visited. That means they'll be the pale blue that you have set in your options, unless you haven't clicked it, then it will be green or gold or whatever colour you have assigned (if any).

Damn I feel this post is lacking some details. I can elaborate if you wish, but basically there are really strict rules and limitations when it comes visited links. In chrome they are super strict. I know in firefox it was/is possible to harvest history using the visited link method without the user knowing. Last I heard they tightened it up a bit, but not to the same extent that chrome has. Tbh my info is a little dated now, but chrome led they way for eliminating this privacy breach.

It all seems kind of unrelated, but Chrome is handling the visited link stuff and RS Linkify can't really tell whats happened in terms of colouring. Yes RS Linkify provides the default colours, but can't see how or where they are used.

Hmmm I kind of elaborated without meaning to. There is more to it though, but maybe that's best left for another post.

In short, I think I can do something. Not exactly what you asked but similar :)

08-Jun-2016 06:03:34 - Last edited on 08-Jun-2016 06:05:18 by Indecent Act

AoDude

AoDude

Posts: 1,694 Mithril Posts by user Forum Profile RuneMetrics Profile
The visited link bit is a thing of trickery. It is just a css modification that allows the browsers natural "a:visited" recoloring to act.

Ofcourse, Indy used her magic to fix the links use of the session id mid link "/c=session_id/" in the browser history so the browser correctly identifies visited links between login sessions. Hence the history permission you have to enable.

It appears in this case whomever is using an inline style element:

[code]<a href="forums.ws?15,16,496,65749813,goto,1#5" class="thread-plate__last-post" style="color: rgb(179, 153, 4);"><span class="thread-plate__last-post-time">02/22/2016 08:40:59 AM</span><span class="linkify-crown"></span>by Mod Stacey</a>[/code]

This bit right here:

[code]style="color: rgb(179, 153, 4);"[/code]

Just loaded up an incognito, so it appears that style element is added by linkify. However, you cannot add psudo classes like :visited to inline style elements.

I assume in your code you do it with this line:

[code]$lastpost.css('color', customCol);[/code]

What could be done, is instead of an inline style element, a class or id element could be added with the relevant style code injected... ect.

I can see how reworking this might be a bit of work and the solution may be a bit messier than Indy's original elegant solution. Although Indy has a way with exceeding expectations, curious what her take will be :)

Edit: It appears Indy has beat me to the Post!
AO
Deputy-Owner :
The Nexus CC

08-Jun-2016 06:15:48 - Last edited on 08-Jun-2016 06:17:12 by AoDude

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
^Damn, your ability to read and understand code is impressive to say the least. Seriously I envy you. I find it so hard to make sense of my own code, let alone other peoples code.

AoDude said :
Ofcourse, Indy used her magic to fix the links use of the session id mid link "/c=session_id/" in the browser history so the browser correctly identifies visited links between login sessions. Hence the history permission you have to enable.
Nailed it perfectly!

I think re-ordering how re-colouring is prioritised is the way to go. Keeps a lid on that can of worms. I did think about using the click event and looking at what styles RS Linkify had applied thus determining what to apply next time. But that creates other problems, because landing on that page without using the last post link will result in a failure to recolour correctly. So a cycle of correction and checks and re-checks begins and that's not how I want handle things. I just want to apply what's needed and be done with it, if I can :)

I'm totally open to other approaches, tbh I'm not really in code mode right now. Maybe after a coffee or two I'll get inspired. Don't hesitate toss more things my way, I really appreciate it :)

08-Jun-2016 06:41:01 - Last edited on 08-Jun-2016 08:16:28 by Indecent Act

AoDude

AoDude

Posts: 1,694 Mithril Posts by user Forum Profile RuneMetrics Profile
Found an elegant solution:

scriptsUniversal\background.js Line 367

[code]chrome.tabs.insertCSS(tabId, {code: ".thread-plate__title, .thread-plate__title h3 {color: inherit;}.thread-plate__main-link:visited .thread-plate__title, .thread-plate__last-post:visited, .forum-post__body a:visited {color: " + RSLinkifyOptions.vLinksCol + ";}", runAt: "document_start"});[/code]

To:

[code]chrome.tabs.insertCSS(tabId, {code: ".thread-plate__title, .thread-plate__title h3 {color: inherit;}.thread-plate__main-link:visited .thread-plate__title, .thread-plate__last-post:visited, .forum-post__body a:visited {color: " + RSLinkifyOptions.vLinksCol + " !Important;}", runAt: "document_start"});[/code]

Optionally, you could add another linkify option: True/False Override Custom Link Colors (you/friends/fmods/jmods/others) of Visited Pages

Then above line 367 something like:

[code]var Ovr = "";
if(RSLinkifyOptions.vLinksOvr){
Ovr = " !Important";
}

chrome.tabs.insertCSS(tabId, {code: ".thread-plate__title, .thread-plate__title h3 {color: inherit;}.thread-plate__main-link:visited .thread-plate__title, .thread-plate__last-post:visited, .forum-post__body a:visited {color: " + RSLinkifyOptions.vLinksCol + Ovr + ";}", runAt: "document_start"});[/code]
AO
Deputy-Owner :
The Nexus CC

08-Jun-2016 15:14:29 - Last edited on 08-Jun-2016 15:41:22 by AoDude

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
That's awesome, I didn't even think about
!Important;


I really like that solution. Thank you so much :)

Building on your fine example I think this will do the trick, by setting a default I can drop the if (condition).

Really love your approach with this, so neat and tidy. Big thank you again! :)

[code]
/*
RSLinkifyOptions.vLinksOv = ''; <-- default

or depending on settings...

RSLinkifyOptions.vLinksOv = ' !Important'; <-- optional
*/

chrome.tabs.insertCSS(tabId, {code: ".thread-plate__title, .thread-plate__title h3 {color: inherit;}.thread-plate__main-link:visited .thread-plate__title, .thread-plate__last-post:visited, .forum-post__body a:visited {color: " + RSLinkifyOptions.vLinksCol + RSLinkifyOptions.vLinksOvr + ";}", runAt: "document_start"});
[/code]

Oh when you get a minute, I sent you a message on twitter earlier :)

Edit:
[code]love the code tag :)
[/code]

08-Jun-2016 16:11:15 - Last edited on 08-Jun-2016 16:19:00 by Indecent Act

Quick find code: 261-262-33-65181208 Back to Top