返回首頁 

Precise Time Converter on Google

See the precise time conversion r###lts on Google when searching for Hours to Days, Minutes to Hours, Minutes to Milliseconds, or X Hours/Minutes From Now.


Install this script?
Author's suggested script

You may also like AIGPT Everywhere.


Install this script
// ==UserScript==// @name         Precise Time Converter on Google// @namespace    PreciseTimeConverterGoogle// @version      21// @description  See the precise time conversion r###lts on Google when searching for Hours to Days, Minutes to Hours, Minutes to Milliseconds, or X Hours/Minutes From Now.// @author       hacker09// @include      *://www.google.*// @icon         https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://www.google.com&size=64// @run-at       document-end// @grant        none// @noframes// ==/UserScript==(function() {'use strict';if (document.querySelector("#ssSucf") !== null) //If the user searched for something that Google returned the conversion boxes{ //Starts the if conditionif (document.querySelector("#ssSucf").value.match('Min') != null) //If the conversion box value is equal Minute{ //Starts the if conditionvar Input = document.querySelector("#HG5Seb > input").defaultValue; //Get the Minute number value} //Finishes the if conditionif (document.querySelector("#ssSucf").value.match('Ho') != null) //If the conversion box value is equal Hour{ //Starts the if conditionInput = document.querySelector("input.vXQmIe.gsrt").defaultValue * 60; //Get the Hour number value} //Finishes the if conditionif ((document.querySelector("#ssSucf").value.match('Ho') != null && document.querySelector("#NotFQb > select").value.match(/Day|Dia/) != null) || (document.querySelector("#ssSucf").value.match('Min') != null && document.querySelector("#NotFQb > select").value.match('Ho') != null) || (document.querySelector("#ssSucf").value.match('Min') != null && document.querySelector("#NotFQb > select").value.match('Mil') != null)) //If the conversion box value is equal Hour, Minute or Day{ //Starts the if conditionvar Value; //Create a new global variablevar days = Math.floor(Input / 1440); //Sum the total precise amount of daysvar hours = Math.floor((Input % 1440) / 60); //Sum the total precise amount of hoursvar minutes = (Input % 1440) % 60; //Sum the total precise amount of minutes(document.querySelector("#ssSucf").value.match('Min') != null && document.querySelector("#NotFQb > select").value.match('Mil') != null) ? Value = Input * 60000: Value = days + ' day(s) ' + hours + ' hr(s) ' + minutes + ' min(s)'; //If the conversion is from Minutes to Milliseconds do the first math, otherwise do the second mathdocument.querySelector("#NotFQb > input").style.width = '370px'; //Expand the converted r###lts boxdocument.querySelector("#NotFQb > input").defaultValue = Value; //Display the converted r###lts} //Finishes the if condition} //Finishes the if conditionif (document.querySelector("#APjFqb").value.match(/ hr\. (\d+) min\.? from now|hours? from now|hrs? from now|minutes? from now|mins? from now/i) !== null) //If the search box contains the text hours/mins from now{ //Starts the if condition//Start the function to correctly format the date and time from nowfunction formatDateTime(date) { //Starts the functionvar year = date.getFullYear();var month = date.getMonth() + 1;var day = date.getDate();var hh = date.getHours();var m = date.getMinutes();var s = date.getSeconds();var dd = "AM";var h = hh;if (h >= 12) {h = hh - 12;dd = "PM";}if (h == 0) {h = 12;}month = month < 10 ? "0" + month : month;day = day < 10 ? "0" + day : day;m = m < 10 ? "0" + m : m;s = s < 10 ? "0" + s : s;h = h < 10 ? "0" + h : h;var display = month + "/" + day + "/" + year + " " + h + ":" + m;display += ":" + s;display += " " + dd;return display;} //Finishes the functionvar DaysFromNow = 0; //The total precise amount of daysvar HoursFromNow = 0; //The total precise amount of hoursvar MinutesFromNow = 0; //The total precise amount of minutesvar SecondsFromNow = 0; //Creates a new variablevar date = new Date(); //Creates a new dateif (document.querySelector("#APjFqb").value.match(/hours? from now|hrs? from now/i) !== null) //If the search box contains the text hours from now{ //Starts the if conditionHoursFromNow = document.querySelector("#APjFqb").value.match(/\d+/)[0]; //Get the written number of hours from now that the user wrote} //Finishes the if conditionif (document.querySelector("#APjFqb").value.match(/minutes? from now|mins? from now/i) !== null) //If the search box contains the text mins from now{ //Starts the if conditionMinutesFromNow = document.querySelector("#APjFqb").value.match(/\d+/)[0]; //Get the written number of Minutes from now that the user wrote} //Finishes the if conditionif (document.querySelector("#APjFqb").value.match(/ hr\. (\d+) min\.?|and \d+ minutes? from now|and \d+ mins? from now/i) !== null) //If the search box contains the text "and minutes/mins from now" or contains " hr. min "{ //Starts the if conditionHoursFromNow = document.querySelector("#APjFqb").value.match(/\d+/)[0]; //Get the written number of hours from now that the user wroteMinutesFromNow = document.querySelector("#APjFqb").value.match(/(?:a?n?d?h?r?\.? (\d+))/)[1]; //Get the written number of Minutes from now that the user wrote} //Finishes the if conditionvar secondsToAdd = DaysFromNow * 60 * 60 * 24 + HoursFromNow * 60 * 60 + MinutesFromNow * 60 + SecondsFromNow; //Convert the actual days,hours and minutes to secondsdate.setSeconds(date.getSeconds() + secondsToAdd);document.querySelector("#APjFqb").value = document.querySelector("#APjFqb").value + ' = ' + formatDateTime(date); //Display a message showing the days, hours, and mins from now} //Finishes the if condition})();