Sleazy Fork is available in English.

Chaturbate reloaded

Ladroop is back

Per 25-12-2024. Zie de nieuwste versie.

  1. // ==UserScript==
  2. // @name Chaturbate reloaded
  3. // @description Ladroop is back
  4. // @version 1.4.0
  5. // @namespace chaturbate_goes_Ladroop
  6. // @match https://*.chaturbate.com/*
  7. // @exclude https://secure.chaturbate.com/*
  8. // @exclude https://*chaturbate.com/apps/*
  9. // @exclude https://*chaturbate.com/b/*
  10. // @exclude https://*chaturbate.com/fullvideo/*
  11. // @exclude https://*chaturbate.com/accounts/followers/*
  12. // @grant none
  13. // @run-at document-end
  14. // @license MIT
  15. // @copyright 2024 Ladroop
  16. // ==/UserScript==
  17.  
  18.  
  19.  
  20. (function() {
  21. 'use strict';
  22. var version = "1.4.0";
  23. var scriptname="Chaturbate reloaded";
  24. var i=0;
  25. var n=0;
  26. var currpage=document.location.href;
  27. var ppage=false;
  28. var biodata="";
  29. var referenceNode="";
  30. var roomname= currpage.split("/")[3];
  31. if (roomname =="p"){
  32. ppage=true;
  33. }
  34. var hls_source = "";
  35. var fetching=0;
  36. var loggedin=false;
  37. var yourname="";
  38. var username="";
  39. var br="";
  40. var vfilter="";
  41. var ofils="";
  42. var vmirror="";
  43. var pos1=0;
  44. var pos2=0;
  45. var pos3=0;
  46. var pos4=0;
  47. var vareaid="";
  48.  
  49. if (document.querySelector('[data-testid="username"]')){
  50. loggedin=true;
  51. yourname=document.querySelector('[data-testid="username"]').innerHTML;
  52. }
  53.  
  54. var observer4=new MutationObserver(adjusthumbs); // observer for the thump
  55. var observerConfig4 ={attributes : true, attributeFilter : ['class'] };
  56. var observer41=new MutationObserver(adjusthumbs); // for 2nd list in spy on pvt
  57. var observer5=new MutationObserver(adjustbiohumbs); // observer for the thump on bio
  58. var observerConfig5 ={attributes : true, attributeFilter : ['style'] };
  59. var observer6=new MutationObserver(adjustfollowhumbs); // observer for the thump on followed popout
  60. var observerConfig6 ={attributes : true, attributeFilter : ['style'] };
  61. var observer7=new MutationObserver(nextcam);
  62. var observerConfig7 ={attributes : true, attributeFilter : ['title'] };
  63. var observer3 = new MutationObserver(varea); // reset the filters if video area is changed
  64. var observerConfig3 = {childList: true, subtree: true}; // changes if video area is changed
  65. var pmobserver = new MutationObserver(tabpm); // to be called if pm is recieved classic mode
  66. var pmobserver2 = new MutationObserver(tabpm); // to be called if pm is recieved theatre mode
  67. var pmobserverConfig = {childList: true}; // changes if pm
  68. var pmobservenode="";// node to observe if pm is recieved classic mode
  69. var pmobservenode2="";// node to observe if pm is recieved theatre mode
  70.  
  71. var tabblink=false;
  72. var ctitle=document.title;
  73. var container="";
  74. var bio=false;
  75.  
  76. var thisfap="";
  77. var fapbr="";
  78. var cimg = new Image();
  79. var pimg = new Image();
  80. var usernoteslist = "";
  81. var stor="greg44609";
  82. var tour="https://chaturbate.com/in/?tour=4uT2&campaign=hgg5k&track=default";
  83. var note='<svg style="height: 2.0em; width: 2.0em;" viewBox="0 0 12 12" xmlns="https://www.w3.org/2000/svg"><path fill="hsla(0, 100%, 50%, 0.8)" d="M5.5 2.00002H2C1.73478 2.00002 1.48043 2.10537 1.29289 2.29291C1.10536 2.48044 1 2.7348 1 3.00002V10C1 10.2652 1.10536 10.5196 1.29289 10.7071C1.48043 10.8947 1.73478 11 2 11H9C9.26522 11 9.51957 10.8947 9.70711 10.7071C9.89464 10.5196 10 10.2652 10 10V6.50002" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.25 1.24985C9.44891 1.05094 9.7187 0.939194 10 0.939194C10.2813 0.939194 10.5511 1.05094 10.75 1.24985C10.9489 1.44877 11.0607 1.71855 11.0607 1.99985C11.0607 2.28116 10.9489 2.55094 10.75 2.74985L6 7.49985L4 7.99985L4.5 5.99985L9.25 1.24985Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>';
  84. var nonote='<svg style="height: 2.0em; width: 2.0em;" viewBox="0 0 12 12" xmlns="https://www.w3.org/2000/svg"><path fill="hsla(197, 10%, 98%, 0.3)" d="M5.5 2.00002H2C1.73478 2.00002 1.48043 2.10537 1.29289 2.29291C1.10536 2.48044 1 2.7348 1 3.00002V10C1 10.2652 1.10536 10.5196 1.29289 10.7071C1.48043 10.8947 1.73478 11 2 11H9C9.26522 11 9.51957 10.8947 9.70711 10.7071C9.89464 10.5196 10 10.2652 10 10V6.50002" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.25 1.24985C9.44891 1.05094 9.7187 0.939194 10 0.939194C10.2813 0.939194 10.5511 1.05094 10.75 1.24985C10.9489 1.44877 11.0607 1.71855 11.0607 1.99985C11.0607 2.28116 10.9489 2.55094 10.75 2.74985L6 7.49985L4 7.99985L4.5 5.99985L9.25 1.24985Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>';
  85. var notegrey='<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="none" viewBox="0 0 12 12" role="img"><path stroke="#48484E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.5 2H2a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V6.5"></path><path stroke="#48484E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.25 1.25a1.06 1.06 0 0 1 1.5 1.5L6 7.5 4 8l.5-2z"></path></svg>';
  86. if (currpage.indexOf(stor)!=-1){document.location.href="https://chaturbate.com";}
  87. var discoverpage=false;
  88. var thumbpage=false;
  89. var tagspage=false;
  90. var openthumbname="";
  91. var opennote="";
  92. var data="";
  93. var room_status="";
  94.  
  95. var hidurl="https://chaturbate.com/api/ts/roomlist/room-list/?&hidden=true&limit=90&offset=";
  96. var hprom=false;
  97. var hidoffset=0;
  98. var hiddenarray=[];
  99.  
  100. var noaccess=false;
  101.  
  102. var c1=0;
  103. var c2=0;
  104. var c3=0;
  105. var c4=0;
  106. var c5=0;
  107. var c6=0;
  108. var c7=0;
  109. var c7a=100;
  110. var c8=0;
  111.  
  112. var firstentry=true;
  113. var twaiting=false;
  114. var chatrules="";
  115.  
  116. // for rooms with ban
  117. if (!localStorage.getItem("defaultplaylist")) {
  118. localStorage.setItem("defaultplaylist","https://edge17-rtm.live.mmcdn.com/live-edge/amlst:XXX-sd-883752acca206f43dfba30fb6a37be0bab0e4cfdd07c3415f24f3146288b427a_trns_h264/playlist.m3u8");
  119. }
  120.  
  121. // to skip agree screen
  122. if (!readCookie("agreeterms")){createCookie("agreeterms","1",30);window.location.reload(true);}
  123. if (document.getElementsByClassName("dismiss_notice_tfa_and_email").length>0){
  124. document.getElementsByClassName("dismiss_notice_tfa_and_email")[0].click();
  125. }
  126. setadstyle();
  127. setgenstyle();
  128. if (roomname=="discover"){
  129. setdiscoverstyle();
  130. }
  131. getmessage();
  132. //======== these are specials
  133.  
  134. if (roomname=="my_collection"){
  135. if (document.getElementsByTagName("video").length>0){
  136. savedprvdownload();
  137. }
  138. return;
  139. }
  140.  
  141. if (roomname=="photo_videos"){
  142. collectiondownload();
  143. return;
  144. }
  145.  
  146. //=== get status and pagetype
  147. var supporter=true;
  148. var login=true;
  149. if (document.querySelector('[class="upgrade"]')){
  150. supporter=false;
  151. }
  152. if (document.querySelector('[href="/auth/login/"]')){
  153. supporter=false;
  154. login=false;
  155. }
  156. getsaving();
  157. if (roomname=="discover"){discoverpage=true;}
  158. if (roomname=="tags"){tagspage=true;}
  159. if (document.getElementById("roomlist_root")){thumbpage=true;}
  160. aff();
  161. noadd();
  162. moreoptions();
  163. if (document.querySelector('[data-testid="denied-notice"]')){
  164. noaccess=true;
  165. bannedroom();
  166. return;
  167. }
  168.  
  169. if (roomname=="roomlogin"){
  170. roomname=currpage.split("/")[4];
  171. passwordfollow();
  172. return;
  173. }
  174. if (tagspage){setupfollowmove();}
  175. if (discoverpage){dothumbpagethings();}
  176. if (thumbpage){dothumbpagethings();}
  177.  
  178.  
  179. //========= from here model page
  180. if (document.getElementById('main')){
  181. test();
  182. }
  183.  
  184. // wait till container is created
  185. function test(){
  186. if(document.getElementsByClassName("BioContents").length>0){
  187. container=document.getElementsByClassName("BioContents")[0];
  188. n=0;
  189. setTimeout(function(){test2();}, 100);
  190. }else{
  191. n++;
  192. if (n==100){
  193. return;
  194. }
  195. setTimeout(function(){test();}, 100);
  196. }
  197. }
  198.  
  199. function test2(){
  200. if (n==100){return;}
  201. if (container.innerHTML.indexOf("Loading…")!=-1){
  202. n++;
  203. setTimeout(function(){test2();}, 100);
  204. }else{
  205. n=0;
  206. test3();
  207. }
  208. }
  209.  
  210. function test3(){
  211. n++;
  212. if (n==100){return;}
  213. var biocont=container.innerHTML;
  214. setTimeout(function(){
  215. if (biocont == container.innerHTML){
  216. if(!ppage){
  217. observer7.observe(document.querySelector('[data-paction-name="ActiveRoom"]'),observerConfig7);
  218. }
  219. dobiothings();
  220. }else{
  221. test3();
  222. }
  223. }, 100);
  224. }
  225.  
  226. function hidemtenter(){
  227. if (!localStorage.getItem("hidemt")){return;}
  228. if ((roomname=="male-cams")||(roomname=="trans-cams")){
  229. document.location.href="https://chaturbate.com";
  230. }
  231. var toptabs=document.getElementsByClassName("gender-tab");
  232. for (n=0; n<toptabs.length; n++){
  233. if (toptabs[n].href){
  234. if (toptabs[n].href.indexOf("/male-")!=-1){
  235. toptabs[n].style.display="none";
  236. }
  237. if (toptabs[n].href.indexOf("/male/")!=-1){
  238. toptabs[n].style.display="none";
  239. }
  240. if (toptabs[n].href.indexOf("/trans-")!=-1){
  241. toptabs[n].style.display="none";
  242. }
  243. if (toptabs[n].href.indexOf("/trans/")!=-1){
  244. toptabs[n].style.display="none";
  245. }
  246. }
  247. }
  248.  
  249. }
  250.  
  251. // nextcam , cleanup first
  252. function nextcam(){
  253. observer7.disconnect();
  254. observer3.disconnect();
  255. if (document.getElementById("notepop")){
  256. document.getElementById("notepop").remove();
  257. }
  258. if (document.getElementById("vcontr")){
  259. document.getElementById("vcontr").remove();
  260. }
  261. if (document.getElementById("ccontr")){
  262. document.getElementById("ccontr").remove();
  263. }
  264. if (document.getElementById("clean")){
  265. document.getElementById("clean").remove();
  266. }
  267. if (document.getElementById("infore")){
  268. document.getElementById("infore").remove();
  269. }
  270. if (document.getElementById("controls")){
  271. document.getElementById("controls").remove();
  272. }
  273. if (document.getElementById("chatcontrols")){
  274. document.getElementById("chatcontrols").remove();
  275. }
  276. if (document.getElementById("rulespop")){
  277. document.getElementById("rulespop").remove();
  278. }
  279. roomname=document.querySelector('[data-paction-name="ActiveRoom"]').innerHTML.split("'")[0].toLowerCase();
  280. test();
  281. }
  282.  
  283. //============ make script option selector
  284. function moreoptions(){
  285. if (roomname=="auth"){return;}
  286. var newelemsw=document.getElementById('UserMenuDropDown').firstChild.cloneNode(true);
  287. var newelemsw2=newelemsw.cloneNode(true);
  288. var newelemsw3=newelemsw.cloneNode(true);
  289. var newelemsw4=newelemsw.cloneNode(true);
  290. var newelemsw5=newelemsw.cloneNode(true);
  291. var newelemtxt=newelemsw.cloneNode(false);
  292. var newelemtxt2=newelemsw.cloneNode(false);
  293. var newelemtxt3=newelemsw.cloneNode(false);
  294.  
  295. newelemtxt.innerHTML="Script settings:";
  296. newelemtxt.style.cursor="default";
  297.  
  298. newelemtxt2.innerHTML="Save all settings.";
  299. newelemtxt2.id="saved";
  300. newelemtxt2.style.cursor="pointer";
  301. newelemtxt2.addEventListener("click", savesetting );
  302.  
  303. newelemtxt3.innerHTML="Clear all saved settings.";
  304. newelemtxt3.id="clear";
  305. newelemtxt3.style.cursor="pointer";
  306. newelemtxt3.addEventListener("click", clearsettings );
  307.  
  308. newelemsw.firstChild.data = "Thumbnail zoom off.";
  309. newelemsw.getElementsByClassName("dmSwitchCircle")[0].id="a1";
  310. newelemsw.addEventListener("click", zoomoff );
  311.  
  312. newelemsw2.firstChild.data = "Preview rooms off.";
  313. newelemsw2.getElementsByClassName("dmSwitchCircle")[0].id="a2";
  314. newelemsw2.addEventListener("click", anionoff );
  315.  
  316. newelemsw3.firstChild.data = "Open rooms in new tab.";
  317. newelemsw3.getElementsByClassName("dmSwitchCircle")[0].id="a3";
  318. newelemsw3.addEventListener("click", newtabon );
  319.  
  320. newelemsw4.firstChild.data = "Auto refresh followed off.";
  321. newelemsw4.getElementsByClassName("dmSwitchCircle")[0].id="a4";
  322. newelemsw4.addEventListener("click", refreshoff );
  323.  
  324. newelemsw5.firstChild.data = "Hide male/trans.";
  325. newelemsw5.getElementsByClassName("dmSwitchCircle")[0].id="a5";
  326. newelemsw5.addEventListener("click", hidemt );
  327.  
  328. document.getElementById('UserMenuDropDown').appendChild(newelemtxt);
  329.  
  330. if (discoverpage){newelemsw.style.display="none";}
  331. document.getElementById('UserMenuDropDown').appendChild(newelemsw);
  332.  
  333. if (supporter){newelemsw2.style.display="none";}
  334. document.getElementById('UserMenuDropDown').appendChild(newelemsw2);
  335.  
  336. document.getElementById('UserMenuDropDown').appendChild(newelemsw3);
  337.  
  338. if (!login){newelemsw4.style.display="none";}
  339. document.getElementById('UserMenuDropDown').appendChild(newelemsw4);
  340.  
  341. document.getElementById('UserMenuDropDown').appendChild(newelemsw5);
  342.  
  343. if (login){
  344. document.getElementById('UserMenuDropDown').appendChild(newelemtxt2);
  345. document.getElementById('UserMenuDropDown').appendChild(newelemtxt3);
  346. }
  347. setsw();
  348. }
  349.  
  350. function setsw(){
  351. if (localStorage.getItem("hidemt")){
  352. document.getElementById("a5").style.left="25px";
  353. }else{
  354. document.getElementById("a5").style.left="3px";
  355. }
  356. if (localStorage.getItem("refreshoff")){
  357. document.getElementById("a4").style.left="25px";
  358. }else{
  359. document.getElementById("a4").style.left="3px";
  360. }
  361.  
  362. if (localStorage.getItem("newtabon")){
  363. document.getElementById("a3").style.left="25px";
  364. }else{
  365. document.getElementById("a3").style.left="3px";
  366. }
  367.  
  368. if (localStorage.getItem("animationoff")){
  369. document.getElementById("a2").style.left="25px";
  370. }else{
  371. document.getElementById("a2").style.left="3px";
  372. }
  373.  
  374. if (localStorage.getItem("zoomoff")){
  375. document.getElementById("a1").style.left="25px";
  376. }else{
  377. document.getElementById("a1").style.left="3px";
  378. }
  379. if (roomname=="discover"){
  380. return;
  381. }else{
  382. if(document.getElementById("movestyle")!=null){document.getElementById("movestyle").remove();}
  383. if(document.getElementById("nomovestyle")!=null){document.getElementById("nomovestyle").remove();}
  384. if(localStorage.getItem("zoomoff")){
  385. setnomovestyle();
  386. }else{
  387. setmovestyle();
  388. }
  389. }
  390. }
  391.  
  392. function hidemt(){
  393. if (document.getElementById("a5").style.left=="3px"){
  394. document.getElementById("a5").style.left="25px";
  395. localStorage.setItem("hidemt","foo");
  396.  
  397. }else{ // staat right
  398. document.getElementById("a5").style.left="3px";
  399. localStorage.removeItem("hidemt");
  400. }
  401. }
  402. function refreshoff(){
  403. if (document.getElementById("a4").style.left=="3px"){
  404. document.getElementById("a4").style.left="25px";
  405. localStorage.setItem("refreshoff","foo");
  406.  
  407. }else{ // staat right
  408. document.getElementById("a4").style.left="3px";
  409. localStorage.removeItem("refreshoff");
  410. }
  411. }
  412. function newtabon(){
  413. if (document.getElementById("a3").style.left=="3px"){
  414. document.getElementById("a3").style.left="25px";
  415. localStorage.setItem("newtabon","foo");
  416.  
  417. }else{ // staat right
  418. document.getElementById("a3").style.left="3px";
  419. localStorage.removeItem("newtabon");
  420. }
  421. }
  422. function anionoff(){
  423. if (document.getElementById("a2").style.left=="3px"){
  424. document.getElementById("a2").style.left="25px";
  425. localStorage.setItem("animationoff","foo");
  426.  
  427. }else{ // staat right
  428. document.getElementById("a2").style.left="3px";
  429. localStorage.removeItem("animationoff");
  430. }
  431. }
  432. function zoomoff(){
  433. if (document.getElementById("a1").style.left=="3px"){
  434. document.getElementById("a1").style.left="25px";
  435. localStorage.setItem("zoomoff","foo");// set item
  436. if (document.getElementById("movestyle")!=null){document.getElementById("movestyle").remove();}
  437. setnomovestyle();
  438. }else{// staat right
  439. document.getElementById("a1").style.left="3px";
  440. localStorage.removeItem("zoomoff");
  441. if (document.getElementById("nomovestyle")!=null){document.getElementById("nomovestyle").remove();}
  442. setmovestyle();
  443. }
  444. }
  445.  
  446.  
  447. function savesetting(){
  448. document.getElementById("saved").removeEventListener("click", savesetting );
  449. var theme_name="lightmode";
  450. if (readCookie("theme_name")){
  451. theme_name=readCookie("theme_name");
  452. }
  453. var hidemt=0;
  454. if (localStorage.getItem("hidemt")){
  455. hidemt=1;
  456. }
  457. var newtabon=0;
  458. if (localStorage.getItem("newtabon")){
  459. newtabon=1;
  460. }
  461. var refreshoff=0;
  462. if (localStorage.getItem("refreshoff")){
  463. refreshoff=1;
  464. }
  465. var zoomoff=0;
  466. if (localStorage.getItem("zoomoff")){
  467. zoomoff=1;
  468. }
  469. var animationoff=0;
  470. if (localStorage.getItem("animationoff")){
  471. animationoff=1;
  472. }
  473. var cleanprof=0;
  474. if (localStorage.getItem("pclean")){
  475. cleanprof=1;
  476. }
  477. var isTheaterMode=localStorage.getItem("isTheaterMode");
  478. var defaultVideoWidth =localStorage.getItem("defaultVideoWidth");
  479. var videoControls =localStorage.getItem("videoControls");
  480. var hmpgFiltAllParams = sessionStorage.getItem("hmpgFiltAllParams");
  481. var hpfltopen=localStorage.getItem("hpfltopen");
  482.  
  483. var allstring="good boy#refreshoff#"+refreshoff+"#hidemt#"+hidemt+"#newtabon#"+newtabon+"#zoomoff#"+zoomoff+"#animationoff#"+animationoff+"#cleanprof#"+cleanprof+"#isTheaterMode#"+isTheaterMode+"#defaultVideoWidth#"+defaultVideoWidth+"#videoControls#"+videoControls+"#theme_name#"+theme_name+"#hmpgFiltAllParams#"+hmpgFiltAllParams+"#hpfltopen#"+hpfltopen;
  484. var url="https://chaturbate.com/api/notes/for_user/"+stor+"/";
  485. var csrftoken= readCookie("csrftoken");
  486. var data = new FormData();
  487. data.append( "text", allstring );
  488. fetch(url,
  489. {
  490. method: "POST",
  491. headers: {
  492. 'x-csrftoken': csrftoken,
  493. 'x-requested-with': 'XMLHttpRequest'
  494. },
  495. body: data
  496. }).then(function(){document.getElementById("saved").innerHTML="Settings saved";setTimeout(function(){document.getElementById("saved").innerHTML="Save all settings.";document.getElementById("saved").addEventListener("click", savesetting );},2000);});
  497. }
  498.  
  499. function clearsettings(){
  500. document.getElementById("clear").removeEventListener("click", clearsettings );
  501. var url="https://chaturbate.com/api/notes/for_user/"+stor+"/";
  502. var csrftoken= readCookie("csrftoken");
  503. var data = new FormData();
  504. data.append( "text", "" );
  505. fetch(url,
  506. {
  507. method: "POST",
  508. headers: {
  509. 'x-csrftoken': csrftoken,
  510. 'x-requested-with': 'XMLHttpRequest'
  511. },
  512. body: data
  513. }).then(function(){document.getElementById("clear").innerHTML="Saved settings removed.";setTimeout(function(){document.getElementById("clear").innerHTML="Clear all saved settings.";document.getElementById("clear").addEventListener("click", clearsettings );},2000);});
  514. }
  515.  
  516. function getsaving(){
  517. if (!login){
  518. localStorage.removeItem("login");
  519. return;
  520. }else{
  521. if (localStorage.getItem("login")){
  522. return;
  523. }
  524. }
  525. localStorage.setItem("login","foo");
  526. var url="https://chaturbate.com/api/notes/for_user/"+stor+"/";
  527. fetch(url,{ credentials: "same-origin"}).then(
  528. function(response) {
  529. if (response.status !== 200) {
  530. return;
  531. }
  532. response.json().then(function(data) {
  533. if (data.text == null){return;}
  534. restoresettings(data.text);
  535. });
  536. });
  537. }
  538.  
  539. function restoresettings(data){
  540. if (data.indexOf("good boy")!=0){return;}
  541. var refreshoff=data.split("refreshoff#")[1].split("#")[0];
  542. localStorage.setItem("refreshoff","foo");
  543. if (refreshoff==0){localStorage.removeItem("refreshoff");}
  544.  
  545. var newtabon=data.split("newtabon#")[1].split("#")[0];
  546. localStorage.setItem("newtabon","foo");
  547. if (newtabon==0){localStorage.removeItem("newtabon");}
  548.  
  549. if (data.indexOf("hidemt#")!=-1){
  550. var hidemt=data.split("hidemt#")[1].split("#")[0];
  551. localStorage.setItem("hidemt","foo");
  552. if (hidemt==0){localStorage.removeItem("hidemt");}
  553. }
  554.  
  555. var zoomoff=data.split("zoomoff#")[1].split("#")[0];
  556. localStorage.setItem("zoomoff","foo");
  557. if (zoomoff==0){localStorage.removeItem("zoomoff");}
  558.  
  559. var animationoff=data.split("animationoff#")[1].split("#")[0];
  560. localStorage.setItem("animationoff","foo");
  561. if (animationoff==0){localStorage.removeItem("animationoff");}
  562.  
  563. var cleanprof=data.split("cleanprof#")[1].split("#")[0];
  564. localStorage.setItem("pclean","foo");
  565. if (cleanprof==0){localStorage.removeItem("pclean");}
  566.  
  567. var isTheaterMode=data.split("isTheaterMode#")[1].split("#")[0];
  568. localStorage.setItem("isTheaterMode",isTheaterMode);
  569.  
  570. var defaultVideoWidth=data.split("defaultVideoWidth#")[1].split("#")[0];
  571. localStorage.setItem("defaultVideoWidth",defaultVideoWidth);
  572.  
  573. var videoControls=data.split("videoControls#")[1].split("#")[0];
  574. localStorage.setItem("videoControls",videoControls);
  575.  
  576. var hmpgFiltAllParams=data.split("hmpgFiltAllParams#")[1].split("#")[0];
  577. sessionStorage.setItem("hmpgFiltAllParams",hmpgFiltAllParams);
  578.  
  579. var exp=new Date().getTime()+86400000;
  580. var x='{"value":"'+hmpgFiltAllParams+'","expiration":'+exp+'}';
  581. localStorage.setItem("hmpgFiltAllParams",x);
  582.  
  583. var hpfltopen=data.split("hpfltopen#")[1].split("#")[0];
  584. hpfltopen=hpfltopen.split('expiration":')[0]+'expiration":'+exp+'}';
  585. localStorage.setItem("hpfltopen",hpfltopen);
  586.  
  587. var theme_name=data.split("theme_name#")[1].split("#")[0];
  588. createCookie("theme_name",theme_name);
  589.  
  590. document.location.reload();
  591. }
  592.  
  593. //===============bio
  594. function dobiothings(){
  595. hidemtenter();
  596. if(ppage){
  597. if (currpage.split("model=").length==1){return;}
  598. roomname=currpage.split("model=")[1].split("&")[0];
  599. rebuildbio();
  600. }else{
  601. afterrebuild();
  602. }
  603. }
  604.  
  605. function afterrebuild(){
  606. bio=true;
  607. if(ppage){
  608. document.querySelector('[data-testid="bio-header"]').innerHTML="<a href='https://chaturbate.com/"+roomname+"?tab=bio' id=biotop>"+roomname.charAt(0).toUpperCase()+roomname.slice(1)+"'s Bio</a>";
  609. }else{
  610. document.querySelector('[data-testid="bio-header"]').innerHTML="<a href='https://chaturbate.com/p/"+yourname+"?tab=bio&model="+roomname+"' id=biotop>"+roomname.charAt(0).toUpperCase()+roomname.slice(1)+"'s Bio and Free Webcam</a>";
  611. }
  612. document.getElementById("biotop").addEventListener("click", function(event){window.location.replace(this.href);event.stopPropagation();event.preventDefault();return false;});
  613. makevidcontrol();
  614. cleaninit();
  615. linkfix();
  616. info();
  617. buildnotepop();
  618. getnoteslist();
  619. if (document.getElementsByTagName("video").length>0){
  620. getvid();
  621. vreset();
  622. pmlistner();
  623. iagree();
  624. }
  625. }
  626.  
  627. function dothumbpagethings(){
  628. if (!discoverpage){
  629. refresher();
  630. }
  631. buildnotepop();
  632. getnoteslist();
  633. return;
  634. }
  635.  
  636. //------ agree room rules and messages
  637. function iagree(){
  638. triggerMouseEvent (document.getElementsByClassName("inputDiv")[0], "mousedown");
  639. if (document.getElementsByClassName("acceptRulesButton").length>0){
  640. document.getElementsByClassName("acceptRulesButton")[0].click();
  641. }
  642. if (document.querySelector('[data-testid="dismissible-message-dismiss"]')){
  643. document.querySelector('[data-testid="dismissible-message-dismiss"]').click();
  644. }
  645. }
  646.  
  647. function triggerMouseEvent (node, eventType) {
  648. var clickEvent = new Event(eventType, { bubbles: true, cancelable: true });
  649. node.dispatchEvent (clickEvent);
  650. }
  651.  
  652. // set styles ,
  653. function setgenstyle(){
  654. var style = document.createElement('style');
  655. style.setAttribute('type', 'text/css');
  656. style.textContent = ".userUpload img{display:none}"+
  657. ".lockOverlayBg {background-color:rgba(0, 0, 0, 0) !important;top:50% !important}"+
  658. ".lockOverlayBg img{display:none}"+
  659. ".userUpload div{background-color:rgba(0, 0, 0, 0) !important}"+
  660. ".previewBorder {display:block !important}"+
  661. ".previewText {color:black !important}"+
  662. ".photoVideoDetailSection img{filter: blur(0px) !important;height:auto !important;width:auto !important; margin-left: auto;margin-right: auto;display:block;min-width:50%;min-height:50%;max-width:100%;max-height:100%}"+
  663. ".BioContents{position:relative !important}"+
  664. ".bioContentText div{background-color:rgba(0, 0, 0, 0) !important}"+
  665. ".cbLogo {display:none !important}";
  666. document.getElementsByTagName('head')[0].appendChild(style);
  667. }
  668.  
  669. function setmovestyle(){
  670. var style = document.createElement('style');
  671. style.id="movestyle";
  672. style.setAttribute('type', 'text/css');
  673. style.textContent = ".content{overflow: visible; !important ;margin-right:33px !important;margin-left:33px !important}"+
  674. ".followedDropdown{z-index:50 !important}"+
  675. ".list{overflow: visible !important}"+
  676. ".MoreRooms{overflow: visible !important}"+
  677. ".roomCard {transition: .3s}"+
  678. ".roomCard:hover {transform: scale(1.37);border-color:red;z-index:20}";
  679. document.getElementsByTagName('head')[0].appendChild(style);
  680. }
  681.  
  682. function setnomovestyle(){
  683. var style = document.createElement('style');
  684. style.id="nomovestyle";
  685. style.setAttribute('type', 'text/css');
  686. style.textContent =".content{overflow: visible; !important ;margin-right:33px !important;margin-left:33px !important}"+
  687. ".roomCard {transition: .1s}"+
  688. ".roomCard:hover {border-color:red}";
  689. document.getElementsByTagName('head')[0].appendChild(style);
  690. }
  691.  
  692. function setdiscoverstyle(){
  693. var style = document.createElement('style');
  694. style.setAttribute('type', 'text/css');
  695. style.textContent =".roomCard {transition: .1s}"+
  696. ".roomCard:hover {border-color:red}";
  697. document.getElementsByTagName('head')[0].appendChild(style);
  698. }
  699.  
  700. function setadstyle(){
  701. var style = document.createElement('style');
  702. style.setAttribute('type', 'text/css');
  703. style.textContent = ".ad {padding: 0px;overflow:hidden; font-weight: bold;color:white;border-radius:5px}"+
  704. ".adinfo {position: relative; display: flex; height: 100%; width: 940px; right:0px}"+
  705. ".adinfo {transition: 1.0s ease-in-out}"+
  706. ".adinfo:hover {right: 472px }"+
  707. ".adscriptinfo {display:block;height:100%;width:468px}";
  708. document.getElementsByTagName('head')[0].appendChild(style);
  709. }
  710.  
  711. // get usernotelist , continues to setupmove
  712. function getnoteslist(){
  713. if(!login){usernoteslist="";whatpage();return;}
  714. var url="https://chaturbate.com/api/notes/usernames/";
  715. fetch(url,{ credentials: "same-origin"}).then(
  716. function(response) {
  717. if (response.status !== 200){
  718. return;
  719. }
  720. response.json().then(function(data) {
  721. usernoteslist=data;
  722. }).then(whatpage);
  723. });
  724. }
  725.  
  726. function whatpage(){
  727. setupfollowmove();
  728. if (thumbpage){setupmove();}
  729. if (bio){setupbiomove();}
  730. if (discoverpage){
  731. setInterval(addevent2,5000);
  732. }
  733. }
  734.  
  735. //observer on followed thumbs
  736. function setupfollowmove(){
  737. var observenode=document.getElementsByClassName("followedDropdown")[0];
  738. observer6.observe(observenode,observerConfig6); // calls adjustfollowthumbs
  739. }
  740.  
  741. function adjustfollowhumbs(){
  742. if (document.getElementsByClassName("followedDropdown")[0].style.display!="block"){return;}
  743. addevent2();
  744. }
  745.  
  746.  
  747. // observer on the page thumbnails
  748. function setupmove(){
  749. var observenode=document.getElementsByClassName("list")[0];
  750. observer4.observe(observenode,observerConfig4); // calls adjustthumbs
  751. adjusthumbs();
  752. addevent2();
  753. }
  754.  
  755. function adjusthumbs(){
  756. subsel();
  757. if (document.getElementsByClassName("list")[0].classList.contains("loading")){return;}
  758. document.getElementById("notepop").style.display="none";
  759. if (document.getElementsByClassName("list").length>1){
  760. var observenode=document.getElementsByClassName("list")[1];
  761. observer41.observe(observenode,observerConfig4);
  762. setTimeout(addevent2, 1000);
  763. }else{
  764. addevent2();
  765. }
  766. }
  767.  
  768. // adjust thumbs on bio more rroms like this
  769. function setupbiomove(){
  770. if (ppage){return;}
  771. var observenode=document.querySelector('[data-testid="more-rooms-like-this-tab-contents"]').firstChild;
  772. observer5.observe(observenode,observerConfig5);
  773. addevent2();
  774. }
  775.  
  776. function adjustbiohumbs(){
  777. if (ppage){return;}
  778. if(document.querySelector('[data-testid="more-rooms-like-this-tab-contents"]').firstChild.style.display=="block"){return;}
  779. addevent2();
  780. }
  781.  
  782. //====== put event and note symbol in the thumbnails
  783. function addevent2(){
  784. hidemtenter();
  785. var hidrooms=0;
  786. if (currpage!=document.location.href){
  787. document.getElementById("notepop").style.display="none";
  788. }
  789. currpage=document.location.href;
  790. var tags=document.querySelectorAll('[data-testid="room-card-image"]');
  791. for (n=0; n<tags.length; n++){
  792.  
  793. if (localStorage.getItem("hidemt")){
  794. if(tags[n].parentNode.parentNode.querySelector('[data-testid="room-card-gender"]')){
  795. if ((tags[n].parentNode.parentNode.querySelector('[data-testid="room-card-gender"]').title=="Male")||(tags[n].parentNode.parentNode.querySelector('[data-testid="room-card-gender"]').title=="Trans")){
  796. tags[n].parentNode.parentNode.style.display="none";
  797. hidrooms++;
  798. }
  799. }
  800. }
  801.  
  802. if(!tags[n].name){
  803. tags[n].parentNode.href=tags[n].parentNode.href+"?tab=bio";
  804. tags[n].parentNode.addEventListener("click", function(event){var target="_self";if (localStorage.getItem("newtabon")){target="_blank";}window.open(this.href, target);event.stopPropagation();event.preventDefault();return false;});
  805. tags[n].name="Camslut";
  806. if (!supporter){
  807. tags[n].parentNode.parentNode.addEventListener("mouseenter", moveimg);
  808. tags[n].parentNode.parentNode.addEventListener("mouseleave", moveimgstop);
  809. }
  810. var name=tags[n].parentNode.parentNode.querySelector('[data-testid="room-card-username"]');
  811. var thumbroomname=name.innerHTML;
  812. if (loggedin){
  813. name.href="https://chaturbate.com/p/"+yourname+"/?tab=bio&model="+thumbroomname;
  814. }
  815. name.addEventListener("click", function(event){var target="_self";if (localStorage.getItem("newtabon")){target="_blank";}window.open(this.href, target);event.stopPropagation();event.preventDefault();return false;});
  816. if (usernoteslist!=""){ // not loggedin
  817. if (tags[n].parentNode.parentNode.className=="roomCard camBgColor"){
  818. var newelem=document.createElement('div');
  819. if (usernoteslist.usernames.indexOf(thumbroomname)!=-1){
  820. newelem.innerHTML=note;
  821. }else{
  822. newelem.innerHTML=nonote;
  823. }
  824. newelem.style.position="absolute";
  825. newelem.style.top="0px";
  826. newelem.style.left="0px";
  827. newelem.addEventListener("click", shownote );
  828. newelem.style.cursor="pointer";
  829. newelem.setAttribute("name", thumbroomname);
  830. newelem.name=thumbroomname;
  831. newelem.title="User notes";
  832. tags[n].parentNode.parentNode.appendChild(newelem);
  833. }
  834. }
  835. }
  836. }
  837.  
  838. var mymsgline=0;
  839. if (document.location.href.split("/")[3]=="spy-on-cams"){
  840. mymsgline=1;
  841. }
  842. var msglines=document.querySelectorAll('[data-testid="num-of-rooms-msg"]');
  843. var msglinesleng=msglines.length;
  844.  
  845. if (msglinesleng !=0){
  846. msglines[0].style.display="block";
  847.  
  848. if (mymsgline == 1){
  849. msglines[1].style.display="block";
  850. }
  851. if (localStorage.getItem("hidemt")){
  852. var msg=msglines[mymsgline].innerHTML.split("filters")[0]+"filters";
  853. msglines[mymsgline].innerHTML=msg+". "+hidrooms+" on this page are hidden.";
  854. }
  855. }
  856. hidrooms=0;
  857. showhidden();
  858. }
  859.  
  860. function showhidden(){
  861. if (document.location.href.split("/")[3]=="spy-on-cams"){showhidden4();return;}
  862. if (document.location.href.split("/")[3]!="followed-cams"){return;}
  863. if (document.location.href.split("/")[4]=="offline"){return;}
  864. if (!document.querySelector('[data-testid="room-card-image"]')){return;}
  865. if (document.querySelector('[data-testid="room-card-image"]').name=="hid"){return;}
  866. document.querySelector('[data-testid="room-card-image"]').name="hid";
  867. hidoffset=0;
  868. hiddenarray=[];
  869. showhidden2();
  870. }
  871.  
  872. function showhidden2(){
  873. if (hprom){return;}
  874. hprom=true;
  875. var url=hidurl+hidoffset*90;
  876. fetch(url,{ credentials: "same-origin"}).then(
  877. function(response) {
  878. if (response.status !== 200) {
  879. hprom=false;
  880. return;
  881. }
  882. response.json().then(function(data){
  883. if (data.rooms != null){
  884. var hiddenlist=data.rooms;
  885. for (n=0; n<hiddenlist.length; n++){
  886. hiddenarray.push(hiddenlist[n].username);
  887. }
  888. var pages=Math.ceil(data.total_count/90);//1.....
  889. hidoffset++;//0.....
  890. if (hidoffset!=pages){
  891. hprom=false;
  892. showhidden2();
  893. }else{
  894. hprom=false;
  895. showhidden3();
  896. }
  897. }
  898. });
  899. });
  900. }
  901.  
  902. function showhidden3(){
  903. var tags=document.querySelector('[data-testid="room-list-container"]').querySelectorAll('[data-testid="room-card"]');
  904. for (n=0; n<tags.length; n++){
  905. var name=tags[n].querySelector('[data-testid="room-card-username"]').innerHTML;
  906. if (hiddenarray.indexOf(name)!=-1){
  907. tags[n].querySelector('[data-testid="thumbnail-label"]').innerHTML=tags[n].querySelector('[data-testid="thumbnail-label"]').innerHTML+" HIDDEN ";
  908. tags[n].querySelector('[data-testid="thumbnail-label"]').style.backgroundColor = "blue";
  909. }
  910. }
  911. }
  912.  
  913. function showhidden4(){
  914. if (document.querySelectorAll('[data-testid="room-list-container"]')[1].querySelector('[data-testid="room-card-image"]').name=="hid"){return;}
  915. document.querySelectorAll('[data-testid="room-list-container"]')[1].querySelector('[data-testid="room-card-image"]').name="hid";
  916. var tags=document.querySelectorAll('[data-testid="room-list-container"]')[1].querySelectorAll('[data-testid="room-card"]');
  917. for (n=0; n<tags.length; n++){
  918. tags[n].querySelector('[data-testid="thumbnail-label"]').innerHTML=tags[n].querySelector('[data-testid="thumbnail-label"]').innerHTML+" HIDDEN ";
  919. tags[n].querySelector('[data-testid="thumbnail-label"]').style.backgroundColor = "blue";
  920. }
  921. }
  922.  
  923. //----------------------------------- show note
  924. function shownote(e){
  925. if(( document.getElementById("notepop").style.display=="block")&&(openthumbname==this.name)){
  926. document.getElementById("notepop").style.display="none";
  927. openthumbname="";
  928. return;
  929. }
  930. document.getElementById("notepop").style.height="170px";
  931. document.getElementById("notearea").value="";
  932. document.getElementById("notenote").innerHTML=notegrey + " Note";
  933. opennote="";
  934. openthumbname=this.name;
  935. var xpos=e.pageX;
  936. document.getElementById("notearea").innerHTML="";
  937. document.getElementById("notepop").style.top=e.pageY+100+"px";
  938. document.getElementById("notepop").style.left=xpos+20+"px";
  939. document.getElementById("notepop").style.display="block";
  940. document.getElementById("notepopName").innerHTML=openthumbname;
  941.  
  942. var url="https://chaturbate.com/api/notes/for_user/"+openthumbname+"/";
  943. fetch(url,{ credentials: "same-origin"}).then(
  944. function(response) {
  945. if (response.status !== 200) {
  946. return;
  947. }
  948. response.json().then(function(data){
  949. if (data.text != null){
  950. document.getElementById("notearea").value=data.text;
  951. opennote=data.text;
  952. if (usernoteslist.usernames.indexOf(openthumbname)==-1){
  953. usernoteslist.usernames.push(openthumbname);
  954. updatedm2();
  955. }
  956. }
  957. });
  958. });
  959. }
  960.  
  961. function buildnotepop(){
  962. var newelem=document.createElement('span');
  963. newelem.id="notepop";
  964. newelem.style.display="none";
  965. newelem.style.position="absolute";
  966. newelem.style.overflow="hidden";
  967. newelem.style.backgroundColor="rgb(255, 255, 255)";
  968. newelem.style.border="1px solid rgb(221, 221, 221)";
  969. newelem.style.borderRadius="4px";
  970. newelem.style.width="188px";
  971. newelem.style.height="170px";
  972. newelem.style.zIndex="999";
  973. newelem.style.boxShadow="0px 0px 32px rgba(0, 0, 0, 0.32)";
  974. document.getElementById("footer-holder").appendChild(newelem);
  975.  
  976. newelem=document.createElement('div');
  977. newelem.style.backgroundColor = "#dddddd";
  978. newelem.style.color="grey";
  979. newelem.style.fontWeight="bold";
  980. newelem.style.height="15px";
  981. newelem.style.fontSize="15px";
  982. newelem.style.padding="8px";
  983. newelem.style.textAlign="left";
  984. newelem.innerHTML='<span id="notepopName" style="text-Overflow: ellipsis; overflow:hidden; width:150px; height:20px; display:inline-block" ></span><span><img src="https://web.static.mmcdn.com/tsdefaultassets/close-gray.svg" style="position: absolute; height: 13px; width: 13px; right: 8px;" title="Close" id="noteclose"></span>';
  985. document.getElementById("notepop").appendChild(newelem);
  986.  
  987. document.getElementById("noteclose").addEventListener("click", notepopclose);
  988.  
  989. newelem=document.createElement('div');
  990. newelem.style.backgroundColor = "white";
  991. newelem.style.border="1px solid rgb(221, 221, 221)";
  992. newelem.style.color="grey";
  993. newelem.style.height="15px";
  994. newelem.style.fontSize="12px";
  995. newelem.style.padding="8px";
  996. newelem.style.textAlign="left";
  997. newelem.style.cursor="pointer";
  998. newelem.addEventListener("click", function(){opendm2(document.getElementById("notepopName").innerHTML);});
  999. newelem.id="notepopLink";
  1000. newelem.innerHTML='<img src="https://web.static.mmcdn.com/tsdefaultassets/popout-grey-d.svg" height="12px" width="12px"> Popout in new window';
  1001. document.getElementById("notepop").appendChild(newelem);
  1002.  
  1003. newelem=document.createElement('div');
  1004. newelem.style.backgroundColor = "white";
  1005. newelem.style.color="grey";
  1006. newelem.style.height="10px";
  1007. newelem.style.fontSize="12px";
  1008. newelem.style.padding="8px";
  1009. newelem.style.textAlign="left";
  1010. newelem.id="notenote";
  1011. newelem.innerHTML=notegrey + " Note";
  1012. document.getElementById("notepop").appendChild(newelem);
  1013.  
  1014. newelem=document.createElement('textarea');
  1015. newelem.id="notearea";
  1016. newelem.style.height="60px";
  1017. newelem.style.fontSize="12px";
  1018. newelem.style.border="1px solid rgb(172, 172, 172)";
  1019. newelem.style.borderRadius="4px";
  1020. newelem.style.backgroundColor="rgb(255, 255, 255)";
  1021. newelem.style.resize="none";
  1022. newelem.style.padding="5px";
  1023. newelem.style.width="85%";
  1024. newelem.setAttribute("placeholder", "Enter notes about this user (only seen by you)");
  1025. newelem.setAttribute("spellcheck", false);
  1026. newelem.addEventListener("input",openbutton);
  1027. newelem.id="notearea";
  1028. document.getElementById("notepop").appendChild(newelem);
  1029.  
  1030. newelem=document.createElement('div');
  1031. newelem.id="notecancelsubmit";
  1032. document.getElementById("notepop").appendChild(newelem);
  1033.  
  1034. newelem=document.createElement("span");
  1035. newelem.style.position="relative";
  1036. newelem.style.top="12px";
  1037. newelem.style.left="-15px";
  1038. newelem.addEventListener("click",closebutton);
  1039. newelem.innerHTML='<a href="#" >Cancel</a>';
  1040. document.getElementById("notecancelsubmit").appendChild(newelem);
  1041.  
  1042. var subbutstyle="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; padding: 4px 10px 5px; position: relative; right: 40px; top:10px; float: right; border-radius: 4px; cursor: pointer;";
  1043.  
  1044. newelem=document.createElement("span");
  1045. newelem.setAttribute("style", subbutstyle);
  1046. newelem.addEventListener("click",savenote);
  1047. newelem.innerHTML="Save";
  1048. document.getElementById("notecancelsubmit").appendChild(newelem);
  1049. }
  1050.  
  1051. function savenote(){
  1052. var notetext=document.getElementById("notearea").value;
  1053. var url="https://chaturbate.com/api/notes/for_user/"+openthumbname+"/";
  1054. var csrftoken= readCookie("csrftoken");
  1055. var data = new FormData();
  1056. data.append( "text", notetext );
  1057. fetch(url,
  1058. {
  1059. method: "POST",
  1060. headers: {
  1061. 'x-csrftoken': csrftoken,
  1062. 'x-requested-with': 'XMLHttpRequest'
  1063. },
  1064. body: data
  1065. }).then(aftersave);
  1066. }
  1067.  
  1068. function aftersave(){
  1069. var notetext=document.getElementById("notearea").value;
  1070. var doupdate=false;
  1071. if ((opennote=="")||(notetext=="")){
  1072. doupdate=true;
  1073. }
  1074. opennote=notetext;
  1075. closebutton();
  1076. if (doupdate){updatedm();}
  1077. }
  1078.  
  1079. function notepopclose(){
  1080. document.getElementById("notepop").style.display="none";
  1081. }
  1082.  
  1083. function openbutton(){
  1084. document.getElementById("notepop").style.height="215px";
  1085. document.getElementById("notenote").innerHTML=notegrey + " Note (unsaved)";
  1086. document.getElementById("notearea").value=document.getElementById("notearea").value.replace("$"," "+new Date().toLocaleDateString()+" ");
  1087. if(opennote==document.getElementById("notearea").value){
  1088. closebutton();
  1089. }
  1090. }
  1091. function closebutton(){
  1092. document.getElementById("notenote").innerHTML=notegrey + " Note";
  1093. document.getElementById("notepop").style.height="170px";
  1094. document.getElementById("notearea").value=opennote;
  1095. }
  1096.  
  1097. function opendm2(that){
  1098. var url="http://chaturbate.com/dm/"+that;
  1099. var dmwindow=window.open(url,that,'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=800,height=800');
  1100. dmwindow.onload = function(){
  1101. this.addEventListener('unload', function(){setTimeout(function(){updatedm();},1000);});
  1102. };
  1103. }
  1104.  
  1105. function updatedm(){
  1106. var url="https://chaturbate.com/api/notes/usernames/";
  1107. fetch(url,{ credentials: "same-origin"}).then(
  1108. function(response) {
  1109. if (response.status !== 200){
  1110. return;
  1111. }
  1112. response.json().then(function(data) {
  1113. usernoteslist=data;
  1114. }).then(updatedm2);
  1115. });
  1116. }
  1117.  
  1118. function updatedm2(){
  1119. var tags=document.querySelectorAll('[title="User notes"]');
  1120. for (n=0; n<tags.length; n++){
  1121. if (usernoteslist.usernames.indexOf(tags[n].getAttribute("name"))!=-1){
  1122. tags[n].innerHTML=note;
  1123. }else{
  1124. tags[n].innerHTML=nonote;
  1125. }
  1126. }
  1127. }
  1128.  
  1129. //------------------------------
  1130. function moveimg(){
  1131. if(localStorage.getItem("animationoff")){return;}
  1132. thisfap=this;
  1133. fapbr=thisfap.getElementsByTagName("img")[0].src.split("/")[4].split("?")[0];
  1134. cimg.addEventListener("load",regetimg);
  1135. cimg.src = "https://jpeg.live.mmcdn.com/minifwap/"+fapbr+"?f="+ new Date().getTime();
  1136. }
  1137.  
  1138. //-------------------------
  1139.  
  1140. function moveimgstop(){ // comes from holder
  1141. cimg.removeEventListener("load",regetimg);
  1142. }
  1143.  
  1144. //--------------------------
  1145. function regetimg(){
  1146. thisfap.getElementsByTagName("img")[0].src=cimg.src;
  1147. setTimeout(function(){ cimg.src = "https://jpeg.live.mmcdn.com/minifwap/"+fapbr+"?f="+ new Date().getTime();}, 50);//~6fps at 100ms load time
  1148. }
  1149.  
  1150. function refresher(){
  1151. document.addEventListener("visibilitychange", function(){
  1152. if (document.hidden){return;}
  1153. if (roomname=="followed-cams"){
  1154. if (!localStorage.getItem("refreshoff")){
  1155. location.reload();
  1156. }
  1157. }
  1158. setsw();
  1159. });
  1160. }
  1161.  
  1162. function noadd(){
  1163. if (document.getElementsByClassName('ad').length>0){ // 468*60
  1164. document.getElementsByClassName('ad')[0].innerHTML="";
  1165.  
  1166. var newelem=document.createElement('div');
  1167. newelem.className="adinfo";
  1168.  
  1169. var newdiv=document.createElement('div');
  1170. newdiv.id="scriptinfo";
  1171. newdiv.className="adscriptinfo";
  1172. newdiv.style.backgroundColor="darkred";
  1173. newelem.appendChild(newdiv);
  1174.  
  1175. newdiv=document.createElement('div');
  1176. newdiv.style.width="4px";
  1177. newdiv.style.backgroundColor="white";
  1178. newelem.appendChild(newdiv);
  1179.  
  1180. newdiv=document.createElement('div');
  1181. newdiv.id="userinfo";
  1182. newdiv.className="adscriptinfo";
  1183. newdiv.style.backgroundColor="darkblue";
  1184. newelem.appendChild(newdiv);
  1185. document.getElementsByClassName('ad')[0].appendChild(newelem);
  1186. var info=scriptname+" version "+version+" is active.";
  1187. newdiv=document.createElement('div');
  1188. newdiv.style.margin="5px";
  1189. if (!readCookie("goodboy")){
  1190. if (!login){
  1191. info=info+"<br>Support this script, <a href='"+tour+"'>create a new account.</a>";
  1192. if(document.querySelector('[data-testid="sign-up-tab"]')){
  1193. document.querySelector('[data-testid="sign-up-tab"]').href=tour;
  1194. }
  1195. }else{
  1196. info=info+"<br>Support this script, log out and create a new account.";
  1197. }
  1198. newdiv.innerHTML=info;
  1199. }else{
  1200. newdiv.innerHTML=info+"<br>Thank you for your support.";
  1201. }
  1202. document.getElementById("scriptinfo").appendChild(newdiv);
  1203.  
  1204. newdiv=document.createElement('div');
  1205. newdiv.style.margin="5px";
  1206. if (!localStorage.getItem("topinfo")){
  1207. newdiv.innerHTML="Info not yet available.";
  1208. }else{
  1209. var topinfo=localStorage.getItem("topinfo").split("{")[1].split("}")[0];
  1210. topinfo=topinfo.replace(/\[/g,"<");
  1211. topinfo=topinfo.replace(/\]/g,">");
  1212. newdiv.innerHTML=topinfo;
  1213. }
  1214. document.getElementById("userinfo").appendChild(newdiv);
  1215. }
  1216. }
  1217.  
  1218. function getmessage(){
  1219. if (!localStorage.getItem("topinfo")){
  1220. getmessage2();
  1221. return;
  1222. }
  1223. var exp=parseInt(localStorage.getItem("topinfo").split("{")[0].split("expires:")[1]);
  1224. if (exp<new Date().getTime()){
  1225. getmessage2();
  1226. }
  1227. }
  1228.  
  1229. function getmessage2(){
  1230. var url="https://chaturbate.com/api/chatvideocontext/"+stor+"/";
  1231. var topinfo="";
  1232. fetch(url,{ credentials: "omit"}).then(
  1233. function(response) {
  1234. if (response.status !== 200){
  1235. topinfo = "{An error occured retrieving the info}";
  1236. var exp=new Date().getTime()+3600000;
  1237. localStorage.setItem("topinfo","expires:"+exp+topinfo);
  1238. return;
  1239. }
  1240. response.json().then(function(roomdata) {
  1241. topinfo="{No info available}";
  1242. if (roomdata.chat_rules!=""){
  1243. topinfo=roomdata.chat_rules;
  1244. }
  1245. var exp=new Date().getTime()+14400000;
  1246. localStorage.setItem("topinfo","expires:"+exp+topinfo);
  1247. });
  1248. });
  1249.  
  1250.  
  1251.  
  1252. }
  1253.  
  1254. function aff(){
  1255. if (currpage=="https://chaturbate.com/accounts/welcome/"){createCookie("goodboy","1",14);return;}
  1256. if (currpage.split("?").length>1){
  1257. if (currpage.split("?")[1].indexOf("campaign=hgg5k")!=-1){// me as aff
  1258. createCookie("agreeterms","1",30);
  1259. if (!login){
  1260. document.location.href="https://chaturbate.com/accounts/register/?src=header&auipsrc=navbar";// direct to signup if not loggedd in on my tour
  1261. }
  1262. return;
  1263. }
  1264. if (currpage.split("?")[1].indexOf("campaign=")!=-1){ // some other aff
  1265. if(!login){
  1266. untrace();
  1267. document.location.href=tour;// go to my tour if not logged in
  1268. }
  1269. return;
  1270. }
  1271. }
  1272. if (currpage.split("?")[0]=="https://chaturbate.com/auth/login/"){// clear traces of other accounts when you login
  1273. localStorage.clear();
  1274. sessionStorage.clear();
  1275. }
  1276. if (currpage.split("?")[0]=="https://chaturbate.com/accounts/register/"){// signup from my tour
  1277. localStorage.clear();
  1278. sessionStorage.clear();
  1279. }
  1280. }
  1281. function untrace(){
  1282. var cookies = document.cookie.split("; ");
  1283. for (var c = 0; c < cookies.length; c++) {
  1284. var d = window.location.hostname.split(".");
  1285. while (d.length > 0) {
  1286. var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path=';
  1287. var p = location.pathname.split('/');
  1288. document.cookie = cookieBase + '/';
  1289. while (p.length > 0) {
  1290. document.cookie = cookieBase + p.join('/');
  1291. p.pop();
  1292. }
  1293. d.shift();
  1294. }
  1295. }
  1296. localStorage.clear();
  1297. sessionStorage.clear();
  1298. }
  1299.  
  1300. //===============================
  1301. function subsel(){
  1302. if (document.getElementById("subselection")){document.getElementById("subselection").remove();}
  1303. if((document.location.href.indexOf("spy-on-cams")==-1)&&(document.location.href.indexOf("followed-cams")==-1)&&(document.location.href.indexOf("/current_app_use/")==-1)){
  1304. var newelem=document.createElement('li');
  1305. newelem.id="subselection";
  1306. var data='<form><select id="subsel" style="margin: 0px 0px 0px 0px; background: #DDE9F5; color:#5E81A4; border-radius: 4px 4px 0px 0px;padding: 5px 1px 4px 12px; font-weight: 400; font-size: 13px; font-family: \'UbuntuMedium\',Arial,Helvetica,sans-serif;" >'+
  1307. '<option value="/XX-cams">ALL CAMS IN CATEGORY</option>'+
  1308. '<option value="/exhibitionist-cams/XX">EXHIBITIONIST CAMS</option>'+
  1309. '<option value="/gaming-cams/XX">GAMING CAMS</option>'+
  1310. '<option value="/new-cams/XX">NEW CAMS</option>'+
  1311. '<option value="/teen-cams/XX">TEEN CAMS (18+)</option>'+
  1312. '<option value="/18to21-cams/XX">18 TO 21 CAMS</option>'+
  1313. '<option value="/21to35-cams/XX">21 TO 35 CAMS</option>'+
  1314. '<option value="/30to50-cams/XX">30 TO 50 CAMS</option>'+
  1315. '<option value="/mature-cams/XX">MATURE CAMS (50+)</option>'+
  1316. '<option value="/north-american-cams/XX">NORTH AMERICAN CAMS</option>'+
  1317. '<option value="/euro-russian-cams/XX">EURO RUSSIAN CAMS</option>'+
  1318. '<option value="/south-american-cams/XX">SOUTH AMERICAN CAMS</option>'+
  1319. '<option value="/asian-cams/XX">ASIAN CAMS</option>'+
  1320. '<option value="/other-region-cams/XX">OTHER REGION CAMS</option>'+
  1321. '<option value="/6-tokens-per-minute-private-cams/XX">6 TOKENS PER MINUTE</option>'+
  1322. '<option value="/12-18-tokens-per-minute-private-cams/XX">12 - 18 TOKENS PER MINUTE</option>'+
  1323. '<option value="/30-42-tokens-per-minute-private-cams/XX">30 - 42 TOKENS PER MINUTE</option>'+
  1324. '<option value="/60-72-tokens-per-minute-private-cams/XX">60 - 72 TOKENS PER MINUTE</option>'+
  1325. '<option value="/90-tokens-per-minute-private-cams/XX">90+ TOKENS PER MINUTE</option>'+
  1326. '</select></form>';
  1327. var uloc=document.location.href+"//";
  1328. var loc=uloc.split("/");
  1329. var check=loc[3]+loc[4];
  1330. var gen="";
  1331. if(check.indexOf("male") != -1){gen="male";}
  1332. if(check.indexOf("female") != -1){gen="female";}
  1333. if(check.indexOf("couple") != -1){gen="couple";}
  1334. if(check.indexOf("trans") != -1){gen="trans";}
  1335. data=data.replace(/XX/gi,gen);
  1336. if (gen === ""){data=data.replace("-cams","");}
  1337. data=data.replace('<option value="/'+loc[3],'<option selected value="/'+loc[3]);
  1338. newelem.innerHTML=data;
  1339. document.getElementsByClassName('sub-nav')[0].appendChild(newelem);
  1340. document.getElementById("subsel").addEventListener('change',subselected);
  1341. }
  1342. }
  1343.  
  1344. // go to the selected page
  1345. function subselected(){
  1346. document.location.href=document.getElementById("subsel").options[document.getElementById("subsel").selectedIndex].value;
  1347. }
  1348.  
  1349. //=============================================
  1350. function pmlistner(){
  1351. setTimeout(function(){
  1352. pmobservenode=document.getElementById('pm-tab-default');//split mode
  1353. pmobservenode2=document.getElementById('pm-tab-fvm');// full video mode
  1354. pmobserver.observe(pmobservenode, pmobserverConfig);
  1355. pmobserver2.observe(pmobservenode2, pmobserverConfig);
  1356. }, 2000);
  1357. }
  1358.  
  1359. //PM in tab
  1360. function tabpm(){
  1361. if (document.visibilityState=="visible"){return;}//tab is in focus, do nothing
  1362. if ((pmobservenode.getElementsByTagName("span")[0].innerHTML=="PM")||(pmobservenode2.getElementsByTagName("span")[0].innerHTML=="PM")){return;}// if 1 of 2 is only "PM" then pm tab is open
  1363. if (tabblink==true){return;}// already blinking
  1364. tabblink=true;
  1365. tabblinker();
  1366. }
  1367.  
  1368. function tabblinker(){
  1369. if (document.title == "PM !! PM"){
  1370. document.title = "!! PM !!";
  1371. }else{
  1372. document.title = "PM !! PM";
  1373. }
  1374. if (document.visibilityState!="visible"){ // tab out focus
  1375. setTimeout(tabblinker,500);
  1376. }else{// tab became in focus
  1377. document.title=ctitle;
  1378. tabblink=false;
  1379. }
  1380. }
  1381.  
  1382. // make all new buttons and sliders and set the video filter
  1383. function makevidcontrol(){
  1384.  
  1385. var slistyle="text-align: left; width: 310px;margin-right: 4px;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: 4px 10px 3px; position: relative; top: 0px; right: 1px; float: right; border-radius: 4px; display: inline;";
  1386. var butstyle="margin-right: 5px;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: 4px 10px 3px; position: relative;right: 1px;top:-4px; float: right; border-radius: 4px; cursor: pointer; display: inline;";
  1387. var cbutstyle="margin-right: 5px;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: 4px 10px 3px; position: relative;right: 1px; float: right; border-radius: 4px; cursor: pointer; display: inline;";
  1388.  
  1389. var place2=document.querySelector('[data-paction="BroadcasterFeedback"]');
  1390. if(ppage){
  1391. place2=document.getElementsByClassName("tabBar")[0];
  1392. }
  1393.  
  1394. var newelem=document.createElement('span');
  1395. newelem.setAttribute("style", butstyle);
  1396. newelem.innerHTML="VIDEO CONTROLS ON/OFF";
  1397. newelem.addEventListener("click", vcontrol);
  1398. newelem.id="vcontr";
  1399. place2.appendChild(newelem);
  1400.  
  1401. newelem=document.createElement('span');
  1402. newelem.setAttribute("style", butstyle);
  1403. newelem.style.display="none";
  1404. newelem.innerHTML="CHAT CONTROLS ON/OFF";
  1405. newelem.addEventListener("click", ccontrol);
  1406. newelem.id="ccontr";
  1407. place2.appendChild(newelem);
  1408.  
  1409. newelem=document.createElement('span');
  1410. newelem.setAttribute("style", butstyle);
  1411. newelem.innerHTML="CLEAN PROFILE = ON";
  1412. newelem.style.width="125px";
  1413. newelem.style.display="none";
  1414. newelem.id="clean";
  1415. newelem.addEventListener("click", cleancookie);
  1416. place2.appendChild(newelem);
  1417.  
  1418. newelem=document.createElement('span');
  1419. newelem.setAttribute("style", butstyle);
  1420. newelem.innerHTML="RELOAD INFO";
  1421. newelem.addEventListener("click", newinfo);
  1422. newelem.id="infore";
  1423. place2.appendChild(newelem);
  1424.  
  1425. newelem=document.createElement('div');
  1426. newelem.id="controls";
  1427. newelem.style.display="none";
  1428. newelem.style.position="absolute";
  1429. newelem.style.backgroundColor="rgb(255, 255, 211)";
  1430. newelem.style.border="2px solid rgb(244, 115, 33)";
  1431. newelem.style.borderRadius="6px";
  1432. newelem.style.width="340px";
  1433. newelem.style.padding="12px";
  1434. newelem.style.marginTop="600px";
  1435. newelem.style.right="320px";
  1436. newelem.style.zIndex="999";
  1437. document.getElementById("user_information").appendChild(newelem);
  1438.  
  1439. newelem=document.createElement('span');
  1440. newelem.setAttribute("style", cbutstyle);
  1441. newelem.innerHTML="MIRROR VIDEO";
  1442. newelem.addEventListener("click",mirror);
  1443. document.getElementById("controls").appendChild(newelem);
  1444.  
  1445. newelem=document.createElement('span');
  1446. newelem.setAttribute("style", cbutstyle);
  1447. newelem.innerHTML="INVERT VIDEO";
  1448. newelem.addEventListener("click",invert);
  1449. document.getElementById("controls").appendChild(newelem);
  1450.  
  1451. newelem=document.createElement('span');
  1452. newelem.setAttribute("style", cbutstyle);
  1453. newelem.innerHTML="DRAG";
  1454. newelem.style.cursor="move";
  1455. newelem.addEventListener("mousedown",dragMouseDown);
  1456. document.getElementById("controls").appendChild(newelem);
  1457.  
  1458. newelem=document.createElement('br');
  1459. document.getElementById("controls").appendChild(newelem);
  1460. newelem=document.createElement('br');
  1461. document.getElementById("controls").appendChild(newelem);
  1462.  
  1463. newelem=document.createElement('span');
  1464. newelem.setAttribute("style", slistyle);
  1465. newelem.innerHTML="BRIGHTNESS : <input type='range' id='myRange' min=0 max=200 value=100 style='width: 200px;height:11px;cursor: pointer;float: right;'>";
  1466. document.getElementById("controls").appendChild(newelem);
  1467. document.getElementById("myRange").addEventListener("input",badjust);
  1468.  
  1469. newelem=document.createElement('br');
  1470. document.getElementById("controls").appendChild(newelem);
  1471. newelem=document.createElement('br');
  1472. document.getElementById("controls").appendChild(newelem);
  1473.  
  1474. newelem=document.createElement('span');
  1475. newelem.setAttribute("style", slistyle);
  1476. newelem.innerHTML="CONTRAST : <input type='range' id='myRange1' min=0 max=200 value=100 style='width: 200px;height:11px;cursor: pointer;float: right;'>";
  1477. document.getElementById("controls").appendChild(newelem);
  1478. document.getElementById("myRange1").addEventListener("input",cadjust);
  1479.  
  1480. newelem=document.createElement('br');
  1481. document.getElementById("controls").appendChild(newelem);
  1482. newelem=document.createElement('br');
  1483. document.getElementById("controls").appendChild(newelem);
  1484.  
  1485. newelem=document.createElement('span');
  1486. newelem.setAttribute("style", slistyle);
  1487. newelem.innerHTML="SATURATION : <input type='range' id='myRange2' min=0 max=200 value=100 style='width: 200px;height:11px;cursor: pointer;float: right;'>";
  1488. document.getElementById("controls").appendChild(newelem);
  1489. document.getElementById("myRange2").addEventListener("input",sadjust);
  1490.  
  1491. newelem=document.createElement('br');
  1492. document.getElementById("controls").appendChild(newelem);
  1493. newelem=document.createElement('br');
  1494. document.getElementById("controls").appendChild(newelem);
  1495.  
  1496. newelem=document.createElement('span');
  1497. newelem.setAttribute("style", slistyle);
  1498. newelem.innerHTML="HUE : <input type='range' id='myRange3' min=180 max=540 value=360 style='width: 200px;height:11px;cursor: pointer;float: right;'>";
  1499. document.getElementById("controls").appendChild(newelem);
  1500. document.getElementById("myRange3").addEventListener("input",hadjust);
  1501.  
  1502. newelem=document.createElement('br');
  1503. document.getElementById("controls").appendChild(newelem);
  1504. newelem=document.createElement('br');
  1505. document.getElementById("controls").appendChild(newelem);
  1506.  
  1507. newelem=document.createElement('span');
  1508. newelem.setAttribute("style", cbutstyle);
  1509. newelem.innerHTML="HIDE CONTROL PANEL";
  1510. newelem.addEventListener("click",vcontrol);
  1511. document.getElementById("controls").appendChild(newelem);
  1512.  
  1513. newelem=document.createElement('span');
  1514. newelem.setAttribute("style", cbutstyle);
  1515. newelem.innerHTML="RESET ALL";
  1516. newelem.addEventListener("click",vreset);
  1517. document.getElementById("controls").appendChild(newelem);
  1518.  
  1519. newelem=document.createElement('div');
  1520. newelem.id="chatcontrols";
  1521. newelem.style.display="none";
  1522. newelem.style.position="absolute";
  1523. newelem.style.backgroundColor="rgb(255, 255, 211)";
  1524. newelem.style.border="2px solid rgb(244, 115, 33)";
  1525. newelem.style.borderRadius="6px";
  1526. newelem.style.width="340px";
  1527. newelem.style.padding="12px";
  1528. newelem.style.top="40px";
  1529. newelem.style.right="10px";
  1530. newelem.style.zIndex="99";
  1531. document.querySelector('[data-testid="room-tab-bar"]').appendChild(newelem);
  1532.  
  1533. newelem=document.createElement('span');
  1534. newelem.setAttribute("style", slistyle);
  1535. newelem.style.margin="2px";
  1536. newelem.innerHTML="Small emoticons : <input type='range' id='c1' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1537. document.getElementById("chatcontrols").appendChild(newelem);
  1538.  
  1539. newelem=document.createElement('span');
  1540. newelem.setAttribute("style", slistyle);
  1541. newelem.style.margin="2px";
  1542. newelem.innerHTML="Notice : <input type='range' id='c2' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1543. document.getElementById("chatcontrols").appendChild(newelem);
  1544.  
  1545. newelem=document.createElement('span');
  1546. newelem.setAttribute("style", slistyle);
  1547. newelem.style.margin="2px";
  1548. newelem.innerHTML="Subject change : <input type='range' id='c3' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1549. document.getElementById("chatcontrols").appendChild(newelem);
  1550.  
  1551. newelem=document.createElement('span');
  1552. newelem.setAttribute("style", slistyle);
  1553. newelem.style.margin="2px";
  1554. newelem.innerHTML="Mod/fan enter-leave : <input type='range' id='c4' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1555. if (document.querySelector('[data-testid="header-slogan-text"]').innerHTML.indexOf("THE ACT OF MASTURBATING ")==-1){newelem.style.display="none";}//only in english
  1556. document.getElementById("chatcontrols").appendChild(newelem);
  1557.  
  1558. newelem=document.createElement('span');
  1559. newelem.setAttribute("style", slistyle);
  1560. newelem.style.margin="2px";
  1561. newelem.innerHTML="Grey user chat : <input type='range' id='c5' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1562. document.getElementById("chatcontrols").appendChild(newelem);
  1563.  
  1564. newelem=document.createElement('span');
  1565. newelem.setAttribute("style", slistyle);
  1566. newelem.style.margin="2px";
  1567. newelem.innerHTML="Moderator chat : <input type='range' id='c6' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1568. document.getElementById("chatcontrols").appendChild(newelem);
  1569.  
  1570. newelem=document.createElement('span');
  1571. newelem.setAttribute("style", slistyle);
  1572. newelem.style.margin="2px";
  1573. newelem.innerHTML="Tips smaller than : <input type='number' id='c7a' min='2' max='1000' value='100' style='width: 4em;height:11px;cursor: pointer; '> tokens.<input type='range' id='c7' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1574. document.getElementById("chatcontrols").appendChild(newelem);
  1575.  
  1576. newelem=document.createElement('span');
  1577. newelem.setAttribute("style", slistyle);
  1578. newelem.style.margin="2px";
  1579. newelem.innerHTML="Lovense messages : <input type='range' id='c8' min=0 max=1 value=0 style='width: 40px;height:11px;cursor: pointer;float: right;'>";
  1580. document.getElementById("chatcontrols").appendChild(newelem);
  1581.  
  1582. newelem=document.createElement('span');
  1583. newelem.setAttribute("style", slistyle);
  1584. newelem.style.margin="2px";
  1585. newelem.innerHTML="Tokens recived : <span id='tclear' style='cursor:pointer'> (Clear)</span><span id='c9' style='width: 40px;height:11px;float: right; color:black'>0</span>";
  1586. document.getElementById("chatcontrols").appendChild(newelem);
  1587.  
  1588. }
  1589.  
  1590. //======================== video control functions
  1591. function getvid(){
  1592. vareaid=document.getElementsByTagName("video")[0].id;
  1593. observer3.observe(document.getElementsByTagName("video")[0].parentNode, observerConfig3);
  1594. }
  1595.  
  1596. function varea(){
  1597. var vnode=document.getElementById(vareaid);
  1598.  
  1599. if(!vnode){
  1600. vnode=document.getElementById("chat-player");
  1601. if(!vnode){
  1602. return;
  1603. }
  1604. }
  1605.  
  1606. vnode.style.filter=vfilter;
  1607. vnode.style.transform=vmirror;
  1608. if (document.querySelector('[data-testid="video-container"]')&&vnode.src){
  1609. document.querySelector('[data-testid="video-container"]').style.background="rgb(51, 51, 51)";
  1610. }
  1611. document.getElementById("vcontr").style.display="block";
  1612. if (!vnode.src){
  1613. document.getElementById("vcontr").style.display="none";
  1614. document.getElementById("controls").style.display="none";
  1615. }
  1616. return vnode;
  1617. }
  1618.  
  1619. // brightness adjust
  1620. function badjust(){
  1621. br=document.getElementById("myRange").value;
  1622. ofils=varea().style.filter.split(" ");
  1623. vfilter="brightness("+br+"%) "+ofils[1]+" "+ofils[2]+" "+ofils[3]+" "+ofils[4];
  1624. varea();
  1625. }
  1626.  
  1627.  
  1628. // contrast adjust
  1629. function cadjust(){
  1630. br=document.getElementById("myRange1").value;
  1631. ofils=varea().style.filter.split(" ");
  1632. vfilter=ofils[0]+" contrast("+br+"%) "+ofils[2]+" "+ofils[3]+" "+ofils[4];
  1633. varea();
  1634. }
  1635.  
  1636. // saturation adjust
  1637. function sadjust(){
  1638. br=document.getElementById("myRange2").value;
  1639. ofils=varea().style.filter.split(" ");
  1640. vfilter=ofils[0]+" "+ofils[1]+" "+ofils[2]+" saturate("+br+"%) "+ofils[4];
  1641. varea();
  1642. }
  1643.  
  1644. // hue adjust
  1645. function hadjust(){
  1646. br=document.getElementById("myRange3").value;
  1647. if (br > 359){br=br-360;}
  1648. ofils=varea().style.filter.split(" ");
  1649. vfilter=ofils[0]+" "+ofils[1]+" "+ofils[2]+" "+ofils[3]+" hue-rotate("+br+"deg)";
  1650. varea();
  1651. }
  1652.  
  1653. // invert video
  1654. function invert(){
  1655. ofils=varea().style.filter.split(" ");
  1656. br=" invert(100%) ";
  1657. if (ofils[2]=="invert(100%)"){br=" invert(0%) ";}
  1658. vfilter=ofils[0]+" "+ofils[1]+br+ofils[3]+" "+ofils[4];
  1659. varea();
  1660. }
  1661.  
  1662. // mirror video
  1663. function mirror(){
  1664. if (varea().style.transform=="none"){
  1665. vmirror="matrix(-1, 0, 0, 1, 0, 0)";
  1666. varea();
  1667.  
  1668. }else{
  1669. vmirror="none";
  1670. varea();
  1671. }
  1672. }
  1673.  
  1674. // reset all video adjustments
  1675. function vreset(){
  1676. vfilter="brightness(100%) contrast(100%) invert(0%) saturate(100%) hue-rotate(0deg)";
  1677. vmirror="none";
  1678. varea();
  1679. document.getElementById("myRange").value=100;
  1680. document.getElementById("myRange1").value=100;
  1681. document.getElementById("myRange2").value=100;
  1682. document.getElementById("myRange3").value=360;
  1683. }
  1684.  
  1685. // video controls on/off
  1686. function vcontrol(){
  1687. if (document.getElementById("controls").style.display=="block"){
  1688. document.getElementById("controls").style.display="none";
  1689. }else{
  1690. document.getElementById("controls").style.display="block";
  1691. }
  1692. }
  1693.  
  1694. // pull and drag functions
  1695. // when clicked
  1696. function dragMouseDown(e) {
  1697. e = e || window.event;
  1698. e.preventDefault();
  1699. pos3 = e.clientX;
  1700. pos4 = e.clientY;
  1701. document.onmouseup = closeDragElement;
  1702. document.onmousemove = elementDrag;
  1703. }
  1704.  
  1705. // when moved while clicked- part of dragMouseDown()
  1706. function elementDrag(e) {
  1707. e = e || window.event;
  1708. e.preventDefault();
  1709. pos1 = pos3 - e.clientX;
  1710. pos2 = pos4 - e.clientY;
  1711. pos3 = e.clientX;
  1712. pos4 = e.clientY;
  1713. var x =parseInt(document.getElementById("controls").style.right);
  1714. var y =parseInt(document.getElementById("controls").style.marginTop);
  1715. if ((pos3>=110)&&(pos3<=window.innerWidth-324)){
  1716. document.getElementById("controls").style.right = (x + pos1) + "px";
  1717. }
  1718. if ((y-pos2>-50)&&(pos4<=window.innerHeight-20)){
  1719. document.getElementById("controls").style.marginTop = (y - pos2) + "px";
  1720. }
  1721. }
  1722.  
  1723. // stop moving when mouse button is released- part of dragMouseDown()
  1724. function closeDragElement() {
  1725. document.onmouseup = null;
  1726. document.onmousemove = null;
  1727. }
  1728.  
  1729. // get basic info, hide video controls in an offline room and on bio only
  1730. function info(){
  1731. var url="https://chaturbate.com/api/chatvideocontext/"+roomname+"/";
  1732. fetching++;
  1733. fetch(url,{ credentials: "same-origin"}).then(
  1734. function(response) {
  1735. if (response.status !== 200){
  1736. response.json().then(function(roomdata) {
  1737. wprof("Error:",roomdata.detail);
  1738. fetching--;
  1739. return;
  1740. });
  1741. }
  1742. response.json().then(function(roomdata) {
  1743. data=roomdata;
  1744. fetching--;
  1745. setprofileinfo();
  1746. });
  1747. });
  1748. }
  1749.  
  1750. function setprofileinfo(){
  1751. room_status=data.room_status;
  1752. username=data.viewer_username;
  1753. if (room_status =="offline"){
  1754. document.getElementById("vcontr").style.display="none";
  1755. }
  1756. if(ppage){
  1757. document.getElementById("vcontr").style.display="none";
  1758. document.getElementsByClassName("voteText")[0].innerHTML="";
  1759. document.getElementsByClassName("voteText")[1].innerHTML="";
  1760. document.getElementsByClassName("highPercent")[0].innerHTML="";
  1761. if (data.satisfaction_score.up_votes){
  1762. document.getElementsByClassName("voteText")[0].innerHTML=data.satisfaction_score.up_votes;
  1763. document.getElementsByClassName("voteText")[1].innerHTML=data.satisfaction_score.down_votes;
  1764. document.getElementsByClassName("highPercent")[0].innerHTML=data.satisfaction_score.percent+"%";
  1765. if (data.satisfaction_score.percent<85){
  1766. document.getElementsByClassName("highPercent")[0].style.color="red";
  1767. }
  1768. }
  1769. }
  1770. wprof("Find:","<a href='https://camgirlfinder.net/models?m="+roomname+"&p=cb&g=a' rel=noreferrer target='_new'>Open in camgirlfinder</a>");
  1771. wprof("Statistics:","<a href='https://statbate.com/search/1/"+roomname+"' rel=noreferrer target='_new'>Open in statbate</a>");
  1772. wprof("Schedule:","<a href='https://www.cbhours.com/user/"+roomname+".html' rel=noreferrer target='_new'>Open in cbhours</a>");
  1773. if (document.getElementById("vcontr").style.display=="none"){
  1774. if (!data.opt_out){
  1775. wprof("Full video (anon):","<a href='https://www.girls4cock.com/fullvideo/?b="+roomname+"' rel=noreferrer target='_new'>Open full video mode as anonymous</a>");
  1776. if (!noaccess){
  1777. wprof("Full video:","<a href='https://chaturbate.com/fullvideo/?b="+roomname+"' rel=noreferrer target='_new'>Open full video mode</a>");
  1778. }
  1779. }
  1780. }
  1781. if (data.opt_out){
  1782. wprof("On network sites:","No");
  1783. }
  1784. makerulesarea(data.chat_rules);
  1785. if(data.chat_rules!=""){
  1786. wprof ("Chat rules:","<a href=# id='rulesview'>Yes, click to read</a>");
  1787. document.getElementById("rulesview").addEventListener("click",function(){
  1788. if(document.getElementById("rulespop").style.display=="none"){
  1789. document.getElementById("rulespop").innerHTML=chatrules;
  1790. document.getElementById("rulespop").style.display="block";
  1791. }
  1792. else{
  1793. document.getElementById("rulespop").style.display="none";
  1794. document.getElementById("rulespop").innerHTML="";
  1795. }
  1796. });
  1797. }
  1798.  
  1799. if(ppage){
  1800. if (data.following){
  1801. wprof("Following:","Yes (Unfollow in DM window)");
  1802. }else{
  1803. wprof("Following:","No (Follow in DM window)");
  1804. }
  1805. }
  1806. if (data.num_viewers!=0){
  1807. wprof("Users in room:",data.num_viewers+"<a href=# id='userview'> (Click to view)</a>");
  1808. document.getElementById("userview").addEventListener("click",getuserlist);
  1809. }else{
  1810. wprof("Users in room:","0");
  1811. }
  1812. if (data.low_satisfaction_score){
  1813. wprof("Satisfaction score:","<font color=#CC0000>LOW !!!</font>");
  1814. }
  1815. if (data.is_moderator){
  1816. wprof("Moderator:","Yes");
  1817. }
  1818. if (data.fan_club_is_member){
  1819. wprof("Fanclub member:","Yes");
  1820. }
  1821. if ((room_status=="offline")||(ppage)){
  1822. wprof("Room topic:","<div style='width:450px;height:auto'>"+data.room_title+"</div>");
  1823. }
  1824. if (ppage){
  1825. if (room_status.indexOf("hidden")!=-1){
  1826. wprof("Hidden message:",data.hidden_message);
  1827. }
  1828. }
  1829. if (room_status != "offline"){
  1830. hls_source=data.hls_source;
  1831. if (hls_source!=""){
  1832. localStorage.setItem("defaultplaylist",hls_source.split("?")[0].replace(roomname,"XXX"));
  1833. }
  1834. navigator.clipboard.writeText(hls_source);
  1835. var vidqual=data.quality.quality;
  1836. if (!vidqual){vidqual= "unknown";}
  1837. wprof("Video quality:",vidqual);
  1838. }
  1839. wprof("Video:",room_status);
  1840. if (data.tips_in_past_24_hours !== 0){
  1841. wprof("You tipped:",data.tips_in_past_24_hours+" Tk/24h");
  1842. }
  1843. if (!data.is_age_verified){
  1844. wprof("Status:","Exhibitionist");
  1845. }else{
  1846. if (data.allow_private_shows){
  1847. if (data.spy_private_show_price !== 0){
  1848. wprof("Spy on private:",data.spy_private_show_price+" Tk/min");
  1849. }else{
  1850. wprof("Spy on private:","Disabled");
  1851. }
  1852. wprof("Minimum private:",data.private_min_minutes+" Minutes");
  1853. wprof("Private recording:",data.allow_show_recordings ? "Yes":"No");
  1854. wprof("Privateshow:",data.private_show_price+" Tk/min");
  1855. }else{
  1856. wprof("Privateshow:","Disabled");
  1857. }
  1858. }
  1859. if (login){
  1860. if (!noaccess){
  1861. wprof ("DM:","<a href='https://chaturbate.com/dm/"+roomname+"/' id='dmpop'>Open window</a>");
  1862. document.getElementById("dmpop").addEventListener("click", function(event){opendm(this);event.stopPropagation();event.preventDefault();return false;});
  1863. }
  1864. getnotes();
  1865. }
  1866. if ((room_status!="offline")&&(!ppage)){chatchange();}
  1867. }
  1868.  
  1869. function getuserlist(){
  1870. if(document.getElementById("rulespop").style.display=="block"){
  1871. document.getElementById("rulespop").style.display="none";
  1872. document.getElementById("rulespop").innerHTML="";
  1873. return;
  1874. }else{
  1875. document.getElementById("rulespop").style.display="block";
  1876. }
  1877.  
  1878. var listurl="https://chaturbate.com/api/getchatuserlist/?sort_by=a&roomname="+roomname+"&private=false";
  1879. fetch(listurl,{credentials: "omit",referrerPolicy: "no-referrer"}).then(
  1880. function(response) {
  1881. if (response.status !== 200){
  1882. return;
  1883. }
  1884. response.text().then(function(userdata) {
  1885. formatuserlist(userdata);
  1886. });
  1887. });
  1888. }
  1889.  
  1890. function formatuserlist(userdata){
  1891. var userarray=userdata.split(",");
  1892. var height=15*userarray.length+120;
  1893. var scroll="";
  1894. if (height<240){height=240;}
  1895. if (height>500){height=500;scroll=";overflow-y:scroll";}
  1896. var userstring="<div style='float:right'>(Close)</div><div onclick='event.stopPropagation()' style='cursor:default;width:350px;height:"+height+"px"+scroll+"'>";
  1897. for (i=1; i<userarray.length; i++){
  1898. var user=userarray[i].split("|");
  1899. if (user[1]=="o"){user[1]="#dc5500";}
  1900. if (user[1]=="m"){user[1]="#dc0000";}
  1901. if (user[1]=="f"){user[1]="#090";}
  1902. if (user[1]=="l"){user[1]="#804baa";}
  1903. if (user[1]=="p"){user[1]="#be6aff";}
  1904. if (user[1]=="tr"){user[1]="#1e5cfb";}
  1905. if (user[1]=="t"){user[1]="#69a";}
  1906. if (user[1]=="g"){user[1]="#939393";}
  1907. if (user[2]=="m"){user[2]="https://web.static.mmcdn.com/tsdefaultassets/gendericons/male.svg";}
  1908. if (user[2]=="f"){user[2]="https://web.static.mmcdn.com/tsdefaultassets/gendericons/female.svg";}
  1909. if (user[2]=="c"){user[2]="https://web.static.mmcdn.com/tsdefaultassets/gendericons/couple.svg";}
  1910. if (user[2]=="s"){user[2]="https://web.static.mmcdn.com/tsdefaultassets/gendericons/trans.svg";}
  1911. if (user[3]=="t"){user[3]="(Follower)";}
  1912. if (user[3]=="f"){user[3]="";}
  1913. if (loggedin){
  1914. userstring=userstring+"<img style='height:16px' src='"+user[2]+"'><a target=_blank style='font-weight: bold;color:"+user[1]+"' href='https://chaturbate.com/p/"+yourname+"?tab=bio&model="+user[0]+"'>"+user[0]+"</a> "+user[3]+"<br>";
  1915. }else{
  1916. userstring=userstring+"<img style='height:16px' src='"+user[2]+"'><a target=_blank style='font-weight: bold;color:"+user[1]+"' href='https://chaturbate.com/"+user[0]+"'>"+user[0]+"</a> "+user[3]+"<br>";
  1917. }
  1918. }
  1919. userstring=userstring+"+"+userarray[0].split("|")[0]+" Anonymous users.</div>";
  1920. document.getElementById("rulespop").innerHTML=userstring;
  1921. }
  1922.  
  1923. function chatchange(){
  1924. document.getElementById("ccontr").style.display="block";
  1925. document.getElementById("c1").addEventListener("change",chatsetchange);
  1926. document.getElementById("c2").addEventListener("change",chatsetchange);
  1927. document.getElementById("c3").addEventListener("change",chatsetchange);
  1928. document.getElementById("c4").addEventListener("change",chatsetchange);
  1929. document.getElementById("c5").addEventListener("change",chatsetchange);
  1930. document.getElementById("c6").addEventListener("change",chatsetchange);
  1931. document.getElementById("c7").addEventListener("change",chatsetchange);
  1932. document.getElementById("c7a").addEventListener("change",chatsetchange);
  1933. document.getElementById("c8").addEventListener("change",chatsetchange);
  1934. var chatobserver = new MutationObserver(chatadjust);
  1935. var chatobserverConfig = {childList: true, subtree: true };
  1936. var observenode=document.getElementsByClassName("message-list")[0];
  1937. if (localStorage.getItem(roomname+"Tokens")){
  1938. document.getElementById("c9").innerHTML=localStorage.getItem(roomname+"Tokens");
  1939. firstentry=false;
  1940. }
  1941. document.getElementById("tclear").addEventListener("click",cleartokens);
  1942. chatobserver.observe(observenode,chatobserverConfig);
  1943. }
  1944.  
  1945. function cleartokens(){
  1946. document.getElementById("c9").innerHTML=0;
  1947. localStorage.removeItem(roomname+"Tokens");
  1948. }
  1949.  
  1950. function chatsetchange(){
  1951. c1=document.getElementById("c1").value;
  1952. c2=document.getElementById("c2").value;
  1953. c3=document.getElementById("c3").value;
  1954. c4=document.getElementById("c4").value;
  1955. c5=document.getElementById("c5").value;
  1956. c6=document.getElementById("c6").value;
  1957. c7=document.getElementById("c7").value;
  1958. c7a=document.getElementById("c7a").value;
  1959. if (c7a<2){c7a=2;document.getElementById("c7a").value=2;}
  1960. if (c7a>1000){c7a=1000;document.getElementById("c7a").value=1000;}
  1961. c8=document.getElementById("c8").value;
  1962. smallemoonoff();
  1963. chatadjust();// after change
  1964. }
  1965.  
  1966.  
  1967. function chatadjust(){
  1968. if (!firstentry){
  1969. twaiting=true;
  1970. setTimeout(function(){twaiting=false;}, 200);
  1971. firstentry=true;
  1972. }
  1973.  
  1974. var tags=document.getElementsByClassName('msg-list-fvm');
  1975. for (n=0; n<tags.length; n++){
  1976. chattamper(n);
  1977. }
  1978. }
  1979.  
  1980. function chattamper(tag){
  1981. var messages=document.getElementsByClassName('msg-list-fvm')[tag].querySelectorAll('[data-testid="chat-message"]');
  1982. var chatmessages=messages.length;
  1983. if (chatmessages==0){return;}
  1984. for (i=0; i<chatmessages; i++){
  1985. // div notices---------------------------------------------------------------
  1986. var noticeelm=messages[i].querySelector('[data-testid="room-notice"]');
  1987. if (noticeelm!=null){
  1988. var noticeclasses=noticeelm.classList;
  1989. var notetext=noticeelm.querySelector('[data-testid="room-notice-viewport"]').textContent;
  1990. if (noticeclasses.length==1){ // notice with no additional class
  1991. if (notetext.indexOf("Notice:")==0){ // normal notice
  1992. if (c2==1){
  1993. messages[i].style.display="none";
  1994. }else{
  1995. messages[i].style.display="block";
  1996. }
  1997. }
  1998. if (notetext.indexOf("Moderator")==0){ //left / entered the room
  1999. if (c4==1){
  2000. messages[i].style.display="none";
  2001. }else{
  2002. messages[i].style.display="block";
  2003. }
  2004. }
  2005. if (notetext.indexOf("Fan club member")==0){//left / entered the room
  2006. if (c4==1){
  2007. messages[i].style.display="none";
  2008. }else{
  2009. messages[i].style.display="block";
  2010. }
  2011. }
  2012. }
  2013.  
  2014. if (noticeclasses.contains("titleChange")){
  2015. if (c3==1){
  2016. messages[i].style.display="none";
  2017. }else{
  2018. messages[i].style.display="block";
  2019. }
  2020. }
  2021.  
  2022. if (noticeclasses.contains("isTip")){
  2023. var tokens=parseInt(notetext.split("tipped ")[1].split(" ")[0]);
  2024. if (tag==0){
  2025. if(messages[i].style.display=="flex"){
  2026. if(!twaiting){
  2027. document.getElementById("c9").innerHTML=parseInt(document.getElementById("c9").innerHTML)+tokens;
  2028. localStorage.setItem(roomname+"Tokens",document.getElementById("c9").innerHTML);
  2029. }
  2030. }
  2031. }
  2032. if ((c7==1)&&(tokens<c7a)){
  2033. messages[i].style.display="none";
  2034. }else{
  2035. messages[i].style.display="block";
  2036. }
  2037. }
  2038.  
  2039. }//end roomnotice
  2040.  
  2041. //div chattext--------------------------------------------------------------------Special Commands:
  2042. if (messages[i].querySelector('[data-testid="chat-message-text"]')!=null){
  2043. //text in chattext-----------------------
  2044. if (messages[i].querySelector('[data-testid="chat-message-username"]').className=="broadcaster"){
  2045. var chattext=messages[i].querySelector('[data-testid="chat-message-text"]').textContent;
  2046. if ((chattext.indexOf("Lovense")!=-1)||(chattext.indexOf("------")!=-1)||(chattext.indexOf("******")!=-1)||(chattext.indexOf("The High Tipper")!=-1)||(chattext.indexOf("The king Tipper")!=-1)||(chattext.indexOf("Special Commands:")!=-1)||(chattext.indexOf("Blitz Mode")!=-1)){
  2047. if (c8==1){
  2048. messages[i].style.display="none";
  2049. }else{
  2050. messages[i].style.display="block";
  2051. }
  2052. }
  2053. }
  2054.  
  2055. //div users in chattext-------------------------------
  2056. if (messages[i].querySelector('[data-testid="chat-message-username"]').className=="defaultUser"){ // grey user
  2057. if (c5==1){
  2058. messages[i].style.display="none";
  2059. }else{
  2060. messages[i].style.display="block";
  2061. }
  2062. }
  2063. if (messages[i].querySelector('[data-testid="chat-message-username"]').className=="mod"){//mod user
  2064. if (c6==1){
  2065. messages[i].style.display="none";
  2066. }else{
  2067. messages[i].style.display="block";
  2068. }
  2069. }
  2070. }
  2071. }
  2072. }
  2073.  
  2074. function smallemoonoff(){
  2075. if ((c1==1)&&(document.getElementById("emostyle")==null)){
  2076. var style = document.createElement('style');
  2077. style.setAttribute('type', 'text/css');
  2078. style.id="emostyle";
  2079. style.textContent = "img.emoticonImage {max-height:22px !important;}";
  2080. document.getElementsByTagName('head')[0].appendChild(style);
  2081. }
  2082. if ((c1==0)&&(document.getElementById("emostyle")!=null)){
  2083. document.getElementById("emostyle").remove();
  2084. }
  2085. }
  2086.  
  2087. function ccontrol(){
  2088. if (document.getElementById("chatcontrols").style.display=="block"){
  2089. document.getElementById("chatcontrols").style.display="none";
  2090. }else{
  2091. document.getElementById("chatcontrols").style.display="block";
  2092. }
  2093. }
  2094.  
  2095. //-----------------------
  2096. function opendm(that){
  2097. var dmwindow= window.open(that.href,'DMpop','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=800,height=800');
  2098. dmwindow.onload = function(){
  2099. this.addEventListener('unload', function(){setTimeout(function(){newinfo();},1000);});
  2100. };
  2101. }
  2102.  
  2103. // get notes
  2104. function getnotes(){
  2105. var url="https://chaturbate.com/api/notes/for_user/"+roomname+"/";
  2106. fetching++;
  2107. fetch(url,{ credentials: "same-origin"}).then(
  2108. function(response) {
  2109. if (response.status !== 200) {
  2110. fetching--;
  2111. wprof("Attention:","This room is banned.");
  2112. return;
  2113. }
  2114. response.json().then(function(data) {
  2115. fetching--;
  2116. if (data.text == null){data.text="";}
  2117. opennote=data.text;
  2118. buildprofnote();
  2119. createimage();
  2120. });
  2121. });
  2122. }
  2123.  
  2124. // pop up the rules, also for userlist
  2125. function makerulesarea(rule){
  2126. if (document.getElementById("rulespop")){return;}
  2127. var rulestyle="cursor:pointer;z-index:999;top:10px;left:10px;box-shadow:0px 0px 32px rgba(0, 0, 0, 0.32);border-radius:4px;border:1px solid rgb(221, 221, 221);background-color:rgb(200, 200, 200);position:absolute; display:none; white-space: pre-line; text-align: left; line-height: 1.4; height: auto; width:500px; padding: 10px 10px 10px 10px; box-sizing: border-box; overflow-wrap: break-word; word-break: break-word; padding: 15px;";
  2128. var newelem=document.createElement('span');
  2129. newelem.setAttribute("style", rulestyle);
  2130. newelem.id="rulespop";
  2131. chatrules="<b>"+roomname+" chatrules:</b><br><br>"+rule+"<br><br><center>(Click to close)</center>";
  2132. newelem.addEventListener("click",function(){this.style.display="none";this.innerHTML="";});
  2133. document.querySelector('[data-testid="room-bio-tab-contents"]').appendChild(newelem);
  2134. }
  2135.  
  2136. //puts in /p/ page jpegplayer , or last image or noting
  2137. function createimage(){
  2138. if ((document.location.href.split("/")[3]!="p")&&!noaccess){return;}
  2139. if ((document.getElementById("profimg"))&&(room_status!="public")){return;}
  2140. if (document.getElementById("profimg")){document.getElementById("profimg").remove();}
  2141. if (room_status=="public"){makeplayer();return;}
  2142. //now check if there is an active thumbnail
  2143. var url="https://jpeg.live.mmcdn.com/minifwap/"+roomname+".jpg";
  2144. fetch(url,{
  2145. cache: "no-cache",
  2146. credentials: "same-origin"}).then(
  2147. function(response){
  2148. var imgsize=response.headers.get("content-length");
  2149. if ((imgsize<4800)||(imgsize>4850)){makeimg();}
  2150. }
  2151. );
  2152. }
  2153.  
  2154. function makeimg(){
  2155. var newelem=document.createElement('img');
  2156. newelem.src="https://jpeg.live.mmcdn.com/minifwap/"+roomname+".jpg";
  2157. newelem.id="profimg";
  2158. newelem.style.zIndex="99";
  2159. newelem.style.position="absolute";
  2160. newelem.style.height="270px";
  2161. newelem.style.width="480px";
  2162. newelem.style.top="10px";
  2163. newelem.style.right="10px";
  2164. newelem.style.border="1px solid rgb(221, 221, 221)";
  2165. newelem.style.borderRadius="4px";
  2166. newelem.style.boxShadow="0px 0px 32px rgba(0, 0, 0, 0.32)";
  2167. document.querySelector('[data-testid="room-bio-tab-contents"]').appendChild(newelem);
  2168. }
  2169.  
  2170. function makeplayer(){
  2171. var newelem=document.createElement('img');
  2172. newelem.src="https://jpeg.live.mmcdn.com/minifwap/"+roomname+".jpg";
  2173. newelem.id="profimg";
  2174. newelem.style.zIndex="99";
  2175. newelem.style.position="absolute";
  2176. newelem.style.width="854px";
  2177. newelem.style.height="480px";
  2178. newelem.style.top="10px";
  2179. newelem.style.right="10px";
  2180. newelem.style.border="1px solid rgb(221, 221, 221)";
  2181. newelem.style.borderRadius="4px";
  2182. newelem.style.boxShadow="0px 0px 32px rgba(0, 0, 0, 0.32)";
  2183. document.querySelector('[data-testid="room-bio-tab-contents"]').appendChild(newelem);
  2184. pimg.addEventListener("load",regetimgprof);
  2185. pimg.addEventListener("error",errorimgprof);
  2186. pimg.src = "https://jpeg.live.mmcdn.com/stream?room="+roomname+"&f="+ new Date().getTime();
  2187. }
  2188.  
  2189. function errorimgprof(){
  2190. setTimeout(function(){pimg.src = "https://jpeg.live.mmcdn.com/stream?room="+roomname+"&f="+ new Date().getTime();}, 5000);
  2191. }
  2192.  
  2193. function regetimgprof(){
  2194. if ((document.visibilityState!="visible")||(document.querySelector('[data-testid="room-bio-tab-contents"]').style.height=="0px")){
  2195. setTimeout(regetimgprof,2000);
  2196. }else{
  2197. document.getElementById("profimg").src=pimg.src;
  2198. setTimeout(function(){pimg.src = "https://jpeg.live.mmcdn.com/stream?room="+roomname+"&f="+ new Date().getTime();}, 50);
  2199. }
  2200. }
  2201.  
  2202. //------------------------------------------
  2203. function buildprofnote(){
  2204. var subbutraw="<span id='profsubmit' style='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; padding: 4px 10px 5px; position: relative; left: 120px; float: left; border-radius: 4px; cursor: pointer;'>Save</span>";
  2205. wprof("",'<div width="200px" id="profnote" style="display:none"><a href=# id="profcancel">Cancel</a>'+subbutraw+'</div>');
  2206. wprof("Personal notes:","<textarea id='proftext' spellcheck='false' placeholder='Enter notes about this user (only seen by you)' style='width: 200px; height: 45px; line-height: 14px; border-width: 1px; border-style: solid; border-color: rgb(172, 172, 172); border-radius: 4px; padding: 7px 8px; overflow: auto;background-color: rgb(221, 233, 245);'></textarea>");
  2207. document.getElementById("proftext").value=opennote;
  2208. document.getElementById("proftext").addEventListener("input",profopenbutton);
  2209. document.getElementById("profcancel").addEventListener("click",profclosebutton);
  2210. document.getElementById("profsubmit").addEventListener("click",profsavenote);
  2211. }
  2212.  
  2213. function profsavenote(){
  2214. var notetext=document.getElementById("proftext").value;
  2215. var url="https://chaturbate.com/api/notes/for_user/"+roomname+"/";
  2216. var csrftoken= readCookie("csrftoken");
  2217. var data = new FormData();
  2218. data.append( "text", notetext );
  2219. fetch(url,
  2220. {
  2221. method: "POST",
  2222. headers: {
  2223. 'x-csrftoken': csrftoken,
  2224. 'x-requested-with': 'XMLHttpRequest'
  2225. },
  2226. body: data
  2227. }).then(profaftersave);
  2228. }
  2229.  
  2230. function profaftersave(){
  2231. opennote=document.getElementById("proftext").value;
  2232. profclosebutton();
  2233. }
  2234.  
  2235. function profopenbutton(){
  2236. document.getElementById("profnote").style.display="block";
  2237. document.getElementById("proftext").value=document.getElementById("proftext").value.replace("$"," "+new Date().toLocaleDateString()+" ");
  2238. if(opennote==document.getElementById("proftext").value){
  2239. profclosebutton();
  2240. }
  2241. }
  2242.  
  2243. function profclosebutton(){
  2244. document.getElementById("profnote").style.display="none";
  2245. document.getElementById("proftext").value=opennote;
  2246. }
  2247.  
  2248. function wprof(col1,col2){
  2249. var container=document.getElementsByClassName("BioContents")[0];
  2250. var newtr=document.createElement('tr');
  2251. newtr.setAttribute("style", "font-size: 14px; font-weight: normal; line-height: 15px; vertical-align: top; text-align: left;");
  2252. newtr.setAttribute("name", "info");
  2253. var newtd=document.createElement('td');
  2254. newtd.setAttribute("style", "padding-bottom: 9px; font-family: UbuntuMedium, Arial, Helvetica, sans-serif; height: 16px;");
  2255. newtd.className="label";
  2256. var newspan=document.createElement('span');
  2257. newspan.className="defaultColor";
  2258. newspan.innerHTML=col1;
  2259. newtd.appendChild(newspan);
  2260. var newtd2=document.createElement('td');
  2261. newtd2.setAttribute("style", "font-size: 14px; line-height: 16px; font-family: UbuntuRegular, Arial, Helvetica, sans-serif;");
  2262. newtd2.className="contentText";
  2263. newtd2.innerHTML=col2;
  2264. newtr.appendChild(newtd);
  2265. newtr.appendChild(newtd2);
  2266. var referenceNode=container.getElementsByTagName("table")[0];
  2267. referenceNode.insertBefore(newtr, referenceNode.getElementsByTagName("tr")[2]);
  2268. }
  2269.  
  2270. // removes the extra info in the profile and gets it again
  2271. function newinfo(){
  2272. if (fetching!==0){alert("Slow down !");return;}
  2273. if(document.getElementById("rulespop")){document.getElementById("rulespop").style.display="none";}
  2274. var tags=document.getElementsByName("info");
  2275. for(i=tags.length-1;i>=0;i--){
  2276. tags[i].remove();
  2277. }
  2278. if (noaccess){
  2279. anoninfo();
  2280. }else{
  2281. info();
  2282. }
  2283. }
  2284.  
  2285.  
  2286. //=================== clean profile
  2287. function cleaninit(){
  2288. var p=0;
  2289. var maxoke="";
  2290. var attr="";
  2291. var tags=document.querySelectorAll('[rel="nofollow"]');
  2292. for (n=0; n<tags.length; n++){
  2293. if (tags[n].style.position){
  2294. if (tags[n].style.position=="fixed"){
  2295. tags[n].style.position="absolute";
  2296. }
  2297. if (tags[n].style.position.indexOf("var")!=-1){
  2298. tags[n].style.position="absolute";
  2299. }
  2300. if (tags[n].style.position.indexOf("absolute")!=-1){
  2301. if (tags[n].getAttribute("style").indexOf("!important")!=-1){
  2302. attr=tags[n].getAttribute("style");
  2303. attr=attr.split("!important").join("");
  2304. tags[n].setAttribute("style",attr);
  2305. }
  2306. tags[n].classList.add("profpos");
  2307. p++;
  2308. }
  2309. }
  2310. // vh em of px 30em , 30 vh , 200px
  2311. if (tags[n].style.marginTop){
  2312. maxoke=-30;
  2313. if(tags[n].style.marginTop.indexOf("px")!=-1){maxoke=-200;}
  2314. if (parseFloat(tags[n].style.marginTop)<maxoke){
  2315. if (tags[n].getAttribute("style").indexOf("!important")!=-1){
  2316. attr=tags[n].getAttribute("style");
  2317. attr=attr.split("!important").join("");
  2318. tags[n].setAttribute("style",attr);
  2319. }
  2320. tags[n].classList.add("profmar");
  2321. p++;
  2322. }
  2323. }
  2324. if (tags[n].style.margin){
  2325. maxoke=-30;
  2326. if(tags[n].style.margin.split(" ")[0].indexOf("px")!=-1){maxoke=-200;}
  2327. if (parseFloat(tags[n].style.margin)<maxoke){
  2328. if (tags[n].getAttribute("style").indexOf("!important")!=-1){
  2329. attr=tags[n].getAttribute("style");
  2330. attr=attr.split("!important").join("");
  2331. tags[n].setAttribute("style",attr);
  2332. }
  2333. tags[n].classList.add("profmar");
  2334. p++;
  2335. }
  2336. }
  2337. if (tags[n].style.cursor){
  2338. if (tags[n].getAttribute("style").indexOf("!important")!=-1){
  2339. attr=tags[n].getAttribute("style");
  2340. attr=attr.split("!important").join("");
  2341. tags[n].setAttribute("style",attr);
  2342. }
  2343. tags[n].classList.add("profcur");
  2344. p++;
  2345. }
  2346. }
  2347. document.getElementById("clean").style.display="none";
  2348. if (p!==0){
  2349. document.getElementById("clean").style.display="block";
  2350. cleanup();
  2351. }
  2352. }
  2353.  
  2354. // swap profile cleanup cookie and call cleanup()
  2355. function cleancookie(){
  2356. if (localStorage.getItem("pclean")){
  2357. localStorage.removeItem("pclean");
  2358. }else{
  2359. localStorage.setItem("pclean", "foo");
  2360. }
  2361. cleanup();
  2362. }
  2363.  
  2364. // hide or unhide marked elements in profile according to cookie
  2365. function cleanup(){
  2366. var claction=!localStorage.getItem("pclean");
  2367. if (claction){
  2368. document.getElementById("clean").innerHTML= "CLEAN PROFILE = ON&nbsp;";
  2369. var style = document.createElement('style');
  2370. style.setAttribute('type', 'text/css');
  2371. style.id="profstyle";
  2372. style.textContent = ".profpos {display:none !important} .profmar {margin-top:0px !important;} .profcur{cursor:default !important }";
  2373. document.getElementsByTagName('head')[0].appendChild(style);
  2374. }else{
  2375. document.getElementById("clean").innerHTML= "CLEAN PROFILE = OFF";
  2376. if (document.getElementById("profstyle")!=null){
  2377. document.getElementById("profstyle").remove();
  2378. }
  2379. }
  2380. }
  2381.  
  2382. //=============== links in bio fix=================
  2383. function linkfix(){
  2384. var bioarea= document.getElementsByClassName('BioContents')[0];
  2385. var tags = bioarea.getElementsByTagName('a');
  2386. for (i=0; i<tags.length; i++){
  2387. if (tags[i].href.indexOf("campaign=")!=-1){
  2388. tags[i].href=tour;
  2389. }
  2390. if (tags[i].href.indexOf('?url=') != -1){
  2391. var linkout=decodeURIComponent(tags[i].href).split("?url=")[1];
  2392. if (linkout.indexOf("campaign=")!=-1){
  2393. linkout=tour;
  2394. }
  2395. tags[i].href=linkout;
  2396. }
  2397. }
  2398. if(document.querySelector('[data-testid="sign-up-tab"]')){
  2399. document.querySelector('[data-testid="sign-up-tab"]').href=tour;
  2400. }
  2401. }
  2402.  
  2403. //===downloadlink my collection and model media in popup
  2404. function collectiondownload(){
  2405. document.getElementById("main").addEventListener("click", collectiondownload2);
  2406. collectiondownload2();
  2407. }
  2408.  
  2409. function collectiondownload2(){
  2410. setTimeout(function(){collectiondownload3();}, 2000);
  2411. }
  2412.  
  2413. function collectiondownload3(){
  2414. if(document.getElementsByTagName("video").length>0){
  2415. if(document.getElementsByTagName("video")[0].src){
  2416. if(!document.getElementById("link")){
  2417. var newelem=document.createElement('a');
  2418. newelem.id="link";
  2419. newelem.style.position="relative";
  2420. newelem.style.left="250px";
  2421. newelem.style.top="5px";
  2422. newelem.href= document.getElementsByTagName("video")[0].src;
  2423. newelem.target="_blank";
  2424. newelem.innerHTML="Right click, save to disk.";
  2425. newelem.style.backgroundColor="white";
  2426. newelem.style.marginLeft="20px";
  2427. document.getElementsByClassName("createdAt")[0].parentNode.appendChild(newelem);
  2428. }
  2429. }
  2430. }
  2431. }
  2432.  
  2433. //======= downloadlink saved private
  2434. function savedprvdownload(){
  2435. setTimeout(function(){savedprvdownload3();}, 2000);
  2436. }
  2437.  
  2438. function savedprvdownload3(){
  2439. var newelem=document.createElement('a');
  2440. newelem.href= document.getElementsByTagName("video")[0].src;
  2441. newelem.target="_blank";
  2442. newelem.innerHTML="Right click, save to disk.<br>";
  2443. newelem.style.backgroundColor="white";
  2444. newelem.style.marginLeft="20px";
  2445. document.getElementById("tsRecordedShowPlayer").appendChild(newelem);
  2446. }
  2447.  
  2448. //password room
  2449. function passwordfollow(){
  2450. setTimeout(function(){
  2451. var unfollow=document.querySelector('[data-testid="unfollow-button"]');
  2452. var follow=document.querySelector('[data-testid="follow-button"]');
  2453. if (unfollow.style.display=="none"){
  2454. follow.parentNode.parentNode.style.display="block";
  2455. follow.style.display="block";
  2456. }
  2457. unfollow.addEventListener("click", function(){setTimeout(function(){document.location.reload();}, 500);} );
  2458. follow.addEventListener("click", function(){setTimeout(function(){document.location.reload();}, 500);} );
  2459. }, 1000);
  2460. var newelem=document.createElement('div');
  2461. newelem.className="BioContents";
  2462. var newtable=document.createElement('table');
  2463. newelem.appendChild(newtable);
  2464. var newtr=document.createElement('tr');
  2465. newtable.appendChild(newtr);
  2466. newtr=document.createElement('tr');
  2467. newelem.style.position="relative";
  2468. newelem.style.float="left";
  2469. newtable.appendChild(newtr);
  2470. document.getElementsByClassName("defaultColor")[0].appendChild(newelem);
  2471. wprof ("DM:","<a href='https://chaturbate.com/dm/"+roomname+"/' id='dmpop'>Open window</a>");
  2472. document.getElementById("dmpop").addEventListener("click", function(event){opendm3(this);event.stopPropagation();event.preventDefault();return false;});
  2473. getnotes();
  2474. document.getElementsByClassName("tooltip")[0].innerHTML="If follow does not work this room banned your region or gender.";
  2475. document.getElementById("tsContent").style.minHeight="400px";
  2476. }
  2477.  
  2478. function opendm3(that){
  2479. window.open(that.href,'DMpop','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=800,height=800');
  2480. }
  2481.  
  2482. //banned room
  2483. function bannedroom(){
  2484. document.getElementsByClassName("BaseRoomContents")[0].style.minHeight="505px";
  2485. var newelem=document.createElement('div');
  2486. newelem.style.width="100%";
  2487. newelem.style.height="1px";
  2488. newelem.setAttribute('data-testid', 'room-bio-tab-contents');
  2489. document.getElementsByClassName("BaseRoomContents")[0].appendChild(newelem);
  2490. newelem=document.createElement('div');
  2491. newelem.style.margin="14px 14px";
  2492. newelem.id="banreload";
  2493. newelem.innerHTML=" Click here to reload info and copy playlist to clipbord.";
  2494. newelem.style.cursor="pointer";
  2495. newelem.addEventListener("click", newinfo);
  2496. document.getElementsByClassName("BaseRoomContents")[0].appendChild(newelem);
  2497. newelem=document.createElement('div');
  2498. newelem.className="BioContents";
  2499. var newtable=document.createElement('table');
  2500. newelem.appendChild(newtable);
  2501. var newtr=document.createElement('tr');
  2502. newtr.id="vcontr";
  2503. newtable.appendChild(newtr);
  2504. newtr=document.createElement('tr');
  2505. newtable.appendChild(newtr);
  2506. document.getElementsByClassName("BaseRoomContents")[0].appendChild(newelem);
  2507. anoninfo();
  2508. }
  2509.  
  2510. function anoninfo(){
  2511. var url="https://chaturbate.com/api/chatvideocontext/"+roomname+"/";
  2512. fetching++;
  2513. fetch(url,{ credentials: "omit"}).then(
  2514. function(response) {
  2515. if (response.status !== 200){ // region or gender block
  2516. fetching--;
  2517. document.getElementById("banreload").style.display="none";
  2518. i=0;
  2519. banimgsize();
  2520. return;
  2521. }
  2522. response.json().then(function(roomdata) {
  2523. data=roomdata;
  2524. fetching--;
  2525. setprofileinfo();
  2526. });
  2527. });
  2528. }
  2529.  
  2530. function banimgsize(){
  2531. var url="https://jpeg.live.mmcdn.com/minifwap/"+roomname+".jpg";
  2532. fetch(url,{
  2533. cache: "no-cache",
  2534. credentials: "omit",
  2535. referrerPolicy: "no-referrer"}).then(
  2536. function(response){
  2537. var imgsize=response.headers.get("content-length");
  2538. if (i==0){
  2539. i=imgsize;
  2540. setTimeout(banimgsize, 1000);
  2541. return;
  2542. }
  2543. if (i!=imgsize){banonline();return;}
  2544. if ((imgsize>4800)&&(imgsize<4850)){banoffline();return;}
  2545. banwasonline();
  2546. }
  2547. );
  2548. }
  2549.  
  2550. function banonline(){
  2551. wprof("","<a href=# id=moreinfo>Click here to search for more info and copy playlist to clipbord.</a>");
  2552. document.getElementById("moreinfo").addEventListener("click",moreinfo);
  2553. putinlinks();
  2554. wprof("Status:","Online");
  2555. makeplayer();
  2556. if(login){
  2557. getnotes();
  2558. }
  2559. }
  2560.  
  2561. function banwasonline(){
  2562. putinlinks();
  2563. wprof("Status:","Recently online.");
  2564. if(login){
  2565. getnotes();
  2566. }else{
  2567. makeimg();
  2568. }
  2569. }
  2570.  
  2571. function banoffline(){
  2572. putinlinks();
  2573. wprof("Status:","Offline.");
  2574. if(login){
  2575. getnotes();
  2576. }
  2577. }
  2578.  
  2579. function putinlinks(){
  2580. wprof("Find:","<a href='https://camgirlfinder.net/models?m="+roomname+"&p=cb&g=a' rel=noreferrer target='_new'>Open in camgirlfinder</a>");
  2581. wprof("Statistics:","<a href='https://statbate.com/search/1/"+roomname+"' rel=noreferrer target='_new'>Open in statbate</a>");
  2582. wprof("Schedule:","<a href='https://www.cbhours.com/user/"+roomname+".html' rel=noreferrer target='_new'>Open in cbhours</a>");
  2583. }
  2584.  
  2585. function moreinfo(){
  2586. document.getElementById("moreinfo").removeEventListener("click",moreinfo);
  2587. document.getElementById("moreinfo").innerHTML="Please wait....";
  2588. navigator.clipboard.writeText(localStorage.getItem("defaultplaylist").replace("XXX",roomname));
  2589. var dataurl="https://chaturbate.com/affiliates/api/onlinerooms/?format=json&wm=b0P2s";
  2590. fetch(dataurl,{credentials: "omit",referrerPolicy: "no-referrer"}).then(
  2591. function(response) {
  2592. if (response.status !== 200){
  2593. document.getElementById("moreinfo").innerHTML="Error reading roomlist.";
  2594. return;
  2595. }
  2596. response.json().then(function(data) {
  2597. for (n=0; n<data.length; n++){
  2598. if (data[n].username==roomname){
  2599. wprof("Gender:",data[n].gender);
  2600. wprof("Given location:",data[n].location);
  2601. wprof("Country flag:",data[n].country);
  2602. wprof("Room topic:","<div style='width:450px;height:auto'>"+data[n].room_subject+"</div>");
  2603. wprof("Spoken languages:",data[n].spoken_languages);
  2604. wprof("Name:", data[n].display_name);
  2605. wprof("Birthday:",data[n].birthday);
  2606. wprof("Age:",data[n].age);
  2607. wprof("Time online:",toTime(data[n].seconds_online));
  2608. wprof("Users in room:",data[n].num_users);
  2609. wprof("Followers:",data[n].num_followers);
  2610. document.getElementById("moreinfo").innerHTML="";
  2611. data="";
  2612. break;
  2613. }
  2614. }
  2615. if (n==data.length){
  2616. document.getElementById("moreinfo").innerHTML="No information found, user may no longer be in public or opt-out.";
  2617. data="";
  2618. }
  2619. });
  2620. });
  2621.  
  2622. }
  2623. function toTime(seconds) {
  2624. var date = new Date(null);
  2625. date.setSeconds(seconds);
  2626. return date.toISOString().substr(11, 8).replace(":","h").replace(":","m")+"s";
  2627. }
  2628.  
  2629. // cookie functions
  2630. function createCookie(name,value,days,domain){
  2631. var expires="";
  2632. if (domain){
  2633. domain=";domain=."+domain;
  2634. }else{
  2635. domain = "";
  2636. }
  2637. if (days) {
  2638. var date = new Date();
  2639. date.setTime(date.getTime()+(days*24*60*60*1000));
  2640. expires = "; expires="+date.toGMTString();
  2641. }
  2642. document.cookie = name+"="+value+expires+"; path=/"+domain;
  2643. }
  2644.  
  2645. function readCookie(name) {
  2646. var nameEQ = name + "=";
  2647. var ca = document.cookie.split(';');
  2648. for(i=0;i < ca.length;i++) {
  2649. var c = ca[i];
  2650. while (c.charAt(0)==' '){
  2651. c = c.substring(1,c.length);
  2652. }
  2653. if (c.indexOf(nameEQ) === 0){
  2654. return c.substring(nameEQ.length,c.length);
  2655. }
  2656. }
  2657. return null;
  2658. }
  2659.  
  2660. function eraseCookie(name,domain){
  2661. createCookie(name,"",-1,domain);
  2662. }
  2663.  
  2664. function rebuildbio(){
  2665. referenceNode=document.getElementsByClassName("BioContents")[0].getElementsByTagName("table")[0];
  2666. document.querySelector('[data-paction="RoomTabs"]').remove();
  2667. removebionode();
  2668. document.getElementsByClassName("editbio")[0].remove();
  2669. document.getElementsByClassName("tooltip defaultTooltipColor")[0].remove();
  2670. document.querySelector('[data-paction-name="ActiveRoom"]').innerHTML=tocap(roomname) + "'s Bio";
  2671. document.querySelector('[data-paction-name="ActiveRoom"]').title=tocap(roomname) + "'s Bio";
  2672. document.title=tocap(roomname) + "'s Bio";
  2673. getbiodata();
  2674. }
  2675.  
  2676. function tocap(name){
  2677. if (!name){return "";}
  2678. return name.charAt(0).toUpperCase()+name.slice(1);
  2679. }
  2680.  
  2681. function getbiodata(){
  2682. var url="https://chaturbate.com/api/biocontext/"+roomname;
  2683. fetch(url,{ credentials: "same-origin"}).then(
  2684. function(response) {
  2685. if (response.status !== 200){
  2686. document.location.href="https://chaturbate.com/"+roomname;
  2687. return;
  2688. }
  2689. response.json().then(function(data) {
  2690. biodata=data;
  2691. buildbio();
  2692. afterrebuild();
  2693. });
  2694. });
  2695. }
  2696.  
  2697. function removebionode(){
  2698. if (referenceNode.getElementsByTagName("tr")[3]){
  2699. referenceNode.getElementsByTagName("tr")[3].remove();
  2700. removebionode();
  2701. }
  2702. }
  2703.  
  2704. function buildbio(){
  2705. referenceNode.getElementsByTagName("tr")[2].getElementsByTagName("span")[0].innerHTML="Real Name:";
  2706. referenceNode.getElementsByTagName("tr")[2].getElementsByTagName("td")[1].innerHTML=tocap(biodata.real_name);
  2707.  
  2708. var newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2709. newnode.getElementsByTagName("span")[0].innerHTML="Followers:";
  2710. newnode.getElementsByTagName("td")[1].innerHTML=biodata.follower_count;
  2711. referenceNode.appendChild(newnode);
  2712.  
  2713. if (biodata.display_birthday){
  2714. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2715. newnode.getElementsByTagName("span")[0].innerHTML="Birth Date:";
  2716. newnode.getElementsByTagName("td")[1].innerHTML=biodata.display_birthday;
  2717. referenceNode.appendChild(newnode);
  2718. }
  2719. if (biodata.display_age){
  2720. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2721. newnode.getElementsByTagName("span")[0].innerHTML="Age:";
  2722. newnode.getElementsByTagName("td")[1].innerHTML=biodata.display_age;
  2723. referenceNode.appendChild(newnode);
  2724. }
  2725.  
  2726. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2727. newnode.getElementsByTagName("span")[0].innerHTML="I Am";
  2728. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.sex)+" "+tocap(biodata.subgender);
  2729. referenceNode.appendChild(newnode);
  2730.  
  2731. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2732. newnode.getElementsByTagName("span")[0].innerHTML="Interested In:";
  2733. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.interested_in[0])+" "+tocap(biodata.interested_in[1])+" "+tocap(biodata.interested_in[2])+" "+tocap(biodata.interested_in[3]);
  2734. referenceNode.appendChild(newnode);
  2735.  
  2736. if (biodata.location){
  2737. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2738. newnode.getElementsByTagName("span")[0].innerHTML="Location:";
  2739. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.location);
  2740. referenceNode.appendChild(newnode);
  2741. }
  2742. if (biodata.time_since_last_broadcast){
  2743. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2744. newnode.getElementsByTagName("span")[0].innerHTML="Last Broadcast:";
  2745. newnode.getElementsByTagName("td")[1].innerHTML=biodata.time_since_last_broadcast;
  2746. referenceNode.appendChild(newnode);
  2747. }
  2748. if (biodata.languages){
  2749. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2750. newnode.getElementsByTagName("span")[0].innerHTML="Language(s):";
  2751. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.languages);
  2752. referenceNode.appendChild(newnode);
  2753. }
  2754. if (biodata.body_type){
  2755. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2756. newnode.getElementsByTagName("span")[0].innerHTML="Body Type:";
  2757. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.body_type);
  2758. referenceNode.appendChild(newnode);
  2759. }
  2760. if (biodata.smoke_drink){
  2761. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2762. newnode.getElementsByTagName("span")[0].innerHTML="Smoke / Drink:";
  2763. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.smoke_drink);
  2764. referenceNode.appendChild(newnode);
  2765. }
  2766. if (biodata.body_decorations){
  2767. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2768. newnode.getElementsByTagName("span")[0].innerHTML="Body Decorations:";
  2769. newnode.getElementsByTagName("td")[1].innerHTML=tocap(biodata.body_decorations);
  2770. referenceNode.appendChild(newnode);
  2771. }
  2772. if (biodata.social_medias[0]){
  2773. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2774. newnode.getElementsByTagName("span")[0].innerHTML="Social Media:";
  2775. newnode.getElementsByTagName("td")[1].innerHTML="Available on cam page.";
  2776. referenceNode.appendChild(newnode);
  2777. }
  2778. if (biodata.photo_sets[0]){
  2779. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2780. newnode.getElementsByTagName("span")[0].innerHTML="Photo/video:";
  2781. newnode.getElementsByTagName("td")[1].innerHTML="<a href='https://chaturbate.com/photo_videos/photoset/detail/"+roomname+"/"+biodata.photo_sets[0].id+"' target=_blank> Open in new tab.</a>";
  2782. referenceNode.appendChild(newnode);
  2783. }
  2784. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2785. newnode.getElementsByTagName("span")[0].innerHTML="About Me:";
  2786. newnode.getElementsByTagName("td")[1].innerHTML=biodata.about_me;
  2787. referenceNode.appendChild(newnode);
  2788. if (biodata.wish_list){
  2789. newnode=referenceNode.getElementsByTagName("tr")[2].cloneNode(true);
  2790. newnode.getElementsByTagName("span")[0].innerHTML="Wish List:";
  2791. newnode.getElementsByTagName("td")[1].innerHTML=biodata.wish_list;
  2792. referenceNode.appendChild(newnode);
  2793. }
  2794. }
  2795.  
  2796. })();