Add storyviews list filter and use it in view switcher

print-window-tiddler
Jermolene 2014-03-24 22:17:45 +00:00
rodzic 26fd460670
commit 20f6383528
3 zmienionych plików z 35 dodań i 3 usunięć

Wyświetl plik

@ -0,0 +1,29 @@
/*\
title: $:/core/modules/filters/storyviews.js
type: application/javascript
module-type: filteroperator
Filter operator for returning the names of the story views in this wiki
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.storyviews = function(source,operator,options) {
var results = [],
storyviews = {};
$tw.modules.applyMethods("storyview",storyviews);
$tw.utils.each(storyviews,function(info,name) {
results.push(name);
});
results.sort();
return results;
};
})();

Wyświetl plik

@ -3,7 +3,7 @@ title: $:/snippets/viewswitcher
\define lingo-base() $:/language/ControlPanel/Appearance/StoryView/
<<lingo Prompt>> {{$:/view}}
<$linkcatcher to="$:/view"><$list filter="classic zoomin pop"><div><$reveal state="$:/view" type="match" text={{!!title}}>&bull;</$reveal><$reveal state="$:/view" type="nomatch" text={{!!title}}>&nbsp;</$reveal> <$link to={{!!title}}><$view field="title"/></$link>
<$linkcatcher to="$:/view"><$list filter="[storyviews[]]"><div><$reveal state="$:/view" type="match" text={{!!title}}>&bull;</$reveal><$reveal state="$:/view" type="nomatch" text={{!!title}}>&nbsp;</$reveal> <$link to={{!!title}}><$view field="title"/></$link>
</div>
</$list>
</$linkcatcher>

Wyświetl plik

@ -1,6 +1,7 @@
title: FilterOperators
created: 20140303091312363
modified: 20140303091312363
modified: 20140324221721972
title: FilterOperators
type: text/vnd.tiddlywiki
The available filter operators are listed here. See TiddlerFilters for an introduction to tiddler filters and how they are used.
@ -39,6 +40,8 @@ The available filter operators are listed here. See TiddlerFilters for an introd
* ''bl'': another synonym for ''butlast''
* ''nth'': selects the n-th tiddler of the list. Defaults to n = 1
* ''indexes'': selects the names of the indexes within a [[DataTiddler|DataTiddlers]]
* ''moduletypes'': selects the list of types of all the loaded modules
* ''storyviews'': selects the list of names of loaded storyviews
The operands available with the `is` operator are: