« first day (18 days earlier)      last day (4947 days later) » 

4:09 PM
can someone explain how local storage works in the browser? Does the browser implement it i.e. firefox, or the layout engine i.e. gecko ?
 
@Greg it's usually done through sqlite implementation, using DOM2
@Greg read more about it here: creativepark.net/blog/entry/id/1191
 
Tek
How can I get callback data from jQuery in the middle of an append? $("#foo").append("<div>callback data</div>")
 
So who's experience with IE6 specific bugs?
creating a options dom object with document.createElement and appending it to a select dom object with .appendChild this works fine. but if I alert a message before appending the option to the select box it doesnt show the new option
And IE6 has rendering problems in general with dynamically inserted options nodes
 
Tek
This channel is lost without the three musketeers. Andy, Nick & Yi Jiang. :p
At least that's who I've seen most active since I joined the javascript chat.
 
4:25 PM
@Tek you can just do $("#foo").children("div").text() probably or did you mean something else?
 
@Tek Me!? Erm... blushes
 
@YiJiang you do talk quite a bit. And you have this impression you know what your doing
 
Tek
^that
 
@Raynos hides behind @NickCraver
 
Psh.
 
4:27 PM
what are stars for
 
@tpae Important stuff you want others to see.
 
@tpae that.
 
Tek
chasing someone with a salad fork seems to be important
 
@Tek no
 
@Raynos Yes!!! Well, the context is important, but salad fork surely trumps all!
 
4:29 PM
@YiJiang What is this injoke
 
@YiJiang that's true, the pastry fork doesn't even get a look-in these days.
 
@Raynos @NickCraver's previous message is:
3 hours ago, by Nick Craver
@Tek - nope, the browser's leaving the page, what would you do there, short of an alert to keep me on the page?
 
Tek
Never even see or knew that existed.
 
Which means that he'll hunt down anyone that uses alert() to stop you from leaving the page
Coincidentally, SO uses this very method to prevent people from accidentally leaving answers and question pages without finishing up their posts
 
Tek
=O
I wonder what he has to say about that.
 
4:35 PM
Which means that @JeffAtwood could right now be in mortal danger, being chased by @NickCraver with a salad fork!
 
Tek
lolz.
 
nope that doesn't use alert() :)
return "Are you sure you wish to leave?";, something to that effect
 
Tek
He's on top of his game!
 
Oh, right, it's a confirm(), not an alert()
 
nah not even a confirm, just return "message";
 
Tek
4:37 PM
Do you really go digging into SO's JS for trivial stuff like that? :p
 
@YiJiang: similar to a confirm, but it's just the return value of the beforeunload event
 
can't use confirm() like that in window.onbeforeunload cross-browser
 
Still, technicalities... tsk tsk... let's see you chasing @JeffAtwood down with a salad fork!
 
Tek
lol
 
@Tek - no, I go digging in all JS for trivial stuff like that
 
4:37 PM
o:
 
All this talk of forks is making me hungry.
 
digging around in js is fun. creating userscripts as a result is even better!
 
Tek
Yay. JS room seems to be the most active room for several hours now. Does that mean we're hip?
 
@rchern Are there resources, tips, etc to creating userscripts?
@Tek JS has always been hip on SO
 
@Tek: I think we're the most active room on average anyway
 
4:42 PM
@AndyE Notwithstanding the Tavern?
 
it's also probably one of the top 5 most used languages in the world today (not counting native / spoken langs)
 
@YiJiang: Tavern always seems quiet to me - maybe it's my timezone
 
Tek
@sworoc Statistics, shmatistics, right?
 
Inserted <option> into <select> dynamically in ie does not get rendered. Does anyone know why? +grammar
 
@Raynos yep, it's because IE sucks
 
4:43 PM
@Raynos: code us up
 
@sworoc how do I fix it?
 
Not sure, as @AndyE said, code us up
 
Resig's commentary of the YUI project: quora.com/…
 
@AndyE let me jsfiddle
 
