Page Visit Counter

Show a counter of page visit on bottom right of page./网页访问计数器,在网页右下角显示页面的访问次数

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Page Visit Counter
// @namespace    http://user-script.yunser.com/
// @version      0.1
// @description  Show a counter of page visit on bottom right of page./网页访问计数器,在网页右下角显示页面的访问次数
// @author       Yunser
// @match        */*
// @icon
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        window.location
// ==/UserScript==

(function () {
    'use strict';

    const sValue = GM_getValue('__counter-' + window.location.href)
    let count = sValue ? (parseInt(sValue) + 1) : 1
    GM_setValue('__counter-' + window.location.href, count)
    const root = document.createElement('DIV')
    root.innerHTML = '' + count
    root.style = `
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 100000000;
    background-color: #f00;
    color: #fff;
    padding: 8px;
`
    const body = document.querySelector('body')
    body.appendChild(root)
})();