All pastes #976159 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-07 23:26 UTC
rendered paste body

function quirks_widget (window) {
    this.name = "quirks-widget";
    text_widget.call (this, window);
    this.add_hook ("content_buffer_location_changed_hook", this.clear_flag)
    this.add_hook ("current_buffer_dom_content_loaded_hook", this.set_flag);
    this.add_hook ("select_buffer_hook", this.update);
}
quirks_widget.prototype.__proto__ = text_widget.prototype;

quirks_widget.prototype.update = function () {
    var buffer = this.window.buffers.current;
    var str = 'foo';
    dumpln ("update");
    dumpln (this.set_flag);
    if (buffer.quirks_flag == true) {
        if (buffer.top_document.compatMode == 'BackCompat')
            str = 'quirks';
        else
            str = 'standards';
    }      
    this.view.text = str;
}

quirks_widget.prototype.clear_flag = function () {
    dumpln ("clear_flag")
    this.window.buffers.current.quirks_flag = false;
}

quirks_widget.prototype.set_flag = function () {
    dumpln ("set_flag");
    dumpln (this.view);
    this.window.buffers.current.quirks_flag = true;
}

add_hook ("mode_line_hook", mode_line_adder (quirks_widget));