Database changes break my heart December 25, 2009 2:16 AM Subscribe
MeFi Navigator and other Metafilter scripts are (I think) broken. But, merry christmas!
Is it just me or MeFi navigator and other Greasemonkey Metafilter scripts are broken?
I think there was a database change of sorts. I use, apart from the aforementioned Navigator, "Metafilter MultiFavorited Multiwidth" and "Metafilter Thread Highlights" and none of them work.
So I pitifully pray for a call of arms to those brave script kiddies: when the festivities are over, take a look at the scripts - they need your help.
Is it just me or MeFi navigator and other Greasemonkey Metafilter scripts are broken?
I think there was a database change of sorts. I use, apart from the aforementioned Navigator, "Metafilter MultiFavorited Multiwidth" and "Metafilter Thread Highlights" and none of them work.
So I pitifully pray for a call of arms to those brave script kiddies: when the festivities are over, take a look at the scripts - they need your help.
I'll be the first to say it: script kiddies have little in common with greasemonkey script authors, and it's not a terribly flattering comparison. Not that I care excessively about that sort of issue anymore, but you'll find many authors who do.
Anyway, my MetaFilter script works, too, so it's looking more like your specific circumstance or a subset of scripts perhaps.
posted by mdevore at 3:32 AM on December 25, 2009
Anyway, my MetaFilter script works, too, so it's looking more like your specific circumstance or a subset of scripts perhaps.
posted by mdevore at 3:32 AM on December 25, 2009
Mefi Navigator still seems to work for me. Except for on Ask Metafilter, where it's been broken for ages. I should probably fix it at some point.
posted by matthewr at 3:37 AM on December 25, 2009
posted by matthewr at 3:37 AM on December 25, 2009
Ok, sorry, it must be me then. Strange, reloading or rebooting aren't changing squat.
And sorry about the "script kiddies" reference - it was meant to be funny, but I didn't manage to convey it.
posted by Baldons at 4:01 AM on December 25, 2009
And sorry about the "script kiddies" reference - it was meant to be funny, but I didn't manage to convey it.
posted by Baldons at 4:01 AM on December 25, 2009
Basic greasemonkey reality check:
1) See if any greasemonkey script works on any site for you. If you don't have any other site scripts, just grab a recent one from userscripts. There are a bunch of basic scripts for popular sites there. If nothing works, that's a big clue to local environment badness.
2) Check you didn't accidentally click the smiling monkey in the status bar to turn off greasemonkey, i.e. make sure it's not gray and unsmiley-like. I did that once, took me a minute to figure out why the scripts were being uniformly uncooperative.
posted by mdevore at 4:18 AM on December 25, 2009
1) See if any greasemonkey script works on any site for you. If you don't have any other site scripts, just grab a recent one from userscripts. There are a bunch of basic scripts for popular sites there. If nothing works, that's a big clue to local environment badness.
2) Check you didn't accidentally click the smiling monkey in the status bar to turn off greasemonkey, i.e. make sure it's not gray and unsmiley-like. I did that once, took me a minute to figure out why the scripts were being uniformly uncooperative.
posted by mdevore at 4:18 AM on December 25, 2009
Of those I use MeFi Navigator and MultiFavorited Multiwidth and they both work fine, so I have to conclude it's just you. Do note that the MultiFavorited script needed modification during the November experiment, so if you updated it for November you need to go back to the pre-November version as the site layout returned to pre-November html as well. You can check which version you have installed by looking at the XPath expression used for 'searchPattern'. The November version used "//span[@class='oldFav']" whereas the normal one uses ""//a[contains(@title,'marked this as favorite')]".
posted by Rhomboid at 4:50 AM on December 25, 2009
posted by Rhomboid at 4:50 AM on December 25, 2009
Navigator works here too
posted by wheelieman at 5:12 AM on December 25, 2009
posted by wheelieman at 5:12 AM on December 25, 2009
Except for on Ask Metafilter, where it's been broken for ages
For me, also.
posted by Wolof at 5:17 AM on December 25, 2009
For me, also.
posted by Wolof at 5:17 AM on December 25, 2009
Oh, I remember fixing MeFi Navigator to work with AskMe a long time ago and then forgetting what the problem was. *time passes* Oh yes, the issue is that it uses the XPath query of '//div/span[@class="smallcopy"]' to find the bylines, but in AskMe this also matches the date string that follows each title in the Related Questions box.
The script expects that every member of the result set will have an A node inside it that it can reference with getElementsByTagName() but this assumption is wrong for the date strings, which means an expression like elements.snapshotItem(0).getElementsByTagName('a').item(0).textContent.toString() will throw an error and cause the script to stop because NULL.item(0) is invalid.
In the past I fixed this just by putting a try/catch block around that expression, but after looking at some XPath references I think a more elegant solution is to change the XPath query to '//div/span[@class="smallcopy"][starts-with(.,"posted by")]' which causes it to only match the desired nodes. With that change it works for AskMe again.
If that didn't make any sense to you, then just open the script and find the first line after function mfn_main() and change it from:
posted by Rhomboid at 6:27 AM on December 25, 2009 [2 favorites]
The script expects that every member of the result set will have an A node inside it that it can reference with getElementsByTagName() but this assumption is wrong for the date strings, which means an expression like elements.snapshotItem(0).getElementsByTagName('a').item(0).textContent.toString() will throw an error and cause the script to stop because NULL.item(0) is invalid.
In the past I fixed this just by putting a try/catch block around that expression, but after looking at some XPath references I think a more elegant solution is to change the XPath query to '//div/span[@class="smallcopy"][starts-with(.,"posted by")]' which causes it to only match the desired nodes. With that change it works for AskMe again.
If that didn't make any sense to you, then just open the script and find the first line after function mfn_main() and change it from:
var elements = document.evaluate('//div/span[@class="smallcopy"]',document.body,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);to
var elements = document.evaluate('//div/span[@class="smallcopy"][starts-with(.,"posted by")]',document.body,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
posted by Rhomboid at 6:27 AM on December 25, 2009 [2 favorites]
Merry Christmas to you to!
posted by The Devil Tesla at 6:56 AM on December 25, 2009
posted by The Devil Tesla at 6:56 AM on December 25, 2009
Rhombold, I have no idea what you just said, but Ill take your word on it.
posted by wheelieman at 7:38 AM on December 25, 2009
posted by wheelieman at 7:38 AM on December 25, 2009
I'm not sure how much testing or coding time you're looking to put into it, matthewr, but if you're planning on revising the code, for some reason MeFi Navigator doesn't work in Google Chrome (which now supports GM scripts natively). Of course, it's probably as likely to be a problem on their end, since the extension support is in beta anyway, so I wouldn't fret unless you were looking to kill time on Christmas.
posted by Partial Law at 7:49 AM on December 25, 2009
posted by Partial Law at 7:49 AM on December 25, 2009
Database changes would have zero affect on you. HTML changes? Yes.
posted by blue_beetle at 7:51 AM on December 25, 2009
posted by blue_beetle at 7:51 AM on December 25, 2009
A very Monkey Greasemas to all.
posted by kuujjuarapik at 8:51 AM on December 25, 2009
posted by kuujjuarapik at 8:51 AM on December 25, 2009
Yep, I clicked that monkey, accidentally... sorry for the trouble, I overreacted. Me loves my precious scripties.
posted by Baldons at 10:19 AM on December 25, 2009
posted by Baldons at 10:19 AM on December 25, 2009
I've updated Mefi Navigator so it works on AskMe again, a mere eighteen months after it broke. Thanks to Rhomboid, whose comment prompted me to actually do something about it. And apologies to the various people who Mefimailed me over the last year waiting for me to look at it.
posted by matthewr at 6:38 PM on December 25, 2009
posted by matthewr at 6:38 PM on December 25, 2009
You are not logged in, either login or create an account to post comments
posted by mathowie (staff) at 2:19 AM on December 25, 2009