Interesting... hmmm...
function setConfirmUnload(c, a) {
    window.onbeforeunload = c ? function () {if (a && $.trim(a.val())) {return c;}} : null;
}
 
4:47 PM
@NickCraver interesting read, thanks!
 
@sworoc, userscripts are pretty much just regular scripts, with hardly any magic
 
@rchern mmmm I'd say there's a rather important difference, no access to globals
 
@rchern is there anything different to consider? Do you have a way to include dependency scripts, or do you have to perform DOM magic?
 
which is a PITA, something you should be able to enable
 
There is some fluff around it but I cant be bothered to strip it.
The important thing to note is that it works fine without the alert statement.
The actaul adding of options doesnt break so badly as much as it breaks when everythings created dynamically
 
4:57 PM
@Raynos Cleaned up the fluff, but can't really see why this should fail under any circumstances jsfiddle.net/jKmh4/1
 
Tek
@YiJiang Preeeeety code
 
@YiJiang it doesn't work in IE6 with the alert before the AddListItems() call
 
@Raynos: interesting. I've experienced issues like that with modal dialogs (like alert) in Internet Explorer before. Those dialogs were only ever there for spitting out debugging information, though
 
the exact same hapens if I wrap the function call in a .click event
@YiJiang jsfiddle.net/jKmh4/3 like so.
@YiJiang running in IE8 in quirks or IE7 compatibility or in IE6 will refuse to have the change event render the options
 
@NickCraver I guess it's just the style of who I initially copied from, but I just append a script node.
 
5:05 PM
2
Q: Using the input 'speech' tag via javascript

Pablo FernandezDoing this in chrome: <input id='speech-this' type='text' speech /> Creates an input tag with a little mic. Clicking on the mic does voice recognition, like android phones search. My question is: Is it possible to do this without the <input> field? I mean, the ideal thing would be...

gtg take my kids to get shoes. bye all :-)
 
right, but you have to append to text of the function, pretty hacky imo, even if it's the only option
 
fair enough. my userscript experience is only what's in my github repo hehe
 
@YiJiang Damn you and your nice looking code
 
@AndyE later!
 
Tek
@AndyE Take care. See ya.
 
5:09 PM
@AndyE bye andy
Alternatively. Seeing as everything is in the dom does ie have a dom.renderPage() functionality to forcifully rerender the dom ?
 
Tek
@Raynos window.location.reload() =D
just kiddin', my attempt at self-entertainment considering I know 0 js :p
 
@Tek that just reloaded the page >:(
 
Tek
I did say I was just kidding...
lmao
Thanks for entertaining me further, I thought you knew more JS than I did. Hehe.
 
I do. I'm at wits end.
The company booted up the VM with IE6 on it. Then I lost half a days of development
 
Tek
eek
good luck with that D:
 
5:16 PM
I guess I'll post up a question on stackoverflow
 
Tek
You should do that more often! It helps other people you know.
 
@Tek this one is such an obscure bug though :p
 
Tek
Exactly my point. We don't have enough obscure bugs documented!
=)
 
Thats it. I'm out.
Good day everyone
 
Tek
all right, later
see ya around
 
5:42 PM
0
A: jquery Not in array ?

Luca Matteisif(!$.inArray(tld, tldsArray)) I suggest reading about programming.

anyone else find that funny, since his code's wrong?
 
Tek
I just think he's a jackass. :p
 
Tom
Hey, could anyone explain me why _thisInstance does not have the field onTextChange where I console.log its keys? See:
 
yeah wow
 
Somebody point it out kindly if I behave that way
 
anyone know a JS framework that supports replacing text with input fields, maybe on hover?
 
5:46 PM
I hope I do not come across as a jerk
 
I don't see it often, maybe twice a week, that one just stood out, if you're arrogant at least have a reason to be, e.g. correct
I hope I don't seem arrogant in many of the comments I leave, but I do feel strongly about pointing out completely incorrect code, especially when it's been upvoted, for the sake of the next person finding it via google.
 
