Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which use a logographic writing system and need larger font sizes.
***/

/*{{{*/
body {font-size:0.8em;}

#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}

.subtitle {font-size:0.8em;}

.viewer table.listView {font-size:0.95em;}

.htmlarea .toolbarHA table {border:1px solid ButtonFace; margin:0em 0em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see AdvancedOptions
__January - June__
*February 20 - The North Carolina General Assembly incorporates the town of Newton as Wilmington, North Carolina, named for Spencer Compton, 1st Earl of Wilmington, and patron of Royal Governor Gabriel Johnston. 
*May 31 - Friedrich II comes to power in Prussia upon the death of his father, Friedrich Wilhelm I. 

__July - December__
*August 17 - Pope Benedict XIV succeeds Pope Clement XII as the 247th pope. 
*October 9 - Dutch East India Company massacre leading of 5,000–10,000 Chinese inhabitants victims fell in Batavia.[1] 
*October 20 - Maria Theresia of Austria inherits the Habsburg hereditary dominions (Austria, Bohemia, Hungary and present-day Belgium). However, her succession to the Holy Roman Empire is contested widely because she is a woman. 
*December 16 - Friedrich II of Prussia invades the Habsburg possession of Silesia, starting the War of the Austrian Succession. 

__Undated__
*By an act of the Parliament of Great Britain, alien immigrants (including Huguenots and Jews) in the Enfield, North Carolina was founded. 
*Adam Smith enters Balliol College, Oxford. 
*George Whitefield founds the Bethesda Orphanage. 
*The song "Rule Britannia" is first performed at Cliveden. 
*Hertford College, Oxford, is founded for the first time. 
*University of Pennsylvania is founded. 
__January - June__
*April 10 - The Austrian army attacks troops of Frederick the Great at Mollwitz. 
*April - The New York Slave Insurrection of 1741, a plot to torch New York City, was discovered. 
*June 25 - Maria Theresa of Austria is crowned Queen Regnant of Hungary in Bratislava. 

__July - December__
*August 10 - Raja of Travancore defeats Dutch East India Company naval expedition at Battle of Colachel. 
*December 6 - Elizabeth of Russia becomes czarina after a palace coup. 
*December 19 - Vitus Bering dies in his expedition east of Siberia. 
*December 25 - Anders Celsius develops his own thermometer scale, Celsius, a centigrade scale. 

__Undated__
*Prague occupied by ~French-Bavarian armies. 
*William Browning invents mineral water. 
*Stemmatographia by Hristofor Zhefarovich, regarded as the first Bulgarian secular printed book, is printed in Vienna. 
__January - June__
*April 13: Handel's Messiah.January 24 - Charles VII Albert becomes Holy Roman Emperor. 
*February 16 - Spencer Compton, Earl of Wilmington, becomes Prime Minister of Great Britain. 
*February 18 - British attack La Guayra. 
*April 13 - The first performance of George Frideric Handel's oratorio The Messiah, in Dublin, Ireland. 
*May 17 - Frederick the Great's army defeats Austrians in Chotusitz; later Austria cedes Silesia to Prussia 
*May 25 - A battle is fought at Sahay. 

__July - December__
*December 2 - The Pennsylvania Journal first appears in print in the United States. 

__Undated__
*Daniel le Pelley succeeds Nicolas le Pelley as Seigneur of Sark. 
*Kingdom of Prussia captures Jihlava. 
*Christian Goldbach formulates Goldbach's conjecture. 
*Colin Maclaurin publishes his Treatise on Fluxions. 
*Anders Celsius proposes the Celsius temperature scale (see: 1741). 
*James Bradley succeeds Edmond Halley as Astronomer Royal. 
*Henry Fielding publishes Joseph Andrews. 
*John Carteret, 2nd Lord Carteret becomes Secretary of State for the Northern Department in Great Britain. 
*Rigging of Chippenham by-election causes a political scandal in Great Britain. 
*William Pulteney is created as 1st Earl of Bath in Great Britain. 
*Robert Walpole was elevated to the peerage and thus moved from the British House of Commons to the House of Lords, effectively ending his reign as Prime Minister of the United Kingdom (see February 16, above). 
*University of Erlangen is founded. 
*Lopukhina Conspiracy arises at the Russian court. 
*Molde in Norway becomes a city. 
*Construction starts on the Foundling Hospital in London. 
*Eisenach, Germany, builds its Stadtschloss (city castle). 
*In Peru, Juan Santon takes the name Atahualpa II and begins an ill-fated rebellion against the Spanish rule. 
*Afghan tribes unite as a monarchy. 
*Charles Jervas's English translation of Don Quixote is published posthumously. Through a printer's error, the translator's name is printed as Charles Jarvis, leading the book to forever be known as the Jarvis translation. It is acclaimed as the most faithful English rendering of the novel made up to that time.
__January - June__
*February 14 - Henry Pelham becomes British Prime Minister. 
*February 21 - The premiere in London of George Frideric Handel's oratorio, Samson. 
*June 16 - The Battle of Dettingen is fought in Bavaria. King George II of Great Britain leads his own troops, the last British king to do so.

__July - December__
*August 7 - Russia and Sweden sign the Treaty of Åbo. 
*September 13 - Treaty of Worms - a treaty between Great Britain, Austria and Sardinia

__Undated__
*War of the Austrian Succession (1740-1748) 
__January - June__
*February 22–February 23 - British fleet defeated by a ~Franco-Spanish fleet at the Battle of Toulon. 
*April 20 - At the Battle of Villafranca, a joint French and Spanish force defeats Britain and Sardinia. 
*June 28 - Catherine the Great is received into the Russian Orthodox Church. 

__July - December__
*July 19 - Battle of Casteldelfino, between France and the Kingdom of Sardinia. 
*September 30 - In the Battle of Madonna dell'Olmo, France and Spain defeat the Kingdom of Sardinia. 

__Undated__
*The third French and Indian War, known as "King George's War," breaks out at Port Royal, Nova Scotia. 
*The First Saudi State is founded by Mohammed Ibn Saud. 
*Prague is occupied by Prussian armies. 
__January - June__
*May 11 - War of Austrian Succession: Battle of Fontenoy - At Fontenoy, French forces defeat an ~Anglo-Dutch-Hanoverian army including the Black Watch. 
*June 4 - Frederick the Great destroys Austrian army at Hohenfriedberg. 

__July - December__
*August 19 - Beginning of the '45 Jacobite Rising at Glenfinnan. 
*September 12 - Francis I is elected Holy Roman Emperor with the support of his wife, Maria Theresia of Austria. He is the successor of Charles VII Albert of Bavaria, an enemy of Habsburg, who died on January 20 of this year. 
*September 14 - Madame de Pompadour is officially presented in the court of Louis XV of France. 
*September 21 - British Government forces are defeated at the Battle of Prestonpans. 
*December 25 - Treaty of Dresden gives Prussia full possession of Silesia. 
*December 28 - For five days, fire destroys buildings in Istanbul. 

__Ongoing events__
*War of the Austrian Succession (1740-1748). 
*The "Forty Five"/Bliadhna Theàrlaich, part of the second Jacobite Rising, mainly in Scotland. 
__January - June__
*January 8 - Bonnie Prince Charlie occupies Stirling. 
*January 17 - British Government forces suffer a defeat to Jacobite forces at the Battle of Falkirk. 
*April 16 - [[Battle of Culloden]] brings an end to the Jacobite Rising. 
*June - Samuel Johnson is contracted to write his A Dictionary of the English Language. 
*June 16 - Battle of Piacenza 
*June 29 - Catherine of Ricci (born 1522) is canonized. 

__July - December__
*August 1 - Wearing of the kilt is banned in Scotland by the Dress Act. 
*August 18 - Two of the four rebellious Scottish lords, Earl of Kilmarnock and Lord Balmeniro beheaded in the Tower (Lord Lovat executed 1747). 
*October 22 - The College of New Jersey is founded (it becomes Princeton University in 1896). 
*October 28 - An earthquake demolishes Lima and Callao, in Peru. 

__Undated__
*Town of Vilkovo (Odes'ka oblast', Ukraine) is founded. 
*Royal Colony of North Carolina Governor Gabriel Johnston moves to the province's largest and most prosperous city of New Bern. As a result, New Bern replaces Edenton as the capital of North Carolina (a title it holds until Raleigh is established in 1792).
__January - June__
*January 31 - The first venereal diseases clinic opens at London Lock Hospital. 
*February 11 - A combined French and Indian force, commanded by Coulon de Villiers, attacks British troops at Grand Pré, Nova Scotia. 
*April 9 - The Scottish Jacobite Lord Lovat was beheaded by axe on Tower Hill, London, for high treason; he was the last man to be executed in this way in Britain. 
*May 14 - War of the Austrian Succession: First battle of Cape Finisterre. 
*June 9 - Emperor Momozono ascends to the throne of Japan, succeeding Emperor Sakuramachi. 
__July - December__
*July 2 - Battle of Lauffeld is fought. 
*October 25 - War of the Austrian Succession: Second battle of Cape Finisterre. 
*November 9 - Rioters in Amsterdam demand governmental reform. 
*Kandahar: Ahmad Shah Durrani crowned as king of Afghanistan in October.November 22 - Prince William IV of Orange becomes stadtholder of all the provinces of the United Provinces. 
*December 16 - Canter of Coltbrigg – 13th and 14th Dragoons flee Jacobites of Charles Edward Stuart. 
__Undated__
*Kandahar taken by Ahmad Shah Durrani, and becomes the first capital of the newly-independent Afghanistan. 
*Thomas Herring is appointed Archbishop of Canterbury. 
*James Lind discovers that citrus fruits prevent scurvy. 
*War of the Austrian Succession: Spanish troops invade and occupy the coastal towns of Beaufort and Brunswick in the Royal Colony of North Carolina during what becomes known as the Spanish Alarm. They are later driven out by the local militia. 

Ongoing events
*War of the Austrian Succession (1740-1748). 
*Samuel Johnson begins work on A Dictionary of the English Language. 
__January - June__
*March 28 - a fire in the City of London causes over a million pounds worth of damage. 
*April - Maastricht is conquered by Maurice de Saxe. 
*April 24 - War of Austrian Succession: A congress assembles at ~Aix-la-Chapelle (Aachen) with the intent to conclude the war (treaty signed October 18). 
__July - December__
*September 24 - Shah Rukh becomes ruler of Khorasan. 
*October 18 - War of Austrian Succession: The Treaty of ~Aix-la-Chapelle is signed to end the war. 
__Undated__
*Great Britain obtains Madras, in India, from France, in exchange of the fortress of Louisbourg in Canada. 
*Leonhard Euler publishes Introductio in analysin infinitorum. 
*Montesquieu publishes De l'Esprit des lois. 
*Adam Smith begins to deliver public lectures in Edinburgh. 
*The building of Sveaborg begins near Helsinki. 
*Henry Fielding organizes the forerunner of the Bow Street Runners: eight men at first. 
*Ahmad Shah Bahadur captures Lahore. 
*The ruins of Pompeii are discovered. 
__January - June__
*January 3 - Benning Wentworth issues the first of the New Hampshire Grants, leading to the establishment of Vermont. 
*April 27 - The first official performance of George Frideric Handel's Music for the Royal Fireworks finished early due to the outbreak of fire. 
*May 19 - King George II of Great Britain grants the Ohio Company a charter of land around the forks of the Ohio River. 
__July - December__
*July 9 - Naval settlement of Halifax, Nova Scotia is founded as British answer to Louisbourg. 
*September 15 - According to mathematical calculations, Pluto moved outside Neptune's orbit to remain the outermost planet until 1979. 
__Undated__
*While in debtor's prison, John Cleland writes Fanny Hill (Memoirs of a Woman of Pleasure). Released from prison, the book was published in London. Immediately, the Church of England asked the British Secretary of State to "//stop the progress of this vile Book, which is an open insult upon Religion and good manners.//" As a result, Cleland was arrested and charged with "corrupting the King's subjects." 
__January - June__
*January - A fire in Istanbul destroys 10,000 houses. 
*March 2 - A small earthquake hits London, England. 
*April 4 - A small earthquake hits Warrington, England. 
*April 5 - First known case of harlequin type ichthyosis is reported. 
*April - A second fire devastates Istanbul (see January). 
__July - December__
*July - José I takes over the throne of Portugal from his deceased father, João V. King José Manuel appoints the Marquis of Pombal as his Chief Minister, who then strips the Inquisition of its power. 
*August 23 - A small earthquake hits Spalding, Lincolnshire, England. 
*September 30 - A small earthquake hits Northampton, England. 
*November 16 - Westminster Bridge is officially opened. 
__Undated__
*Jonas Hanway is the first Englishman to use an umbrella (considered French fashion). 
*"James Gray" reveals her sex to her Royal Marines compatriots. 
*John Cleland publishes Fanny Hill, or The Memoirs of a Woman of Pleasure. 
*Ahmad Shah Bahadur's army, retreating from Persia, is said to have lost 18,000 men near what is present-day Herat, Afghanistan from cold in a single night. 
*A third fire late in the year in Istanbul destroys 10,000 more houses (see above: January/April). 
*Gallery slavery is abolished in Europe.[2] 
*World population: 791,000,000 
**Africa: 106,000,000 
**Asia: 502,000,000 
**Europe: 163,000,000 
**~Latin-America: 16,000,000 
**Northern America: 2,000,000 
**Oceania: 2,000,000 
__January - June__
*March 25 - For the last time, New Year's Day is legally on March 25 in England and Wales. 
*March 25 - Upon his death, Frederick I of Sweden is succeeded as king by Adolf Frederick. 
*April 20 - The future King George III of the United Kingdom succeeds his father as heir-apparent to the British throne (later that year, he's named Prince of Wales). His mother Augusta of ~Saxe-Gotha becomes Dowager Princess of Wales. 
*May 11 - The Pennsylvania legislature grants a charter to Benjamin Franklin and Dr. Thomas Bond for the establishment in Philadelphia of the first hospital in the Colonies. 
__July - December__
*August 13 - The Academy and College of Philadelphia, predecessor to the private University of Pennsylvania, opened its doors, with Benjamin Franklin as president. 
*October 27 - Beginning of Hōreki period in Japan. 
__Undated__
*Adam Smith is appointed professor of logic at the University of Glasgow. 
*First publication of Encyclopédie. 
*Fire destroys 1,000 houses in Stockholm. 
*Glasgow Medical School is founded. 
__January - June__
*January 1 - The British Empire adopts the Gregorian calendar. 
*February 11 - Pennsylvania Hospital, the first hospital in the US, is opened. 
*March 23 - The Halifax Gazette, the first Canadian newspaper, is published. 
*June 6 - Fire destroys 18,000 houses in Moscow. 
*June 15 - Benjamin Franklin proves that lightning is electricity, using a kite and a key. 
__July - December__
*September 1 - The Liberty Bell arrives in Philadelphia. 
*September 3–September 13 inclusive - These dates were omitted from the calendar in Britain as part of the adoption of the Gregorian calendar in the British Empire to correct the discrepancy between the Old Style and New Style dates. 
__Undated__
*Adam Smith at the University of Glasgow transfers to professor of moral philosophy. 
*English scientist Lord John Davies first observes what is later recognised as respiratory collapse. 
__January - June__
*January 13 - Sentenced conspirators of the Tavora affair are executed. 
*January 29 - After a month's absence, Elizabeth Canning returns to her mother's home in London and claims that she was abducted. Following criminal trial causes uproar. 
*March 1 - Sweden adopts Gregorian calendar. 
*April 5 - Founding charter of the British Museum is enacted. 
__July - December__
*October 31 - Virginia Lieut. Gov. Robert Dinwiddie commissions 21-year-old militia Maj. George Washington to dissuade the French from occupying the Ohio Country. Seven Years' War, the first global conflict, ensues. 
__Undated__
*British Parliament extends citizenship to Jews. 
*Publication of Species Plantarum by Linnaeus on 1st May, adopted by the International Code of Botanical Nomenclature as the formal start date of the scientific classification of plants. 
*James Lind writes A Treatise of the Scurvy. 
*Tobias Smollett writes Ferdinand Count Fathom. 
*Robert Wallace writes On the Numbers of Man. 
*Samuel Johnson is still writing A Dictionary of the English Language begun in 1746. 
*Benjamin Franklin invents the lightning rod, to ring a bell when struck, following the 1752 kite/key tests with his 21-year-old son. 
*Cramer family starts brewing operation including the current major brand Warsteiner 
__January - June__
*January 28 - Horace Walpole, in a letter to Horace Mann, coins the word serendipity. 
*May 28 - The Battle of Jumonville Glen begins the French and Indian War in North America. 
*June - ~Alexandrine-Jeanne d'Etioles took ill in the convent of Assumption in Paris. 
*June 19 - The Albany Convention of New England Colonies proposes an American Union. 
__July - December__
*July - Columbia University founded as King's College by royal charter of King George II of England. The college was originally located in Lower Manhattan. Instruction was suspended in 1776 and the school would be reopened in 1784 as Columbia College. With the college's growth in the 19th Century, it would be renamed Columbia University in 1896. 
__Undated__
*Change of emperor of the Ottoman Empire from Mahmud I (1730-1754) to Osman III (1754-1757). 
*Surveyor William Churton lays out what will become the county seat of Orange County, North Carolina. The town is named Corbin Town for Francis Corbin, a member of the North Carolina governor's council. Corbin Town is renamed Childsburgh in 1759 and finally Hillsborough in 1766. 
*Samuel Johnson is still writing A Dictionary of the English Language begun in 1746. 
__January - June__
*January 25 - Moscow University established on Tatiana Day. 
*February 13 - The kingdom of Mataram on Java is divided in two, creating the sultanate of Yogyakarta and the sunanate of Surakarta. 
*February 20 - General Braddock lands in Virginia to take command of the English forces against the French in North America. 
*April 15 - A Dictionary of the English Language is published by Samuel Johnson; he had begun the work 9 years earlier, in 1746. 
__July - December__
*July 9 - French and Indian War: Braddock Expedition - British troops and colonial militiamen are ambushed and suffer a devastating defeat inflicted by French and Indian forces. During the battle, British General Edward Braddock is mortally wounded. Colonel George Washington survives. 
*July 17 - In a convoy of ships from England, returning to India for the East India Company, the lead ship Dodington wrecks at Port Elizabeth, losing a chest of gold coins from Robert Clive, worth L33000. In 1998, 1400 coins were offered for sale, and in 2002 a portion was given to the South African government.[1] 
*July 25 - The decision to deport the Acadians was made during meetings of the Nova Scotia Council meeting in Halifax. Beginning in September of 1755 and continuing to June of 1763 the vast majority of Acadians were deported to one of the following British Colonies in America; Massachusetts, Connecticut, New York, Pennsylvania, Maryland, Virginia, North and South Carolina and Georgia. Contrary to popular belief, no Acadians were sent to Louisiana. Those sent Virginia were refused and were then sent on to Liverpool, Bristol, Southampton and Penn-ryn (Falmouth) in England. In 1758 the Fortress of Louisbourg fell and all of the civilian population of Isle Royal (Cape Breton Island) and Isle St. Jean (Prince Edward Island) were repatriated to France. Among them were several thousand Acadians who had escaped the deportation by fleeing into those areas.Very few Acadians successfully escaped the deportation and did so only by fleeing into some of the northern sections of present day New Brunswick. The event inspired Longfellow to write the epic poem Evangeline. 
*August - Beginning of the Great Expulsion of the Acadians. 
*November 1 - 1755 Lisbon earthquake: In Portugal, Lisbon is destroyed by a massive earthquake and tsunami, killing 60,000 - 90,000 people. 
*November 18 - An earthquake occurs in the vicinity of Cape Ann, Massachusetts, causing extensive damage. 
*December 2 - The second Eddystone Lighthouse is destroyed by fire. 
__Undated__
*Wolsey the clothes manufacturer was established in Leicester; the business celebrated its 250th anniversary in 2005. 
*Construction of the Puning Temple complex in Chengde, China is complete, during the reign of the Qianlong Emperor. 

__Ongoing events__
*French and Indian War (1754-1763) 
__January - June__
*March 17 - St. Patrick's Day is celebrated in New York City for the first time (at the Crown and Thistle Tavern). 
*April 12 - Seven Years' War: The French invade Minorca, then under British control. 
*May 17 - Seven Years' War: The Seven Years' War formally begins when Great Britain declares war on France. 
*May 20 - Seven Years' War: Battle of Minorca: The British fleet under John Byng is defeated by the French under ~Roland-Michel Barrin de La Galissonière. 
*May 28 - Seven Years' War: The British garrison in Minorca surrenders to the French. 
*June 25 - Foundation of The Marine Society in London, the world's oldest seafarers' charity. 
__July - December__
*July 30 - Bartolomeo Rastrelli presents the newly-built Catherine Palace to Empress Elizabeth and her courtiers. 
*August 14 - Seven Years' War: French and Indian War: Fort Oswego falls to the French. 
*August 29 - Frederick the Great invades Saxony, beginning the war on the continent. 
*October 1 - Seven Years' War: Battle of Lobositz: Frederick defeats an Austrian army under Marshal Maximilian Ulysses Reichsgraf von Browne. 
*December - Seven Years' War: French and Indian War: Militias of the Royal Colony of North Carolina build a fort on the province's western frontier to protect it against natives allied with the French. The fort is named Fort Dobbs in honor of North Carolina Governor Arthur Dobbs, who persuaded the North Carolina legislature to fund the construction a year earlier. 
__Undated__
*Mayonnaise was invented by the French chef of the Duc de Richelieu. 
*Frederick II of Prussia forces his country's peasants to grow the unpopular and obscure potato.
__Ongoing events__
*French and Indian War (1754-1763) 
__January - June__
*January 2 - Britain captures Calcutta, India. 
*January 11 - Possible birth date of Alexander Hamilton. 
*March 14 - Seven Years' War: On-board the HMS Monarch, Royal Navy Admiral John Byng is executed by firing squad for breach of the Articles of War. 
*May 6 - Seven Years' War: Battle of Prague: Frederick the Great defeats an Austrian army and begins to besiege the city. 
*June 18 - Seven Years' War: Battle of Kolin: Frederick is defeated by an Austrian army under Marshal Daun, forcing him to evacuate Bohemia. 
*June 23 - Battle of Plassey: 3000 British troops under Robert Clive defeat a 50,000 strong Indian army under Siraj ud-Daulah at Plassey. 
__July - December__
*July 26 - Seven Years' War: Battle of Hastenbeck: An ~Anglo-Hanoverian army under the Duke of Cumberland is defeated by the French under Louis d'Estrées and forced out of Hanover. 
*July 30 - Seven Years' War: Battle of ~Gross-Jägersdorf: A Prussian army under Hans von Lehwald is defeated by the Russian army of Marshal Stepan Apraksin. 
*August 3 - August 9 - French and Indian War: A French army under ~Louis-Joseph de Montcalm forces the English to surrender Fort William Henry. The French army's Indian allies slaughter the survivors for unclear reasons 
*October 16 - Seven Years' War: Austrian raiders plunder Berlin. 
*October 30 - Osman III dies and is succeeded as Ottoman Sultan by Mustafa III. 
*November 5 - Seven Years' War: Battle of Rossbach: Frederick defeats the ~French-Imperial army under the Duc de Soubise and Prince Joseph of ~Saxe-Hildburghausen, forcing the French to withdraw from Saxony. 
*November 22 - Seven Years' War: Battle of Breslau: An Austrian army under Prince Charles Alexander of Lorraine defeats the Prussian army of Wilhelm of ~Brunswick-Bevern and forces the Austrians behind the Oder. 
*December 6 - Seven Years' War: Battle of Leuthen: Frederick defeats Prince Charles's Austrian army in what is generally considered the Prussian king's greatest tactical victory. 
__Ongoing events__
*French and Indian War (1754-1763) 
*Seven Years' War (1756-1763) 
__January - June__
*April 29, 2005 - Battle of Cuddalore: A British fleet under Sir George Pocock engages the French fleet of Anne Antoine d'Aché indecisively near Madras. 
*May 21 - Seven Years' War: French and Indian War: Mary Campbell is abducted from her home in Pennsylvania by Lenape. 
*June 12 - Seven Years' War: French and Indian War: Siege of Louisbourg: James Wolfe's attack at Louisbourg, Nova Scotia commences. 
*June 23 - Seven Years' War: Battle of Krefeld - ~Anglo-Hanoverian forces under Ferdinand of Brunswick defeat the French. 
*June 30 - Seven Years' War: Battle of Domstadtl - Austrian forces under Ernst Gideon von Laudon and Joseph von Siskovits routed an enormous convoy with supplies for Prussian army guarded by strong troops of Hans Joachim von Zieten. 
__July - December__
*July 6 - Pope Clement XIII succeeds Pope Benedict XIV as the 248th pope. 
**Seven Years' War: Battle of Bernetz Brook 
*July 8 - Seven Years' War: French and Indian War: French forces hold Fort Carillon against British at Ticonderoga, New York. 
*July 25 - Seven Years' War: French and Indian War: The island battery at Fortress Louisbourg is silenced and all French warships are destroyed or taken. 
*August 3 - Seven Years' War: Battle of Negapatam: Off the coast of India, Admiral Pocock again engages d'Aché's French fleet, this time with more success. 
*August 25 - Seven Years' War: Battle of Zorndorf: Frederick defeats the Russian army of Count Wilhelm Fermor near the Oder. 
*September 1 - The town of Stephensburgh, Virginia was chartered and founded. Stephensburgh is known today as Stephens City. 
*September 3 - Tavora affair: attempted assassination of Joseph I of Portugal. 
*September 14 - Seven Years' War: French and Indian War: Battle of Fort Duquesne: A British attack on Fort Duquesne is defeated. 
*October 14 - Seven Years' War: Battle of Hochkirch: Frederick loses a hard-fought battle against the Austrians under Marshal Leopold von Daun, who besieges Dresden. 
*November 25 - Seven Years' War: French and Indian War: French forces abandon Fort Duquesne to the British who then name the area Pittsburgh. 
*December 25 - Halley's Comet appears for the first time after Halley's discovery of it. 
__Undated__
*First European settlement in what is now Erie County by the French at the mouth of Buffalo Creek. 
*Rudjer Boscovich publishes his atomic theory in Theoria philosophiae naturalis redacta ad unicam legem virium in nalura existentium. 
*James Abercrombie replaces the Earl of Loudoun as supreme commander in the American colonies. He is replaced himself after failing to take the fort at Ticonderoga. 
*Fire destroys part of Oslo, then called Christiania. 
*Carolus Linnaeus publishes the first volume (Animalia) of the tenth edition of his Systema Naturae, the starting point of modern zoological nomenclature. 
__Ongoing events__
*French and Indian War (1754-1763) 
*Seven Years' War (1756-1763) 
__January - June__
*January 6 - George Washington marries Martha Dandridge Custis. 
*January 11 - In Philadelphia, Pennsylvania, the first American life insurance company is incorporated. 
*January 13 - The Távora family is executed following the accusation of attempted regicide on Joseph I of Portugal. 
*January 15 - The British Museum opens (after 6 years of development). 
*April 14 - A French army defeats Ferdinand, Duke of Brunswick at Brunswick. 
*June 27 - British Troops under Jeffrey Amherst take Fort Ticonderoga. 
__July - December__
*July 25 - Seven Years' War (French and Indian War): In Canada, British forces capture Fort Niagara from French, who subsequently abandon Fort Rouillé. 
*July 26 - Seven Years' War (French and Indian War): At the southern end of Lake Champlain, British forces capture Fort Carillon from French, and rename it Fort Ticonderoga. 
*August 1 - Battle of Minden - ~Anglo-Hanoverian forces under Ferdinand of Brunswick defeat the French army of the Duc de Broglie, but due to the disobedience of the English cavalry commander Lord George Sackville, the French are able to withdraw unmolested. 
*August 10 - Ferdinand VI of Spain dies and is succeeded by his half-brother Charles III. Charles resigns the thrones of Naples and Sicily to his third son, Ferdinand IV. 
*August 12 - Battle of Kunersdorf - Frederick the Great is rebuffed in bloody assaults on the combined ~Austro-Russian army of Peter Soltikov and Gideon von Loudon. This is one of Frederick's greatest defeats. 
*August 18 - Battle of Lagos - The British fleet of Edward Boscawen defeats a French force under Commodore de la Clue off the Portuguese coast. 
*September 10 - Battle of Pondicherry - An inconclusive naval battle is fought off the coast of India between the French Admiral d'Aché and the British under George Pocock. The French forces are badly damaged and returned home, never to return. 
*September 13 - Seven Years' War (French and Indian War): Quebec falls to British forces following General Wolfe's victory in the Battle of the Plains of Abraham just outside the city. Both the French Commander (the Marquis de Montcalm) and the British General James Wolfe are fatally wounded. 
*November 20 - Battle of Quiberon Bay - The English fleet of Sir Edward Hawke defeats a French fleet under Marshal de Conflans near the coast of Brittany. This is the decisive naval engagement of the Seven Years' War - after this, the French are no longer able to field a significant fleet. 
*November 21 - Battle of Maxen - the Austrian army of Marshal von Daun cuts off and forces the surrender of a Prussian force under Friedrich von Finck. 
*December 6 - The Germantown Union School (now called "Germantown Academy"), America's oldest nonsectarian day school, is founded. 
__Undated__
*Adam Smith publishes Theory of Moral Sentiments, embodying some of his Glasgow lectures. 
*Voltaire's Candide is published. 
*The town of Egedesminde (modern Aasiaat) is founded in Greenland. 
*The Famous Guinness Brewery founded in St. James's Gate, Dublin Ireland 
*Churton Town, the Orange County, North Carolina county seat laid out in 1754, is renamed Childsburgh in honor of North Carolina attorney general Thomas Child. It is later renamed Hillsborough in 1766. 
*Fire destroys 250 houses in Stockholm. 
__Ongoing events__
*French and Indian War (1754-1763) 
*Seven Years' War (1756-1763)
__January - June__
*January 9 - Afghans defeat Marathas in Battle of Barari Ghat. 
*January 28 -- Benning Wentworth creates the New Hampshire Grant of Pownal, Vermont. 
*February 27 - Seven Years' War: French and Indian War: Cherokee natives allied with French forces attack a North Carolina militia stationed at Fort Dobbs in the western part of the province. The attack is repelled by the militia. 
*March 20 - The "Great Fire" of Boston destroys 349 buildings. 
*June 4 - Great Upheaval: New England planters arrive to claim land in Nova Scotia Canada taken from the Acadians. 
__July - December__
*July 8 - Seven Years' War: French and Indian War: Battle of the Ristigouche: British defeat French forces in last naval battle in New France. 
*July 19 - A formal request is made to the Spanish government as to allow the founding of the later city of Mayagüez, Puerto Rico. 
*July 31 - Seven Years' War: Battle of Warburg: The ~Anglo-Hanoverian army of Ferdinand of Brunswick storms Warburg, with a heroic role being played by the English commander Lord Granby. 
*August 15 - Seven Years' War: Battle of Legnica: By a series of brilliant maneuvers, Frederick the Great manages to defeat the Austrian army of Marshal Laudon before it can unite with that of Marshal Daun. 
*August 21 - The church (later cathedral) of "Our Lady of Candlemas of Mayagüez (Puerto Rico)" is founded, establishing the basis for the founding of the city. 
*18 September - The town (later city) of Mayagüez, Puerto Rico is founded. 
*October 9 - Russian troops enter Berlin, but soon withdraw. 
*October 16 - Seven Years' War: Battle of ~Kloster-Kamp: Ferdinand of Brunswick is beaten back from the Rhine by a French army. 
*October 25 - Death of George II of Great Britain. His grandson George III ascends to the throne. 
*November 3 - Seven Years' War: Battle of Torgau: In another extremely hard Frederick defeats Daun's Austrians, who withdraw across the Elbe. 
__Undated__
*Abu Dhabi is founded. (Approximate date) 
*Tacky's rebellion occurs in Jamaica. 
*Publication of Dr. James Fordyce's two-volume compendium Sermons for Young Women. 
*The dockyards of Portsmouth catch fire. 
__Ongoing events__
*French and Indian War (1754-1763) 
*Seven Years' War (1756-1763)
__January - June__
*January 14 - Third Battle of Panipat was fought between Marathas and Afghans. 
*January 16 - British capture Pondicherry, India from the French. 
*February 8 - An earthquake in London breaks chimneys in Limehouse and Poplar. 
*March 8 - A second earthquake occurs in North London, Hampstead and Highgate. 
*June 6 - A transit of Venus occurred, and was observed from 120 locations around the Earth. 
__July - December__
*September 19 - Slave trade to and within Portugal mainland is forbidden. 
*December 16 - Seven Years' War: After four months of siege, the Russians under Pyotr Rumyantsev take the Prussian fortress of Kolobrzeg. 
__Undated__
*In Dutch Guyana, a "state" formed by escaped slaves signs a treaty with the local governor. 
*Opening of Matthew Boulton's Soho Manufactory. 
*The tune to "Twinkle Twinkle Little Star" is published in France. 
__Ongoing events__
*French and Indian War (1754–1763) 
*Seven Years' War (1756–1763) 
__January - June__
*January 4 - Britain declares war on Spain and Naples. 
*January 5 - Death of the Empress Elisabeth of Russia, who is succeeded by her nephew Peter III. Peter, an admirer of Frederick the Great, immediately opens peace negotiations with the Prussians. 
*May 15 - The Treaty of Saint Petersburg (1762) ends the war between Russia and Prussia. 
*May 22 - The Treaty of Hamburg takes Sweden out of the war against Prussia. 
*June 24 - Battle of Wilhelmstal. The ~Anglo-Hanoverian army of Ferdinand of Brunswick defeats the French forces in Westphalia. The British commander Lord Granby distinguishes himself. 
__July - December__
*July 9 - Catherine II becomes empress of Russia upon the deposition of her husband Peter III. The incipient ~Russo-Prussian alliance falls apart, but Russia does not rejoin the war. 
*July 21 - Battle of Burkersdorf. In his last major battle, Frederick defeats Marshal Daun in Silesia. 
*August 10 - British East India Company seizes the port city of Manila, Philippines from the Spaniards. 
*September 15 - Battle of Signal Hill is fought. 
*October 5 - The British take Manila and make it an Open Port. 
__Undated__
*~Jean-Jacques Rousseau first publishes The Social Contract (Du Contrat Social). 
*Louis XV orders the construction of the Petit Trianon, in the park of the Palace of Versailles, for his mistress Madame de Pompadour. 
*Neolin begins to preach. 
*Empress ~Go-Sakuramachi ascends to the throne of Japan, succeeding Emperor Momozono. 
*The North Carolina General Assembly incorporates Kingston, named for King George III of the United Kingdom, as the county seat of Dobbs County, North Carolina. The name is later shortened to Kinston in 1784. 
__Ongoing events__
*French and Indian War (1754-1763). 
*Seven Years' War (1756-1763). 
__January - June__
*February 1 - The Royal Colony of North Carolina officially creates Mecklenburg County from the western portion of Anson County. The county is named for Queen Charlotte of ~Mecklenburg-Strelitz, who married King George III in 1761. 
*February 10 - French and Indian War: The 1763 Treaty of Paris ends the war and France cedes Canada to Great Britain. 
*February 15 - the Treaty of Hubertusburg puts an end to the Seven Years' War between Prussia and Austria and their allies. 
*February 23 - Berbice Slave Uprising starts in the former Dutch colony of Berbice. 
*March 1 - Charles Townshend becomes President of the Board of Trade in the British government. 
*May 7 - Chief Pontiac begins the "Conspiracy of Pontiac" by attacking British forces at Fort Detroit. 
*June 2 - Pontiac's Rebellion: At what is now Mackinaw City, Michigan, Chippewas capture Fort Michilimackinac by diverting the garrison's attention with a game of lacrosse, then chasing a ball into the fort. 
*June 28 - Earthquake occurs in Komarom, Hungary. 
__July - December__
*August 5 - Pontiac's War - Battle of Bushy Run - British forces led by Henry Bouquet defeat Chief Pontiac's Indians at Bushy Run in the Pennsylvania backcountry. 
*September 1 - Catherine II of Russia endorses Ivan Betskoy's plans for a Foundling Home in Moscow 
*October 7 - Proclamation of 1763 is made. 
__Undated__
*First publication is made of Bayes' theorem. 
*Fire in Smyrna, Turkey destroys 2,600 houses. 
*Mir Kasim of Bengal destroys the English garrison in Patna. 
*The English defeat Mir Kasim at Katwah, Murshidabad, Giria, Sooty, Udayanala and Monghyr. 
__January - June__
*January 7 - Siculicidium: the Massacre at Madéfalva (Transylvania, Kingdom of Hungary) where hundreds of innocent Székely people were murdered by the Austrians. 
*January 19 - John Wilkes is expelled from the United Kingdom House of Commons for seditious libel. 
*February 15 - The American city of St. Louis is established. 
*April 6 - The Sugar Act is passed. 
*June 21 - The English-language Quebec Gazette is established in Quebec City, Quebec, Canada. As of 2005, it is the oldest surviving newspaper in North America. 
*June 29 - A Level 5 tornado in Woldegk, Germany. 
__July - December__
*September 7 - Stanisław August Poniatowski was elected as the King of the ~Polish-Lithuanian Commonwealth. 
*October - Battle of Buxar was a significant battle fought between the forces under the command of the British East India Company on the one side, and the combined armies of Mir Kasim, the Nawab of Bengal ; Nawab of Awadh; and Shah Alam II, the Mughal Emperor. The battle fought at Buxar, a town (currently in Bihar state, India) located on the bank of the Ganges river, was a decisive battle won by the forces of the East India Company. 
*The battle resulted in the securing of Diwani rights to administer the collection and management of revenues of large areas which currently form parts of Indian states of West Bengal, Bihar, Jharkhand, and Uttar Pradesh , as well as of Bangladesh. The Battle of Buxar heralded the establishment of the rule of the East India Company in the eastern part of the Indian subcontinent. 
*November 9 - Mary Campbell, a captive of the Lenape during the French and Indian War, is turned over to forces commanded by Colonel Henry Bouquet. 
*November 16 - Chief Pontiac surrenders to the British. 
__Undated__
*The Royal Colony of North Carolina establishes a new county from the eastern portion of Granville County and names it Bute County for John Stuart, 3rd Earl of Bute, who had recently resigned his post as Prime Minister of Great Britain. In 1779 the State of North Carolina abolishes the county when it forms Warren County from the northern portion and Franklin County from the southern portion. 
__Ongoing events__
*War of the Regulation (1764-1771). 
__January - June__
*January 23 - Marriage of Joseph II, Holy Roman Emperor to Princess Maria Josepha of Bavaria in Vienna. 
*March 9 - After a public campaign by the writer Voltaire, judges in Paris posthumously exonerate Jean Calas of murdering his son. Calas had been tortured and executed in 1762 on the charge, though his son had actually committed suicide. 
*March 22 - The British Parliament passes the Stamp Act which is the first direct tax levied from Great Britain on the American colonies. 
*March 24 - Great Britain passes the Quartering Act that requires the 13 American colonies to house British troops. 
*May 18 - Fire destroys one quarter of town of Montreal, Quebec. 
*June 21 - The Isle of Man is brought under British control. 
__July - December__
*August - Josef II becomes Holy Roman Emperor. 
*August 9 - Russian Empress Catherine II issued a decree, authorizing the new way to produce vodka (by freezing). 
*September 6 - ~Jean-Jacques Rousseau's house in Switzerland is stoned by a mob. 
*September 21 - Antoine de Beauterne announces he has killed the Beast of Gévaudan. 
*October 17 - The Pennsylvania Gazette reports that a Mr. ~McCullough, the Distributor of Stamps for the Royal Colony of North Carolina, has resigned his post in protest of the Stamp Act. A Dr. Huston is appointed to the position. 
*November 1 - The British Parliament enacts the Stamp Act on the 13 colonies in order to help pay for British military operations in North America. 
*December 12 - The Pennsylvania Gazette reports that Dr. Huston, the recently instated Distributor of Stamps for the Royal Colony of North Carolina, has resigned his post in protest of the Stamp Act. 
__Undated__
*Sons of Liberty are created. 
*The first true restaurant opens in Paris, where a tavern-keeper named Boulanger sells cooked dishes at an all-night place on the Rue Bailleul. 
*Nicholas Cugnot pioneers the automobile with a three-wheel gun tractor. 
*James Watt supersedes the 1705 Newcomen engine with a more effective steam engine. 
*In Lisbon, the auto-da-fe parade (often an excuse for violence against Jews or Christian 'heretics') is abolished. 
*Horace Walpole publishes The Castle of Otranto. 
__Ongoing events__
*War of the Regulation (1764-1771) 
__January - June__
*January 1 - Bonnie Prince Charlie becomes the new Stuart claimant to the throne of Great Britain as King Charles III and figurehead for Jacobitism. 
*January 14 - Christian VII becomes King of Denmark. 
*February 5 - An observer in Wilmington, North Carolina reports to the Edinburgh newspaper Caledonian Mercury that three ships were seized by British Men of War on the charge of carrying official documents without stamps. The strict enforcement causes seven other ships to leave Wilmington for other ports. 
*February 20 - The Pennsylvania Gazette reports that a British sloop outside of Wilmington, North Carolina seized one sloop sailing from Philadelphia and one sloop sailing from Saint Christopher on the charge of carrying official documents without stamps. In response, local residents threaten to burn a Royal Man of War attempting to deliver stamps to Wilmington, forcing the ship to return to the mouth of the Cape Fear River. 
*March 5 - Antonio de Ulloa, the first Spanish governor of Louisiana, arrives in New Orleans. 
*March 18 - American Revolution: The British Parliament repeals the Stamp Act which was very unpopular in the British colonies. The persuasion of Benjamin Franklin is considered partly responsible. The Declaratory Act asserts the right of Britain to bind the colonies in all other respects. 
__July - December__
*November 10 - The last Colonial governor of New Jersey, William Franklin, signs the charter of Queen's College (later renamed Rutgers University). 
*November 27 - An observer in New York City, New York reports to the Pennsylvania Gazzette that a British Sloop of War is searching all vessels passing near Cape Lookout, North Carolina and that some vessels have been seized. 
__Undated__
*Wolfgang Amadeus Mozart returns to Salzburg after touring Paris and London with his father. 
*Lorraine becomes French again on the death of Stanislaus I Leszczyński, King of Poland. 
*The Burmese begin to invade the Thai kingdom of Ayutthaya. 
*What is now England's oldest surviving Georgian theatre was constructed in ~Stockton-on-Tees. 
*Childsburgh, the Orange County, North Carolina county seat laid out as Corbin Town in 1754 and renamed in 1759, is renamed Hillsborough in honor of Wills Hill, Earl of Hillsborough. 
__Ongoing events__
*War of the Regulation (1764-1771). 
__January - June__
*January 1 - Nautical Almanac for the first time gives mariners the means to find their longitude while at sea, using tables of lunar distances. 
*January 9 - William Tryon, governor of the Royal Colony of North Carolina, signs a contract with architect John Hawks to build Tryon Palace; a lavish Georgian style governor's mansion on the New Bern waterfront. 
*June 19 - Jean Chastel kills the infamous Beast of Gévaudan by firing 2 silver bullets at it because he thought it was a werewolf. The Beasts Reign of Terror began in 1764. 
*June 18 - Samuel Wallis, an English sea captain, sighted Tahiti and is considered the first European to reach the island. 
*June 29 - The Townshend Acts are passed by British Parliament, placing a tax on common products, such as lead, paper, paint, glass, and tea. 
__July - December__
*July 3 - Pitcairn Island is discovered by Midshipman Robert Pitcairn on an expeditionary voyage commanded by Philip Carteret. 
*July 3 - Norway's oldest newspaper, still in print, Adresseavisen, is founded (first edition published this date). 
*August 26 - Construction begins on Tryon Palace in New Bern, North Carolina. The construction proves more expensive than initially expected, leading the government to increase local taxes. This stirs resentment among some North Carolinians and helps prolong the War of the Regulation. 
__Undated__
*The Burmese army captures the Thai capital of Ayutthaya, and destroys the city. 
*North Carolina woodsman Daniel Boone goes through the Cumberland Gap and reaches Kentucky - in defiance of a decree from King George III. He discovers a rich hunting ground, contested by several Native American tribes. 
*American Whalers venture into the Antarctic for the first time, and begin to commercially exploit it. 
*~Jean-Jacques Rousseau settles in England. 
*First known competition of winter sport biathlon takes place, in Norway. 
*The final volume of The Life and Opinions of Tristram Shandy by Laurence Sterne is published. 
*Mozart completes his first true opera, Apollo et Hyacinthus. 
*The term "fine art" is first used. 
*Suppression of the Society of Jesus occurs in the Spanish Empire. 
*Construction begins on the Putuo Zongcheng Temple complex in Chengde, China, under the reign of the Qianlong Emperor. 
__Ongoing events__
*War of the Regulation (1764-1771). 
__January - June__
*January 9 - Philip Astley stages the first modern circus, with acrobats on galloping horses (London). 
*May 10 - John Wilkes is imprisoned for writing an article for the North Briton severely criticizing King George III. This action provokes rioting in London 
*May 15 - After the Treaty of Versailles, the island of Corsica is ceded by Genoa to France. 
__July - December__
*August 8 - James Cook departed Plymouth on his first voyage of discovery. 
*December 1 - The slave ship Fredensborg sinks off Tromøy in Norway. 
*December 21 - Nepal is united. 
__Undated__
*The Petit Trianon, originally built for Madame de Pompadour, is achieved in the park of the Palace of Versailles and inaugurated by Louis XV. 
*New Smyrna Beach, the largest attempt at colonization by the British in the New World in founded by Dr. Andrew Turnbull. 
*Samuel Adams' circular letter was sent around the colonies. 
*Secretary of State for colonies appointed in Britain. 
*Massachusetts Assembly dissolved for refusing to assist collection of taxes. 
*Boston citizens refuse to quarter British troops. 
*Gurkhas conquer Nepal. 
*First of the weekly numbers of the Encyclopædia Britannica are published; 100 are planned. 
*Steller's sea cow, discovered on Bering Island in 1741, is driven to extinction. 
__Ongoing events__
*War of the Regulation (1764-1771). 
*Captain James Cook's first voyage (1768-1771). 
__January - June__
*April 13 - James Cook arrives in Tahiti on the ship HM Bark Endeavour, preparing to observe the solar eclipse of the planet Venus, which took place on June 3. After the voyage, the data was found to be inaccurate in determining the distance between the Sun and Earth. 
*May 14 - Charles III of Spain sends Spanish missionaries, who found California missions in San Diego, Santa Barbara, San Francisco and Monterey and begin the settlement of California. 
*May 19 - Pope Clement XIV succeeds Pope Clement XIII as the 249th pope. 
*June 3 - (O.S.) A transit of Venus is followed five hours later by a total solar eclipse, the shortest such interval in the historical past. The predicted transit was viewed by King George III of Great Britain at Kew Observatory. 
*June 7 - Frontiersman Daniel Boone first began to explore the present-day Bluegrass State, Kentucky. 
__July - December__
*July 16: Father Junípero Serra founds Mission San Diego de Alcalá, the first of the 21 California missions. 
*August 3: The party of Gaspar de Portolà became the first white group to set foot in the area now known as Santa Monica, California. 
*September 10: ~Russo-Turkish War, 1768-1774: Russian forces take the Ottoman fortress of Chocim in Bukovina. 
*December 13: Dartmouth College in Hanover, New Hampshire is established as John Wentworth, the Royal Governor, conveys a charter from King George III of England. 
__Undated__
*James Watt demonstrates the first practical steam engine, an invention which inaugurated the Industrial Revolution in Great Britain. 
*~Nicolas-Joseph Cugnot demonstrates a steam-powered wagon or automobile (see drawing) in France. 
*Famine in Bengal kills 10 million people, a third of the population, in the worst natural disaster in human history (in terms of lives lost). 
*The Maharajah of Mysore forces the British to agree a treaty of mutual assistance in view of the famine, but the British East India Company increases its demands on the Bengali people to keep profits up. 
*David Garrick holds the first Shakespeare Festival at ~Stratford-upon-Avon. 
*Richard Arkwright invents the spinning frame. 
*The city of Brescia, Italy is devastated when the Church of San Nazaro, near Venice, is struck by lightning. The resulting fire ignites 200,000 lb (90,000 kg) of gunpowder being stored there, causing a massive explosion which destroys one sixth of the city and kills 3,000 people. The disaster prompts the Roman Catholic Church to abandon their religious objection to using lightning rods to protect their property. 
__Ongoing events__
*~Russo-Turkish War, 1768-1774. 
*War of the Regulation (1764-1771). 
*Captain James Cook's first voyage (1768-1771). 
__January - June__
*March 5 - Boston Massacre: 5 Americans killed by British troops in an event that would help start the American Revolutionary War 5 years later. 
*May 14 - Marie Antoinette arrives at the French court. 
*May 16 - 14-year old Marie Antoinette marries 15-year old ~Louis-Auguste (who later becomes Louis XVI King of France). 
*May 16 - Fireworks, lit by Eric Engelbrecht, at the wedding of the crown prince of France in Paris cause a fire: 132 dead. 
*June 3 - Gasper de Portola and Father Junipero Serra establish Monterey, which was the presidio of Alta California territory for Spain from 1777-1822, United Mexican States 1824-1846, until California Republic. 
__July - December__
*July 1 - Comet Lexell (D/1770 L1) passes the Earth. 
*July 5 - Battle of Chesma and Battle of Larga between the Russian Empire and the Ottoman Empire. 
*July 21 - ~Russo-Turkish War, 1768-1774: Russian commander Pyotr Rumyantsev routs 150,000 Turks in the Battle of Kagul. 
*August 22 - James Cook claims the eastern coast of New Holland (Australia) for Great Britain. 
__Undated__
*Falkland Crisis (1770) 
*Joseph Priestley, British chemist, recommends the use of a rubber to remove pencil marks. 
*Joseph Louis Lagrange proves Bachet's Conjecture. 
__January - June__
*January 9 - Emperor ~Go-Momozono accedes to the throne of Japan, following his aunt's abdication. 
*March - War of the Regulation: North Carolina Governor William Tryon raises a militia to put down the long running uprising of backcountry militias against North Carolina's colonial government. 
*March 12 - The North Carolina General Assembly establishes Wake County (named for Margaret Wake, the wife of North Carolina Royal Governor William Tryon) from portions of Cumberland, Johnston and Orange counties. Bloomsbury (later known as Wake Courthouse) is made the informal county seat. 
*May 11 - War of the Regulation: North Carolina Governor William Tryon marches his militia out of Hillsborough to come to the aid of General Hugh Waddell's beleaguered forces. Tryon's army stops at Alamance Creek, five miles away from the Regulator army. 
*May 16 - War of the Regulation: The Battle of Alamance commences after Regulators reject an appeal by Governor Tryon to peacefully disperse. Governor Tryon's forces crush the rebellion, causing many Regulators to move to frontier areas outside of North Carolina. 
__July - December__
*July 17 - Massacre at Bloody Falls: Chipewyan chief Matonabbee traveling as the guide to Samuel Hearne on his Arctic overland journey, massacre a group of unsuspecting Inuit. 
*August 8 - First Recorded Town Cricket Match played at Horsham. Horsham Cricket Club formed here. 
*September 8 - In California, Fathers Pedro Cambon and Angel Somera found Mission San Gabriel Arcangel in what is now San Gabriel, California. 
*October 9 - The Dutch merchant ship //Vrouw Maria// sinks near the coast of Finland. Captain Raymund Lourens and his crew escape unharmed. 
*November 16 - During the night the Tyne floods, destroying many bridges and killing several people; the main bridge at Newcastle upon Tyne is not completed until 1781. 
__Undated__
*The territory of ~Baden-Baden is inherited by the Margrave of ~Baden-Durlach, forming Baden. 
*Plague in Moscow: 57,000 dead. 
*The trade monopoly with Iceland is transferred to the Danish crown. 
*~Russo-Turkish War, 1768-1774: Russian forced under Prince Vasily Dolgorukov occupy the Crimea. 
*The North Carolina General Assembly passes an act establishing the town of Martinsborough, named for Royal Governor Josiah Martin, on the land of Richard Evans to serve as the county seat of Pitt County. 
*Construction of the Putuo Zongcheng Temple complex in Chengde, China is complete, during the reign of the Qianlong Emperor. 
__Ongoing events__
*~Russo-Turkish War, 1768-1774. 
*War of the Regulation (1764-1771). 
*Captain James Cook's first voyage (1768-1771). 
__January - June__
*January 17 - Johann Friedrich Struensee and Queen Caroline Matilda are arrested, leading to his execution and her banishment from Denmark. 
*February 17 - First partition of Poland, by Russia and Prussia, later including Austria. 
*May - Watauga Association formed in East Tennessee. 
*June 9 - British vessel Gaspee is burned off of Rhode Island. 
*June 22 - Lord Mansfield delivers the decision that leads to the end of slavery in England. 
__July - December__
*August 5 - First Partition of Poland begins. 
*August 21 - The coup d'etat by King Gustav III is completed by adopting a new Constitution, ending half a century of parliamentary rule in Sweden and making him an enlightened despot. 
*September 1 - Mission San Luis Obispo de Tolosa founded in San Luis Obispo, California. 
*November 2 - American Revolutionary War: Samuel Adams and Joseph Warren form the first Committee of Correspondence. 
__Undated__
*The world's first vineyard classification system (appellation control) was brought to completion by the Hungarians in ~Tokaj-Hegyalja, Hungary. 
*Sister Elisabeth Oesterlein, a Moravian living in Salem, North Carolina, begins a day school for girls which evolves into the Salem Academy and later becomes Salem College.
__January - June__
*January 12 - The first American museum open to the public is opened in (Charleston, South Carolina). 
*January 17 - Captain James Cook becomes the first European explorer to cross the Antarctic Circle 
*April 27 or May 10 - The British Parliament passes the Tea Act, designed to save the British East India Company by granting it a monopoly on the North American tea trade. 
*May 8 - In Egypt, Ottoman rebels revolt, killing Ali Bey, Mamluk Sultan of Egypt. 
__July - December__
*July 21 - Under the pressure of the Bourbon courts Pope Clement XIV suppresses the Society of Jesus 
*September 11 - The Public Advertiser publishes a satirical essay titled Rules By Which A Great Empire May Be Reduced To A Small One, which is written by Benjamin Franklin. 
*October 10 - Daniel Boone leads the first attempt by British colonists to establish a settlement in Kentucky, but is turned back in an attack by American Indians in which his son is killed. 
*October 12 - America's first insane asylum opens for 'Persons of Insane and Disordered Minds' in Williamsburg, Virginia 
*October 14 - Komisja Edukacji Narodowej (Polish for Commission of National Education) formed in the ~Polish-Lithuanian Commonwealth is considered to be the first ministry of education in the history of mankind. 
*December 16 - Boston Tea Party occurs. 
__Undated__
*Antigua Guatemala is destroyed by an earthquake and the capital of Guatemala is moved to Guatemala City. 
*Holy Roman Emperor Joseph II expels Jesuits from the Empire, and Pope Clement XIV orders the dissolution of the Society of Jesus. 
*~Russo-Turkish War, 1768-1774: Russian forces fail to take Silistria. 
*Hilaire Rouelle discovers urea. 
*Istanbul Technical University is established (under the original name of Royal School of Naval Engineering) as the world's first comprehensive institution of higher learning dedicated to engineering education. Pioneer through the ages...(ITU) 
*In China, written work begins on the Siku Quanshu, the largest literary compilation of books in China's history (surpassing the Yongle Encyclopedia of the 15th century). Upon completion in 1782, the books were bound in 36,381 volumes (册) with more than 79,000 chapters (卷), comprising about 2.3 million pages, and approximately 800 million Chinese characters. 
__January - June__
*January 21 - Mustafa III, Sultan of the Ottoman Empire dies and is succeeded by his brother ~Abd-ul-Hamid I. 
*March 31 - Intolerable Acts: The British Parliament passes the Boston Port Act, closing the port of Boston, Massachusetts as punishment for the Boston Tea Party. 
*May 10 - Louis XVI becomes King of France. 
*June 2 - Intolerable Acts: A new Quartering Act, requiring American colonists to provide better housing for British soldiers upon demand, is passed. 
*June 11 - Jews in Algiers escape the attack of the Spanish army. 
__July - December__
*July 21 - ~Russo-Turkish War, 1768-1774: Russia and the Ottoman Empire sign the Treaty of ~Kuchuk-Kainarji ending six years of war. The treaty does give Russia the right to intervene in Ottoman politics to protect its Christian subjects. 
*1 August - The element oxygen is discovered for the third (and last) time — the second quantitatively following the somewhat earlier work of Carl Wilhelm Scheele (1771-1772) -  by Joseph Priestley who publishes the fact in 1775 and so named the element and usually gets all the credit. 
*September 5 - the First Continental Congress assembles in Philadelphia, Pennsylvania. 
*September 21 - George Mason and George Washington found the Fairfax County Militia Association, a military unit independent of British control. 
*October 14 - Document Congress in America ~Adpoted-Decloration and Resolves. 
*October 21 - First display of the word "Liberty" on a flag, raised by colonists in Taunton, Massachusetts and which was in defiance of British rule in Colonial America. 
__Undated__
*The British pass the Quebec Act setting out rules of governance for the colony of Quebec in British North America. 
*To avoid severe flooding, Martinsborough, North Carolina is moved to higher ground three miles west. The North Carolina General Assembly incorporates Martinsborough as the new county seat of Pitt County, three years after its founding. 
*German cobbler Johann Birkenstock creates the first Birkenstock sandals. 
__January - June__
*February 9 - American Revolution: British Parliament declares Massachusetts a rebellion 
*February 15 - Pope Pius VI succeeds Pope Clement XIV as the 250th pope. 
*March 23 - American Revolution: Patrick Henry delivers his "give me liberty or give me death" speech at St. John's Church in Richmond, Virginia. 
*April 11 - Last execution for witchcraft in Europe, of Anna Maria Schwiigel. 
*April 18 - Paul Revere, William Dawes, and Joseph Warren ride from Boston to Concord in an attempt to warn John Hancock and Sam Adams that the British Armies were coming to seize their weapons and ammunition. 
*April 19 - Hostility between Britain and its American colonies explode into bloodshed at the Battles of Lexington and Concord on the 19th,[1] which ignites the American Revolution. 
*May 10 - American Revolution: The Continental Congress meets, elects John Hancock president, raises the Continental army under George Washington as commander and authorizes the colonies to adopt their own constitutions. 
*May 10 - American Revolution: Fort Ticonderoga is taken by a small force called the Green Mountain Boys of Vermont, led by Benedict Arnold and Ethan Allen. 
*May 17 - American Revolution: The Continental Congress bans trade with Canada. 
*June 12 - American Revolution: The British forces offered a pardon to all colonists who would lay down their arms. 
*June 14 - American Revolution: Delegates of the Continental Congress nominate George Washington as commander of the Continental Army -- defeating John Hancock. 
*June 17 - American Revolution: Two months into the colonial siege of Boston, British open fire on Breed's Hill on Charles Town peninsula. After three charges, the British take the hill in the misnamed Battle of Bunker Hill. 
__July - December__
*July 3 - American Revolution: George Washington takes command of the 17,000-man Continental Army at Cambridge. 
*July 5 - American Revolution: The Continental Congress sends the Olive Branch Petition, hoping for a reconciliation. 
*July 6 - American Revolution: The Continental Congress issues Declaration of the Causes and Necessity of Taking Up Arms, which contains the words: "Our cause is just. Our union is perfect... being with one mind resolved to die freemen rather than to live slaves...". 
*July 26 - The Second Continental Congress appointed Benjamin Franklin to be the first Postmaster General of what would later become the United States Post Office Department. 
*August 21 - American Revolution: American rebels launch invasion of Canada Battle of Fort St. Jean. 
*August 23 - American Revolution: Refusing to even look at the Olive Branch Petition, King George issues a Proclamation of Rebellion against the American colonies. 
*August 29 - September 12 - "Independence Hurricane" from South Carolina to Nova Scotia kills 4170, mostly fishermen and sailors. 
*September 25- American Revolution: Battle of Montreal - Patriot revolutionary forces under Maj. Ethan Allen attack Montreal, commanded by British General Guy Carleton. Allen's forces are defeated, and Allen himself is captured and held on British ships until he is later released. 
*October - Sayre Plot to kidnap King George III. 
*October 13 - American Revolution: The United States Continental Congress orders the establishment of the Continental army(later renamed the United States Navy). 
*November - American Revolution: Colonel Richard Richardson's South Carolina revolutionaries march through Ninety Six District in what becomes known as the "Snow Campaign", effectively ending all major support for the Loyalist cause in the backcountry of South Carolina. 
*November 10 - The United States Marine Corps is born in Philadelphia. It is common belief that the first Marines are recruited out of Tun Tavern. There is some speculation that this could have happened at a tavern near the site of Tun Tavern. American Revolution: The Continental Congress passes a resolution creating the Continental Marines (later renamed the United States Marine Corps) to serve as landing troops for the recently created Continental Navy (the Marines were disbanded at end of war in April of 1783 but were reformed on July 11, 1798). 
*November 13 - American Revolution: Battle of Montreal - Patriot revolutionary forces under Brig. Gen. Richard Montgomery capture Montreal. British General Guy Carleton escapes to Quebec. 
*December 5 - American Revolution: Henry Knox begins his journey to Cambridge, Massachusetts with the artillery that has been captured from Fort Ticonderoga. 
*December 31 - American Revolution: British forces repulse an attack by Continental Army generals Richard Montgomery and Benedict Arnold at Quebec. 
__Undated__
*Smallpox epidemic begins in New England. 
*Last official execution for witchcraft in Germany. 
*French decide to ignore plans for perpetuum mobiles in the future. 
*James Watt's first steam engine prototype. 
*Austria forces the Ottoman Empire to cede Bukovina. 
*John Wilkinson (industrialist) invented and patented a new kind of boring machine. 
__January - June__
*January 15 - Thomas Paine publishes Common Sense.
*January 20 - American Revolution: South Carolina Loyalists led by Robert Cunningham sign a petition from prison agreeing to all demands for peace by the newly formed state government of South Carolina. 
*January 24 - American Revolution: Henry Knox arrives at Cambridge, Massachusetts with the artillery that he has transported from Fort Ticonderoga 
*February 27 - American Revolution: Battle of Moore's Creek Bridge: North Carolina Loyalists charge across Moore's Creek bridge near Wilmington to attack what they mistakenly believe to be a small force of rebels. Several loyalist leaders are killed in the ensuing battle. The patriot victory virtually ends all British authority in the town. 
*March 4 - The American Revolution: The Americans capture "Dorchester Heights" dominating the port of Boston, Massachusetts. 
*March 9 - The first of the Great Economists, Adam Smith, publishes The Wealth of Nations. 
*March 17 - American Revolution: British forces evacuate Boston, Massachusetts after George Washington commands the placement of artillery overlooking the city at Dorchester Heights. 
*March 28 - Juan Bautista de Anza finds the site for the Presidio of San Francisco. 
*April 12 - American Revolution: The Royal Colony of North Carolina produces the Halifax Resolves making it the first British colony to officially authorize its Continental Congress delegates to vote for independence from the Kingdom of Great Britain. 
*May 1 - Adam Weishaupt founds the Bavarian Illuminati (Order of the Illuminati) in Ingolstadt, Bavaria. 
*May 4 - Rhode Island becomes the first American colony to renounce allegiance to King George III. 
*June 7 - American Revolution: Richard Henry Lee of Virginia proposes to the Continental Congress a resolution calling for a Declaration of Independence. 
*June 8 - American Revolution: Battle of ~Trois-Rivières: American invaders are driven back at ~Trois-Rivières, Quebec. 
*June 12 - American Revolution: Virginia Declaration of Rights by George Mason adopted by the Virginia Convention of Delegates. 
*June 15 - American Revolution: Delaware Separation Day: The Delaware General Assembly votes to suspend government under the British Crown. 
*June 17 - Lt. Jose Joaquin Moraga leads a band of colonists from Monterey Presidio, landing on June 29 and constructing the Mission Dolores of the new Presidio of San Francisco. 
__July - December__
*July 2 - American Revolution: The final (despite minor revisions) U.S. Declaration of Independence is written. 
*July 4 - American Revolution: United States Declaration of Independence. United States officially declares independence from the British Empire. 
*July 9 - American Revolution: An angry mob in New York City topples the equestrian statue of George III in Bowling Green. 
*July 12 - Captain James Cook sets off from Plymouth England on his third, and fatal, expedition to the Pacific Ocean. 
*July 21 - Mozart's celebrated Haffner Serenade is first performed in Salzburg, Austria 
*August 2 - Most of the American colonies ratify the Declaration of Independence 
*August 15 - American Revolution: First Hessian troops land on Staten Island to join British forces. 
*August 27 - American Revolution: Battle of Long Island: Washington's troops routed in Brooklyn by British under William Howe. 
*September - First running of the St. Leger Stakes horse race in England. 
*September 6 - Hurricane hits Guadeloupe, killing more than 6000. 
*September 7 - American Revolution: World's first submarine attack. American submersible craft Turtle attempts to attach a time bomb to the hull of British Admiral Richard Howe's flagship HMS Eagle in New York Harbor. 
*September 11 - American Revolution: abortive peace conference between British and Americans on Staten Island. 
*September 15 - American Revolution: British land on Manhattan at Kip's Bay. 
*September 16 - American Revolution: Battle of Harlem Heights is fought. 
*September 22 - American Revolution: Nathan Hale executed in New York City for espionage. 
*October 7 - Crown Prince Paul of Russia marries Sophie Marie Dorothea of Württemberg. 
*October 9 - Father Francisco Palou founds Mission San Francisco de Asis in what is now San Francisco, California. 
*October 11 - American Revolution: Battle of Valcour Island: On Lake Champlain near Valcour Island, a British fleet led by Sir Guy Carleton defeats 15 American gunboats commanded by Brigadier General Benedict Arnold. Although nearly all of Arnold's ships are destroyed, the two day-long battle will give Patriot forces enough time to prepare defenses of New York City. 
*October 28 - American Revolution: Battle of White Plains: British forces arrive at White Plains, attack and capture Chatterton Hill from the Americans. 
*November 16 - American Revolution: Hessian mercenaries under Lieutenant General Wilhelm von Knyphausen capture Fort Washington from the American Continentals. 
*December 5 - The Phi Beta Kappa society is founded at the College of William and Mary. 
*December 7 - American Revolution: Marquis de Lafayette attempts to enter the American military as a major general. 
*December 21 - American Revolution: The Royal Colony of North Carolina reorganizes into the State of North Carolina after adopting its own constitution. Richard Caswell becomes the first governor of the newly formed state. 
*December 23 - American Revolution: Thomas Paine, living with Washington's troops, begins publishing The American Crisis, containing the stirring phrase, "These are the times that try men's souls." 
*December 25 - American Revolution: Gen. George Washington orders the first issue of The Crisis read to his troops on Christmas Eve, then at 6 p.m. all 2600 of them march to ~McKonkey's Ferry, cross the Delaware River and land on the Jersey bank at 3 a.m. 
*December 26 - American Revolution: Battle of Trenton: Washington's troops surprise the 1500 Hessian troops under the command of Col. Johann Rall at 8 a.m. outside Trenton and score a victory, taking 948 prisoners while suffering only 5 wounded. 
__Undated__
*The History of the Decline and Fall of the Roman Empire, Vol. 1 published by Gibbon.
__January - June__
*January 3 - American Revolution: American general George Washington defeats British general Charles Cornwallis at the Battle of Princeton. 
*January 12 - Mission Santa Clara de Asís is founded in what is now Santa Clara, California. 
*January 15 - Vermont declares its independence from New York becoming an independent country, a status it retained until it joined the United States as the 14th state in 1791. 
*May 16 - Lachlan ~McIntosh and Button Gwinnett shoot each other during a duel near Savannah, Georgia. Gwinnett, a signer of the United States Declaration of Independence, dies three days later. 
*June 13 - American Revolution: Marquis de Lafayette lands near Charleston, South Carolina to help the Continental Congress train its army. 
*June 14 - Stars and Stripes adopted by the Continental Congress as the Flag of the United States. 
__July - December__
*August 16 - American Revolution: Battle of Bennington - British forces are defeated by American troops. 
*September 3 - Cooch's Bridge - Skirmish of American Revolutionary war in New Castle County, Delaware where the Flag of the United States was flown in battle for the first time. 
*September 11 - Battle of Brandywine - Major American Revolutionary war victory for British in Chester County, Pennsylvania. 
*September 19 - American Revolution: First Battle of Saratoga/Battle of Freeman's Farm/Battle of Bemis Heights. 
*October 4 - American Revolution: Battle of Germantown- Troops under George Washington are repelled by British troops under Sir William Howe. 
*October 17 - American Revolution: Battle of Saratoga- American troops defeat the British. 
*November 15 - American Revolution: After 16 months of debate, the Continental Congress approves the Articles of Confederation in the temporary American capital at York, Pennsylvania. 
*November 17 - Articles of Confederation submitted to the states for ratification. 
*November 29 - San Jose, California founded. It is the first pueblo in Spanish Alta California. 
*December - Death of Dolly Pentreath, claimed to be the last speaker of the Cornish language. 
*December 19 - American Revolution: George Washington's Continental Army goes into winter quarters at Valley Forge, Pennsylvania. 
*December 24 - Kiritimati discovered by James Cook. 
__Undated__
*The 2nd edition of Encyclopædia Britannica is published. 
*The code duello is adopted at the Clonmell Summer Assizes as the form for pistol duels in Ireland. It is quickly denounced but nevertheless widely adopted throughout the English-speaking world. 
<<reminder day:24 month:12 year:2007 title:"Christmas Eve - Holiday" >>
<<reminder day:25 month:12 year:2007 title:"Christmas - Holiday" >>
<<reminder day:31 month:12 year:2007 title:"New Years Eve - holiday" >>/% alwayboten  ljyahoo bitchtress %/
<<reminder day:4 month:12 year:2007 title:"Hannukah, first night - Holiday" >>
<<reminder day:7 month:12 year:2007 title:"Mom-sitting night 1" >>
<<reminder day:8 month:12 year:2007 title:"Mom-sitting night 2?" >>
config.options.chkHttpReadOnly = false;
Daughter of [[Jane Archer|Archer, Jane]] and either [[Samuel|Talboys, Samuel]] or [[George Talboys|Talboys, George]].
Foster sister of [[Charlie McGregor|McGregor, Charles Edward]], christened Margaret Archer, her mother began calling her Bethany after Charlie and his father left, possibly out of misplaced love for the one man of her acquaintance who didn't abuse her.
Born in late [[1749]], left on the parish by her mother early in [[1762]], the serving maid at [[Talboys Farm|TalboysFarm]] from [[1762]] until her death in [[1775]].  One daughter, [[Bethany Archer|Archer, Elizabeth]], fathered by either [[Samuel|Talboys, Samuel]] or [[George Talboys|Talboys, George]]. 
/***
!Metadata:
|''Name:''|ArchivedTimeline|
|''Description:''|Timeline archived monthly.|
|''Version:''|0.6.3|
|''Date:''|Jan 14, 2007|
|''Source:''|http://sourceforge.net/project/showfiles.php?group_id=150646|
|''Author:''|BramChen (bram.chen (at) gmail (dot) com)|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License]]|
|''~CoreVersion:''|2.0.11|
|''Browser:''|Firefox 1.5+; InternetExplorer 6.0|

!Syntax/Examples:
|{{{<<timeline [modified | created] [maxentries]>>}}}|
!Revision History:
|''Version''|''Date''|''Note''|
|0.6.3|Jan 14, 2007|Cleaned codes, Removed config.macros.timeline.slider and config.macros.timeline.onClickSlider|
|0.6.2|Dec 10, 2006|Add monthFormat to display month format for Chinese|
|0.6.1|Aug 12, 2006|A great effect on config.macros.timeline.slider for Firefox, thanks Bob McElrath|
|0.6.0|Jul 25, 2006|Runs compatibly with TW 2.1.0 (rev #403+)|
|0.5.2|Jun 21, 2006|Fixed bugs for dateFormat of TW 2.1|
|~|~|Change default dateFormat to "0DD MMM, YYYY"|
|0.5.1|Jun 04, 2006|Added config.macros.archivedTimeline.orderBy for localization|
|0.5.0|Apr 19, 2006|Fixed bug for twice records of the same date ()|
|~|~|Added Date.prototype.convertToLocalYYYYMMDDHHMM<<br>>in order to backward compatible with 2.0.6-|
|0.4.0|Apr 03, 2006|Added new parameter, {{{<<timeline [sortfield] [maxentries]>>}}}|
|~|~|Added config.options.txtTimelineMaxentries|
|0.3.1|Feb 04, 2006|JSLint checked|
|0.3.0|Feb 04, 2006|Fixed several missing variable declarations|
|0.2.0|Dec 26, 2005|changed for the new feature of Macro timeline of TW 2.0.0 beta 6|
|0.1.0|Nov 3, 2005|Initial release|

!Code section:
***/
//{{{
version.extensions.archivedTimeline = {major: 0, minor: 6, revision: 3,
	date: new Date("Jan 14, 2007"),
	name: "ArchivedTimeline",
	type: "Macro",
	author: "BramChen",
	source: "http://sourceforge.net/project/showfiles.php?group_id=150646"
};
config.options.txtTimelineMaxentries=0;
config.macros.archivedTimeline = {
	tooltips: "Archives sorted by  ",
	orderBy:{modified: "modified", created: "created"},
	monthFormat: "0DD MMM YYYY",
	dateFormat: "0DD MMM YYYY"
};
config.macros.timeline = config.macros.archivedTimeline;

config.macros.timeline.handler = function(place,macroName,params) {
	var field = params[0] ? params[0] : "modified";

	place.appendChild(document.createTextNode(this.tooltips + this.orderBy[field]));
	var tiddlers = store.reverseLookup("tags","excludeLists",false,field);
	var lastMonth = ""; var lastDay = ""; var theText = "----\n"; var i = 0;
	var last = (params[1])?params[1]:config.options.txtTimelineMaxentries;
		last = (isNaN(last)||last<1) ? 0:tiddlers.length-Math.min(tiddlers.length,parseInt(last));
	var cookie; var archives;
	for (var t=tiddlers.length-1; t>=last; t--) {
		var tiddler = tiddlers[t];
		var theMonth = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,6);
		var theDay = tiddler[field].convertToLocalYYYYMMDDHHMM().substr(0,8);
		if(theMonth != lastMonth) {
			if (lastMonth === "") {
				lastMonth = theMonth;
				}
			else {
				place.appendChild(document.createElement('hr'));
				cookie = 'chktimeline'+(i++);
				archives = this.formatString(this.monthFormat, lastMonth);
				var panel = config.macros.slider.createSlider(place,cookie,archives,this.tooltips + archives);
				wikify(theText,panel);
				lastMonth = theMonth; theText = '----\n';
			}
		}
		if(theDay != lastDay){
			theText +=  tiddler[field].formatString(this.dateFormat) + '\n';
			lastDay = theDay; 
		}
		theText += '* [[' + tiddler.title + ']]\n';
	}
	place.appendChild(document.createElement('hr'));
	cookie = 'chktimeline'+(i++);
	archives = this.formatString(this.monthFormat, lastMonth);
	var panel = config.macros.slider.createSlider(place,cookie,archives,this.tooltips + archives);
	wikify(theText,panel);
	place.appendChild(document.createElement('hr'));
};

config.macros.timeline.formatString = function(template, yyyymm)
{
	var dateString = new Date(yyyymm.substr(0,4)+'/'+yyyymm.substr(4,2)+'/01');
	template = template.replace(/DDD|0DD|DD/g,'');
	return dateString.formatString(template);
};
if (!Date.prototype.convertToLocalYYYYMMDDHHMM){
	Date.prototype.convertToLocalYYYYMMDDHHMM = function(){
		return(String.zeroPad(this.getFullYear(),4) + String.zeroPad(this.getMonth()+1,2) + String.zeroPad(this.getDate(),2) + String.zeroPad(this.getHours(),2) + String.zeroPad(this.getMinutes(),2));
	}
}
//}}}
|Year| Herside | Hisside |
| [[1747]] |Morag ~MacGregor is born in February, approximately 9 months after the [[Battle of Culloden]] in a brothel in London.  Her mother and grandfather were Scots, made homeless by the Jacobite Rebellion.  She is destined to be an only child, as the childbirth leaves her mother barren.  She lives in the brothel (a rather high-class one), where her grandfather looks after the children of the prostitutes, until she is eleven||
|[[1758]]|Morag's mother realizes that the brothel owner is planning to auction Morag off to the highest bidder, and drives both her father and child away from the brothel, and London.  In the countryside, the pair ended up working on farms|Arthur Lord Pendleton marries his childhood sweetheart, Elizabeth deVilliers.|
|[[1759]]|One of the harvest workers tries to rape Morag when she is twelve.  At that point, her grandfather dresses her in breeches and she becomes Morris.||
|[[1760]]||Arthur and Elizabeth have a daughter, also named Elizabeth, but called Caroline.|
|[[1763]]||Elizabeth begins an affair.|
|[[1764]]|Morris's grandfather dies when she is seventeen, in the summer.  Approximately four months later, [[next|Plot1]]|When Elizabeth's affair is discovered, she elopes with her lover.  Arthur tracks her down in the fall, they argue, she runs away again, this time taking his curricle.|
[[before|Plot1]]
|Year| Herside | Hisside |
|[[1764]]|In Chester, Morris has the child baptised Charles, for his grandfather, and the vicar who peformed the ceremony arranged both a wetnurse for the baby and work for Morris at a farm owned by Samuel Talboys, his maidservant, Jane Archer, has recently had an illegitimate baby girl.  The farmer, in his generosity, has not thrown the mother and child on the parish, but in the year and a half that Morris works there, he sees brutalities that leave it clear to him that Jane Archer's child was fathered either by Sam Talboys, or his son, George.|The scene of the accident is discovered by other people, who don't think to tell Arthur that his dead wife was no longer pregnant.  He buries her.|
|[[1766]]|Once Charlie is weaned (at about 2 years old), Morris leaves, politely as possible.  Taking his son, Morris works here and there.||
|[[1767]]||Arthur discovers that Elizabeth had had her child and that the child was a boy when he is in Chester and talks to the vicar who discusses the remarkable fact that he buried a woman who'd just given birth, the day after he baptized a boy who's mother had the same christian name.  Arthur decides it is too much of a co-incidence, and decides to investigate further.  He contacts the Talboys and learns that the boy, Charlie, looked nothing like his purported father, and that his mother was fairhaired.  The Talboys had been shown the miniature.|
|[[1771]]|Morris and Charlie are in Bristol, working for a merchant, the housekeeper is Mistress Crump, a miserly woman.||
|[[1773]]|Morris returns to London in to work for a market gardener.  There, he discovers that his mother died shortly after turfing out Morag.  She drank a bottle of opium.  Morris takes Charlie and leaves again, not wanting to stay.||
|[[1775]]|That summer, the pair end up in York, where Charlie adopts a stray dog he names Stewball.  With the coming of fall, Morris turns them south again, to look for a place where Morris can work for the winter.|Arthur tracks the pair to London.|
[[next|Plot2]]
[[before|Plot3]]
|Year| Herside | Hisside |
|[[1775]]|Jane Archer hangs herself to keep the Talboys from making her tell what she did, and from revealing "Morris's" secret.|Arthur Pendleton receives a letter from the Talboys and heads to their farm, east of Chester|
[[next|Plot4]]
The Battle of Culloden (April 16, [[1746]]) was the final clash between the French-supported Jacobites and the Hanoverian British Government in the 1745 Jacobite Rising. It was the last battle to be fought on mainland Britain. Culloden brought the Jacobite cause—to restore the House of Stuart to the throne of the Kingdom of Great Britain—to a decisive defeat.

The Jacobites—most of them Highland Scots—supported the claim of James Francis Edward Stuart (aka "The Old Pretender") to the throne; the government army, under the Duke of Cumberland, younger son of the Hanoverian sovereign, King George II, supported his father's cause.

The aftermath of the battle was brutal and earned the victorious general the name "Butcher" Cumberland. Charles Edward Stuart eventually left Britain and went to Rome, never to attempt to take the throne again. Civil penalties were also severe. New laws attacked the Highlanders' clan system, and even highland dress was outlawed.

''Background''
For further detail see Jacobite Rising.

Prince Charles Edward Stuart, known as Bonnie Prince Charlie or the Young Pretender, successfully raised forces, mainly of Scottish Highland clansmen and defeated the Hanoverian Army stationed in Scotland at the Battle of Prestonpans. Edinburgh was occupied. The British government recalled forces from the war with France in Flanders to deal with the rebellion.

After a lengthy wait, Charles persuaded his generals that English Jacobites would stage an uprising in support of his cause. He was convinced that France would launch an invasion of England as well. His army of around 5000 invaded England on November 8, [[1745]]. They advanced through Carlisle and Manchester, to Derby, and a position where they appeared to threaten London. King George II made plans to decamp to Hanover. The Jacobites met only token resistance. There was, however, little support from English Jacobites, and the French invasion fleet was still being assembled. The armies of General George Wade and of William Augustus, Duke of Cumberland, also known as the "Wee German Lairdy" and "The Butcher", were approaching. A militia was forming in London and the Jacobites had (fictitious) reports of a third army closing on them. The Jacobite general Lord George Murray and the Council of War insisted on returning to join their growing force in Scotland. On 6 December [[1745]], they withdrew, with the Prince petulantly leaving the command to Murray.

On the long march back to Scotland the Highland Army wore out its boots and demanded all the boots and shoes of the townspeople of Dumfries as well as money and hospitality.  This made them rather unpopular in the borders which had more Hanoverian sympathies.

The Jacobites reached Glasgow on 25 December [[1745]]. There they reprovisioned, and were joined by a few thousand new men. They then defeated the forces of General Henry Hawley at the Battle of Falkirk. The Duke of Cumberland arrived in Edinburgh on 30 January [[1746]], to take over command of the government army from General Hawley. He then marched north along the coast, with the army being supplied by sea. Six weeks were spent at Aberdeen training.

The King's forces continued to pressure Charles. He retired north, losing men and failing to take Stirling Castle or Fort William. But he invested Fort Augustus and Fort George in Invernessshire in early April. Charles now took command again, and insisted on fighting a defensive action.

Hugh (Rose of Kilravock), 16th Baron, entertained Prince Charles and the Duke of Cumberland repectively on 14th and 15th April [[1746]], before the battle of Culloden. On the occasion the Prince Charles' manners and deportment were described by his host as most engaging. Having walked out with Mr. Rose, before sitting down, he observed several persons engaged in planting trees. He remarked, "How happy, Sir, you must feel, to be thus peaceably employed in adorning your mansion, whilst all the country round is in such commotion." Kilravock was a firm supporter of the Hanoverian family; but his adherence was not solicited, nor were his preferences alluded to. Next day, the Duke of Cumberland called at the castle gate, and when Kilravock went to receive him, he bluffly observed, "So you had my cousin Charles here yesterday." Kilravock replied, "What am I to do, I am Scottish", To which Cumberland replied, "you did perfectly right."


''Armies''

''Jacobite Army''
Nearly three quarters of the Jacobite army was composed of Scottish Highland clansmen, the majority of them being Roman Catholic, but more than a third being Scottish Episcopalians. 
Around a quarter of the force were Episcopalians from the north-east Scottish Lowlands, north of the River Tay, so that more than half the total was Episcopalian, but the lowland contribution was obscured by their tendency to wear Highland dress as a kind of Jacobite uniform. 
Only 20-25% of the Highlanders were armed with swords, some having spears or axes and the remainder makeshift or captured weapons. 
During the invasion of England about 300 English Roman Catholics from Manchester formed a regiment, but were left behind as a rearguard at Carlisle. 
Many of the Jacobites left for home after the Battle of Falkirk, and the army was poorly provisioned and short on rations. 
The Jacobite army which fought at the Battle of Culloden included men from: Clan Stuart (Stewart), Clan Donnachaidh, Clan ~MacDonald of Keppoch, Clan ~MacDonnell of Glengarry, Clan ~MacDonald of Clan Ranald, Clan ~MacKinnon, Clan Cameron, Clan Gordon, Clan Fraser, Clan ~MacGregor, Clan ~MacLean, Clan ~MacLeod, Clan ~MacIntyre, Clan Ogilvy, Clan Chisholm, Clan ~MacLaren, Clan ~MacLea, Clan ~MacBain, Clan ~MacLachlan, Clan ~MacNaghten, and Clan Chattan, composed of Clan Davidson, Clan ~MacGillivray, Clan ~Macpherson, Clan ~MacKintosh, Clan ~MacDuff, and Clan Farquharson. 

''British Government Army''
The British Army under Cumberland, assembled and trained at Aberdeen, was well supplied. It included:

Three regiments of Scottish horse; Kerr's Dragoons protected the left flank, led by Lord Mark Kerr, chief of Clan Kerr. Possibly also included some German Hanoverians. 
Twelve battalions of foot, two thirds were English and one third was made from Scottish Lowland and Scottish Highland clansmen: 
One battalion and a militia had been largely raised from Clan Campbell Scottish Highlanders. 
James Sinclair, chief of the Highland Clan Sinclair commanded The Royal Scots along with Charles Cathcart. 
Three battalions of Scottish Lowlanders foot soldiers supported the government at Culloden from Clan Cathcart, Clan Colville, Clan Sempill, Clan Kerr and Clan Cunningham (company of artillery). Most of the these clans fought in mixed regiments such as The Royal Scots Regiment of Foot and some were under the name of an English officer such as Barrel's Regiment of Foot. 
Other Highland clans such as the Clan ~MacKay, Clan Munro, Clan Ross, Clan Sutherland, Clan Gunn and Clan Grant, sided with the government during the uprisings but were assigned other military duties at the time of Culloden and were not present at this battle. The Clan ~MacKay intercepted and captured gold and supplies to stop them reaching Jacobite leader Bonnie Prince Charlie before the battle commenced and the Clan Ross defended Inverness Castle against the Jacobites. It is often suggested that men from these clans fought for the government at Culloden but there is little if any evidence for this. 

''The Battle''

The Duke of Cumberland and his army of around 8,811 men arrived at Nairn on 14 April [[1746]]. The Jacobite forces of about 5,400 left their base at Inverness, leaving most of their supplies, and assembled 5 miles (8 km) to the east near Drummossie, around 12 miles (19 km) before Nairn. Prince Charles had decided to personally command his forces and took the advice of his adjutant general, Secretary ~O’Sullivan, who chose to stage a defensive action at Drummossie Moor, a stretch of open moorland enclosed between the walled Culloden[1] enclosures to the North and the walls of Culloden Park to the South. Lord George Murray "did not like the ground" and with other senior officers pointed out the unsuitability of the rough moorland terrain which was highly advantageous to the Duke with the marshy and uneven ground making the famed Highland charge somewhat more difficult while remaining open to Cumberland’s powerful artillery. They had argued for a guerrilla campaign, but the Prince refused to change his mind.

On 15 April the Government army celebrated Cumberland's birthday, drinking his health at his expense. At the suggestion of Murray the Jacobites tried that evening to repeat the success of Prestonpans by carrying out a night attack on the government army encampment, but the half-starved Highlanders who had only had one biscuit apiece during the day were still 2 miles (3 km) short of Nairn by dawn and had to march back, then dispersed to search for food or fell asleep in ditches and outbuildings. Many of them lay exhausted in the grounds of Culloden House throughout the battle.

Early on 16 April the Government army marched from Nairn, and Jacobite guns sounded the alarm (though not all heard) to bring their troops to form two lines. The front line of exhausted highland foot soldiers had guns in the centre and on the flanks, the second line included their horse regiments, worn out from the night march, and the Scots and Irish regiments of the French army. The weather was very poor with a gale driving sleety rain into the faces of the Jacobites. The Duke's forces arrived around mid day and arrayed themselves in two lines to face the Jacobite forces, their left flank anchored on a low stone wall running along the south end of the field towards Culloden Park. Horse Dragoons and Government militia moved round behind the wall to infiltrate the park around the Jacobite flank. The Prince's artillery, outnumbered some three to one, opened fire first but due to a lack of trained gunners had little impact.

Over the next twenty minutes Cumberland's superior artillery continued to batter the Jacobite lines, while Charles, moved for safety out of sight of his own forces, waited for the government forces to move. Inexplicably, he left his forces arrayed under the Government fire for over half an hour. Although the marshy terrain minimised casualties, the morale of the Jacobites began to suffer. Several clan leaders, angry at the lack of action, pressured Charles to issue the order to charge. When he was eventually persuaded to issue the order, the ~McDonalds refused, angry because they had been placed on the left flank overturning their traditional right to take the right flank. The Clan Chattan was first away, but an area of boggy ground in front of them forced them to veer right so that they obstructed the following regiments and the attack was pushed towards the wall. The Highlanders advanced on the left flank of the Government troops but were subjected to several volleys of musket fire and the artillery which had switched from roundshot to grapeshot.

Despite this, a large number of Jacobites reached the Government lines; however, unlike in previous battles, their uncoordinated charge meant that the line arrived piecemeal. The newly introduced bayonet drill used by the government troops meant that in a few places the charge, already flagging, was crushed against the Government lines. Despite this, the right flank of the Jacobites broke through the first line of Government troops and was only halted by Cumberland's second line of defence.

While the attack was still in progress, a small number of the Government forces had breached the park wall and the Campbell militia advanced unseen to fire at the right flank of the Jacobite lines. This added to all the other brutal gunfire, and threatened by cavalry the Jacobites were forced to retreat. The Duke ordered in his dragoons to rout the Jacobite forces, but the small contingent of elite Irish and other regular regiments covered the retreat as the Jacobites withdrew.

In a total of about 60 minutes the Duke was victorious, around 1,250 Jacobites were dead, a similar number were wounded, and 558 prisoners (336 Scots and Irish as well as 222 Frenchmen) were taken. Cumberland had about 52 dead and 259 wounded among his Government forces.


''Aftermath''
After their victory, Cumberland ordered his men to execute all the Jacobite wounded and prisoners, an act for which he was known afterwards as "the Butcher". Certain higher-ranking prisoners did survive to be tried and executed later in Inverness.

The Prince fled the battlefield and survived for five months in Scotland despite a £30,000 reward for his capture. The Prince eventually returned to France, making a dramatic if humiliating escape disguised as a "lady's maid" to Flora ~MacDonald.

Immediately after the battle, Cumberland rode into Inverness, his drawn sword still covered in blood, a symbolic and menacing gesture. The following day, the slaughter continued, when patrols were sent back to the battlefield to kill any survivors; contemporary sources indicate that about 70 more Jacobites were killed as a result of this. Cumberland emptied the jails of English prisoners, and replaced them with Jacobite sympathisers. A numbers of the prisoners were taken south to England to stand trial for high treason. Trials took place at Berwick upon Tweed, York and London with many Jacobite prisoners being held in hulks on the Thames or in Tilbury Fort where there is a memorial stone. Executions were conducted on the basis of drawing lots on a ratio of about 1 in 20. In total 3,470 Jacobites supporters and others were taken prisoner in the aftermath of Culloden, with 120 of them being executed and 88 dying in prison; 936 transported to the colonies and 222 more "banished". While many were eventually released, the fate of nearly 700 is unknown. As well as dealing out summary justice to his captives Cumberland was equally ruthless, executing 36 deserters from his own forces found amongst the prisoners.

By contrast to the ruthless treatment of many captured clansmen, the detachments of Irish soldiers from the French army were permitted to formally surrender and were treated well and eventually returned to France. They were considered as regular soldiers of a foreign ruler and accordingly subject to the normal practices of warfare. The captured Jacobites were regarded as traitors (even if many had had no choice but to follow their clan leaders) and treated accordingly.

The Hanoverian forces' assault on the Jacobite sympathizers continued in the coming months — destroying the clan system with the Act of Proscription disarming them, banning the kilt and the tartan, the Tenures Abolition Act ending the feudal bond of military service and the Heritable Jurisdictions Act removing the virtually sovereign power the chiefs had over their clan. Statute provisions were aimed at proscribing the perceived religion of the Jacobites, Episcopalianism (Catholicism was already banned). Government troops were stationed in the Highlands and built more roads and barracks to better control the region, adding to the Wade roads constructed for ~Major-General George Wade after the 'Fifteen rising, as well a new fortress at Fort George to the east of Inverness. The proscribed clan dress of kilt and tartan was, at least officially, only permitted in the Highland regiments serving in the British Army.

''Order of battle''

''Jacobite Army''
(approximately 5,400 men)

*Army Commander - Prince Charles Edward Stuart 
*FIRST LINE - 3,810 men 
**Right Wing - 1,150 men (Lord George Murray, brother of the Chief of Clan Murray) 
***Atholl Highlanders Regiment - 500 men (William Murray Lord Nairne) 
***Clan Cameron Regiment - 400 men (Donald Cameron of Lochiel, de facto Chief of Clan Cameron) 
***The Appin Regiment - 250 men (Charles Stewart of Ardshiel, uncle to the Chief of Clan Stewart of Appin) 
**Centre - 1,760 men (Lord John Drummond) 
***Frasers of Lovat Regiment - 400 men (Charles Fraser of Inverallochy and Simon Fraser, Master of Lovat) 
***Chattan Confederation Regiment - 350 men (Alexander ~MacGillivray of Dunmaglass, Chief of Clan ~MacGillivray, for Lady Anne Farquharson ~MacIntosh, "Colonel Anne", wife of the Chief of Clan ~MacKintosh, Captain of the Clan Chattan Confederation and daughter of John Farquharson of Invercauld) 
***Clan Farquharson Regiment - 250 men (James Farquharson of Balmoral, "Balmoral the Brave") 
***Clan ~MacLachlan & Clan ~MacLean Regiment - 290 men (Lachlan ~MacLachlan of ~MacLachlan, Chief of Clan ~MacLachlan and aide de camp to the Prince, with Charles ~MacLean of Drimnin as second-in-command) 
***Clan ~MacLeod Unit - 120 men (Malcolm ~MacLeod of Raasay) - attached to Clans ~MacLachlan & ~MacLean Regiment 
***Edinburgh Regiment - 200 men (John Roy Stewart) 
***Clan Chisholm Regiment - 150 men (Roderick Chisholm of Comar, son of the Chief of Clan Chisholm) 
**Left Wing - 900 men (James Drummond, 3rd Duke of Perth, Chief of Clan Drummond) 
***Clan ~MacDonald of Clan Ranald - 200 men (Ranald ~MacDonald of Clan Ranald, "Young Clanranald", son of the Chief of Clan ~MacDonald of Clan Ranald) 
***Clan ~MacDonald of Keppoch Regiment - 200 men (Alexander ~MacDonnell of Keppoch, Chief of Clan ~MacDonnell of Keppoch) 
***Clan ~MacDonnell of Glengarry Regiment - 420 men (Donald ~MacDonell of Lochgarry) 
***Clan Grant of Glenmorriston Unit - 80 men (Alexander Grant of Corrimony) - attached to Clan ~MacDonnell of Glengarry Regiment 
*SECOND LINE - 1,190 men (Lt.Col. Walter Stapleton) 
**Clan Ogilvy Angus Regiment (Lord David Ogilvy, son of the Chief of Clan Ogilvy) 
**1st Clan Gordon Regiment (Lord Lewis Gordon, brother of the Chief of Clan Gordon) 
**2nd Clan Gordon Regiment (John Gordon of Glenbucket) 
**Duke of Perth's Regiment (Unknown) 
**Régiment Écossais Royaux (Lord Louis Drummond) 
**Irish Piquets Regiment (Maj. Summan) 
*THIRD LINE - 400 men 
**Kilmarnock's Regiment (William Boyd, 4th Earl of Kilmarnock, Chief of Clan Boyd) 
**Pitsligo's Regiment (Alexander Baron Forbes of Pitsligo) 
**Régiment Baggot (Unknown) 
**Lord Elcho's Horse (David Wemyss Lord Elcho, son of the Chief of Clan Wemyss) 
**Life Guards (Unknown) 
**~FitzJames's Horse (Sir Jean ~McDonell) 
*ARTILLERY (Unknown) 
**2 x 2pdr cannon 
**3 x 4pdr cannon 
**3 x 6pdr cannon 
//Note 1:// Of the commanding officers listed above:
*Donald Cameron of Lochiel, de facto Chief of Clan Cameron, was wounded and had to be carried from the field; 
*Charles Fraser of Inverallachie was mortally wounded; 
*Alexander ~MacGillivray of Dunmaglass, Chief of Clan ~MacGillivray, was killed, with all but three officers of the Clan Chattan Regiment; 
*Lachlan ~MacLachlan of ~MacLachlan, Chief of Clan ~MacLachlan, was killed, probably by a cannon shot; 
*Charles ~MacLean of Drimnin was killed, with two of his sons; 
*James Drummond, 3rd Duke of Perth and Chief of Clan Drummond, was severely wounded - he was carried from the field, but died on his way to France; 
*Alexander ~MacDonell of Keppoch, Chief of Clan ~MacDonell of Keppoch, was killed. 
Other persons of note on the Jacobite side to be killed at Culloden were:
*William Drummond of Machany, 4th Viscount of Strathallan; 
*Robert Mercer of Aldie, an officer in the Atholl Highlanders Regiment; 
*Gillies Mhor ~MacBean of Dalmagerry, who led the ~MacBeans of the Clan Chattan Regiment. 
//Note 2:// More clans fought (and died) at Culloden than is apparent from this order of battle.

The Atholl Highlanders Regiment (also known as the Atholl Brigade) was mostly made up of members of Clan Murray, Clan Ferguson, Clan Stewart of Atholl, Clan Menzies, and Clan Robertson.

Also, the clan regiments are not quite as easily defined as their names suggest. Note that:
*in the Clan Cameron Regiment there were also members of Clan ~Macfie and Clan ~MacMillan; 
*the Appin Regiment was not only made up of members of Clan Stewart of Appin, but also of Clan ~MacLaren, Clan ~MacColl, Clan ~MacInnes, Clan ~MacIntyre, and Clan Livingstone; 
*the Clan Chattan Regiment was mostly made up of Clan ~MacIntosh, Clan ~MacGillivray, and Clan ~MacBean, but also included members of Clan ~MacKinnon and Clan ~MacTavish, which were not part of the Clan Chattan Confederation; 
*the Clan ~MacDonnell of Keppoch Regiment included, apart from Clan ~MacDonnell of Keppoch, also Clan ~MacDonald of Glencoe (also known as Clan ~MacIan), Clan ~MacGregor, and Clan ~MacIver; 
*Lord Ogilvy's Angus Regiment consisted mainly of members of Clan Ogilvy and Clan Ramsay; 
*the Duke of Perth's Regiment consisted mainly of members of Clan Drummond; 
*Kilmarnock's Regiment consisted mainly of members of Clan Boyd; 
*Pitsligo's Regiment consisted mainly of members of Clan Forbes; 
*and Lord Elcho's Horse consisted mainly of members of Clan Wemyss. 

''British Government Army''
*Army Commander - 'William Duke of Cumberland 
*FIRST LINE - Earl of Abermarle 
**Kerr's Dragoons (protected the left flank, led by Lord Mark Kerr chief of Clan Kerr). 
**Barrell's 4th (King's Own) Regiment of Foot (led by Lord Robert of Clan Kerr). 
**Munro's 37th Regiment of Foot (led by Colonel Dejean) (after 1881 became part of the Royal Hampshire Regiment regiment). 
**Campbell's, 21st Regiment of Foot, (led by 'Charles' chief of Clan Colville). (Today called the Royal Scots Fusiliers). 
**Price's 14th Regiment of Foot. (later the West Yorkshire Regiment (The Prince of Wales's Own)). 
**Cholmondley's 34th (Cumberland) Regiment of Foot. (after 1881 became part of The Border Regiment). 
**The Royal Scots (led by Charles Cathcart of Clan Cathcart and James Sinclair of Clan Sinclair). 
*SECOND LINE - Maj.Gen John Huske 
**Semphill's, 25th Regiment of Foot (led by "Hugh" chief of Clan Sempill and Capt. Campbell), (later named the King's Own Scottish Borderers). 
**Wolfe's 8th Regiment of Foot (Lt. Col James Wolfe) (later called The King’s (Liverpool Regiment)). 
**Bligh's 20th Regiment of Foot (later called The Lancashire Fusiliers). 
**Conway's 48th Regiment of Foot (after 1881 part of The Northamptonshire Regiment). 
**Fleming's 36th (Herefordshire) Regiment of Foot. 
**Howard's 3rd Regiment of Foot (later called Buffs (Royal East Kent Regiment)) 
*THIRD LINE - Brig.Gen Mordaunt 
**Blakeney's 27th Regiment of Foot (from Ireland, later named Royal Inniskilling Fusiliers). 
**Battereau's 62nd Regiment of Foot (later disbanded) 
**Pulteney's 13th Regiment of Foot (later The Somerset Light Infantry). 
**Royal Artillery (led by Captain Cunningham of Clan Cunningham) 
***10 x 3pdr cannon 
**Clan Campbell's Militia (Col. Jack Campbell) 
**Cobham's Dragoons (renamed the 10th Royal Hussars (Prince of Wales's Own) 
**Kingston's Regiment of Horse (later disbanded). 
//Note:// Of the British officers present, one, Lord Robert Kerr, the commander of Barrell's 4th Regiment of Foot, was killed. Colonel Rich who served in Barrell's lost his left hand and was badly cut on his head by a Jacobite swordsman. In addition, a small number of captains and lieutenants received wounds ranging from severe to minor.

