Author Topic: 4chan UserJS Script  (Read 78803 times)

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
4chan UserJS Script
« on: May 31, 2006, 09:37:34 pm »
CROSSPOSTEDDDDD


The 4chan extension for Firefox has a few nice things to offer, and I've found myself using that browser to peruse 4chan at times, even though my primary browser is Opera.  Unfortuantely, nobody seems to have ever written any enhancements for it (that I've ever found), so I decided to write one myself!

http://www.fybertech.com/userjs/fychan.js

This mostly implements the feature I prefer most; loading a full thread right inside the page, instead of loading a seperate page to see the omitted posts.  Just in the time I've been testing it, I've already been finding it pretty useful.

In any case, this is a UserJS script for anyone not in the know.  It's Opera's version of an extension language.  I've found myself using it a lot lately, not just to add features to websites, but to fix other ones that won't work properly in Opera.  It's great.

If you don't know how to install a UserJS script, it's simple.  You can either read the elaborate explantion at http://userjs.org/help/installation , or just:  Go to Tools, Options, Preferences, then the Advanced tab, pick the Content section, click Javascript Options.  In the "My Javascript files" blank, put like "c:\userjs" (minus the quotes), then create that folder on your computer, and copy the script inside.  You'll probably want to right-click/save-as to get the script onto your computer, mind you.

Anyway, if anyone wants to mess around with it and see if they can find any  problems, feel free.  I'm also welcome to suggestions of things to add.  Hope some folks find it useful!

Spug

  • Newbie
  • *
  • Posts: 12
Re: 4chan UserJS Script
« Reply #1 on: June 01, 2006, 02:30:05 am »
My hero  :-*

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #2 on: June 01, 2006, 10:06:30 am »
That's the post I put on their Programming BBS board, and linked to it fralm one in /g/, btw.

The script seems to be warkin good for folks, though a couple mentioned they'd like to be able to shrink the threads back down afterwards, so I'll add that in today.  It's also crowding the text a little in one place, and getting a DOM error on the BBS boards, but those should be simple fixes.

HOORAY USERJS?

Ki_Shodar

  • Newbie
  • *
  • Posts: 2
Re: 4chan UserJS Script
« Reply #3 on: July 25, 2006, 04:33:29 am »
any chance of getting a copy that still works with Opera 8.54?

latest version only works in Opera 9 which I'm not really liking at the moment

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #4 on: July 25, 2006, 01:44:27 pm »
I actually made a copy of the old version just in case anyone ever needed it.  You can get it here.

How come you're not liking Opera 9, out of curiosity?


P.S.  Anyone else here that uses this script, I did in fact upgrade it some over the past couple weeks or so, but forgot to mention it here.  The link in the first post will get the new version.

Ki_Shodar

  • Newbie
  • *
  • Posts: 2
Re: 4chan UserJS Script
« Reply #5 on: July 26, 2006, 04:12:45 am »
Seems to run noticeably slower for me compared to 8.54, and I don't like the way going back pages in the history has changed in 9 (In 8.54 the previous pages load instantly, unlike 9 which seems to check for updates to some of the pages you've visited). Annoying enough for me to keep using 8 for the time being.

Grabbed that version 8 copy of the script, but it's not working very well - previous/next buttons don't work at all and their bars are all over the place.
And links are back to using the javascript open method. Had regular links in one of the versions that worked in 8 before I upgraded to the Opera 9 only version.

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #6 on: December 21, 2006, 11:07:14 pm »
4chan made some code changes for their new ads and stuff, so I made another little update to accomodate for it.  Same link as above to grab it.

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #7 on: April 25, 2007, 12:30:41 am »
I upgraded this script a bit as I've been wanting a couple of certain features, so hopefully you guys will find them useful as well.  Download link same as above.

New stuff:

- Inline image expansion.  Like in the Firefox extension, clicking a thumbnail will load the image right in the page.  You can turn this off with a setting in the UserJS file if you prefer, but clicking the filename or middle-clicking the thumb will open it in a new window like always.  Initially I disabled interstitial ads for this to work correctly, but then I rewrote how it worked so that it would still function properly while keeping ads intact.  I haven't noticed any problems from having done so, but if it acts up, just let me know.

