2013-02-15 80 views
1

我目前正在使用Jquery/Javascript編寫一個易於編輯的BB代碼腳本。唯一的問題是它不是我想要的那麼容易,所以我需要一些幫助。BB代碼清單Javascript

該腳本工作正常(添加到textarea的東西)。不過,我正在嘗試使演示文稿更好一些。

我會很感激,如果有人可以告訴我如何取消列表中的項目或至少隱藏的buttet點(可能做到這一點使用CSS),否則我可以編輯的JavaScript/jQuery的。

另外,當我滾動選項(對於粗體按鈕)時,它顯示代碼到按鈕(作爲標題)我想刪除這個,但我不能看到代碼的哪裏編輯它。

Screenshot of list/bb options

這裏是我的javascript代碼:

// ---------------------------------------------------------------------------- 
// markItUp! 
// ---------------------------------------------------------------------------- 
// Copyright (C) 2008 Jay Salvat 
// http://markitup.jaysalvat.com/ 
// ---------------------------------------------------------------------------- 
myBbcodeSettings = { 
    nameSpace:   "bbcode", // Useful to prevent multi-instances CSS conflict 
    previewParserPath: "~/sets/bbcode/preview.php", 
    markupSet: [ 
     {name:"<img src='_img/bold_icon.gif'>", key:'B', openWith:'[b]', closeWith:'[/b]'}, 
     {name:'Italic', key:'I', openWith:'[i]', closeWith:'[/i]'}, 
     {name:'Underline', key:'U', openWith:'[u]', closeWith:'[/u]'}, 
     {separator:'---------------' }, 
     {name:'Picture', key:'P', replaceWith:'[img][![Url]!][/img]'}, 
     {name:'Link', key:'L', openWith:'[url=[![Url]!]]', closeWith:'[/url]', placeHolder:'Your text to link here...'}, 
     {separator:'---------------' }, 
     {name:'Colors', openWith:'[color=[![Color]!]]', closeWith:'[/color]', dropMenu: [ 
      {name:'Yellow', openWith:'[color=yellow]', closeWith:'[/color]', className:"col1-1" }, 
      {name:'Orange', openWith:'[color=orange]', closeWith:'[/color]', className:"col1-2" }, 
      {name:'Red', openWith:'[color=red]', closeWith:'[/color]', className:"col1-3" }, 
      {name:'Blue', openWith:'[color=blue]', closeWith:'[/color]', className:"col2-1" }, 
      {name:'Purple', openWith:'[color=purple]', closeWith:'[/color]', className:"col2-2" }, 
      {name:'Green', openWith:'[color=green]', closeWith:'[/color]', className:"col2-3" }, 
      {name:'White', openWith:'[color=white]', closeWith:'[/color]', className:"col3-1" }, 
      {name:'Gray', openWith:'[color=gray]', closeWith:'[/color]', className:"col3-2" }, 
      {name:'Black', openWith:'[color=black]', closeWith:'[/color]', className:"col3-3" } 
     ]}, 
     {name:'Size', key:'S', openWith:'[size=[![Text size]!]]', closeWith:'[/size]', dropMenu :[ 
      {name:'Big', openWith:'[size=200]', closeWith:'[/size]' }, 
      {name:'Normal', openWith:'[size=100]', closeWith:'[/size]' }, 
      {name:'Small', openWith:'[size=50]', closeWith:'[/size]' } 
     ]}, 
     {separator:'---------------' }, 
     {name:'Bulleted list', openWith:'[list]\n', closeWith:'\n[/list]'}, 
     {name:'Numeric list', openWith:'[list=[![Starting number]!]]\n', closeWith:'\n[/list]'}, 
     {name:'List item', openWith:'[*] '}, 
     {separator:'---------------' }, 
     {name:'Quotes', openWith:'[quote]', closeWith:'[/quote]'}, 
     {name:'Code', openWith:'[code]', closeWith:'[/code]'}, 
     {separator:'---------------' }, 
     {name:'Clean', className:"clean", replaceWith:function(h) { return h.selection.replace(/\[(.*?)\]/g, "") } }, 
     {name:'Preview', className:"preview", call:'preview' } 
    ] 
} 

感謝您的幫助,您可以給我! :)

回答

1

使用PHP解析並添加一個簡單的腳本文本。