/***\n|''Name:''|AdjustEditorRows|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBar addon|\n|''Required:''|WikiBar 2.0.0+|\n!Description\nadjust rows of editor\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // define tools\n var adjustEditorRows={\n CAPTION:'adjust rows of editor',\n HANDLER: AdjustEditorRows_getRows\n };\n\n // register tools\n wikibarStore.addon.adjustEditorRows = adjustEditorRows;\n}\n\nfunction AdjustEditorRows_getRows(param){\n var rows = prompt('input rows of editor', config.maxEditRows);\n if(rows && !isNaN(rows)){\n config.maxEditRows = rows;\n\n var editor = param.button.editor;\n editor.rows = rows;\n }\n}\n\n\n\n//}}}
/***\n|''Name:''|CssStripper|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBar addon|\n|''Required:''|WikiBar 2.0.0+|\n!Description\nreduce the size of css\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // define tools\n var cssStripper={\n CAPTION:'css stripper',\n HANDLER: CssStripper_doIt\n };\n\n // register tools\n wikibarStore.addon.cssStripper = cssStripper;\n}\n\nCssStripper_doIt = function(param){\n\n clearMessage();\n try{\n var editor = param.button.editor;\n var codes = editor.value;\n\n // strip multi-line javascript comment\n codes = codes.replace(/\s/\s*(\ss*|.*?)*\s*\s//g, '');\n\n // strip single-line comment, except ://\n// codes = codes.replace(/[^\s:]\s/\s/.*$/gm, '');\n\n// // convert tab to space\n// codes = codes.replace(/\st/g, ' ');\n//\n// // rtirm\n// codes = codes.replace(/([ ]+$)/gm, ''); // ltrim | rtrim\n\n // strip redundant white-spaces or tabs\n codes = codes.replace(/(\st|[ ])+/g, ' ');\n codes = codes.replace(/((^[ ]+)|([ ]+$))/gm, ''); // ltrim | rtrim\n\n// // strip redundant newline\n// codes = codes.replace(/(\sn|\sr)+/g, '\sn');\n\n // strip all newline\n codes = codes.replace(/(\sn|\sr)+/g, '');\n\n // strip redundant white-space between delimiters\n delis = ',:;{}()';\n for(i=0; i<delis.length; i++){\n deli = delis.charAt(i);\n var regx = new RegExp('[ ]*\s\s' + deli + '[ ]*', 'g');\n //print(regx);\n codes = codes.replace(regx, deli);\n }\n\n if(editor.value!=codes){\n editor.value=codes;\n displayMessage('CSS strip ok!');\n }else{\n displayMessage('nothing changed');\n }\n\n }catch(ex){\n alert('error: ' + ex);\n }\n}\n\n\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n\n\n//}}}
/***\n|''Name:''|DateFormatString|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBar addon|\n|''Required:''|WikiBar 2.0.0+|\n!Description\nAdd date format string syntax.\n!Installation\n#Install WikiBar firstly.\n#Create your addon as a tiddler and add 'wikibarAddons' tag.\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused)\n{\n // define tools\n var dateFormatString={\n TYPE:'MENU',\n CAPTION: 'date format string',\n TOOLTIP: 'often used with \s"today\s" macro',\n YYYY:\n {\n TOOLTIP: 'full year',\n syntax: 'YYYY',\n HANDLER: wikibar_editFormatByCursor\n },\n YY:\n {\n TOOLTIP: '2-digit year',\n syntax: 'YY',\n HANDLER: wikibar_editFormatByCursor\n },\n MMM:\n {\n TOOLTIP: 'month name',\n syntax: 'MMM',\n HANDLER: wikibar_editFormatByCursor\n },\n MM:\n {\n TOOLTIP: 'month',\n syntax: 'MM',\n HANDLER: wikibar_editFormatByCursor\n },\n OMM:\n {\n TOOLTIP: 'zero-leading month',\n syntax: '0MM',\n HANDLER: wikibar_editFormatByCursor\n },\n DDD:\n {\n TOOLTIP: 'week day',\n syntax: 'DDD',\n HANDLER: wikibar_editFormatByCursor\n },\n DD:\n {\n TOOLTIP: 'day',\n syntax: 'DD',\n HANDLER: wikibar_editFormatByCursor\n },\n '0DD':\n {\n TOOLTIP: 'zero-leading day',\n syntax: '0DD',\n HANDLER: wikibar_editFormatByCursor\n },\n DDth:\n {\n TOOLTIP: 'day with trailing (English) suffix',\n syntax: 'DDth',\n HANDLER: wikibar_editFormatByCursor\n },\n hh:\n {\n TOOLTIP: 'hour',\n syntax: 'hh',\n HANDLER: wikibar_editFormatByCursor\n },\n '0hh':\n {\n TOOLTIP: 'zero-leading hour',\n syntax: '0hh',\n HANDLER: wikibar_editFormatByCursor\n },\n mm:\n {\n TOOLTIP: 'minute',\n syntax: 'mm',\n HANDLER: wikibar_editFormatByCursor\n },\n '0mm':\n {\n TOOLTIP: 'zero-leading minute',\n syntax: '0mm',\n HANDLER: wikibar_editFormatByCursor\n },\n ss:\n {\n TOOLTIP: 'second',\n syntax: 'ss',\n HANDLER: wikibar_editFormatByCursor\n },\n '0ss':\n {\n TOOLTIP: 'zero-leading second',\n syntax: '0ss',\n HANDLER: wikibar_editFormatByCursor\n }\n };\n\n // register tools\n wikibarStore.addon.dateFormatString = dateFormatString;\n}\n\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n\n\n//}}}
WikiBarDemo
<div class='toolbar' macro='toolbar +saveTiddler cancelTiddler deleteTiddler closeOthers permalink references jump wikibar'></div>\n<div class='title' macro='view title'></div>\n<div class='editor' macro='edit title'></div>\n<div class='editor' macro='edit text'></div>\n<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
#open TW in browser\n#enable options -> ~SaveBackups\n#save changes, and DON'T close TW\n#right click on [[finalRelease|http://www.tiddlywiki.com/empty.html]] (or [[finalBeta|http://www.tiddlywiki.com/beta/empty.html]]) of TW, save as a new file, replace to current TW\n#save changes again
GIMP Palette\nName: Hues and Brightnesses\nColumns: 17\n#\n# ColorZilla Hues and Brightnesses palette\n#\n# Copyright (C) 2004 Alex Sirota (alex@elbrus.com)\n#\n255 191 0 untitled\n240 164 0 untitled\n225 139 0 untitled\n213 113 0 untitled\n202 89 0 untitled\n193 66 0 untitled\n186 43 0 untitled\n182 22 0 untitled\n180 0 0 untitled\n182 0 22 untitled\n186 0 43 untitled\n193 0 66 untitled\n202 0 89 untitled\n213 0 113 untitled\n225 0 139 untitled\n240 0 164 untitled\n255 0 191 untitled\n240 195 0 untitled\n223 167 0 untitled\n208 141 0 untitled\n194 115 0 untitled\n182 90 0 untitled\n172 66 0 untitled\n164 44 0 untitled\n159 22 0 untitled\n158 0 0 untitled\n159 0 22 untitled\n164 0 44 untitled\n172 0 66 untitled\n182 0 90 untitled\n194 0 115 untitled\n208 0 141 untitled\n223 0 167 untitled\n240 0 195 untitled\n225 200 0 untitled\n208 171 0 untitled\n191 143 0 untitled\n176 117 0 untitled\n163 91 0 untitled\n151 67 0 untitled\n143 44 0 untitled\n137 22 0 untitled\n135 0 0 untitled\n137 0 22 untitled\n143 0 44 untitled\n151 0 67 untitled\n163 0 91 untitled\n176 0 117 untitled\n191 0 143 untitled\n208 0 171 untitled\n225 0 200 untitled\n213 206 0 untitled\n194 176 0 untitled\n176 147 0 untitled\n159 120 0 untitled\n144 93 0 untitled\n131 68 0 untitled\n121 44 0 untitled\n115 22 0 untitled\n113 0 0 untitled\n115 0 22 untitled\n121 0 44 untitled\n131 0 68 untitled\n144 0 93 untitled\n159 0 120 untitled\n176 0 147 untitled\n194 0 176 untitled\n213 0 206 untitled\n190 202 0 untitled\n181 182 0 untitled\n163 153 0 untitled\n144 123 0 untitled\n128 96 0 untitled\n113 69 0 untitled\n101 45 0 untitled\n93 22 0 untitled\n90 0 0 untitled\n93 0 22 untitled\n101 0 45 untitled\n113 0 69 untitled\n128 0 96 untitled\n144 0 123 untitled\n163 0 153 untitled\n181 0 182 untitled\n190 0 202 untitled\n162 193 0 untitled\n152 172 0 untitled\n143 151 0 untitled\n131 129 0 untitled\n113 100 0 untitled\n96 72 0 untitled\n81 46 0 untitled\n71 22 0 untitled\n68 0 0 untitled\n71 0 22 untitled\n81 0 46 untitled\n96 0 72 untitled\n113 0 100 untitled\n131 0 129 untitled\n143 0 151 untitled\n152 0 172 untitled\n162 0 193 untitled\n136 186 0 untitled\n126 164 0 untitled\n115 143 0 untitled\n105 121 0 untitled\n95 101 0 untitled\n81 76 0 untitled\n64 48 0 untitled\n50 22 0 untitled\n45 0 0 untitled\n50 0 22 untitled\n64 0 48 untitled\n81 0 76 untitled\n95 0 101 untitled\n105 0 121 untitled\n115 0 143 untitled\n126 0 164 untitled\n136 0 186 untitled\n112 182 0 untitled\n101 159 0 untitled\n90 137 0 untitled\n79 115 0 untitled\n68 93 0 untitled\n58 71 0 untitled\n48 50 0 untitled\n32 24 0 untitled\n23 0 0 untitled\n32 0 24 untitled\n48 0 50 untitled\n58 0 71 untitled\n68 0 93 untitled\n79 0 115 untitled\n90 0 137 untitled\n101 0 159 untitled\n112 0 182 untitled\n90 180 0 untitled\n79 158 0 untitled\n68 135 0 untitled\n56 113 0 untitled\n45 90 0 untitled\n34 68 0 untitled\n23 45 0 untitled\n11 23 0 untitled\n0 0 0 untitled\n11 0 23 untitled\n23 0 45 untitled\n34 0 68 untitled\n45 0 90 untitled\n56 0 113 untitled\n68 0 135 untitled\n79 0 158 untitled\n90 0 180 untitled\n69 182 0 untitled\n58 159 0 untitled\n47 137 0 untitled\n36 115 0 untitled\n25 93 0 untitled\n14 71 0 untitled\n3 50 0 untitled\n0 32 8 untitled\n0 23 23 untitled\n0 8 32 untitled\n3 0 50 untitled\n14 0 71 untitled\n25 0 93 untitled\n36 0 115 untitled\n47 0 137 untitled\n58 0 159 untitled\n69 0 182 untitled\n49 186 0 untitled\n38 164 0 untitled\n27 143 0 untitled\n17 121 0 untitled\n6 101 0 untitled\n0 81 5 untitled\n0 64 16 untitled\n0 50 28 untitled\n0 45 45 untitled\n0 28 50 untitled\n0 16 64 untitled\n0 5 81 untitled\n6 0 101 untitled\n17 0 121 untitled\n27 0 143 untitled\n38 0 164 untitled\n49 0 186 untitled\n30 193 0 untitled\n19 172 0 untitled\n9 151 0 untitled\n0 131 2 untitled\n0 113 13 untitled\n0 96 24 untitled\n0 81 36 untitled\n0 71 49 untitled\n0 68 68 untitled\n0 49 71 untitled\n0 36 81 untitled\n0 24 96 untitled\n0 13 113 untitled\n0 2 131 untitled\n9 0 151 untitled\n19 0 172 untitled\n30 0 193 untitled\n12 202 0 untitled\n1 182 0 untitled\n0 163 10 untitled\n0 144 21 untitled\n0 128 32 untitled\n0 113 43 untitled\n0 101 56 untitled\n0 93 71 untitled\n0 90 90 untitled\n0 71 93 untitled\n0 56 101 untitled\n0 43 113 untitled\n0 32 128 untitled\n0 21 144 untitled\n0 10 163 untitled\n1 0 182 untitled\n12 0 202 untitled\n0 213 7 untitled\n0 194 18 untitled\n0 176 29 untitled\n0 159 40 untitled\n0 144 51 untitled\n0 131 64 untitled\n0 121 77 untitled\n0 115 93 untitled\n0 113 113 untitled\n0 93 115 untitled\n0 77 121 untitled\n0 64 131 untitled\n0 51 144 untitled\n0 40 159 untitled\n0 29 176 untitled\n0 18 194 untitled\n0 7 213 untitled\n0 225 26 untitled\n0 208 37 untitled\n0 191 48 untitled\n0 176 59 untitled\n0 163 71 untitled\n0 151 84 untitled\n0 143 99 untitled\n0 137 115 untitled\n0 135 135 untitled\n0 115 137 untitled\n0 99 143 untitled\n0 84 151 untitled\n0 71 163 untitled\n0 59 176 untitled\n0 48 191 untitled\n0 37 208 untitled\n0 26 225 untitled\n0 240 45 untitled\n0 223 56 untitled\n0 208 67 untitled\n0 194 79 untitled\n0 182 92 untitled\n0 172 105 untitled\n0 164 120 untitled\n0 159 138 untitled\n0 158 158 untitled\n0 138 159 untitled\n0 120 164 untitled\n0 105 172 untitled\n0 92 182 untitled\n0 79 194 untitled\n0 67 208 untitled\n0 56 223 untitled\n0 45 240 untitled\n0 255 64 untitled\n0 240 75 untitled\n0 225 87 untitled\n0 213 99 untitled\n0 202 112 untitled\n0 193 127 untitled\n0 186 142 untitled\n0 182 160 untitled\n0 180 180 untitled\n0 160 182 untitled\n0 142 186 untitled\n0 127 193 untitled\n0 112 202 untitled\n0 99 213 untitled\n0 87 225 untitled\n0 75 240 untitled\n0 64 255 untitled\n
/***\n|''Name:''|JsStripper|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBar addon|\n|''Required:''|WikiBar 2.0.0+|\n!Description\nreduce the size of javascript\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // define tools\n var jsStripper={\n TYPE:'MENU',\n CAPTION:'stripper',\n doit:{\n CAPTION: 'go!',\n HANDLER: JsStripper_doIt\n },\n SEPERATOR:{/*-----------------------------*/},\n options:{\n TYPE:'MENU',\n DYNAITEM: JsStripper_genOptions\n }\n };\n\n // register tools\n if(!wikibarStore.addon.javascript){ wikibarStore.addon.javascript = { TYPE:'MENU' }; }\n wikibarStore.addon.javascript.jsStripper = jsStripper;\n\n JsStripper_init();\n}\n\nfunction JsStripper_init(){\n\n // set default value\n var cookies = [\n {name: 'chkJsStripperSetAndGo', value: false},\n {name: 'chkJsStripperRemoveComment', value: true},\n {name: 'chkJsStripperLTrim', value: false},\n {name: 'chkJsStripperRTrim', value: true},\n {name: 'chkJsStripperRemoveCrlf', value: true},\n {name: 'chkJsStripperRemoveAllCrlf', value: false}\n ];\n\n for(var i=0; i<cookies.length; i++){\n if(config.options[cookies[i].name]==null){\n config.options[cookies[i].name]=cookies[i].value;\n saveOptionCookie(cookies[i].name);\n }\n }\n\n}\n\nfunction JsStripper_genOptions(){\n return {\n setAndGo:{\n CAPTION:'set and go',\n SELECTED: config.options['chkJsStripperSetAndGo'],\n HANDLER: function(param){\n config.options['chkJsStripperSetAndGo'] = !config.options['chkJsStripperSetAndGo'];\n saveOptionCookie('chkJsStripperSetAndGo');\n }\n },\n SEPERATOR:{/*-----------------------------*/},\n removeComment: {\n CAPTION:'remove comments',\n SELECTED: config.options['chkJsStripperRemoveComment'],\n HANDLER: function(param){\n config.options['chkJsStripperRemoveComment'] = !config.options['chkJsStripperRemoveComment'];\n saveOptionCookie('chkJsStripperRemoveComment');\n if(config.options['chkJsStripperRemoveComment'] && config.options['chkJsStripperSetAndGo']){ JsStripper_removeComment(param); }\n }\n },\n lTrim: {\n CAPTION:'trim leading spaces',\n SELECTED: config.options['chkJsStripperLTrim'],\n HANDLER: function(param){\n config.options['chkJsStripperLTrim'] = !config.options['chkJsStripperLTrim'];\n saveOptionCookie('chkJsStripperLTrim');\n if(config.options['chkJsStripperLTrim'] && config.options['chkJsStripperSetAndGo']){ JsStripper_lTrim(param); }\n }\n },\n rTrim: {\n CAPTION:'trim tailing spaces',\n SELECTED: config.options['chkJsStripperRTrim'],\n HANDLER: function(param){\n config.options['chkJsStripperRTrim'] = !config.options['chkJsStripperRTrim'];\n saveOptionCookie('chkJsStripperRTrim');\n if(config.options['chkJsStripperRTrim'] && config.options['chkJsStripperSetAndGo']){ JsStripper_rTrim(param); }\n }\n },\n removeCrlf: {\n TYPE:'MENU',\n CAPTION:'remove new-lines',\n removeRedundant:{\n CAPTION:'remove redundant',\n SELECTED: config.options['chkJsStripperRemoveCrlf'],\n HANDLER: function(param){\n config.options['chkJsStripperRemoveCrlf'] = !config.options['chkJsStripperRemoveCrlf'];\n saveOptionCookie('chkJsStripperRemoveCrlf');\n if(!config.options['chkJsStripperRemoveCrlf']){ config.options['chkJsStripperRemoveAllCrlf'] = false; }\n if(config.options['chkJsStripperRemoveCrlf'] && config.options['chkJsStripperSetAndGo']){ JsStripper_removeCrlf(param); }\n }\n },\n removeAllCrlf:{\n CAPTION:'remove all',\n SELECTED: config.options['chkJsStripperRemoveAllCrlf'],\n HANDLER: function(param){\n config.options['chkJsStripperRemoveAllCrlf'] = !config.options['chkJsStripperRemoveAllCrlf'];\n saveOptionCookie('chkJsStripperRemoveAllCrlf');\n if(config.options['chkJsStripperRemoveAllCrlf']){ config.options['chkJsStripperRemoveCrlf'] = true; }\n if(config.options['chkJsStripperRemoveAllCrlf'] && config.options['chkJsStripperSetAndGo']){ JsStripper_removeCrlf(param); }\n }\n }\n }\n };\n}\n\nfunction JsStripper_removeComment(param){\n\n var editor = param.button.editor;\n var codes = editor.value;\n\n if(config.options['chkJsStripperRemoveComment']){\n // remove multi-line javascript comment\n codes = codes.replace(/\s/\s*(\ss*|.*?)*\s*\s//g, '');\n\n // remove single-line comment\n // note: those has '//' in string should in '\s/\s/' format!!\n codes = codes.replace(/\s/\s/.*$/gm, '');\n }\n\n if(editor.value != codes){ editor.value = codes; }\n};\n\nfunction JsStripper_lTrim(param){\n\n var editor = param.button.editor;\n var codes = editor.value;\n\n if(config.options['chkJsStripperLTrim']){\n codes = codes.replace(/(^(\st|[ ])+)/gm, '');\n }\n\n if(editor.value != codes){ editor.value = codes; }\n};\n\nfunction JsStripper_rTrim(param){\n\n var editor = param.button.editor;\n var codes = editor.value;\n\n if(config.options['chkJsStripperRTrim']){\n codes = codes.replace(/((\st|[ ])+$)/gm, '');\n }\n\n if(editor.value != codes){ editor.value = codes; }\n};\n\nfunction JsStripper_removeCrlf(param){\n\n var editor = param.button.editor;\n var codes = editor.value;\n\n if(config.options['chkJsStripperRemoveCrlf']){\n codes = codes.replace(/(\sn|\sr)+/g, '\sn'); // 多個crlf轉為一個\n }else if(config.options['chkJsStripperRemoveAllCrlf']){\n codes = codes.replace(/(\sn|\sr)/g, ''); // 全部移除\n }\n\n if(editor.value != codes){ editor.value = codes; }\n};\n\nfunction JsStripper_doIt(param){\n\n clearMessage();\n try{\n var editor = param.button.editor;\n var codes = editor.value;\n\n // remove comments\n JsStripper_removeComment(param);\n\n // replace tab to spaces\n //codes = codes.replace(/(\st)/g, ' ');\n\n // strip redundant white-spaces or tabs\n //codes = codes.replace(/(\st|[ ])+/g, ' ');\n\n // right trim\n JsStripper_rTrim(param);\n\n // left trim\n JsStripper_lTrim(param);\n\n // strip newline\n JsStripper_removeCrlf(param);\n\n// // strip redundant white-space between delimiters: 這可能破壞字串內容!\n// delis = '!%&*()-+=\s/{}:;<>,?';\n// for(i=0; i<delis.length; i++){\n// deli = delis.charAt(i);\n// var regx = new RegExp('[ ]*\s\s' + deli + '[ ]*', 'g');\n// //print(regx);\n// codes = codes.replace(regx, deli);\n// }\n\n// // strip redundant white spaces\n// codes = codes.replace(/\ss/gm, '');\n\n if(editor.value!=codes){\n //editor.value=codes;\n displayMessage('JS strip ok!');\n wikibar_editSelectAll(param);\n }else{\n displayMessage('nothing changed');\n }\n\n }catch(ex){\n alert('error: ' + ex);\n }\n};\n\n\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n\n\n//}}}
/***\n|''Name:''|JsVerifier|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBar addon|\n|''Required:''|WikiBar 2.0.0+|\n!Description\nJavascript verifier, refer to http://www.crockford.com/jslint/index.html\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // define tools\n var jsVerifier={\n TYPE:'MENU',\n CAPTION:'verifier',\n doit:{\n CAPTION:'go!',\n TOOLTIP:'javascript verifier',\n HANDLER: JsVerifier_doIt\n },\n DYNAITEM: JsVerifier_genCloseReport,\n SEPERATOR:{/*-----------------------------*/},\n options:{\n TYPE:'MENU',\n DYNAITEM: JsVerifier_genOptions\n },\n about:{\n HANDLER: function(){\n clearMessage();\n displayMessage('Refer to www.JSLint.com for more informations', 'http:\s/\s/www.JSLint.com');\n }\n }\n };\n\n // register tools\n if(!wikibarStore.addon.javascript){ wikibarStore.addon.javascript = { TYPE:'MENU' }; }\n wikibarStore.addon.javascript.jsVerifier = jsVerifier;\n\n // set style\n setStylesheet(\n '#JsVerifierDiv { background-color: #fff; display:block; overflow:auto; border: 1px solid;}',\n 'JsLintStyleSheet' );\n\n // init\n JsVerifier_init();\n}\n\nString.prototype.entityify = function () {\n return this.\n replace(/[&]/g, '&amp;').\n replace(/[<]/g, '&lt;').\n replace(/[>]/g, '&gt;');\n};\n\nfunction JsVerifier_genCloseReport(){\n return {\n closeReport:{\n CAPTION:'close report',\n DISABLED: !document.getElementById('JsVerifierDiv'), // check if report exist\n HANDLER: JsVerifier_closeReport\n }\n };\n}\n\nfunction JsVerifier_init(){\n\n // set default value\n cookies = [\n {name: 'chkJsVerifierlaxLineEnd', value: false},\n {name: 'chkJsVerifierplusplus', value: false},\n {name: 'chkJsVerifiercap', value: false},\n {name: 'chkJsVerifierjscript', value: false},\n {name: 'chkJsVerifierdebug', value: false}\n ];\n\n for(var i=0; i<cookies.length; i++){\n if(config.options[cookies[i].name]===null){\n config.options[cookies[i].name]=cookies[i].value;\n saveOptionCookie(cookies[i].name);\n }\n }\n}\n\nfunction JsVerifier_genOptions(){\n return {\n //TYPE:'MENU',\n laxLineEnd: {\n CAPTION:'strict line ending',\n SELECTED: !config.options['chkJsVerifierlaxLineEnd'],\n HANDLER: function(){\n config.options['chkJsVerifierlaxLineEnd'] = !config.options['chkJsVerifierlaxLineEnd'];\n saveOptionCookie('chkJsVerifierlaxLineEnd');\n }\n },\n plusplus: {\n CAPTION:'++ and -- considered harmful',\n SELECTED: config.options['chkJsVerifierplusplus'],\n HANDLER: function(){\n config.options['chkJsVerifierplusplus'] = !config.options['chkJsVerifierplusplus'];\n saveOptionCookie('chkJsVerifierplusplus');\n }\n },\n cap: {\n CAPTION:'tolerate HTML case',\n SELECTED: config.options['chkJsVerifiercap'],\n HANDLER: function(){\n config.options['chkJsVerifiercap'] = !config.options['chkJsVerifiercap'];\n saveOptionCookie('chkJsVerifiercap');\n }\n },\n jscript: {\n CAPTION:'tolerate JScript deviations',\n SELECTED: config.options['chkJsVerifierjscript'],\n HANDLER: function(){\n config.options['chkJsVerifierjscript'] = !config.options['chkJsVerifierjscript'];\n saveOptionCookie('chkJsVerifierjscript');\n }\n },\n debug: {\n CAPTION:'allow debugger statements',\n SELECTED: config.options['chkJsVerifierdebug'],\n HANDLER: function(){\n config.options['chkJsVerifierdebug'] = !config.options['chkJsVerifierdebug'];\n saveOptionCookie('chkJsVerifierdebug');\n }\n }\n };\n}\n\nfunction JsVerifier_doIt(param){\n\n try{\n // set jslint options\n jslint.laxLineEnd = config.options['chkJsVerifierlaxLineEnd'];\n jslint.plusplus = config.options['chkJsVerifierplusplus'];\n jslint.cap = config.options['chkJsVerifiercap'];\n jslint.jscript = config.options['chkJsVerifierjscript'];\n jslint.debug = config.options['chkJsVerifierdebug'];\n\n var editor = param.button.editor;\n\n if (jslint(editor.value)) {\n JsVerifier_report(true, jslint.report(), param);\n } else {\n var e = jslint.error;\n r = '<table>'+\n '<tr><td>error</td><td>line: ' + (e.line + 1) + ', character: ' + (e.character + 1) + '</td></tr>' +\n '<tr><td>reason</td><td>' + e.reason.entityify() + '</td></tr>' +\n '<tr><td>code</td><td>' + e.evidence.entityify() + '</td></tr>' +\n '</table>';\n JsVerifier_report(false, r, param);\n }\n\n }catch(ex){\n alert('Error: '+ex);\n }\n}\n\n// close report\nfunction JsVerifier_closeReport(unused){\n var d=document.getElementById('JsVerifierDiv');\n if(d){ d.parentNode.removeChild(d); }\n}\n\n// create a div to report\nfunction JsVerifier_report(result, r, param){\n\n JsVerifier_closeReport();\n\n if(r.trim().length<=0){return;}\n\n var editor = param.button.editor;\n var div = createTiddlyElement(editor.parentNode,'div','JsVerifierDiv','viewer'); // CSS: #JsVerifierDiv\n div.innerHTML = r;\n\n// div.style.left = findPosX(editor) + 'px';\n// div.style.top = findPosY(editor) + 'px';\n div.style.width = editor.offsetWidth + 'px';\n div.style.height = (result? parseInt(editor.offsetHeight,10): parseInt(editor.offsetHeight/2,10)) + 'px';\n}\n\n\n//------------------------------------------------------------------------------------------------\n// (C)2002 Douglas Crockford\n// www.JSLint.com\n// http://www.crockford.com/jslint/jslint.js\n//------------------------------------------------------------------------------------------------\nvar jslint;String.prototype.isAlpha=function(){return(this>='a'&&this<='z\suffff')||(this>='A'&&this<='Z\suffff');};String.prototype.isDigit=function(){return(this>='0'&&this<='9');};(function(){var anonname,builtin,funlab,funstack,functions,lex,lookahead,member,prevtoken,stack,syntax={},token,verb,xmode,xtype,tx=/^([(){}[.,:;'"~]|\s](\s]>)?|\s?>?|==?=?|\s/(\s*(global)*|=|)|\s*[\s/=]?|\s+[+=]?|-[-=]?|%[=>]?|&[&=]?|\s|[|=]?|>>?>?=?|<([\s/=%\s?]|\s!(\s[|--)?|<=?)?|\s^=?|\s!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\s.[0-9]*)?([eE][+-]?[0-9]+)?)/,sx=/^((\s\s[^\sx00-\sx1f]|[^\sx00-\sx1f'\s\s])*)'/,qx=/^((\s\s[^\sx00-\sx1f]|[^\sx00-\sx1f"\s\s])*)"/,rx=/^(\s\s[^\sx00-\sx1f]|\s[(\s\s[^\sx00-\sx1f]|[^\sx00-\sx1f\s\s\s/])*\s]|[^\sx00-\sx1f\s\s\s/\s[])+\s/[gim]*/,lx=/\s*\s/|\s/\s*/,gx=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,hx=/^[\sx00-\sx20,]*(\s*\s/)?/,wx=/^\ss*(\s/\s/.*\sr*$)?/;jslint=function(s){functions=[];error.free=true;xmode=false;xtype='';stack=null;funlab={};member={};funstack=[];lookahead=[];lex=new Lex(s);builtin={Array:9,Boolean:9,Date:9,decodeURI:9,decodeURIComponent:9,encodeURI:9,encodeURIComponent:9,Error:9,escape:9,EvalError:9,Function:9,isFinite:9,isNaN:9,Math:9,Number:9,Object:9,parseInt:9,parseFloat:9,RangeError:9,ReferenceError:9,RegExp:9,String:9,SyntaxError:9,TypeError:9,unescape:9,URIError:9};prevtoken=token=syntax['(begin)'];advance();try{if(token.value.charAt(0)==='<'){xml();}else{statements();advance('(end)');}}catch(e){jslint.error=error;return false;}\njslint.error=null;return true;};function object(o){var r=function(){};r.prototype=o;return new r();}\nfunction Lex(lines,filename){if(typeof lines==='string'){lines=lines.split('\sn');if(lines.length==1){lines=lines[0].split('\sr');}}\njslint.lines=lines;var line=0,character=0,from=0,s=lines[0];function nextLine(){line+=1;if(line>=lines.length){return false;}\ncharacter=0;s=lines[line];return true;}\nthis.token=function(){function string(x){r=x.exec(s);if(r){t=r[1];l=r[0].length;s=s.substr(l);character+=l;if(xmode=='script'){if(t.indexOf('<\s/')>=0){throw error('Expected "...<\s\s/..." and instead saw "...<\s/...".',token);}}\nreturn it('(string)',r[1]);}else{if(!xmode){throw error("Unclosed string: "+s,line,character);}\nwhile(error.free){if(!nextLine()){throw error("Unclosed string.",token);}\ni=s.indexOf('"');if(i>=0){break;}}\ns=s.substr(i+1);return it('(string)');}}\nvar c,i,l,r,t;while(error.free){if(!s){if(nextLine()){return it('(endline)','');}else{return it('(end)','');}}\nr=wx.exec(s);if(!r||!r[0]){break;}\nl=r[0].length;s=s.substr(l);character+=l;if(s){break;}}\nfrom=character;r=tx.exec(s);if(r){t=r[0];l=t.length;s=s.substr(l);character+=l;c=t.substr(0,1);if(c.isAlpha()||c==='_'||c==='$'){return it('(identifier)',t);}\nif(c.isDigit()){if(token.id==='.'){throw error("A decimal fraction should have a zero before the decimal point.",token);}\nif(!isFinite(Number(t))){throw error("Bad number: '"+t+"'.",line,character);}\nif(s.substr(0,1).isAlpha()){throw error("Space is required after a number: '"+\nt+"'.",line,character);}\nif(c==='0'&&t.substr(1,1).isDigit()){throw error("Don't use extra leading zeros: '"+\nt+"'.",line,character);}\nif(t.substr(t.length-1)==='.'){throw error("A trailing decimal point can be confused with a dot: '"+t+"'.",line,character);}\nreturn it('(number)',t);}\nif(t==='"'){return(xmode==='"'||xmode==='string')?it('(punctuator)',t):string(qx);}\nif(t==="'"){return(xmode==="'"||xmode==='string')?it('(punctuator)',t):string(sx);}\nif(t==='/*'){while(error.free){i=s.search(lx);if(i>=0){break;}\nif(!nextLine()){throw error("Unclosed comment.",token);}}\ncharacter+=i+2;if(s.substr(i,1)==='/'){throw error("Nested comment.");}\ns=s.substr(i+2);return this.token();}\nif(t==='/*global'){while(error.free){r=hx.exec(s);if(r){l=r[0].length;s=s.substr(l);character+=l;if(r[1]==='*/'){return this.token();}}\nif(s){r=gx.exec(s);if(r){l=r[0].length;s=s.substr(l);character+=l;builtin[r[1]]=9;}else{throw error("Bad global identifier: '"+\ns+"'.",line,character);}}else if(!nextLine()){throw error("Unclosed comment.");}}}\nreturn it('(punctuator)',t);}\nthrow error("Unexpected token: "+(t||s.substr(0,1)),line,character);};this.skip=function(to){if(token.id){if(!to){to='';if(token.id.substr(0,1)==='<'){lookahead.push(token);return true;}}else if(token.id.indexOf(to)>=0){return true;}}\nprevtoken=token;token=syntax['(error)'];while(error.free){var i=s.indexOf(to||'<');if(i>=0){character+=i+to.length;s=s.substr(i+to.length);return true;}\nif(!nextLine()){break;}}\nreturn false;};this.regex=function(){var l,r=rx.exec(s),x;if(r){l=r[0].length;character+=l;s=s.substr(l);x=r[1];return it('(regex)',x);}\nthrow error("Bad regular expression: "+s);};function it(type,value){var t;if(type==='(punctuator)'){t=syntax[value];}else if(type==='(identifier)'){t=syntax[value];if(!t||typeof t!='object'){t=syntax[type];}}else{t=syntax[type];}\nif(!t||typeof t!='object'){throw error("Unrecognized symbol: '"+value+"' "+type);}\nt=object(t);if(value||type==='(string)'){t.value=value;}\nt.line=line;t.character=character;t.from=from;t.filename=filename;return t;}}\nvar error=function(m,x,y){var l,c,t=typeof x==='object'?x:token;if(typeof x==='number'){l=x;c=y||0;}else{if(t.id==='(end)'){t=prevtoken;}\nl=t.line||0;c=t.from||0;}\nif(error.free){error.free=false;error.id='(error)';error.reason=m;error.evidence=jslint.lines[l]||'';error.line=l;error.character=c;token=syntax['(error)'];token.reason=error.reason;}\nreturn error;};function addlabel(t,type){if(t){if(t==='arguments'){if(type==='global'||type==='var*'){funlab[t]='parameter';return;}else{throw error("Incorrect use of 'arguments'.",prevtoken);}}\nif(typeof funlab[t]==='string'){switch(funlab[t]){case'var':case'var*':if(type==='global'){funlab[t]='var*';return;}\nbreak;case'global':if(type==='var'){throw error('Var '+t+' was used before it was declared.',prevtoken);}\nif(type==='var*'||type==='global'){return;}\nbreak;case'function':case'parameter':if(type==='global'){return;}\nbreak;}\nthrow error("Identifier '"+t+"' already declared as "+\nfunlab[t],prevtoken);}\nfunlab[t]=type;}}\nfunction peek(i){var j=0,t;if(token==syntax['(error)']){return token;}\ni=i||0;while(j<=i){t=lookahead[j];if(!t){t=lookahead[j]=lex.token();}\nj+=1;}\nreturn t;}\nvar badbreak={')':true,']':true,'++':true,'--':true};function advance(id,t){var l;switch(prevtoken.id){case'(number)':if(token.id==='.'){throw error("A dot following a number can be confused with a decimal point.",prevtoken);}\nbreak;case'-':if(token.id==='-'||token.id==='--'){throw error("Confusing minusses.");}\nbreak;case'+':if(token.id==='+'||token.id==='++'){throw error("Confusing plusses.");}\nbreak;}\nif(prevtoken.type==='(string)'||prevtoken.identifier){anonname=prevtoken.value;}\nif(id&&token.value!=id){if(t){if(token.id==='(end)'){throw error("Unmatched '"+t.id+"'.",t);}else{throw error("Expected '"+id+"' to match '"+\nt.id+"' from line "+(t.line+1)+" and instead saw '"+token.value+"'.");}}else{throw error("Expected '"+id+"' and instead saw '"+\ntoken.value+"'.");}}\nprevtoken=token;while(error.free){token=lookahead.shift()||lex.token();if(token.id==='<!['&&xtype!=='html'){if(xmode==='script'){token=lex.token();if(token.value!=='CDATA'){throw error("Expected 'CDATA'");}\ntoken=lex.token();if(token.id!=='['){throw error("Expected '['");}\nxmode='CDATA';}else if(xmode==='xml'){lex.skip(']]>');}else{throw error("Unexpected token '<!['");}}else if(token.id===']]>'){if(xmode==='CDATA'){xmode='script';}else{throw error("Unexpected token ']]>");}}else if(token.id!=='(endline)'){break;}\nif(xmode==='"'||xmode==="'"){throw error("Missing '"+xmode+"'.",prevtoken);}\nl=!xmode&&!jslint.laxLineEnd&&(prevtoken.type=='(string)'||prevtoken.type=='(number)'||prevtoken.type=='(identifier)'||badbreak[prevtoken.id]);}\nif(l&&token.id!='{'&&token.id!='}'&&token.id!=']'){throw error("Strict line ending error: '"+\nprevtoken.value+"'.",prevtoken);}\nif(xtype==='widget'&&xmode==='script'&&token.id){l=token.id.charAt(0);if(l==='<'||l==='&'){token.nud=token.led=null;token.lbp=0;token.reach=true;}}}\nfunction advanceregex(){token=lex.regex();}\nfunction beginfunction(i){var f={'(name)':i,'(line)':token.line+1,'(context)':funlab};funstack.push(funlab);funlab=f;functions.push(funlab);}\nfunction endfunction(){funlab=funstack.pop();}\nfunction parse(rbp,initial){var l,left,o;if(token.id&&token.id==='/'){if(prevtoken.id!='('&&prevtoken.id!='='&&prevtoken.id!=':'&&prevtoken.id!=','&&prevtoken.id!='='){throw error("Expected to see a '(' or '=' or ':' or ',' preceding a regular expression literal, and instead saw '"+\nprevtoken.value+"'.",prevtoken);}\nadvanceregex();}\nif(token.id==='(end)'){throw error("Unexpected early end of program",prevtoken);}\nadvance();if(initial){anonname='anonymous';verb=prevtoken.value;}\nif(initial&&prevtoken.fud){prevtoken.fud();}else{if(prevtoken.nud){o=prevtoken.exps;left=prevtoken.nud();}else{if(token.type==='(number)'&&prevtoken.id==='.'){throw error("A leading decimal point can be confused with a dot: ."+token.value,prevtoken);}\nthrow error("Expected an identifier and instead saw '"+\nprevtoken.id+"'.",prevtoken);}\nwhile(rbp<token.lbp){o=token.exps;advance();if(prevtoken.led){left=prevtoken.led(left);}else{throw error("Expected an operator and instead saw '"+\nprevtoken.id+"'.");}}\nif(initial&&!o){throw error("Expected an assignment or function call and instead saw an expression.",prevtoken);}}\nif(l){funlab[l]='label';}\nreturn left;}\nfunction symbol(s,p){return syntax[s]||(syntax[s]={id:s,lbp:p,value:s});}\nfunction delim(s){return symbol(s,0);}\nfunction stmt(s,f){var x=delim(s);x.identifier=x.reserved=true;x.fud=f;return x;}\nfunction blockstmt(s,f){var x=stmt(s,f);x.block=true;return x;}\nfunction prefix(s,f){var x=symbol(s,150);x.nud=(typeof f==='function')?f:function(){parse(150);return this;};return x;}\nfunction type(s,f){var x=delim(s);x.type=s;x.nud=f;return x;}\nfunction reserve(s,f){var x=type(s,f);x.identifier=x.reserved=true;return x;}\nfunction reservevar(s){return reserve(s,function(){return this;});}\nfunction infix(s,f,p){var x=symbol(s,p);x.led=(typeof f==='function')?f:function(left){return[f,left,parse(p)];};return x;}\nfunction assignop(s,f){symbol(s,20).exps=true;return infix(s,function(left){if(left){if(left===true||(left.identifier&&!left.reserved)){parse(19);return left;}\nif(left==syntax['function']){if(jslint.jscript){parse(19);return left;}else{throw error("Expected an identifier in an assignment, and instead saw a function invocation.",prevtoken);}}}\nthrow error("Bad assignment.",this);},20);}\nfunction suffix(s,f){var x=symbol(s,150);x.led=function(left){if(jslint.plusplus){throw error("This operator is considered harmful: "+this.id,this);}\nreturn[f,left];};return x;}\nfunction optionalidentifier(){if(token.reserved){throw error("Expected an identifier and instead saw '"+\ntoken.id+"' (a reserved word).");}\nif(token.identifier&&!token.reserved){advance();return prevtoken.value;}}\nfunction identifier(){var i=optionalidentifier();if(i){return i;}\nthrow error("Expected an identifier and instead saw '"+\ntoken.value+"'.",token);}\nfunction reachable(s){var i=0,t;if(token.id!=';'){return;}\nwhile(error.free){t=peek(i);if(t.reach){return;}\nif(t.id!='(endline)'){if(t.id==='function'){throw error("Inner functions should be listed at the top of the outer function.",t);}\nthrow error("Unreachable '"+t.value+"' after '"+s+"'.",t);}\ni+=1;}}\nfunction statement(){var t=token;if(t.identifier&&!t.reserved&&peek().id===':'){advance();advance(':');addlabel(t.value,'live*');if(!token.labelled){throw error("Label '"+t.value+"' on unlabelable statement '"+token.value+"'.",token);}\nif(t.value.toLowerCase()=='javascript'){throw error("Label '"+t.value+"' looks like a javascript url.",token);}\ntoken.label=t.value;t=token;}\nparse(0,true);if(!t.block&&error.free){if(token.id!=';'){throw error("Expected ';' and instead saw '"+token.value+"'.",prevtoken.line,prevtoken.from+prevtoken.value.length);}\nadvance(';');}}\nfunction statements(){while(error.free&&!token.reach){statement();}}\nfunction block(){var t=token;advance('{');statements();advance('}',t);verb=null;}\nfunction idValue(){return this;}\nfunction countMember(m){if(typeof member[m]==='number'){member[m]+=1;}else{member[m]=1;}}\ntype('(number)',idValue);type('(string)',idValue);syntax['(identifier)']={type:'(identifier)',lbp:0,identifier:true,nud:function(){addlabel(this.value,'global');return this;},led:function(){throw error("Expected an operator and instead saw '"+\ntoken.value+"'.");}};type('(regex)',function(){return[this.id,this.value,this.flags];});delim('(endline)');delim('(begin)');delim('(end)').reach=true;delim('</').reach=true;delim('<![').reach=true;delim('<%');delim('<?');delim('<!');delim('<!--');delim('%>');delim('?>');delim('(error)').reach=true;delim('}').reach=true;delim(')');delim(']');delim(']]>').reach=true;delim('"').reach=true;delim("'").reach=true;delim(';');delim(':').reach=true;delim(',');reserve('else');reserve('case').reach=true;reserve('default').reach=true;reserve('catch');reserve('finally');reservevar('this');reservevar('true');reservevar('false');reservevar('Infinity');reservevar('NaN');reservevar('null');reservevar('undefined');assignop('=','assign',20);assignop('+=','assignadd',20);assignop('-=','assignsub',20);assignop('*=','assignmult',20);assignop('/=','assigndiv',20).nud=function(){throw error("A regular expression literal can be confused with '/='.");};assignop('%=','assignmod',20);assignop('&=','assignbitand',20);assignop('|=','assignbitor',20);assignop('^=','assignbitxor',20);assignop('<<=','assignshiftleft',20);assignop('>>=','assignshiftright',20);assignop('>>>=','assignshiftrightunsigned',20);infix('?',function(left){parse(10);advance(':');parse(10);},30);infix('||','or',40);infix('&&','and',50);infix('|','bitor',70);infix('^','bitxor',80);infix('&','bitand',90);infix('==',function(left){var t=token;if((t.type==='(number)'&&!+t.value)||(t.type==='(string)'&&!t.value)||t.type==='true'||t.type==='false'||t.type==='undefined'||t.type==='null'){throw error("Use '===' to compare with '"+t.value+"'.",t);}\nreturn['==',left,parse(100)];},100);infix('===','equalexact',100);infix('!=',function(left){var t=token;if((t.type==='(number)'&&!+t.value)||(t.type==='(string)'&&!t.value)||t.type==='true'||t.type==='false'||t.type==='undefined'||t.type==='null'){throw error("Use '!==' to compare with '"+t.value+"'.",t);}\nreturn['!=',left,parse(100)];},100);infix('!==','notequalexact',100);infix('<','less',110);infix('>','greater',110);infix('<=','lessequal',110);infix('>=','greaterequal',110);infix('<<','shiftleft',120);infix('>>','shiftright',120);infix('>>>','shiftrightunsigned',120);infix('in','in',120);infix('instanceof','instanceof',120);infix('+','addconcat',130);prefix('+','num');infix('-','sub',130);prefix('-','neg');infix('*','mult',140);infix('/','div',140);infix('%','mod',140);suffix('++','postinc');prefix('++','preinc');syntax['++'].exps=true;suffix('--','postdec');prefix('--','predec');syntax['--'].exps=true;prefix('delete',function(){parse(0);}).exps=true;prefix('~','bitnot');prefix('!','not');prefix('typeof','typeof');prefix('new',function(){parse(160);advance('(');if(token.id!==')'){while(error.free){parse(10);if(token.id!==','){break;}\nadvance(',');}}\nadvance(')');return syntax['function'];});syntax['new'].exps=true;infix('.',function(left){var m=identifier();if(typeof m==='string'){countMember(m);}\nreturn true;},160);infix('(',function(left){var n=0;if(token.id!==')'){while(error.free){parse(10);n+=1;if(token.id!==','){break;}\nadvance(',');}}\nadvance(')');if(left&&left.value=='parseInt'&&n==1){throw error("Missing radix parameter",left);}\nreturn syntax['function'];},160).exps=true;prefix('(',function(){parse(0);advance(')',this);});infix('[',function(left){var e=parse(0);if(e&&e.type==='(string)'){countMember(e.value);}\nadvance(']',this);return true;},160);prefix('[',function(){if(token.id===']'){advance(']');return;}\nwhile(error.free){parse(10);if(token.id===','){advance(',');if(token.id===']'||token.id===','){throw error('Extra comma.',prevtoken);}}else{advance(']',this);return;}}},160);(function(x){x.nud=function(){var i;if(token.id==='}'){advance('}');return;}\nwhile(error.free){i=optionalidentifier(true);if(!i&&(token.id==='(string)'||token.id==='(number)')){i=token.id;advance();}\nif(!i){throw error("Expected an identifier and instead saw '"+\ntoken.value+"'.");}\nif(typeof i.value==='string'){countMember(i.value);}\nadvance(':');parse(10);if(token.id===','){advance(',');if(token.id===','||token.id==='}'){throw error("Extra comma.");}}else{advance('}',this);return;}}};x.fud=function(){throw error("Expected to see a statement and instead saw a block.");};})(delim('{'));function varstatement(){while(error.free){addlabel(identifier(),'var');if(token.id==='='){advance('=');parse(20);}\nif(token.id===','){advance(',');}else{return;}}}\nstmt('var',varstatement);function functionparams(){var t=token;advance('(');if(token.id===')'){advance(')');return;}\nwhile(error.free){addlabel(identifier(),'parameter');if(token.id===','){advance(',');}else{advance(')',t);return;}}}\nblockstmt('function',function(){var i=identifier();addlabel(i,'var*');beginfunction(i);addlabel(i,'function');functionparams();block();endfunction();});prefix('function',function(){var i=optionalidentifier()||('"'+anonname+'"');beginfunction(i);addlabel(i,'function');functionparams();block();endfunction();});blockstmt('if',function(){var t=token;advance('(');parse(20);advance(')',t);block();if(token.id==='else'){advance('else');if(token.id==='if'||token.id==='switch'){statement();}else{block();}}});blockstmt('try',function(){var b;block();if(token.id==='catch'){advance('catch');beginfunction('"catch"');functionparams();block();endfunction();b=true;}\nif(token.id==='finally'){advance('finally');beginfunction('"finally"');block();endfunction();return;}else if(!b){throw error("Expected 'catch' or 'finally' and instead saw '"+\ntoken.value+"'.");}});blockstmt('while',function(){var t=token;advance('(');parse(20);advance(')',t);block();}).labelled=true;reserve('with');blockstmt('switch',function(){var t=token;advance('(');var g=false;parse(20);advance(')',t);t=token;advance('{');while(error.free){switch(token.id){case'case':switch(verb){case'break':case'case':case'continue':case'return':case'switch':case'throw':break;default:throw error("Expected a 'break' statement before 'case'.",prevtoken);}\nadvance('case');parse(20);g=true;advance(':');verb='case';break;case'default':switch(verb){case'break':case'continue':case'return':case'throw':break;default:throw error("Expected a 'break' statement before 'default'.",prevtoken);}\nadvance('default');g=true;advance(':');break;case'}':advance('}',t);return;default:if(g){statements();}else{throw error("Expected to see 'case' and instead saw '"+\ntoken.value+"'.");}}}}).labelled=true;stmt('debugger',function(){if(!jslint.debug){throw error("All debugger statements should be removed.");}});stmt('do',function(){block();advance('while');var t=token;advance('(');parse(20);advance(')',t);}).labelled=true;blockstmt('for',function(){var t=token;advance('(');if(peek(token.id==='var'?1:0).id==='in'){if(token.id==='var'){advance('var');addlabel(identifier(),'var');}else{advance();}\nadvance('in');parse(20);advance(')',t);block();return;}else{if(token.id!=';'){if(token.id==='var'){advance('var');varstatement();}else{for(;;){parse(0);if(token.id!==','){break;}\nadvance(',');}}}\nadvance(';');if(token.id!=';'){parse(20);}\nadvance(';');if(token.id===';'){throw error("Expected to see ')' and instead saw ';'");}\nif(token.id!=')'){for(;;){parse(0);if(token.id!==','){break;}\nadvance(',');}}\nadvance(')',t);block();}}).labelled=true;stmt('throw',function(){parse(20);reachable('throw');});stmt('return',function(){if(token.id!=';'&&!token.reach){parse(20);}\nreachable('return');});stmt('break',function(){if(funlab[token.value]==='live*'){advance();}\nreachable('break');});stmt('continue',function(){if(funlab[token.id]==='live*'){advance();}\nreachable('continue');});reserve('abstract');reserve('as');reserve('boolean');reserve('byte');reserve('char');reserve('class');reserve('const');reserve('double');reserve('enum');reserve('export');reserve('extends');reserve('final');reserve('float');reserve('goto');reserve('implements');reserve('import');reserve('int');reserve('interface');reserve('long');reserve('native');reserve('package');reserve('private');reserve('protected');reserve('public');reserve('short');reserve('static');reserve('super');reserve('synchronized');reserve('throws');reserve('transient');reserve('use');reserve('void');reserve('volatile');function Token(s){this.id=s;this.lbp=0;this.identifier=true;syntax[s]=this;}\nToken.prototype.nud=function(){addlabel(this.id,'global');return this.id;};Token.prototype.led=function(){throw error("Expected an operator and instead saw '"+\ntoken.id+"'.");};jslint.report=function(){var a=[],c,cc,f,i,k,o='',s;function detail(h){if(s.length){return'<div>'+h+':&nbsp; '+s.sort().join(', ')+'</div>';}\nreturn'';}\nfor(k in member){a.push(k);}\nif(a.length){a=a.sort();for(i=0;i<a.length;i+=1){a[i]='<tr><td><tt>'+a[i]+'</tt></td><td>'+\nmember[a[i]]+'</td></tr>';}\no+='<table><tbody><tr><th>Members</th><th>Occurrences</th></tr>'+\na.join('')+'</tbody></table>';}\nfor(i=0;i<functions.length;++i){f=functions[i];for(k in f){if(f[k]==='global'){c=f['(context)'];while(error.free){cc=c['(context)'];if(!cc){if((!funlab[k]||funlab[k]==='var?')&&builtin[k]!=9){funlab[k]='var?';f[k]='global?';}\nbreak;}\nif(c[k]==='parameter!'||c[k]==='var!'){f[k]='var.';break;}\nif(c[k]==='var'||c[k]==='var*'||c[k]==='var!'){f[k]='var.';c[k]='var!';break;}\nif(c[k]==='parameter'){f[k]='var.';c[k]='parameter!';break;}\nc=cc;}}}}\ns=[];for(k in funlab){if(funlab[k].substr(0,3)==='var'){if(funlab[k]==='var?'){s.push('<tt>'+k+'</tt><small>&nbsp;(?)</small>');}else{s.push('<tt>'+k+'</tt>');}}}\no+=detail('Global');if(functions.length){o+='<p>Function:</p><ol style="padding-left:0.5in">';}\nfor(i=0;i<functions.length;i+=1){f=functions[i];o+='<li value='+\nf['(line)']+'><tt>'+(f['(name)']||'')+'</tt>';s=[];for(k in f){if(k.charAt(0)!='('){switch(f[k]){case'parameter':s.push('<tt>'+k+'</tt>');break;case'parameter!':s.push('<tt>'+k+'</tt><small>&nbsp;(closure)</small>');break;}}}\no+=detail('Parameter');s=[];for(k in f){if(k.charAt(0)!='('){switch(f[k]){case'var':s.push('<tt>'+k+'</tt><small>&nbsp;(unused)</small>');break;case'var*':s.push('<tt>'+k+'</tt>');break;case'var!':s.push('<tt>'+k+'</tt><small>&nbsp;(closure)</small>');break;case'var.':s.push('<tt>'+k+'</tt><small>&nbsp;(outer)</small>');break;}}}\no+=detail('Var');s=[];c=f['(context)'];for(k in f){if(k.charAt(0)!='('&&f[k].substr(0,6)==='global'){if(f[k]==='global?'){s.push('<tt>'+k+'</tt><small>&nbsp;(?)</small>');}else{s.push('<tt>'+k+'</tt>');}}}\no+=detail('Global');s=[];for(k in f){if(k.charAt(0)!='('&&f[k]==='label'){s.push(k);}}\no+=detail('Label');o+='</li>';}\nif(functions.length){o+='</ol>';}\nreturn o;};var scriptstring={onload:true,onunload:true,onclick:true,ondblclick:true,onmousedown:true,onmouseup:true,onmouseover:true,onmousemove:true,onmouseout:true,onfocus:true,onblur:true,onkeypress:true,onkeydown:true,onkeyup:true,onsubmit:true,onreset:true,onselect:true,onchange:true};var xmltype={HTML:{doBegin:function(n){if(!jslint.cap){throw error("HTML case error.");}\nxmltype.html.doBegin();}},html:{doBegin:function(n){xtype='html';xmltype.html.script=false;builtin.alert=9;builtin.document=9;builtin.navigator=9;builtin.window=9;},doTagName:function(n,p){var i,t=xmltype.html.tag[n],x;if(!t){throw error('Unrecognized tag: <'+n+'>. '+\n(n===n.toLowerCase()?'Did you mean <'+n.toLowerCase()+'>?':''));}\nx=t.parent;if(x){if(x.indexOf(' '+p+' ')<0){throw error('A <'+n+'> must be within <'+x+'>',prevtoken);}}else{i=stack.length;do{if(i<=0){throw error('A <'+n+'> must be within the body',prevtoken);}\ni-=1;}while(stack[i].name!=='body');}\nxmltype.html.script=n==='script';return t.simple;},doAttribute:function(n,a){if(n==='script'&&a==='src'){xmltype.html.script=false;return'string';}\nreturn scriptstring[a]&&'script';},doIt:function(n){return xmltype.html.script?'script':n!=='html'&&xmltype.html.tag[n].special&&'special';},tag:{a:{},abbr:{},acronym:{},address:{},applet:{},area:{simple:true,parent:' map '},b:{},base:{simple:true,parent:' head '},bdo:{},big:{},blockquote:{},body:{parent:' html noframes '},br:{simple:true},button:{},caption:{parent:' table '},center:{},cite:{},code:{},col:{simple:true,parent:' table colgroup '},colgroup:{parent:' table '},dd:{parent:' dl '},del:{},dfn:{},dir:{},div:{},dl:{},dt:{parent:' dl '},em:{},embed:{},fieldset:{},font:{},form:{},frame:{simple:true,parent:' frameset '},frameset:{parent:' html frameset '},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},head:{parent:' html '},html:{},hr:{simple:true},i:{},iframe:{},img:{simple:true},input:{simple:true},ins:{},kbd:{},label:{},legend:{parent:' fieldset '},li:{parent:' dir menu ol ul '},link:{simple:true,parent:' head '},map:{},menu:{},meta:{simple:true,parent:' head noscript '},noframes:{parent:' html body '},noscript:{parent:' html head body frameset '},object:{},ol:{},optgroup:{parent:' select '},option:{parent:' optgroup select '},p:{},param:{simple:true,parent:' applet object '},pre:{},q:{},samp:{},script:{parent:' head body p div span abbr acronym address bdo blockquote cite code del dfn em ins kbd pre samp strong th td var '},select:{},small:{},span:{},strong:{},style:{parent:' head ',special:true},sub:{},sup:{},table:{},tbody:{parent:' table '},td:{parent:' tr '},textarea:{},tfoot:{parent:' table '},th:{parent:' tr '},thead:{parent:' table '},title:{parent:' head '},tr:{parent:' tbody thead tfoot '},tt:{},u:{},ul:{},'var':{}}},widget:{doBegin:function(n){xtype='widget';builtin.alert=9;builtin.appleScript=9;builtin.beep=9;builtin.bytesToUIString=9;builtin.chooseColor=9;builtin.chooseFile=9;builtin.chooseFolder=9;builtin.convertPathToHFS=9;builtin.convertPathToPlatform=9;builtin.closeWidget=9;builtin.escape=9;builtin.focusWidget=9;builtin.form=9;builtin.include=9;builtin.isApplicationRunning=9;builtin.konfabulatorVersion=9;builtin.log=9;builtin.openURL=9;builtin.play=9;builtin.popupMenu=9;builtin.print=9;builtin.prompt=9;builtin.reloadWidget=9;builtin.resolvePath=9;builtin.resumeUpdates=9;builtin.runCommand=9;builtin.runCommandInBg=9;builtin.saveAs=9;builtin.savePreferences=9;builtin.showWidgetPreferences=9;builtin.sleep=9;builtin.speak=9;builtin.suppressUpdates=9;builtin.tellWidget=9;builtin.unescape=9;builtin.updateNow=9;builtin.yahooCheckLogin=9;builtin.yahooLogin=9;builtin.yahooLogout=9;builtin.COM=9;builtin.filesystem=9;builtin.preferenceGroups=9;builtin.preferences=9;builtin.screen=9;builtin.system=9;builtin.iTunes=9;builtin.URL=9;builtin.animator=9;builtin.CustomAnimation=9;builtin.FadeAnimation=9;builtin.MoveAnimation=9;builtin.RotateAnimation=9;builtin.XMLDOM=9;builtin.XMLHttpRequest=9;},doTagName:function(n,p){var t=xmltype.widget.tag[n];if(!t){throw error('Unrecognized tag: <'+n+'>. ');}\nvar x=t.parent;if(x.indexOf(' '+p+' ')<0){throw error('A <'+n+'> must be within <'+x+'>',prevtoken);}},doAttribute:function(n,a){var t=xmltype.widget.tag[a];if(!t){throw error('Unrecognized attribute: <'+n+' '+a+'>. ');}\nvar x=t.parent;if(x.indexOf(' '+n+' ')<0){throw error('Attribute '+a+' does not belong in <'+\nn+'>');}\nreturn t.script?'script':a==='name'?'define':'string';},doIt:function(n){var x=xmltype.widget.tag[n];return x&&x.script&&'script';},tag:{"about-box":{parent:' widget '},"about-image":{parent:' about-box '},"about-text":{parent:' about-box '},"about-version":{parent:' about-box '},action:{parent:' widget ',script:true},alignment:{parent:' image text textarea window '},author:{parent:' widget '},autoHide:{parent:' scrollbar '},bgColor:{parent:' text textarea '},bgOpacity:{parent:' text textarea '},checked:{parent:' image '},clipRect:{parent:' image '},color:{parent:' about-text about-version shadow text textarea '},contextMenuItems:{parent:' frame image text textarea window '},colorize:{parent:' image '},columns:{parent:' textarea '},company:{parent:' widget '},copyright:{parent:' widget '},data:{parent:' about-text about-version text textarea '},debug:{parent:' widget '},defaultValue:{parent:' preference '},defaultTracking:{parent:' widget '},description:{parent:' preference '},directory:{parent:' preference '},editable:{parent:' textarea '},enabled:{parent:' menuItem '},extension:{parent:' preference '},file:{parent:' action preference '},fillMode:{parent:' image '},font:{parent:' about-text about-version text textarea '},frame:{parent:' frame window '},group:{parent:' preference '},hAlign:{parent:' frame image scrollbar text textarea '},height:{parent:' frame image scrollbar text textarea window '},hidden:{parent:' preference '},hLineSize:{parent:' frame '},hOffset:{parent:' about-text about-version frame image scrollbar shadow text textarea window '},hotkey:{parent:' widget '},hRegistrationPoint:{parent:' image '},hslAdjustment:{parent:' image '},hslTinting:{parent:' image '},hScrollBar:{parent:' frame '},icon:{parent:' preferenceGroup '},image:{parent:' about-box frame window widget '},interval:{parent:' action timer '},key:{parent:' hotkey '},kind:{parent:' preference '},level:{parent:' window '},lines:{parent:' textarea '},loadingSrc:{parent:' image '},max:{parent:' scrollbar '},maxLength:{parent:' preference '},menuItem:{parent:' contextMenuItems '},min:{parent:' scrollbar '},minimumVersion:{parent:' widget '},minLength:{parent:' preference '},missingSrc:{parent:' image '},modifier:{parent:' hotkey '},name:{parent:' hotkey image preference preferenceGroup text textarea timer window '},notSaved:{parent:' preference '},onContextMenu:{parent:' frame image text textarea window ',script:true},onDragDrop:{parent:' frame image text textarea ',script:true},onDragEnter:{parent:' frame image text textarea ',script:true},onDragExit:{parent:' frame image text textarea ',script:true},onFirstDisplay:{parent:' window ',script:true},onGainFocus:{parent:' textarea window ',script:true},onKeyDown:{parent:' hotkey text textarea ',script:true},onKeyPress:{parent:' textarea ',script:true},onKeyUp:{parent:' hotkey text textarea ',script:true},onImageLoaded:{parent:' image ',script:true},onLoseFocus:{parent:' textarea window ',script:true},onMouseDown:{parent:' frame image text textarea ',script:true},onMouseEnter:{parent:' frame image text textarea ',script:true},onMouseExit:{parent:' frame image text textarea ',script:true},onMouseMove:{parent:' frame image text ',script:true},onMouseUp:{parent:' frame image text textarea ',script:true},onMouseWheel:{parent:' frame ',script:true},onMultiClick:{parent:' frame image text textarea window ',script:true},onSelect:{parent:' menuItem ',script:true},onTimerFired:{parent:' timer ',script:true},onValueChanged:{parent:' scrollbar ',script:true},opacity:{parent:' frame image scrollbar shadow text textarea window '},option:{parent:' preference widget '},optionValue:{parent:' preference '},order:{parent:' preferenceGroup '},orientation:{parent:' scrollbar '},pageSize:{parent:' scrollbar '},preference:{parent:' widget '},preferenceGroup:{parent:' widget '},remoteAsync:{parent:' image '},requiredPlatform:{parent:' widget '},rotation:{parent:' image '},scrollX:{parent:' frame '},scrollY:{parent:' frame '},secure:{parent:' preference textarea '},scrollbar:{parent:' text textarea '},shadow:{parent:' about-text text window '},size:{parent:' about-text about-version text textarea '},spellcheck:{parent:' textarea '},src:{parent:' image '},srcHeight:{parent:' image '},srcWidth:{parent:' image '},style:{parent:' about-text about-version preference text textarea '},text:{parent:' frame window '},textarea:{parent:' frame window '},timer:{parent:' widget '},thumbColor:{parent:' scrollbar '},ticking:{parent:' timer '},ticks:{parent:' preference '},tickLabel:{parent:' preference '},tileOrigin:{parent:' image '},title:{parent:' menuItem preference preferenceGroup window '},tooltip:{parent:' image text textarea '},truncation:{parent:' text '},tracking:{parent:' image '},trigger:{parent:' action '},truncation:{parent:' text textarea '},type:{parent:' preference '},useFileIcon:{parent:' image '},vAlign:{parent:' frame image scrollbar text textarea '},value:{parent:' preference scrollbar '},version:{parent:' widget '},visible:{parent:' frame image scrollbar text textarea window '},vLineSize:{parent:' frame '},vOffset:{parent:' about-text about-version frame image scrollbar shadow text textarea window '},vRegistrationPoint:{parent:' image '},vScrollBar:{parent:' frame '},width:{parent:' frame image scrollbar text textarea window '},window:{parent:' widget '},zOrder:{parent:' frame image scrollbar text textarea '}}}};function xmlword(tag){var w=token.value;if(!token.identifier){if(token.id==='<'){throw error(tag?"Expected &lt; and saw '<'":"Missing '>'",prevtoken);}else{throw error("Missing quotes",prevtoken);}}\nadvance();while(token.id==='-'||token.id===':'){w+=token.id;advance();if(!token.identifier){throw error('Bad name: '+w+token.value);}\nw+=token.value;advance();}\nreturn w;}\nfunction xml(){var a,e,n,q,t;xmode='xml';stack=[];while(error.free){switch(token.value){case'<':advance('<');t=token;n=xmlword(true);t.name=n;if(!xtype){if(xmltype[n]){xmltype[n].doBegin();n=xtype;e=false;}else{throw error("Unrecognized <"+n+">");}}else{if(jslint.cap&&xtype==='html'){n=n.toLowerCase();}\ne=xmltype[xtype].doTagName(n,stack[stack.length-1].type);}\nt.type=n;while(error.free){if(token.id==='/'){advance('/');e=true;break;}\nif(token.id&&token.id.substr(0,1)==='>'){break;}\na=xmlword();switch(xmltype[xtype].doAttribute(n,a)){case'script':xmode='string';advance('=');q=token.id;if(q!=='"'&&q!=="'"){throw error('Missing quote.');}\nxmode=q;advance(q);statements();if(token.id!==q){throw error('Missing close quote on script attribute');}\nxmode='xml';advance(q);break;case'value':advance('=');if(!token.identifier&&token.type!='(string)'&&token.type!='(number)'){throw error('Bad value: '+token.value);}\nadvance();break;case'string':advance('=');if(token.type!=='(string)'){throw error('Bad value: '+token.value);}\nadvance();break;case'define':advance('=');if(token.type!=='(string)'){throw error('Bad value: '+token.value);}\naddlabel(token.value,'global');advance();break;default:if(token.id==='='){advance('=');if(!token.identifier&&token.type!='(string)'&&token.type!='(number)'){}\nadvance();}}}\nswitch(xmltype[xtype].doIt(n)){case'script':xmode='script';advance('>');statements();xmode='xml';break;case'special':e=true;n='</'+t.name+'>';if(!lex.skip(n)){throw error("Missing "+n,t);}\nbreak;default:lex.skip('>');}\nif(!e){stack.push(t);}\nbreak;case'</':advance('</');n=xmlword(true);t=stack.pop();if(!t){throw error('Unexpected close tag: </'+n+'>');}\nif(t.name!=n){throw error('Expected </'+t.name+'> and instead saw </'+n+'>');}\nif(token.id!=='>'){throw error("Expected '>'");}\nlex.skip('>');break;case'<!':while(error.free){advance();if(token.id==='>'){break;}\nif(token.id==='<'||token.id==='(end)'){throw error("Missing '>'.",prevtoken);}}\nlex.skip('>');break;case'<!--':lex.skip('-->');break;case'<%':lex.skip('%>');break;case'<?':while(error.free){advance();if(token.id==='?>'){break;}\nif(token.id==='<?'||token.id==='<'||token.id==='>'||token.id==='(end)'){throw error("Missing '?>'.",prevtoken);}}\nlex.skip('?>');break;case'<=':case'<<':case'<<=':throw error("Expected '&lt;'.");case'(end)':return;}\nif(!lex.skip('')){if(stack.length){t=stack.pop();throw error('Missing </'+t.name+'>',t);}\nreturn;}\nadvance();}}})();\n//}}}\n\n//{{{\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n//}}}
/***\n|''Name:''|Templater|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBarPlugin addon|\n|''Required:''|WikiBarPlugin 1.0.0+|\n!Description\nLoad a tiddler template.\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // define tools\n var loadTemplate={\n TYPE:'MENU',\n CAPTION:'template',\n options:{\n TYPE:'MENU',\n DYNAITEM: loadTemplate_genOptions\n },\n SEPERATOR: {/*---------------------------*/},\n DYNAITEM: loadTemplate_genTemplates\n };\n\n // register tools\n wikibarStore.addon.loadTemplate = loadTemplate;\n\n // init\n loadTemplate_init();\n}\n\nfunction loadTemplate_init(){\n\n // set default value\n var cookies = [\n {name: 'chkLoadTemplateReplaceTitle', value: false},\n {name: 'chkLoadTemplateAppendTag', value: true},\n {name: 'chkLoadTemplateReplaceText', value: false}\n ];\n\n for(var i=0; i<cookies.length; i++){\n if(config.options[cookies[i].name]==null){\n config.options[cookies[i].name]=cookies[i].value;\n saveOptionCookie(cookies[i].name);\n }\n }\n\n}\n\nfunction loadTemplate_selectTemplate(param){\n\n var title = param.button.tiddlerTitle;\n var tiddlerWrapper = document.getElementById('tiddler'+title);\n var theTitle = wikibar_resolveEditItem(tiddlerWrapper, 'title');\n var theTag = wikibar_resolveEditItem(tiddlerWrapper, 'tags');\n var editor = param.button.editor;\n\n // get tiddler data\n var tiddler = store.getTiddler(this.title);\n\n if(config.options['chkLoadTemplateReplaceTitle']){\n theTitle.value = tiddler.title;\n }\n\n if(config.options['chkLoadTemplateAppendTag']){\n theTag.value = tiddler.getTags();\n }\n\n if(config.options['chkLoadTemplateReplaceText']){\n editor.value = tiddler.text;\n wikibar_editSelectAll(param);\n }else{ // inset current cursor\n param.params = tiddler.text;\n wikibar_editFormatByCursor(param);\n }\n\n}\n\nfunction loadTemplate_genOptions(){\n var toolset={};\n\n toolset.replaceTitle = {\n CAPTION:'replace title',\n TOOLTIP:'current title will be replaced',\n SELECTED: config.options['chkLoadTemplateReplaceTitle'],\n HANDLER:function(param){\n config.options['chkLoadTemplateReplaceTitle'] = !config.options['chkLoadTemplateReplaceTitle'];\n saveOptionCookie('chkLoadTemplateReplaceTitle');\n }\n };\n\n toolset.appendTag = {\n CAPTION:'append tags',\n TOOLTIP:'template tags will be appended',\n SELECTED: config.options['chkLoadTemplateAppendTag'],\n HANDLER:function(param){\n config.options['chkLoadTemplateAppendTag'] = !config.options['chkLoadTemplateAppendTag'];\n saveOptionCookie('chkLoadTemplateAppendTag');\n }\n };\n\n toolset.replaceText = {\n CAPTION:'replace text',\n TOOLTIP:'current text will be replaced',\n SELECTED: config.options['chkLoadTemplateReplaceText'],\n HANDLER:function(param){\n config.options['chkLoadTemplateReplaceText'] = !config.options['chkLoadTemplateReplaceText'];\n saveOptionCookie('chkLoadTemplateReplaceText');\n }\n };\n\n return toolset;\n}\n\nfunction loadTemplate_genTemplates(){\n\n try{\n\n var tiddlers = store.getTaggedTiddlers('TiddlerTemplates');\n if(!tiddlers) {\n displayMessage('Template not found! You can create a new tiddler and add \s"TiddlerTemplates\s" tag');\n return;\n }\n\n var toolset={};\n// toolset.TYPE='MENU';\n\n for(i=0; i<tiddlers.length; i++){\n var title = tiddlers[i].title.trim();\n toolset[title] = {\n title: title,\n HANDLER: loadTemplate_selectTemplate\n };\n }\n\n return toolset;\n\n }catch(ex){alert(ex);}\n\n}\n\n//}}}\n\n//{{{\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n//}}}\n\n
[[upgrade|HowToUpgradeTW]]\n
<html>\n<a href="javascript:;"\nonClick="story.displayTiddler(this,'TWMacro',2)">edit</a>\n</html>
<div id='header'>\n <div id='titleLine' macro='gradient vert #55bb55 #338844'>\n <span id='siteTitle' refresh='content' tiddler='SiteTitle'></span>\n <span id='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n </div>\n</div>\n\n<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>\n\n<div id='sidebar'>\n <div macro='gradient vert #338844 #113322'>\n <div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>\n </div>\n <div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>\n</div>\n\n<div id='displayArea'>\n <div id='messageArea'></div>\n <div id='tiddlerDisplay'></div>\n</div>
GIMP Palette\nName: Pastel\n 0 0 0 grey0\n252 252 252 grey99\n236 236 252\n216 216 252\n200 200 252\n180 180 252\n164 164 252\n144 144 252\n128 128 252\n108 108 252\n 92 92 252\n 72 72 252\n 56 56 252\n 36 36 252\n 20 20 252\n 0 0 252\n252 252 252 grey99\n252 236 236\n252 220 220\n252 204 204\n252 188 188\n252 168 168\n252 152 152\n252 136 136\n252 120 120\n252 104 104\n252 84 84\n252 68 68\n252 52 52\n252 36 36\n252 20 20\n252 0 0\n252 252 252 grey99\n236 252 236\n220 252 220\n204 252 204\n188 252 188\n168 252 168\n152 252 152\n136 252 136\n120 252 120\n104 252 104\n 84 252 84\n 68 252 68\n 52 252 52\n 36 252 36\n 20 252 20\n 0 252 0\n252 252 252 grey99\n252 236 252\n252 220 252\n252 204 252\n252 188 252\n252 168 252\n252 152 252\n252 136 252\n252 120 252\n252 104 252\n252 84 252\n252 68 252\n252 52 252\n252 36 252\n252 20 252\n252 0 252\n252 252 252 grey99\n236 252 252\n220 252 252\n204 252 252\n188 252 252\n168 252 252\n152 252 252\n136 252 252\n120 252 252\n104 252 252\n 84 252 252\n 68 252 252\n 52 252 252\n 36 252 252\n 20 252 252\n 0 252 252\n252 252 252 grey99\n252 252 236\n252 252 220\n252 252 204\n252 252 188\n252 252 168\n252 252 152\n252 252 136\n252 252 120\n252 252 104\n252 252 84\n252 252 68\n252 252 52\n252 252 36\n252 252 20\n252 252 0\n252 252 252 grey99\n244 236 252\n236 220 252\n228 204 252\n220 188 252\n212 168 252\n204 152 252\n196 136 252\n188 120 252\n180 104 252\n172 84 252\n164 68 252\n156 52 252\n148 36 252\n140 20 252\n128 0 252\n252 252 252 grey99\n236 244 252\n220 236 252\n204 228 252\n188 220 252\n168 212 252\n152 204 252\n136 196 252\n120 188 252\n104 180 252\n 84 172 252\n 68 164 252\n 52 156 252\n 36 148 252\n 20 140 252\n 0 128 252\n252 252 252 grey99\n252 236 244\n252 220 236\n252 204 228\n252 188 220\n252 168 212\n252 152 204\n252 136 196\n252 120 188\n252 104 180\n252 84 172\n252 68 164\n252 52 156\n252 36 148\n252 20 140\n252 0 128\n252 252 252 grey99\n252 244 236\n252 236 220\n252 228 204\n252 220 188\n252 212 168\n252 204 152\n252 196 136\n252 188 120\n252 180 104\n252 172 84\n252 164 68\n252 156 52\n252 148 36\n252 140 20\n252 128 0\n252 252 252 grey99\n236 236 244\n220 220 236\n204 204 228\n188 188 220\n168 168 212\n152 152 204\n136 136 196\n120 120 188\n104 104 180\n 84 84 172\n 68 68 164\n 52 52 156\n 36 36 148\n 20 20 140\n 0 0 128 NavyBlue\n252 252 252 grey99\n244 236 236\n236 220 220\n228 204 204\n220 188 188\n212 168 168\n204 152 152\n196 136 136\n188 120 120\n180 104 104\n172 84 84\n164 68 68\n156 52 52\n148 36 36\n140 20 20\n128 0 0\n252 252 252 grey99\n236 244 236\n220 236 220\n204 228 204\n188 220 188\n168 212 168\n152 204 152\n136 196 136\n120 188 120\n104 180 104\n 84 172 84\n 68 164 68\n 52 156 52\n 36 148 36\n 20 140 20\n 0 128 0\n252 252 252 grey99\n244 236 244\n236 220 236\n228 204 228\n220 188 220\n212 168 212\n204 152 204\n196 136 196\n188 120 188\n180 104 180\n172 84 172\n164 68 164\n156 52 156\n148 36 148\n140 20 140\n128 0 128\n252 252 252 grey99\n236 244 244\n220 236 236\n204 228 228\n188 220 220\n168 212 212\n152 204 204\n136 196 196\n120 188 188\n104 180 180\n 84 172 172\n 68 164 164\n 52 156 156\n 36 148 148\n 20 140 140\n 0 128 128\n252 252 252 grey99\n244 244 236\n236 236 220\n228 228 204\n220 220 188\n212 212 168\n204 204 152\n196 196 136\n188 188 120\n180 180 104\n172 172 84\n164 164 68\n156 156 52\n148 148 36\n140 140 20\n128 128 0\n
<<search>><<closeAll>><<newTiddler>><<permaview>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>
a way to ~TiddlyWiki's formatting features
WikiBar for TiddlyWiki <<version>>
http://www.tiddlywiki.com/beta/
/***\n!Colors Used\n*@@bgcolor(#ada): #ada - Sidebar background@@\n*@@bgcolor(#5b5): #5b5 - Top@@\n*@@bgcolor(#384): #384 - Mid@@\n*@@bgcolor(#132):color(#fff): #132 - Bottom@@\n*@@bgcolor(#221):color(#fff): #221 - Message area@@\n*@@bgcolor(#442): #442 - Link@@\n*@@bgcolor(#ec8): #ec8 - Header link@@\n*@@bgcolor(#eef): #eef - monospaced background@@\n*@@bgcolor(#abb):color(#fff): #abb - Command@@\n*@@bgcolor(#225):color(#fff): #225 - Title@@\n*@@bgcolor(#768): #768 - Subtitle@@\n*@@bgcolor(#ff4): #ff4 - popup background@@\n*@@bgcolor(#880): #880 - popup border@@\n!Generic Rules /%==============================================%/\n***/\n/*{{{*/\nbody {\nbackground: #fff;\n color: #000;\n}\n\na{\n color: #442;\n}\n\na:hover{\n background: #384;\n color: #fff;\n}\n\na img{\n border: 0;\n}\n\nh1,h2,h3,h4,h5 {\n color: #225;\n background: #ada;\n}\n/*}}}*/\n/***\n!Header /%==================================================%/\n***/\n/*{{{*/\n#titleLine {\n color: #fff;\n background: #384;\n}\n\n#titleLine a {\n color: #ec8;\n font-weight: bold;\n}\n\n#titleLine a:hover {\n background: transparent;\n}\n/*}}}*/\n/***\n!Sidebar options /%=================================================%/\n~TiddlyLinks and buttons are treated identically in the sidebar and slider panel\n***/\n/*{{{*/\n#sidebar {\n background: #132;\n}\n\n#sidebarOptions a{\n color: #abb;\n}\n\n#sidebarOptions a:hover {\n color: #000;\n background: #abb;\n}\n\n#sidebarOptions a:active {\n color: #000;\n background: #fff;\n}\n\n#sidebarOptions .sliderPanel {\n background: #ada;\n}\n\n#sidebarOptions .sliderPanel a {\n color: #384;\n}\n\n#sidebarOptions .sliderPanel a:hover {\n color: #fff;\n background: #384;\n}\n\n#sidebarOptions .sliderPanel a:active {\n color: #384;\n background: #fff;\n}\n/*}}}*/\n/***\n!Sidebar tabs /%=================================================%/\n***/\n/*{{{*/\n\n.tabUnselected {\n background: #132;\n}\n\n#sidebarTabs {\n background: #132;\n}\n\n#sidebarTabs .tabSelected{\n color: #132;\n background: #ada;\n}\n\n#sidebarTabs .tabUnselected {\n color: #000;\n background: #5b5;\n}\n\n#sidebarTabs .tabContents{\n background: #ada;\n color: #132;\n}\n\n#sidebarTabs .txtMoreTab .tabSelected,\n#sidebarTabs .txtMoreTab .tabSelected:hover{\n background: #fff;\n color: #225;\n}\n\n#sidebarTabs .txtMoreTab .tabUnselected,\n#sidebarTabs .txtMoreTab .tabUnselected:hover{\n background: #5b5;\n color: #132;\n}\n\n#sidebarTabs .txtMoreTab .tabContents {\n background: #fff;\n}\n\n#sidebarTabs .tabContents a {\n color: #442;\n}\n\n#sidebarTabs .tabContents a:hover {\n background: #384;\n color: #fff;\n}\n/*}}}*/\n/***\n!Message Area /%=================================================%/\n***/\n/*{{{*/\n#messageArea {\n background: #442;\n color: #fff;\n}\n\n#messageArea a:link, #messageArea a:visited {\n color: #ec8;\n}\n\n#messageArea a:hover {\n color: #fff;\n}\n\n#messageArea a:active {\n color: #fff;\n}\n/*}}}*/\n/***\n!Popup /%=================================================%/\n***/\n/*{{{*/\n.popup {\n background: #ff4;\n border: 1px solid #880;\n}\n\n.popup hr {\n color: #880;\n background: #880;\n border-bottom: 1px;\n}\n\n.popup li.disabled {\n color: #880;\n}\n\n.popup li a, .popup li a:visited {\n color: #221;\n}\n\n.popup li a:hover {\n background: #442;\n color: #ff4;\n}\n/*}}}*/\n/***\n!Tiddler Display /%=================================================%/\n***/\n/*{{{*/\n.tiddler .button {\n color: #384;\n border: 1px solid #fff;\n}\n\n.tiddler .button:hover {\n color: #132;\n background: #ada;\n border: 1px solid #384;\n}\n\n.tiddler .button:active {\n color: #132;\n background: #384;\n border: 1px solid #132;\n}\n\n.tiddler .defaultCommand {\n font-weight: bold;\n}\n\n.shadow .title {\n color: #888;\n}\n\n.title {\n color: #225;\n}\n\n.subtitle {\n color: #768;\n}\n\n.toolbar {\n color: #384;\n}\n\n.tagging, .tagged {\n border: 1px solid #abb;\n background-color: #fff;\n}\n\n.selected .tagging, .selected .tagged {\n background-color: #eef;\n border: 1px solid #abb;\n}\n\n.tagging .listTitle, .tagged .listTitle {\ncolor: #132;\n}\n\n.footer {\n color: #ddd;\n}\n\n.selected .footer {\n color: #888;\n}\n\n.sparkline {\n background: #ada;\n border: 0;\n}\n\n.sparktick {\n background: #132;\n}\n\n.errorButton {\n color: #ff0;\n background: #f00;\n}\n\n.zoomer {\n color: #384;\n border: 1px solid #384;\n}\n\n.imageLink {\n background: transparent;\n}\n\n/*}}}*/\n/***\n''The viewer is where the tiddler content is displayed'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.viewer .button {\n background: #ada;\n color: #132;\n border-right: 1px solid #384;\n border-bottom: 1px solid #384;\n}\n\n.viewer .button:hover {\n background: #442;\n color: #fff;\n}\n\n.viewer blockquote {\n border-left: 3px solid #666;\n}\n\n.viewer table {\n border: 2px solid #303030;\n}\n\n.viewer th, thead td {\n background: #996;\n border: 1px solid #606060;\n color: #fff;\n}\n\n.viewer td, .viewer tr {\n border: 1px solid #606060;\n}\n\n.viewer pre {\n border: 1px solid #225;\n background: #eef;\n}\n\n.viewer code {\n color: #225;\n}\n\n.viewer hr {\n border: 0;\n border-top: dashed 1px #606060;\n color: #666;\n}\n\n.highlight, .marked {\n background: #ff3;\n}\n/*}}}*/\n/***\n''The editor replaces the viewer in the tiddler'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.editor input {\n border: 1px solid #000;\n}\n\n.editor textarea {\n border: 1px solid #000;\n width: 100%;\n}\n\n.editorFooter {\n color: #aaa;\n}\n\n.editorFooter a {\n color: #384;\n}\n\n.editorFooter a:hover {\n color: #fff;\n background: #442;\n}\n\n.editorFooter a:active {\n color: #fff;\n background: #132;\n}\n/*}}}*/
/***\n!Sections in this Tiddler:\n*Generic rules\n**Links styles\n**Link Exceptions\n*Header\n*Main menu\n*Sidebar\n**Sidebar options\n**Sidebar tabs\n*Message area\n*Popup\n*Tabs\n*Tiddler display\n**Viewer\n**Editor\n*Misc. rules\n!Generic Rules /%==============================================%/\n***/\n/*{{{*/\nbody {\n font-size: .75em;\n font-family: arial,helvetica;\n position: relative;\n margin: 0;\n padding: 0;\n}\n\nh1,h2,h3,h4,h5 {\n font-weight: bold;\n text-decoration: none;\n padding-left: 0.4em;\n}\n\nh1 {font-size: 1.35em;}\nh2 {font-size: 1.25em;}\nh3 {font-size: 1.1em;}\nh4 {font-size: 1em;}\nh5 {font-size: .9em;}\n\nhr {\n height: 1px;\n}\n\na{\n text-decoration: none;\n}\n/*}}}*/\n/***\n''Gerneral Link Styles'' /%-----------------------------------------------------------------------------%/\n***/\n/*{{{*/\n.externalLink {\n text-decoration: underline;\n}\n\n.tiddlyLinkExisting {\n font-weight: bold;\n}\n\n.tiddlyLinkNonExisting {\n font-style: italic;\n}\n\n/* the 'a' is required for IE, otherwise it renders the whole tiddler a bold */\na.tiddlyLinkNonExisting.shadow {\n font-weight: bold;\n}\n/*}}}*/\n/***\n''Exceptions to common link styles'' /%------------------------------------------------------------------%/\n***/\n/*{{{*/\n\n#mainMenu .tiddlyLinkExisting, \n#mainMenu .tiddlyLinkNonExisting,\n#sidebarTabs .tiddlyLinkExisting,\n#sidebarTabs .tiddlyLinkNonExisting,\n#siteTitle .tiddlyLinkExisting,\n#siteTitle .tiddlyLinkNonExisting{\n font-weight: normal;\n font-style: normal;\n}\n\n/*}}}*/\n/***\n!Header /%==================================================%/\n***/\n/*{{{*/\n\n#titleLine {\n padding: 1.5em 0em 0.5em 0em;\n}\n\n#siteTitle {\n font-size: 3em;\n margin-left: .33em;\n}\n\n#siteSubtitle {\n padding-left: 1em;\n font-size: 1.1em;\n}\n\n/*}}}*/\n/***\n!Main menu /%==================================================%/\n***/\n/*{{{*/\n#mainMenu {\n position: absolute;\n left: 0;\n width: 7em;\n text-align: right;\n line-height: 1.6em;\n padding: 1.5em 0.5em 0.5em 0.5em;\n font-size: 1.1em;\n}\n\n/*}}}*/\n/***\n!Sidebar rules /%==================================================%/\n***/\n/*{{{*/\n#sidebar {\n position: absolute;\n right: 0em;\n width: 16em;\n font-size: .9em;\n}\n/*}}}*/\n/***\n''Sidebar options'' /%----------------------------------------------------------------------------------%/\n***/\n/*{{{*/\n#sidebarOptions a {\n padding: 0.3em 1em;\n display: block;\n}\n\n#sidebarOptions input {\n margin: 0.4em 1em;\n}\n\n#sidebarOptions .sliderPanel {\n padding: 0.5em;\n font-size: .85em;\n}\n\n#sidebarOptions .sliderPanel a {\n font-weight: bold;\n display: inline;\n padding: 0;\n}\n\n#sidebarOptions .sliderPanel input {\n margin: 0 0 .3em 0;\n}\n/*}}}*/\n/***\n''Sidebar tabs'' /%-------------------------------------------------------------------------------------%/\n***/\n/*{{{*/\n#sidebarTabs .tabContents {\n width: 15em;\n overflow: hidden;\n}\n\n#sidebarTabs .tabSelected {\n position: relative;\n top: -2px;\n}\n/*}}}*/\n/***\n!Message area /%==================================================%/\n***/\n/*{{{*/\n#messageArea {\n padding: 0.5em;\n}\n\n#messageToolbar {\ndisplay: block;\ntext-align: right;\n}\n\n#messageArea a{\n text-decoration: underline;\n}\n/*}}}*/\n/***\n!Popup /%==================================================%/\n***/\n/*{{{*/\n.popup {\n font-size: .9em;\n padding: 0.2em;\n list-style: none;\n margin: 0;\n}\n\n.popup hr {\n display: block;\n height: 1px;\n width: auto;\n padding: 0;\n margin: 0.2em 0em;\n}\n\n.popup li.disabled {\n padding: 0.2em;\n}\n\n.popup li a{\n display: block;\n padding: 0.2em;\n}\n/*}}}*/\n/***\n!Tabs /%==================================================%/\n***/\n/*{{{*/\n.tabset {\n padding: 1em 0em 0em 0.5em;\n}\n\n.tab {\n margin: 0em 0em 0em 0.25em;\n padding: 2px;\n}\n\n.tabContents {\n padding: 0.5em;\n}\n\n.tabContents ul, .tabContents ol {\n margin: 0;\n padding: 0;\n}\n\n.tabContents li {\n list-style: none;\n}\n\n.tabContents li.listLink {\n margin-left: .75em;\n}\n/*}}}*/\n/***\n!Tiddler display rules /%==================================================%/\n***/\n/*{{{*/\n#displayArea {\n margin: 0.2em 14.5em 0em 8.5em;\n}\n\n\n.toolbar {\n text-align: right;\n font-size: .9em;\n visibility: hidden;\n}\n\n.selected .toolbar {\n visibility: visible;\n}\n\n.tiddler {\n padding: 1em 1em 0em 1em;\n}\n\n.missing .viewer,.missing .title {\n font-style: italic;\n}\n\n.title {\n font-size: 2em;\n font-weight: bold;\n}\n\n.missing .subtitle {\n display: none\n}\n\n.subtitle {\n font-size: 1.25em;\n}\n\n/* I'm not a fan of how button looks in tiddlers... */\n.tiddler .button {\n padding: 0.2em 0.4em;\n}\n\n.tagging {\nmargin: 0.5em 0.5em 0.5em 0;\nfloat: left;\ndisplay: none;\n}\n\n.isTag .tagging {\ndisplay: block;\n}\n\n.tagged {\nmargin: 0.5em;\nfloat: right;\n}\n\n.tagging, .tagged {\nfont-size: 0.9em;\npadding: 0.25em;\n}\n\n.tagging ul, .tagged ul {\nlist-style: none;margin: 0.25em;\npadding: 0;\n}\n\n.tagClear {\nclear: both;\n}\n\n.footer {\n font-size: .9em;\n}\n\n.footer li {\ndisplay: inline;\n}\n/***\n''The viewer is where the tiddler content is displayed'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.viewer {\n line-height: 1.4em;\n padding-top: 0.5em;\n}\n\n.viewer .button {\n margin: 0em 0.25em;\n padding: 0em 0.25em;\n}\n\n.viewer blockquote {\n line-height: 1.5em;\n padding-left: 0.8em;\n margin-left: 2.5em;\n}\n\n.viewer ul, .viewer ol{\n margin-left: 0.5em;\n padding-left: 1.5em;\n}\n\n.viewer table {\n border-collapse: collapse;\n margin: 0.8em 1.0em;\n}\n\n.viewer th, .viewer td, .viewer tr,.viewer caption{\n padding: 3px;\n}\n\n.viewer pre {\n padding: 0.5em;\n margin-left: 0.5em;\n font-size: 1.2em;\n line-height: 1.4em;\n overflow: auto;\n}\n\n.viewer code {\n font-size: 1.2em;\n line-height: 1.4em;\n}\n/*}}}*/\n/***\n''The editor replaces the viewer in the tiddler'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.editor {\nfont-size: 1.1em;\n}\n\n.editor input, .editor textarea {\n display: block;\n width: 100%;\n font: inherit;\n}\n\n.editorFooter {\n padding: 0.25em 0em;\n font-size: .9em;\n}\n\n.fieldsetFix {border: 0;\npadding: 0;\nmargin: 1px 0px 1px 0px;\n}\n/*}}}*/\n/***\n!Misc rules /%==================================================%/\n***/\n/*{{{*/\n.sparkline {\n line-height: 1em;\n}\n\n.sparktick {\n outline: 0;\n}\n\n.zoomer {\n font-size: 1.1em;\n position: absolute;\n padding: 1em;\n}\n\n.cascade {\n font-size: 1.1em;\n position: absolute;\n padding: 1em;\n background: #dfd;\n color: #014;\n border: 1px solid #014;\n overflow: hidden;\n}\n/*}}}*/
/***\n|''Name:''|TWMacro|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBar addon|\n|''Required:''|WikiBar 2.0.0+|\n!Description\nsupport TiddlyWiki macro syntaxes\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // register tools\n wikibarStore.macro = {\n TYPE: 'MENU',\n TOOLTIP: 'system macros',\n systemInfo:{\n TYPE: 'MENU',\n CAPTION:'system information',\n allTags:{\n TOOLTIP:'display all TiddlyWiki tags',\n syntax: '<<allTags>>',\n HANDLER: wikibar_editFormatByWord\n },\n tag:{\n TOOLTIP:'display specified tag',\n syntax: '<<tag %1>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'tagName(ex: systemConfig)'\n },\n message:{\n TOOLTIP:'get system message',\n syntax:'<<message %1>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'customConfigError'\n },\n option:{\n TOOLTIP:'display specified option',\n syntax: '<<option %1>>[%2]\sn',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'chkOpenInNewWindow \s"Open link in new window\s"'\n },\n saveChanges:{\n TOOLTIP:'save changes',\n syntax: '<<saveChanges>>',\n HANDLER: wikibar_editFormatByWord\n },\n search:{\n TOOLTIP:'display search button and input box',\n syntax: '<<search>>',\n HANDLER: wikibar_editFormatByWord\n },\n timeline:{\n TYPE:'MENU',\n TOOLTIP:'list tiddlers in date order',\n modified:{\n TOOLTIP:'list tiddlers in modified date order',\n syntax: '<<timeline>>',\n HANDLER: wikibar_editFormatByWord\n },\n created:{\n TOOLTIP:'list tiddlers in created date order',\n syntax: '<<timeline created>>',\n HANDLER: wikibar_editFormatByWord\n }\n },\n version:{\n TOOLTIP:'display TiddlyWiki version',\n syntax: '<<version>>',\n HANDLER: wikibar_editFormatByWord\n },\n list:{\n TYPE: 'MENU',\n list:{\n TOOLTIP:'list all tiddlers in alphabetical order',\n syntax: '<<list>>',\n HANDLER: wikibar_editFormatByWord\n },\n listMissing:{\n CAPTION:'list missing',\n TOOLTIP:'list all undefined tiddlers',\n syntax: '<<list missing>>',\n HANDLER: wikibar_editFormatByWord\n },\n listOrphans:{\n CAPTION:'list orphans',\n TOOLTIP:'tiddlers that are not linked to from any other tiddlers',\n syntax: '<<list orphans>>',\n HANDLER: wikibar_editFormatByWord\n }\n }\n }, // systemInfo\n tiddlerOperate:{\n TYPE: 'MENU',\n CAPTION:'tiddler operation',\n newJournal:{\n TOOLTIP:'create a new tiddler from current date and time',\n syntax: '<<newJournal %1>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: '\s"journal title\s"'\n },\n newTiddler:{\n TOOLTIP:'create new tiddler',\n syntax: '<<newTiddler>>',\n HANDLER: wikibar_editFormatByWord\n },\n closeAll:{\n TOOLTIP:'close all tiddlers',\n syntax: '<<closeAll>>',\n HANDLER: wikibar_editFormatByWord\n }\n }, // tiddlerOperate\n tiddlerInfo:{\n TYPE: 'MENU',\n CAPTION:'tiddler information',\n tiddler:{\n TOOLTIP:'display specified tiddler text',\n syntax: '<<tiddler %1>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'tiddlerTitle'\n }\n }, // tiddlerInfo\n template:{\n TYPE:'MENU',\n CAPTION:'template only',\n toolbar:{\n TYPE:'MENU',\n TOOLTIP:'toolbar macro command',\n closeTiddler:{\n TOOLTIP: 'close current tiddler',\n syntax: 'closeTiddler',\n HANDLER: wikibar_editFormatByWord\n },\n closeOthers:{\n TOOLTIP: 'close other opened tiddlers',\n syntax: 'closeOthers',\n HANDLER: wikibar_editFormatByWord\n },\n editTiddler:{\n TOOLTIP: 'edit current tiddler',\n syntax: 'editTiddler',\n HANDLER: wikibar_editFormatByWord\n },\n saveTiddler:{\n TOOLTIP: 'save current tiddler',\n syntax: 'saveTiddler',\n HANDLER: wikibar_editFormatByWord\n },\n cancelTiddler:{\n TOOLTIP: 'cancel current tiddler',\n syntax: 'cancelTiddler',\n HANDLER: wikibar_editFormatByWord\n },\n deleteTiddler:{\n TOOLTIP: 'delete current tiddler',\n syntax: 'deleteTiddler',\n HANDLER: wikibar_editFormatByWord\n },\n permalink:{\n TOOLTIP:'display current tiddler link',\n syntax: 'permalink',\n HANDLER: wikibar_editFormatByWord\n },\n references:{\n TOOLTIP:'current tiddler references',\n syntax: 'references',\n HANDLER: wikibar_editFormatByWord\n },\n jump:{\n TOOLTIP:'jump to other opened tiddler',\n syntax: 'jump',\n HANDLER: wikibar_editFormatByWord\n },\n tagChooser:{\n TOOLTIP:'add tag(s) to current tiddler',\n syntax: 'tagChooser',\n HANDLER: wikibar_editFormatByWord\n }\n },\n edit:{\n TYPE:'MENU',\n editTitle:{\n CAPTION:'edit title',\n TOOLTIP:'display title input box',\n syntax: "macro='edit title'",\n HANDLER: wikibar_editFormatByWord\n },\n editTags:{\n CAPTION:'edit tags',\n TOOLTIP:'display tags input box',\n syntax: "macro='edit tags'",\n HANDLER: wikibar_editFormatByWord\n },\n editText:{\n CAPTION:'edit text',\n TOOLTIP:'display tiddler text edit box',\n syntax: "macro='edit text'",\n HANDLER: wikibar_editFormatByWord\n }\n },\n view:{\n TYPE:'MENU',\n viewTitle:{\n CAPTION:'view title',\n TOOLTIP:'display title',\n syntax: "macro='view title'",\n HANDLER: wikibar_editFormatByWord\n },\n viewTags:{\n CAPTION:'view tags',\n TOOLTIP:'display tags',\n syntax: "macro='view tags'",\n HANDLER: wikibar_editFormatByWord\n },\n viewText:{\n CAPTION:'view text',\n TOOLTIP:'display tiddler text',\n syntax: "macro='view text'",\n HANDLER: wikibar_editFormatByWord\n }\n }\n },\n misc:{\n TYPE: 'MENU',\n gradient:{\n TOOLTIP: 'gradient',\n syntax: '<<gradient vert %1 #ffffff %1>>user_text\sn>>',\n HANDLER: wikibar_getColorCode,\n doMore: wikibar_editFormatByWord\n },\n slider:{\n TOOLTIP: 'slider',\n syntax: '<<slider %1 %2 %3>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'sliderID sliderTiddler sliderLabel'\n },\n sparkline:{\n TOOLTIP: 'sparkline',\n syntax: '<<sparkline %N>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'number_list(ex: 100 123 ...)'\n },\n tabs:{\n TOOLTIP: 'tabs',\n syntax: '<<tabs [%N]>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: 'indentifier tabLabel tabName Tiddler'\n },\n today:{\n TOOLTIP: 'today',\n syntax: '<<today [%1]>>',\n HANDLER: wikibar_getMacroParam,\n doMore: wikibar_editFormatByWord,\n param: '"YYYY/MM/DD hh:mm:ss"'\n }\n } // misc\n }; // macro\n\n}\n\n//}}}\n//{{{\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n//}}}
/***\n| ''Name'' |plugin name|\n| ''Version'' ||\n| ''Source'' |[[source_name|http://where.you.are]]|\n| ''Author'' |[[author_name|mailto:you@from.where]]|\n| ''Type'' |plugin macro extension|\n| ''Required'' |TiddlyWiki |\n!Description\n\n!Revision\n\n!Code\n***/\n//{{{\n\n/* your code here */\n\n//}}}
/***\n|''Name:''|Templater|\n|''Version:''||\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|WikiBarPlugin addon|\n|''Required:''|WikiBarPlugin 1.0.0+|\n!Description\nLoad a tiddler template.\n!Installation\n#install WikiBar at first\n#create your addon as a tiddler with tag 'wikibarAddons'\n!Code\n***/\n//{{{\n\n//----------------------------------------------------------------------------\n// addon install function: this is a must\n//----------------------------------------------------------------------------\nfunction wikibar_addonInstall(unused){\n\n // define tools\n var loadTemplate={\n TYPE:'MENU',\n CAPTION:'template',\n options:{\n TYPE:'MENU',\n DYNAITEM: loadTemplate_genOptions\n },\n SEPERATOR: {/*---------------------------*/},\n DYNAITEM: loadTemplate_genTemplates\n };\n\n // register tools\n wikibarStore.addon.loadTemplate = loadTemplate;\n\n // init\n loadTemplate_init();\n}\n\nfunction loadTemplate_init(){\n\n // set default value\n var cookies = [\n {name: 'chkLoadTemplateReplaceTitle', value: false},\n {name: 'chkLoadTemplateAppendTag', value: true},\n {name: 'chkLoadTemplateReplaceText', value: false}\n ];\n\n for(var i=0; i<cookies.length; i++){\n if(config.options[cookies[i].name]==null){\n config.options[cookies[i].name]=cookies[i].value;\n saveOptionCookie(cookies[i].name);\n }\n }\n\n}\n\nfunction loadTemplate_selectTemplate(param){\n\n var title = param.button.tiddlerTitle;\n var tiddlerWrapper = document.getElementById('tiddler'+title);\n var theTitle = wikibar_resolveEditItem(tiddlerWrapper, 'title');\n var theTag = wikibar_resolveEditItem(tiddlerWrapper, 'tags');\n var editor = param.button.editor;\n\n // get tiddler data\n var tiddler = store.getTiddler(this.title);\n\n if(config.options['chkLoadTemplateReplaceTitle']){\n theTitle.value = tiddler.title;\n }\n\n if(config.options['chkLoadTemplateAppendTag']){\n theTag.value = tiddler.getTags();\n }\n\n if(config.options['chkLoadTemplateReplaceText']){\n editor.value = tiddler.text;\n wikibar_editSelectAll(param);\n }else{ // inset current cursor\n param.params = tiddler.text;\n wikibar_editFormatByCursor(param);\n }\n\n}\n\nfunction loadTemplate_genOptions(){\n var toolset={};\n\n toolset.replaceTitle = {\n CAPTION:'replace title',\n TOOLTIP:'current title will be replaced',\n SELECTED: config.options['chkLoadTemplateReplaceTitle'],\n HANDLER:function(param){\n config.options['chkLoadTemplateReplaceTitle'] = !config.options['chkLoadTemplateReplaceTitle'];\n saveOptionCookie('chkLoadTemplateReplaceTitle');\n }\n };\n\n toolset.appendTag = {\n CAPTION:'append tags',\n TOOLTIP:'template tags will be appended',\n SELECTED: config.options['chkLoadTemplateAppendTag'],\n HANDLER:function(param){\n config.options['chkLoadTemplateAppendTag'] = !config.options['chkLoadTemplateAppendTag'];\n saveOptionCookie('chkLoadTemplateAppendTag');\n }\n };\n\n toolset.replaceText = {\n CAPTION:'replace text',\n TOOLTIP:'current text will be replaced',\n SELECTED: config.options['chkLoadTemplateReplaceText'],\n HANDLER:function(param){\n config.options['chkLoadTemplateReplaceText'] = !config.options['chkLoadTemplateReplaceText'];\n saveOptionCookie('chkLoadTemplateReplaceText');\n }\n };\n\n return toolset;\n}\n\nfunction loadTemplate_genTemplates(){\n\n try{\n\n var tiddlers = store.getTaggedTiddlers('TiddlerTemplates');\n if(!tiddlers) {\n displayMessage('Template not found! You can create a new tiddler and add \s"TiddlerTemplates\s" tag');\n return;\n }\n\n var toolset={};\n// toolset.TYPE='MENU';\n\n for(i=0; i<tiddlers.length; i++){\n var title = tiddlers[i].title.trim();\n toolset[title] = {\n title: title,\n HANDLER: loadTemplate_selectTemplate\n };\n }\n\n return toolset;\n\n }catch(ex){alert(ex);}\n\n}\n\n//}}}\n\n//{{{\n// for debugging: you can turn it off in final release ----------------------\nwikibar_addonInstall();\n//}}}\n\n
<div class='toolbar' macro='toolbar +editTiddler -closeTiddler closeOthers deleteTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div>\n<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (created <span macro='view created date [[DD MMM YYYY]]'></span>)</div>\n<!--<div class='tagging' macro='tagging'></div>-->\n<!--<div class='tagged' macro='tags'></div>-->\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div>
/***\n|''Name:''|WikiBar|\n|''Version:''|2.0.0 beta3|\n|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|\n|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|\n|''Type:''|toolbar macro command extension|\n|''Required:''|TiddlyWiki 2.0.0 beta6|\n!Description\nWikiBar is a toolbar that gives access to most of TiddlyWiki's formatting features with a few clicks. It's a handy tool for people who are not familiar with TiddlyWiki syntax.\nBesides, with WikiBar-addons, users can extend the power of WikiBar.\n!Support browser\n*Firefox 1.5\n!Revision history\n*v2.0.0 beta3 (2005/12/30)\n** remove macros (replaced by TWMacro addon)\n** add wikibar command in toolbar automatically\n** rename DOIT to HANDLER\n** rename TIP to TOOLTIP\n*v2.0.0 beta2 (2005/12/21)\n** re-design Wikibar addon framework\n*v2.0.0 beta1 (2005/12/14)\n** Note:\n*** WikiBarPlugin is renamed to WikiBar\n** New Features:\n*** support TiddlyWiki 2.0.0 template mechanism\n*** new wikibar data structure\n*** new wikibar-addon framework for developers\n**** support dynamic popup menu generator\n*** support most new macros added in TiddlyWiki 2.0.0\n*** multi-level popup menu\n*** fix wikibar tab stop\n*** remove paletteSelector\n** Known Bugs:\n*** popup-menu and color-picker can't be closed correctly\n*** some macros can't be displayed correctly in previewer\n*** text in previewer will be displayed italic\n*v1.2.0 (2005/11/21)\n**New Features:\n***User defined color palettes supported\n####Get color palettes from [[ColorZilla Palettes|http://www.iosart.com/firefox/colorzilla/palettes.html]].\n####Save the palette file(*.gpl) as a new tiddler and tag it with 'ColorPalettes', then you can use it in WikiBar.\n***WikiBar style sheet supported\n***Click on document to close current colorPicker, paletteSelector or aboutWikibar\n*v1.1.1 (2005/11/03)\n**Bugs fixed:\n***'Not enough parameters!' message is displayed when the parameter includes '%+number', ex: 'hello%20world!'\n*v1.1.0 (2005/11/01)\n**Bugs fixed:\n***WikiBar overruns (reported by by GeoffS <gslocock@yahoo.co.uk>)\n**New features:\n***Insert a color code at the cursor. (Thanks to RunningUtes <RunningUtes@gmail.com>)\n***Enable gradient macro. (Thanks to RunningUtes <RunningUtes@gmail.com>)\n***Insert tiddler comment tags {{{/% ... %/}}}. (new feature supported by TiddlyWiki 1.2.37)\n***Insert DateFormatString for {{{<<today>>}}} macro. (new feature supported by TiddlyWiki 1.2.37)\n**Enhanced:\n***Allow optional parameters in syntax.\n**Bugs:\n***'Not enough parameters!' message is displayed when the parameter includes '%+number', ex: 'hello%20world!'\n*v1.0.0 (2005/10/30)\n**Initial release\n!Code\n***/\n//{{{\nconfig.macros.wikibar = {major: 2, minor: 0, revision: 0, beta: 3, date: new Date(2005,12,30)};\nconfig.macros.wikibar.handler = function(place,macroName,params,wikifier,paramString,tiddler){\n if(!(tiddler instanceof Tiddler)) {return;}\n story.setDirty(tiddler.title,true);\n place.id = 'wikibar'+tiddler.title;\n place.className = 'toolbar wikibar';\n};\nfunction wikibar_install(){\n config.commands.wikibar = {\n text: 'wikibar',\n tooltip: 'wikibar on/off',\n handler: function(e,src,title) {\n if(!e){ e = window.event; }\n var theButton = resolveTarget(e);\n theButton.id = 'wikibarButton'+title;\n wikibarPopup.remove();\n wikibar_installAddons(theButton, title);\n wikibar_createWikibar(title);\n return(false);\n }\n };\n config.shadowTiddlers['EditTemplate'] = wikibar_addWikibarCommand(config.shadowTiddlers['EditTemplate']);\n var tiddler = store.getTiddler('EditTemplate');\n if(tiddler){\n tiddler.text = wikibar_addWikibarCommand(tiddler.text);\n }\n}\nfunction wikibar_installAddons(theButton, title){\n var tiddlers = store.getTaggedTiddlers('wikibarAddons');\n if(!tiddlers) { return; }\n theButton.addons=[];\n for(var i=0; i<tiddlers.length; i++){\n try{\n eval(tiddlers[i].text);\n try{\n wikibar_addonInstall(title);\n wikibar_addonInstall = null;\n theButton.addons.push({ok:true, name:tiddlers[i].title});\n }catch(ex){\n theButton.addons.push({ok:false, name:tiddlers[i].title, error:ex});\n }\n }catch(ex){\n theButton.addons.push({ok:false, name:tiddlers[i].title, error:ex});\n }\n }\n}\nfunction wikibar_addWikibarCommand(tiddlerText){\n var div = document.createElement('div');\n div.style.display = 'none';\n div.innerHTML = tiddlerText;\n for(var i=0; i<div.childNodes.length; i++){\n var o=div.childNodes[i];\n if(o.tagName==='DIV'){\n if(o.className=='toolbar'){\n var macroText = o.getAttribute('macro').trim();\n if(macroText.search('wikibar')<=0){\n macroText += ' wikibar';\n o.setAttribute('macro', macroText);\n }\n break;\n }\n }\n }\n return div.innerHTML.replace(/\s"/g, "\s'");\n}\nfunction wikibar_processSyntaxParams(theSyntax, params){\n try{\n var pcr = 'AplWikibarPcr';\n var rx=null;\n var allParams=null;\n if(params){\n if(typeof(params)=='object'){\n for(var i=0; i<params.length; i++){\n if(params[i]){\n params[i] = params[i].replace(new RegExp('%','g'), pcr).trim();\n rx = '(\s\s[%'+(i+1)+'\s\s])' + '|' + '(%'+(i+1)+')';\n theSyntax = theSyntax.replace(new RegExp(rx,'g'), params[i] );\n }\n }\n allParams = params.join(' ').trim();\n }else{\n allParams = params.replace(new RegExp('%','g'), pcr).trim();\n rx = /(\s[%1{1}\s])|(%1{1})/g;\n theSyntax = theSyntax.replace(rx, allParams);\n }\n }\n if(allParams){\n theSyntax = theSyntax.replace(new RegExp('%N{1}','g'), allParams);\n }\n rx=/\s[%(([1-9]{1,}[0-9]{0,})|(N{1}))\s]/g;\n theSyntax = theSyntax.replace(rx, '');\n rx=/%(([1-9]{1,}[0-9]{0,})|(N{1}))/g;\n if( theSyntax.match(rx) ){\n throw 'Not enough parameters! ' + theSyntax;\n }\n theSyntax=theSyntax.replace(new RegExp(pcr,'g'), '%');\n return theSyntax;\n } catch(ex){\n return null;\n }\n}\nfunction wikibar_resolveEditItem(tiddlerWrapper, itemName){\n if(tiddlerWrapper.hasChildNodes()){\n var c=tiddlerWrapper.childNodes;\n for(var i=0; i<c.length; i++){\n var txt=wikibar_resolveEditItem(c[i], itemName);\n if(!txt){\n continue;\n }else{\n return txt;\n }\n }\n }\n return ((tiddlerWrapper.getAttribute && tiddlerWrapper.getAttribute('edit')==itemName)? tiddlerWrapper : null);\n}\nfunction wikibar_resolveEditItemValue(tiddlerWrapper, itemName){\n var o = wikibar_resolveEditItem(tiddlerWrapper, itemName);\n return (o? o.value.replace(/\sr/mg,'') : null);\n}\nfunction wikibar_resolveTiddlerEditorWrapper(obj){\n if(obj.id=='tiddlerDisplay'){return null;}\n if((obj.getAttribute && obj.getAttribute('macro')=='edit text')){return obj;}\n return wikibar_resolveTiddlerEditorWrapper(obj.parentNode);\n}\nfunction wikibar_resolveTiddlerEditor(obj){\n if(obj.hasChildNodes()){\n var c = obj.childNodes;\n for(var i=0; i<c.length; i++){\n var o=wikibar_resolveTiddlerEditor(c[i]);\n if(o){ return o;}\n }\n }\n return ((obj.getAttribute && obj.getAttribute('edit')=='text')? obj : null);\n}\nfunction wikibar_resolveTargetButton(obj){\n if(obj.id && obj.id.substring(0,7)=='wikibar'){ return null; }\n if(obj.tiddlerTitle){\n return obj;\n }else{\n return wikibar_resolveTargetButton(obj.parentNode);\n }\n}\nfunction wikibar_isValidMenuItem(tool){\n if(!tool){ return false; }\n if(tool.TYPE=='MENU' || tool.TYPE=='MAIN_MENU'){\n for(var key in tool){\n if(key.substring(0,8)=='DYNAITEM'){ return true; }\n if(wikibar_isValidMenuItem(tool[key])){ return true; }\n }\n return false;\n }else{\n return (tool.HANDLER? true : false);\n }\n}\nfunction wikibar_editFormat(param){\n var editor = param.button.editor;\n var params = param.params;\n clearMessage();\n if(!editor){ return; }\n var repText = wikibar_processSyntaxParams(this.syntax, params);\n if(repText===null){ return; }\n var st = editor.scrollTop;\n var ss = editor.selectionStart;\n var se = editor.selectionEnd;\n var frontText= '';\n var endText = '';\n var fullText = editor.value;\n if(se>ss && ss>=0){\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n }\n else if(ss===0 && (se===0 || se == fullText.length) ){\n endText = fullText;\n }\n else if(se==ss && ss>0){\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n }\n if(repText.indexOf('user_text')>=0 && this.hint){\n repText = repText.replace('user_text', this.hint);\n }\n editor.value = frontText + repText + endText;\n editor.selectionStart = ss;\n editor.selectionEnd = ss + repText.length;\n editor.scrollTop = st;\n editor.focus();\n}\nfunction wikibar_editFormatByWord(param){\n var editor = param.button.editor;\n var params = param.params;\n clearMessage();\n if(!editor){return;}\n var repText = wikibar_processSyntaxParams(this.syntax, params);\n if(repText===null){ return; }\n var st = editor.scrollTop;\n var ss = editor.selectionStart;\n var se = editor.selectionEnd;\n var frontText= '';\n var selText = '';\n var endText = '';\n var fullText = editor.value;\n if(se>ss && ss>=0){\n frontText = fullText.substring(0, ss);\n selText = fullText.substring(ss,se);\n endText = fullText.substring(se, fullText.length);\n }\n else if(ss===0 && (se===0 || se == fullText.length) ){\n endText = fullText;\n }\n else if(se==ss && ss>0){\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n if(!( fullText.charAt(ss-1).match(/\sW/gi) || fullText.charAt(ss).match(/\sW/gi) )){\n var m = frontText.match(/\sW/gi);\n if(m){\n ss = frontText.lastIndexOf(m[m.length-1])+1;\n }\n else{\n ss = 0;\n }\n m = endText.match(/\sW/gi);\n if(m){\n se += endText.indexOf(m[0]);\n }\n else{\n se = fullText.length;\n }\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n selText = fullText.substring(ss,se);\n }\n }\n if(selText.length>0){\n repText = repText.replace('user_text', selText);\n }\n if(repText.indexOf('user_text')>=0 && this.hint){\n repText = repText.replace('user_text', this.hint);\n }\n editor.value = frontText + repText + endText;\n editor.selectionStart = ss;\n editor.selectionEnd = ss + repText.length;\n editor.scrollTop = st;\n editor.focus();\n}\nfunction wikibar_editFormatByCursor(param){\n var editor = param.button.editor;\n var params = param.params;\n clearMessage();\n if(!editor){ return; }\n var repText = wikibar_processSyntaxParams(this.syntax, params);\n if(repText===null){ return; }\n var st = editor.scrollTop;\n var ss = editor.selectionStart;\n var se = editor.selectionEnd;\n var frontText= '';\n var endText = '';\n var fullText = editor.value;\n if(se>ss && ss>=0){\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n }\n else if(ss===0 && (se===0 || se == fullText.length) ){\n endText = fullText;\n }\n else if(se==ss && ss>0){\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n }\n if(repText.indexOf('user_text')>=0 && this.hint){\n repText = repText.replace('user_text', this.hint);\n }\n editor.value = frontText + repText + endText;\n editor.selectionStart = ss;\n editor.selectionEnd = ss + repText.length;\n editor.scrollTop = st;\n editor.focus();\n}\nfunction wikibar_editFormatByLine(param){\n var editor = param.button.editor;\n var params = param.params;\n clearMessage();\n if(!editor){ return; }\n var repText = wikibar_processSyntaxParams(this.syntax, params);\n if(repText===null){ return; }\n var st = editor.scrollTop;\n var ss = editor.selectionStart;\n var se = editor.selectionEnd;\n var frontText= '';\n var selText = '';\n var endText = '';\n var fullText = editor.value;\n if(se>ss && ss>=0){\n if(this.byBlock){\n frontText = fullText.substring(0, ss);\n selText = fullText.substring(ss,se);\n endText = fullText.substring(se, fullText.length);\n }\n else{\n se = ss;\n }\n }\n if(ss===0 && (se===0 || se == fullText.length) ){\n var m=fullText.match(/(\sn|\sr)/g);\n if(m){\n se = fullText.indexOf(m[0]);\n }else{\n se = fullText.length;\n }\n selText = fullText.substring(0, se);\n endText = fullText.substring(se, fullText.length);\n }\n else if(se==ss && ss>0){\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n m = frontText.match(/(\sn|\sr)/g);\n if(m){\n ss = frontText.lastIndexOf(m[m.length-1])+1;\n }\n else{\n ss = 0;\n }\n m = endText.match(/(\sn|\sr)/g);\n if(m){\n se += endText.indexOf(m[0]);\n }\n else{\n se = fullText.length;\n }\n frontText = fullText.substring(0, ss);\n selText = fullText.substring(ss,se);\n endText = fullText.substring(se, fullText.length);\n }\n if(selText.length>0){\n repText = repText.replace('user_text', selText);\n }\n if(repText.indexOf('user_text')>=0 && this.hint){\n repText = repText.replace('user_text', this.hint);\n }\n if(this.byBlock){\n if( (frontText.charAt(frontText.length-1)!='\sn') && ss>0 ){\n repText = '\sn' + repText;\n }\n if( (endText.charAt(0)!='\sn') || se==fullText.length){\n repText += '\sn';\n }\n }\n editor.value = frontText + repText + endText;\n editor.selectionStart = ss;\n editor.selectionEnd = ss + repText.length;\n editor.scrollTop = st;\n editor.focus();\n}\nfunction wikibar_editFormatByTableCell(param){\n var editor = param.button.editor;\n var params = param.params;\n clearMessage();\n if(!editor){ return; }\n var repText = wikibar_processSyntaxParams(this.syntax, params);\n if(repText===null){ return; }\n var st = editor.scrollTop;\n var ss = editor.selectionStart;\n var se = editor.selectionEnd;\n var frontText= '';\n var selText = '';\n var endText = '';\n var fullText = editor.value;\n if(ss===0 || ss==fullText.length){\n throw 'not valid cell!';\n }\n se=ss;\n frontText = fullText.substring(0, ss);\n endText = fullText.substring(se, fullText.length);\n i=frontText.lastIndexOf('\sn');\n j=frontText.lastIndexOf('|');\n if(i>j || j<0){\n throw 'not valid cell!';\n }\n ss = j+1;\n i=endText.indexOf('\sn');\n j=endText.indexOf('|');\n if(i<j || j<0){\n throw 'not valid cell!';\n }\n se += j;\n frontText = fullText.substring(0, ss-1);\n selText = fullText.substring(ss,se);\n endText = fullText.substring(se+1, fullText.length);\n if(this.key.substring(0,5)=='align'){\n selText = selText.trim();\n if( selText=='>' || selText=='~' || selText.substring(0,8)=='bgcolor(') {return; }\n }\n if(selText.length>0){\n repText = repText.replace('user_text', selText);\n }\n if(repText.indexOf('user_text')>=0 && this.hint){\n repText = repText.replace('user_text', this.hint);\n }\n editor.value = frontText + repText + endText;\n editor.selectionStart = ss;\n editor.selectionEnd = ss + repText.length - 2;\n editor.scrollTop = st;\n editor.focus();\n}\nfunction wikibar_editSelectAll(param){\n var editor = param.button.editor;\n editor.selectionStart = 0;\n editor.selectionEnd = editor.value.length;\n editor.scrollTop = 0;\n editor.focus();\n}\nfunction wikibar_doPreview(param){\n var theButton = param.button;\n var editor = param.button.editor;\n var wikibar = theButton.parentNode;\n if(!wikibar) { return; }\n title = theButton.tiddlerTitle;\n var editorWrapper = wikibar_resolveTiddlerEditorWrapper(editor);\n var tiddlerWrapper = editorWrapper.parentNode;\n var previewer = document.getElementById('previewer'+title);\n if(previewer){\n previewer.parentNode.removeChild(previewer);\n editorWrapper.style.display = 'block';\n visible=true;\n }else{\n previewer = document.createElement('div');\n previewer.id = 'previewer'+title;\n previewer.className = 'viewer previewer';\n previewer.style.height = (editor.offsetHeight) + 'px';\n wikify(editor.value, previewer);\n tiddlerWrapper.insertBefore(previewer, editorWrapper);\n editorWrapper.style.display = 'none';\n visible=false;\n }\n var pv=null;\n for(var i=0; i<wikibar.childNodes.length; i++){\n try{\n var btn = wikibar.childNodes[i];\n if(btn.toolItem.key == 'preview'){ pv=btn; }\n if(btn.toolItem.key != 'preview'){\n btn.style.display = visible ? '': 'none';\n }\n }catch(ex){}\n }\n if(!pv) { return; }\n if(visible){\n pv.innerHTML = '<font face=\s"verdana\s">&infin;</font>';\n pv.title = 'preview current tiddler';\n }\n else{\n pv.innerHTML = '<font face=\s"verdana\s">&larr;</font>';\n pv.title = 'back to editor';\n }\n}\nfunction wikibar_doListAddons(param){\n clearMessage();\n var title = param.button.tiddlerTitle;\n var wikibarButton = document.getElementById('wikibarButton'+title);\n var ok=0, fail=0;\n for(var i=0; i<wikibarButton.addons.length; i++){\n var addon=wikibarButton.addons[i];\n if(addon.ok){\n displayMessage('[ o ] '+addon.name);\n ok++;\n }\n else{\n displayMessage('[ x ] '+addon.name + ': ' + addon.error);\n fail++;\n }\n }\n displayMessage('---------------------------------');\n displayMessage(ok + ' ok ; ' + fail + ' failed');\n}\nfunction wikibar_getColorCode(param){\n var cbOnPickColor = function(colorCode, param){\n param.params = colorCode;\n param.button.toolItem.doMore(param);\n };\n wikibarColorTool.openColorPicker(param.button, cbOnPickColor, param);\n}\nfunction wikibar_getLinkUrl(param){\n var url= prompt('Please enter the link target', (this.param? this.param : ''));\n if (url && url.trim().length>0){\n param.params = url;\n this.doMore(param);\n }\n}\nfunction wikibar_getTableRowCol(param){\n var rc= prompt('Please enter (rows x cols) of the table', '2 x 3');\n if (!rc || (rc.trim()).length<=0){ return; }\n var arr = rc.toUpperCase().split('X');\n if(arr.length != 2) { return; }\n for(var i=0; i<arr.length; i++){\n if(isNaN(arr[i].trim())) { return; }\n }\n var rows = parseInt(arr[0].trim(), 10);\n var cols = parseInt(arr[1].trim(), 10);\n var txtTable='';\n for(var r=0; r<rows; r++){\n for(var c=0; c<=cols; c++){\n if(c===0){\n txtTable += '|';\n }else{\n txtTable += ' |';\n }\n }\n txtTable += '\sn';\n }\n if(txtTable.trim().length>0){\n param.params = txtTable.trim();\n this.doMore(param);\n }\n}\nfunction wikibar_getMacroParam(param){\n var p = prompt('Please enter the parameters of macro \s"' + this.key + '\s":' +\n '\snSyntax: ' + this.syntax +\n '\sn\snNote: '+\n '\sn%1,%2,... - parameter needed'+\n '\sn[%1] - optional parameter'+\n '\sn%N - more than one parameter(1~n)'+\n '\sn[%N] - any number of parameters(0~n)'+\n '\sn\snPS:'+\n '\sn1. Parameters should be seperated with space character'+\n '\sn2. Use \s" to wrap the parameter that includes space character, ex: \s"hello world\s"'+\n '\sn3. Input the word(null) for the optional parameter ignored',\n (this.param? this.param : '') );\n if(!p) { return; }\n p=p.readMacroParams();\n for(var i=0; i<p.length; i++){\n var s=p[i].trim();\n if(s.indexOf(' ')>0){ p[i]="'"+s+"'"; }\n if(s.toLowerCase()=='null'){ p[i]=null; }\n }\n param.params = p;\n this.doMore(param);\n}\nfunction wikibar_getMorePalette(unused){\n clearMessage();\n displayMessage('Get more color palettes(*.gpl) from ColorZilla Palettes site', 'http:\s/\s/www.iosart.com/firefox/colorzilla/palettes.html');\n displayMessage('Save it as a new tiddler with \s"ColorPalettes\s" tag');\n}\nfunction wikibar_createWikibar(title){\n var theWikibar = document.getElementById('wikibar' + title);\n if(theWikibar){\n if(theWikibar.hasChildNodes()){\n theWikibar.style.display = (theWikibar.style.display=='block'? 'none':'block');\n return;\n }\n }\n var tiddlerWrapper = document.getElementById('tiddler'+title);\n var theTextarea = wikibar_resolveTiddlerEditor(tiddlerWrapper);\n if(!theTextarea){\n clearMessage();\n displayMessage('WikiBar only works in tiddler edit mode now');\n return;\n }else{\n if(!theTextarea.id){ theTextarea.id = 'editor'+title; }\n if(!theTextarea.parentNode.id){ theTextarea.parentNode.id='editorWrapper'+title; }\n }\n if(theWikibar){\n theWikibar = document.getElementById('wikibar'+title);\n }else{\n var editorWrapper = wikibar_resolveTiddlerEditorWrapper(theTextarea);\n theWikibar = createTiddlyElement(tiddlerWrapper, 'div', 'wikibar'+title, 'toolbar');\n addClass(theWikibar, 'wikibar');\n var previewer = document.getElementById('previewer'+title);\n if(previewer){\n tiddlerWrapper.insertBefore(theWikibar, previewer);\n }else{\n tiddlerWrapper.insertBefore(theWikibar, editorWrapper);\n }\n }\n wikibar_createMenu(theWikibar,wikibarStore,title,theTextarea);\n if(config.options['chkWikibarSetEditorHeight'] && config.options['txtWikibarEditorRows']){\n theTextarea.rows = config.options['txtWikibarEditorRows'];\n }\n setStylesheet(\n '.wikibar{text-align:left;visibility:visible;margin:2px;padding:1px;}.previewer{overflow:auto;display:block;border:1px solid;}#colorPicker{position:absolute;display:none;z-index:10;margin:0px;padding:0px;}#colorPicker table{margin:0px;padding:0px;border:2px solid #000;border-spacing:0px;border-collapse:collapse;}#colorPicker td{margin:0px;padding:0px;border:1px solid;font-size:11px;text-align:center;cursor:auto;}#colorPicker .header{background-color:#fff;}#colorPicker .button{background-color:#fff;cursor:pointer;cursor:hand;}#colorPicker .button:hover{padding-top:3px;padding-bottom:3px;color:#fff;background-color:#136;}#colorPicker .cell{padding:4px;font-size:7px;cursor:crosshair;}#colorPicker .cell:hover{padding:10px;}.wikibarPopup{position:absolute;z-index:10;border:1px solid #014;color:#014;background-color:#cef;}.wikibarPopup table{margin:0;padding:0;border:0;border-spacing:0;border-collapse:collapse;}.wikibarPopup .button:hover{color:#eee;background-color:#014;}.wikibarPopup .disabled{color:#888;}.wikibarPopup .disabled:hover{color:#888;background-color:#cef;}.wikibarPopup tr .seperator hr{margin:0;padding:0;background-color:#cef;width:100%;border:0;border-top:1px dashed #014;}.wikibarPopup tr .icon{font-family:verdana;font-weight:bolder;}.wikibarPopup tr .marker{font-family:verdana;font-weight:bolder;}.wikibarPopup td{font-size:0.9em;padding:2px;}.wikibarPopup input{border:0;border-bottom:1px solid #014;margin:0;padding:0;font-family:arial;font-size:100%;background-color:#fff;}',\n 'WikiBarStyleSheet');\n}\nfunction wikibar_createMenu(place,toolset,title,editor){\n if(!wikibar_isValidMenuItem(toolset)){return;}\n if(!(toolset.TYPE=='MAIN_MENU' || toolset.TYPE=='MENU')){ return; }\n for(var key in toolset){\n if(key.substring(0,9)=='SEPERATOR'){\n wikibar_createMenuSeperator(place);\n continue;\n }\n if(key.substring(0,8)=='DYNAITEM'){\n var dynaTools = toolset[key](title,editor);\n if(dynaTools.TYPE && dynaTools.TYPE=='MENU'){\n wikibar_createMenuItem(place,dynaTools,null,editor,title);\n }else{\n dynaTools.TYPE = 'MENU';\n wikibar_createMenu(place, dynaTools, title, editor);\n }\n continue;\n }\n if((toolset[key].TYPE!='MENU' && toolset[key].TYPE!='MAIN_MENU') && !toolset[key].HANDLER){continue;}\n wikibar_createMenuItem(place,toolset,key,editor,title);\n }\n}\nfunction wikibar_createMenuItem(place,toolset,key,editor,title){\n if(!key){\n var tool = toolset;\n }else{\n tool = toolset[key];\n tool.key = key;\n }\n if(!wikibar_isValidMenuItem(tool)){return;}\n var toolIsOnMainMenu = (toolset.TYPE=='MAIN_MENU');\n var toolIsMenu = (tool.TYPE=='MENU');\n var theButton;\n if(toolIsOnMainMenu){\n theButton = createTiddlyButton(\n place,\n '',\n (tool.TOOLTIP? tool.TOOLTIP : ''),\n (toolIsMenu? wikibar_onClickMenuItem : wikibar_onClickItem),\n 'button');\n theButton.innerHTML = (tool.CAPTION? tool.CAPTION : key);\n theButton.isOnMainMenu = true;\n addClass(theButton, (toolIsMenu? 'menu' : 'item'));\n place.appendChild( document.createTextNode('\sn') );\n if(!toolIsMenu){\n if(config.options['chkWikibarPopmenuOnMouseOver']){\n theButton.onmouseover = function(e){ wikibarPopup.remove(); };\n }\n }\n }else{\n theButton=createTiddlyElement(place, 'tr',key,'button');\n theButton.title = (tool.TOOLTIP? tool.TOOLTIP : '');\n theButton.onclick = (toolIsMenu? wikibar_onClickMenuItem : wikibar_onClickItem);\n var tdL = createTiddlyElement(theButton, 'td','','marker');\n var td = createTiddlyElement(theButton, 'td');\n var tdR = createTiddlyElement(theButton, 'td','','marker');\n td.innerHTML = (tool.CAPTION? tool.CAPTION : key);\n if(toolIsMenu){\n tdR.innerHTML='&nbsp;&nbsp;&rsaquo;';\n }\n if(tool.SELECTED){\n tdL.innerHTML = '&radic; ';\n addClass(theButton, 'selected');\n }\n if(tool.DISABLED){\n addClass(theButton, 'disabled');\n }\n }\n theButton.tiddlerTitle = title;\n theButton.toolItem = tool;\n theButton.editor = editor;\n theButton.tabIndex = 999;\n if(toolIsMenu){\n if(config.options['chkWikibarPopmenuOnMouseOver']){\n theButton.onmouseover = wikibar_onClickMenuItem;\n }\n }\n}\nfunction wikibar_createMenuSeperator(place){\n if(place.id.substring(0,7)=='wikibar') { return; }\n var onclickSeperator=function(e){\n if(!e){ e = window.event; }\n e.cancelBubble = true;\n if (e.stopPropagation){ e.stopPropagation(); }\n return(false);\n };\n var theButton=createTiddlyElement(place,'tr','','seperator');\n var td = createTiddlyElement(theButton, 'td','','seperator');\n td.colSpan=3;\n theButton.onclick=onclickSeperator;\n td.innerHTML = '<hr>';\n}\nfunction wikibar_genWikibarAbout(){\n var toolset={};\n toolset.version = {\n CAPTION: '<center>WikiBar ' +\n config.macros.wikibar.major + '.' +\n config.macros.wikibar.minor + '.' +\n config.macros.wikibar.revision +\n (config.macros.wikibar.beta? ' beta '+config.macros.wikibar.beta : '') +\n '</center>',\n HANDLER: function(){}\n };\n toolset.SEPERATOR = {};\n toolset.author = {\n CAPTION: '<center>Arphen Lin<br>arphenlin@gmail.com</center>',\n TOOLTIP: 'send mail to the author',\n HANDLER: function(){ window.open('mailto:arphenlin@gmail.com'); }\n };\n toolset.website = {\n CAPTION: '<center>aiddlywiki.sourceforge.net</center>',\n TOOLTIP: 'go to the web site of WikiBar',\n HANDLER: function(){ window.open('http:\s/\s/aiddlywiki.sourceforge.net/'); }\n };\n return toolset;\n}\nfunction wikibar_genWikibarOptions(title, editor){\n var toolset={};\n toolset.popOnMouseOver = {\n CAPTION:'popup menu on mouse over',\n SELECTED: config.options['chkWikibarPopmenuOnMouseOver'],\n HANDLER: function(param){\n config.options['chkWikibarPopmenuOnMouseOver'] = !config.options['chkWikibarPopmenuOnMouseOver'];\n saveOptionCookie('chkWikibarPopmenuOnMouseOver');\n var title = param.button.tiddlerTitle;\n var wikibar = document.getElementById('wikibar'+title);\n if(wikibar){ wikibar.parentNode.removeChild(wikibar); }\n wikibar_createWikibar(title);\n }\n };\n toolset.setEditorSize = {\n CAPTION:'set editor height: <input id=\s"txtWikibarEditorRows\s" type=text size=1 MAXLENGTH=3 value=\s"' +\n (config.options['txtWikibarEditorRows']? config.options['txtWikibarEditorRows']:editor.rows) + '\s"> ok',\n HANDLER: function(param){\n var input = document.getElementById('txtWikibarEditorRows');\n if(input){\n var rows = parseInt(input.value, 10);\n if(!isNaN(rows)){\n var editor = param.button.editor;\n editor.rows = rows;\n }else{\n rows=config.maxEditRows;\n }\n config.options['txtWikibarEditorRows'] = rows;\n saveOptionCookie('txtWikibarEditorRows');\n config.maxEditRows = rows;\n }\n }\n };\n toolset.setEditorSizeOnLoadingWikibar = {\n CAPTION:'set editor height on loading wikibar',\n SELECTED: config.options['chkWikibarSetEditorHeight'],\n HANDLER: function(param){\n config.options['chkWikibarSetEditorHeight'] = !config.options['chkWikibarSetEditorHeight'];\n saveOptionCookie('chkWikibarSetEditorHeight');\n if(config.options['chkWikibarSetEditorHeight']){\n var rows = config.options['txtWikibarEditorRows'];\n if(!isNaN(rows)){ rows = 15; }\n var editor = param.button.editor;\n editor.rows = rows;\n config.options['txtWikibarEditorRows'] = rows;\n saveOptionCookie('txtWikibarEditorRows');\n }\n }\n };\n toolset.SEPERATOR = {};\n toolset.update = {\n CAPTION: 'check for updates',\n DISABLED: true,\n HANDLER: function(){}\n };\n return toolset;\n}\nfunction wikibar_genPaletteSelector(){\n try{\n var cpTiddlers = store.getTaggedTiddlers('ColorPalettes');\n if(!cpTiddlers) { return; }\n var palettes=[];\n palettes.push(wikibarColorTool.defaultPaletteName);\n for(var i=0; i<cpTiddlers.length; i++){\n palettes.push(cpTiddlers[i].title.trim());\n }\n var toolset={};\n for(i=0; i<palettes.length; i++){\n toolset[palettes[i]] = {\n TOOLTIP: palettes[i],\n SELECTED: (palettes[i]==wikibarColorTool.paletteName),\n HANDLER: wikibar_doSelectPalette\n };\n }\n return toolset;\n }catch(ex){ return null; }\n}\nfunction wikibar_onClickItem(e){\n if(!e){ e = window.event; }\n var theTarget = resolveTarget(e);\n if(theTarget.tagName=='INPUT'){\n e.cancelBubble = true;\n if (e.stopPropagation){ e.stopPropagation(); }\n return;\n }\n var theButton = wikibar_resolveTargetButton(theTarget);\n if(!theButton){ return(false); }\n var o = theButton.toolItem;\n if(!o) { return; }\n var param = {\n event: e,\n button: theButton\n };\n if(o.HANDLER){ o.HANDLER(param); }\n if(o.DISABLED){\n e.cancelBubble = true;\n if (e.stopPropagation){ e.stopPropagation(); }\n }\n return(false);\n}\nfunction wikibar_onClickMenuItem(e){\n if(!e){ e = window.event; }\n var theButton = wikibar_resolveTargetButton(resolveTarget(e));\n if(!theButton){ return(false); }\n e.cancelBubble = true;\n if (e.stopPropagation){ e.stopPropagation(); }\n var title = theButton.tiddlerTitle;\n var editor = theButton.editor;\n var tool = theButton.toolItem;\n if(!tool) { return; }\n var popup = wikibarPopup.create(this);\n if(popup){\n wikibar_createMenu(popup,tool,title,editor);\n if(!popup.hasChildNodes()){\n wikibarPopup.remove();\n }else{\n wikibarPopup.show(popup, false);\n }\n }\n return(false);\n}\nvar wikibarColorTool = {\n defaultPaletteName : 'default',\n defaultColumns : 16,\n defaultPalette : [\n '#FFF','#DDD','#CCC','#BBB','#AAA','#999','#666','#333','#111','#000','#FC0','#F90','#F60','#F30','#C30','#C03',\n '#9C0','#9D0','#9E0','#E90','#D90','#C90','#FC3','#FC6','#F96','#F63','#600','#900','#C00','#F00','#F36','#F03',\n '#CF0','#CF3','#330','#660','#990','#CC0','#FF0','#C93','#C63','#300','#933','#C33','#F33','#C36','#F69','#F06',\n '#9F0','#CF6','#9C3','#663','#993','#CC3','#FF3','#960','#930','#633','#C66','#F66','#903','#C39','#F6C','#F09',\n '#6F0','#9F6','#6C3','#690','#996','#CC6','#FF6','#963','#630','#966','#F99','#F39','#C06','#906','#F3C','#F0C',\n '#3F0','#6F3','#390','#6C0','#9F3','#CC9','#FF9','#C96','#C60','#C99','#F9C','#C69','#936','#603','#C09','#303',\n '#0C0','#3C0','#360','#693','#9C6','#CF9','#FFC','#FC9','#F93','#FCC','#C9C','#969','#939','#909','#636','#606',\n '#060','#3C3','#6C6','#0F0','#3F3','#6F6','#9F9','#CFC','#9CF','#FCF','#F9F','#F6F','#F3F','#F0F','#C6C','#C3C',\n '#030','#363','#090','#393','#696','#9C9','#CFF','#39F','#69C','#CCF','#C9F','#96C','#639','#306','#90C','#C0C',\n '#0F3','#0C3','#063','#396','#6C9','#9FC','#9CC','#06C','#369','#99F','#99C','#93F','#60C','#609','#C3F','#C0F',\n '#0F6','#3F6','#093','#0C6','#3F9','#9FF','#699','#036','#039','#66F','#66C','#669','#309','#93C','#C6F','#90F',\n '#0F9','#6F9','#3C6','#096','#6FF','#6CC','#366','#069','#36C','#33F','#33C','#339','#336','#63C','#96F','#60F',\n '#0FC','#6FC','#3C9','#3FF','#3CC','#399','#033','#39C','#69F','#00F','#00C','#009','#006','#003','#63F','#30F',\n '#0C9','#3FC','#0FF','#0CC','#099','#066','#3CF','#6CF','#09C','#36F','#0CF','#09F','#06F','#03F','#03C','#30C'\n ],\n colorPicker : null,\n pickColorHandler: null,\n userData: null\n};\nwikibarColorTool.paletteName = wikibarColorTool.defaultPaletteName;\nwikibarColorTool.columns = wikibarColorTool.defaultColumns;\nwikibarColorTool.palette = wikibarColorTool.defaultPalette;\nwikibarColorTool.onPickColor = function(e){\n if (!e){ e = window.event; }\n var theCell = resolveTarget(e);\n if(!theCell){ return(false); }\n color = theCell.bgColor.toLowerCase();\n if(!color) { return; }\n wikibarColorTool.displayColorPicker(false);\n if(wikibarColorTool.pickColorHandler){\n wikibarColorTool.pickColorHandler(color, wikibarColorTool.userData);\n }\n return(false);\n};\nwikibarColorTool.onMouseOver = function(e){\n if (!e){ e = window.event; }\n var theButton = resolveTarget(e);\n if(!theButton){ return(false); }\n if(!wikibarColorTool) { return; }\n color = theButton.bgColor.toUpperCase();\n if(!color) { return; }\n td=document.getElementById('colorPickerInfo');\n if(!td) { return; }\n td.bgColor = color;\n td.innerHTML = '<span style=\s"color:#000;\s">'+color+'</span>&nbsp;&nbsp;&nbsp;' +\n '<span style=\s"color:#fff;\s">'+color+'</span>';\n e.cancelBubble = true;\n if (e.stopPropagation){ e.stopPropagation(); }\n return(false);\n};\nwikibarColorTool.openColorPicker = function(theTarget, pickColorHandler, userData){\n wikibarColorTool.skipClickDocumentEvent = true;\n wikibarColorTool.pickColorHandler = pickColorHandler;\n wikibarColorTool.userData = userData;\n wikibarColorTool.moveColorPicker(theTarget);\n};\nwikibarColorTool.convert3to6HexColor = function(c){\n c=c.trim();\n var rx=/^\s#(\sd|[a-f])(\sd|[a-f])(\sd|[a-f])$/gi;\n return (rx.test(c)? c.replace(rx, '#$1$1$2$2$3$3') : c);\n};\nwikibarColorTool.numToHexColor = function (n){\n if(typeof(n)=='number' && (n>=0 && n<=255)) {\n s = n.toString(16).toLowerCase();\n return ((s.length==1)? '0'+s : s);\n }else{\n return null;\n }\n};\nwikibarColorTool.renderColorPalette = function(){\n if(wikibarColorTool.paletteName==wikibarColorTool.defaultPaletteName){\n wikibarColorTool.palette=wikibarColorTool.defaultPalette;\n wikibarColorTool.columns=wikibarColorTool.defaultColumns;\n return;\n }\n tiddlerText = (store.getTiddlerText(wikibarColorTool.paletteName, '')).trim();\n if(tiddlerText.length<=0) { return; }\n var cpContents = tiddlerText.split('\sn');\n var colors=[];\n columns = wikibarColorTool.defaultColumns;\n var tmpArray=null;\n errCount=0;\n for(var i=0; i<cpContents.length; i++){\n cpLine=cpContents[i].trim();\n if( (!cpLine) || (cpLine.length<=0) || (cpLine.charAt(0) == '#') ){ continue; }\n if(cpLine.substring(0,8).toLowerCase()=='columns:'){\n tmpArray = cpLine.split(':');\n try{\n columns = parseInt(tmpArray[1],10);\n }catch(ex){\n columns = wikibarColorTool.defaultColumns;\n }\n }else{\n tmpArray = cpLine.replace('\st', ' ').split(/[ ]{1,}/);\n try{\n color='';\n for(var j=0; j<3; j++){\n c=parseInt(tmpArray[j].trim(), 10);\n if(isNaN(c)){\n break;\n }else{\n c=wikibarColorTool.numToHexColor(c);\n if(!c) {break;}\n color+=c;\n }\n }\n if(color.length==6){\n colors.push('#'+color);\n } else {\n throw 'error';\n }\n }catch(ex){\n }\n }\n }\n if(colors.length>0){\n wikibarColorTool.palette = colors;\n wikibarColorTool.columns = columns;\n }else{\n throw 'renderColorPalette(): No color defined in the palette.';\n }\n};\nwikibarColorTool.displayColorPicker = function(visible){\n if(wikibarColorTool.colorPicker){\n wikibarColorTool.colorPicker.style.display = (visible? 'block' : 'none');\n }\n};\nwikibarColorTool.moveColorPicker = function(theTarget){\n if(!wikibarColorTool.colorPicker){\n wikibarColorTool.createColorPicker();\n }\n var cp = wikibarColorTool.colorPicker;\n var rootLeft = findPosX(theTarget);\n var rootTop = findPosY(theTarget);\n var popupLeft = rootLeft;\n var popupTop = rootTop;\n var popupWidth = cp.offsetWidth;\n var winWidth = findWindowWidth();\n if(popupLeft + popupWidth > winWidth){\n popupLeft = winWidth - popupWidth;\n }\n cp.style.left = popupLeft + 'px';\n cp.style.top = popupTop + 'px';\n wikibarColorTool.displayColorPicker(true);\n};\nwikibarColorTool.createColorPicker = function(unused, palette){\n if(palette){ wikibarColorTool.paletteName=palette; }\n wikibarColorTool.renderColorPalette();\n wikibarColorTool.colorPicker = document.createElement('div');\n wikibarColorTool.colorPicker.id = 'colorPicker';\n document.body.appendChild(wikibarColorTool.colorPicker);\n var theTable = document.createElement('table');\n wikibarColorTool.colorPicker.appendChild(theTable);\n var theTR = document.createElement('tr');\n theTable.appendChild(theTR);\n var theTD = document.createElement('td');\n theTD.className = 'header';\n theTD.colSpan = wikibarColorTool.columns;\n theTD.innerHTML = wikibarColorTool.paletteName;\n theTR.appendChild(theTD);\n for(var i=0; i<wikibarColorTool.palette.length; i++){\n if((i%wikibarColorTool.columns)===0){\n theTR = document.createElement('tr');\n theTable.appendChild(theTR);\n }\n theTD = document.createElement('td');\n theTD.className = 'cell';\n theTD.bgColor = wikibarColorTool.convert3to6HexColor(wikibarColorTool.palette[i]);\n theTD.onclick = wikibarColorTool.onPickColor;\n theTD.onmouseover = wikibarColorTool.onMouseOver;\n theTR.appendChild(theTD);\n }\n rest = wikibarColorTool.palette.length % wikibarColorTool.columns;\n if(rest>0){\n theTD = document.createElement('td');\n theTD.colSpan = wikibarColorTool.columns-rest;\n theTD.bgColor = '#000000';\n theTR.appendChild(theTD);\n }\n theTR = document.createElement('tr');\n theTable.appendChild(theTR);\n theTD = document.createElement('td');\n theTD.colSpan = wikibarColorTool.columns;\n theTD.id = 'colorPickerInfo';\n theTR.appendChild(theTD);\n};\nwikibarColorTool.onDocumentClick = function(e){\n if (!e){ e = window.event; }\n if(wikibarColorTool.skipClickDocumentEvent) {\n wikibarColorTool.skipClickDocumentEvent = false;\n return true;\n }\n if((!e.eventPhase) || e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET){\n wikibarColorTool.displayColorPicker(false);\n }\n return true;\n};\nfunction wikibar_doSelectPalette(param){\n clearMessage();\n var theButton = param.button;\n if(!theButton.toolItem.key) { return; }\n var palette = theButton.toolItem.key;\n var oldPaletteName = wikibarColorTool.paletteName;\n if(oldPaletteName != palette){\n try{\n wikibarColorTool.createColorPicker(theButton, palette);\n displayMessage('Palette \s"'+palette+'\s" ('+ wikibarColorTool.palette.length +' colors) is selected');\n }catch(ex){\n errMsg = ex;\n if(errMsg.substring(0,18)=='renderColorPalette'){\n displayMessage('Invalid palette \s"' + palette + '\s", please check it out!');\n wikibarColorTool.createColorPicker(theButton, oldPaletteName);\n }\n }\n }\n}\nvar wikibarPopup = {\n skipClickDocumentEvent: false,\n stack: []\n};\nwikibarPopup.resolveRootPopup = function(o){\n if(o.isOnMainMenu){ return null; }\n if(o.className.substring(0,12)=='wikibarPopup'){ return o;}\n return wikibarPopup.resolveRootPopup(o.parentNode);\n};\nwikibarPopup.create = function(root){\n for(var i=0; i<wikibarPopup.stack.length; i++){\n var p=wikibarPopup.stack[i];\n if(p.root==root){\n wikibarPopup.removeFrom(i+1);\n return null;\n }\n }\n var rootPopup = wikibarPopup.resolveRootPopup(root);\n if(!rootPopup){\n wikibarPopup.remove();\n }else{\n wikibarPopup.removeFromRootPopup(rootPopup);\n }\n var popup = createTiddlyElement(document.body,'div','wikibarPopup'+root.toolItem.key,'wikibarPopup');\n var pop = createTiddlyElement(popup,'table','','');\n wikibarPopup.stack.push({rootPopup: rootPopup, root: root, popup: popup});\n return pop;\n};\nwikibarPopup.show = function(unused,slowly){\n var curr = wikibarPopup.stack[wikibarPopup.stack.length-1];\n var overlayWidth = 1;\n var rootLeft, rootTop, rootWidth, rootHeight, popupLeft, popupTop, popupWidth;\n if(curr.rootPopup){\n rootLeft = findPosX(curr.rootPopup);\n rootTop = findPosY(curr.root);\n rootWidth = curr.rootPopup.offsetWidth;\n popupLeft = rootLeft + rootWidth - overlayWidth;\n popupTop = rootTop;\n }else{\n rootLeft = findPosX(curr.root);\n rootTop = findPosY(curr.root);\n rootHeight = curr.root.offsetHeight;\n popupLeft = rootLeft;\n popupTop = rootTop + rootHeight;\n }\n var winWidth = findWindowWidth();\n popupWidth = curr.popup.offsetWidth;\n if(popupLeft + popupWidth > winWidth){\n popupLeft = rootLeft - popupWidth + overlayWidth;\n }\n curr.popup.style.left = popupLeft + 'px';\n curr.popup.style.top = popupTop + 'px';\n curr.popup.style.display = 'block';\n addClass(curr.root, 'highlight');\n if(config.options.chkAnimate){\n anim.startAnimating(new Scroller(curr.popup,slowly));\n }else{\n window.scrollTo(0,ensureVisible(curr.popup));\n }\n};\nwikibarPopup.remove = function(){\n if(wikibarPopup.stack.length > 0){\n wikibarPopup.removeFrom(0);\n }\n};\nwikibarPopup.removeFrom = function(from){\n for(var t=wikibarPopup.stack.length-1; t>=from; t--){\n var p = wikibarPopup.stack[t];\n removeClass(p.root,'highlight');\n p.popup.parentNode.removeChild(p.popup);\n }\n wikibarPopup.stack = wikibarPopup.stack.slice(0,from);\n};\nwikibarPopup.removeFromRootPopup = function(from){\n for(var t=0; t<wikibarPopup.stack.length; t++){\n var p = wikibarPopup.stack[t];\n if(p.rootPopup==from){\n wikibarPopup.removeFrom(t);\n break;\n }\n }\n};\nwikibarPopup.onDocumentClick = function(e){\n if (!e){ e = window.event; }\n if(wikibarPopup.skipClickDocumentEvent){\n wikibarPopup.skipClickDocumentEvent=false;\n return true;\n }\n if((!e.eventPhase) || e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET){\n wikibarPopup.remove();\n }\n return true;\n};\nvar wikibarStore = {\n TYPE: 'MAIN_MENU',\n help:{\n TYPE:'MENU',\n CAPTION: '<font face=\s"verdana\s">?</font>',\n TOOLTIP: 'about WikiBar',\n options:{\n TYPE:'MENU',\n DYNAITEM: wikibar_genWikibarOptions\n },\n about:{\n TYPE:'MENU',\n DYNAITEM: wikibar_genWikibarAbout\n }\n },\n preview:{\n TOOLTIP: 'preview this tiddler',\n CAPTION: '<font face=\s"verdana\s">&infin;</font>',\n HANDLER: wikibar_doPreview\n },\n line:{\n TOOLTIP: 'horizontal line',\n CAPTION: '<font face=\s"verdana\s">&mdash;</font>',\n syntax: '\sn----\sn',\n HANDLER: wikibar_editFormatByCursor\n },\n crlf:{\n TOOLTIP: 'new line',\n CAPTION: '<font face=\s"verdana\s">&para;</font>',\n syntax: '\sn',\n HANDLER: wikibar_editFormatByCursor\n },\n selectAll:{\n TOOLTIP: 'select all',\n CAPTION: '<font face=\s"verdana\s">&sect;</font>',\n HANDLER: wikibar_editSelectAll\n },\n deleteSelected:{\n TOOLTIP: 'delete selected',\n CAPTION: '<font face=\s"verdana\s">&times;</font>',\n syntax: '',\n HANDLER: wikibar_editFormat\n },\n textFormat:{\n TYPE: 'MENU',\n CAPTION: 'text',\n TOOLTIP: 'text formatters',\n ignore:{\n TOOLTIP: 'ignore wiki word',\n CAPTION: 'ignore wikiWord',\n syntax: '~user_text',\n hint: 'wiki_word',\n HANDLER: wikibar_editFormatByWord\n },\n bolder:{\n TOOLTIP: 'bolder text',\n CAPTION: '<strong>bolder</strong>',\n syntax: "''user_text''",\n hint: 'bold_text',\n HANDLER: wikibar_editFormatByWord\n },\n italic:{\n TOOLTIP: 'italic text',\n CAPTION: '<em>italic</em>',\n syntax: '\s/\s/user_text\s/\s/',\n hint: 'italic_text',\n HANDLER: wikibar_editFormatByWord\n },\n underline:{\n TOOLTIP: 'underline text',\n CAPTION: '<u>underline</u>',\n syntax: '__user_text__',\n hint: 'underline_text',\n HANDLER: wikibar_editFormatByWord\n },\n strikethrough:{\n TOOLTIP: 'strikethrough text',\n CAPTION: '<strike>strikethrough</strike>',\n syntax: '==user_text==',\n hint: 'strikethrough_text',\n HANDLER: wikibar_editFormatByWord\n },\n superscript:{\n TOOLTIP: 'superscript text',\n CAPTION: 'X<sup>superscript</sup>',\n syntax: '^^user_text^^',\n hint: 'superscript_text',\n HANDLER: wikibar_editFormatByWord\n },\n subscript:{\n TOOLTIP: 'subscript text',\n CAPTION: 'X<sub>subscript</sub>',\n syntax: '~~user_text~~',\n hint: 'subscript_text',\n HANDLER: wikibar_editFormatByWord\n },\n comment:{\n TOOLTIP: 'comment text',\n CAPTION: 'comment text',\n syntax: '/%user_text%/',\n hint: 'comment_text',\n HANDLER: wikibar_editFormatByWord\n },\n monospaced:{\n TOOLTIP: 'monospaced text',\n CAPTION: '<code>monospaced</code>',\n syntax: '{{{user_text}}}',\n hint: 'monospaced_text',\n HANDLER: wikibar_editFormatByWord\n }\n },\n paragraph:{\n TYPE: 'MENU',\n TOOLTIP: 'paragarph formatters',\n list:{\n TYPE: 'MENU',\n TOOLTIP: 'list tools',\n bullet:{\n TOOLTIP: 'bullet point',\n syntax: '*user_text',\n hint: 'bullet_text',\n HANDLER: wikibar_editFormatByLine\n },\n numbered:{\n TOOLTIP: 'numbered list',\n syntax: '#user_text',\n hint: 'numbered_text',\n HANDLER: wikibar_editFormatByLine\n }\n },\n heading:{\n TYPE: 'MENU',\n heading1:{\n CAPTION:'<h1>Heading 1</h1>',\n TOOLTIP: 'Heading 1',\n syntax: '!user_text',\n hint: 'heading_1',\n HANDLER: wikibar_editFormatByLine\n },\n heading2:{\n CAPTION:'<h2>Heading 2<h2>',\n TOOLTIP: 'Heading 2',\n syntax: '!!user_text',\n hint: 'heading_2',\n HANDLER: wikibar_editFormatByLine\n },\n heading3:{\n CAPTION:'<h3>Heading 3</h3>',\n TOOLTIP: 'Heading 3',\n syntax: '!!!user_text',\n hint: 'heading_3',\n HANDLER: wikibar_editFormatByLine\n },\n heading4:{\n CAPTION:'<h4>Heading 4</h4>',\n TOOLTIP: 'Heading 4',\n syntax: '!!!!user_text',\n hint: 'heading_4',\n HANDLER: wikibar_editFormatByLine\n },\n heading5:{\n CAPTION:'<h5>Heading 5</h5>',\n TOOLTIP: 'Heading 5',\n syntax: '!!!!!user_text',\n hint: 'heading_5',\n HANDLER: wikibar_editFormatByLine\n }\n },\n comment:{\n TYPE: 'MENU',\n commentByLine:{\n CAPTION:'comment by line',\n TOOLTIP: 'line comment',\n syntax: '/%user_text%/',\n hint: 'comment_text',\n HANDLER: wikibar_editFormatByLine\n },\n commentByBlock:{\n CAPTION:'comment by block',\n TOOLTIP: 'block comment',\n syntax: '/%\snuser_text\sn%/',\n hint: 'comment_text',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n }\n },\n monospaced:{\n TYPE: 'MENU',\n monosByLine:{\n CAPTION: 'monospaced by line',\n TOOLTIP: 'line monospaced',\n syntax: '{{{\snuser_text\sn}}}',\n hint: 'monospaced_text',\n HANDLER: wikibar_editFormatByLine\n },\n monosByBlock:{\n CAPTION: 'monospaced by block',\n TOOLTIP: 'block monospaced',\n syntax: '{{{\snuser_text\sn}}}',\n hint: 'monospaced_text',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n }\n },\n quote:{\n TYPE: 'MENU',\n quoteByLine:{\n CAPTION: 'quote by line',\n TOOLTIP: 'line quote',\n syntax: '>user_text',\n hint: 'quote_text',\n HANDLER: wikibar_editFormatByLine\n },\n quoteByBlcok:{\n CAPTION: 'quote by block',\n TOOLTIP: 'block quote',\n syntax: '<<<\snuser_text\sn<<<',\n hint: 'quote_text',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n }\n },\n plugin:{\n TYPE: 'MENU',\n code:{\n CAPTION: 'code area',\n TOOLTIP: 'block monospaced for plugin',\n syntax: '\sn\s/\s/{{{\snuser_text\sn\s/\s/}}}\sn',\n hint: 'monospaced_plugin_code',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n },\n commentByLine:{\n CAPTION: 'comment by line',\n TOOLTIP: 'line comment',\n syntax: '\s/\s/user_text',\n hint: 'plugin_comment',\n HANDLER: wikibar_editFormatByLine\n },\n commentByBlock:{\n CAPTION: 'comment by block',\n TOOLTIP: 'block comment',\n syntax: '\s/\s***\snuser_text\sn***\s/',\n hint: 'plugin_comment',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n }\n },\n css:{\n TYPE: 'MENU',\n code:{\n CAPTION: 'code area',\n TOOLTIP: 'block monospaced for css',\n syntax: '\sn\snuser_text\sn\sn',\n hint: 'monospaced_css_code',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n },\n commentByLine:{\n CAPTION: 'comment by line',\n TOOLTIP: 'line comment',\n syntax: '',\n hint: 'css_comment',\n HANDLER: wikibar_editFormatByLine\n },\n commentByBlock:{\n CAPTION: 'comment by block',\n TOOLTIP: 'block comment',\n syntax: '',\n hint: 'css_comment',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n }\n }\n },\n color:{\n TYPE: 'MENU',\n TOOLTIP: 'color tools',\n highlight:{\n CAPTION:'highlight text',\n TOOLTIP: 'highlight text',\n syntax: '@@user_text@@',\n hint: 'highlight_text',\n HANDLER: wikibar_editFormatByWord\n },\n color:{\n CAPTION:'text color',\n TOOLTIP: 'text color',\n hint: 'your_text',\n syntax: '@@color(%1):user_text@@',\n HANDLER: wikibar_getColorCode,\n doMore: wikibar_editFormatByWord\n },\n bgcolor:{\n CAPTION:'background color',\n TOOLTIP: 'background color',\n hint: 'your_text',\n syntax: '@@bgcolor(%1):user_text@@',\n HANDLER: wikibar_getColorCode,\n doMore: wikibar_editFormatByWord\n },\n colorcode:{\n CAPTION:'color code',\n TOOLTIP: 'insert color code',\n syntax: '%1',\n HANDLER: wikibar_getColorCode,\n doMore: wikibar_editFormatByCursor\n },\n 'color palette':{\n TYPE:'MENU',\n DYNAITEM: wikibar_genPaletteSelector,\n SEPERATOR:{},\n morePalette:{\n CAPTION:'more palettes',\n TOOLTIP:'get more palettes',\n HANDLER: wikibar_getMorePalette\n }\n }\n },\n link:{\n TYPE: 'MENU',\n TOOLTIP: 'insert link',\n wiki:{\n CAPTION:'wiki link',\n TOOLTIP: 'wiki link',\n syntax: '[[user_text]]',\n hint: 'wiki_word',\n HANDLER: wikibar_editFormatByWord\n },\n pretty:{\n CAPTION: 'pretty link',\n TOOLTIP: 'pretty link',\n syntax: '[[user_text|%1]]',\n hint: 'pretty_word',\n param: 'PrettyLink Target',\n HANDLER: wikibar_getLinkUrl,\n doMore: wikibar_editFormatByWord\n },\n url:{\n TOOLTIP: 'url link',\n syntax: '[[user_text|%1]]',\n hint: 'your_text',\n param: 'http:\s/\s/...',\n HANDLER: wikibar_getLinkUrl,\n doMore: wikibar_editFormatByWord\n },\n image:{\n TOOLTIP: 'image link',\n syntax: '[img[user_text|%1]]',\n hint: 'alt_text',\n param: 'image/icon.jpg',\n HANDLER: wikibar_getLinkUrl,\n doMore: wikibar_editFormatByWord\n }\n },\n macro:{},\n more:{\n TYPE: 'MENU',\n TOOLTIP: 'more tools',\n table:{\n TYPE: 'MENU',\n TOOLTIP: 'table',\n table:{\n CAPTION:'create table',\n TOOLTIP: 'create a new table',\n syntax: '\sn%1\sn',\n HANDLER: wikibar_getTableRowCol,\n doMore: wikibar_editFormatByWord\n },\n header:{\n TOOLTIP: 'table header text',\n syntax: '|user_text|c',\n hint: 'table_header',\n HANDLER: wikibar_editFormatByWord\n },\n cell:{\n TOOLTIP: 'create a tabel cell',\n syntax: '|user_text|',\n hint: 'your_text',\n HANDLER: wikibar_editFormatByWord\n },\n columnHeader:{\n CAPTION:'column header',\n TOOLTIP: 'create a column header cell',\n syntax: '|!user_text|',\n hint: 'column_header',\n HANDLER: wikibar_editFormatByWord\n },\n cell:{\n TYPE: 'MENU',\n CAPTION: 'cell options',\n bgcolor:{\n CAPTION: 'background color',\n TOOLTIP: 'cell bgcolor',\n syntax: '|bgcolor(%1):user_text|',\n hint: 'your_text',\n HANDLER: wikibar_getColorCode,\n doMore: wikibar_editFormatByTableCell\n },\n alignLeft:{\n CAPTION: 'align left',\n TOOLTIP: 'left align cell text',\n syntax: '|user_text|',\n hint: 'your_text',\n HANDLER: wikibar_editFormatByTableCell\n },\n alignCenter:{\n CAPTION: 'align center',\n TOOLTIP: 'center align cell text',\n syntax: '| user_text |',\n hint: 'your_text',\n HANDLER: wikibar_editFormatByTableCell\n },\n alignRight:{\n CAPTION: 'align right',\n TOOLTIP: 'right align cell text',\n syntax: '| user_text|',\n hint: 'your_text',\n HANDLER: wikibar_editFormatByTableCell\n }\n }\n },\n html:{\n TYPE: 'MENU',\n html:{\n CAPTION: '&lt;html&gt;',\n TOOLTIP: 'html tag',\n syntax: '<html>\snuser_text\sn</html>',\n hint: 'html_content',\n byBlock: true,\n HANDLER: wikibar_editFormatByLine\n }\n }\n },\n addon:{\n TYPE: 'MENU',\n TOOLTIP:'3rd party tools',\n 'about addons':{\n TOOLTIP: 'list loaded addons',\n HANDLER: wikibar_doListAddons\n },\n SEPERATOR:{}\n }\n};\naddEvent(document, 'click', wikibarColorTool.onDocumentClick);\naddEvent(document, 'click', wikibarPopup.onDocumentClick);\nwikibar_install();\n//}}}
/***\n!WikiBar CSS 說明\n*井號開頭表示 id, ex: #colorPicker\n*點號開頭表示 class, ex: .wikibar\n\n!WikiBar Colors Used\n*@@bgcolor(#014):color(#fff): #014 - 選單邊框@@\n*@@bgcolor(#014):color(#fff): #014 - 選單字體色@@\n*@@bgcolor(#cef): #cef - 選單底色@@\n*@@bgcolor(#eee): #eee - 選單字體色:游標滑過時@@\n*@@bgcolor(#014):color(#fff): #014 - 選單底色:游標滑過時@@\n*@@bgcolor(#888): #888 - 無效選單字體色@@\n*@@bgcolor(#cef): #cef - 無效選單底色:游標滑過時@@\n*@@bgcolor(#014):color(#fff): #014 - 分隔線顏色@@\n\n!wikibar: 工具列, 繼承 .toolbar /%==============================================%/\n***/\n/*{{{*/\n.wikibar {\n text-align: left;\n visibility: visible;\n margin:2px; padding:1px;\n}\n/*}}}*/\n\n/***\n!previewer: 預覽區, 繼承 .viewer /%==============================================%/\n***/\n/*{{{*/\n.previewer {overflow:auto; display:block; border:1px solid;}\n/*}}}*/\n\n/***\n!colorPicker 調色盤 /%==============================================%/\n***/\n/*{{{*/\n#colorPicker {position:absolute; display:none; z-index:10; margin:0px; padding:0px; }\n#colorPicker table {\n margin:0px; padding:0px;\n border:2px solid #000;\n border-spacing: 0px;\n border-collapse: collapse;\n}\n#colorPicker td {margin:0px; padding:0px; border:1px solid; font-size:11px; text-align:center; cursor:auto;}\n#colorPicker .header {background-color: #fff;}\n#colorPicker .button {background-color: #fff; cursor:pointer; cursor:hand;}\n#colorPicker .button:hover {padding-top:3px; padding-bottom:3px; color:#fff; background-color:#136;}\n#colorPicker .cell {padding:4px; font-size:7px; cursor:crosshair;}\n#colorPicker .cell:hover {padding:10px;}\n/*}}}*/\n\n/***\n!wikibarPopup 功能表選單 /%==============================================%/\n***/\n/*{{{*/\n.wikibarPopup{\n position:absolute; z-index:10;\n border: 1px solid #014;\n color: #014; background-color: #cef;\n /*\n max-height:150px;\n overflow-x:hidden; overflow-y:auto;\n */\n}\n\n/* 彈出選單 */\n.wikibarPopup table{\n margin:0; padding:0;\n border:0;\n border-spacing:0;\n border-collapse:collapse;\n}\n\n/* 選單上之按鈕 */\n.wikibarPopup .button:hover{color:#eee; background-color: #014;}\n\n/*\n.wikibarPopup .selected {background-color: #cf6;}\n*/\n\n/* 停用選項 */\n.wikibarPopup .disabled {color: #888;}\n.wikibarPopup .disabled:hover {color: #888; background-color: #cef;}\n\n/* 分隔線 */\n.wikibarPopup tr .seperator hr{\n margin:0; padding:0; background-color: #cef; width: 100%;\n border: 0;\n border-top: 1px dashed #014;\n}\n\n/* 選項左右兩邊符號區 */\n.wikibarPopup tr .icon {font-family:verdana; font-weight:bolder;}\n.wikibarPopup tr .marker {font-family:verdana; font-weight:bolder;}\n\n/* 選項 */\n.wikibarPopup td {font-size:0.9em; padding:2px;}\n\n.wikibarPopup input{\n border:0;\n border-bottom: 1px solid #014;\n margin:0; padding:0;\n font-family: arial;\n font-size:100%;\n background-color: #fff;\n}\n\n/*}}}*/
<<gradient vert #ff66cc #ffffff #ff66cc>>Steps:\n#enter tiddler edit mode\n#click ''wikibar'' button on the toolbar\n>>
/***\n|''Name:''|mySave|\n|''Version:''|1.0.0 |\n|''Source:''|AiddlyWiki|\n|''Author:''|[[Arphen Lin]] |\n|''Type:''|Plugin|\n|''Requires:''|TiddlyWiki 1.2.35 or higher |\n!Description\nSave files in my way.\n!Revision history\n*v1.0.0 2005/10/22\n**Initial release\n!Code\n***/\n//{{{\n\n\n//------------------------------------------------------------------------------------------------\n// override saveChanges()\n//------------------------------------------------------------------------------------------------\nfunction saveChanges()\n{\n clearMessage();\n // Get the URL of the document\n var originalPath = document.location.toString();\n // Check we were loaded from a file URL\n if(originalPath.substr(0,5) != "file:")\n {\n alert(config.messages.notFileUrlError);\n displayTiddler(null,"SaveChanges");\n return;\n }\n // Remove any location part of the URL\n var hashPos = originalPath.indexOf("#");\n if(hashPos != -1)\n originalPath = originalPath.substr(0,hashPos);\n // Convert to a native file format assuming\n // "file:///x:/path/path/path..." - pc local file --> "x:\spath\spath\spath..."\n // "file://///server/share/path/path/path..." - FireFox pc network file --> "\s\sserver\sshare\spath\spath\spath..."\n // "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."\n // "file://server/share/path/path/path..." - pc network file --> "\s\sserver\sshare\spath\spath\spath..."\n var localPath;\n if(originalPath.charAt(9) == ":") // pc local file\n localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\s\s");\n else if(originalPath.indexOf("file://///") == 0) // FireFox pc network file\n localPath = "\s\s\s\s" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\s\s");\n else if(originalPath.indexOf("file:///") == 0) // mac/unix local file\n localPath = unescape(originalPath.substr(7));\n else if(originalPath.indexOf("file:/") == 0) // mac/unix local file\n localPath = unescape(originalPath.substr(5));\n else // pc network file\n localPath = "\s\s\s\s" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\s\s");\n // Load the original file\n var original = loadFile(localPath);\n if(original == null)\n {\n alert(config.messages.cantSaveError);\n displayTiddler(null,"SaveChanges");\n return;\n }\n // Locate the storeArea div's\n var posOpeningDiv = original.indexOf(startSaveArea);\n var posClosingDiv = original.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1))\n {\n alert(config.messages.invalidFileError.format([localPath]));\n return;\n }\n // Save the backup\n if(config.options.chkSaveBackups)\n {\n //var backupPath = localPath.substr(0,localPath.lastIndexOf(".")) + "." + (new Date()).convertToYYYYMMDDHHMMSSMMM() + ".html";\n // arphen: 只儲存一個備份檔\n var backupPath = localPath.substr(0,localPath.lastIndexOf(".")) + ".backup.html";\n var backup = saveFile(backupPath,original);\n if(backup)\n displayMessage(config.messages.backupSaved,"file://" + backupPath);\n else\n alert(config.messages.backupFailed);\n }\n // Save Rss\n if(config.options.chkGenerateAnRssFeed)\n {\n var rssPath = localPath.substr(0,localPath.lastIndexOf(".")) + ".xml";\n var rssSave = saveFile(rssPath,convertUnicodeToUTF8(generateRss()));\n if(rssSave)\n displayMessage(config.messages.rssSaved,"file://" + rssPath);\n else\n alert(config.messages.rssFailed);\n }\n // Save empty template\n if(config.options.chkSaveEmptyTemplate)\n {\n var emptyPath,p;\n if((p = localPath.lastIndexOf("/")) != -1)\n emptyPath = localPath.substr(0,p) + "/empty.html";\n else if((p = localPath.lastIndexOf("\s\s")) != -1)\n emptyPath = localPath.substr(0,p) + "\s\sempty.html";\n else\n emptyPath = localPath + ".empty.html";\n var empty = original.substr(0,posOpeningDiv + startSaveArea.length) + convertUnicodeToUTF8(generateEmpty()) + original.substr(posClosingDiv);\n var emptySave = saveFile(emptyPath,empty);\n if(emptySave)\n displayMessage(config.messages.emptySaved,"file://" + emptyPath);\n else\n alert(config.messages.emptyFailed);\n }\n // Save new file\n var revised = original.substr(0,posOpeningDiv + startSaveArea.length) +\n convertUnicodeToUTF8(allTiddlersAsHtml()) + "\sn\st\st" +\n original.substr(posClosingDiv);\n var newSiteTitle = convertUnicodeToUTF8((wikifyPlain("SiteTitle") + " - " + wikifyPlain("SiteSubtitle")).htmlEncode());\n revised = revised.replace(new RegExp("<title>[^<]*</title>", "im"),"<title>"+ newSiteTitle +"</title>");\n var save = saveFile(localPath,revised);\n if(save)\n {\n displayMessage(config.messages.mainSaved,"file://" + localPath);\n store.setDirty(false);\n }\n else\n alert(config.messages.mainFailed);\n}\n\n//}}}