//Note 2:// The majority of the casualties sustained by the British were borne by Barrell's 4th Regiment of Foot. Of the 438 men present, 17 were killed and 108 wounded.

__British Casualties__
1st): 0 killed, 4 wounded
3rd): 1 killed, 2 wounded
4th): 17 killed, 108 wounded
8th): 0 killed, 1 wounded
34th): 1 killed, 2 wounded
14th): 1 killed, 9 wounded
48th): 1 killed, 5 wounded
13th): 0 killed, 0 wounded
25th): 1 killed, 13 wounded
21st): 0 killed, 7 wounded
27th): 0 killed, 0 wounded
37th): 14 killed, 69 wounded
36th): 0 killed, 6 wounded
20th): 4 killed, 17 wounded
62nd): 0 killed, 3 wounded

Highland Militia: 6 killed, 4 wounded
Cobham's Dragoons: 1 killed, 0 wounded
Kerr's Dragoons: 3 killed, 3 wounded
Kingston's Dragoons: 0 killed, 1 wounded
~DMarie84 RE: Anything/Everything 18th Century 
10/03/2007 - 07:57 
Here's a list of books I have on my massive research sheet - I have tons of novel ideas, and one of them takes place in America during the Revolution. I don't know where your novel is taking place, but here's some for America and England during that time that may be worth looking into (Amazon has summaries for many of these to give you an idea what it's about):

