PageSourceSearch

https://mp3-juice.za.com/assets/js/comco-results.js

js mp3-juice.za.com collected 2026-10-09 05:18:35 UTC 6,922 bytes, 57 lines download raw bytes

1/* Build media results with DOM text nodes, keeping source titles out of markup. */
2(function () {
3  'use strict';
4  var results=document.getElementById('results'), load=document.getElementById('load'), input=document.getElementById('query');
5  if (!results || !window.jQuery) return;
6  var query=results.getAttribute('data-query') || '';
7  if (input) { input.value=''; input.defaultValue=''; }
8  window.addEventListener('pageshow',function(){if(input) input.value='';});
9  var paths={download:'M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5',play:'m8 4 12 8-12 8Z',close:'m6 6 12 12M6 18 18 6',stop:'M6 6h12v12H6Z',audio:'M3 14v-3a9 9 0 0 1 18 0v3M3 13h4v8H3ZM17 13h4v8h-4Z',video:'M3 5h14v14H3ZM17 9l5-3v12l-5-3',share:'m8 12 8-6m-8 6 8 6M7 12h.01M18 5h.01M18 19h.01'};
10  function icon(name) { var ns='http://www.w3.org/2000/svg', svg=document.createElementNS(ns,'svg'),path=document.createElementNS(ns,'path');svg.setAttribute('viewBox','0 0 24 24');svg.setAttribute('fill','none');svg.setAttribute('stroke','currentColor');svg.setAttribute('stroke-width','1.8');svg.setAttribute('aria-hidden','true');path.setAttribute('d',paths[name]||paths.download);svg.appendChild(path);return svg; }
11  function element(tag, text, cls) { var node=document.createElement(tag); if(text) node.textContent=text;if(cls) node.className=cls;return node; }
12  function label(control,text,symbol) { control.replaceChildren(icon(symbol),document.createTextNode(' '+text)); }
13  function button(text,symbol) {var node=element('button');node.type='button';label(node,text,symbol);return node;}
14  function link(text,url,symbol,external) {var node=element('a');node.href=url;label(node,text,symbol);if(external){node.target='_blank';node.rel='nofollow noopener noreferrer';}return node;}
15  function iframe(src,title,cls) {var node=element('iframe',null,cls);node.src=src;node.title=title;node.setAttribute('allow','autoplay');node.setAttribute('loading','eager');node.style.border='0';node.style.width='100%';return node;}
16  function message(text) {results.replaceChildren(element('p',text,'cc-result-message'));if(load)load.hidden=true;}
17  function decodeTitle(value) {
18    var named={amp:'&',quot:'"',apos:"'",lt:'<',gt:'>',nbsp:' '};
19    for(var pass=0;pass<2;pass++) value=value.replace(/&(#x[0-9a-f]+|#[0-9]+|amp|quot|apos|lt|gt|nbsp);/gi,function(full,key){if(key[0]!=='#')return named[key.toLowerCase()]||full;var cp=parseInt(key.slice(key[1].toLowerCase()==='x'?2:1),key[1].toLowerCase()==='x'?16:10);return cp>0&&cp<=0x10ffff&&!(cp>=0xd800&&cp<=0xdfff)?String.fromCodePoint(cp):full;});
20    return value;
21  }
22  function build(item,index) {
23    var id=String(item.id||'');if(!/^[A-Za-z0-9_-]{11}$/.test(id) || typeof item.title!=='string') return null;
24    var title=decodeTitle(item.title).replace(/\u2014/g,'-'), card=element('article',null,'result');card.id='result_'+index;
25    card.appendChild(element('h2',title,'name'));card.appendChild(element('p','Check the recording, then choose a file.','properties'));
26    var actions=element('div',null,'options');card.appendChild(actions);
27    actions.appendChild(link('Download Now','https://sowve.com/4/7e99b8b41ebfa5b9bcbb34a1c6fca106','download',true));
28    var download=button('Download','download'),play=button('Play','play'),panel=null,player=null;actions.append(download,play);
29    download.setAttribute('aria-expanded','false');play.setAttribute('aria-expanded','false');
30    download.addEventListener('click',function(){
31      if(panel){panel.remove();panel=null;label(download,'Download','download');download.setAttribute('aria-expanded','false');return;}
32      label(download,'Close','close');download.setAttribute('aria-expanded','true');panel=element('section',null,'file cc-file-panel');panel.setAttribute('aria-label','Download options for '+title);panel.appendChild(element('h3',title));panel.appendChild(element('p','Choose MP3 audio or MP4 video to load the available download control.'));
33      var formats=element('div',null,'options');panel.appendChild(formats);
34      ['mp3','mp4'].forEach(function(format){var control=button('Download '+format.toUpperCase(),format==='mp3'?'audio':'video'),frame=null;formats.appendChild(control);control.setAttribute('aria-expanded','false');control.addEventListener('click',function(){
35        if(frame){frame.remove();frame=null;label(control,'Download '+format.toUpperCase(),format==='mp3'?'audio':'video');control.setAttribute('aria-expanded','false');return;}
36        frame=iframe('https://clickapi.net/api/button/'+format+'?url='+encodeURIComponent('https://www.youtube.com/watch?v='+id),format.toUpperCase()+' download options','cc-provider-frame');panel.appendChild(frame);label(control,'Close '+format.toUpperCase(),'close');control.setAttribute('aria-expanded','true');
37      });});
38      formats.appendChild(link('More file options','/convert/?g='+encodeURIComponent(id)+'&t='+encodeURIComponent(title),'download',false));
39      var sharing=element('div',null,'options cc-share');sharing.appendChild(link('Share on Facebook','https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),'share',true));sharing.appendChild(link('Share on X','https://twitter.com/intent/tweet?url='+encodeURIComponent(location.href),'share',true));panel.appendChild(sharing);card.appendChild(panel);
40    });
41    play.addEventListener('click',function(){if(player){player.remove();player=null;label(play,'Play','play');play.setAttribute('aria-expanded','false');return;}player=iframe('https://www.youtube.com/embed/'+id,'Preview: '+title,'cc-player-frame');card.appendChild(player);label(play,'Stop','stop');play.setAttribute('aria-expanded','true');});
42    return card;
43  }
44  if(!query){message('Enter a song and artist to find matching recordings.');return;}
45  var pending=false;
46  function search(){
47    if(pending)return;pending=true;if(load)load.hidden=false;
48    window.jQuery.ajax({url:'/grab/json.php',data:{q:query},dataType:'json',timeout:30000}).done(function(response){
49      if(response && response.blocked){message('This recording is unavailable following a copyright removal request.');return;}
50      var items=response && Array.isArray(response.items)?response.items:[],cards=items.map(build).filter(Boolean);
51      if(!cards.length){message('No matching recordings were returned. Try the song title with its artist, or paste a specific video link.');return;}
52      results.replaceChildren(element('p',cards.length+' matching recordings for “'+query+'”. Check the title and preview before opening a download.','cc-result-summary'));
53      cards.forEach(function(card){results.appendChild(card);});
54    }).fail(function(){message('The music search did not respond. Your query is saved below so you can try again.');var retry=button('Try search again','download');retry.addEventListener('click',search);results.appendChild(retry);}).always(function(){pending=false;if(load)load.hidden=true;});
55  }
56  search();
57})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.