Flash Accelerate

开启FlashPlayer硬件渲染加速

目前為 2015-02-18 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Flash Accelerate
// @namespace   [email protected]
// @description 开启FlashPlayer硬件渲染加速
// @include     *
// @exclude     http://www.imdb.com/whattowatch/
// @version     1.07
// @grant       none
// ==/UserScript==
//创意来自 gpu-accelerated-flash-player 扩展!
//是否有加速效果作者也不知道。
//关于wmode参数的解释:http://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html
//
//
var run_time_max = 3;//最大运行次数
var wmode_value = 'gpu'; //默认 gpu,可以是 direct。一般不需要更改


var toggle = function (o) {
    if (o) {
      o.setAttribute("fa-sign",1);
      var display = o.style.display;
      o.style.display = 'none';
      setTimeout(function () {
        o.style.display = display;
        //console.log(o);
      }, 0);
    }
};
var run_time = 1;
var interval = setInterval(function () {
  //console.log("run_time",run_time,location);
  if(run_time == run_time_max){
      clearInterval(interval);
  }
  run_time = run_time + 1;
  var embeds = document.getElementsByTagName('embed');
  if (embeds.length > 0) {
    for (var i = 0; i < embeds.length; i++){
      if(embeds[i].getAttribute("fa-sign")){
        continue;
      }
      else{
        embeds[i].setAttribute('wmode', wmode_value);
        toggle(embeds[i]);
      }
    }
  }
  var wmodes = (function(){var a=document.getElementsByName("wmode"),b=document.getElementsByName("wMode"),c=[],x=0,y=0;for(;x<a.length;x++){c.push(a[x])}for(;y<b.length;y++){c.push(b[y])}return c;})();
  if (wmodes.length > 0) {
    for (var j = 0; j < wmodes.length; j++) {
      var obj = wmodes[j].parentNode;
      if(obj.getAttribute("fa-sign")){
        continue;
      }
      else{
        wmodes[j].value = wmode_value;
        toggle(obj);
      }
    }
  }
}, 1500);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址