Daily life in 18th-century England - Kirstin Olsen
English life in the eighteenth century - Roger Hart
The Georgian gentleman - Michael Brander
The pleasures of the imagination : English culture in the eighteenth century - John Brewer
A Visual History of Costume: The Eighteenth Century - Aileen Ribeiro
Fashion in Detail: From the 17th and 18th Centuries - Avril Hart
Tidings from the 18th Century - Beth Gilgan
Costume in Detail: 1730-1930 - Nancy Bradfield
 
nightfalltwen RE: Anything/Everything 18th Century 
10/02/2007 - 23:45
You might have to narrow your request. 

What country are you looking for? 

"Daily Life in 18th Century England" by K. Olsen is a interesting read and one of the many resources I'm using for my historical fiction.

But it doesn't focus on anything in the rest of the world.
 
Elena Greene  RE: Servant Class in 1790s England 

Nov 6, 2007 - 09:07 
I don't know of any websites but there are a number of good print sources you might find at a good library.

THE COMPLETE SERVANT by Samuel and Sarah Adams
THE DOMESTIC SERVANT CLASS IN 18TH CENTURY ENGLAND by J. Jean Hecht
THE COUNTRY HOUSE SERVANT by Pamela Sambrook
THE SERVANTS' HALL by Merlin Waterson

