PageSourceSearch

https://www.mo-rentals.com/_js/jquery.sudy.wp.visitcount.js

js mo-rentals.com collected 2026-10-08 22:46:24 UTC 8,514 bytes, 241 lines download raw bytes

1/**
2 * 主要为了实现文章评价功能
3 * add by lcfeng
4 */
5$(document).ready(function() {
6
7    $.fn.WPVisitCount = function(options) {
8        var defaults = {};
9        var options = $.extend(defaults, options);
10        $(this).each(function() {
11            var url = $(this).attr("url");
12            if (url) {
13                initVisitCount(url, $(this));
14            }
15        });
16
17        //初始化访问次数
18        function initVisitCount(url, obj) {
19            $.ajax({
20                type: "post",
21                dataType: "text",
22                url: url,
23                success: function(result) {
24                    if (result !== '' && result !== '0' && result !== '<span>0</span>') {
25                        obj.html(result);
26                        obj.show();
27                    }
28                },
29                error: function(error) {
30                }
31            });
32        }
33    };
34
35    $.fn.WPColListVisitCount = function(options) {
36        var defaults = {};
37        var options = $.extend(defaults, options);
38        var colId = new Array();
39        var colIds = "";
40        $(this).each(function() {
41            var id = $(this).attr("colId");
42            var siteId = $(this).attr("siteId");
43            id += "_" + siteId;
44            colId.push(id);
45            colId = unique(colId);
46        });
47        colIds = colId.join(",");
48        if (colIds == "") {
49            return;
50        }
51        var url = "";
52        var con = $("script[sudy-wp-context]").attr("sudy-wp-context");
53        if (con) {
54            con = "/" + con;
55            url += con;
56        }
57//        url += "/_visitcountdisplay?columnIds=" + colIds;
58        url += "/_visitcountdisplay?funType=0";
59        var type = $("span[class=WP_ColsVisitCount]").attr("type");
60        if (type) {
61            url += "&type=" + type;
62        }
63//        url += "&funType=0";
64        initColListVisitCount(url, colIds);
65    };
66
67    function initColListVisitCount(url, colIds) {
68        $.ajax({
69            url: url,
70            dataType: 'json',
71            type: 'post',
72            data: {columnIds: colIds},
73            success: function(result) {
74                if (result !== '' && result !== null) {
75                    $.each(result, function(n, value) {
76                        var listVisitCount = $("span[colListVisitCountId=wp_colListVisitCount_" + value.columnId + "]");
77                        var oldCount = listVisitCount.html();
78                        var num = oldCount > value.count ? (oldCount - value.count) : (value.count - oldCount);
79                        var total = value.count + num;
80                        listVisitCount.html(total);
81                        listVisitCount.css('visibility', 'visible');
82                    });
83                }
84            }
85        });
86    }
87    ;
88
89    $.fn.WPArticleReadStatus = function(options) {
90        var defaults = {};
91        var options = $.extend(defaults, options);
92        var artId = new Array();
93        var articleIds = "";
94        $(this).each(function() {
95            var id = $(this).attr("artId");
96            artId.push(id);
97            artId = unique(artId);
98        });
99        articleIds = artId.join(",");
100        if (articleIds != null && articleIds != '') {
101            var url = "";
102            var con = $("script[sudy-wp-context]").attr("sudy-wp-context");
103            if (con) {
104                con = "/" + con;
105                url += con;
106            }
107            url += "/_visitcountdisplay?articleIds=" + articleIds;
108            var siteId = $("script[sudy-wp-siteId]").attr("sudy-wp-siteId");
109            if (siteId) {
110                url += "&siteId=" + siteId;
111            }
112            url += "&funType=1";
113            initReadStatus(url);
114        }
115    };
116
117    function unique(arr) {
118        var res = [];
119        var json = {};
120        for (var i = 0; i < arr.length; i++) {
121            if (!json[arr[i]]) {
122                res.push(arr[i]);
123                json[arr[i]] = 1;
124            }
125        }
126        return res;
127    }
128
129    function initReadStatus(url) {
130        $.ajax({
131            url: url,
132            dataType: 'text',
133            type: "post",
134            success: function(result) {
135                if (result !== "") {
136                    var artIds = result.split(",");
137                    for (var i = 0; i < artIds.length; i++) {
138                        $("span[readStatusId=wp_artReadStauts_" + artIds[i] + "]").addClass("wp_artReadStatus_unread");
139                    }
140                }
141            }
142        });
143    }
144    ;
145
146    $.fn.WPListVisitCount = function(options) {
147        var defaults = {};
148        var options = $.extend(defaults, options);
149        var artId = new Array();
150        var articleIds = "";
151        $(this).each(function() {
152            var id = $(this).attr("artId");
153            artId.push(id);
154            artId = unique(artId);
155        });
156        articleIds = artId.join(",");
157        if (articleIds != null && articleIds != '') {
158            var url = "";
159            var con = $("script[sudy-wp-context]").attr("sudy-wp-context");
160            if (con) {
161                con = "/" + con;
162                url += con;
163            }
164            url += "/_visitcountdisplay?articleIds=" + articleIds;
165            var siteId = $("script[sudy-wp-siteId]").attr("sudy-wp-siteId");
166            if (siteId) {
167                url += "&siteId=" + siteId;
168            }
169            var type = $("span[class=wp_listVisitCount]").attr("type");
170            if (type) {
171                url += "&type=" + type;
172            }
173            url += "&funType=0";
174            initListVisitCount(url);
175        }
176    };
177
178    function initListVisitCount(url) {
179        $.ajax({
180            url: url,
181            dataType: 'json',
182            type: 'post',
183            success: function(result) {
184                if (result !== '' && result !== null) {
185                    $.each(result, function(n, value) {
186                        var listVisitCount = $("span[listVisitCountId=wp_listVisitCount_" + value.articleId + "]");
187                        listVisitCount.html(value.count);
188                        listVisitCount.css('visibility', 'visible');
189                    });
190                }
191            }
192        });
193    };
194
195
196    if ($('.WP_VisitCount').hasClass('WP_VisitCount')) {
197        $('.WP_VisitCount').WPVisitCount();
198    }
199    if ($('.wp_artReadStatus').hasClass('wp_artReadStatus')) {
200        $('.wp_artReadStatus').WPArticleReadStatus();
201    }
202    if ($('.wp_listVisitCount').hasClass('wp_listVisitCount')) {
203        $('.wp_listVisitCount').WPListVisitCount();
204    }
205    if ($('.WP_ColsVisitCount').hasClass('WP_ColsVisitCount')) {
206        $('.WP_ColsVisitCount').WPColListVisitCount();
207    }
208    $(".search-submit").bind("click",function(){
209        let searchUrl = $(".wp-search").find("form").attr("action");
210        if (searchUrl.includes("&keyword=")) {
211            searchUrl = searchUrl.substring(0, searchUrl.indexOf("&keyword="));
212        }
213
214        $(".wp-search").find("form").attr("action", searchUrl+"&keyword="+$(".search-title").val());
215    });
216}); 
217    //$(".anniu").bind("click",function(){
218    //    let searchUrl = $(".yetou").find("form").attr("action");
219    //    if (searchUrl.includes("&keyword=")) {
220    //        searchUrl = searchUrl.substring(0, searchUrl.indexOf("&keyword="));
221    //    }
222
223    //    $(".yetou").find("form").attr("action", searchUrl+"&keyword="+$(".srk").val());
224    //});
225
226//下面这个根据ip获取地址的接口坏了,如果要使用,需要另找接口
227//$().ready(function() {
228//    $.ajax({
229//        type: 'get',
230//        dataType: 'jsonp',
231//        //url: "http://ip.chinaz.com/ajaxsync.aspx?at=ip&ip=" + ip, //这里是url
232//        url: "http://ip.chinaz.com/getip.aspx",//调用URL返回ip和来访地址 返回值{ip:'xxx.xxx.xxx.xxx',address:'江苏省南京市 电信'}
233//        success: function(data) {
234//            var address = data.address.replace("电信", "").replace("移动","").replace("联通","");//取出地址并且将里面的运营商去掉
235//            document.cookie = "ipAddressName=" + escape(address) + ";path=/; ";//将地址信息塞入cookie
236//        },
237//        error: function() {
238//       
239//        }
240//    });
241//})

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.