ginebra2/chrome/bedrockchrome/windowcount.snippet/windowcount.js
changeset 16 3c88a81ff781
parent 3 0954f5dd2cd0
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
     7  * area we need to see from the status bar and their backgrounds are set to none. The middle cell is
     7  * area we need to see from the status bar and their backgrounds are set to none. The middle cell is
     8  * used to display the circles and its bakground changes between black and white based
     8  * used to display the circles and its bakground changes between black and white based
     9  * on the display mode.
     9  * on the display mode.
    10  */
    10  */
    11 
    11 
       
    12 var FILLED_SRC = "/windowcount/filledcircle.png";
       
    13 var EMPTY_SRC = "/windowcount/emptycircle.png";
       
    14 
    12 //
    15 //
    13 // INIT the WindowCount snippet
    16 // INIT the WindowCount snippet
    14 //
    17 //
    15 function WindowCountBar(id)
    18 function WindowCountBar(id)
    16 {
    19 {
    17 
    20 
    18     this.id = id;
    21     this.id = id;
    19 
    22 
    20     this.begin =
    23     this.begin =
    21         '<table id="wcrow" align=center   >'+
    24         '<table id="wcrow" align=center>'+
    22         '<tr>'+
    25         '<tr>'+
    23         '<td id="wcfirst" style="background-color: transparent;">'+
    26         '<td id="wcfirst" style="background-color: transparent;">'+
    24         '</td>'+
    27         '</td>'+
    25         '<td  id="wccontent">';
    28         '<td  id="wccontent">';
    26 
    29 
    27     this.filledimg =
    30     this.filledimg =
    28         '<img class="wcicon" src="windowcount.snippet/icons/filledcircle.png" >' ;
    31         '<img class="wcicon" src="' + FILLED_SRC + '" >';
    29 
    32 
    30     this.emptyimg =
    33     this.emptyimg =
    31         '<img class="wcicon" src="windowcount.snippet/icons/emptycircle.png" >' ;
    34         '<img class="wcicon" src="' + EMPTY_SRC + '" >';
    32 
    35 
    33     this.end =
    36     this.end =
    34         '</td>'+
    37         '</td>'+
    35         '<td id="wclast" style="background-color: transparent;">'+
    38         '<td id="wclast" style="background-color: transparent;">'+
    36         '</td>'+
    39         '</td>'+
    37         '</tr>'+
    40         '</tr>'+
    38         '</table>' ;
    41         '</table>';
    39 
    42 
    40     this.InitWCBar = function()  {
    43     this.InitWCBar = function()  {
    41         this.wcOneWindow();
    44         this.wcOneWindow();
    42         this.setId();
    45         this.setId();
    43     }
    46     }
   103             document.write(htmlText);
   106             document.write(htmlText);
   104         }
   107         }
   105     }
   108     }
   106 
   109 
   107     this.wcTwoWindows = function() {
   110     this.wcTwoWindows = function() {
       
   111 
   108         var htmlText = '' +
   112         var htmlText = '' +
   109                 this.begin + this.emptyimg + this.emptyimg + this.end;
   113                 this.begin + this.emptyimg + this.emptyimg + this.end;
   110 
   114 
   111         this.setHtmlText(htmlText)
   115         this.setHtmlText(htmlText)
   112 
       
   113 
   116 
   114     }
   117     }
   115 
   118 
   116     this.wcThreeWindows = function() {
   119     this.wcThreeWindows = function() {
   117         var htmlText = '' +
   120         var htmlText = '' +
   155         else  if (window.views.current().type == "WindowView" ){
   158         else  if (window.views.current().type == "WindowView" ){
   156             index = window.views.WindowView.currentPageIndex();
   159             index = window.views.WindowView.currentPageIndex();
   157         }
   160         }
   158 
   161 
   159         //app.debug("setCurrentIndex: View " + window.views.current().type  + " Index : " + index);
   162         //app.debug("setCurrentIndex: View " + window.views.current().type  + " Index : " + index);
   160         Icons[index].setAttribute('src', "windowcount.snippet/icons/filledcircle.png");
   163         Icons[index].setAttribute('src', FILLED_SRC);
   161     }
   164     }
   162 
   165 
   163 
   166 
   164     this.setSnippetPosition = function() {
   167     this.setSnippetPosition = function() {
   165 
   168 
   166         if (window.snippets.WindowCountBarId ) {
   169         if (window.snippets.WindowCountBarId ) {
       
   170 
   167             mode = window.chrome.displayMode;
   171             mode = window.chrome.displayMode;
   168             if (mode == "portrait") {
   172             if (mode == "portrait") {
   169                 window.snippets.WindowCountBarId.setPosition(0,27);
   173                 window.snippets.WindowCountBarId.setPosition(0,27);
   170             }
   174             }
   171             else if (mode == "landscape") {
   175             else if (mode == "landscape") {