I hope this helps. Happy writing!
head groom at Pendleton Abbey, a greying man in his early fifties, who has known the current lord since the lord was a child.  Does not trade on the long acquaintance, much.
His son [[Thomas|Bottleby, Thomas]], is the village schoolmaster.
The village schoolmaster for Pendleton Abbey.  The son of the head groom, [[Bottleby|Bottleby, Mr.]]
/***
|Name|CalendarPlugin|
|Source|http://www.TiddlyTools.com/#CalendarPlugin|
|Version|0.0.0|
|Author|SteveRumsby|
|License|unknown|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|monthly and yearly calendars|

// // updated by Jeremy Sheeley to add cacheing for reminders
// // see http://www.geocities.com/allredfaq/reminderMacros.html
// // ''Changes by ELS 2006.08.23:''
// // added handling for weeknumbers (code supplied by Martin Budden.  see "wn**" comment marks)
// // ''Changes by ELS 2005.10.30:''
// // config.macros.calendar.handler()
// // ^^use "tbody" element for IE compatibility^^
// // ^^IE returns 2005 for current year, FF returns 105... fix year adjustment accordingly^^
// // createCalendarDays()
// // ^^use showDate() function (if defined) to render autostyled date with linked popup^^
// // calendar stylesheet definition
// // ^^use .calendar class-specific selectors, add text centering and margin settings^^


!!!!!Configuration:
<<option chkDisplayWeekNumbers>> Display week numbers //(note: Monday will be used as the start of the week)//
|''First day of week:''|<<option txtCalFirstDay>>|(Monday = 0, Sunday = 6)|
|''First day of weekend:''|<<option txtCalStartOfWeekend>>|(Monday = 0, Sunday = 6)|

!!!!!Syntax:
|{{{<<calendar>>}}}|Produce a full-year calendar for the current year|
|{{{<<calendar year>>}}}|Produce a full-year calendar for the given year|
|{{{<<calendar year month>>}}}|Produce a one-month calendar for the given month and year|
|{{{<<calendar thismonth>>}}}|Produce a one-month calendar for the current month|
|{{{<<calendar lastmonth>>}}}|Produce a one-month calendar for last month|
|{{{<<calendar nextmonth>>}}}|Produce a one-month calendar for next month|

***/
// //Modify this section to change the text displayed for the month and day names, to a different language for example. You can also change the format of the tiddler names linked to from each date, and the colours used.

//{{{
config.macros.calendar = {};

config.macros.calendar.monthnames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
config.macros.calendar.daynames = ["M", "T", "W", "T", "F", "S", "S"];

config.macros.calendar.weekendbg = "#c0c0c0";
config.macros.calendar.monthbg = "#e0e0e0";
config.macros.calendar.holidaybg = "#ffc0c0";

//}}}
// //''Code section:''
// (you should not need to alter anything below here)//
//{{{
if(config.options.txtCalFirstDay == undefined)
  config.options.txtCalFirstDay = 0;
if(config.options.txtCalStartOfWeekend == undefined)
  config.options.txtCalStartOfWeekend = 5;
if(config.options.chkDisplayWeekNumbers == undefined)//wn**
  config.options.chkDisplayWeekNumbers = false;
if(config.options.chkDisplayWeekNumbers)
  config.options.txtCalFirstDay = 0;

config.macros.calendar.tiddlerformat = "0DD/0MM/YYYY";  // This used to be changeable - for now, it isn't// <<smiley :-(>> 

version.extensions.calendar = { major: 0, minor: 6, revision: 0, date: new Date(2006, 1, 22)};
config.macros.calendar.monthdays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

config.macros.calendar.holidays = [ ]; // Not sure this is required anymore - use reminders instead
//}}}

// //Is the given date a holiday?
//{{{
function calendarIsHoliday(date)
{
 var longHoliday = date.formatString("0DD/0MM/YYYY");
 var shortHoliday = date.formatString("0DD/0MM");

 for(var i = 0; i < config.macros.calendar.holidays.length; i++) {
   if(config.macros.calendar.holidays[i] == longHoliday || config.macros.calendar.holidays[i] == shortHoliday) {
     return true;
   }
 }
 return false;
}
//}}}

// //The main entry point - the macro handler.
// //Decide what sort of calendar we are creating (month or year, and which month or year)
// // Create the main calendar container and pass that to sub-ordinate functions to create the structure.
// ELS 2005.10.30: added creation and use of "tbody" for IE compatibility and fixup for year >1900//
// ELS 2005.10.30: fix year calculation for IE's getYear() function (which returns '2005' instead of '105')//
// ELS 2006.05.29: add journalDateFmt handling//
//{{{
config.macros.calendar.handler = function(place,macroName,params)
{
   var calendar = createTiddlyElement(place, "table", null, "calendar", null);
   var tbody = createTiddlyElement(calendar, "tbody", null, null, null);
   var today = new Date();
   var year = today.getYear();
   if (year<1900) year+=1900;
 
   // get format for journal link by reading from SideBarOptions (ELS 5/29/06 - based on suggestion by Martin Budden)
   var text = store.getTiddlerText("SideBarOptions");
   this.journalDateFmt = "DD-MMM-YYYY";
   var re = new RegExp("<<(?:newJournal)([^>]*)>>","mg"); var fm = re.exec(text);
   if (fm && fm[1]!=null) { var pa=fm[1].readMacroParams(); if (pa[0]) this.journalDateFmt = pa[0]; }

   if (params[0] == "thismonth")
  {
      cacheReminders(new Date(year, today.getMonth(), 1, 0, 0), 31);
      createCalendarOneMonth(tbody, year, today.getMonth());
  } 
  else if (params[0] == "lastmonth") {
      var month = today.getMonth()-1; if (month==-1) { month=11; year--; }
      cacheReminders(new Date(year, month, 1, 0, 0), 31);
      createCalendarOneMonth(tbody, year, month);
   }
   else if (params[0] == "nextmonth") {
      var month = today.getMonth()+1; if (month>11) { month=0; year++; }
      cacheReminders(new Date(year, month, 1, 0, 0), 31);
      createCalendarOneMonth(tbody, year, month);
   }
   else {
      if (params[0]) year = params[0];
      if(params[1])
      {
         cacheReminders(new Date(year, params[1]-1, 1, 0, 0), 31);
         createCalendarOneMonth(tbody, year, params[1]-1);
      }
      else
      {
         cacheReminders(new Date(year, 0, 1, 0, 0), 366);
         createCalendarYear(tbody, year);
      }
   }
  window.reminderCacheForCalendar = null;
}
//}}}
//{{{
//This global variable is used to store reminders that have been cached
//while the calendar is being rendered.  It will be renulled after the calendar is fully rendered.
window.reminderCacheForCalendar = null;
//}}}
//{{{
function cacheReminders(date, leadtime)
{
  if (window.findTiddlersWithReminders == null)
    return;
  window.reminderCacheForCalendar = {};
  var leadtimeHash = [];
  leadtimeHash [0] = 0;
  leadtimeHash [1] = leadtime;
  var t = findTiddlersWithReminders(date, leadtimeHash, null, 1);
  for(var i = 0; i < t.length; i++) {
    //just tag it in the cache, so that when we're drawing days, we can bold this one.
     window.reminderCacheForCalendar[t[i]["matchedDate"]] = "reminder:" + t[i]["params"]["title"]; 
  }
}
//}}}
//{{{
function createCalendarOneMonth(calendar, year, mon)
{
  var row = createTiddlyElement(calendar, "tr", null, null, null);
  createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon] + " " + year, true, year, mon);
  row = createTiddlyElement(calendar, "tr", null, null, null);
  createCalendarDayHeader(row, 1);
  createCalendarDayRowsSingle(calendar, year, mon);
}
//}}}

//{{{
function createCalendarMonth(calendar, year, mon)
{
  var row = createTiddlyElement(calendar, "tr", null, null, null);
  createCalendarMonthHeader(calendar, row, config.macros.calendar.monthnames[mon] + " " + year, false, year, mon);
  row = createTiddlyElement(calendar, "tr", null, null, null);
  createCalendarDayHeader(row, 1);
  createCalendarDayRowsSingle(calendar, year, mon);
}
//}}}

//{{{
function createCalendarYear(calendar, year)
{
  var row;
  row = createTiddlyElement(calendar, "tr", null, null, null);
  var back = createTiddlyElement(row, "td", null, null, null);
  var backHandler = function() {
      removeChildren(calendar);
      createCalendarYear(calendar, year-1);
    };
  createTiddlyButton(back, "<", "Previous year", backHandler);
  back.align = "center";

  var yearHeader = createTiddlyElement(row, "td", null, "calendarYear", year);
  yearHeader.align = "center";
  //yearHeader.setAttribute("colSpan", 19);
  yearHeader.setAttribute("colSpan",config.options.chkDisplayWeekNumbers?22:19);//wn**

  var fwd = createTiddlyElement(row, "td", null, null, null);
  var fwdHandler = function() {
    removeChildren(calendar);
    createCalendarYear(calendar, year+1);
  };
  createTiddlyButton(fwd, ">", "Next year", fwdHandler);
  fwd.align = "center";

  createCalendarMonthRow(calendar, year, 0);
  createCalendarMonthRow(calendar, year, 3);
  createCalendarMonthRow(calendar, year, 6);
  createCalendarMonthRow(calendar, year, 9);
}
//}}}

//{{{
function createCalendarMonthRow(cal, year, mon)
{
  var row = createTiddlyElement(cal, "tr", null, null, null);
  createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon], false, year, mon);
  createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+1], false, year, mon);
  createCalendarMonthHeader(cal, row, config.macros.calendar.monthnames[mon+2], false, year, mon);
  row = createTiddlyElement(cal, "tr", null, null, null);
  createCalendarDayHeader(row, 3);
  createCalendarDayRows(cal, year, mon);
}
//}}}

//{{{
function createCalendarMonthHeader(cal, row, name, nav, year, mon)
{
  var month;
  if(nav) {
    var back = createTiddlyElement(row, "td", null, null, null);
    back.align = "center";
    back.style.background = config.macros.calendar.monthbg;

/*
    back.setAttribute("colSpan", 2);

    var backYearHandler = function() {
      var newyear = year-1;
      removeChildren(cal);
      cacheReminders(new Date(newyear, mon , 1, 0, 0), 31);
      createCalendarOneMonth(cal, newyear, mon);
    };
    createTiddlyButton(back, "<<", "Previous year", backYearHandler);
*/
    var backMonHandler = function() {
      var newyear = year;
      var newmon = mon-1;
      if(newmon == -1) { newmon = 11; newyear = newyear-1;}
      removeChildren(cal);
      cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);
      createCalendarOneMonth(cal, newyear, newmon);
    };
    createTiddlyButton(back, "<", "Previous month", backMonHandler);


    month = createTiddlyElement(row, "td", null, "calendarMonthname", name)
//    month.setAttribute("colSpan", 3);
//    month.setAttribute("colSpan", 5);
    month.setAttribute("colSpan", config.options.chkDisplayWeekNumbers?6:5);//wn**

    var fwd = createTiddlyElement(row, "td", null, null, null);
    fwd.align = "center";
    fwd.style.background = config.macros.calendar.monthbg; 

//    fwd.setAttribute("colSpan", 2);
    var fwdMonHandler = function() {
      var newyear = year;
      var newmon = mon+1;
      if(newmon == 12) { newmon = 0; newyear = newyear+1;}
      removeChildren(cal);
      cacheReminders(new Date(newyear, newmon , 1, 0, 0), 31);
      createCalendarOneMonth(cal, newyear, newmon);
    };
    createTiddlyButton(fwd, ">", "Next month", fwdMonHandler);
/*
    var fwdYear = createTiddlyElement(row, "td", null, null, null);
    var fwdYearHandler = function() {
      var newyear = year+1;
      removeChildren(cal);
      cacheReminders(new Date(newyear, mon , 1, 0, 0), 31);
      createCalendarOneMonth(cal, newyear, mon);
    };
    createTiddlyButton(fwd, ">>", "Next year", fwdYearHandler);
*/
  } else {
    month = createTiddlyElement(row, "td", null, "calendarMonthname", name)
    //month.setAttribute("colSpan", 7);
    month.setAttribute("colSpan",config.options.chkDisplayWeekNumbers?8:7);//wn**
  }
  month.align = "center";
  month.style.background = config.macros.calendar.monthbg;
}
//}}}

//{{{
function createCalendarDayHeader(row, num)
{
  var cell;
  for(var i = 0; i < num; i++) {
    if (config.options.chkDisplayWeekNumbers) createTiddlyElement(row, "td");//wn**
    for(var j = 0; j < 7; j++) {
      var d = j + (config.options.txtCalFirstDay - 0);
      if(d > 6) d = d - 7;
      cell = createTiddlyElement(row, "td", null, null, config.macros.calendar.daynames[d]);
      if(d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))
        cell.style.background = config.macros.calendar.weekendbg;
    }
  }
}
//}}}

//{{{
function createCalendarDays(row, col, first, max, year, mon)
{
  var i;
  if (config.options.chkDisplayWeekNumbers){
    if (first<=max) {
      var ww = new Date(year,mon,first);
      createTiddlyElement(row, "td", null, null, "w"+ww.getWeek());//wn**
    }
    else createTiddlyElement(row, "td", null, null, null);//wn**
  }
  for(i = 0; i < col; i++) {
    createTiddlyElement(row, "td", null, null, null);
  }
  var day = first;
  for(i = col; i < 7; i++) {
    var d = i + (config.options.txtCalFirstDay - 0);
    if(d > 6) d = d - 7;
    var daycell = createTiddlyElement(row, "td", null, null, null);
    var isaWeekend = ((d == (config.options.txtCalStartOfWeekend-0) || d == (config.options.txtCalStartOfWeekend-0+1))? true:false);

    if(day > 0 && day <= max) {
      var celldate = new Date(year, mon, day);
      // ELS 2005.10.30: use <<date>> macro's showDate() function to create popup
      if (window.showDate) {
        showDate(daycell,celldate,"popup","DD",config.macros.calendar.journalDateFmt,true, isaWeekend); // ELS 5/29/06 - use journalDateFmt 
      } else {
        if(isaWeekend) daycell.style.background = config.macros.calendar.weekendbg;
        var title = celldate.formatString(config.macros.calendar.tiddlerformat);
        if(calendarIsHoliday(celldate)) {
          daycell.style.background = config.macros.calendar.holidaybg;
        }
        if(window.findTiddlersWithReminders == null) {
          var link = createTiddlyLink(daycell, title, false);
          link.appendChild(document.createTextNode(day));
        } else {
          var button = createTiddlyButton(daycell, day, title, onClickCalendarDate);
        }
      }
    }
    day++;
  }
}
//}}}

// //We've clicked on a day in a calendar - create a suitable pop-up of options.
// //The pop-up should contain:
// // * a link to create a new entry for that date
// // * a link to create a new reminder for that date
// // * an <hr>
// // * the list of reminders for that date
//{{{
function onClickCalendarDate(e)
{
  var button = this;
  var date = button.getAttribute("title");
  var dat = new Date(date.substr(6,4), date.substr(3,2)-1, date.substr(0, 2));

  date = dat.formatString(config.macros.calendar.tiddlerformat);
  var popup = createTiddlerPopup(this);
  popup.appendChild(document.createTextNode(date));
  var newReminder = function() {
    var t = store.getTiddlers(date);
    displayTiddler(null, date, 2, null, null, false, false);
    if(t) {
      document.getElementById("editorBody" + date).value += "\n<<reminder day:" + dat.getDate() +
                                                                                         " month:" + (dat.getMonth()+1) +
                                                                                         " year:" + (dat.getYear()+1900) + " title: >>";
    } else {
      document.getElementById("editorBody" + date).value = "<<reminder day:" + dat.getDate() +
                                                                                       " month:" + (dat.getMonth()+1) +
                                                                                       " year:" + (dat.getYear()+1900) + " title: >>";
    }
  };
  var link = createTiddlyButton(popup, "New reminder", null, newReminder); 
  popup.appendChild(document.createElement("hr"));

  var t = findTiddlersWithReminders(dat, [0,14], null, 1);
  for(var i = 0; i < t.length; i++) {
    link = createTiddlyLink(popup, t[i].tiddler, false);
    link.appendChild(document.createTextNode(t[i].tiddler));
  }
}
//}}}

//{{{
function calendarMaxDays(year, mon)
{
 var max = config.macros.calendar.monthdays[mon];
 if(mon == 1 && (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0)) {
 max++;
 }
 return max;
}
//}}}

