function CSSLoad(file){ var link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("type", "text/css"); link.setAttribute("href", file); document.getElementsByTagName("head")[0].appendChild(link) } function SendCount(id_seriya){ var xhttp; if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("POST", "http://legalplay.ru/count.php", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("id_seriya="+id_seriya); } function LoadPlayer1(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } function LoadPlayer2(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } function LoadPlayer3(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } function LoadPlayer4(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } function LoadPlayer5(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } function LoadPlayer6(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } function LoadPlayer7(id, id_seriya){ document.getElementById('videoplayer').innerHTML = ''; SendCount(id_seriya); document.getElementById("lgPlayBtn").style.display = 'none'; } CSSLoad('http://legalplay.ru/css/addStyles.css?v=1'); var PlayerHTML = '
'; document.write(PlayerHTML); var count = 10; var svplaylist = document.getElementById('svplaylist'); var list = svplaylist.querySelector('ul'); var listElems = svplaylist.querySelectorAll('li'); var listWidth = 850; var position = 0; if(listElems.length < 11){ svplaylist.querySelectorAll('.svplaylist-arrow').forEach(function(dd) { dd.style.display = 'none'; }); } svplaylist.querySelector('.svplaylist-prev').onclick = function () { position = Math.min(position + listWidth * count, 0) list.style.marginLeft = (position/count) + 'px'; }; svplaylist.querySelector('.svplaylist-next').onclick = function () { if (listElems.length > count) { position = Math.max(position - listWidth * count, -listWidth * (listElems.length - count)); list.style.marginLeft = (position/count) + 'px'; }; };