MCPcopy
hub / github.com/kanasimi/work_crawler / get_crawler

Function get_crawler

gui_electron/gui_electron_functions.js:2480–2529  ·  view source on GitHub ↗
(site_id, just_test)

Source from the content-addressed store, hash-verified

2478}
2479
2480function get_crawler(site_id, just_test) {
2481 site_id = site_id || site_used;
2482 // gettext_config:{"id":"please-specify-site-to-download-first"}
2483 var attention_message = '請先指定要下載的網站。';
2484 if (!site_id) {
2485 if (!just_test) {
2486 show_attention({
2487 b : {
2488 T : attention_message
2489 }
2490 }, attention_message);
2491 }
2492 return;
2493 }
2494 hide_attention_panel(attention_message);
2495
2496 var crawler = base_directory + site_id + '.js';
2497 CeL.debug({
2498 // gettext_config:{"id":"current-path-$1"}
2499 T : [ '當前路徑:%1', CeL.storage.working_directory() ]
2500 }, 1, 'get_crawler');
2501 CeL.debug({
2502 // gettext_config:{"id":"load-and-use-the-download-tool-$1"}
2503 T : [ '載入並使用下載工具 %1', crawler ]
2504 }, 1, 'get_crawler');
2505
2506 var old_site_used = site_used;
2507 // Will used in function prepare_crawler()
2508 site_used = site_id;
2509
2510 // include site script .js
2511 // 這個過程會執行 setup_crawler() @ work_crawler_loader.js
2512 // 以及 setup_crawler.prepare()
2513 crawler = require(crawler);
2514 crawler_loaded[site_id] = crawler;
2515 if (old_site_used !== site_used) {
2516 // recover
2517 site_used = old_site_used;
2518 } else {
2519 CeL.toggle_display('favorites_panel', true);
2520 CeL.toggle_display('download_options_panel', true);
2521 set_panel_height('favorites_panel');
2522 // gettext_config:{"id":"select-download-tool-$1"}
2523 process.title = _('選擇下載工具:%1', crawler.site_id);
2524 }
2525
2526 // assert: (site_id in download_site_nodes.link_of_site)
2527
2528 return crawler;
2529}
2530
2531// 一個 {Download_job} 只會配上一個作品。不同作品會用到不同的 {Download_job}。
2532function Download_job(crawler, work_id) {

Callers 14

setup_download_optionsFunction · 0.85
change_download_optionFunction · 0.85
click_download_optionFunction · 0.85
append_to_favoritesFunction · 0.85
get_favoritesFunction · 0.85
save_favoritesFunction · 0.85
reset_favoritesFunction · 0.85
reset_site_optionsFunction · 0.85
show_search_resultFunction · 0.85
search_work_titleFunction · 0.85

Calls 3

show_attentionFunction · 0.85
hide_attention_panelFunction · 0.85
set_panel_heightFunction · 0.85

Tested by

no test coverage detected