//{{{
function createCalendarDayRows(cal, year, mon)
{
 var row = createTiddlyElement(cal, "tr", null, null, null);

 var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
 if(first1 < 0) first1 = first1 + 7;
 var day1 = -first1 + 1;
 var first2 = (new Date(year, mon+1, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
 if(first2 < 0) first2 = first2 + 7;
 var day2 = -first2 + 1;
 var first3 = (new Date(year, mon+2, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
 if(first3 < 0) first3 = first3 + 7;
 var day3 = -first3 + 1;

 var max1 = calendarMaxDays(year, mon);
 var max2 = calendarMaxDays(year, mon+1);
 var max3 = calendarMaxDays(year, mon+2);

 while(day1 <= max1 || day2 <= max2 || day3 <= max3) {
 row = createTiddlyElement(cal, "tr", null, null, null);
 createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;
 createCalendarDays(row, 0, day2, max2, year, mon+1); day2 += 7;
 createCalendarDays(row, 0, day3, max3, year, mon+2); day3 += 7;
 }
}
//}}}

//{{{
function createCalendarDayRowsSingle(cal, year, mon)
{
 var row = createTiddlyElement(cal, "tr", null, null, null);

 var first1 = (new Date(year, mon, 1)).getDay() -1 - (config.options.txtCalFirstDay-0);
 if(first1 < 0) first1 = first1+ 7;
 var day1 = -first1 + 1;
 var max1 = calendarMaxDays(year, mon);

 while(day1 <= max1) {
 row = createTiddlyElement(cal, "tr", null, null, null);
 createCalendarDays(row, 0, day1, max1, year, mon); day1 += 7;
 }
}
//}}}

// //ELS 2005.10.30: added styles
//{{{
setStylesheet(".calendar, .calendar table, .calendar th, .calendar tr, .calendar td { text-align:center; } .calendar, .calendar a { margin:0px !important; padding:0px !important; }", "calendarStyles");
//}}}
CAXTON, 3 m. distant, Croxton Park, Sir //George Williams Leeds//, Bart.
49 miles from London, from Shoreditch Church
posting houses the Crown and the George
/***
|Name|CheckboxPlugin|
|Source|http://www.TiddlyTools.com/#CheckboxPlugin|
|Version|2.2.4|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Add checkboxes to your tiddler content|
This plugin extends the TiddlyWiki syntax to allow definition of checkboxes that can be embedded directly in tiddler content.  Checkbox states are preserved by either:
* automatically modifying the tiddler content (deprecated)
* or, by setting/removing tags on specified tiddlers,
* or, by setting custom field values on specified tiddlers,
* or, by saving to a locally-stored cookie ID.
When an ID is assigned to the checkbox, it enables direct programmatic access to the checkbox DOM element, as well as creating an entry in TiddlyWiki's config.options[ID] internal data.  In addition to tracking the checkbox state, you can also specify custom javascript for programmatic initialization and onClick event handling for any checkbox, so you can provide specialized side-effects in response to state changes.
!!!!! Inline wiki-syntax usage
<<<
//{{{
[ ]or[_] and [x]or[X]
//}}}
Simple checkboxes using 'Inline X' storage.  The current unchecked/checked state is indicated by the character between the {{{[}}} and {{{]}}} brackets ("_" means unchecked, "X" means checked).  When you click on a checkbox, the current state is retained by directly modifying the tiddler content to place the corresponding "_" or "X" character in between the brackets.
>//''NOTE: 'Inline X' syntax has been deprecated...''  This storage format only works properly for checkboxes that are directly embedded and accessed from content in a single tiddler.  However, if that tiddler is 'transcluded' into another (by using the {{{<<tiddler TiddlerName>>}}} macro), the 'Inline X' will be ''erroneously stored in the containing tiddler's source content, resulting in corrupted content in that tiddler.''  For anything but the most simple of "to do list" uses, you should select from the various alternative storage methods described below...//
//{{{
[x=id]
//}}}
Assign an optional ID to the checkbox so you can use {{{document.getElementByID("id")}}} to manipulate the checkbox DOM element, as well as tracking the current checkbox state in {{{config.options["id"]}}}.  If the ID starts with "chk" the checkbox state will also be saved in a cookie, so it can be automatically restored whenever the checkbox is re-rendered (overrides any default {{{[x]}}} or {{{[_]}}} value).  If a cookie value is kept, the "_" or "X" character in the tiddler content remains unchanged, and is only applied as the default when a cookie-based value is not currently defined.
//{{{
[x(title|tag)] or [x(title:tag)]
//}}}
Initializes and tracks the current checkbox state by setting or removing a particular tag value from a specified tiddler.  If you omit the tiddler title (and the | or : separator), the specified tag is assigned to the current tiddler.  If you omit the tag value, as in {{{(title|)}}}, the default tag, {{{checked}}}, is assumed.  Omitting both the title and tag, {{{()}}}, tracks the checkbox state by setting the "checked" tag on the current tiddler.  When tag tracking is used, the "_" or "X" character in the tiddler content remains unchanged, and is not used to set or track the checkbox state.  If a tiddler title named in the tag does not exist, the checkbox state defaults to the "inline X" value.  If this value is //checked//, or is subsequently changed to //checked//, it will automatically create the missing tiddler and then add the tag to it.  //''NOTE: beginning with version 2.1.2 of this plugin, the "|" separator is the preferred separator between the title and tag name, as it avoids syntactic ambiguity when ":" is used within tiddler titles or tag names.''//
//{{{
[x(field@tiddler)]
//}}}
Initializes and tracks the current checkbox state by setting a particular custom field value from a specified tiddler.  If you omit the tiddler title (but not the "@" separator), the specified field on the current tiddler is used.  If you omit the field name, as in {{{(@tiddler)}}}, a default fieldname of {{{checked}}} is assumed.  Omitting both the field and the tiddler title, {{{(@)}}}, defaults to setting the "checked" field on the current tiddler.  When field tracking is used, the "_" or "X" character in the tiddler content remains unchanged, and is not used to set or track the checkbox state.  If the tiddler title named in the parameter does not exist, the checkbox state defaults to the "inline X" value.  If this value is //checked// or is subsequently changed to //checked//, it will automatically create the missing tiddler and then add the field to it.
//{{{
[x{javascript}{javascript}]
//}}}
You can define optional javascript code segments to add custom initialization and/or 'onClick' handling to a checkbox.  The current checkbox state (and it's other DOM attributes) can be set or read from within these code segments by reference to the default context-object, 'this'.

The first code segment will be executed when the checkbox is initially displayed, so that you can programmatically determine it's starting checked/unchecked state.  The second code segment (if present) is executed whenever the checkbox is clicked, so that you can perform programmed responses or intercept and override the checkbox state based on complex logic using the TW core API or custom functions defined in plugins (e.g. testing a particular tiddler title to see if certain tags are set or setting some tags when the checkbox is clicked).

Note: if you want to use the default checkbox initialization processing with a custom onclick function, use this syntax: {{{ [x=id{}{javascript}] }}} 
<<<
!!!!! Macro usage
<<<
In addition to embedded checkboxes using the wiki syntax described above, a ''macro-based syntax'' is also provided, for use in templates where wiki syntax cannot be directly used.  This macro syntax can also be used in tiddler content, as an alternative to the wiki syntax.  When embedded in [[PageTemplate]], [[ViewTemplate]], or [[EditTemplate]] (or custom alternative templates), use the following macro syntax:
//{{{
<span macro="checkbox target checked id onInit onClick"></span>
//}}}
or, when embedded in tiddler content, use the following macro syntax:
//{{{
<<checkbox target checked id onInit onClick>>
//}}}
where:
''target''
>is either a tag reference (e.g., ''tagname|tiddlername'') or a field reference (e.g. ''fieldname@tiddlername''), as described above.
''checked'' (optional)
>is a keyword that sets the initial state of the checkbox to "checked".  When omitted, the default checkbox state is "unchecked".
''id'' (optional)
>specifies an internal config.options.* ID, as described above.  If the ID begins with "chk", a cookie-based persistent value will be created to track the checkbox state in between sessions.
''onInit'' (optional)
>contains a javascript event handler to be performed when the checkbox is initially rendered (see details above).
''onClick'' (optional)
>contains a javascript event handler to be performed each time the checkbox is clicked (see details above).
>//note: to use the default onInit handler with a custom onClick handler, use "" (empty quotes) as a placeholder for the onInit parameter//
<<<
!!!!!Examples
<<<
''checked and unchecked static default ("inline X") values:''
//{{{
[X] label
[_] label
//}}}
>[X] label
>[_] label
''document-based value (id='demo', no cookie):''
//{{{
[_=demo] label
//}}}
>[_=demo] label
''cookie-based value  (id='chkDemo'):''
//{{{
[_=chkDemo] label
//}}}
>[_=chkDemo] label
''tag-based value (TogglyTagging):''
//{{{
[_(CheckboxPlugin|demotag)]
[_(CheckboxPlugin|demotag){this.refresh.tagged=this.refresh.container=false}]
//}}}
>[_(CheckboxPlugin|demotag)] toggle 'demotag' (and refresh tiddler display)
>[_(CheckboxPlugin|demotag){this.refresh.tagged=this.refresh.container=false}] toggle 'demotag' (no refresh)
''field-based values:''
//{{{
[_(demofield@CheckboxPlugin)] demofield@CheckboxPlugin
[_(demofield@)] demofield@ (equivalent to demonfield@ current tiddler)
[_(checked@CheckboxPlugin)] checked@CheckboxPlugin
[_(@CheckboxPlugin)] @CheckboxPlugin
[_(@)] @ (equivalent to checked@ current tiddler)
//}}}
>[_(demofield@CheckboxPlugin)] demofield@CheckboxPlugin
>[_(demofield@)] demofield@ (current tiddler)
>[_(checked@CheckboxPlugin)] checked@CheckboxPlugin
>[_(@CheckboxPlugin)] @CheckboxPlugin
>[_(@)] toggle field: @ (defaults to "checked@here")
>click to view current: <<toolbar fields>>
''custom init and onClick functions:''
//{{{
[X{this.checked=true}{alert(this.checked?"on":"off")}] message box with checkbox state
//}}}
>[X{this.checked=true}{alert(this.checked?"on":"off")}] message box with checkbox state
''retrieving option values:''
>config.options['demo']=<script>return config.options['demo']?"true":"false";</script>
>config.options['chkDemo']=<script>return config.options['chkDemo']?"true":"false";</script>
<<<
!!!!!Configuration
<<<
Normally, when a checkbox state is changed, the affected tiddlers are automatically re-rendered, so that any checkbox-dependent dynamic content can be updated.  There are three possible tiddlers to be re-rendered, depending upon where the checkbox is placed, and what kind of storage method it is using.
*''container'': the tiddler in which the checkbox is displayed. (e.g., this tiddler)
*''tagged'': the tiddler that is being tagged (e.g., "~MyTask" when tagging "~MyTask:done")
*''tagging'': the "tag tiddler" (e.g., "~done" when tagging "~MyTask:done")
You can set the default refresh handling for all checkboxes in your document by using the following javascript syntax either in a systemConfig plugin, or as an inline script.  (Substitute true/false values as desired):
{{{config.checkbox.refresh = { tagged:true, tagging:true, container:true };}}}

You can also override these defaults for any given checkbox by using an initialization function to set one or more of the refresh options.  For example:
{{{[_{this.refresh.container=false}]}}}
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''CheckboxPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
2007.08.06 - 2.2.5 supress automatic refresh of any tiddler that is currently being edited.  Ensures that current tiddler edit sessions are not prematurely discarded (losing any changes).  However, if checkbox changes a tag on a tiddler being edited, update the "tags" input field (if any) so that saving the edited tiddler correctly reflects any changes due to checkbox activity... see refreshEditorTagField().
2007.07.13 - 2.2.4 in handler(), fix srctid reference (was "w.tiddler", should have been "w.tiddler.title").  This fixes broken 'inline X' plus fatal macro error when using PartTiddlerPlugin.  Thanks to cmari for reporting the problem and UdoBorkowski for finding the code error.
2007.06.21 - 2.2.3 suppress automatic refresh of tiddler when using macro-syntax to prevent premature end of tiddler editing session.
2007.06.20 - 2.2.2 fixed handling for 'inline X' when checkboxes are contained in a 'trancluded' tiddler.  Now, regardless of where an inline X checkbox appears, the X will be placed in the originating source tiddler, rather than the tiddler in which the checkbox appears.
2007.06.17 - 2.2.1 Refactored code to add checkbox //macro// syntax for use in templates (e.g., {{{macro="checkbox ..."}}}. Also, code cleanup of existing tag handling.
2007.06.16 - 2.2.0 added support for tracking checkbox states using tiddler fields via "(fieldname@tiddlername)" syntax.
2006.05.04 - 2.1.3 fix use of findContainingTiddler() to check for a non-null return value, so that checkboxes won't crash when used outside of tiddler display context (such as in header, sidebar or mainmenu)
2006.03.11 - 2.1.2 added "|" as delimiter to tag-based storage syntax (e.g. "tiddler|tag") to avoid parsing ambiguity when tiddler titles or tag names contain ":".   Using ":" as a delimiter is still supported but is deprecated in favor of the new "|" usage.  Based on a problem reported by JeffMason.
2006.02.25 - 2.1.0 added configuration options to enable/disable forced refresh of tiddlers when toggling tags
2006.02.23 - 2.0.4 when toggling tags, force refresh of the tiddler containing the checkbox.
2006.02.23 - 2.0.3 when toggling tags, force refresh of the 'tagged tiddler' so that tag-related tiddler content (such as "to-do" lists) can be re-rendered.
2006.02.23 - 2.0.2 when using tag-based storage, allow use [[ and ]] to quote tiddler or tag names that contain spaces:
{{{[x([[Tiddler with spaces]]:[[tag with spaces]])]}}}
2006.01.10 - 2.0.1 when toggling tags, force refresh of the 'tagging tiddler'.  For example, if you toggle the "systemConfig" tag on a plugin, the corresponding "systemConfig" TIDDLER will be automatically refreshed (if currently displayed), so that the 'tagged' list in that tiddler will remain up-to-date.
2006.01.04 - 2.0.0 update for ~TW2.0
2005.12.27 - 1.1.2 Fix lookAhead regExp handling for {{{[x=id]}}}, which had been including the "]" in the extracted ID.  
Added check for "chk" prefix on ID before calling saveOptionCookie()
2005.12.26 - 1.1.2 Corrected use of toUpperCase() in tiddler re-write code when comparing {{{[X]}}} in tiddler content with checkbox state. Fixes a problem where simple checkboxes could be set, but never cleared.
2005.12.26 - 1.1.0 Revise syntax so all optional parameters are included INSIDE the [ and ] brackets.  Backward compatibility with older syntax is supported, so content changes are not required when upgrading to the current version of this plugin.   Based on a suggestion by GeoffSlocock
2005.12.25 - 1.0.0 added support for tracking checkbox state using tags ("TogglyTagging")
Revised version number for official post-beta release.
2005.12.08 - 0.9.3 support separate 'init' and 'onclick' function definitions.
2005.12.08 - 0.9.2 clean up lookahead pattern
2005.12.07 - 0.9.1 only update tiddler source content if checkbox state is actually different.  Eliminates unnecessary tiddler changes (and 'unsaved changes' warnings)
2005.12.07 - 0.9.0 initial BETA release
<<<
!!!!!Credits
<<<
This feature was created by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.CheckboxPlugin = {major: 2, minor: 2, revision:5 , date: new Date(2007,8,6)};
//}}}

//{{{
config.checkbox = { refresh: { tagged:true, tagging:true, container:true } };
config.formatters.push( {
	name: "checkbox",
	match: "\\[[xX_ ][\\]\\=\\(\\{]",
	lookahead: "\\[([xX_ ])(=[^\\s\\(\\]{]+)?(\\([^\\)]*\\))?({[^}]*})?({[^}]*})?\\]",
	handler: function(w) {
		var lookaheadRegExp = new RegExp(this.lookahead,"mg");
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source)
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			// get params
			var checked=(lookaheadMatch[1].toUpperCase()=="X");
			var id=lookaheadMatch[2];
			var target=lookaheadMatch[3];
			if (target) target=target.substr(1,target.length-2).trim(); // trim off parentheses
			var fn_init=lookaheadMatch[4];
			var fn_click=lookaheadMatch[5];
			var tid=story.findContainingTiddler(w.output);  if (tid) tid=tid.getAttribute("tiddler");
			var srctid=w.tiddler?w.tiddler.title:null;
			config.macros.checkbox.create(w.output,tid,srctid,w.matchStart+1,checked,id,target,config.checkbox.refresh,fn_init,fn_click);
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
	}
} );
config.macros.checkbox = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!(tiddler instanceof Tiddler)) { // if no tiddler passed in try to find one
			var here=story.findContainingTiddler(place);
			if (here) tiddler=store.getTiddler(here.getAttribute("tiddler"))
		}
		var srcpos=0; // "inline X" not applicable to macro syntax
		var target=params.shift(); if (!target) target="";
		var defaultState=params[0]=="checked"; if (defaultState) params.shift();
		var id=params.shift(); if (id && !id.length) id=null;
		var fn_init=params.shift(); if (fn_init && !fn_init.length) fn_init=null;
		var fn_click=params.shift(); if (fn_click && !fn_click.length) fn_click=null;
		var refresh={ tagged:true, tagging:true, container:false };
		this.create(place,tiddler.title,tiddler.title,0,defaultState,id,target,refresh,fn_init,fn_click);
	},
	create: function(place,tid,srctid,srcpos,defaultState,id,target,refresh,fn_init,fn_click) {
		// create checkbox element
		var c = document.createElement("input");
		c.setAttribute("type","checkbox");
		c.onclick=this.onClickCheckbox;
		c.srctid=srctid; // remember source tiddler
		c.srcpos=srcpos; // remember location of "X"
		c.container=tid; // containing tiddler (may be null if not in a tiddler)
		c.tiddler=tid; // default target tiddler 
		c.refresh = {};
		c.refresh.container = refresh.container;
		c.refresh.tagged = refresh.tagged;
		c.refresh.tagging = refresh.tagging;
		place.appendChild(c);
		// set default state
		c.checked=defaultState;
		// track state in config.options.ID
		if (id) {
			c.id=id.substr(1); // trim off leading "="
			if (config.options[c.id]!=undefined)
				c.checked=config.options[c.id];
			else
				config.options[c.id]=c.checked;
		}
		// track state in (tiddlername|tagname) or (fieldname@tiddlername)
		if (target) {
			var pos=target.indexOf("@");
			if (pos!=-1) {
				c.field=pos?target.substr(0,pos):"checked"; // get fieldname (or use default "checked")
				c.tiddler=target.substr(pos+1); // get specified tiddler name (if any)
				if (!c.tiddler || !c.tiddler.length) c.tiddler=tid; // if tiddler not specified, default == container
				if (store.getValue(c.tiddler,c.field)!=undefined)
					c.checked=(store.getValue(c.tiddler,c.field)=="true"); // set checkbox from saved state
			} else {
				var pos=target.indexOf("|"); if (pos==-1) var pos=target.indexOf(":");
				c.tag=target;
				if (pos==0) c.tag=target.substr(1); // trim leading "|" or ":"
				if (pos>0) { c.tiddler=target.substr(0,pos); c.tag=target.substr(pos+1); }
				if (!c.tag.length) c.tag="checked";
				var t=store.getTiddler(c.tiddler);
				if (t && t.tags)
					c.checked=t.isTagged(c.tag); // set checkbox from saved state
			}
		}
		if (fn_init) c.fn_init=fn_init.trim().substr(1,fn_init.length-2); // trim off surrounding { and } delimiters
		if (fn_click) c.fn_click=fn_click.trim().substr(1,fn_click.length-2);
		c.init=true; c.onclick(); c.init=false; // compute initial state and save in tiddler/config/cookie
	},
	onClickCheckbox: function(event) {
		if (this.fn_init)
			// custom function hook to set initial state (run only once)
			{ try { eval(this.fn_init); this.fn_init=null; } catch(e) { displayMessage("Checkbox init error: "+e.toString()); } }
		else if (this.fn_click)
			// custom function hook to override or react to changes in checkbox state
			{ try { eval(this.fn_click) } catch(e) { displayMessage("Checkbox click error: "+e.toString()); } }
		if (this.id)
			// save state in config AND cookie (only when ID starts with 'chk')
			{ config.options[this.id]=this.checked; if (this.id.substr(0,3)=="chk") saveOptionCookie(this.id); }
		if (this.srctid && this.srcpos>0 && (!this.id || this.id.substr(0,3)!="chk") && !this.tag && !this.field) {
			// save state in tiddler content only if not using cookie, tag or field tracking
			var t=store.getTiddler(this.srctid); // put X in original source tiddler (if any)
			if (t && this.checked!=(t.text.substr(this.srcpos,1).toUpperCase()=="X")) { // if changed
				t.set(null,t.text.substr(0,this.srcpos)+(this.checked?"X":"_")+t.text.substr(this.srcpos+1),null,null,t.tags);
				if (!story.isDirty(t.title)) story.refreshTiddler(t.title,null,true);
				store.setDirty(true);
			}
		}
		if (this.field) {
			if (this.checked && !store.tiddlerExists(this.tiddler))
				store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
			// set the field value in the target tiddler
			store.setValue(this.tiddler,this.field,this.checked?"true":"false");
			// DEBUG: displayMessage(this.field+"@"+this.tiddler+" is "+this.checked);
		}
		if (this.tag) {
			if (this.checked && !store.tiddlerExists(this.tiddler))
				store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
			var t=store.getTiddler(this.tiddler);
			if (t) {
				var tagged=(t.tags && t.tags.find(this.tag)!=null);
				if (this.checked && !tagged) { t.tags.push(this.tag); store.setDirty(true); }
				if (!this.checked && tagged) { t.tags.splice(t.tags.find(this.tag),1); store.setDirty(true); }
			}
			// if tag state has been changed, update display of corresponding tiddlers (unless they are in edit mode...)
			if (this.checked!=tagged) {
				if (this.refresh.tagged) {
					if (!story.isDirty(this.tiddler)) story.refreshTiddler(this.tiddler,null,true); // the TAGGED tiddler in view mode
					else config.macros.checkbox.refreshEditorTagField(this.tiddler,this.tag,this.checked); // the TAGGED tiddler in edit mode (with tags field)
				}
				if (this.refresh.tagging)
					if (!story.isDirty(this.tag)) story.refreshTiddler(this.tag,null,true); // the TAGGING tiddler
			}
		}
		// refresh containing tiddler (but not during initial rendering, or we get an infinite loop!) (and not when editing container)
		if (!this.init && this.refresh.container && this.container!=this.tiddler)
			if (!story.isDirty(this.container)) story.refreshTiddler(this.container,null,true); // the tiddler CONTAINING the checkbox
		return true;
	},
	refreshEditorTagField: function(title,tag,set) {
		var tagfield=story.getTiddlerField(title,"tags");
		if (!tagfield||tagfield.getAttribute("edit")!="tags") return; // if no tags field in editor (i.e., custom template)
		var tags=tagfield.value.readBracketedList();
		if (tags.contains(tag)==set) return; // if no change needed
		if (set) tags.push(tag); // add tag
		else tags.splice(tags.indexOf(tag),1); // remove tag
		for (var t=0;t<tags.length;t++) tags[t]=String.encodeTiddlyLink(tags[t]);
		tagfield.value=tags.join(" "); // reassemble tag string (with brackets as needed)
		return;
	}
}
//}}}
/***
|Name|DatePlugin|
|Source|http://www.TiddlyTools.com/#DatePlugin|
|Version|2.3.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|formatted dates plus popup menu with 'journal' link, changes and (optional) reminders|

There are quite a few calendar generators, reminders, to-do lists, 'dated tiddlers' journals, blog-makers and GTD-like schedule managers that have been built around TW.  While they all have different purposes, and vary in format, interaction, and style, in one way or another each of these plugins displays and/or uses date-based information to make finding, accessing and managing relevant tiddlers easier.  This plugin provides a general approach to embedding dates and date-based links/menus within tiddler content.

This plugin display formatted dates, for the specified year, month, day using number values or mathematical expressions such as (Y+1) or (D+30).  Optionally, you can create a link from the formatted output to a 'dated tiddler' for quick blogging or create a popup menu that includes the dated tiddler link plus links to changes made on that date as well as links to any pending reminders for the coming 31 days (if the RemindersPlugin is installed).  This plugin also provides a public API for easily incorporating formatted date output (with or without the links/popups) into other plugins, such as calendar generators, etc.
!!!!!Usage
<<<
When installed, this plugin defines a macro: {{{<<date [mode] [date] [format] [linkformat]>>}}}.  All of the macro parameters are optional and, in it's simplest form, {{{<<date>>}}}, it is equivalent to the ~TiddlyWiki core macro, {{{<<today>>}}}.

However, where {{{<<today>>}}} simply inserts the current date/time in a predefined format (or custom format, using {{{<<today [format]>>}}}), the {{{<<date>>}}} macro's parameters take it much further than that:
* [mode] is either ''display'', ''link'' or ''popup''.  If omitted, it defaults to ''display''.  This param let's you select between simply displaying a formatted date, or creating a link to a specific 'date titled' tiddler or a popup menu containing a dated tiddler link, plus links to changes and reminders.
* [date] lets you enter ANY date (not just today) as ''year, month, and day values or simple mathematical expressions'' using pre-defined variables, Y, M, and D for the current year, month and day, repectively.  You can display the modification date of the current tiddler by using the keyword: ''tiddler'' in place of the year, month and day parameters.  Use ''tiddler://name-of-tiddler//'' to display the modification date of a specific tiddler.  You can also use keywords ''today'' or ''filedate'' to refer to these //dynamically changing// date/time values.  
* [format] and [linkformat] uses standard ~TiddlyWiki date formatting syntax.  The default is "YYYY.0MM.0DD"
>^^''DDD'' - day of week in full (eg, "Monday"), ''DD'' - day of month, ''0DD'' - adds leading zero^^
>^^''MMM'' - month in full (eg, "July"), ''MM'' - month number, ''0MM'' - adds leading zero^^
>^^''YYYY'' - full year, ''YY'' - two digit year, ''hh'' - hours, ''mm'' - minutes, ''ss'' - seconds^^
>^^//note: use of hh, mm or ss format codes is only supported with ''tiddler'', ''today'' or ''filedate'' values//^^
* [linkformat] - specify an alternative date format so that the title of a 'dated tiddler' link can have a format that differs from the date's displayed format

In addition to the macro syntax, DatePlugin also provides a public javascript API so that other plugins that work with dates (such as calendar generators, etc.) can quickly incorporate date formatted links or popups into their output:

''{{{showDate(place, date, mode, format, linkformat, autostyle, weekend)}}}'' 

Note that in addition to the parameters provided by the macro interface, the javascript API also supports two optional true/false parameters:
* [autostyle] - when true, the font/background styles of formatted dates are automatically adjusted to show the date's status:  'today' is boxed, 'changes' are bold, 'reminders' are underlined, while weekends and holidays (as well as changes and reminders) can each have a different background color to make them more visibly distinct from each other.
* [weekend] - true indicates a weekend, false indicates a weekday.  When this parameter is omitted, the plugin uses internal defaults to automatically determine when a given date falls on a weekend.
<<<
!!!!!Examples
<<<
The current date: <<date>>
The current time: <<date today "0hh:0mm:0ss">>
Today's blog: <<date link today "DDD, MMM DDth, YYYY">>
Recent blogs/changes/reminders: <<date popup Y M D-1 "yesterday">> <<date popup today "today">> <<date popup Y M D+1 "tomorrow">>
The first day of next month will be a <<date Y M+1 1 "DDD">>
This tiddler (DatePlugin) was last updated on: <<date tiddler "DDD, MMM DDth, YYYY">>
The SiteUrl was last updated on: <<date tiddler:SiteUrl "DDD, MMM DDth, YYYY">>
This document was last saved on <<date filedate "DDD, MMM DDth, YYYY at 0hh:0mm:0ss">>
<<date 2006 07 24 "MMM DDth, YYYY">> will be a <<date 2006 07 24 "DDD">>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''DatePlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.06.20 [2.3.1]'' in onClickDatePopup(), use Popup.show() instead of deprecated ScrollToTiddlerPopup().  Fixes fatal error that prevents popups from being properly displayed
''2007.05.31 [2.3.0]'' list "created" tiddlers in date popup.  Also, force re-cache of created/modified indices when displaying current date and store.isDirty(), so that popup is kept in sync with tiddler changes.
''2006.05.09 [2.2.1]'' added "todaybg" handling to set background color of current date.  Also, honor excludeLists tag when getting lists of tiddlers.  Based on suggestions by Mark Hulme.
''2006.05.05 [2.2.0]'' added "linkedbg" handling to set background color when a 'dated tiddler' exists.  Based on a suggestion by Mark Hulme.
''2006.03.08 [2.1.2]'' add 'override leadtime' flag param in call to findTiddlersWithReminders(), and add "Enter a title" default text to new reminder handler.  Thanks to Jeremy Sheeley for these additional tweaks.
''2006.03.06 [2.1.0]'' hasReminders() nows uses window.reminderCacheForCalendar[] when present.  If calendar cache is not present, indexReminders() now uses findTiddlersWithReminders() with a 90-day look ahead to check for reminders.  Also, switched default background colors for autostyled dates: reminders are now greenish ("c0ffee") and holidays are now reddish ("ffaace").
''2006.02.14 [2.0.5]'' when readOnly is set (by TW core), omit "new reminders..." popup menu item and, if a "dated tiddler" does not already exist, display the date as simple text instead of a link.
''2006.02.05 [2.0.4]'' added var to variables that were unintentionally global.  Avoids FireFox 1.5.0.1 crash bug when referencing global variables
''2006.01.18 [2.0.3]'' In 1.2.x the tiddler editor's text area control was given an element ID=("tiddlerBody"+title), so that it was easy to locate this field and programmatically modify its content.  With the addition of configuration templates in 2.x, the textarea no longer has an ID assigned.  To find this control we now look through all the child nodes of the tiddler editor to locate a "textarea" control where attribute("edit") equals "text", and then append the new reminder to the contents of that control.
''2006.01.11 [2.0.2]'' correct 'weekend' override detection logic in showDate()
''2006.01.10 [2.0.1]'' allow custom-defined weekend days (default defined in config.macros.date.weekend[] array)
added flag param to showDate() API to override internal weekend[] array
''2005.12.27 [2.0.0]'' Update for TW2.0
Added parameter handling for 'linkformat'
''2005.12.21 [1.2.2]'' FF's date.getYear() function returns 105 (for the current year, 2005).  When calculating a date value from Y M and D expressions, the plugin adds 1900 to the returned year value get the current year number.  But IE's date.getYear() already returns 2005.  As a result, plugin calculated date values on IE were incorrect (e.g., 3905 instead of 2005).  Adding +1900 is now conditional so the values will be correct on both browsers.
''2005.11.07 [1.2.1]'' added support for "tiddler" dynamic date parameter
''2005.11.06 [1.2.0]'' added support for "tiddler:title" dynamic date parameter
''2005.11.03 [1.1.2]'' when a reminder doesn't have a specified title parameter, use the title of the tiddler that contains the reminder as "fallback" text in the popup menu.  Based on a suggestion from BenjaminKudria.
''2005.11.03 [1.1.1]'' Temporarily bypass hasReminders() logic to avoid excessive overhead from generating the indexReminders() cache.  While reminders can still appear in the popup menu, they just won't be indicated by auto-styling the date number that is displayed.  This single change saves approx. 60% overhead (5 second delay reduced to under 2 seconds).
''2005.11.01 [1.1.0]'' corrected logic in hasModifieds() and hasReminders() so caching of indexed modifieds and reminders is done just once, as intended.  This should hopefully speed up calendar generators and other plugins that render multiple dates...
''2005.10.31 [1.0.1]'' documentation and code cleanup
''2005.10.31 [1.0.0]'' initial public release
''2005.10.30 [0.9.0]'' pre-release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].
<<<
!!!!!Code
***/
//{{{
version.extensions.date = {major: 2, minor: 3, revision: 1, date: new Date(2007,6,20)};
//}}}

//{{{
config.macros.date = {
	format: "YYYY.0MM.0DD", // default date display format
	linkformat: "YYYY.0MM.0DD", // 'dated tiddler' link format
	linkedbg: "#babb1e", // "babble"
	todaybg: "#ffab1e", // "fable"
	weekendbg: "#c0c0c0", // "cocoa"
	holidaybg: "#ffaace", // "face"
	createdbg: "#bbeeff", // "beef"
	modifiedsbg: "#bbeeff", // "beef"
	remindersbg: "#c0ffee", // "coffee"
	holidays: [ "01/01", "07/04", "07/24", "11/24" ], // NewYearsDay, IndependenceDay(US), Eric's Birthday (hooray!), Thanksgiving(US)
	weekend: [ 1,0,0,0,0,0,1 ] // [ day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6 ]
};
//}}}

//{{{
config.macros.date.handler = function(place,macroName,params)
{
	// do we want to see a link, a popup, or just a formatted date?
	var mode="display";
	if (params[0]=="display") { mode=params[0]; params.shift(); }
	if (params[0]=="popup") { mode=params[0]; params.shift(); }
	if (params[0]=="link") { mode=params[0]; params.shift(); }
	// get the date
	var now = new Date();
	var date = now;
	if (!params[0] || params[0]=="today")
		{ params.shift(); }
	else if (params[0]=="filedate")
		{ date=new Date(document.lastModified); params.shift(); }
	else if (params[0]=="tiddler")
		{ date=store.getTiddler(story.findContainingTiddler(place).id.substr(7)).modified; params.shift(); }
	else if (params[0].substr(0,8)=="tiddler:")
		{ var t; if ((t=store.getTiddler(params[0].substr(8)))) date=t.modified; params.shift(); }
	else {
		var y = eval(params.shift().replace(/Y/ig,(now.getYear()<1900)?now.getYear()+1900:now.getYear()));
		var m = eval(params.shift().replace(/M/ig,now.getMonth()+1));
		var d = eval(params.shift().replace(/D/ig,now.getDate()+0));
		date = new Date(y,m-1,d);
	}
	// date format with optional custom override
	var format=this.format; if (params[0]) format=params.shift();
	var linkformat=this.linkformat; if (params[0]) linkformat=params.shift();
	showDate(place,date,mode,format,linkformat);
}
//}}}

//{{{
window.showDate=showDate;
function showDate(place,date,mode,format,linkformat,autostyle,weekend)
{
	if (!mode) mode="display";
	if (!format) format=config.macros.date.format;
	if (!linkformat) linkformat=config.macros.date.linkformat;
	if (!autostyle) autostyle=false;

	// format the date output
	var title = date.formatString(format);
	var linkto = date.formatString(linkformat);

	// just show the formatted output
	if (mode=="display") { place.appendChild(document.createTextNode(title)); return; }

	// link to a 'dated tiddler'
	var link = createTiddlyLink(place, linkto, false);
	link.appendChild(document.createTextNode(title));
	link.title = linkto;
	link.date = date;
	link.format = format;
	link.linkformat = linkformat;

	// if using a popup menu, replace click handler for dated tiddler link
	// with handler for popup and make link text non-italic (i.e., an 'existing link' look)
	if (mode=="popup") {
		link.onclick = onClickDatePopup;
		link.style.fontStyle="normal";
	}

	// format the popup link to show what kind of info it contains (for use with calendar generators)
	if (!autostyle) return;
	if (hasModifieds(date)||hasCreateds(date))
		{ link.style.fontStyle="normal"; link.style.fontWeight="bold"; }
	if (hasReminders(date))
		{ link.style.textDecoration="underline"; }
	if(isToday(date))
		{ link.style.border="1px solid black"; }

	if( (weekend!=undefined?weekend:isWeekend(date)) && (config.macros.date.weekendbg!="") )
		{ place.style.background = config.macros.date.weekendbg; }
	if(isHoliday(date)&&(config.macros.date.holidaybg!=""))
		{ place.style.background = config.macros.date.holidaybg; }
	if (hasCreateds(date)&&(config.macros.date.createdbg!=""))
		{ place.style.background = config.macros.date.createdbg; }
	if (hasModifieds(date)&&(config.macros.date.modifiedsbg!=""))
		{ place.style.background = config.macros.date.modifiedsbg; }
	if (store.tiddlerExists(linkto)&&(config.macros.date.linkedbg!=""))
		{ place.style.background = config.macros.date.linkedbg; }
	if (hasReminders(date)&&(config.macros.date.remindersbg!=""))
		{ place.style.background = config.macros.date.remindersbg; }
	if(isToday(date)&&(config.macros.date.todaybg!=""))
		{ place.style.background = config.macros.date.todaybg; }
}
//}}}

//{{{
function isToday(date) // returns true if date is today
	{ var now=new Date(); return ((now-date>=0) && (now-date<86400000)); }

function isWeekend(date) // returns true if date is a weekend
	{ return (config.macros.date.weekend[date.getDay()]); }

function isHoliday(date) // returns true if date is a holiday
{
	var longHoliday = date.formatString("0MM/0DD/YYYY");
	var shortHoliday = date.formatString("0MM/0DD");
	for(var i = 0; i < config.macros.date.holidays.length; i++) {
		var holiday=config.macros.date.holidays[i];
		if (holiday==longHoliday||holiday==shortHoliday) return true;
	}
	return false;
}
//}}}

//{{{
// Event handler for clicking on a day popup
function onClickDatePopup(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	var popup = Popup.create(this);
	if(popup) {
		// always show dated tiddler link (or just date, if readOnly) at the top...
		if (!readOnly || store.tiddlerExists(this.date.formatString(this.linkformat)))
			createTiddlyLink(popup,this.date.formatString(this.linkformat),true);
		else
			createTiddlyText(popup,this.date.formatString(this.linkformat));
		addCreatedsToPopup(popup,this.date,this.format);
		addModifiedsToPopup(popup,this.date,this.format);
		addRemindersToPopup(popup,this.date,this.linkformat);
	}
	Popup.show(popup,false);
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return(false);
}
//}}}

//{{{
function indexCreateds() // build list of tiddlers, hash indexed by creation date
{
	var createds= { };
	var tiddlers = store.getTiddlers("title","excludeLists");
	for (var t = 0; t < tiddlers.length; t++) {
		var date = tiddlers[t].created.formatString("YYYY0MM0DD")
		if (!createds[date])
			createds[date]=new Array();
		createds[date].push(tiddlers[t].title);
	}
	return createds;
}
function hasCreateds(date) // returns true if date has created tiddlers
{
	if (!config.macros.date.createds) config.macros.date.createds=indexCreateds();
	return (config.macros.date.createds[date.formatString("YYYY0MM0DD")]!=undefined);
}

function addCreatedsToPopup(popup,when,format)
{
	var force=(store.isDirty() && when.formatString("YYYY0MM0DD")==new Date().formatString("YYYY0MM0DD"));
	if (force || !config.macros.date.createds) config.macros.date.createds=indexCreateds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var createds = config.macros.date.createds[when.formatString("YYYY0MM0DD")];
	if (createds) {
		createds.sort();
		var e=createTiddlyElement(popup,"div",null,null,"created:");
		for(var t=0; t<createds.length; t++) {
			var link=createTiddlyLink(popup,createds[t],false);
			link.appendChild(document.createTextNode(indent+createds[t]));
			createTiddlyElement(popup,"br",null,null,null);
		}
	}
}
//}}}

//{{{
function indexModifieds() // build list of tiddlers, hash indexed by modification date
{
	var modifieds= { };
	var tiddlers = store.getTiddlers("title","excludeLists");
	for (var t = 0; t < tiddlers.length; t++) {
		var date = tiddlers[t].modified.formatString("YYYY0MM0DD")
		if (!modifieds[date])
			modifieds[date]=new Array();
		modifieds[date].push(tiddlers[t].title);
	}
	return modifieds;
}
function hasModifieds(date) // returns true if date has modified tiddlers
{
	if (!config.macros.date.modifieds) config.macros.date.modifieds = indexModifieds();
	return (config.macros.date.modifieds[date.formatString("YYYY0MM0DD")]!=undefined);
}

function addModifiedsToPopup(popup,when,format)
{
	var force=(store.isDirty() && when.formatString("YYYY0MM0DD")==new Date().formatString("YYYY0MM0DD"));
	if (force || !config.macros.date.modifieds) config.macros.date.modifieds=indexModifieds();
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	var mods = config.macros.date.modifieds[when.formatString("YYYY0MM0DD")];
	if (mods) {
		mods.sort();
		var e=createTiddlyElement(popup,"div",null,null,"changed:");
		for(var t=0; t<mods.length; t++) {
			var link=createTiddlyLink(popup,mods[t],false);
			link.appendChild(document.createTextNode(indent+mods[t]));
			createTiddlyElement(popup,"br",null,null,null);
		}
	}
}
//}}}

//{{{
function indexReminders(date,leadtime) // build list of tiddlers with reminders, hash indexed by reminder date
{
	var reminders = { };
	if(window.findTiddlersWithReminders!=undefined) { // reminder plugin is installed
		// DEBUG var starttime=new Date();
		var t = findTiddlersWithReminders(date, [0,leadtime], null, null, 1);
		for(var i=0; i<t.length; i++) reminders[t[i].matchedDate]=true;
		// DEBUG var out="Found "+t.length+" reminders in "+((new Date())-starttime+1)+"ms\n";
		// DEBUG out+="startdate: "+date.toLocaleDateString()+"\n"+"leadtime: "+leadtime+" days\n\n";
		// DEBUG for(var i=0; i<t.length; i++) { out+=t[i].matchedDate.toLocaleDateString()+" "+t[i].params.title+"\n"; }
		// DEBUG alert(out);
	}
	return reminders;
}

function hasReminders(date) // returns true if date has reminders
{
	if (window.reminderCacheForCalendar)
		return window.reminderCacheForCalendar[date]; // use calendar cache
	if (!config.macros.date.reminders)
		config.macros.date.reminders = indexReminders(date,90); // create a 90-day leadtime reminder cache
	return (config.macros.date.reminders[date]);
}

function addRemindersToPopup(popup,when,format)
{
	if(window.findTiddlersWithReminders==undefined) return; // reminder plugin not installed

	var indent = String.fromCharCode(160)+String.fromCharCode(160);
	var reminders=findTiddlersWithReminders(when, [0,31],null,null,1);
	var e=createTiddlyElement(popup,"div",null,null,"reminders:"+(!reminders.length?" none":""));
	for(var t=0; t<reminders.length; t++) {
		link = createTiddlyLink(popup,reminders[t].tiddler,false);
		var diff=reminders[t].diff;
		diff=(diff<1)?"Today":((diff==1)?"Tomorrow":diff+" days");
		var txt=(reminders[t].params["title"])?reminders[t].params["title"]:reminders[t].tiddler;
		link.appendChild(document.createTextNode(indent+diff+" - "+txt));
		createTiddlyElement(popup,"br",null,null,null);
	}
	if (readOnly) return;	// omit "new reminder..." link
	var link = createTiddlyLink(popup,indent+"new reminder...",true); createTiddlyElement(popup,"br");
	var title = when.formatString(format);
	link.title="add a reminder to '"+title+"'";
	link.onclick = function() {
		// show tiddler editor
		story.displayTiddler(null, title, 2, null, null, false, false);
		// find body 'textarea'
		var c =document.getElementById("tiddler" + title).getElementsByTagName("*");
		for (var i=0; i<c.length; i++) if ((c[i].tagName.toLowerCase()=="textarea") && (c[i].getAttribute("edit")=="text")) break;
		// append reminder macro to tiddler content
		if (i<c.length) {
			if (store.tiddlerExists(title)) c[i].value+="\n"; else c[i].value="";
			c[i].value += "<<reminder";
			c[i].value += " day:"+when.getDate();
			c[i].value += " month:"+(when.getMonth()+1);
			c[i].value += " year:"+when.getFullYear();
			c[i].value += ' title:"Enter a title" >>';
		}
	};
}
//}}}
// // date plugin calendar colors
//{{{
config.macros.date.holidays=[ "01/01", "07/04", "07/24", "11/24" ]; // NewYearsDay, IndependenceDay(US), Eric's Birthday (hooray!), Thanksgiving(US)
config.macros.date.weekend=[ 1,0,0,0,0,0,1 ]; // day index values: sun=0, mon=1, tue=2, wed=3, thu=4, fri=5, sat=6
config.macros.date.format="YYYY.0MM.0DD"; // default date display format
config.macros.date.linkformat="YYYY.0MM.0DD"; // 'dated tiddler' link format
config.macros.date.weekendbg="#c0c0c0";
config.macros.date.holidaybg="#ffaace";
config.macros.date.createdbg="#bbeeff";
config.macros.date.modifiedsbg="#bbeeff";
config.macros.date.linkedbg="#babb1e";
config.macros.date.remindersbg="#c0ffee";
//}}}
/*
This is a macro that can be used like so:
<''''<daysLeft "date">''''>

Where date is in the form "November 1 2006". The quote marks around the date are essential.
Example: <<daysLeft "October 19 2006">>

{{{
*/

Date.prototype.isToday = function ()
{
 var today = new Date();
 if (this.getDate() == today.getDate() && this.getMonth() == today.getMonth() && this.getFullYear() == today.getFullYear())
 return true;
 else
 return false;
}

version.extensions.daysLeft = {major: 1, minor: 1, revision: 1, date: new Date (2005, 10, 14)};
config.macros.daysLeft = {label: "Days left counter"};
config.macros.daysLeft.style = {fontWeight: "bold"};
config.macros.daysLeft.handler = function (place, macroName, params)
{
 var today = new Date();
 var target = new Date(params[0]);
 var text = "";
 var yearsDifference = target.getYear() - today.getYear();
 
 if (yearsDifference > 1)
 {
 text = params[0] + " is too far away for me to count";
 }
 else if (target.getTime() > today.getTime())
 {
 var days = 0;
 while (!target.isToday() && target.getTime() > today.getTime())
 {
 target.setDate (target.getDate() - 1);
 ++days;
 }
 text = days + " days left until " + params[0];
 }
 else
 {
 text = params[0] + " has passed already";
 }

 var element = createTiddlyElement (place, "span", null, null, text);
 for (var i in this.style)
 element.style[i] = this.style[i];
}

/*
}}}
 */ 
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened.
This is using <<version>> of the codebase.
You'll also need to enter your username for signing your edits: <<option txtUserName>>
[[Bottleby|Bottleby, Mr.]]'s assistant groom and cousin (his mother is the sister of Bottleby's father)
HAVERHILL, Suffolk, 58 3/4 miles from London (from Whitechapel Church), 4 m, distant at Great Thurlow, Sir //Robert Harland//, Bart.  Market on Wednesday, posting house is The Cross.
For the seats between this place and Swanstreat, see page 338
the title/name for the footman on duty in the front hall.
A nephew of [[Gerard|Johnson, Gerard]], he is a schoolmate of [[Charlie|McGregor, Charles Edward]], who believes his uncle's lies.
A footman at [[Pendleton Abbey|PendletonAbbey]].  [[Morag|McGregor, Morag]] makes an enemy of him when he attempts to take liberties and she almost breaks his knee.  A cousin of [[Polly]], his nephew is [[Dirk|Johnson, Dirk]].
//Look up information on opium/laudanum.  History, methodology, usage of painkillers. 
Opium eaters.//

In the 16th century, Paracelsus experimented with the medical value of opium. He decided that its medical (analgesic) value was of such magnitude that he called it Laudanum, from the Latin laudare, to praise, or from labdanum, the term for a plant extract. He did not know of its addictive properties.

In the 19th century, laudanum was used in many patent medicines to "relieve pain... to produce sleep... to allay irritation... to check excessive secretions... to support the system... [and] as a sudorific".[1] The limited pharmacopoeia of the day meant that opium derivatives were among the most efficacious of available treatments, and so laudanum was widely prescribed for ailments from colds to meningitis to cardiac diseases, in both adults and children. Laudanum was used during the yellow fever epidemic.

The Romantic and Victorian eras were marked by the widespread use of laudanum in Europe and the United States. Initially a working class drug, laudanum was cheaper than a bottle of gin or wine, because it was treated as a medication for legal purposes and not taxed as an alcoholic beverage. 
/***
|''Name:''|LegacyStrikeThroughPlugin|
|''Description:''|Support for legacy (pre 2.1) strike through formatting|
|''Version:''|1.0.2|
|''Date:''|Jul 21, 2006|
|''Source:''|http://www.tiddlywiki.com/#LegacyStrikeThroughPlugin|
|''Author:''|MartinBudden (mjbudden (at) gmail (dot) com)|
|''License:''|[[BSD open source license]]|
|''CoreVersion:''|2.1.0|
***/

//{{{
// Ensure that the LegacyStrikeThrough Plugin is only installed once.
if(!version.extensions.LegacyStrikeThroughPlugin) {
version.extensions.LegacyStrikeThroughPlugin = {installed:true};

config.formatters.push(
{
	name: "legacyStrikeByChar",
	match: "==",
	termRegExp: /(==)/mg,
	element: "strike",
	handler: config.formatterHelpers.createElementAndWikify
});

} //# end of "install only once"
//}}}
/***
| Name|LessBackupsPlugin|
| Description|Intelligently limit the number of backup files you create|
| Version|3.0 ($Rev: 2320 $)|
| Date|$Date: 2007-06-18 22:37:46 +1000 (Mon, 18 Jun 2007) $|
| Source|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
| Author|Simon Baird|
| Email|simon.baird@gmail.com|
| License|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second.  So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array

!!!Notes
Works in IE and Firefox only.  Algorithm by Daniel Baird. IE code by by Saq Imtiaz.
!!!Code
***/
//{{{
window.getSpecialBackupPath = function(backupPath) {

	var MINS  = 60 * 1000;
	var HOURS = 60 * MINS;
	var DAYS  = 24 * HOURS;

	// comment out the ones you don't want
	var modes = [
		["YYYY",  365*DAYS], // one per year for ever
		["MMM",   31*DAYS],  // one per month
		["ddd",   7*DAYS],   // one per weekday
		//["d0DD",  1*DAYS],   // one per day of month
		["h0hh",  24*HOURS], // one per hour
		["m0mm",  1*HOURS],  // one per minute
		["s0ss",  1*MINS],   // one per second
		["latest",0]         // always keep last version. (leave this).
	];

	var now = new Date();

	for (var i=0;i<modes.length;i++) {

		// the filename we will try
		var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
						'$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')

		// open the file

		try {
			if (config.browser.isIE) {
				var fsobject = new ActiveXObject("Scripting.FileSystemObject")
				var fileExists  = fsobject.FileExists(specialBackupPath);
				if (fileExists) {
					var fileObject = fsobject.GetFile(specialBackupPath);
					var modDate = new Date(fileObject.DateLastModified).valueOf();
				}
			}
			else {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
				file.initWithPath(specialBackupPath);
				var fileExists = file.exists();
				if (fileExists) {
					var modDate = file.lastModifiedTime;
				}
			}
		}
		catch(e) {
			// give up
			return backupPath;
		}

		// expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
		// June file on disk that's more than an month old then it must be stale so overwrite
		// note that "latest" should be always because the expiration period is zero (see above)
		var expiry = new Date(modDate + modes[i][1]);
		if (!fileExists || now > expiry)
			return specialBackupPath;
	}
}

// hijack the core function
window.getBackupPath_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
	return getSpecialBackupPath(getBackupPath_orig(localPath));
}

//}}}
<<gradient vert #88ff44 #ffffff #0088ff>> 
GettingStarted
NaNoWriMoCalendar
NaNoFiMo
[[offsite word count]]
[[timeline]]
PlotPointList
<<newTiddler>>
<<toggleSideBar Sidebar show>>
<<version>>
<<calendar thismonth>>
The foster son of [[Morris McGregor|McGregor, Morag]], the natural son of Elizabeth deVilliers Pendleton and Arthur, Lord Pendleton.
Sometimes called Morris ~McGregor (when dressed as a man).  A half scot born 10 months after the [[Battle of Culloden]], in London.  The foster parent of [[Charlie|McGregor, Charles Edward]] since birth, and [[Bethany|Archer, Elizabeth]] from the age of 11, when her mother handed her over to Morris.
A footman at [[Pendleton Abbey|PendletonAbbey]].  He is a trifle slow, and not given overly taxing duties.
<<sparkline 581 1704 0 323 290 1230 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31>>

<<sparkline 581 2285 2285 2608 2898 4128 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31>>
also:
[[the website|http://www.nanofimo.org]]
[[National Novel Writer Month|http://www.nanowrimo.org]]
<<daysLeft "November 1 2007">>

<<calendarNaNo>>

<<daysLeft "November 30 2007">>
Progress:
daily <<sparkline 2543 2225 440 3900 1448 1723 1260 1813 1543 2594 2654 2267 1100 542 1102 1316 2013 3301 563 2134 1103 2075 2054 1534 2258 570 2170 1006 322>>
progress <<sparkline 2543 4768 5209 9109 10557 13540 15353 16896 19490 22191 24458 25558 26100 27202 28518 30531 33832 34394 36296 37631 38304 40109 42228 43762 45462 46020 46590 48760 49768 50090>>
/***
| Name|NaNoWriMoCaldendarPlugin|
| Description|calendar for the month of November of the current yyear, showing expected wordcount to get 50,000 words in 30 days|
| Version|unknown|
| Date|November 2007|
| Source||
| Author|Lustforlike|
| Email||
| License|unknown|
/*
This is a macro that inserts a calender for the month of November in the current year. It will highlight the current day, if it is visible on the calendar, and it displays the necessary word counts on each of the days.

To use it, put: <''''<calendarNaNo>''''> in a tiddler. Example:
<<calendarNaNo>>
{{{
 */

version.extensions.calendarNaNo = {major: 1, minor: 1, revision: 1, date: new Date (2005, 10, 14)};
config.macros.calendarNaNo = {label: "NaNoWriMo calendar"};
config.macros.calendarNaNo.styleToday = {color: "#000077", fontWeight: "bold", backgroundColor: "ffff00"};
config.macros.calendarNaNo.styleWordCount = {fontSize: "75%", display: "block"};

config.macros.calendarNaNo.applyStyle = function (element, stylesToApply)
{
 for (var i in stylesToApply)
 element.style[i] = stylesToApply[i];
}

config.macros.calendarNaNo.createWordCountElement = function (parent, wordCount)
{
 var insert = createTiddlyElement(parent,"span", null, "wordCount", wordCount + " words");
 this.applyStyle (insert, this.styleWordCount);
}

config.macros.calendarNaNo.handler = function (place)
{
 var params =
 {
 year: (new Date ()).getFullYear(),
 month: 10,
 targetWordCount: 60000,
 displayWordCount: true
 };
 
 var daysOfTheWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
 var firstDayOfMonth = (new Date (params.year, params.month, 1)).getDay();
 var lastDateOfMonth = (new Date (params.year, params.month + 1, 0)).getDate();
 var table = createTiddlyElement(place,"table", null, "calendar");
 var header = createTiddlyElement(createTiddlyElement (table, "tbody"),"tr");
 var body = createTiddlyElement (table, "tbody");
 for (var i = 0; i < daysOfTheWeek.length; ++i)
 createTiddlyElement(header,"th", null, null, daysOfTheWeek[i]);

 var currentDay = -firstDayOfMonth
 while (currentDay < lastDateOfMonth)
 {
 var row = createTiddlyElement(body,"tr");
 for (var i = 0; i < daysOfTheWeek.length; ++i)
 {
 var element;
 var wordCountForToday = 0;
 var dayText = "";
 var displayWordCount = false;
 
 if (currentDay >= 0 && currentDay < lastDateOfMonth)
 {
 wordCountForToday = Math.ceil ((params.targetWordCount / lastDateOfMonth) * (currentDay + 1));
 dayText = "" + (currentDay + 1);
 displayWordCount = true;
 }
 else if (currentDay >= lastDateOfMonth)
 wordCountForToday = params.targetWordCount;
 
 element = createTiddlyElement(row,"td", null, null, dayText);
 element.align = "center";
 element.style.paddingTop = ".5em";
 element.style.paddingBottom = ".5em";
 if (displayWordCount && params.displayWordCount)
 this.createWordCountElement (element, wordCountForToday);
 if ((new Date(params.year, params.month, currentDay + 1)).isToday())
 this.applyStyle (element, this.styleToday);
 
 ++currentDay;
 }
 }
}

/*
}}}
 */
57 Miles from London (taken from Whitechapel Church), near the border with Essex.

NEYLAND occupies a low situation, and is therefore subject to occaisional inundations : it stands on the north bank of the river Stour, over which there is a large brick bridge of one arch leading into Essex, and was at one time celebrated for its extensive woolen manufacture, now, however, reduced to a very low ebb.  The church, with its spire steeple, standing in the middle of the town, is its principal ornament; but this edifice does not contain anything remarkable, except a few ancient monuments to persons formerly eminent in the clothing trade.

NEYLAND, Tendering Hall, //Sir William Rowley//, Bart.
p.340
PasswordOptionPlugin extends the core Options with a non encrypted password type.

Notice:
*How a style can be specified for a specific option in StyleSheet

----
Test Password: <<option pasPassword myPasOptionInput >>
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#PasswordOptionPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
	major: 1, minor: 0, revision: 2, 
	date: new Date("Apr 19, 2007"),
	source: 'http://tiddlywiki.bidix.info/#PasswordOptionPlugin',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
	coreVersion: '2.2.0 (Beta 5)'
};

config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");

merge(config.macros.option.types, {
	'pas': {
		elementType: "input",
		valueField: "value",
		eventName: "onkeyup",
		className: "pasOptionInput",
		typeValue: config.macros.option.passwordInputType,
		create: function(place,type,opt,className,desc) {
			// password field
			config.macros.option.genericCreate(place,'pas',opt,className,desc);
			// checkbox linked with this password "save this password on this computer"
			config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);			
			// text savePasswordCheckboxLabel
			place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
		},
		onChange: config.macros.option.genericOnChange
	}
});

merge(config.optionHandlers['chk'], {
	get: function(name) {
		// is there an option linked with this chk ?
		var opt = name.substr(3);
		if (config.options[opt]) 
			saveOptionCookie(opt);
		return config.options[name] ? "true" : "false";
	}
});

merge(config.optionHandlers, {
	'pas': {
 		get: function(name) {
			if (config.options["chk"+name]) {
				return encodeCookie(config.options[name].toString());
			} else {
				return "";
			}
		},
		set: function(name,value) {config.options[name] = decodeCookie(value);}
	}
});

// need to reload options to load passwordOptions
loadOptionsCookie();

/*
if (!config.options['pasPassword'])
	config.options['pasPassword'] = '';

merge(config.optionsDesc,{
		pasPassword: "Test password"
	});
*/
//}}}
book, reference book
full name, Arthur George Pendleton, born in 1735, Viscount Pendleton.  One older sister, Augusta
Married in [[1758]] to his childhood sweetheart, Elizabeth deVilliers.
One daughter, born in [[1760]]
One son, born in [[1764]].
Widowed in [[1764]].
full name Augusta Pendleton, born in 1730, married in [[1749]], her eldest daughter, Mary, is expecting, in [[1775]].
Full name: Elizabeth Caroline deVilliers Pendleton.
Born in [[1760]], named for her mother, the (then) queen of England, her mother's maiden name.

A trifle spoiled, but not mean tempered with it.
The first Lord Pendleton were a knight who married a merchant's daughter and bought the land when King Henry siezed the land from the papists with her dowry," the Pendletons "His grandson got created Viscount Pendleton by King James" and his own family, the Wagstaffes "we been here long as the Abbey was, Uncle says, longer than the Pendletons any road.  Most of the family works the land, oldest tenant farm on the estate, just a couple of us work in the Abbey."
	All Morris had to do was nod, walk, and nod some more. "This here is the children's wing, on account of this is where the children live.  When Sir Josiah,  Viscount Pendleton's grandfather as was, got the land, he didn't have enough money to build new, so he just used the Abbey buildings and built on.  Still got the cloister in the middle, and the four wings, the Front, the Vespers, the Children's and the Matins, around the cloisters."

Lord Pendleton's study is on the first floor (not the ground floor).
The Long Gallery is on the ground floor of  the north side of the Front wing, so the light is even, and so it overlooks the cloister garden.
[[before|Background1]]
[[1764]]
Walking south towards the city of Chester, Morris ~MacGregor is almost run down by a woman driving a curricle.  An hour later, Morris comes across the woman and the curricle again, only this time the curricle has been wrecked and the woman is in labor.
Morris delivers the child, a boy, but the woman, named Elizabeth, dies.  Looting her body, Morris takes her money and most of her jewelry, leaving her money to be buried with, and her wedding ring.  Among the things taken is a miniature of the woman and a dark haired man.
Morris also takes the infant, walking south to Chester.
[[next|Background2]]
[[before|Plot9]]
[[1775]]
Arthur decides to keep ~McGregor on the estate because he suspects that she will run away, either with Charlie, or with the boy following her.
He arranges for her to move into the nursery wing with the children.
[[after|Plot11]]
[[before|Plot10]]
[[1775]]
Caroline is 15, accustomed to being her father's only child, and accompanied by her aunt, and the latest in a long succession of potential stepmothers (sponsored by Auntie).
She and Bethany have some minor dustups, especially when Arthur insists that Bethany isn't to be treated as a servant, and some more major disagreements with Charlie, who has never had an older sister, and doesn't know how to treat one.
[[next|Plot12]]
[[before|Plot11]]
[[1775]]
Auntie attempts to discredit Morris, first fiscally, but when that doesn't work, --she attempts to set him up for rape.  That backfires, and Morris's true gender is revealed.-- tries other methods.
Arthur is appalled, he had never knowingly struck a woman.  Morris, now using her proper name of Morag, forgives him, Arthur hadn't known of her gender when they fought, and Morag, as Morris, had done worse than fight back when attacked.//this comes earlier, during the fight//
[[next|Plot13]]
[[before|Plot12]]
[[1775]]
Auntie is invited to go home after her second attempt to discredit Morag fails (moral turpitude).
Charlie takes to education like a fish to water, Caroline becomes accustomed, then fond of her new little sister, and Morag begins to dream a little of staying with her children.
Arthur begins to grow fond of Morag as well.  She is under educated, but intelligent, and with her upbringing and lifestyle, is accustomed to thinking for herself.  He respects, then grows fond of her for her wit and odd way of looking at things

[[after|Plot14]]
[[before|BackGround2]]
[[1775]]
Morris wakes up in a hay field and also wakes Charlie and Stewball.  They find themselves outside Chester, and are accosted by the farmer Morris worked for when Charlie was an infant.
The farmer, Sam Talboys, insists on inviting the father, son and dog back to his farm.
[[next|Plot3]]
[[before|Plot2]]
[[1775]]
That night, the servant who was Charlie's wet-nurse wakes Morris up and warns them that someone, she does not know who, is hunting Charlie and Morris, has been hunting them for at least 6 years, and Talboys was bragging about sending word to the hunter, and that he would keep Morris and Charlie until the hunter came.
Morris starts scrabbling his possessions together and demands to know why the woman, Jane Archer, why she warned them.
Jane admits that she'd brought the warning with a price.  She wants her daughter Elizabeth, taken when Morris leaves.  Her daughter is eleven, and Sam Talboys and his son are starting to look at her like a woman.  If Morris doesn't agree, Jane will scream and warn the Talboys of the ~MacGregor's flight.
Morris agrees, but wonders why Jane would trust him.  He could be a worse monster than the Talboys ever could be.
Jane claims that the fact that Charlie is still with Morris is proof, --and even more, Jane knows that Morris is a woman--.  She insists that Morris take the child (called Bethany) along.
Reluctantly, Morris agrees.
[[next|Background3]]
[[before|Background3]]
[[1775]]
Arthur Pendleton arrives at the Talboys to discover his quarry fled, having suposedly stolen a child and killed Jane Archer.  Furious and disappointed, he heads for home.
On the way there, he stops at an inn where Morris, and his children have stopped for the night.  Morris --works-- gets hired as an hostler to get food and a place in the stables to sleep.  Arthur's groom, who has been with him since Arthur was a boy, recognizes Charlie as well as the combination of names, and warns Arthur.  The two men decide that the groom will play sick, and Arthur will be "forced" to hire Morris to get home.
The plan goes off without a hitch, and Arthur manages to feign mild disgust at having to share his coach with two children and a large dog.  In reality, he is hungry to see the son he didn't know he had.
[[next|Plot5]]
[[before|Plot4]]
[[1775]]
Morris and family settle in quickly at Pendleton Abbey, Morris arranges for Charlie to attend school in the village, with extra tutoring from the curate, while Bethany is attending school for the first time.  Their evenings are spent bringing Bethany's education up to Charlie's level.
Arthur watches trying to figure out how to take back his son, at once hating and envying ~McGregor for the affection the two share, and how ~McGregor includes his "new" daughter in that affection.
Two things puzzle him though, ~McGregor goes to the churchyard and "adopts" a neglected grave in the churchyard, and over several Sundays, cleans it up, and introduces his children to the grave of "their granther"
Questioned by Arthur, ~McGregor explains that he doesn't know where his grandfather is buried, or even if he has a grave, but takes care of another man's grave in the hopes that it is understood that the service would be done for his real grandfather.
[[next|Plot6]]
[[before|Plot5]]
[[1775]]
Charlie shows Bethany the miniature of his mother, during a squabble one evening.
[[next|Plot7]]
[[before|Plot7]]
[[1775]]
Bethany and Charlie, stuck inside due to an autumn storm, come upon the portrait gallery.  They both recognize the portrait of Arthur as a child (with his parents and sister), as well as one of Elizabeth with her daughter Caroline as a toddler.
The portrait looks like Charlie, and Charlie's miniature is a copy of the painting of Elizabeth.
The children run screaming for Morris, but are caught by Arthur and some of the senior servants, who have gossiped among themselves about the uncanny "Family Look" that Charlie has.  Charlie tries to get away, but both are caught.  Arthur sends for ~McGregor, determined to have it out with the man who stole his son.  He also orders the portrait of Elizabeth brought to his study.
[[next|Plot8]]
[[before|Plot7]]
[[1775]]
Morris is brought in by a pair of footmen, spots the painting and immediately tries to protect Charlie from Arthur.  Arthur orders the children taken away and guarded, and proceeds to have a knockdown drag out arguement (with forays into some physical violence) with ~McGregor.  Morris had thought the dark haired man was Elizabeth's husband, and didn't realize that it was her lover instead.
Arthur didn't know whether or not Charlie was his until he saw him.
Morris took Charlie to avoid him ending up a foundling on the parish.  He took Bethany for the same reason.
Arthur threatens to have Morris arrested for murdering Jane Archer, which Morris denies.
[[next|Plot9]]
[[before|Plot8]]
[[1775]]
In the end, Morris agrees to give up Charlie if Arthur will also take Bethany.  She's had no father, and her mother is dead now, and life on the road isn't safe for a girl-child.
Arthur agrees, and Morris agrees to leave in the spring.  He has his own goodbyes to make, and he has to reconcile the children to the new family arrangement.
Arthur sends for Caroline, who has been visiting his sister and her family with her governess.
[[next|Plot10]]
    [[Background1]]
[X] [[Plot1]]
    [[Background2]]
[X] [[Plot2]]
[X] [[Plot3]]
    [[Background3]]
[X] [[Plot4]]
[X] [[Plot5]]
[X] [[Plot6]]
[X] [[Plot7]]
[X] [[Plot8]]
[X] [[Plot9]]
[X] [[Plot10]]
[ ] [[Plot11]]
[ ] [[Plot12]]
[ ] [[Plot13]]
[ ] [[Plot14]]
[ ] [[Plot15]]
[ ] [[Plot16]]
[ ] [[Plot17]]
[ ] [[Plot18]]
[ ] [[Plot19]]
[ ] [[Plot20]]
The nursery maid brought out of retirement to look after Bethany and Charlie.
/***
|''Name:''|ReminderPlugin|
|''Version:''|2.3.10 (Jun 28, 2007)|
|''Source:''|http://remindermacros.tiddlyspot.com|
|''Author:''|Jeremy Sheeley(pop1280 [at] excite [dot] com)<<br>>Maintainer: simon.baird@gmail.com|
|''Licence:''|[[BSD open source license]]|
|''Macros:''|reminder, showreminders, displayTiddlersWithReminders, newReminder|
|''TiddlyWiki:''|2.0+|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|

!Description
This plugin provides macros for tagging a date with a reminder.  Use the {{{reminder}}} macro to do this.  The {{{showReminders}}} and {{{displayTiddlersWithReminder}}} macros automatically search through all available tiddlers looking for upcoming reminders.

!Installation
* Create a new tiddler in your tiddlywiki titled ReminderPlugin and give it the {{{systemConfig}}} tag.  The tag is important because it tells TW that this is executable code.
* Double click this tiddler, and copy all the text from the tiddler's body.
* Paste the text into the body of the new tiddler in your TW.
* Save and reload your TW.
* You can copy some examples into your TW as well.  See [[Simple examples]], [[Holidays]], [[showReminders]] and [[Personal Reminders]]

!Syntax:
|>|See [[ReminderSyntax]] and [[showRemindersSyntax]]|

!Revision history
* v2.3.10 (Jun 28, 2007)
** Removed window.story = window backwards compatibility hacks since they were breaking TW 2.2
* v2.3.9 (Apr 26, 2007)
** allow bracketed list format in tags param lets you use tags with spaces
* v2.3.8 (Mar 9, 2006)
**Bug fix: A global variable had snuck in, which was killing FF 1.5.0.1
**Feature: You can now use TIDDLER and TIDDLERNAME in a regular reminder format
* v2.3.6 (Mar 1, 2006)
**Bug fix: Reminders for today weren't being matched sometimes.
**Feature:  Solidified integration with DatePlugin and CalendarPlugin
**Feature:  Recurring reminders will now return multiple hits in showReminders and the calendar.
**Feature:  Added TIDDLERNAME to the replacements for showReminders format, for plugins that need the title without brackets.
* v2.3.5 (Feb 8, 2006)
**Bug fix: Sped up reminders lots.  Added a caching mechanism for reminders that have already been matched.
* v2.3.4 (Feb 7, 2006)
**Bug fix: Cleaned up code to hopefully prevent the Firefox 1.5.0.1 crash that was causing lots of plugins 
to crash Firefox.  Thanks to http://www.jslint.com
* v2.3.3 (Feb 2, 2006)
**Feature: newReminder now has drop down lists instead of text boxes.
**Bug fix:  A trailing space in a title would trigger an infinite loop.
**Bug fix:  using tag:"birthday !reminder" would filter differently than tag:"!reminder birthday"
* v2.3.2 (Jan 21, 2006)
**Feature: newReminder macro, which will let you easily add a reminder to a tiddler. Thanks to Eric Shulman (http://www.elsdesign.com) for the code to do this.
** Bug fix: offsetday was not working sometimes
** Bug fix: when upgrading to 2.0, I included a bit to exclude tiddlers tagged with excludeSearch.  I've reverted back to searching through all tiddlers
* v2.3.1 (Jan 7, 2006)
**Feature: 2.0 compatibility
**Feature AlanH sent some code to make sure that showReminders prints a message if no reminders are found.
* v2.3.0 (Jan 3, 2006)
** Bug Fix:  Using "Last Sunday (-0)" as a offsetdayofweek wasn't working.
** Bug Fix:  Daylight Savings time broke offset based reminders (for example year:2005 month:8 day:23 recurdays:7 would match Monday instead of Tuesday during DST.

!Code
***/
//{{{

//============================================================================
//============================================================================
//           ReminderPlugin
//============================================================================
//============================================================================

version.extensions.ReminderPlugin = {major: 2, minor: 3, revision: 8, date: new Date(2006,3,9), source: "http://remindermacros.tiddlyspot.com/"};

//============================================================================
// Configuration
// Modify this section to change the defaults for 
// leadtime and display strings
//============================================================================

config.macros.reminders = {};
config.macros["reminder"] = {};
config.macros["newReminder"] = {};
config.macros["showReminders"] = {};
config.macros["displayTiddlersWithReminders"] = {};

config.macros.reminders["defaultLeadTime"] = [0,6000];
config.macros.reminders["defaultReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY";
config.macros.reminders["defaultShowReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY -- TIDDLER";
config.macros.reminders["defaultAnniversaryMessage"] = "(DIFF)";
config.macros.reminders["untitledReminder"] = "Untitled Reminder";
config.macros.reminders["noReminderFound"] = "Couldn't find a match for TITLE in the next LEADTIMEUPPER days."
config.macros.reminders["todayString"] = "Today";
config.macros.reminders["tomorrowString"] = "Tomorrow";
config.macros.reminders["ndaysString"] = "DIFF days";
config.macros.reminders["emtpyShowRemindersString"] = "There are no upcoming events";


//============================================================================
//  Code
// You should not need to edit anything 
// below this.  Make sure to edit this tiddler and copy 
// the code from the text box, to make sure that 
// tiddler rendering doesn't interfere with the copy 
// and paste.
//============================================================================

//this object will hold the cache of reminders, so that we don't
//recompute the same reminder over again.
var reminderCache = {};

config.macros.showReminders.handler = function showReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the 
         //leadtime a few lines down.
         paramHash["leadtime"] = [-10000, 10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }

   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   var elem = createTiddlyElement(place,"span",null,null, null);
   var mess = "";
   if (arr.length == 0)
   {
      mess += config.macros.reminders.emtpyShowRemindersString; 
   }
   for (var j = 0; j < arr.length; j++)
   {
      if (paramHash["format"] != null)
      {
         arr[j]["params"]["format"] = paramHash["format"];
      }
      else
      {
         arr[j]["params"]["format"] = config.macros.reminders["defaultShowReminderMessage"];
      }
      mess += getReminderMessageForDisplay(arr[j]["diff"], arr[j]["params"], arr[j]["matchedDate"], arr[j]["tiddler"]);
      mess += "\n";
   }
   wikify(mess, elem, null, null);
};


config.macros.displayTiddlersWithReminders.handler = function displayTiddlersWithReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the leadtime 
         //a few lines down.
         paramHash["leadtime"] = [-10000,10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }
   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   for (var j = 0; j < arr.length; j++)
   {
      displayTiddler(null, arr[j]["tiddler"], 0, null, false, false, false);
   }
};

config.macros.reminder.handler = function reminder(place,macroName,params)
{
   var dateHash = getParamsForReminder(params);
   if (dateHash["hidden"] != null)
   {
      return;
   }
   var leadTime = dateHash["leadtime"];
   if (leadTime == null)
   {
      leadTime = config.macros.reminders["defaultLeadTime"]; 
   }
   var leadTimeLowerBound = new Date().getMidnight().addDays(leadTime[0]);
   var leadTimeUpperBound = new Date().getMidnight().addDays(leadTime[1]);
   var matchedDate = findDateForReminder(dateHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound);
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(place).id.substr(7);
   if (matchedDate != null)
   {
      var diff = matchedDate.getDifferenceInDays(new Date().getMidnight());
      var elem = createTiddlyElement(place,"span",null,null, null);
      var mess = getReminderMessageForDisplay(diff, dateHash, matchedDate, title);
      wikify(mess, elem, null, null);
   }
   else
   {
      createTiddlyElement(place,"span",null,null, config.macros.reminders["noReminderFound"].replace("TITLE", dateHash["title"]).replace("LEADTIMEUPPER", leadTime[1]).replace("LEADTIMELOWER", leadTime[0]).replace("TIDDLERNAME", title).replace("TIDDLER", "[[" + title + "]]") );
   }
};

config.macros.newReminder.handler = function newReminder(place,macroName,params)
{
  var today=new Date().getMidnight();
  var formstring = '<html><form>Year: <select name="year"><option value="">Every year</option>';
  for (var i = 0; i < 5; i++)
  {
    formstring += '<option' + ((i == 0) ? ' selected' : '') + ' value="' + (today.getFullYear() +i) + '">' + (today.getFullYear() + i) + '</option>';
  }
  formstring += '</select>&nbsp;&nbsp;Month:<select name="month"><option value="">Every month</option>';
  for (i = 0; i < 12; i++)
  {
    formstring += '<option' + ((i == today.getMonth()) ? ' selected' : '') + ' value="' + (i+1) + '">' + config.messages.dates.months[i] + '</option>';
  }
  formstring += '</select>&nbsp;&nbsp;Day:<select name="day"><option value="">Every day</option>';
  for (i = 1; i < 32; i++)
  {
    formstring += '<option' + ((i == (today.getDate() )) ? ' selected' : '') + ' value="' + i + '">' + i + '</option>';
  }

formstring += '</select>&nbsp;&nbsp;Reminder Title:<input type="text" size="40" name="title" value="please enter a title" onfocus="this.select();"><input type="button" value="ok" onclick="addReminderToTiddler(this.form)"></form></html>';

  var panel = config.macros.slider.createSlider(place,null,"New Reminder","Open a form to add a new reminder to this tiddler");
  wikify(formstring ,panel,null,store.getTiddler(params[1]));
};

// onclick: process input and insert reminder at 'marker'
window.addReminderToTiddler = function(form) {
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(form).id.substr(7);
   var tiddler=store.getTiddler(title);
  var txt='\n<<reminder ';
  if (form.year.value != "")
    txt += 'year:'+form.year.value + ' ';
  if (form.month.value != "")
    txt += 'month:'+form.month.value + ' ';
  if (form.day.value != "")
    txt += 'day:'+form.day.value + ' ';
  txt += 'title:"'+form.title.value+'" ';
  txt +='>>';
   tiddler.set(null,tiddler.text + txt);
   window.story.refreshTiddler(title,1,true);
   store.setDirty(true);
};

function hasTag(tiddlerTags, tagFilters)
{
  //Make sure we respond well to empty tiddlerTaglists or tagFilterlists
  if (tagFilters.length==0 || tiddlerTags.length==0)
  {
    return true;
  }

  var bHasTag = false;
  
  /*bNoPos says: "'till now there has been no check using a positive filter"
     Imagine a filterlist consisting of 1 negative filter:
         If the filter isn't matched, we want hasTag to be true.
         Yet bHasTag is still false ('cause only positive filters cause bHasTag to change)
         
     If no positive filters are present bNoPos is true, and no negative filters are matched so we have not returned false
         Thus: hasTag returns true.
      
      If at any time a positive filter is encountered, we want at least one of the tags to match it, so we turn bNoPos to false, which
      means bHasTag must be true for hasTag to return true*/
  var bNoPos=true;
  
for (var t3 = 0; t3 < tagFilters.length; t3++)
  {
      for(var t2=0; t2<tiddlerTags.length; t2++)
      {
           if (tagFilters[t3].length > 1 && tagFilters[t3].charAt(0) == '!') 
           {
              if (tiddlerTags[t2] == tagFilters[t3].substring(1))
              {
                 //If at any time a negative filter is matched, we return false
                  return false;
              }
           }
           else 
           {
              if (bNoPos)
              {
                 //We encountered the first positive filter
                 bNoPos=false;
              }
              if (tiddlerTags[t2] == tagFilters[t3])
              {
                  //A positive filter is matched. As long as no negative filter is matched, hasTag will return true
                  bHasTag=true;
              }
           }
        }
    }
    return (bNoPos || bHasTag);
};

//This function searches all tiddlers for the reminder  //macro.  It is intended that other plugins (like //calendar) will use this function to query for 
//upcoming reminders.
//The arguments to this function filter out reminders //based on when they will fire.
//
//ARGUMENTS:
//baseDate is the date that is used as "now".  
//leadtime is a two element int array, with leadtime[0] 
//         as the lower bound and leadtime[1] as the
//         upper bound.  A reasonable default is [0,14]
//tags is a space-separated list of tags to use to filter 
//         tiddlers.  If a tag name begins with an !, then 
//         only tiddlers which do not have that tag will 
//         be considered.  For example "examples holidays"  
//         will search for reminders in any tiddlers that  
//         are tagged with examples or holidays and 
//         "!examples !holidays" will search for reminders 
//         in any tiddlers that are not tagged with 
//         examples or holidays.  Pass in null to search 
//         all tiddlers.
//limit.  If limit is null, individual reminders can 
//        override the leadtime specified earlier.  
//        Pass in 1 in order to override that behavior.

window.findTiddlersWithReminders = function findTiddlersWithReminders(baseDate, leadtime, tags, limit)
{
//function(searchRegExp,sortField,excludeTag)
//   var macroPattern = "<<([^>\\]+)(?:\\*)([^>]*)>>";
   var macroPattern = "<<(reminder)(.*)>>";
   var macroRegExp = new RegExp(macroPattern,"mg");
   var matches = store.search(macroRegExp,"title","");
   var arr = [];
   var tagsArray = null;
   if (tags != null)
   {
      // tagsArray = tags.split(" ");
      tagsArray = tags.readBracketedList(); // allows tags with spaces. thanks Robin Summerhill, 4-Oct-06.
   }
   for(var t=matches.length-1; t>=0; t--)
   {
      if (tagsArray != null)
      {
         //If they specified tags to filter on, and this tiddler doesn't 
	 //match, skip it entirely.
         if ( ! hasTag(matches[t].tags, tagsArray))
         {
            continue;
         }
      }

      var targetText = matches[t].text;
      do {
         // Get the next formatting match
         var formatMatch = macroRegExp.exec(targetText);
         if(formatMatch && formatMatch[1] != null && formatMatch[1].toLowerCase() == "reminder")
         {
            //Find the matching date.
            
            var params = formatMatch[2] != null ? formatMatch[2].readMacroParams() : {};
            var dateHash = getParamsForReminder(params);
            if (limit != null || dateHash["leadtime"] == null)
            {
               if (leadtime == null)
                   dateHash["leadtime"] = leadtime;
               else
               {
                  dateHash["leadtime"] = [];
                  dateHash["leadtime"][0] = leadtime[0];
                  dateHash["leadtime"][1] = leadtime[1];
               }
            }
	    if (dateHash["leadtime"] == null)
               dateHash["leadtime"] = config.macros.reminders["defaultLeadTime"]; 
            var leadTimeLowerBound = baseDate.addDays(dateHash["leadtime"][0]);
            var leadTimeUpperBound = baseDate.addDays(dateHash["leadtime"][1]);
            var matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
            while (matchedDate != null)
            {
               var hash = {};
               hash["diff"] = matchedDate.getDifferenceInDays(baseDate);
               hash["matchedDate"] = new Date(matchedDate.getFullYear(), matchedDate.getMonth(), matchedDate.getDate(), 0, 0);
               hash["params"] = cloneParams(dateHash);
               hash["tiddler"] = matches[t].title;
               hash["tags"] = matches[t].tags;
               arr.pushUnique(hash);
	       if (dateHash["recurdays"] != null || (dateHash["year"] == null))
	       {
	         leadTimeLowerBound = leadTimeLowerBound.addDays(matchedDate.getDifferenceInDays(leadTimeLowerBound)+ 1);
                 matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
	       }
	       else matchedDate = null;
            }
         }
      }while(formatMatch);
   }
   if(arr.length > 1)  //Sort the array by number of days remaining.
   {
      arr.sort(function (a,b) {if(a["diff"] == b["diff"]) {return(0);} else {return (a["diff"] < b["diff"]) ? -1 : +1; } });
   }
   return arr;
};

//This function takes the reminder macro parameters and
//generates the string that is used for display.
//This function is not intended to be called by 
//other plugins.
 window.getReminderMessageForDisplay= function getReminderMessageForDisplay(diff, params, matchedDate, tiddlerTitle)
{
   var anniversaryString = "";
   var reminderTitle = params["title"];
   if (reminderTitle == null)
   {
      reminderTitle = config.macros.reminders["untitledReminder"];
   }
   if (params["firstyear"] != null)
   {
      anniversaryString = config.macros.reminders["defaultAnniversaryMessage"].replace("DIFF", (matchedDate.getFullYear() - params["firstyear"]));
   }
   var mess = "";
   var diffString = "";
   if (diff == 0)
   {
      diffString = config.macros.reminders["todayString"];
   }
   else if (diff == 1)
   {
      diffString = config.macros.reminders["tomorrowString"];
   }
   else
   {
      diffString = config.macros.reminders["ndaysString"].replace("DIFF", diff);
   }
   var format = config.macros.reminders["defaultReminderMessage"];
   if (params["format"] != null)
   {
      format = params["format"];
   }
   mess = format;
//HACK!  -- Avoid replacing DD in TIDDLER with the date
   mess = mess.replace(/TIDDLER/g, "TIDELER");
   mess = matchedDate.formatStringDateOnly(mess);
   mess = mess.replace(/TIDELER/g, "TIDDLER");
   if (tiddlerTitle != null)
   {
      mess = mess.replace(/TIDDLERNAME/g, tiddlerTitle);
      mess = mess.replace(/TIDDLER/g, "[[" + tiddlerTitle + "]]");
   }
   
   mess = mess.replace("DIFF", diffString).replace("TITLE", reminderTitle).replace("DATE", matchedDate.formatString("DDD MMM DD, YYYY")).replace("ANNIVERSARY", anniversaryString);
   return mess;
};

// Parse out the macro parameters into a hashtable.  This
// handles the arguments for reminder, showReminders and 
// displayTiddlersWithReminders.
window.getParamsForReminder = function getParamsForReminder(params)
{
   var dateHash = {};
   var type = "";
   var num = 0;
   var title = "";
   for(var t=0; t<params.length; t++)
   {
      var split = params[t].split(":");
      type = split[0].toLowerCase();
      var value = split[1];
      for (var i=2; i < split.length; i++)
      {
         value += ":" + split[i];
      }
      if (type == "nolinks" || type == "limit" || type == "hidden")
      {
         num = 1;
      }
      else if (type == "leadtime")
      {
         var leads = value.split("...");
         if (leads.length == 1)
         {
            leads[1]= leads[0];
            leads[0] = 0;
         }
         leads[0] = parseInt(leads[0], 10);
         leads[1] = parseInt(leads[1], 10);
         num = leads;
      }
      else if (type == "offsetdayofweek")
      {
          if (value.substr(0,1) == "-")
          {
             dateHash["negativeOffsetDayOfWeek"] = 1;
	     value = value.substr(1);
          }
          num = parseInt(value, 10);
      }
      else if (type != "title" && type != "tag" && type != "format")
      {
         num = parseInt(value, 10);
      }
      else
      {
         title = value;
         t++;
         while (title.substr(0,1) == '"' && title.substr(title.length - 1,1) != '"' && params[t] != undefined)
         {
            title += " " + params[t++];
         }
         //Trim off the leading and trailing quotes
         if (title.substr(0,1) == "\"" && title.substr(title.length - 1,1)== "\"")
         {
            title = title.substr(1, title.length - 2);
            t--;
         }
         num = title;
      }
      dateHash[type] = num;
   }
   //date is synonymous with day
   if (dateHash["day"] == null)
   {
      dateHash["day"] = dateHash["date"];
   }
   return dateHash;
};

//This function finds the date specified in the reminder 
//parameters.  It will return null if no match can be
//found.  This function is not intended to be used by
//other plugins.
window.findDateForReminder= function findDateForReminder( dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound)
{
   if (baseDate == null)
   {
     baseDate = new Date().getMidnight();
   }
   var hashKey = baseDate.convertToYYYYMMDDHHMM();
   for (var k in dateHash)
   {
      hashKey += "," + k + "|" + dateHash[k];
   }
   hashKey += "," + leadTimeLowerBound.convertToYYYYMMDDHHMM();
   hashKey += "," + leadTimeUpperBound.convertToYYYYMMDDHHMM();
   if (reminderCache[hashKey] == null)
   {
      //If we don't find a match in this run, then we will
      //cache that the reminder can't be matched.
      reminderCache[hashKey] = false;
   }
   else if (reminderCache[hashKey] == false)
   {
      //We've already tried this date and failed
      return null;
   }
   else
   {
      return reminderCache[hashKey];
   }
   
   var bOffsetSpecified = dateHash["offsetyear"] != null || 
				dateHash["offsetmonth"] != null || 
				dateHash["offsetday"] != null || 
				dateHash["offsetdayofweek"] != null || 
				dateHash["recurdays"] != null;
   
   // If we are matching the base date for a dayofweek offset, look for the base date a 
   //little further back.
   var tmp1leadTimeLowerBound = leadTimeLowerBound;  
   if ( dateHash["offsetdayofweek"] != null)
   {
      tmp1leadTimeLowerBound = leadTimeLowerBound.addDays(-6);  
   }
   var matchedDate = baseDate.findMatch(dateHash, tmp1leadTimeLowerBound, leadTimeUpperBound);
   if (matchedDate != null)
   {
      var newMatchedDate = matchedDate;
      if (dateHash["recurdays"] != null)
      {
         while (newMatchedDate.getTime() < leadTimeLowerBound.getTime())
         {
            newMatchedDate = newMatchedDate.addDays(dateHash["recurdays"]);
         }
      }
      else if (dateHash["offsetyear"] != null || 
		dateHash["offsetmonth"] != null || 
		dateHash["offsetday"] != null || 
		dateHash["offsetdayofweek"] != null)
      {
         var tmpdateHash = cloneParams(dateHash);
         tmpdateHash["year"] = dateHash["offsetyear"];
         tmpdateHash["month"] = dateHash["offsetmonth"];
         tmpdateHash["day"] = dateHash["offsetday"];
         tmpdateHash["dayofweek"] = dateHash["offsetdayofweek"];
	 var tmpleadTimeLowerBound = leadTimeLowerBound;
	 var tmpleadTimeUpperBound = leadTimeUpperBound;
	 if (tmpdateHash["offsetdayofweek"] != null)
	 {
	 	if (tmpdateHash["negativeOffsetDayOfWeek"] == 1)
		{
		   tmpleadTimeLowerBound = matchedDate.addDays(-6);
		   tmpleadTimeUpperBound = matchedDate;

		}
		else
		{
		   tmpleadTimeLowerBound = matchedDate;
		   tmpleadTimeUpperBound = matchedDate.addDays(6);
		}

	 }
	 newMatchedDate = matchedDate.findMatch(tmpdateHash, tmpleadTimeLowerBound, tmpleadTimeUpperBound);
         //The offset couldn't be matched.  return null.
         if (newMatchedDate == null)
         {
            return null;
         }
      }
      if (newMatchedDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         reminderCache[hashKey] = newMatchedDate;
         return newMatchedDate;
      }
   }
   return null;
};

//This does much the same job as findDateForReminder, but
//this one doesn't deal with offsets or recurring 
//reminders.
Date.prototype.findMatch = function findMatch(dateHash, leadTimeLowerBound, leadTimeUpperBound)
{

   var bSpecifiedYear =     (dateHash["year"] != null);
   var bSpecifiedMonth =     (dateHash["month"] != null);
   var bSpecifiedDay =     (dateHash["day"] != null);
   var bSpecifiedDayOfWeek =     (dateHash["dayofweek"] != null);
   if (bSpecifiedYear && bSpecifiedMonth && bSpecifiedDay)
   {
      return new Date(dateHash["year"], dateHash["month"]-1, dateHash["day"], 0, 0);
   }
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedDay && bSpecifiedMonth && !bSpecifiedYear && !bSpecifiedDayOfWeek)
   {

      //Shortcut -- First try this year.  If it's too small, try next year.
      var tmpMidnight = this.getMidnight();
      var tmpDate = new Date(this.getFullYear(), dateHash["month"]-1, dateHash["day"], 0,0);
      if (tmpDate.getTime() < leadTimeLowerBound.getTime())
      {
         tmpDate = new Date((this.getFullYear() + 1), dateHash["month"]-1, dateHash["day"], 0,0);
      }
      if ( tmpDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         return tmpDate;
      }
      else
      {
         return null;
      }
   }

   var newDate = leadTimeLowerBound; 
   while (newDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
   {
      var tmp = testDate(newDate, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek);
      if (tmp != null)
        return tmp;
      newDate = newDate.addDays(1);
   }
};

function testDate(testMe, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek)
{
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedYear)
   {
      bMatchedYear = (dateHash["year"] == testMe.getFullYear());
   }
   if (bSpecifiedMonth)
   {
      bMatchedMonth = ((dateHash["month"] - 1)  == testMe.getMonth() );
   }
   if (bSpecifiedDay)
   {
      bMatchedDay = (dateHash["day"] == testMe.getDate());
   }
   if (bSpecifiedDayOfWeek)
   {
      bMatchedDayOfWeek = (dateHash["dayofweek"] == testMe.getDay());
   }

   if (bMatchedYear && bMatchedMonth && bMatchedDay && bMatchedDayOfWeek)
   {
      return testMe;
   }
};

//Returns true if the date is in between two given dates
Date.prototype.isBetween = function isBetween(lowerBound, upperBound)
{
  return (this.getTime() >= lowerBound.getTime() && this.getTime() <= upperBound.getTime());
}
//Return a new date, with the time set to midnight (0000)
Date.prototype.getMidnight = function getMidnight()
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0);
};
// Add the specified number of days to a date.
Date.prototype.addDays = function addDays(numberOfDays)
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate() + numberOfDays, 0, 0);
};
//Return the number of days between two dates.
Date.prototype.getDifferenceInDays = function getDifferenceInDays(otherDate)
{
//I have to do it this way, because this way ignores daylight savings
   var tmpDate = this.addDays(0);
   if (this.getTime() > otherDate.getTime())
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() > otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(-1);
      }
      return i;
   }
   else
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() < otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(1);
      }
      return i * -1;
   }
   return 0;
};
function cloneParams(what) {
    var tmp = {};
    for (var i in what) {
        tmp[i] = what[i];
    }
    return tmp;
}
// Substitute date components into a string
Date.prototype.formatStringDateOnly = function formatStringDateOnly(template)
{
	template = template.replace("YYYY",this.getFullYear());
	template = template.replace("YY",String.zeroPad(this.getFullYear()-2000,2));
	template = template.replace("MMM",config.messages.dates.months[this.getMonth()]);
	template = template.replace("0MM",String.zeroPad(this.getMonth()+1,2));
	template = template.replace("MM",this.getMonth()+1);
	template = template.replace("DDD",config.messages.dates.days[this.getDay()]);
	template = template.replace("0DD",String.zeroPad(this.getDate(),2));
	template = template.replace("DD",this.getDate());
	return template;
};

