global variable

Minggu, 15 April 2012

Random AutoPlay Mp3 Player (updated)

·
<style type="text/css"><!--
a.tbl-stop, a.tbl-nek, a.tbl-ser{
  display:inline-block;
  padding:0 7px;
 -moz-border-radius:5px; border-radius:5px;
  border:1px outset #3B5998;
  background-color: #A62112;
  color:white;
  font-weight:bold;
  text-decoration:none;
}
a.tbl-stop{background-color:darkred;}
a.tbl-nek{background-color:darkgreen;}
a.tbl-ser{background-color:darkblue;}

a.tbl-stop:hover, a.tbl-nek:hover, a.tbl-ser:hover,
a.tbl-stop:active, a.tbl-nek:active, a.tbl-ser:active,
a.tbl-stop:focus, a.tbl-nek:focus, a.tbl-ser:focus{
  text-decoration:none;
  border:1px outset white;
  background-color:#3B5998;
  color:white;
}
--></style>





<marquee id="suster-ngesot-aing-luar" direction="left" scrollamount="1">
  <img id="gbr-suster-ngesot-aing" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii5y6u-lKe0cvex8t-0bBFwSCNoq4Ft63bzNuROdmfjhSw-s2pP6edPBMIWH656Sw-PwACNSXzySSIZP-S4ahMq9EPvntKhV0cMHT4F44LCqXWoWiCLYq28jygCk2F_8dGgokGkIeJd70/s128/thmonkey.gif"/>
  <span id="suster-ngesot-aing-dalem" style="font-size:9px; font-family:lucida grande,tahoma,verdana,arial,sans-serif; text-align:center;">
    gak usah liatin gue, cuekin aja..
  </span>
</marquee>





<script type="text/javascript">
<!--
//variables yang monggo dirubah
var namaPlayer = 'musik-player-aing';
var susterNgesot = 'suster-ngesot-aing';
var namaArrayLagu = 'laguCadangan';
var tinggiPlayer = 20;
var idAplikasiBuatShare = '202945083050895';

var laguCadangan = [
  "http://irland.heck.in/files/garasi-awakening.mp3",
  "http://irland.heck.in/files/slank-ngangkang.mp3"
];

//susunan Elements Player
var mpEmbedAing = '<div id="judul-'+namaPlayer+'"></div>';
    mpEmbedAing += '<embed id="'+namaPlayer+'" wmode="transparent" src="" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="top" height="'+tinggiPlayer+'"></embed>';
    mpEmbedAing += '<div id="kontrol-'+namaPlayer+'"></div>';

function cekElementsPlayer(){
  if(!document.getElementById(susterNgesot+'-dalem')){
    if(!document.getElementById('judul-'+namaPlayer)){
      alert('ELEMENT judul-'+namaPlayer+' GAK KETEMU COY');
    }
    if(!document.getElementById(namaPlayer)){
      alert('ELEMENT '+namaPlayer+' GAK KETEMU COY');
    }
    if(!document.getElementById('kontrol-'+namaPlayer)){
      alert('ELEMENT kontrol-'+namaPlayer+' GAK KETEMU COY');
    }
  }
}

cekElementsPlayer();

function stelMusikAing(mp3,judul,loop,play,langsungNyala,nextArrayName){
  if(nextArrayName==null || nextArrayName==''){
    nextArrayName = 'laguCadangan';
  }
  if(judul==null || judul==''){
    var ke = mp3.split('/').length-1;
    judul = unescape(mp3.split('/')[ke]);
  }

  if(loop==null || loop=='' || loop=='yes'){
    loop = 'yes';
  }else{
    loop = 'no';
  }

  if(play==null || play=='' || play=='yes'){
    play = 'yes';
  }else{
    play = 'no';
  }

  var swfPl = 'http://beemp3.com/player/player.swf?soundFile='+mp3;
  var flashvar = '&autostart='+play+'&loop='+loop+'&bg=0x000000&leftbg=0xAF2910&lefticon=0xF2F2F2&rightbg=0xD67919&rightbghover=0x1BAD07&righticon=0xF2F2F2&righticonhover=0xFFFFFF&text=0xE0E3F4&slider=0x357DCE&track=0xFFFFFF&border=0xFFFFFF&loader=0xAF2910';

  if(!document.getElementById(namaPlayer) && document.getElementById(susterNgesot+'-dalem')){
    document.getElementById(susterNgesot+'-dalem').style.display = 'inline-block';
    document.getElementById(susterNgesot+'-dalem').innerHTML = mpEmbedAing;
  }

  var tempatJudul = document.getElementById('judul-'+namaPlayer);
  var tempatMusik = document.getElementById(namaPlayer);
  var tempatKontrol = document.getElementById('kontrol-'+namaPlayer);
  var fncOnClick = 'if(document.getElementById(\''+namaPlayer+'\').style.display==\'block\'){document.getElementById(\''+namaPlayer+'\').style.display=\'none\'; this.innerHTML=\'play\';}else{document.getElementById(\''+namaPlayer+'\').style.display=\'block\'; this.innerHTML=\'stop\';}';

  tempatJudul.innerHTML = '<input type="text" id="bwtsrc-'+namaPlayer+'" style="display:none;" value="'+mp3+'"/>';
  tempatJudul.innerHTML += '<a href="'+mp3+'">'+unescape(judul)+'</a>';

  if(langsungNyala==null || langsungNyala=='' || langsungNyala=='yes'){
    tempatMusik.style.display='block';
    var stopApaPlay = 'stop';
  }else{
    tempatMusik.style.display='none';
    var stopApaPlay = 'play';
  }

  tempatMusik.src = swfPl+flashvar;
  tempatKontrol.innerHTML = '<a class="tbl-stop" href="javascript:void(0);" onClick="'+fncOnClick+'">'+stopApaPlay+'</a> ';
  tempatKontrol.innerHTML += '<a class="tbl-nek" href="javascript:nextMskAingDong('+nextArrayName+');void(0);">next</a> ';
  tempatKontrol.innerHTML += '<a class="tbl-ser" href="javascript:serAingOnFbAh();void(0);">share</a>';
}

