MediaWiki-diskusjon:Gadget-page-authors-simple.js

message: Hi! Could someone apply these changes to this script? Here is a summary of what changed:
* Migration to functions available in latest version of MediaWiki:
** Use mw.config.get(...) to access config variables (they won't be global forever)
** Use mw.util.wikiScript( 'api' ) to get an API link
** Use mw.util.wikiGetlink(...) to get links to wikipages
** Use mw.util.addPortletLink(...) to create portlet links
* Fixes for some problems found by JSHint (a tool recommended by MediaWiki developers for validating JavaScript code)
** Remove unnecessary semicolons and add others which are needed
** Make consistent use of tabs for indentation
** Variables should not be declared multiple times in the same scope
** Use the array literal notation [] instead of new Array()
** Use '===' to compare with 'null'
** Don't make functions within a loop
Best regards, Helder.wiki 19. okt 2011 kl. 17:47 (CEST)
replies: text: My coding style doesn't go well with JShint, so I stopped using it. Basically it nags about details that isn't important at all, and tries to enforce coding styles that are error prone. Especially the nagging about multiple declarations are troublesome. I can update the script, but please note as I wrote in the bug report that there is a few additional problems with this script. Use it as an example of whats possible, not how something like this should be implemented. — Jeblad 20. okt 2011 kl. 13:47 (CEST)
replies: text: :The usage of one variable per function is indeed a coding style that one can choose to adopt (one that is disabled by default in JSHint and is only enabled with /*jshint onevar:true */). The other issues it found here, however, ae matters of code quality, not coding style (unnecessary semicolons, array literal notation, misunderstood comparison to 'null', functions in a loop) are all instances of the author misunderstanding how the language works or just trivial clean up. Krinkle (diskusjon) 15. jul. 2014 kl. 19:31 (CEST)
thread_title:  Updates 

message: Har ikke sjekket, men virker som det er en mindre endring i APIet. Endre linje 192 fra
query.rvstartid = data['query-continue'].revisions.rvstartid;
til noe ala
query.rvstartid = data['query-continue'].revisions.rvcontinue;
Tror det er alt som skal til for å få dette til å fungere igjen. — Jeblad 19. aug 2012 kl. 14:31 (CEST)
replies: text: Implementert. Ser ut til å fungere. Stigmj (diskusjon) 19. aug 2012 kl. 14:57 (CEST)
replies: text: :Takk! — Jeblad 19. aug 2012 kl. 15:01 (CEST)
thread_title:  Endringsforslag 

message: Hi,
I've applied some updates to remove misunderstood code and enforce code quality. Here is an overview of the changes. Since Jeblad is here, I've also added an additional note explaining it briefly.
* Removed confusing semicolons.This isn't a case of coding style or relying on Automatic Semicolon Insertion. Instead, this is a matter of confusing semicolons. JavaScript terminates statements with a semicolon. However these where in fact function declarations (like class Foo {} in other languages), not a function expression assigned in a statement. The semicolon merely results in an additional empty statement being created.
* Broken comparison to null.The null value in javascript is separate from undefined. The default value for new variables, and the value yielded from an inexistent object property is undefined, not null. null is a defined and custom value that is only returned you explicitly return it and should generally be avoided elsewhere. This code worked because the two errors (using null and using loose comparison) cancelled each other out since the "loose equality" operator also tolerates undefined when compared against null (similar to how it tolerates a numerical string when comparing against a number).
* Remove double declared variables. JavaScript has no block scope, only function scope. This in no way changes behaviour or even interpretation of the application. Any var statement is hoisted before execution to the top of its function scope.
Krinkle (diskusjon) 15. jul. 2014 kl. 19:48 (CEST)
replies: text: You  made your point previously, and I don't agree. Especially the null tests was added on purpose. — Jeblad 16. jul. 2014 kl. 10:36 (CEST)
thread_title:  Code clean up 

message: Vet ikke hvorfor det fortsatt er aktivitet på denne siden, den er utdatert og ikke i bruk. Ny kode er på MediaWiki:Gadget-page-contributors.js. — Jeblad 16. jul. 2014 kl. 10:57 (CEST)
thread_title:  Utdatert