@StJohnJohnson you are looking for a framework, or just a solution?
@NickCraver you just come across as knowing your stuff better than 99.9% of us out there.
 
Tom
@StJohnJohnson, see code.google.com/p/rangy
 
@sworoc solution, can involve a framework
@tom looking at it now
 
Tom
 
5:50 PM
@tom do you have an example page of this framework?
 
Tom
@StJohnJohnson check the wiki tab
@StJohnJohnson I may have misunderstood you though, you said hover, I interpreted selection
Which is something else, sorry
 
@tom ahh, no worries
I'm just looking for an existing solution, idea, or nudge in the right direction for implementing either a on hover switch to input box or button press replace all text with input boxes
I'm thinking of just writing a function to replace specific classes with input boxes and vice versa.. or maybe to hide them then show them.. figured i'd look for an existing solution
 
Tom
@StJohnJohnson, should be easy with jquery, onHover replace the hover text with input with that value
Anyway did anyone get my question above ?
 
Do you want to actually replace it, or just show some text in there? e.g. do you want hover watermarks, or actually replacing the .value?
 
Replace it, think viewing a page, but if you want to change something - mouse over it, switches to an input field, type text, mouse off
 
Tom
did githubs stop showing?
 
@nick
@nickcraver awesome!
 
@tom - unsure, were they previewing before?
 
Tom
@NickCraver, well not the ones you linked but gists did
 
Okay, jeditable is way cool
 
5:57 PM
oh, hmm lemme try
gist: Adds a "total rep today" number in the top bar for all StackExchange sites - Only works in Chrome, only makes a request every 30 min or when your total rep changes., 2010-10-27 10:43:32Z
// ==UserScript==
// @name           SO Daily Reputation
// @namespace      soRepDaily
// @description    Shows reputation for the current day.
// @include        http://stackoverflow.com/*
// @include        http://serverfault.com/*
// @include        http://superuser.com/*
// @include        http://meta.stackoverflow.com/*
// @include        http://*.stackexchange.com/*
// ==/UserScript==
(function(){
  var ro = JSON.parse(localStorage.getItem("CurRep")), 
      hlu = document.getElementById("hlinks-user"),
      s = document.createElement('span'), is = s.cloneNode();
  s.className = 'reputation-score';
  s.id = 'current-rep-top';
  is.className = 'bounty-indicator-tab';
  is.innerHTML = ro && ro.rep || "Fetching...";
  s.appendChild(is);
  hlu.insertBefore(s, hlu.childNodes[0]);
  
  function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }
  with_jquery(function() {
    $(function(){
      if(!$("#topbar a[href^='/users/logout']:first").length) return;
      
      var today = new Date(),
          UTCtoday = today.getUTCFullYear() + '-' + leftPad(today.getUTCMonth()+1) + '-' + leftPad(today.getUTCDate()),
          url = ($("#topbar a[href^='/users/recent/']:first").attr('href').match(/^[^?]+/))[0] + '?StartDate=' + UTCtoday + '&EndDate=' + UTCtoday,
          repNode = $('#current-rep-top'),
          pageRep = $("#hlinks-user .reputation-score").text(),
          ro = JSON.parse(localStorage.getItem("CurRep"));
          
      repNode.wrapInner($('<a />', { href: url + '&tab=reputation#tab-top' }));

      if(ro && ro.time && ro.time >= (today.getTime() - 300000) && pageRep == ro.pageRep) return;
      
      repNode.load(url + " #tabs a[href^='/users/recent/'][href*='tab=reputation']:first" , function() {
        $(this).find('a').html($(this).find('.bounty-indicator-tab').add($('<span class="bounty-indicator-tab">0</span>')).eq(0));
        $("#hlinks-user").prepend(this);
        localStorage.setItem("CurRep", JSON.stringify({rep: $(this).text() || "0", time: today.getTime(), pageRep: pageRep }));        
      }); 
      
      function leftPad(num) { 
        return (num < 10) ? '0' + num : num; 
      }
    });
  });
})();
 
