JSon configuration file

Content of markitup/sets/advanced/set.js

// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
myAdvancedSettings = {
    nameSpace:       "advanced", // Useful to prevent multi-instances CSS conflict
    onShiftEnter:    {keepDefault:false, replaceWith:'<br />\n'},
    onCtrlEnter:     {keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'},
    onTab:           {keepDefault:false, openWith:'     '},
    markupSet:  [
        {name:'Colors', className:'colors', dropMenu: [
            {name:'Yellow',  replaceWith:'#FCE94F',     className:"col1-1" },
            {name:'Yellow',  replaceWith:'#EDD400',     className:"col1-2" },
            {name:'Yellow',  replaceWith:'#C4A000',     className:"col1-3" },
            {name:'Orange',  replaceWith:'#FCAF3E',     className:"col2-1" },
            {name:'Orange',  replaceWith:'#F57900',     className:"col2-2" },
            {name:'Orange',  replaceWith:'#CE5C00',     className:"col2-3" },
            {name:'Brown',   replaceWith:'#E9B96E',     className:"col3-1" },
            {name:'Brown',   replaceWith:'#C17D11',     className:"col3-2" },
            {name:'Brown',   replaceWith:'#8F5902',     className:"col3-3" },
            {name:'Green',   replaceWith:'#8AE234',     className:"col4-1" },
            {name:'Green',   replaceWith:'#73D216',     className:"col4-2" },
            {name:'Green',   replaceWith:'#4E9A06',     className:"col4-3" },
            {name:'Blue',    replaceWith:'#729FCF',     className:"col5-1" },
            {name:'Blue',    replaceWith:'#3465A4',     className:"col5-2" },
            {name:'Blue',    replaceWith:'#204A87',     className:"col5-3" },
            {name:'Purple',  replaceWith:'#AD7FA8',     className:"col6-1" },
            {name:'Purple',  replaceWith:'#75507B',     className:"col6-2" },
            {name:'Purple',  replaceWith:'#5C3566',     className:"col6-3" },
            {name:'Red',     replaceWith:'#EF2929',     className:"col7-1" },
            {name:'Red',     replaceWith:'#CC0000',     className:"col7-2" },
            {name:'Red',     replaceWith:'#A40000',     className:"col7-3" },
            {name:'Gray',    replaceWith:'#FFFFFF',     className:"col8-1" },
            {name:'Gray',    replaceWith:'#D3D7CF',     className:"col8-2" },
            {name:'Gray',    replaceWith:'#BABDB6',     className:"col8-3" },
            {name:'Gray',    replaceWith:'#888A85',     className:"col9-1" },
            {name:'Gray',    replaceWith:'#555753',     className:"col9-2" },
            {name:'Gray',    replaceWith:'#000000',     className:"col9-3" }
            ]
        },
        {separator:'---------------' },
        {name:'Calculator', 
         className:'calculator',
         replaceWith:function(markItUp) { 
            try { 
                return eval(markItUp.selection); 
            }
            catch(e){} 
         }
        }, 
        {name:'Sort',
         className:"sort",
         replaceWith:function(markItUp) { 
            var s = markItUp.selection.split((($.browser.mozilla) ? "\n" : "\r\n"));
            s.sort();
            if (markItUp.altKey) s.reverse();
            return s.join("\n");
         }
        },    
        {name:'Date', 
         className:"date", 
         replaceWith:function() { 
            var date = new Date()
            var weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
            var monthname = ["January","February","March","April","May","June","July","August","September","October","November","December"];
            var D = weekday[date.getDay()];
            var d = date.getDate();
            var m = monthname[date.getMonth()];
            var y = date.getFullYear();
            var h = date.getHours();
            var i = date.getMinutes();
            var s = date.getSeconds();
            return (D +" "+ d + " " + m + " " + y + " " + h + ":" + i + ":" + s);
         }
        },    
        {name:'Encode Html special chars',
         className:"encodechars", 
         replaceWith:function(markItUp) { 
            c = document.createElement('div');
            c.appendChild(document.createTextNode(markItUp.selection));
            return c.innerHTML; 
         }
        },
        {separator:'---------------' },
        {name:'Email selection', 
         className:'email', 
         beforeInsert:function(markItUp) { 
                if (markItUp.altKey) {
                    email = prompt("Email:");
                } else {
                    email = "";    
                }
                subject = prompt("Subject:", "From markItUp! editor");
                document.location="mailto:"+email+"?subject="+escape(subject)+"&body="+escape(markItUp.selection); 
            } 
        },
        {separator:'---------------' },
        {name:'monitor callback',
         className:"debug",
         openWith:"<open>", 
         closeWith:"<close>", 
         placeHolder:"some text...",
         replaceWith:function(markItUp) { 
            miu.monitor("replaceWith", markItUp); 
            return markItUp.line+" - "+markItUp.selection 
         },
         beforeInsert:function(markItUp) { 
            miu. monitor("beforeInsert", markItUp)
         },
         afterInsert:function(markItUp) { 
             miu.monitor("afterInsert", markItUp)
         },
         beforeMultiInsert:function(markItUp) {
             miu.monitor("beforeMultiInsert", markItUp)
         },
         afterMultiInsert:function(markItUp) {
             miu.monitor("afterMultiInsert", markItUp)
         }        
      }
   ]
}

miu = {
    monitor: function (type, markItUp) {
        monitored = (type == "beforeInsert") ? "" : $("#monitor").html()+"<br/>";
        debug  = "<b>" + type + "</b> - caretPosition : "     + markItUp.caretPosition + "<br/>";
        debug += "<b>" + type + "</b> - selection : "         + markItUp.selection + "<br/>";
        debug += "<b>" + type + "</b> - line : "             + markItUp.line + "<br/>";
        debug += "<b>" + type + "</b> - openWith : "         + markItUp.openWith.toString().replace("<", "&lt;") + "<br/>";
        debug += "<b>" + type + "</b> - closeWith : "         + markItUp.closeWith.toString().replace("<", "&lt;") + "<br/>";
        debug += "<b>" + type + "</b> - replaceWith : "     + markItUp.replaceWith.toString().replace("<", "&lt;") + "<br/>";
        debug += "<b>" + type + "</b> - placeHolder : "     + markItUp.placeHolder.toString().replace("<", "&lt;") + "<br/>";
        $("#monitor").html(monitored + debug);
    }
}