You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
571 B
PHTML
32 lines
571 B
PHTML
6 years ago
|
<?php
|
||
|
class Hotkeys_Noscroll extends Plugin {
|
||
|
private $host;
|
||
|
|
||
|
function about() {
|
||
|
return array(1.0,
|
||
|
"n/p hotkeys move between articles without scrolling",
|
||
|
"fox");
|
||
|
}
|
||
|
|
||
|
function init($host) {
|
||
|
$this->host = $host;
|
||
|
|
||
|
$host->add_hook($host::HOOK_HOTKEY_MAP, $this);
|
||
|
}
|
||
|
|
||
|
function hook_hotkey_map($hotkeys) {
|
||
|
|
||
|
$hotkeys["(40)|down"] = "next_article_noscroll";
|
||
|
$hotkeys["(38)|up"] = "prev_article_noscroll";
|
||
|
$hotkeys["n"] = "next_article_noscroll";
|
||
|
$hotkeys["p"] = "prev_article_noscroll";
|
||
|
|
||
|
return $hotkeys;
|
||
|
}
|
||
|
|
||
|
function api_version() {
|
||
|
return 2;
|
||
|
}
|
||
|
|
||
|
}
|