Tom
oh, strange, mine didn't show previousely
 
ah cool, didn't know they previewed, thanks @Tom!
 
thanks Nick!
 
Tom
@NickCraver did you see mine earlier? I asked why onTextChange was not part of _thisInstance's fields here:
 
welcome :)
 
Tom
5:58 PM
didn't show for me
 
gist: 661414, 2010-11-03 17:44:56Z
//SourceSubmissionForm: creates a form used for source submission

var SourceSubmissionForm = function() {
	var _thisInstance = this;
	
	//instance members
	this.index = -1;
	this.element = null;
	this.value = "";
	
	//add this instance to list
	SourceSubmissionForm.instances.push(this);
	
	//update index
	this.index = SourceSubmissionForm.instances.length - 1;
	
	//create new form
	this.element = $('<textarea id="sourceForm' + this.index + '"/>');
	this.element.css({'width' : '200px', 'height' : '200px'});
	this.element.appendTo("#mid1");
	
	//register change event
	this.element.change(function() {
		
		console.log("outputting this instance fields");
		for (var key in _thisInstance) {
			console.log(key);
		}
	
		_thisInstance.onTextChange();
	});
};

//static members
SourceSubmissionForm.instances = [];

//proto methods
SourceSubmissionForm.prototype.onTextChange = function() {
	console.log("inner update");
	this.value = $(this.element).val();
};
https:// doesn't work, http:// does
 
Tom
oh alright
 
should put it in chat feedback

Chat feedback

Problems with chat? Let us know...
 
Tom
@NickCraver done
Anyway am I doing something wrong above? It says onTextChange is not a field of the object
 
building rep is hard
 
Tek
6:02 PM
that's what she said
 
lol
i've been answering every question on codeigniter
but i hate it when people just re-posts with more clarified version of my answer
and they get the kudos
 
Tom
@tpae that's why there should be assisted answers imo
 
yeah
 
Tek
weeeell, you know us programmers. copying other code to improve it more
It's a habit.
 
Tom
6:05 PM
@NickCraver, its really weird, it works for me too when I do that, though I dont see any conflicting code in my app -- javascript sucks for debugging tbh
 
console.dir(_thisInstance);
 
@Tom maybe it's just debugged differently than how you do it :P
 
to get a better readout of what you want, instead of the for loop
 
Tom
@NickCraver, when I define the function inside the constructor it does work
But not when I define it as a prototype field
 
Tek
@NickCraver Kind of related to our conversation earlier. I wonder if facebook validates user input through the server and then echo's it back to the user.
/random rant
 
Tom
6:07 PM
@Tek maybe, after selling it to some intermediary :p
 
Tek
bahaha
That sounds quite true actually. Reminds me of something, hold on, fetching.
Ah, here it is.
 
Tom
@NickCraver any idea what could cause this.function to work and prototype.function to fail?
@Tek it's only a matter of time before some extreme group has enough liquidity to perform an acquisition of such service
 
Tek
Perhaps.
 
Tom
@NickCraver would you like to see my source? It's not that large, been confused by this for two days now
Its like 3 objects
 
will look in a few, sorry for 4 visual studios up debugging each other and a phone call atm
 
Tom
6:19 PM
alright take your time @NickCraver : )
 
Tek
If anyone's not busy, I'm requesting newbie help! Using a $.post callback: $("#foo").append("<div>data</div>")
How would I get the success data between the divs?
 
sure
function callback(data) {
 $("#foo").append("<div>" + data + "</div>");
}
is that what you mean?
 
Tek
@sworoc Perfect, thanks! I should've known it was that easy. D:
 
@Tek it always looks easier once it is done :)
 
Tek
Of course.
haha
 
6:27 PM
Does anyone know the best way to filter on a list of custom objects? jQuery filter seems to be only on elements, is this true?
nevermind
 
