mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-02 16:43:00 +00:00
Added new storyview that shows tiddlers stacked up sideways
This commit is contained in:
45
core/modules/macros/story/views/sideways.js
Normal file
45
core/modules/macros/story/views/sideways.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/*\
|
||||
title: $:/core/modules/macros/story/views/sideways.js
|
||||
type: application/javascript
|
||||
module-type: storyview
|
||||
|
||||
A storyview that shows a sequence of tiddlers as horizontally stacked blocks
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
function setStoryElementStyles(e) {
|
||||
e.style.display = "inline-block";
|
||||
e.style.width = "350px";
|
||||
e.style.verticalAlign = "top";
|
||||
e.style.whiteSpace = "normal";
|
||||
}
|
||||
|
||||
function SidewaysView(story) {
|
||||
this.story = story;
|
||||
var wrapper = this.story.child.children[1].domNode;
|
||||
// Scroll horizontally
|
||||
wrapper.style.whiteSpace = "nowrap";
|
||||
// Make all the tiddlers position absolute, and hide all but the first one
|
||||
for(var t=0; t<wrapper.children.length; t++) {
|
||||
setStoryElementStyles(wrapper.children[t]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Visualise navigation to the specified tiddler macro, optionally specifying a source node for the visualisation
|
||||
targetTiddlerNode: tree node of the tiddler macro we're navigating to
|
||||
isNew: true if the node we're navigating to has just been added to the DOM
|
||||
sourceNode: optional tree node that initiated the navigation
|
||||
*/
|
||||
SidewaysView.prototype.navigate = function(targetTiddlerNode,isNew,sourceEvent) {
|
||||
setStoryElementStyles(targetTiddlerNode.domNode);
|
||||
};
|
||||
|
||||
exports.sideways = SidewaysView;
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user