User talk:Ohconfucius/test/MOSNUM dates.js

This is an old revision of this page, as edited by Ohconfucius (talk | contribs) at 02:58, 15 August 2014 (Updates: question). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 11 years ago by Ohconfucius in topic Updates

Bug and corrections

  1. "{{main" becomes "{{mainmain", 13 April 2012 resolved 13 April 2012
  2. "| accessdate = 25 December 2008" becomes "December 25 2008", 12 April 2012 resolved 15 April 2012
  3. New York Times 26 Mar 1961 becomes New York TimesMar , 26 1961, resolved 15 April 2012
  4. <ref name="chronicle">Houston Chronicle, 18 November 2008</ref> becomes <ref name="chronicle">Houston Chronicle,November 18 2008</ref> resolved 15 April 2012
  5. http://en.wikipedia.org/w/index.php?title=Alcohol_laws_of_Utah&diff=487366373&oldid=481660290 resolved 15 April 2012
  6. '05.09.08' becomes '05@ERROR@08' resolved 15 April
  7. dmy - Non-conversion of July 31, 2005. resolved 15 April
  8. dmy - Non-conversion of January 31, 2005. resolved 15 April
  9. Unwarranted expansion of date: br >Region 4: Feb 14, 2008<re to br />Region 4: February 14, 2008<ref resolved 20 April 2012
  10. Unwarranted removal of ordinal resolved 20 April 2012
  11. Vol. 23, No. 5, May 1987, p. 3 becomes Vol. 23, No. May 5, 1987, p. 3 resolved 20 April 2012
  12. "$424 billion" becomes ",24 billion" (from Virginia) resolved 13 May
  13. |date=October 10-1997}} -> date=October 10–1, 997}}
  14. [[Progressive Conservative Association of Alberta leadership election, 2011|October 2, 2011]] becomes [[Progressive Conservative Association of Alberta leadership election, 2011|October 02, 2011]]
  15. missing comma. took place between 3–22 November 1967 becomes took place between November 3–22 1967
  16. stripping of hyphens without changing month "accessed 12-08-2011" becomes "accessed 12 08 2011"
  17. order of month switched with year in range |date=2003 Jul-Aug becomes |date=July 2003–Aug
  18. fails to remove ordinal 'the 17th of May'
  19. accessdate=2012 Apr 07 becomes accessdate=April 2012 07
  20. '1st Marquess' becomes '1 Marquess'

Simplifications

Hi!

What do you think about optimizing some regexes? Helder 21:46, 6 July 2012 (UTC)Reply

Updates

Hello Ohconfucius!

Could you make these fixes and improvements to the script? Helder 02:26, 13 August 2014 (UTC)Reply

@Ohconfucius: is any function defined in this script called from another js page? Helder 03:06, 13 August 2014 (UTC)Reply
Helder, the only place these functions would normally be called from is my vector file, and it doesn't seem to be the case. But if I have to call it, how would this be achieved? -- Ohc ¡digame! 03:12, 13 August 2014 (UTC)Reply
Ohconfucius: If you are referring to any of the functions which are used in the click events, you could trigger the click event of the link associated to the function (e.g. executing $( '#t-ISOdmy' ).click();), and jQuery would take care of passing the event object as a parameter (which is used in the lines e.preventDefault()). But if these functions are also intended to be called without a click event, then it would need some change to avoid errors such as "ReferenceError: e is not defined".
BTW: I just noticed the script is creating duplicated ids in the page (there are 4 "t-expand", 2 "t-dmy", 2 "ca-unitfixer", etc), which is invalid in HTML. You should choose a unique id for each link. Helder 03:43, 13 August 2014 (UTC)Reply
Noted. I never knew what those IDs' functions were, and the fact they were the same never caused any problems. Now renamed. I will do that for my other scripts too. -- Ohc ¡digame! 03:52, 13 August 2014 (UTC)Reply
  • @Helder.wiki: So, if I need to improve the other scripts (like formatgeneral.js), presumably I need to put e.preventDefault(); as the first line in each driver (the one activated directly by the button) and then change the syntax for the click buttons? Would I do that for Ohc_run_formatgeneral() only, or do I need to do it for Ohc_downcase_headings() and Ohc_eject_zh(), both of whose functions reside in a subscript? And what does that e. line do anyway? -- Ohc ¡digame! 02:58, 15 August 2014 (UTC)Reply