Tom
@NickCraver : this is minimum source that works with my programming structure (hook based)..
Run it with Firebug, it'll tell you _thisInstance.onTextChange is undefined
 
6:46 PM
I seem to recall that there's issues with listening for focus in IE. Is there a way to fire a function whenever the window gets focus? Embedding a page in a 3rd party app and I'm trying to fire a function whenever our page becomes visible.
 
@rchern sounds tricky, you mean iframe by embedded?
or is it a desktop application
 
It's a desktop app that has multiple IE windows embedded in it with just 1 of them actually visible at a time.
 
Have you tried doing something more like this:

$(window).one("mouseover")
it would only trigger on the first mouseover of the page?
 
Waiting for mouseover is too late.
 
well, it seems that the DOM would repaint on visible
 
6:52 PM
(and no guarantee the user would mouseover anyway)
 
Tek
I see a bunch of different code to clear a <textarea> with jQuery when I searched S.O. What is the most proper way to do this in your opinion?
 
7:09 PM
$("textarea").val("");
 
Tom
@NickCraver, did you see jsfiddle.net/6rBTZ/1 ?
 
 
1 hour later…
Tom
8:18 PM
Meh, I should probably post an SO question, not sure what to name it though as I do not even know what I want to figure out (no idea what's causing it)
Actually, I figured out what the problem is
Not sure how to solve it though
it's this line:

SourceSubmissionForm = SourceSubmissionForm.afterConstruction(function() {
new SourceWindow();
});
Apparently the prototype methods get lost (?)
Strange, because I am doing newObj.prototype = oldObj.prototype; //copy prototype fields of oldObj inside afterConstruction method (see jsfiddle).
0
Q: Javascript: resetting object definition with hook added (hooking construction)

TomHi there, I'm trying to hook the creation of objects in Javascript. This is easy for methods, but afaik not for constructors. I cannot change the way to create objects as this has to work for current libraries. Anyway, this is what I have now: Function.prototype.afterConstruction = function(ho...

 
 
2 hours later…
10:15 PM
I have this: $("form").submit(function() { Now i have a hidden input field in the form, how can i get the val() ? Should i just call it by the id: $('#replyTo').val(); or can i do something smart?
 
10:32 PM
Oh my, jsFiddle has to be one of the smartest things I've ever seen.
 
10:59 PM
How can i enable this again after 2 seconds:
$('#sendPM_btn').attr('disabled', false);
 
not my fault
 
setTimeout(function(){
$('#sendPM_btn').attr('disabled', false);
}, 1500);
is this right ?
Yes it is.. nice! Nice to do something new and have it working..!
Is there any way i can fadeIn, prepend(). ?
to this: $('#PrivateMessages').prepend(rs);
I tried .fadeIn(1000), but it wont work. Probably because i need rs display: none? Is it a must?
 
11:14 PM
I have made rs display: none but now nothing appears
I did:
$('#PrivateMessages').prepend(rs).show().fadeIn("fast");
anyone?
 
prepend will return the jQuery object containing #PrivateMessages
not rs
and there's not much point in fading in after you show()
 
I tried without show() and nothing shows after i did display: none to rs
 
6 mins ago, by rchern
prepend will return the jQuery object containing #PrivateMessages
ie, you're trying to fade in #PrivateMessages, not rs.
 
oh
how can i fade in rs then?
 
11:30 PM
use prependTo instead of prepend
 
$('#PrivateMessages').prependTo(rs).fadeIn(1000);
?
or
$(rs).prependTo('#PrivateMessages').fadeIn(1000);
yup that worked, thank you @rchern
 
11:47 PM
@Nick
@NickCraver i have a question, does having a high rep in stack overflow help you get job offers?
 
I get one every 2-4 weeks, yes, usually somehow as a result of SO
 
Wow thats nice
 
I can't say how much rep matters though, as I have no comparison point
 
Im glad i found SO
 
hello
 
11:59 PM
hi
 

« first day (18 days earlier)      last day (4947 days later) »