//}}}
Things do to:
update codebase
import tiddlers and macros from 2006 tw, (find updated versions if necessary).

|plugin name|version|date|
|--ArchivedTimelines--|0.6.3|2007.01.14|
|--CalendarPlugin--|0.0.0|2006.08.23|
|--DatePlugin--|2.3.1|2007.06.20|
|--DaysLeftPlugin--|?.?.?|?.?.?|
|--LegacyStrikeThroughPlugin--|?.?.?|?.?.?|
|--LessBackupsPlugin--|3.0.|2007.06.18|
|NaNoWriMoCalendarPlugin|?.?.?|?.?.?|
|--ReminderMacros--|3.3.10|2007.06.28|
|--toggleSideBar--|1.0|2006.07.23|
the title/name for the footman serving in the dining room.  If there is more than one footman on duty, the senior footman is Samuel, the others are not addressed directly.
<<gradient vert #88ff44 #ffffff #0088ff>> <<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY">><<saveChanges>><<upload http://rkivist.tiddlyspot.com/store.cgi index.html . . rkivist>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
for the 2007 NaNoWriMo and NaNoFiMo
rkvist's TiddlyWiki
the current ([[1775]]) farm hand on [[Talboys Farm|TalboysFarm]].  He was left one and a half shillings in silver pence (thirty pieces of silver) by either [[Jane Archer|Archer, Jane]], or [[McGregor|McGregor, Morris]] the night that Jane died.

