Symbian.org/preview/script/lib/loader.js
author ivanl
Tue, 21 Jul 2009 12:16:25 +0100
changeset 10 07ac2f6a36a9
parent 0 54498df70f5d
permissions -rw-r--r--
1.0rc10 Fixes annoyances and buglets in reading forums and blog.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     1
/*
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     2
 * Emulator, which manages the device interacations
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     3
 */
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     4
if (typeof _BRIDGE_REF == "undefined" || !_BRIDGE_REF) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     5
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     6
	var _BRIDGE_REF = {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     7
		parent: window.parent || false,
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     8
		nokia: window.parent.NOKIA || false,
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
     9
		sysInfoObject : null
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    10
	};
0
54498df70f5d Adding Symbian.org Widget 1.0rc3 source
ivanl
parents:
diff changeset
    11
10
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    12
	_BRIDGE_REF.namespace = function(name){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    13
		var parts = name.split('.');
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    14
		var current = _BRIDGE_REF;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    15
		for (var key in parts) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    16
			if (!current[parts[key]]) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    17
				current[parts[key]] = {};
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    18
			}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    19
			current = current[parts[key]];
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    20
		}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    21
	};
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    22
	
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    23
	/*
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    24
	 * _BRIDGE_REF.helper functions
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    25
	 */
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    26
	_BRIDGE_REF.namespace('helper.loadScript');
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    27
	_BRIDGE_REF.helper = {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    28
		path: document.location.pathname,
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    29
		loadScript: function(path){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    30
			var head = document.getElementsByTagName("head")[0] || document.documentElement;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    31
			var script = document.createElement("script");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    32
			
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    33
			script.type = "text/javascript";
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    34
			script.src = path;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    35
			head.appendChild(script);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    36
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    37
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    38
		createCookie: function(name, value){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    39
			var days = 240000;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    40
			if (days) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    41
				var date = new Date();
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    42
				date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    43
				var expires = "; expires=" + date.toGMTString();
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    44
			}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    45
			else 
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    46
				var expires = "";
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    47
			var value = "Nokia_WRT#" + _BRIDGE_REF.helper.path + "#" + name + "=" + value;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    48
			document.cookie = value + expires + "; Emulator.path=/"
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    49
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    50
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    51
		readCookie: function(name){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    52
			name = "Nokia_WRT#" + _BRIDGE_REF.helper.path + "#" + name;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    53
			var nameEQ = name + "=";
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    54
			var ca = document.cookie.split(';');
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    55
			for (var i = 0; i < ca.length; i++) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    56
				var c = ca[i];
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    57
				while (c.charAt(0) == ' ') 
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    58
					c = c.substring(1, c.length);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    59
				if (c.indexOf(nameEQ) == 0) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    60
					return c.substring(nameEQ.length, c.length);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    61
				}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    62
			}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    63
			return undefined;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    64
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    65
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    66
		updateMainCookie: function(doucment){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    67
			var temp = "";
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    68
			name = "Nokia_WRT#" + widget.path;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    69
			for (var k = 0; k < widget.preferenceArray.length; k++) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    70
				temp = temp + "|" + widget.preferenceArray[k];
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    71
			}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    72
			this.createCookie(document, name, temp, 24000);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    73
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    74
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    75
		addEvent: function(obj, type, fn){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    76
			if (obj.addEventListener) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    77
				obj.addEventListener(type, fn, false);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    78
			}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    79
			else 
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    80
				if (obj.attachEvent) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    81
					obj["e" + type + fn] = fn;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    82
					obj[type + fn] = function(){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    83
						obj["e" + type + fn](window.event);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    84
					}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    85
					obj.attachEvent("on" + type, obj[type + fn]);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    86
				}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    87
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    88
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    89
		getElementsLengthInObject : function(items){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    90
			var count = 0;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    91
			for (var i in items) 
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    92
				count++;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    93
			
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    94
			return count;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    95
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    96
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    97
		getBatteryStrength : function(){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    98
			
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
    99
/*			if(!_BRIDGE_REF.sysInfoObject)
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   100
				_BRIDGE_REF.sysInfoObject = device.getServiceObject("Service.SysInfo", "ISysInfo");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   101
			
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   102
			var result = _BRIDGE_REF.sysInfoObject.ISysInfo.GetInfo({
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   103
				Entity	: 'Battery',
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   104
				Key		:	'ChargingStatus'
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   105
			});
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   106
			
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   107
			if(!result.ErrorCode)
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   108
			{
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   109
				return result.Status;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   110
			}else
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   111
			{
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   112
				alert('Error in getting Battery Strength: '+result.ErrorCode);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   113
				return 0;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   114
			}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   115
			if(typeof device.implementation.data["Service.SysInfo"].default.battery.batterystrength.Status != 'undefined')
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   116
				return device.implementation.data["Service.SysInfo"].default.battery.batterystrength.Status;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   117
			else
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   118
				return 0;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   119
*/
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   120
		},
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   121
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   122
		console : function(){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   123
			if (!typeof window.console) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   124
				_BRIDGE_REF.helper.loadScript("preview/script/lib/console.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   125
			}			
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   126
		}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   127
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   128
	};
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   129
	
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   130
	
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   131
	/*
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   132
	 Load Scripts
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   133
	 */
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   134
	_BRIDGE_REF.helper.loadScript("preview/script/lib/widget.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   135
	_BRIDGE_REF.helper.loadScript("preview/script/lib/systeminfo.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   136
	_BRIDGE_REF.helper.loadScript("preview/script/lib/menu.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   137
	_BRIDGE_REF.helper.loadScript("preview/script/lib/menuItem.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   138
	_BRIDGE_REF.helper.loadScript("preview/script/lib/console.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   139
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   140
	//	Inject SAPI scripts	
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   141
	if (_BRIDGE_REF.nokia) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   142
		var wrtVersion = _BRIDGE_REF.nokia.helper.readCookie('_WRT_VERSION');
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   143
		if ((typeof wrtVersion == 'undefined') || (wrtVersion == 'WRT 1.1')) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   144
			_BRIDGE_REF.nokia.version = 'WRT 1.1';
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   145
			_BRIDGE_REF.nokia.helper.createCookie('_WRT_VERSION', 'WRT 1.1');
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   146
			_BRIDGE_REF.helper.loadScript("preview/script/lib/device.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   147
		}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   148
		else {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   149
			_BRIDGE_REF.nokia.version = 'WRT 1.0';
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   150
		}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   151
	}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   152
	else {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   153
		_BRIDGE_REF.helper.loadScript("preview/script/lib/device.js");
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   154
	}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   155
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   156
	/*
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   157
	 window native functions over-riding
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   158
	 */
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   159
	if ( (typeof window.frameElement != 'undefined') && (typeof _BRIDGE_REF.nokia  != 'undefined') && window !== window.parent) {
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   160
		//	alert
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   161
		window.alert = function(msg){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   162
			return window.parent.alert(msg);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   163
		};
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   164
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   165
		//	confirm
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   166
		window.confirm = function(msg){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   167
			return window.parent.confirm(msg);
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   168
		};
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   169
		
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   170
		//	prompt
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   171
		window.prompt = function(msg, str){
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   172
			return window.parent.prompt(msg, str)
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   173
		};
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   174
	}
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   175
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   176
	//	make TRUE loader.js script loaded
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   177
	window.parent.NOKIA.scriptsLoaded.loader = true;
07ac2f6a36a9 1.0rc10 Fixes annoyances and buglets in reading forums and blog.
ivanl
parents: 0
diff changeset
   178
0
54498df70f5d Adding Symbian.org Widget 1.0rc3 source
ivanl
parents:
diff changeset
   179
}