A Wikipedia user script to automate common TfD operations
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

tfdclerk.js 2.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Templates for discussion clerk script by [[User:The Earwig]]
  2. // Version: @TFDCLERK_VERSION_FULL@
  3. // Development and bug reports: https://github.com/earwig/tfdclerk
  4. // To install, add:
  5. // importScript("User:The Earwig/tfdclerk.js"); // [[User:The Earwig/tfdclerk.js]]
  6. // to [[Special:MyPage/common.js]] or [[Special:MyPage/skin.js]]
  7. /*
  8. Copyright (C) 2015 Ben Kurtovic <ben.kurtovic@gmail.com>
  9. Permission is hereby granted, free of charge, to any person obtaining a copy
  10. of this software and associated documentation files (the "Software"), to deal
  11. in the Software without restriction, including without limitation the rights to
  12. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  13. of the Software, and to permit persons to whom the Software is furnished to do
  14. so, subject to the following conditions:
  15. The above copyright notice and this permission notice shall be included in all
  16. copies or substantial portions of the Software.
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. SOFTWARE.
  24. */
  25. // <nowiki>
  26. var dependencies = [
  27. "mediawiki.api",
  28. "mediawiki.ui",
  29. "mediawiki.util",
  30. "jquery.ui.core"
  31. ];
  32. var is_tfd_page = function() {
  33. return mw.config.get("wgAction") == "view" &&
  34. mw.config.get("wgIsProbablyEditable") == true &&
  35. mw.config.get("wgRevisionId") == mw.config.get("wgCurRevisionId") &&
  36. mw.config.get("wgNamespaceNumber") == 4 && (
  37. mw.config.get("wgTitle") == "Templates for discussion" ||
  38. mw.config.get("wgTitle").indexOf("Templates for discussion/Log/2") == 0);
  39. };
  40. if (is_tfd_page()) {
  41. mw.loader.using(dependencies, function() {
  42. /* Main script starts here */
  43. mw.util.addCSS(
  44. @TFDCLERK_INCLUDE:main.css@
  45. );
  46. @TFDCLERK_INCLUDE:main.js@
  47. @TFDCLERK_INCLUDE:util.js@
  48. @TFDCLERK_INCLUDE:tfd.js@
  49. @TFDCLERK_INCLUDE:tfd_close.js@
  50. @TFDCLERK_INCLUDE:tfd_relist.js@
  51. $(TFDClerk.install);
  52. /* Main script ends here */
  53. });
  54. }
  55. // </nowiki>