He failed to get the reference.
82 1/2 miles from London (taken from Hicks Hall).

SOUTHAM has more the appearance of a large village than a town; it is situated  on the turnpike road, and contains a handsome Gothic church, with a square tower at its west end, surmounted by a spire.  The market is held on Monday, but the chief support  of the inhabitants is derived from the expenditure of travelers who pas thorugh the town.

SOUTHAM, near at Ladbrook, //Wm Palmer//, Esq.

SOUTHAM, 1 1/2 m. beyond, Stoney Thorpe, //Henry Thomas Chamberlayne//, Esq.

p.209
a widow, wife of [[George Talboys|Talboys, George]], mother of [[Thomas Talboys|Talboys, Thomas]].  She hates [[Jane Archer|Archer, Jane]], and Jane's daughter, [[Bethany|Archer, Bethany]] as well.
Son of [[Samuel Talboys|Talboys, Samuel]], husband of [[Alison|Talboys, Alison Reece]], father of [[Thomas Talboys|Talboys, Thomas]].  Possible father of [[Bethany Archer|Archer, Elizabeth]]
Father of [[George Talboys|Talboys, George]], grandfather of [[Thomas Talboys|Talboys, Thomas]], possible father of [[Bethany Archer|Archer, Elizabeth]].  Owner of [[Talboys Farm|TalboysFarm]], a thin old man with bad teeth, worse breath, and quite possibly in possession of the first farthing he took from his father's purse.
Son of [[George|Talboys, George]] and [[Alison Talboys|Talboys, Alison Reece]], possible nephew or half brother of [[Bethany Archer|Archer, Elizabeth]].

A pudgy boy.
A farm outside of the city of Chester, run down, worked by the Talboys family and whatever hired hands they have at the moment.  Located in Cheshire.