- Added an "All Images" command to the thread ID bar.  Clicking this lets you open all images in a thread at once.  If you try to open more than 15 (by default), it'll ask you to confirm.  I did kind of a last minute fix so that this would work on reply pages as well, so hopefully I didn't break anything.  Note that this WON'T WORK if you have popup blocking enabled for 4chan.  You can disable that explicitly for 4chan by right-clicking the page and picking "Edit site preferences", then preferably selecting "Open pop-ups in background".  You may have to do this once for each of 4chan's servers that you visit (zip, img, orz, etc).

- Added a minor fix so that it would load the default stylesheet, since for whatever reason, it wasn't working in Opera.

Buzzard

  • Flying biker bandit
  • Hero Member
  • *****
  • Posts: 856
  • So I heard you like Mudkips
Re: 4chan UserJS Script
« Reply #8 on: April 25, 2007, 02:18:48 pm »
Awesome, I totally forgot to update this after they redid a little bit of 4chan and it made it all screwy. Hopefully this is better, which it should be.
Ten years to the minute, no longer in it.

juggy

  • Newbie
  • *
  • Posts: 2
Re: 4chan UserJS Script
« Reply #9 on: June 29, 2008, 10:29:12 am »
YOU ARE TOTALLY GREAT!!!

Like you said yourself in your first post there are nothing like this for Opera which is a big shame...

I just love this, no need to open all the pics by clicking on each of them anymore if you need to open them all and nearly no need for me to use firefox anymore *.*

Thanks, thanks and thanks a lot for this extension.

oh yeah forgot nearly what it was I was going to ask XD

Could I ask you, if it's not too much to ask, to make a grab and save function like the "not4chan Grab Extension" (A Firefox extension to help grab images on not4chan or similar image board) and make it more general so it can also be used on similar image boards too?

Clicking and saving all those pics one by one takes time plus opening about 50 tabs takes up mem.  :'(

I hope I'm not asking for the impossible and I apologize if I in any way have been offending because of my low knowledge of programmering and with opera too.

Again thanks a lot for the plug-in.

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #10 on: June 29, 2008, 03:50:39 pm »
Hey thanks for the praise, I'm glad you get as much use out of it as myself.

Opera actually has a neat links feature built in, making it easy to grab all the images or whatever off of a page.  Control + Shift + L is the default keyboard shortcut now I think, or you can just go to the Tools menu and pick Links.  It shows you all the clickable things on a page. 

To save all the images from a thread on 4chan, load the thread in question in its own window, bring the links window up, then put this into the search blank along the top:

/src/1

This filters only things coming from the /src/ directory on 4chan, and files starting with "1" immediately after it.  If you don't put the 1, you'll get some duplicates in the list, I noticed.  Images on 4chan should always start with a 1, because they save them based on the unix timestamp apparently, meaning it won't become a 2 until the year 2033!  You might not need the 1 on other image boards, though, depending on what type of chan software they use.

But anyhow, then you can select however many images you want to save.  Control-A will just select everything.  Then you can right-click on'em, and either pick the Save As feature, or Save to Download Folder.  If you pick the first one, I think it prompts you for every file.  If you pick the other option, it saves them all with no prompting to whatever folder you have set in Opera as your download folder.

Hope that helps!
« Last Edit: June 29, 2008, 03:53:47 pm by FyberOptic »

juggy

  • Newbie
  • *
  • Posts: 2
Re: 4chan UserJS Script
« Reply #11 on: July 02, 2008, 11:07:55 am »
FyberOptic, if you were a girl I'd kiss you

This is exactly what I've been looking for and the best thing is that it works for more than just pictures. You lilttle guide to how it works was easy to understand too so I'm going crazy with the certain opera functionality. This just made Firefox become trash for me and trash goes into the trashbin. :D

Lots of thanks for answering and this fast.

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #12 on: July 13, 2008, 11:44:51 pm »
I updated the script some more.  Partially it was to clean the code since I entered it in the UserJS competition on the Opera site, but it also fixed some bugs and added minor functionality.

lobotomoy

  • Newbie
  • *
  • Posts: 1
Re: 4chan UserJS Script
« Reply #13 on: August 29, 2008, 12:15:37 am »
Would it be possible to add a Hide Thread function like in the Firefox extension?

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Re: 4chan UserJS Script
« Reply #14 on: August 29, 2008, 10:52:47 am »
I've actually thought about adding that in, since it wouldn't be hard.

I haven't worked on the script much lately due to other projects, but it's still in the middle of being upgraded to be able to store more settings.  That'll let me implement a thread watcher finally!