脚本分享

3 云朵小眠眠 10小时前 164次点击

给各位盲人朋友分享一个 Via 浏览器专用网页加载进度蜂鸣提示脚本。网页加载时会发出实体感的滴滴声,加载进度越高,声音越急促,页面加载完成会有一声短促的嘟声提示,方便咱们用听觉判断加载状态。使用方法:打开 Via 浏览器,点击菜单,选择设置,点击脚本,点击添加脚本,弹出菜单后选择添加脚本,把里面默认的代码全部删除,粘贴脚本代码,点击保存,返回主界面即可生效。我待会会把代码发到评论区,需要的朋友直接复制使用。

共 14 条评论
云朵小眠眠 [楼主] 10小时前
0 

// ==UserScript==

// @name Via浏览器 加载进度实体蜂鸣提示

// @namespace via.load.beep

// @version 1.0

// @description 网页加载进度实体蜂鸣音,方波滴声随进度变急促,完成锯齿波嘟声

// @match *://*/*

// @grant none

// @run-at document-start

// ==/UserScript==

(function() {

'use strict';

let audioCtx;

let beepTimer;

let progress = 0;

let loading = true;

// 初始化音频

function initAudio() {

if (!audioCtx) {

audioCtx = new (window.AudioContext || window.webkitAudioContext)();

}

}

// 实体滴声(方波,短促扎实)

function playBeep() {

initAudio();

const t = audioCtx.currentTime;

const osc = audioCtx.createOscillator();

const gain = audioCtx.createGain();

osc.type = 'square';

osc.frequency.value = 900;

gain.gain.setValueAtTime(0, t);

gain.gain.linearRampToValueAtTime(0.3, t + 0.01);

gain.gain.linearRampToValueAtTime(0, t + 0.1);

osc.connect(gain);

gain.connect(audioCtx.destination);

osc.start(t);

osc.stop(t + 0.12);

}

// 实体嘟声(锯齿波,硬朗短促长音)

function playDone() {

initAudio();

const t = audioCtx.currentTime;

const osc = audioCtx.createOscillator();

const gain = audioCtx.createGain();

osc.type = 'sawtooth';

osc.frequency.value = 1000;

gain.gain.setValueAtTime(0, t);

gain.gain.linearRampToValueAtTime(0.3, t + 0.02);

gain.gain.linearRampToValueAtTime(0, t + 0.5);

osc.connect(gain);

gain.connect(audioCtx.destination);

osc.start(t);

osc.stop(t + 0.55);

}

// 进度蜂鸣循环

function startBeepLoop() {

if (!loading) return;

progress += Math.random() * 6;

if (progress > 100) progress = 100;

playBeep();

// 进度越高,滴得越急促

let delay = 800 - progress * 7;

if (delay < 120) delay = 120;

beepTimer = setTimeout(startBeepLoop, delay);

}

// 开始加载

function startLoad() {

loading = true;

progress = 0;

clearTimeout(beepTimer);

startBeepLoop();

}

// 加载完成

function finishLoad() {

loading = false;

clearTimeout(beepTimer);

setTimeout(playDone, 100);

}

window.addEventListener('beforeunload', startLoad);

window.addEventListener('load', finishLoad);

})();

云朵小眠眠 [楼主] 10小时前
0 

直接复制人在这个浏览器上面点击菜单,点击设置,点击脚本点击添加脚本,上面会有三个选项,一个是添加脚本,一个是下载脚本,一个是导入脚本,点击添加脚本后把里面的鱼。原来的代码删除掉,把这个脚本的代码粘贴进去就好了

云朵小眠眠 [楼主] 10小时前
0 

可以在评论区讨论脚本心得

夜舞倾城 10小时前
0 

服了,这个百宝箱不能复制评论,还得回读屏这边弄

夜舞倾城 10小时前
0 

发一个效果展示吧,不知道这两次加载的区别在哪

云朵小眠眠 [楼主] 10小时前
0 

感觉这脚本好不好用啊?

夜舞倾城 9小时前
0 
就是有点吵
0 

用不上,但是感谢分享

云朵小眠眠 [楼主] 9小时前
0 

