Sha256: d156b7694950f1ac65a4beffe555eecb275a30689abc2c2a302408d5ba219650

Contents?: true

Size: 1.51 KB

Versions: 25

Compression:

Stored size: 1.51 KB

Contents

jQuery(function($){
  $('textarea.editor').each(function(e){
    if(editorEnabled()) {
      loadEditor(this.id)
    }
  });  
})

function editorEnabled() {
  return $.cookie('editorEnabled') ? $.cookie('editorEnabled') == "true" : true
}

function disableEditor(id) {
  if(typeof(FCKeditorAPI) != "undefined" && FCKeditorAPI.GetInstance(id) != null) {
    
    //Prevent FCK from copying the value from the WYSIWYG to the textarea
    FCKeditorAPI.GetInstance(id).LinkedField = null
    
    $('#'+id).val(FCKeditorAPI.GetInstance(id).GetHTML()).show()
    $('#'+id+'___Frame').hide()
    $.cookie('editorEnabled', false, { expires: 90, path: '/' })    
  }
}

function enableEditor(id) {
  if(typeof(FCKeditorAPI) != "undefined" && FCKeditorAPI.GetInstance(id) != null) {
    FCKeditorAPI.GetInstance(id).SetHTML($('#'+id).val())
    $('#'+id).hide()
    $('#'+id+'___Frame').show()  
    $.cookie('editorEnabled', true, { expires: 90, path: '/' })    
  }
}

function toggleEditor(id, status) {
  loadEditor(id)
  if(status == 'Simple Text' || status.value == 'disabled'){
    disableEditor(id) 
  } else {
    enableEditor(id) 
  }
}

function loadEditor(id) {
  if(typeof(FCKeditorAPI) == "undefined" || FCKeditorAPI.GetInstance(id) == null) {
    var editor = new FCKeditor(id)
    editor.BasePath = "/fckeditor/"
    editor.ToolbarSet = 'CMS'
    editor.Width = 598
    editor.Height = 400
    editor.ReplaceTextarea()    
    $.cookie('editorEnabled', true, { expires: 90, path: '/' })  
    return true
  } else {
    return false
  }
}

Version data entries

25 entries across 25 versions & 9 rubygems

Version Path
SFEley-browsercms-3.0.2 public/javascripts/cms/editor.js
buzzware-browsercms-3.0.2 public/javascripts/cms/editor.js
coredumplings-browsercms-3.0.0 public/javascripts/cms/editor.js
jonleighton-bcms_feeds-1.0.1 public/javascripts/cms/editor.js
jonleighton-bcms_feeds-1.0.2 public/javascripts/cms/editor.js
nate-browsercms-3.0.210 public/javascripts/cms/editor.js
nate-browsercms-3.0.211 public/javascripts/cms/editor.js
we5-browsercms-3.0.1.1 public/javascripts/cms/editor.js
webficient-browsercms-3.0.1 public/javascripts/cms/editor.js
webficient-browsercms-3.0.2 public/javascripts/cms/editor.js
webficient-browsercms-3.0.3 public/javascripts/cms/editor.js
webficient-browsercms-3.0.4 public/javascripts/cms/editor.js
browsercms-3.0.6 public/javascripts/cms/editor.js
browsercms-3.0.5 public/javascripts/cms/editor.js
we5-browsercms-3.0.5.1 public/javascripts/cms/editor.js
we5-browsercms-3.0.5 public/javascripts/cms/editor.js
browsercms_s3-3.0.5 public/javascripts/cms/editor.js
browsercms-3.0.4 public/javascripts/cms/editor.js
browsercms-3.0.3 public/javascripts/cms/editor.js
browsercms_s3-3.0.4 public/javascripts/cms/editor.js