Azubiheft.de - Warn on to many lines

Wanrns if there are to many lines to send the report

目前為 2023-09-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Azubiheft.de - Warn on to many lines
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Wanrns if there are to many lines to send the report
// @author       Tim Gromeyer <[email protected]>
// @match        https://www.azubiheft.de/Azubi/Wochenansicht.aspx?*
// @match        https://www.azubiheft.de/Azubi/Tagesbericht.aspx?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=azubiheft.de
// @grant        none
// @license      MIT
// ==/UserScript==

var entries = [];

if (window.location.pathname === "/Azubi/Wochenansicht.aspx") {
    entries = document.getElementsByClassName("d50");
} else {
    entries = document.getElementsByClassName("row7 d5");
}
var entriesLength = entries.length;

var linesCount = 0;

for (var i = 0; i < entriesLength; i++) {
    linesCount += entries[i].childElementCount;
}
linesCount += entries.length;

if (linesCount > 30) {
    var warning = document.createElement("div");
    warning.className = "warning";
    warning.textContent = "To many lines. Reduce the number of lines to 30 or less. Current number of lines: " + linesCount;

    warning.style.backgroundColor = "orange";
    warning.style.color = "white";
    warning.style.padding = "10px";
    warning.style.textAlign = "center";
    warning.style.fontWeight = "bold";
    warning.position = "fixed";
    warning.top = 0;
    warning.left = 0;
    warning.with = "100%";

    document.body.insertBefore(warning, document.body.firstChild);
}