Via浏览器加载进度实体蜂鸣提示1.1优化版,优化了蜂鸣提示音,声音更接近真实实体蜂鸣器。本脚本免费分享,需使用统一通用数字兑换码兑换脚本代码,仅发送纯代码,不发文件。需要的朋友请发邮件至19161785384@189.cn领取兑换码。

云朵小眠眠 [楼主] 9小时前
0 

谢谢反馈啊

你们做一个那种苹果的吗,就是苹果的那个浏览器,然后在开旁白的情况下,不是会有一种加载的提示音吗?弄那种,正在加载和加载完成
各位用这个看看
// ==UserScript== // @name Via浏览器 加载滴滴提示 // @namespace via.load.drip // @version 3.0 // @description 网页加载过程短促滴滴声,进度越快滴声越密,加载完成响一声不同音调的提示滴 // @match *://*/* // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; let audioCtx; let beepTimer; let realProgress = 0; let isLoading = false; // 初始化音频上下文(修复Via浏览器移动端自动播放限制) function initAudio() { if (!audioCtx) { audioCtx = new (window.AudioContext || window.webkitAudioContext)(); } // 自动恢复被暂停的音频上下文,确保无需手动点击就能播放 if (audioCtx.state === 'suspended') { audioCtx.resume(); } } // 【加载中】短促滴滴声(850Hz 高频短滴,清脆不刺耳) function playLoadingDrip() { initAudio(); const now = audioCtx.currentTime; const osc = audioCtx.createOscillator(); const gainNode = audioCtx.createGain(); osc.type = 'square'; osc.frequency.value = 850; // 音量淡入淡出,杜绝破音 gainNode.gain.setValueAtTime(0, now); gainNode.gain.linearRampToValueAtTime(0.25, now + 0.008); gainNode.gain.linearRampToValueAtTime(0, now + 0.06); osc.connect(gainNode); gainNode.connect(audioCtx.destination); osc.start(now); osc.stop(now + 0.07); } // 【加载完成】单独一声提示滴(1200Hz 更高亮音调,和加载中滴声明显区分) function playFinishDrip() { initAudio(); const now = audioCtx.currentTime; const osc = audioCtx.createOscillator(); const gainNode = audioCtx.createGain(); osc.type = 'square'; osc.frequency.value = 1200; // 时长比加载滴稍长,辨识度拉满 gainNode.gain.setValueAtTime(0, now); gainNode.gain.linearRampToValueAtTime(0.3, now + 0.01); gainNode.gain.linearRampToValueAtTime(0, now + 0.15); osc.connect(gainNode); gainNode.connect(audioCtx.destination); osc.start(now); osc.stop(now + 0.16); } // 计算页面真实加载进度(不用随机假进度,和实际加载状态同步) function calcRealProgress() { if (document.readyState === 'complete') return 100; if (document.readyState === 'interactive') return 75; if (document.readyState === 'loading') return 30; return 0; } // 加载滴滴循环 function startDripLoop() { if (!isLoading) return; clearTimeout(beepTimer); // 同步真实加载进度 realProgress = calcRealProgress(); playLoadingDrip(); // 核心逻辑:加载进度越高,滴滴间隔越短,最低120ms避免过于密集刺耳 let interval = 800 - realProgress * 7.5; interval = Math.max(interval, 120); beepTimer = setTimeout(startDripLoop, interval); } // 开始加载触发 function onLoadStart() { isLoading = true; realProgress = 0; clearTimeout(beepTimer); startDripLoop(); } // 加载完成触发 function onLoadFinish() { isLoading = false; clearTimeout(beepTimer); // 延迟100ms播放,避免和最后一声加载滴重叠 setTimeout(playFinishDrip, 100); } // 绑定页面生命周期事件 window.addEventListener('beforeunload', onLoadStart); window.addEventListener('load', onLoadFinish); // 首次打开页面、刷新页面直接生效 if (document.readyState !== 'complete') { onLoadStart(); } })();
晶晶 8小时前
0 

我用了。所以上来感谢楼主。

添加一条新评论

登录后可以发表评论 去登录

作者

积分:120

这家伙很懒,什么都没有留下
作者其它话题
游戏分享
新人报道