zapEmbedsRefer

replace all embeds for href option display

  1. // ==UserScript==
  2. // @name zapEmbedsRefer
  3. // @description replace all embeds for href option display
  4. // @include *
  5. // @include https://*
  6. // @include http://*
  7. // @run-at document-end
  8. // @namespace https://gf.qytechs.cn/en/users/3561-lucianolll
  9. // @namespace https://openuserjs.org/users/lucianolll
  10. // @namespace http://userscripts-mirror.org/users/46776
  11. // @version 16
  12. // @grant none
  13. // ==/UserScript==
  14. var codemp={
  15. zapEmbedsref:function(){
  16. var doc=document,gemb=doc.getElementsByTagName('embed'),len=gemb.length;
  17. if(len!==0){
  18. var geb=function(gt){var g,gds=function(d){g=gt[d];return [g,g.parentNode];};return function(d){return gds(d);};}(gemb),
  19. embid=function(at){var t,ts=function(d){t=at[d];return [t.name,t.value];};return function(d){return ts(d);};};
  20. for(var m=len,j=0,tmp=[];m--;j++){tmp[j]=geb(j);}
  21. for(var i=len,embaj=[],att,embi,emba;i--;){
  22. att=tmp[i][0].attributes;embi=embid(att);
  23. for(j=att.length,emba=embaj[i]=[];j--;){emba[j]=embi(j);}
  24. }geb=null;embi=null;emba=null;
  25. var gem=[];embaj.forEach(
  26. function(){
  27. var ads,repl=function(){var doc=document,ds=function(ad){ad.setAttribute('href','javascript:;');ad.setAttribute('onclick','replAdsC(this)');ad.style.position='relative';ad.textContent='em';return ad;};
  28. return function(){return ds(doc.createElement('a'));};}();
  29. return function(v,i){ads=repl();v.forEach(function(d){ads.setAttribute(d[0],d[1]);});gem[i]=ads;};
  30. }());embaj=null;
  31. tmp.forEach(function(v,i){v[1].replaceChild(gem[i],v[0]);});tmp=null;gem=null;
  32. }
  33. },
  34. zapobjt:function(){
  35. var doc=document,objt=doc.getElementsByTagName('object'),len=objt.length;
  36. if(len!==0){
  37. var embid=function(at){var t,ts=function(d){t=at[d];return [t.name,t.value];};return function(d){return ts(d);};};
  38. for(var j=len,n=0,p=0,q=0,obs,vrf,prm,frgm,objm=[],ptemp=[],qtemp=[],att,embi,embaj=[];j--;n++){
  39. obs=objt[n];vrf=obs.getElementsByTagName('a')===true;
  40. if(vrf){qtemp[q++]=obs;}
  41. if(!vrf){
  42. ptemp[p]=[obs,obs.parentNode];prm=obs.getElementsByTagName('param');frgm=doc.createDocumentFragment();
  43. for(var s=prm.length;s--;){frgm.appendChild(prm[s]);}
  44. objm[p]=frgm;p++;att=obs.attributes;embi=embid(att);frgm=null;
  45. for(var m=att.length,u=0,emba=embaj[n]=[];m--;u++){emba[u]=embi(u);}
  46. }
  47. }
  48. if(!vrf){
  49. var gem=[];embaj.forEach(
  50. function(){
  51. var doc=document,ads,spn,repl=function(){var doc=document,ds=function(ad){ad.setAttribute('href','javascript:;');ad.setAttribute('onclick','replObjM(this)');ad.style.position='relative';ad.textContent='emi';return ad;};
  52. return function(){return ds(doc.createElement('a'));};}();
  53. return function(v,i){
  54. ads=repl();spn=doc.createElement('span');
  55. v.forEach(function(d){ads.setAttribute(d[0],d[1]);});spn.appendChild(objm[i]);ads.appendChild(spn);gem[i]=ads;
  56. };}());embaj=null;objm=null;ads=null;
  57. ptemp.forEach(function(v,i){v[1].replaceChild(gem[i],v[0]);});ptemp=null;gem=null;
  58. }
  59. if(vrf){
  60. for(var i=qtemp.length,obst,prmo;i--;){
  61. obst=qtemp[i];obs.data='';prmo=obst.getElementsByTagName('param');
  62. for(var a=obs.attributes.length;a--;){obst.removeAttribute(obst.attributes[a].name);}
  63. for(var t=prmo.length,pa,tmp=[];t--;){pa=prmo[t];tmp[t]=[pa,pa.parentNode];}
  64. tmp.forEach(function(v){v[1].removeChild(v[0]);});tmp=null;
  65. }
  66. }
  67. }
  68. },
  69. replAdsC:function replAdsC(obj){
  70. var attr=obj.attributes,ademb=document.createElement('embed');
  71. for(var i=attr.length,as,adm=[];i--;){as=attr[i];adm[i]=[as.name,as.value];}attr=null;
  72. adm.forEach(function(v){ademb.setAttribute(v[0],v[1]);});adm=null;ademb.removeAttribute('href');ademb.removeAttribute('onclick');
  73. obj.parentNode.replaceChild(ademb,obj);
  74. },
  75. replObjM:function replObjM(obj){
  76. var doc=document,attr=obj.attributes,ln=attr.length,prm=obj.getElementsByTagName('param'),ademb=doc.createElement('object'),frgm=doc.createDocumentFragment();
  77. for(var i=ln,as,adm=[];i--;){as=attr[i];adm[i]=[as.name,as.value];}attr=null;
  78. adm.forEach(function(v){ademb.setAttribute(v[0],v[1]);});adm=null;ademb.removeAttribute('href');ademb.removeAttribute('onclick');
  79. for(var s=prm.length;s--;){frgm.appendChild(prm[s]);}
  80. ademb.appendChild(frgm);prm=null;frgm=null;
  81. obj.parentNode.replaceChild(ademb,obj);
  82. },
  83. adscr:function(){
  84. var doc=document,adscript=doc.createElement('script');adscript.textContent=[this.replAdsC,this.replObjM].join('');doc.getElementsByTagName('body')[0].appendChild(adscript);
  85. }
  86. };
  87. addEventListener('load',codemp.zapEmbedsref,false);addEventListener('load',codemp.zapobjt,false);addEventListener('load',codemp.adscr(),false);
  88. /*addEventListener('load',codemp.zapEmbedsref(),codemp.zapobjt(),codemp.adscr(),false);*/
  89. /*addEventListener('load',codemp.zapEmbedsref(),false);addEventListener('load',codemp.zapobjt(),false);addEventListener('load',codemp.adscr(),false);*/

QingJ © 2025

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