function ranking_get(cn,ct,sn,en){
url = 'http://ranking.cansystem.info/output/j/ranking/ranking_custom.php';
if(sn == ''){ sn = '0'; }
if(en == ''){ en = 10; }
if(ct == ''){ ct = 1; }
if(cn == ''){ cn = 'ranking1'; }
pars = 'cn=' + cn + '&ct=' + ct + '&sn=' + sn + '&en=' + en;
var oj = new Ajax.Request(
url,{
method: 'get',
parameters: pars,
onComplete : ranking_onloaded
}
);
}
function ranking_onloaded(resoj){
eval("var rres = " + resoj.responseText);
result = rres.result;
cn = rres.cn;
if(result != 'error'){
period = rres[cn].period;
//nextpage = rres[cn].page + 1;
//prevpage = rres[cn].page - 1;
list = rres[cn].data;
tag = '
' + rres[cn].date + '(' + period + ')
' +
'' +
'' +
'' +
'順位 | SONG | ARTIST | ';
for(i = 0; i < list.length; i++){
this_data = list[i];
if(this_data.last1rank == "0" && this_data.last2rank == "0" && this_data.last3rank == "0" && this_data.last4rank == "0"){
arrow = ' ';
}else if( ( this_data.last1rank == "0" || this_data.last1rank == "" ) && this_data.last2rank != ""){
if(this_data.rank == this_data.last2rank){
arrow = ' ';
}else if(this_data.rank > this_data.last2rank){
arrow = ' ';
}else if(this_data.rank < this_data.last2rank){
arrow = ' ';
}
}else{
if(this_data.rank == this_data.last1rank){
arrow = ' ';
}else if(this_data.rank > this_data.last1rank){
arrow = ' ';
}else if(this_data.rank < this_data.last1rank){
arrow = ' ';
}
}
if(cn == 'ranking2'){
type = 2;
}else{
type = 1;
}
while(this_data.song.indexOf(" ", 0) >= 0) {
this_data.song = this_data.song.replace(" ","");
}
while(this_data.artist.indexOf(" ", 0) >= 0) {
this_data.artist = this_data.artist.replace(" ","");
}
usn = encodeURI(this_data.song);
uan = encodeURI(this_data.artist);
sn = this_data.song;
an = this_data.artist;
s_detail = '/song/?sn=' + sn + '&an=' + an + '&tp=' + type;
a_detail = '/artist/?an=' + an + '&tp=' + type;
if(cn == 'ranking1' || cn == 'ranking2'){
tag += ' ' + arrow + ' | ' +
'' + this_data.song + ' | ' +
'' + this_data.artist + ' | ';
}else{
tag += ' | ' +
'' + this_data.song + ' | ' +
'' + this_data.artist + ' | ';
}
}
if(rres[cn].start != 0 && rres[cn].start != ""){
var sn_m = rres[cn].start - 0 - 1;
var up_button = '';
}else{
var up_button = '';
}
if(rres[cn].n1link > 0){
var sn_p = rres[cn].start - 0 + 1;
var down_button = '';
}else{
var down_button = '';
}
var baseurl = 'http://ranking.cansystem.info/';
if(rres.cn == "ranking1"){
var k = "rj";
}else if(rres.cn == "ranking2"){
var k = "rw";
}else if(rres.cn == "ranking3"){
var k = "ij";
}else if(rres.cn == "ranking5"){
var k = "ie";
}
if(rres[cn].p1link > 0){
var p1url = baseurl + "?k=" + k + "&s=" + rres[cn].p1sn + "&e=" + rres[cn].p1en;
var p1link = '<< ' + rres[cn].p1name + '';
}else{ var p1link = ""; }
// if($rdata['P2LINK'] > 0){
// var p2url = baseurl + "?k=" + k + "&c=" + rres[cn].p2ct + "&e=" + rres[cn].p2en;
// var p2link = '<< ' + rres[cn].p12name + '';
// }
if(rres[cn].n1link > 0){
var n1url = baseurl + "?k=" + k + "&s=" + rres[cn].n1sn + "&e=" + rres[cn].n1en;
var n1link = '' + rres[cn].n1name + ' >>';
}else{ var n1link = ""; }
// if($rdata['N2LINK'] > 0){
// var n2url = baseurl + "?k=" + k + "&c=" + rres[cn].n2ct + "&e=" + rres[cn].n2en;
// var n2link = '' + rres[cn].n2name + ' >>';
// }
tag += ' ';
tag += ' | ';
tag += '' + up_button;
tag += ' |
';
tag += '' + down_button;
tag += ' | ';
tag += '
';
tag += '
';
tag += '';
tag += '
';
tag += '- ' + p1link + '
';
tag += '- ' + n1link + '
';
tag += '
';
tag += '
';
$('ranking_result').innerHTML = tag;
//alert(tag);
}
}
function graf_swf_run_debug(sn,an,mr,k){
var sfile;
switch (k){
case "1":
sfile = "/common/swf/Song_Chart_150_debug.swf";
break;
case "2":
sfile = "/common/swf/Song_Chart_50_debug.swf";
break;
default:
sfile = "/common/swf/Song_Chart_150_debug.swf";
}
document.write('\n');
}
function graf_swf_run(sn,an,mr,k) {
/*-------------------------------------
SONG名とARTIST名からチャートグラフを
SWFで出力します。
SONG詳細ページとARTIST詳細ページから
呼び出します。
--------------------------------------*/
var sfile;
switch (k){
case "1":
sfile = "/common/swf/Song_Chart_150.swf";
break;
case "2":
sfile = "/common/swf/Song_Chart_50.swf";
break;
default:
sfile = "/common/swf/Song_Chart_150.swf";
}
document.write('\n');
}
function encodeURL(str) {
var character = '';
var unicode = '';
var string = '';
var i = 0;
for (i = 0; i < str.length; i++) {
character = str.charAt(i);
unicode = str.charCodeAt(i);
if (character == ' ') {
string += '+';
} else {
if (unicode == 0x2a || unicode == 0x2d || unicode == 0x2e || unicode == 0x5f || ((unicode >= 0x30) && (unicode <= 0x39)) || ((unicode >= 0x41) && (unicode <= 0x5a)) || ((unicode >= 0x61) && (unicode <= 0x7a))) {
string = string + character;
} else {
if ((unicode >= 0x0) && (unicode <= 0x7f)) {
character = '0' + unicode.toString(16);
string += '%' + character.substr(character.length - 2);
} else if (unicode > 0x1fffff) {
string += '%' + (oxf0 + ((unicode & 0x1c0000) >> 18)).toString(16);
string += '%' + (0x80 + ((unicode & 0x3f000) >> 12)).toString(16);
string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
} else if (unicode > 0x7ff) {
string += '%' + (0xe0 + ((unicode & 0xf000) >> 12)).toString(16);
string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
} else {
string += '%' + (0xc0 + ((unicode & 0x7c0) >> 6)).toString(16);
string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
}
}
}
}
return string;
}