1 // for console support
\r
2 if (typeof window.parent.console == 'undefined') {
\r
5 sprintf: function(args){
\r
6 if (typeof args == 'undefined') {
\r
10 if (args.length < 1) {
\r
14 if (typeof args[0] != 'string') {
\r
18 if (typeof RegExp == 'undefined') {
\r
22 if (args.length == 1) {
\r
28 var newString = args[0];
\r
29 var arr = new Array();
\r
30 var exp = new RegExp(/[^%](%)([a-zA-Z])/g);
\r
34 while (match = exp.exec(str) && argPos < args.length) {
\r
35 if (str[exp.lastIndex - 1] == "%") {
\r
39 if (str[exp.lastIndex - 1] == "d") {
\r
40 arr.push(str.substring(lastMatch, exp.lastIndex - 2));
\r
41 arr.push(args[argPos++]);
\r
44 if (str[exp.lastIndex - 1] == "i") {
\r
45 arr.push(str.substring(lastMatch, exp.lastIndex - 2));
\r
46 arr.push(args[argPos++]);
\r
49 if (str[exp.lastIndex - 1] == "f") {
\r
50 arr.push(str.substring(lastMatch, exp.lastIndex - 2));
\r
51 arr.push(args[argPos++]);
\r
54 if (str[exp.lastIndex - 1] == "s") {
\r
55 arr.push(str.substring(lastMatch, exp.lastIndex - 2));
\r
56 arr.push(args[argPos++]);
\r
59 if (str[exp.lastIndex - 1] != "%") {
\r
60 arr.push(str.substring(lastMatch, exp.lastIndex - 2));
\r
62 arr.push(args[argPos++]);
\r
65 lastMatch = exp.lastIndex;
\r
67 if (lastMatch < str.length) {
\r
68 arr.push(str.substring(lastMatch, str.length));
\r
70 while (argPos < args.length) {
\r
72 arr.push(args[argPos++]);
\r
74 return arr.join("").replace(/\%\%/g,"%");
\r
77 var errorStr = console.sprintf(arguments);
\r
79 _BRIDGE_REF.nokia.layout.log('error', errorStr);
\r
83 var errorStr = console.sprintf(arguments);
\r
85 _BRIDGE_REF.nokia.layout.log('info', errorStr);
\r
89 var errorStr = console.sprintf(arguments);
\r
91 _BRIDGE_REF.nokia.layout.log('warn', errorStr);
\r
95 var errorStr = console.sprintf(arguments);
\r
97 _BRIDGE_REF.nokia.layout.log('log', errorStr);
\r
101 var errorStr = console.sprintf(arguments);
\r
103 _BRIDGE_REF.nokia.layout.log('debug', errorStr);
\r
106 assert: function(){
\r
107 var errorStr = console.sprintf(arguments);
\r
114 // enable the Console.
\r
115 _BRIDGE_REF.nokia.layout._console_enabled = true;
\r
116 _BRIDGE_REF.nokia.layout.render();
\r
120 // make TRUE console.js script loaded
\r
121 window.parent.NOKIA.scriptsLoaded.console = true;
\r