Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit25bc3f8e52696d606f236e286d2d295a4358fbbe (patch)
Author
 Kamen Mladenov <kamen@syndamia.com>
2023-03-13 19:09:00 +0000
Committer
 Kamen Mladenov <kamen@syndamia.com>
2023-03-13 19:09:00 +0000
Filesd1a9313b19a29d39590ea3b5d8cb2e648405dd79
userscripts-25bc3f8e52696d606f236e286d2d295a4358fbbe.tar
userscripts-25bc3f8e52696d606f236e286d2d295a4358fbbe.tar.gz
userscripts-25bc3f8e52696d606f236e286d2d295a4358fbbe.zip
Parent9f9ba253bf00b7dec2046e96fc8ea901d7e479fe (diff)
[vfk/v1.1] Added count to solutions pages and slightly reworked styling
1 files changed, 20 insertions, 8 deletions
-rw-r--r--vim-fmi-keystrokes.js28
diff --git a/vim-fmi-keystrokes.js b/vim-fmi-keystrokes.js
index c8fc6bd..87da7b9 100644
--- a/vim-fmi-keystrokes.js
+++ b/vim-fmi-keystrokes.js
@@ -2,7 +2,7 @@
// @name vim-fmi точки
// @description Добавя брой натиснати клавиши във всяка страница на решения
//
-// @version 1.0
+// @version 1.1
// @license MIT
// @author Syndamia
//
@@ -16,10 +16,22 @@
// @run-at document-body
// ==/UserScript==
-document.getElementsByTagName('ul')[3].childNodes.forEach((x) => {
- if (x.tagName != 'LI') return;
- var countElem = document.createElement('span');
- countElem.style.verticalAlign = 'bottom';
- countElem.innerText = x.children[0].children.length;
- x.insertBefore(countElem, x.firstChild);
-});
+if (window.location.pathname.endsWith('solutions')) {
+ document.getElementsByTagName('tbody')[0].childNodes.forEach((x) => {
+ if (x.tagName != "TR") return;
+ var countElem = document.createElement('div');
+ countElem.style.display = 'inline-block';
+ countElem.style.fontWeight = 'bold';
+ countElem.innerText = x.children[1].children[0].children.length;
+ x.children[1].insertBefore(countElem, x.children[1].firstChild);
+ });
+}
+else {
+ document.getElementsByTagName('ul')[3].childNodes.forEach((x) => {
+ if (x.tagName != 'LI') return;
+ var countElem = document.createElement('span');
+ countElem.style.verticalAlign = 'middle';
+ countElem.innerText = x.children[0].children.length;
+ x.insertBefore(countElem, x.firstChild);
+ });
+}