PageSourceSearch

https://www.venustreatments.com/lib/widgets/articles_more.js?v=2

js venustreatments.com collected 2026-09-26 04:51:28 UTC 6,441 bytes, 123 lines download raw bytes

1// V1.4
2"use strict";
3
4var articleMore = articleMore || {};
5
6$(document).ready(function(){
7
8	articleMore.count = 0;
9	articleMore.loading = false;
10	articleMore.selector = '.articlesmore';
11	articleMore.label =  articleMore.label || 'Load More';
12	articleMore.data = {'article_start':0,'article_limit':0};
13	articleMore.debug = articleMore.debug || false;
14	articleMore.autoscroll = articleMore.autoscroll || false;
15
16	if (articleMore.debug) {console.log("articleMore: ready()");}
17    
18    articleMore_init();
19});
20
21function articleMore_init() {
22	if (articleMore.debug) {console.log("articleMore: articleMore_init()");}
23	articleMore.obj = $(articleMore.selector);
24	if (articleMore.obj.length===1) {
25		if (!articleMore.obj.attr('data-limit')) {
26			articleMore.obj = articleMore.obj.find('> div');
27		}
28	}
29	if (articleMore.obj.length===1) {
30		if (articleMore.debug) {console.log("articleMore: loading");}
31        if (!articleMore.obj.attr('parsed')) {
32            articleMore.obj.attr('parsed',1);
33            articleMore.data.article_limit = parseInt(articleMore.obj.attr('data-limit'));
34            articleMore.data.article_start = parseInt(articleMore.obj.attr('data-start')) + articleMore.data.article_limit;
35            articleMore.count = parseInt(articleMore.obj.attr('data-count'));
36            if (articleMore.obj.attr('data-url')) {
37                articleMore.url = articleMore.obj.attr('data-url');
38            } else {
39                articleMore.url = "/redirect.cfm?eid=" + articleMore.obj.attr('data-guid');
40            }
41            if (articleMore.obj.attr('data-search')) { articleMore.data.article_search = decodeURI(articleMore.obj.attr('data-search'));}
42            if (articleMore.obj.attr('data-categoryids')) { articleMore.data.article_category_ids = articleMore.obj.attr('data-categoryids');}
43            if (articleMore.obj.attr('data-tagids')) { articleMore.data.article_tag_ids = articleMore.obj.attr('data-tagids');}
44            if (articleMore.obj.attr('data-roleids')) { articleMore.data.article_role_ids = articleMore.obj.attr('data-roleids');}
45            if (articleMore.obj.attr('data-sort')) { articleMore.data.article_sort = articleMore.obj.attr('data-sort');}
46
47            if (articleMore.debug) { console.log("articleMore: articleMore=",articleMore);}
48
49            if (typeof(article_item_setup)==="function") {
50                if (articleMore.debug) { console.log("articleMore: loaded ajx call function");}
51                article_item_setup(articleMore.obj.find('.article_item'));
52            }
53
54            if (articleMore.data.article_limit>0 && articleMore.data.article_start <= articleMore.count) {
55                if (articleMore.debug) {console.log("articleMore: add button");}
56
57                articleMore.obj.append("<button class='btn articlesmorebutton' data-url='"+articleMore.url+"'>"+articleMore.label+"</button>");
58
59                var am = articleMore.obj.find('.articlesmorebutton');
60
61                if (articleMore.debug) { console.log("articleMore: articleMore.data=",articleMore.data);}
62
63                am.click(function(){
64                    if (articleMore.debug) { console.log("articleMore: click");}
65                    if (!articleMore.loading) {
66                        if (articleMore.debug) { console.log("articleMore: load ajax");}
67                        articleMore.loading = true;
68                        am.addClass('loading');
69                        $.ajax({
70                            url: articleMore.url,
71                            data: articleMore.data,
72                            method: "get",
73                            datatype: 'text',
74                            cache: false,
75                            success: function (data) {
76                                if (articleMore.debug) { console.log("articleMore: loaded ajax");}
77                                //if (articleMore.debug) console.log("articleMore: data{"+typeof(data)+"}=",data);
78                                articleMore.data.article_start += articleMore.data.article_limit;
79                                if (articleMore.data.article_start > articleMore.count) { am.hide();}
80    //							articleMore.obj.append($("<div>"+data+"</div>").find(".articlesmore").html());
81                                articleMore.obj.find("article:last").after($("<div>"+data+"</div>").find(".articlesmore").html());
82                                if (typeof(article_item_setup)==="function") {
83                                    if (articleMore.debug) { console.log("articleMore: loaded ajx call function");}
84                                    article_item_setup(articleMore.obj.find('.article_item'));
85                                }
86                                am.removeClass('loading');
87                                if (articleMore.data.article_start > articleMore.count) {
88                                    am.hide();
89                                } else {
90                                    articleMore.loading = false;
91                                    $(window).trigger("scroll");
92                                }
93                                if (articleMore.debug) { console.log("articleMore: articleMore.data=",articleMore.data);}
94                            }
95                        });
96                    }
97                });
98
99                if (articleMore.autoscroll) {
100
101                    $(window).scroll(function() {
102                        if ($(window).width()>653) { // disable for mobile
103                            var top_of_element = am.offset().top;
104                            var bottom_of_element = top_of_element + am.outerHeight();
105                            var top_of_screen = $(window).scrollTop();
106                            var bottom_of_screen = top_of_screen + $(window).height();
107                            if (articleMore.debug) { console.log("articleMore.scroll: w=",$(window).width());}
108                            //console.log(top_of_element,bottom_of_element,top_of_screen,bottom_of_screen);
109                            if (articleMore.autoscroll && top_of_element<bottom_of_screen && bottom_of_element > top_of_screen){
110                                am.trigger("click");
111                            }
112                        }
113                    });
114
115                    setTimeout(function(){
116                        $(window).trigger("scroll");
117                    },1000);			
118                }
119
120            }
121        }
122	} 
123}

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.