diff --git a/boot/boot.js b/boot/boot.js index 80032b4f5..9b742120c 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -267,8 +267,16 @@ $tw.utils.htmlDecode = function(s) { Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash) */ $tw.utils.getLocationHash = function() { - var parts = window.location.href.split('#'); - return "#" + (parts.length > 1 ? parts[1] : ""); + var href = window.location.href; + var idx = href.indexOf('#'); + if(idx === -1) { + return "#"; + } else if(idx < href.length-1 && href[idx+1] === '#') { + // Special case: ignore location hash if it itself starts with a # + return "#"; + } else { + return href.substring(idx); + } }; /* diff --git a/core/language/en-GB/Import.multids b/core/language/en-GB/Import.multids index 1b1c6f219..cc2c6c143 100644 --- a/core/language/en-GB/Import.multids +++ b/core/language/en-GB/Import.multids @@ -15,8 +15,9 @@ Listing/Preview/Diff: Diff Listing/Preview/DiffFields: Diff (Fields) Listing/Rename/Tooltip: Rename tiddler before importing Listing/Rename/Prompt: Rename to: -Listing/Rename/ConfirmRename : Rename tiddler -Listing/Rename/CancelRename : Cancel +Listing/Rename/ConfirmRename: Rename tiddler +Listing/Rename/CancelRename: Cancel +Listing/Rename/OverwriteWarning: A tiddler with this title already exists. Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <> being older than existing <>) Upgrader/Plugins/Upgraded: Upgraded plugin from <> to <> diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index bc1091910..61570f2af 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -64,7 +64,7 @@ OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team. PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect RecentChanges/DateFormat: DDth MMM YYYY -Shortcuts/Input/AdvancedSearch/Hint: Open the AdvancedSearch panel from within the sidebar search field +Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field Shortcuts/Input/Accept/Hint: Accept the selected item Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant) Shortcuts/Input/Cancel/Hint: Clear the input field @@ -72,6 +72,7 @@ Shortcuts/Input/Down/Hint: Select the next item Shortcuts/Input/Tab-Left/Hint: Select the previous Tab Shortcuts/Input/Tab-Right/Hint: Select the next Tab Shortcuts/Input/Up/Hint: Select the previous item +Shortcuts/SidebarLayout/Hint: Change the sidebar layout SystemTiddler/Tooltip: This is a system tiddler SystemTiddlers/Include/Prompt: Include system tiddlers TagManager/Colour/Heading: Colour diff --git a/core/modules/filterrunprefixes/intersection.js b/core/modules/filterrunprefixes/intersection.js new file mode 100644 index 000000000..2874125d4 --- /dev/null +++ b/core/modules/filterrunprefixes/intersection.js @@ -0,0 +1,30 @@ +/*\ +title: $:/core/modules/filterrunprefixes/intersection.js +type: application/javascript +module-type: filterrunprefix + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter prefix function +*/ +exports.intersection = function(operationSubFunction) { + return function(results,source,widget) { + if(results.length !== 0) { + var secondRunResults = operationSubFunction(source,widget); + var firstRunResults = results.splice(0); + $tw.utils.each(firstRunResults,function(title) { + if(secondRunResults.indexOf(title) !== -1) { + results.push(title); + } + }); + } + }; +}; + +})(); \ No newline at end of file diff --git a/core/modules/filters/strings.js b/core/modules/filters/strings.js index 625acd9a7..38620454c 100644 --- a/core/modules/filters/strings.js +++ b/core/modules/filters/strings.js @@ -56,14 +56,14 @@ exports.trim = function(source,operator,options) { return result; }; -// makeStringBinaryOperator( -// function(a) {return [$tw.utils.trim(a)];} -// ); - exports.split = makeStringBinaryOperator( function(a,b) {return ("" + a).split(b);} ); +exports["enlist-input"] = makeStringBinaryOperator( + function(a) {return $tw.utils.parseStringArray("" + a);} +); + exports.join = makeStringReducingOperator( function(accumulator,value,operand) { if(accumulator === null) { diff --git a/core/modules/widgets/list.js b/core/modules/widgets/list.js index f4981df33..786ce42a9 100755 --- a/core/modules/widgets/list.js +++ b/core/modules/widgets/list.js @@ -87,8 +87,14 @@ ListWidget.prototype.getTiddlerList = function() { }; ListWidget.prototype.getEmptyMessage = function() { - var emptyMessage = this.getAttribute("emptyMessage",""), - parser = this.wiki.parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true}); + var parser, + emptyMessage = this.getAttribute("emptyMessage",""); + // this.wiki.parseText() calls + // new Parser(..), which should only be done, if needed, because it's heavy! + if (emptyMessage === "") { + return []; + } + parser = this.wiki.parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true}); if(parser) { return parser.tree; } else { diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 80189f7a9..c158e6b38 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -378,10 +378,10 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is y = Number(b); if(isNumeric && (!isNaN(x) || !isNaN(y))) { return compareNumbers(x,y); - } else if(isAlphaNumeric) { - return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"}); } else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) { return isDescending ? b - a : a - b; + } else if(isAlphaNumeric) { + return isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: "base"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: "base"}); } else { a = String(a); b = String(b); diff --git a/core/ui/AdvancedSearch/Filter.tid b/core/ui/AdvancedSearch/Filter.tid index e55e9e03b..232994cc4 100644 --- a/core/ui/AdvancedSearch/Filter.tid +++ b/core/ui/AdvancedSearch/Filter.tid @@ -4,13 +4,23 @@ caption: {{$:/language/Search/Filter/Caption}} \define lingo-base() $:/language/Search/ \define set-next-input-tab(beforeafter:"after") <$macrocall $name="change-input-tab" stateTitle="$:/state/tab/advanced-search-results" tag="$:/tags/AdvancedSearch" beforeafter="$beforeafter$" defaultState="$:/core/ui/AdvancedSearch/System" actions="""<$action-setfield $tiddler="$:/state/advancedsearch/currentTab" text=<>/>"""/> -<$linkcatcher to="$:/temp/advancedsearch"> + +\define cancel-search-actions() <$list filter="[{$:/temp/advancedsearch/input}!match{$:/temp/advancedsearch}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]" />"""><$action-setfield $tiddler="$:/temp/advancedsearch/input" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> + +\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> + +\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> + <>