« first day (74 days earlier)      last day (4934 days later) » 

7:01 PM
@TimStone I think so. Not 100% sure myself :)
 
@ChrisF I'm back, did the datestring idea work?
 
@Hogan - I wasn't sure what you were referring to & as you'd gone I couldn't ask
 
oh sorry...
I'll explain:
The idea is to append a unique string to the image url. An easy way to do this is by urlencoding the current time (with millsecs.) and appending it to the end of the URL
Is that clearer?
 
A little - but I don't see how that helps in my case? It's a WPF app and the problem still occurs if I change the Opacity rather than unload/reload the image
 
Couldn't that still be a caching issue?
... I guess not.
hmmm...
 
7:05 PM
Hmm - I see your point. Will have to investigate, but got to go myself now, but will check back later
 
Does calling invalidate help?
 
7:19 PM
@radp, your include/exclude list doesn't exclude all chats does it?
 
HELLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
 
Howdy @Chacha102
 
allo
 
@rchern Did you mess around any with scrollTo, or just @YiJiang?
'Ello @Chacha102
 
yeah, i've used scrollTo (not just with SEChatModifications)
 
7:22 PM
I was going to ask you about an exception I was getting, but turns out I just forgot to fix something, heh. Nevermind.
 
(:
 
@rchern // @exclude http://chat.*.stackexchange.com/*
the others aren't included to begin with
 
gah, i read that like 5 times and still only saw chat.se excluded
fail.
 
5
Q: What's the correct way to @include all SE sites?

radpWhat's the @include sequence that most accurately lists all the SE sites for greasemonkey/userscript hacking purposes?

if you want to edit, do it there ↑ :)
I wish the SE stuff could put some list to #include or something.
 
nah that's what i was looking at
my SEModifications script is still being run here though
 
7:28 PM
could it be that the http://stackoverflow.com/* rule propagates to all subdomains?
 
Unless you've changed it, it's currently http://*stackoverflow.com/*
 
uh, my post definitely says // @include http://stackoverflow.com/*
 
i copied the list from @radp's answer, replaced my @include/@exclude block with that, tossed alert("semodifications"); at the end of my SEModifications.user.js, reloaded script and refreshed here
guess what i see
 
unicorns
 
@radp Not you you, sorry.
 
7:31 PM
yes and guess what're carrying? an alert dialog saying semodifications
 
no big deal, @rchern, add a rule that explictly @exclude's http://chat*
 
@rchern Would you mind pasting the link here so I can regrab it?
 
it's CW
 
Thanks
 
7:32 PM
@radp, I don't want to edit it if it isn't needed. and i feel like it shouldn't be.
 
A F5 and it's no longer showing up for chat for me, hm.
 
seriously? i disabled/enabled the extension and then f5 here and i see the alert box every refresh/load
 
later
 
Bye @radp
Yep, works as expected for me..hrm.
 
chrome or ff?
 
7:36 PM
FF
 
you're ff right?
 
Yeah
 
hrm
chrome issue with @include?
 
Let me check with Chrome
 
yup, my modifications script is running here, and on so/wa chats
lemme try SU
grrr, running on SU also
...the heck?
 
7:37 PM
Didn't run for me when I pulled up http://chat.meta.stackoverflow.com/
(in Chrome)
But it does for SO
So...Shame on you Chrome!
Seems to have cached your previous includes lists, perhaps? I actually have that problem when manually editing the file; Greasemonkey won't see the metadata changes, which I think they specifically mention somewhere.
 
hmm... it came up once for me then stopped.
 
so when changing the metadata it needs to be a full uninstall/install
 
I'm not sure whether or not it has to be, but that definitely seems to work.
 
oh duh I turned it off.
 
8:21 PM
@Hogan No - it looks like the event's not firing or if it is the event handler isn't wired up properly because the code to set the image or change the opacity doesn't get called
 
@ChrisF Could it be that the image does not have a name attribute?
 
I'm referencing it through the button & it does work if I display a second album.
Don't worry about it - I'll get to the bottom of the problem eventually. It's not for work so there's no time limit.
 
8:45 PM
Did you know? In base 1, 0/0 = 0.
hm, so I take it this will load both jQuery and SOApi before proceeding?
//balpha <3
function with_plugin(url, callback) {
  var script = document.createElement("script");
  script.setAttribute("src", url);
  script.addEventListener("load", function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + callback.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }, false);
  document.body.appendChild(script);
}

with_plugin("err", stage_2_loader)

