Changeset 194

Show
Ignore:
Timestamp:
08/31/08 22:06:04 (4 months ago)
Author:
rgrp
Message:

[js/controllers][s]: fixes to get controllers working when 'console' not available.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/microfacts/public/behaviour/app/controllers/geochronopage_controller.js

    r193 r194  
    4141} 
    4242 
    43 // setupPageController(GeochronoPageController); 
     43// for some reason just does not work ... 
     44// BaseController.createPageController('GeochronoPageController'); 
  • trunk/microfacts/public/behaviour/app/controllers/threadpage_controller.js

    r186 r194  
    9393 
    9494if (Environment != "test") { 
     95    // stub a console if it does not exist (so work if firebug is not available) 
     96    if (!console) { 
     97        var console = { 
     98            'log': function() { 
     99            }, 
     100            'error': function() { 
     101            } 
     102        }; 
     103    } 
    95104    window.addEvent('domready', function () { 
    96105        // using document as argument causes problems 
  • trunk/microfacts/public/behaviour/app/views/timelineview.js

    r179 r194  
    3737        // Substitute native 'show bubble' behaviour. 
    3838        eventPainter = this.band.getEventPainter(); 
     39        this._oldShowBubble = eventPainter._showBubble.bind(eventPainter); 
    3940        eventPainter._showBubble = this.onEventSelect.bind(this); 
    4041    }, 
     
    6364    }, 
    6465 
     66    // underlying simile timeline handler 
    6567    onEventSelect: function(x, y, timelineEvent) { 
    6668        var factletObject = this.findFactletFromEvent(timelineEvent); 
     
    6870        this.log("factlet object:"); 
    6971        this.log(factletObject); 
    70         this.fireEvent('factletSelect', factletObject, x, y); 
     72        this.fireEvent('factletSelect', factletObject, x, y, timelineEvent); 
    7173    }, 
    7274 
    73     onFactletSelect: function(factletObject, x, y) { 
     75    onFactletSelect: function(factletObject, x, y, timelineEvent) { 
    7476        this.log("TimelineView: saw factletSelect event"); 
    7577        this.log("factlet object:"); 
  • trunk/microfacts/public/behaviour/lib/moovc.js

    r193 r194  
    33 
    44    log: function(message) { 
    5     //    console.log(message); 
     5        console.log(message); 
    66    }, 
    77 
    88    error: function(message) { 
    9     //    console.error(message); 
     9        console.error(message); 
    1010    } 
    1111 
     
    139139}); 
    140140 
    141 var setupPageController = function(controllerClass) { 
    142 if (Environment != "test") { 
    143     // define a non-functional console function for when firebug is not available 
    144     if (!console) { 
    145         var console = { 
    146             'log': function() { 
    147             }, 
    148             'error': function() { 
    149             } 
    150         }; 
     141 
     142// for some reason just does not work ... 
     143BaseController.createPageController = function(controllerClassName) { 
     144    if (Environment != "test") { 
     145        // define a non-functional console function for when firebug is not available 
     146        if (!console) { 
     147            var console = { 
     148                'log': function() { 
     149                }, 
     150                'error': function() { 
     151                } 
     152            }; 
     153        } 
     154        window.addEvent('domready', function () { 
     155            eval("var constructor = " + controllerClassName); 
     156            new constructor(document) 
     157        }); 
    151158    } 
    152     window.addEvent('domready', function () { 
    153         new controllerClass(document); 
    154     }); 
    155 } 
    156159};