Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

josafah

Erro no javascript

Recommended Posts

este script é do meu blogger. Quando eu posto uma musica aqui hospedo no zippyshare e na postagem vai assim --> [m]http://www48.zippyshare.com/v/ccylrRvg/file.html[/m] - o script chama a musica e toca, mas depois que o zippyshare mudou as estruturas dos links o player parou de funcionar. Antes os links eram assim (http://www25.zippyshare.com/v/49975200/file.html)
agora termina com letras e números ao invés de apenas números como antes,
veja nesse link a postagem como está.
(postagem com link novo não funciona)
(Postagem com link antigo funciona)
eu até mexi nas expressões regulares mas não dei conta de concertar
Alguém aí sabe concertar o código pra funcionar com esse novo tipo de link do zippyshare?
Espero que eu tenha explicado melhor dessa vez.
Este é o script -->
<!-- Player -->
<script type='text/javascript'>
//<![CDATA[ 
var $_ = function(a) {
        if (document.getElementById) return document.getElementById(a)
    },
    M = new ANCMusic;

function ANCMusic() {
    m_w = this.width;
    i_1 = this.id1;
    i_2 = this.id2;
    au = this.auto;
    this.r = function() {
        var a = $_(i_1).innerHTML,
            a = a.replace(/\[m\]/gi, "<span id='anc_ms' style='display: none;'>"),
            a = a.replace(/\[\/m\]/gi, "</span>");
        $_(i_1).innerHTML = a;
        return z = $_("anc_ms").innerHTML
    };
    this.p = function(a) {
        $_(i_2).innerHTML = M.l(a)
    };
    this.l = function(a) {
        var d = "",
            b = []; - 1 != a.indexOf("zing.vn") && (b = a.match(/[\d\w]+/gi), c = b.length - 2, d = o(b[c])[0], M.css("60")); - 1 != a.indexOf("nhaccuatui.com") && (a = a.replace(/nghe\?M\=/gi, "m/"), d = o(a)[1], M.css("8")); - 1 != a.indexOf("zippyshare.com") && (b = a.match(/\d+/gi), d = o(b)[2]); - 1 != a.indexOf("nhacso.net") && (b = a.match(/[\d\w]+/gi), c = b.length - 2, d = o(b[c])[3], M.css("35")); - 1 != a.indexOf("nhac.vui.vn") && (b = a.match(/[0-9]+/gi), d = o(b[0])[4]); - 1 != a.indexOf("musik.soha.vn") && (b = a.match(/\bd[\w\d]+/gi), d = o(b[0].replace(/d/gi, ""))[5]); - 1 != a.indexOf(".m4a") && (b = a.match(/\bd[\w\d]+/gi), d = o(b[0].replace(/d/gi, ""))[5]); - 1 != a.indexOf(".mp3") && -1 == a.indexOf("zing.vn") && (d = o(a)[6]); - 1 != a.indexOf("youtube.com") && (a = a.replace(/\/watch\?v=/gi, "/watch?v="), a = a.replace(/\&feature=related/gi, ""), d = o(a)[7]);
        return d
    };
    this.css = function(a) {
        css = "<style>";
        css += "#jbb_play{margin:0;}";
        css += "</style>";
        document.write(css)
    }
}
var o = function(a) {
    _mode = 'quality="high" wmode="transparent" type="application/x-shockwave-flash" allowscriptaccess="always"';
    _zing = 'quality="high" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"';
    return data = ['<embed width="' + m_w + '" height="80" src="http://mp3.zing.vn/embed/song/' + a + "?autostart=" + au + '" ' + _zing + "/>", '<embed width="' + m_w + '" height="318" flashvars="&autostart=' + au + '" src="' + a + '" ' + _mode + "/>", '<embed width="' + m_w + '" height="20" src="http://www' + a[0] + '.zippyshare.com/swf/player.swf" ' + _mode + ' flashvars="&file=http://www' + a[0] + ".zippyshare.com/downloadMusic?key=" + a[1] + "&time=1&volume=100&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=00E4E4&repeat=alway&logo=&autostart=" + au + '&skin=http://player.v1vn.com/cassette/cassette.xml&type=flv"/><div id="download">http://adf.ly/4830814/http://www' + a[0] + '.zippyshare.com%2Fv%2F' + a[1] + '%2Ffile.html</div>', '<embed width="' + m_w + '" height="60" autostart="true" ' + _mode + ' flashvars="xmlPath=http://nhacso.net/flash/song/xnl/1/id/' + a + "&adsLink=&colorAux=0xff4a4a&colorMain=0xeffcfc&colorBorder=0x078939&typePlayer=single&mAuto=" + au + '" src="http://st.nhacso.net/flash/v61/embedPlaylistjs.swf"/>', '<embed width="' + m_w + '" height="127" flashvars="playlistfile=http://hn.nhac.vui.vn/asx2.php%3Ftype%3D1%26id%3D' + a + "&frontcolor=1717f7&lightcolor=ff4a4a&screencolor=000000&bufferlength=10&volume=100&playlist=bottom&playlistsize=60&autostart=" + au + '&repeat=no&controlbar=bottom&dock=false&plugins=http://hn.nhac.vui.vn/upload/players/spectrumvisualizer-1.swf&spectrumvisualizer.effect=reflection" src="http://player.longtailvideo.com/player.swf"/>', '<embed width="' + m_w + '" height="318" ' + _mode + ' flashvars="&autostart=' + au + '" src="http://musik.soha.vn/share/k14/track/' + a + '" />', "	<embed " + _mode + ' flashvars="&file=' + a + "&image=http://byt.wpengine.netdna-cdn.com/wp-content/uploads/2013/06/Rap-underground-deltron-3030.jpg&autostart=" + au + '&menu=false&repeat=always&stretching=uniform&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=0xff0000" src="http://dj.so1vn.vn/js/jwhplayer.swf" height="50" width="' + m_w + '" ></embed><div id="download">' + a + '</div>', "<embed " + _mode + ' src="https://jakub-bb-net.googlecode.com/svn/trunk/jbbplayer.swf" flashvars="file=http://www.youtube.com/watch?v=' + a + '&logo=http://www.iconsdb.com/icons/preview/white/facebook-like-m.png&image=http://1.bp.blogspot.com/--OB9yaipUw8/VGHBLmYERSI/AAAAAAAAARk/WPZp7F7BES8/s1600/baixarmelody-video-2.jpg&repeat=true&autostart=true" allowfullscreen="true" height="388" width="' + m_w + '"></embed><div id="download">' + a + '</div>']
};
//]]>
</script>
<script>
var z = { width: "100%", id1: "Blog1", id2: "jbb_play", auto: "true", };
ANCMusic.call(z);
M.p(M.r());
</script>
<!-- End player -->

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