function nextMskAingDong(eurey){
  if(eurey==null || eurey==''){
    eurey = laguCadangan;
  }

  eurey = eurey.sort(function() {return 0.5 - Math.random()});

  var ke = eurey[0].split('/').length-1;
  var judulnyateh = eurey[0].split('/')[ke];

  stelMusikAing(eurey[0],judulnyateh,'yes','yes','yes',namaArrayLagu);
}

function serAingOnFbAh(){
  var sumber = document.getElementById('bwtsrc-'+namaPlayer).value;

  var ke = sumber.split('/').length-1;
  var judulnyateh = unescape(sumber.split('/')[ke].replace(/.mp3/gi,''));

  var nama =  unescape(sumber.split('/')[ke]);
  var kapsen = ' ';
  var deskrip = document.title;

  var tgtid = prompt("Please enter your friend Id","");
  var ling = window.location.href.split('?')[0];

  if(tgtid!=null && tgtid!=""){
    var kepada = tgtid;
  }else{
    var kepada = '';
  }

  var atName = '"name":"'+nama+'"';
  var atHref = '"href":"'+ling+'"';
  var atCap = '"caption":"'+kapsen+'"';
  var atDes = '"description":"'+deskrip+'"';

  var atMed1Typ = '"type": "mp3"';
  var atMed1Src = '"src": "'+sumber+'"';
  var atMed1Art = '"artist": "'+document.location.hostname.split('.')[0]+'"';
  var atMed1Tit = '"title": "'+judulnyateh+'"';
  var atMed1Alb = '"album": "'+document.title+'"';
  var atMed1 = '{'+atMed1Typ+', '+atMed1Src+', '+atMed1Art+', '+atMed1Tit+', '+atMed1Alb+'}';
  var atMed = '"media":['+atMed1+']';

  var lampiran = '&attachment={'+atName+', '+atHref+', '+atCap+', '+atDes+', '+atMed+'}';

  var actLnk1Txt = '"text":"Read More.."';
  var actLnk1Hrf = '"href":"'+ling+'"';
  var actLnk1 = '{'+actLnk1Txt+', '+actLnk1Hrf+'}';
  var actLnk = '&action_links=['+actLnk1+']';

  var kirimKe = '&target_id='+kepada;

  var shareUrl = 'http://www.facebook.com/connect/prompt_feed.php?api_key='+idAplikasiBuatShare;
      shareUrl += lampiran;
      shareUrl += actLnk;
      shareUrl += kirimKe;

  openPopUpDongCuy(shareUrl,'600','300');
}

function openPopUpDongCuy(url,lebar,tinggi){
  var kiri = screen.availWidth/2-lebar/2;
  var atas = screen.availHeight/2-tinggi/2;
  var properties = 'width='+lebar+',height='+tinggi+',top='+atas+',left='+kiri;

  window.open(url,'popup',properties);
}

nextMskAingDong(laguCadangan);
//-->
</script>





//variables yang monggo dirubah
var namaPlayer = 'musik-player-aing';
var susterNgesot = 'suster-ngesot-aing';
var namaArrayLagu = 'laguCadangan';
var tinggiPlayer = 20;
var idAplikasiBuatShare = '202945083050895';
var laguCadangan = [
    "http://irland.heck.in/files/garasi-awakening.mp3",
    "http://irland.heck.in/files/slank-ngangkang.mp3"
];


Play satu lagu..
stelMusikAing(mp3,judul,loop,play,langsungNyala,nextArrayName); Contoh1:
stelMusikAing('http://irland.heck.in/files/slank-ngangkang.mp3','Slank - Ngangkang','yes','yes','yes','laguCadangan'); Contoh2:
stelMusikAing('http://irland.heck.in/files/slank-ngangkang.mp3');


Random AutoPlay..
nextMskAingDong(eurey); Contoh:
nextMskAingDong(laguCadangan);

Tidak ada komentar:

Posting Komentar

handapeunpost