BULSATCOM IPTV

Bulsatcom IPTV extended.

La data de 15-05-2015. Vezi ultima versiune.

// ==UserScript==
// @name        BULSATCOM IPTV
// @namespace   bulsat
// @include     *test.iptv.bulsat.com/iptv.php*
// @version     0.11.2
// @grant       none
// @description Bulsatcom IPTV extended.
// ==/UserScript==

//================================================================================================================
	
var user; var pass; var width; var height; var rmvprg = {}; var catNm = {}; var catPr = {}; var maxwidth = 720;

//================================================================================================================

	user 	 = '';					// e-mail
	pass 	 = '';					// парола
     
	defprg 	 = 'bTV HD';			// програма тръгваща по подразбиране
				 
	rmvprg 	 = [					// списък с каналите за изтриване

			   ];
	
	catNm[0] = 'ОБЩИ';
	catPr[0] = [
				'БНТ 1 HD',
				'bTV HD',
				'Nova TV',
				'TV7',
				'Diema',
				'KinoNova',
				'bTV Cinema',
				'bTV Action',
				'bTV Comedy',
				'Kanal 3',
				'TV+ HD',
				'F+',
				'F+ HD',
				'БНТ HD',
				'БНТ 2',
				'BNT world',
				'News 7 HD',
				'ТВ Европа',
				'Bulgaria ON Air',
				'Bulgaria 24',
				'Evrokom',
				'Черно Море',
				'TV 1 HD',
				'Skat',
				'Alfa',
				'bTV Lady',
				'Diema Family',
			   ];
			   
	catNm[1] = 'Спортни';
	catPr[1] = [
				'Ring BG',
				'Nova Sport',
				'Nova Sport HD',
				'Sportal HD',
				'AMS HD',
			   ];
				 			 
	catNm[2] = 'Научно популярни';
	catPr[2] = [
				'Hobby TV',
				'Hobby TV HD',
				'Hobby lov HD',
				'Destination BG HD',
				'Българска история HD',
				'History Channel HD',
				'Travel Channel',
				'Travel TV HD',
				'От близо HD',
				'Хайде в кухнята HD',
				'Fine Living',
				'Fiesta TV',
				'Viasat History',
				'Viasat Explorer',
				'Viasat Nature',
				'Outdor HD',
				'Охота и рыбалка',
			   ];
				 			 
	catNm[3] = 'Филмови';
	catPr[3] = [
				'AXN',
				'Cinema + HD',
				'Action + HD',
				'Comedy + HD',
				'TV1000',
				'CBS Drama',
				'CBS Reality',
			   ];
				 			 
	catNm[4] = 'Музикални';
	catPr[4] = [
				'Planeta HD',
				'Planeta',
				'Fan TV HD',
				'Balkanica HD',
				'BOX TV HD',
				'The Voice',
				'City TV',
				'BG Top Music',
				'BG Music Channel HD',
				'Iconcert HD',
				'MTV Hits',
				'MTV Rock',
				'VH1',
				'VH1 Classic',
				'Tiankov Music HD',
				'DSTV',
				'Planeta Folk',
				'Fen Folk TV',
				'Folklor TV HD',
				'Tiankov TV HD',
			   ];
				 			 
	catNm[5] = 'Детски';
	catPr[5] = [
				'Super 7',
				'Ekids',
				'CN',
				'Disney channel',
				'Disney Junior',
				'Nick Jr.',
				'Boomerang',
				'nickelodeon',
				'KiKa HD',
			   ];
				 			 
	catNm[6] = 'Чуждестранни';
	catPr[6] = [
				'Fashion TV',
				'CNN',
				'Russia Tuday',
				'PTP Планета',
				'Дом кино',
				'RTL HD',
				'RTL 2 HD',
				'Super RTL HD',
				'RTL Nitro HD',
				'VOX HD',
				'Pro 7 HD',
				'ZDF HD',
				'ARD HD',
				'SAT1',
				'3SAT HD',
				'ARTE HD',
				'France 24',
				'TV5',
			   ];
				 			 
	catNm[7] = 'Радиа';
	catPr[7] = [
				'Дарик радио',
				'Radio Focus',
				'Radio Nova',
				'Hristo Botev BNR',
				'horizont',
				'BG radio',
				'veronika',
				'vitosha',
				'njoy',
				'rthevoice',
				'Radio City',
				'nrj',
				'Radio 1',
				'zrock',
				'tangramegarock',
				'radio1rock',
				'jazzfm',
			   ];
					  
//================================================================================================================

