// ==UserScript==
// @name        watermark-package
// @namespace   Scripts
// @match       *://test2.adsdesk.cn/*
// @grant       none
// @version     1.0
// @author      -
// @require     https://cdn.jsdelivr.net/npm/watermark-package
// @description 2023/12/6 13:42:17
// ==/UserScript==

(function () {
    'use strict';
    console.log("begin")

    setInterval(addWatermark, 1000)

    function addWatermark() {
        watermark.setWaterMark(
            {
                w_texts: ['模拟环境[' + 'xbz' + ']' + getNowTime()],
                w_options: {
                    w_opacity: '0.21'
                }
            }
        )
        watermark.removeWatermark()
    }

    function getNowTime() {
        const now = new Date();
        let year = now.getFullYear(),
            month = now.getMonth() + 1,
            date = now.getDate(),
            h = now.getHours(),
            m = now.getMinutes()
        month = month < 10 ? '0' + month : month
        date = date < 10 ? '0' + date : date
        h = h < 10 ? '0' + h : h
        m = m < 10 ? '0' + m : m
        return year + "-" + month + "-" + date + " " + h + ":" + m;
    }

    console.log("end")
})()
