PageSourceSearch

https://shcm.gov.cn/js/news1.js

js shcm.gov.cn collected 2026-10-02 16:28:18 UTC 11,070 bytes, 323 lines download raw bytes

1/**!
2 * 新闻中心
3 * date:2021-01-12
4 * author: wppei;
5 */
6(function (win, $) {
7    // 国务院新闻和崇明要闻右侧多行省略
8    $('.dot').dotdotdot({
9        wrap: 'letter'
10    });
11    // 国务院新闻右侧点击
12    $('.new-gwy-dot').on('click', 'a', function (param) {
13        var _this = $(this);
14        FUtil.act(_this, function ($act) {
15            var index = _this.index(),
16                $uList = $('.new-gwy-list');
17            var scrollHeight = $('.new-gwy-list li:first').height();
18            //滚动出一个<li>的高度
19            $uList.stop().animate(
20                {
21                    marginTop: -scrollHeight * index
22                },
23                500
24            );
25        });
26    });
27    // 配置轮播配置项
28    function getOwlCarouselOption($dom, time, param) {
29        var option = $.extend(
30            {
31                loop: true,
32                items: 1,
33                nav: true,
34                rtl: false, //默认情况下旋转木马是从左向右移动,通过设置rtl:true可以使Owl改变方向从右向左移动
35                dots: true, //是否显示圆点导航
36                autoplay: true, //是否自动播放
37                autoplayHoverPause: true,
38                center: true,
39                autoplayTimeout: time, //自动播放间隔超时
40                responsiveClass: true, //是否是响应式轮播
41                mouseDrag: false, //pc端禁用拖动
42                //淡出动画
43                navText: [' ', ' '] //设置左右按钮文字
44            },
45            param
46        );
47        return $dom.owlCarousel(option);
48    }
49
50    // 新闻轮播
51    getOwlCarouselOption($('#newsCarousel'), 5000);
52
53 // 多图滚动
54//  $(".tabview").each(function(index, el) {
55//     $(this).Tab({
56//         hd: ".hdl",
57//         bd: ".bdl",
58//         target: "target",
59//         activeIndex: 0, //默认激活Tab索引
60//         event: "mouseover", //Tab激活方式 click,mouseover
61//         after: function(a, b) {
62          
63//         }
64//     });
65// });
66    // 崇明报多图滚动
67    // $('#ewb-imgscroll-other').owlCarousel({
68    //     loop: true,
69    //     margin: 25,
70    //     nav: true,
71    //     autoplay: false,
72    //     autoplayHoverPause: true,
73    //     autoplayTimeout: 1000, //自动播放间隔超时
74    //     navText: [' ', ' '], //设置左右按钮文字
75    //     responsive: {
76    //         0: {
77    //             items: 1
78    //         },
79    //         480: {
80    //             items: 1
81    //         },
82    //         768: {
83    //             items: 1
84    //         }
85    //     }
86    // });
87
88    // 视频新闻多图轮播
89    $('.video-carousel').owlCarousel({
90        loop: true,
91        margin: 25,
92        nav: true,
93        autoplay: false,
94        autoplayHoverPause: true,
95        autoplayTimeout: 1000, //自动播放间隔超时
96        navText: [' ', ' '], //设置左右按钮文字
97        responsive: {
98            0: {
99                items: 1
100            },
101            480: {
102                items: 2
103            },
104            768: {
105                items: 2,
106                dotsEach: 2
107            }
108        }
109    });
110
111    $('#video-other2').owlCarousel({
112        loop: true,
113        margin: 25,
114        nav: true,
115        autoplay: false,
116        autoplayHoverPause: true,
117        autoplayTimeout: 1000, //自动播放间隔超时
118        navText: [' ', ' '], //设置左右按钮文字
119        responsive: {
120            0: {
121                items: 1
122            },
123            480: {
124                items: 2
125            },
126            768: {
127                items: 2,
128                dotsEach: 2
129            }
130        }
131    });
132
133
134    $('body')
135        // 新增点击切换模块高亮
136        // .on('click', '.features-item', function () {
137        //     var $this = $(this);
138        //     $this.addClass('active').siblings().removeClass('active');
139        //     // 此处写重新渲染新闻列表函数
140        // })
141        .on('click', '.type-item', function () {
142            // var $this = $(this);
143            // $this.addClass('active').siblings().removeClass('active');
144            // 此处写重新渲染视频内容
145        });
146    $('#features-tab').Tab({
147        hd: '.features-item',
148        bd: '.features-news',
149        before: function ($hd, $bd) {},
150        after: function ($hd, $bd) {
151        //    console.log($hd.text().trim());
152            var title = $hd.text().trim();
153            if("新闻发布" == title){
154                $(".read-more").attr("href","/xwzx/002004/newSec.html");
155            }
156            if("综合信息" == title){
157                $(".read-more").attr("href","/xwzx/002003/newSec.html");
158            }
159            if("基层新闻" == title){
160                $(".read-more").attr("href","/xwzx/002013/newSec.html");
161            }
162            if("文明建设" == title){
163                $(".read-more").attr("href","/xwzx/002005/newSec.html");
164            }
165            if("便民提示" == title){
166                $(".read-more").attr("href","/xwzx/002009/newSec.html");
167            }
168            //console.log("222");
169        }
170    });
171
172    $('.convenient').Tab({
173        hd: '.type-item',
174        bd: '.owl-carousel',
175        before: function ($hd, $bd) {},
176        after: function ($hd, $bd) {
177          //  console.log($hd.text().trim());
178            var title = $hd.text().trim();
179            if("崇启海新闻资讯" == title){
180                $("#videomore").attr("href","/xwzx/002012/videoNews.html");
181            }
182            if("视频新闻" == title){
183                $("#videomore").attr("href","/xwzx/002006/videoNews.html");
184            }
185        }
186    });
187
188
189
190
191
192    //新闻中心-国务院信息
193    function getxwzxpushinfo($Id) {
194        webbuilder.getxwzxGwyNews(function(msg){
195            var html = Mustache.render($('#gwynews-template').html(), {"data":msg.splice(0,8)});
196            $Id.empty().html(html);
197        });
198    }
199
200     //新闻中心-崇明报
201     function getCmb($Id) {
202        webbuilder.getCmb(function(msg){
203            var arr = msg.result;
204            var html = Mustache.render($('#cmb-template').html(), {"data":arr});
205            $Id.empty().html(html);
206            //替换‘崇明报’标题的链接
207            console.log(arr[0].url);
208            $("#cmb-more").attr("href",arr[0].url);
209			//$("#cmb-more").attr("href","https://www.shcm.gov.cn/xwzx/002008/20220421/fe730e8b-e5d0-4912-88c7-07395885fccd.html");
210            $('#ewb-imgscroll-other').owlCarousel({
211                loop: true,
212                margin: 25,
213                nav: true,
214                autoplay: false,
215                autoplayHoverPause: true,
216                autoplayTimeout: 1000, //自动播放间隔超时
217                navText: [' ', ' '], //设置左右按钮文字
218                responsive: {
219                    0: {
220                        items: 1
221                    },
222                    480: {
223                        items: 1
224                    },
225                    768: {
226                        items: 1
227                    }
228                }
229            });
230        
231        });
232    }
233    
234
235    //渲染国务院新闻
236    getxwzxpushinfo($("#gwynews"));
237    //渲染崇明报 因为对方接口问题暂时注释
238    getCmb($("#ewb-imgscroll-other"));
239
240    //无障碍
241    //轮播图插件克隆的图片不读
242    $(".cloned > a").each(function (){
243        $(this).addClass("yx_not");
244        $(this).find("p").addClass("yx_not");
245        $(this).find("h3").addClass("yx_not");
246    })
247    //轮播图按钮不读
248    $(".owl-carousel").find("button").each(function (){
249        $(this).addClass("yx_not");
250    })
251    
252    //国务院新闻右侧点不被tab键聚焦
253    $(".new-gwy-dot >a").each(function(){
254        $(this).attr("tabindex","-1");
255    });
256
257    // tab时候跨页解决方法
258    // $(document).keyup(function(e) {
259    //     if (e.keyCode === 9) {
260    //         var $cur = $(e.currentTarget.activeElement);
261    //         if ($cur.hasClass('next')) {
262    //             $.fn.fullpage.moveSectionDown();
263    //         }
264
265    //         // 针对崇明要闻轮播区域
266    //         if ($cur.hasClass('news-star')) {
267    //             $("#newsCarousel").trigger('to.owl.carousel', 0);
268    //             $("#newsCarousel").trigger('stop.owl.autoplay');
269    //             $('.owl-dots',$("#newsCarousel")).remove();//此处为新增,去除轮播点
270    //         } else if ($cur.hasClass('news-end')) {
271    //             $("#newsCarousel").trigger('destroy.owl.carousel');
272    //             // 新闻轮播
273    //             getOwlCarouselOption($("#newsCarousel"), 5000);
274    //         }
275
276    //         // 针对崇明要闻轮播区域
277    //         if ($cur.hasClass('cmb-star')) {
278    //             $("#ewb-imgscroll-other").trigger('to.owl.carousel', 0);
279    //             $("#ewb-imgscroll-other").trigger('stop.owl.autoplay');
280    //         } else if ($cur.hasClass('cmb-end')) {
281    //             $("#ewb-imgscroll-other").trigger('destroy.owl.carousel');
282    //             //渲染崇明报
283    //             // 多图滚动
284    //             // $("#ewb-imgscroll-other").owlCarousel({
285    //             //     loop: true,
286    //             //     margin: 25,
287    //             //     nav: true,
288    //             //     dots: false,
289    //             //     autoplay: false,
290    //             //     autoplayHoverPause: true,
291    //             //     autoplayTimeout: 1000, //自动播放间隔超时
292    //             //     navText: [" ", " "], //设置左右按钮文字
293    //             //     responsive: {
294    //             //         0: {
295    //             //             items: 2,
296    //             //         },
297    //             //         480: {
298    //             //             items: 2,
299    //             //         },
300    //             //         768: {
301    //             //             items: 2,
302    //             //             dotsEach: 2,
303    //             //         },
304    //             //     },
305    //             // });
306    //         }
307    //     }
308    // }).keydown(function(e) {
309    //     var $cur = $(e.currentTarget.activeElement);
310    //     if($cur.hasClass('journal')){
311    //         $("#ewb-imgscroll-other").trigger('next.owl.carousel');
312    //     }
313    // });
314
315    // 新闻中心——视频新闻tab区域
316    tabChange({
317        content: '.video-tab',//需要做特殊处理的切换class,class需要是当前tab独有的,不然会出问题
318        initIndex: 0,//初始默认在哪个tab上
319        activate: 'mouseover'//根据所用tab切换采用的切换方式来传,click,mouseover
320    });
321
322    //tab切换改链接
323})(this, jQuery);

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.