您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Notify when battery reaches low
// ==UserScript== // @name Battery Notifier for chrome on google/bing // @namespace http://tampermonkey.net/ // @version 0.1 // @description Notify when battery reaches low // @author Grok // @match https://www.bing.com/* // @match https://www.google.com/* // @match *://*.microsoft.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // Check if Battery API is supported if ('getBattery' in navigator) { navigator.getBattery().then(function(battery) { // Initial check checkBatteryLevel(battery.level); // Listen for battery level changes battery.addEventListener('levelchange', function() { checkBatteryLevel(battery.level); }); }); } else { console.log('Battery Status API not supported'); return; } function checkBatteryLevel(level) { // Convert level to percentage const percentage = Math.round(level * 100); // Check if battery is at or below percent if (percentage <= 35) { // Create notification showNotification(percentage); } } function showNotification(percentage) { // Check if Notification API is supported if ('Notification' in window) { // Request permission if not already granted if (Notification.permission !== 'granted') { Notification.requestPermission(); } if (Notification.permission === 'granted') { new Notification('Battery Warning', { body: `Arey azaamu, battery ${percentage}%! maatrame undi, please charging pettu rarey!!`, icon: 'https://cdn-icons-png.flaticon.com/512/3103/3103446.png' }); } } } // Check battery every 5 minutes as a fallback setInterval(function() { navigator.getBattery().then(function(battery) { checkBatteryLevel(battery.level); }); }, 300000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址