long touch to fullscreen

triple touch to fullscreen for for mobile

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         long touch to fullscreen
// @namespace    http://tampermonkey.net/
// @version      0.1.3
// @description  triple touch to fullscreen for for mobile
// @author       amormaid
// @run-at       document-end
// @match        http(s)?://*/*
// @include      http://*
// @include      https://*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // document.documentElement.requestFullscreen()
    let time_list = []
    function fullscreen() {
        console.log('touch end')
        time_list = [...time_list.slice(-2) , +new Date()]
        const [a, b, c] = time_list
        if (a && c && c - a < 1500) {
            // 处理点击事件
            document.documentElement.requestFullscreen()
        }
    }

    document.body.addEventListener('touchend', fullscreen )

})();