mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-13 08:44:03 +02:00
Add filter reset on location change.
This commit is contained in:
@@ -67,6 +67,11 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||||||
return new RegExp(sequence, 'i');
|
return new RegExp(sequence, 'i');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
reset = function () {
|
||||||
|
|
||||||
|
$input.val('').blur();
|
||||||
|
},
|
||||||
|
|
||||||
update = function (focus) {
|
update = function (focus) {
|
||||||
|
|
||||||
var val = $input.val();
|
var val = $input.val();
|
||||||
@@ -103,12 +108,12 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||||||
.on('keydown', function (event) {
|
.on('keydown', function (event) {
|
||||||
|
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
$input.val('').blur();
|
reset();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('keypress', updt);
|
.on('keypress', updt);
|
||||||
|
|
||||||
event.sub('location.changed', updf);
|
event.sub('location.changed', reset);
|
||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
@@ -82,6 +82,12 @@ class Api {
|
|||||||
$response["items"] = $this->app->get_items($url, $what);
|
$response["items"] = $this->app->get_items($url, $what);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (has_request_param("all_items")) {
|
||||||
|
|
||||||
|
use_request_param("all_items");
|
||||||
|
$response["all_items"] = $this->app->get_all_items();
|
||||||
|
}
|
||||||
|
|
||||||
if (count($_REQUEST)) {
|
if (count($_REQUEST)) {
|
||||||
$response["unused"] = $_REQUEST;
|
$response["unused"] = $_REQUEST;
|
||||||
}
|
}
|
||||||
|
@@ -187,6 +187,34 @@ class App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function get_all_item_content($item, &$cache) {
|
||||||
|
|
||||||
|
foreach ($item->get_content($cache) as $child) {
|
||||||
|
if ($child->is_folder) {
|
||||||
|
$this->get_all_item_content($child, $cache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_all_items() {
|
||||||
|
|
||||||
|
$cache = array();
|
||||||
|
$root = Item::get($this, ROOT_PATH, $cache);
|
||||||
|
|
||||||
|
$this->get_all_item_content($root, $cache);
|
||||||
|
|
||||||
|
uasort($cache, array("Item", "cmp"));
|
||||||
|
$result = array();
|
||||||
|
foreach ($cache as $p => $item) {
|
||||||
|
$result[] = $item->to_json_object();
|
||||||
|
}
|
||||||
|
|
||||||
|
@file_put_contents(CACHE_PATH . "/item.json", json_encode($result));
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_fallback() {
|
public function get_fallback() {
|
||||||
|
|
||||||
$cache = array();
|
$cache = array();
|
||||||
|
Reference in New Issue
Block a user