sysperfana/memspyext/com.nokia.s60tools.heapanalyser/Binaries/HeapDataJavaScriptLib.js
changeset 7 8e12a575a9b5
equal deleted inserted replaced
6:f65f740e69f9 7:8e12a575a9b5
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * Redistribution and use in source and binary forms, with or without
       
     6 * modification, are permitted provided that the following conditions are met:
       
     7 *
       
     8 * - Redistributions of source code must retain the above copyright notice,
       
     9 *   this list of conditions and the following disclaimer.
       
    10 * - Redistributions in binary form must reproduce the above copyright notice,
       
    11 *   this list of conditions and the following disclaimer in the documentation
       
    12 *   and/or other materials provided with the distribution.
       
    13 * - Neither the name of Nokia Corporation nor the names of its contributors
       
    14 *   may be used to endorse or promote products derived from this software
       
    15 *   without specific prior written permission.
       
    16 *
       
    17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
       
    18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
       
    21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
       
    22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
       
    23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
       
    24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
       
    25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       
    26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
       
    27 * POSSIBILITY OF SUCH DAMAGE.
       
    28 * 
       
    29 * Initial Contributors:
       
    30 * Nokia Corporation - initial contribution.
       
    31 *
       
    32 * Contributors:
       
    33 *
       
    34 * Description: 
       
    35 *
       
    36 */
       
    37 
       
    38 var info = document.createElement("div");
       
    39 var header = document.createElement("div");
       
    40 var body = document.createElement("div");
       
    41 
       
    42 function initialize()
       
    43 {
       
    44      info.style.position="absolute";
       
    45      info.style.visibility='hidden';
       
    46 
       
    47      setGeneralStyle(header);
       
    48 
       
    49      header.style.fontWeight='bold';
       
    50      header.style.color='#4B7A98';
       
    51      header.style.background='#D5EBF9';
       
    52 
       
    53      setGeneralStyle(body);
       
    54 
       
    55      body.style.borderTop='0px';
       
    56      body.style.color='#1B4966';
       
    57      body.style.background='#FFFFFF';
       
    58 
       
    59      info.appendChild(header);
       
    60      info.appendChild(body);
       
    61 
       
    62      document.body.appendChild(info);
       
    63 }
       
    64 
       
    65 function setGeneralStyle(elm)
       
    66 {
       
    67      elm.style.fontFamily='arial';
       
    68      elm.style.fontSize='10';
       
    69      elm.style.padding='2';
       
    70      elm.style.border='1px solid #A5CFE9';
       
    71 }
       
    72 
       
    73 function showInfo(title, text, width)
       
    74 {
       
    75      header.innerHTML = title;
       
    76      body.innerHTML = text;
       
    77  
       
    78      if ( width )
       
    79      {
       
    80           header.style.width = width + "px";
       
    81           body.style.width = width + "px";
       
    82      }
       
    83      else
       
    84      {
       
    85           header.style.width = '180px';
       
    86           body.style.width = '180px';
       
    87      }
       
    88  
       
    89      info.style.visibility = 'visible';
       
    90 }
       
    91 
       
    92 function hideInfo()
       
    93 {
       
    94      info.style.visibility = 'hidden';
       
    95 }
       
    96 
       
    97 function mouseMove(e)
       
    98 {
       
    99      if ( info.style.visibility == 'visible' )
       
   100      {
       
   101           var evt;
       
   102 
       
   103           e?evt=e:evt=event;
       
   104 
       
   105           var x, y;
       
   106 
       
   107           if ( !evt.pageX )
       
   108                 x = evt.x + document.body.scrollLeft;
       
   109           else
       
   110                 x = evt.pageX;
       
   111 
       
   112           info.style.left = x + 15;
       
   113 
       
   114           if ( !evt.pageY )
       
   115                 y  = evt.y + document.body.scrollTop;
       
   116           else
       
   117                 y = evt.pageY;
       
   118 
       
   119           info.style.top = y + 15;
       
   120       }
       
   121 }
       
   122 
       
   123 function showMainFormCell( txt )
       
   124 {
       
   125     var currentURL = parent.MainWindow.location.toString();
       
   126     var hashPos = currentURL.indexOf('#');
       
   127 
       
   128     if  ( hashPos >= 0 )
       
   129     {
       
   130         var hashArray = currentURL.split("#");
       
   131         currentURL = hashArray[ 0 ];
       
   132     }
       
   133 
       
   134     var newURL = currentURL + '#Cell_' + txt;
       
   135  
       
   136     parent.MainWindow.location = newURL;
       
   137 }