Slyfoot ([info]slyfoot) wrote in [info]lj_nifty,
@ 2008-03-18 06:13:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
View All Journals And Communities In Your S2 Style (Opera)
I don't know if this has been posted here yet, but if not I'm sure that someone might appreciate it. Here's a simple JavaScript that makes it possible to always view other journals and communities in your own layout style (S2 only). First create a text file such as "LJ.JS" then paste the following code:



// ==UserScript==
// @name My_LiveJournal_Style
// @include http://*.livejournal.com/*
// @exclude http://*.livejournal.com/*s2id=*
// @exclude http://*.livejournal.com/*style=*
// @exclude http://*.livejournal.com/*.bml*
// @exclude http://www.livejournal.com/doc/*
// @exclude http://*.livejournal.com/profile*
// @exclude http://*.livejournal.com/data/*
// @exclude http://pics.livejournal.com/*
// @exclude http://www.livejournal.com/portal/*
// ==/UserScript==

location.search+=(location.search?'&':'?')+'style=mine';




After you do that, save the file and place LJ.JS in whatever directory you want. Go to Tools -> Preferences -> Advanced Tab -> Content, and click on the Manage Site Preferences button. Add "livejournal.com" and click the "Edit" button. When the Site Preferences dialog pops up, click the Scripting tab, be sure that "Enable Javascript" is checked, then look for the "User JavaScript Files" text box and then enter the directory where you placed LJ.JS

After that, you should always be able to see communities and journals in your own S2 style when you are logged in, even when you reply to comments from within emails!

I did this with help from [info]cat_irix because I couldn't get the Greasemonkey script to work with Opera.


(Post a new comment)


[info]nikolasco
2008-03-18 02:51 pm UTC (link)
It might be nice to put the code behind an lj-cut.

Also, this script should work just fine with Greasemonkey (in addition to Opera). It's worth noting that, instead of rewriting links, this script causes a redirect; it might be nice to do link re-writing (using document.getElementsByTagName("a")).

In any case, this is beautiful in its simplicity.

(Reply to this) (Thread)


[info]slyfoot
2008-03-18 05:01 pm UTC (link)
I added a cut.

Thanks for mentioning that it works with GM. Opera was the only browser I tested it with.

(Reply to this) (Parent)


[info]gipa
2008-03-18 03:13 pm UTC (link)
It is much easier to just put a button on your link bar that points to:
javascript:void(open(location.href+'?style=mine',%20'_top',%20''));
Just one click and you're home free.

(Reply to this) (Thread)


[info]slyfoot
2008-03-18 05:02 pm UTC (link)
Some days I am just too lazy to click a button, haha.

(Reply to this) (Parent)


[info]dimrub
2008-03-18 03:15 pm UTC (link)
Wow, clever! That's the shortest GM script I've ever seen :).

(Reply to this) (Thread)


[info]slyfoot
2008-03-18 05:26 pm UTC (link)
Well, [info]cat_irix is probably more clever than I am, but I have my moments too. :D

(Reply to this) (Parent)


[info]nakeisha
2008-03-18 05:34 pm UTC (link)
Thank you so much for this.

I use Opera and love it.

I've saved it for future reference as I'm still not sure if I want to do this as I do quite enjoy seeing other people's journals. However, oddly enough I was thinking just the other day that there are more and more journals which I have problems reading because of colours etc, and was seriously thinking about finding out how to do this. So thank you!

(Reply to this) (Thread)


[info]slyfoot
2008-03-18 05:39 pm UTC (link)
Well, here's some good news: You can actually create a Toolbar button that you can click whenever you want to view a particular journal in your style:

javascript:location.search+=(location.search?'&':'?')+'style=mine'

Sometimes I am just too lazy to click a button and I wanted the change to be more automatic. But either way, Opera rules. :D

ETA: Also, it's worth noting that you can add specific journals by altering the includes. So instead of "// @include http://*.livejournal.com/*" you could add individual journals such as "// @include http://somejournalhere.livejournal.com/*"

That would give you control over exactly which journals you view in your own style.

Edited at 2008-03-18 05:54 pm UTC