[[George Talboys|Talboys, George]]
[[Samuel Talboys|Talboys, Samuel]]
[[Thomas Talboys|Talboys, Thomas]]
[[Alison Reece Talboys|Talboys, Alison Reece]]
[[Jem Solway|Solway, Jem]]
[[Jane Archer|Archer, Jane]]
[[Bethany Archer|Archer, Elizabeth]]
[[TiddlyWiki|http://www.tiddlywiki.com]]
/***

|Name|ToggleSideBarMacro|
|Created by|SaqImtiaz|
|Location|http://tw.lewcid.org/#ToggleSideBarMacro|
|Version|1.0|
|Requires|~TW2.x|
!Description:
Provides a button for toggling visibility of the SideBar. You can choose whether the SideBar should initially be hidden or displayed.

!Demo
<<toggleSideBar "Toggle Sidebar">>

!Usage:
{{{<<toggleSideBar>>}}} <<toggleSideBar>>
additional options:
{{{<<toggleSideBar label tooltip show/hide>>}}} where:
label = custom label for the button,
tooltip = custom tooltip for the button,
show/hide = use one or the other, determines whether the sidebar is shown at first or not.
(default is to show the sidebar)

You can add it to your tiddler toolbar, your MainMenu, or where you like really.
If you are using a horizontal MainMenu and want the button to be right aligned, put the following in your StyleSheet:
{{{ .HideSideBarButton {float:right;} }}}

!History
*23-07-06: version 1.0: completely rewritten, now works with custom stylesheets too, and easier to customize start behaviour. 
*20-07-06: version 0.11
*27-04-06: version 0.1: working.

!Code
***/
//{{{
config.macros.toggleSideBar={};

config.macros.toggleSideBar.settings={
         styleHide :  "#sidebar { display: none;}\n"+"#contentWrapper #displayArea { margin-right: 1em;}\n"+"",
         styleShow : " ",
         arrow1: "«",
         arrow2: "»"
};

config.macros.toggleSideBar.handler=function (place,macroName,params,wikifier,paramString,tiddler)
{
          var tooltip= params[1]||'toggle sidebar';
          var mode = (params[2] && params[2]=="hide")? "hide":"show";
          var arrow = (mode == "hide")? this.settings.arrow1:this.settings.arrow2;
          var label= (params[0]&&params[0]!='.')?params[0]+" "+arrow:arrow;
          var theBtn = createTiddlyButton(place,label,tooltip,this.onToggleSideBar,"button HideSideBarButton");
          if (mode == "hide")
             { 
             (document.getElementById("sidebar")).setAttribute("toggle","hide");
              setStylesheet(this.settings.styleHide,"ToggleSideBarStyles");
             }
};

config.macros.toggleSideBar.onToggleSideBar = function(){
          var sidebar = document.getElementById("sidebar");
          var settings = config.macros.toggleSideBar.settings;
          if (sidebar.getAttribute("toggle")=='hide')
             {
              setStylesheet(settings.styleShow,"ToggleSideBarStyles");
              sidebar.setAttribute("toggle","show");
              this.firstChild.data= (this.firstChild.data).replace(settings.arrow1,settings.arrow2);
              }
          else
              {    
               setStylesheet(settings.styleHide,"ToggleSideBarStyles");
               sidebar.setAttribute("toggle","hide");
               this.firstChild.data= (this.firstChild.data).replace(settings.arrow2,settings.arrow1);
              }

     return false;
}

setStylesheet(".HideSideBarButton .button {font-weight:bold; padding: 0 5px;}\n","ToggleSideBarButtonStyles");

//}}}
config.tiddlyspotSiteId = 'rkivist.tiddlyspot.com';
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 03/11/2007 09:13:57 | rkivist | [[eighteenth.html|file:///H:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | [[index.html | http://rkivist.tiddlyspot.com/index.html]] | . |
| 03/11/2007 09:27:54 | rkivist | [[eighteenth.html|file:///H:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | [[index.html | http://rkivist.tiddlyspot.com/index.html]] | . |
| 9/11/2007 13:52:52 | rkivist | [[eighteenth.html|file:///G:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 9/11/2007 13:53:13 | rkivist | [[eighteenth.html|file:///G:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 12/11/2007 9:1:5 | rkivist | [[eighteenth.html|file:///F:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 12/11/2007 9:2:10 | rkivist | [[eighteenth.html|file:///F:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 12/11/2007 9:2:59 | rkivist | [[eighteenth.html|file:///F:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |
| 16/11/2007 15:16:48 | rkivist | [[eighteenth.html|file:///G:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 16/11/2007 15:17:12 | rkivist | [[eighteenth.html|file:///G:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 19/11/2007 18:22:12 | YourName | [[eighteenth.html|file:///E:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |
| 21/11/2007 8:26:23 | rkivist | [[eighteenth.html|file:///F:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 26/11/2007 0:6:40 | rkivist | [[eighteenth.html|file:///E:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 26/11/2007 0:7:15 | rkivist | [[eighteenth.html|file:///E:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 26/11/2007 0:8:13 | rkivist | [[eighteenth.html|file:///E:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 27/11/2007 23:28:36 | rkivist | [[eighteenth.html|file:///E:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
| 7/12/2007 22:59:54 | rkivist | [[eighteenth.html|file:///D:/NaNoWriMo07/eighteenth.html]] | [[store.cgi|http://rkivist.tiddlyspot.com/store.cgi]] | . | index.html | . |
/***
<<tiddler UploadPluginDoc>>
!Code
***/
//{{{
version.extensions.UploadPlugin = {
 major: 3, minor: 3, revision: 3, 
 date: new Date(2006,6,30),
 type: 'macro',
 source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
 docs: 'http://tiddlywiki.bidix.info/#UploadPluginDoc'
};
//}}}

////+++!![config.lib.file]

//{{{
if (!config.lib) config.lib = {};
if (!config.lib.file) config.lib.file= {
 author: 'BidiX',
 version: {major: 0, minor: 1, revision: 0}, 
 date: new Date(2006,3,9)
};
config.lib.file.dirname = function (filePath) {
 var lastpos;
 if ((lastpos = filePath.lastIndexOf("/")) != -1) {
 return filePath.substring(0, lastpos);
 } else {
 return filePath.substring(0, filePath.lastIndexOf("\\"));
 }
};
config.lib.file.basename = function (filePath) {
 var lastpos;
 if ((lastpos = filePath.lastIndexOf("#")) != -1) 
 filePath = filePath.substring(0, lastpos);
 if ((lastpos = filePath.lastIndexOf("/")) != -1) {
 return filePath.substring(lastpos + 1);
 } else
 return filePath.substring(filePath.lastIndexOf("\\")+1);
};
window.basename = function() {return "@@deprecated@@";};
//}}}
////===

////+++!![config.lib.log]

//{{{
if (!config.lib) config.lib = {};
if (!config.lib.log) config.lib.log= {
 author: 'BidiX',
 version: {major: 0, minor: 1, revision: 0}, 
 date: new Date(2006,3,9)
};
config.lib.Log = function(tiddlerTitle, logHeader) {
 if (version.major < 2)
 this.tiddler = store.tiddlers[tiddlerTitle];
 else
 this.tiddler = store.getTiddler(tiddlerTitle);
 if (!this.tiddler) {
 this.tiddler = new Tiddler();
 this.tiddler.title = tiddlerTitle;
 this.tiddler.text = "| !date | !user | !location |" + logHeader;
 this.tiddler.created = new Date();
 this.tiddler.modifier = config.options.txtUserName;
 this.tiddler.modified = new Date();
 if (version.major < 2)
 store.tiddlers[tiddlerTitle] = this.tiddler;
 else
 store.addTiddler(this.tiddler);
 }
 return this;
};

config.lib.Log.prototype.newLine = function (line) {
 var now = new Date();
 var newText = "| ";
 newText += now.getDate()+"/"+(now.getMonth()+1)+"/"+now.getFullYear() + " ";
 newText += now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" | ";
 newText += config.options.txtUserName + " | ";
 var location = document.location.toString();
 var filename = config.lib.file.basename(location);
 if (!filename) filename = '/';
 newText += "[["+filename+"|"+location + "]] |";
 this.tiddler.text = this.tiddler.text + "\n" + newText;
 this.addToLine(line);
};

config.lib.Log.prototype.addToLine = function (text) {
 this.tiddler.text = this.tiddler.text + text;
 this.tiddler.modifier = config.options.txtUserName;
 this.tiddler.modified = new Date();
 if (version.major < 2)
 store.tiddlers[this.tiddler.tittle] = this.tiddler;
 else {
 store.addTiddler(this.tiddler);
 story.refreshTiddler(this.tiddler.title);
 store.notify(this.tiddler.title, true);
 }
 if (version.major < 2)
 store.notifyAll(); 
};
//}}}
////===

////+++!![config.lib.options]

//{{{
if (!config.lib) config.lib = {};
if (!config.lib.options) config.lib.options = {
 author: 'BidiX',
 version: {major: 0, minor: 1, revision: 0}, 
 date: new Date(2006,3,9)
};

config.lib.options.init = function (name, defaultValue) {
 if (!config.options[name]) {
 config.options[name] = defaultValue;
 saveOptionCookie(name);
 }
};
//}}}
////===

////+++!![PasswordTweak]

//{{{
version.extensions.PasswordTweak = {
 major: 1, minor: 0, revision: 2, date: new Date(2006,3,11),
 type: 'tweak',
 source: 'http://tiddlywiki.bidix.info/#PasswordTweak'
};
//}}}
/***
!!config.macros.option
***/
//{{{
config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordType = "password"; // password | text

config.macros.option.onChangeOption = function(e)
{
 var opt = this.getAttribute("option");
 var elementType,valueField;
 if(opt) {
 switch(opt.substr(0,3)) {
 case "txt":
 elementType = "input";
 valueField = "value";
 break;
 case "pas":
 elementType = "input";
 valueField = "value";
 break;
 case "chk":
 elementType = "input";
 valueField = "checked";
 break;
 }
 config.options[opt] = this[valueField];
 saveOptionCookie(opt);
 var nodes = document.getElementsByTagName(elementType);
 for(var t=0; t<nodes.length; t++) {
 var optNode = nodes[t].getAttribute("option");
 if (opt == optNode) 
 nodes[t][valueField] = this[valueField];
 }
 }
 return(true);
};

config.macros.option.handler = function(place,macroName,params)
{
 var opt = params[0];
 var size = 15;
 if (params[1])
 size = params[1];
 if(config.options[opt] === undefined) {
 return;}
 var c;
 switch(opt.substr(0,3)) {
 case "txt":
 c = document.createElement("input");
 c.onkeyup = this.onChangeOption;
 c.setAttribute ("option",opt);
 c.size = size;
 c.value = config.options[opt];
 place.appendChild(c);
 break;
 case "pas":
 // input password
 c = document.createElement ("input");
 c.setAttribute("type",config.macros.option.passwordType);
 c.onkeyup = this.onChangeOption;
 c.setAttribute("option",opt);
 c.size = size;
 c.value = config.options[opt];
 place.appendChild(c);
 // checkbox link with this password "save this password on this computer"
 c = document.createElement("input");
 c.setAttribute("type","checkbox");
 c.onclick = this.onChangeOption;
 c.setAttribute("option","chk"+opt);
 place.appendChild(c);
 c.checked = config.options["chk"+opt];
 // text savePasswordCheckboxLabel
 place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
 break;
 case "chk":
 c = document.createElement("input");
 c.setAttribute("type","checkbox");
 c.onclick = this.onChangeOption;
 c.setAttribute("option",opt);
 place.appendChild(c);
 c.checked = config.options[opt];
 break;
 }
};
//}}}
/***
!! Option cookie stuff
***/
//{{{
window.loadOptionsCookie_orig_PasswordTweak = window.loadOptionsCookie;
window.loadOptionsCookie = function()
{
 var cookies = document.cookie.split(";");
 for(var c=0; c<cookies.length; c++) {
 var p = cookies[c].indexOf("=");
 if(p != -1) {
 var name = cookies[c].substr(0,p).trim();
 var value = cookies[c].substr(p+1).trim();
 switch(name.substr(0,3)) {
 case "txt":
 config.options[name] = unescape(value);
 break;
 case "pas":
 config.options[name] = unescape(value);
 break;
 case "chk":
 config.options[name] = value == "true";
 break;
 }
 }
 }
};

window.saveOptionCookie_orig_PasswordTweak = window.saveOptionCookie;
window.saveOptionCookie = function(name)
{
 var c = name + "=";
 switch(name.substr(0,3)) {
 case "txt":
 c += escape(config.options[name].toString());
 break;
 case "chk":
 c += config.options[name] ? "true" : "false";
 // is there an option link with this chk ?
 if (config.options[name.substr(3)]) {
 saveOptionCookie(name.substr(3));
 }
 break;
 case "pas":
 if (config.options["chk"+name]) {
 c += escape(config.options[name].toString());
 } else {
 c += "";
 }
 break;
 }
 c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/";
 document.cookie = c;
};
//}}}
/***
!! Initializations
***/
//{{{
// define config.options.pasPassword
if (!config.options.pasPassword) {
 config.options.pasPassword = 'defaultPassword';
 window.saveOptionCookie('pasPassword');
}
// since loadCookies is first called befor password definition
// we need to reload cookies
window.loadOptionsCookie();
//}}}
////===

////+++!![config.macros.upload]

//{{{
config.macros.upload = {
 accessKey: "U",
 formName: "UploadPlugin",
 contentType: "text/html;charset=UTF-8",
 defaultStoreScript: "store.php"
};

// only this two configs need to be translated
config.macros.upload.messages = {
 aboutToUpload: "About to upload TiddlyWiki to %0",
 errorDownloading: "Error downloading",
 errorUploadingContent: "Error uploading content",
 fileNotFound: "file to upload not found",
 fileNotUploaded: "File %0 NOT uploaded",
 mainFileUploaded: "Main TiddlyWiki file uploaded to %0",
 urlParamMissing: "url param missing",
 rssFileNotUploaded: "RssFile %0 NOT uploaded",
 rssFileUploaded: "Rss File uploaded to %0"
};

config.macros.upload.label = {
 promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
 promptParamMacro: "Save and Upload this TiddlyWiki in %0",
 saveLabel: "save to web", 
 saveToDisk: "save to disk",
 uploadLabel: "upload" 
};

config.macros.upload.handler = function(place,macroName,params){
 // parameters initialization
 var storeUrl = params[0];
 var toFilename = params[1];
 var backupDir = params[2];
 var uploadDir = params[3];
 var username = params[4];
 var password; // for security reason no password as macro parameter
 var label;
 if (document.location.toString().substr(0,4) == "http")
 label = this.label.saveLabel;
 else
 label = this.label.uploadLabel;
 var prompt;
 if (storeUrl) {
 prompt = this.label.promptParamMacro.toString().format([this.dirname(storeUrl)]);
 }
 else {
 prompt = this.label.promptOption;
 }
 createTiddlyButton(place, label, prompt, 
 function () {
 config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password); 
 return false;}, 
 null, null, this.accessKey);
};
config.macros.upload.UploadLog = function() {
 return new config.lib.Log('UploadLog', " !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |" );
};
config.macros.upload.UploadLog.prototype = config.lib.Log.prototype;
config.macros.upload.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
 var line = " [[" + config.lib.file.basename(storeUrl) + "|" + storeUrl + "]] | ";
 line += uploadDir + " | " + toFilename + " | " + backupDir + " |";
 this.newLine(line);
};
config.macros.upload.UploadLog.prototype.endUpload = function() {
 this.addToLine(" Ok |");
};
config.macros.upload.basename = config.lib.file.basename;
config.macros.upload.dirname = config.lib.file.dirname;
config.macros.upload.upload = function(storeUrl, toFilename, uploadDir, backupDir, username, password)
{
 // parameters initialization
 storeUrl = (storeUrl ? storeUrl : config.options.txtUploadStoreUrl);
 toFilename = (toFilename ? toFilename : config.options.txtUploadFilename);
 backupDir = (backupDir ? backupDir : config.options.txtUploadBackupDir);
 uploadDir = (uploadDir ? uploadDir : config.options.txtUploadDir);
 username = (username ? username : config.options.txtUploadUserName);
 password = config.options.pasUploadPassword; // for security reason no password as macro parameter
 if (storeUrl === '') {
 config.macros.upload.defaultStoreScript;
 }
 if (config.lib.file.dirname(storeUrl) === '') {
 storeUrl = config.lib.file.dirname(document.location.toString())+'/'+storeUrl;
 }
 if (toFilename === '') {
 toFilename = config.lib.file.basename(document.location.toString());
 }

 clearMessage();
 // only for forcing the message to display
 if (version.major < 2)
 store.notifyAll();
 if (!storeUrl) {
 alert(config.macros.upload.messages.urlParamMissing);
 return;
 }
 
 var log = new this.UploadLog();
 log.startUpload(storeUrl, toFilename, uploadDir, backupDir);
 if (document.location.toString().substr(0,5) == "file:") {
 saveChanges();
 }
 displayMessage(config.macros.upload.messages.aboutToUpload.format([this.dirname(storeUrl)]), this.dirname(storeUrl));
 this.uploadChanges(storeUrl, toFilename, uploadDir, backupDir, username, password);
 if(config.options.chkGenerateAnRssFeed) {
 //var rssContent = convertUnicodeToUTF8(generateRss());
 var rssContent = generateRss();
 var rssPath = toFilename.substr(0,toFilename.lastIndexOf(".")) + ".xml";
 this.uploadContent(rssContent, storeUrl, rssPath, uploadDir, '', username, password, 
 function (responseText) {
 if (responseText.substring(0,1) != '0') {
 displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([rssPath]));
 }
 else {
 if (uploadDir) {
 rssPath = uploadDir + "/" + config.macros.upload.basename(rssPath);
 } else {
 rssPath = config.macros.upload.basename(rssPath);
 }
 displayMessage(config.macros.upload.messages.rssFileUploaded.format(
 [config.macros.upload.dirname(storeUrl)+"/"+rssPath]), config.macros.upload.dirname(storeUrl)+"/"+rssPath);
 }
 // for debugging store.php uncomment last line
 //DEBUG alert(responseText);
 });
 }
 return;
};

config.macros.upload.uploadChanges = function(storeUrl, toFilename, uploadDir, backupDir, 
 username, password) {
 var original;
 if (document.location.toString().substr(0,4) == "http") {
 original = this.download(storeUrl, toFilename, uploadDir, backupDir, username, password);
 return;
 }
 else {
 // standard way : Local file
 
 original = loadFile(getLocalPath(document.location.toString()));
 if(window.Components) {
 // it's a mozilla browser
 try {
 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
 .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
 converter.charset = "UTF-8";
 original = converter.ConvertToUnicode(original);
 }
 catch(e) {
 }
 }
 }
 //DEBUG alert(original);
 this.uploadChangesFrom(original, storeUrl, toFilename, uploadDir, backupDir, 
 username, password);
};

config.macros.upload.uploadChangesFrom = function(original, storeUrl, toFilename, uploadDir, backupDir, 
 username, password) {
 var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it
 var endSaveArea = '</d' + 'iv>';
 // Locate the storeArea div's
 var posOpeningDiv = original.indexOf(startSaveArea);
 var posClosingDiv = original.lastIndexOf(endSaveArea);
 if((posOpeningDiv == -1) || (posClosingDiv == -1))
 {
 alert(config.messages.invalidFileError.format([document.location.toString()]));
 return;
 }
 var revised = original.substr(0,posOpeningDiv + startSaveArea.length) + 
 allTiddlersAsHtml() + "\n\t\t" +
 original.substr(posClosingDiv);
 var newSiteTitle;
 if(version.major < 2){
 newSiteTitle = (getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode();
 } else {
 newSiteTitle = (wikifyPlain ("SiteTitle") + " - " + wikifyPlain ("SiteSubtitle")).htmlEncode();
 }
 revised = revised.replace(new RegExp("<title>[^<]*</title>", "im"),"<title>"+ newSiteTitle +"</title>");
 var response = this.uploadContent(revised, storeUrl, toFilename, uploadDir, backupDir, 
 username, password, function (responseText) {
 if (responseText.substring(0,1) != '0') {
 alert(responseText);
 displayMessage(config.macros.upload.messages.fileNotUploaded.format([getLocalPath(document.location.toString())]));
 }
 else {
 if (uploadDir !== '') {
 toFilename = uploadDir + "/" + config.macros.upload.basename(toFilename);
 } else {
 toFilename = config.macros.upload.basename(toFilename);
 }
 displayMessage(config.macros.upload.messages.mainFileUploaded.format(
 [config.macros.upload.dirname(storeUrl)+"/"+toFilename]), config.macros.upload.dirname(storeUrl)+"/"+toFilename);
 var log = new config.macros.upload.UploadLog();
 log.endUpload();
 store.setDirty(false);
 }
 // for debugging store.php uncomment last line
 //DEBUG alert(responseText);
 }
 );
};

config.macros.upload.uploadContent = function(content, storeUrl, toFilename, uploadDir, backupDir, 
 username, password, callbackFn) {
 var boundary = "---------------------------"+"AaB03x"; 
 var request;
 try {
 request = new XMLHttpRequest();
 } 
 catch (e) { 
 request = new ActiveXObject("Msxml2.XMLHTTP"); 
 }
 if (window.netscape){
 try {
 if (document.location.toString().substr(0,4) != "http") {
 netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');}
 }
 catch (e) { }
 } 
 //DEBUG alert("user["+config.options.txtUploadUserName+"] password[" + config.options.pasUploadPassword + "]");
 // compose headers data
 var sheader = "";
 sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
 sheader += config.macros.upload.formName +"\"\r\n\r\n";
 sheader += "backupDir="+backupDir
 +";user=" + username 
 +";password=" + password
 +";uploaddir=" + uploadDir
 + ";;\r\n"; 
 sheader += "\r\n" + "--" + boundary + "\r\n";
 sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+toFilename+"\"\r\n";
 sheader += "Content-Type: " + config.macros.upload.contentType + "\r\n";
 sheader += "Content-Length: " + content.length + "\r\n\r\n";
 // compose trailer data
 var strailer = new String();
 strailer = "\r\n--" + boundary + "--\r\n";
 var data;
 data = sheader + content + strailer;
 //request.open("POST", storeUrl, true, username, password);
 request.open("POST", storeUrl, true);
 request.onreadystatechange = function () {
 if (request.readyState == 4) {
 if (request.status == 200)
 callbackFn(request.responseText);
 else
 alert(config.macros.upload.messages.errorUploadingContent);
 }
 };
 request.setRequestHeader("Content-Length",data.length);
 request.setRequestHeader("Content-Type","multipart/form-data; boundary="+boundary);
 request.send(data); 
};


config.macros.upload.download = function(uploadUrl, uploadToFilename, uploadDir, uploadBackupDir, 
 username, password) {
 var request;
 try {
 request = new XMLHttpRequest();
 } 
 catch (e) { 
 request = new ActiveXObject("Msxml2.XMLHTTP"); 
 }
 try {
 if (uploadUrl.substr(0,4) == "http") {
 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 }
 else {
 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 }
 } catch (e) { }
 //request.open("GET", document.location.toString(), true, username, password);
 request.open("GET", document.location.toString(), true);
 request.onreadystatechange = function () {
 if (request.readyState == 4) {
 if(request.status == 200) {
 config.macros.upload.uploadChangesFrom(request.responseText, uploadUrl, 
 uploadToFilename, uploadDir, uploadBackupDir, username, password);
 }
 else
 alert(config.macros.upload.messages.errorDownloading.format(
 [document.location.toString()]));
 }
 };
 request.send(null);
};

//}}}
////===

////+++!![Initializations]

//{{{
config.lib.options.init('txtUploadStoreUrl','store.php');
config.lib.options.init('txtUploadFilename','');
config.lib.options.init('txtUploadDir','');
config.lib.options.init('txtUploadBackupDir','');
config.lib.options.init('txtUploadUserName',config.options.txtUserName);
config.lib.options.init('pasUploadPassword','');
config.shadowTiddlers.UploadPluginDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadPluginDoc ]]\n"; 


//}}}
////===

////+++!![Core Hijacking]

//{{{
config.macros.saveChanges.label_orig_UploadPlugin = config.macros.saveChanges.label;
config.macros.saveChanges.label = config.macros.upload.label.saveToDisk;

config.macros.saveChanges.handler_orig_UploadPlugin = config.macros.saveChanges.handler;

config.macros.saveChanges.handler = function(place)
{
 if ((!readOnly) && (document.location.toString().substr(0,4) != "http"))
 createTiddlyButton(place,this.label,this.prompt,this.onClick,null,null,this.accessKey);
}

//}}}
////===
//last update: UploadPlugin v 4.1.1//

!Description
UploadPlugin with <<tag UploadService>> extend TiddlyWiki with @@upload@@ and @@save to web@@ commands. 
UploadPlugin uses Username and Password from UploadOptions stored in cookies to authenticate itself to [[store.php]] or [[store.cgi]].
UploadPlugin requires PasswordOptionPlugin.
French translation available as a separate tiddler UploadPluginMsgFR

!!UploadPlugin
*If the TiddlyWiki is viewed @@from local disk@@ :
**{{{<<upload ...>>}}}
***display as '''upload'''
***after saving to disk, upload to a website.
*If the TiddlyWiki is viewed @@from a website@@ :
**{{{<<upload ...>>}}}
***display as '''save to web'''
***save to the same website.
*If GenerateAnRssFeed in AdvancedOptions is set :
**generate the content of the RSSFeed 
**upload the RssFile
**Caution : use the SiteUrl tiddler to specify the right url of the TiddlyWiki in the generated RssFile
*DisplayMessage
*If a backupDir is specified
**and if a file already exists in the uploadDir withe the same fielname, move it in the backup dir and rename it with a timestamp
*if UploadLog is activated every upload action is logged in UploadLog
**only the last maxLines are stored
**if maxLine = -1 no truncation will occured 
hint : if UploadLog is the first tiddler in the TimelineTab, no tiddler has been changed since last upload.

!![[store.php]]
*UserVariables to set :
//{{{
$AUTHENTICATE_USER = true; // true | false
$USERS = array(
 'UserName1'=>'Password1', 
 'UserName2'=>'Password2', 
 'UserName3'=>'Password3'); // set usernames and strong passwords
$DEBUG = false; // true | false
//}}}
*method GET
**display an information page
*method POST
**if $~AUTHENTICATE_USER is ''true''
***presence and value of user and password are checked with $USER and $PASSWORD 
**if toFilename already exists and backDir parameter specified
***rename toFilename to backupDir/toFilename.AAAAMMDD.HHSS.html
**copy temporaryUploadedFile toFilename
**return status

!![[store.cgi]]
*UserVariables to set :
//{{{
CONFIG = {
 :users => {
 'UserName1'=>'Password1', 
 'UserName2'=>'Password2', 
 'UserName3'=>'Password3')
 },
 :authenticateUser => true,
 :backupExistingFile => true,
 :withUploadDir => true
}
//}}}
*same processing as store.php above

!Usage : 
{{{
<<upload>>
 uses UploadOptions saved in cookies :
 txtUploadUserName: username
 pasUploadPassword : password
 txtUploadStoreUrl : store script
 txtUploadDir : relative path for upload directory
 txtUploadFilename : upload filename
 txtUploadBackupDir : relative path for backup directory

<<upload [storeUrl [toFilename [backupDir [uploadDir [username]]]]]>>
 Optional positional parameters can be passed to overwrite 
 UploadOptions. 
}}}

Suggestion: Install the {{{<<upload ... >>}}} macro in SideBarOptions just below {{{<<saveChanges>>}}} macro.


!User manual
See HowToUpload

!Installation :
*Install the UploadPlugin as usual
*[[Upload]] the [[store.php]] file on your php aware webserver in your TiddlyWiki directory
*Protect your server against malicious upload. Two approaches :
**set $~AUTHENTICATE_USER to true in the [[store.php]] script
***configure $USER and $PASSWORD in the [[store.php]] script on your webserver
***set UploadOptions in conformity with [[store.php]]
**Use server protection :
***for Apache web server ([[for detail see Apache documentation|http://httpd.apache.org/docs/1.3/howto/htaccess.html]]) : 
****configure and upload the [[.htaccess]] [[.passwd]]
***for other web servers see the appropriate documentation
*Configure an upload button, for example in the SideBarOptions
!Suppported Browser
*Firefox and Gecko based browser: tested Ok
*Internet Explorer : tested Ok
*Safari : tested ok on OS X
*Others : Not tested, please report status.

!Revision history
<<tiddler UploadPluginRevisionHistory>>
Butler of Pendleton Abbey.
He has a nephew named [[Michael]]
[[Dandified's items tagged 18thcentury|http://del.icio.us/Dandified/18thcentury]]
[[Georgian Index|http://www.georgianindex.net/fd/index.html]]
[[Correct forms of Address|http://laura.chinet.com/html/titles12.html]]
[[Antique Bloodletting and Leeching Instruments|http://www.medicalantiques.com/medical/Scarifications_and_Bleeder_Medical_Antiques.htm]]
[[The Macaroni Club: Homosexual Scandals in 1772|http://www.infopt.demon.co.uk/macaroni.htm]]
[[Behind the Name - the etymology and history of first names|http://www.behindthename.com/]]
[[Fashion History Costume Trends and Eras|http://www.fashion-era.com/]]
WELLINGBOROUGH is supposed to have derived its name from the number of medicinal springs in its neighborhood, one of which , called Redwell, was formerly of consideable celebrity.  The town is ancient, but, owing to a dreadful fire in 1738, contiains many good modern buildings; it is situated on te slope of a hill, and the streets are generally clean.  The church is spacious;  it has a handsome tower at its west end, surmounted by a spire; the building is elegantly decorated, and has three stalls on each side of the chancel, similar to those in cathedral choirs.  Market on Wednesday
69 (or 68 3/4) miles from London
Posting house is The Hind
Parish church is All Hallows (from the web)

Hannah Sparke (from [[the web|http://allhallowswellingborough.com/folk.aspx]])
An entry in the church register reads 'On July 28th, 1738 happened a terrible fire at 2 of ye clock in the afternoon and in less than 4 hours consumed the best part of the town, it was on a fryday.' So great was the heat that it melted the leads on the church roof. Hannah Sparke was the heroine of the day. Water being scarce, she ordered her cellars in Pebble Lane to be emptied of the 'malt liquors' and used them to quench the flames, These she stemmed by spreading blankets soaked in beer upon the roof of her house. 
Hannah lived to well into her second century. On her hundredth birthday the people of the town carried her head-high around the town centre! 
Her portrait is preserved in a print by Bartolozzi and her coffin was discovered in 1911 during the installation of the new heating system. This famous Wellingborough centenarian's remains were enclosed in a leaded coffin, about 18 inches below the slab. On the coffin lid was a crown, her name and age (107) standing up well in raised leaded letters. The coffin was moved 2ft. nearer the east end which indicates that it is now east of the heating channel where it crosses the centre aisle.
[[A Tour of Scotland, 1769|http://www.amazon.co.uk/Tour-Scotland-1769-Thomas-Pennant/dp/187474470X]]
1 pence = 4 farthings = 2 half pence (written 1 d.)
1 shilling = 12 pence (written 1 s.)
1 pound = 20 shilling (written 1 look up pound symbol)
drawers, knickers, panties .... nonexistant?
look up fish chowder, or chowders in general
look up a luncheon menu in 18th century england.
[img[http://www.neilgaiman.com/exclusive/nanowrimo/meter.php?uid=31466&offset=-5]]
[img[http://www.neilgaiman.com/exclusive/nanowrimo/sparkline.php?uid=31466&type=bar&difference=true&less=red&more=green]]
[[wordcount widgets|http://tinyurl.com/332plj]] 

[img[http://www.nanowrimo.org/NanowrimoUtils/NanowrimoGraph/31466.png]]
| tiddlyspot password:|<<option pasUploadPassword>>|
| site management:|<<upload http://rkivist.tiddlyspot.com/store.cgi index.html . . rkivist>>//(requires tiddlyspot password)//<<br>>[[control panel|http://rkivist.tiddlyspot.com/controlpanel]], [[download (go offline)|http://rkivist.tiddlyspot.com/download]]|
| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://faq.tiddlyspot.com/]], [[announcements|http://announce.tiddlyspot.com/]], [[blog|http://tiddlyspot.com/blog/]], email [[support|mailto:support@tiddlyspot.com]] & [[feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|
what rank does the daughter of a Viscount have,
"Honorable Miss" or "Miss" or "Lady"
Chester, Cheshire, to [[Southam, Warwickshire]] Distance: 113.8 miles Time: 1 hour 46 mins (approx.) (from Yahoo Maps) TalboysFarm is 5 miles south of Chester, 
--Southam, Warwickshire, to Crawley, Kent 118.7 miles Time: 1 hour 43 mins (approx.) (from Yahoo Maps) Pendleton Abbey is 15 miles north and west of Crawley.--
[[Neyland, Suffolk]], 57 miles from London (PatersonsRoads1826), Pendleton Abbey is not far from it from [[Southam, Warwickshire]] Distance: 127 mi Time: about 3 hours 23 mins  (from Google Maps)
overnight stops:
[[Wellingborough, Northamptonshire]], approximately 33.9 miles
[[Caxton, Cambridgeshire]] approximately 33.1 miles
[[Haverhill, Suffolk]] approximately 29.7 mi 
Nayland, Cholchester, Suffolk, approximately 25.4 miles