Notice: You have been identified as a bot, so no internal UID will be assigned to you. If you are a real person messing with your useragent, you should change it back to something normal.

Minichan

Topic: Is this bad code?

stal !nator.ccGk started this discussion 15 years ago #6,847

http://pastie.org/private/8glbwa0cxwkmueolmevw
Poll option Votes Percentage Graph
Yes. 1 50%
Yes. 1 50%

r04r joined in and replied with this 15 years ago, 3 minutes later[^] [v] #120,163

Yes. You only have a maximum for 2 citations. Loop through them.

You can do that with:

for(index in obResponse.citations) {
var value = obResponse.citations[index];
alert(value.snippet);
}

stal !nator.ccGk (OP) replied with this 15 years ago, 8 minutes later, 11 minutes after the original post[^] [v] #120,172

@previous (r04r)
So that will popup an alert for each citation I have?

r04r replied with this 15 years ago, 6 minutes later, 18 minutes after the original post[^] [v] #120,180

@previous (stal !nator.ccGk)
Yes

stal !nator.ccGk (OP) replied with this 15 years ago, 37 minutes later, 56 minutes after the original post[^] [v] #120,221

function writeHTML(obResponse) {
if (safari.extension.settings.boolDebugOn == 1) alert('Writing HTML...');
if (safari.extension.settings.boolUseRunic == 1) {
var htmlClass = 'threadIDrune';
} else {
var htmlClass = 'threadID';
}
if (safari.extension.settings.boolDebugOn == 1) alert(htmlClass);
if (obResponse.citations[0] === undefined) {
document.getElementById("container-cites").className = "hidden";
} else {
document.getElementById("container-cites").className = "container";
var htmlToWrite = '<p></p>'
for(index in obResponse.citations) {
var value = obResponse.citations[index];
alert(value.snippet);
htmlToWrite += '<div id="cite"><a href="javascript:void(0)" class="'+htmlClass+'" onClick="openPage('+value.topic_id+'#'+value.reply_id');">'+'<b>'+value.headline+': </b>'+value.snippet+'</a></div>';
}
var cite-container = document.getElementById("cite1");
cite-container.innerHTML = htmlToWrite;
}
if (obResponse.watchlists[0] === undefined) {
document.getElementById("container-watched").className = "hidden";
} else {
document.getElementById("container-watched").className = "container";
var w1 = document.getElementById("wl1");
w1.innerHTML = '<a href="javascript:void(0)" class="'+htmlClass+'" onClick="openPage('+obResponse.watchlists[0].topic_id+');">'+'<b>'+obResponse.watchlists[0].headline+': </b>'+obResponse.watchlists[0].unread+' new</a>';
var w2 = document.getElementById("wl2");
w2.innerHTML = '<a href="javascript:void(0)" class="'+htmlClass+'" onClick="openPage('+obResponse.watchlists[1].topic_id+');">'+'<b>'+obResponse.watchlists[1].headline+': </b>'+obResponse.watchlists[1].unread+' new</a>';
}
}


I don't think I'm doing it right.

Green joined in and replied with this 15 years ago, 21 minutes later, 1 hour after the original post[^] [v] #120,251

Image went missingIs this bad cod?

Foxygen !FANATICibM joined in and replied with this 15 years ago, 9 minutes later, 1 hour after the original post[^] [v] #120,262

Image went missing@previous (Green)
yours looks fine
this is a bad cod, though

Killer Lettuce !!iNo3FkiZx joined in and replied with this 15 years ago, 1 minute later, 1 hour after the original post[^] [v] #120,264

@previous (Foxygen !FANATICibM)
Really? I finished with CoD at MW2, but looking at the trailer and some things I've heard, I'd actually consider buying it.

stal !nator.ccGk (OP) replied with this 15 years ago, 50 seconds later, 1 hour after the original post[^] [v] #120,265

@120,251 (Green)
@120,262 (Foxygen !FANATICibM)
@previous (Killer Lettuce !!iNo3FkiZx)
egt fucked

SQUARED !B./giPt8go joined in and replied with this 15 years ago, 2 minutes later, 1 hour after the original post[^] [v] #120,267

@120,264 (Killer Lettuce !!iNo3FkiZx)
Battlefield 3 will be better. :')

Foxygen !FANATICibM replied with this 15 years ago, 1 minute later, 1 hour after the original post[^] [v] #120,268

@previous (SQUARED !B./giPt8go)
Lol this.
None of the new CoDs can touch Battlefield 2, much less 3.

Green replied with this 15 years ago, 1 minute later, 1 hour after the original post[^] [v] #120,270

@120,262 (Foxygen !FANATICibM)
Can't stand most modern games, since Fable 3 made me depressed as hell.

Killer Lettuce !!iNo3FkiZx replied with this 15 years ago, 5 minutes later, 1 hour after the original post[^] [v] #120,283

@previous (Green)
Me too, but probably for different reasons than you, lol. Normal levelling system? Bollocks to that, go to some cloud chests!

Foxygen !FANATICibM replied with this 15 years ago, 2 seconds later, 1 hour after the original post[^] [v] #120,284

@120,270 (Green)
Why

Anonymous C replied with this 15 years ago, 21 hours later, 22 hours after the original post[^] [v] #121,166

@previous (Foxygen !FANATICibM)
Too easy and in the end was dessert.
:

Please familiarise yourself with the rules and markup syntax before posting.