PageSourceSearch

https://neofeed.com.br/wp-content/themes/wp_neofeed/assets/js/utils/components/loadMore/loadMore.js

js neofeed.com.br collected 2026-10-02 02:16:03 UTC 2,344 bytes, 67 lines download raw bytes

1import request from "../../request/request.js";
2import { showHide } from "../../utils.js";
3import ui from "./ui.js"
4
5export default{
6    page:0,
7    adunit_prefix_desktop:'',
8    adunit_prefix_mobile:'',
9    adunit_index:'',
10    btnLoadMore:null,
11    loadGit:null,
12    start(){
13
14        this.btnLoadMore = document.getElementById("btncarregarMais");
15        this.loadGit = document.getElementById("n-loading");
16
17        if(this.btnLoadMore){
18
19            this.btnLoadMore.onclick = (e) => this.loadMore(e);
20        }
21    },
22    async loadMore(e){
23        const me = e.target;
24        const data = {
25            adunit_prefix_desktop:me.getAttribute("adunit_prefix_desktop"),
26            adunit_prefix_mobile:me.getAttribute("adunit_prefix_mobile"),
27            adunit_index:me.getAttribute("adunit_index"),
28            display_in:me.getAttribute("display_in"),
29            parameters:me.getAttribute("parameters"),
30            posts_to_exclude:me.getAttribute("posts_to_exclude"),
31            show_banners:me.getAttribute("show_banners"),
32        }
33
34        this.page = (parseInt(this.page) + 1);
35        this.adunit_index = (this.adunit_index != '') ? 
36        (parseInt(this.adunit_index) + 1) :  
37        (parseInt(data.adunit_index) + 1);
38
39        this.adunit_prefix_desktop = data.adunit_prefix_desktop.replace('[INDICE]', this.adunit_index);
40        this.adunit_prefix_mobile = data.adunit_prefix_mobile.replace('[INDICE]', this.adunit_index);
41
42        showHide(me,'none');
43        showHide(this.loadGit,'block');
44
45        const retorno = await this.getMorePosts(data);
46        await this.displayPosts(retorno,data.display_in,data.show_banners);
47
48        showHide(me,'inline');
49        showHide(this.loadGit,'none');
50    },
51    async getMorePosts(data){
52
53        const aditionalParam = (data.parameters != "") ? `&${data.parameters}` : '';
54
55        const url = `${request.defaultActionEndpoint}?page=${this.page}&posts_to_exclude=${data.posts_to_exclude}${aditionalParam}`;
56
57        return await request.get(url);
58    },
59    async displayPosts(data,display_in,show_banners){
60
61        if(data.length > 0){
62
63           await ui.displayNewPosts(data,display_in,show_banners,this.adunit_prefix_mobile,this.adunit_prefix_desktop);
64           lazyLoadImages();
65        }
66    }
67}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.