$(document).ready(function() {
	
	// Визуални промени			
	$("#globalheader").remove();
	$("#copyright").remove();
	$("#iptvmenu").remove();
	$("#iptvft").remove();
	$("h3").remove();
		
	$("html").css("cssText", "background:#191C1F;");
	$("body").css("cssText", "background:#191C1F;overflow:hidden;");
	$("#iptvpc").css("cssText", "background:#191C1F;padding-top:0px;");
	$("#wrapper").css("cssText", "margin-top:2000px");
	
    var mySort = setInterval( function() {
		
		$("#login-container").css("cssText", "margin-top:-1800px");
	
		$("#cfg").remove();
		$("#grp").remove();
		$(".clear").remove();
	
		if($("#btv").length) {
			
			// Визуални промени			
			$("#jw_wrapper").css("cssText", "width:100%;height:100%;");
			$("#list").css("cssText", "width:279px;height:100%;overflow:hidden;");
			
			width = get_width() - 280; height = width / (16/9);
			$("#main").css("cssText", "width:" + (width + 280) + "px;height:" + height  + "px;padding:0;");
			$("#wrapper").css("cssText", "width:" + (width + 280) + "px;height:" + height + "px;margin:0;");
			$("#pl").css("cssText", "width:" + width + "px;height:" + height + "px;");		
			$("#list").css("cssText", "width:279px;height:" + (height - 41) + "px;overflow:hidden;");
			jwplayer().resize(width,height);
			
			// Всички програми
			var programs = {};
			$("#list a").each(function() {
				var id = $(this).attr('href').match(/\d+/g);
				var name = $(this).find('h2').text(); 
				$(this).attr('rel', (parseInt(id) + 1000));
				$(this).addClass('cat0');
				programs[name] = $(this).attr('id');
			});
			
			// Групиране на програмите
			for (i = 10; i >= 0; i--) {
				if(catPr[i]) {
					$.each(catPr[i], function(index, value) { 
						$('#' + programs[value]).removeClass('cat0').addClass('cat'+i);
						$('#' + programs[value]).attr('rel', ((i * 100) + index));
					});
				}
			}
			
			// Изтриване на програмите
			$.each(rmvprg, function(index, value) { 
				$('#' + programs[value]).remove();
			});
			
			// Сортиране на програмите
			$('#list a').sort(function(a, b){
				var e1 = parseInt($(a).attr('rel'))
				var e2 = parseInt($(b).attr('rel'))
				return e1 > e2 ? 1 : e1 < e2 ? -1 : 0;
			}).appendTo('#list')
			
		}	
		
		// Автоматично логване
		if($('#user').length && $('#pw').length) {
			if(user.length && pass.length) {
				$('#user').val(user);
				$('#pw').val(pass);
				$("#auth").trigger('click');
			}
		}
		
		// Спиране на скрипта, задаване на начална програма, добавяне на категориите
		if($("#btv").length) { 
			clearInterval(mySort);
			
			if(programs[defprg]) {
				$("#" + programs[defprg]).get(0).click();
			}
			
			$('<style type="text/css">#epg ul{width:auto;float:left;margin-left:50px;}</style>').appendTo(document.head);
			$('<style type="text/css">.cat{float:left;display:block;width:34px;height:40px;border-left:1px solid #111012;}</style>').appendTo(document.head);
			$('<style type="text/css">.c0{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat0.png") 0 0 no-repeat;} .c0:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat0.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c1{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat1.png") 0 0 no-repeat;} .c1:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat1.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c2{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat2.png") 0 0 no-repeat;} .c2:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat2.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c3{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat3.png") 0 0 no-repeat;} .c3:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat3.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c4{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat4.png") 0 0 no-repeat;} .c4:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat4.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c5{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat5.png") 0 0 no-repeat;} .c5:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat5.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c6{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat6.png") 0 0 no-repeat;} .c6:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat6.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$('<style type="text/css">.c7{background: #191C1F url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat7.png") 0 0 no-repeat;} .c7:hover{background: #24292D url("https://dl.dropboxusercontent.com/u/9691030/IPTV/files/cat7.png") 0 -40px no-repeat;} .cat-active{background-color:#24292D;background-position: 0 -40px;}</style>').appendTo(document.head);
			$("#pl").after('<div id="cat" style="width:280px; height:40px; float:left; background:#191C1F; border-bottom:1px solid #111012;"></div>');
			$("#cat").append('<a id="cat0" class="cat c0 cat-active" href="javascript:showCat(0)" title="'+catNm[0]+'"></a>')
			$("#cat").append('<a id="cat1" class="cat c1" href="javascript:showCat(1)" title="'+catNm[1]+'"></a>');
			$("#cat").append('<a id="cat2" class="cat c2" href="javascript:showCat(2)" title="'+catNm[2]+'"></a>');
			$("#cat").append('<a id="cat3" class="cat c3" href="javascript:showCat(3)" title="'+catNm[3]+'"></a>');
			$("#cat").append('<a id="cat4" class="cat c4" href="javascript:showCat(4)" title="'+catNm[4]+'"></a>');
			$("#cat").append('<a id="cat5" class="cat c5" href="javascript:showCat(5)" title="'+catNm[5]+'"></a>');
			$("#cat").append('<a id="cat6" class="cat c6" href="javascript:showCat(6)" title="'+catNm[6]+'"></a>');
			$("#cat").append('<a id="cat7" class="cat c7" href="javascript:showCat(7)" title="'+catNm[7]+'"></a>');

			$("#list a").each(function() { $(this).hide(); });
			$("#list a.cat0").each(function() { $(this).show(); });
						
			if(get_width() < maxwidth) { 
				width = get_width(); height = width / (16/9);
				$("#pl").css("cssText", "width:" + width + "px;height:" + height + "px;");
				$("#main").css("cssText", "width:" + width + "px;height:" + height + "px;padding:0;");
				$("#wrapper").css("cssText", "width:" + width + "px;height:" + height + "px;margin:0;");
				$("#list").css("cssText", "width:279px;height:" + (height - 73) + "px;overflow:hidden;position:absolute;top:41px;").hide(); 
				$("#cat").css("cssText", "width:280px; height:40px; float:left; background:#191C1F; border-bottom:1px solid #111012;position:absolute;").hide(); 
				$("#epg").css("cssText", "width:" + width + "px;margin-top:-80px;").hide(); 
				$("#pl, #list, #cat, #ascrail2000").mouseenter(function(){$("#list, #cat").show();}).mouseleave(function(){$("#list, #cat").hide();});
			    $("#list").mouseenter(function(){$("#epg").hide();}).mouseleave(function(){$("#epg").hide();});
				jwplayer().resize(width,height);
			}
			else {
				$("#epg").css("cssText", "width:" + width + "px;margin-top:-80px;").hide(); 
				$("#list, #epg").mouseenter(function(){$("#epg").show();}).mouseleave(function(){$("#epg").hide();});
			}

		}

    }, 200);

	$(window).resize(function() {
		if(get_width() >= maxwidth) { 
			width = get_width() - 280; height = width / (16/9);
			$("#pl").css("cssText", "width:" + width + "px;height:" + height + "px;");
			$("#main").css("cssText", "width:" + (width + 280) + "px;height:" + height  + "px;padding:0;");
			$("#wrapper").css("cssText", "width:" + (width + 280) + "px;height:" + height + "px;margin:0;");
			$("#list").show().css("cssText", "width:279px;height:" + (height - 41) + "px;overflow:hidden;"); 
			$("#cat").css("cssText", "width:280px; height:40px; float:left; background:#191C1F; border-bottom:1px solid #111012;").show(); 
			$("#epg").css("cssText", "width:" + width + "px;margin-top:-80px;").hide(); 
			$("#pl, #list, #cat, #ascrail2000").mouseenter(function(){$("#list, #cat").show();}).mouseleave(function(){$("#list, #cat").show();});
			$("#list, #epg").mouseenter(function(){$("#epg").show();}).mouseleave(function(){$("#epg").hide();});
		} 
		else { 
			width = get_width(); height = width / (16/9);
			$("#pl").css("cssText", "width:" + width + "px;height:" + height + "px;");
			$("#main").css("cssText", "width:" + width + "px;height:" + height + "px;padding:0;");
			$("#wrapper").css("cssText", "width:" + width + "px;height:" + height + "px;margin:0;");
			$("#list").css("cssText", "width:279px;height:" + (height - 73) + "px;overflow:hidden;position:absolute;top:41px;").hide(); 
			$("#cat").css("cssText", "width:280px; height:40px; float:left; background:#191C1F; border-bottom:1px solid #111012;position:absolute;").hide(); 
			$("#epg").css("cssText", "width:" + width + "px;margin-top:-80px;").hide(); 
			$("#pl, #list, #cat, #ascrail2000").mouseenter(function(){$("#list, #cat").show();}).mouseleave(function(){$("#list, #cat").hide();});
			$("#list, #epg").mouseenter(function(){$("#epg").hide();}).mouseleave(function(){$("#epg").hide();});
		}
		jwplayer().resize(width,height);
	});
	
	function get_width() {
        var correction = ($(window).width() >= maxwidth ? 280 : 0);
		var h = (($(window).width() - correction) / (16/9))
		if($(window).height() < h) {
			return (($(window).height() * (16/9)) + correction);
		}
		else {
			return $(window).width();
		}
	}
	
});

function showCat(id) {
	$("#cat a").removeClass('cat-active');
	$("#cat #cat"+id).addClass('cat-active');
	$("#list a").each(function() { $(this).hide(); });
	$("#list a.cat"+id).each(function() { $(this).show(); });
	$("#list").getNiceScroll().resize();
}

// Script Insert
var script = document.createElement('script');
script.textContent = showCat;
document.body.appendChild(script);