Kawiesh

[OLD] Random JS Experiments

Feb 11th, 2021 (edited)
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //--------------------SHADOW DOM------------------------------
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <style>
  7. html,body{
  8. position:absolute;
  9. top:0;bottom:0;
  10. left:0;right:0;
  11. display:flex;
  12. flex-direction:column;
  13. justify-content:center;
  14. align-items:center;            
  15. }      
  16. </style>
  17. <script>
  18. let template= document.createElement("template");
  19. template.innerHTML=`<style>
  20. #main{color:blue;}     
  21. #sec{color:blue;}      
  22. #secb{color:red;}
  23. .uno{background:pink;}
  24. #lolzy div{background:blue;}</style>
  25. <div> Main
  26. <div id="sec"> 2nd</div>
  27. <span>2b</span>
  28. </div>`;
  29.    
  30. class kdEl extends HTMLElement {
  31. constructor() {
  32. super();
  33. this.attachShadow({ mode: "open" });
  34. this.shadowRoot.appendChild(template.content.cloneNode(true));
  35. }
  36.  
  37. connectedCallback(){
  38. let x= this.shadowRoot.querySelector("span");
  39. x.contentEditable= this.getAttribute("edit");          
  40. this.id= this.getAttribute("id");      
  41. }
  42. }
  43.  
  44. customElements.define("kd-el", kdEl);
  45.  
  46. </script>
  47. </head>
  48. <body>
  49. <div>hii</div>
  50. <kd-el edit= "true"></kd-el>
  51. <kd-el  id="lolzy" edit= "true"></kd-el>
  52. <span>hiiisss</span>
  53. <script>
  54. let $= document.querySelector.bind(document),
  55. $$= document.querySelectorAll.bind(document);
  56.  
  57. //GIVEN IDS IN HTML ONLY WORK FOR OUTERDOM
  58. let a= $("#lolzy").shadowRoot.querySelector("span");
  59.  
  60. a.classList.add("uno");    
  61. </script>              
  62. </body>
  63. </html>
  64.  
  65. //--------------------RADIO REGEX------------------------------
  66. let a= /\bhttp:\/\/[^\/]*\/[^\s:"]*/gm;
  67.  
  68. let b=`
  69. "http://168.195.218.193:8000/radio1-1":"Rapar",
  70. "http://tbn.kloud.xyz:8050/radio.mp3":"Trishul",
  71. "http://108.59.9.147:8136/":"Rasonic",
  72. "http://sgm.kloud.xyz:8030/radio.mp3":"Sangeetmala",
  73. "http://nickerie.webhop.net:8000/;?type=http&amp;nocache=5286":"Ishara",
  74. "http://eksitara.kloud.xyz:8120/radio.mp3":"Ek Sitara",
  75. "http://79.143.187.96:8053/live":"Suvidha",
  76. "http://shruti.kloud.xyz:8000/radio.mp3":"Shruti",
  77. "https://amorfm_192.streampartner.nl/stream":"Amor",
  78. "http://86.82.62.172:8000/live":"Akaash",
  79. "http://94.23.148.11:8058/":"Vahon",
  80. "http://stream2.ujala.nl/stream/2/listen.mp3":"Ujalah",
  81. "http://stream.sunrisefm.nl:9600/stream":"Sunrise",
  82. "http://stream2.iqhosted.nl:8000/stream/1/":"Sangam"
  83. `;
  84.  
  85. alert(b.match(a).join('\n'));
  86.  
  87.  
  88.  
  89.  
  90. //--------------------Grab links with keywords------------------------------
  91. let a= "....",
  92.     b= document.querySelectorAll("a"),
  93.     c= [];
  94.  
  95. b.forEach(i=>{
  96. if(i.outerHTML.includes(a)){
  97. c.push(i.href);
  98. }
  99. });
  100.  
  101. if(c.length>0) location= c[0];
  102.  
  103.  
  104. //--------------------Google Direct Link------------------------------
  105. let a= document.querySelectorAll(".Zu0yb.UGIkD.qzEoUe");
  106.  
  107. a.forEach(i=>{
  108. let b= i.parentNode.parentNode.href;// or i.closest("a").href
  109. i.innerHTML= `<a href="${b}">${b}</a>`;
  110. i.style.border= "1px solid blue";
  111. });
  112.  
  113. //--------
  114. let a= document.querySelectorAll(".C8nzq.BmP5tf");
  115. let b= "http://kawiesh.tk/";
  116.  
  117. a.forEach(i=>{
  118. i.ping= "";
  119.  
  120. /*i.onclick=()=>{
  121. location= b+ i.href;
  122. return false;
  123. };*/
  124. });
  125.  
  126. //--------------podcast grab Indian-podcasts.com------------------------------
  127. let a= document.querySelectorAll("audio source");
  128. let a= document.querySelectorAll("audio source");
  129. let b= document.querySelectorAll("audio");
  130. let d= document.querySelectorAll(".max-w-full.flex-grow.py-4.px-6");
  131. let e= document.querySelectorAll(".text-lg.font-bold");
  132. let c= [];
  133.  
  134. a.forEach((i,x)=>{
  135. if(!d[x].innerHTML.includes("Bloopers")){
  136. c.push(`<a href="${decodeURIComponent(i.src).split("amur04/")[1]}">${e[x].innerText}</a><br>`);
  137. }
  138. });
  139.  
  140. let z= window.open();
  141. z.document.write(c.join("<br>"));
  142.  
  143. //-------
  144.  
  145. let
  146. select= document.querySelector.bind(document),
  147. create= document.createElement.bind(document),
  148. source= select("audio>source"),
  149. channel= select(".ep-ch-info"),
  150. episode= select(".ep-info-title"),
  151. time= select("audio"),
  152.  
  153. open= window.open("","_blank"),
  154.  
  155. audio= create("audio"),
  156. kd= create("source"),
  157. div= create("div"),
  158. forward= create("button"),
  159. rewind= create("button");
  160.  
  161. forward.style.position= "absolute";
  162. forward.style.right= "100px";
  163. forward.style.top= "50%";
  164. forward.innerHTML= "+10s";
  165. forward.onclick=()=> audio.currentTime+=10;
  166.  
  167. rewind.style.position= "absolute";
  168. rewind.style.left= "100px";
  169. rewind.style.top= "50%";
  170. rewind.innerHTML= "-10s";
  171. rewind.onclick=()=> audio.currentTime-=10;
  172.  
  173.  
  174. div.style.height= "20%";
  175. div.style.position= "absolute";
  176. div.style.width= "100%";
  177. div.style.top= "0%";
  178. div.append(forward,rewind);
  179. forward.type= "button";
  180. rewind.type= "button";
  181.  
  182. audio.append(kd);
  183. kd.src= source.src;
  184. audio.controls= true;
  185. audio.style.display= "block";
  186. audio.style.position= "absolute";
  187. audio.style.top= "20%";
  188. audio.style.width= "60%";
  189. audio.style.left= "20%";
  190.  
  191. open.document.body.style.backgroundColor="black";
  192. open.document.body.append(div,audio);
  193.  
  194. if(channel && episode){
  195. open.document.title=
  196. episode.innerText + " - " +
  197. channel.innerText;
  198. }
  199. else open.document.title= "X-Tracted Audio";
Add Comment
Please, Sign In to add comment