Вход Регистрация
Файл: templates/Default/radio/files/parser.js
Строк: 83
//======================================================
// Dle Radio v.1 by Elegant Division (http://e-div.com)
//======================================================

function stripslashes( str ) {
    return (str+'').replace(//g, '0').replace(/\([\'"])/g, '$1');
}

function strip_tags(input, allowed) {
    allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
    var tags = /</?([a-z][a-z0-9]*)b[^>]*>/gi, commentsAndPhpTags = /<!--[sS]*?-->|<?(?:php)?[sS]*??>/gi;
    return 
input.replace(commentsAndPhpTags'').replace(tags, function($0, $1){
        return 
allowed.indexOf('<' + $1.toLowerCase() + '>') > -? $'';
    });
}

function 
lastfm(radiolfmserverdir) {

    var 
lang = ["<b>Информация об исполнителе:</b><br />""<br /><br /><b>Похожие исполнители:</b><br />""Информация отсутствует""Похожих исполнителей не найдено""Без загаловка""Загрузка..."],
        
songID "#song",
        
API "96e0589327a3f120074f74dbc8ec6443",
        
bioID ".bio",
        
coID ".cover img",
        
nocover dir "engine/modules/radio/template/files/nocover.jpg";
        
    $.
ajax({
        
urldir "engine/modules/radio/parser.php",
        
data"url=" radio "&server=" server,
        
dataType"html"
        
cachefalse,
        
timeout5000,
        
success: function( data ){

            if( 
data != "none" ) {
                
                $(
songID).html(strip_tags(data""));
                $(
document).attr("title"data);
                
                if( 
lfm == ) {
                        
                    var 
band data.split(" - ");
                
                    if( $(
bioID).attr("rel") != band[0] ) {
                
                        $.
ajax({
                            
url"http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=" encodeURI(band[0]) + "&api_key=" API "&lang=ru&format=json&callback=?",
                            
dataType"json",
                            
cachefalse,
                            
timeout5000,
                            
beforeSend: function() {
                                $(
bioID).text(lang[5]);
                            },
                            
success: function(result){
                                var 
sim "";
                                $.
each(result.artist.similar.artist, function(iitem){ if( item.name != "" ) { sim += item.name ", "; }});
                                
                                if( 
sim == "" ) { sim lang[3]; }
                
                                if( 
result.artist.image[2]['#text'] == "" ){ var cover nocover; } 
                                else { var 
cover stripslashes(result.artist.image[2]['#text']); }
                                
                                if( 
result.artist.bio.summary == "" ){ var biog lang[2]; }
                                else { var 
biog strip_tags(result.artist.bio.summary""); }
                            
                                $(
bioID).attr("rel"band[0]).html(lang[0] + biog lang[1] + sim);
                                $(
coID).attr("src"cover).attr("alt"band[0]);
                            },
                            
error: function(){
                                $(
bioID).attr("rel""").html(lang[0] + lang[2] + lang[1] + lang[3]);
                                $(
coID).attr("src"nocover)
                            }
                        });
                    }
                }
                
            } else {
                $(
songID).text(lang[4]);
                $(
document).attr("title"lang[4]);
                
                if( 
lfm == ) {
                    $(
coID).attr("src"nocover)
                    $(
bioID).attr("rel""").text(lang[2]);
                }
            }

        },
        
error: function(){
            $(
songID).text(lang[4]);
            $(
document).attr("title"lang[4]);

            if( 
lfm == ) {
                $(
coID).attr("src"nocover)
                $(
bioID).attr("rel""").text(lang[2]);
            }
        }
    });

}
Онлайн: 2
Реклама