= getVerN(cfg.jq_max_ver) ) {
b_load_jq = true;
}
}
}
return b_load_jq;
};
function loadScript(url, callback){
if ( !url ) {
callback( false );
return;
}
var script = document.createElement("script");
script.type = "text/javascript";
if (script.readyState){/*IE*/
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
callback( true );
}
};
} else {/*Others*/
script.onload = function(){
callback( true );
};
}
script.src = url;
//-- document.head.appendChild(script);
//-- document.head isn't available to IE<9. Just use
document.getElementsByTagName("head")[0].appendChild(script);
};
function run( $, appcfg ){
/*css
//==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>
//
// RM Ranking v6.00
// Copyright (c) phpkobo.com ( http://jpn.phpkobo.com/ )
// Email : admin@phpkobo.com
// ID : RMRANK-600J
//
//==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<
*/
//-- [polyfill] trim
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
}
//-- [polyfill] JSON
if (!window.JSON) {
window.JSON = {
parse: function(sJSON) { return eval('(' + sJSON + ')'); },
stringify: (function () {
var toString = Object.prototype.toString;
var isArray = Array.isArray || function (a) { return toString.call(a) === '[object Array]'; };
var escMap = {'"': '\\"', '\\': '\\\\', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t'};
var escFunc = function (m) { return escMap[m] || '\\u' + (m.charCodeAt(0) + 0x10000).toString(16).substr(1); };
var escRE = /[\\"\u0000-\u001F\u2028\u2029]/g;
return function stringify(value) {
if (value == null) {
return 'null';
} else if (typeof value === 'number') {
return isFinite(value) ? value.toString() : 'null';
} else if (typeof value === 'boolean') {
return value.toString();
} else if (typeof value === 'object') {
if (typeof value.toJSON === 'function') {
return stringify(value.toJSON());
} else if (isArray(value)) {
var res = '[';
for (var i = 0; i < value.length; i++) {
res += (i ? ', ' : '') + stringify(value[i]);
}
return res + ']';
} else if (toString.call(value) === '[object Object]') {
var tmp = [];
for (var k in value) {
if (value.hasOwnProperty(k)) {
tmp.push(stringify(k) + ': ' + stringify(value[k]));
}
}
return '{' + tmp.join(', ') + '}';
}
}
return '"' + value.toString().replace(escRE, escFunc) + '"';
};
})()
};
}
function printError( msg ) {
console.log( msg );
};
function hsc( s ) {
return $("").text(s).html();
};
function canCssAnim() {
var b = false;
elm = document.createElement("div");
if ( elm.style.animationName !== undefined ) {
b = true;
}
return b;
};
function ajaxSend( requ, obj, func ) {
$.ajax({
url:appcfg.url_server,
data:"requ="+encodeURIComponent(JSON.stringify(requ)),
dataType:"jsonp",
success:function(resp){
console.log(resp);
func.call(obj,resp);
},
error:function( jqXHR, textStatus, errorThrown ){
var s = "[$.ajax.error]\n";
s += jqXHR.responseText+"\n";
s += textStatus+"\n";
s += errorThrown;
printError( s );
}
});
};
var CFormatter = {
number_format : function( n ) {
return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
},
ffCount : function( cnt, cfmin ) {
return this.number_format( cnt );
}
};
function CRmRank( opt ) {
for( var key in opt ) { this[key] = opt[key]; }
if ( this.jqo_ctar.length ) {
this.setup();
}
};
CRmRank.prototype = {
setup :function() {
var _this = this;
this.rs = null;
//-- show info
if ( appcfg.info ) {
console.log("INFO","[jQuery version]",$.fn.jquery);
}
//-- init
},
printHtml : function( admin, html, state, sts ) {
var _this = this;
this.jqo_ctar.html(html);
if ( admin ) {
this.editMode();
} else {
if ( state ) {
this.jqo_ctar.find(".rmr-btn").click(function(e){
e.preventDefault();
var rec = {
iid:_this.iid,
vikey:$(this).parents(".rmr-item").attr("data-vikey"),
vbtype:$(this).attr("data-vbtype")
};
_this.onClick(rec);
});
} else {
this.jqo_ctar.find(".rmr-btn").css({
cursor:"default"
});
}
if ( !this.jqo_ctar.find(".rmr-countdown-msg").html() ) {
this.jqo_ctar.find(".rmr-countdown").remove();
}
this.updateData([],sts);
}
},
editMode : function() {
var _this = this;
var edit_func = function( jqo ){
var jqo_prt = jqo.parents(".rmr-inp");
var vikey = jqo_prt.attr("data-vikey");
var vbtype = jqo_prt.attr("data-vbtype");
var jqo_vcnt = jqo_prt.find(".rmr-inp-vcnt");
var vcnt = jqo_vcnt.val();
var vcnt = parseInt(vcnt);
if ( !isNaN(vcnt) ) {
jqo_vcnt.val(vcnt);
}
var rec = {
iid:_this.iid,
vikey:vikey,
vbtype:vbtype,
vcnt:vcnt
};
_this.onEdit(rec,jqo_prt);
};
this.jqo_ctar.find(".rmr-inp-vcnt").click(function(e){
e.preventDefault();
e.stopPropagation();
})
.keydown(function(e){
var cc = e.which;
if (( cc == 13 ) || ( cc == 32 )) {
e.preventDefault();
e.stopPropagation();
edit_func($(this));
}
});
this.jqo_ctar.find(".rmr-inp-enter").click(function(e){
e.preventDefault();
e.stopPropagation();
edit_func($(this));
})
.keydown(function(e){
var cc = e.which;
if (( cc == 13 ) || ( cc == 32 )) {
e.preventDefault();
e.stopPropagation();
edit_func($(this));
}
});
},
updateData : function( upd, sts ) {
for( var i=0; i