# pmore

> A BBS Pmore system written in JavaScript.

Latest version **0.1.1** (published 2016-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install pmore
pnpm add pmore
yarn add pmore
bun add pmore
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-04-30 |
| First published | 2016-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | eight04 |
| Maintainers | eight04 |

## Links

- npm: https://www.npmjs.com/package/pmore
- Repository: https://github.com/eight04/pmore-js
- Homepage: https://github.com/eight04/pmore-js#readme
- Issues: https://github.com/eight04/pmore-js/issues
- npm.io page: https://npm.io/package/pmore

## Recent versions

- 0.1.1 (latest) — 2016-04-30
- 0.1.0 — 2016-04-29

## README

Pmore-js
========

A BBS Pmore system written in JavaScript.

Features
--------

* Parse pmore statements and run it.

Install
-------

	npm install --save pmore
	
Usage
-----

```js
var Pmore = require("pmore");

// A list of frames and the viewer service. See follow.
var pmore = Pmore(frames, myViewer);

// Transfer key event to pmore
window.addEventListener("keypress", function(event) {
	var key = event.key;
	// Map special key into "@x" form. See `inputOption.key` in `viewer.inputStart`
	if (key in specialMap) {
		key = specialMap[key];;
	}
	pmore.trigger(key);
});

// Start the animation
pmore.start();
```
	
### Frame

```js
var frame = {
	line: 0,	// The line number of the ^L tag.
	control: "^L..."	// ^L definition. This will be parsed into a control
						// object after sending to pmore
};
```
	
### Viewer

Viewer is a service used by pmore. Implement it with following interface:

```js
var viewer = {
	
	scrollTo: function(frame) {
		/* Scroll to the frame.
		
		The viewer should show the next line of ^L tag, i.e. the 
		`frame.line + 1` line.
		*/
	},
	
	scrollToLine: function(line) {
		/* Scroll to specified line. Return false when out of index */
	},
	
	getPageSize: function() {
		/* Return how many lines in one page. Integer. */
	}
	
	pause: function() {
		/* Display the pause message */
	},
	
	unpause: function() {
		/* Remove the pause message */
	},
	
	forceEnd: function() {
		/* This will be called when pmore is forced ended.

		That is, q key or any key that is not kept.
		*/
	}
	
	end: function() {
		/* This will be called when pmore stopped.

		It could be stopped by the user (after forceEnd) or met the ^LE tag.
		*/
	},
	
	inputStart: function(options) {
		/* Display a menu showing input options.
		
		`options` is a list of option object.
		
		The option object contains a `key` property and a `message` property.
		
		`option.key` is a printable character, or a 2 length string starting
		with "@". If it starts with "@", it represents a special key as follow:
		(case-sensitive)
		
		- @u UP
		- @d DOWN
		- @l LEFT
		- @r RIGHT
		- @b BACKSPACE
		- @H HOME
		- @E END
		- @P PAGEUP
		- @N PAGEDOWN
		- @I INSERT
		- @D DELETE
		- @a ANY KEY
		
		`option.key` is used to describe which key can trigger the function.
		
		`option.message` is the describtion of the option. String.
		*/
	},
	
	inputEnd: function() {
		/* Remove input menu */
	},
	
	inputSelect: function(i) {
		/* Select an option with index `i`.

		It is common to highlight the option.
		*/
	}
};
```

Pmore
-----

Pmore is a scriptable `more` system created by piaip.bbs@ptt.cc. The implementation follows these references:

* https://www.ptt.cc/bbs/BBSmovie/M.1197169523.A.F75.html
* https://www.ptt.cc/bbs/BBSmovie/M.1243129226.A.25D.html

Changelog
---------

* 0.1.1 (Apr 30, 2016)

	- Fix unpause bug.

* 0.1.0 (Apr 27, 2016)

    - First release.

---
_Source: https://npm.io/package/pmore · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
