Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association
[img[http://latex.codecogs.com/gif.latex?\frac{22}{7}]]
/***
|''Navn:''|DanishTranslationPlugin|
|''Beskrivelse:''|Translation of TiddlyWiki into Danish|
|''Forfatter:''|MartinBudden (mjbudden (at) gmail (dot) com)|
|''Kilde:''|www.example.com |
|''CodeRepository:''|http://svn.tiddlywiki.org/Trunk/association/locales/core/en/locale.en.js |
|''Version:''|0.3.7|
|''Dato:''|Jul 6, 2007|
|''Kommentarer:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''Licens:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.4|
***/
//{{{
//--
//-- Translateable strings
//--
// Strings in "double quotes" should be translated; strings in 'single quotes' should be left alone
config.locale = "da"; // W3C language tag
if (config.options.txtUserName == 'YourName') // do not translate this line, but do translate the next line
merge(config.options,{txtUserName: "DitNavn"});
merge(config.tasks,{
save: {text: "gem", tooltip: "Gem dine ændringer til denne TiddlyWiki", action: saveChanges},
sync: {text: "synk", tooltip: "Synkronisér ændringer med andre TiddlyWiki filer og servere", content: '<<sync>>'},
importTask: {text: "importér", tooltip: "Importér tiddlers og plugins fra andre TiddlyWiki filer og servere", content: '<<importTiddlers>>'},
tweak: {text: "Tilpas", tooltip: "Tilpas TiddlyWikis udseende og opførsel", content: '<<options>>'},
upgrade: {text: "upgradér", tooltip: "Upgrader TiddlyWikis kerne kode", content: '<<upgrade>>'},
plugins: {text: "udvidelser", tooltip: "Administrér installerede udvidelser", content: '<<plugins>>'}
});
// Options that can be set in the options panel and/or cookies
merge(config.optionsDesc,{
txtUserName: "Brugernavn til signering af dine ændringer",
chkRegExpSearch: "Avend almindelige udtryk til søgninger",
chkCaseSensitiveSearch: "Forskel på store og små bogstaver",
chkIncrementalSearch: "Bogstav for bogstav-søgning",
chkAnimate: "Anvend animationer",
chkSaveBackups: "Gem en backupfil når der gemmes ændringer",
chkAutoSave: "Gem automatisk ændringer",
chkGenerateAnRssFeed: "Lav et RSS feed når der gemmes ændringer",
chkSaveEmptyTemplate: "Lav en tom skabelon når der gemmes ændringer",
chkOpenInNewWindow: "Åben internet links i et nyt vindue",
chkToggleLinks: "Når man klikker på et link i åbne tiddlers lukkes de",
chkHttpReadOnly: "Skjul redigeringsværktøjer når den vises over HTTP",
chkForceMinorUpdate: "Opdatér ikke brugernavn og dato når tiddlers bliver ændrede",
chkConfirmDelete: "Bed om bekræftelse før tiddlers slettes",
chkInsertTabs: "Brug tab tasten til at indsætte tab tegn istedet for at hoppe imellem felter",
txtBackupFolder: "Navn på mappe til brug for backups",
txtMaxEditRows: "Maximum antal af rækker i edit bokse",
txtFileSystemCharSet: "Default tegnsæt til at gemme ændringer (Kun i Firefox/Mozilla)"});
merge(config.messages,{
customConfigError: "Der opstod problemer ved loading af udvidelser. Se PluginManager for detaljer",
pluginError: "Fejl: %0",
pluginDisabled: "Ikke udført fordi det er slået fra via 'systemConfigDisable' tag",
pluginForced: "Udført fordi det er tvunget via 'systemConfigForce' tag",
pluginVersionError: "Ikke udført fordi denne udvidelse kræver en nyere udgave af TiddlyWiki",
nothingSelected: "Intet er valgt. Du er nødt til at vælge en eller flere ting først",
savedSnapshotError: "Det ser ud som om denne TiddlyWiki er blevet gemt forkert. Se venligst http://www.tiddlywiki.com/#DownloadSoftware for details",
subtitleUnknown: "(ukendt)",
undefinedTiddlerToolTip: "Tiddleren '%0' findes ikke endnu",
shadowedTiddlerToolTip: "Tiddleren '%0' findes ikke endnu, men har en foruddefineret skygge værdi",
tiddlerLinkTooltip: "%0 - %1, %2",
externalLinkTooltip: "Internet link til %0",
noTags: "Der er ingen taggede tiddlere",
notFileUrlError: "Du er nødt til at gemme denne TiddlyWiki til en fil før du kan gemme ændringer",
cantSaveError: "Det er ikke muligt at gemme ændringer. Mulige grunde indbefatter:\n- din browser understøtter det ikke (Firefox, Internet Explorer, Safari og Opera virker alle fint hvis de er konfigurerede korrekt)\n- stien til din TiddlyWiki fil indeholder ulovlige tegn\n- TiddlyWiki HTML filen er blevet flyttet eller omdøbt",
invalidFileError: "Den originale fil '%0' lader ikke til at være en rigtig TiddlyWiki",
backupSaved: "Backup gemt",
backupFailed: "Det lykkedes IKKE at gemme en backup fil",
rssSaved: "RSS feed gemt",
rssFailed: "Det lykkedes IKKE at gemme et RSS feed",
emptySaved: "Tom skabelon gemt",
emptyFailed: "Det lykkedes IKKE at gemme en tom skabelon",
mainSaved: "Hoved TiddlyWiki fil gemt",
mainFailed: "Det lykkedes IKKE at gemme hoved TiddlyWiki filen. Dine ændringer er IKKE blevet gemt",
macroError: "Fejl i makro <<\%0>>",
macroErrorDetails: "Fejl ved udførsel af makro <<\%0>>:\n%1",
missingMacro: "Ingen sådan makro",
overwriteWarning: "En tiddler med navnet '%0' findes allerede. Vælg OK for at overskrive den",
unsavedChangesWarning: "ADVARSEL! Der er ugemte æmdringer i TiddlyWikien\n\nVælg OK for at gemme\nVælg FORTRYD for at afvise",
confirmExit: "--------------------------------\n\nDer er ugemte ændringer i TiddlyWikien. Hvis du fortsætter vil du miste disse ændringer\n\n--------------------------------",
saveInstructions: "GemÆndringer",
unsupportedTWFormat: "Ikke understøttet TiddlyWiki format '%0'",
tiddlerSaveError: "Fejl ved forsøg på at gemme tiddler '%0'",
tiddlerLoadError: "Fejl ved load af tiddler '%0'",
wrongSaveFormat: "Kan ikke gemme med formatet '%0'. Bruger standard format til at gemme.",
invalidFieldName: "Ikke tilladt feltnavn %0",
fieldCannotBeChanged: "Felt '%0' kan ikke ændres",
loadingMissingTiddler: "Forsøger at hente tiddleren '%0' fra '%1' serveren ved:\n\n'%2' i arbejdsområdet '%3'",
upgradeDone: "Opgradering til version %0 er nu fuldført\n\nKlik 'OK' for at genopfriske den nyligt opgraderede TiddlyWiki"});
merge(config.messages.messageClose,{
text: "luk",
tooltip: "luk dette meddelelsesområde"});
config.messages.backstage = {
open: {text: "bagscenen", tooltip: "Åben bagsceneområdet for at ændre på nogle grundlæggende indstillinger"},
close: {text: "luk", tooltip: "Luk bagsceneområdet"},
prompt: "bagscenen: ",
decal: {
edit: {text: "edit", tooltip: "Redigér tiddleren '%0'"}
}
};
config.messages.listView = {
tiddlerTooltip: "Klik for at se hele denne tiddlers tekst",
previewUnavailable: "(forhåndsvisning er ikke tilgængelig)"
};
config.messages.dates.months = ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November","December"];
config.messages.dates.days = ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"];
config.messages.dates.shortMonths = ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"];
config.messages.dates.shortDays = ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"];
// suffixes for dates, eg "1ste","2den","3die"..."30te","31te"
config.messages.dates.daySuffixes = ["ste","den","die","te","te","te","te","te","te","te",
"te","te","te","te","te","te","te","te","te","te",
"ste","den","die","te","te","te","te","te","te","te",
"te"];
config.messages.dates.am = "formiddag";
config.messages.dates.pm = "eftermiddag";
merge(config.messages.tiddlerPopup,{
});
merge(config.views.wikified.tag,{
labelNoTags: "ingen tags",
labelTags: "tags: ",
openTag: "Åben tag '%0'",
tooltip: "Vis tiddlere der er taggede med '%0'",
openAllText: "Åben alle",
openAllTooltip: "Åben alle disse tiddlere",
popupNone: "Ingen andre tiddlere er taggede med '%0'"});
merge(config.views.wikified,{
defaultText: "Tiddleren '%0' findes ikke endnu. Dobbelt-klik for at lave den",
defaultModifier: "(mangler)",
shadowModifier: "(indbygget skygge tiddler)",
dateFormat: "DD MMM YYYY", // use this to change the date format for your locale, eg "YYYY MMM DD", do not translate the Y, M or D
createdPrompt: "lavet"});
merge(config.views.editor,{
tagPrompt: "Skriv tags delt med mellemrum, [[brug 2 dobbelte firkantede klammer]] om nødvendigt, eller tilføj allerede eksisterende",
defaultText: "Skriv teksten til '%0'"});
merge(config.views.editor.tagChooser,{
text: "tags",
tooltip: "Vælg eksisterende tags som tilføjelse til denne tiddler",
popupNone: "Der er ikke defineret nogen tags",
tagTooltip: "Tilføj tagget '%0'"});
merge(config.messages,{
sizeTemplates:
[
{unit: 1024*1024*1024, template: "%0\u00a0GB"},
{unit: 1024*1024, template: "%0\u00a0MB"},
{unit: 1024, template: "%0\u00a0KB"},
{unit: 1, template: "%0\u00a0B"}
]});
merge(config.macros.search,{
label: "søg",
prompt: "Søg i denne TiddlyWiki",
accessKey: "F",
successMsg: "Der er fundet %0 tiddlere som matcher %1",
failureMsg: "Der er ikke fundet nogen tiddlere som matcher %0"});
merge(config.macros.tagging,{
label: "tagger: ",
labelNotTag: "tagger ikke",
tooltip: "Liste over tiddlere der er taggede med '%0'"});
merge(config.macros.timeline,{
dateFormat: "DD MMM YYYY"});// use this to change the date format for your locale, eg "YYYY MMM DD", do not translate the Y, M or D
merge(config.macros.allTags,{
tooltip: "Vis tiddlere der er taggede med '%0'",
noTags: "Der er ingen taggede tiddlere"});
config.macros.list.all.prompt = "Alle tiddlere i alfabetisk orden";
config.macros.list.missing.prompt = "Tiddlere der linkes til men som ikke er definerede";
config.macros.list.orphans.prompt = "Tiddlere som der ikke linkes til fra nogen andre tiddlere";
config.macros.list.shadowed.prompt = "Tiddlere som er skyggede med grundlæggende indhold";
config.macros.list.touched.prompt = "Tiddlere som er blevet ændret lokalt ";
merge(config.macros.closeAll,{
label: "luk alle",
prompt: "Luk alle viste tiddlere (untaget dem som er ved at blive redigerede)"});
merge(config.macros.permaview,{
label: "vis permalink",
prompt: "Lav et link til en URL som henter alle de netop nu synlige tiddlere"});
merge(config.macros.saveChanges,{
label: "gem ændringer",
prompt: "Gem alle tiddlere for at lave en ny TiddlyWiki",
accessKey: "S"});
merge(config.macros.newTiddler,{
label: "ny tiddler",
prompt: "Lav en ny tiddler",
title: "Ny Tiddler",
accessKey: "N"});
merge(config.macros.newJournal,{
label: "ny journal",
prompt: "Lav en ny tiddler ud fra nuværende dato og tid",
accessKey: "J"});
merge(config.macros.options,{
wizardTitle: "Tilpas avancerede muligheder",
step1Title: "Disse muligheder gemmes i cookies i din browser",
step1Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='false' name='chkUnknown'>Show unknown options</input>",
unknownDescription: "//(ukendt)//",
listViewTemplate: {
columns: [
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
});
merge(config.macros.plugins,{
wizardTitle: "Administrer udvidelser",
step1Title: "Aktive udvidelser",
step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE
skippedText: "(Denne udvidelse er ikke blevet aktiveret fordi den først er blevet tilføjet efter start)",
noPluginText: "Der er ikke installeret nogen udvidelser",
confirmDeleteText: "Er du sikker på at du vil slette disse udvidelser:\n\n%0",
removeLabel: "Fjern systemConfig tag",
removePrompt: "Fjern systemConfig tag",
deleteLabel: "slet",
deletePrompt: "Slet disse tiddlere permanent",
listViewTemplate: {
columns: [
{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
{name: 'Forced', field: 'forced', title: "Forced", tag: 'systemConfigForce', type: 'TagCheckbox'},
{name: 'Disabled', field: 'disabled', title: "Disabled", tag: 'systemConfigDisable', type: 'TagCheckbox'},
{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"},
{name: 'Startup Time', field: 'startupTime', title: "Startup Time", type: 'String'},
{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"},
{name: 'Log', field: 'log', title: "Log", type: 'StringList'}
],
rowClasses: [
{className: 'error', field: 'error'},
{className: 'warning', field: 'warning'}
]}
});
merge(config.macros.toolbar,{
moreLabel: "mere",
morePrompt: "Vis flere muligheder"
});
merge(config.macros.refreshDisplay,{
label: "genopfrisk",
prompt: "Genopfrisk hele TiddlyWikiens udseende"
});
merge(config.macros.importTiddlers,{
readOnlyWarning: "Du kan ikke importere til en låst TiddlyWiki fil. Prøv at åbne den fra en fil:// URL",
wizardTitle: "Importer tiddlere fra en anden fil eller server",
step1Title: "Trin 1: Find serveren eller TiddlyWiki filen",
step1Html: "Vælg servertypen: <select name='selTypes'><option value=''>Choose...</option></select><br>Enter the URL or pathname here: <input type='text' size=50 name='txtPath'><br>...or browse for a file: <input type='file' size=50 name='txtBrowse'><br><hr>...or select a pre-defined feed: <select name='selFeeds'><option value=''>Choose...</option></select>",
openLabel: "open",
openPrompt: "Åben forbindelsen til denne fil eller server",
openError: "Der var problemer med at hente tiddlywiki filen",
statusOpenHost: "Forbinder til hosten",
statusGetWorkspaceList: "Henter en liste over tilgængelige arbejdsområder",
step2Title: "Trin 2: Vælg arbejdsområde",
step2Html: "Indskriv et navn på arbejdsområdet: <input type='text' size=50 name='txtWorkspace'><br>...eller vælg et der allerede er der: <select name='selWorkspace'><option value=''>Choose...</option></select>",
cancelLabel: "fortryd",
cancelPrompt: "Fortryd denne import",
statusOpenWorkspace: "Åben arbejdsområdet",
statusGetTiddlerList: "Henter listen over tilgængelige tiddlere",
errorGettingTiddlerList: "Fejl ved hentning af liste over tiddlere, klik Fortryd for at prøve igen",
step3Title: "Trin 3: Vælg hvilke tiddlere der skal importeres",
step3Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='true' name='chkSync'>Keep these tiddlers linked to this server so that you can synchronise subsequent changes</input><br><input type='checkbox' name='chkSave'>Save the details of this server in a 'systemServer' tiddler called:</input> <input type='text' size=25 name='txtSaveTiddler'>",
importLabel: "importer",
importPrompt: "Importer disse tiddlere",
confirmOverwriteText: "Er du sikker på at du vil overskrive disse tiddlere:\n\n%0",
step4Title: "Trin 4: Importerer %0 tiddler(e)",
step4Html: "<input type='hidden' name='markReport'></input>", // DO NOT TRANSLATE
doneLabel: "udført",
donePrompt: "Luk denne wizard",
statusDoingImport: "Importerer tiddlere",
statusDoneImport: "Alle tiddlere er importede",
systemServerNamePattern: "%2 on %1",
systemServerNamePatternNoWorkspace: "%1",
confirmOverwriteSaveTiddler: "Tiddleren '%0' findes allerede. Klik 'OK' for at overskrive den med detaljerne fra denne server, eller 'Fortryd' for at efterlade uændret",
serverSaveTemplate: "|''Type:''|%0|\n|''URL:''|%1|\n|''Workspace:''|%2|\n\nDenne tiddler blev lavet automatisk for at skrive denne servers detaljer",
serverSaveModifier: "(System)",
listViewTemplate: {
columns: [
{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
{name: 'Tags', field: 'tags', title: "Tags", type: 'Tags'}
],
rowClasses: [
]}
});
merge(config.macros.upgrade,{
wizardTitle: "Opgrader TiddlyWikis kerne kode",
step1Title: "Opdater eller reparer denne TiddlyWiki til sidste nye udgivelse",
step1Html: "Du er ved at opgradere til sidste nye udgave af TiddlyWikis kerne kode (from <a href='%0' class='externalLink' target='_blank'>%1</a>). Dit indhold vil blive bibeholdt under opgraderinen.<br><br>Bemærk at opgraderinger kan konfikte med gamle udvidelser. Hvis du får problemer med den opgraderede fil se her <a href='http://www.tiddlywiki.org/wiki/CoreUpgrades' class='externalLink' target='_blank'>http://www.tiddlywiki.org/wiki/CoreUpgrades</a>",
errorCantUpgrade: "Kan ikke opgradere denne TiddlyWiki. Du kan kun opgradere en TiddlyWiki fil som er gemt lokalt på en pc",
errorNotSaved: "Du skal gemme ændringer før du kan gennemføre en opgradering",
step2Title: "Bekræft opgraderingsdetaljer",
step2Html_downgrade: "Du er ved at nedgradere til TiddlyWiki version %0 fra %1.<br><br>Nedgradering til en ældre udgave af kerne koden er IKKE tilrådeligt",
step2Html_restore: "Denne tiddlyWike bruger allerede den sidste nye kerne kode (%0).<br><br>Du kan fortsætte med opgraderingen for at sikre dig at koden ikke er blevet ødelagt",
step2Html_upgrade: "Du er ved at opgradere til TiddlyWiki version %0 fra %1",
upgradeLabel: "opgrader",
upgradePrompt: "Forbered opgraderingsprocessen",
statusPreparingBackup: "Forbereder backup",
statusSavingBackup: "Gemmer backup fil",
errorSavingBackup: "Der var problemer med at gemme backup filen",
statusLoadingCore: "Loader kernekoden",
errorLoadingCore: "Fejl ved load af kernekoden",
errorCoreFormat: "Fejl ved den nye kernekode",
statusSavingCore: "Gemmer den nye kernekode",
statusReloadingCore: "Genloader den nye kernekode",
startLabel: "start",
startPrompt: "Start opgraderingsprocessen",
cancelLabel: "fortryd",
cancelPrompt: "Fortryd opgraderingsprocessen",
step3Title: "Opgradering afbrudt",
step3Html: "Du har afbrudt opgraderingsprocessen"
});
merge(config.macros.sync,{
listViewTemplate: {
columns: [
{name: 'Selected', field: 'selected', rowName: 'title', type: 'Selector'},
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
{name: 'Server Type', field: 'serverType', title: "Server type", type: 'String'},
{name: 'Server Host', field: 'serverHost', title: "Server host", type: 'String'},
{name: 'Server Workspace', field: 'serverWorkspace', title: "Server workspace", type: 'String'},
{name: 'Status', field: 'status', title: "Synchronisation status", type: 'String'},
{name: 'Server URL', field: 'serverUrl', title: "Server URL", text: "View", type: 'Link'}
],
rowClasses: [
],
buttons: [
{caption: "Synkronisér disse tiddlere", name: 'sync'}
]},
wizardTitle: "Synkroniser med internet servere og filer",
step1Title: "Vælg hvilke tiddlere du vil synkronisere",
step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE
syncLabel: "synk",
syncPrompt: "Synkronisér disse tiddlere",
hasChanged: "Ændret imens den var koblet fra",
hasNotChanged: "Uændret imens den var koblet fra",
syncStatusList: {
none: {text: "...", color: "gennemsigtig", display:null},
changedServer: {text: "Ændret på serveren", color: '#8080ff', display:null},
changedLocally: {text: "Ændret imens den var koblet fra", color: '#80ff80', display:null},
changedBoth: {text: "ændret imens den var koblet fra også på serveren", color: '#ff8080', display:null},
notFound: {text: "Ikke fundet på serveren", color: '#ffff80', display:null},
putToServer: {text: "Gemt update på serveren", color: '#ff80ff', display:null},
gotFromServer: {text: "Hentet update fra serveren", color: '#80ffff', display:null}
}
});
merge(config.commands.closeTiddler,{
text: "luk",
tooltip: "Luk denne tiddler"});
merge(config.commands.closeOthers,{
text: "luk andre",
tooltip: "Luk alle andre tiddlere"});
merge(config.commands.editTiddler,{
text: "redigér",
tooltip: "Redigér denne tiddler",
readOnlyText: "se",
readOnlyTooltip: "Se denne tiddlers kilde"});
merge(config.commands.saveTiddler,{
text: "færdig",
tooltip: "Gem ændringer til denne tiddler"});
merge(config.commands.cancelTiddler,{
text: "fortryd",
tooltip: "Fortryd ændringer til denne tiddler",
warning: "Er du sikker på at du vil fortryde dine ændringer til '%0'?",
readOnlyText: "færdig",
readOnlyTooltip: "Se tiddlere normalt"});
merge(config.commands.deleteTiddler,{
text: "slet",
tooltip: "Slet denne tiddler",
warning: "Er du sikker på at du vil slette '%0'?"});
merge(config.commands.permalink,{
text: "permalink",
tooltip: "Permalink til denne tiddler"});
merge(config.commands.references,{
text: "referencer",
tooltip: "Vis tiddlere som linker til denne tiddler",
popupNone: "Ingen referencer"});
merge(config.commands.jump,{
text: "spring",
tooltip: "Spring til en anden tiddler"});
merge(config.commands.syncing,{
text: "synkroniserer",
tooltip: "Kontroller synkronisering af denne tiddler med en server eller en fil",
currentlySyncing: "<div>Currently syncing via <span class='popupHighlight'>'%0'</span> to:</"+"div><div>host: <span class='popupHighlight'>%1</span></"+"div><div>workspace: <span class='popupHighlight'>%2</span></"+"div>", // Note escaping of closing <div> tag
notCurrentlySyncing: "Sykroniserer ikke lige nu",
captionUnSync: "Stop synkronisering af denne tiddler",
chooseServer: "Synkronisér denne tiddler med en anden server:",
currServerMarker: "\u25cf ",
notCurrServerMarker: " "});
merge(config.commands.fields,{
text: "felter",
tooltip: "Vis denne tiddlers udvidede felter",
emptyText: "Der er ingen udvidede felter til rådighed for denne tiddler",
listViewTemplate: {
columns: [
{name: 'Field', field: 'field', title: "Field", type: 'String'},
{name: 'Value', field: 'value', title: "Value", type: 'String'}
],
rowClasses: [
],
buttons: [
]}});
merge(config.shadowTiddlers,{
DefaultTiddlers: "[[TranslatedGettingStarted]]",
MainMenu: "[[TranslatedGettingStarted]]\n\n\n^^~TiddlyWiki version <<version>>\n© 2007 [[UnaMesa|http://www.unamesa.org/]]^^",
TranslatedGettingStarted: "For at komme i gang med denne tomme tiddlywiki, skal du ændre på de følgende tiddlere:\n* SiteTitle & SiteSubtitle: Sidens titel og undertitel, som vist øverst (efter de er gemt, vil de også vise sig i browserens titelmenu)\n* MainMenu: er hovedmenuen (er oftest placeret til venstre)\n* DefaultTiddlers: Indeholder navnene på de tiddlere du vilhave skal starte op når du åbner TiddlyWiki\nDu skal også skrive dit brugernavn for at signere dine redigeringer: <<option txtUserName>>",
SiteTitle: "Min TiddlyWiki",
SiteSubtitle: "en genbrugelig ikke-liniær personlig web notesbog",
SiteUrl: "http://www.tiddlywiki.com/",
OptionsPanel: "Disse muligheder for at ændre på TiddlyWiki bliver gemt i din browser\n\nDit brugernavn til at signere dine ændringer. Skriv det som et WikiOrd (f.eks. PerPoulsen)\n<<option txtUserName>>\n\n<<option chkSaveBackups>> Save backups\n<<option chkAutoSave>> Auto save\n<<option chkRegExpSearch>> Regexp search\n<<option chkCaseSensitiveSearch>> Case sensitive search\n<<option chkAnimate>> Enable animations\n\n----\nAlso see [[TranslatedAdvancedOptions|AdvancedOptions]]",
SideBarOptions: '<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "muligheder \u00bb" "Ændre på TiddlyWikis avancerede muligheder">>',
SideBarTabs: '<<tabs txtMainTab "Tidslinie" "Tidslinie" TabTimeline "Alle" "Alle tiddlere" TabAll "Tags" "Alle tags" TabTags "Flere" "Flere lister" TabMore>>',
TabMore: '<<tabs txtMoreTab "Manglende" "Manglende tiddlere" TabMoreMissing "Uden tilknytning" "Tiddlere" TabMoreOrphans "Skyggede" "Skyggede tiddlere" TabMoreShadowed>>'
});
merge(config.annotations,{
AdvancedOptions: "Denne skygge tiddler giver adgang til flere avancerede muligheder",
ColorPalette: "Disse værdier i denne skyggetiddler bestemmer hvilket farveskema, der bliver brugt til ~TiddlyWikis brugerflade",
DefaultTiddlers: "Tiddlere som er listede i denne skyggetiddler vil automatisk blive vist når ~TiddlyWiki starter op",
EditTemplate: "HTML skabelonen i denne skyggetiddler bestemmer hvordan tiddlere ser ud når de bliver redigerede",
GettingStarted: "Denne skyggetiddler giver instruktioner om grundlæggende anvendelse",
ImportTiddlers: "Denne skyggetiddler giver mulighed for at importere tiddlere",
MainMenu: "Denne tiddler bliver brugt til at definere indholdet af hoved menuen i venstre side af skærmen",
MarkupPreHead: "Denne tiddler bliver indsat i toppen af <head> sektionen på TiddlyWiki HTML filen",
MarkupPostHead: "Denne tiddler bliver indsat i bunden af <head> sektionen på TiddlyWiki HTML filen",
MarkupPreBody: "Denne tiddler bliver indsat i toppen af<body> sektionen på TiddlyWiki HTML filen",
MarkupPostBody: "Denne tiddler bliver indsat i slutningen af <body> sektionen på TiddlyWiki HTML filen umiddelbart efter script blokken",
OptionsPanel: "Denne skyggetiddler bliver brugt til indholdet af muligheder skydepanelet i højre side",
PageTemplate: "HTML skabelonen i denne skyggetiddler bestemmer det overordnede ~TiddlyWiki layout",
PluginManager: "Denne skyggetiddler giver adgang til udvidelsesadministrationen",
SideBarOptions: "Denne skyggetiddler bruges til indholdet af muligheder panelet i højre sidemenu",
SideBarTabs: "Denne skyggetiddler bruges til indholdet af fanebladspanelet i højre sidemenu",
SiteSubtitle: "Denne skyggetiddler bruges som anden del af sidens titel",
SiteTitle: "Denne skyggetiddler bruges som første del af sidens titel",
SiteUrl: "Denne skyggetiddler bør sættes til den fulde mål-URL til publikation",
StyleSheetColors: "Denne skyggetiddler indeholder CSS definitionerne der bestemmer farverne på side elementerne. ''REDIGÉR IKKE DENNE TIDDLER'', lav i stedet dine ændringer i StyleSheet skyggetiddleren",
StyleSheet: "Denne tiddler kan indeholde specialle CSS definitioner",
StyleSheetLayout: "Denne skyggetiddler indeholder CSS definitioner der bestemmer layoutet på side elementer. ''REDIGÉR IKKE DENNE TIDDLER'', lav i stedet dine ændringer i StyleSheet skyggetiddleren",
StyleSheetLocale: "Denne skyggetiddler indeholder CSS definitioner relateret til lokale oversættelser",
StyleSheetPrint: "Denne skyggetiddler indeholder CSS definitioner til print",
TabAll: "Denne skyggetiddler indeholder hvad der er i 'Alle' fanen i højre sidemenu",
TabMore: "Denne skyggetiddler indeholder hvad der er i 'Flere' fanen i højre sidemenu",
TabMoreMissing: "Denne skyggetiddler indeholder hvad der er i 'Mangler' fanen i højre sidemenu",
TabMoreOrphans: "Denne skyggetiddler indeholder hvad der er i 'Mangler tilknytning' fanen i højre sidemenu",
TabMoreShadowed: "Denne skyggetiddler indeholder hvad der er i 'Skyggede' fanen i højre sidemenu",
TabTags: "Denne skyggetiddler indeholder hvad der er i 'Tags' fanen i højre sidemenu",
TabTimeline: "Denne skyggetiddler indeholder hvad der er i 'Tidslinie' fanen i højre sidemenu",
ToolbarCommands: "Denne skyggetiddler bestemmer hvilke værktøjer der vises i tiddleres værktøjslinier",
ViewTemplate: "HTML skabelonen i denne skyggetiddler bestemmer hvordan tiddlere ser ud"
});
//}}}
[[TW Ligninger]]
[[Kom i gang]]
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='showWhen tiddler.tags.contains("equation") || tiddler.title =="ANewEquationTiddler"'>[[LaunchEditor]]</div>
<div macro='tiddler QuickEditToolbar'></div><span class='toolbar' macro='toolbar toggleQuickEdit'></span>
<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>
<!--}}}-->
<script>
/*<![CDATA[*/
/***********************************************
* Encrypt Email script- Please keep notice intact
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/
<!-- Encrypted version of: tiddlywikihelp [at] *****.***.** //-->
var emailriddlerarray=[116,105,100,100,108,121,119,105,107,105,104,101,108,112,64,121,97,104,111,111,46,99,111,109,46,97,117]
var encryptedemail_id69='' //variable to contain encrypted email
for (var i=0; i<emailriddlerarray.length; i++)
encryptedemail_id69+=String.fromCharCode(emailriddlerarray[i])
document.write('<a href="mailto:'+encryptedemail_id69+'?subject=From TW Equation">Email forfatteren</a>')
/*]]>*/
</script>
/***
|Name|EquationEditorPlugin|
|Source|http://twhelp.tiddlywiki.com/#EquationEditorPlugin|
|Version|1.0.0|
|Author|Morris Gray - twhelp.tiddlywiki.com & Will Bateman - CodeCogs.com|
|License|BSD open source license.|
|~CoreVersion|2.2|
|Type|script|
|Requires|See below|
|Overrides|config.macros.edit.handler and config.views.editor.defaultText|
|Description|definition for toolbar button for equation editing|
''Requirements:''
Put the following in MarkupPreHead
{{{
<script type="text/javascript" src="http://latex.codecogs.com/editor.js"></script>
}}}
Usage:
QuickEditToolbar: <<tiddler QuickEdit_equation>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_equation'></span>
QuickEdit_equationButton
!Code
***/
config.views.editor.defaultText = "";
config.macros.edit.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var field = params[0];
var rows = params[1] || 0;
var defVal = params[2] || '';
if((tiddler instanceof Tiddler) && field) {
story.setDirty(tiddler.title,true);
var e,v;
if(field != "text" && !rows) {
e = createTiddlyElement(null,"input");
if(tiddler.isReadOnly())
e.setAttribute("readOnly","readOnly");
e.setAttribute("edit",field);
e.setAttribute("type","text");
e.value = store.getValue(tiddler,field) || defVal;
e.setAttribute("size","40");
e.setAttribute("autocomplete","off");
place.appendChild(e);
} else {
var wrapper1 = createTiddlyElement(null,"fieldset",null,"fieldsetFix");
var wrapper2 = createTiddlyElement(wrapper1,"div");
e = createTiddlyElement(wrapper2,"textarea");
if(tiddler.isReadOnly())
e.setAttribute("readOnly","readOnly");
e.value = v = store.getValue(tiddler,field) || defVal;
rows = rows || 10;
var lines = v.match(/\n/mg);
var maxLines = Math.max(parseInt(config.options.txtMaxEditRows),5);
if(lines != null && lines.length > rows)
rows = lines.length + 5;
rows = Math.min(rows,maxLines);
e.setAttribute("rows",rows);
e.setAttribute("edit",field);
e.id="eqntarget";
place.appendChild(wrapper1);
}
return e;
}
};
/***
|''Name:''|FCKeditorPlugin|
|''Description:''|Wysiwyg editor for TiddlyWiki using FCKeditor.|
|''Version:''|1.1.1|
|''Date:''|Dec 21,2007|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.2.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Demo:
On the plugin [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], see and edit [[WysiwygDemo]].
!Installation:
#download and unzip [[FCKeditor|http://www.fckeditor.net/download]] (by default, in a wiki subfolder, such that the relative path "fckeditor/fckeditor.js" is right).
#import [[FCKeditorPlugin]] (systemConfig tagged)
#add the following text to MarkupPreHead : {{{<script type="text/javascript" src="fckeditor/fckeditor.js"></script>}}}
#customize FCKeditorPath if needed (in MarkupPreHead and in options below)
#save and reload
#use the <<toolbar editHtml>> button in the tiddler's toolbar (in default ViewTemplate) or add {{{editHtml}}} command in your own toolbar.
! Useful Addons
*[[HTMLFormattingPlugin|http://www.tiddlytools.com/#HTMLFormattingPlugin]] to embed wiki syntax in html tiddlers.<<br>>//__Tips__ : When this plugin is installed, you can use anchor syntax to link tiddlers in wysiwyg mode (example : #example). Anchors are converted back and from wiki syntax when editing.//
*[[TaggedTemplateTweak|http://www.TiddlyTools.com/#TaggedTemplateTweak]] to use alternative ViewTemplate/EditTemplate for tiddler's tagged with specific tag values.
!Configuration options :
|FCKeditor folder (absolute or relative)|<<option txtFCKeditorPath>> |
|FCKeditor custom configuration script path (relative or absolute)<<br>>[[Example|fckeditor/editor/custom_config.js]] : {{{ fckeditor/editor/custom_config.js}}}|<<option txtFCKCustomConfigScript>>|
|Toolbar name ("Default", "Basic" or custom)<<br>>See [[FCKeditor documentation|http://wiki.fckeditor.net/Developer%27s_Guide/Configuration/Toolbar]] for more information on custom toolbars|<<option txtFCKToolbar>>|
|FCKeditor default height (if blank = 500px)|<<option txtFCKheight>>|
|Template called by the {{{wysiwyg}}} button|EditHtmlTemplate|
!Code
***/
//{{{
config.options.txtFCKeditorPath = config.options.txtFCKeditorPath ? config.options.txtFCKeditorPath : "fckeditor/";
config.options.txtFCKCustomConfigScript = config.options.txtFCKCustomConfigScript ? config.options.txtFCKCustomConfigScript : "";
config.options.txtFCKToolbar = config.options.txtFCKToolbar ? config.options.txtFCKToolbar : "";
config.options.txtFCKheight = config.options.txtFCKheight ? config.options.txtFCKheight : "500px";
config.macros.editHtml = {
handler : function(place,macroName,params,wikifier,paramString,tiddler) {
var field = params[0];
var height = params[1] ? params[1] : config.options.txtFCKheight;
if (typeof FCKeditor=="undefined"){
displayMessage(config.macros.editHtml.FCKeditorUnavailable);
config.macros.edit.handler(place,macroName,params,wikifier,paramString,tiddler);
}
else if (field) {
var e = createTiddlyElement(null,"div");
var fckName = "FCKeditor"+ Math.random();
if(tiddler.isReadOnly())
e.setAttribute("readOnly","readOnly");
e.setAttribute("editHtml",field);
if (height) e.setAttribute("height",height);
e.setAttribute("fckName",fckName);
place.appendChild(e);
var fck = new FCKeditor(fckName);
fck.BasePath = config.options.txtFCKeditorPath;
if (config.options.txtFCKCustomConfigScript) fck.Config["CustomConfigurationsPath"] = config.options.txtFCKCustomConfigScript ;
if (config.options.txtFCKToolbar) fck.ToolbarSet = config.options.txtFCKToolbar;
fck.Height=height;
var re = /^<html>(.*)<\/html>$/m;
var fieldValue=store.getValue(tiddler,field);
var htmlValue = re.exec(fieldValue);
var value = (htmlValue && (htmlValue.length>0)) ? htmlValue[1] : fieldValue;
value=value.replace(/\[\[([^|\]]*)\|([^\]]*)]]/g,'<a href="#$2">$1</a>');
config.macros.editHtml.FCKvalues[fckName]=value;
e.innerHTML = fck.CreateHtml();
}
},
gather : function(e) {
var name = e.getAttribute("fckName");
var oEditor = window.FCKeditorAPI ? FCKeditorAPI.GetInstance(name) : null;
if (oEditor) {
var html = oEditor.GetHTML();
if (html!=null)
return "<html>"+html.replace(/<a href="#([^>]*)">([^<]*)<\/a>/gi,"[[$2|$1]]")+"</html>";
}
},
FCKvalues : {},
FCKeditorUnavailable : "FCKeditor kunne ikke hentes. Check om du har internet og evt. også plugin konfigurationen og genopfrisk."
}
window.FCKeditor_OnComplete= function( editorInstance ) {
var name=editorInstance.Name;
var value = config.macros.editHtml.FCKvalues[name];
delete config.macros.editHtml.FCKvalues[name];
oEditor = FCKeditorAPI.GetInstance(name);
if (value) oEditor.SetHTML(value);
}
Story.prototype.previousGatherSaveEditHtml = Story.prototype.previousGatherSaveEditHtml ? Story.prototype.previousGatherSaveEditHtml : Story.prototype.gatherSaveFields; // to avoid looping if this line is called several times
Story.prototype.gatherSaveFields = function(e,fields){
if(e && e.getAttribute) {
var f = e.getAttribute("editHtml");
if(f){
var newVal = config.macros.editHtml.gather(e);
if (newVal) fields[f] = newVal;
}
this.previousGatherSaveEditHtml(e, fields);
}
};
config.shadowTiddlers.EditHtmlTemplate = config.shadowTiddlers.EditTemplate.replace(/macro='edit text'/,"macro='editHtml text'");
config.commands.editHtml={
text: "wysiwyg",
tooltip: "redigér denne tiddler med en RichText editor",
readOnlyText: "",
handler : function(event,src,title) {
clearMessage();
var tiddlerElem = document.getElementById(story.idPrefix + title);
var fields = tiddlerElem.getAttribute("tiddlyFields");
story.displayTiddler(null,title,"EditHtmlTemplate",false,null,fields);
return false;
}
}
config.shadowTiddlers.ViewTemplate = config.shadowTiddlers.ViewTemplate.replace(/\+editTiddler/,"+editTiddler editHtml");
//}}}
/***
|Name:|HideWhenPlugin|
|Description:|Allows conditional inclusion/exclusion in templates|
|Version:|3.1 ($Rev: 3919 $)|
|Date:|$Date: 2008-03-13 02:03:12 +1000 (Thu, 13 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#HideWhenPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
For use in ViewTemplate and EditTemplate. Example usage:
{{{<div macro="showWhenTagged Task">[[TaskToolbar]]</div>}}}
{{{<div macro="showWhen tiddler.modifier == 'BartSimpson'"><img src="bart.gif"/></div>}}}
***/
//{{{
window.hideWhenLastTest = false;
window.removeElementWhen = function(test,place) {
window.hideWhenLastTest = test;
if (test) {
removeChildren(place);
place.parentNode.removeChild(place);
}
};
merge(config.macros,{
hideWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( eval(paramString), place);
}},
showWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !eval(paramString), place);
}},
hideWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAll(params), place);
}},
showWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAll(params), place);
}},
hideWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAny(params), place);
}},
showWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAny(params), place);
}},
hideWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAll(params), place);
}},
showWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAll(params), place);
}},
hideWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0]), place);
}},
showWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !(store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0])), place);
}},
hideWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.title == params[0], place);
}},
showWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.title != params[0], place);
}},
'else': { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !window.hideWhenLastTest, place);
}}
});
//}}}
On Tuesday, 3 February 2009 8:58:58 AM, YourName imported 54 tiddlers from
[[F:\TiddlyWiki2.4\TWEquation\twequation.html|F:\TiddlyWiki2.4\TWEquation\twequation.html]]:
<<<
#[[8 January 2009]] - added
#[[DefaultTiddlers]] - added
#[[EditTemplate]] - added
#[[EmailTWMath]] - added
#[[EquationEditorPlugin]] - added
#[[HideWhenPlugin]] - added
#[[InlineJavascriptPlugin]] - added
#[[LoadRemoteFileThroughProxy]] - added
#[[MainMenu]] - added
#[[MarkupPostBody]] - added
#[[MarkupPreHead]] - added
#[[PageTemplate]] - added
#[[PasswordOptionsPlugin]] - added
#[[PublishMacro]] - added
#[[QuickEditPackage]] - added
#[[QuickEditPlugin]] - added
#[[QuickEditToolbar]] - added
#[[QuickEdit_align]] - added
#[[QuickEdit_color]] - added
#[[QuickEdit_css]] - added
#[[QuickEdit_equation]] - added
#[[QuickEdit_file]] - added
#[[QuickEdit_font]] - added
#[[QuickEdit_fontList]] - added
#[[QuickEdit_format]] - added
#[[QuickEdit_image]] - added
#[[QuickEdit_link]] - added
#[[QuickEdit_macro]] - added
#[[QuickEdit_replace]] - added
#[[QuickEdit_sort]] - added
#[[QuickEdit_split]] - added
#[[QuickEdit_tiddler]] - added
#[[SaveAsPlugin]] - added
#[[SearchIncremental=false]] - added
#[[SearchOptionsPlugin]] - added
#[[ShowQuickEdit=true]] - added
#[[SideBarOptions]] - added
#[[SiteSubtitle]] - added
#[[SiteTitle]] - added
#[[StyleSheet]] - added
#[[StyleSheetTiddlersBar]] - added
#[[TW Equation]] - added
#[[TWHelp-SearchResults]] - added
#[[TabsCSS]] - added
#[[TiddlersBarPluginMG]] - added
#[[TopMenu]] - added
#[[TopMenuStyle]] - added
#[[TspotSetupPlugin]] - added
#[[TwHelpSearchPlugin]] - added
#[[UploadLog]] - added
#[[UploadPlugin]] - added
#[[Version]] - added
#[[ViewTemplate]] - added
#[[Welcome To Tiddlyspot]] - added
<<<
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Version|1.6.0|
|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|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Usage
<<<
When installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.
''Deferred execution from an 'onClick' link''
By including a {{{label="..."}}} parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered. You may also include a {{{title="..."}}} parameter to specify the 'tooltip' text that will appear whenever the mouse is moved over the onClick link text
''External script source files:''
You can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.
''Display script source in tiddler output''
By including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.
''Defining javascript functions and libraries:''
Although the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed. Thus, you cannot load a library and //immediately// use it's functions within the same tiddler. However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).
To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened. For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.
Since the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines. Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.
''Creating dynamic tiddler content''
An important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:
* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.
* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.
If your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display. For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.
//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//
''Accessing the ~TiddlyWiki DOM''
The plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.
Access to this DOM element allows you to create scripts that can:
* vary their actions based upon the specific location in which they are embedded
* access 'tiddler-relative' information (use findContainingTiddler(place))
* perform direct DOM manipulations (when returning wikified text is not enough)
<<<
!!!!!Examples
<<<
an "alert" message box:
>
dynamic output:
><script show>
return (new Date()).toString();
</script>
wikified dynamic output:
><script show>
return "link to current user: [["+config.options.txtUserName+"]]";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
if (!window.story) window.story=window;
var title=story.findContainingTiddler(place).id.substr(7);
return title+" is using "+store.getTiddlerText(title).length+" bytes";
</script>
creating an 'onclick' button/link that runs a script:
><script label="click here" title="clicking this link will show an 'alert' box" show>
if (!window.story) window.story=window;
alert("Hello World!\nlinktext='"+place.firstChild.data+"'\ntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");
</script>
loading a script from a source url:
>http://www.TiddlyTools.com/demo.js contains:
>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}
>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}
><script src="demo.js" show>
return "loading demo.js..."
</script>
><script label="click to execute demo() function" show>
demo()
</script>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.02.19 [1.6.0]'' added support for title="..." to specify mouseover tooltip when using an onclick (label="...") script
''2006.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper. Fixes error caused when last line of script is a comment.
''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output
''2006.01.05 [1.4.0]'' added support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.
''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by UdoBorkowski
''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content. Based on a suggestion by BradleyMeck
''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax
''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access
''2005.11.08 [1.0.0]'' initial release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.inlineJavascript= {major: 1, minor: 6, revision: 0, date: new Date(2007,2,19)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
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) {
if (lookaheadMatch[1]) { // load a script library
// make script tag, set src, add to body to execute, then remove for cleanup
var script = document.createElement("script"); script.src = lookaheadMatch[1];
document.body.appendChild(script); document.body.removeChild(script);
}
if (lookaheadMatch[5]) { // there is script code
if (lookaheadMatch[4]) // show inline script code in tiddler output
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (lookaheadMatch[2]) { // create a link to an 'onclick' script
// add a link, define click handler, save code in link (pass 'place'), set link attributes
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);
link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}
link.code="function _out(place){"+lookaheadMatch[5]+"\n};_out(this);"
link.setAttribute("title",lookaheadMatch[3]?lookaheadMatch[3]:"");
link.setAttribute("href","javascript:;");
link.style.cursor="pointer";
}
else { // run inline script code
var code="function _out(place){"+lookaheadMatch[5]+"\n};_out(w.output);"
code=code.replace(/document.write\(/gi,'place.innerHTML+=(');
try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
for at komme i gang med denne tomme TiddlyWiki, skal du ændre på de følgende tiddlere:
* SiteTitle & SiteSubtitle: Sidens titel og undertitel, som vist herover (når du har gemt, vil ændringerne også vises i browserens titel linie)
* MainMenu: Menuen (oftes til venstre)
* DefaultTiddlers: navnene på de tiddlere du vil have åbnet når TiddlyWiki åbnes.
Hvis du vil signere dine ændringer: <<option txtUserName>>
/***
|''Name:''|LoadRemoteFileThroughProxy (previous LoadRemoteFileHijack)|
|''Description:''|When the TiddlyWiki file is located on the web (view over http) the content of [[SiteProxy]] tiddler is added in front of the file url. If [[SiteProxy]] does not exist "/proxy/" is added. |
|''Version:''|1.1.0|
|''Date:''|mar 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#LoadRemoteFileHijack|
|''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|
***/
//{{{
version.extensions.LoadRemoteFileThroughProxy = {
major: 1, minor: 1, revision: 0,
date: new Date("mar 17, 2007"),
source: "http://tiddlywiki.bidix.info/#LoadRemoteFileThroughProxy"};
if (!window.bidix) window.bidix = {}; // bidix namespace
if (!bidix.core) bidix.core = {};
bidix.core.loadRemoteFile = loadRemoteFile;
loadRemoteFile = function(url,callback,params)
{
if ((document.location.toString().substr(0,4) == "http") && (url.substr(0,4) == "http")){
url = store.getTiddlerText("SiteProxy", "/proxy/") + url;
}
return bidix.core.loadRemoteFile(url,callback,params);
}
//}}}
<html><a href="javascript:void(0)" onclick="story.closeAllTiddlers();story.displayTiddlers(null,store.getTiddlerText('DefaultTiddlers').readBracketedList())"
><span title="Close all tiddlers and open Welcome" style="cursor:pointer">Hjem</span></a></html>
[[TW Ligninger]]
[[Kom i gang]]
<<doPublish>>
tiddlere tagget
med <<doPublish>>
@@font-size:.75em;color:#C06;''» '' @@ {{blueLink {<html><a href='http://twequation.tiddlyspot.com/download' class='button'>Download den originale TW Equation</a></html>}}}
{{blueLinktextNormal{<<tiddler [[EmailTWMath]]>>}}}
<html><a href="http://www.codecogs.com"><img src="http://www.codecogs.com/images/poweredbycc.gif" border="0" title="CodeCogs - An Open Source Numerical Library" alt="CodeCogs - An Open Source Numerical Library"></a>
</html>
<!-- Start of StatCounter Code -->
<script type="text/javascript">
var sc_project=4338348;
var sc_invisible=1;
var sc_partition=54;
var sc_click_stat=1;
var sc_security="ecf78a44";
</script>
<script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><div class="statcounter"><a title="free web stats" href="http://www.statcounter.com/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/4338348/0/ecf78a44/1/" alt="free web stats" ></a></div></noscript>
<!-- End of StatCounter Code -->
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="http://latex.codecogs.com/editor.js"></script>
<!--}}}-->
/***
|Name:|NewHerePlugin|
|Description:|Creates the new here and new journal macros|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#NewHerePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.macros, {
newHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newTiddler "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
},
newJournalHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newJournal "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
}
});
//}}}
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></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>
<!--}}}-->
/***
|''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"
});
*/
//}}}
/***
|''Name:''|Publish Macro|
|''Version:''|2.4.1 (2 July 2008)|
|''Source''|http://jackparke.googlepages.com/jtw.html#PublishMacro ([[del.icio.us|http://del.icio.us/post?url=http://jackparke.googlepages.com/jtw.html%23PublishMacro]])|
|''Author:''|[[Jack]]|
|''Type:''|Macro|
!Description
<<doPublish>> tiddlers tagged with these tags <<option txtPublishTags>> (comma seperated) as HTML pages to the subfolder 'publish' (you must create this). Use the [[PublishTemplateHead]] and [[PublishTemplateBody]] templates to style your pages and the [[PublishIndexTemplate]] to define an index page. For publishing individual tiddlers the [[PublishTemplateBodySingle]] template is used.
!Usage
To publish all tagged tiddlers:
{{{<<doPublish>>}}} <<doPublish>>
To publish a single tiddler, use the {{{<<publishTiddler>>}}} macro or add the "publishTiddler" command to your ViewTemplate
!Template placeholders
|!Placeholder|!Meaning|
|%0|Your SiteTitle "<<tiddler SiteTitle>>"|
|%1|The current tiddler title|
|%2|The rendered tiddler HTML|
|%3|CSV list of tags|
|%4|Tiddler modifier|
|%5|Tiddler modified date|
|%6|Tiddler creation date|
|%7|Tiddler wiki text|
!Revision History
* Original by [[Jack]] 24 May 2006
* Updated 2 Jan 2007
* Refactored 4 Jan 2007
* Small improvements
* Publish single tiddlers
* Template placeholder %7 for tiddler's wiki text
!Code
***/
//{{{
version.extensions.doPublish = {
major: 2,
minor: 4,
revision: 1,
date: new Date("July 2, 2008")
};
config.macros.doPublish = {
label: "publish",
prompt: "Publish Tiddlers as HTML files"
};
if (config.options.txtPublishTags == undefined) config.options.txtPublishTags = "Publish";
config.shadowTiddlers.PublishTemplateHead = '<title>%0 - %1</title>\n<link rel="stylesheet" type="text/css" href="style.css"/>\n<meta name="keywords" content="%3"/>'
config.shadowTiddlers.PublishTemplateBody = '<div class=\'viewer\' id=\'contentWrapper\'><small><a href=\"./publish/index.html\">Home</a> > %1</small><h1>%0</h1>\n<h2>%1</h2>\n%2\n<hr>Tags: %3\n<hr>%4, %5 (created %6)\n</div>\n'
config.shadowTiddlers.PublishTemplateBodySingle = '<h1>%0</h1>\n<h2>%1</h2>\n%2\n<hr>Tags: %3\n<hr>%4, %5 (created %6)\n</div>\n'
config.shadowTiddlers.PublishIndexTemplate = '<div class=\'viewer\' id=\'contentWrapper\'><small><a href="./publish/index.html">Home</a> > %1</small><h1>%0</h1><h2>%1</h2>\n<ul>%2\n</ul>\n<small>Published: %6</small>\n</div>\n';
config.macros.doPublish.handler = function(place)
{
if (!readOnly)
createTiddlyButton(place, this.label, this.prompt,
function() {
doPublish();
return false;
},
null, null, this.accessKey);
}
config.macros.publishTiddler = {
label : 'publish',
prompt : 'Publish this tiddler as an HTML file.',
handler : function(place,macroName,params,wikifier,paramString,tiddler)
{
var btn = createTiddlyButton(place, this.label, this.prompt,
function(e) {
if(!e) var e = window.event;
publishTiddler(this.getAttribute('tiddler'))
return false;
},
null, null, this.accessKey);
btn.setAttribute('tiddler', tiddler.title);
}}
config.commands.publishTiddler = {handler : function(event,src,title) {publishTiddler(title);},text: "publish", tooltip: "Publish this tiddler as HTML"};
function publishTiddler(title) {
//debugger
var PublishFolder = getWikiPath('publish');
var place = document.getElementById(story.container)
var HTMLTemplateHead = store.getTiddlerText("PublishTemplateHead");
var HTMLTemplateBody = store.getTiddlerText("PublishTemplateBodySingle") || store.getTiddlerText("PublishTemplateBody");
HTMLTemplateBody = renderTemplate(HTMLTemplateBody)
HTMLTemplateBody = wiki2Web(HTMLTemplateBody);
var tiddler = store.getTiddler(title);
var tiddlerText = store.getValue(tiddler, 'text');
var tiddlerHTML = wikifyStatic(tiddlerText);
var HTML = '<html>\n\<head>\n' + HTMLTemplateHead + '\n</head>\n<body>\n' + HTMLTemplateBody + '\n</body>\n</html>';
HTML = HTML.format([
wikifyPlain("SiteTitle").htmlEncode(),
tiddler.title.htmlEncode(),
wiki2Web(tiddlerHTML),
tiddler.tags.join(", "),
tiddler.modifier,
tiddler.modified.toLocaleString(),
tiddler.created.toLocaleString(),
tiddlerText
]);
saveFile(PublishFolder + tiddler.title.filenameEncode() + ".html", HTML);
//story.closeTiddler(tiddler.title);
var indexWin = window.open((PublishFolder + title.filenameEncode() + ".html").replace(/\\/g, "/"), null);
indexWin.focus();
}
function doPublish() {
var savedTiddlers = [];
var tiddlers = store.getTiddlers("title");
var place = document.getElementById(story.container)
var HTMLTemplateHead = store.getTiddlerText("PublishTemplateHead");
var HTMLTemplateBody = store.getTiddlerText("PublishTemplateBody");
HTMLTemplateBody = renderTemplate(HTMLTemplateBody)
HTMLTemplateBody = wiki2Web(HTMLTemplateBody);
var PublishTags = config.options.txtPublishTags || "publish";
PublishTags = PublishTags.split(",")
var PublishFolder = getWikiPath('publish');
if (!PublishFolder) return;
var indexFile = "";
var indexFileTemplate = store.getTiddlerText("PublishIndexTemplate");
// This does not allow <<myMacro>> but wants <div macro="myMacro">
indexFileTemplate = renderTemplate(indexFileTemplate)
// This option allows WIKI-syntax but is limited in it's HTML capabilities
//indexFileTemplate = wikifyStatic(indexFileTemplate)
for (var t = 0; t < tiddlers.length; t++) {
var tiddler = tiddlers[t];
if (tiddler.tags.containsAny(PublishTags)) {
var tiddlerText = store.getValue(tiddler, 'text');
var tiddlerHTML = wikifyStatic(tiddlerText);
var HTML = '<html>\n\<head>\n' + HTMLTemplateHead + '\n</head>\n<body>\n' + HTMLTemplateBody + '\n</body>\n</html>';
HTML = HTML.format([
wikifyPlain("SiteTitle").htmlEncode(),
tiddler.title.htmlEncode(),
wiki2Web(tiddlerHTML),
tiddler.tags.join(", "),
tiddler.modifier,
tiddler.modified.toLocaleString(),
tiddler.created.toLocaleString(),
tiddlerText
]);
//saveFile(PublishFolder + tiddler.created.formatString("YYYY0MM0DD") + ".html", HTML);
saveFile(PublishFolder + tiddler.title.filenameEncode() + ".html", HTML);
indexFile += "<li><a href=\"" + tiddler.title.filenameEncode() + ".html" + "\" class=\"tiddlyLink tiddlyLinkExisting\">" + tiddler.title + "</a></li>\n";
story.closeTiddler(tiddler.title);
}
}
indexFileTemplate = '<html>\n\<head>\n' + HTMLTemplateHead + '\n</head>\n<body>\n' + indexFileTemplate + '\n</body>\n</html>';
indexFileTemplate = indexFileTemplate.format([wikifyPlain("SiteTitle").htmlEncode(), wikifyPlain("SiteSubtitle").htmlEncode(), "%2", "", "", "", (new Date()).toLocaleString()])
indexFile = indexFileTemplate.replace("%2", indexFile)
indexFile = wiki2Web(indexFile);
saveFile(PublishFolder + "index.html", indexFile)
saveFile(PublishFolder + "style.css", store.getTiddlerText("StyleSheet") + store.getTiddlerText("StyleSheetLayout") + store.getTiddlerText("StyleSheetColors"))
var indexWin = window.open("file://" + PublishFolder.replace(/\\/g, "/") + "index.html", null);
indexWin.focus();
}
function renderTemplate(html) {
var result = document.createElement("div");
result.innerHTML = html;
applyHtmlMacros(result, null);
var temp = result.innerHTML;
//result.parentNode.removeChild(result);
return temp;
}
// Convert wikified text to html
function wiki2Web(wikiHTML) {
//var regexpLinks = new RegExp("<a tiddlylink=.*?</a>", "img");
var regexpLinks = /<a[^>]+tiddlylink\s*=\s*["']?\s*?([^ "'>]*)\s*["']?[^>]*>[^<]+<\/a>/img;
var result = wikiHTML.match(regexpLinks);
if (result) {
for (i = 0; i < result.length; i++) {
var className = result[i].match(/ class="(.*?)"/i) ? result[i].match(/ class="(.*?)"/i)[1] : "";
var tiddlerName = result[i].match(/ tiddlylink="(.*?)"/i)[1];
var url = tiddlerName.htmlDecode().filenameEncode() + ".html";
var tiddlerLabel = result[i].match(/">(.*?)<\/a>/i)[1];
if (!className.match(/tiddlyLinkNonExisting/i))
wikiHTML = wikiHTML.myReplace(result[i], "<a class=\"" + className + "\" href=\"" + url + "\">" + tiddlerLabel + "</a>");
else
wikiHTML = wikiHTML.myReplace(result[i], "<a class=\"" + className + "\" title=\"Page does not exist\" href=\"#\">" + tiddlerName + "</a>");
}
wikiHTML = wikiHTML.replace(/ href="http:\/\//gi, " target=\"_blank\" href=\"http://");
}
return wikiHTML
}
function getWikiPath(folderName) {
var originalPath = document.location.toString();
if (originalPath.substr(0, 5) != 'file:') {
alert(config.messages.notFileUrlError);
if (store.tiddlerExists(config.messages.saveInstructions))
story.displayTiddler(null, config.messages.saveInstructions);
return;
}
var localPath = getLocalPath(originalPath);
var backSlash = localPath.lastIndexOf('\\') == -1 ? '/': '\\';
var dirPathPos = localPath.lastIndexOf(backSlash);
var subPath = localPath.substr(0, dirPathPos) + backSlash + (folderName ? folderName + backSlash: '');
return subPath;
}
// Replace without regex
String.prototype.myReplace = function(sea, rep) {
var t1 = this.indexOf(sea);
var t2 = parseInt(this.indexOf(sea)) + parseInt(sea.length);
var t3 = this.length;
return this.substring(0, t1) + rep + this.substring(t2, t3)
}
// Convert illegal characters to underscores
String.prototype.filenameEncode = function()
{
return (this.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
}
//}}}
@@color:#C06;''» »'' @@ Get it here http://tiddlytools.com/#QuickEditPackage
Provides a secondary toolbar for use when editing a tiddler. This toolbar allows you to quickly insert TiddlyWiki tiddler links, images, macros, etc. or common formatting sequences directly into tiddler content, as well as providing find/replace, sort, and 'split' functions that operate on the tiddler source content displayed in the editor.
{{textleft{<<tiddler QuickEditToolbar with: show>>}}}
+++[installation instructions...]>...
After importing these tiddlers, add the following line to your EditTemplate:
{{{
<div macro='tiddler QuickEditToolbar'></div>
}}}
and add the following line to your StyleSheet:
{{{
[[StyleSheetShortcuts]]
}}}
Note that, after adding the QuickEditToolbar to your EditTemplate, it is //not automatically displayed when editing a tiddler//. To enable display of the toolbar, you can add the following configuration option control to your SideBarOptions (or any other suitable location):
{{{
<<option chkShowQuickEdit>> show QuickEdit toolbar
}}}
When this option is checked and you subsequently edit a tiddler, the QuickEditToolbar will then be displayed. Alternatively, you can 'hard-code' this setting, so that the QuickEditToolbar will //always// be displayed, by creating a tiddler (e.g., ConfigTweaks), tagged with <<tag systemConfig>>, containing:
{{{
config.options.chkShowQuickEdit=true;
}}}
Optionally, to add a tiddler command item that toggles the display of the QuickEditToolbar while editing a tiddler, insert the following line to your EditTemplate:
{{{
<span class='toolbar' macro='toolbar toggleQuickEdit'></span>
}}}
You can also add individual ~QuickEdit toolbar buttons (e.g. [[QuickEdit_replace]], [[QuickEdit_link]], etc) directly to the tiddler editor menu, by inserting one or more lines to your EditTemplate, like this:
{{{
<span class='toolbar' macro='tiddler QuickEdit_replace'></span>
}}}
===
/***
|Name|QuickEditPlugin|
|Source|http://www.TiddlyTools.com/#QuickEditPlugin|
|Documentation|http://www.TiddlyTools.com/#QuickEditPlugin|
|Version|2.4.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Support functions for ~QuickEdit package: styles, utility functions, and 'toggleQuickEdit' command|
!!!!!Revisions
<<<
2008.09.07 [2.4.1] added removeOptionCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.17 [2.4.0] copied code from StickyPopupPlugin to remove dependency
2008.05.12 [2.3.0] added "toggleQuickEdit" command handler (replaces inline script command)
2008.01.11 [2.2.0] converted from inline script
2007.03.29 [1.0.0] initial release (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.QuickEditPlugin= {major: 2, minor: 4, revision: 1, date: new Date(2008,9,7)};
// SET STYLESHEET (for toolbar button style)
setStylesheet(".quickEdit a { border:2px outset ButtonFace; -moz-appearance:button; padding:0px 3px; \
background-color:ButtonFace; color:ButtonText !important; line-height:200%; font-weight:normal; }", "quickEditStyles");
// if removeOptionCookie() function is not defined by TW core, define it here.
if (window.removeOptionCookie===undefined) {
window.removeOptionCookie=function(cookie) {
var ex=new Date(); ex.setTime(ex.getTime()-1000); // immediately expire cookie
document.cookie = cookie+"=novalue; path=/; expires="+ex.toGMTString();
}
}
// UTILITY FUNCTIONS
config.quickEdit = {
getField: function(where) {
var here=story.findContainingTiddler(where); if (!here) return null;
var e=story.getTiddlerField(here.getAttribute("tiddler"),"text");
if (e&&e.getAttribute("edit")=="text") return e;
return null;
},
setSelection: function(where,newtext) {
var e=this.getField(where); if (!e) return false;
e.focus(); replaceSelection(e,newtext);
return false;
},
wrapSelection: function(where,before,after) {
var e=this.getField(where); if (!e) return false;
e.focus(); replaceSelection(e,before+config.quickEdit.getSelection(e)+after);
return false;
},
getSelection: function(e) {
var seltext="";
if (e&&e.setSelectionRange)
seltext=e.value.substr(e.selectionStart,e.selectionEnd-e.selectionStart);
else if (document.selection) {
var range = document.selection.createRange();
if (range.parentElement()==e) seltext=range.text
}
return seltext;
},
promptForFilename: function(msg,path,file) {
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeOpen);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='jpg';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterImages);
if (picker.show()!=nsIFilePicker.returnCancel)
var result="file:///"+picker.file.persistentDescriptor.replace(/\\/g,'/');
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|JPG files|*.jpg|GIF files|*.gif|PNG files|*.png|';
s.FilterIndex=1; // default to JPG files;
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
}
}
//}}}
//{{{
if (config.options.chkShowQuickEdit===undefined) config.options.chkShowQuickEdit=false;
config.commands.toggleQuickEdit = {
hideReadOnly: true,
getText: function() { return config.options.chkShowQuickEdit?'\u221Aquickedit':'quickedit'; },
tooltip: 'show QuickEdit toolbar buttons',
handler: function(event,src,title) {
config.options.chkShowQuickEdit=!config.options.chkShowQuickEdit;
config.macros.option.propagateOption("chkShowQuickEdit","checked", config.options.chkShowQuickEdit,"input");
// save cookie when toolbar shown, remove cookie when toolbar hidden
if (config.options.chkShowQuickEdit) saveOptionCookie("chkShowQuickEdit");
else removeOptionCookie("chkShowQuickEdit");
// set link and title based on option state
src.innerHTML=config.commands.toggleQuickEdit.getText();
// refresh all actively displayed tiddler editor(s)
story.forEachTiddler(function(t,e){if (story.isDirty(t)) refreshElements(e);});
return false;
}
};
//}}}
// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
// if click is in a sticky popup, ignore it so popup will remain visible
var e = ev ? ev : window.event; var target = resolveTarget(e);
var p=target; while (p) {
if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
else p=p.parentNode;
}
if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
Popup.onDocumentClick(ev);
return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/%
|Name|QuickEditToolbar|
|Source|http://www.TiddlyTools.com/#QuickEditToolbar|
|Version|2.1.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin, InlineJavascriptPlugin|
|Optional|QuickEdit_replace, QuickEdit_split, QuickEdit_link, QuickEdit_macro, QuickEdit_image, QuickEdit_tiddler, QuickEdit_file, QuickEdit_format, QuickEdit_sort|
|Overrides||
|Description|quickly insert TiddlyWiki tiddler links or common formatting sequences directly into tiddler content|
Usage (in EditTemplate): <div macro='tiddler QuickEditToolbar with: show'></div>
where "show" is an OPTIONAL keyword to force the toolbar to be displayed regardless of the current 'toggle' state
%/<<tiddler HideTiddlerTags>>/%
TOOLBAR DEFINITIONS BEGIN HERE...
= = = = = = = = = = = = = = = = =
%/{{hidden fine center quickEdit{
<script>
// note: always show toolbar when directly viewing the tiddler containing the actual toolbar definition!
var here=story.findContainingTiddler(place); if (here) var tid=here.getAttribute("tiddler");
var show="$1"!="$"+"1"||config.options.chkShowQuickEdit||tid=="QuickEditToolbar"
place.style.display=show?"block":"none";
</script>/%
%/<<tiddler QuickEdit_format>>/%
%/<<tiddler QuickEdit_align>>/%
%/<<tiddler QuickEdit_color>>/%
%/<<tiddler QuickEdit_font>>/%
%/ /% (SPACER)
%/<<tiddler QuickEdit_equation>>/%
%/ /% (SPACER)
%/<<tiddler QuickEdit_link>>/%
%/<<tiddler QuickEdit_macro>>/%
%/<<tiddler QuickEdit_image>>/%
%/<<tiddler QuickEdit_tiddler>>/%
%/}}}
/%
|Name|QuickEdit_align|
|Source|http://www.TiddlyTools.com/#QuickEdit_align|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button for text alignment|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_align>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_align'></span>
**** ALIGNMENT ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="align text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select text alignment...','');
s.onchange=function(){
config.quickEdit.wrapSelection(this.button,'{{'+this.value+'{','}}}');
Popup.remove(); return false;
};
s.options[s.length]=new Option('left','left');
s.options[s.length-1].title='{{left{...}}}';
s.options[s.length]=new Option('center','center');
s.options[s.length-1].title='{{center{...}}}';
s.options[s.length]=new Option('right','right');
s.options[s.length-1].title='{{right{...}}}';
s.options[s.length]=new Option('justify','justify');
s.options[s.length-1].title='{{justify{...}}}';
s.options[s.length]=new Option('float left','floatleft');
s.options[s.length-1].title='{{floatleft{...}}}';
s.options[s.length]=new Option('float right','floatright');
s.options[s.length-1].title='{{floatright{...}}}';
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>align</a></html>
/%
|Name|QuickEdit_color|
|Source|http://www.TiddlyTools.com/#QuickEdit_color|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition of toolbar button for "color" command|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_color>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_color'></span>
**** COLOR ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="text/background color - @@color:#RGB;background-color:#RGB;...@@"
onclick="var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
p.style.padding='2px';
function hex(d) { return '0123456789ABCDEF'.substr(d,1); }
var fg=createTiddlyElement(p,'select'); fg.button=this;
fg.style.width='12em';
fg.options[0]=new Option('text color...','');
fg.options[1]=new Option('\xa0 or enter a value','_ask');
fg.options[2]=new Option('\xa0 or use default color','');
for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
var label=hex(r)+hex(g)+hex(b);
fg.options[fg.length]=new Option(label,'#'+label);
fg.options[fg.length-1].style.color='#'+label;
}
fg.onchange=function(){ var val=this.value;
if (val=='_ask') { val=prompt('Enter a CSS color value');
if (!val||!val.length) return false; }
this.options[0].value=val; this.options[0].text=val.length?'text: '+val:'text color...';
var bg=this.nextSibling;
for (var i=3;i<bg.options.length;i++) bg.options[i].style.color=val;
var preview=this.nextSibling.nextSibling.nextSibling;
var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
var fg=this.value; if (fg.length) fg='color:'+fg+';';
var bg=this.nextSibling.value; if (bg.length) bg='background-color:'+bg+';';
if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
removeChildren(preview); wikify(t,preview);
this.selectedIndex=0; return false;
};
var bg=createTiddlyElement(p,'select'); bg.button=this;
bg.style.width='12em';
bg.options[0]=new Option('background color...','');
bg.options[1]=new Option('\xa0 or enter a value','_ask');
bg.options[2]=new Option('\xa0 or use default color','');
for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
var label=hex(15-r)+hex(15-g)+hex(15-b);
bg.options[bg.length]=new Option(label,'#'+label);
bg.options[bg.length-1].style.backgroundColor='#'+label;
}
bg.onchange=function(){ var val=this.value;
if (val=='_ask') { val=prompt('Enter a CSS color value');
if (!val||!val.length) return false; }
this.options[0].value=val;
this.options[0].text=val.length?'background: '+val:'background color...';
var fg=this.previousSibling;
for (var i=3;i<fg.options.length;i++) fg.options[i].style.backgroundColor=val;
var preview=this.nextSibling.nextSibling;
var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
var fg=this.previousSibling.value; if (fg.length) fg='color:'+fg+';';
var bg=this.value; if (bg.length) bg='background-color:'+bg+';';
if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
removeChildren(preview); wikify(t,preview);
this.selectedIndex=0; return false;
};
var b=createTiddlyElement(p,'input',null,null,null,{type:'button'}); b.button=this;
b.value='ok'; b.style.width='4em';
b.onclick=function() {
var fg=this.previousSibling.previousSibling.value; if (fg.length) fg='color:'+fg+';';
var bg=this.previousSibling.value; if (bg.length) bg='background-color:'+bg+';';
var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
if (fg.length||bg.length) config.quickEdit.setSelection(this.button,'@@'+fg+bg+t+'@@');
Popup.remove(); return false;
};
var preview=createTiddlyElement(p,'div',null,'viewer'); var s=preview.style;
s.border='1px solid'; s.margin='2px'; s.width='24em'; s.padding='3px'; s.MozBorderRadius='3px';
s.overflow='hidden'; s.textAlign='center'; s.whiteSpace='normal';
var t=config.quickEdit.getSelection(config.quickEdit.getField(this));
wikify(t.length?t:'~AaBbCcDdEeFfGgHhIiJj 1234567890',preview);
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>color</a></html>
/%
|Name|QuickEdit_css|
|Source|http://www.TiddlyTools.com/#QuickEdit_css|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button for inline css and css class wrappers|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_css>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_css'></span>
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="inline CSS styles - @@attr:value;attr:value;...@@"
onclick="var css=prompt('Enter CSS attribute/value pairs (attr:val;attr:val;...;)','');
if (!css) return false; /* cancelled by user */
return config.quickEdit.wrapSelection(this,'@@'+css+';','@@');"
>style</a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="CSS class wrapper - {{classname classname etc{...}}}"
onclick="var c=prompt('Enter a CSS classname','');
if (!c) return false; /* cancelled by user */
return config.quickEdit.wrapSelection(this,'{{'+c+'{','}}}');"
>class</a></html>
/%
|Name|QuickEdit_equation|
|Source|TBA|
|Version|1.0.0|
|Author|Morris Gray - twhelp.tiddlywiki.com & Will Bateman - CodeCogs.com|
|License|http://www.codecogs.com|
|~CoreVersion|2.2|
|Type|script|
|Requires|QuickEditPlugin Package http://tiddlytools.com/#QuickEditPackage|
|Overrides||
|Description|definition for toolbar button for equation editing|
This script must be put in MarkupPreHead
{{{<script type="text/javascript" src="http://latex.codecogs.com/editor.js"></script>}}}
Usage:
QuickEditToolbar: <<tiddler QuickEdit_equation>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_equation'></span>
**** INSERT EQUATION ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="embed an equation - "
onclick="config.quickEdit.id='eqntarget'; OpenLatexEditor('eqntarget','tw',''); "
>equation</a></html>
/%
|Name|QuickEdit_file|
|Source|http://www.TiddlyTools.com/#QuickEdit_file|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar buttons that insert content from external files|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_file>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_file'></span>
**** INSERT FILE ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="insert content from an external text file"
onclick="var fn=config.quickEdit.promptForFilename('Enter/select a text file',getLocalPath(document.location.href),'');
if (!fn) return false; /* cancelled by user */
var text=loadFile(getLocalPath(fn)); if (!text) { alert('Error: unable to read contents from \0027'+fn+'\0027'); return; }
return config.quickEdit.setSelection(place,text);"
>file</a></html>
/%
|Name|QuickEdit_font|
|Source|http://www.TiddlyTools.com/#QuickEdit_font|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button that set font-family CSS attribute|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_font>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_macro'></span>
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="set font-family CSS attribute - @@font-family:facename;...@@"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a font family...','');
s.onchange=function(){
if (this.value=='_edit')
story.displayTiddler(story.findContainingTiddler(this.button),'QuickEdit_fontList',DEFAULT_EDIT_TEMPLATE);
else
config.quickEdit.wrapSelection(this.button,'@@font-family:\x22'+this.value+'\x22;','@@');
Popup.remove(); return false;
};
var fonts=store.getTiddlerText('QuickEdit_fontList','').split('\n');
for (var i=0; i<fonts.length; i++) {
if (!fonts[i].length) continue;
s.options[s.length]=new Option(fonts[i],fonts[i]);
s.options[s.length-1].style.fontFamily=fonts[i];
}
s.options[s.length]=new Option('[Edit font list...]','_edit');
s.options[s.length-1].title='enter fonts, one per line...';
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>font</a></html>
Arial,helvetica,sans-serif
Times New Roman,times,serif
Courier,monospaced
/%
|Name|QuickEdit_format|
|Source|http://www.TiddlyTools.com/#QuickEdit_format|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button for text formatting|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_format>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_format'></span>
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" title="''bold''" accesskey="B"
onclick="config.quickEdit.wrapSelection(this,'\x27\x27','\x27\x27'); return false;"
> B </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" title="//italics//" accesskey="I"
onclick="config.quickEdit.wrapSelection(this,'//','//'); return false;"
> I </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" title="__underline__" accesskey="U"
onclick="config.quickEdit.wrapSelection(this,'__','__'); return false;"
> U </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" title="--strikethrough--" accesskey="S"
onclick="config.quickEdit.wrapSelection(this,'--','--'); return false;"
> S </a></html>/%
%/ /% SPACER
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="format text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select text format...','');
s.onchange=function(){
var parts=this.value.split(',');
config.quickEdit.wrapSelection(this.button,parts[0],parts[1]);
Popup.remove(); return false;
};
s.options[s.length]=new Option('superscript','^^,^^');
s.options[s.length-1].title='^^superscript^^';
s.options[s.length]=new Option('subscript','~~,~~');
s.options[s.length-1].title='~~subcript~~';
s.options[s.length]=new Option('blockquote','\n\<\<\<\n,\n\<\<\<\n');
s.options[s.length-1].title='indented blockquote - \<\<\<';
s.options[s.length]=new Option('monospaced','{{{,}}}');
s.options[s.length-1].title='inline monospaced text - {{{...}}}';
s.options[s.length]=new Option('pre','\n{{{\n,\n}}}\n');
s.options[s.length-1].title='multi-line monospaced text box - {{{...}}}';
s.options[s.length]=new Option('heading 1','\n!,\n');
s.options[s.length-1].title='H1 heading - !';
s.options[s.length]=new Option('heading 2','\n!!,\n');
s.options[s.length-1].title='H2 heading - !';
s.options[s.length]=new Option('heading 3','\n!!!,\n');
s.options[s.length-1].title='H3 heading - !';
s.options[s.length]=new Option('heading 4','\n!!!!,\n');
s.options[s.length-1].title='H4 heading - !';
s.options[s.length]=new Option('heading 5','\n!!!!!,\n');
s.options[s.length-1].title='H5 heading - !';
s.options[s.length]=new Option('comment','/%,%/');
s.options[s.length-1].title='comment (hidden content) - /%...%/';
s.options[s.length]=new Option('HTML','<html>,<\x2fhtml>');
s.options[s.length-1].title='HTML syntax - <html>...<\x2fhtml>';
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>format</a></html>
/%
|Name|QuickEdit_image|
|Source|http://www.TiddlyTools.com/#QuickEdit_image|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar buttons that insert embedded image references|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_image>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_image'></span>
**** INSERT IMAGE ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="embed an image (jpg/gif/png) - [img[tooltip|URL]] or [img[tooltip|path/to/file.ext]]"
onclick="var fn=config.quickEdit.promptForFilename('Enter/select an image file',getLocalPath(document.location.href),'');
if (!fn) return false; /* cancelled by user */
var tip=prompt('Enter a tooltip for this image',''); if (!tip) tip=''; else tip+='|';
return config.quickEdit.setSelection(this,'[img['+tip+fn+']]');"
>image</a></html>
/%
|Name|QuickEdit_link|
|Source|http://www.TiddlyTools.com/#QuickEdit_link|
|Version|2.2.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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|toolbar button that inserts a ~PrettyTiddlyLink to a tiddler or external file|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_link>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_link'></span>
**** INSERT LINK ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="add a 'PrettyLink' to another tiddler - [[link text|TiddlerName]]"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a tiddler or file...','');
s.onchange=function(){
var title=this.value; var txt=title;
if (title=='_file') {
title=config.quickEdit.promptForFilename('Select a file',
getLocalPath(document.location.href),'');
if (!title) { this.selectedIndex=0; this.focus(); return false; }
var txt=title.substr(title.lastIndexOf('/')+1);
}
var txt=prompt('Enter the text to display for this link',txt);
if (!txt) { this.selectedIndex=0; this.focus(); return false; }
config.quickEdit.setSelection(this.button,'[['+txt+'|'+title+']]');
Popup.remove(); return false;
};
s.options[s.length]=new Option('[browse for file...]','_file');
var tids=store.getTiddlers('title');
for (var t=0; t<tids.length; t++) {
s.options[s.length]=new Option(tids[t].title,tids[t].title);
s.options[s.length-1].title=tids[t].getSubtitle();
}
var s=createTiddlyElement(p,'select');
s.options[0]=new Option('match tag...','');
s.onchange=function(){
var tag=this.value;
var tids=tag.length?store.getTaggedTiddlers(tag,'title'):store.getTiddlers('title');
var list=this.previousSibling;
while (list.length) list.options[0]=null;
var prompt='select a tiddler or file...';
if (tag.length) prompt='select a tagged tiddler ['+tids.length+' matches]...';
list.options[0]=new Option(prompt,'');
if (!tag.length) list.options[list.length]=new Option('[browse for file...]','_file');
for (var t=0; t<tids.length; t++) {
list.options[list.length]=new Option(tids[t].title,tids[t].title);
list.options[list.length-1].title=tids[t].getSubtitle();
}
};
var tags=store.getTags();
for (var t=0; t<tags.length; t++) s.options[s.length]=new Option(tags[t][0],tags[t][0]);
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>link</a></html>
/%
|Name|QuickEdit_macro|
|Source|http://www.TiddlyTools.com/#QuickEdit_macro|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button that inserts macros with guide text|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_macro>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_macro'></span>
**** INSERT MACRO ****
The "macro" command can include optional "guideText" for any given macro, as an aide to entering macro parameters, by embedding placeholders or recommended default values into the macro syntax that is inserted into your tiddler content. For built-in TW core macros, this guideText is defined below. You can add guideText to your own plugin-defined macros by using the following javascript syntax: config.macros.macroName.guideText="guide text goes here";
%/<<tiddler {{
/* SET MACRO GUIDE TEXT (for built-in core macros) (11/17 - TBD - incomplete list) */
config.macros.edit.guideText="fieldname #rows";
config.macros.view.guideText="fieldname (link,wikified,date) format";
config.macros.slider.guideText="cookie TiddlerName label tooltip";
config.macros.option.guideText="(txtCookieName,chkCookieName)";
config.macros.tiddler.guideText="TiddlerName with: params...";
""; /* must return blank to suppress output */ }}>>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="add a macro - \<\<macroName ...\>\>"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a macro...','');
s.onchange=function(){
config.quickEdit.setSelection(this.button,'\<\<'+this.value+'\>\>');
Popup.remove(); return false;
};
var macros=[]; for (var m in config.macros) if (config.macros[m].handler) macros.push(m); macros.sort();
for (var i=0; i<macros.length; i++) { var m=macros[i];
var help=config.macros[m].guideText; if (!help) help=''; else help=' '+help;
s.options[s.length]=new Option(m,m+help);
s.options[s.length-1].title='\<\<'+m+help+'\>\>';
}
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>macro</a></html>
/%
|Name|QuickEdit_replace|
|Source|http://www.TiddlyTools.com/#QuickEdit_replace|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for find/replace toolbar button|
Usage:find/replace selected text with replacement text
QuickEditToolbar: <<tiddler QuickEdit_replace>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_replace'></span>
**** FIND/REPLACE/NEXT/ALL ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="find/replace selected text with replacement text"
onclick="var here=story.findContainingTiddler(this); if (!here) return false;
var e=config.quickEdit.getField(here);
var s=config.quickEdit.getSelection(e);
var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
var t=createTiddlyElement(p,'input'); t.onfocus=function(){this.select()};
t.value=s.length?s:'enter target text';
var r=createTiddlyElement(p,'input'); r.onfocus=function(){this.select()};
r.value='enter replacement text';
var tid=here.getAttribute('tiddler');
var b=createTiddlyElement(p,'button',null,null,'?',{tid:tid});
b.style.width='2em';
b.title='FIND/FIND NEXT target text';
b.onclick=function(ev) { /* FIND */
var e=story.getTiddlerField(this.getAttribute('tid'),'text');
if (!e||e.getAttribute('edit')!='text') return;
var t=this.previousSibling.previousSibling;
e.focus();
if (e.setSelectionRange) { /* MOZ */
var newstart=e.value.indexOf(t.value,e.selectionStart+1);
if (newstart==-1) newstart=e.value.indexOf(t.value); /* wrap around */
if (newstart==-1) { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); return; }
e.setSelectionRange(newstart,newstart+t.value.length);
var linecount=e.value.split('\n').length;
var thisline=e.value.substr(0,e.selectionStart).split('\n').length;
e.scrollTop=Math.floor((thisline-1-e.rows/2)*e.scrollHeight/linecount);
} else if (document.selection) { /* IE */
var range=document.selection.createRange();
if(range.parentElement()==e) {
range.collapse(false);
var found=false; try{found=range.findText(t.value,e.value.length,4)}catch(e){}
if (found) range.select();
else { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); }
}
}
};
b=createTiddlyElement(p,'button',null,null,'=',{tid:tid});
b.style.width='2em';
b.title='REPLACE selected text';
b.onclick=function(ev) { /* REPLACE */
var e=story.getTiddlerField(this.getAttribute('tid'),'text');
if (!e||e.getAttribute('edit')!='text') return;
var t=this.previousSibling.previousSibling.previousSibling;
var r=this.previousSibling.previousSibling;
if ( (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
|| (document.selection && document.selection.createRange().text==''))
this.previousSibling.click(); /* no selection... do FIND first */
if ( (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
|| (document.selection && document.selection.createRange().text==''))
{ t.focus(); return; } /* still no selection... goto target input */
e.focus(); replaceSelection(e,r.value);
};
b=createTiddlyElement(p,'button',null,null,'+',{tid:tid});
b.style.width='2em';
b.title='REPLACE selected text AND FIND NEXT target text';
b.onclick=function(ev) { /* REPLACE and FIND NEXT */
this.previousSibling.click();
this.previousSibling.previousSibling.click();
};
b=createTiddlyElement(p,'button',null,null,'!',{tid:tid});
b.style.width='2em';
b.title='REPLACE ALL occurrences of target text';
b.onclick=function(ev) { /* REPLACE ALL */
var e=story.getTiddlerField(this.getAttribute('tid'),'text');
if (!e||e.getAttribute('edit')!='text') return;
var t=this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling;
var r=this.previousSibling.previousSibling.previousSibling.previousSibling;
if (!t.value.length) { alert('Please enter the target text'); t.focus(); return; }
var m='This will replace all occurences of:\n\n';
m+='\''+t.value+'\'\n\nwith:\n\n\''+r.value+'\'\n\nAre you sure?';
if (!confirm(m)) { r.focus(); r.select(); return; }
e.value=e.value.replace(new RegExp(t.value.escapeRegExp(),'gm'),r.value);
e.focus(); e.select(); Popup.remove();
};
Popup.show(p,false);
if (!s.length) {t.focus();t.select()} else {r.focus();r.select()}
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>replace</a></html>
/%
|Name|QuickEdit_sort|
|Source|http://www.TiddlyTools.com/#QuickEdit_sort|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar "sort" button|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_sort>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_sort'></span>
**** SORT LINES ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="sort lines of text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select sort order...','');
s.onchange=function(){
var e=config.quickEdit.getField(this.button); if (!e) return false;
var lines=config.quickEdit.getSelection(e).split('\n').sort();
if (this.value=='D') lines=lines.reverse();
replaceSelection(e,lines.join('\n'));
e.focus();
Popup.remove(); return false;
};
s.options[s.length]=new Option('ascending','A');
s.options[s.length-1].title='ascending';
s.options[s.length]=new Option('descending','D');
s.options[s.length-1].title='descending';
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>sort</a></html>
/%
|Name|QuickEdit_split|
|Source|http://www.TiddlyTools.com/#QuickEdit_split|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|toolbar button: split selected content into separate tiddler|
Based on ideas originally developed by YannPerrin
(http://yann.perrin.googlepages.com/twkd.html#easySlicer)
Usage
QuickEditToolbar: <<tiddler QuickEdit_split>>
OR
EditTemplate:
<div class='toolbar'>
<span macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></span>
<span macro='tiddler QuickEdit_split'></span>
</div>
**** SPLIT TIDDLER ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="move selection to new tiddler and insert link, embedded tiddler, or slider"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
p.style.whiteSpace='nowrap';
var i=createTiddlyElement(p,'input');
i.defaultValue='Enter a new tiddler title';
i.onfocus=function(){this.select()};
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select type...','');
s.options[0].title='select split type';
s.options[1]=new Option('link','link');
s.options[1].title='replace with [[TiddlerName]]';
s.options[2]=new Option('embed','embed');
s.options[2].title='replace with \<\<tiddler TiddlerName\>\>';
s.options[3]=new Option('slider','slider');
s.options[3].title='replace with \<\<slider \u0022\u0022 [[TiddlerName]] [[label]] [[tooltip]]\>\>';
s.onchange=function(){
if (s.previousSibling.value==s.previousSibling.defaultValue)
{ alert('A tiddler title is required'); s.selectedIndex=0; s.previousSibling.focus(); return false; }
var tid=s.previousSibling.value;
if (store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid])))
{ s.previousSibling.focus(); return false; }
switch(s.value) {
case 'link':
var newtxt='[['+tid+']]';
break;
case 'embed':
var newtxt='\<\<tiddler [['+tid+']]\>\>';
break;
case 'slider':
var label=prompt('Enter a slider label',tid);
if (!label) { Popup.remove(); return false; }
var tip=prompt('Enter a slider tooltip',label);
if (!tip) { Popup.remove(); return false; }
var newtxt='\<\<slider \u0022\u0022 [['+tid+']] [['+label+']] [['+tip+']]\>\>';
break;
}
var txt=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
store.saveTiddler(tid,tid,txt,config.options.txtUserName,new Date(),[],{});
story.displayTiddler(story.findContainingTiddler(this.button),tid);
config.quickEdit.setSelection(this.button,newtxt);
Popup.remove(); return false;
};
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>split</a></html>
/%
|Name|QuickEdit_tiddler|
|Source|http://www.TiddlyTools.com/#QuickEdit_tiddler|
|Version|2.2.0|
|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.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button that inserts content from another tiddler|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_tiddler>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_tiddler'></span>
**** INSERT TIDDLER ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="copy content from another tiddler"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a tiddler...','');
s.onchange=function(){
var txt=store.getTiddlerText(this.value);
if (!txt) { displayMessage(this.value+' not found'); this.selectedIndex=0; this.focus(); return false; }
config.quickEdit.setSelection(this.button,txt);
Popup.remove(); return false;
};
var tids=store.getTiddlers('title');
for (var t=0; t<tids.length; t++) {
s.options[s.length]=new Option(tids[t].title,tids[t].title);
s.options[s.length-1].title=tids[t].getSubtitle();
}
var s=createTiddlyElement(p,'select');
s.options[0]=new Option('match tag...','');
s.onchange=function(){
var tag=this.value;
var tids=tag.length?store.getTaggedTiddlers(tag,'title'):store.getTiddlers('title');
var list=this.previousSibling;
while (list.length) list.options[0]=null;
var prompt='select a '+(tag.length?'tagged ':'')+'tiddler'+(tag.length?(' ['+tids.length+' matches]'):'')+'...';
list.options[0]=new Option(prompt,'');
for (var t=0; t<tids.length; t++) {
list.options[list.length]=new Option(tids[t].title,tids[t].title);
list.options[list.length-1].title=tids[t].getSubtitle();
}
};
var tags=store.getTags();
for (var t=0; t<tags.length; t++) s.options[s.length]=new Option(tags[t][0],tags[t][0]);
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>tiddler</a></html>
/***
|Name|SaveAsPlugin|
|Source|http://www.TiddlyTools.com/#SaveAsPlugin|
|Documentation|http://www.TiddlyTools.com/#SaveAsPluginInfo|
|Version|2.4.3|
|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|Save current document to a different path/filename|
This plugin automatically adds a 'save as' command to the TiddlyWiki 'backstage' menu that allows you to quickly create an exact copy of the current TiddlyWiki document. The plugin also defines a macro that you can use to place a "save as..." command link into your sidebar/mainmenu/any tiddler (or wherever you like).
>//Note: This plugin now supersedes [[NewDocumentPlugin]], which has been retired and is no longer being distributed. In addition, the HTML+CSS "snapshot" functionality previous provided by that plugin has been moved to a separate plugin. Please see [[SnapshotPlugin]] for additional information.//
!!!!!Documentation
<<<
see [[SaveAsPluginInfo]]
<<<
!!!!!Revisions
<<<
2008.09.29 [2.4.3] in getData(), convert existing TW file from UTF8 to Unicode before merging to correct handling of international characters and symbols.
| Please see [[SaveAsPluginInfo]] for additional revision details |
2006.02.03 [1.0.0] Created.
<<<
!!!!!Code
***/
//{{{
version.extensions.SaveAsPlugin= {major: 2, minor: 4, revision: 2, date: new Date(2008,9,28)};
config.macros.saveAs = {
label: "save as...",
labelparam: "label:",
prompt: "Save current document to a different path/file",
promptparam: "prompt:",
filePrompt: "Please select or enter a target path/filename",
targetparam: "target:",
defaultFilename: "new.html",
filenameparam: "filename:",
currfilekeyword: "here",
typeparam: "type:",
type_TW: "tw", type_PS: "ps", type_TX: "tx", type_NF: "nf", // file type tokens
type_map: { // map filetype param alternatives/abbreviations to token values
tiddlywiki:"tw", tw:"tw", wiki: "tw",
purestore: "ps", ps:"ps", store:"ps",
plaintext: "tx", tx:"tx", text: "tx",
newsfeed: "nf", nf:"nf", xml: "nf", rss:"nf"
},
replaceparam: "replace",
mergeparam: "merge",
quietparam: "quiet",
openparam: "open",
askParam: "ask",
askMsg: "Enter a tag filter (use * for all tiddlers, 'none' for blank document)",
emptyParam: "none",
confirmmsg: "Found %0 tiddlers matching\n\n'%1'\n\nPress OK to proceed",
mergeprompt: "%0\nalready contains tiddler definitions.\n"
+"\nPress OK to add new/revised tiddlers to current file contents."
+"\nPress Cancel to completely replace file contents",
mergestatus: "Merged %0 new/revised tiddlers and %1 existing tiddlers",
okmsg: "%0 tiddlers written to %1",
failmsg: "An error occurred while creating %1",
filter: "",
handler: function(place,macroName,params) {
if (params[0] && params[0].substr(0,this.labelparam.length)==this.labelparam)
var label=params.shift().substr(this.labelparam.length);
if (params[0] && params[0].substr(0,this.promptparam.length)==this.promptparam)
var prompt=params.shift().substr(this.promptparam.length);
if (params[0] && params[0].substr(0,this.targetparam.length)==this.targetparam)
var target=params.shift().substr(this.targetparam.length);
if (params[0] && params[0].substr(0,this.filenameparam.length)==this.filenameparam)
var filename=params.shift().substr(this.filenameparam.length);
if (params[0] && params[0].substr(0,this.typeparam.length)==this.typeparam)
var filetype=this.type_map[params.shift().substr(this.typeparam.length).toLowerCase()];
var q=(params[0] && params[0]==this.quietparam); if (q) params.shift();
var o=(params[0] && params[0]==this.replaceparam); if (o) params.shift();
var m=(params[0] && params[0]==this.mergeparam); if (m) params.shift();
var a=(params[0] && params[0]==this.openparam); if (a) params.shift();
var btn=createTiddlyButton(place,label||this.label,prompt||this.prompt,
function(){config.macros.saveAs.go(
this.getAttribute('target'),
this.getAttribute('filename'),
this.getAttribute('filetype'),
this.getAttribute('filter'),
this.getAttribute('quiet')=="true",
this.getAttribute('overwrite')=="true",
this.getAttribute('merge')=="true",
this.getAttribute('autoopen')=="true"); return false;}
);
if (target) btn.setAttribute("target",target);
if (filename) btn.setAttribute("filename",filename);
btn.setAttribute("filetype",filetype||this.type_TW);
btn.setAttribute("filter",params.join(" "));
btn.setAttribute("quiet",q?"true":"false");
btn.setAttribute("overwrite",o?"true":"false");
btn.setAttribute("merge",m?"true":"false");
btn.setAttribute("autoopen",a?"true":"false");
},
go: function(target,filename,filetype,filter,quiet,overwrite,merge,autoopen) {
var cm=config.messages; // abbreviation
var cms=config.macros.saveAs; // abbreviation
if (window.location.protocol!="file:") // make sure we are local
{ displayMessage(cm.notFileUrlError); return; }
// get tidders, confirm filtered results
var tids=cms.selectTiddlers(filter);
if (tids===false) return; // cancelled by user
if (cms.filter!=cms.emptyParam && cms.filter.length && !quiet)
if (!confirm(cms.confirmmsg.format([tids.length,cms.filter]))) return;
// get target path/filename
if (!filetype) filetype=this.type_TW;
target=target||cms.getTarget(filename,filetype==this.type_TX?'txt':'html');
if (!target) return; // cancelled by user
var link="file:///"+target.replace(/\\/g,'/');
var samefile=link==decodeURIComponent(window.location.href);
var p=getLocalPath(document.location.href);
if (samefile) {
if (config.options.chkSaveBackups) { var t=loadOriginal(p);if(t)saveBackup(p,t); }
if (config.options.chkGenerateAnRssFeed && saveRss instanceof Function) saveRss(p);
}
var notes="";
var total={val:0};
var out=this.assembleFile(target,filetype,tids,notes,quiet,overwrite,merge,total);
var ok=saveFile(target,out);
if (ok && autoopen) {
if (!samefile) window.open(link).focus();
else { store.setDirty(false); window.location.reload(); }
}
if (!quiet || !(ok && autoopen))
displayMessage((ok?this.okmsg:this.failmsg).format([total.val,target]),link);
},
selectTiddlers: function(filter) {
var cms=config.macros.saveAs; // abbreviation
cms.filter=filter||"";
if (filter==cms.emptyParam) return [];
if (!filter||!filter.length) return store.getTiddlers("title");
// get filtered tiddlers
if (filter==config.macros.saveAs.askParam) {
filter=prompt(config.macros.saveAs.askMsg,"");
if (!filter) return false; // cancelled by user
cms.filter=filter=="*"?"":filter;
if (filter=="*") return store.getTiddlers("title");
}
return store.filterTiddlers("[tag["+filter+"]]");
},
getTarget: function(defName,defExt) {
var cms=config.macros.saveAs; // abbreviation
// get new target path/filename
var newPath=getLocalPath(window.location.href);
var slashpos=newPath.lastIndexOf("/"); if (slashpos==-1) slashpos=newPath.lastIndexOf("\\");
if (slashpos!=-1) newPath=newPath.substr(0,slashpos+1); // trim filename
if (!defName||!defName.length) { // use current filename as default
var p=getLocalPath(window.location.href);
var s=p.lastIndexOf("/"); if (s==-1) s=p.lastIndexOf("\\");
if (s!=-1) defName=p.substr(s+1);
}
var defFilename=(defName||cms.defaultFilename).replace(/.html$/,'.'+defExt);
var target=cms.askForFilename(cms.filePrompt,newPath,defFilename,defExt);
if (!target) return; // cancelled by user
// if specified file does not include a path, assemble fully qualified path and filename
var slashpos=target.lastIndexOf("/"); if (slashpos==-1) slashpos=target.lastIndexOf("\\");
if (slashpos==-1) target=target+(defName||cms.defaultFilename).replace(/.html$/,'.'+defExt);
return target;
},
askForFilename: function(msg,path,file,defExt) {
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension=defExt||'html';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP/Vista only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
s.FilterIndex=(defExt=='txt')?2:3; // default to HTML files;
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
},
plainTextHeader:
'// Source'+':\n//\t%0\n'
+'// Title:\n//\t%1\n'
+'// Subtitle:\n//\t%2\n'
+'// Created:\n//\t%3 by %4\n'
+'// Application:\n//\tTiddlyWiki %5 / %6 %7\n',
plainTextTiddler:
'\n// ----- %0 (by %1 on %2) -----\n\n%3',
plainTextFooter:
'',
newsFeedHeader:
'<'+'?xml version="1.0"?'+'>\n'
+'<rss version="2.0">\n'
+'<channel>\n'
+'<title>%1</title>\n'
+'<link>%0</link>\n'
+'<description>%2</description>\n'
+'<language>en-us</language>\n'
+'<copyright>Copyright '+(new Date().getFullYear())+' %4</copyright>\n'
+'<pubDate>%3</pubDate>\n'
+'<lastBuildDate>%3</lastBuildDate>\n'
+'<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n'
+'<generator>TiddlyWiki %5 / %6 %7</generator>\n',
newsFeedTiddler:
'\n%0\n',
newsFeedFooter:
'</channel></rss>',
pureStoreHeader:
'<html><body>'
+'<style type="text/css">'
+' #storeArea {display:block;margin:1em;}'
+' #storeArea div {padding:0.5em;margin:1em;border:2px solid black;height:10em;overflow:auto;}'
+' #pureStoreHeading {width:100%;text-align:left;background-color:#eeeeee;padding:1em;}'
+'</style>'
+'<div id="pureStoreHeading">'
+' TiddlyWiki "PureStore" export file<br>'
+' Source'+': <b>%0</b><br>'
+' Title: <b>%1</b><br>'
+' Subtitle: <b>%2</b><br>'
+' Created: <b>%3</b> by <b>%4</b><br>'
+' TiddlyWiki %5 / %6 %7<br>'
+' Notes:<hr><pre>%8</pre>'
+'</div>'
+'<div id="storeArea">',
pureStoreTiddler:
'%0\n%1',
pureStoreFooter:
'</div><!--POST-BODY-START-->\n<!--POST-BODY-END--></body></html>',
assembleFile: function(target,filetype,tids,notes,quiet,overwrite,merge,total) {
var revised="";
var now = new Date().toLocaleString();
var src=convertUnicodeToUTF8(document.location.href);
var title = convertUnicodeToUTF8(wikifyPlain("SiteTitle").htmlEncode());
var subtitle = convertUnicodeToUTF8(wikifyPlain("SiteSubtitle").htmlEncode());
var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());
var twver = version.major+"."+version.minor+"."+version.revision;
var v=version.extensions.SaveAsPlugin; var pver = v.major+"."+v.minor+"."+v.revision;
var headerargs=[src,title,subtitle,now,user,twver,"SaveAsPlugin",pver,notes];
switch (filetype) {
case this.type_TX: // plain text
var header=this.plainTextHeader.format(headerargs);
var footer=this.plainTextFooter;
break;
case this.type_NF: // news feed (XML)
headerargs[0]=store.getTiddlerText("SiteUrl","");
var header=this.newsFeedHeader.format(headerargs);
var footer=this.newsFeedFooter;
break;
case this.type_PS: // PureStore (no code)
var header=this.pureStoreHeader.format(headerargs);
var footer=this.pureStoreFooter;
break;
case this.type_TW: // full TiddlyWiki
default:
var currPath=getLocalPath(window.location.href);
var original=loadFile(currPath);
if (!original) { alert(config.messages.cantSaveError); return; }
var posDiv = locateStoreArea(original);
if (!posDiv) { alert(config.messages.invalidFileError.format([currPath])); return; }
var header = original.substr(0,posDiv[0]+startSaveArea.length)+"\n";
var footer = "\n"+original.substr(posDiv[1]);
break;
}
var out=this.getData(target,filetype,tids,quiet,overwrite,merge);
var revised = header+convertUnicodeToUTF8(out.join("\n"))+footer;
// if full TW, insert page title and language attr, and reset MARKUP blocks as needed...
if (filetype==this.type_TW) {
var newSiteTitle=convertUnicodeToUTF8(getPageTitle()).htmlEncode();
revised=revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised=updateLanguageAttribute(revised);
var titles=[]; for (var i=0; i<tids.length; i++) titles.push(tids[i].title);
revised=updateMarkupBlock(revised,"PRE-HEAD",
titles.contains("MarkupPreHead")? "MarkupPreHead" :null);
revised=updateMarkupBlock(revised,"POST-HEAD",
titles.contains("MarkupPostHead")?"MarkupPostHead":null);
revised=updateMarkupBlock(revised,"PRE-BODY",
titles.contains("MarkupPreBody")? "MarkupPreBody" :null);
revised=updateMarkupBlock(revised,"POST-SCRIPT",
titles.contains("MarkupPostBody")?"MarkupPostBody":null);
}
total.val=out.length;
return revised;
},
formatItem: function(s,f,t,u) {
if (f==this.type_TW) var r=s.getSaver().externalizeTiddler(s,t);
if (f==this.type_PS) var r=this.pureStoreTiddler.format([t.title,s.getSaver().externalizeTiddler(s,t)]);
if (f==this.type_NF) var r=this.newsFeedTiddler.format([t.saveToRss(u)]);
if (f==this.type_TX) var r=this.plainTextTiddler.format([t.title,t.modifier,t.modified.toLocaleString(),t.text]);
return r||"";
},
getData: function(target,filetype,tids,quiet,overwrite,merge) {
// output selected tiddlers and gather list of titles (for use with merge)
var out=[]; var titles=[];
var url=store.getTiddlerText("SiteUrl","");
for (var i=0; i<tids.length; i++) {
out.push(this.formatItem(store,filetype,tids[i],url));
titles.push(tids[i].title);
}
// if TW or PureStore format, ask to merge with existing tiddlers (if any)
if (filetype==this.type_TW || filetype==this.type_PS) {
if (overwrite) return out; // skip merge... forced overwrite
var text=loadFile(target);
if (text && text.length) {
var remoteStore=new TiddlyWiki();
if (remoteStore.importTiddlyWiki(convertUTF8ToUnicode(text))
&& (merge||confirm(this.mergeprompt.format([target])))) {
var existing=remoteStore.getTiddlers("title");
for (var i=0; i<existing.length; i++)
if (!titles.contains(existing[i].title))
out.push(this.formatItem(remoteStore,filetype,existing[i],url));
if (!quiet) displayMessage(this.mergestatus.format([tids.length,out.length-tids.length]));
}
}
}
return out;
}
};
//}}}
//{{{
// automatically add saveAs to backstage
config.tasks.saveAs = {
text: "saveAs",
tooltip: config.macros.saveAs.prompt,
action: function(){ clearMessage(); config.macros.saveAs.go(); }
}
config.backstageTasks.splice(config.backstageTasks.indexOf("save")+1,0,"saveAs");
//}}}
config.options.chkSearchIncremental=false;
/***
|Name|SearchOptionsPlugin|
|Source|http://www.TiddlyTools.com/#SearchOptionsPlugin|
|Documentation|http://www.TiddlyTools.com/#SearchOptionsPluginInfo|
|Version|3.0.5|
|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|Story.prototype.search, TiddlyWiki.prototype.search, config.macros.search.onKeyPress|
|Options|##Configuration|
|Description|extend core search function with additional user-configurable options|
Adds extra options to core search function including selecting which data items to search, enabling/disabling incremental key-by-key searches, and generating a ''list of matching tiddlers'' instead of immediately displaying all matches. This plugin also adds syntax for rendering 'search links' within tiddler content to embed one-click searches using pre-defined 'hard-coded' search terms.
!!!!!Documentation
>see [[SearchOptionsPluginInfo]]
!!!!!Configuration
<<<
Search in:
<<option chkSearchTitles>> titles <<option chkSearchText>> text <<option chkSearchTags>> tags <<option chkSearchFields>> fields <<option chkSearchShadows>> shadows
<<option chkSearchHighlight>> Highlight matching text in displayed tiddlers
<<option chkSearchList>> Show list of matches
<<option chkSearchListTiddler>> Write list to [[SearchResults]] tiddler
<<option chkSearchTitlesFirst>> Show title matches first
<<option chkSearchByDate>> Sort matching tiddlers by modification date (most recent first)
<<option chkIncrementalSearch>> Incremental key-by-key search: {{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, {{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay
<<option chkSearchOpenTiddlers>> Search only in tiddlers that are currently displayed
<<option chkSearchExcludeTags>> Exclude tiddlers tagged with: <<option txtSearchExcludeTags>>
<<<
!!!!!Revisions
<<<
2009.01.16 [3.0.5] added chkSearchOpenTiddlers option to limit searches to displayed tiddlers only
|please see [[SearchOptionsPluginInfo]] for additional revision details|
2005.10.18 [1.0.0] Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.SearchOptionsPlugin= {major: 3, minor: 0, revision: 5, date: new Date(2009,1,16)};
var co=config.options; // abbrev
if (co.chkSearchTitles===undefined) co.chkSearchTitles=true;
if (co.chkSearchText===undefined) co.chkSearchText=true;
if (co.chkSearchTags===undefined) co.chkSearchTags=true;
if (co.chkSearchFields===undefined) co.chkSearchFields=true;
if (co.chkSearchTitlesFirst===undefined) co.chkSearchTitlesFirst=true;
if (co.chkSearchList===undefined) co.chkSearchList=true;
if (co.chkSearchHighlight===undefined) co.chkSearchHighlight=true;
if (co.chkSearchListTiddler===undefined) co.chkSearchListTiddler=false;
if (co.chkSearchByDate===undefined) co.chkSearchByDate=false;
if (co.chkIncrementalSearch===undefined) co.chkIncrementalSearch=true;
if (co.chkSearchShadows===undefined) co.chkSearchShadows=true;
if (co.txtIncrementalSearchDelay===undefined) co.txtIncrementalSearchDelay=500;
if (co.txtIncrementalSearchMin===undefined) co.txtIncrementalSearchMin=3;
if (co.chkSearchOpenTiddlers===undefined) co.chkSearchOpenTiddlers=false;
if (co.chkSearchExcludeTags===undefined) co.chkSearchExcludeTags=true;
if (co.txtSearchExcludeTags===undefined) co.txtSearchExcludeTags="excludeSearch";
if (config.macros.search.reportTitle==undefined)
config.macros.search.reportTitle="SearchResults"; // note: not a cookie!
config.macros.search.label+="\xa0"; // a little bit of space just because it looks better
//}}}
// // searchLink: {{{[search[text to find]] OR [search[text to display|text to find]]}}}
//{{{
config.formatters.push( {
name: "searchLink",
match: "\\[search\\[",
lookaheadRegExp: /\[search\[(.*?)(?:\|(.*?))?\]\]/mg,
prompt: "search for: '%0'",
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var label=lookaheadMatch[1];
var text=lookaheadMatch[2]||label;
var prompt=this.prompt.format([text]);
var btn=createTiddlyButton(w.output,label,prompt,
function(){story.search(this.getAttribute("searchText"))},"searchLink");
btn.setAttribute("searchText",text);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
});
//}}}
// // incremental search uses option settings instead of hard-coded delay and minimum input values
//{{{
var fn=config.macros.search.onKeyPress;
fn=fn.toString().replace(/500/g, "config.options.txtIncrementalSearchDelay||500");
fn=fn.toString().replace(/> 2/g, ">=(config.options.txtIncrementalSearchMin||3)");
eval("config.macros.search.onKeyPress="+fn);
//}}}
// // REPLACE story.search() for option to "show search results in a list"
//{{{
Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
var co=config.options; // abbrev
var re=new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
if (config.options.chkSearchHighlight) highlightHack=re;
var matches = store.search(re,co.chkSearchByDate?"modified":"title","");
if (co.chkSearchByDate) matches=matches.reverse(); // most recent first
var q = useRegExp ? "/" : "'";
clearMessage();
if (!matches.length) {
if (co.chkSearchListTiddler) discardSearchResults();
displayMessage(config.macros.search.failureMsg.format([q+text+q]));
} else {
if (co.chkSearchList||co.chkSearchListTiddler)
reportSearchResults(text,matches);
else {
var titles = []; for(var t=0; t<matches.length; t++) titles.push(matches[t].title);
this.closeAllTiddlers(); story.displayTiddlers(null,titles);
displayMessage(config.macros.search.successMsg.format([matches.length, q+text+q]));
}
}
highlightHack = null;
}
//}}}
// // REPLACE store.search() for enhanced searching/sorting options
//{{{
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag)
{
var co=config.options; // abbrev
var tids = this.reverseLookup("tags",excludeTag,false,sortField);
var opened=[]; story.forEachTiddler(function(tid,elem){opened.push(tid);});
// eliminate tiddlers tagged with excluded tags
if (co.chkSearchExcludeTags&&co.txtSearchExcludeTags.length) {
var ex=co.txtSearchExcludeTags.readBracketedList();
var temp=[]; for(var t=tids.length-1; t>=0; t--)
if (!tids[t].tags.containsAny(ex)) temp.push(tids[t]);
tids=temp;
}
// scan for matching titles first...
var results = [];
if (co.chkSearchTitles) {
for(var t=0; t<tids.length; t++) {
if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue;
if(tids[t].title.search(searchRegExp)!=-1) results.push(tids[t]);
}
if (co.chkSearchShadows)
for (var t in config.shadowTiddlers) {
if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue;
if ((t.search(searchRegExp)!=-1) && !store.tiddlerExists(t))
results.push((new Tiddler()).assign(t,config.shadowTiddlers[t]));
}
}
// then scan for matching text, tags, or field data
for(var t=0; t<tids.length; t++) {
if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue;
if (co.chkSearchText && tids[t].text.search(searchRegExp)!=-1)
results.pushUnique(tids[t]);
if (co.chkSearchTags && tids[t].tags.join(" ").search(searchRegExp)!=-1)
results.pushUnique(tids[t]);
if (co.chkSearchFields && store.forEachField!=undefined)
store.forEachField(tids[t],
function(tid,field,val) {
if (val.search(searchRegExp)!=-1) results.pushUnique(tids[t]);
},
true); // extended fields only
}
// then check for matching text in shadows
if (co.chkSearchShadows)
for (var t in config.shadowTiddlers) {
if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue;
if ((config.shadowTiddlers[t].search(searchRegExp)!=-1) && !store.tiddlerExists(t))
results.pushUnique((new Tiddler()).assign(t,config.shadowTiddlers[t]));
}
// if not 'titles first', or sorting by modification date,
// re-sort results to so titles, text, tag and field matches are mixed together
if(!sortField) sortField = "title";
var bySortField=function(a,b){
if(a[sortField]==b[sortField])return(0);else return(a[sortField]<b[sortField])?-1:+1;
}
if (!co.chkSearchTitlesFirst || co.chkSearchByDate) results.sort(bySortField);
return results;
}
//}}}
// // HIJACK core {{{<<search>>}}} macro to add "report" and "simple inline" output
//{{{
config.macros.search.SOP_handler=config.macros.search.handler;
config.macros.search.handler = function(place,macroName,params)
{
// if "report", use SearchOptionsPlugin report generator for inline output
if (params[1]&¶ms[1].substr(0,6)=="report") {
var keyword=params[0];
var options=params[1].split("=")[1]; // split "report=option+option+..."
var heading=params[2]?params[2].unescapeLineBreaks():"";
var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
if (matches.length) wikify(heading+window.formatSearchResults(keyword,matches,options),place);
} else if (params[1]) {
var keyword=params[0];
var heading=params[1]?params[1].unescapeLineBreaks():"";
var seperator=params[2]?params[2].unescapeLineBreaks():", ";
var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
if (matches.length) {
var out=[];
for (var m=0; m<matches.length; m++) out.push("[["+matches[m].title+"]]");
wikify(heading+out.join(seperator),place);
}
} else
config.macros.search.SOP_handler.apply(this,arguments);
};
//}}}
// // SearchResults panel handling
//{{{
setStylesheet(".searchResults { padding:1em 1em 0 1em; }","searchResults"); // matches std tiddler padding
config.macros.search.createPanel=function(text,matches,body) {
function getByClass(e,c) { var d=e.getElementsByTagName("div");
for (var i=0;i<d.length;i++) if (hasClass(d[i],c)) return d[i]; }
var panel=createTiddlyElement(null,"div","searchPanel","searchPanel");
this.renderPanel(panel,text,matches,body);
var oldpanel=document.getElementById("searchPanel");
if (!oldpanel) { // insert new panel just above tiddlers
var da=document.getElementById("displayArea");
da.insertBefore(panel,da.firstChild);
} else { // if panel exists
var oldwrap=getByClass(oldpanel,"searchResults");
var newwrap=getByClass(panel,"searchResults");
// if no prior content, just insert new content
if (!oldwrap) oldpanel.insertBefore(newwrap,null);
else { // swap search results content but leave containing panel intact
oldwrap.style.display='block'; // unfold wrapper if needed
var i=oldwrap.getElementsByTagName("input")[0]; // get input field
if (i) { var pos=this.getCursorPos(i); i.onblur=null; } // get cursor pos, ignore blur
oldpanel.replaceChild(newwrap,oldwrap);
panel=oldpanel; // use existing panel
}
}
this.showPanel(true,pos);
return panel;
}
config.macros.search.renderPanel=function(panel,text,matches,body) {
var wrap=createTiddlyElement(panel,"div",null,"searchResults");
wrap.onmouseover = function(e){ addClass(this,"selected"); }
wrap.onmouseout = function(e){ removeClass(this,"selected"); }
// create toolbar: "open all", "fold/unfold", "close"
var tb=createTiddlyElement(wrap,"div",null,"toolbar");
var b=createTiddlyButton(tb, "open all", "open all matching tiddlers", function() {
story.displayTiddlers(null,this.getAttribute("list").readBracketedList()); return false; },"button");
var list=""; for(var t=0;t<matches.length;t++) list+='[['+matches[t].title+']] ';
b.setAttribute("list",list);
var b=createTiddlyButton(tb, "fold", "toggle display of search results", function() {
config.macros.search.foldPanel(this); return false; },"button");
var b=createTiddlyButton(tb, "close", "dismiss search results", function() {
config.macros.search.showPanel(false); return false; },"button");
createTiddlyText(createTiddlyElement(wrap,"div",null,"title"),"Search for: "+text); // title
wikify(body,createTiddlyElement(wrap,"div",null,"viewer")); // report
return panel;
}
config.macros.search.showPanel=function(show,pos) {
var panel=document.getElementById("searchPanel");
var i=panel.getElementsByTagName("input")[0];
i.onfocus=show?function(){config.macros.search.stayFocused(true);}:null;
i.onblur=show?function(){config.macros.search.stayFocused(false);}:null;
if (show && panel.style.display=="block") { // if shown, grab focus, restore cursor
if (i&&this.stayFocused()) { i.focus(); this.setCursorPos(i,pos); }
return;
}
if(!config.options.chkAnimate) {
panel.style.display=show?"block":"none";
if (!show) { removeChildren(panel); config.macros.search.stayFocused(false); }
} else {
var s=new Slider(panel,show,false,show?"none":"children");
s.callback=function(e,p){e.style.overflow="visible";}
anim.startAnimating(s);
}
return panel;
}
config.macros.search.foldPanel=function(button) {
var d=document.getElementById("searchPanel").getElementsByTagName("div");
for (var i=0;i<d.length;i++) if (hasClass(d[i],"viewer")) var v=d[i]; if (!v) return;
var show=v.style.display=="none";
if(!config.options.chkAnimate)
v.style.display=show?"block":"none";
else {
var s=new Slider(v,show,false,"none");
s.callback=function(e,p){e.style.overflow="visible";}
anim.startAnimating(s);
}
button.innerHTML=show?"fold":"unfold";
return false;
}
config.macros.search.stayFocused=function(keep) { // TRUE/FALSE=set value, no args=get value
if (keep===undefined) return this.keepReportInFocus;
this.keepReportInFocus=keep;
return keep
}
config.macros.search.getCursorPos=function(i) {
var s=0; var e=0; if (!i) return { start:s, end:e };
try {
if (i.setSelectionRange) // FF
{ s=i.selectionStart; e=i.selectionEnd; }
if (document.selection && document.selection.createRange) { // IE
var r=document.selection.createRange().duplicate();
var len=r.text.length; s=0-r.moveStart('character',-100000); e=s+len;
}
}catch(e){};
return { start:s, end:e };
}
config.macros.search.setCursorPos=function(i,pos) {
if (!i||!pos) return; var s=pos.start; var e=pos.end;
if (i.setSelectionRange) //FF
i.setSelectionRange(s,e);
if (i.createTextRange) // IE
{ var r=i.createTextRange(); r.collapse(true); r.moveStart("character",s); r.select(); }
}
//}}}
// // SearchResults report generation
// note: these functions are defined globally, so they can be more easily redefined to customize report formats//
//{{{
if (!window.reportSearchResults) window.reportSearchResults=function(text,matches)
{
var cms=config.macros.search; // abbrev
var body=window.formatSearchResults(text,matches);
if (!config.options.chkSearchListTiddler) // show #searchResults panel
window.scrollTo(0,ensureVisible(cms.createPanel(text,matches,body)));
else { // write [[SearchResults]] tiddler
var title=cms.reportTitle;
var who=config.options.txtUserName;
var when=new Date();
var tags="excludeLists excludeSearch temporary";
var tid=store.getTiddler(title); if (!tid) tid=new Tiddler();
tid.set(title,body,who,when,tags);
store.addTiddler(tid);
story.closeTiddler(title);
story.displayTiddler(null,title);
}
}
if (!window.formatSearchResults) window.formatSearchResults=function(text,matches,opt)
{
var body='';
var title=config.macros.search.reportTitle
var q = config.options.chkRegExpSearch ? "/" : "'";
if (!opt) var opt="all";
var parts=opt.split("+");
for (var i=0; i<parts.length; i++) { var p=parts[i].toLowerCase();
if (p=="again"||p=="all") body+=window.formatSearchResults_again(text,matches);
if (p=="summary"||p=="all") body+=window.formatSearchResults_summary(text,matches);
if (p=="list"||p=="all") body+=window.formatSearchResults_list(text,matches);
if (p=="buttons"||p=="all") body+=window.formatSearchResults_buttons(text,matches);
}
return body;
}
if (!window.formatSearchResults_again) window.formatSearchResults_again=function(text,matches)
{
var title=config.macros.search.reportTitle
var body='';
// search again
body+='{{span{<<search "'+text.replace(/"/g,'"')+'">> /%\n';
body+='%/<html><input type="button" value="search again"';
body+=' onclick="var t=this.parentNode.parentNode.getElementsByTagName(\'input\')[0];';
body+=' config.macros.search.doSearch(t); return false;">';
body+=' <a href="javascript:;" onclick="';
body+=' var e=this.parentNode.nextSibling;';
body+=' var show=e.style.display!=\'block\';';
body+=' if(!config.options.chkAnimate) e.style.display=show?\'block\':\'none\';';
body+=' else anim.startAnimating(new Slider(e,show,false,\'none\'));';
body+=' return false;">options...</a>';
body+='</html>@@display:none;border-left:1px dotted;margin-left:1em;padding:0;padding-left:.5em;font-size:90%;/%\n';
body+=' %/<<option chkSearchTitles>>titles /%\n';
body+=' %/<<option chkSearchText>>text /%\n';
body+=' %/<<option chkSearchTags>>tags /%\n';
body+=' %/<<option chkSearchFields>>fields /%\n';
body+=' %/<<option chkSearchShadows>>shadows\n';
body+=' <<option chkCaseSensitiveSearch>>case-sensitive /%\n';
body+=' %/<<option chkRegExpSearch>>text patterns /%\n';
body+=' %/<<option chkSearchByDate>>sorted by date\n';
body+=' <<option chkSearchHighlight>> highlight matching text in displayed tiddlers\n';
body+=' <<option chkIncrementalSearch>>incremental key-by-key search: /%\n';
body+=' %/{{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, /%\n';
body+=' %/{{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay\n';
body+=' <<option chkSearchOpenTiddlers>> search only in tiddlers that are currently displayed\n';
body+=' <<option chkSearchExcludeTags>>exclude tiddlers tagged with:\n';
body+=' {{editor{<<option txtSearchExcludeTags>>}}}/%\n';
body+='%/@@}}}\n\n';
return body;
}
if (!window.formatSearchResults_summary) window.formatSearchResults_summary=function(text,matches)
{
// summary: nn tiddlers found matching '...', options used
var body='';
var co=config.options; // abbrev
var title=config.macros.search.reportTitle
var q = co.chkRegExpSearch ? "/" : "'";
body+="''"+config.macros.search.successMsg.format([matches.length,q+"{{{"+text+"}}}"+q])+"''\n";
var opts=[];
if (co.chkSearchTitles) opts.push("titles");
if (co.chkSearchText) opts.push("text");
if (co.chkSearchTags) opts.push("tags");
if (co.chkSearchFields) opts.push("fields");
if (co.chkSearchShadows) opts.push("shadows");
if (co.chkSearchOpenTiddlers) body+="^^//search limited to displayed tiddlers only//^^\n";
body+="~~ searched in "+opts.join(" + ")+"~~\n";
body+=(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"^^ using ":"")
+(co.chkCaseSensitiveSearch?"case-sensitive ":"")
+(co.chkRegExpSearch?"pattern ":"")
+(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"matching^^\n":"");
return body;
}
if (!window.formatSearchResults_list) window.formatSearchResults_list=function(text,matches)
{
// bullet list of links to matching tiddlers
var body='';
var pattern=co.chkRegExpSearch?text:text.escapeRegExp();
var sensitive=co.chkCaseSensitiveSearch?"mg":"img";
var link='{{tiddlyLinkExisting{<html><nowiki><a href="javascript:;" onclick="'
+'if(config.options.chkSearchHighlight)'
+' highlightHack=new RegExp(\x27'+pattern+'\x27,\x27'+sensitive+'\x27);'
+'story.displayTiddler(null,\x27%0\x27);'
+'highlightHack = null; return false;'
+'" title="%2">%1</a></html>}}}';
for(var t=0;t<matches.length;t++) {
body+="* ";
if (config.options.chkSearchByDate)
body+=matches[t].modified.formatString('YYYY.0MM.0DD 0hh:0mm')+" ";
var title=matches[t].title;
var fixup=title.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
var tid=store.getTiddler(title);
var tip=tid?tid.getSubtitle():''; tip=tip.replace(/"/g,""");
body+=link.format([fixup,title,tip])+'\n';
}
return body;
}
if (!window.formatSearchResults_buttons) window.formatSearchResults_buttons=function(text,matches)
{
// embed buttons only if writing SearchResults to tiddler
if (!config.options.chkSearchListTiddler) return "";
// "open all" button
var title=config.macros.search.reportTitle;
var body="";
body+="@@diplay:block;<html><input type=\"button\" href=\"javascript:;\" "
+"onclick=\"story.displayTiddlers(null,[";
for(var t=0;t<matches.length;t++)
body+="'"+matches[t].title.replace(/\'/mg,"\\'")+"'"+((t<matches.length-1)?", ":"");
body+="],1);\" accesskey=\"O\" value=\"open all matching tiddlers\"></html> ";
// "discard SearchResults" button
body+="<html><input type=\"button\" href=\"javascript:;\" "
+"onclick=\"discardSearchResults()\" value=\"discard "+title+"\"></html>";
body+="@@\n";
return body;
}
if (!window.discardSearchResults) window.discardSearchResults=function()
{
// remove the tiddler
story.closeTiddler(config.macros.search.reportTitle);
store.deleteTiddler(config.macros.search.reportTitle);
store.notify(config.macros.search.reportTitle,true);
}
//}}}
config.options.chkShowQuickEdit=true;
<<tiddler Version>><<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<tiddler TspotSidebar>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
en personlig web notesbog med mulighed for at skrive ligninger
@@font-size:0.75em;TW Ligninger@@
/***
|Name|SnapshotPlugin|
|Source|http://www.TiddlyTools.com/#SnapshotPlugin|
|Documentation|http://www.TiddlyTools.com/#SnapshotPluginInfo|
|Version|1.1.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|save or print HTML+CSS image of rendered document content|
|Status|ALPHA - DO NOT DISTRIBUTE|
This plugin provides a macro as well as tiddler toolbar commands to create a file or browser window containing the //rendered// CSS-and-HTML that is currently being displayed for selected elements of the current document.
!!!!!Documentation
>see [[SnapshotPluginInfo]]
!!!!!Configuration
<<<
<<option chkSnapshotHTMLOnly>> output HTML only (omit CSS)
<<<
!!!!!Revisions
<<<
2008.05.16 [1.1.1] added try..catch around addEvent/removeEvent calls to avoid error in Opera
2008.04.28 [1.1.0] removed 'viewerHTML' from 'ask' droplist and replaced with toggle for "output HTML only". Removed 'noCSS' parameter and replaced with config.options.chkSnapshotHTMLOnly global option. Added "select a tiddler..." to 'ask' droplist
2008.04.24 [1.0.1] in saveSnap(), convert output from Unicode to UTF before passing to saveFile(). Fixes "unknown name" error in IE's file.Write() function. Added viewerHTML to 'ask' droplist.
2008.04.21 [1.0.0] initial release - derived from [[NewDocumentPlugin]] with many improvements, including: "ask for ID" using droplist of available DOM elements, use "<base href=...>" for correctly resolving image references, wrap 'viewer only' output in class="tiddler viewer" for proper application of inherited CSS styles, snapshotSave and snapshotPrint tiddler toolbar command definitions, and more...
<<<
!!!!!Code
***/
//{{{
version.extensions.SnapshotPlugin= {major: 1, minor: 1, revision: 1, date: new Date(2008,5,16)};
if (config.options.chkSnapshotHTMLOnly===undefined) config.options.chkSnapshotHTMLOnly=false;
config.macros.snapshot = {
snapLabel: "save a snapshot",
printLabel: "print a snapshot",
snapPrompt: "save an HTML image of rendered content",
printPrompt: "print an HTML image of rendered content",
hereID: "here",
viewerID: "viewer",
storyID: "story",
allID: "all",
askID: "ask",
askTiddlerID: "askTiddler",
askDOMID: "askDOM",
askMsg: "select an element...",
hereItem: "tiddler: '%0'",
viewerItem: "tiddler: '%0' (content only)",
storyItem: "story column",
allItem: "entire document",
tiddlerItem: "select a tiddler...",
IDItem: "select a DOM element by ID...",
HTMLItem: "[%0] output HTML only (omit CSS)",
fileMsg: "select or enter a target path/filename",
defaultFilename: "snapshot.html",
okmsg: "snapshot written to %0",
failmsg: "An error occurred while creating %0",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var printing=params[0]&¶ms[0]=="print"; if (printing) params.shift();
params = paramString.parseParams("anon",null,true,false,false);
var id=getParam(params,"id","here");
var label=getParam(params,"label",printing?this.printLabel:this.snapLabel);
var prompt=getParam(params,"prompt",printing?this.printPrompt:this.snapPrompt);
var btn=createTiddlyButton(place,label,prompt, function(ev){
this.setAttribute("snapID",this.getAttribute("startID"));
config.macros.snapshot.go(this,ev)
});
btn.setAttribute("startID",id);
btn.setAttribute("snapID",id);
btn.setAttribute("printing",printing?"true":"false");
btn.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
},
go: function(here,ev) {
var cms=config.macros.snapshot; // abbreviation
var id=here.getAttribute("snapID");
var printing=here.getAttribute("printing")=="true";
var HTMLOnly=here.getAttribute("HTMLOnly")=="true";
if (id==cms.askID||id==cms.askTiddlerID||id==cms.askDOMID) {
cms.askForID(here,ev);
} else {
// get element
if (id==cms.storyID) id="tiddlerDisplay";
if (id==cms.allID) id="contentWrapper";
var snapElem=document.getElementById(id);
if (id==cms.hereID || id==cms.viewerID)
var snapElem=story.findContainingTiddler(here);
if (snapElem && hasClass(snapElem,"tiddler") && (id==cms.viewerID || HTMLOnly)) {
// find viewer class element within tiddler element
var nodes=snapElem.getElementsByTagName("*");
for (var i=0; i<nodes.length; i++)
if (hasClass(nodes[i],"viewer")) { snapElem=nodes[i]; break; }
}
if (!snapElem) // not in a tiddler or no viewer element or unknown ID
{ e.cancelBubble=true; if(e.stopPropagation)e.stopPropagation(); return(false); }
// write or print snapshot
var out=cms.getsnap(snapElem,id,printing,HTMLOnly);
if (printing) cms.printsnap(out); else cms.savesnap(out);
}
return false;
},
askForID: function(here,ev) {
var ev = ev ? ev : window.event;
var cms=config.macros.snapshot; // abbreviation
var id=here.getAttribute("snapID");
var indent='\xa0\xa0\xa0\xa0';
var p=Popup.create(here); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=here;
if (id==cms.askID) {
s.options[s.length]=new Option(cms.askMsg,cms.askID);
var tid=story.findContainingTiddler(here);
if(tid) {
var title=tid.getAttribute("tiddler");
if (here.getAttribute("HTMLOnly")!="true")
s.options[s.length]=new Option(indent+cms.hereItem.format([title]),cms.hereID);
s.options[s.length]=new Option(indent+cms.viewerItem.format([title]),cms.viewerID);
}
s.options[s.length]=new Option(indent+cms.tiddlerItem,cms.askTiddlerID);
s.options[s.length]=new Option(indent+cms.IDItem,cms.askDOMID);
s.options[s.length]=new Option(indent+cms.storyItem,"tiddlerDisplay");
s.options[s.length]=new Option(indent+cms.allItem,"contentWrapper");
}
if (id==cms.askDOMID) {
s.options[s.length]=new Option(cms.IDItem,cms.askDOMID);
var elems=document.getElementsByTagName("*");
var ids=[];
for (var i=0;i<elems.length;i++)
if (elems[i].id.length && elems[i].className!="animationContainer")
ids.push(elems[i].id);
ids.sort();
for (var i=0;i<ids.length;i++) s.options[s.length]=new Option(indent+ids[i],ids[i]);
}
if (id==cms.askTiddlerID) {
s.options[s.length]=new Option(cms.tiddlerItem,cms.askTiddlerID);
var elems=document.getElementsByTagName("div");
var ids=[];
for (var i=0;i<elems.length;i++) { var id=elems[i].id;
if (id.length && id.substr(0,story.idPrefix.length)==story.idPrefix && id!="tiddlerDisplay")
ids.push(id);
}
ids.sort();
for (var i=0;i<ids.length;i++) s.options[s.length]=new Option(indent+ids[i].substr(story.idPrefix.length),ids[i]);
}
s.options[s.length]=new Option(cms.HTMLItem.format([here.getAttribute("HTMLOnly")=="true"?"\u221a":"_"]),cms.HTMLItem);
s.onchange=function(ev){
var ev = ev ? ev : window.event;
var cms=config.macros.snapshot; // abbreviation
var here=this.button;
if (this.value==cms.HTMLItem) {
config.options.chkSnapshotHTMLOnly=!config.options.chkSnapshotHTMLOnly;
here.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
config.macros.option.propagateOption("chkSnapshotHTMLOnly","checked",
config.options.chkSnapshotHTMLOnly,"input");
} else
here.setAttribute("snapID",this.value);
config.macros.snapshot.go(here,ev);
return false;
};
Popup.show(p,false);
ev.cancelBubble=true;
if(ev.stopPropagation)ev.stopPropagation();
return false;
},
getpath: function() {
// get current path
var path=getLocalPath(window.location.href);
var slashpos=path.lastIndexOf("/");
if (slashpos==-1) slashpos=path.lastIndexOf("\\");
if (slashpos!=-1) path=path.substr(0,slashpos+1); // trim filename
return path;
},
getsnap: function(snapElem,id,printing,HTMLOnly) {
var cms=config.macros.snapshot; // abbreviation
var out="";
out+="<html><head>\n";
if (printing)
out+='<base href="file:///'+cms.getpath().replace(/\\/g,'/')+'"></base>\n';
if (!HTMLOnly) {
var styles=document.getElementsByTagName("style");
for(var i=0; i < styles.length; i++) {
out+="<style>\n";
out+="/* stylesheet="+styles[i].getAttribute("id")+" */\n";
out+=styles[i].innerHTML+"\n\n";
out+="</style>\n";
}
}
out+="</head><body>\n\n<div"+(id==cms.viewerID?" class='tiddler viewer'>":">");
out+=snapElem.innerHTML;
out+="</div>\n\n</body>\n";
out+="</html>";
return out;
},
printsnap: function(out) {
var win=window.open("","_blank","");
win.document.open();
win.document.writeln(out);
win.document.close();
win.focus(); // bring to front
win.print(); // trigger print dialog
},
savesnap: function(out) {
var cms=config.macros.snapshot; // abbreviation
// make sure we are local
if (window.location.protocol!="file:")
{ alert(config.messages.notFileUrlError); return; }
var target=cms.askForFilename(cms.fileMsg,cms.getpath(),cms.defaultFilename);
if (!target) return; // cancelled by user
// if specified file does not include a path, assemble fully qualified path and filename
var slashpos=target.lastIndexOf("/");
if (slashpos==-1) slashpos=target.lastIndexOf("\\");
if (slashpos==-1) target=target+cms.defaultFilename;
var link="file:///"+target.replace(/\\/g,'/'); // link for message text
var ok=saveFile(target,convertUnicodeToUTF8(out));
var msg=ok?cms.okmsg.format([target]):cms.failmsg.format([target]);
clearMessage(); displayMessage(msg,link);
},
askForFilename: function(msg,path,file) {
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='html';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP/Vista only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
s.FilterIndex=3; // default to HTML files;
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
}
};
//}}}
// // TOOLBAR DEFINITIONS
//{{{
config.commands.snapshotSave = {
text: "snap",
tooltip: config.macros.snapshot.snapPrompt,
handler: function(ev,src,title) {
src.setAttribute("snapID","ask");
src.setAttribute("printing","false");
src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
config.macros.snapshot.go(src,ev);
return false;
}
};
config.commands.snapshotPrint = {
text: "print",
tooltip: config.macros.snapshot.printPrompt,
handler: function(ev,src,title) {
src.setAttribute("snapID","ask");
src.setAttribute("printing","true");
src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
config.macros.snapshot.go(src,ev);
return false;
}
};
//}}}
// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
// if click is in a sticky popup, ignore it so popup will remain visible
var e = ev ? ev : window.event; var target = resolveTarget(e);
var p=target; while (p) {
if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
else p=p.parentNode;
}
if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
Popup.onDocumentClick(ev);
return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
.button {border: solid 0px;}
#tiddlerTWHelp-SearchResults .viewer {
overflow: auto;
}
.header {position:relative; height:40px;}
.header a:hover {background:transparent;}
.headerShadow {position: relative;padding: 0em 0em 0em 1em;left: 0px; top: 0px;}
.headerForeground {position:absolute;padding:0.0em 0em 1em 1em; left:0px; top:0px;}
.blueLink .button {color:#00f;font-size:.75em;}
.blueLinktext {color:#00f;font-weight:bold;}
.blueLinktextNormal {color:#00f;font-weight:normal;font-size:.75em;line-height:0.5em;}
[[TabsCSS]]
!!!StyleSheetTiddlersBar
#tiddlersBar .button {border:1px; color:#000;}
#tiddlersBar .tab {white-space:nowrap;}
#tiddlersBar {padding : 0.55em 0.5em 0.0em 1.0em;margin-left:0em;margin-right:0em}
#tiddlersBar {margin-bottom:0px;}
.tabSelected .button:hover {font-size:0.95em;font-weight:bold;color: #f00;background: #fff;padding : 0px 0px 0px 2px;}
.tabUnselected .button:hover {font-size:0.95em;color: #f00;background: #fff; padding : 0px 0px 0px 2px;}
.tabUnselected .button {font-size:0.95em;font-weight:bold;color: #008; padding : 0px 0px 0px 2px;}
.tabSelected .button {font-size:0.95em;font-weight:bold;color: #008;padding : 0px 0px 0px 2px;}
.tabUnselected {
background:url("http://img261.imageshack.us/img261/8603/navbargrayhw1.png") repeat-x top left;top left;
background-color:#eee;
border:0px #eee solid; border-bottom:0px;font-size:0.95em; }
.tabSelected {
background:url("http://img505.imageshack.us/img505/489/navbarredlt5.gif") repeat-x top left;top left;
background-color:#fcb;
color: #a00;border-top: 0px #c06 solid;border-bottom:0px; font-size:0.95em;}
.tabUnselected .tabButton {font-weight:bold;font-size:0.75em;color:#333;background:transparent; padding : 0px 2px 0px 2px; margin: 0 0 0 1px;}
.tabSelected .tabButton {font-weight:bold;font-size:0.75em;color:#000;background:transparent;padding : 0px 2px 0px 2px; margin: 0 0 0 1px;}
.tabSelected .tabButton:hover {font-weight:bold;color: #f00;background: #fff;}
.tabUnselected .tabButton:hover {font-weight:bold;color: #f00;background: #fff;}
.tiddler, .tabContents {border-top:0px #fa0 solid;margin-left:0.5em;margin-right:0.5em;}
#tiddlersBar .tab {-moz-border-radius : 0.4em 0.4em 0 0;}
#tiddlersBar {background:#000;line-height: 1.45em;}
#tiddlersBar {background: url("http://img80.imageshack.us/img80/7319/bluecheckedbgpk8.png"); background-repeat: repeat;line-height: 1.45em;border-top: 2px #00a solid;border-bottom:0px; }
@@font-size:1.2em;''TW Ligninger kan nu bruges med faneblade i ~TiddlyWiki''@@
@@color:#C06;font-size:1.5em;''» »'' @@ ''Klik her for at <html><a href='http://twligninger.tiddlyspot.com/download' class='button'>downloade</a></html> TW Ligninger''
''Indeholder QuickEditPlugin til wysiwyg redigering og en nem og hurtig '' måde at lave matematiske formler der kan bruges i ~TiddlyWikier v.h.a. [[CodeCogs Equation Editor|http://www.codecogs.com/components/equationeditor/equation_install.php]]
''Når en tiddler er sat i redigerings-modus, vil klik på '' {{makeborder{equation}}} i ~QuickEditToolbar åbne en ligningseditor hvor du kan konstruere matematiske formler. Når du er færdig med ligningen klikker du blot på {{makeborder{Copy to Document}}} i ligningseditoren for at indsætte ligningen i tiddleren ved markørposititionen.
''Når du skriver'' den tilhørende tekst til din ligningsside kan du vælge ''wysiwyg'' editoren for nemt at formatere din side. Når du er færdig med at lave din nye tiddler med tekst og ligninger mangler du blot at navngive tiddleren og klikke ''færdig''.
''Hvis du ønsker det'' kan du importere dine tiddlere til andre ~TiddlyWikier som selvstændige tiddlere.
@@color:#C06;font-size:1.5em;''»'' @@ ''Hvis du vil have en Html-side med dine ligninger.''
<<<
Du kan lave din side som en tiddler og konvertere den til en HTML side. Tag de tiddlere du vil publisere med: ''publish''. Klik på 'publish' i hovedmenuen til venstre. Din HTML sider vil blive publiseret i en mappe ved navn 'publish' på din harddisk i samme mappe hvor du har gemt denne TW.
<<<
''Note:'' ''Hvis du foretrækker __ikke at bruge faneblade__'' kan du genoprette den 'klassiske' ~TiddlyWiki opførsel ved at slå TiddlersBarPluginMG fra. Du skal blot ændre dens tag til systemXConfig (måske vil du skifte tilbage igen senere). Dette tillader at alle åbne tiddlere kan ses på een gang, med nyligt åbnede tiddlere øverst.
''Kommentarer og foreslag til ~TiddlyWiki'' [[Discussion Group|http://groups.google.com/group/TiddlyWiki/]]
<html><style>
#tiddlerMathEquations .viewer blockquote {border-left: 2px solid #c06;}
</style></html>
|>|bgcolor(#8af):@@color(#000080):''Der er fundet 10 tiddlere som matcher /{{{publish}}}/''@@|bgcolor(#8af): @@color(#A00000): SearchHelp@@ |
|>|>|bgcolor(#E3FFE3):<<search>> <<option chkSearchTitles>> Titles <<option chkSearchText>> Text <<option chkSearchTags>>Tags <<option chkHoldSearches>> Hold |
|bgcolor(#8af): |bgcolor(#8af): @@color(#000080):sort by: ''Titles''@@ |bgcolor(#8af): @@color(#000080): ''Size'' (bytes)@@ |bgcolor(#8af): @@color(#000080): ''Tags''@@ |h
| 1|[[PublishMacro]]| 9340|@@systemConfig@@|
| 2|[[PublishTemplateHead]]| 117|@@@@|
| 3|[[PublishTemplateBody]]| 175|@@@@|
| 4|[[PublishTemplateBodySingle]]| 76|@@@@|
| 5|[[PublishIndexTemplate]]| 171|@@@@|
| 6|[[TW Ligninger]]| 2108|@@Instructions,Note,publish@@|
| 7|[[MainMenu]]| 794|@@@@|
| 8|[[ImportedTiddlers]]| 1732|@@@@|
| 9|[[PublishTemplateBody]]| 175|@@@@|
| 10|[[PublishIndexTemplate]]| 171|@@@@|
#sidebarTabs .tabSelected {
background:url("navbarredlt5.gif") repeat-x top left;top left;
background-color:#fcb;
font-size:0.95em;
font-weight:bold;
color:#a00;
text-decoration:none;
border: 0px solid #999;
}
#sidebarTabs .tabUnselected {
background:url("navbargrayhw1.jpg") repeat-x top left;top left;
background-color:#eee;
font-size:0.95em;
font-weight:bold;
color:#008;
text-decoration:none;
border: 0px solid #999;
}
[img[http://latex.codecogs.com/gif.latex?2^{\frac{4}{8}}\sum]]
/***
|''Name:''|TiddlersBarPluginMG|
|''Description:''|A bar to switch between tiddlers through tabs (like browser tabs bar).|
|''Version:''|1.2.5|
|''Date:''|Jan 18,2008|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Modification
2008.09.06 - Morris Gray (Added http://tw.lewcid.org/#OpenTopPlugin code to this plugin to overcome jumping to the top when invoking any popup. Deleted the offending code)
!Demos
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], open several tiddlers to use the tabs bar.
!Installation
#import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
#save and reload
#''if you're using a custom [[PageTemplate]]'', add {{{<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>}}} before {{{<div id='tiddlerDisplay'></div>}}}
#optionally, adjust StyleSheetTiddlersBar
!Tips
*Doubleclick on the tiddlers bar (where there is no tab) create a new tiddler.
*Tabs include a button to close {{{x}}} or save {{{!}}} their tiddler.
*By default, click on the current tab close all others tiddlers.
!Configuration options
<<option chkDisableTabsBar>> Disable the tabs bar (to print, by example).
<<option chkHideTabsBarWhenSingleTab >> Automatically hide the tabs bar when only one tiddler is displayed.
<<option txtSelectedTiddlerTabButton>> ''selected'' tab command button.
<<option txtPreviousTabKey>> previous tab access key.
<<option txtNextTabKey>> next tab access key.
!Code
***/
//{{{
config.options.chkDisableTabsBar = config.options.chkDisableTabsBar ? config.options.chkDisableTabsBar : false;
config.options.chkHideTabsBarWhenSingleTab = config.options.chkHideTabsBarWhenSingleTab ? config.options.chkHideTabsBarWhenSingleTab : false;
config.options.txtSelectedTiddlerTabButton = config.options.txtSelectedTiddlerTabButton ? config.options.txtSelectedTiddlerTabButton : "do nothing";
config.options.txtPreviousTabKey = config.options.txtPreviousTabKey ? config.options.txtPreviousTabKey : "";
config.options.txtNextTabKey = config.options.txtNextTabKey ? config.options.txtNextTabKey : "";
config.macros.tiddlersBar = {
tooltip : "see ",
tooltipClose : "click here to close this tab",
tooltipSave : "click here to save this tab",
promptRename : "Enter tiddler new name",
currentTiddler : "",
previousState : false,
previousKey : config.options.txtPreviousTabKey,
nextKey : config.options.txtNextTabKey,
tabsAnimationSource : null, //use document.getElementById("tiddlerDisplay") if you need animation on tab switching.
handler: function(place,macroName,params) {
var previous = null;
if (config.macros.tiddlersBar.isShown())
story.forEachTiddler(function(title,e){
if (title==config.macros.tiddlersBar.currentTiddler){
var d = createTiddlyElement(null,"span",null,"tab tabSelected");
config.macros.tiddlersBar.createActiveTabButton(d,title);
if (previous && config.macros.tiddlersBar.previousKey) previous.setAttribute("accessKey",config.macros.tiddlersBar.nextKey);
previous = "active";
}
else {
var d = createTiddlyElement(place,"span",null,"tab tabUnselected");
var btn = createTiddlyButton(d,title,config.macros.tiddlersBar.tooltip + title,config.macros.tiddlersBar.onSelectTab);
btn.setAttribute("tiddler", title);
if (previous=="active" && config.macros.tiddlersBar.nextKey) btn.setAttribute("accessKey",config.macros.tiddlersBar.previousKey);
previous=btn;
}
var isDirty =story.isDirty(title);
var c = createTiddlyButton(d,isDirty ?"!":"x",isDirty?config.macros.tiddlersBar.tooltipSave:config.macros.tiddlersBar.tooltipClose, isDirty ? config.macros.tiddlersBar.onTabSave : config.macros.tiddlersBar.onTabClose,"tabButton");
c.setAttribute("tiddler", title);
if (place.childNodes) {
place.insertBefore(document.createTextNode(" "),place.firstChild); // to allow break line here when many tiddlers are open
place.insertBefore(d,place.firstChild);
}
else place.appendChild(d);
})
},
refresh: function(place,params){
removeChildren(place);
config.macros.tiddlersBar.handler(place,"tiddlersBar",params);
if (config.macros.tiddlersBar.previousState!=config.macros.tiddlersBar.isShown()) {
story.refreshAllTiddlers();
if (config.macros.tiddlersBar.previousState) story.forEachTiddler(function(t,e){e.style.display="";});
config.macros.tiddlersBar.previousState = !config.macros.tiddlersBar.previousState;
}
},
isShown : function(){
if (config.options.chkDisableTabsBar) return false;
if (!config.options.chkHideTabsBarWhenSingleTab) return true;
var cpt=0;
story.forEachTiddler(function(){cpt++});
return (cpt>1);
},
selectNextTab : function(){ //used when the current tab is closed (to select another tab)
var previous="";
story.forEachTiddler(function(title){
if (!config.macros.tiddlersBar.currentTiddler) {
story.displayTiddler(null,title);
return;
}
if (title==config.macros.tiddlersBar.currentTiddler) {
if (previous) {
story.displayTiddler(null,previous);
return;
}
else config.macros.tiddlersBar.currentTiddler=""; // so next tab will be selected
}
else previous=title;
});
},
onSelectTab : function(e){
var t = this.getAttribute("tiddler");
if (t) story.displayTiddler(null,t);
return false;
},
onTabClose : function(e){
var t = this.getAttribute("tiddler");
if (t) {
if(story.hasChanges(t) && !readOnly) {
if(!confirm(config.commands.cancelTiddler.warning.format([t])))
return false;
}
story.closeTiddler(t);
}
return false;
},
onTabSave : function(e) {
var t = this.getAttribute("tiddler");
if (!e) e=window.event;
if (t) config.commands.saveTiddler.handler(e,null,t);
return false;
},
onSelectedTabButtonClick : function(event,src,title) {
var t = this.getAttribute("tiddler");
if (!event) event=window.event;
if (t && config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton])
config.commands[config.options.txtSelectedTiddlerTabButton].handler(event, src, t);
return false;
},
onTiddlersBarAction: function(event) {
var source = event.target ? event.target.id : event.srcElement.id; // FF uses target and IE uses srcElement;
if (source=="tiddlersBar") story.displayTiddler(null,'New Tiddler',DEFAULT_EDIT_TEMPLATE,false,null,null);
},
createActiveTabButton : function(place,title) {
if (config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton]) {
var btn = createTiddlyButton(place, title, config.commands[config.options.txtSelectedTiddlerTabButton].tooltip ,config.macros.tiddlersBar.onSelectedTabButtonClick);
btn.setAttribute("tiddler", title);
}
else
createTiddlyText(place,title);
}
}
story.coreCloseTiddler = story.coreCloseTiddler? story.coreCloseTiddler : story.closeTiddler;
story.coreDisplayTiddler = story.coreDisplayTiddler ? story.coreDisplayTiddler : story.displayTiddler;
story.closeTiddler = function(title,animate,unused) {
if (title==config.macros.tiddlersBar.currentTiddler)
config.macros.tiddlersBar.selectNextTab();
story.coreCloseTiddler(title,false,unused); //disable animation to get it closed before calling tiddlersBar.refresh
var e=document.getElementById("tiddlersBar");
if (e) config.macros.tiddlersBar.refresh(e,null);
}
story.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle){
story.coreDisplayTiddler(config.macros.tiddlersBar.tabsAnimationSource,tiddler,template,animate,unused,customFields,toggle);
var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;
if (config.macros.tiddlersBar.isShown()) {
story.forEachTiddler(function(t,e){
if (t!=title) e.style.display="none";
else e.style.display="";
})
config.macros.tiddlersBar.currentTiddler=title;
}
var e=document.getElementById("tiddlersBar");
if (e) config.macros.tiddlersBar.refresh(e,null);
}
var coreRefreshPageTemplate = coreRefreshPageTemplate ? coreRefreshPageTemplate : refreshPageTemplate;
refreshPageTemplate = function(title) {
coreRefreshPageTemplate(title);
if (config.macros.tiddlersBar) config.macros.tiddlersBar.refresh(document.getElementById("tiddlersBar"));
}
ensureVisible=function (e) {return 0} //disable bottom scrolling (not useful now)
config.shadowTiddlers.StyleSheetTiddlersBar = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .button {border:0}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .tab {white-space:nowrap}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar {padding : 1em 0.5em 2px 0.5em}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tabUnselected .tabButton, .tabSelected .tabButton {padding : 0 2px 0 2px; margin: 0 0 0 4px;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tiddler, .tabContents {border:1px [[ColorPalette::TertiaryPale]] solid;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar +="/*}}}*/";
store.addNotification("StyleSheetTiddlersBar", refreshStyles);
config.refreshers.none = function(){return true;}
config.shadowTiddlers.PageTemplate=config.shadowTiddlers.PageTemplate.replace(/<div id='tiddlerDisplay'><\/div>/m,"<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>\n<div id='tiddlerDisplay'></div>");
//}}}
|~ViewToolbar|closeTiddler closeOthers +editTiddler editHtml newHere snapshotPrint > fields syncing permalink references jump|
|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|
<script>place.style.backgroundColor="#ccc"; /* set background color */ </script><html><hide linebreaks><div id="slantedmenu" style="font-size:1.05em;"><ul><li><<fullscreen>></li><li> <a href="javascript:void(0)" onclick="story.closeAllTiddlers();story.displayTiddlers(null,store.getTiddlerText('DefaultTiddlers').readBracketedList())"
><span title="Close all tiddlers and open Welcome" style="cursor:pointer">''Home''</span></a></li><li>[[Introduction|Introduction]]</li><li>[[Tutorial|Tutorial]]</li><li>[[TW Discussion Group|http://groups.google.com/group/TiddlyWiki/]]</li><li>[[CodeCogs Forums|http://www.codecogs.com/pages/forums/forum_view.php?f=28#comments]]</li><li><<tiddler GoTo>></li><li><<toggleSideBar>></li></ul></div></html>{{redLink textcenter{<<tiddler ShowUnsavedChanges>> }}}
/***
!!!SlantedStyle /%==================================================%/
***/
{{{
http://img261.imageshack.us/img261/8603/navbargrayhw1.png
http://img520.imageshack.us/img520/8688/mainmenugray7ef.gif
background-image: url("http://img264.imageshack.us/img264/4134/headbackbgdc6.png");background-repeat: repeat-x top-left;
}}}
/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */
{{{
#slantedmenu{
font-size: 90%;
position: fixed !important;
width: 100%;
z-index:1
}
}}}
#slantedmenu{
font-size: 90%;}
#slantedmenu:after{ /*Add margin between menu and rest of content in Firefox*/
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#slantedmenu ul{
text-indent: 10px;
padding: 3px 0;
margin: 0;
background:url("http://img261.imageshack.us/img261/8603/navbargrayhw1.png") repeat-x top left;top left;
/%background-color: #000; %/
border-top: 0px solid #f6f;
border-bottom: 0px solid #f6f;
text-align: center; /*set value to "center" for example to center items*/
}
#slantedmenu ul li{
display: inline;
}
#slantedmenu ul li a{
font-weight: normal;
color: #00a;
padding: 3px 0;
padding-right: 5px;
padding-left: 5px;
margin: 0;
text-decoration: none;
background: transparent url() top right no-repeat;
}
#slantedmenu ul li a:hover{
color: #f00;
background:#fff;
}
/***
Description: Contains the stuff you need to use Tiddlyspot
Note, you also need UploadPlugin, PasswordOptionPlugin and LoadRemoteFileThroughProxy
from http://tiddlywiki.bidix.info for a complete working Tiddlyspot site.
***/
//{{{
// edit this if you are migrating sites or retrofitting an existing TW
config.tiddlyspotSiteId = 'twligninger';
// make it so you can by default see edit controls via http
config.options.chkHttpReadOnly = false;
window.readOnly = false; // make sure of it (for tw 2.2)
window.showBackstage = true; // show backstage too
// disable autosave in d3
if (window.location.protocol != "file:")
config.options.chkGTDLazyAutoSave = false;
// tweak shadow tiddlers to add upload button, password entry box etc
with (config.shadowTiddlers) {
SiteUrl = 'http://'+config.tiddlyspotSiteId+'.tiddlyspot.com';
SideBarOptions = SideBarOptions.replace(/(<<saveChanges>>)/,"$1<<tiddler TspotSidebar>>");
OptionsPanel = OptionsPanel.replace(/^/,"<<tiddler TspotOptions>>");
DefaultTiddlers = DefaultTiddlers.replace(/^/,"[[WelcomeToTiddlyspot]] ");
MainMenu = MainMenu.replace(/^/,"[[WelcomeToTiddlyspot]] ");
}
// create some shadow tiddler content
merge(config.shadowTiddlers,{
'WelcomeToTiddlyspot':[
"This document is a ~TiddlyWiki from tiddlyspot.com. A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //What now?// @@ Before you can save any changes, you need to enter your password in the form below. Then configure privacy and other site settings at your [[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]] (your control panel username is //" + config.tiddlyspotSiteId + "//).",
"<<tiddler TspotControls>>",
"See also GettingStarted.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working online// @@ You can edit this ~TiddlyWiki right now, and save your changes using the \"save to web\" button in the column on the right.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// @@ A fully functioning copy of this ~TiddlyWiki can be saved onto your hard drive or USB stick. You can make changes and save them locally without being connected to the Internet. When you're ready to sync up again, just click \"upload\" and your ~TiddlyWiki will be saved back to tiddlyspot.com.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Help!// @@ Find out more about ~TiddlyWiki at [[TiddlyWiki.com|http://tiddlywiki.com]]. Also visit [[TiddlyWiki.org|http://tiddlywiki.org]] for documentation on learning and using ~TiddlyWiki. New users are especially welcome on the [[TiddlyWiki mailing list|http://groups.google.com/group/TiddlyWiki]], which is an excellent place to ask questions and get help. If you have a tiddlyspot related problem email [[tiddlyspot support|mailto:support@tiddlyspot.com]].",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy :)// @@ We hope you like using your tiddlyspot.com site. Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments or suggestions."
].join("\n"),
'TspotControls':[
"| tiddlyspot password:|<<option pasUploadPassword>>|",
"| site management:|<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">>//(requires tiddlyspot password)//<br>[[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]], [[download (go offline)|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download]]|",
"| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://faq.tiddlyspot.com/]], [[blog|http://tiddlyspot.blogspot.com/]], email [[support|mailto:support@tiddlyspot.com]] & [[feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|"
].join("\n"),
'TspotSidebar':[
"<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">><html><a href='http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download' class='button'>download</a></html>"
].join("\n"),
'TspotOptions':[
"tiddlyspot password:",
"<<option pasUploadPassword>>",
""
].join("\n")
});
//}}}
/***
|Name|TwHelpSearchPlugin|
|Source|http://twhelp.tiddlyspot.com/#TwHelpSearchPlugin|
|Documentation|http://twhelp.tiddlyspot.com/#TWHelpSearchDoc|
|Version|1.0.6|
|Author|Morris Gray|
|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.0 - 2.4|
|Type|plugin|
|Requires|[[SearchOptionsPlugin|http://www.TiddlyTools.com/#SearchOptionsPlugin]] [[TableSortingPlugin|http://tw.lewcid.org/#TableSortingPlugin]] (only for sorting option)|
|Overrides|SearchOptionsPlugin's search results|
|Description|Extends the search results from SearchOptionsPlugin to a sortable table showing title, size and tags.|
''Demo search:''
|>|>|>|<<search>> |
|>|>| look for in |>|>|>|
| <<option chkSearchTitles>> | <<option chkSearchText>> | <<option chkSearchTags>> | <<option chkHoldSearches>> |
| titles | text | tags | hold |
''A Plugin Tweak for:'' SearchOptionsPlugin
!!!!!Description
<<<
This plugin defines an alternative format for the SearchResults tiddler that is generated by the SearchOptionsPlugin . It presents the search results in tabular form numbering the rows; and showing the tiddler title, the size in bytes, and the tags. It is ready to be used with the [[TableSortingPlugin|http://tw.lewcid.org/#TableSortingPlugin]] (check versions) so any column can be sorted; such as size in ascending or descending order.
<<<
!!!!!Installation
<<<
Import (or copy/paste) the following tiddlers into your ~TiddlyWiki:
* http://twhelp.tiddlyspot.com/#TwHelpSearchPlugin
*SearchOptionsPlugin from http://www.tiddlytools.com/#SearchOptionsPlugin
* Get more documentation here [[TWHelpSearchDoc]] or here:
* http://twhelp.tiddlyspot.com/#TwHelpSearchDoc
<<<
!!!!!Revision History
<<<
''2008.09.14 [1.0.6]''
Cosmetic - Add header.
''2007.09.12 [1.0.6]''
Added overflow scroll to TWHelp-SearchResults for long titles or tags.
''2006.02.03 [1.0.5]''
Added facility for holding the results of multiple searches with tick box on dashboard.
''2006.02.02 [1.0.4]''
Added several options, cleaned up design.Planning one version basic and one with added options this is the added options version.
''2006.01.27 [1.0.3''
Added a column for the size of the text in each tiddler, this does not include the size of the title or tags. Added overall TW statistics button requires TiddlerStatsPlugin.
''2006.01.23 [1.0.2 ]''
''a)''Changed function reportSearchResults(text,matches) to window.reportSearchResults=function(text,matches)
''b)''Added a line so that Incremental Search is automatically disabled config.options.chkSearchIncremental=false; turn off key-by-key searching
''c)''Removed space inside parens. bgcolor(#fe8 )" to "bgcolor(#fe8)". This
is what was causing IE to 'crap out' halfway through drawing the table
headings.
''d)''Added {{{config.options.chkSearchList=true;}}}
''2006.01.20 [1.0.1]''
ELS: reportSearchResults() definition moved to this Plugin Tweak tiddler and removed extranous code
''2006.01.19 [1.0.0]''
This is an adaptation of Eric Shulman's SearchOptionsPlugin. Adapted by MorrisGray to provide search results in table form. All the necessary controls for refining the search is provided within the table including slide-down access to AdvancedOptions.
<<<
!!!!!Code
***/
//{{{
if (config.options.chkSinglePageMode==undefined) config.options.chkSinglePageMode=false;
if (config.options.chkRegExpSearch==undefined) config.options.chkRegExpSearch=true;
if (config.options.chkSearchTitles==undefined) config.options.chkSearchTitles=false;
if (config.options.chkSearchText==undefined) config.options.chkSearchText=true;
if (config.options.chkSearchTags==undefined) config.options.chkSearchTags=false;
if (config.options.chkSearchTitlesFirst==undefined) config.options.chkSearchTitlesFirst=true;
if (config.options.chkSearchList==undefined) config.options.chkSearchList=true;
if (config.options.chkSearchIncremental==undefined) config.options.chkSearchIncremental=false;
if (config.options.chkToggleLinks==true) config.options.chkToggleLinks=false;
if (config.options.chkHoldSearches==undefined) config.options.chkHoldSearches=false;
if (config.options.chkSortTags==undefined) config.options.chkSortTags=false;
config.options.chkToggleLinks=false;
config.options.chkSinglePageMode=false;
config.options.chkHoldSearches=false;
config.options.chkSearchIncremental=false;
config.options.chkHttpReadOnly = false;
config.options.chkRegExpSearch=true;
config.options.chkSearchList=true;
config.options.chkToggleLinks=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkHoldSearches>> Hold search results";
//}}}
//{{{
// Give the report a custom name
config.macros.search.reportTitle="TWHelp-SearchResults";
// Override default SearchOptionsPlugin formatting for SearchResults tiddler
window.reportSearchResults=function(text,matches)
{
var title=config.macros.search.reportTitle
config.macros.search.reportTitle;
var q = config.options.chkRegExpSearch ? "/" : "'";
if (!config.options.chkHoldSearches) body="";
body+="\n|>|bgcolor(#8af):@@color(#000080):''"+config.macros.search.successMsg.format([matches.length,q+"{{{"+text+"}}}"+q])+"''@@|bgcolor(#8af): @@color(#A00000): SearchHelp@@ "+"|"+"\n";
body+="|>|>|bgcolor(#E3FFE3):<<search>> <<option chkSearchTitles>> Titles <<option chkSearchText>> Text <<option chkSearchTags>>Tags <<option chkHoldSearches>> Hold |"+"\n";
body+="\n|bgcolor(#8af): |bgcolor(#8af): @@color(#000080):sort by: ''Titles''@@ |bgcolor(#8af): @@color(#000080): ''Size'' (bytes)@@ |bgcolor(#8af): @@color(#000080): ''Tags''@@ |h";
for(var t=0;t<matches.length;t++)
body+="\n"+"| "+(t+1)+"|[["+matches[t].title+"]]| "+matches[t].text.length+"|"+"@@"+matches[t].tags+"@@"+"|";
body+="\n";
// create/update the tiddler
var tiddler=store.getTiddler(title); if (!tiddler) tiddler=new Tiddler();
tiddler.set(title,body,config.options.txtUserName,(new Date()),"excludeLists excludeSearch killbookmark");
store.addTiddler(tiddler); story.closeTiddler(title);
// render tiddler
var oldprompt=config.macros.search.label;
config.macros.search.label="search again"; // use alternate "search again" label
story.displayTiddler(null,title,1); // force refresh
config.macros.search.label=oldprompt; // restore standard search label
}
//}}}
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 08/01/2009 15:04:09 | YourName | [[twequationClassic.html|file:///H:/twequationClassic.html]] | [[store.cgi|http://twequation.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twequation.tiddlyspot.com/index.html]] | . | ok |
| 09/01/2009 08:52:50 | YourName | [[twequation.html|file:///H:/twequation.html]] | [[store.cgi|http://twequation.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twequation.tiddlyspot.com/index.html]] | . | ok |
| 09/01/2009 09:07:00 | YourName | [[twequation.html|file:///H:/twequation.html]] | [[store.cgi|http://twequation.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twequation.tiddlyspot.com/index.html]] | . | ok |
| 09/01/2009 09:09:04 | YourName | [[twequation.html|file:///H:/twequation.html]] | [[store.cgi|http://twequation.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twequation.tiddlyspot.com/index.html]] | . | ok |
| 03/02/2009 09:13:32 | YourName | [[twequation.html|file:///F:/TiddlyWiki2.4/TWEquation/twequation.html]] | [[store.cgi|http://twequation.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twequation.tiddlyspot.com/index.html]] | . |
| 04/04/2009 16:30:09 | DitNavn | [[twequation.html|file:///C:/Documents%20and%20Settings/mama/Skrivebord/twequation.html]] | [[store.cgi|http://twligninger.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twligninger.tiddlyspot.com/index.html]] | . | ok |
| 04/04/2009 16:44:06 | DitNavn | [[twequation.html|file:///C:/Documents%20and%20Settings/mama/Skrivebord/twequation.html]] | [[store.cgi|http://twligninger.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twligninger.tiddlyspot.com/index.html]] | . | ok |
| 04/04/2009 18:46:13 | DitNavn | [[twequation.html|file:///C:/Documents%20and%20Settings/mama/Skrivebord/twequation.html]] | [[store.cgi|http://twligninger.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twligninger.tiddlyspot.com/index.html]] | . |
| 02/05/2009 17:21:19 | DitNavn | [[index.html|http://twligninger.tiddlyspot.com/index.html]] | [[store.cgi|http://twligninger.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twligninger.tiddlyspot.com/index.html]] | . | failed |
| 02/05/2009 17:22:28 | DitNavn | [[index.html|http://twligninger.tiddlyspot.com/index.html]] | [[store.cgi|http://twligninger.tiddlyspot.com/store.cgi]] | . | [[index.html | http://twligninger.tiddlyspot.com/index.html]] | . |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''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|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
major: 4, minor: 1, revision: 3,
date: new Date("Feb 24, 2008"),
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0'
};
//
// Environment
//
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false; // true to activate both in Plugin and UploadService
//
// Upload Macro
//
config.macros.upload = {
// default values
defaultBackupDir: '', //no backup
defaultStoreScript: "store.php",
defaultToFilename: "index.html",
defaultUploadDir: ".",
authenticateUser: true // UploadService Authenticate User
};
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.messages = {
noStoreUrl: "No store URL in parmeters or options",
usernameOrPasswordMissing: "Username or password missing"
};
config.macros.upload.handler = function(place,macroName,params) {
if (readOnly)
return;
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (params[0]) {
prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0],
(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
} else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};
config.macros.upload.action = function(params)
{
// for missing macro parameter set value from options
if (!params) params = {};
var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
var username = params[4] ? params[4] : config.options.txtUploadUserName;
var password = config.options.pasUploadPassword; // for security reason no password as macro parameter
// for still missing parameter set default value
if ((!storeUrl) && (document.location.toString().substr(0,4) == "http"))
storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
if (storeUrl.substr(0,4) != "http")
storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
if (!toFilename)
toFilename = bidix.basename(window.location.toString());
if (!toFilename)
toFilename = config.macros.upload.defaultToFilename;
if (!uploadDir)
uploadDir = config.macros.upload.defaultUploadDir;
if (!backupDir)
backupDir = config.macros.upload.defaultBackupDir;
// report error if still missing
if (!storeUrl) {
alert(config.macros.upload.messages.noStoreUrl);
clearMessage();
return false;
}
if (config.macros.upload.authenticateUser && (!username || !password)) {
alert(config.macros.upload.messages.usernameOrPasswordMissing);
clearMessage();
return false;
}
bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;
};
config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir)
{
if (!storeUrl)
return null;
var dest = bidix.dirname(storeUrl);
if (uploadDir && uploadDir != '.')
dest = dest + '/' + uploadDir;
dest = dest + '/' + toFilename;
return dest;
};
//
// uploadOptions Macro
//
config.macros.uploadOptions = {
handler: function(place,macroName,params) {
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
wizard.setValue("listWrapper",listWrapper);
this.refreshOptions(listWrapper,false);
var uploadCaption;
if (document.location.toString().substr(0,4) == "http")
uploadCaption = config.macros.upload.label.saveLabel;
else
uploadCaption = config.macros.upload.label.uploadLabel;
wizard.setButtons([
{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption,
onClick: config.macros.upload.action},
{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
]);
},
options: [
"txtUploadUserName",
"pasUploadPassword",
"txtUploadStoreUrl",
"txtUploadDir",
"txtUploadFilename",
"txtUploadBackupDir",
"chkUploadLog",
"txtUploadLogMaxLine"
],
refreshOptions: function(listWrapper) {
var opts = [];
for(i=0; i<this.options.length; i++) {
var opt = {};
opts.push();
opt.option = "";
n = this.options[i];
opt.name = n;
opt.lowlight = !config.optionsDesc[n];
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
opts.push(opt);
}
var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
for(n=0; n<opts.length; n++) {
var type = opts[n].name.substr(0,3);
var h = config.macros.option.types[type];
if (h && h.create) {
h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
}
}
},
onCancel: function(e)
{
backstage.switchTab(null);
return false;
},
wizardTitle: "Upload with options",
step1Title: "These options are saved in cookies in your browser",
step1Html: "<input type='hidden' name='markList'></input><br>",
cancelButton: "Cancel",
cancelButtonPrompt: "Cancel prompt",
listViewTemplate: {
columns: [
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
};
//
// upload functions
//
if (!bidix.upload) bidix.upload = {};
if (!bidix.upload.messages) bidix.upload.messages = {
//from saving
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
backupSaved: "Backup saved",
backupFailed: "Failed to upload backup file",
rssSaved: "RSS feed uploaded",
rssFailed: "Failed to upload RSS feed file",
emptySaved: "Empty template uploaded",
emptyFailed: "Failed to upload empty template file",
mainSaved: "Main TiddlyWiki file uploaded",
mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
//specific upload
loadOriginalHttpPostError: "Can't get original file",
aboutToSaveOnHttpPost: 'About to upload on %0 ...',
storePhpNotFound: "The store script '%0' was not found."
};
bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
var callback = function(status,uploadParams,original,url,xhr) {
if (!status) {
displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
return;
}
if (bidix.debugMode)
alert(original.substr(0,500)+"\n...");
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
bidix.upload.uploadRss(uploadParams,original,posDiv);
};
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
// save on localdisk ?
if (document.location.toString().substr(0,4) == "file") {
var path = document.location.toString();
var localPath = getLocalPath(path);
saveChanges();
}
// get original
var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
var originalPath = document.location.toString();
// If url is a directory : add index.html
if (originalPath.charAt(originalPath.length-1) == "/")
originalPath = originalPath + "index.html";
var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
var log = new bidix.UploadLog();
log.startUpload(storeUrl, dest, uploadDir, backupDir);
displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
if (bidix.debugMode)
alert("about to execute Http - GET on "+originalPath);
var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
bidix.upload.uploadRss = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if(status) {
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
bidix.upload.uploadMain(params[0],params[1],params[2]);
} else {
displayMessage(bidix.upload.messages.rssFailed);
}
};
// do uploadRss
if(config.options.chkGenerateAnRssFeed) {
var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
var rssString = generateRss();
// no UnicodeToUTF8 conversion needed when location is "file" !!!
if (document.location.toString().substr(0,4) != "file")
rssString = convertUnicodeToUTF8(rssString);
bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
} else {
bidix.upload.uploadMain(uploadParams,original,posDiv);
}
};
bidix.upload.uploadMain = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
var log = new bidix.UploadLog();
if(status) {
// if backupDir specified
if ((params[3]) && (responseText.indexOf("backupfile:") > -1)) {
var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
}
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
store.setDirty(false);
log.endUpload("ok");
} else {
alert(bidix.upload.messages.mainFailed);
displayMessage(bidix.upload.messages.mainFailed);
log.endUpload("failed");
}
};
// do uploadMain
var revised = bidix.upload.updateOriginal(original,posDiv);
bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};
bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
var localCallback = function(status,params,responseText,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (xhr.status == 404)
alert(bidix.upload.messages.storePhpNotFound.format([url]));
if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
alert(responseText);
if (responseText.indexOf("Debug mode") >= 0 )
responseText = responseText.substring(responseText.indexOf("\n\n")+2);
} else if (responseText.charAt(0) != '0')
alert(responseText);
if (responseText.charAt(0) != '0')
status = null;
callback(status,params,responseText,url,xhr);
};
// do httpUpload
var boundary = "---------------------------"+"AaB03x";
var uploadFormName = "UploadPlugin";
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += uploadFormName +"\"\r\n\r\n";
sheader += "backupDir="+uploadParams[3] +
";user=" + uploadParams[4] +
";password=" + uploadParams[5] +
";uploaddir=" + uploadParams[2];
if (bidix.debugMode)
sheader += ";debug=1";
sheader += ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
sheader += "Content-Length: " + data.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
data = sheader + data + strailer;
if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
if (!posDiv)
posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
store.allTiddlersAsHtml() + "\n" +
original.substr(posDiv[1]);
var newSiteTitle = getPageTitle().htmlEncode();
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
return revised;
};
//
// UploadLog
//
// config.options.chkUploadLog :
// false : no logging
// true : logging
// config.options.txtUploadLogMaxLine :
// -1 : no limit
// 0 : no Log lines but UploadLog is still in place
// n : the last n lines are only kept
// NaN : no limit (-1)
bidix.UploadLog = function() {
if (!config.options.chkUploadLog)
return; // this.tiddler = null
this.tiddler = store.getTiddler("UploadLog");
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = "UploadLog";
this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
}
return this;
};
bidix.UploadLog.prototype.addText = function(text) {
if (!this.tiddler)
return;
// retrieve maxLine when we need it
var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
if (isNaN(maxLine))
maxLine = -1;
// add text
if (maxLine != 0)
this.tiddler.text = this.tiddler.text + text;
// Trunck to maxLine
if (maxLine >= 0) {
var textArray = this.tiddler.text.split('\n');
if (textArray.length > maxLine + 1)
textArray.splice(1,textArray.length-1-maxLine);
this.tiddler.text = textArray.join('\n');
}
// update tiddler fields
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
// refresh and notifiy for immediate update
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
};
bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
if (!this.tiddler)
return;
var now = new Date();
var text = "\n| ";
var filename = bidix.basename(document.location.toString());
if (!filename) filename = '/';
text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
text += config.options.txtUserName + " | ";
text += "[["+filename+"|"+location + "]] |";
text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
text += uploadDir + " | ";
text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
text += backupDir + " |";
this.addText(text);
};
bidix.UploadLog.prototype.endUpload = function(status) {
if (!this.tiddler)
return;
this.addText(" "+status+" |");
};
//
// Utilities
//
bidix.checkPlugin = function(plugin, major, minor, revision) {
var ext = version.extensions[plugin];
if (!
(ext &&
((ext.major > major) ||
((ext.major == major) && (ext.minor > minor)) ||
((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
// write error in PluginManager
if (pluginInfo)
pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
}
};
bidix.dirname = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
bidix.basename = function(filePath) {
if (!filePath)
return;
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);
};
bidix.initOption = function(name,value) {
if (!config.options[name])
config.options[name] = value;
};
//
// Initializations
//
// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);
// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");
//optionsDesc
merge(config.optionsDesc,{
txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
txtUploadUserName: "Upload Username",
pasUploadPassword: "Upload Password",
chkUploadLog: "do Logging in UploadLog (default: true)",
txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});
// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');
// Backstage
merge(config.tasks,{
uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");
//}}}
@@padding-left:0.7em;font-size:9px;color:#ccc;TW Ver:<<version>>@@
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'><span macro='newHere label:"Ny her"'></span></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='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
This document is a ~TiddlyWiki from tiddlyspot.com. A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.
.
@@font-weight:bold;font-size:1.3em;color:#444; //What now?// @@ Before you can save any changes, you need to enter your password in the form below. Then configure privacy and other site settings at your [[control panel|http://twequation.tiddlyspot.com/controlpanel]] (your control panel username is //twequation//).
<<tiddler TspotControls>>
See also GettingStarted.
@@font-weight:bold;font-size:1.3em;color:#444; //Working online// @@ You can edit this ~TiddlyWiki right now, and save your changes using the "save to web" button in the column on the right.
@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// @@ A fully functioning copy of this ~TiddlyWiki can be saved onto your hard drive or USB stick. You can make changes and save them locally without being connected to the Internet. When you're ready to sync up again, just click "upload" and your ~TiddlyWiki will be saved back to tiddlyspot.com.
@@font-weight:bold;font-size:1.3em;color:#444; //Help!// @@ Find out more about ~TiddlyWiki at [[TiddlyWiki.com|http://tiddlywiki.com]]. Also visit [[TiddlyWiki.org|http://tiddlywiki.org]] for documentation on learning and using ~TiddlyWiki. New users are especially welcome on the [[TiddlyWiki mailing list|http://groups.google.com/group/TiddlyWiki]], which is an excellent place to ask questions and get help. If you have a tiddlyspot related problem email [[tiddlyspot support|mailto:support@tiddlyspot.com]].
@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy :)// @@ We hope you like using your tiddlyspot.com site. Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments or suggestions.