Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Javascript in 4chan 404 defeater

Name: Anonymous 2009-02-27 14:51

4chan 404 defeater is a Firefox extension used to auto refresh 4chan threads in Firefox until they 404 (without showing a 404 screen):
Website:
http://spacetaken.net/44d/

Firefox extension:
http://spacetaken.net/44d/4chan404defeater_0-4.xpi

Greasemonkey script:
http://spacetaken.net/44d/4chan404defeater_0-4.user.js

Inside that .xpi is chandefeater.js and it's identical to the Greasemonkey script. I've been using 4chan 404 defeater for a while and I don't know anything about Javascript.

I want to modify that .js so instead of the default (auto F5'ing turned off (unchecked) and refresh rate set at every 2 minutes), I want the default to be checked and 8 minutes.

From window.saveCookies, it evidently saves a cookie for each open tab, saving the scroll position (44d_scroll_pos), the F5 interval (44d_f5_rate), and whether auto F5'ing (44d_auto_f5) is on/checked/true or off/unchecked/false.

I can view those cookies in Firefox through Tools > Options > Privacy > Show cookies and doing a Search for 4chan.

If I edit the .js and change:
var autoF5Rate = readCookie("44d_f5_rate", 2);
to
var autoF5Rate = readCookie("44d_f5_rate", 8);
..that changes the default refresh rate to 8 minutes.

But if I change:
var autoF5 = readCookie("44d_auto_f5", false);
to
var autoF5 = readCookie("44d_auto_f5", true);
..it does nothing.

The terms "checked" and "auto_f5_checker" both appear 6 times in that .js

The term "document.getElementById("auto_f5_checker").checked" appears 3 times in that .js

I think it has something to do with "onlick" and ".checked"

I'm currently focuses on these portions of code:

unsafeWindow.updateAutoF5 = function(){
    var checked = document.getElementById("auto_f5_checker").checked;
    //stop or start auto f5ing
    if(checked)
        autoF5TimerId = setInterval('doF5()', 1000*60*autoF5Rate);
    else
        clearInterval(autoF5TimerId);
}

unsafeWindow.validateRate = function(){
    var field = document.getElementById("ref_rate_mins");
    autoF5Rate = parseFloat(field.value);
    if(isNaN(autoF5Rate)) autoF5Rate = 1;
    else if(autoF5Rate < 0.1) autoF5Rate = 0.1;
    field.value = autoF5Rate;        //update to possibly different-to-inputted value
    if(document.getElementById("auto_f5_checker").checked){
        clearInterval(autoF5TimerId);
        autoF5TimerId = setInterval("doF5()", Math.round(1000*60*autoF5Rate));
    }
}

window.saveCookies = function(){
    writeCookie("44d_scroll_pos", document.body.scrollTop);
    if(document.getElementById("auto_f5_checker")){
        writeCookie("44d_f5_rate", autoF5Rate);   
        writeCookie("44d_auto_f5", document.getElementById("auto_f5_checker").checked);
    }
}

How do I make it so auto F5'ing is turned on by default in that .js but can still be turned off by unchecking the box (created by window.controlNode)?

Name: FrozenVoid 2009-02-27 15:33

All this "404 defeater" crap does not keep threads alive.
i.e. a simple autobump script > refresh tab each x seconds.

Name: Anonymous 2009-02-27 15:43

>>1
Uh, I think it'd be a better idea to make an extension that redirects to the archive when a thread is deleted so you can continue the discussion there.

I think someone already wrote a script like that, actually.

Name: Anonymous 2009-02-27 15:55

>>2-3
you both know very well what this script is really for.
it's for the sort of threads where people post things like "F5 F5 F5" and "in b4 404".
but not saving the images makes it pretty useless even for that.

Name: FrozenVoid 2009-02-27 16:07

>>4
Can't you just open 2 tabs and refresh them in sequence?
(sort of STABLE/CURRENT branch)

Name: Anonymous 2009-02-27 16:13

>>2

It's not intended to keep threads alive. It provides a soft refresh.

It allows a user to see the last comment in a thread before it 404'd and allows the user to save the entire thread.

Name: Anonymous 2009-02-27 16:17

>>4

It would be nice if 404 defeater also saved all the images, but it does still let you save all the thumbnails.

I'm using Downthemall to save images, but I'm thinking of switching to Chanmongler.

Name: Anonymous 2009-02-28 1:41

My greasemonkey script updates the posts in place with ajax, and auto-expands every image. So if I see a thread with comic strips and I can't be bothered F5'ing, I just open it in another tab and come back to it later. Works really nicely in /gif/. No, you can't have it because you are all dick heads.

Name: Anonymous 2009-03-01 14:04

>>8

Well, there are several Greasemonkey scripts that turn up in a search for "4chan expand" at userscripts.org

http://userscripts.org/scripts/search?q=4chan+expand&sort=installs

Name: Anonymous 2009-03-01 22:10

It would be nice if they fixed the 4chan Firefox extension to work with 3.1

Name: Anonymous 2009-03-01 22:42

Name: Anonymous 2009-03-09 5:40

>>1

If you have Greasemonkey, try

4chan all-in-one
http://userscripts.org/scripts/show/42873

It looks to have an auto updater function.

Name: Anonymous 2009-03-09 18:43

>>12
Please grease my monkey with your /prog/snake

Name: Anonymous 2009-03-09 19:02

Don't use cookies to store data, they are for IDs and such. Use localStorage (which is globalStorage[location.hostname] in Firefox)

Name: Anonymous 2009-03-10 6:12

>>14

I didn't write the extension. If I knew how to contact them, I would.

I've noticed that when Firefox crashes, some of the cookies are still good and some are lost.

Would a crash affect localStorage?

Name: Anonymous 2009-03-10 11:47

>>1

Search for 4chan update
http://userscripts.org/scripts/search?q=4chan+update

I see several

Name: Anonymous 2009-03-10 19:31

>>8

Someone could do that with the Greasemonkey scripts
4chan Expand All Images
http://userscripts.org/scripts/show/33217
+
4chan 404 defeater
http://spacetaken.net/44d/4chan404defeater_0-4.user.js

But you have to turn both on in each tab.

Name: Anonymous 2009-03-10 19:33

>>17
No, when a page refreshes, all the pics go back to thumbnails with expand all images.

Name: Anonymous 2009-03-11 8:45

>>18
Can't you read? There's a + button to expand all images. It doesn't happen automatically. Naturally the images will be still thumbnailed if you refresh the page.
If you want it to happen automatically, just modify the script.

Also lol'd at the terrible code this script contains.

Name: Anonymous 2009-03-11 11:47

Also lol'd at the terrible code this script contains. 

That's because it's Javascript, which is OPTIMIZED for shitty code

Name: FrozenVoid 2009-03-11 16:53

>>20
JavaScript can be optimized enough for video games.
http://www.nihilogic.dk/labs/mariokart/

____________________________________
Eternity lies ahead of us, and behind.

Name: Anonymous 2009-03-11 17:03

>>21
It's not Mario Kart without power slides and shells.

Name: FrozenVoid 2009-03-11 17:08

>>22
"Its not an AI without an inference engine"

________________________________________________
...what we call education and culture is for the most part nothing but the substitution of reading for experience, of literature for life, of the obsolete fictitious for the contemporary real...

Name: Anonymous 2009-03-11 17:15

double dash my anus

Name: Anonymous 2009-03-12 16:20

>>19

O RLY brainiac?

How would you modify Expand All Images to expand them automatically or keep them expanded after a refresh?

Name: Anonymous 2009-03-12 19:33

>>1

Install Greasemonkey and the Greasemonkey version of the script.

You can change it on the fly and see the results.

    var autoF5Rate = readCookie("44d_f5_rate", 6);
    var scrollPos = readCookie("44d_scroll_pos", 450);

That changes the default refresh rate to 6, and the default scroll position to 450 (which is where the first post appears if Adblock Plus is running).

Name: Anonymous 2009-03-12 19:38

>>26

470 is even better

Name: Anonymous 2009-03-12 21:58

>>24
Back to Nintendo Gamecube, please.

Name: Anonymous 2009-03-13 11:30

>>25
Don't even want to touch that piece of shit. Just use this.

// ==UserScript==
// @include http://*.4chan.org/*html
// @name Auto-Expand images
// @author Anonymous
// @version 13-03-09
// @description Enjoy your load times.
// ==/UserScript==

var images = document.evaluate("//a/img[@align='left']",
    document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

for (var i = 0; i < images.snapshotLength; ++i) {
    var img = images.snapshotItem(i);
    var newSrc = img.parentNode.href;
    img.parentNode.parentNode.replaceChild(img, img.parentNode);
    img.removeAttribute('width');
    img.removeAttribute('height');
    img.setAttribute('src', newSrc);
}

Name: Anonymous 2009-03-13 11:36

>>29
I will, along with my job.

Name: Anonymous 2009-03-17 23:18

>>29
Thanks! How do I set the images to fit-width?

Name: Anonymous 2009-03-18 1:36

>>31
Terrible!

Name: Anonymous 2009-06-01 2:38

Doesn't work with safari

Name: Anonymous 2009-06-01 2:41

>>30-32
THE FUCK ON?

Name: Anonymous 2010-03-23 11:29

It's really tedious to put a checkmark in each box in each open tab.

Anyway to modify that greasemonkey script so it's checked by default?

Name: Anonymous 2010-03-23 11:35

>>35
You could try this AJAX greasemonkey script
http://userscripts.org/scripts/show/66242

Name: Anonymous 2010-03-23 12:05

>>36
I can't get that AJAX updater to work.

I thought maybe it was because it required jQuery.

I went here
http://joanpiedra.com/jquery/greasemonkey/

and installed the jQuery greasemonkey script
http://joanpiedra.com/jquery/greasemonkey/jquery.user.js

and that AJAX script is still not working.

I even tried pasting the AJAX script code into the code here:
http://joanpiedra.com/jquery/greasemonkey/


// Add jQuery
    var GM_JQ = document.createElement('script');
    GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
    GM_JQ.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
    function GM_wait() {
        if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; letsJQuery(); }
    }
    GM_wait();

// All your GM code must be inside this function
    function letsJQuery() {
        alert($); // check if the dollar (jquery) function works
    }


And it's not working. When I click on the @ a small window pops up with

function (selector, context) {
  return new (jQuery.fn.init)(selector, context);
}

Name: Anonymous 2010-03-23 12:11

I also downloaded this
http://jquery.com/src/jquery-latest.js

renamed it jquery-latest.user.js and installed it in Greasemonkey. It's not working.

I also downloaded this
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

renamed it jquery.min.user.js and installed in Greasemonkey. It's not working.

I get that same small window popup.

Name: Anonymous 2010-03-23 12:26

Only a Vizard can defeat 404

Name: Anonymous 2010-03-23 15:24

Just get 4chan X and ya4cie to expand images.
If you want to save images from dead threads using DownThemAll you'll have to hack it because for some absolutely braindead reason it bypasses the cache by default (which also makes regular saving not work anymore, thanks DownThemAll!). I have no idea why the fuck it would do that but it's an easy fix. Simply grep for "cache" through the source and delete one line.
Of course, you can also just install squid and let it serve the cached images even when requested with "no-cache" headers.

Name: Anonymous 2010-03-23 17:49

lol googling 4chan auto expand points to this thrad now :D

Name: Anonymous 2010-03-23 20:06

Name: Anonymous 2010-03-24 9:38

>>40
They do that to ensure you don't get stale data.

Name: Anonymous 2011-01-31 21:15

<-- check em dubz

Name: Anonymous 2011-02-03 0:50

Name: Anonymous 2011-03-23 1:15

>>1
>I want to modify that .js so instead of the default (auto F5'ing turned off (unchecked) and refresh rate set at every 2 minutes), I want the default to be checked and 8 minutes.

There's a very dirty way to do this in Greasemonkey. Edit the script.

Find the else that has the following after it:
clearInterval(autoF5TimerId);

Remove that and paste the code from the if above:
autoF5TimerId = setInterval('doF5()', 1000*60*autoF5Rate);

This makes it auto F5 no matter if the checkbox is checked or not. But you will no longer be able to change the refresh rate via the box, only by editing the live code.

To change the refresh rate to 8 minutes, find
readCookie("44d_f5_rate",

Then change the number after it to 8

You may also need to change the line above that (change the false to true).

Name: Anonymous 2011-03-23 8:14

setInterval('doF5()'
Please stop programming!

Name: Anonymous 2011-06-30 4:39

Could you make doF5 have a timeout so that it won't get stuck and require user input to cancel on worse connections?

Name: Anonymous 2011-07-16 9:10

why are ppl still posting in this thread then it is over two years old?

Name: Anonymous 2011-07-16 9:12

REQUESTING SAGETANK

Name: 1000 posts 2011-07-16 16:12

●█████▄▄▄▄▄▄▄▄
▄▅███████▅▄▃▂
███sage tank███████►
◥☼▲⊙▲⊙▲⊙▲⊙▲⊙▲☼◤

Name: barbour mens classic duffle 2011-12-01 22:43

There are many brands of <a href="http://www.barbourjackets-uk.org/"><strong>barbour fusilier</strong></a> in the market today. Each of the brand promises to bring out something new to the customers.

Name: Anonymous 2012-09-06 22:46

wat

Name: Anonymous 2012-09-07 1:11

so much effort for that 4chan shit

Don't change these.
Name: Email:
Entire Thread Thread List