Greasy Fork is available in English.

Contador de registros de contribuciones de RosettaCode

Cuenta elementos li específicos dentro de section.mw-pager-body

  1. // ==UserScript==
  2. // @name RosettaCode Conribution Records Counter
  3. // @description count specific li elements within section.mw-pager-body
  4. // @name:ar عداد سجلات المساهمات في RosettaCode
  5. // @description:ar عداد عناصر li معينة داخل section.mw-pager-body
  6. // @name:bg Брояч на записи за принос към RosettaCode
  7. // @description:bg Преброява специфични li елементи в section.mw-pager-body
  8. // @name:cs Počítadlo záznamů o příspěvcích RosettaCode
  9. // @description:cs Počítá specifické li elementy uvnitř section.mw-pager-body
  10. // @name:da RosettaCode bidragsrekordtæller
  11. // @description:da Tæller specifikke li-elementer inden for section.mw-pager-body
  12. // @name:de RosettaCode Beitragsdatensatzzähler
  13. // @description:de Zählt bestimmte li-Elemente innerhalb von section.mw-pager-body
  14. // @name:el Μετρητής αρχείων συνεισφοράς RosettaCode
  15. // @description:el Μετράει συγκεκριμένα στοιχεία li μέσα στο section.mw-pager-body
  16. // @name:eo RosettaCode Kontribuaĵo-Rekordoj-Nombrilo
  17. // @description:eo Kalkulas specifajn li elementojn ene de section.mw-pager-body
  18. // @name:es Contador de registros de contribuciones de RosettaCode
  19. // @description:es Cuenta elementos li específicos dentro de section.mw-pager-body
  20. // @name:fi RosettaCode Osallistumistietojen laskuri
  21. // @description:fi Laskee tietyt li-elementit section.mw-pager-body -sisällä
  22. // @name:fr Compteur d'enregistrements de contributions RosettaCode
  23. // @description:fr Compte les éléments li spécifiques dans section.mw-pager-body
  24. // @name:fr-CA Compteur d'enregistrements de contributions RosettaCode
  25. // @description:fr-CA Compte les éléments li spécifiques dans section.mw-pager-body
  26. // @name:he מונה רשומות תרומה של RosettaCode
  27. // @description:he סופר רכיבי li ספציפיים בתוך section.mw-pager-body
  28. // @name:hr Brojač zapisa doprinosa za RosettaCode
  29. // @description:hr Broji određene li elemente unutar section.mw-pager-body
  30. // @name:hu RosettaCode Hozzájárulás-rekord számláló
  31. // @description:hu Megszámolja a specifikus li elemeket a section.mw-pager-body-n belül
  32. // @name:id Penghitung Catatan Kontribusi RosettaCode
  33. // @description:id Menghitung elemen li tertentu di dalam section.mw-pager-body
  34. // @name:it Contatore di record di contributo di RosettaCode
  35. // @description:it Conta elementi li specifici all'interno di section.mw-pager-body
  36. // @name:ja RosettaCode投稿記録カウンター
  37. // @description:ja section.mw-pager-body内の特定のli要素をカウントします
  38. // @name:ka RosettaCode-ის წვლილის ჩანაწერების მთვლელი
  39. // @description:ka ითვლის კონკრეტულ li ელემენტებს section.mw-pager-body-ში
  40. // @name:ko RosettaCode 기여 기록 카운터
  41. // @description:ko section.mw-pager-body 내의 특정 li 요소를 계산합니다.
  42. // @name:nb RosettaCode bidragsrekordteller
  43. // @description:nb Teller spesifikke li-elementer innenfor section.mw-pager-body
  44. // @name:nl RosettaCode Bijdrage Records Teller
  45. // @description:nl Telt specifieke li-elementen binnen section.mw-pager-body
  46. // @name:pl Licznik rekordów kontrybucji RosettaCode
  47. // @description:pl Zlicza określone elementy li wewnątrz section.mw-pager-body
  48. // @name:pt-BR Contador de Registros de Contribuições do RosettaCode
  49. // @description:pt-BR Conta elementos li específicos dentro de section.mw-pager-body
  50. // @name:ro Contor de înregistrări de contribuții RosettaCode
  51. // @description:ro Numără elemente li specifice în interiorul section.mw-pager-body
  52. // @name:ru Счетчик записей о вкладе в RosettaCode
  53. // @description:ru Подсчитывает определенные элементы li внутри section.mw-pager-body
  54. // @name:sk Počítadlo záznamov o príspevkoch RosettaCode
  55. // @description:sk Počíta špecifické li elementy vnútri section.mw-pager-body
  56. // @name:sr Бројач записа о доприносима за RosettaCode
  57. // @description:sr Броји одређене li елементе унутар section.mw-pager-body
  58. // @name:sv RosettaCode bidragsregisterräknare
  59. // @description:sv Räknar specifika li-element inom section.mw-pager-body
  60. // @name:th ตัวนับบันทึกการมีส่วนร่วมของ RosettaCode
  61. // @description:th นับองค์ประกอบ li เฉพาะภายใน section.mw-pager-body
  62. // @name:tr RosettaCode Katkı Kayıtları Sayacı
  63. // @description:tr section.mw-pager-body içindeki belirli li öğelerini sayar
  64. // @name:ug RosettaCode تۆھپە خاتىرىسى سانىغۇچ
  65. // @description:ug section.mw-pager-body ئىچىدىكى كونكرېت li ئېلېمېنتلىرىنى ھېسابلايدۇ
  66. // @name:uk Лічильник записів внеску RosettaCode
  67. // @description:uk Підраховує певні елементи li всередині section.mw-pager-body
  68. // @name:vi Bộ đếm hồ sơ đóng góp RosettaCode
  69. // @description:vi Đếm các phần tử li cụ thể bên trong section.mw-pager-body
  70. // @name:zh RosettaCode贡献记录计数器
  71. // @description:zh 计算 section.mw-pager-body 中特定的 li 元素
  72. // @name:zh-CN RosettaCode贡献记录计数器
  73. // @description:zh-CN 计算 section.mw-pager-body 中特定的 li 元素
  74. // @name:zh-HK RosettaCode貢獻記錄計數器
  75. // @description:zh-HK 計算 section.mw-pager-body 中特定的 li 元素
  76. // @name:zh-SG RosettaCode贡献记录计数器
  77. // @description:zh-SG 计算 section.mw-pager-body 中特定的 li 元素
  78. // @name:zh-TW RosettaCode貢獻記錄計數器
  79. // @description:zh-TW 計算 section.mw-pager-body 中特定的 li 元素
  80. // @namespace http://tampermonkey.net/
  81. // @version 1.0.2.1
  82. // @author aspen138
  83. // @match *://rosettacode.org/wiki/Special:Contributions?end=&limit=5000&namespace=all&start=&tagfilter=&target=*
  84. // @match *://rosettacode.org/wiki/Special:Contributions*
  85. // @grant none
  86. // @license MIT
  87. // ==/UserScript==
  88.  
  89.  
  90. (function() {
  91. 'use strict';
  92.  
  93. function countAndDisplayDistinctTitles() {
  94. // Find the target section
  95. var section = document.querySelector('section.mw-pager-body');
  96. if (!section) return;
  97.  
  98. // Collect all title attributes from 'a' elements
  99. var liElements = section.querySelectorAll('a.mw-contributions-title');
  100. var titlesSet = new Set();
  101. liElements.forEach(function(aElement) {
  102. var title = aElement.getAttribute('title');
  103. if (title && !title.startsWith('User:') && !title.startsWith('File:')) {
  104. titlesSet.add(title);
  105. }
  106. });
  107. console.log('titlesSet=',titlesSet);
  108.  
  109. // Count distinct titles
  110. var countDistinctTitles = titlesSet.size;
  111.  
  112. // Create a new element to display the count of distinct titles
  113. var resultDisplay = document.createElement('div');
  114. resultDisplay.textContent = `(RosettaCode Contribution Records Counter) Count of distinct titles: ${countDistinctTitles}`;
  115. resultDisplay.style.backgroundColor = 'yellow'; // Set the background color to yellow
  116. resultDisplay.style.color = 'blue'; // Optional: Set text color to blue for better readability
  117. resultDisplay.style.padding = '10px'; // Optional: Add some padding
  118. resultDisplay.style.marginBottom = '10px'; // Optional: Add some margin at the bottom
  119. resultDisplay.style.border = "2px solid black";
  120.  
  121. // Insert the results as the first child of the section
  122. if (section.firstChild) {
  123. section.insertBefore(resultDisplay, section.firstChild);
  124. } else {
  125. section.appendChild(resultDisplay);
  126. }
  127. }
  128.  
  129. // Assuming this function is called when the document is fully loaded
  130. window.addEventListener('load', countAndDisplayDistinctTitles);
  131. })();
  132.