As in previous months, I have concentrated on coding visible features to impress the masses, while the likes of Oolong and OldMiner grind away behind the scenes doing essential but less visible work to stop the site melting down or freezing up, depending on the weather and the current sign of the first derivative of the gravitational potential field with respect to distance from the centre of the Earth. And just to make sure everyone knows who to thank for the new bells, whistles, and errors here is a summary of what I have been doing. Much of it followed on 'logically' from the things I was doing before to improve writeup footers:
- If you send a message to the author of a writeup from the blab box under the message, the report of the sent message is no longer jammed along with the blab box and their fourteen children in a microscopic flea-infested box where they have to stand on each others' heads in order to breathe, but has a well-ventilated space of its own under the writeup footer (or header, if you're really old-fashioned. Are you still wearing those socks?).
- But why should a message have to wait to be sent to be able to breathe? Writeup message boxes now expand to accommodate the text within them, as do many others. There was already code in place to make multi-line textarea elements expand, but it couldn't be used for text input boxes, since these can only be used for a single line of text. So the input boxes have to be replaced by an expanding text area of the same starting size as the original text input, and then have to be watched to see if the user hits the return/enter key, whereupon the form containing the box is submitted, as is normal with an input box (but not with a text area).
- Making the message box in the Chatterbox nodelet expand was less easy, because under some circumstances the entire chatterbox is replaced by the magic of AJAX and the expanding replacement message box would be replaced as well. AJAX is a technology for replacing bits and pieces of web pages instead of reloading the whole page, and is generally thought to be a Good Thing; you can enable it by selecting 'Everything2 AJAX' at the Javascript Repository. So the chatterbox AJAX code needed some rewiring: (1) to use an onsubmit function on the chatterbox form to trigger it, rather than event handlers on individual form controls and (2) to update the chatbox with only one AJAX call back to the server, rather than one call to sendMessage and one to updateNodelet. This in its turn required some reorganisation of the updateNodelet htmlcode to execute opcodes and to execute nodelet code in the same environment as when nodelets are inserted into a complete page, adjusting the values of the $NODE variable and the query parameters appropriately. A desirable side-effect of all of that was that the AJAXified Chatterbox is twice as fast and reports sent messages. Two desirable side-effects.
- Meanwhile, OldMiner redefined the meaning of 'success' in the Everything2 AJAX update function, which did away with the distressing tendency of the Chatterbox nodelet to occasionally vanish completely. Building on that, a callback function in an E2AJAX call is now always called after any attempted update, not only after 'successful' ones, making it possible for the callback function to decide what do about failure. Such as provide a bland error message. Code is in place to provide informative messages and not just "(unknown error)," but I haven't seen it say anything useful yet.
- Those of you who created a website back in the good old days will remember how you had to everything twice: once for proper browsers, and once for the one everyone was using. Those days are past. Nearly. But to make the AJAX chatbox work in Internet Explorer 8, a 'get' to had to be changed to a 'post' so that IE will not use a cached response. Telling it to tell the server not to use any response cached after 1970 is simply not enough. What a rebel that William is.
- Since I was messing around with the Chatterbox, I had a look at chatterlight. This has completely differently structured html code from the rest of the site, for which reason I excoriate and anathemetise it, and spit on the graves of its Reverend Progenitors. I also made a candidate replacement for it, currently to be seen at Chatterlighter. Since this provides absolutely nothing of any use to users of this site that is not also provided by chatterlight, its candidacy is currently in abeyance. One day it may be customisable in Exciting Ways in the context of pioneering new options for customisation of the site as a whole, whereupon its bid will be renewed. Please do not hold your breath, as resuscitation is cumbersome and not always 100% successful.
- To make Chatterlighter as a bog-standard Everything2 superdoc it was necessary to make it possible for pages to define their own nodelet set, overriding or adapting the user's normal nodelet options. Having done that it was possible to make sure that when a nodelet is viewed on its own page it will not also be shown in the page sidebar. Nodelets can contain forms that do things which are better not done twice, and they have id attributes in their html code which should only be used once in a given page, so that was a Good Thing.
- When Chatterlight(er) is inactive for a long time it no longer puts up an alert and steals the focus from whatever interesting things were keeping you from following the current discussion of the relevance of boobies to post-modern deconstruction of late-feminist neo-Quaker Quantum Mechanics. Instead it simply notes that it has got bored, provides a button to wake it up, and goes to sleep.
- For a long time there has been an option in nodelet settings not to show the chatbox topic. As a radical break with tradition, if you select it, the chatbox topic will not be shown.
- The revised chatterbox code only needed a little revision to be used to deal with forms in nodelets in general. So now submision of nearly all forms in nodelets will lead only to the nodelet being reloaded, not the whole page. (The exceptions are the log-in form and forms whose whole purpose is to take you to another page.) For example, you can change the number of writeups shown in New Writeups without reloading the whole page.
- If you are an admin you have another option in New Writeups. This is now managed in the same place as the choice of length.
- Strange things happened to the section collapsers in some nodelets when they were updated with AJAX. This turned out to be because the Ajax Update node is a node of type fullpage, and fullpage nodes are sent through the parseLinks function, which turns things in [square brackets] into links. It is now possible for fullpage nodes to say they can deal with their own links, thank-you very much.
- The chatterbox was AJAXed, but sending a writeup message still provoked a full pageload. Solution: a method of flagging that a form field should be used as the basis for an AJAX update, not a page load. This could then be recycled and extended to links and then to arbitrary elements to provide asyncronous handling of all sorts of actions: cooling of writeups, bookmarking, adding to categories, making users 'favourite!'... The code requires no more than a little gobbledigook in the class attribute of an HTML element to ajaxify it, so there will be a lot more of this going on going forward (as we say these days). Saves your time, the E2 servers' time, and U. of Mich.'s bandwidth. Activate AJAX now, before we do it for you!
More or less unrelated to the above stream of free association football boots the chemistry set and mathchmaker match made in hell for leather shoe soul kitchen table and chair, no bill:
- A principle of Good Web Design is that no function of a site should rely entirely on client-side scripting (code that runs in your browser): for the case that your browser doesn't Do scripts, it should also provide the same functions 100% server-side. E2 does not always comply with this. One place it didn't was in C!ing writeups when 'cool safety' was engaged: a pop-up window appeared asking for confirmation. Unless you didn't have scripting available in your browser, in which case nothing happened... To deal with this in a generalisable way there is now code in place that will ask for confirmation of an action with a pop-up box if scripting is available, or ask for confirmation by clicking on a button provided for this purpose after a page-load if not.
- Oolong had coded an option to hide low-reputation nodes automatically in the New Writeups nodelet. These nodelets are now also hidden in e2nodes unless you ask to see them. You can decide for yourself how 'low' is low.
- To err is human, to get driven completely and unreasonably NUTS by the trivial failings of others even more so. To make it easier for you to avoid contact with the works of those you cannot tolerate at your current level of spiritual development, there is a link from Your Ignore List to the Pit of Abomination. But only if you are already ignoring someone.
- The New Writeups Atom Feed is now entirely proof against being truncated: if it comes out too long, a shorter version is made.
- All of this coding business would happen much more slowly if at all if we didn't have a development server to play with and break things on where they won't get in the way. It would be nice if more members of edev were doing so. To make things even more fun and risky it is now possible to edit a code patch and apply it in one operation. This would be a Bad Idea on the production server: if we have to mess around with code here rather than importing it from the development server after fixing it so nothing explodes, then we should be forced to think about it carefully. But it would be a Bad Thing if the code on the development server were different from the production server in the long term. To make it possible to keep the code the same on the two servers while taking account of the need for different behaviour there is now a flag in System Settings, accessible to code as $HTMLVARS{isDevServer}, which is set on one server and not on the other.
This log was written on a plane. The oxygen pressure on planes is only 60% of that at standard temperature and pressure, and you should therefore avoid doing anything requiring significant mental acuity whilst flying.