🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Simple Faster Flash

Faster flash from simple way.

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         Simple Faster Flash
// @name:zh-CN   Flash 简单优化
// @namespace    https://greasyfork.org/users/159546
// @version      1.0.1
// @description  Faster flash from simple way.
// @description:zh-CN 略微提升 Flash 元素的性能。
// @author       LEORChn
// @include      *
// @run-at       document-start
// @grant        none
// ==/UserScript==
var done=0,countdown=10 *5;// 10 sec
(function(){
	recheck();
})();
function recheck(){
    __object();
    __embed();
    if(pageloaded() && finaly())return;
    setTimeout(recheck,200);
}
function __object(){
    try{
    for(var i=0,v=document.getElementsByTagName('object'),len=v.length;i<len;i++)
        if(v[i].type.toLowerCase().includes('flash')){
            var qNode;
            for(var i2=0,v2=v[i].childNodes,l2=v2.length;i2<l2;i2++)
                if(v2[i2].name && v2[i2].name.includes('quality')){//maybe multi object elements nesting. Like news.163.com
                    qNode=v2[i2];
                    break;
                }
            if(qNode==undefined){
                qNode=document.createElement('param');
                qNode.name='quality';
                v[i].appendChild(qNode);
            }
            if(qNode.value!='low'){
                qNode.value='low';
                done++;
            }
        }
    }catch(e){}
}
function __embed(){
    for(var i=0,v=document.getElementsByTagName('embed'),len=v.length;i<len;i++)
        if(v[i].type.toLowerCase().includes('flash') && !v[i].outerHTML.includes('quality="low"')){
            v[i].outerHTML=v[i].outerHTML.replace('<embed','<embed quality="low"');
            done++;
        }
}
function pageloaded(){ return document.readyState.toLowerCase()=='complete'; }
function finaly(){
    countdown--;//Use count down because some flash element using js to add in page. Like live.bilibili.com...
    if(countdown>0)return false;
    try{console.log('Simple Faster Flash: Faster '+done+' flash element(s).');}catch(e){}
    return true;
}