Direct Wmode

An userscript to make flash object display in "direct" mode.

目前为 2015-04-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Direct Wmode
  3. // @description An userscript to make flash object display in "direct" mode.
  4. // @namespace eight04.blogspot.com
  5. // @version 0.1.0
  6. // @grant none
  7. // ==/UserScript==
  8.  
  9. new MutationObserver(cleanContainer).observe(document.body, {
  10. childList: true,
  11. subtree: true
  12. });
  13.  
  14. function cleanContainer(){
  15. var nodes = document.querySelectorAll("object>param[name='wmode']");
  16. var i;
  17. var swap = [];
  18. var len;
  19. for (i = 0, len = nodes.length; i < len; i++) {
  20. swap[i] = nodes[i];
  21. }
  22. for (i = 0; i < len; i++) {
  23. swap[i].setAttribute("value", "direct");
  24. }
  25. }
  26.  
  27. function clean(object) {
  28. var clone = object.cloneNode(true);
  29. var param = clone.querySelector("[name=wmode]");
  30. if (!param) {
  31. return;
  32. }
  33. if (param.getAttribute("value") == "direct") {
  34. return;
  35. }
  36. param.setAttribute("value", "direct");
  37. object.parentNode.replaceChild(clone, object);
  38. }