Skip to content

Instantly share code, notes, and snippets.

@LiamDawe
Created January 24, 2014 19:39
Show Gist options
  • Save LiamDawe/8604540 to your computer and use it in GitHub Desktop.
Save LiamDawe/8604540 to your computer and use it in GitHub Desktop.
// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// BBCode tags example
// http://en.wikipedia.org/wiki/Bbcode
// ----------------------------------------------------------------------------
// Feel free to add more tags
// ----------------------------------------------------------------------------
mySettings = {
markupSet: [
{name:'Bold', 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:'Bulleted list', openWith:'[ul]\n[li]', closeWith:'[/li]\n[/ul]'},
{name:'List item', openWith:'[li] [/li]'},
{separator:'---------------' },
{name:'Quotes', openWith:'[quote]', closeWith:'[/quote]'},
{name:'Code', openWith:'[code]', closeWith:'[/code]'},
{separator:'---------------' },
{name:'smilies', key:'S', className: 'smilies',
dropMenu :[
{name:'Angry', openWith:':><:', className: 'angry'},
{name:'Cry', openWith:':\'(', className: 'cry'},
{name:'Dizzy', openWith:':dizzy:', className: 'dizzy'}
]},
{name:'Clean', className:"clean", replaceWith:function(markitup) { return markitup.selection.replace(/\[(.*?)\]/g, "") } },
{name:'Insert You Tube Video', className: 'youtube', replaceWith: function(mark){
var nameYT = prompt('Enter You Tube URL', 'http://');
if (nameYT != null && nameYT != "" && nameYT != 'http://'){
var YTUrl = nameYT.replace('http://www.youtube.com/watch?v=', '');
$.markItUp( { replaceWith: '[youtube]'+YTUrl+'[/youtube]' } );
} else { return false; }
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment