Off Topic > Off Topic
Programming Megathread
Foxscotch:
some parts seem intentionally obfuscated, like this:
function DLP_mOnDownload(auv) {
var atp = avd[Sp];
atp(auv);
return false;
}
that is the function that's called when the download button is clicked. Sp starts at 0, and avd[0] is weird
the auv argument is the button element itself
I also can't imagine why this function returns false. it doesn't seem to ever get used outside of the onclick things, so idk why they bothered returning anything at all
here's avd[0]:
avd[0] = function(atF) {
var atU = atF.getAttribute('href');
Ku(5, 'Retry Download: ' + atU);
var auR = atF;
var auL = $(atF).parent();
var aup = $(atF).attr('href');
var atN = aup.split('/');
var aul = atN[atN.length - 3];
$(auL).html('<span class="dl-text">Your download is starting...</span>');
$('body').addClass('download_in_progress');
atV();
setTimeout(function() {
$(auR).html('Still not downloading? <span>Repair your download.</span>').addClass('warning').attr('target', '_self').attr('href', '/download_repair.php?qkey=[I removed this]&dkey=' + aul.substring(0, 11) + '&origin=normal_download_click_repair');
$(auL).children().replaceWith($(auR));
Sp++;
}, 4000);
return true;
};
(I removed a try/catch block, because it only used a different method to do the same thing, in the case of a bad browser)
as you can see it increments Sp at the end, so the next time the button is clicked it'll call a different function, but avd[1] is just this:
avd[1] = function(atF) {
return true;
};
at this point, I have to assume that either Ku() or atV() contains what I'm looking for, but god knows how long I'm going to have to keep going
edit: atV() is irrelevant and Ku() doesn't seem to be defined in this file. fml
devildogelite:
Anyone have any good recommendations for a style guide for C# to follow? I imagine strictly following one will make debugging a lot easier and help me finish projects since I'll be able to go back and not forget what I was thinking when I wrote what I wrote.
Headcrab Zombie:
--- Quote from: Foxscotch on February 06, 2016, 11:11:58 AM ---I also can't imagine why this function returns false. it doesn't seem to ever get used outside of the onclick things, so idk why they bothered returning anything at all
--- End quote ---
return false prevents event handlers from doing whatever they would normally do
like stopping a submit button from submitting form/refreshing page
Foxscotch:
--- Quote from: devildogelite on February 08, 2016, 08:00:58 AM ---Anyone have any good recommendations for a style guide for C# to follow? I imagine strictly following one will make debugging a lot easier and help me finish projects since I'll be able to go back and not forget what I was thinking when I wrote what I wrote.
--- End quote ---
if google has a style guide for a language, that's usually the one I use
one exception is python, where I follow PEP 8 instead
--- Quote from: Headcrab Zombie on February 08, 2016, 08:32:09 AM ---return false prevents event handlers from doing whatever they would normally do
like stopping a submit button from submitting form/refreshing page
--- End quote ---
shouldn't you use Event.preventDefault() for that? it's a lot more intuitive...
Headcrab Zombie:
--- Quote from: Foxscotch on February 08, 2016, 10:36:38 AM ---shouldn't you use Event.preventDefault() for that? it's a lot more intuitive...
--- End quote ---
I guess that used to not be a thing? so people just keep using return false out of habit