User talk:Galil/GWW Ajaxifier
nice work :)[edit]
This looks very interesting! AJAX is something I never tried myself (I prefer Flash :P), and I always thought we have AJAX disabled here? I'll take a look at the code and try to learn :P (I would like to see the code with indentation though :P Maybe you can add them the next time?) poke | talk 19:30, 11 January 2008 (UTC)
- Ajax probably is disabled, but it's not required to have server-side for it to work. The only thing this script calls on the server is the api-file, which requires you to set
$wgEnableAPI = false;
manually to disable, and the watchpage for obvious reasons. Everything else is client-side. ;)
- The reason the code isn't indented is quite simple though. This started out as a greasemonkey script, and as such only one script file could be loaded. I had to somehow embed three libraries into my own script file while still keeping the code separated (and it's also why all images are also embedded using the data: URI scheme). The way I solved it was to keep the files separated, and use Dojo Shrinksafe to put them together. This has the added effect of compressing the files. Though seeing as I'm no longer limited to one file, I guess I could upload the files separately, and possibly separate the images and css from the file as well. Will look into it tomorrow or something. :) — Galil 19:45, 11 January 2008 (UTC)
- Greasemonkey is also the reason this script doesn't work in a few browsers. It was never intended to be run in anything but Firefox to start with. ;) The reason it doesn't work with KHTML though (Safari and Konqueror) is unknown, and will remain so until they get a javascript debugger or atleast start to display javascript errors. — Galil 19:50, 11 January 2008 (UTC)
- Ah ok :) But I would recommend you to not split it up as additional files take longer than one bigger file to load, especially when you have to add the script tags manually after the page loaded already. And the API page is very interesting, thanks :) poke | talk 19:58, 11 January 2008 (UTC)
- True, but I was thinking about uploading the original files non-the-less sooner or later since I figured some people would be interrested in the code in a readable state. Doing that doesn't necessarily mean removing the big file. ;) Either way if the script is ever going to work in Internet Explorer for one, I would have to extract the images anyway, as IE doesn't support the data-scheme (surprise!). Not sure about Konqueror or Safari. — Galil 20:09, 11 January 2008 (UTC)
- Ah ok :) But I would recommend you to not split it up as additional files take longer than one bigger file to load, especially when you have to add the script tags manually after the page loaded already. And the API page is very interesting, thanks :) poke | talk 19:58, 11 January 2008 (UTC)
(Reset indent) I think you'd be interrested in looking at User:Galil/Sandbox/ajaxifier.js. Will try to keep it updated, but can't promise I will. Thus the sandbox. — Galil 04:37, 12 January 2008 (UTC)
Thanks[edit]
Great script, thanks. :) The search suggestion doesn't work for me though, but the watchlist/gallery work great. I should probably get more into AJAX. Biscuits 21:57, 11 January 2008 (UTC)
- Seconded. Although, if you could make the same thing for Patrol as you did for Watchlist, that would be grrreat :P -- Brains12 • Talk • 21:59, 11 January 2008 (UTC)
- Biscuits; What browser are you using? Note that the way the suggestions are implemented, they set a timer whenever you press a button in the searchbox for one second, resetting it to one second the next keypress. After it's timed out, it will send a request to the server asking for a list of pages beginning with that. After all that is done, and the results are retrieved it will finally display them to you. If the textbox loses focus during this time, it will abort. Basically it means you have to stop typing and wait a second or two for it to show up, without letting the focus leave the textbox.
- Brains12; I would look into it, as long as you give me directions for what link you are referring to. ;) — Galil 22:25, 11 January 2008 (UTC)
- Patrol, it's a sysop tool which marks a revision as "Patrolled", so when looking through Recentchanges or watchlist, you don't get a ! near the article and then know a sysop hasn't seen it/marked it as patrolled. You get the link when you go to a diff that hasn't been marked. It then goes to a page, similar to the Watchlist notice, which says something along the lines of "this revision has been marked as patrolled. Go back to Article. "
- Seeing as you're not an admin, it'll be hard for you to do that, though I guess... Unless Poke helps or something? :P -- Brains12 • Talk • 22:32, 11 January 2008 (UTC)
- The link to click (when viewing a diff) is like this:
http://wiki.guildwars.com/index.php?title=Talk:Monastery_Keeper &action=markpatrolled&rcid=638701
(space added for linebreak) for this diff, if that helps. :P - anja 22:36, 11 January 2008 (UTC)- While it does help, it wouldn't be the optimal way for me to judge links by simply scanning through their targets. That way I would have to check every single link on the entire page, and trust me there are more than you think. Just on this page there are 90. :P The thing I guess I could do though, is install a wiki on my private server (again, did it when writing the first script for GuildWiki) and experiment there. Either way, it should be possible to arrange, will just need some looking into. :) — Galil 22:41, 11 January 2008 (UTC)
- The problem with the patrolling is - which is why I stopped working on my Enhanced patrol mode tool - that you need the patrol id which is unique and does not belong to the revision or whatever. So if there is no rcid gived the whole patrolling is just too complicated.. (imo) poke | talk 22:48, 11 January 2008 (UTC)
- The amount of elements that aren't possible to track down with
document.evaluate
should be extremely low. So finding the link should be no problem. After that, if things are as you say - that you need the patrol id to "patrol" a diff - it should be available in the link, and should be extractable. If it isn't available in the link, you'd think it can't be needed either? ;) — Galil 22:54, 11 January 2008 (UTC)
- The amount of elements that aren't possible to track down with
- The problem with the patrolling is - which is why I stopped working on my Enhanced patrol mode tool - that you need the patrol id which is unique and does not belong to the revision or whatever. So if there is no rcid gived the whole patrolling is just too complicated.. (imo) poke | talk 22:48, 11 January 2008 (UTC)
- While it does help, it wouldn't be the optimal way for me to judge links by simply scanning through their targets. That way I would have to check every single link on the entire page, and trust me there are more than you think. Just on this page there are 90. :P The thing I guess I could do though, is install a wiki on my private server (again, did it when writing the first script for GuildWiki) and experiment there. Either way, it should be possible to arrange, will just need some looking into. :) — Galil 22:41, 11 January 2008 (UTC)
- The link to click (when viewing a diff) is like this:
- Found it. It shouldn't be too hard to implement. The question is, what do you want to happen once it's been marked as patrolled? Stay on the diff-page? Get sent to Special:Recentchanges? Popup a window with a dancing charr? Though I guess the latter would be quite difficult since I'm not good at drawing, even less so at animating. — Galil 23:32, 11 January 2008 (UTC)
- Ah I see. It does work, I was just not being patient enough. And also, I was typing "User:" which doesn't return anything. Biscuits 00:08, 12 January 2008 (UTC)
- Yeah, I seem to have forgotten to mention that. I had two choises. Either request a 5 kB page containing links, that works with all namespaces and parse said page, or request a 200-300-ish byte page containing page-names that works only with the main namespace but translates directly into javascript. I chose the latter. Though due to recent discoveries I've found a way to request another 200-300 byte page that also translates directly into javascript and works with all namespaces. I intend to use that starting with the next release. :) — Galil 00:14, 12 January 2008 (UTC)
(Reset indent) So how about that? Works with all namespaces. Though, you have to write the colon and at least one char after it too for it to know what namespace you are referring to and where to begin. User
would show pages in the main namespace that begin with User, User:
would not show anything, User:Galil
would show my own userpages.
Also, I've added the ajaxified "Mark as patrolled" link! Two things to note though, it will not remove the actual link after marking it, just disable it. You will not accidentally mark it as patrolled twice though since (again) it's disabled. The other thing to note is I don't know how error messages work out, since I haven't gotten it to fail yet. :P That would be nothing major though, just an odd message and a cross.
Enjoy. — Galil 04:06, 12 January 2008 (UTC)
- Thanks for that, Galil! Most helpful :P -- Brains12 • Talk • 14:36, 12 January 2008 (UTC)
- My pleasure, I'm just glad it's useful and not just eyecandy. ;) Be sure to give me a ping if it starts acting weird. As I'm not a sysop, I'm not likely to notice. :P — Galil 14:43, 12 January 2008 (UTC)
- I just noticed a small problem - the patrol link only comes when you go to a diff on recent changes or from watchlist. It doesn't work if you go to the "diff last" gwwt tab (or through History > compare selected versions). -- Brains12 • Talk • 19:14, 12 January 2008 (UTC)
- Is it supposed to appear at History > Compare selected versions? Cause it doesn't on my local wiki. o.O — Galil 19:56, 12 January 2008 (UTC)
- I just noticed a small problem - the patrol link only comes when you go to a diff on recent changes or from watchlist. It doesn't work if you go to the "diff last" gwwt tab (or through History > compare selected versions). -- Brains12 • Talk • 19:14, 12 January 2008 (UTC)
- My pleasure, I'm just glad it's useful and not just eyecandy. ;) Be sure to give me a ping if it starts acting weird. As I'm not a sysop, I'm not likely to notice. :P — Galil 14:43, 12 January 2008 (UTC)
- Same goes for the diff last tab after adding GWWT to said wiki. Meaning, I don't think the link is supposed to be there. There's at least no possible way it's this script hiding it, cause there's no code in it that could hide it/remove it even if the code was faulty. Try turning off javascript in your browser and check that the link is actually supposed to be there to begin with. — Galil 20:01, 12 January 2008 (UTC)
- I dont think there is a patrolled link if you don't have a rc-id, and you don't get that from history. (No use of marking things that have moved out of rc a long time ago, I guess) - anja 20:03, 12 January 2008 (UTC)
- My mistake, sorry, Galil. It doesn't appear through Diff or Compare selected verion (Blame my newbishness :P) -- Brains12 • Talk • 20:08, 12 January 2008 (UTC)
Recent changes ticker[edit]
I'm thinking of implementing a recent changes ticker. I don't quite have all the details in the head yet, but the general idea is that it should query the server once per minute to see if there's anything new on recent changes. If so, it would add those to the ticker (with some sweet effects of course!) and if there's more than <insert decent number here> entries on the ticker it would remove the ones at the bottom. Seeing how many people do nothing but refresh recent changes (myself included) I think it would be a nice addition. :)
So, any suggestions of how it should work? I'm thinking that it should hook into the current recent changes list, and simply add new items to that list. Pros; you won't have to see recent changes on each and every page. Half the work is already done. Cons; the half that isn't done is the hard part, especially if the user in question has got advanced recent changes list activated in preferences. Another solution I'm thinking about is a div somewhere on all pages that would list recent changes. Pros; you could easily see recent changes no matter what page you're on. Cons; lack of space to put it. :S Other suggestions? Which would you prefer? — Galil 04:53, 12 January 2008 (UTC)
It seems......[edit]
like a nice tool, oh how I wish I could use it but I have Internet Explorer. Hopefully you can get it to work for IE --Shadowphoenix 02:17, 4 February 2008 (UTC)
- I guess I could give it a try, but I have to say it's not very high on the priority list (read; inexistant), especially due to the veins that pop in any and all web developers' foreheads when they try to make anything work in IE.
- While waiting for the IE version however, may I poke you in the direction of some interresting reading, and some even more interresting reading if you're using IE6? Also, did you know that US, Swedish and Finnish governments (at least) all have warned against using IE (pre-IE7)? *spreads some anti-IE propaganda* — Galil 02:29, 4 February 2008 (UTC)
- Oh my what horrible things they are saying about IE6 luckly I have IE7 XD lol --Shadowphoenix 07:56, 4 February 2008 (UTC)
- Oh, I've managed to crash almost every browser that ever existed...lol. (yes, even firefox) ~ Chakra Djinn 00:25, 3 March 2008 (UTC)
- Oh my what horrible things they are saying about IE6 luckly I have IE7 XD lol --Shadowphoenix 07:56, 4 February 2008 (UTC)
Interesting...[edit]
I've been programming JS for quite some time, and where can I see this in action?
Also...lol, I can't help myself...but where's all the AJAX? All I see is regular JS. ;)
Yeah, if you're interested, I actually made an AJAX library myself. It compresses every transaction between the server and client, I'm quite proud of it, just never got to actually making it understandable to others. Chakra Djinn 04:56, 11 February 2008 (UTC)
- I'd like to correct myself, I now see the AJAX in the auto-complete. If you need any help for IE compatability, let me know.
- The day IE implements support for
document.evaluate
is most likely the day I'll be looking into IE compatibility. For now, IE users will have to be punshed severely for using a bad browser. ;) On a serious note though, there's also AJAX for the watch/unwatch link on each page (or AJAJ rather, but that sounds lame...), and for the patrol-links for sysops. — Galil 12:28, 11 February 2008 (UTC)- lol, you could always add that functionality using an external JS file ;) But yes, I agree, IE is quite a pain. But hope is in way, haha, they finally annouced (some time ago) that the dev version of IE8 will render ACID2!!! Chakra Djinn 23:13, 2 March 2008 (UTC)
- Really? o.O So there is light at the end of the tunnel after all. :P — Galil 23:17, 2 March 2008 (UTC)
- Yeah, we shall see...still no native canvas support I've seen yet. Google made a work-around but that doesn't work w/ image files well. ~ Chakra Djinn 00:23, 3 March 2008 (UTC)
- Really? o.O So there is light at the end of the tunnel after all. :P — Galil 23:17, 2 March 2008 (UTC)
- lol, you could always add that functionality using an external JS file ;) But yes, I agree, IE is quite a pain. But hope is in way, haha, they finally annouced (some time ago) that the dev version of IE8 will render ACID2!!! Chakra Djinn 23:13, 2 March 2008 (UTC)
- The day IE implements support for
Gallery Not Working[edit]
After adding this to my javascript I decided to try out the different features but the gallery doesn't seem to work for me. The page I tried it on is is the Elementalist armor, the same one you used in your example image. On this page both the watch page button and search bar auto-completion work as they should but when I click on an image it opened it on a separate page, like it does without Ajaxifier added. I've tried clearing my cache with Ctrl + F5 without success, not sure why it's not working since two out of the three work fine. I'm using FireFox at the moment. --Kakarot 17:38, 4 March 2008 (UTC)
- Don't click on the image - there's a "Gallery" tab at the top which puts all the images on the page onto the gallery :) -- Brains12 \ Talk 17:40, 4 March 2008 (UTC)
- I thought about making it pop up when you clicked the images, but quickly dismissed the idea since then it would be awfully painful to get to their pages. I'm still planning to implement thumbnails for the gallery though, I just need time. :/ — Galil 17:42, 4 March 2008 (UTC)
Patrolling of new articles[edit]
When creating a plugin, Pling and me noticed that the Ajaxifier does not patrol new articles. Could you add that maybe? The patrol link for new articles (or: for non-diff pages) comes with the following code:
<div class="patrollink">[<a title="<Article name>" href="/index.php?title=<Article_name>&action=markpatrolled&rcid=<RCID>">Mark this article as patrolled</a>]</div>
So instead of looking for //td[ @class="diff-ntitle" ]
ask also for //div[ @class="patrollink" ]
. Thanks :) poke | talk 23:35, 7 April 2008 (UTC)