PageSourceSearch

http://www.bjmti.com/static/js/index.js?t=7

js bjmti.com collected 2026-10-07 08:15:06 UTC 17,734 bytes, 512 lines download raw bytes

1/**
2 * Created by jiangyang on 16/11/9.
3 */
4$(document).ready(function () {
5    search_width();
6    $('.module1').height($(window).width() * 0.41979167);
7    $('.module2,.module3').height($(window).width() * 0.23489583);
8    $('.module4,.module5').height($(window).width() * 0.18489583);
9    $('.banner-item').height($(window).width() * 0.33854167);
10    if ($(window).width() < 1100) {
11        $('.module1').height($(window).width() * 0.71979167);
12        $('.module2,.module3').height($(window).width() * 0.43489583);
13        $('.module4,.module5').height($(window).width() * 0.28489583);
14        // $('.banner-item').height($(window).width() * 0.53854167);
15        $('.btn-screening').on('click', function () {
16            $('.limit').slideToggle();
17            $(this).toggleClass('active');
18        });
19        $('.phone-flash').on('click', function () {
20            alert('手机不支持flash动画播放,请使用PC查看');
21            return false
22        })
23    }
24
25    $(window).resize(function () {
26        search_width();
27        $('.module1').height($(window).width() * 0.41979167);
28        $('.module2,.module3').height($(window).width() * 0.23489583);
29        $('.module4,.module5').height($(window).width() * 0.18489583);
30        // $('.banner-item').height($(window).width() * 0.33854167);
31        if ($(window).width() < 1100) {
32            $('.module1,.module2,.module3,.module4,.module5,.module6').css({'height': 'auto'})
33        }
34    });
35
36    var title_height = $('.dask').find('.title').outerHeight();
37    $('.dask').find('.title').css({
38        'top': -title_height + 'px'
39    });
40
41    $('.limit').find('li').on('click', function () {
42        $(this).addClass('active').siblings('li').removeClass('active')
43    });
44
45    $('.navbar-toggle').on('click', function () {
46        var navbar = $('.navbar-collapse');
47        !navbar.hasClass('open') ? navbar.slideDown().addClass('open') : navbar.slideUp().removeClass('open');
48    });
49
50    //flash-modal
51    $('.j_flash,.j_lesson').on('click', function () {
52        $('body').addClass('modal-open');
53        var flash_modal = $('#flash_modal');
54        var flash_sm = flash_modal.find('.j_img-sm');
55        var flash_bg = flash_modal.find('.j_flash-img');
56        var flash_data = [
57            "http://qiniu.bjmti.com/o_1b94utgbmq2v22q10po1nd8k769.swf",
58            "http://qiniu.bjmti.com/o_1b94uu6st1sgprjm1uqir5t1ft89.swf",
59            "http://ogf5mteml.bkt.clouddn.com/o_1b2sajgqm1uvu1dm01k1eap01jfh9.swf"
60        ]
61        flash_modal.show().removeClass('fadeOut').addClass('fadeIn');
62        flash_sm.on('click', function () {
63            $(this).addClass('active').siblings('.j_img-sm').removeClass('active');
64            var _index = $(this).index();
65            $(flash_bg).eq(_index).show(function() {
66                var api_url = $(this).attr('api')
67                $(this).addClass('active')
68                $(this).html(
69                    "<object type=" + "application/x-shockwave-flash data=" +api_url+ ' width=' + '100% height=' +'100%' +'>' +
70                    '<param name=' + 'movie' + 'value=' + api_url + '>' +
71                    '<param name=' + 'allowFullScreen' + 'value=' + 'true' + '>' +
72                    '<param name=' + 'FlashVars' + '>' +
73                    '</object>')
74                $(this).siblings('.j_flash-img').empty()
75            }).siblings('.j_flash-img').hide()
76        });
77        //animate轮播
78        var sm_wrap = flash_modal.find('.img-sm-wrap');
79        var sm_img = sm_wrap.children('.img-sm');
80        var flash_up = flash_modal.find('.flash-up');
81        var flash_down = flash_modal.find('.flash-down');
82        if (sm_wrap.children('.img-sm').length > 5) {
83            sm_wrap.css({
84                'margin-top': '19px'
85            });
86            sm_img.css({
87                'margin': '4px 0'
88            });
89            flash_up.show();
90            flash_down.show();
91            flash_down.addClass('active');
92            var click_num = 0;
93            var distance = sm_img.outerHeight() + 4;
94            flash_down.on('click', function () {
95                if (click_num > sm_img.length - 6) {
96                    click_num = -1;
97                }
98                click_num++;
99                sm_wrap.css({
100                    '-webkit-transform': 'translateY(-' + click_num * distance + 'px)',
101                    'transform': 'translateY(-' + click_num * distance + 'px)',
102                });
103                if (click_num !== 0) {
104                    flash_up.addClass('active');
105                } else {
106                    flash_up.removeClass('active');
107                }
108            });
109            flash_up.on('click', function () {
110                if (click_num == 0) {
111                    return false
112                }
113                click_num--;
114                sm_wrap.css({
115                    '-webkit-transform': 'translateY(-' + click_num * distance + 'px)',
116                    'transform': 'translateY(-' + click_num * distance + 'px)',
117                });
118                if (click_num == 0) {
119                    flash_up.removeClass('active')
120                }
121            })
122        }
123    });
124
125    function StopFlashMovie()
126    {
127        var flashMovie=getFlashMovieObject("simplemovie");
128        flashMovie.StopPlay();
129    }
130
131    $('.j_close-flash').on('click', function () {
132        $('body').removeClass('modal-open');
133        $('.flash').hide().removeClass('fadeIn').addClass('fadeOut');
134        $('.j_flash-img').empty();
135    });
136
137    //top-nav
138    $(window).scroll(function () {
139        var top = $('.top'),
140            top_nav = $('.top-nav'),
141            navbar = $('.navbar-nav .item > a'),
142            yheight = getScrollTop();   //获取距离顶部距离
143        if (yheight > top.outerHeight()) {
144            top_nav.addClass('top-nav-fixed');
145            navbar.addClass('top-padding').removeClass('top-padding-return');
146        } else {
147            top_nav.removeClass('top-nav-fixed');
148            navbar.addClass('top-padding-return').removeClass('top-padding');
149        }
150    });
151
152    //点击tab切换
153    $('.setStorage').on('click', function () {
154        var $index = $(this).index();
155        $(this).addClass('active').siblings('.setStorage').removeClass('active');
156        $('.change-tab').eq($index).show().siblings('.change-tab').hide();
157    });
158
159});
160
161function getScrollTop() {
162    var scrollPos;
163    if (window.pageYOffset) {
164        scrollPos = window.pageYOffset;
165    }
166    else if (document.compatMode && document.compatMode != 'BackCompat') {
167        scrollPos = document.documentElement.scrollTop;
168    }
169    else if (document.body) {
170        scrollPos = document.body.scrollTop;
171    }
172    return scrollPos;
173}
174
175function search_width() {
176    var btn = $('.pop');
177    var search = $('.j_search');
178    if ($(window).innerWidth() < 1200) {
179        $('.index-search').addClass('search-back').removeClass('search-width');
180    } else {
181        $('.index-search').removeClass('search-back').removeClass('search-return');
182    }
183    if (search.hasClass('search-back')) {
184        btn.show();
185        btn.on('click', function (event) {
186            event.stopPropagation();
187            btn.hide();
188            search.removeClass('search-return').addClass('search-width');
189            $(document).click(function () {
190                btn.show();
191                search.removeClass('search-width').addClass('search-return');
192            });
193            $('.icon-search').click(function (event) {
194                event.stopPropagation()
195            });
196            search.click(function (event) {
197                event.stopPropagation()
198            });
199            search.children('input').click(function (event) {
200                event.stopPropagation()
201            });
202        });
203    } else {
204        $('.pop').hide();
205    }
206}
207
208//modal 垂直居中
209function centerModals() {
210    $('.modal').each(function (i) {
211        var $clone = $(this).clone().css('display', 'block').appendTo('body');
212        var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);
213        top = top > 0 ? top : 0;
214        $clone.remove();
215        $(this).find('.modal-content').css("margin-top", top - 20);
216    });
217}
218$('.modal').on('show.bs.modal', centerModals);
219$(window).on('resize', centerModals);
220
221if (typeof jQuery === 'undefined') {
222    throw new Error('Bootstrap\'s JavaScript requires jQuery')
223}
224+function ($) {
225    var version = $.fn.jquery.split(' ')[0].split('.')
226    if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
227        throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
228    }
229}(jQuery);
230
231/* ========================================================================
232 * Bootstrap: modal.js v3.3.0
233 * http://getbootstrap.com/javascript/#modals
234 * ========================================================================
235 * Copyright 2011-2014 Twitter, Inc.
236 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
237 * ======================================================================== */
238
239
240+function ($) {
241    'use strict';
242
243    // MODAL CLASS DEFINITION
244    // ======================
245
246    var Modal = function (element, options) {
247        this.options = options
248        this.$body = $(document.body)
249        this.$element = $(element)
250        this.$backdrop =
251            this.isShown = null
252        this.scrollbarWidth = 0
253
254        if (this.options.remote) {
255            this.$element
vendor: 8,239 bytes, lines 256-512
256                .find('.modal-content')
257                .load(this.options.remote, $.proxy(function () {
258                    this.$element.trigger('loaded.bs.modal')
259                }, this))
260        }
261    }
262
263    Modal.VERSION = '3.3.0'
264
265    Modal.TRANSITION_DURATION = 300
266    Modal.BACKDROP_TRANSITION_DURATION = 150
267
268    Modal.DEFAULTS = {
269        backdrop: true,
270        keyboard: true,
271        show: true
272    }
273
274    Modal.prototype.toggle = function (_relatedTarget) {
275        return this.isShown ? this.hide() : this.show(_relatedTarget)
276    }
277
278    Modal.prototype.show = function (_relatedTarget) {
279        var that = this
280        var e = $.Event('show.bs.modal', {relatedTarget: _relatedTarget})
281
282        this.$element.trigger(e)
283
284        if (this.isShown || e.isDefaultPrevented()) return
285
286        this.isShown = true
287
288        this.checkScrollbar()
289        this.$body.addClass('modal-open')
290
291        this.setScrollbar()
292        this.escape()
293
294        this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
295
296        this.backdrop(function () {
297            var transition = $.support.transition && that.$element.hasClass('fade')
298
299            if (!that.$element.parent().length) {
300                that.$element.appendTo(that.$body) // don't move modals dom position
301            }
302
303            that.$element
304                .show()
305                .scrollTop(0)
306
307            if (transition) {
308                that.$element[0].offsetWidth // force reflow
309            }
310
311            that.$element
312                .addClass('in')
313                .attr('aria-hidden', false)
314
315            that.enforceFocus()
316
317            var e = $.Event('shown.bs.modal', {relatedTarget: _relatedTarget})
318
319            transition ?
320                that.$element.find('.modal-dialog') // wait for modal to slide in
321                    .one('bsTransitionEnd', function () {
322                        that.$element.trigger('focus').trigger(e)
323                    })
324                    .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
325                that.$element.trigger('focus').trigger(e)
326        })
327    }
328
329    Modal.prototype.hide = function (e) {
330        if (e) e.preventDefault()
331
332        e = $.Event('hide.bs.modal')
333
334        this.$element.trigger(e)
335
336        if (!this.isShown || e.isDefaultPrevented()) return
337
338        this.isShown = false
339
340        this.escape()
341
342        $(document).off('focusin.bs.modal')
343
344        this.$element
345            .removeClass('in')
346            .attr('aria-hidden', true)
347            .off('click.dismiss.bs.modal')
348
349        $.support.transition && this.$element.hasClass('fade') ?
350            this.$element
351                .one('bsTransitionEnd', $.proxy(this.hideModal, this))
352                .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
353            this.hideModal()
354    }
355
356    Modal.prototype.enforceFocus = function () {
357        $(document)
358            .off('focusin.bs.modal') // guard against infinite focus loop
359            .on('focusin.bs.modal', $.proxy(function (e) {
360                if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
361                    this.$element.trigger('focus')
362                }
363            }, this))
364    }
365
366    Modal.prototype.escape = function () {
367        if (this.isShown && this.options.keyboard) {
368            this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
369                e.which == 27 && this.hide()
370            }, this))
371        } else if (!this.isShown) {
372            this.$element.off('keydown.dismiss.bs.modal')
373        }
374    }
375
376    Modal.prototype.hideModal = function () {
377        var that = this
378        this.$element.hide()
379        this.backdrop(function () {
380            that.$body.removeClass('modal-open')
381            that.resetScrollbar()
382            that.$element.trigger('hidden.bs.modal')
383        })
384    }
385
386    Modal.prototype.removeBackdrop = function () {
387        this.$backdrop && this.$backdrop.remove()
388        this.$backdrop = null
389    }
390
391    Modal.prototype.backdrop = function (callback) {
392        var that = this
393        var animate = this.$element.hasClass('fade') ? 'fade' : ''
394
395        if (this.isShown && this.options.backdrop) {
396            var doAnimate = $.support.transition && animate
397
398            this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
399                .prependTo(this.$element)
400                .on('click.dismiss.bs.modal', $.proxy(function (e) {
401                    if (e.target !== e.currentTarget) return
402                    this.options.backdrop == 'static'
403                        ? this.$element[0].focus.call(this.$element[0])
404                        : this.hide.call(this)
405                }, this))
406
407            if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
408
409            this.$backdrop.addClass('in')
410
411            if (!callback) return
412
413            doAnimate ?
414                this.$backdrop
415                    .one('bsTransitionEnd', callback)
416                    .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
417                callback()
418
419        } else if (!this.isShown && this.$backdrop) {
420            this.$backdrop.removeClass('in')
421
422            var callbackRemove = function () {
423                that.removeBackdrop()
424                callback && callback()
425            }
426            $.support.transition && this.$element.hasClass('fade') ?
427                this.$backdrop
428                    .one('bsTransitionEnd', callbackRemove)
429                    .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
430                callbackRemove()
431
432        } else if (callback) {
433            callback()
434        }
435    }
436
437    Modal.prototype.checkScrollbar = function () {
438        this.scrollbarWidth = this.measureScrollbar()
439    }
440
441    Modal.prototype.setScrollbar = function () {
442        var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
443        if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
444    }
445
446    Modal.prototype.resetScrollbar = function () {
447        this.$body.css('padding-right', '')
448    }
449
450    Modal.prototype.measureScrollbar = function () { // thx walsh
451        if (document.body.clientWidth >= window.innerWidth) return 0
452        var scrollDiv = document.createElement('div')
453        scrollDiv.className = 'modal-scrollbar-measure'
454        this.$body.append(scrollDiv)
455        var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
456        this.$body[0].removeChild(scrollDiv)
457        return scrollbarWidth
458    }
459
460
461    // MODAL PLUGIN DEFINITION
462    // =======================
463
464    function Plugin(option, _relatedTarget) {
465        return this.each(function () {
466            var $this = $(this)
467            var data = $this.data('bs.modal')
468            var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
469
470            if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
471            if (typeof option == 'string') data[option](_relatedTarget)
472            else if (options.show) data.show(_relatedTarget)
473        })
474    }
475
476    var old = $.fn.modal
477
478    $.fn.modal = Plugin
479    $.fn.modal.Constructor = Modal
480
481
482    // MODAL NO CONFLICT
483    // =================
484
485    $.fn.modal.noConflict = function () {
486        $.fn.modal = old
487        return this
488    }
489
490
491    // MODAL DATA-API
492    // ==============
493
494    $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
495        var $this = $(this)
496        var href = $this.attr('href')
497        var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
498        var option = $target.data('bs.modal') ? 'toggle' : $.extend({remote: !/#/.test(href) && href}, $target.data(), $this.data())
499
500        if ($this.is('a')) e.preventDefault()
501
502        $target.one('show.bs.modal', function (showEvent) {
503            if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
504            $target.one('hidden.bs.modal', function () {
505                $this.is(':visible') && $this.trigger('focus')
506            })
507        })
508        Plugin.call($target, option, this)
509    })
510
511}(jQuery);
512

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.