[Chrome插件] 视频屏蔽专家绿色版

亲测可以正常安装与屏蔽 YK!

目录结构:

e:
- blocker
    - blocker.js
    - manifest.json

blocker.js

document.getElementByClass = function(n) {
	var el = [], _el = document.getElementsByTagName('*');
	for (var i = 0; i < _el.length; i++) {
		if (_el[i].className == n) {
			el[el.length] = _el[i]
		}
	};
	return el;
};

var removeEl = function(el) {
	if (el && el.innerHTML && el.parentNode) {
		el.innerHTML = '';
		el.parentNode.removeChild(el);
	}
};

if (window.location.hostname == 'v.youku.com') {
	var url = window.location.href;
	var id = url.substring(url.indexOf('id_') + 3, url.indexOf('.html'));
	var _hfds = ["<object width='100%' height='91%' type='application/x-shockwave-flash' data='http://adblockv.cdn.duapp.com/pkgs/loader.swf' id='movie_player'>",
				 "<param name='allowFullScreen' value='true'>",
				 "<param name='allowscriptaccess' value='always'>",
				 "<param name='flashvars' value='VideoIDS=",  
                 id,  
                "&amp;ShowId=0&amp;category=96&amp;Cp=0&amp;Light=on&amp;THX=off&amp;unCookie=0&amp;frame=0&amp;pvid=1368343846095HVe&amp;Tid=0&amp;",
				"isAutoPlay=true&amp;Version=/v1.0.0856&amp;show_ce=0&amp;winType=interior&amp;Type=Folder&amp;Fid=19050231&amp;Pt=2&amp;Ob=1&amp;plchid=c&amp;",
				"vext=bc%3D%26pid%3D%26unCookie%3D0%26frame%3D0%26type%3D1%26fob%3D1%26fpo%3D2%26svt%3D0%26emb%3DAjEzNjE3MjYxMgJ2LnlvdWt1LmNvbQIvdl9zaG93L2lkX1hOVFUxTWprM09EYzIuaHRtbA%3D%3D%26dn%3D%E7%BD%91%E9%A1%B5%26hwc%3D1%26mtype%3Doth'>",
				"</object>"].join('');
	document.getElementByClass("abs").innerHTML = "";
	document.getElementById("player").innerHTML = _hfds;
	var listArea = document.getElementByClass("listArea")[0].innerHTML;
	
	document.body.innerHTML = _hfds + '<div style="width: 100%;">' + listArea + '</div>';
	
	removeEl(document.getElementById('vLoading'));
	removeEl(document.getElementById('listRelated'));
	removeEl(document.getElementById('tabs'));
	removeEl(document.getElementByClass("head")[0]);
	
	setInterval(function() {
		var lis = document.getElementsByTagName('li');
	
		for (var i = 0; i < lis.length; i++){
			var li = lis[i];
			li.style.cssText = 'width: 50px; float: left';
		}
	}, 100);
	
};

 

 


manifest.json
 
{
   "content_scripts": [ {
      "js": [ "blocker.js" ],
      "matches": [ "http://*/*" ]
   } ],
   "description": "bisoft",
   "manifest_version": 2,
   "name": "blocker",
   "permissions": [ "contextMenus", "tabs", "http://code.google.com/*" ],
   "version": "1.0"
}
 



附件是安装包,解压到E:, Chrome浏览器|工具|扩展程序|开发者模式打勾,载入正在开发的扩展程序-> e:\blocker

注意:下载的安装包路径不能有中文, 否则安装不成功!




你可能感兴趣的:(JavaScript)