skeleton/public/javascripts/lib/cleditor/jquery.cleditor.js
function refreshButtons(editor) {

    // Webkit requires focus before queryCommandEnabled will return anything but false
    if (!iOS && $.browser.webkit && !editor.focused) {
      editor.$frame[0].contentWindow.focus();
      window.focus();
      editor.focused = true;
    }

    // Get the object used for checking queryCommandEnabled
    var queryObj = editor.doc;
    if (ie) queryObj = getRange(editor);

    // Loop through each button
    var inSourceMode = sourceMode(editor);
    $.each(editor.$toolbar.find("." + BUTTON_CLASS), function(idx, elem) {

      var $elem = $(elem),
        button = $.cleditor.buttons[$.data(elem, BUTTON_NAME)],
        command = button.command,
        enabled = true;

      // Determine the state
      if (editor.disabled)
        enabled = false;
      else if (button.getEnabled) {
        var data = {
          editor: editor,
          button: elem,
          buttonName: button.name,
          popup: popups[button.popupName],
          popupName: button.popupName,
          command: button.command,
          useCSS: editor.options.useCSS
        };
        enabled = button.getEnabled(data);
        if (enabled === undefined)
          enabled = true;
      }
      else if (((inSourceMode || iOS) && button.name != "source") ||
      (ie && (command == "undo" || command == "redo")))
        enabled = false;
      else if (command && command != "print") {
        if (ie && command == "hilitecolor")
          command = "backcolor";
        // IE does not support inserthtml, so it's always enabled
        if (!ie || command != "inserthtml") {
          try {enabled = queryObj.queryCommandEnabled(command);}
          catch (err) {enabled = false;}
        }
      }

      // Enable or disable the button
      if (enabled) {
        $elem.removeClass(DISABLED_CLASS);
        $elem.removeAttr(DISABLED);
      }
      else {
        $elem.addClass(DISABLED_CLASS);
        $elem.attr(DISABLED, DISABLED);
      }

    });
  }
function refreshButtons(editor) {

    // Webkit requires focus before queryCommandEnabled will return anything but false
    if (!iOS && $.browser.webkit && !editor.focused) {
      editor.$frame[0].contentWindow.focus();
      window.focus();
      editor.focused = true;
    }

    // Get the object used for checking queryCommandEnabled
    var queryObj = editor.doc;
    if (ie) queryObj = getRange(editor);

    // Loop through each button
    var inSourceMode = sourceMode(editor);
    $.each(editor.$toolbar.find("." + BUTTON_CLASS), function(idx, elem) {

      var $elem = $(elem),
        button = $.cleditor.buttons[$.data(elem, BUTTON_NAME)],
        command = button.command,
        enabled = true;

      // Determine the state
      if (editor.disabled)
        enabled = false;
      else if (button.getEnabled) {
        var data = {
          editor: editor,
          button: elem,
          buttonName: button.name,
          popup: popups[button.popupName],
          popupName: button.popupName,
          command: button.command,
          useCSS: editor.options.useCSS
        };
        enabled = button.getEnabled(data);
        if (enabled === undefined)
          enabled = true;
      }
      else if (((inSourceMode || iOS) && button.name != "source") ||
      (ie && (command == "undo" || command == "redo")))
        enabled = false;
      else if (command && command != "print") {
        if (ie && command == "hilitecolor")
          command = "backcolor";
        // IE does not support inserthtml, so it's always enabled
        if (!ie || command != "inserthtml") {
          try {enabled = queryObj.queryCommandEnabled(command);}
          catch (err) {enabled = false;}
        }
      }

      // Enable or disable the button
      if (enabled) {
        $elem.removeClass(DISABLED_CLASS);
        $elem.removeAttr(DISABLED);
      }
      else {
        $elem.addClass(DISABLED_CLASS);
        $elem.attr(DISABLED, DISABLED);
      }

    });
  }
function refreshButtons ( editor ) { // Webkit requires focus before queryCommandEnabled will return anything but false
 if ( ! iOS && $ . browser . webkit && ! editor . focused ) { editor . $frame [ 0 ] . contentWindow . focus ( ) ; window . focus ( ) ; editor . focused = true ; } // Get the object used for checking queryCommandEnabled
 var queryObj = editor . doc ; if ( ie ) queryObj = getRange ( editor ) ; // Loop through each button
 var inSourceMode = sourceMode ( editor ) ; $ . each ( editor . $toolbar . find ( "." + BUTTON_CLASS ) , function ( idx , elem ) { var $elem = $ ( elem ) , button = $ . cleditor . buttons [ $ . data ( elem , BUTTON_NAME ) ] , command = button . command , enabled = true ; // Determine the state
 if ( editor . disabled ) enabled = false ; else if ( button . getEnabled ) { var data = { editor : editor , button : elem , buttonName : button . name , popup : popups [ button . popupName ] , popupName : button . popupName , command : button . command , useCSS : editor . options . useCSS } ; enabled = button . getEnabled ( data ) ; if ( enabled === undefined ) enabled = true ; } else if ( ( ( inSourceMode || iOS ) && button . name != "source" ) || ( ie && ( command == "undo" || command == "redo" ) ) ) enabled = false ; else if ( command && command != "print" ) { if ( ie && command == "hilitecolor" ) command = "backcolor" ; // IE does not support inserthtml, so it's always enabled
 if ( ! ie || command != "inserthtml" ) { try { enabled = queryObj . queryCommandEnabled ( command ) ; } catch ( err ) { enabled = false ; } } } // Enable or disable the button
 if ( enabled ) { $elem . removeClass ( DISABLED_CLASS ) ; $elem . removeAttr ( DISABLED ) ; } else { $elem . addClass ( DISABLED_CLASS ) ; $elem . attr ( DISABLED , DISABLED ) ; } } ) ; }
refreshButtons - enables or disables buttons based on availability
refreshButtons - enables or disables buttons based on availability