User talk:The wub/CloseCFD.js

Sub-sections of debates
This script has a bug: it doesn't handle CFD debates with sub-sections well. After I growled the closing admin it turns out that it was this script which was responsible for stripping a whole sub-subsection of a CFD debate.

Looking at the code, I think I can see how this happens. The debate is split on the header string '====', and assumes that the only instances are in the header of the debate. If there is a sub-section, its heading will use five equals signs '=====' .... so the split command will produce two more strings for each sub-section. However, if this happens, they won't be pasted back into the edit box, becasuse the script doesn't check for their existence.

I think that the solution is as follows.

Replace the line   t.value += z[2] + '\n' ;  //re-add main body

... with this block for (i=2 ; i< z.length ; i++) { t.value += z[i]; } t.value += "\n";

I don't swear that my code is correct, but I hope this helps. -- Brown HairedGirl (talk) • (contribs) 20:56, 13 March 2009 (UTC)


 * The split method removes whatever you're splitting on (I was adding the main header ====s back in manually), so unfortunately the "=====" then becomes "=". After some false starts I eventually found out you can override that behaviour using capturing parentheses, and changed the script appropriately. Thanks for your help! the wub "?!"  00:17, 15 March 2009 (UTC)

Legacy JavaScript
Hello! This script has been detected as using deprecated parameters that need to be replaced with the updated version. Examples include  needs to be replaced with   or   (depending on use);  all wgGlobalVariables need to be properly gotten with  ; and   needs to be called with. Please see ResourceLoader/Legacy JavaScript for details. Thank you. —  22:23, 19 January 2015 (UTC)