Chaturbate Clean

removes all add's, sub-selector on the tab's, shows video if you have no access, full screen with chat

Od 25.10.2019.. Pogledajte najnovija verzija.

  1. // ==UserScript==
  2. // @name Chaturbate Clean
  3. // @description removes all add's, sub-selector on the tab's, shows video if you have no access, full screen with chat
  4. // @version 4.0
  5. // @namespace chaturbate_goes_ladroop
  6. // @match https://*.chaturbate.com/*
  7. // @exclude https://blog.chaturbate.com/*
  8. // @exclude https://secure.chaturbate.com/*
  9. // @exclude https://*.chaturbate.com/apps/*
  10. // @exclude https://*.chaturbate.com/tipping/*
  11. // @exclude https://*.chaturbate.com/embed/*
  12. // @exclude https://*.chaturbate.com/accounts/welcome/*
  13. // @exclude https://*.chaturbate.com/accounts/register/*
  14. // @exclude https://*.chaturbate.com/contest/*
  15. // @noframes
  16. // @grant none
  17. // @run-at document-end
  18. // @license MIT
  19. // @copyright 2019, ladroop (https://sleazyfork.org/nl/users/7390-ladroop)
  20. // ==/UserScript==
  21.  
  22.  
  23.  
  24.  
  25. (function() {
  26. 'use strict';
  27.  
  28. //prevents the script from throwing errors to CB's own error logger and maybe some part of the script keeps working if they make changes again
  29. window.onerror=function(){return true;};
  30.  
  31. // to skip agree screen
  32. if (!readCookie("agreeterms")){createCookie("agreeterms","1",30);createCookie("noads","1",30);window.location.reload(true);}
  33. // this cookie removes most add's
  34. if (!readCookie("noads")){createCookie("noads","1",30);window.location.reload(true);}
  35. // initial player size
  36. if (!readCookie("player_width")){createCookie("player_width","640",1);}
  37.  
  38. // locations
  39. var thumbpage=false;
  40. var campage=false;
  41. var theaterpage=false;
  42. var banpage=false;
  43. var broadcastpage=false;
  44. var passwordpage=false;
  45. var colpage=false;
  46. var morepage=false;
  47. var bio=false;
  48. var followtab=false;
  49. var moretab=false;
  50. var bioarea="";//bio area
  51. var varea="";// video area
  52. var elem="";//full screen area
  53. var HLS="";//hls video link
  54. // used in multiple functions
  55. var ad="";
  56. var tags="";
  57. var newelem="";
  58. var n=0;
  59. var i=0;
  60. var p=0;
  61. var br="";
  62. var ofils="";
  63. var fapbr="";
  64. var thisfap="";
  65. var observer = new MutationObserver(makemove); // to be called if thumbnail page is refreshed
  66. var observerConfig = {characterData: true, childList: true, subtree: true }; // changes if pages is refreshed
  67. var observenode="";// node to observe if page is refreshed
  68. var cimg = new Image(); // for jpg players
  69. // for full screen
  70. var isfullscreen=false;
  71. var myfullscreen=false;
  72. var orgplayerw=0;
  73. var orgplayerh=0;
  74. // for greasemonkey
  75. var win = window.wrappedJSObject ? window.wrappedJSObject : window;
  76. // used by drag slider window
  77. var pos1=0, pos2=0, pos3=0, pos4=0, x=0, y=0;
  78. // install the theater mode script too and support me
  79. var thcleanurl="https://openuserjs.org/install/ladroop/cb_theatermode_clean.user.js";
  80. var affkey="?track=default&tour=4uT2&campaign=MojQn";
  81. var affid="MojQn";
  82.  
  83. // first check where we are and set some locations
  84. // thumbnail page , online cam page (bio + cam), offline cam page or /p/ (only bio), you're banned page, broadcast page,
  85. // my collection page, password page , show more or purchage pop-up , followed tab if non of these assume it's theater mode
  86.  
  87. if (document.location.href.split("/")[3]=="b"){
  88. broadcastpage=true;
  89. }
  90. if (document.location.href.split("/")[3]=="roomlogin"){
  91. passwordpage=true;
  92. }
  93. if ((document.location.href.split("/")[5]=="list_popup")||(document.location.href.split("/")[4]=="purchase")){
  94. morepage=true;
  95. }
  96. if (document.getElementById("followed_tab")){
  97. followtab=true;
  98. }
  99. if (document.getElementsByClassName("more_like_this")[0]){
  100. moretab=true;
  101. }
  102. if ((document.location.href.split("/")[3]=="photo_videos")||(document.location.href.split("/")[3]=="my_collection")){
  103. if (document.getElementById("player")){
  104. colpage=true;
  105. }
  106. }
  107. if ((document.getElementsByClassName('c-1 endless_page_template')[0])||(document.getElementsByClassName('tag_row')[0])||(document.getElementsByClassName('list followers')[0])){
  108. thumbpage=true;
  109. }
  110. if (document.getElementsByClassName('bio')[0]){
  111. bioarea=document.getElementsByClassName('bio')[0];
  112. bio=true;
  113. }
  114. if((document.getElementById("player"))&&(!colpage)){
  115. elem = document.getElementById("defchat").getElementsByClassName("section")[0];
  116. campage=true;
  117. }
  118. if (document.getElementsByClassName('block')[0]){
  119. if (!document.getElementsByClassName('block')[0].id){
  120. banpage=true;
  121. }
  122. }
  123. if (!broadcastpage&&!passwordpage&&!colpage&&!thumbpage&&!bio&&!campage&&!banpage&&!morepage){
  124. theaterpage=true;
  125. }
  126.  
  127. // do things on selected pages
  128. if (theaterpage){
  129. update();
  130. return;
  131. }
  132. if (morepage){
  133. moreclean();
  134. return;
  135. }
  136. if (colpage){
  137. std();
  138. return;
  139. }
  140. removeadd();
  141. if (followtab){
  142. makefollowmove();
  143. }
  144. if (moretab){
  145. makemoremove();
  146. }
  147. if (passwordpage){
  148. cleanbar();
  149. return;
  150. }
  151. if (thumbpage){
  152. subsel();
  153. makemove();
  154. return;
  155. }
  156. if (banpage){
  157. cleanbar();
  158. jpgplayer();
  159. return;
  160. }
  161. if (bio){
  162. cleanbar();
  163. cleanbutton();
  164. linkfix();
  165. imgfix();
  166. setTimeout(function(){info();}, 500);
  167. }
  168. if (broadcastpage){
  169. cleanbar();
  170. return;
  171. }
  172. if (campage){
  173. fullscreenbutton();
  174. getvid();
  175. getHls();
  176. }
  177.  
  178. // functions in random order
  179.  
  180. //initialize the moving thumbnails and start/stop page refresh observer
  181. function makemove(){
  182. if (moretab){ //use the same observer for more like this
  183. makemoremove();
  184. return;
  185. }
  186. if (document.getElementsByClassName('c-1 endless_page_template')[0]){
  187. if (observenode!==""){observer.disconnect();}
  188. if (fapbr!==""){setTimeout(moveimgstop,1500);}// so it will stop after a refresh if you leave the page open
  189. observenode=document.getElementsByClassName('c-1 endless_page_template')[0];
  190. tags=document.getElementsByClassName("png");
  191. for (n=0; n<tags.length; n++){
  192. tags[n].addEventListener("mouseenter", moveimg);
  193. tags[n].addEventListener("mouseleave", moveimgstop);
  194. }
  195. observer.observe(observenode, observerConfig);
  196. }
  197. }
  198.  
  199. // thumnails from follow
  200. function makefollowmove(){
  201. document.getElementById("followed_tab").addEventListener("mouseup",followmove);
  202. }
  203.  
  204. function followmove(){
  205. tags= document.getElementById("followed_tab").getElementsByTagName("img");
  206. for (n=0; n<tags.length; n++){
  207. tags[n].addEventListener("mouseenter", moveimg);
  208. tags[n].addEventListener("mouseleave", moveimgstop);
  209. }
  210. }
  211.  
  212. // thmbnails from mor like this
  213. function makemoremove(){
  214. if (observenode!==""){observer.disconnect();}
  215. if (fapbr!==""){setTimeout(moveimgstop,1500);}// so it will stop after a refresh if you leave the page open
  216. observenode=document.getElementsByClassName("more_like_this")[0];
  217. tags=document.getElementsByClassName("more_like_this")[0].getElementsByTagName("img");
  218. for (n=0; n<tags.length; n++){
  219. tags[n].addEventListener("mouseenter", moveimg);
  220. tags[n].addEventListener("mouseleave", moveimgstop);
  221. }
  222. observer.observe(observenode, observerConfig);
  223. }
  224.  
  225.  
  226. //get the name of thumb and set load event
  227. function moveimg(){
  228. fapbr=this.src.split("/")[4].split("?")[0];
  229. thisfap=this;
  230. i=0;
  231. cimg.addEventListener("load",regetimg);
  232. cimg.src = "https://cbjpeg.stream.highwebmedia.com/minifap/"+fapbr+"?"+ new Date().getTime();
  233. }
  234.  
  235. function regetimg(){
  236. i++;
  237. if (i>1000){moveimgstop();}
  238. thisfap.src=cimg.src;
  239. setTimeout(function(){ cimg.src = "https://cbjpeg.stream.highwebmedia.com/minifap/"+fapbr+"?"+ new Date().getTime();}, 150);//~4fps at 100ms load time
  240. }
  241.  
  242. //stop refreshing the thumb
  243. function moveimgstop(){
  244. cimg.removeEventListener("load",regetimg);
  245. }
  246.  
  247.  
  248. // wait till video is initialized and make video controls
  249. function getvid(){
  250. if(document.getElementById("xmovie")||document.getElementById("still_video_object_html5_api")){
  251. if (document.getElementById("xmovie")){
  252. varea=document.getElementById("xmovie");
  253. }else{
  254. varea=document.getElementById("still_video_object_html5_api");
  255. }
  256. controlsbutton();
  257. }else{
  258. n++;
  259. if (n==10){
  260. varea=document.getElementById("player");
  261. controlsbutton();
  262. return;
  263. }
  264. setTimeout(function(){getvid();}, 100);
  265. }
  266. }
  267.  
  268. // update if theatermode
  269. function update(){
  270. setTimeout(function(){
  271. if(document.getElementsByClassName('bio-container')[0]){
  272. if (!document.getElementById("update")){
  273. var newelem=document.createElement('div');
  274. newelem.style.position="absolute";
  275. newelem.style.top="10px";
  276. newelem.style.left="255px";
  277. newelem.style.fontSize="12px";
  278. newelem.style.color="#0b5d81";
  279. newelem.style.fontWeight="bold";
  280. newelem.id="update";
  281. newelem.innerHTML="<b>Please install the chaturbate theater mode script made by ladroop.<br> Click <a href='"+thcleanurl+"'> here </a> to install.</b>";
  282. document.getElementsByTagName("div")[0].appendChild(newelem);
  283. }
  284. }
  285. }, 3000);
  286. }
  287.  
  288. //remove the add's
  289. function removeadd(){
  290. ad = document.getElementsByClassName('ad')[0];
  291. if (ad){
  292. ad.style.zIndex="9999";
  293. ad.style.position="absolute";
  294. ad.innerHTML='<strong>Chaturbate Clean V'+GM_info.script.version+' Made by Ladroop.</strong> <br>';
  295. }
  296. support();
  297. ad = document.getElementsByClassName('featured_blog_posts')[0];
  298. if (ad){
  299. ad.style.display="none";
  300. }
  301. ad = document.getElementsByClassName('featured_text')[0];
  302. if (ad){
  303. ad.style.display="none";
  304. }
  305. }
  306.  
  307. // support me
  308. function support(){
  309. if (!document.getElementById('user_information')){
  310. if (document.location.search.indexOf(affid) != -1){
  311. document.location.href="/accounts/register/";
  312. return;
  313. }
  314. if(!readCookie("tnx")){
  315. document.getElementsByClassName("creat")[0].href="#";
  316. document.getElementsByClassName("creat")[0].addEventListener("click",support2);
  317. if (thumbpage){
  318. ad.innerHTML=ad.innerHTML+"<strong>Please support this script. <a href=# id='support'><font color='red'>Click here to sign up for a new account.</font></a></strong>";
  319. document.getElementById("support").addEventListener("click",support2);
  320. }
  321. }
  322. }
  323. }
  324.  
  325. function support2(){
  326. var cookies=document.cookie.split(";");
  327. for (i = 0; i < cookies.length; i++){
  328. eraseCookie(cookies[i].split("=")[0],"");
  329. }
  330. createCookie("agreeterms","1",30);
  331. createCookie("tnx","1",3);
  332. document.location.href="https://chaturbate.com/in/"+affkey;
  333. }
  334.  
  335. // save vid
  336. function std(){
  337. newelem=document.createElement('a');
  338. newelem.href=win.playerSettings.videoFile;
  339. newelem.target="_blank";
  340. newelem.innerHTML="Right click, save to disk.";
  341. newelem.style.backgroundColor="white";
  342. newelem.style.marginLeft="20px";
  343. document.getElementsByTagName("body")[0].appendChild(newelem);
  344. }
  345.  
  346. // get the HLS link
  347. function getHls(){
  348. tags=document.getElementsByTagName("script");
  349. for (n=1; n<tags.length; n++){
  350. if(!tags[n].src){
  351. if (tags[n].innerHTML.indexOf(".m3u8")!=-1){
  352. HLS="https://"+tags[n].innerHTML.split("src='https://")[1].split(".m3u8")[0]+".m3u8";
  353. break;
  354. }
  355. }
  356. }
  357. }
  358.  
  359. // options on menu bar on a cam page , only show link to main page, broadcast link in a new tab except on broadcast page and login, other links can still be found on the thumb pages
  360. function cleanbar(){
  361. tags=document.getElementById("nav").getElementsByTagName('li');
  362. for (n=1; n<tags.length; n++){
  363. if ((tags[n].getElementsByTagName("a")[0].href.split("/")[3]=="b")&&(document.location.href.split("/")[3]!="b")){
  364. tags[n].getElementsByTagName("a")[0].target="_blank";
  365. }else{
  366. if (tags[n].getElementsByTagName("a")[0].href.indexOf('/login') == -1){
  367. tags[n].style.display="none";
  368. }
  369. }
  370. if (tags[n].getElementsByTagName("a")[0].href.split("/")[3]=='tags'){
  371. if (readCookie("selected")){
  372. tags[n].style.display="block";
  373. tags[n].getElementsByTagName("a")[0].href=readCookie("selected");
  374. tags[n].getElementsByTagName("a")[0].innerHTML="BACK";
  375. }
  376. }
  377. }
  378. }
  379.  
  380. // make a subselector on a thumbpage
  381. function subsel(){
  382. createCookie("selected",document.location.href,1);
  383. if((document.location.href.indexOf("spy-on-cams")==-1)&&(document.location.href.indexOf("followed-cams")==-1)&&(document.location.href.indexOf("/tag")==-1)&&(document.location.href.indexOf("/current_app_use/")==-1)){
  384. newelem=document.createElement('li');
  385. var data='<form><select id="subsel" style="margin: 0px 0px 0px 0px; background: #DDE9F5; color:#5E81A4; border-radius: 4px 4px 0px 0px;padding: 3px 1px 4px 12px; font-weight: 400; font-size: 13px; font-family: \'UbuntuMedium\',Arial,Helvetica,sans-serif;" >'+
  386. '<option value="/XX-cams">ALL CAMS IN CATEGORY</option>'+
  387. '<option value="/exhibitionist-cams/XX">EXHIBITIONIST CAMS</option>'+
  388. '<option value="/hd-cams/XX">HD CAMS</option>'+
  389. '<option value="/new-cams/XX">NEW CAMS</option>'+
  390. '<option value="/teen-cams/XX">TEEN CAMS (18+)</option>'+
  391. '<option value="/18to21-cams/XX">18 TO 21 CAMS</option>'+
  392. '<option value="/21to35-cams/XX">21 TO 35 CAMS</option>'+
  393. '<option value="/30to50-cams/XX">30 TO 50 CAMS</option>'+
  394. '<option value="/mature-cams/XX">MATURE CAMS (50+)</option>'+
  395. '<option value="/north-american-cams/XX">NORTH AMERICAN CAMS</option>'+
  396. '<option value="/euro-russian-cams/XX">EURO RUSSIAN CAMS</option>'+
  397. '<option value="/south-american-cams/XX">SOUTH AMERICAN CAMS</option>'+
  398. '<option value="/asian-cams/XX">ASIAN CAMS</option>'+
  399. '<option value="/other-region-cams/XX">OTHER REGION CAMS</option>'+
  400. '<option value="/6-tokens-per-minute-private-cams/XX">6 TOKENS PER MINUTE</option>'+
  401. '<option value="/12-tokens-per-minute-private-cams/XX">12 TOKENS PER MINUTE</option>'+
  402. '<option value="/18-tokens-per-minute-private-cams/XX">18 TOKENS PER MINUTE</option>'+
  403. '<option value="/30-tokens-per-minute-private-cams/XX">30 TOKENS PER MINUTE</option>'+
  404. '<option value="/60-tokens-per-minute-private-cams/XX">60 TOKENS PER MINUTE</option>'+
  405. '<option value="/90-tokens-per-minute-private-cams/XX">90 TOKENS PER MINUTE</option>'+
  406. '</select></form>';
  407. var uloc=document.location.href+"//";
  408. var loc=uloc.split("/");
  409. var check=loc[3]+loc[4];
  410. var gen="";
  411. if(check.indexOf("male") != -1){gen="male";}
  412. if(check.indexOf("female") != -1){gen="female";}
  413. if(check.indexOf("couple") != -1){gen="couple";}
  414. if(check.indexOf("trans") != -1){gen="trans";}
  415. data=data.replace(/XX/gi,gen);
  416. if (gen === ""){data=data.replace("-cams","");}
  417. data=data.replace('<option value="/'+loc[3],'<option selected value="/'+loc[3]);
  418. newelem.innerHTML=data;
  419. document.getElementsByClassName('sub-nav')[0].appendChild(newelem);
  420. document.getElementById("subsel").addEventListener('change',subselected);
  421. }
  422. }
  423.  
  424. // go to the selected page
  425. function subselected(){
  426. document.location.href=document.getElementById("subsel").options[document.getElementById("subsel").selectedIndex].value;
  427. }
  428.  
  429. // jpg player for banned rooms and kill all timers
  430. function jpgplayer(){
  431. br=document.location.href.split("/")[3];
  432. if(br=="p"){
  433. br=document.location.href.split("/")[4];
  434. }
  435. document.title=br+"'s no access cam";
  436. newelem=document.createElement('div');
  437. newelem.setAttribute("style","clear:both;float:left;margin-left:10px;margin-top:10px;margin-bottom:10px;margin-right:200px;border-width:5px;border-style:double;resize:both;overflow:hidden;width: 640px; height: 480px;");
  438. newelem.innerHTML="<img id='vidimg' src='https://ssl-ccstatic.highwebmedia.com/images/cam_notice_background.jpg' height=100% width=100%></img>";
  439. document.getElementsByClassName('block')[0].appendChild(newelem);
  440.  
  441. cimg.onload = function(){
  442. document.getElementById("vidimg").src=cimg.src;
  443. setTimeout(function(){ cimg.src = 'https://cbjpeg.stream.highwebmedia.com/minifap/'+br+'.jpg?f='+ new Date().getTime();}, 150);
  444. };
  445.  
  446. cimg.onerror = function(){
  447. setTimeout(function(){ cimg.src = 'https://cbjpeg.stream.highwebmedia.com/minifap/'+br+'.jpg?f='+ new Date().getTime();}, 1000);
  448. };
  449.  
  450. cimg.src = 'https://cbjpeg.stream.highwebmedia.com/minifap/'+br+'.jpg?f='+ new Date().getTime();
  451.  
  452. for (i = 1; i < 9999; i++){win.clearInterval(i);}
  453. }
  454.  
  455.  
  456. // make a clean profile button and call cleaninit()
  457. function cleanbutton(){
  458. newelem = document.createElement('li');
  459. newelem.style.display="none";
  460. newelem.id="hclean";
  461. newelem.innerHTML="<div class='button_share'> <a href=# id='clean' >CLEAN PROFILE = OFF</a></div>";
  462. newelem.addEventListener('click',cleancookie);
  463. document.getElementsByClassName("socials")[0].appendChild(newelem);
  464. cleaninit();
  465. }
  466.  
  467. // make a full screen button,exit full screen button, fix html5 video area size bug, app area bug and set full screen handler
  468. function fullscreenbutton(){
  469. newelem = document.createElement('li');
  470. newelem.innerHTML="<div class='button_share'> <a href=#>FULL SCREEN WITH CHAT</a></div>";
  471. newelem.addEventListener('click',fullscreenapi);
  472. document.getElementsByClassName("socials")[0].appendChild(newelem);
  473.  
  474. newelem = document.createElement('div');
  475. newelem.id="fsclose";
  476. newelem.className="button_share";
  477. newelem.innerHTML="<a href=#>EXIT FULL SCREEN</a>";
  478. newelem.style.position="absolute";
  479. newelem.style.borderRadius="4px";
  480. newelem.style.right="60px";
  481. newelem.style.marginTop="-40px";
  482. newelem.style.display="none";
  483. newelem.addEventListener("click",closeFullscreen);
  484. document.getElementsByClassName("video-box")[0].appendChild(newelem);
  485.  
  486. if (document.getElementById("still_video_object_html5_api")){
  487. document.getElementById("player").style.height=parseInt(document.getElementById("player").style.height)-32+"px";
  488. sizeadj();
  489. }
  490.  
  491. document.getElementsByClassName("tip_shell")[0].style.width="100%";
  492.  
  493. document.addEventListener('webkitfullscreenchange', exitHandler, false);
  494. document.addEventListener('mozfullscreenchange', exitHandler, false);
  495. document.addEventListener('fullscreenchange', exitHandler, false);
  496. }
  497.  
  498. // make video controls, set filter
  499. function controlsbutton(){
  500. var butstyle="margin-right: 10px;color: rgb(255, 255, 255); background: rgba(0, 0, 0, 0) linear-gradient(rgb(255, 151, 53) 0%, rgb(255, 158, 54) 50%, rgb(255, 112, 2) 60%) repeat scroll 0% 0%; font-family: UbuntuMedium, Helvetica, Arial, sans-serif; font-size: 12px; text-shadow: rgb(241, 129, 18) 1px 1px 0px; padding: 3px 10px 2px; float: right; border-radius: 4px; cursor: pointer; display: inline;";
  501. var slistyle="text-align: left; width: 310px;margin-right: 10px;color: rgb(255, 255, 255); background: rgba(0, 0, 0, 0) linear-gradient(rgb(255, 151, 53) 0%, rgb(255, 158, 54) 50%, rgb(255, 112, 2) 60%) repeat scroll 0% 0%; font-family: UbuntuMedium, Helvetica, Arial, sans-serif; font-size: 12px; text-shadow: rgb(241, 129, 18) 1px 1px 0px; padding: 3px 10px 2px; float: right; border-radius: 4px; display: inline;";
  502.  
  503. newelem = document.createElement('li');
  504. newelem.innerHTML="<div class='button_share'> <a href=#>VIDEO CONTROLS ON/OFF</a></div>";
  505. newelem.addEventListener('click',vcontrol);
  506. document.getElementsByClassName("socials")[0].appendChild(newelem);
  507.  
  508. newelem=document.createElement('div');
  509. newelem.id="controls";
  510. newelem.style.display="none";
  511. newelem.style.position="absolute";
  512. newelem.style.backgroundColor="rgb(255, 255, 211)";
  513. newelem.style.border="2px solid rgb(244, 115, 33)";
  514. newelem.style.borderRadius="6px";
  515. newelem.style.width="350px";
  516. newelem.style.padding="12px";
  517. newelem.style.marginTop="50px";
  518. newelem.style.right="320px";
  519. newelem.style.zIndex="999";
  520. document.getElementsByClassName("socials")[0].appendChild(newelem);
  521.  
  522. newelem=document.createElement('span');
  523. newelem.setAttribute("style", butstyle);
  524. newelem.innerHTML="MIRROR VIDEO";
  525. newelem.addEventListener("click",mirror);
  526. document.getElementById("controls").appendChild(newelem);
  527.  
  528. newelem=document.createElement('span');
  529. newelem.setAttribute("style", butstyle);
  530. newelem.innerHTML="INVERT VIDEO";
  531. newelem.addEventListener("click",invert);
  532. document.getElementById("controls").appendChild(newelem);
  533.  
  534. newelem=document.createElement('span');
  535. newelem.setAttribute("style", butstyle);
  536. newelem.innerHTML="DRAG";
  537. newelem.style.cursor="move";
  538. newelem.addEventListener("mousedown",dragMouseDown);
  539. document.getElementById("controls").appendChild(newelem);
  540.  
  541. newelem=document.createElement('br');
  542. document.getElementById("controls").appendChild(newelem);
  543. newelem=document.createElement('br');
  544. document.getElementById("controls").appendChild(newelem);
  545.  
  546. newelem=document.createElement('span');
  547. newelem.setAttribute("style", slistyle);
  548. newelem.innerHTML="BRIGHTNESS : <input type='range' id='myRange' min=0 max=200 value=100 style='width: 200px;height: 13px;cursor: pointer;float: right;'>";
  549. document.getElementById("controls").appendChild(newelem);
  550. document.getElementById("myRange").addEventListener("input",badjust);
  551.  
  552. newelem=document.createElement('br');
  553. document.getElementById("controls").appendChild(newelem);
  554. newelem=document.createElement('br');
  555. document.getElementById("controls").appendChild(newelem);
  556.  
  557. newelem=document.createElement('span');
  558. newelem.setAttribute("style", slistyle);
  559. newelem.innerHTML="CONTRAST : <input type='range' id='myRange1' min=0 max=200 value=100 style='width: 200px;height: 13px;cursor: pointer;float: right;'>";
  560. document.getElementById("controls").appendChild(newelem);
  561. document.getElementById("myRange1").addEventListener("input",cadjust);
  562.  
  563. newelem=document.createElement('br');
  564. document.getElementById("controls").appendChild(newelem);
  565. newelem=document.createElement('br');
  566. document.getElementById("controls").appendChild(newelem);
  567.  
  568. newelem=document.createElement('span');
  569. newelem.setAttribute("style", slistyle);
  570. newelem.innerHTML="SATURATION : <input type='range' id='myRange2' min=0 max=200 value=100 style='width: 200px;height: 13px;cursor: pointer;float: right;'>";
  571. document.getElementById("controls").appendChild(newelem);
  572. document.getElementById("myRange2").addEventListener("input",sadjust);
  573.  
  574. newelem=document.createElement('br');
  575. document.getElementById("controls").appendChild(newelem);
  576. newelem=document.createElement('br');
  577. document.getElementById("controls").appendChild(newelem);
  578.  
  579. newelem=document.createElement('span');
  580. newelem.setAttribute("style", slistyle);
  581. newelem.innerHTML="HUE : <input type='range' id='myRange3' min=180 max=540 value=360 style='width: 200px;height: 13px;cursor: pointer;float: right;'>";
  582. document.getElementById("controls").appendChild(newelem);
  583. document.getElementById("myRange3").addEventListener("input",hadjust);
  584.  
  585. newelem=document.createElement('br');
  586. document.getElementById("controls").appendChild(newelem);
  587. newelem=document.createElement('br');
  588. document.getElementById("controls").appendChild(newelem);
  589.  
  590. newelem=document.createElement('span');
  591. newelem.setAttribute("style", butstyle);
  592. newelem.innerHTML="HIDE CONTROL PANEL";
  593. newelem.addEventListener("click",vcontrol);
  594. document.getElementById("controls").appendChild(newelem);
  595.  
  596. newelem=document.createElement('span');
  597. newelem.setAttribute("style", butstyle);
  598. newelem.innerHTML="RESET ALL";
  599. newelem.addEventListener("click",vreset);
  600. document.getElementById("controls").appendChild(newelem);
  601.  
  602. newelem=document.createElement('input');
  603. newelem.id="copytext";
  604. newelem.type="text";
  605. newelem.style.display="none";
  606. document.getElementsByClassName("socials")[0].appendChild(newelem);
  607.  
  608. vreset();
  609. }
  610.  
  611. //set interesting defchat settings in profile
  612. function info(){
  613. if (win.defchat_settings.private_price !== "0"){
  614. wprof("Private:",win.defchat_settings.private_price+" Tk/min");
  615. }else{
  616. wprof("Private:","Disabled");
  617. }
  618. if (win.defchat_settings.private_price !== "0"){
  619. if (win.defchat_settings.spy_price !== "0"){
  620. wprof("Spy:",win.defchat_settings.spy_price+" Tk/min");
  621. }else{
  622. wprof("Spy:","Disabled");
  623. }
  624. }
  625. if (win.defchat_settings.group_price !== "0"){
  626. wprof("Group:",win.defchat_settings.group_price+" Tk/min");
  627. }else{
  628. wprof("Group:","Disabled");
  629. }
  630. if (!win.defchat_settings.allow_tipping){
  631. wprof("Status:","Exhibitionist");
  632. }
  633. if (!campage){
  634. wprof("Last room topic:",decodeURIComponent(win.defchat_settings.default_subject));
  635. }
  636. }
  637.  
  638. //mark elements that can be hidden in the profile make clean button visible and call cleanup()
  639. function cleaninit(){
  640. var taglist=["a","p","i","strong","b","u","ul","ol","li","h1","h2","h3","img","font","br"];
  641. for (i=0; i<taglist.length; i++){
  642. tags = bioarea.getElementsByTagName(taglist[i]);
  643. for (n=0; n<tags.length; n++){
  644. if (tags[n].style.position){
  645. if ((tags[n].style.position.indexOf("absolute")!=-1)||(tags[n].style.position.indexOf("fixed")!=-1)){
  646. tags[n].setAttribute("name", "clean");
  647. p++;
  648. }
  649. }
  650. }
  651. }
  652. if (p!==0){
  653. document.getElementById("hclean").style.display="block";
  654. cleanup();
  655. }
  656. }
  657.  
  658. // swap profile cleanup cookie and call cleanup()
  659. function cleancookie(){
  660. if (readCookie("pclean")){
  661. eraseCookie("pclean");
  662. }else{
  663. createCookie("pclean",1,30);
  664. }
  665. cleanup();
  666. }
  667.  
  668. // hide or unhide marked elements in profile according to cookie
  669. function cleanup(){
  670. var claction=!readCookie("pclean");
  671. if (claction){
  672. document.getElementById("clean").innerHTML= "CLEAN PROFILE = ON&nbsp;";
  673. }else{
  674. document.getElementById("clean").innerHTML= "CLEAN PROFILE = OFF";
  675. }
  676. tags=document.getElementsByName("clean");
  677. for (i=0; i<tags.length; i++){
  678. if (claction){
  679. tags[i].style.display="none";
  680. }else{
  681. tags[i].style.display="block";
  682. }
  683. }
  684. }
  685.  
  686. // fix the redirection links in the profile
  687. function linkfix(){
  688. tags = bioarea.getElementsByTagName('a');
  689. for (i=0; i<tags.length; i++){
  690. if (tags[i].href.indexOf('?url=') != -1){
  691. tags[i].href=decodeURIComponent(tags[i].href).split("?url=")[1];
  692. }
  693. if (tags[i].href.indexOf('/in/') != -1){
  694. tags[i].href=tags[i].href.split('?')[0]+affkey;
  695. }
  696. }
  697. }
  698.  
  699. // hide the lock on paid profile pictures
  700. function imgfix(){
  701. tags = bioarea.getElementsByTagName('img');
  702. for (i=0; i<tags.length; i++){
  703. if (tags[i].src.indexOf('highwebmedia.com/images/locked_rectangle') != -1){
  704. tags[i].style.display="none";
  705. }
  706. }
  707. }
  708.  
  709. // hide the locks on show more pop up page
  710. function moreclean(){
  711. tags = document.getElementsByTagName('img');
  712. for (i=0; i<tags.length; i++){
  713. if (tags[i].src.indexOf('highwebmedia.com/images/locked_rectangle') != -1){
  714. tags[i].style.display="none";
  715. }
  716. }
  717. }
  718.  
  719. // full screen open
  720. function fullscreenapi(){
  721. myfullscreen=true;
  722. if (elem.requestFullscreen) {
  723. elem.requestFullscreen();
  724. } else if (elem.mozRequestFullScreen) {
  725. elem.mozRequestFullScreen();
  726. } else if (elem.webkitRequestFullScreen) {
  727. elem.webkitRequestFullscreen();
  728. }
  729. }
  730.  
  731. // full screen close
  732. function closeFullscreen() {
  733. if (document.exitFullscreen) {
  734. document.exitFullscreen();
  735. } else if (document.mozCancelFullScreen) {
  736. document.mozCancelFullScreen();
  737. } else if (document.webkitExitFullscreen) {
  738. document.webkitExitFullscreen();
  739. }
  740. }
  741.  
  742. //full screen enter/exit handler and prevent double full screen in html5
  743. function exitHandler(){
  744. if (isfullscreen){ //exit
  745. isfullscreen=false;
  746. myfullscreen=false;
  747. document.getElementById("fsclose").style.display="none";
  748. document.getElementById("player").style.width=orgplayerw+"px";
  749. createCookie("player_width",orgplayerw,1);
  750. elem.style.width="";
  751. sizeadj();
  752. if (document.getElementsByClassName("vjs-fullscreen-control")[0]) {
  753. document.getElementsByClassName("vjs-fullscreen-control")[0].style.visibility="visible";
  754. }
  755. }
  756. else{ //enter
  757. if(!myfullscreen) {return;}
  758. isfullscreen=true;
  759. document.getElementById("fsclose").style.display="block";
  760. orgplayerw=parseInt(document.getElementById("player").style.width);
  761. orgplayerh=parseInt(document.getElementById("player").style.height);
  762. var ratio=orgplayerw/orgplayerh;
  763. var fsplheight=screen.height-92;
  764. if (document.getElementById("still_video_object_html5_api")){
  765. fsplheight=fsplheight-32;
  766. }
  767. var fsplwidth=Math.round(fsplheight*ratio);
  768. if (screen.width-fsplwidth < 275){
  769. fsplwidth=screen.width-275;
  770. }
  771. document.getElementById("player").style.width=fsplwidth+"px";
  772. createCookie("player_width",fsplwidth,1);
  773. elem.style.width="100%";
  774. sizeadj();
  775. if (document.getElementsByClassName("vjs-fullscreen-control")[0]) {
  776. document.getElementsByClassName("vjs-fullscreen-control")[0].style.visibility="hidden";
  777. }
  778. }
  779. }
  780.  
  781. //player resize
  782. function sizeadj() {
  783. win.resizable_player.update_sizes();
  784. }
  785.  
  786. // brightness adjust
  787. function badjust(){
  788. br=document.getElementById("myRange").value;
  789. ofils=varea.style.filter.split(" ");
  790. varea.style.filter="brightness("+br+"%) "+ofils[1]+" "+ofils[2]+" "+ofils[3]+" "+ofils[4];
  791. }
  792.  
  793. // contrast adjust
  794. function cadjust(){
  795. br=document.getElementById("myRange1").value;
  796. ofils=varea.style.filter.split(" ");
  797. varea.style.filter=ofils[0]+" contrast("+br+"%) "+ofils[2]+" "+ofils[3]+" "+ofils[4];
  798. }
  799.  
  800. // saturation adjust
  801. function sadjust(){
  802. br=document.getElementById("myRange2").value;
  803. ofils=varea.style.filter.split(" ");
  804. varea.style.filter=ofils[0]+" "+ofils[1]+" "+ofils[2]+" saturate("+br+"%) "+ofils[4];
  805. }
  806.  
  807. // hue adjust
  808. function hadjust(){
  809. br=document.getElementById("myRange3").value;
  810. if (br > 359){
  811. br=br-360;
  812. }
  813. ofils=varea.style.filter.split(" ");
  814. varea.style.filter=ofils[0]+" "+ofils[1]+" "+ofils[2]+" "+ofils[3]+" hue-rotate("+br+"deg)";
  815. }
  816.  
  817. // invert video
  818. function invert(){
  819. ofils=varea.style.filter.split(" ");
  820. br=" invert(100%) ";
  821. if (ofils[2]=="invert(100%)"){
  822. br=" invert(0%) ";
  823. }
  824. varea.style.filter=ofils[0]+" "+ofils[1]+br+ofils[3]+" "+ofils[4];
  825. }
  826.  
  827. // mirror video
  828. function mirror(){
  829. if (varea.style.transform=="none"){
  830. varea.style.transform="matrix(-1, 0, 0, 1, 0, 0)";
  831. }else{
  832. varea.style.transform="none";
  833. }
  834. }
  835.  
  836. // reset all video adjustments
  837. function vreset(){
  838. varea.style.filter="brightness(100%) contrast(100%) invert(0%) saturate(100%) hue-rotate(0deg)";
  839. varea.style.transform="none";
  840. document.getElementById("myRange").value=100;
  841. document.getElementById("myRange1").value=100;
  842. document.getElementById("myRange2").value=100;
  843. document.getElementById("myRange3").value=360;
  844. }
  845.  
  846. // video controls on/off
  847. function vcontrol(){
  848. if (document.getElementById("controls").style.display=="block"){
  849. document.getElementById("controls").style.display="none";
  850. }else{
  851. document.getElementById("controls").style.display="block";
  852. }
  853. copyclipboard(HLS);
  854. }
  855.  
  856. // writes a line in the profile at the top
  857. function wprof (row1,row2){
  858. var pnod = document.getElementById('tabs_content_container');
  859. var rnod = pnod.getElementsByTagName('h1')[0];
  860. newelem = document.createElement('dl');
  861. newelem.style.margin=0;
  862. newelem.style.padding=0;
  863. newelem.innerHTML = "<dt>"+row1+"</dt><dd>"+row2+"</dd>";
  864. pnod.insertBefore(newelem, rnod.nextSibling);
  865. }
  866.  
  867. // pull and drag functions
  868. // when clicked
  869. function dragMouseDown(e) {
  870. e = e || window.event;
  871. e.preventDefault();
  872. pos3 = e.clientX;
  873. pos4 = e.clientY;
  874. document.onmouseup = closeDragElement;
  875. document.onmousemove = elementDrag;
  876. }
  877.  
  878. // when moved while clicked- part of dragMouseDown()
  879. function elementDrag(e) {
  880. e = e || window.event;
  881. e.preventDefault();
  882. pos1 = pos3 - e.clientX;
  883. pos2 = pos4 - e.clientY;
  884. pos3 = e.clientX;
  885. pos4 = e.clientY;
  886. x =parseInt(document.getElementById("controls").style.right);
  887. y =parseInt(document.getElementById("controls").style.marginTop);
  888. if ((pos3>=110)&&(pos3<=window.innerWidth-324)){
  889. document.getElementById("controls").style.right = (x + pos1) + "px";
  890. }
  891. if ((pos4>=20)&&(pos4<=window.innerHeight-20)){
  892. document.getElementById("controls").style.marginTop = (y - pos2) + "px";
  893. }
  894. }
  895.  
  896. // stop moving when mouse button is released- part of dragMouseDown()
  897. function closeDragElement() {
  898. document.onmouseup = null;
  899. document.onmousemove = null;
  900. }
  901.  
  902. // copy cdata to clipboard (only works after user interaction)
  903. function copyclipboard(cdata){
  904. document.getElementById("copytext").value=cdata;
  905. document.getElementById("copytext").style.display="block";
  906. document.getElementById("copytext").select();
  907. document.execCommand("copy");
  908. document.getElementById("copytext").style.display="none";
  909. }
  910.  
  911. // cookie functions
  912. function createCookie(name,value,days,domain){
  913. var expires="";
  914. if (domain){
  915. domain=";domain=."+domain;
  916. }else{
  917. domain = "";
  918. }
  919. if (days) {
  920. var date = new Date();
  921. date.setTime(date.getTime()+(days*24*60*60*1000));
  922. expires = "; expires="+date.toGMTString();
  923. }
  924. document.cookie = name+"="+value+expires+"; path=/"+domain;
  925. }
  926.  
  927. function readCookie(name) {
  928. var nameEQ = name + "=";
  929. var ca = document.cookie.split(';');
  930. for(i=0;i < ca.length;i++) {
  931. var c = ca[i];
  932. while (c.charAt(0)==' '){
  933. c = c.substring(1,c.length);
  934. }
  935. if (c.indexOf(nameEQ) === 0){
  936. return c.substring(nameEQ.length,c.length);
  937. }
  938. }
  939. return null;
  940. }
  941.  
  942. function eraseCookie(name,domain){
  943. createCookie(name,"",-1,domain);
  944. }
  945.  
  946. })();