time

ora-data

2022-10-23 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name           time
// @namespace      https://greatest.deepsurf.us/users/237458
// @version        0.6
// @description    ora-data
// @author         figuccio
// @match          *://*/*
// @grant          GM_addStyle
// @grant          GM_setValue
// @grant          GM_getValue
// @noframes
// @run-at         document-start
// @license        MIT
// @grant          GM_registerMenuCommand
// @require        https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js
// ==/UserScript==
$(document).ready(function() {
       addGlobalStyle(`
.timebox {
position:fixed;top:0px;right:230px;z-index:999999;width:auto;height:auto;margin:;text-align:center;background-color:gold;border-radius:10px;border:2px solid red;}

.day {width:100%;height:20px;font-size:15px;color:red;line-height:20px;}
.time {width:100%;height:30px;font-size:20px;color:green;line-height:20px;}

    `);
        //Aggiungi casella
        var box = $("<div class='timebox' id=testtimebox><div class='day' id='day'></div><div class='time' id='time'>");
        $("body").append(box);
        var date = new Date();
        var year = date.getFullYear();
        var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1);
        var day2 = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
        var day1 = day2 + '-' + month + '-' +year ;
////////////////////////////////////////////
var hour = date.getHours();
var minu = date.getMinutes();
var sec = date.getSeconds();

        var time1 = hour + ':' + minu + ':' + sec;
        $("#day").text(day1);
        $("#time").text(time1);
        var flag=0;//Segno dell'anno bisestile
        var d=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
        window.setInterval(add, 1000);

        function add() {
            sec++;
            if (sec >= 60) {
                sec = 0;
                minu++;
            }
            if (minu >= 60) {
                minu = 0;
                hour++;
            }
            if (hour >= 24) {
                hour = 0;
                day2++;
            }

            //anno bisestile
            if(year%400==0||(year%4==0&&year%100!=0))
                flag=1;
            //Aumento del mese
            if(month==2){
                if(flag==1){
                    if(day2>d[month]+1){
                        month++;
                        day2=1;
                    }
                }else{
                    if(day2>d[month]){
                        month++;
                        day2=1;
                    }
                }
            }else{
                if(day2>d[month]){
                    month++;
                    day2=1;
                }
            }
            if(month>12){
                month=1;
                year++;
            }
            // alert(minu);
            sec = parseInt(sec);
            minu = parseInt(minu);
            hour = parseInt(hour);
            day2 = parseInt(day2);
            month = parseInt(month);
            year = parseInt(year);
            sec = sec < 10 ? '0' + sec : sec;
            minu = minu < 10 ? '0' + minu : minu;
            hour = hour < 10 ? '0' + hour : hour;
            time1 = hour + ':' + minu + ':' + sec;
            day2 = day2 < 10 ? '0' + day2 : day2;
            month = month < 10 ? '0' + month : month;
            year = year < 10 ? '0' + year : year;
            day1 = day2 + '-' + month + '-' + year;
            $("#day").text(day1);
            $("#time").text(time1);
        }

    });
    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    };

//mostra nascondi data
 function myFunctiondate() {
  var box= document.getElementById('day');
box.style.display = ((box.style.display!='none') ? 'none' : 'block');
}
GM_registerMenuCommand("mostra data/nascondi data",myFunctiondate);
/////////////////////////////
 function myFunctiontime() {
  var box= document.getElementById('time');
box.style.display = ((box.style.display!='none') ? 'none' : 'block');
}
GM_registerMenuCommand("mostra time/nascondi time",myFunctiontime);
//////////////////
function Functionnasconditutto() {
  var box= document.getElementById('testtimebox');
box.style.display = ((box.style.display!='none') ? 'none' : 'block');
}
GM_registerMenuCommand("mostra box/nascondi box",Functionnasconditutto);
////////////////////////////////////