function stage_2_loader(){
  with_plugin("http://soapi.info/code/js/stable/scripts/Soapi.js", SO_Live)
um, no, there's no jQuery object to pass as a parameter when calling stage_2_loader.
...where err is a path to jQuery
 
you're setting up multiple script blocks?
 
well I need both jQuery and SOApi
and when I put the .js file in a userscript, I can't piggyback on the instance of jQuery already running on the page
...not easily anyway
could var $ = window.$ do?
 
i'm not loading jQuery in my 2 userscripts
so it seems to be using it from the page
it's just writing out a script element, why couldn't it use jQuery from the page?
if you're waiting for multiple scripts, you'd want to adjust with_plugin to take in multiple urls and only continue on when all loads have been fired though maybe?
 
9:01 PM
> var user_id = $("#hlinks-user a").first().attr("href").match(/[0-9]+/)[0];
(chrome-extension://odcjpkomnjonkehcfmjhfocjbhngcclp/script.js:109)
< Uncaught ReferenceError: $ is not defined
 
link?
 
gist: 631092, 2010-10-17 18:11:14Z
source view link
and install link:
this version works just fine if you copy paste it straight in the javascript console.
also it's my first UserScript ever, or my first attempt at serious javascript, so it's bound to be horribly written
@rchern Also, that user script isn't running in this window for me -- Chrome Dev for Windows
 
yeah, the suggestion to fully uninstall and reinstall was spot on. disabling/enabling doesn't seem to pick up metadata changes
status-completed
keep in mind that only the function you pass as the callback gets written to the script node that gets inserted
 
9:20 PM
hrm, moving everything in the delayed loaded helped - the script has loaded and I'm getting debug messages
 
add console.log(script.textContent) and view the output
 
but now I can't debug it from the console
 
the code in your user.js isn't what gets injected into the page
it's the code in the script node you create
 
yes, I understood that
but I thought you didn't need to inject everything
just what required on the additional "plugin"
that function also contained the designated entry point
(line 70, _schedule_next_update())
 
you need to inject anything you want to use on the page
the js runs in the page, it won't callback into the user script
 
9:22 PM
well then
so is it normal that I can't access the plugin from the console?
 
what do you mean?
 
for example when I dumped the script on the console window, I could run _parse_api_result(0, debug_change) and have it run
 
if that is something that gets passed in to the callback that gets inserted into the script node, then yes
 
or update_reputation_since(new Date("2010-09-01 00:00:00Z"))
// ==UserScript==
// @name          SO Live!
// @namespace     tag://badp/
// @description   Bring Live reputation requirement updates to the StackExchange™ EgoEmpowering HumanWorth™ counter.
// @include       stackoverflow.com*
// @include       meta.stackoverflow.com*
// @include       superuser.com*
// @include       meta.superuser.com*
// @include       serverfault.com*
// @include       meta.serverfault.com*
// @include       askubuntu.com*
I moved everything in the script tag.
 
if you take a look at SEChatModifications, you'll notice the script has 2 top level elements: declaring with_plugin, and calling with_plugin
 
9:28 PM
@rchern so do I
1. function with_plugin(url, callback) {
2. with_plugin("http://soapi.info/code/js/stable/scripts/Soapi.js", SO_Live)
(3. function SO_Live($){)
 
view what gets injected into the page: `$("script").eq(5) or whatever number
 
 (function SO_Live($){

  var api = Soapi.RouteFactory("api." + site);
/* remainder of userscript here  */
  }

})(jQuery)
I guess this makes it a de-facto anonymous function?
 
I haven't read the rest of this so I might be repeating something, but that's only going to work if jQuery is declared within the userscript, which it isn't if you didn't @require it
 
@MichaelMrozek no @require in non-Firefox
 
Yeah, that's why you don't use the jQuery or $ variables in the first place, you use the <script> trick
 
9:33 PM
but all the pages I'm injecting in do have jQuery already
yeah, the <script> trick I'm using indeed
but I'd like to keep console access
I'm considering changing with_plugins like this:
//balpha <3
function with_plugin(url, callback) {
  var script = document.createElement("script");
  script.setAttribute("src", url);
  script.addEventListener("load", function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    if(callback.name)
      script.textContent = callback.toString() + ";" + callback.name + "(jQuery);";
    else
      script.textContent = "(" + callback.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }, false);
nevermind that when I now paste the SO_Live function in the console, I can't access anything inside anyway
I guess I need to change function declarations to something like SO_Live.update_reputation_since = function update_reputation_since(date){ ?
 
I gotta admit, I'm utterly confused as to what you're trying to accomplish here...
 
@Shog9 poll every 30 seconds for rep updates. If there are any, announce them and increment the rep number.
 
No, I mean the with_plugin changes
 
The hope is that by injecting function foo($){ ... }; foo(jQuery) instead of (function foo($){ ... })(jQuery), I can then access foo from the console.
 
oh
you want global variables
 
9:46 PM
ah, yeah. i was confused hehe
 
window.foo = function foo($){ ... }; foo(jQuery)?
 
that'd do
 
I guess that's a foo too many
 
yuck yuck yuck
 
It's my day 1 of "serious" JS, pardon my being newbie.
 
9:48 PM
's ok
 
we've all been there (:
 
brb
 
the reason for the (fn)(jQuery) construct was specifically to avoid namespace pollution; if you want to expose something globally, window.name = fn makes that explicit
I wouldn't bother exposing the outer function (foo / SO_Live / whatever) though; you'll probably want to do some one-time initialization there, and calling it later on would get hairy
 
@radp I pity the foo.
 
just create another "doWork()" function, expose that, and call it when you want to watch what's happening
 
9:55 PM
sounds reasonable, I guess
I guess I'll add something like this then:
  window._start_SO_Live_debug = function(){
    debug = 1;
    window.SO_Live = SO_Live;
    window.SO_Live._parse_API_update = _parse_API_update;
    //etc.
  }
 
_start_SO_Live_debug? ouch.
 
weird
 
@rchern ugh for the ugly, long name or is it actually bad practice?
RIP, Mandelbrot. Though I only knew a small portion of your work, I can only assume that the larger picture was exactly the same.
6
 
heh
 
@radp, haven't you been paying attention? i'm not the person to ask about javascript best practices hehe
 
10:03 PM
@rchern :D
 
i'm sure someone could easily rip apart my chat user script
 
I'm kinda proud of my lightweight_notify() function. It's obviously useless if the window top is not at the top
however, I cannot just set the top bar position:fixed.
Not with 20-some different sites.
yeah, just can't work that way.
 
10:24 PM
I see console access isn't a big deal for you anyway :)
 
?
 
10:57 PM
HHHHHHHHEEEEEEEEEEEELLLLLLLLLLLOOOOOOOOOOO
 
o:
 
You always seem so surprised when I come in
 
She's probably surprised that you need to announce it each time
 
haha, i was surprised at your HHHHHHHHEEEEEEEEEEEELLLLLLLLLLLOOOOOOOOOOO announcement (:
 
does GM stuff qualify for StackApps?
or does it belong to MSO rather?
0
Q: SO Live! -- live updates to your reputation scores thorough the network.

badpThis userscript, based on SOApi.js, injects itself in all SE pages and polls the API for reputation changes every 30 seconds. When your reputation changes, this is quietly announced at the top of the page and the top reputation counter is joyfully updated. View Source Install To "demo" wha...

 
11:20 PM
yeah, i'd say that goes on SA since you're using the api
good call (:
now where i should post mine? no clue, lol
i'm not seeing the onclick handler on the message actions that generates the popup >_<
or rather, i see the handler, but not where it gets attached
 
Which handler is that?
 
function ta(c) {
 
Ah, alright.
 
the hover effect that shows the down arrow. i think that's what i'm missing
 
fuck
I refreshed to page to check if I was upvoted
that really defeats the point, huh? :D
 
11:28 PM
Hahah
 
did you add an api key in there? enough people use it and it seems like there's gonna be some serious forced throttling
 
@radp woo that is some crazy indenting happening at ~ line 65
(heads to the store to buy a wider monitor)
 
nite
@rchern I have
Who knows how many badges will Community earn as a result? :D
 
huh?
so...1 request every 30 seconds, 2 requests per minute, 120 per hour. 42 people install the script and you've got 2 hours lifetime?
la la la, i know this click event is somewhere
 
11:45 PM
I'm searching for it too, heh, my brain is a little slow right now though.
$(".action-link").live("click", ta); perhaps? ;)
Line 5385 if you ran it through jsbeautifier
 
grrr. why didn't that come up when i went through searching for "ta"
and why doesn't $("#message-243863 span.action-link").data("events") return it? i guess because it is done through .live()?
(and let me say, there's a lot of instances of "ta" in the code ):
 
Yeah, .live() works in a somewhat funny way.
 
does $("#message-243863 span.action-link").click() do anything for you?
 
Doesn't appear to.
 
hm
goes back to looking for the edit code
 
11:53 PM
@rchern Oh, I actually looked at that yesterday. Unfortunately there's no way to hook into it, since it's isolated inside, meh. I guess you could copy it, but that seems wasteful.
 
oh hrm
wanted to add edit and delete
 
Yeah, I did too, heheh.
I'm trying to see if there's a workaround, but no dice yet.
 
):
is it a lot of code to copy or just a couple lines?
 
Hmm
 
4 mins ago, by rchern
goes back to looking for the edit code
(;
 
11:57 PM
It starts at line 4099 I believe
Well
Actually the function above that, but nothing important happens there.
 

« first day (74 days earlier)      last day (4934 days later) »