expliquei diferente nesse outro tópico pra ve se alguém entendia o problema.

Sei que isso é apenas um erro nas expressões regulares mas infelizmente não consigo resolver e preciso de ajuda e tá dificil de conseguir.

Compartilhar este post


Link para o post
Compartilhar em outros sites

É difícil ajudar, pq esse código tá horrível de ler.

 

Certamente foi minificado em algum momento e depois expandido, ai perdeu o nome das variáveis, perdeu o sentido de várias coisas, e fica ruim lermos um código q não faz sentido.

 

 

Creio que por isso, vc não recebeu ajuda ainda.

Sério, olha isso:

b = []; - 1 != a.indexOf("zing.vn") && (b = a.match(/[\d\w]+/gi), c = b.length - 2, d = o(b[c])[0], M.css("60")); - 1 != a.indexOf("nhaccuatui.com") && (a = a.replace(/nghe\?M\=/gi, "m/"), d = o(a)[1], M.css("8")); - 1 != a.indexOf("zippyshare.com") && (b = a.match(/\d+/gi), d = o(b)[2]); - 1 != a.indexOf("nhacso.net") && (b = a.match(/[\d\w]+/gi), c = b.length - 2, d = o(b[c])[3], M.css("35")); - 1 != a.indexOf("nhac.vui.vn") && (b = a.match(/[0-9]+/gi), d = o(b[0])[4]); - 1 != a.indexOf("musik.soha.vn") && (b = a.match(/\bd[\w\d]+/gi), d = o(b[0].replace(/d/gi, ""))[5]); - 1 != a.indexOf(".m4a") && (b = a.match(/\bd[\w\d]+/gi), d = o(b[0].replace(/d/gi, ""))[5]); - 1 != a.indexOf(".mp3") && -1 == a.indexOf("zing.vn") && (d = o(a)[6]); - 1 != a.indexOf("youtube.com") && (a = a.replace(/\/watch\?v=/gi, "/watch?v="), a = a.replace(/\&feature=related/gi, ""), d = o(a)[7]);
não tenho tempo e nem força de vontade suficiente para organizar humanamente esse trecho.

Tente melhorar um mínimo, se não, muito difícil alguém se propor a mexer em palheiro assim..

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.