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)?
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)?