(Reply to this) (Parent)(Thread)


[info]nakeisha
2008-03-18 05:55 pm UTC (link)
Ooh, thank you.

That's a brilliant temporary solution (I do fence sitting and compromises, very British *g*).

Now all I have to do is work out how to create buttons (as in all the years I've been using Opera I've never done that thing).

Opera does indeed rule :-)

Thank you again.

(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-18 05:58 pm UTC (link)
Try this if you get stuck: Opera Custom Button & Command Creator

(Reply to this) (Parent)(Thread)


[info]nakeisha
2008-03-18 06:11 pm UTC (link)
And yet another 'thank you'.

Really, thank you for the trouble you've gone to. I do appreciate it.

(Reply to this) (Parent)


[info]nakeisha
2008-03-19 12:19 pm UTC (link)
Okay, I have to confess that I'm stuck.

I can make a button - thanks to this link. What I can't do, however, is to get the button to do anything.

Where do I need to put the:

location.search+=(location.search?'&':'?')+'style=mine';

I've tried putting it in the 'action' in the 'Normal Command Buttons' but that didn't work.

I then tried copying it into a text document and using the 'External Program Buttons' and choosing that document to 'execute' but again, nothing.

I can get the button, but not the action.

I can get the whole thing, using your excellent script to work, i.e. for all journals to be in my style - but not the button thing.

I'm obviously doing something wrong or putting something in the wrong place.

Are you able to help at all, please? I've never played with java script or done anything like this.

Any assistance would be much appreciated.

Thank you in advance.

(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-19 03:08 pm UTC (link)
Hmm, I never tried that interface, so I don't really know how it works, sorry. But I played around and here's another way to do it:

Bookmark a page (any page). Go to Bookmarks -> Manage Bookmarks and replace the URL of the bookmark with "javascript:location.search+=(location.search?'&':'?')+'style=mine';" (no quotes). Give it a short, simple name, like "LJ". While you are in Manage Bookmarks, drag the bookmark to whatever toolbar you want to use, then you should be in business.

Let me know if that did the trick for you.

Edited at 2008-03-19 03:33 pm UTC

(Reply to this) (Parent)(Thread)


[info]nakeisha
2008-03-19 03:52 pm UTC (link)
Thank you!

Thank you!

Thank you!

It works. That's really great. I'm so pleased.

Thank you for going to so much trouble to help out a perfect stranger. I really do appreciate it.

(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-19 03:53 pm UTC (link)
Hooray! Niftiness complete. I'm glad you're all set now.

(Reply to this) (Parent)(Thread)


[info]nakeisha
2008-03-22 03:50 pm UTC (link)
Just popping up again a few days later to say how much I'm enjoying my nifty button.

It's great to be able to see a journal and admire (or not *g*) the scheme, but then to read it just simply turn it into my layout with a simple mouse click.

I love my new toy *blushes at own enthusiasm*

(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-23 04:32 am UTC (link)
I'm glad to hear it. :)

(Reply to this) (Parent)


[info]nakeisha
2008-03-18 06:03 pm UTC (link)
And once more - thank you so much again.

I really appreciate this. That is great.

(Reply to this) (Parent)


[info]doingsoso
2008-03-31 04:57 pm UTC (link)
Okay so for complete noobs to any kind of scripting or code. What do I do with this:

javascript:location.search+=(location.search?'&':'?')+'style=mine'

Now that I've got it?

I haven't a clue what to do with it to make a button. And here I was feeling proud of myself for trial and erroring my way through a profile layout, LOL.

Is this just for Opera or will it work on FireFox also?

For the sake of the totally clueless. Step by step instructions please?


(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-31 05:10 pm UTC (link)
I don't know if it will work for Firefox, but further down there are instructions about dragging a bookmark to a toolbar. Create a bookmark as you normally would, edit the URL and paste the code in it, then drag it to a Toolbar.

(Reply to this) (Parent)


[info]tobymalfoy
2008-03-18 06:31 pm UTC (link)
I'm not going to use this, I'm using Firefox and the Greasemonkey script. I'm just curious why you say that it's for S2 only, since the "?style=mine" thing works perfectly well for me and I'm using S1?

(Reply to this) (Thread)


[info]slyfoot
2008-03-18 06:37 pm UTC (link)
Because I tested it using my old S1 Tabular Indent style, and it doesn't work consistently across the board, whereas it does work with S2. Why? I dunno, but it might have something to do with S1 support being abandoned.

(Reply to this) (Parent)(Thread)


[info]phoenixdreaming
2008-03-18 07:35 pm UTC (link)
I think it's because style=mine only works on certain journal pages if you're using S1; it's fine on comment pages, which is where most people use it anyway. On pages with a corresponding S1 view (recent, calendar, day, friends page), though, it displays whatever the S1 style is selected for the journal being viewed -- not the viewer's own style.

This was how it worked when the feature came in; I don't *think* it's changed, but if anyone's seen different behaviour, I'd be interested in hearing.

(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-18 07:45 pm UTC (link)
That corresponds to what I've noticed, yeah.

(Reply to this) (Parent)


[info]av8rmike
2008-03-18 07:36 pm UTC (link)
Not all page views are supported in S1. That (and lack of tag support) is the extent to which S1 is "abandoned".

(Reply to this) (Parent)

ur a genius, sir
[info]slavezombie
2008-03-18 09:51 pm UTC (link)
That was the easiest introduction to javascript niftiness I've ever followed. Thanks. I'm gonna add this to my memories too.

BTW, I would've used the <pre> tag to emphasize the javascript code to copy and past to the lj.js file.

// ==UserScript==
// @name My_LiveJournal_Style
// @include http://*.livejournal.com/*
// @exclude http://*.livejournal.com/*s2id=*
// @exclude http://*.livejournal.com/*style=*
// @exclude http://*.livejournal.com/*.bml*
// @exclude http://www.livejournal.com/doc/*
// @exclude http://*.livejournal.com/profile*
// @exclude http://*.livejournal.com/data/*
// @exclude http://pics.livejournal.com/*
// @exclude http://www.livejournal.com/portal/*
// ==/UserScript==

location.search+=(location.search?'&':'?')+'style=mine';

(Reply to this) (Thread)

Re: ur a genius, sir
[info]slyfoot
2008-03-18 09:58 pm UTC (link)
Good idea. I've added the "pre" tag.

(Reply to this) (Parent)


[info]kate_nepveu
2008-03-19 03:19 pm UTC (link)
Wicked nifty! Thanks!

(Reply to this) (Thread)


[info]kate_nepveu
2008-03-19 04:46 pm UTC (link)
PS: if you want this to work for things originally linked in format=light, change the last line to

var str=location.search;str=str.replace(/format=light/g,'style=mine');var sep=(str?'&':'?');location.search=((str.indexOf('style=mine')==-1)?str+sep+'style=mine':str);


as seen here: http://murklins.talkoncorners.net/bookmarklets.html

(Reply to this) (Parent)(Thread)


[info]slyfoot
2008-03-19 04:48 pm UTC (link)
Hmm, I hadn't thought of that! Thanks for the tip.

(Reply to this) (Parent)(Thread)


[info]kate_nepveu
2008-03-19 04:51 pm UTC (link)
I suspect much of LJ doesn't see format=light at all, but for the people who do, this variant is very handy.

(Reply to this) (Parent)


[info]prissi
2008-03-27 12:25 am UTC (link)
Very neat. I hope you don't mind me asking, but would you know if it's possible to adapt this somehow so that all other journal/community comment pages only appear siteschemed, while your own comment pages appear in your journal style?

(Reply to this) (Thread)


[info]slyfoot
2008-03-27 01:14 am UTC (link)
I'm not sure how to do that, sorry. :/

(Reply to this) (Parent)


[info]ms_manna
2008-03-28 01:11 am UTC (link)
This is very cool! I use both Firefox and Opera, so I can be logged into LJ with two accounts at the same time, and it's great to be able to have ?style=mine working in both.

(Reply to this) (Thread)


[info]slyfoot
2008-03-28 01:16 am UTC (link)
I'm glad it's useful!

(Reply to this) (Parent)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…