jeawin-astro 3.0.52 → 3.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/author_info.astro +3 -1
- package/src/components/banner_swiper.astro +3 -1
- package/src/components/block.astro +3 -1
- package/src/components/choose_language.astro +3 -1
- package/src/components/filter_links.astro +3 -1
- package/src/components/form.astro +4 -0
- package/src/components/formitem/country.astro +3 -1
- package/src/components/friendlinks.astro +7 -1
- package/src/components/header/header3.astro +3 -1
- package/src/components/newsletter.astro +2 -2
- package/src/components/nodes_list.astro +3 -1
- package/src/components/prevnext.astro +3 -1
- package/src/components/prevnext_simple.astro +3 -1
- package/src/components/rel_nodes_list.astro +3 -1
- package/src/components/remote_image.astro +3 -1
- package/src/components/site_options.astro +3 -1
- package/src/components/smartmenus/smartmenus1.astro +3 -1
- package/src/components/smartmenus.astro +3 -1
- package/src/env.d.ts +2 -0
- package/src/layouts/Footer.astro +4 -0
- package/src/layouts/category.astro +3 -1
- package/src/layouts/channel.astro +3 -1
- package/src/layouts/page.astro +3 -1
- package/src/scripts/cms.d.ts +5 -1
- package/src/scripts/cms.js +12 -2
- package/src/scripts/util.d.ts +4 -0
- package/src/scripts/util.js +94 -1
package/package.json
CHANGED
|
@@ -15,11 +15,13 @@ interface Props {
|
|
|
15
15
|
node_id: any;
|
|
16
16
|
}
|
|
17
17
|
const { node_id } = Astro.props;
|
|
18
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
18
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
19
19
|
const jeawinapi = new JeawinApi({
|
|
20
20
|
apikey: jeawin_apikey,
|
|
21
21
|
api_domain: jeawin_api_domain,
|
|
22
22
|
api_path: jeawin_api_path,
|
|
23
|
+
sticky_top_height: sticky_top_height,
|
|
24
|
+
is_preview
|
|
23
25
|
});
|
|
24
26
|
let author_info_html = await jeawinapi.get_author_info({ node_id });
|
|
25
27
|
// console.log(author_info_html);
|
|
@@ -43,11 +43,13 @@ if(slide_class){
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, all_langs, base } = Astro.locals;
|
|
46
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview, all_langs, base } = Astro.locals;
|
|
47
47
|
const jeawinapi = new JeawinApi({
|
|
48
48
|
apikey: jeawin_apikey,
|
|
49
49
|
api_domain: jeawin_api_domain,
|
|
50
50
|
api_path: jeawin_api_path,
|
|
51
|
+
sticky_top_height: sticky_top_height,
|
|
52
|
+
is_preview
|
|
51
53
|
});
|
|
52
54
|
const banners = await jeawinapi.get_nodes({ channel_id: 5 });
|
|
53
55
|
// console.log(banners);
|
|
@@ -17,12 +17,14 @@ interface Props {
|
|
|
17
17
|
get_node_detail?: boolean;
|
|
18
18
|
}
|
|
19
19
|
const { block_id, site_id, get_node_detail = false } = Astro.props;
|
|
20
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
20
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
21
21
|
|
|
22
22
|
const jeawinapi = new JeawinApi({
|
|
23
23
|
apikey: jeawin_apikey,
|
|
24
24
|
api_domain: jeawin_api_domain,
|
|
25
25
|
api_path: jeawin_api_path,
|
|
26
|
+
sticky_top_height,
|
|
27
|
+
is_preview
|
|
26
28
|
});
|
|
27
29
|
const block = await jeawinapi.get_block({
|
|
28
30
|
block_id,
|
|
@@ -18,12 +18,14 @@ interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
const { canonical, render_type, handle_style_func } = Astro.props;
|
|
20
20
|
|
|
21
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
21
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
22
22
|
|
|
23
23
|
const jeawinapi = new JeawinApi({
|
|
24
24
|
apikey: jeawin_apikey,
|
|
25
25
|
api_domain: jeawin_api_domain,
|
|
26
26
|
api_path: jeawin_api_path,
|
|
27
|
+
is_preview,
|
|
28
|
+
sticky_top_height
|
|
27
29
|
});
|
|
28
30
|
|
|
29
31
|
let choose_language_html = await jeawinapi.get_choose_language({
|
|
@@ -22,12 +22,14 @@ const {
|
|
|
22
22
|
field_array,
|
|
23
23
|
max_width_screen = 'max-w-screen-2xl'
|
|
24
24
|
} = Astro.props;
|
|
25
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, base } = Astro.locals;
|
|
25
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview, base } = Astro.locals;
|
|
26
26
|
// console.log(field_array);
|
|
27
27
|
const jeawinapi = new JeawinApi({
|
|
28
28
|
apikey: jeawin_apikey,
|
|
29
29
|
api_domain: jeawin_api_domain,
|
|
30
30
|
api_path: jeawin_api_path,
|
|
31
|
+
sticky_top_height,
|
|
32
|
+
is_preview
|
|
31
33
|
});
|
|
32
34
|
const filter_links = await jeawinapi.get_filter_links({
|
|
33
35
|
channel_id: channel_id,
|
|
@@ -26,11 +26,15 @@ const {
|
|
|
26
26
|
jeawin_apikey,
|
|
27
27
|
jeawin_api_domain,
|
|
28
28
|
jeawin_api_path,
|
|
29
|
+
sticky_top_height,
|
|
30
|
+
is_preview
|
|
29
31
|
} = Astro.locals;
|
|
30
32
|
const jeawinapi = new JeawinApi({
|
|
31
33
|
apikey: jeawin_apikey,
|
|
32
34
|
api_domain: jeawin_api_domain,
|
|
33
35
|
api_path: jeawin_api_path,
|
|
36
|
+
sticky_top_height,
|
|
37
|
+
is_preview
|
|
34
38
|
});
|
|
35
39
|
const forminfo = await jeawinapi.get_form({ form_id });
|
|
36
40
|
// console.log(forminfo);
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
import JeawinApi from "../../scripts/cms.js";
|
|
12
12
|
import { render_lang, render_value } from "../../scripts/util.js";
|
|
13
13
|
const { field } = Astro.props;
|
|
14
|
-
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path } =
|
|
14
|
+
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } =
|
|
15
15
|
Astro.locals;
|
|
16
16
|
const jeawinapi = new JeawinApi({
|
|
17
17
|
apikey: jeawin_apikey,
|
|
18
18
|
api_domain: jeawin_api_domain,
|
|
19
19
|
api_path: jeawin_api_path,
|
|
20
|
+
sticky_top_height,
|
|
21
|
+
is_preview
|
|
20
22
|
});
|
|
21
23
|
const countrylist = await jeawinapi.get_country();
|
|
22
24
|
---
|
|
@@ -19,12 +19,18 @@ const {
|
|
|
19
19
|
jeawin_preview_domain,
|
|
20
20
|
jeawin_apikey,
|
|
21
21
|
jeawin_api_domain,
|
|
22
|
-
jeawin_api_path,
|
|
22
|
+
jeawin_api_path,
|
|
23
|
+
sticky_top_height,
|
|
24
|
+
is_preview,
|
|
25
|
+
base,
|
|
26
|
+
url_suffix
|
|
23
27
|
} = Astro.locals;
|
|
24
28
|
const jeawinapi = new JeawinApi({
|
|
25
29
|
apikey: jeawin_apikey,
|
|
26
30
|
api_domain: jeawin_api_domain,
|
|
27
31
|
api_path: jeawin_api_path,
|
|
32
|
+
sticky_top_height,
|
|
33
|
+
is_preview
|
|
28
34
|
});
|
|
29
35
|
|
|
30
36
|
const friendlinksLang = render_lang(all_langs, "friendlinks");
|
|
@@ -15,11 +15,13 @@ import { render_url } from "../../scripts/util.js";
|
|
|
15
15
|
|
|
16
16
|
const { seo_title, menu_root_link_id, menu_position, max_width_screen = 'max-w-screen-2xl' } = Astro.props;
|
|
17
17
|
|
|
18
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path,base, url_suffix } = Astro.locals;
|
|
18
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path,sticky_top_height, is_preview,base, url_suffix } = Astro.locals;
|
|
19
19
|
const jeawinapi = new JeawinApi({
|
|
20
20
|
apikey: jeawin_apikey,
|
|
21
21
|
api_domain: jeawin_api_domain,
|
|
22
22
|
api_path: jeawin_api_path,
|
|
23
|
+
sticky_top_height,
|
|
24
|
+
is_preview
|
|
23
25
|
});
|
|
24
26
|
const menus = await jeawinapi.get_menus({
|
|
25
27
|
menu_id: 3, // 顶部菜单
|
|
@@ -12,7 +12,7 @@ import { render_value, render_lang } from "../scripts/util.js";
|
|
|
12
12
|
import Input from "./formitem/input.astro";
|
|
13
13
|
const { btn_class, siteinfo, jeawin_form_api_domain, all_langs } = Astro.locals;
|
|
14
14
|
|
|
15
|
-
const {other_btn_class} = Astro.props;
|
|
15
|
+
const {other_btn_class, max_width = 'max-w-md'} = Astro.props;
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
<form
|
|
@@ -24,7 +24,7 @@ const {other_btn_class} = Astro.props;
|
|
|
24
24
|
<input type="hidden" name="site_id" value={siteinfo.id} />
|
|
25
25
|
<input type="hidden" name="captchaId" id="captchaIdSubscribe" value="" />
|
|
26
26
|
<input type="hidden" name="captcha_code" id="captchaCodeSubscribe" value="" />
|
|
27
|
-
<div class=
|
|
27
|
+
<div class:list={max_width}>
|
|
28
28
|
<div class="flex flex-wrap gap-2 -mx-2">
|
|
29
29
|
<div class="px-2 grow-[9999] basis-64">
|
|
30
30
|
<Input
|
|
@@ -24,11 +24,13 @@ const {
|
|
|
24
24
|
field_array,
|
|
25
25
|
ids,
|
|
26
26
|
} = Astro.props;
|
|
27
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
27
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, is_preview, sticky_top_height } = Astro.locals;
|
|
28
28
|
const jeawinapi = new JeawinApi({
|
|
29
29
|
apikey: jeawin_apikey,
|
|
30
30
|
api_domain: jeawin_api_domain,
|
|
31
31
|
api_path: jeawin_api_path,
|
|
32
|
+
sticky_top_height,
|
|
33
|
+
is_preview
|
|
32
34
|
});
|
|
33
35
|
// console.log(channel_id);
|
|
34
36
|
// console.log(category_id);
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
import JeawinApi from "../scripts/cms.js";
|
|
12
12
|
import { render_url, render_value, render_lang } from "../scripts/util.js";
|
|
13
13
|
const { nodeinfo, node_id, channel_id, category_id } = Astro.props;
|
|
14
|
-
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path, base, url_suffix } =
|
|
14
|
+
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview, base, url_suffix } =
|
|
15
15
|
Astro.locals;
|
|
16
16
|
const jeawinapi = new JeawinApi({
|
|
17
17
|
apikey: jeawin_apikey,
|
|
18
18
|
api_domain: jeawin_api_domain,
|
|
19
19
|
api_path: jeawin_api_path,
|
|
20
|
+
sticky_top_height,
|
|
21
|
+
is_preview
|
|
20
22
|
});
|
|
21
23
|
const previousLang = render_lang(all_langs, "previous");
|
|
22
24
|
const nextLang = render_lang(all_langs, "next");
|
|
@@ -3,12 +3,14 @@ import { Icon } from "astro-icon/components";
|
|
|
3
3
|
import JeawinApi from "../scripts/cms.js";
|
|
4
4
|
import { render_url, render_value, render_lang } from "../scripts/util.js";
|
|
5
5
|
const { nodeinfo, node_id, channel_id, category_id } = Astro.props;
|
|
6
|
-
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path, base, url_suffix } =
|
|
6
|
+
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview, base, url_suffix } =
|
|
7
7
|
Astro.locals;
|
|
8
8
|
const jeawinapi = new JeawinApi({
|
|
9
9
|
apikey: jeawin_apikey,
|
|
10
10
|
api_domain: jeawin_api_domain,
|
|
11
11
|
api_path: jeawin_api_path,
|
|
12
|
+
sticky_top_height,
|
|
13
|
+
is_preview
|
|
12
14
|
});
|
|
13
15
|
const previousLang = render_lang(all_langs, "previous");
|
|
14
16
|
const nextLang = render_lang(all_langs, "next");
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
import JeawinApi from "../scripts/cms.js";
|
|
12
12
|
import Pagination from "./pagination.astro";
|
|
13
13
|
const { field_id, rel_id, uri, page, limit, no_fields } = Astro.props;
|
|
14
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
14
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
15
15
|
const jeawinapi = new JeawinApi({
|
|
16
16
|
apikey: jeawin_apikey,
|
|
17
17
|
api_domain: jeawin_api_domain,
|
|
18
18
|
api_path: jeawin_api_path,
|
|
19
|
+
sticky_top_height,
|
|
20
|
+
is_preview
|
|
19
21
|
});
|
|
20
22
|
// console.log(channel_id);
|
|
21
23
|
// console.log(category_id);
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import JeawinApi from "../scripts/cms.js";
|
|
12
12
|
const { remote_url, alt, class_str, is_lcp } = Astro.props;
|
|
13
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
13
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
14
14
|
const jeawinapi = new JeawinApi({
|
|
15
15
|
apikey: jeawin_apikey,
|
|
16
16
|
api_domain: jeawin_api_domain,
|
|
17
17
|
api_path: jeawin_api_path,
|
|
18
|
+
sticky_top_height,
|
|
19
|
+
is_preview
|
|
18
20
|
});
|
|
19
21
|
const html = await jeawinapi.get_theme_render_image({
|
|
20
22
|
image_url: remote_url,
|
|
@@ -12,11 +12,13 @@ import _ from "lodash";
|
|
|
12
12
|
import JeawinApi from "../scripts/cms.js";
|
|
13
13
|
import { render_value } from "../scripts/util.js";
|
|
14
14
|
const { option_name } = Astro.props;
|
|
15
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
15
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
16
16
|
const jeawinapi = new JeawinApi({
|
|
17
17
|
apikey: jeawin_apikey,
|
|
18
18
|
api_domain: jeawin_api_domain,
|
|
19
19
|
api_path: jeawin_api_path,
|
|
20
|
+
sticky_top_height,
|
|
21
|
+
is_preview
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
let option_value = "";
|
|
@@ -58,13 +58,15 @@ switch (menu_position) {
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const { siteinfo, jeawin_apikey, jeawin_api_domain, jeawin_api_path,base,url_suffix } =
|
|
61
|
+
const { siteinfo, jeawin_apikey, jeawin_api_domain, jeawin_api_path,sticky_top_height, is_preview,base,url_suffix } =
|
|
62
62
|
Astro.locals;
|
|
63
63
|
|
|
64
64
|
const jeawinapi = new JeawinApi({
|
|
65
65
|
apikey: jeawin_apikey,
|
|
66
66
|
api_domain: jeawin_api_domain,
|
|
67
67
|
api_path: jeawin_api_path,
|
|
68
|
+
sticky_top_height,
|
|
69
|
+
is_preview
|
|
68
70
|
});
|
|
69
71
|
const menus = await jeawinapi.get_menu_tree({ menu_id: 1 });
|
|
70
72
|
// _.set(menus, [1, "style"], "mega");
|
|
@@ -22,13 +22,15 @@ import SearchInput from "./search_input.astro";
|
|
|
22
22
|
import Logo from "./logo.astro";
|
|
23
23
|
|
|
24
24
|
const { menu_root_link_id, menu_position } = Astro.props;
|
|
25
|
-
const { siteinfo, jeawin_apikey, jeawin_api_domain, jeawin_api_path, base, url_suffix } =
|
|
25
|
+
const { siteinfo, jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview, base, url_suffix } =
|
|
26
26
|
Astro.locals;
|
|
27
27
|
|
|
28
28
|
const jeawinapi = new JeawinApi({
|
|
29
29
|
apikey: jeawin_apikey,
|
|
30
30
|
api_domain: jeawin_api_domain,
|
|
31
31
|
api_path: jeawin_api_path,
|
|
32
|
+
sticky_top_height,
|
|
33
|
+
is_preview
|
|
32
34
|
});
|
|
33
35
|
const menus = await jeawinapi.get_menu_tree({ menu_id: 1 });
|
|
34
36
|
|
package/src/env.d.ts
CHANGED
package/src/layouts/Footer.astro
CHANGED
|
@@ -36,11 +36,15 @@ const {
|
|
|
36
36
|
jeawin_apikey,
|
|
37
37
|
jeawin_api_domain,
|
|
38
38
|
jeawin_api_path,
|
|
39
|
+
sticky_top_height,
|
|
40
|
+
is_preview
|
|
39
41
|
} = Astro.locals;
|
|
40
42
|
const jeawinapi = new JeawinApi({
|
|
41
43
|
apikey: jeawin_apikey,
|
|
42
44
|
api_domain: jeawin_api_domain,
|
|
43
45
|
api_path: jeawin_api_path,
|
|
46
|
+
sticky_top_height,
|
|
47
|
+
is_preview
|
|
44
48
|
});
|
|
45
49
|
const menus = await jeawinapi.get_menus({
|
|
46
50
|
menu_id: 2,
|
|
@@ -14,7 +14,7 @@ import Footer from "./Footer.astro";
|
|
|
14
14
|
import InnerHeader from "./InnerHeader.astro";
|
|
15
15
|
import JeawinApi from "../scripts/cms.js";
|
|
16
16
|
import { render_value } from "../scripts/util.js";
|
|
17
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
17
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
18
18
|
const { dark_mode, category_id, page, page_type, url, uri, field_array, max_width_screen = 'max-w-screen-2xl' } =
|
|
19
19
|
Astro.props;
|
|
20
20
|
|
|
@@ -23,6 +23,8 @@ const jeawinapi = new JeawinApi({
|
|
|
23
23
|
apikey: jeawin_apikey,
|
|
24
24
|
api_domain: jeawin_api_domain,
|
|
25
25
|
api_path: jeawin_api_path,
|
|
26
|
+
sticky_top_height,
|
|
27
|
+
is_preview
|
|
26
28
|
});
|
|
27
29
|
const categoryinfo = await jeawinapi.get_category({
|
|
28
30
|
category_id: category_id,
|
|
@@ -16,11 +16,13 @@ import JeawinApi from "../scripts/cms.js";
|
|
|
16
16
|
import { render_value } from "../scripts/util.js";
|
|
17
17
|
const { dark_mode, channel_id, page, page_type, slug, url, uri, field_array, max_width_screen = 'max-w-screen-2xl' } =
|
|
18
18
|
Astro.props;
|
|
19
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
19
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
20
20
|
const jeawinapi = new JeawinApi({
|
|
21
21
|
apikey: jeawin_apikey,
|
|
22
22
|
api_domain: jeawin_api_domain,
|
|
23
23
|
api_path: jeawin_api_path,
|
|
24
|
+
sticky_top_height,
|
|
25
|
+
is_preview
|
|
24
26
|
});
|
|
25
27
|
// 栏目信息
|
|
26
28
|
const channelinfo = await jeawinapi.get_channel({
|
package/src/layouts/page.astro
CHANGED
|
@@ -26,11 +26,13 @@ const {
|
|
|
26
26
|
page,
|
|
27
27
|
max_width_screen = 'max-w-screen-2xl'
|
|
28
28
|
} = Astro.props;
|
|
29
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
29
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview } = Astro.locals;
|
|
30
30
|
const jeawinapi = new JeawinApi({
|
|
31
31
|
apikey: jeawin_apikey,
|
|
32
32
|
api_domain: jeawin_api_domain,
|
|
33
33
|
api_path: jeawin_api_path,
|
|
34
|
+
sticky_top_height,
|
|
35
|
+
is_preview
|
|
34
36
|
});
|
|
35
37
|
// 详情
|
|
36
38
|
const nodeinfo = await jeawinapi.get_node({
|
package/src/scripts/cms.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
export default class JeawinApi {
|
|
2
|
-
constructor({ apikey, api_domain, api_path }: {
|
|
2
|
+
constructor({ apikey, api_domain, api_path, is_preview, sticky_top_height }: {
|
|
3
3
|
apikey: any;
|
|
4
4
|
api_domain?: string;
|
|
5
5
|
api_path?: string;
|
|
6
|
+
is_preview?: number;
|
|
7
|
+
sticky_top_height?: number;
|
|
6
8
|
});
|
|
7
9
|
cachePath: string;
|
|
8
10
|
apikey: string;
|
|
9
11
|
api_domain: string;
|
|
10
12
|
api_path: string;
|
|
11
13
|
server_api_url: string;
|
|
14
|
+
is_preview: number;
|
|
15
|
+
sticky_top_height: number;
|
|
12
16
|
jeawinFetch(url: any, options: any): Promise<any>;
|
|
13
17
|
delete_cache(): Promise<void>;
|
|
14
18
|
/**
|
package/src/scripts/cms.js
CHANGED
|
@@ -65,7 +65,11 @@ export default class JeawinApi {
|
|
|
65
65
|
|
|
66
66
|
server_api_url = '';
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
is_preview = 0;
|
|
69
|
+
|
|
70
|
+
sticky_top_height = 100;
|
|
71
|
+
|
|
72
|
+
constructor({ apikey, api_domain = '', api_path = '', is_preview = 0, sticky_top_height = '100' }) {
|
|
69
73
|
this.apikey = apikey;
|
|
70
74
|
|
|
71
75
|
if (api_domain) {
|
|
@@ -75,10 +79,16 @@ export default class JeawinApi {
|
|
|
75
79
|
if (api_path) {
|
|
76
80
|
this.api_path = api_path;
|
|
77
81
|
}
|
|
82
|
+
|
|
83
|
+
this.is_preview = is_preview;
|
|
84
|
+
|
|
85
|
+
this.sticky_top_height = sticky_top_height;
|
|
78
86
|
|
|
79
|
-
this.server_api_url = `${this.api_domain}${this.api_path}&apikey=${this.apikey}`;
|
|
87
|
+
this.server_api_url = `${this.api_domain}${this.api_path}&apikey=${this.apikey}&is_preview=${this.is_preview}&sticky_top_height=${this.sticky_top_height}`;
|
|
80
88
|
|
|
81
89
|
this.cachePath = `.cache/site`;
|
|
90
|
+
|
|
91
|
+
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
async jeawinFetch(url, options) {
|
package/src/scripts/util.d.ts
CHANGED
package/src/scripts/util.js
CHANGED
|
@@ -354,4 +354,97 @@ export function without_toc(content){
|
|
|
354
354
|
$('script')?.remove();
|
|
355
355
|
$('.toc-anchor')?.remove();
|
|
356
356
|
return $.html();
|
|
357
|
-
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 显示视频栏目内容
|
|
361
|
+
*/
|
|
362
|
+
export function render_video_content(content, picurl, node_title){
|
|
363
|
+
|
|
364
|
+
let return_html = '';
|
|
365
|
+
|
|
366
|
+
const $ = cheerio.load(content);
|
|
367
|
+
|
|
368
|
+
const iframes = $('iframe');
|
|
369
|
+
|
|
370
|
+
let hasVideo = false;
|
|
371
|
+
|
|
372
|
+
iframes.each(function(i, elem){
|
|
373
|
+
const src = $(this).attr('src');
|
|
374
|
+
// console.log(src);
|
|
375
|
+
if(src.indexOf('youtube')!== -1 || src.indexOf('vimeo') !== -1){
|
|
376
|
+
// 是视频
|
|
377
|
+
hasVideo = true;
|
|
378
|
+
// 修改元素
|
|
379
|
+
$(this).wrap(`<div class="video-wrapper">
|
|
380
|
+
<img src="${picurl}" alt="${node_title}" class="video-poster">
|
|
381
|
+
<button class="play-button" type="button">▶</button>
|
|
382
|
+
<iframe src="" data-src="${src}"
|
|
383
|
+
allowfullscreen class="video-frame" title="${node_title}" width="100%" height="100%"></iframe>
|
|
384
|
+
</div>`);
|
|
385
|
+
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
return_html = $.html();
|
|
390
|
+
// console.log(return_html);
|
|
391
|
+
|
|
392
|
+
if(hasVideo){
|
|
393
|
+
// 包含视频
|
|
394
|
+
return_html += `<style>
|
|
395
|
+
.video-wrapper {
|
|
396
|
+
position: relative;
|
|
397
|
+
width: 100%;
|
|
398
|
+
max-width: 800px;
|
|
399
|
+
aspect-ratio: 16/9;
|
|
400
|
+
margin:0 auto;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.video-poster {
|
|
404
|
+
width: 100%;
|
|
405
|
+
height: 100%;
|
|
406
|
+
object-fit: contain;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.play-button {
|
|
410
|
+
position: absolute;
|
|
411
|
+
top: 50%;
|
|
412
|
+
left: 50%;
|
|
413
|
+
transform: translate(-50%, -50%);
|
|
414
|
+
width: 80px;
|
|
415
|
+
height: 80px;
|
|
416
|
+
border-radius: 50%;
|
|
417
|
+
background: rgba(255, 0, 0, 0.8);
|
|
418
|
+
border: none;
|
|
419
|
+
color: white;
|
|
420
|
+
font-size: 24px;
|
|
421
|
+
cursor: pointer;
|
|
422
|
+
z-index: 1;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.video-frame {
|
|
426
|
+
position: absolute;
|
|
427
|
+
width: 100%;
|
|
428
|
+
height: 100%;
|
|
429
|
+
top: 0;
|
|
430
|
+
left: 0;
|
|
431
|
+
display: none;
|
|
432
|
+
}
|
|
433
|
+
</style>
|
|
434
|
+
|
|
435
|
+
<script>
|
|
436
|
+
document.querySelector('.play-button').addEventListener('click', function() {
|
|
437
|
+
const wrapper = this.parentElement;
|
|
438
|
+
const iframe = wrapper.querySelector('.video-frame');
|
|
439
|
+
const poster = wrapper.querySelector('.video-poster');
|
|
440
|
+
|
|
441
|
+
iframe.src = iframe.dataset.src;
|
|
442
|
+
iframe.style.display = 'block';
|
|
443
|
+
poster.style.display = 'none';
|
|
444
|
+
this.style.display = 'none';
|
|
445
|
+
});
|
|
446
|
+
</script>`;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return return_html;
|
|
450
|
+
}
|