Added icon.
[ptas] / zouba.sb1 / wrt / preview / script / lib / widget.js
diff --git a/zouba.sb1/wrt/preview/script/lib/widget.js b/zouba.sb1/wrt/preview/script/lib/widget.js
deleted file mode 100644 (file)
index 93ff656..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/**\r
- * widget object constructor\r
- * @param {void}\r
- *     widget()\r
- * @return {void}\r
- */ \r
-\r
-if (typeof window.widget == "undefined" || !window.widget) {\r
-       window.widget = {\r
-               author : 'Nokia WRT Emulation Library',\r
-               //      widget identifier, dummy value\r
-               identifier: 14021981,\r
-               isrotationsupported: true,\r
-               \r
-               //      widget event triggers\r
-               onshow: null,\r
-               onhide: null,\r
-               \r
-               sysInfo: [],\r
-               onload: null,\r
-               opacity: 50,\r
-               interval: 20,\r
-               isFront: false,\r
-               preferenceArray: [],\r
-               preferenceKey: 0\r
-       };\r
-       \r
-       \r
-       /**\r
-        * Launches the browser with the specified url\r
-        * @param {String} url\r
-        *     openURL()\r
-        * @return {Void}\r
-        */\r
-       widget.openURL = function(url){\r
-               if (url) {\r
-                       window.open(url, "New Widget Window", 'height=200 width=250');\r
-               }\r
-       }\r
-       \r
-       \r
-       /**\r
-        * Returns previously stored preference associated with the specified key\r
-        * @param {String} Key preference value to be fetch\r
-        *     preferenceForKey()\r
-        * @return {String} Value\r
-        */\r
-       widget.preferenceForKey = function(name){\r
-               return _BRIDGE_REF.nokia.helper.readCookie(name);\r
-       }\r
-       \r
-       \r
-       /**\r
-        * Stores the key associated with the specified preference\r
-        * @param {String} Preference value to be stored\r
-        * @param {String} Key Preference value associated to\r
-        *     setPreferenceForKey()\r
-        * @return {Void}\r
-        */\r
-       widget.setPreferenceForKey = function(preference, key){\r
-               _BRIDGE_REF.nokia.helper.createCookie(key, preference);\r
-       }\r
-       \r
-       \r
-       \r
-       /**\r
-        * Toggle between Tabbed navigation mode or Cursor mode\r
-        * @param {Boolean} Value\r
-        *     setNavigationEnabled()\r
-        * @return {Void}\r
-        */\r
-       widget.setNavigationEnabled = function(bool){\r
-               //This function can not be used on preview browser\r
-       }\r
-       \r
-       \r
-       \r
-       /**\r
-        * Open S0-Application identified by UID along with the specified params\r
-        * @param {Integer} Uid hexadecimal value to a specified application\r
-        * @param {String} Value\r
-        *     openApplication()\r
-        * @return {Void}\r
-        */\r
-       widget.openApplication = function(Uid, param){\r
-               alert("openApplication function won't be simulated in this application");\r
-       }\r
-       \r
-       \r
-       \r
-       /**\r
-        * Prepares the Widget.to do transition to specified transitionState\r
-        * @param {String} Value Transition state\r
-        *     prepareForTransition()\r
-        * @return {Void}\r
-        */\r
-       widget.prepareForTransition = function(transitionState){\r
-               this.isFront = ("" + transitionState).toLowerCase() != "toback";\r
-               window.document.getElementsByTagName("body")[0].style.opacity = "0.3";\r
-       }\r
-       \r
-       \r
-       \r
-       \r
-       /**\r
-        * Does the animation to make the transition between the specified transitionState\r
-        * @param {Void}\r
-        *     performTransition()\r
-        * @return {Void}\r
-        */\r
-       widget.performTransition = function(){\r
-               var _self = this;\r
-               this.opacity = 0;\r
-               this.interval = window.setInterval(function(){\r
-                       _self.opacity += 0.2;\r
-                       if (_self.opacity > 1) {\r
-                               _self.opacity = 1;\r
-                       }\r
-                       window.document.getElementsByTagName("body")[0].style.opacity = _self.opacity + "";\r
-                       if (_self.opacity >= 1) {\r
-                               window.clearInterval(_self.interval);\r
-                               window.document.getElementsByTagName("body")[0].style.opacity = "1";\r
-                       }\r
-                       //do nothing\r
-               }, 50);\r
-               //do nothing\r
-       }\r
-       \r
-       \r
-       \r
-       \r
-       \r
-       /**\r
-        * Set the preferred screen orientation to landscape.\r
-        * The display will flip if the phone display orientation\r
-        * is portrait and the phone supports landscape mode.\r
-        * @param {Void}\r
-        *     setDisplayLandscape()\r
-        * @return {Void}\r
-        */\r
-       widget.setDisplayLandscape = function(){\r
-               try {\r
-                       if (this.isrotationsupported && _BRIDGE_REF.nokia.emulator.orientationSupports()) {\r
-                               _BRIDGE_REF.nokia.emulator.setMode('landscape');\r
-                       }\r
-               } \r
-               catch (e) {\r
-               }\r
-       }\r
-       \r
-       \r
-       \r
-       \r
-       /**\r
-        * Set the preferred screen orientation to portrait.\r
-        * The display will flip if the phone display orientation\r
-        * is landscape and the phone supports portrait mode.\r
-        * @param {Void}\r
-        *     setDisplayPortrait()\r
-        * @return {Void}\r
-        */\r
-       widget.setDisplayPortrait = function(){\r
-               try {\r
-                       if (this.isrotationsupported && _BRIDGE_REF.nokia.emulator.orientationSupports()) {\r
-                               _BRIDGE_REF.nokia.emulator.setMode('portrait');\r
-                       }\r
-               } \r
-               catch (e) {\r
-               }\r
-       }\r
-       \r
-       /**\r
-        * Allows the definition of a function to be called\r
-        * when a Widget.is displayed\r
-        * @param {Void}\r
-        *     onshow()\r
-        * @return {Void}\r
-        */\r
-       widget.onshow = function(){\r
-               // to be implemented\r
-       }\r
-       \r
-       \r
-       \r
-       \r
-       /**\r
-        * Allows the definition of a function to be called\r
-        * when a Widget.sent into the background (hidden)\r
-        * @param {Void}\r
-        *     onhide()\r
-        * @return {Void}\r
-        */\r
-       widget.onhide = function(){\r
-               // to be implemented\r
-       }\r
-       \r
-       \r
-       \r
-       /**\r
-        * This function returns the System API if sysinfo is included in document embed\r
-        */\r
-       widget.enableSystemApi = function(){\r
-       \r
-               //      Identify, and Attach System-Info-Object properties\r
-               try {\r
-                       var parentIframeRef = window.parent.frames[0];\r
-                       if (typeof parentIframeRef == 'object') {\r
-                               if (parentIframeRef.document.embeds.length > 0) {\r
-                                       for (var i = 0; i < parentIframeRef.document.embeds.length; i++) {\r
-                                               //match the system Info API embed tag\r
-                                               if (parentIframeRef.document.embeds[i].type == 'application/x-systeminfo-widget') {\r
-                                                       new systemAPI(parentIframeRef.document.embeds[i]);\r
-//                                                     widget.sysInfo = parentIframeRef.document.embeds[i];\r
-                                                       \r
-                                                       // hide the <embed> object\r
-                                                       parentIframeRef.document.embeds[i].style.display='none';\r
-                                                       \r
-                                                       // push the reference object into widget\r
-                                                       widget.sysInfo.push(parentIframeRef.document.embeds[i]);\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               } \r
-               catch (e) {\r
-                       alert('Error in attachSysInfo: ' + e);\r
-               }\r
-       }\r
-       \r
-       /**\r
-        * \r
-        */\r
-       \r
-       widget.triggerListener = function(provider, eventType, data){\r
-               if(widget.sysInfo.length){\r
-                       for(var i=0; i<widget.sysInfo.length; i++){\r
-                               if(provider == "power"){\r
-                                       switch(eventType){\r
-                                               case "chargerconnected" : \r
-                                                                                                 widget.sysInfo[i].chargerconnected = data;\r
-                                                                                                 if(widget.sysInfo[i].onchargerconnected != null){\r
-                                                                                                       setTimeout(widget.sysInfo[i].onchargerconnected, 0);\r
-                                                                                                 }else{\r
-                                                                                                               console.info("System API-1.0 Notice -- no listeners defined for eventType:"+eventType);\r
-                                                                                                 }\r
-                                                                                                 break;\r
-\r
-                                               case "chargelevel"              :\r
-                                                                                                 widget.sysInfo[i].chargelevel = data;\r
-                                                                                                 if(widget.sysInfo[i].onchargelevel != null){\r
-                                                                                                       setTimeout(widget.sysInfo[i].onchargelevel, 0);\r
-                                                                                                 }else{\r
-                                                                                                               console.info("System API-1.0 Notice -- no listeners defined for eventType:"+eventType);\r
-                                                                                                 }\r
-                                                                                                break;\r
-                                       }\r
-                               }\r
-                       }\r
-               }else{\r
-                       console.info("System API-1.0 Notice -- no listeners defined for eventType:"+eventType);\r
-               }\r
-       }\r
-       \r
-       //      make TRUE widget.js script loaded\r
-       window.parent.NOKIA.scriptsLoaded.widget = true;\r
-}\r
-\r
-(function(){\r
-\r
-       //      attach the System-Info api specific functionality\r
-       _BRIDGE_REF.helper.addEvent(window, 'load', function(){\r
-               widget.enableSystemApi();\r
-               \r
-       });\r
-\r
-       if (_BRIDGE_REF.nokia) {\r
-               _BRIDGE_REF.nokia.menu.lsk_event = function(){\r
-                       _BRIDGE_REF.nokia.emulator.child.menu.show();\r
-               };\r
-               \r
-               //      Add THIS window Reference on FRAME WINDOW\r
-               //      NOKIA.emulator.child object reference\r
-               _BRIDGE_REF.nokia.emulator.child = window;\r
-               _BRIDGE_REF.nokia.menu.init();\r
-       }       \r
-})()\r