<%- translate("Select contents:")%>
'
@@ -242,15 +265,24 @@
+ '
<% } %>
'
);
+Rkns.Renkan.prototype.translate = function(_text) {
+ if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {
+ return Rkns.i18n[this.options.language][_text];
+ }
+ if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0,2)] && Rkns.i18n[this.options.language.substr(0,2)][_text]) {
+ return Rkns.i18n[this.options.language.substr(0,2)][_text];
+ }
+ return _text;
+};
+
Rkns.Renkan.prototype.onStatusChange = function() {
- this.renderer.onStatusChange();
-}
-
+ this.renderer.onStatusChange();
+};
Rkns.Renkan.prototype.setSearchEngine = function(_key) {
this.search_engine = this.search_engines[_key];
this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current " + this.search_engine.getBgClass());
-}
+};
Rkns.Renkan.prototype.resizeBins = function() {
var _d = + this.$.find(".Rk-Bins-Head").outerHeight();
@@ -260,13 +292,14 @@
this.$.find(".Rk-Bin-Main").css({
height: this.$.find(".Rk-Bins").height() - _d
});
-}
+};
/* Utility functions */
Rkns.Utils = {
_ID_AUTO_INCREMENT : 0,
_ID_BASE : (function(_d) {
+
function pad(n){return n<10 ? '0'+n : n}
function fillrand(n) {
var _res = ''
@@ -279,40 +312,47 @@
+ pad(_d.getUTCMonth()+1) + '-'
+ pad(_d.getUTCDate()) + '-'
+ fillrand(16);
+
})(new Date()),
getUID : function(_base) {
+
var _n = (++this._ID_AUTO_INCREMENT).toString(16),
_base = (typeof _base === "undefined" ? "" : _base + "-" );
while (_n.length < 4) {
_n = '0' + _n
}
return _base + this._ID_BASE + '-' + _n;
+
},
getFullURL : function(url) {
-
- if(typeof(url) == 'undefined' || url == null ) {
- return "";
- }
- if(url.indexOf("http://")==0) {
- return url;
- }
- var img = new Image();
- img.src = url;
- var res = img.src;
- img.src = null;
- return res;
+
+ if(typeof(url) == 'undefined' || url == null ) {
+ return "";
+ }
+ if(/https?:\/\//.test(url)) {
+ return url;
+ }
+ var img = new Image();
+ img.src = url;
+ var res = img.src;
+ img.src = null;
+ return res;
+
},
inherit : function(_baseClass, _callbefore) {
- var _class = function() {
+
+ var _class = function(_arg) {
if (typeof _callbefore === "function") {
_callbefore.apply(this, Array.prototype.slice.call(arguments, 0));
}
_baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
- if (typeof this._init == "function") {
+ if (typeof this._init == "function" && !this._initialized) {
this._init.apply(this, Array.prototype.slice.call(arguments, 0));
+ this._initialized = true;
}
}
- _class.prototype = new _baseClass();
+ Rkns._(_class.prototype).extend(_baseClass.prototype);
return _class;
+
}
-}
\ No newline at end of file
+};