From 79242ba7dc6fdec52c8b51a1163eee393b0fdf68 Mon Sep 17 00:00:00 2001 From: Jackson Date: Thu, 29 Mar 2018 20:06:35 +0800 Subject: [PATCH] docs: change script link (#49) --- mip-169kangad/README.md | 2 +- mip-233-change/README.md | 2 +- mip-233-changekc/README.md | 2 +- mip-233-clickmore/README.md | 2 +- mip-233-djs/README.md | 2 +- mip-233-hideorshow/README.md | 2 +- mip-233-ksbm/README.md | 2 +- mip-233-list/README.md | 2 +- mip-233-login/README.md | 2 +- mip-233-lxkf/README.md | 2 +- mip-233-newsmore/README.md | 2 +- mip-233-slider/README.md | 2 +- mip-233-tongji/README.md | 2 +- mip-233-up2now/README.md | 2 +- mip-233-yytx/README.md | 2 +- mip-25game-gradient/README.md | 2 +- mip-25game-openapp/README.md | 2 +- mip-25game-progressbar/README.md | 2 +- mip-25game-star/README.md | 2 +- mip-25game-tabsplit/README.md | 2 +- mip-360doc-script/README.md | 17 + mip-360doc-script/mip-360doc-script.js | 203 + mip-360doc-script/package.json | 12 + mip-360docad-script/README.md | 2 +- mip-365-addask/README.md | 2 +- mip-365xiazai-header/README.md | 2 +- mip-365xiazai-tabtap/README.md | 2 +- mip-3727-pagination/README.md | 67 + mip-3727-pagination/mip-3727-pagination.css | 2 + mip-3727-pagination/mip-3727-pagination.js | 113 + mip-3727-pagination/package.json | 12 + mip-39ad/README.md | 27 + mip-39ad/mip-39ad.js | 833 + mip-39ad/package.json | 12 + mip-39alimama/README.md | 2 +- mip-39appgad/README.md | 31 + mip-39appgad/mip-39appgad.js | 835 + mip-39appgad/package.json | 12 + mip-51la/README.md | 2 +- mip-53msg/README.md | 2 +- mip-53pop/README.md | 2 +- mip-53vote/README.md | 2 +- mip-5577-cnzzcount/README.md | 2 +- mip-5h-cnzzcount/README.md | 2 +- mip-7yaz-downbox/README.md | 2 +- mip-99down-dropload/README.md | 2 +- mip-9ht-bdzs/README.md | 2 +- mip-a5-loadmore/README.md | 57 + mip-a5-loadmore/mip-a5-loadmore.js | 107 + mip-a5-loadmore/package.json | 12 + mip-ad-link/README.md | 2 +- mip-ad-random/README.md | 63 + mip-ad-random/mip-ad-random.js | 42 + mip-ad-random/package.json | 12 + mip-ad-video/README.md | 44 + mip-ad-video/mip-ad-video.js | 78 + mip-ad-video/mip-ad-video.less | 22 + mip-ad-video/package.json | 14 + mip-add-game/README.md | 2 +- mip-adsense/README.md | 50 + mip-adsense/mip-adsense.js | 46 + mip-adsense/package.json | 12 + mip-ajax-carousel/README.md | 2 +- mip-ajax-data/README.md | 46 + mip-ajax-data/mip-ajax-data.js | 72 + mip-ajax-data/mip-ajax-data.less | 30 + mip-ajax-data/package.json | 14 + mip-all-checkout/README.md | 2 +- mip-app27/README.md | 2 +- mip-append-video/README.md | 2 +- mip-ask-closed/README.md | 2 +- mip-ask-pucker/README.md | 2 +- mip-askad/README.md | 64 + mip-askad/mip-askad.js | 250 + mip-askad/package.json | 12 + mip-askvip-ad/README.md | 2 +- mip-audit-xa/README.md | 2 +- mip-baiyun-map/README.md | 82 + mip-baiyun-map/mip-baiyun-map.js | 130 + mip-baiyun-map/mip-baiyun-map.less | 132 + mip-baiyun-map/package.json | 14 + mip-bdb-custom-content/README.md | 2 +- mip-bkmy-anchor/README.md | 2 +- mip-bkmy-audio/README.md | 2 +- mip-bsml-carousel/README.md | 20 + mip-bsml-carousel/iscroll/iscroll.js | 2042 ++ mip-bsml-carousel/mip-bsml-carousel.js | 45 + mip-bsml-carousel/package.json | 14 + mip-bsml-fixedbar/README.md | 22 + mip-bsml-fixedbar/mip-bsml-fixedbar.js | 36 + mip-bsml-fixedbar/package.json | 14 + mip-bsml-form/README.md | 19 + mip-bsml-form/mip-bsml-form.js | 94 + mip-bsml-form/mip-bsml-form.less | 103 + mip-bsml-form/package.json | 14 + mip-bsml-multiselect/README.md | 18 + mip-bsml-multiselect/mip-bsml-multiselect.js | 753 + .../mip-bsml-multiselect.less | 275 + mip-bsml-multiselect/package.json | 14 + mip-bsml-sliding/README.md | 20 + mip-bsml-sliding/iscroll/iscroll.js | 2042 ++ mip-bsml-sliding/mip-bsml-sliding.js | 39 + mip-bsml-sliding/package.json | 14 + mip-bsml-widget/README.md | 18 + mip-bsml-widget/mip-bsml-widget.js | 115 + mip-bsml-widget/package.json | 14 + mip-btn-address/README.md | 2 +- mip-caidashi-mob/README.md | 2 +- mip-cambrian-article/README.md | 2 +- mip-cambrian/README.md | 2 +- mip-cd-news/README.md | 2 +- mip-cd-source/README.md | 2 +- mip-cehome-bbsinfo/README.md | 2 +- mip-cehome-common/README.md | 2 +- mip-cehome-forumlist/README.md | 2 +- mip-cehome-sellso/README.md | 2 +- mip-cehome-threadlist/README.md | 2 +- mip-changyan/README.md | 36 + mip-changyan/mip-changyan.js | 27 + mip-changyan/package.json | 14 + mip-chinabyte-titlehide/README.md | 2 +- mip-chinacn-filter/README.md | 2 +- mip-chinacn-gallery/README.md | 2 +- mip-chinacn-search/README.md | 2 +- mip-ck-ad/README.md | 59 + mip-ck-ad/mip-ck-ad.js | 131 + mip-ck-ad/package.json | 12 + mip-ck-basecss/README.md | 15 + mip-ck-basecss/css/base.css | 733 + mip-ck-basecss/css/dialog.css | 134 + mip-ck-basecss/css/footer.css | 61 + mip-ck-basecss/css/head.css | 78 + mip-ck-basecss/css/page.css | 50 + mip-ck-basecss/css/reset.css | 280 + mip-ck-basecss/mip-ck-basecss.js | 13 + mip-ck-basecss/mip-ck-basecss.less | 15 + mip-ck-basecss/package.json | 12 + mip-ck-browser/README.md | 55 + mip-ck-browser/ck-browser.js | 47 + mip-ck-browser/mip-ck-browser.js | 71 + mip-ck-browser/package.json | 11 + mip-ck-course-detail/README.md | 19 + mip-ck-course-detail/css/detail.less | 81 + mip-ck-course-detail/css/main.less | 1044 + mip-ck-course-detail/css/video-js.css | 1516 + mip-ck-course-detail/js/catalog.js | 155 + mip-ck-course-detail/js/comments.js | 126 + mip-ck-course-detail/js/details.js | 56 + mip-ck-course-detail/js/downapp.js | 75 + mip-ck-course-detail/js/hot.js | 41 + mip-ck-course-detail/js/index.js | 60 + mip-ck-course-detail/js/lib/os.js | 129 + mip-ck-course-detail/js/lib/video.js | 22760 ++++++++++++++++ .../js/lib/videojs-contrib-hls.js | 15422 +++++++++++ mip-ck-course-detail/js/mediator.js | 15 + mip-ck-course-detail/js/player.js | 191 + mip-ck-course-detail/js/share.js | 82 + mip-ck-course-detail/js/tab.js | 99 + mip-ck-course-detail/js/tpl-data.js | 86 + mip-ck-course-detail/js/util.js | 19 + mip-ck-course-detail/mip-ck-course-detail.js | 24 + .../mip-ck-course-detail.less | 12 + mip-ck-course-detail/package.json | 12 + mip-ck-location/README.md | 50 + mip-ck-location/ck-location.js | 25 + mip-ck-location/mip-ck-location.js | 74 + mip-ck-location/package.json | 11 + mip-ck-script/README.md | 20 + mip-ck-script/mip-ck-script.js | 79 + mip-ck-script/package.json | 12 + mip-click-to-scroll/README.md | 2 +- mip-clickup/README.md | 2 +- mip-close-ad/README.md | 2 +- mip-close-dom/README.md | 2 +- mip-cloud-tie/README.md | 2 +- mip-cngold-ajax-table/README.md | 2 +- mip-cngold-madapt/README.md | 2 +- mip-cnkang-content/README.md | 2 +- mip-cnkang-data/README.md | 2 +- mip-cnkang-details/README.md | 2 +- mip-cnkang-direct/README.md | 2 +- mip-cnkang-elect/README.md | 2 +- mip-cnkang-href/README.md | 2 +- mip-cnkang-pic/README.md | 2 +- mip-cnkang-sex/README.md | 2 +- mip-cnkang-switch-display/README.md | 2 +- mip-con-but/README.md | 2 +- mip-container-expand/README.md | 2 +- mip-content-readmore/README.md | 82 + mip-content-readmore/mip-content-readmore.js | 94 + .../mip-content-readmore.less | 45 + mip-content-readmore/package.json | 14 + mip-copy/README.md | 2 +- mip-count/README.md | 2 +- mip-cr173-addapp/README.md | 2 +- mip-cr173-addrecomd/README.md | 2 +- mip-cr173-bottomjump/README.md | 2 +- mip-cr173-cnzz/README.md | 2 +- mip-cr173-comment/README.md | 2 +- mip-cr173-conut/README.md | 18 + mip-cr173-conut/mip-cr173-conut.js | 177 + mip-cr173-conut/package.json | 8 + mip-cr173-downthe/README.md | 2 +- mip-cr173-eject/README.md | 2 +- mip-cr173-key/README.md | 2 +- mip-cr173-mg/README.md | 2 +- mip-cr173-popup/README.md | 2 +- mip-cr173-ppzs/README.md | 14 + mip-cr173-ppzs/mip-cr173-ppzs.js | 159 + mip-cr173-ppzs/package.json | 12 + mip-cr173-tags/README.md | 41 + mip-cr173-tags/mip-cr173-tags.js | 94 + mip-cr173-tags/package.json | 12 + mip-cs-meiqia/README.md | 2 +- mip-custom-passport-365caidashi/README.md | 2 +- mip-cy-audio/README.md | 2 +- mip-cy-fine-qa/README.md | 2 +- mip-cy-list/README.md | 2 +- mip-cy-pay-button/README.md | 2 +- mip-cy-quick-question/README.md | 2 +- mip-cy-root/README.md | 2 +- mip-cy-script/README.md | 2 +- mip-cy-search-bar/README.md | 2 +- mip-cy-search-doc-tab/README.md | 2 +- mip-cy-upgrade-service/README.md | 2 +- mip-czsy-nav/README.md | 2 +- mip-dad-appdownload/README.md | 61 + mip-dad-appdownload/mip-dad-appdownload.js | 81 + mip-dad-appdownload/package.json | 14 + mip-dftt-pageNewsList/README.md | 2 +- mip-discuz-login/README.md | 40 + mip-discuz-login/mip-discuz-login.js | 732 + mip-discuz-login/package.json | 14 + mip-discuz-post/README.md | 40 + mip-discuz-post/mip-discuz-post.js | 852 + mip-discuz-post/package.json | 14 + mip-display-column/README.md | 2 +- mip-down-comment/README.md | 36 + mip-down-comment/mip-down-comment.js | 144 + mip-down-comment/package.json | 12 + mip-down-dropload/README.md | 39 + mip-down-dropload/mip-down-dropload.js | 117 + mip-down-dropload/package.json | 12 + mip-down-hideshow/README.md | 27 + mip-down-hideshow/mip-down-hideshow.js | 77 + mip-down-hideshow/package.json | 12 + mip-down-ppzs/README.md | 18 + mip-down-ppzs/mip-down-ppzs.js | 196 + mip-down-ppzs/package.json | 12 + mip-down-script/README.md | 85 + mip-down-script/mip-down-script.js | 355 + mip-down-script/package.json | 12 + mip-downlink/README.md | 2 +- mip-dp-script/README.md | 54 + mip-dp-script/mip-dp-script.js | 191 + mip-dp-script/package.json | 12 + mip-ecms/README.md | 85 + mip-ecms/mip-ecms.js | 99 + mip-ecms/package.json | 9 + mip-em-hq/README.md | 2 +- mip-fdad/README.md | 2 +- mip-fengxi-sdk/README.md | 30 + mip-fengxi-sdk/mip-fengxi-sdk.js | 46 + mip-fengxi-sdk/package.json | 13 + mip-fh-ad-plus/README.md | 2 +- mip-fh-ad/README.md | 48 + mip-fh-ad/mip-fh-ad.js | 186 + mip-fh-ad/package.json | 10 + mip-fh-async/README.md | 2 +- mip-fh-bus/README.md | 23 + mip-fh-bus/bus-extra.js | 66 + mip-fh-bus/bus-set-img-ad.js | 54 + mip-fh-bus/mip-fh-bus.js | 31 + mip-fh-bus/package.json | 11 + mip-fh-location/README.md | 2 +- mip-fh-paging/README.md | 2 +- mip-fj-countdown/README.md | 2 +- mip-fj-fetch/README.md | 2 +- mip-fn-comment-post/README.md | 2 +- mip-fn-comment-praise/README.md | 2 +- mip-fn-comment-reply/README.md | 2 +- mip-fn-show-allarticles/README.md | 2 +- mip-fn-swiper/README.md | 2 +- mip-fn-thread-post/README.md | 2 +- mip-fn-wapheader/README.md | 2 +- mip-fn-width/README.md | 2 +- mip-fontsize/README.md | 2 +- mip-footbutton/README.md | 2 +- mip-fx-flying-carpet/README.md | 29 + mip-fx-flying-carpet/mip-fx-flying-carpet.js | 70 + .../mip-fx-flying-carpet.less | 37 + mip-fx-flying-carpet/package.json | 12 + mip-gallery/README.md | 2 +- mip-game-recommend/README.md | 2 +- mip-game4399-download/README.md | 2 +- mip-gfads/README.md | 2 +- mip-global-script/README.md | 39 + mip-global-script/mip-global-script.js | 56 + mip-global-script/package.json | 13 + mip-gudindgufeng/README.md | 2 +- mip-gudingwzshipin/README.md | 2 +- mip-gxdxw/README.md | 2 +- mip-haixue-contact/README.md | 22 + mip-haixue-contact/mip-haixue-contact.js | 173 + mip-haixue-contact/package.json | 14 + mip-haixue-register/README.md | 22 + mip-haixue-register/mip-haixue-register.js | 56 + mip-haixue-register/mip-haixue-register.less | 80 + mip-haixue-register/package.json | 14 + mip-hc-popup/README.md | 2 +- mip-hc360-p4p/README.md | 2 +- mip-hc360-performace/README.md | 2 +- mip-header-fixed/README.md | 2 +- mip-header-qiehuan/README.md | 2 +- mip-hk-call/README.md | 52 + mip-hk-call/mip-hk-call.js | 201 + mip-hk-call/package.json | 12 + mip-hk-fcvideo/README.md | 17 + mip-hk-fcvideo/mip-hk-fcvideo.js | 33 + mip-hk-fcvideo/package.json | 12 + mip-hk-feed/README.md | 26 + mip-hk-feed/mip-hk-feed.js | 195 + mip-hk-feed/package.json | 12 + mip-hk-keep/README.md | 32 + mip-hk-keep/mip-hk-keep.js | 30 + mip-hk-keep/package.json | 12 + mip-hk-share/README.md | 27 + mip-hk-share/mip-hk-share.js | 83 + mip-hk-share/package.json | 12 + mip-hk-showarticle/README.md | 34 + mip-hk-showarticle/mip-hk-showarticle.js | 37 + mip-hk-showarticle/package.json | 12 + mip-html-ajax/README.md | 39 + mip-html-ajax/mip-html-ajax.js | 483 + mip-html-ajax/mip-html-ajax.less | 14 + mip-html-ajax/package.json | 13 + mip-html-font-size/README.md | 2 +- mip-html-tabs/README.md | 266 + mip-html-tabs/mip-html-tabs.js | 211 + mip-html-tabs/package.json | 13 + mip-huajun-downtag/README.md | 29 + mip-huajun-downtag/mip-huajun-downtag.js | 35 + mip-huajun-downtag/package.json | 12 + mip-huajun-fixdnav/README.md | 37 + mip-huajun-fixdnav/mip-huajun-fixdnav.js | 27 + mip-huajun-fixdnav/package.json | 12 + mip-huajun-loadmore/README.md | 86 + mip-huajun-loadmore/mip-huajun-loadmore.js | 52 + mip-huajun-loadmore/package.json | 12 + mip-huayi-kst/README.md | 2 +- mip-huimee/README.md | 26 + mip-huimee/mip-huimee.js | 26 + mip-huimee/package.json | 14 + mip-huixinkang-nav/README.md | 2 +- mip-iask-ajax/README.md | 51 + mip-iask-ajax/mip-iask-ajax.js | 71 + mip-iask-ajax/package.json | 14 + mip-iask-business/README.md | 19 + mip-iask-business/mip-iask-business.js | 1553 ++ mip-iask-business/package.json | 14 + mip-iask-ext/README.md | 19 + mip-iask-ext/mip-iask-ext.js | 310 + mip-iask-ext/package.json | 14 + mip-iask-report/README.md | 37 + mip-iask-report/mip-iask-report.js | 56 + mip-iask-report/package.json | 14 + mip-icms-comment/README.md | 2 +- mip-jia-apply/README.md | 2 +- mip-jia-bottomshare/README.md | 2 +- mip-jia-city-select/README.md | 2 +- mip-jia-coupons/README.md | 2 +- mip-jia-distance/README.md | 2 +- mip-jia-footertl/README.md | 2 +- mip-jia-footerzxbj/README.md | 2 +- mip-jia-headermenu/README.md | 2 +- mip-jia-house-style/README.md | 2 +- mip-jia-log/README.md | 2 +- mip-jia-masonrymore/README.md | 2 +- mip-jia-redpacket/README.md | 2 +- mip-jia-shopcomment/README.md | 2 +- mip-jia-signup/README.md | 2 +- mip-jia-style-test/README.md | 2 +- mip-jia-stylexam/README.md | 2 +- mip-jia-swiper/README.md | 2 +- mip-jia-tbs/README.md | 2 +- mip-jia-wporder/README.md | 2 +- mip-jia-zxpacket/README.md | 2 +- mip-jjpz/README.md | 300 + mip-jjpz/iconfont/iconfont.css | 26 + mip-jjpz/iconfont/iconfont.eot | Bin 0 -> 7320 bytes mip-jjpz/iconfont/iconfont.svg | 61 + mip-jjpz/iconfont/iconfont.ttf | Bin 0 -> 7036 bytes mip-jjpz/iconfont/iconfont.woff | Bin 0 -> 4500 bytes mip-jjpz/img/20150831173017783.png | Bin 0 -> 942 bytes mip-jjpz/img/down.png | Bin 0 -> 1160 bytes mip-jjpz/img/loading2.gif | Bin 0 -> 2767 bytes mip-jjpz/mip-jjpz.js | 845 + mip-jjpz/mip-jjpz.less | 1887 ++ mip-jjpz/package.json | 13 + mip-jt-ams/README.md | 2 +- mip-jt-banner/README.md | 2 +- mip-jt-calc-homeyk/README.md | 2 +- mip-jt-calc-homezh/README.md | 2 +- mip-jt-calendar/README.md | 2 +- mip-jt-comment/README.md | 2 +- mip-jt-jiepan/README.md | 2 +- mip-jt-madapt/README.md | 2 +- mip-jt-map/README.md | 2 +- mip-jt-passport/README.md | 2 +- mip-jt-quote-chart/README.md | 2 +- mip-jt-quote-content/README.md | 2 +- mip-jt-quote-his/README.md | 2 +- mip-jt-quote-realtime/README.md | 2 +- mip-jt-quote-rt/README.md | 2 +- mip-jt-resize/README.md | 2 +- mip-judge-port/README.md | 2 +- mip-jx-ad/README.md | 36 + mip-jx-ad/mip-jx-ad.js | 20 + mip-jx-ad/package.json | 10 + mip-kw-ajax/README.md | 2 +- mip-leshu-tab/README.md | 2 +- mip-lezun/README.md | 2 +- mip-linkeddb-changeHref/README.md | 2 +- mip-linkeddb-mad/README.md | 2 +- mip-linkeddb-relmap/README.md | 2 +- mip-linktion-city/README.md | 2 +- mip-linktion-fortune-video/README.md | 2 +- mip-linktion-fortune/README.md | 2 +- mip-linktion-try/README.md | 2 +- mip-liuxue-main/README.md | 2 +- mip-lmb-script/README.md | 2 +- mip-lnxyw-switch/README.md | 2 +- mip-ls-pagination/README.md | 31 + mip-ls-pagination/mip-ls-pagination.js | 115 + mip-ls-pagination/mip-ls-pagination.less | 24 + mip-ls-pagination/package.json | 12 + mip-med-showmore/README.md | 2 +- mip-meishij/README.md | 84 + mip-meishij/mip-meishij.js | 233 + mip-meishij/package.json | 12 + mip-mipengine-preview-v2/README.md | 2 +- mip-mmbang-flexible/README.md | 2 +- mip-mmtpk-script/README.md | 2 +- mip-mz-addonapp/README.md | 38 + mip-mz-addonapp/mip-mz-addonapp.js | 45 + mip-mz-addonapp/package.json | 14 + mip-mz-appdownload/README.md | 56 + mip-mz-appdownload/mip-mz-appdownload.js | 131 + mip-mz-appdownload/package.json | 14 + mip-nav-show-hide/README.md | 2 +- mip-netease-article-recommend/README.md | 2 +- mip-netease-tracker/README.md | 2 +- mip-news-iframe-interface/README.md | 20 + .../mip-news-iframe-interface.js | 115 + mip-news-iframe-interface/package.json | 11 + mip-news-recommend/README.md | 21 + mip-news-recommend/mip-news-recommend.js | 212 + mip-news-recommend/mip-news-recommend.less | 85 + mip-news-recommend/package.json | 11 + mip-next-news/README.md | 2 +- mip-next-page/README.md | 2 +- mip-nine-business/README.md | 17 + mip-nine-business/mip-nine-business.js | 118 + mip-nine-business/package.json | 11 + mip-nine-download/README.md | 17 + mip-nine-download/mip-nine-download.js | 197 + mip-nine-download/package.json | 11 + mip-njt-ad/README.md | 2 +- mip-nph/README.md | 2 +- mip-nszxyu-bookcase/README.md | 2 +- mip-nszxyu-login/README.md | 2 +- mip-nszxyu-read/README.md | 2 +- mip-objectpropertycheck-min/README.md | 2 +- mip-onga/README.md | 2 +- mip-openweb-search/README.md | 2 +- mip-pc-ad/README.md | 2 +- mip-pc6-dif/README.md | 2 +- mip-pc6-down/README.md | 2 +- mip-pc6-news/README.md | 2 +- mip-pc6-touchslide/README.md | 2 +- mip-pcad/README.md | 2 +- mip-pcbabyad/README.md | 2 +- mip-pcgroup-commentshow/README.md | 2 +- mip-pcgroup-counter/README.md | 2 +- mip-pcgroup-pconline-artproduct/README.md | 2 +- mip-pcgroup-rem/README.md | 2 +- mip-pcgroup-user/README.md | 2 +- mip-pcgroup-zancai/README.md | 2 +- mip-pcsoft-form/README.md | 2 +- mip-pcsoft-paging/README.md | 2 +- mip-pcsoft-slide/README.md | 2 +- mip-pingao-icon/README.md | 2 +- mip-pop-video/README.md | 2 +- mip-popup-layer/README.md | 2 +- mip-ppkao-bottomnav/README.md | 2 +- mip-ppkao-dropdown/README.md | 2 +- mip-ppkao-goback/README.md | 2 +- mip-ppkao-jiyancode/README.md | 2 +- mip-ppkao-kaoshixinxi/README.md | 2 +- mip-ppkao-login/README.md | 2 +- mip-ppkao-rotate/README.md | 2 +- mip-ppkao-shitisearch/README.md | 2 +- mip-ppkao-showsubject/README.md | 2 +- mip-ppkao-subjectjingyanviewmore/README.md | 2 +- mip-ppkao-zhinanslide/README.md | 2 +- mip-praise/README.md | 2 +- mip-push-bd-caidashi/README.md | 2 +- mip-push/README.md | 2 +- mip-qbb-base64/README.md | 2 +- mip-qbb-comment/README.md | 2 +- mip-qbb-detail/README.md | 2 +- mip-qbb-isweixin/README.md | 2 +- mip-qbb-qinxin/README.md | 2 +- mip-qbb-resetpic/README.md | 2 +- mip-qcode/README.md | 2 +- mip-qinbao-collection/README.md | 2 +- mip-qinbao-customaudio/README.md | 2 +- mip-qqtn-addmore/README.md | 2 +- mip-qqtn-addtab/README.md | 2 +- mip-qqtn-cnzz/README.md | 2 +- mip-qqtn-cnzzcount/README.md | 2 +- mip-qqtn-commentdrop/README.md | 2 +- mip-qqtn-count/README.md | 2 +- mip-qqtn-downts/README.md | 2 +- mip-qqtn-imgenlarge/README.md | 2 +- mip-qqtn-num0/README.md | 2 +- mip-qqtn-shield/README.md | 2 +- mip-qqtn-txalt/README.md | 2 +- mip-qqtn-txtab/README.md | 2 +- mip-qqtngx-shrinknav/README.md | 2 +- mip-qqtnhealth-dynamicmenu/README.md | 2 +- mip-rich-video/README.md | 2 +- mip-row-slide/README.md | 2 +- mip-scroll-anchor/README.md | 2 +- mip-search-prompt/README.md | 2 +- mip-sg-ad/README.md | 2 +- mip-shouji-down/README.md | 2 +- mip-shouji56-code/README.md | 2 +- mip-shushi100-timeout/README.md | 2 +- mip-shushi100-toggle/README.md | 2 +- mip-shuyang-count/README.md | 2 +- mip-sina-rem/README.md | 2 +- mip-sina-sax/README.md | 2 +- mip-sina-sudalog/README.md | 2 +- mip-sina-sudamap/README.md | 2 +- mip-sj-search/README.md | 2 +- mip-smart-recommend/README.md | 2 +- mip-sn-shop-floor/README.md | 2 +- mip-sn-shop-list/README.md | 2 +- mip-so-ssp/README.md | 2 +- mip-stats-ajk/README.md | 45 + mip-stats-ajk/mip-stats-ajk.js | 30 + mip-stats-ajk/package.json | 12 + mip-stats-bidu/README.md | 25 + mip-stats-bidu/mip-stats-bidu.js | 194 + mip-stats-bidu/package.json | 12 + mip-stats-cnzz-365caidashi/README.md | 2 +- mip-stats-general/README.md | 25 + mip-stats-general/mip-stats-general.js | 41 + mip-stats-general/package.json | 12 + mip-stats-google/README.md | 2 +- mip-stats-netease/README.md | 1 + mip-stats-netease/mip-stats-netease.js | 31 + mip-stats-netease/package.json | 12 + mip-stats-qiyu/README.md | 2 +- mip-stats-sina/README.md | 1 + mip-stats-sina/mip-stats-sina.js | 89 + mip-stats-sina/package.json | 12 + mip-swt/README.md | 2 +- mip-taoge-form/README.md | 2 +- mip-taoge-scaydk-adviser/README.md | 2 +- mip-taoge-scaydk-calculator/README.md | 2 +- mip-taoge-scaydk-index/README.md | 2 +- mip-taoge-scaydk-loan/README.md | 2 +- mip-taoge-scaydk-qe/README.md | 2 +- mip-taoge-scaydk/README.md | 2 +- mip-taoge-tp/README.md | 2 +- mip-terms-shield/README.md | 2 +- mip-tiantis-51la/README.md | 2 +- mip-tiantis-54kefu/README.md | 2 +- mip-tiantis-jsridge/README.md | 2 +- mip-ticket/README.md | 2 +- mip-trilobite-fontsize/README.md | 2 +- mip-trilobite-log/README.md | 2 +- mip-trilobite-scroll/README.md | 2 +- mip-truckcn-hash/README.md | 2 +- mip-truckcn-tel/README.md | 2 +- mip-trueland-rem/README.md | 2 +- mip-trueland-utils/README.md | 2 +- mip-tuijian-baidu/README.md | 2 +- mip-ueditor-out/README.md | 2 +- mip-unique-visitor/README.md | 2 +- mip-vd-popup/README.md | 77 + mip-vd-popup/mip-vd-popup.js | 178 + mip-vd-popup/mip-vd-popup.less | 296 + mip-vd-popup/package.json | 12 + mip-vd-popup/popup.js | 169 + mip-vd-popup/tab.js | 259 + mip-video-repeat/README.md | 2 +- mip-wangxia-call/README.md | 22 + mip-wangxia-call/mip-wangxia-call.js | 31 + mip-wangxia-call/package.json | 13 + mip-wangxia-down/README.md | 22 + mip-wangxia-down/mip-wangxia-down.js | 133 + mip-wangxia-down/mip-wangxia-down.less | 67 + mip-wangxia-down/package.json | 13 + mip-wangxia-topc/README.md | 2 +- mip-weiyoubaba-tthead/README.md | 71 + .../mip-weiyoubaba-tthead.js | 46 + mip-weiyoubaba-tthead/package.json | 13 + mip-wkad-config/README.md | 26 + mip-wkad-config/mip-wkad-config.js | 118 + mip-wkad-config/package.json | 11 + mip-wkad-final/README.md | 2 +- mip-wkad/README.md | 33 + mip-wkad/mip-wkad.js | 98 + mip-wkad/package.json | 11 + mip-wkclub-wss/README.md | 2 +- mip-wkfun-appdown/README.md | 2 +- mip-wkfun-article/README.md | 2 +- mip-wkfun-change-style/README.md | 2 +- mip-wkfun-club/README.md | 61 + mip-wkfun-club/mip-wkfun-club.js | 707 + mip-wkfun-club/package.json | 11 + mip-wkfun-disease/README.md | 17 + mip-wkfun-disease/mip-wkfun-disease.js | 171 + mip-wkfun-disease/package.json | 11 + mip-wkfun-mclub/README.md | 2 +- mip-wkfun-medicine/README.md | 17 + mip-wkfun-medicine/mip-wkfun-medicine.js | 709 + mip-wkfun-medicine/package.json | 11 + mip-wkfun-newclub/README.md | 2 +- mip-wkfun-newslist/README.md | 2 +- mip-wkfun-unfold/README.md | 2 +- mip-wkfun/README.md | 17 + mip-wkfun/mip-wkfun.js | 101 + mip-wkfun/package.json | 11 + mip-wkyimei-cpts/README.md | 2 +- mip-wygx-classtab/README.md | 2 +- mip-wygx-imgslider/README.md | 2 +- mip-xcy-hf/README.md | 2 +- mip-xcy-wz/README.md | 2 +- mip-xem-buttons/README.md | 18 + mip-xem-buttons/mip-xem-buttons.js | 138 + mip-xem-buttons/package.json | 12 + mip-xem-comment-duoshuo/README.md | 45 + .../mip-xem-comment-duoshuo.js | 30 + mip-xem-comment-duoshuo/package.json | 12 + mip-xem-dropdowns/README.md | 35 + mip-xem-dropdowns/mip-xem-dropdowns.js | 163 + mip-xem-dropdowns/package.json | 12 + mip-xem-review/README.md | 42 + mip-xem-review/mip-xem-review.js | 47 + mip-xem-review/package.json | 12 + mip-xiaojp-display/README.md | 2 +- mip-xiaomi-router/README.md | 2 +- mip-xiaoniaole/README.md | 2 +- mip-xiaoshuo-read/README.md | 2 +- mip-xilu-ad/README.md | 2 +- mip-xinshijue-script/README.md | 2 +- mip-xuexb-like/README.md | 2 +- mip-xuexb-login/README.md | 2 +- mip-xueyou-ad/README.md | 31 + mip-xueyou-ad/mip-xueyou-ad.js | 58 + mip-xueyou-ad/package.json | 12 + mip-xueyou-article/README.md | 31 + mip-xueyou-article/mip-xueyou-article.js | 166 + mip-xueyou-article/package.json | 12 + mip-xueyou-list/README.md | 18 + mip-xueyou-list/mip-xueyou-list.js | 32 + mip-xueyou-list/package.json | 12 + mip-xxcms-fd/README.md | 2 +- mip-xzh-payment/README.md | 2 +- mip-xzw-article/README.md | 15 + mip-xzw-article/mip-xzw-article.js | 126 + mip-xzw-article/package.json | 12 + mip-xzw-layer/README.md | 2 +- mip-xzw-picker/README.md | 2 +- mip-xzw-rem/README.md | 2 +- mip-ychlyxgs-adddata/README.md | 2 +- mip-ychlyxgs-data/README.md | 2 +- mip-yibai-zhaosheng/README.md | 2 +- mip-yiqibazi-tap/README.md | 109 + mip-yiqibazi-tap/mip-yiqibazi-tap.js | 47 + mip-yiqibazi-tap/package.json | 12 + mip-youlai-audio/README.md | 2 +- mip-youth-tb360/README.md | 37 + mip-youth-tb360/mip-youth-tb360.js | 24 + mip-youth-tb360/package.json | 13 + mip-youth-ttyd/README.md | 39 + mip-youth-ttyd/mip-youth-ttyd.js | 15 + mip-youth-ttyd/package.json | 13 + mip-ys137-ad/README.md | 2 +- mip-ys137-loaddata/README.md | 2 +- mip-yuanxiaoku-diqufenshuxian/README.md | 2 +- mip-yuanxiaoku-fastsearch/README.md | 2 +- mip-yuanxiaoku-fenshuxian/README.md | 2 +- mip-yuanxiaoku-homevs/README.md | 2 +- mip-yuanxiaoku-schooldetails/README.md | 2 +- mip-yuanxiaoku-schoollist/README.md | 2 +- mip-yuanxiaoku-schoolvs/README.md | 2 +- mip-yuanxiaoku-tiaodaxue/README.md | 2 +- mip-yuanxiaoku-xuanzhuanye/README.md | 2 +- mip-yuanxiaoku-zhuanyedetails/README.md | 2 +- mip-yxdown-floatad/README.md | 26 + mip-yxdown-floatad/mip-yxdown-floatad.js | 27 + mip-yxdown-floatad/package.json | 14 + mip-yxdown-games/README.md | 2 +- mip-yxdown-shielding-page/README.md | 24 + .../mip-yxdown-shielding-page.js | 52 + mip-yxdown-shielding-page/package.json | 14 + mip-yyg-jump-url/README.md | 2 +- mip-yyg-meun/README.md | 2 +- mip-yyg-photo-wall/README.md | 2 +- mip-yyg-rolling-wall/README.md | 2 +- mip-yys-rem/README.md | 2 +- mip-zhaopin-tracker/README.md | 2 +- mip-zixun/README.md | 2 +- mip-zmall-address-list/README.md | 2 +- mip-zmall-address-map/README.md | 2 +- mip-zmall-address/README.md | 2 +- mip-zmall-buy/README.md | 2 +- mip-zmall-coupon/README.md | 2 +- mip-zmall-distance/README.md | 2 +- mip-zmall-goback/README.md | 2 +- mip-zmall-map/README.md | 2 +- mip-zmall-popup-window/README.md | 2 +- mip-zmall-reply/README.md | 2 +- mip-zmall-share/README.md | 2 +- mip-zmall-store/README.md | 2 +- mip-zmall-tab/README.md | 2 +- mip-zmall-yunfei/README.md | 2 +- mip-zol-ad/README.md | 2 +- mip-zol-article-merchant/README.md | 2 +- mip-zol-ask-audio/README.md | 2 +- mip-zol-ask-report/README.md | 2 +- mip-zol-blockload/README.md | 2 +- mip-zol-commenter/README.md | 2 +- mip-zol-cr/README.md | 2 +- mip-zol-dialog/README.md | 2 +- mip-zol-input/README.md | 2 +- mip-zol-like/README.md | 2 +- mip-zol-loadmore/README.md | 2 +- mip-zol-picker/README.md | 2 +- mip-zol-praise/README.md | 2 +- mip-zol-rem/README.md | 2 +- mip-zol-stats/README.md | 2 +- mip-zol-user/README.md | 2 +- mip-zol-wapnav/README.md | 2 +- mip-zpm-commonga/README.md | 2 +- mip-zpm-company/README.md | 2 +- mip-zpm-globalza/README.md | 2 +- mip-zpm-jobdetail/README.md | 2 +- mip-zpm-searchjobs/README.md | 2 +- mip-zpm-sindex/README.md | 2 +- 755 files changed, 74186 insertions(+), 401 deletions(-) create mode 100644 mip-360doc-script/README.md create mode 100644 mip-360doc-script/mip-360doc-script.js create mode 100644 mip-360doc-script/package.json create mode 100644 mip-3727-pagination/README.md create mode 100644 mip-3727-pagination/mip-3727-pagination.css create mode 100644 mip-3727-pagination/mip-3727-pagination.js create mode 100644 mip-3727-pagination/package.json create mode 100644 mip-39ad/README.md create mode 100644 mip-39ad/mip-39ad.js create mode 100644 mip-39ad/package.json create mode 100644 mip-39appgad/README.md create mode 100644 mip-39appgad/mip-39appgad.js create mode 100644 mip-39appgad/package.json create mode 100644 mip-a5-loadmore/README.md create mode 100644 mip-a5-loadmore/mip-a5-loadmore.js create mode 100644 mip-a5-loadmore/package.json create mode 100644 mip-ad-random/README.md create mode 100644 mip-ad-random/mip-ad-random.js create mode 100644 mip-ad-random/package.json create mode 100644 mip-ad-video/README.md create mode 100644 mip-ad-video/mip-ad-video.js create mode 100644 mip-ad-video/mip-ad-video.less create mode 100644 mip-ad-video/package.json create mode 100644 mip-adsense/README.md create mode 100644 mip-adsense/mip-adsense.js create mode 100644 mip-adsense/package.json create mode 100644 mip-ajax-data/README.md create mode 100644 mip-ajax-data/mip-ajax-data.js create mode 100644 mip-ajax-data/mip-ajax-data.less create mode 100644 mip-ajax-data/package.json create mode 100644 mip-askad/README.md create mode 100755 mip-askad/mip-askad.js create mode 100644 mip-askad/package.json create mode 100644 mip-baiyun-map/README.md create mode 100644 mip-baiyun-map/mip-baiyun-map.js create mode 100644 mip-baiyun-map/mip-baiyun-map.less create mode 100644 mip-baiyun-map/package.json create mode 100644 mip-bsml-carousel/README.md create mode 100644 mip-bsml-carousel/iscroll/iscroll.js create mode 100644 mip-bsml-carousel/mip-bsml-carousel.js create mode 100644 mip-bsml-carousel/package.json create mode 100644 mip-bsml-fixedbar/README.md create mode 100644 mip-bsml-fixedbar/mip-bsml-fixedbar.js create mode 100644 mip-bsml-fixedbar/package.json create mode 100644 mip-bsml-form/README.md create mode 100755 mip-bsml-form/mip-bsml-form.js create mode 100644 mip-bsml-form/mip-bsml-form.less create mode 100644 mip-bsml-form/package.json create mode 100644 mip-bsml-multiselect/README.md create mode 100644 mip-bsml-multiselect/mip-bsml-multiselect.js create mode 100644 mip-bsml-multiselect/mip-bsml-multiselect.less create mode 100644 mip-bsml-multiselect/package.json create mode 100644 mip-bsml-sliding/README.md create mode 100644 mip-bsml-sliding/iscroll/iscroll.js create mode 100644 mip-bsml-sliding/mip-bsml-sliding.js create mode 100644 mip-bsml-sliding/package.json create mode 100644 mip-bsml-widget/README.md create mode 100644 mip-bsml-widget/mip-bsml-widget.js create mode 100644 mip-bsml-widget/package.json create mode 100644 mip-changyan/README.md create mode 100644 mip-changyan/mip-changyan.js create mode 100644 mip-changyan/package.json create mode 100644 mip-ck-ad/README.md create mode 100644 mip-ck-ad/mip-ck-ad.js create mode 100644 mip-ck-ad/package.json create mode 100644 mip-ck-basecss/README.md create mode 100644 mip-ck-basecss/css/base.css create mode 100644 mip-ck-basecss/css/dialog.css create mode 100644 mip-ck-basecss/css/footer.css create mode 100644 mip-ck-basecss/css/head.css create mode 100644 mip-ck-basecss/css/page.css create mode 100644 mip-ck-basecss/css/reset.css create mode 100644 mip-ck-basecss/mip-ck-basecss.js create mode 100644 mip-ck-basecss/mip-ck-basecss.less create mode 100644 mip-ck-basecss/package.json create mode 100644 mip-ck-browser/README.md create mode 100644 mip-ck-browser/ck-browser.js create mode 100644 mip-ck-browser/mip-ck-browser.js create mode 100644 mip-ck-browser/package.json create mode 100644 mip-ck-course-detail/README.md create mode 100644 mip-ck-course-detail/css/detail.less create mode 100644 mip-ck-course-detail/css/main.less create mode 100644 mip-ck-course-detail/css/video-js.css create mode 100644 mip-ck-course-detail/js/catalog.js create mode 100644 mip-ck-course-detail/js/comments.js create mode 100644 mip-ck-course-detail/js/details.js create mode 100644 mip-ck-course-detail/js/downapp.js create mode 100644 mip-ck-course-detail/js/hot.js create mode 100644 mip-ck-course-detail/js/index.js create mode 100644 mip-ck-course-detail/js/lib/os.js create mode 100644 mip-ck-course-detail/js/lib/video.js create mode 100644 mip-ck-course-detail/js/lib/videojs-contrib-hls.js create mode 100644 mip-ck-course-detail/js/mediator.js create mode 100644 mip-ck-course-detail/js/player.js create mode 100644 mip-ck-course-detail/js/share.js create mode 100644 mip-ck-course-detail/js/tab.js create mode 100644 mip-ck-course-detail/js/tpl-data.js create mode 100644 mip-ck-course-detail/js/util.js create mode 100644 mip-ck-course-detail/mip-ck-course-detail.js create mode 100644 mip-ck-course-detail/mip-ck-course-detail.less create mode 100644 mip-ck-course-detail/package.json create mode 100644 mip-ck-location/README.md create mode 100644 mip-ck-location/ck-location.js create mode 100644 mip-ck-location/mip-ck-location.js create mode 100644 mip-ck-location/package.json create mode 100644 mip-ck-script/README.md create mode 100644 mip-ck-script/mip-ck-script.js create mode 100644 mip-ck-script/package.json create mode 100644 mip-content-readmore/README.md create mode 100644 mip-content-readmore/mip-content-readmore.js create mode 100644 mip-content-readmore/mip-content-readmore.less create mode 100644 mip-content-readmore/package.json create mode 100644 mip-cr173-conut/README.md create mode 100644 mip-cr173-conut/mip-cr173-conut.js create mode 100644 mip-cr173-conut/package.json create mode 100644 mip-cr173-ppzs/README.md create mode 100644 mip-cr173-ppzs/mip-cr173-ppzs.js create mode 100644 mip-cr173-ppzs/package.json create mode 100644 mip-cr173-tags/README.md create mode 100644 mip-cr173-tags/mip-cr173-tags.js create mode 100644 mip-cr173-tags/package.json create mode 100644 mip-dad-appdownload/README.md create mode 100644 mip-dad-appdownload/mip-dad-appdownload.js create mode 100644 mip-dad-appdownload/package.json create mode 100644 mip-discuz-login/README.md create mode 100644 mip-discuz-login/mip-discuz-login.js create mode 100644 mip-discuz-login/package.json create mode 100644 mip-discuz-post/README.md create mode 100644 mip-discuz-post/mip-discuz-post.js create mode 100644 mip-discuz-post/package.json create mode 100644 mip-down-comment/README.md create mode 100644 mip-down-comment/mip-down-comment.js create mode 100644 mip-down-comment/package.json create mode 100644 mip-down-dropload/README.md create mode 100644 mip-down-dropload/mip-down-dropload.js create mode 100644 mip-down-dropload/package.json create mode 100644 mip-down-hideshow/README.md create mode 100644 mip-down-hideshow/mip-down-hideshow.js create mode 100644 mip-down-hideshow/package.json create mode 100644 mip-down-ppzs/README.md create mode 100644 mip-down-ppzs/mip-down-ppzs.js create mode 100644 mip-down-ppzs/package.json create mode 100644 mip-down-script/README.md create mode 100644 mip-down-script/mip-down-script.js create mode 100644 mip-down-script/package.json create mode 100644 mip-dp-script/README.md create mode 100644 mip-dp-script/mip-dp-script.js create mode 100644 mip-dp-script/package.json create mode 100644 mip-ecms/README.md create mode 100644 mip-ecms/mip-ecms.js create mode 100644 mip-ecms/package.json create mode 100644 mip-fengxi-sdk/README.md create mode 100644 mip-fengxi-sdk/mip-fengxi-sdk.js create mode 100644 mip-fengxi-sdk/package.json create mode 100644 mip-fh-ad/README.md create mode 100644 mip-fh-ad/mip-fh-ad.js create mode 100644 mip-fh-ad/package.json create mode 100644 mip-fh-bus/README.md create mode 100644 mip-fh-bus/bus-extra.js create mode 100644 mip-fh-bus/bus-set-img-ad.js create mode 100644 mip-fh-bus/mip-fh-bus.js create mode 100644 mip-fh-bus/package.json create mode 100644 mip-fx-flying-carpet/README.md create mode 100644 mip-fx-flying-carpet/mip-fx-flying-carpet.js create mode 100644 mip-fx-flying-carpet/mip-fx-flying-carpet.less create mode 100644 mip-fx-flying-carpet/package.json create mode 100644 mip-global-script/README.md create mode 100644 mip-global-script/mip-global-script.js create mode 100644 mip-global-script/package.json create mode 100644 mip-haixue-contact/README.md create mode 100644 mip-haixue-contact/mip-haixue-contact.js create mode 100644 mip-haixue-contact/package.json create mode 100644 mip-haixue-register/README.md create mode 100644 mip-haixue-register/mip-haixue-register.js create mode 100644 mip-haixue-register/mip-haixue-register.less create mode 100644 mip-haixue-register/package.json create mode 100644 mip-hk-call/README.md create mode 100644 mip-hk-call/mip-hk-call.js create mode 100644 mip-hk-call/package.json create mode 100644 mip-hk-fcvideo/README.md create mode 100644 mip-hk-fcvideo/mip-hk-fcvideo.js create mode 100644 mip-hk-fcvideo/package.json create mode 100644 mip-hk-feed/README.md create mode 100644 mip-hk-feed/mip-hk-feed.js create mode 100644 mip-hk-feed/package.json create mode 100644 mip-hk-keep/README.md create mode 100644 mip-hk-keep/mip-hk-keep.js create mode 100644 mip-hk-keep/package.json create mode 100644 mip-hk-share/README.md create mode 100644 mip-hk-share/mip-hk-share.js create mode 100644 mip-hk-share/package.json create mode 100644 mip-hk-showarticle/README.md create mode 100644 mip-hk-showarticle/mip-hk-showarticle.js create mode 100644 mip-hk-showarticle/package.json create mode 100644 mip-html-ajax/README.md create mode 100644 mip-html-ajax/mip-html-ajax.js create mode 100644 mip-html-ajax/mip-html-ajax.less create mode 100644 mip-html-ajax/package.json create mode 100644 mip-html-tabs/README.md create mode 100644 mip-html-tabs/mip-html-tabs.js create mode 100644 mip-html-tabs/package.json create mode 100644 mip-huajun-downtag/README.md create mode 100644 mip-huajun-downtag/mip-huajun-downtag.js create mode 100644 mip-huajun-downtag/package.json create mode 100644 mip-huajun-fixdnav/README.md create mode 100644 mip-huajun-fixdnav/mip-huajun-fixdnav.js create mode 100644 mip-huajun-fixdnav/package.json create mode 100644 mip-huajun-loadmore/README.md create mode 100644 mip-huajun-loadmore/mip-huajun-loadmore.js create mode 100644 mip-huajun-loadmore/package.json create mode 100644 mip-huimee/README.md create mode 100644 mip-huimee/mip-huimee.js create mode 100644 mip-huimee/package.json create mode 100644 mip-iask-ajax/README.md create mode 100644 mip-iask-ajax/mip-iask-ajax.js create mode 100644 mip-iask-ajax/package.json create mode 100644 mip-iask-business/README.md create mode 100644 mip-iask-business/mip-iask-business.js create mode 100644 mip-iask-business/package.json create mode 100644 mip-iask-ext/README.md create mode 100644 mip-iask-ext/mip-iask-ext.js create mode 100644 mip-iask-ext/package.json create mode 100644 mip-iask-report/README.md create mode 100644 mip-iask-report/mip-iask-report.js create mode 100644 mip-iask-report/package.json create mode 100644 mip-jjpz/README.md create mode 100644 mip-jjpz/iconfont/iconfont.css create mode 100644 mip-jjpz/iconfont/iconfont.eot create mode 100644 mip-jjpz/iconfont/iconfont.svg create mode 100644 mip-jjpz/iconfont/iconfont.ttf create mode 100644 mip-jjpz/iconfont/iconfont.woff create mode 100644 mip-jjpz/img/20150831173017783.png create mode 100644 mip-jjpz/img/down.png create mode 100644 mip-jjpz/img/loading2.gif create mode 100644 mip-jjpz/mip-jjpz.js create mode 100644 mip-jjpz/mip-jjpz.less create mode 100644 mip-jjpz/package.json create mode 100644 mip-jx-ad/README.md create mode 100644 mip-jx-ad/mip-jx-ad.js create mode 100644 mip-jx-ad/package.json create mode 100644 mip-ls-pagination/README.md create mode 100644 mip-ls-pagination/mip-ls-pagination.js create mode 100644 mip-ls-pagination/mip-ls-pagination.less create mode 100644 mip-ls-pagination/package.json create mode 100644 mip-meishij/README.md create mode 100644 mip-meishij/mip-meishij.js create mode 100644 mip-meishij/package.json create mode 100644 mip-mz-addonapp/README.md create mode 100644 mip-mz-addonapp/mip-mz-addonapp.js create mode 100644 mip-mz-addonapp/package.json create mode 100644 mip-mz-appdownload/README.md create mode 100644 mip-mz-appdownload/mip-mz-appdownload.js create mode 100644 mip-mz-appdownload/package.json create mode 100644 mip-news-iframe-interface/README.md create mode 100644 mip-news-iframe-interface/mip-news-iframe-interface.js create mode 100644 mip-news-iframe-interface/package.json create mode 100644 mip-news-recommend/README.md create mode 100644 mip-news-recommend/mip-news-recommend.js create mode 100644 mip-news-recommend/mip-news-recommend.less create mode 100644 mip-news-recommend/package.json create mode 100644 mip-nine-business/README.md create mode 100644 mip-nine-business/mip-nine-business.js create mode 100644 mip-nine-business/package.json create mode 100644 mip-nine-download/README.md create mode 100644 mip-nine-download/mip-nine-download.js create mode 100644 mip-nine-download/package.json create mode 100644 mip-stats-ajk/README.md create mode 100644 mip-stats-ajk/mip-stats-ajk.js create mode 100644 mip-stats-ajk/package.json create mode 100644 mip-stats-bidu/README.md create mode 100755 mip-stats-bidu/mip-stats-bidu.js create mode 100644 mip-stats-bidu/package.json create mode 100644 mip-stats-general/README.md create mode 100755 mip-stats-general/mip-stats-general.js create mode 100644 mip-stats-general/package.json create mode 100644 mip-stats-netease/README.md create mode 100755 mip-stats-netease/mip-stats-netease.js create mode 100644 mip-stats-netease/package.json create mode 100644 mip-stats-sina/README.md create mode 100755 mip-stats-sina/mip-stats-sina.js create mode 100644 mip-stats-sina/package.json create mode 100644 mip-vd-popup/README.md create mode 100644 mip-vd-popup/mip-vd-popup.js create mode 100644 mip-vd-popup/mip-vd-popup.less create mode 100644 mip-vd-popup/package.json create mode 100644 mip-vd-popup/popup.js create mode 100644 mip-vd-popup/tab.js create mode 100644 mip-wangxia-call/README.md create mode 100644 mip-wangxia-call/mip-wangxia-call.js create mode 100644 mip-wangxia-call/package.json create mode 100644 mip-wangxia-down/README.md create mode 100644 mip-wangxia-down/mip-wangxia-down.js create mode 100644 mip-wangxia-down/mip-wangxia-down.less create mode 100644 mip-wangxia-down/package.json create mode 100644 mip-weiyoubaba-tthead/README.md create mode 100644 mip-weiyoubaba-tthead/mip-weiyoubaba-tthead.js create mode 100644 mip-weiyoubaba-tthead/package.json create mode 100644 mip-wkad-config/README.md create mode 100644 mip-wkad-config/mip-wkad-config.js create mode 100644 mip-wkad-config/package.json create mode 100644 mip-wkad/README.md create mode 100644 mip-wkad/mip-wkad.js create mode 100644 mip-wkad/package.json create mode 100644 mip-wkfun-club/README.md create mode 100644 mip-wkfun-club/mip-wkfun-club.js create mode 100644 mip-wkfun-club/package.json create mode 100644 mip-wkfun-disease/README.md create mode 100644 mip-wkfun-disease/mip-wkfun-disease.js create mode 100644 mip-wkfun-disease/package.json create mode 100644 mip-wkfun-medicine/README.md create mode 100644 mip-wkfun-medicine/mip-wkfun-medicine.js create mode 100644 mip-wkfun-medicine/package.json create mode 100644 mip-wkfun/README.md create mode 100644 mip-wkfun/mip-wkfun.js create mode 100644 mip-wkfun/package.json create mode 100644 mip-xem-buttons/README.md create mode 100644 mip-xem-buttons/mip-xem-buttons.js create mode 100644 mip-xem-buttons/package.json create mode 100644 mip-xem-comment-duoshuo/README.md create mode 100644 mip-xem-comment-duoshuo/mip-xem-comment-duoshuo.js create mode 100644 mip-xem-comment-duoshuo/package.json create mode 100644 mip-xem-dropdowns/README.md create mode 100644 mip-xem-dropdowns/mip-xem-dropdowns.js create mode 100644 mip-xem-dropdowns/package.json create mode 100644 mip-xem-review/README.md create mode 100644 mip-xem-review/mip-xem-review.js create mode 100644 mip-xem-review/package.json create mode 100644 mip-xueyou-ad/README.md create mode 100644 mip-xueyou-ad/mip-xueyou-ad.js create mode 100644 mip-xueyou-ad/package.json create mode 100644 mip-xueyou-article/README.md create mode 100644 mip-xueyou-article/mip-xueyou-article.js create mode 100644 mip-xueyou-article/package.json create mode 100644 mip-xueyou-list/README.md create mode 100644 mip-xueyou-list/mip-xueyou-list.js create mode 100644 mip-xueyou-list/package.json create mode 100644 mip-xzw-article/README.md create mode 100644 mip-xzw-article/mip-xzw-article.js create mode 100644 mip-xzw-article/package.json create mode 100644 mip-yiqibazi-tap/README.md create mode 100644 mip-yiqibazi-tap/mip-yiqibazi-tap.js create mode 100644 mip-yiqibazi-tap/package.json create mode 100644 mip-youth-tb360/README.md create mode 100644 mip-youth-tb360/mip-youth-tb360.js create mode 100644 mip-youth-tb360/package.json create mode 100644 mip-youth-ttyd/README.md create mode 100644 mip-youth-ttyd/mip-youth-ttyd.js create mode 100644 mip-youth-ttyd/package.json create mode 100644 mip-yxdown-floatad/README.md create mode 100644 mip-yxdown-floatad/mip-yxdown-floatad.js create mode 100644 mip-yxdown-floatad/package.json create mode 100644 mip-yxdown-shielding-page/README.md create mode 100644 mip-yxdown-shielding-page/mip-yxdown-shielding-page.js create mode 100644 mip-yxdown-shielding-page/package.json diff --git a/mip-169kangad/README.md b/mip-169kangad/README.md index b4d043ee..61cf53e6 100644 --- a/mip-169kangad/README.md +++ b/mip-169kangad/README.md @@ -6,7 +6,7 @@ mip-169kangad 用来添加搜狗广告。 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-169kangad/mip-169kangad.js +所需脚本|https://c.mipcdn.com/static/v1/mip-169kangad/mip-169kangad.js ## 示例 diff --git a/mip-233-change/README.md b/mip-233-change/README.md index 073af534..e1ff1b3e 100644 --- a/mip-233-change/README.md +++ b/mip-233-change/README.md @@ -6,7 +6,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-change/mip-233-change.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-change/mip-233-change.js ## 示例 diff --git a/mip-233-changekc/README.md b/mip-233-changekc/README.md index c85b7e3a..9ce01b93 100644 --- a/mip-233-changekc/README.md +++ b/mip-233-changekc/README.md @@ -6,7 +6,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-changekc/mip-233-changekc.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-changekc/mip-233-changekc.js ## 示例 diff --git a/mip-233-clickmore/README.md b/mip-233-clickmore/README.md index 3a118850..db4cc4be 100644 --- a/mip-233-clickmore/README.md +++ b/mip-233-clickmore/README.md @@ -6,7 +6,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-clickmore/mip-233-clickmore.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-clickmore/mip-233-clickmore.js ## 示例 diff --git a/mip-233-djs/README.md b/mip-233-djs/README.md index 7259a0d8..b5e12309 100644 --- a/mip-233-djs/README.md +++ b/mip-233-djs/README.md @@ -6,7 +6,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-djs/mip-233-djs.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-djs/mip-233-djs.js ## 示例 diff --git a/mip-233-hideorshow/README.md b/mip-233-hideorshow/README.md index 986cecac..33a6be8f 100644 --- a/mip-233-hideorshow/README.md +++ b/mip-233-hideorshow/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-hideorshow/mip-233-hideorshow.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-hideorshow/mip-233-hideorshow.js ## 示例 diff --git a/mip-233-ksbm/README.md b/mip-233-ksbm/README.md index e1a6464d..9b9618d6 100644 --- a/mip-233-ksbm/README.md +++ b/mip-233-ksbm/README.md @@ -6,7 +6,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-ksbm/mip-233-ksbm.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-ksbm/mip-233-ksbm.js ## 示例 diff --git a/mip-233-list/README.md b/mip-233-list/README.md index 16819bd9..0e42ac87 100644 --- a/mip-233-list/README.md +++ b/mip-233-list/README.md @@ -7,7 +7,7 @@ list 插件 ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-list/mip-233-list.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-list/mip-233-list.js ## 示例 diff --git a/mip-233-login/README.md b/mip-233-login/README.md index 2dfece2d..b6b46f53 100644 --- a/mip-233-login/README.md +++ b/mip-233-login/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-login/mip-233-login.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-login/mip-233-login.js ## 示例 diff --git a/mip-233-lxkf/README.md b/mip-233-lxkf/README.md index 10d814e3..1bc6d6c5 100644 --- a/mip-233-lxkf/README.md +++ b/mip-233-lxkf/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-lxkf/mip-233-lxkf.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-lxkf/mip-233-lxkf.js ## 示例 diff --git a/mip-233-newsmore/README.md b/mip-233-newsmore/README.md index e3b0ea7f..3988d9e8 100644 --- a/mip-233-newsmore/README.md +++ b/mip-233-newsmore/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-newsmore/mip-233-newsmore.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-newsmore/mip-233-newsmore.js ## 示例 diff --git a/mip-233-slider/README.md b/mip-233-slider/README.md index 6e2f131b..736248ec 100644 --- a/mip-233-slider/README.md +++ b/mip-233-slider/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-slider/mip-233-slider.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-slider/mip-233-slider.js ## 示例 diff --git a/mip-233-tongji/README.md b/mip-233-tongji/README.md index 4cf5af62..6b42a851 100644 --- a/mip-233-tongji/README.md +++ b/mip-233-tongji/README.md @@ -6,7 +6,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-contact/mip-233-cnzz.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-contact/mip-233-cnzz.js ## 示例 diff --git a/mip-233-up2now/README.md b/mip-233-up2now/README.md index cb2c036f..0d72aeb1 100644 --- a/mip-233-up2now/README.md +++ b/mip-233-up2now/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-up2now/mip-233-up2now.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-up2now/mip-233-up2now.js ## 示例 diff --git a/mip-233-yytx/README.md b/mip-233-yytx/README.md index 1647998e..3d1d4b51 100644 --- a/mip-233-yytx/README.md +++ b/mip-233-yytx/README.md @@ -7,7 +7,7 @@ ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-233-yytx/mip-233-yytx.js +所需脚本|https://c.mipcdn.com/static/v1/mip-233-yytx/mip-233-yytx.js ## 示例 diff --git a/mip-25game-gradient/README.md b/mip-25game-gradient/README.md index 26c908be..4c5b3826 100644 --- a/mip-25game-gradient/README.md +++ b/mip-25game-gradient/README.md @@ -6,7 +6,7 @@ ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-25game-gradient/mip-25game-gradient.js +所需脚本|https://c.mipcdn.com/static/v1/mip-25game-gradient/mip-25game-gradient.js ## 示例 diff --git a/mip-25game-openapp/README.md b/mip-25game-openapp/README.md index 59097143..ebc0d51f 100644 --- a/mip-25game-openapp/README.md +++ b/mip-25game-openapp/README.md @@ -6,7 +6,7 @@ ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-25game-openApp/mip-25game-openapp.js +所需脚本|https://c.mipcdn.com/static/v1/mip-25game-openApp/mip-25game-openapp.js ## 示例 diff --git a/mip-25game-progressbar/README.md b/mip-25game-progressbar/README.md index 0b3c1242..ba43fcdf 100644 --- a/mip-25game-progressbar/README.md +++ b/mip-25game-progressbar/README.md @@ -6,7 +6,7 @@ mip-25game-progressbar 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-25game-progressbar/mip-25game-progressbar.js +所需脚本|https://c.mipcdn.com/static/v1/mip-25game-progressbar/mip-25game-progressbar.js ## 示例 diff --git a/mip-25game-star/README.md b/mip-25game-star/README.md index 3b34b0c5..357139f1 100644 --- a/mip-25game-star/README.md +++ b/mip-25game-star/README.md @@ -6,7 +6,7 @@ mip-25game-star 显示评星 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-25game-star/mip-25game-star.js +所需脚本|https://c.mipcdn.com/static/v1/mip-25game-star/mip-25game-star.js ## 示例 diff --git a/mip-25game-tabsplit/README.md b/mip-25game-tabsplit/README.md index d5ecd82f..5bf45f1e 100644 --- a/mip-25game-tabsplit/README.md +++ b/mip-25game-tabsplit/README.md @@ -6,7 +6,7 @@ mip-25game-tabsplit 把字符串分割成html标签 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-25game-tabSplit/mip-25game-tabSplit.js +所需脚本|https://c.mipcdn.com/static/v1/mip-25game-tabSplit/mip-25game-tabSplit.js ## 示例 diff --git a/mip-360doc-script/README.md b/mip-360doc-script/README.md new file mode 100644 index 00000000..602171b5 --- /dev/null +++ b/mip-360doc-script/README.md @@ -0,0 +1,17 @@ +# mip-360doc-script + +mip-360doc-script 是360doc网业务逻辑组件。 + +标题|内容 +----|---- +类型|业务,广告 +支持布局|N/S +所需脚本|https://c.mipcdn.com/static/v1/mip-360doc-script/mip-360doc-script.js + +## 示例 + +### 基本使用 + +```html + +``` diff --git a/mip-360doc-script/mip-360doc-script.js b/mip-360doc-script/mip-360doc-script.js new file mode 100644 index 00000000..b28889ea --- /dev/null +++ b/mip-360doc-script/mip-360doc-script.js @@ -0,0 +1,203 @@ +/** + * @file 360doc 自定义逻辑组件 + * @author www.360doc.com技术部 + */ +define(function (require) { + var $ = require('zepto'); + var customElem = require('customElement').create(); + // build 方法,元素插入到文档时执行,仅会执行一次 + customElem.prototype.build = function () { + if ($('.mip-360doc-script-wxggalink') !== null) { + $('.mip-360doc-script-wxggalink').html(''); + var picn = $('.mip-360doc-script-pic').length; + if (picn > 1) { + $('.mip-360doc-script-pic').eq(0).css('display', 'inline').siblings('.mip-360doc-script-pic').hide(); + } + $('.mip-360doc-script-box960').css('display', ''); + setone(); + } + getRefNum();// 鲜花 + // 统计 + record(); + // 检测广告 + var t = setTimeout(function () { + check(); + clearTimeout(t); + }, 10000); + if ($('.mip-360doc-script-plg2') !== null) { + $('.mip-360doc-script-plg2').on('click', function (event) { + sendlog('Componentclick?id=1'); + }); + } + if ($('.mip-360doc-script-p_header_sc') !== null) { + $('.mip-360doc-script-p_header_sc').on('click', function (event) { + sendlog('Componentclick?id=2'); + }); + } + if ($('.mip-360doc-scropt-plzs') !== null) { + $('.mip-360doc-scropt-plzs').on('click', function (event) { + sendlog('Componentclick?id=4'); + }); + } + if ($('.mip-360doc-script-gz1') !== null) { + $('.mip-360doc-script-gz1').on('click', function (event) { + sendlog('Componentclick?id=5'); + }); + } + if ($('.mip-360doc-script-xh1') !== null) { + $('.mip-360doc-script-xh1').on('click', function (event) { + sendlog('Componentclick?id=6'); + }); + } + if ($('.mip-360doc-script-reflectionurl') !== null) { + $('.mip-360doc-script-reflectionurl').on('click', function (event) { + sendlog('Componentclick?id=7'); + }); + } + if ($('.mip-360doc-script-p_footer_sc') !== null) { + $('.mip-360doc-script-p_footer_sc').on('click', function (event) { + sendlog('Componentclick?id=8'); + }); + } + getBlockArt(); + if ($('.mip-360doc-script-keyword') !== null) { + parseSearchWord(); + } + }; + function check() { + var deny1 = true; + var deny2 = true; + var node; + if ($('.like_content') && $('.like_content').eq(0)) { + node = document.getElementsByClassName('like_content')[0]; + if (node.getElementsByTagName('iframe') && node.getElementsByTagName('iframe')[0] + && node.getElementsByTagName('iframe')[0].src + && (node.getElementsByTagName('iframe')[0].src.indexOf('baidu.com') > 0 + || node.getElementsByTagName('iframe')[0].src.indexOf('360doc.cn') > 0)) { + deny1 = false; + } + } + + if ($('.like_content') && $('.like_content').eq(1)) { + node = document.getElementsByClassName('like_content')[1]; + if (node.getElementsByTagName('iframe') && node.getElementsByTagName('iframe')[0] + && node.getElementsByTagName('iframe')[0].src + && (node.getElementsByTagName('iframe')[0].src.indexOf('baidu.com') > 0 + || node.getElementsByTagName('iframe')[0].src.indexOf('360doc.cn') > 0)) { + deny2 = false; + } + } + if (deny1) { + sendlog('mipads/iframe_likecontent'); + } + if (deny2) { + sendlog('mipads/iframe_service'); + } + } + function record() { + try { + var domain = document.domain; + sendlog('mipConn?domain=_' + encodeURI(domain) + '_&aid=' + getID()); + } + catch (e) { } + } + function sendlog(url) { + var img = new Image(); + var key = 'broswerlog_' + Math.floor(Math.random() * 2147483648).toString(36); + window[key] = img; + img.onload = img.onerror = img.onabort = function () { + img.onload = img.onerror = img.onabort = null; + window[key] = null; + img = null; + }; + img.src = 'https://mipeclick.360doc.com/' + url; + } + // 广告轮播 + function setone() { + var t = setTimeout(function () { + show(1); + clearTimeout(t); + settwo(); + }, 3000); + } + // 广告轮播 + function settwo() { + var t = setTimeout(function () { + show(0); + clearTimeout(t); + setone(); + }, 4000); + } + function show(index) { + $('.mip-360doc-script-pic').eq(index).css('display', 'inline') + .siblings('.mip-360doc-script-pic').css('display', 'none'); + } + // 获取评论数 + function getRefNum() { + var artid = getID(); + if (artid === '') { + return; + } + $.ajax({ + type: 'POST', + url: 'https://transfer.360doc.cn/ajax/Handler.ashx', + data: 'id=' + artid, + success: function (data) { + var useridref = data.split('|'); + if (useridref[1] !== null && useridref[1] !== '') { + $('.mip-360doc-script-refnum').html(useridref[1]); + } + else { + $('.mip-360doc-script-refnum').html('0'); + } + $('.mip-360doc-script-xh1').html('献花(' + useridref[3] + ')'); + }, + error: function () { } + }); + } + // 不显示已被删除的文章 + function getBlockArt() { + var fetchJsonp = require('fetch-jsonp'); + fetchJsonp('https://blockart.360doc.com/ajax/getstatusmip.ashx?aid=' + getID(), { + jsonpCallback: 'callback' + }).then(function (response) { + return response.json(); + }).then(function (data) { + if (data.result === 1) { + $('.mip-360doc-script-tit').html(''); + $('.mip-360doc-script-con').html('对不起,该文章已被删除!'); + } + }); + } + // 获取文章id + function getID() { + var artid = $('.mip-360doc-script-saveid').html(); + return artid; + } + // 获取搜索词 + function parseSearchWord() { + try { + var url = ''; + var keyword = ''; + var index = -1; + var index2 = -1; + if (document.referrer) { + url = document.referrer; + } + if (url.length > 0 && url.indexOf('//m.baidu.com') >= 0) { + index = url.indexOf('word='); + if (index > 0) { + index2 = url.indexOf('&', index); + } + if (index2 > 0) { + keyword = url.substring(index + 5, index2); + if (keyword.length > 0) { + $('.mip-360doc-script-keyword').val(decodeURI(keyword)); + } + } + } + } + catch (e) { } + } + return customElem; +}); diff --git a/mip-360doc-script/package.json b/mip-360doc-script/package.json new file mode 100644 index 00000000..d9120f75 --- /dev/null +++ b/mip-360doc-script/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-360doc-script", + "version": "1.1.3", + "author": { + "name": "360doc", + "email": "caizhi@360doc.com", + "url": "https://www.mipengine.org" + }, + "engines": { + "mip": ">=1.1.3" + } +} \ No newline at end of file diff --git a/mip-360docad-script/README.md b/mip-360docad-script/README.md index 7efd6ac5..8f2dd94c 100644 --- a/mip-360docad-script/README.md +++ b/mip-360docad-script/README.md @@ -6,7 +6,7 @@ mip-360docad-script 是360doc网业务逻辑组件。 ----|---- 类型|业务,广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-360docad-script/mip-360docad-script.js +所需脚本|https://c.mipcdn.com/static/v1/mip-360docad-script/mip-360docad-script.js ## 示例 diff --git a/mip-365-addask/README.md b/mip-365-addask/README.md index 8a6645cf..d224a6f2 100644 --- a/mip-365-addask/README.md +++ b/mip-365-addask/README.md @@ -6,7 +6,7 @@ mip-365-addask 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-365-addask/mip-365-addask.js +所需脚本|https://c.mipcdn.com/static/v1/mip-365-addask/mip-365-addask.js ## 示例 diff --git a/mip-365xiazai-header/README.md b/mip-365xiazai-header/README.md index e8a4338a..34825462 100644 --- a/mip-365xiazai-header/README.md +++ b/mip-365xiazai-header/README.md @@ -7,7 +7,7 @@ ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-365xiazai-btn/mip-365xiazai-header.js +所需脚本|https://c.mipcdn.com/static/v1/mip-365xiazai-btn/mip-365xiazai-header.js ## 示例 diff --git a/mip-365xiazai-tabtap/README.md b/mip-365xiazai-tabtap/README.md index ea377a3a..ed9a9a8c 100644 --- a/mip-365xiazai-tabtap/README.md +++ b/mip-365xiazai-tabtap/README.md @@ -7,7 +7,7 @@ ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-365xiazai-btn/mip-365xiazai-tabtap.js +所需脚本|https://c.mipcdn.com/static/v1/mip-365xiazai-btn/mip-365xiazai-tabtap.js ## 示例 diff --git a/mip-3727-pagination/README.md b/mip-3727-pagination/README.md new file mode 100644 index 00000000..3952bfa5 --- /dev/null +++ b/mip-3727-pagination/README.md @@ -0,0 +1,67 @@ +# mip-3727-pagination + + mip-3727-pagination 图片模拟分页 + +标题|内容 +----|---- +类型|定制 +支持布局| N/S +所需脚本|https://c.mipcdn.com/static/v1/mip-3727-pagination/mip-3727-pagination.js + +## 示例 + +### 模拟分页 + +``` + +
+

+ +

+

+ +

+

+ +

+

+ +

+

+ +

+

+ +

+
+
+

+ +

+

+ +

+
+ +
+

+ 上一页 + 1 2 下一页 +

+
+ +
+``` + + diff --git a/mip-3727-pagination/mip-3727-pagination.css b/mip-3727-pagination/mip-3727-pagination.css new file mode 100644 index 00000000..b75d06d4 --- /dev/null +++ b/mip-3727-pagination/mip-3727-pagination.css @@ -0,0 +1,2 @@ +.mip_hide { display:none;} +.mip_show{display:block!important} \ No newline at end of file diff --git a/mip-3727-pagination/mip-3727-pagination.js b/mip-3727-pagination/mip-3727-pagination.js new file mode 100644 index 00000000..a40cede6 --- /dev/null +++ b/mip-3727-pagination/mip-3727-pagination.js @@ -0,0 +1,113 @@ +/** +* page switch +* @file Analog paging +* @author wztgzn@126.com +* @version 1.0 +* @copyright 2016 yiaiddd, Inc. All Rights Reserved +*/ +define(function (require) { + var $ = require('zepto'); + var customElem = require('customElement').create(); + function htmlpage() { + var $span = $('.ub_page'); + $span.on('click', 'span', function () { + var $void = $(this).attr('data-void'); + if ($void === '1') { + var html = ''; + var $page = $(this).attr('data-page'); + var page = parseInt($page, 0); + var len = $('.list_content').length; + html = createpage(page, len, html); + $('.ub_page').html(html); + $('.list_content').eq(($page - 1)).addClass('mip_show').siblings().removeClass('mip_show'); + } + }); + } + function createpage(page, len, html) { + if (page === 1) { + html += ''; + html += '上一页'; + } + else { + html += '上一页'; + } + html = createmiddlepage(page, len, html); + if (page === len) { + html += ''; + html += '下一页'; + } + else { + html += '下一页'; + } + return html; + } + function createmiddlepage(page, len, html) { + var begin; + var end; + if (len < 5) { + begin = 1; + end = len; + for (var i = begin; i <= end; i++) { + if (i === page) { + html += ''; + html += i + ''; + } + else { + html += ' ' + i + ' '; + } + } + } + else { + if (page + 2 > len) { + begin = len - 5; + end = len; + for (var j = begin; j <= end; j++) { + if (j === page) { + html += ''; + html += j + ''; + } + else { + html += '' + j + ''; + } + } + } + else if (page - 2 <= 0) { + begin = 1; + end = 5; + for (var k = begin; k <= end; k++) { + if (k === page) { + html += ''; + html += k + ''; + } + else { + html += '' + k + ''; + } + } + } + else { + begin = page - 2; + end = page + 2; + for (var g = begin; g <= end; g++) { + if (g === page) { + html += ''; + html += g + ''; + } + else { + html += '' + g + ''; + } + } + } + } + return html; + } + customElem.prototype.firstInviewCallback = function () { + htmlpage(); + }; + return customElem; +}); diff --git a/mip-3727-pagination/package.json b/mip-3727-pagination/package.json new file mode 100644 index 00000000..1cfc9ef3 --- /dev/null +++ b/mip-3727-pagination/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-3727-pagination", + "version": "1.1.0", + "author": { + "name": "3727", + "email": "wztgzn@126.com", + "url": "http://aa.3727.cc/" + }, + "engines": { + "mip": ">=1.1.0" + } +} \ No newline at end of file diff --git a/mip-39ad/README.md b/mip-39ad/README.md new file mode 100644 index 00000000..f87ee086 --- /dev/null +++ b/mip-39ad/README.md @@ -0,0 +1,27 @@ +# mip-39ad + +39广告组件 + +描述|提供了一个广告容器用来显示39广告 +----|---- +类型|广告 +支持布局| N/S +所需脚本|https://c.mipcdn.com/static/v1/mip-39ad/mip-39ad.js + +## 示例 + +只需要一个``标签,无须其他填充dom + +``` + +``` + +## 属性 + +### asid + +说明:广告id +必填:是 +格式:数字 +取值:4位 + diff --git a/mip-39ad/mip-39ad.js b/mip-39ad/mip-39ad.js new file mode 100644 index 00000000..7a17d44f --- /dev/null +++ b/mip-39ad/mip-39ad.js @@ -0,0 +1,833 @@ +/** + * @file 39net添加广告 + * @author www.39.net技术部 + */ +// 定义了广告的通用模块 +define(function (require) { + // var customElem = require('customElement'); + // 定义广告的全局变量 + window.MIP39GlobNode = {}; + var customElem = require('customElement').create(); + var ks = function (asid) { + var g; + var d; + (function () { + // 自执行引导函数 + typeof MIP39GlobNode.ack !== 'undefined' ? d = MIP39GlobNode.ack : (d = MIP39GlobNode.ack = function (a) { + var constructor = d.prototype.init; + return new constructor(a); + } + , + typeof MIP39GlobNode.ackInfoWare === 'undefined' && (MIP39GlobNode.ackInfoWare = {}), + g = MIP39GlobNode.ackInfoWare, + // 继承的钩子函数 + d.extend = function (a, b, c) { + c && d.extend(a, c); + for (var f in b) { + if (b.hasOwnProperty(f)) { + b.hasOwnProperty(f) && (a[f] = b[f]); + } + } + return a; + } + , + // 继承的工具方法 + d.extend(d, { + ready: function () { + d.isReady = 1; + }, + idle: [1, 1], + getProtocol: function () { + return location.protocol + '//'; + }, + joinParameters: function (a, b) { + var c = []; + if (b === ',') { + for (var d in a) { + if (a.hasOwnProperty(d)) { + a.hasOwnProperty(d) && Array.prototype.push.call(c, a[d]); + } + } + } + else if (b === '&') { + for (var e in a) { + if (a.hasOwnProperty(e)) { + a.hasOwnProperty(e) && Array.prototype.push.call(c, e + '=' + a[e]); + } + } + } + return c.join(b); + }, + createCacheBuster: function () { + return Math.ceil(Math.random() * 1E10); + }, + getCookieEnabled: function () { + return navigator.cookieEnabled ? 1 : 0; + }, + getPreviousUrl: function () { + var a = ''; + try { + a = top.document.referrer; + } catch (b) { + try { + a = document.referrer; + } catch (c) {} + } + return encodeURIComponent(a); + }, + getCurrentUrl: function () { + var a = ''; + try { + a = top.document.location; + } catch (b) { + try { + a = document.location; + } catch (c) {} + } + return encodeURIComponent(a); + }, + getDomain: function (a) { + var b = ''; + var c = ''; + var d = /[0-9a-z\-]+\.com\.cn$|[0-9a-z\-]+\.edu\.cn$|[0-9a-z\-]+\.gov\.cn$|[0-9a-z\-]/ + + /\.net\.cn$|[0-9a-z\-]+\.org\.cn$|[0-9a-z\-]+\.mil\.cn$|[0-9a-z\-]+\.cn$|[0-9a-z\-]/ + + /\.com$|[0-9a-z\-]+\.net$|[0-9a-z\-]+\.org$|[0-9a-z\-]+\.edu$|[0-9a-z\-]/ + + /\.gov$|[0-9a-z\-]+\.cc$|[0-9a-z\-]+\.info/; + (a = /\/\/([0-9a-z\-\.]+)/.exec(a)) && (b = a[1]); + b && (a = d.exec(b)) && (c = a[0]); + return c ? c : b; + }, + isSameDomain: function (a, b) { + var c = d.getDomain(a); + var f = d.getDomain(b); + return c && f && c === f ? !0 : !1; + }, + load: function (a, b, c, f) { + var e; + var l = /loaded|complete/i; + var j = 'ac_js86_$' + d.createCacheBuster(); + if (b === null) { + l = /complete/i; + MIP39GlobNode.s2 = document.createElement('script'); + MIP39GlobNode.s2.type = 'text/javascript'; + MIP39GlobNode.s2.src = a; + MIP39GlobNode.s2.id = j; + document.getElementById('ads_' + asid).parentNode.appendChild(MIP39GlobNode.s2); + } else { + e = document.createElement('script'); + e.type = 'text/javascript'; + e.async = 1; + e.id = j; + e.src = a; + document.getElementsByTagName('head')[0].appendChild(e); + } + if (e = d.$(j)) { + e.onload = e.onreadystatechange = function () { + if (!e.readyState || e.readyState.match(l)) { + if (typeof c === 'function' && (c(), + c = null), + e && e.parentNode) { + e.onload = e.onreadystatechange = null, + e.parentNode.removeChild(e), + e = null; + } + } + }; + } + f && setTimeout(function () { + if (e) { + typeof c === 'function' && (c(), + c = null), + e.src = 'javascript:void(0)'; + } + }, f); + }, + send: function (a, b) { + var c; + b ? (c = document.createElement('img'), + c.style.display = 'none') : (c = document.createElement('script'), + c.type = 'text/javascript', + c.async = !0); + document.body.insertBefore(c, document.body.firstChild); + c.src = a + (a.indexOf('?') > 0 ? '&cb=' : '?cb=') + Math.ceil(Math.random() * 1E9); + }, + $: function (a) { + return typeof a === 'string' ? document.getElementById(a) : a; + }, + cookie: function (a, b, c) { + if (typeof b !== 'undefined') { + if (b === null) { + b = '', + c = c || {}, + c.expires = -1; + } + a = a + '=' + b; + c && (c.expires && (a += ';expires=' + c.expires.toUTCString()), + c.path && (a += ';path=' + c.path), + c.domain && (a += ';domain=' + c.domain), + c.secure && (a += ';secure')); + document.cookie = a; + } else { + return RegExp(';?' + a + '=([^;]*);?').test(document.cookie) + ? decodeURIComponent(RegExp.$1) : null; + } + }, + ga: function (a, b) { + typeof MIP39GlobNode.ackInfoWare === 'undefined' && (MIP39GlobNode.ackInfoWare = {}); + typeof MIP39GlobNode.ackInfoWare[a] === 'undefined' && (MIP39GlobNode.ackInfoWare[a] = {}); + typeof b !== 'undefined' && (MIP39GlobNode.ackInfoWare[a].mid = b); + typeof MIP39GlobNode.ackInfoWare[a].mid === 'undefined' && (MIP39GlobNode.ackInfoWare[a].mid = -1); + return MIP39GlobNode.ackInfoWare[a].mid; + }, + gak: function (a, b, c) { + typeof MIP39GlobNode.ackInfoWare === 'undefined' && (MIP39GlobNode.ackInfoWare = {}); + typeof MIP39GlobNode.ackInfoWare[a] === 'undefined' && (MIP39GlobNode.ackInfoWare[a] = {}); + typeof c !== 'undefined' && (MIP39GlobNode.ackInfoWare[a][b] = c); + return MIP39GlobNode.ackInfoWare[a][b]; + }, + gas: function (a, b) { + var c = function (a, b) { + for (var c = 0, e; e = b[c]; ++c) { + var f = d.gak(e, 'imids'); + var h = d.gak(e, 'mid'); + h && a !== h && (f ? f.indexOf(h) === -1 && d.gak(e, 'imids', [f, h].join(',')) : d.gak(e, 'imids', h + '')); + d.gak(e, 'mid', a); + } + } + ; + arguments.length === 1 && (b = 0); + for (var f = 0, e = a.length; f < e; f++) { + if (a[f].length) { + if (f === b) { + c(a[f][0], a[f].slice(1)); + } + else if (f !== b) { + var l = {}; + var j = a[f][0]; + var h = a[f].slice(1); + l[j] = h; + d.igas(l); + } + } + } + }, + igas: function (a) { + for (var b in a) { + for (var c = a[b], f = 0, e = c.length; f < e; f++) { + var l = c[f]; + var j = d.gak(l, 'imids'); + j && j.indexOf(b) === -1 ? j += ',' + b : j = b + ''; + d.gak(l, 'imids', j); + } + } + }, + rcid: function (a) { + if (!d._pcids) { + d._pcids = []; + } + d._pcids.push(a); + }, + reload: function (a, b, c, f, e, l, j) { + if (arguments.length === 1 && MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare['$tag_' + a]) { + return MIP39GlobNode.ackInfoWare[a].async = 1, + MIP39GlobNode.ackInfoWare['$tag_' + a].g(), + !1; + } + var f = f || 0; + var e = e || 0; + var l = l || 0; + var j = j || 1; + var h = null; + var g = null; + var m = null; + var g = null; + var k = ''; + var n = !1; + if (!f && MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare[' ' + a]) { + MIP39GlobNode.ackInfoWare[a].async = 1, + setTimeout(function () { + MIP39GlobNode.ackInfoWare['$tag_' + a].g(); + }, b * 1E3); + } + if (f && MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare['$tag_' + a] + && (MIP39GlobNode.ackInfoWare[a].async = 1, + g = MIP39GlobNode.ackInfoWare['$tag_' + a], + k = g.info('destid'), + g = d.$('ac_js86_' + a), + k && d.$(k) ? (m = d.$(k), + n = !0) : g && g.parentNode && (d.$('vs_anch_' + a) ? m = d.$('vs_anch_' + a) : (m = d.element('div', { + id: 'vs_anch_' + a + }, { + border: 'none', + background: 'none', + margin: 0, + padding: 0, + fontSize: 0, + height: '1px', + width: '1px', + position: 'absolute' + }), + g.parentNode.insertBefore(m, g)), + n = !0), + n)) { + d['vs_' + a] ? h = d['vs_' + a] : (h = d['vs_' + a] = {}, + h.t = null, + h.starttm = function () { + if (h.t === null) { + h.t = setTimeout(function () { + MIP39GlobNode.ackInfoWare['$tag_' + a].g(); + h.stoptm(); + }, b * 1E3); + } + } + , + h.stoptm = function () { + if (h.t) { + clearTimeout(h.t), + h.t = null; + } + if (h.interval) { + clearTimeout(h.interval), + h.interval = null; + } + } + ); + h.stoptm(); + h.interval = setTimeout(function () { + var a = null; + var a = !0; + var b = 0; + var c = 0; + var f = 0; + var g = 0; + document.hasFocus && (a = document.hasFocus()); + a ? j ? (f = d.getClient('height'), + g = d.getClient('width'), + m.getBoundingClientRect && (a = m.getBoundingClientRect(), + b = a.top - (document.documentElement.clientLeft || document.body.clientLeft || 0), + c = a.left - (document.documentElement.clientTop || document.body.clientTop || 0)), + b > -l && b < f && c > -e && c < g ? h.starttm() : h.stoptm()) : h.starttm() : h.stoptm(); + h.interval = setTimeout(arguments.callee, 1E3); + }, 1E3); + } + c === 0 && setTimeout(function () { + location.reload(); + }, b * 1E3); + }, + vmap: function (a) { + var b = new Date; + b.setFullYear(b.getFullYear() + 1); + d.cookie('acaspvid', a.acvid, { + expires: b, + path: '/', + domain: location.host + }); + }, + element: function (a, b, c, f) { + a = document.createElement(a); + if (b) { + for (var e in b) { + a.setAttribute(e, b[e]); + } + } + c && d.css(a, c); + if (f) { + a.innerHTML = f; + } + return a; + }, + css: function (a, b) { + var c = d.$(a); + if (typeof b === 'string') { + if (c.currentStyle) { + return c.currentStyle[b]; + } + if (getComputedStyle) { + return document.defaultView.getComputedStyle(c, null)[b]; + } + } else if (typeof b === 'object') { + for (var f in b) { + c.style[f] = b[f]; + } + } + }, + getClient: function (a) { + a = a.charAt(0).toUpperCase() + a.substr(1).toLowerCase(); + return document.compatMode === 'BackCompat' ? document.body['client' + a] : document.documentElement['client' + a]; + }, + getScroll: function (a) { + a = a.charAt(0).toUpperCase() + a.substr(1).toLowerCase(); + return document.documentElement['scroll' + a] || document.body['scroll' + a]; + }, + getPosition: function (a) { + var a = d.$(a); + var b = { + left: 0, + top: 0 + }; + if (a.getBoundingClientRect) { + b.left = Math.round(a.getBoundingClientRect().left + d.getScroll('left') - (document.documentElement.clientLeft || document.body.clientLeft || 0)); + b.top = Math.round(a.getBoundingClientRect().top + d.getScroll('top') - (document.documentElement.clientTop || document.body.clientTop || 0)); + } + return b; + }, + getCurrentScript: function () { + var a = { + script: null, + last: !1 + }; + var b; + if (document.currentScript) { + a.script = document.currentScript; + } + else { + b = document.getElementsByTagName('script'); + if (/msie \d/i.test(navigator.userAgent)) { + for (var i = b.length - 1; i >= 0; i--) { + if (b[i].readyState === 'interactive') { + a.script = b[i]; + break; + } + } + } + if (!a.script) { + a.script = b[b.length - 1]; + a.last = !0; + } + } + return a; + }, + isFirstScreen: function (a, b, c) { + var f = 0; + var e = d.getClient('height'); + var g = 0; + var j = d.$('ac_js86_' + a); + var h = null; + if (b && d.$(b)) { + g = d.getPosition(b).top; + } + else if (c) { + g = c[0]; + } + else if (j) { + h = d.element('div', { + id: 'vs_anch_' + a + }, { + border: 'none', + background: 'none', + margin: 0, + padding: 0, + fontSize: 0, + height: '1px', + width: '1px', + position: 'absolute' + }), + j.parentNode.insertBefore(h, j), + g = d.getPosition(h).top, + h.parentNode.removeChild(h); + } + e && (f = Math.ceil(g / e)); + return f; + }, + ssp: function (a) { + var c = a.aid; + var f = a.vid; + var e = a.pf; + var g = a.dAd ? a.dAd : null; + var j = a.js ? a.js : 'http://static.acs86.com/csp.js'; + var h = a.sburl ? a.sburl : ''; + var o = a.ext ? a.ext : null; + var m = a.ssct ? a.ssct : ''; + var k = a.sdct ? a.sdct : ''; + var b = MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare[c] && MIP39GlobNode.ackInfoWare[c].async ? 1 : 0; + b === 0 ? (MIP39GlobNode.acSspId = c, + MIP39GlobNode.acSspVisitorId = f, + MIP39GlobNode.acSspPlatform = e, + MIP39GlobNode.acSspAsync = b, + MIP39GlobNode.acSspDefaultAd = g, + MIP39GlobNode.acSspAdTrack = m, + MIP39GlobNode.acSspDefaultAdTrack = k, + a.sburl && (MIP39GlobNode.acSspServerBaseUrl = h), + a.ext && (MIP39GlobNode.acSspExt = o), + MIP39GlobNode.s3 = document.createElement('script'), MIP39GlobNode.s3.type='text/javascript', MIP39GlobNode.s3.src = j, + document.getElementById('ads_' + asid).parentNode.appendChild(MIP39GlobNode.s3)) : d.load(j, 1, function () { + var d = { + aid: c, + vid: f, + pf: e, + async: b, + dAd: g, + ssct: m, + sdct: k + }; + if (a.sburl) { + d.serverbaseurl = h; + } + if (a.ext) { + d.ext = o; + } + MIP39GlobNode.acCSP(d); + }); + }, + megax: function (a) { + var b = 0; + var c = a.oid; + var f = a.aid; + var e = a.dAd ? a.dAd : null; + var g = a.js ? a.js : 'http://static.mlt01.com/b.js'; + var j = a.sburl ? a.sburl : ''; + var h = a.cburl ? a.cburl : ''; + var o = a.ext ? a.ext : null; + var m = a.ssct ? a.ssct : ''; + var a = a.sdct ? a.sdct : ''; + var k; + if (MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare[c]) { + if (c = MIP39GlobNode.ackInfoWare[c], + c.async && (b = 1), + c.destid) { + k = c.destid; + } + } else { + b = 0; + } + if (b === 0) { + MIP39GlobNode.mxAsId = f; + MIP39GlobNode.mxAsync = b; + MIP39GlobNode.mxDefaultAd = MIP39GlobNode.e; + MIP39GlobNode.mxAdTrack = m; + MIP39GlobNode.mxDefaultAdTrack = a; + j && (MIP39GlobNode.mxServerBaseUrl = j); + h && (MIP39GlobNode.mxStaticBaseUrl = h); + o && (MIP39GlobNode.mxExternal = o); + k && (MIP39GlobNode.mxDestId = k); + MIP39GlobNode.s4 = document.createElement('script'); + MIP39GlobNode.s4.type = 'text/javascript'; + MIP39GlobNode.s4.src = g; + document.getElementById('ads_' + asid).parentNode.appendChild(MIP39GlobNode.s4); + } + else { + var n = { + aid: f, + async: b, + dAd: e, + ssct: m, + sdct: a + }; + if (j) { + n.serverbaseurl = j; + } + if (h) { + n.staticbaseurl = h; + } + if (o) { + n.ex = o; + } + if (k) { + n.destid = k; + } + MIP39GlobNode.mxB ? MIP39GlobNode.mxB(n) : d.load(g, 1, function () { + MIP39GlobNode.mxB(n); + }); + } + } + }), + // 广告单例的具体实体化类 + d.prototype = { + init: function (a) { + if (a && (a.aids || a.aid)) { + if (a.aids) { + for (var b = 0, c; c = a.aids[b]; ++b) { + g[c] ? g[c].rl = 0 : g[c] = { + rl: 0 + }; + } + } + var f = 'ac_js86_' + a.aid; + (function () { + var b = d.getCurrentScript(); + var b = b.last; + if (!d.$(f)) { + var s5 = document.createElement('ins'); + s5.id = f, s5.style = 'display:none;'; + if (b && !a.async + && (document.getElementById('ads_' + a.aid).parentNode.appendChild(s5), d.$(f))) { + return; + } + b = document.createElement('ins'); + b.style.display = 'none'; + b.id = f; + document.getElementById('ads_' + a.aid).parentNode.appendChild(b); + } + })(); + this.timestamp = (new Date()).getTime(); + this.aid = a.aid; + g[this.aid] ? d.extend(g[this.aid], a) : g[this.aid] = a; + g['$tag_' + this.aid] = this; + this.info('mode') === 1 && (this.info('rl') === 0 ? (this.info('rl', 1), + g.otlads && g.otlads[this.aid] && (g.otlads[this.aid](), + g.otlads[this.aid] = null)) : this.g()); + } + }, + jsv: 7, + info: function (a, b) { + typeof g === 'undefined' && (g = {}); + g[this.aid] || (g[this.aid] = {}); + typeof b !== 'undefined' && (b === null ? delete g[this.aid][a] : g[this.aid][a] = b); + return g[this.aid][a]; + }, + // 获得业务参数方法 + getParameters: function () { + var a = ''; + var b = ''; + var c = ''; + var f = !1; + var e = this.info('pv') || 1; + var a = this.info('mid') === void 0 ? -1 : this.info('mid'); + var b = this.info('imids') === void 0 ? 0 : this.info('imids'); + var c = d.joinParameters({ + aid: String(this.info('aid')).substr(1,parseInt(String(this.info('aid')).substr(0,1))), + gid: this.info('gid') === void 0 ? 0 : this.info('gid'), + height: 0, + width: 0, + format: this.info('format') === void 0 ? 0 : this.info('format'), + mode: this.info('mode') === void 0 ? 1 : this.info('mode'), + ce: d.getCookieEnabled(), + fv: '' + }, ','); + var e = { + pv: e, + sp: c, + ec: 'utf-8', + re: [screen.width, screen.height].join(',') + }; + if (this.info('aids')) { + e.clt = this.info('aids').join(','); + } + a !== -1 && (e.mid = a); + b && (e.imids = b); + d._pcids && (e.pcids = d._pcids.join(',')); + if (this.info('gid') === 1 && typeof MIP39GlobNode.acContentTargeting !== 'undefined' && MIP39GlobNode.acContentTargeting) { + e.ct = encodeURIComponent(MIP39GlobNode.acContentTargeting); + } + if (this.info('gid') === 1 && typeof MIP39GlobNode.acContentId !== 'undefined' && MIP39GlobNode.acContentId) { + e.ctid = encodeURIComponent(MIP39GlobNode.acContentId); + } + if (this.info('sendkeywords') && this.info('gid') === 1 && typeof MIP39GlobNode.acKeywordsTargeting !== 'undefined' && MIP39GlobNode.acKeywordsTargeting) { + e.kw = encodeURIComponent(MIP39GlobNode.acKeywordsTargeting); + } + this.info('ex') && d.extend(e, this.info('ex')); + if (this.info('sendreferer') === 1) { + a = d.cookie('asp_furl'); + b = d.getPreviousUrl(); + c = d.getCurrentUrl(); + if (a) { + b && !d.isSameDomain(decodeURIComponent(b), decodeURIComponent(c)) + && !d.isSameDomain(decodeURIComponent(b), a) ? (f = !0, + e.purl = b) : e.purl = encodeURIComponent(a); + } + else if (b) { + d.isSameDomain(decodeURIComponent(b), decodeURIComponent(c)) || (f = !0), + e.purl = b; + } + f && d.cookie('asp_furl', b, { + domain: d.getDomain(decodeURIComponent(c)), + path: '/' + }); + } + if (this.info('currenturl')) { + e.curl = encodeURIComponent(this.info('currenturl')); + } + e.jsv = this.jsv; + e.cb = d.createCacheBuster(); + d.seq ? d.seq += 1 : d.seq = 1; + e.seq = d.seq; + if (d.cookie('acaspvid')) { + e.vid = d.cookie('acaspvid'); + } + e.fs = d.isFirstScreen(this.aid, this.info('destid'), this.info('coors')); + if (this.info('async')) { + e.ar = 1; + } + if (this.info('ad_callback')) { + e.acb = this.info('ad_callback'); + } + return d.joinParameters(e, '&'); + }, + // 获得服务器url地址 + getServerUrl: function () { + return d.getProtocol() + this.getBaseUrl() + '20160105?' + 'ukey=' + this.aid + '&'; + }, + // 获得基础路径 + getBaseUrl: function () { + return this.info('serverbaseurl') ? this.info('serverbaseurl') : this.getLBUrl(); + }, + getLBUrl: function () { + return this.info('serverbaseurl', this.info('gid') === 1 ? 'afp.acs86.com/' : 'acs86.com/'); + }, + g: function (a, b) { + var c = this; + (new Date()).getTime(); + var f; + b || c.info('async') ? (f = function () { + d.idle[1] = 1; + } + , + function () { + d.idle[1] ? (d.idle[1] = 0, + d.load(a || c.getServerUrl() + c.getParameters(), b + || c.info('async'), f, 1E4)) : setTimeout(arguments.callee, 0); + }()) : (d.idle[0] = 0, + f = function () { + d.idle[0] = 1; + } + , + d.load(a || c.getServerUrl() + c.getParameters(), b || c.info('async'), f, 1E4)); + } + }, + d.prototype.init.prototype = d.prototype); + })(); + (function () { + typeof MIP39GlobNode.ackOTL === 'undefined' && (MIP39GlobNode.ackOTL = function () { + var a = Array.prototype.slice.call(arguments, 0); + var b = 1; + var c = ''; + var f = 0; + var e = null; + var g = null; + typeof a[a.length - 1] !== 'string' && (b = 2, + f = 1); + c = a[a.length - b]; + e = a.slice(0, -b); + for (g = e.splice(0, 16); g.length;) { + d({ + aid: 0, + aids: g, + gid: 1, + format: 0, + mode: 1, + serverbaseurl: c, + sendreferer: f + }), + g = e.splice(0, 16); + } + } + ); + })(); + (function () { + var a = { + pv: 1, + gid: 0, + format: 0, + mode: 1, + hidetime: 0, + staticbaseurl: 's.acs86.com/' + }; + // 根据具体业务条件实例化参数vo + if (typeof MIP39GlobNode.acAsId === 'number') { + a.aid = MIP39GlobNode.acAsId; + a.pv = 1; + a.sendreferer = 0; + MIP39GlobNode.acAsId = null; + } + if (typeof MIP39GlobNode.acGroupId === 'number') { + a.gid = MIP39GlobNode.acGroupId, + a.groupid = MIP39GlobNode.acGroupId, + MIP39GlobNode.acGroupId = null; + } + if (typeof MIP39GlobNode.acFormat === 'number') { + a.format = MIP39GlobNode.acFormat, + MIP39GlobNode.acFormat = null; + } + if (typeof MIP39GlobNode.acMode === 'number') { + a.mode = MIP39GlobNode.acMode, + MIP39GlobNode.acMode = null; + } + if (a.gid === 0) { + a.async = 1; + } + if (typeof MIP39GlobNode.acAsync === 'number') { + a.async = MIP39GlobNode.acAsync, + MIP39GlobNode.acAsync = null; + } + if (typeof MIP39GlobNode.acDestId !== 'undefined') { + a.destid = MIP39GlobNode.acDestId, + MIP39GlobNode.acDestId = null; + } + if (typeof MIP39GlobNode.acAnchId !== 'undefined') { + a.anchid = MIP39GlobNode.acAnchId, + MIP39GlobNode.acAnchId = null; + } + if (typeof MIP39GlobNode.acCoors !== 'undefined') { + a.coors = MIP39GlobNode.acCoors, + MIP39GlobNode.acCoors = null; + } + if (typeof MIP39GlobNode.acSendReferer !== 'undefined') { + a.sendreferer = MIP39GlobNode.acSendReferer, + MIP39GlobNode.acSendReferer = null; + } + if (typeof MIP39GlobNode.acSendKeywords !== 'undefined') { + a.sendkeywords = MIP39GlobNode.acSendKeywords, + MIP39GlobNode.acSendKeywords = null; + } + if (typeof MIP39GlobNode.acHideTime !== 'undefined') { + a.hidetime = MIP39GlobNode.acHideTime, + MIP39GlobNode.acHideTime = null; + } + if (typeof MIP39GlobNode.acCurrentUrl === 'string' && MIP39GlobNode.acCurrentUrl) { + a.currenturl = MIP39GlobNode.acCurrentUrl, + MIP39GlobNode.acCurrentUrl = null; + } + if (typeof MIP39GlobNode.acStaticBaseUrl === 'string' && MIP39GlobNode.acStaticBaseUrl) { + a.staticbaseurl = MIP39GlobNode.acStaticBaseUrl, + MIP39GlobNode.acStaticBaseUrl = null; + } + if (typeof MIP39GlobNode.acServerBaseUrl === 'string' && MIP39GlobNode.acServerBaseUrl) { + a.serverbaseurl = MIP39GlobNode.acServerBaseUrl, + MIP39GlobNode.acServerBaseUrl = null; + } + if (typeof MIP39GlobNode.acAdNone === 'function') { + a.ad_none = MIP39GlobNode.acAdNone, + MIP39GlobNode.acAdNone = null; + } + if (typeof MIP39GlobNode.acAdCallback === 'string' && MIP39GlobNode.acAdCallback) { + a.ad_callback = MIP39GlobNode.acAdCallback, + MIP39GlobNode.acAdCallback = null; + } + if (typeof MIP39GlobNode.acShowEnd === 'function') { + a.show_end = MIP39GlobNode.acShowEnd, + MIP39GlobNode.acShowEnd = null; + } + if (typeof MIP39GlobNode.acStateChange === 'function') { + a.stateChange = MIP39GlobNode.acStateChange, + MIP39GlobNode.acStateChange = null; + } + d(a); + } + )(); + }; + // build 方法,元素插入到文档时执行,仅会执行一次 + customElem.prototype.build = function () { + // this.element 可取到当前实例对应的 dom 元素 + var element2 = this.element; + var id = element2.getAttribute('asid'); + var rdStr = ''; + for (i = 0; i < 5; i++){rdStr+=String(Math.floor(Math.random()*10))}; + var rid = String(id.length) + id + rdStr; + var hideLayerId = element2.getAttribute('hide-layer-id'); + var n = require('zepto'); + var i = n(element2); + var script = [ + '']; + i.append(script.join('')); + ks(rid); + setTimeout(function () { + if (hideLayerId) { + i.find(".close").click(function () {window.document.getElementById(hideLayerId).style.display = "none";}); + } + }, 3000); + }; + return customElem; +}); + diff --git a/mip-39ad/package.json b/mip-39ad/package.json new file mode 100644 index 00000000..ace76385 --- /dev/null +++ b/mip-39ad/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-39ad", + "version": "1.1.4", + "author": { + "name": "MIP authors", + "email": "mip-support@baidu.com", + "url": "https://www.mipengine.org" + }, + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-39alimama/README.md b/mip-39alimama/README.md index a8f993b6..05204c9a 100644 --- a/mip-39alimama/README.md +++ b/mip-39alimama/README.md @@ -6,7 +6,7 @@ mip-39alimama 组件说明 ----|---- 类型|通用 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-39alimama/mip-39alimama.js +所需脚本|https://c.mipcdn.com/static/v1/mip-39alimama/mip-39alimama.js ## 示例 diff --git a/mip-39appgad/README.md b/mip-39appgad/README.md new file mode 100644 index 00000000..f1b47bd3 --- /dev/null +++ b/mip-39appgad/README.md @@ -0,0 +1,31 @@ +# mip-39appgad + +mip-39appgad 用来支持39.net相关页面的特殊客户广告显示 + +描述|提供了一个广告容器用来显示39广告 +----|---- +类型|广告 +支持布局| N/S +所需脚本|https://c.mipcdn.com/static/v1.2/mip-39appgad.js.js + +## 示例 + +```html +
+ +
+``` + +## 属性 + +### adid + +说明:广告位ID +必填:是 +格式:数字 + +### hide-layer-id + +说明:要增加关闭按钮的层的ID +必填:否 +格式:字符串 diff --git a/mip-39appgad/mip-39appgad.js b/mip-39appgad/mip-39appgad.js new file mode 100644 index 00000000..9df55640 --- /dev/null +++ b/mip-39appgad/mip-39appgad.js @@ -0,0 +1,835 @@ +var MIP39GlobNode = {}; +// 定义了广告的通用模块 +define(function (require) { + // var customElem = require('customElement'); + var customElem = require('customElement').create(); + var ks = function (asid) { + var g; + var d; + (function () { + // 自执行引导函数 + typeof MIP39GlobNode.ack !== 'undefined' ? d = MIP39GlobNode.ack : (d = MIP39GlobNode.ack = function (a) { + var constructor = d.prototype.init; + return new constructor(a); + } + , + typeof MIP39GlobNode.ackInfoWare === 'undefined' && (MIP39GlobNode.ackInfoWare = {}), + g = MIP39GlobNode.ackInfoWare, + // 继承的钩子函数 + d.extend = function (a, b, c) { + c && d.extend(a, c); + for (var f in b) { + if (b.hasOwnProperty(f)) { + b.hasOwnProperty(f) && (a[f] = b[f]); + } + } + return a; + } + , + // 继承的工具方法 + d.extend(d, { + ready: function () { + d.isReady = 1; + }, + idle: [1, 1], + getProtocol: function () { + return location.protocol + '//'; + }, + joinParameters: function (a, b) { + var c = []; + if (b === ',') { + for (var d in a) { + if (a.hasOwnProperty(d)) { + a.hasOwnProperty(d) && Array.prototype.push.call(c, a[d]); + } + } + } + else if (b === '&') { + for (var e in a) { + if (a.hasOwnProperty(e)) { + a.hasOwnProperty(e) && Array.prototype.push.call(c, e + '=' + a[e]); + } + } + } + return c.join(b); + }, + createCacheBuster: function () { + return Math.ceil(Math.random() * 1E10); + }, + getCookieEnabled: function () { + return navigator.cookieEnabled ? 1 : 0; + }, + getPreviousUrl: function () { + var a = ''; + try { + a = top.document.referrer; + } catch (b) { + try { + a = document.referrer; + } catch (c) {} + } + return encodeURIComponent(a); + }, + getCurrentUrl: function () { + var a = ''; + try { + a = top.document.location; + } catch (b) { + try { + a = document.location; + } catch (c) {} + } + return encodeURIComponent(a); + }, + getDomain: function (a) { + var b = ''; + var c = ''; + var d = /[0-9a-z\-]+\.com\.cn$|[0-9a-z\-]+\.edu\.cn$|[0-9a-z\-]+\.gov\.cn$|[0-9a-z\-]/ + + /\.net\.cn$|[0-9a-z\-]+\.org\.cn$|[0-9a-z\-]+\.mil\.cn$|[0-9a-z\-]+\.cn$|[0-9a-z\-]/ + + /\.com$|[0-9a-z\-]+\.net$|[0-9a-z\-]+\.org$|[0-9a-z\-]+\.edu$|[0-9a-z\-]/ + + /\.gov$|[0-9a-z\-]+\.cc$|[0-9a-z\-]+\.info/; + (a = /\/\/([0-9a-z\-\.]+)/.exec(a)) && (b = a[1]); + b && (a = d.exec(b)) && (c = a[0]); + return c ? c : b; + }, + isSameDomain: function (a, b) { + var c = d.getDomain(a); + var f = d.getDomain(b); + return c && f && c === f ? !0 : !1; + }, + load: function (a, b, c, f) { + var e; + var l = /loaded|complete/i; + var j = 'ac_js86_$' + d.createCacheBuster(); + if (b === null) { + l = /complete/i; + MIP39GlobNode.s2 = document.createElement('script'); + MIP39GlobNode.s2.type = 'text/javascript'; + MIP39GlobNode.s2.src = a; + MIP39GlobNode.s2.id = j; + document.getElementById('ads_' + asid).parentNode.appendChild(MIP39GlobNode.s2); + } else { + e = document.createElement('script'); + e.type = 'text/javascript'; + e.async = 1; + e.id = j; + e.src = a; + document.getElementsByTagName('head')[0].appendChild(e); + } + if (e = d.$(j)) { + e.onload = e.onreadystatechange = function () { + if (!e.readyState || e.readyState.match(l)) { + if (typeof c === 'function' && (c(), + c = null), + e && e.parentNode) { + e.onload = e.onreadystatechange = null, + e.parentNode.removeChild(e), + e = null; + } + } + }; + } + f && setTimeout(function () { + if (e) { + typeof c === 'function' && (c(), + c = null), + e.src = 'javascript:void(0)'; + } + }, f); + }, + send: function (a, b) { + var c; + b ? (c = document.createElement('img'), + c.style.display = 'none') : (c = document.createElement('script'), + c.type = 'text/javascript', + c.async = !0); + document.body.insertBefore(c, document.body.firstChild); + c.src = a + (a.indexOf('?') > 0 ? '&cb=' : '?cb=') + Math.ceil(Math.random() * 1E9); + }, + $: function (a) { + return typeof a === 'string' ? document.getElementById(a) : a; + }, + cookie: function (a, b, c) { + if (typeof b !== 'undefined') { + if (b === null) { + b = '', + c = c || {}, + c.expires = -1; + } + a = a + '=' + b; + c && (c.expires && (a += ';expires=' + c.expires.toUTCString()), + c.path && (a += ';path=' + c.path), + c.domain && (a += ';domain=' + c.domain), + c.secure && (a += ';secure')); + document.cookie = a; + } else { + return RegExp(';?' + a + '=([^;]*);?').test(document.cookie) + ? decodeURIComponent(RegExp.$1) : null; + } + }, + ga: function (a, b) { + typeof MIP39GlobNode.ackInfoWare === 'undefined' && (MIP39GlobNode.ackInfoWare = {}); + typeof MIP39GlobNode.ackInfoWare[a] === 'undefined' && (MIP39GlobNode.ackInfoWare[a] = {}); + typeof b !== 'undefined' && (MIP39GlobNode.ackInfoWare[a].mid = b); + typeof MIP39GlobNode.ackInfoWare[a].mid === 'undefined' && (MIP39GlobNode.ackInfoWare[a].mid = -1); + return MIP39GlobNode.ackInfoWare[a].mid; + }, + gak: function (a, b, c) { + typeof MIP39GlobNode.ackInfoWare === 'undefined' && (MIP39GlobNode.ackInfoWare = {}); + typeof MIP39GlobNode.ackInfoWare[a] === 'undefined' && (MIP39GlobNode.ackInfoWare[a] = {}); + typeof c !== 'undefined' && (MIP39GlobNode.ackInfoWare[a][b] = c); + return MIP39GlobNode.ackInfoWare[a][b]; + }, + gas: function (a, b) { + var c = function (a, b) { + for (var c = 0, e; e = b[c]; ++c) { + var f = d.gak(e, 'imids'); + var h = d.gak(e, 'mid'); + h && a !== h && (f ? f.indexOf(h) === -1 && d.gak(e, 'imids', [f, h].join(',')) : d.gak(e, 'imids', h + '')); + d.gak(e, 'mid', a); + } + } + ; + arguments.length === 1 && (b = 0); + for (var f = 0, e = a.length; f < e; f++) { + if (a[f].length) { + if (f === b) { + c(a[f][0], a[f].slice(1)); + } + else if (f !== b) { + var l = {}; + var j = a[f][0]; + var h = a[f].slice(1); + l[j] = h; + d.igas(l); + } + } + } + }, + igas: function (a) { + for (var b in a) { + for (var c = a[b], f = 0, e = c.length; f < e; f++) { + var l = c[f]; + var j = d.gak(l, 'imids'); + j && j.indexOf(b) === -1 ? j += ',' + b : j = b + ''; + d.gak(l, 'imids', j); + } + } + }, + rcid: function (a) { + if (!d._pcids) { + d._pcids = []; + } + d._pcids.push(a); + }, + reload: function (a, b, c, f, e, l, j) { + if (arguments.length === 1 && MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare['$tag_' + a]) { + return MIP39GlobNode.ackInfoWare[a].async = 1, + MIP39GlobNode.ackInfoWare['$tag_' + a].g(), + !1; + } + var f = f || 0; + var e = e || 0; + var l = l || 0; + var j = j || 1; + var h = null; + var g = null; + var m = null; + var g = null; + var k = ''; + var n = !1; + if (!f && MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare[' ' + a]) { + MIP39GlobNode.ackInfoWare[a].async = 1, + setTimeout(function () { + MIP39GlobNode.ackInfoWare['$tag_' + a].g(); + }, b * 1E3); + } + if (f && MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare['$tag_' + a] + && (MIP39GlobNode.ackInfoWare[a].async = 1, + g = MIP39GlobNode.ackInfoWare['$tag_' + a], + k = g.info('destid'), + g = d.$('ac_js86_' + a), + k && d.$(k) ? (m = d.$(k), + n = !0) : g && g.parentNode && (d.$('vs_anch_' + a) ? m = d.$('vs_anch_' + a) : (m = d.element('div', { + id: 'vs_anch_' + a + }, { + border: 'none', + background: 'none', + margin: 0, + padding: 0, + fontSize: 0, + height: '1px', + width: '1px', + position: 'absolute' + }), + g.parentNode.insertBefore(m, g)), + n = !0), + n)) { + d['vs_' + a] ? h = d['vs_' + a] : (h = d['vs_' + a] = {}, + h.t = null, + h.starttm = function () { + if (h.t === null) { + h.t = setTimeout(function () { + MIP39GlobNode.ackInfoWare['$tag_' + a].g(); + h.stoptm(); + }, b * 1E3); + } + } + , + h.stoptm = function () { + if (h.t) { + clearTimeout(h.t), + h.t = null; + } + if (h.interval) { + clearTimeout(h.interval), + h.interval = null; + } + } + ); + h.stoptm(); + h.interval = setTimeout(function () { + var a = null; + var a = !0; + var b = 0; + var c = 0; + var f = 0; + var g = 0; + document.hasFocus && (a = document.hasFocus()); + a ? j ? (f = d.getClient('height'), + g = d.getClient('width'), + m.getBoundingClientRect && (a = m.getBoundingClientRect(), + b = a.top - (document.documentElement.clientLeft || document.body.clientLeft || 0), + c = a.left - (document.documentElement.clientTop || document.body.clientTop || 0)), + b > -l && b < f && c > -e && c < g ? h.starttm() : h.stoptm()) : h.starttm() : h.stoptm(); + h.interval = setTimeout(arguments.callee, 1E3); + }, 1E3); + } + c === 0 && setTimeout(function () { + location.reload(); + }, b * 1E3); + }, + vmap: function (a) { + var b = new Date; + b.setFullYear(b.getFullYear() + 1); + d.cookie('acaspvid', a.acvid, { + expires: b, + path: '/', + domain: location.host + }); + }, + element: function (a, b, c, f) { + a = document.createElement(a); + if (b) { + for (var e in b) { + a.setAttribute(e, b[e]); + } + } + c && d.css(a, c); + if (f) { + a.innerHTML = f; + } + return a; + }, + css: function (a, b) { + var c = d.$(a); + if (typeof b === 'string') { + if (c.currentStyle) { + return c.currentStyle[b]; + } + if (getComputedStyle) { + return document.defaultView.getComputedStyle(c, null)[b]; + } + } else if (typeof b === 'object') { + for (var f in b) { + c.style[f] = b[f]; + } + } + }, + getClient: function (a) { + a = a.charAt(0).toUpperCase() + a.substr(1).toLowerCase(); + return document.compatMode === 'BackCompat' ? document.body['client' + a] : document.documentElement['client' + a]; + }, + getScroll: function (a) { + a = a.charAt(0).toUpperCase() + a.substr(1).toLowerCase(); + return document.documentElement['scroll' + a] || document.body['scroll' + a]; + }, + getPosition: function (a) { + var a = d.$(a); + var b = { + left: 0, + top: 0 + }; + if (a.getBoundingClientRect) { + b.left = Math.round(a.getBoundingClientRect().left + d.getScroll('left') - (document.documentElement.clientLeft || document.body.clientLeft || 0)); + b.top = Math.round(a.getBoundingClientRect().top + d.getScroll('top') - (document.documentElement.clientTop || document.body.clientTop || 0)); + } + return b; + }, + getCurrentScript: function () { + var a = { + script: null, + last: !1 + }; + var b; + if (document.currentScript) { + a.script = document.currentScript; + } + else { + b = document.getElementsByTagName('script'); + if (/msie \d/i.test(navigator.userAgent)) { + for (var i = b.length - 1; i >= 0; i--) { + if (b[i].readyState === 'interactive') { + a.script = b[i]; + break; + } + } + } + if (!a.script) { + a.script = b[b.length - 1]; + a.last = !0; + } + } + return a; + }, + isFirstScreen: function (a, b, c) { + var f = 0; + var e = d.getClient('height'); + var g = 0; + var j = d.$('ac_js86_' + a); + var h = null; + if (b && d.$(b)) { + g = d.getPosition(b).top; + } + else if (c) { + g = c[0]; + } + else if (j) { + h = d.element('div', { + id: 'vs_anch_' + a + }, { + border: 'none', + background: 'none', + margin: 0, + padding: 0, + fontSize: 0, + height: '1px', + width: '1px', + position: 'absolute' + }), + j.parentNode.insertBefore(h, j), + g = d.getPosition(h).top, + h.parentNode.removeChild(h); + } + e && (f = Math.ceil(g / e)); + return f; + }, + ssp: function (a) { + var c = a.aid; + var f = a.vid; + var e = a.pf; + var g = a.dAd ? a.dAd : null; + var j = a.js ? a.js : 'http://static.acs86.com/csp.js'; + var h = a.sburl ? a.sburl : ''; + var o = a.ext ? a.ext : null; + var m = a.ssct ? a.ssct : ''; + var k = a.sdct ? a.sdct : ''; + var b = MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare[c] && MIP39GlobNode.ackInfoWare[c].async ? 1 : 0; + b === 0 ? (MIP39GlobNode.acSspId = c, + MIP39GlobNode.acSspVisitorId = f, + MIP39GlobNode.acSspPlatform = e, + MIP39GlobNode.acSspAsync = b, + MIP39GlobNode.acSspDefaultAd = g, + MIP39GlobNode.acSspAdTrack = m, + MIP39GlobNode.acSspDefaultAdTrack = k, + a.sburl && (MIP39GlobNode.acSspServerBaseUrl = h), + a.ext && (MIP39GlobNode.acSspExt = o), + MIP39GlobNode.s3 = document.createElement('script'), MIP39GlobNode.s3.type='text/javascript', MIP39GlobNode.s3.src = j, + document.getElementById('ads_' + asid).parentNode.appendChild(MIP39GlobNode.s3)) : d.load(j, 1, function () { + var d = { + aid: c, + vid: f, + pf: e, + async: b, + dAd: g, + ssct: m, + sdct: k + }; + if (a.sburl) { + d.serverbaseurl = h; + } + if (a.ext) { + d.ext = o; + } + MIP39GlobNode.acCSP(d); + }); + }, + megax: function (a) { + var b = 0; + var c = a.oid; + var f = a.aid; + var e = a.dAd ? a.dAd : null; + var g = a.js ? a.js : 'http://static.mlt01.com/b.js'; + var j = a.sburl ? a.sburl : ''; + var h = a.cburl ? a.cburl : ''; + var o = a.ext ? a.ext : null; + var m = a.ssct ? a.ssct : ''; + var a = a.sdct ? a.sdct : ''; + var k; + if (MIP39GlobNode.ackInfoWare && MIP39GlobNode.ackInfoWare[c]) { + if (c = MIP39GlobNode.ackInfoWare[c], + c.async && (b = 1), + c.destid) { + k = c.destid; + } + } else { + b = 0; + } + if (b === 0) { + MIP39GlobNode.mxAsId = f; + MIP39GlobNode.mxAsync = b; + MIP39GlobNode.mxDefaultAd = MIP39GlobNode.e; + MIP39GlobNode.mxAdTrack = m; + MIP39GlobNode.mxDefaultAdTrack = a; + j && (MIP39GlobNode.mxServerBaseUrl = j); + h && (MIP39GlobNode.mxStaticBaseUrl = h); + o && (MIP39GlobNode.mxExternal = o); + k && (MIP39GlobNode.mxDestId = k); + MIP39GlobNode.s4 = document.createElement('script'); + MIP39GlobNode.s4.type = 'text/javascript'; + MIP39GlobNode.s4.src = g; + document.getElementById('ads_' + asid).parentNode.appendChild(MIP39GlobNode.s4); + } + else { + var n = { + aid: f, + async: b, + dAd: e, + ssct: m, + sdct: a + }; + if (j) { + n.serverbaseurl = j; + } + if (h) { + n.staticbaseurl = h; + } + if (o) { + n.ex = o; + } + if (k) { + n.destid = k; + } + MIP39GlobNode.mxB ? MIP39GlobNode.mxB(n) : d.load(g, 1, function () { + MIP39GlobNode.mxB(n); + }); + } + } + }), + // 广告单例的具体实体化类 + d.prototype = { + init: function (a) { + if (a && (a.aids || a.aid)) { + if (a.aids) { + for (var b = 0, c; c = a.aids[b]; ++b) { + g[c] ? g[c].rl = 0 : g[c] = { + rl: 0 + }; + } + } + var f = 'ac_js86_' + a.aid; + (function () { + var b = d.getCurrentScript(); + var b = b.last; + if (!d.$(f)) { + var s5 = document.createElement('ins'); + s5.id = f, s5.style = 'display:none;'; + if (b && !a.async + && (document.getElementById('ads_' + a.aid).parentNode.appendChild(s5), d.$(f))) { + return; + } + b = document.createElement('ins'); + b.style.display = 'none'; + b.id = f; + document.getElementById('ads_' + a.aid).parentNode.appendChild(b); + } + })(); + this.timestamp = (new Date()).getTime(); + this.aid = a.aid; + g[this.aid] ? d.extend(g[this.aid], a) : g[this.aid] = a; + g['$tag_' + this.aid] = this; + this.info('mode') === 1 && (this.info('rl') === 0 ? (this.info('rl', 1), + g.otlads && g.otlads[this.aid] && (g.otlads[this.aid](), + g.otlads[this.aid] = null)) : this.g()); + } + }, + jsv: 7, + info: function (a, b) { + typeof g === 'undefined' && (g = {}); + g[this.aid] || (g[this.aid] = {}); + typeof b !== 'undefined' && (b === null ? delete g[this.aid][a] : g[this.aid][a] = b); + return g[this.aid][a]; + }, + // 获得业务参数方法 + getParameters: function () { + var a = ''; + var b = ''; + var c = ''; + var f = !1; + var e = this.info('pv') || 1; + var a = this.info('mid') === void 0 ? -1 : this.info('mid'); + var b = this.info('imids') === void 0 ? 0 : this.info('imids'); + var c = d.joinParameters({ + aid: this.info('aid'), + gid: this.info('gid') === void 0 ? 0 : this.info('gid'), + height: 0, + width: 0, + format: this.info('format') === void 0 ? 0 : this.info('format'), + mode: this.info('mode') === void 0 ? 1 : this.info('mode'), + ce: d.getCookieEnabled(), + fv: '' + }, ','); + var e = { + pv: e, + sp: c, + ec: 'utf-8', + re: [screen.width, screen.height].join(',') + }; + if (this.info('aids')) { + e.clt = this.info('aids').join(','); + } + a !== -1 && (e.mid = a); + b && (e.imids = b); + d._pcids && (e.pcids = d._pcids.join(',')); + if (this.info('gid') === 1 && typeof MIP39GlobNode.acContentTargeting !== 'undefined' && MIP39GlobNode.acContentTargeting) { + e.ct = encodeURIComponent(MIP39GlobNode.acContentTargeting); + } + if (this.info('gid') === 1 && typeof MIP39GlobNode.acContentId !== 'undefined' && MIP39GlobNode.acContentId) { + e.ctid = encodeURIComponent(MIP39GlobNode.acContentId); + } + if (this.info('sendkeywords') && this.info('gid') === 1 && typeof MIP39GlobNode.acKeywordsTargeting !== 'undefined' && MIP39GlobNode.acKeywordsTargeting) { + e.kw = encodeURIComponent(MIP39GlobNode.acKeywordsTargeting); + } + this.info('ex') && d.extend(e, this.info('ex')); + if (this.info('sendreferer') === 1) { + a = d.cookie('asp_furl'); + b = d.getPreviousUrl(); + c = d.getCurrentUrl(); + if (a) { + b && !d.isSameDomain(decodeURIComponent(b), decodeURIComponent(c)) + && !d.isSameDomain(decodeURIComponent(b), a) ? (f = !0, + e.purl = b) : e.purl = encodeURIComponent(a); + } + else if (b) { + d.isSameDomain(decodeURIComponent(b), decodeURIComponent(c)) || (f = !0), + e.purl = b; + } + f && d.cookie('asp_furl', b, { + domain: d.getDomain(decodeURIComponent(c)), + path: '/' + }); + } + if (this.info('currenturl')) { + e.curl = encodeURIComponent(this.info('currenturl')); + } + e.jsv = this.jsv; + e.cb = d.createCacheBuster(); + d.seq ? d.seq += 1 : d.seq = 1; + e.seq = d.seq; + if (d.cookie('acaspvid')) { + e.vid = d.cookie('acaspvid'); + } + e.fs = d.isFirstScreen(this.aid, this.info('destid'), this.info('coors')); + if (this.info('async')) { + e.ar = 1; + } + if (this.info('ad_callback')) { + e.acb = this.info('ad_callback'); + } + return d.joinParameters(e, '&'); + }, + // 获得服务器url地址 + getServerUrl: function () { + return d.getProtocol() + this.getBaseUrl() + '20160105?'; + }, + // 获得基础路径 + getBaseUrl: function () { + return this.info('serverbaseurl') ? this.info('serverbaseurl') : this.getLBUrl(); + }, + getLBUrl: function () { + return this.info('serverbaseurl', this.info('gid') === 1 ? 'afp.acs86.com/' : 'acs86.com/'); + }, + g: function (a, b) { + var c = this; + (new Date()).getTime(); + var f; + b || c.info('async') ? (f = function () { + d.idle[1] = 1; + } + , + function () { + d.idle[1] ? (d.idle[1] = 0, + d.load(a || c.getServerUrl() + c.getParameters(), b + || c.info('async'), f, 1E4)) : setTimeout(arguments.callee, 0); + }()) : (d.idle[0] = 0, + f = function () { + d.idle[0] = 1; + } + , + d.load(a || c.getServerUrl() + c.getParameters(), b || c.info('async'), f, 1E4)); + } + }, + d.prototype.init.prototype = d.prototype); + })(); + (function () { + typeof MIP39GlobNode.ackOTL === 'undefined' && (MIP39GlobNode.ackOTL = function () { + var a = Array.prototype.slice.call(arguments, 0); + var b = 1; + var c = ''; + var f = 0; + var e = null; + var g = null; + typeof a[a.length - 1] !== 'string' && (b = 2, + f = 1); + c = a[a.length - b]; + e = a.slice(0, -b); + for (g = e.splice(0, 16); g.length;) { + d({ + aid: 0, + aids: g, + gid: 1, + format: 0, + mode: 1, + serverbaseurl: c, + sendreferer: f + }), + g = e.splice(0, 16); + } + } + ); + })(); + (function () { + var a = { + pv: 1, + gid: 0, + format: 0, + mode: 1, + hidetime: 0, + staticbaseurl: 's.acs86.com/' + }; + // 根据具体业务条件实例化参数vo + if (typeof MIP39GlobNode.acAsId === 'number') { + a.aid = MIP39GlobNode.acAsId; + a.pv = 1; + a.sendreferer = 0; + MIP39GlobNode.acAsId = null; + } + if (typeof MIP39GlobNode.acGroupId === 'number') { + a.gid = MIP39GlobNode.acGroupId, + a.groupid = MIP39GlobNode.acGroupId, + MIP39GlobNode.acGroupId = null; + } + if (typeof MIP39GlobNode.acFormat === 'number') { + a.format = MIP39GlobNode.acFormat, + MIP39GlobNode.acFormat = null; + } + if (typeof MIP39GlobNode.acMode === 'number') { + a.mode = MIP39GlobNode.acMode, + MIP39GlobNode.acMode = null; + } + if (a.gid === 0) { + a.async = 1; + } + if (typeof MIP39GlobNode.acAsync === 'number') { + a.async = MIP39GlobNode.acAsync, + MIP39GlobNode.acAsync = null; + } + if (typeof MIP39GlobNode.acDestId !== 'undefined') { + a.destid = MIP39GlobNode.acDestId, + MIP39GlobNode.acDestId = null; + } + if (typeof MIP39GlobNode.acAnchId !== 'undefined') { + a.anchid = MIP39GlobNode.acAnchId, + MIP39GlobNode.acAnchId = null; + } + if (typeof MIP39GlobNode.acCoors !== 'undefined') { + a.coors = MIP39GlobNode.acCoors, + MIP39GlobNode.acCoors = null; + } + if (typeof MIP39GlobNode.acSendReferer !== 'undefined') { + a.sendreferer = MIP39GlobNode.acSendReferer, + MIP39GlobNode.acSendReferer = null; + } + if (typeof MIP39GlobNode.acSendKeywords !== 'undefined') { + a.sendkeywords = MIP39GlobNode.acSendKeywords, + MIP39GlobNode.acSendKeywords = null; + } + if (typeof MIP39GlobNode.acHideTime !== 'undefined') { + a.hidetime = MIP39GlobNode.acHideTime, + MIP39GlobNode.acHideTime = null; + } + if (typeof MIP39GlobNode.acCurrentUrl === 'string' && MIP39GlobNode.acCurrentUrl) { + a.currenturl = MIP39GlobNode.acCurrentUrl, + MIP39GlobNode.acCurrentUrl = null; + } + if (typeof MIP39GlobNode.acStaticBaseUrl === 'string' && MIP39GlobNode.acStaticBaseUrl) { + a.staticbaseurl = MIP39GlobNode.acStaticBaseUrl, + MIP39GlobNode.acStaticBaseUrl = null; + } + if (typeof MIP39GlobNode.acServerBaseUrl === 'string' && MIP39GlobNode.acServerBaseUrl) { + a.serverbaseurl = MIP39GlobNode.acServerBaseUrl, + MIP39GlobNode.acServerBaseUrl = null; + } + if (typeof MIP39GlobNode.acAdNone === 'function') { + a.ad_none = MIP39GlobNode.acAdNone, + MIP39GlobNode.acAdNone = null; + } + if (typeof MIP39GlobNode.acAdCallback === 'string' && MIP39GlobNode.acAdCallback) { + a.ad_callback = MIP39GlobNode.acAdCallback, + MIP39GlobNode.acAdCallback = null; + } + if (typeof MIP39GlobNode.acShowEnd === 'function') { + a.show_end = MIP39GlobNode.acShowEnd, + MIP39GlobNode.acShowEnd = null; + } + if (typeof MIP39GlobNode.acStateChange === 'function') { + a.stateChange = MIP39GlobNode.acStateChange, + MIP39GlobNode.acStateChange = null; + } + d(a); + } + )(); + }; + + // build 方法,元素插入到文档时执行,仅会执行一次 + customElem.prototype.build = function () { + var element = this.element; + var hideLayerId = element.getAttribute('hide-layer-id'); + var adid = element.getAttribute('adid'); + MIP39GlobNode.callbackfunction = function (data) { + var id = data; + var n = require('zepto'); + var i = n(element); + var script = [ + '']; + i.append(script.join('')); + ks(id); + setTimeout(function () { + if (hideLayerId) { + i.find(".close").click(function () {window.document.getElementById(hideLayerId).style.display = "none";}); + } + }, 3000); + }; + // this.element 可取到当前实例对应的 dom 元素 + var url = 'https://app-g-mip.39.net/rel/k14.php?id=' + adid + '&jsonpcallback=MIP39GlobNode.callbackfunction'; + var script = document.createElement('script'); + script.setAttribute('src', url); + document.getElementsByTagName('head')[0].appendChild(script); + }; + return customElem; +}); + + + diff --git a/mip-39appgad/package.json b/mip-39appgad/package.json new file mode 100644 index 00000000..aa4f3af4 --- /dev/null +++ b/mip-39appgad/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-39appgad", + "version": "1.1.2", + "author": { + "name": "MIP authors", + "email": "mip-support@baidu.com", + "url": "https://www.mipengine.org" + }, + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-51la/README.md b/mip-51la/README.md index d55526f2..f95bb969 100644 --- a/mip-51la/README.md +++ b/mip-51la/README.md @@ -6,7 +6,7 @@ mip-51la 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-51la/mip-51la.js +所需脚本|https://c.mipcdn.com/static/v1/mip-51la/mip-51la.js ## 示例 diff --git a/mip-53msg/README.md b/mip-53msg/README.md index 7af03d10..db9fec76 100644 --- a/mip-53msg/README.md +++ b/mip-53msg/README.md @@ -6,7 +6,7 @@ mip-53msg 用于提交联系方式的组件 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-53msg/mip-53msg.js +所需脚本|https://c.mipcdn.com/static/v1/mip-53msg/mip-53msg.js ## 示例 diff --git a/mip-53pop/README.md b/mip-53pop/README.md index 9ab00ab5..dd6f4f11 100644 --- a/mip-53pop/README.md +++ b/mip-53pop/README.md @@ -6,7 +6,7 @@ mip-53pop 一款弹出功能小组件 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-53pop/mip-53pop.js +所需脚本|https://c.mipcdn.com/static/v1/mip-53pop/mip-53pop.js ## 示例 diff --git a/mip-53vote/README.md b/mip-53vote/README.md index 51a8333e..a4acafd3 100644 --- a/mip-53vote/README.md +++ b/mip-53vote/README.md @@ -6,7 +6,7 @@ mip-53vote 用来进行投票的小组件 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-53vote/mip-53vote.js +所需脚本|https://c.mipcdn.com/static/v1/mip-53vote/mip-53vote.js ## 示例 diff --git a/mip-5577-cnzzcount/README.md b/mip-5577-cnzzcount/README.md index 465249d1..c8695eec 100644 --- a/mip-5577-cnzzcount/README.md +++ b/mip-5577-cnzzcount/README.md @@ -6,7 +6,7 @@ mip-5577-cnzzcount CNZZ统计 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-5577-cnzzcount/mip-5577-cnzzcount.js +所需脚本|https://c.mipcdn.com/static/v1/mip-5577-cnzzcount/mip-5577-cnzzcount.js ## 示例 ### CNZZ统计 diff --git a/mip-5h-cnzzcount/README.md b/mip-5h-cnzzcount/README.md index caaed061..25fdc8a4 100644 --- a/mip-5h-cnzzcount/README.md +++ b/mip-5h-cnzzcount/README.md @@ -6,7 +6,7 @@ mip-5h-cnzzcount CNZZ统计 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-5h-cnzzcount/mip-5h-cnzzcount.js +所需脚本|https://c.mipcdn.com/static/v1/mip-5h-cnzzcount/mip-5h-cnzzcount.js ## 示例 ### CNZZ统计 diff --git a/mip-7yaz-downbox/README.md b/mip-7yaz-downbox/README.md index 6f52a6d9..e0735e6a 100644 --- a/mip-7yaz-downbox/README.md +++ b/mip-7yaz-downbox/README.md @@ -6,7 +6,7 @@ ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-7yaz-downbox/mip-7yaz-downbox.js +所需脚本|https://c.mipcdn.com/static/v1/mip-7yaz-downbox/mip-7yaz-downbox.js ## 示例 diff --git a/mip-99down-dropload/README.md b/mip-99down-dropload/README.md index 1f378baa..d7a2a49a 100644 --- a/mip-99down-dropload/README.md +++ b/mip-99down-dropload/README.md @@ -6,7 +6,7 @@ mip-99down-dropload 用来支持页面下拉加载 ----|---- 类型|业务 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-99down-dropload/mip-99down-dropload.js +所需脚本|https://c.mipcdn.com/static/v1/mip-99down-dropload/mip-99down-dropload.js ## 示例 diff --git a/mip-9ht-bdzs/README.md b/mip-9ht-bdzs/README.md index e6fda229..43c2dcdf 100644 --- a/mip-9ht-bdzs/README.md +++ b/mip-9ht-bdzs/README.md @@ -5,7 +5,7 @@ mip-9ht-bdzs 百度站搜表单提交 标题|内容 ----|---- 类型|通用 -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-9ht-bdzs/mip-9ht-bdzs.js +所需脚本|https://c.mipcdn.com/static/v1/mip-9ht-bdzs/mip-9ht-bdzs.js ## 示例 diff --git a/mip-a5-loadmore/README.md b/mip-a5-loadmore/README.md new file mode 100644 index 00000000..c12ea755 --- /dev/null +++ b/mip-a5-loadmore/README.md @@ -0,0 +1,57 @@ +# mip-a5-loadmore + +mip-a5-loadmore 是a5创业网逻辑组件,也适应于其他相似业务。 + +标题|内容 +----|---- +类型|通用 +支持布局|N/S +所需脚本|https://c.mipcdn.com/static/v1/mip-a5-loadmore/mip-a5-loadmore.js + +## 示例 + +### 基本使用 + +```html + + + +
    +
  • 1
  • +
  • 2
  • +
  • 3
  • +
+
+ +
+
+``` + +## 属性 + +### 配置 +在组件script标签内配置相关设置,script中必须是json格式,参数说明如下: +参数|类型|默认值|说明 +----|----|----|---- +url|string|"#"|指定获取数据url +page|int|2|第一次加载的页码 +btn|string|".loadBtn"|点击加载的按钮 +moreList|string|".moreList"|列表容器,每次加载获取其子元素,并append到其中 +status|json|{
"init": "加载更多",
"loading": "加载中",
"ending": "没有了",
"error": "网络错误"
}|按钮显示的提示内容,init表示初始化和加载完成,loading正在加载,ending没有更多数据了,error错误 +scroll|int|-1|页面滚动到底部自动加载页数,-1:不自动加载,0:一直加载,>0:加载的次数 +pageParam|string|"page"|页码参数名称 diff --git a/mip-a5-loadmore/mip-a5-loadmore.js b/mip-a5-loadmore/mip-a5-loadmore.js new file mode 100644 index 00000000..107fa4de --- /dev/null +++ b/mip-a5-loadmore/mip-a5-loadmore.js @@ -0,0 +1,107 @@ +/** + * @author: cuikangyi + * @date: 2016-12-12 + * @file: mip-a5-loadmore.js + */ + +define(function (require) { + var $ = require('zepto'); + var customElem = require('customElement').create(); + var defaults = { + url: '#', + page: 2, + btn: '.loadBtn', + moreList: '.moreList', + status: { + init: '加载更多', + loading: '加载中', + ending: '没有了', + error: '网络错误' + }, + scrollPage: -1, + pageParam: 'page' + }; + var options = {}; + var loadBtn = ''; + var page = 2; + var isLoading = false; + + function getMore(element) { + isLoading = true; + loadBtn.html(options.status.loading); + var morelist = $(element).find(options.moreList); + $.ajax({ + url: options.url, + method: 'GET', + data: options.pageParam + '=' + page, + success: function (data) { + var newData = $(data).find(options.moreList).children(); + if (newData.length > 0) { + morelist.append(newData); + loadBtn.html(options.status.init); + page++; + isLoading = false; + } + else { + loadBtn.html(options.status.ending); + isLoading = false; + } + }, + error: function (error) { + loadBtn.html(options.status.error); + isLoading = false; + } + }); + } + + function isJsonScriptTag(element) { + return element.tagName === 'SCRIPT' + && element.getAttribute('type') + && element.getAttribute('type').toUpperCase() === 'APPLICATION/JSON'; + } + + customElem.prototype.build = function () { + var element = this.element; + var scriptEle = element.querySelector('script') || null; + if (scriptEle !== null) { + if (isJsonScriptTag(scriptEle)) { + var optStr = scriptEle.textContent.toString(); + try { + options = JSON.parse(optStr); + } + catch (e) { + console.error('error options', optStr); + return false; + } + } + else { + console.error('error options'); + return false; + } + } + + options = $.extend(defaults, options); + page = options.page; + loadBtn = $(options.btn); + loadBtn.html(options.status.init); + loadBtn.click(function () { + if (isLoading) { + return false; + } + getMore(element); + }); + + var scrollPage = parseInt(options.scrollPage, 0); + if (scrollPage >= 0) { + var winHeight = $(window).height(); + $(window).on('scroll', function () { + var scrollTop = $(this).scrollTop(); + var diff = $(document).height() - winHeight - scrollTop - 50; + if (diff < 0 && isLoading === false && (scrollPage === 0 || page < (options.page + scrollPage))) { + getMore(element); + } + }); + } + }; + return customElem; +}); diff --git a/mip-a5-loadmore/package.json b/mip-a5-loadmore/package.json new file mode 100644 index 00000000..2ede8c4b --- /dev/null +++ b/mip-a5-loadmore/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-a5-loadmore", + "version": "1.0.0", + "description": "A5创业网mip站列表加载更多功能,也适应于相似业务需求", + "author": { + "name": "cuikangyi", + "email": "392083349@qq.com" + }, + "engines": { + "mip": ">=1.1.0" + } +} \ No newline at end of file diff --git a/mip-ad-link/README.md b/mip-ad-link/README.md index fec7722c..57d2b427 100644 --- a/mip-ad-link/README.md +++ b/mip-ad-link/README.md @@ -6,7 +6,7 @@ mip-ad-link 康网图片增加链接代码 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-ad-link/mip-ad-link.js +所需脚本|https://c.mipcdn.com/static/v1/mip-ad-link/mip-ad-link.js ## 示例 diff --git a/mip-ad-random/README.md b/mip-ad-random/README.md new file mode 100644 index 00000000..aabc70a6 --- /dev/null +++ b/mip-ad-random/README.md @@ -0,0 +1,63 @@ +# mip-ad-random + +mip-ad-random 用来支持携景财富网的mip广告位置随机显示。 + +标题|提供了一个随机位置让广告展示 +----|---- +类型|广告 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://github.com/weiling0626/weiling666/blob/master/mip-ad-random.js + +## 示例 + +### 广告位置随机显示 + +```html + + +``` + +提示: 参与随机位置的标签里面都加上与data-parents中参数一致的类。 + + +## 属性 + +### data-parent +说明:与参与随机位置标签建立联系的自定义属性 +必选项:是 +类型:字符串 + +### ad-href +说明:广告图片来源 +必选项:是 +类型:字符串 + +### ad-src +说明:广告图片地址 +必选项:是 +类型:字符串 + +### ad-width +说明:广告所占宽度 +必选项:是 +类型:数字 +取值范围:>0 +单位: px +默认值:400 + +### ad-height +说明:广告所占高度 +必选项:是 +类型:数字 +取值范围:>0 +单位: px +默认值:80 + +### ad-class +说明:调整广告mip广告的样式名 +必选项:否 + +### ad-title +说明:广告标题 +必选项:否 + diff --git a/mip-ad-random/mip-ad-random.js b/mip-ad-random/mip-ad-random.js new file mode 100644 index 00000000..cb75593b --- /dev/null +++ b/mip-ad-random/mip-ad-random.js @@ -0,0 +1,42 @@ +/** + * @file 随机广告插件 + * @author weiling(741999251@qq.com) + * @version 1.0.0 + */ +define(function (require) { + var $ = require('zepto'); + var customElement = require('customElement').create(); + var t = this.element; + function e() { + getadress(); + } + function getadress() { + var allLocation = $('mip-ad-random').data('parents'); + var bigLocation = $('.' + allLocation); + var arrylength1 = bigLocation.length; + var randnum = Math.ceil(Math.random() * arrylength1) - 1; + var rank = bigLocation[randnum]; + var rchildren = $(rank).children(); + var arrylength2 = rchildren.length; + var randnum2 = Math.ceil(Math.random() * arrylength2) - 1; + var rank2 = rchildren[randnum2]; + var adsrc = t.getAttribute('ad-src'); + var adhref = t.getAttribute('ad-href'); + var adTitle = t.getAttribute('ad-title'); + var adClass = t.getAttribute('ad-class'); + var adWidth = t.getAttribute('ad-width'); + var adHeight = t.getAttribute('ad-height'); + var advet = ''; + if (arrylength2 === 0) { + $(rank).append(advet); + } + else { + $(rank2).after(advet); + } + } + customElement.prototype.build = e; + return customElement; +} +); diff --git a/mip-ad-random/package.json b/mip-ad-random/package.json new file mode 100644 index 00000000..35d26be0 --- /dev/null +++ b/mip-ad-random/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-ad-random", + "version": "1.1.2", + "author": { + "name": "xiejing", + "url": "https://www.mipengine.org", + "email":"741999251@qq.com" + }, + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-ad-video/README.md b/mip-ad-video/README.md new file mode 100644 index 00000000..90952712 --- /dev/null +++ b/mip-ad-video/README.md @@ -0,0 +1,44 @@ +# mip-ad-video +mip-ad-video 实现了一个简单的广告+视频的播放器 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://c.mipcdn.com/static/v1/mip-ad-video/mip-ad-video.js + +## 示例 + +### 带广告的播放 +```html + + +``` + +## 属性 + +### ad-src +说明:广告视频的url地址 +必选项:是 +类型:string + +### ad-src-end +说明:目标视频播放完毕之后的广告url地址 +必选项:否 +类型:string + +### target-src +说明:视频的url地址 +必选项:是 +类型:string + +### poster +说明:视频的封面图片 +必选项:是 +类型:string + +## 注意事项 +不带广告的播放器,请使用 mip-video diff --git a/mip-ad-video/mip-ad-video.js b/mip-ad-video/mip-ad-video.js new file mode 100644 index 00000000..2e018b71 --- /dev/null +++ b/mip-ad-video/mip-ad-video.js @@ -0,0 +1,78 @@ +/** + * @file mip-ad-video 带有广告的视频播放组件主文件 + * @author vodjk + */ + +define(function (require) { + var $ = require('zepto'); + var util = require('util'); + var platform = util.platform; + + var customElem = require('customElement').create(); + + /** + * build + */ + customElem.prototype.build = function () { + // this.element 可取到当前实例对应的 dom 元素 + var $element = $(this.element); + var adSrc = $element.attr('ad-src'); + var adSrcEnd = $element.attr('ad-src-end'); + var targetSrc = $element.attr('target-src'); + var poster = $element.attr('poster'); + + // 广告提示的dom + var domAdTip = document.createElement('div'); + domAdTip.innerHTML = '广告'; + domAdTip.className = 'ad-tip'; + + // 初始化播放器 + var video = document.createElement('video'); + + // 初始化video的属性 + $(video).attr({ + 'playsinline': '', + 'webkit-playsinline': '', + 'controls': '', + 'poster': poster, + 'preload': 'no' + }); + + // 初始化video的尺寸大小 + $(video).css('height', window.innerWidth / 16 * 9 + 'px'); + + $element[0].appendChild(video); + + // 当播放开始的时候设置为自动播放 + video.onplay = function () { + video.autoplay = true; + }; + + // 如果有广告并且非IOS上的QQ浏览器 则播放广告 + if (adSrc && !(platform.isIos() && platform.isQQ())) { + video.src = adSrc; + $element[0].appendChild(domAdTip); + + // 第一个视频播放完毕 + video.onended = function () { + if (video.src === targetSrc && adSrcEnd) { + // 显示广告提示 + domAdTip.style.display = 'block'; + video.src = adSrcEnd; + } else { + // 隐藏广告提示 + domAdTip.style.display = 'none'; + video.src = targetSrc; + } + video.autoplay = true; + video.setAttribute('autoplay', 'autoplay'); + + video.play(); + }; + } else { // 否则直接播放内容 + video.src = targetSrc; + } + }; + + return customElem; +}); diff --git a/mip-ad-video/mip-ad-video.less b/mip-ad-video/mip-ad-video.less new file mode 100644 index 00000000..42daac84 --- /dev/null +++ b/mip-ad-video/mip-ad-video.less @@ -0,0 +1,22 @@ +mip-ad-video { + width: 100%; + position: relative; + + video { + width: 100%; + height: 200px; + display: block; + background-color: rgb(0, 0, 0); + } + + .ad-tip { + width: 66px; + text-align: center; + position: absolute; + right: 0; + top: 0; + color: #bbb; + line-height: 2em; + background: rgba(0, 0, 0, 0.4) + } +} \ No newline at end of file diff --git a/mip-ad-video/package.json b/mip-ad-video/package.json new file mode 100644 index 00000000..276d7c4e --- /dev/null +++ b/mip-ad-video/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-ad-video", + "version": "1.4.0", + + "author": { + "name": "vodjk", + "email": "1196847324@qq.com", + "url":"http://www.vodjk.com" + }, + + "engines": { + "mip": ">=1.1.2" + } +} \ No newline at end of file diff --git a/mip-add-game/README.md b/mip-add-game/README.md index 5cda21b4..f4ebd2f9 100644 --- a/mip-add-game/README.md +++ b/mip-add-game/README.md @@ -6,7 +6,7 @@ mip-add-game 动态加载游戏渲染到页面中 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-add-game/mip-add-game.js +所需脚本|https://c.mipcdn.com/static/v1/mip-add-game/mip-add-game.js ## 示例 diff --git a/mip-adsense/README.md b/mip-adsense/README.md new file mode 100644 index 00000000..03f32af5 --- /dev/null +++ b/mip-adsense/README.md @@ -0,0 +1,50 @@ +# mip-adsense + +mip-adsense 用来添加谷歌广告 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://c.mipcdn.com/static/v1/mip-adsense/mip-adsense.js + +## 示例 + +MIP提供谷歌广告的扩展组件,代码示例: + +``` + + +``` + +## 属性 + +### ad-client + +说明:用户 +必选项:是 +类型:字符串 + +### ad-slot + +说明:位置 +必选项:是 +类型:字符串 + +### ad-format + +说明:格式 +必选项:否 +类型:字符串 + +### ad-width + +说明:宽度 +必选项:否 +类型:字符串 + +### ad-height + +说明:高度 +必选项:否 +类型:字符串 \ No newline at end of file diff --git a/mip-adsense/mip-adsense.js b/mip-adsense/mip-adsense.js new file mode 100644 index 00000000..eeaccaf0 --- /dev/null +++ b/mip-adsense/mip-adsense.js @@ -0,0 +1,46 @@ +/** + * @file + * 谷歌广告 + * @author smileU + * @version 1.1.1 + */ +define(function (require) { + var customElement = require('customElement').create(); + customElement.prototype.createdCallback = function () { + var ele = this.element; + var adClient = ele.getAttribute('ad-client'); + var adSlot = ele.getAttribute('ad-slot'); + var adFormat = ele.getAttribute('ad-format'); + var insTag = document.createElement('ins'); + var width = ele.getAttribute('ad-width'); + var height = ele.getAttribute('ad-height'); + var scriptTag1 = document.createElement('script'); + scriptTag1.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', + scriptTag1.setAttribute('async', 'true'); + var scriptTag2 = document.createElement('script'); + if (!(adSlot)) { + scriptTag2.innerHTML = '(adsbygoogle=window.adsbygoogle||[]).push({google_ad_client:"' + + '' + adClient + '",enable_page_level_ads:true});'; + ele.appendChild(scriptTag1); + ele.appendChild(scriptTag2); + } + else { + if (adFormat) { + insTag.setAttribute('data-ad-format', adFormat); + insTag.setAttribute('style', 'display:block'); + } + else { + insTag.setAttribute('style', 'display:inline-block;width:' + width + 'px;height:' + + height + 'px'); + } + insTag.classList.add('adsbygoogle'); + insTag.setAttribute('data-ad-client', adClient); + insTag.setAttribute('data-ad-slot', adSlot); + scriptTag2.innerHTML = '(adsbygoogle = window.adsbygoogle || []).push({});'; + ele.appendChild(scriptTag1); + ele.appendChild(insTag); + ele.appendChild(scriptTag2); + } + }; + return customElement; +}); diff --git a/mip-adsense/package.json b/mip-adsense/package.json new file mode 100644 index 00000000..cf1b4d6b --- /dev/null +++ b/mip-adsense/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-adsense", + "version": "1.0.0", + "description": "sample component", + "author": { + "name": "smileU", + "email": "1484249625@qq.com" + }, + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-ajax-carousel/README.md b/mip-ajax-carousel/README.md index 597adc2c..ea2caf45 100644 --- a/mip-ajax-carousel/README.md +++ b/mip-ajax-carousel/README.md @@ -6,7 +6,7 @@ mip-ajax-carousel 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-ajax-carousel/mip-ajax-carousel.js +所需脚本|https://c.mipcdn.com/static/v1/mip-ajax-carousel/mip-ajax-carousel.js ## 示例 diff --git a/mip-ajax-data/README.md b/mip-ajax-data/README.md new file mode 100644 index 00000000..e9c120da --- /dev/null +++ b/mip-ajax-data/README.md @@ -0,0 +1,46 @@ +# mip-ajax-data + +mip-ajax-data 用来触发元素ajax异步加载数据到指定容器,也可以下拉加载 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://c.mipcdn.com/static/v1/mip-ajax-data/mip-ajax-data.js + +## 示例 + +### 通过 mip-ajax-data标签来指定触发加载容器指定异步内容追加容器以及其他参数来异步加载内容 +```html + + 下载中 + +
1111
+
2222
+ + 下载中 + +``` + +## 属性 + +### mip-ajax-params + +说明:此异步加载所需要的参数 +必选项:是 +类型:数组格式的字符串 +取值范围: 需要配置异步加载的url (如果是类似于下拉形式多次加载 需要指定markplaceholder,即在网址中会变的量,比如page或者id,并且需要设置mip-ajax-mark属性,还要设置步长length,length和后端数据一致), containerclass异步内容存放的容器的class, action触发加载的动作(click,roll) +单位:无 +默认值:无 + +### mip-ajax-mark + +说明:选填项,用来记录加载多少页或者加载到多少id了,此属性有,说明是多次加载 +必选项:否 +类型:一般是表示page或者id的整形数字 +取值范围:数字或者其他 +单位:无 +默认值:无 + +## 注意事项 +为了适应更多的情况,通过jsonp异步加载来的json里面必须包含html这个key(一段html内容), 如果是多次加载,还得有mip-ajax-mark这个key,表示下一次从哪一个page或者id开始, 还有length表示每次加载的记录数 diff --git a/mip-ajax-data/mip-ajax-data.js b/mip-ajax-data/mip-ajax-data.js new file mode 100644 index 00000000..82f93be5 --- /dev/null +++ b/mip-ajax-data/mip-ajax-data.js @@ -0,0 +1,72 @@ +/** + * @file mip-ajax-data 组件 + * @author Jobs Fan + */ + +define(function (require) { + + var customElement = require('customElement').create(); + var $ = require('zepto'); + + /** [bindEven 绑定事件] + * + * @param {Object} element [mip-ajax-data元素] + * @param {Object} params [来自mip-ajax-data的属性] + * @param {Booleans} once [是否只执行一次] + */ + function bindEven(element, params, once) { + if (params.action !== 'roll') { + $(element).on(params.action, 'span', function () { + if (once) { + var url = params.url; + } else { + var url = params.url.replace('[markplaceholder]', $(element).attr('mip-ajax-mark')); + } + $.getJSON(url, function (result) { + $('.' + params.containerclass).append(result.html); + if (once || result.length < params.length) { + $(element).remove(); + } else { + $(element).attr('mip-ajax-mark', result['mip-ajax-mark']); + } + }); + }); + } else { + var allow = true; + $(window).bind('scroll', function () { + if (typeof ($(element).get(0)) === 'undefined') { + return false; + } + if (allow && $(window).height() + window.pageYOffset >= $(element).offset().top) { + allow = false; + if (once) { + var url = params.url; + } else { + var url = params.url.replace('[markplaceholder]', $(element).attr('mip-ajax-mark')); + } + $.getJSON(url, function (result) { + $('.' + params.containerclass).append(result.html); + if (once || result.length < params.length) { + $(element).remove(); + } else { + $(element).attr('mip-ajax-mark', result['mip-ajax-mark']); + allow = true; + } + }); + } + }); + } + } + + /** [构造元素,只会运行一次] + * + */ + customElement.prototype.build = function () { + var self = this; + var element = this.element; + var params = JSON.parse($(element).attr('mip-ajax-params').replace(/'/g, '"')); + bindEven(element, params, typeof ($(element).attr('mip-ajax-mark')) === 'undefined'); + }; + + return customElement; +}); diff --git a/mip-ajax-data/mip-ajax-data.less b/mip-ajax-data/mip-ajax-data.less new file mode 100644 index 00000000..5ba44d81 --- /dev/null +++ b/mip-ajax-data/mip-ajax-data.less @@ -0,0 +1,30 @@ +/** + * @file mip-ajax-data样式文件 + */ + +mip-ajax-data { + width: 95%; + height: 36px; + line-height: 36px; + clear: both; + cursor: pointer; + border: 1px solid rgb(228, 228, 228); + margin: 10px auto; + border-radius: 5px; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(253, 253, 253)), color-stop(0.95, rgb(239, 239, 239)), to(rgb(247, 247, 247))); +} + +mip-ajax-data span { + display: block; + width: 65px; + margin: 0 auto; + font-size: 14px; + color: #414141; + text-align: left; +} + +mip-ajax-data span mip-img { + display: inline-block !important; + width: 18px !important; + vertical-align: middle; +} \ No newline at end of file diff --git a/mip-ajax-data/package.json b/mip-ajax-data/package.json new file mode 100644 index 00000000..149aafe0 --- /dev/null +++ b/mip-ajax-data/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-ajax-data", + "version": "1.0.0", + "description": "来触发元素ajax异步加载数据到指定容器,也可以下拉加载", + "contributors": [ + { + "name": "Jobs Fan", + "email": "289047960@qq.com" + } + ], + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-all-checkout/README.md b/mip-all-checkout/README.md index 9af704c6..d5d528a7 100644 --- a/mip-all-checkout/README.md +++ b/mip-all-checkout/README.md @@ -6,7 +6,7 @@ ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-all-checkout/mip-all-checkout.js +所需脚本|https://c.mipcdn.com/static/v1/mip-all-checkout/mip-all-checkout.js ## 示例 diff --git a/mip-app27/README.md b/mip-app27/README.md index 65bd5c80..ad36be80 100644 --- a/mip-app27/README.md +++ b/mip-app27/README.md @@ -6,7 +6,7 @@ mip-app27 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-app27/mip-app27.js +所需脚本|https://c.mipcdn.com/static/v1/mip-app27/mip-app27.js ## 示例 diff --git a/mip-append-video/README.md b/mip-append-video/README.md index 06dc10a0..7cf5a1f1 100644 --- a/mip-append-video/README.md +++ b/mip-append-video/README.md @@ -6,7 +6,7 @@ mip-append-video 实现了一个简单的广告(非必填)+视频的播放 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-append-video/mip-append-video.js +所需脚本|https://c.mipcdn.com/static/v1/mip-append-video/mip-append-video.js ## 示例 diff --git a/mip-ask-closed/README.md b/mip-ask-closed/README.md index 3061f7cb..f2606627 100644 --- a/mip-ask-closed/README.md +++ b/mip-ask-closed/README.md @@ -6,7 +6,7 @@ ----|---- 类型|广告 支持布局| N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-ask-closed/mip-ask-closed.js +所需脚本|https://c.mipcdn.com/static/v1/mip-ask-closed/mip-ask-closed.js ## 示例 ``` diff --git a/mip-ask-pucker/README.md b/mip-ask-pucker/README.md index 72a199ab..b610e346 100644 --- a/mip-ask-pucker/README.md +++ b/mip-ask-pucker/README.md @@ -6,7 +6,7 @@ ----|---- 类型|广告 支持布局| N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-ask-pucker/mip-ask-pucker.js +所需脚本|https://c.mipcdn.com/static/v1/mip-ask-pucker/mip-ask-pucker.js ## 示例 ``` diff --git a/mip-askad/README.md b/mip-askad/README.md new file mode 100644 index 00000000..9cf7846b --- /dev/null +++ b/mip-askad/README.md @@ -0,0 +1,64 @@ +# mip-askad + +120askad广告组件 + +标题|内容 +----|---- +类型|广告 +支持布局| N/S +所需脚本|https://c.mipcdn.com/static/v1/mip-askad/mip-askad.js + +## 示例 + +只需要一个``标签,无须其他填充dom + +``` +- yw-class + +- yw-keyword + +- yw-other + + +``` + +## 属性 + +### type + +说明:广告类型 +必填:是 +格式:字符 +取值:yw-* +默认值:yw-other + +### paramsid + +说明:广告id +必填:是 +格式:数字 + +### otherparamkey + +说明:其他关键字 +必填:是 +格式:字符串 + +### otherparamvalue + +说明:其他属性值 +必填:是 +格式:字符串 + +### cboptions +说明:样式配置 +必填:是 +格式:json串 + + diff --git a/mip-askad/mip-askad.js b/mip-askad/mip-askad.js new file mode 100755 index 00000000..cc65e6ac --- /dev/null +++ b/mip-askad/mip-askad.js @@ -0,0 +1,250 @@ +/** + * @file 120ask广告组件 + * @author fengchuantao + * @time 2016.8.8 + */ +define(function (require) { + var $ = require('jquery'); + var util = require('util'); + var customElement = require('customElement').create(); + + var newYWBD; + var mipLoadedJs = false; + var mipLoadingJs = false; + var mipcallList = []; + + + function build() { + var _element = this.element; + if (_element.isRender) { + return; + } + _element.isRender = true; + + var _this = _element; + var type = _element.getAttribute("type") || "yw-other"; + var arg = {}; + arg['ID'] = _element.getAttribute("paramsid") || ""; + arg['classparams'] = _element.getAttribute("classparams") || ""; + arg['otherparamkey'] = _element.getAttribute("otherparamkey") || "0"; + arg['otherparamvalue'] = _element.getAttribute("otherparamvalue") || ""; + arg['callbackconfig'] = _element.getAttribute("cboptions") || [] ; + arg['callbacknboptions'] = _element.getAttribute("nboptions") || [] ; + + //回调配置序列化 + var callbackdata = []; + if (arg['callbackconfig']) { + try { + callbackdata = new Function('return ' + arg['callbackconfig'])() + } catch (e) {} + } + //回调配置序列化 + var callbacknb = []; + if (arg['callbacknboptions']) { + try { + callbacknb = new Function('return ' + arg['callbacknboptions'])() + } catch (e) {} + } + + //根据页面获取推荐内容 + var $title = $(".g-under-ask h1"); + var $dse = $(".g-under-ask .crazy_keyword_inlink"); + + if($title.length == 0 || $dse.length == 0) { + var content = ""; + }else { + var content = $title.html() +" "+ $dse.html().slice(0,30); + } + innerJs(content,function(){ + getadDate(type, arg, callbackdata, _this, callbacknb); + + }) + } + + /** + * 加载120ask网站js + */ + function innerJs(content,callback) { + if(mipLoadedJs) { + callback(); + }else if(mipLoadingJs) { + mipcallList.push(callback) + }else { + mipLoadingJs = true; + var timestamp = ( new Date()).valueOf(); + var CLASSID = $("#top_ad").attr("cid"); + var allurl = ["//ip.120ask.com/lt?js=m.120ask.com&r="+timestamp+"&cid="+CLASSID,"//scws.120ask.com/scws?t=js&content="+content+"&r="+timestamp,"//m.120ask.com/pub/js/x_m_none_jquery.js?r="+timestamp]; + var calbacklen = 3; + + for(var i = 0; i< allurl.length; i++) { + + var script = document.createElement("script"); + script.src = allurl[i]; + + var firstChild = document.head.firstChild; + document.head.insertBefore(script,firstChild); + + + script.onload = function() { + if(calbacklen == 1) { + mipLoadedJs = true; + for(var i=0; i= 0) { + + YWBD_LOG_URL = "//eclick.120ask.com/lualog"; + + }else if(YWBD_LOG_URL.indexOf("scws.120ask.com") >= 0) { + + YWBD_LOG_URL = "//gss2.bdstatic.com/5bUVf8T-RdYFkdTgoY3K"; + + }else if (YWBD_LOG_URL.indexOf("cdn.120askimages.com") >= 0) { + + YWBD_LOG_URL = "//gss2.bdstatic.com/9bA1smf7RAUTmdKfo9eSBHF6hhy"; + } + } + } + + /** + * 渲染回调 + */ + function renderCallback(callbackdata) { + var index = 0; + for(index = 0; index < callbackdata.length; index++ ) { + if(callbackdata[index].type == "show") { + showdom(callbackdata[index].target) + } else if(callbackdata[index].type == "hide") { + hidedom(callbackdata[index].target) + } else if(callbackdata[index].type == "remove") { + removedom(callbackdata[index].target) + } else if(callbackdata[index].type == "removead") { + removeAdDom(callbackdata[index].target) + } + } + } + + /** + * 删除节点 + */ + + function removeAdDom(uid) { + if (!uid) { + return; + } + //find 对应的 iframe + var iframes = document.querySelectorAll('iframe'); + var len = iframes.length; + var targetIframe; + for (var i = 0; i < len; i++) { + if (iframes[i].id.indexOf(uid) > -1) { + targetIframe = iframes[i]; + } + } + if (!targetIframe) { + return; + } + var parent = targetIframe.parentNode; + while (true) { + if (parent.style.position === 'fixed') { + parent.outerHTML = ''; + break; + } + var parent = parent.parentNode; + if (parent.tagName.toUpperCase() === 'BODY') { + break; + } + } + } + + /** + * 删除对应广告节点 + */ + + function removedom(obj) { + $(obj).remove(); + } + + /** + * 显示节点 + */ + + function showdom(obj) { + $(obj).show(); + } + + /** + * 隐藏节点 + */ + function hidedom(obj) { + $(obj).hide(); + } + + customElement.prototype.build = build; + + return customElement; + +}); + diff --git a/mip-askad/package.json b/mip-askad/package.json new file mode 100644 index 00000000..f87309ae --- /dev/null +++ b/mip-askad/package.json @@ -0,0 +1,12 @@ +{ + "name": "mip-askad", + "version": "1.1.4", + "author": { + "name": "MIP authors", + "email": "mip-support@baidu.com", + "url": "https://www.mipengine.org" + }, + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-askvip-ad/README.md b/mip-askvip-ad/README.md index 0e0845fa..4dc3dff6 100644 --- a/mip-askvip-ad/README.md +++ b/mip-askvip-ad/README.md @@ -6,7 +6,7 @@ mip-askvip-ad 用来支持问题页面广告的展示 ----|---- 类型|广告 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-askvip-ad/mip-askvip-ad.js +所需脚本|https://c.mipcdn.com/static/v1/mip-askvip-ad/mip-askvip-ad.js ## 示例 diff --git a/mip-audit-xa/README.md b/mip-audit-xa/README.md index 7a776281..4b1aa624 100644 --- a/mip-audit-xa/README.md +++ b/mip-audit-xa/README.md @@ -6,7 +6,7 @@ mip-audit-xa 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-audit-xa/mip-audit-xa.js +所需脚本|https://c.mipcdn.com/static/v1/mip-audit-xa/mip-audit-xa.js ## 示例 diff --git a/mip-baiyun-map/README.md b/mip-baiyun-map/README.md new file mode 100644 index 00000000..ef3ed495 --- /dev/null +++ b/mip-baiyun-map/README.md @@ -0,0 +1,82 @@ +# mip-baiyun-map + +mip-baiyun-map 组件说明 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://c.mipcdn.com/static/mip-baiyun-map/{版本号}/mip-baiyun-map.js + +## 示例 + +### 基本用法 +```html + +
+
+
+ + +
+
+ 未找到,请输入起点详细地址(城市街名号) +
+ 起点: +
+
+ 终点: +
+
+ +
+
+
+``` + +## 属性 + +### data-x + +说明:地图需要标注的位置的经度 +必选项:是 +类型:string + +### data-y + +说明:地图需要标注的位置的纬度 +必选项:是 +类型:string + +### data-zoom + +说明:地图初始化显示的比例 +必选项:否 +类型:string +默认值:16 + +### data-way + +说明:地图公交驾车线路查询,如果为1的时候必须保留way的文档结构 +必选项:否 +类型:string +默认值:0 + +### data-ak + +说明:密钥 +必选项:是 + +### data-id + +说明:地图线路查询方式 +必选项:是 + + +## 注意事项 + +- ID: allmap 地图容器ID必须唯一 +- ID: l-result 公交路线ID必须唯一 +- 元素结构固定 + +![](https://cloud.githubusercontent.com/assets/13213114/22011830/f882e586-dccb-11e6-9f05-657f88cd925f.gif) \ No newline at end of file diff --git a/mip-baiyun-map/mip-baiyun-map.js b/mip-baiyun-map/mip-baiyun-map.js new file mode 100644 index 00000000..07de6854 --- /dev/null +++ b/mip-baiyun-map/mip-baiyun-map.js @@ -0,0 +1,130 @@ +/** + * @file mip-baiyun-map 组件 + * @author unofficial + * @time 2017-01-17 + */ + +define(function (require) { + var customElement = require('customElement').create(); + + customElement.prototype.firstInviewCallback = function () { + var ele = this.element; + initMap(ele); + window.addEventListener('load', function () { + var baiyunMap = new BaiyunMap(ele); + baiyunMap.map(); + // 注册查询方式 + ele.dataset.way && baiyunMap.way(); + }); + }; + + /** + * 插入地图元素至Body末尾 + * + * @param {html} ele 当前mip-baiyun-map元素 + */ + function initMap(ele) { + var ak = ele.dataset.ak; + // add map class + var headElement = document.getElementsByTagName('body')[0]; + var scriptElement = document.createElement('script'); + scriptElement.type = 'text/javascript'; + scriptElement.src = '//api.map.baidu.com/getscript?v=2.0&ak=' + ak; + headElement.appendChild(scriptElement); + } + + /** + * 地图操作类 + * + * @param {html} ele 当前mip-baiyun-map元素 + * @class BaiyunMap + */ + function BaiyunMap(ele) { + this.mapElement = ele; + this.imap; + this.wayId = 1; + // 获取需要的要素 + var conElement = this.mapElement.children[1].children[1]; + this.startElement = conElement.children[1].firstElementChild; + this.endElement = conElement.children[2].firstElementChild; + this.failElement = conElement.children[0]; + this.resultElement = conElement.children[3]; + } + + /** + * map init + */ + BaiyunMap.prototype.map = function () { + var id = this.mapElement.firstElementChild.id || 'allmap'; + var zoom = this.mapElement.dataset.zoom || 16; + var x = this.mapElement.dataset.x; + var y = this.mapElement.dataset.y; + + // 初始化中心点必须存在 + if (!x || !y) { + return; + } + this.imap = new BMap.Map(id); + var point = new BMap.Point(x, y); + this.imap.centerAndZoom(point, zoom); + // 创建标注 + var marker = new BMap.Marker(point); + this.imap.addOverlay(marker); + marker.setAnimation(BMAP_ANIMATION_BOUNCE); + }; + + /** + * what way + */ + BaiyunMap.prototype.way = function () { + var self = this; + this.mapElement.addEventListener('click', function (e) { + var targetEle = e.target; + if (targetEle.parentElement.id === 'tip') { + self.wayId = Number(targetEle.dataset.id); + // 选中 + var butArr = [].slice.call(targetEle.parentElement.children); + butArr.forEach(function (e) { + e.className = ''; + }); + targetEle.className = 'cur'; + } + else if (targetEle.parentElement.id === 'con') { + self.getRoute(); + } + }); + }; + + /** + * get route way + */ + BaiyunMap.prototype.getRoute = function () { + // need: way / start / end + var start = this.startElement.value; + var end = this.endElement.value; + if (start && end) { + this.failElement.className = 'fail'; + this.imap.clearOverlays(); + var options; + if (this.wayId === 1) { + options = { + renderOptions: {map: this.imap, panel: this.resultElement.id || 'l-result'} + }; + } + else if (this.wayId === 2) { + this.resultElement.innerText = ''; + options = { + renderOptions: {map: this.imap}, + policy: 0 + }; + } + var transit = new BMap.TransitRoute(this.imap, options); + transit.search(start, end); + } + else { + this.failElement.className = 'fail show'; + this.failElement.innerText = '起点或终点不能为空'; + } + }; + return customElement; +}); diff --git a/mip-baiyun-map/mip-baiyun-map.less b/mip-baiyun-map/mip-baiyun-map.less new file mode 100644 index 00000000..84c3fd8e --- /dev/null +++ b/mip-baiyun-map/mip-baiyun-map.less @@ -0,0 +1,132 @@ +/** + * @file mip-baiyun-map样式文件 + */ + +mip-baiyun-map { + .map { + width: 100%; + height: 200px; + overflow: hidden; + } + button { + font-family: 'Microsoft Yahei'; + } + .way { + font-family: 'Microsoft Yahei'; + .tip { + &:before, + &:after { + content: " "; + display: table; + } + &:after { + clear: both; + } + + height: 30px; + border-bottom: 1px solid #ccc; + line-height: 30px; + button { + display: block; + height: 100%; + float: left; + padding: 0 10px; + border: 1px solid #ccc; + background: #EBEBEB; + color: #666; + position: relative; + top: 1px; + + &.cur { + font-weight: bold; + background: #fff; + border-bottom: 1px solid #fff; + } + &:nth-child(1) { + border-right: 0; + } + } + } + .con { + border: 1px solid #ccc; + border-top: none; + padding: 5px; + .fail { + display: none; + color: #f00; + } + .show { + display: block; + } + input { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background-color: #fff; + background-image: none; + border-radius: 4px; + border: 1px solid #bfcbd9; + box-sizing: border-box; + color: #1f2d3d; + display: inline-block; + font-size: inherit; + height: 36px; + line-height: 1; + outline: none; + padding: 3px 10px; + transition: border-color .2s cubic-bezier(.645,.045,.355,1); + width: 80% + } + div { + line-height: 50px; + } + .l-confirm { + display: inline-block; + line-height: 1; + white-space: nowrap; + cursor: pointer; + background: #fff; + border: 1px solid #bfcbd9; + color: #1f2d3d; + -webkit-appearance: none; + text-align: center; + box-sizing: border-box; + outline: none; + margin: 5px 0 0 0; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + padding: 10px 15px; + font-size: 14px; + border-radius: 4px + } + } + } + #travl-method { + height: 29px; + border-bottom: 1px solid #ccc; + line-height: 28px + } + + #travl-method a:first-child { + border-left: 1px solid #ccc + } + + #travl-method a.cur { + font-weight: bold; + color: black; + position: relative; + top: 1px; + background: white + } + + .tab-con { + border: 1px solid #ccc; + border-top: none; + padding: 5px + } + + .tab-con input[type=text] { + width: 80% + } +} \ No newline at end of file diff --git a/mip-baiyun-map/package.json b/mip-baiyun-map/package.json new file mode 100644 index 00000000..50e21068 --- /dev/null +++ b/mip-baiyun-map/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-baiyun-map", + "version": "1.0.0", + "description": "Baidu地图基础组件", + "contributors": [ + { + "name": "unofficial", + "email": "cangku@unofficial.cn" + } + ], + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-bdb-custom-content/README.md b/mip-bdb-custom-content/README.md index f54d38f9..11094c48 100644 --- a/mip-bdb-custom-content/README.md +++ b/mip-bdb-custom-content/README.md @@ -6,7 +6,7 @@ mip-bdb-custom-content 用来支持本地宝文章结尾的自定义内容版块 ----|---- 类型|业务 支持布局|N/S -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-bdb-custom-content/mip-bdb-custom-content.js +所需脚本|https://c.mipcdn.com/static/v1/mip-bdb-custom-content/mip-bdb-custom-content.js ## 示例 diff --git a/mip-bkmy-anchor/README.md b/mip-bkmy-anchor/README.md index fd4d82b6..73833a34 100644 --- a/mip-bkmy-anchor/README.md +++ b/mip-bkmy-anchor/README.md @@ -6,7 +6,7 @@ mip-bkmy-anchor 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-bkmy-anchor/mip-bkmy-anchor.js +所需脚本|https://c.mipcdn.com/static/v1/mip-bkmy-anchor/mip-bkmy-anchor.js ## 示例 diff --git a/mip-bkmy-audio/README.md b/mip-bkmy-audio/README.md index 2554aa0d..967917bf 100644 --- a/mip-bkmy-audio/README.md +++ b/mip-bkmy-audio/README.md @@ -6,7 +6,7 @@ mip-bkmy-audio 组件说明 ----|---- 类型|通用 支持布局|responsive,fixed-height,fill,container,fixed -所需脚本|https://c.mipcdn.com/extensions/platform/v1/mip-bkmy-audio/mip-bkmy-audio.js +所需脚本|https://c.mipcdn.com/static/v1/mip-bkmy-audio/mip-bkmy-audio.js ## 示例 diff --git a/mip-bsml-carousel/README.md b/mip-bsml-carousel/README.md new file mode 100644 index 00000000..eccf8463 --- /dev/null +++ b/mip-bsml-carousel/README.md @@ -0,0 +1,20 @@ +# mip-bsml-carousel + +mip-bsml-carousel bsml轮播组件 + +标题|内容 +----|---- +类型|通用 +支持布局|container +所需脚本|https://c.mipcdn.com/static/v1/mip-bsml-carousel/mip-bsml-carousel.js + +## 示例 + +### 基本用法 +```html + + 自定义内容,可以嵌套其他组件 + +``` + + diff --git a/mip-bsml-carousel/iscroll/iscroll.js b/mip-bsml-carousel/iscroll/iscroll.js new file mode 100644 index 00000000..a8e07c29 --- /dev/null +++ b/mip-bsml-carousel/iscroll/iscroll.js @@ -0,0 +1,2042 @@ +define(function(require, exports, module) { + + /*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */ + (function(window, document, Math) { + var rAF = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function(callback) { + window.setTimeout(callback, 1000 / 60); + }; + + var utils = (function() { + var me = {}; + + var _elementStyle = document.createElement('div').style; + var _vendor = (function() { + var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'], + transform, + i = 0, + l = vendors.length; + + for (; i < l; i++) { + transform = vendors[i] + 'ransform'; + if (transform in _elementStyle) return vendors[i].substr(0, vendors[i].length - 1); + } + + return false; + })(); + + function _prefixStyle(style) { + if (_vendor === false) return false; + if (_vendor === '') return style; + return _vendor + style.charAt(0).toUpperCase() + style.substr(1); + } + + me.getTime = Date.now || function getTime() { + return new Date().getTime(); + }; + + me.extend = function(target, obj) { + for (var i in obj) { + target[i] = obj[i]; + } + }; + + me.addEvent = function(el, type, fn, capture) { + el.addEventListener(type, fn, !!capture); + }; + + me.removeEvent = function(el, type, fn, capture) { + el.removeEventListener(type, fn, !!capture); + }; + + me.prefixPointerEvent = function(pointerEvent) { + return window.MSPointerEvent ? + 'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10) : + pointerEvent; + }; + + me.momentum = function(current, start, time, lowerMargin, wrapperSize, deceleration) { + var distance = current - start, + speed = Math.abs(distance) / time, + destination, + duration; + + deceleration = deceleration === undefined ? 0.0006 : deceleration; + + destination = current + (speed * speed) / (2 * deceleration) * (distance < 0 ? -1 : 1); + duration = speed / deceleration; + + if (destination < lowerMargin) { + destination = wrapperSize ? lowerMargin - (wrapperSize / 2.5 * (speed / 8)) : lowerMargin; + distance = Math.abs(destination - current); + duration = distance / speed; + } else if (destination > 0) { + destination = wrapperSize ? wrapperSize / 2.5 * (speed / 8) : 0; + distance = Math.abs(current) + destination; + duration = distance / speed; + } + + return { + destination: Math.round(destination), + duration: duration + }; + }; + + var _transform = _prefixStyle('transform'); + + me.extend(me, { + hasTransform: _transform !== false, + hasPerspective: _prefixStyle('perspective') in _elementStyle, + hasTouch: 'ontouchstart' in window, + hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed + hasTransition: _prefixStyle('transition') in _elementStyle + }); + + // This should find all Android browsers lower than build 535.19 (both stock browser and webview) + me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion)); + + me.extend(me.style = {}, { + transform: _transform, + transitionTimingFunction: _prefixStyle('transitionTimingFunction'), + transitionDuration: _prefixStyle('transitionDuration'), + transitionDelay: _prefixStyle('transitionDelay'), + transformOrigin: _prefixStyle('transformOrigin') + }); + + me.hasClass = function(e, c) { + var re = new RegExp("(^|\\s)" + c + "(\\s|$)"); + return re.test(e.className); + }; + + me.addClass = function(e, c) { + if (me.hasClass(e, c)) { + return; + } + + var newclass = e.className.split(' '); + newclass.push(c); + e.className = newclass.join(' '); + }; + + me.removeClass = function(e, c) { + if (!me.hasClass(e, c)) { + return; + } + + var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g'); + e.className = e.className.replace(re, ' '); + }; + + me.offset = function(el) { + var left = -el.offsetLeft, + top = -el.offsetTop; + + // jshint -W084 + while (el = el.offsetParent) { + left -= el.offsetLeft; + top -= el.offsetTop; + } + // jshint +W084 + + return { + left: left, + top: top + }; + }; + + me.preventDefaultException = function(el, exceptions) { + for (var i in exceptions) { + if (exceptions[i].test(el[i])) { + return true; + } + } + + return false; + }; + + me.extend(me.eventType = {}, { + touchstart: 1, + touchmove: 1, + touchend: 1, + + mousedown: 2, + mousemove: 2, + mouseup: 2, + + pointerdown: 3, + pointermove: 3, + pointerup: 3, + + MSPointerDown: 3, + MSPointerMove: 3, + MSPointerUp: 3 + }); + + me.extend(me.ease = {}, { + quadratic: { + style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)', + fn: function(k) { + return k * (2 - k); + } + }, + circular: { + style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1) + fn: function(k) { + return Math.sqrt(1 - (--k * k)); + } + }, + back: { + style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)', + fn: function(k) { + var b = 4; + return (k = k - 1) * k * ((b + 1) * k + b) + 1; + } + }, + bounce: { + style: '', + fn: function(k) { + if ((k /= 1) < (1 / 2.75)) { + return 7.5625 * k * k; + } else if (k < (2 / 2.75)) { + return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75; + } else if (k < (2.5 / 2.75)) { + return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375; + } else { + return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375; + } + } + }, + elastic: { + style: '', + fn: function(k) { + var f = 0.22, + e = 0.4; + + if (k === 0) { + return 0; + } + if (k == 1) { + return 1; + } + + return (e * Math.pow(2, -10 * k) * Math.sin((k - f / 4) * (2 * Math.PI) / f) + 1); + } + } + }); + + me.tap = function(e, eventName) { + var ev = document.createEvent('Event'); + ev.initEvent(eventName, true, true); + ev.pageX = e.pageX; + ev.pageY = e.pageY; + e.target.dispatchEvent(ev); + }; + + me.click = function(e) { + var target = e.target, + ev; + + if (!(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName)) { + ev = document.createEvent('MouseEvents'); + ev.initMouseEvent('click', true, true, e.view, 1, + target.screenX, target.screenY, target.clientX, target.clientY, + e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, + 0, null); + + ev._constructed = true; + target.dispatchEvent(ev); + } + }; + + return me; + })(); + + function IScroll(el, options) { + this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; + this.scroller = this.wrapper.children[0]; + this.scrollerStyle = this.scroller.style; // cache style for better performance + + this.options = { + + resizeScrollbars: true, + + mouseWheelSpeed: 20, + + snapThreshold: 0.334, + + // INSERT POINT: OPTIONS + + startX: 0, + startY: 0, + scrollY: true, + directionLockThreshold: 5, + momentum: true, + + bounce: true, + bounceTime: 600, + bounceEasing: '', + + preventDefault: true, + preventDefaultException: { + tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ + }, + + HWCompositing: true, + useTransition: true, + useTransform: true + }; + + for (var i in options) { + this.options[i] = options[i]; + } + + // Normalize options + this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : ''; + + this.options.useTransition = utils.hasTransition && this.options.useTransition; + this.options.useTransform = utils.hasTransform && this.options.useTransform; + + this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough; + this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault; + + // If you want eventPassthrough I have to lock one of the axes + this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY; + this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX; + + // With eventPassthrough we also need lockDirection mechanism + this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough; + this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold; + + this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing; + + this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling; + + if (this.options.tap === true) { + this.options.tap = 'tap'; + } + + if (this.options.shrinkScrollbars == 'scale') { + this.options.useTransition = false; + } + + this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1; + + // INSERT POINT: NORMALIZATION + + // Some defaults + this.x = 0; + this.y = 0; + this.directionX = 0; + this.directionY = 0; + this._events = {}; + + // INSERT POINT: DEFAULTS + + this._init(); + this.refresh(); + + this.scrollTo(this.options.startX, this.options.startY); + this.enable(); + } + + IScroll.prototype = { + version: '5.1.3', + + _init: function() { + this._initEvents(); + + if (this.options.scrollbars || this.options.indicators) { + this._initIndicators(); + } + + if (this.options.mouseWheel) { + this._initWheel(); + } + + if (this.options.snap) { + this._initSnap(); + } + + if (this.options.keyBindings) { + this._initKeys(); + } + + // INSERT POINT: _init + + }, + + destroy: function() { + this._initEvents(true); + + this._execEvent('destroy'); + }, + + _transitionEnd: function(e) { + if (e.target != this.scroller || !this.isInTransition) { + return; + } + + this._transitionTime(); + if (!this.resetPosition(this.options.bounceTime)) { + this.isInTransition = false; + this._execEvent('scrollEnd'); + } + }, + + _start: function(e) { + // React to left mouse button only + if (utils.eventType[e.type] != 1) { + if (e.button !== 0) { + return; + } + } + + if (!this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated)) { + return; + } + + if (this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException)) { + e.preventDefault(); + } + + var point = e.touches ? e.touches[0] : e, + pos; + + this.initiated = utils.eventType[e.type]; + this.moved = false; + this.distX = 0; + this.distY = 0; + this.directionX = 0; + this.directionY = 0; + this.directionLocked = 0; + + this._transitionTime(); + + this.startTime = utils.getTime(); + + if (this.options.useTransition && this.isInTransition) { + this.isInTransition = false; + pos = this.getComputedPosition(); + this._translate(Math.round(pos.x), Math.round(pos.y)); + this._execEvent('scrollEnd'); + } else if (!this.options.useTransition && this.isAnimating) { + this.isAnimating = false; + this._execEvent('scrollEnd'); + } + + this.startX = this.x; + this.startY = this.y; + this.absStartX = this.x; + this.absStartY = this.y; + this.pointX = point.pageX; + this.pointY = point.pageY; + + this._execEvent('beforeScrollStart'); + }, + + _move: function(e) { + if (!this.enabled || utils.eventType[e.type] !== this.initiated) { + return; + } + + if (this.options.preventDefault) { // increases performance on Android? TODO: check! + e.preventDefault(); + } + + var point = e.touches ? e.touches[0] : e, + deltaX = point.pageX - this.pointX, + deltaY = point.pageY - this.pointY, + timestamp = utils.getTime(), + newX, newY, + absDistX, absDistY; + + this.pointX = point.pageX; + this.pointY = point.pageY; + + this.distX += deltaX; + this.distY += deltaY; + absDistX = Math.abs(this.distX); + absDistY = Math.abs(this.distY); + + // We need to move at least 10 pixels for the scrolling to initiate + if (timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10)) { + return; + } + + // If you are scrolling in one direction lock the other + if (!this.directionLocked && !this.options.freeScroll) { + if (absDistX > absDistY + this.options.directionLockThreshold) { + this.directionLocked = 'h'; // lock horizontally + } else if (absDistY >= absDistX + this.options.directionLockThreshold) { + this.directionLocked = 'v'; // lock vertically + } else { + this.directionLocked = 'n'; // no lock + } + } + + if (this.directionLocked == 'h') { + if (this.options.eventPassthrough == 'vertical') { + e.preventDefault(); + } else if (this.options.eventPassthrough == 'horizontal') { + this.initiated = false; + return; + } + + deltaY = 0; + } else if (this.directionLocked == 'v') { + if (this.options.eventPassthrough == 'horizontal') { + e.preventDefault(); + } else if (this.options.eventPassthrough == 'vertical') { + this.initiated = false; + return; + } + + deltaX = 0; + } + + deltaX = this.hasHorizontalScroll ? deltaX : 0; + deltaY = this.hasVerticalScroll ? deltaY : 0; + + newX = this.x + deltaX; + newY = this.y + deltaY; + + // Slow down if outside of the boundaries + if (newX > 0 || newX < this.maxScrollX) { + newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX; + } + if (newY > 0 || newY < this.maxScrollY) { + newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY; + } + + this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; + this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; + + if (!this.moved) { + this._execEvent('scrollStart'); + } + + this.moved = true; + + this._translate(newX, newY); + + /* REPLACE START: _move */ + + if (timestamp - this.startTime > 300) { + this.startTime = timestamp; + this.startX = this.x; + this.startY = this.y; + } + + /* REPLACE END: _move */ + + }, + + _end: function(e) { + if (!this.enabled || utils.eventType[e.type] !== this.initiated) { + return; + } + + if (this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException)) { + e.preventDefault(); + } + + var point = e.changedTouches ? e.changedTouches[0] : e, + momentumX, + momentumY, + duration = utils.getTime() - this.startTime, + newX = Math.round(this.x), + newY = Math.round(this.y), + distanceX = Math.abs(newX - this.startX), + distanceY = Math.abs(newY - this.startY), + time = 0, + easing = ''; + + this.isInTransition = 0; + this.initiated = 0; + this.endTime = utils.getTime(); + + // reset if we are outside of the boundaries + if (this.resetPosition(this.options.bounceTime)) { + return; + } + + this.scrollTo(newX, newY); // ensures that the last position is rounded + + // we scrolled less than 10 pixels + if (!this.moved) { + if (this.options.tap) { + utils.tap(e, this.options.tap); + } + + if (this.options.click) { + utils.click(e); + } + + this._execEvent('scrollCancel'); + return; + } + + if (this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100) { + this._execEvent('flick'); + return; + } + + // start momentum animation if needed + if (this.options.momentum && duration < 300) { + momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { + destination: newX, + duration: 0 + }; + momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { + destination: newY, + duration: 0 + }; + newX = momentumX.destination; + newY = momentumY.destination; + time = Math.max(momentumX.duration, momentumY.duration); + this.isInTransition = 1; + } + + + if (this.options.snap) { + var snap = this._nearestSnap(newX, newY); + this.currentPage = snap; + time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(newX - snap.x), 1000), + Math.min(Math.abs(newY - snap.y), 1000) + ), 300); + newX = snap.x; + newY = snap.y; + + this.directionX = 0; + this.directionY = 0; + easing = this.options.bounceEasing; + } + + // INSERT POINT: _end + + if (newX != this.x || newY != this.y) { + // change easing function when scroller goes out of the boundaries + if (newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY) { + easing = utils.ease.quadratic; + } + + this.scrollTo(newX, newY, time, easing); + return; + } + + this._execEvent('scrollEnd'); + }, + + _resize: function() { + var that = this; + + clearTimeout(this.resizeTimeout); + + this.resizeTimeout = setTimeout(function() { + that.refresh(); + }, this.options.resizePolling); + }, + + resetPosition: function(time) { + var x = this.x, + y = this.y; + + time = time || 0; + + if (!this.hasHorizontalScroll || this.x > 0) { + x = 0; + } else if (this.x < this.maxScrollX) { + x = this.maxScrollX; + } + + if (!this.hasVerticalScroll || this.y > 0) { + y = 0; + } else if (this.y < this.maxScrollY) { + y = this.maxScrollY; + } + + if (x == this.x && y == this.y) { + return false; + } + + this.scrollTo(x, y, time, this.options.bounceEasing); + + return true; + }, + + disable: function() { + this.enabled = false; + }, + + enable: function() { + this.enabled = true; + }, + + refresh: function() { + var rf = this.wrapper.offsetHeight; // Force reflow + + this.wrapperWidth = this.wrapper.clientWidth; + this.wrapperHeight = this.wrapper.clientHeight; + + /* REPLACE START: refresh */ + + this.scrollerWidth = this.scroller.offsetWidth; + this.scrollerHeight = this.scroller.offsetHeight; + + this.maxScrollX = this.wrapperWidth - this.scrollerWidth; + this.maxScrollY = this.wrapperHeight - this.scrollerHeight; + + /* REPLACE END: refresh */ + + this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0; + this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0; + + if (!this.hasHorizontalScroll) { + this.maxScrollX = 0; + this.scrollerWidth = this.wrapperWidth; + } + + if (!this.hasVerticalScroll) { + this.maxScrollY = 0; + this.scrollerHeight = this.wrapperHeight; + } + + this.endTime = 0; + this.directionX = 0; + this.directionY = 0; + + this.wrapperOffset = utils.offset(this.wrapper); + + this._execEvent('refresh'); + + this.resetPosition(); + + // INSERT POINT: _refresh + + }, + + on: function(type, fn) { + if (!this._events[type]) { + this._events[type] = []; + } + + this._events[type].push(fn); + }, + + off: function(type, fn) { + if (!this._events[type]) { + return; + } + + var index = this._events[type].indexOf(fn); + + if (index > -1) { + this._events[type].splice(index, 1); + } + }, + + _execEvent: function(type) { + if (!this._events[type]) { + return; + } + + var i = 0, + l = this._events[type].length; + + if (!l) { + return; + } + + for (; i < l; i++) { + this._events[type][i].apply(this, [].slice.call(arguments, 1)); + } + }, + + scrollBy: function(x, y, time, easing) { + x = this.x + x; + y = this.y + y; + time = time || 0; + + this.scrollTo(x, y, time, easing); + }, + + scrollTo: function(x, y, time, easing) { + easing = easing || utils.ease.circular; + + this.isInTransition = this.options.useTransition && time > 0; + + if (!time || (this.options.useTransition && easing.style)) { + this._transitionTimingFunction(easing.style); + this._transitionTime(time); + this._translate(x, y); + } else { + this._animate(x, y, time, easing.fn); + } + }, + + scrollToElement: function(el, time, offsetX, offsetY, easing) { + el = el.nodeType ? el : this.scroller.querySelector(el); + + if (!el) { + return; + } + + var pos = utils.offset(el); + + pos.left -= this.wrapperOffset.left; + pos.top -= this.wrapperOffset.top; + + // if offsetX/Y are true we center the element to the screen + if (offsetX === true) { + offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2); + } + if (offsetY === true) { + offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2); + } + + pos.left -= offsetX || 0; + pos.top -= offsetY || 0; + + pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left; + pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top; + + time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x - pos.left), Math.abs(this.y - pos.top)) : time; + + this.scrollTo(pos.left, pos.top, time, easing); + }, + + _transitionTime: function(time) { + time = time || 0; + + this.scrollerStyle[utils.style.transitionDuration] = time + 'ms'; + + if (!time && utils.isBadAndroid) { + this.scrollerStyle[utils.style.transitionDuration] = '0.001s'; + } + + + if (this.indicators) { + for (var i = this.indicators.length; i--;) { + this.indicators[i].transitionTime(time); + } + } + + + // INSERT POINT: _transitionTime + + }, + + _transitionTimingFunction: function(easing) { + this.scrollerStyle[utils.style.transitionTimingFunction] = easing; + + + if (this.indicators) { + for (var i = this.indicators.length; i--;) { + this.indicators[i].transitionTimingFunction(easing); + } + } + + + // INSERT POINT: _transitionTimingFunction + + }, + + _translate: function(x, y) { + if (this.options.useTransform) { + + /* REPLACE START: _translate */ + + this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ; + + /* REPLACE END: _translate */ + + } else { + x = Math.round(x); + y = Math.round(y); + this.scrollerStyle.left = x + 'px'; + this.scrollerStyle.top = y + 'px'; + } + + this.x = x; + this.y = y; + + + if (this.indicators) { + for (var i = this.indicators.length; i--;) { + this.indicators[i].updatePosition(); + } + } + + + // INSERT POINT: _translate + + }, + + _initEvents: function(remove) { + var eventType = remove ? utils.removeEvent : utils.addEvent, + target = this.options.bindToWrapper ? this.wrapper : window; + + eventType(window, 'orientationchange', this); + eventType(window, 'resize', this); + + if (this.options.click) { + eventType(this.wrapper, 'click', this, true); + } + + if (!this.options.disableMouse) { + eventType(this.wrapper, 'mousedown', this); + eventType(target, 'mousemove', this); + eventType(target, 'mousecancel', this); + eventType(target, 'mouseup', this); + } + + if (utils.hasPointer && !this.options.disablePointer) { + eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this); + eventType(target, utils.prefixPointerEvent('pointermove'), this); + eventType(target, utils.prefixPointerEvent('pointercancel'), this); + eventType(target, utils.prefixPointerEvent('pointerup'), this); + } + + if (utils.hasTouch && !this.options.disableTouch) { + eventType(this.wrapper, 'touchstart', this); + eventType(target, 'touchmove', this); + eventType(target, 'touchcancel', this); + eventType(target, 'touchend', this); + } + + eventType(this.scroller, 'transitionend', this); + eventType(this.scroller, 'webkitTransitionEnd', this); + eventType(this.scroller, 'oTransitionEnd', this); + eventType(this.scroller, 'MSTransitionEnd', this); + }, + + getComputedPosition: function() { + var matrix = window.getComputedStyle(this.scroller, null), + x, y; + + if (this.options.useTransform) { + matrix = matrix[utils.style.transform].split(')')[0].split(', '); + x = +(matrix[12] || matrix[4]); + y = +(matrix[13] || matrix[5]); + } else { + x = +matrix.left.replace(/[^-\d.]/g, ''); + y = +matrix.top.replace(/[^-\d.]/g, ''); + } + + return { + x: x, + y: y + }; + }, + + _initIndicators: function() { + var interactive = this.options.interactiveScrollbars, + customStyle = typeof this.options.scrollbars != 'string', + indicators = [], + indicator; + + var that = this; + + this.indicators = []; + + if (this.options.scrollbars) { + // Vertical scrollbar + if (this.options.scrollY) { + indicator = { + el: createDefaultScrollbar('v', interactive, this.options.scrollbars), + interactive: interactive, + defaultScrollbars: true, + customStyle: customStyle, + resize: this.options.resizeScrollbars, + shrink: this.options.shrinkScrollbars, + fade: this.options.fadeScrollbars, + listenX: false + }; + + this.wrapper.appendChild(indicator.el); + indicators.push(indicator); + } + + // Horizontal scrollbar + if (this.options.scrollX) { + indicator = { + el: createDefaultScrollbar('h', interactive, this.options.scrollbars), + interactive: interactive, + defaultScrollbars: true, + customStyle: customStyle, + resize: this.options.resizeScrollbars, + shrink: this.options.shrinkScrollbars, + fade: this.options.fadeScrollbars, + listenY: false + }; + + this.wrapper.appendChild(indicator.el); + indicators.push(indicator); + } + } + + if (this.options.indicators) { + // TODO: check concat compatibility + indicators = indicators.concat(this.options.indicators); + } + + for (var i = indicators.length; i--;) { + this.indicators.push(new Indicator(this, indicators[i])); + } + + // TODO: check if we can use array.map (wide compatibility and performance issues) + function _indicatorsMap(fn) { + for (var i = that.indicators.length; i--;) { + fn.call(that.indicators[i]); + } + } + + if (this.options.fadeScrollbars) { + this.on('scrollEnd', function() { + _indicatorsMap(function() { + this.fade(); + }); + }); + + this.on('scrollCancel', function() { + _indicatorsMap(function() { + this.fade(); + }); + }); + + this.on('scrollStart', function() { + _indicatorsMap(function() { + this.fade(1); + }); + }); + + this.on('beforeScrollStart', function() { + _indicatorsMap(function() { + this.fade(1, true); + }); + }); + } + + + this.on('refresh', function() { + _indicatorsMap(function() { + this.refresh(); + }); + }); + + this.on('destroy', function() { + _indicatorsMap(function() { + this.destroy(); + }); + + delete this.indicators; + }); + }, + + _initWheel: function() { + utils.addEvent(this.wrapper, 'wheel', this); + utils.addEvent(this.wrapper, 'mousewheel', this); + utils.addEvent(this.wrapper, 'DOMMouseScroll', this); + + this.on('destroy', function() { + utils.removeEvent(this.wrapper, 'wheel', this); + utils.removeEvent(this.wrapper, 'mousewheel', this); + utils.removeEvent(this.wrapper, 'DOMMouseScroll', this); + }); + }, + + _wheel: function(e) { + if (!this.enabled) { + return; + } + + e.preventDefault(); + e.stopPropagation(); + + var wheelDeltaX, wheelDeltaY, + newX, newY, + that = this; + + if (this.wheelTimeout === undefined) { + that._execEvent('scrollStart'); + } + + // Execute the scrollEnd event after 400ms the wheel stopped scrolling + clearTimeout(this.wheelTimeout); + this.wheelTimeout = setTimeout(function() { + that._execEvent('scrollEnd'); + that.wheelTimeout = undefined; + }, 400); + + if ('deltaX' in e) { + if (e.deltaMode === 1) { + wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed; + wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed; + } else { + wheelDeltaX = -e.deltaX; + wheelDeltaY = -e.deltaY; + } + } else if ('wheelDeltaX' in e) { + wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed; + wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed; + } else if ('wheelDelta' in e) { + wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed; + } else if ('detail' in e) { + wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed; + } else { + return; + } + + wheelDeltaX *= this.options.invertWheelDirection; + wheelDeltaY *= this.options.invertWheelDirection; + + if (!this.hasVerticalScroll) { + wheelDeltaX = wheelDeltaY; + wheelDeltaY = 0; + } + + if (this.options.snap) { + newX = this.currentPage.pageX; + newY = this.currentPage.pageY; + + if (wheelDeltaX > 0) { + newX--; + } else if (wheelDeltaX < 0) { + newX++; + } + + if (wheelDeltaY > 0) { + newY--; + } else if (wheelDeltaY < 0) { + newY++; + } + + this.goToPage(newX, newY); + + return; + } + + newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0); + newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0); + + if (newX > 0) { + newX = 0; + } else if (newX < this.maxScrollX) { + newX = this.maxScrollX; + } + + if (newY > 0) { + newY = 0; + } else if (newY < this.maxScrollY) { + newY = this.maxScrollY; + } + + this.scrollTo(newX, newY, 0); + + // INSERT POINT: _wheel + }, + + _initSnap: function() { + this.currentPage = {}; + + if (typeof this.options.snap == 'string') { + this.options.snap = this.scroller.querySelectorAll(this.options.snap); + } + + this.on('refresh', function() { + var i = 0, + l, + m = 0, + n, + cx, cy, + x = 0, + y, + stepX = this.options.snapStepX || this.wrapperWidth, + stepY = this.options.snapStepY || this.wrapperHeight, + el; + + this.pages = []; + + if (!this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight) { + return; + } + + if (this.options.snap === true) { + cx = Math.round(stepX / 2); + cy = Math.round(stepY / 2); + + while (x > -this.scrollerWidth) { + this.pages[i] = []; + l = 0; + y = 0; + + while (y > -this.scrollerHeight) { + this.pages[i][l] = { + x: Math.max(x, this.maxScrollX), + y: Math.max(y, this.maxScrollY), + width: stepX, + height: stepY, + cx: x - cx, + cy: y - cy + }; + + y -= stepY; + l++; + } + + x -= stepX; + i++; + } + } else { + el = this.options.snap; + l = el.length; + n = -1; + + for (; i < l; i++) { + if (i === 0 || el[i].offsetLeft <= el[i - 1].offsetLeft) { + m = 0; + n++; + } + + if (!this.pages[m]) { + this.pages[m] = []; + } + + x = Math.max(-el[i].offsetLeft, this.maxScrollX); + y = Math.max(-el[i].offsetTop, this.maxScrollY); + cx = x - Math.round(el[i].offsetWidth / 2); + cy = y - Math.round(el[i].offsetHeight / 2); + + this.pages[m][n] = { + x: x, + y: y, + width: el[i].offsetWidth, + height: el[i].offsetHeight, + cx: cx, + cy: cy + }; + + if (x > this.maxScrollX) { + m++; + } + } + } + + this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0); + + // Update snap threshold if needed + if (this.options.snapThreshold % 1 === 0) { + this.snapThresholdX = this.options.snapThreshold; + this.snapThresholdY = this.options.snapThreshold; + } else { + this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold); + this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold); + } + }); + + this.on('flick', function() { + var time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(this.x - this.startX), 1000), + Math.min(Math.abs(this.y - this.startY), 1000) + ), 300); + + this.goToPage( + this.currentPage.pageX + this.directionX, + this.currentPage.pageY + this.directionY, + time + ); + }); + }, + + _nearestSnap: function(x, y) { + if (!this.pages.length) { + return { + x: 0, + y: 0, + pageX: 0, + pageY: 0 + }; + } + + var i = 0, + l = this.pages.length, + m = 0; + + // Check if we exceeded the snap threshold + if (Math.abs(x - this.absStartX) < this.snapThresholdX && + Math.abs(y - this.absStartY) < this.snapThresholdY) { + return this.currentPage; + } + + if (x > 0) { + x = 0; + } else if (x < this.maxScrollX) { + x = this.maxScrollX; + } + + if (y > 0) { + y = 0; + } else if (y < this.maxScrollY) { + y = this.maxScrollY; + } + + for (; i < l; i++) { + if (x >= this.pages[i][0].cx) { + x = this.pages[i][0].x; + break; + } + } + + l = this.pages[i].length; + + for (; m < l; m++) { + if (y >= this.pages[0][m].cy) { + y = this.pages[0][m].y; + break; + } + } + + if (i == this.currentPage.pageX) { + i += this.directionX; + + if (i < 0) { + i = 0; + } else if (i >= this.pages.length) { + i = this.pages.length - 1; + } + + x = this.pages[i][0].x; + } + + if (m == this.currentPage.pageY) { + m += this.directionY; + + if (m < 0) { + m = 0; + } else if (m >= this.pages[0].length) { + m = this.pages[0].length - 1; + } + + y = this.pages[0][m].y; + } + + return { + x: x, + y: y, + pageX: i, + pageY: m + }; + }, + + goToPage: function(x, y, time, easing) { + easing = easing || this.options.bounceEasing; + + if (x >= this.pages.length) { + x = this.pages.length - 1; + } else if (x < 0) { + x = 0; + } + + if (y >= this.pages[x].length) { + y = this.pages[x].length - 1; + } else if (y < 0) { + y = 0; + } + + var posX = this.pages[x][y].x, + posY = this.pages[x][y].y; + + time = time === undefined ? this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(posX - this.x), 1000), + Math.min(Math.abs(posY - this.y), 1000) + ), 300) : time; + + this.currentPage = { + x: posX, + y: posY, + pageX: x, + pageY: y + }; + + this.scrollTo(posX, posY, time, easing); + }, + + next: function(time, easing) { + var x = this.currentPage.pageX, + y = this.currentPage.pageY; + + x++; + + if (x >= this.pages.length && this.hasVerticalScroll) { + x = 0; + y++; + } + + this.goToPage(x, y, time, easing); + }, + + prev: function(time, easing) { + var x = this.currentPage.pageX, + y = this.currentPage.pageY; + + x--; + + if (x < 0 && this.hasVerticalScroll) { + x = 0; + y--; + } + + this.goToPage(x, y, time, easing); + }, + + _initKeys: function(e) { + // default key bindings + var keys = { + pageUp: 33, + pageDown: 34, + end: 35, + home: 36, + left: 37, + up: 38, + right: 39, + down: 40 + }; + var i; + + // if you give me characters I give you keycode + if (typeof this.options.keyBindings == 'object') { + for (i in this.options.keyBindings) { + if (typeof this.options.keyBindings[i] == 'string') { + this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0); + } + } + } else { + this.options.keyBindings = {}; + } + + for (i in keys) { + this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i]; + } + + utils.addEvent(window, 'keydown', this); + + this.on('destroy', function() { + utils.removeEvent(window, 'keydown', this); + }); + }, + + _key: function(e) { + if (!this.enabled) { + return; + } + + var snap = this.options.snap, // we are using this alot, better to cache it + newX = snap ? this.currentPage.pageX : this.x, + newY = snap ? this.currentPage.pageY : this.y, + now = utils.getTime(), + prevTime = this.keyTime || 0, + acceleration = 0.250, + pos; + + if (this.options.useTransition && this.isInTransition) { + pos = this.getComputedPosition(); + + this._translate(Math.round(pos.x), Math.round(pos.y)); + this.isInTransition = false; + } + + this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0; + + switch (e.keyCode) { + case this.options.keyBindings.pageUp: + if (this.hasHorizontalScroll && !this.hasVerticalScroll) { + newX += snap ? 1 : this.wrapperWidth; + } else { + newY += snap ? 1 : this.wrapperHeight; + } + break; + case this.options.keyBindings.pageDown: + if (this.hasHorizontalScroll && !this.hasVerticalScroll) { + newX -= snap ? 1 : this.wrapperWidth; + } else { + newY -= snap ? 1 : this.wrapperHeight; + } + break; + case this.options.keyBindings.end: + newX = snap ? this.pages.length - 1 : this.maxScrollX; + newY = snap ? this.pages[0].length - 1 : this.maxScrollY; + break; + case this.options.keyBindings.home: + newX = 0; + newY = 0; + break; + case this.options.keyBindings.left: + newX += snap ? -1 : 5 + this.keyAcceleration >> 0; + break; + case this.options.keyBindings.up: + newY += snap ? 1 : 5 + this.keyAcceleration >> 0; + break; + case this.options.keyBindings.right: + newX -= snap ? -1 : 5 + this.keyAcceleration >> 0; + break; + case this.options.keyBindings.down: + newY -= snap ? 1 : 5 + this.keyAcceleration >> 0; + break; + default: + return; + } + + if (snap) { + this.goToPage(newX, newY); + return; + } + + if (newX > 0) { + newX = 0; + this.keyAcceleration = 0; + } else if (newX < this.maxScrollX) { + newX = this.maxScrollX; + this.keyAcceleration = 0; + } + + if (newY > 0) { + newY = 0; + this.keyAcceleration = 0; + } else if (newY < this.maxScrollY) { + newY = this.maxScrollY; + this.keyAcceleration = 0; + } + + this.scrollTo(newX, newY, 0); + + this.keyTime = now; + }, + + _animate: function(destX, destY, duration, easingFn) { + var that = this, + startX = this.x, + startY = this.y, + startTime = utils.getTime(), + destTime = startTime + duration; + + function step() { + var now = utils.getTime(), + newX, newY, + easing; + + if (now >= destTime) { + that.isAnimating = false; + that._translate(destX, destY); + + if (!that.resetPosition(that.options.bounceTime)) { + that._execEvent('scrollEnd'); + } + + return; + } + + now = (now - startTime) / duration; + easing = easingFn(now); + newX = (destX - startX) * easing + startX; + newY = (destY - startY) * easing + startY; + that._translate(newX, newY); + + if (that.isAnimating) { + rAF(step); + } + } + + this.isAnimating = true; + step(); + }, + handleEvent: function(e) { + switch (e.type) { + case 'touchstart': + case 'pointerdown': + case 'MSPointerDown': + case 'mousedown': + this._start(e); + break; + case 'touchmove': + case 'pointermove': + case 'MSPointerMove': + case 'mousemove': + this._move(e); + break; + case 'touchend': + case 'pointerup': + case 'MSPointerUp': + case 'mouseup': + case 'touchcancel': + case 'pointercancel': + case 'MSPointerCancel': + case 'mousecancel': + this._end(e); + break; + case 'orientationchange': + case 'resize': + this._resize(); + break; + case 'transitionend': + case 'webkitTransitionEnd': + case 'oTransitionEnd': + case 'MSTransitionEnd': + this._transitionEnd(e); + break; + case 'wheel': + case 'DOMMouseScroll': + case 'mousewheel': + this._wheel(e); + break; + case 'keydown': + this._key(e); + break; + case 'click': + if (!e._constructed) { + e.preventDefault(); + e.stopPropagation(); + } + break; + } + } + }; + + function createDefaultScrollbar(direction, interactive, type) { + var scrollbar = document.createElement('div'), + indicator = document.createElement('div'); + + if (type === true) { + scrollbar.style.cssText = 'position:absolute;z-index:9999'; + indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px'; + } + + indicator.className = 'iScrollIndicator'; + + if (direction == 'h') { + if (type === true) { + scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0'; + indicator.style.height = '100%'; + } + scrollbar.className = 'iScrollHorizontalScrollbar'; + } else { + if (type === true) { + scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px'; + indicator.style.width = '100%'; + } + scrollbar.className = 'iScrollVerticalScrollbar'; + } + + scrollbar.style.cssText += ';overflow:hidden'; + + if (!interactive) { + scrollbar.style.pointerEvents = 'none'; + } + + scrollbar.appendChild(indicator); + + return scrollbar; + } + + function Indicator(scroller, options) { + this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el; + this.wrapperStyle = this.wrapper.style; + this.indicator = this.wrapper.children[0]; + this.indicatorStyle = this.indicator.style; + this.scroller = scroller; + + this.options = { + listenX: true, + listenY: true, + interactive: false, + resize: true, + defaultScrollbars: false, + shrink: false, + fade: false, + speedRatioX: 0, + speedRatioY: 0 + }; + + for (var i in options) { + this.options[i] = options[i]; + } + + this.sizeRatioX = 1; + this.sizeRatioY = 1; + this.maxPosX = 0; + this.maxPosY = 0; + + if (this.options.interactive) { + if (!this.options.disableTouch) { + utils.addEvent(this.indicator, 'touchstart', this); + utils.addEvent(window, 'touchend', this); + } + if (!this.options.disablePointer) { + utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); + utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this); + } + if (!this.options.disableMouse) { + utils.addEvent(this.indicator, 'mousedown', this); + utils.addEvent(window, 'mouseup', this); + } + } + + if (this.options.fade) { + this.wrapperStyle[utils.style.transform] = this.scroller.translateZ; + this.wrapperStyle[utils.style.transitionDuration] = utils.isBadAndroid ? '0.001s' : '0ms'; + this.wrapperStyle.opacity = '0'; + } + } + + Indicator.prototype = { + handleEvent: function(e) { + switch (e.type) { + case 'touchstart': + case 'pointerdown': + case 'MSPointerDown': + case 'mousedown': + this._start(e); + break; + case 'touchmove': + case 'pointermove': + case 'MSPointerMove': + case 'mousemove': + this._move(e); + break; + case 'touchend': + case 'pointerup': + case 'MSPointerUp': + case 'mouseup': + case 'touchcancel': + case 'pointercancel': + case 'MSPointerCancel': + case 'mousecancel': + this._end(e); + break; + } + }, + + destroy: function() { + if (this.options.interactive) { + utils.removeEvent(this.indicator, 'touchstart', this); + utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); + utils.removeEvent(this.indicator, 'mousedown', this); + + utils.removeEvent(window, 'touchmove', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); + utils.removeEvent(window, 'mousemove', this); + + utils.removeEvent(window, 'touchend', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this); + utils.removeEvent(window, 'mouseup', this); + } + + if (this.options.defaultScrollbars) { + this.wrapper.parentNode.removeChild(this.wrapper); + } + }, + + _start: function(e) { + var point = e.touches ? e.touches[0] : e; + + e.preventDefault(); + e.stopPropagation(); + + this.transitionTime(); + + this.initiated = true; + this.moved = false; + this.lastPointX = point.pageX; + this.lastPointY = point.pageY; + + this.startTime = utils.getTime(); + + if (!this.options.disableTouch) { + utils.addEvent(window, 'touchmove', this); + } + if (!this.options.disablePointer) { + utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this); + } + if (!this.options.disableMouse) { + utils.addEvent(window, 'mousemove', this); + } + + this.scroller._execEvent('beforeScrollStart'); + }, + + _move: function(e) { + var point = e.touches ? e.touches[0] : e, + deltaX, deltaY, + newX, newY, + timestamp = utils.getTime(); + + if (!this.moved) { + this.scroller._execEvent('scrollStart'); + } + + this.moved = true; + + deltaX = point.pageX - this.lastPointX; + this.lastPointX = point.pageX; + + deltaY = point.pageY - this.lastPointY; + this.lastPointY = point.pageY; + + newX = this.x + deltaX; + newY = this.y + deltaY; + + this._pos(newX, newY); + + // INSERT POINT: indicator._move + + e.preventDefault(); + e.stopPropagation(); + }, + + _end: function(e) { + if (!this.initiated) { + return; + } + + this.initiated = false; + + e.preventDefault(); + e.stopPropagation(); + + utils.removeEvent(window, 'touchmove', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); + utils.removeEvent(window, 'mousemove', this); + + if (this.scroller.options.snap) { + var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y); + + var time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(this.scroller.x - snap.x), 1000), + Math.min(Math.abs(this.scroller.y - snap.y), 1000) + ), 300); + + if (this.scroller.x != snap.x || this.scroller.y != snap.y) { + this.scroller.directionX = 0; + this.scroller.directionY = 0; + this.scroller.currentPage = snap; + this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing); + } + } + + if (this.moved) { + this.scroller._execEvent('scrollEnd'); + } + }, + + transitionTime: function(time) { + time = time || 0; + this.indicatorStyle[utils.style.transitionDuration] = time + 'ms'; + + if (!time && utils.isBadAndroid) { + this.indicatorStyle[utils.style.transitionDuration] = '0.001s'; + } + }, + + transitionTimingFunction: function(easing) { + this.indicatorStyle[utils.style.transitionTimingFunction] = easing; + }, + + refresh: function() { + this.transitionTime(); + + if (this.options.listenX && !this.options.listenY) { + this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none'; + } else if (this.options.listenY && !this.options.listenX) { + this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none'; + } else { + this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none'; + } + + if (this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll) { + utils.addClass(this.wrapper, 'iScrollBothScrollbars'); + utils.removeClass(this.wrapper, 'iScrollLoneScrollbar'); + + if (this.options.defaultScrollbars && this.options.customStyle) { + if (this.options.listenX) { + this.wrapper.style.right = '8px'; + } else { + this.wrapper.style.bottom = '8px'; + } + } + } else { + utils.removeClass(this.wrapper, 'iScrollBothScrollbars'); + utils.addClass(this.wrapper, 'iScrollLoneScrollbar'); + + if (this.options.defaultScrollbars && this.options.customStyle) { + if (this.options.listenX) { + this.wrapper.style.right = '2px'; + } else { + this.wrapper.style.bottom = '2px'; + } + } + } + + var r = this.wrapper.offsetHeight; // force refresh + + if (this.options.listenX) { + this.wrapperWidth = this.wrapper.clientWidth; + if (this.options.resize) { + this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8); + this.indicatorStyle.width = this.indicatorWidth + 'px'; + } else { + this.indicatorWidth = this.indicator.clientWidth; + } + + this.maxPosX = this.wrapperWidth - this.indicatorWidth; + + if (this.options.shrink == 'clip') { + this.minBoundaryX = -this.indicatorWidth + 8; + this.maxBoundaryX = this.wrapperWidth - 8; + } else { + this.minBoundaryX = 0; + this.maxBoundaryX = this.maxPosX; + } + + this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX)); + } + + if (this.options.listenY) { + this.wrapperHeight = this.wrapper.clientHeight; + if (this.options.resize) { + this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8); + this.indicatorStyle.height = this.indicatorHeight + 'px'; + } else { + this.indicatorHeight = this.indicator.clientHeight; + } + + this.maxPosY = this.wrapperHeight - this.indicatorHeight; + + if (this.options.shrink == 'clip') { + this.minBoundaryY = -this.indicatorHeight + 8; + this.maxBoundaryY = this.wrapperHeight - 8; + } else { + this.minBoundaryY = 0; + this.maxBoundaryY = this.maxPosY; + } + + this.maxPosY = this.wrapperHeight - this.indicatorHeight; + this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY)); + } + + this.updatePosition(); + }, + + updatePosition: function() { + var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0, + y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0; + + if (!this.options.ignoreBoundaries) { + if (x < this.minBoundaryX) { + if (this.options.shrink == 'scale') { + this.width = Math.max(this.indicatorWidth + x, 8); + this.indicatorStyle.width = this.width + 'px'; + } + x = this.minBoundaryX; + } else if (x > this.maxBoundaryX) { + if (this.options.shrink == 'scale') { + this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8); + this.indicatorStyle.width = this.width + 'px'; + x = this.maxPosX + this.indicatorWidth - this.width; + } else { + x = this.maxBoundaryX; + } + } else if (this.options.shrink == 'scale' && this.width != this.indicatorWidth) { + this.width = this.indicatorWidth; + this.indicatorStyle.width = this.width + 'px'; + } + + if (y < this.minBoundaryY) { + if (this.options.shrink == 'scale') { + this.height = Math.max(this.indicatorHeight + y * 3, 8); + this.indicatorStyle.height = this.height + 'px'; + } + y = this.minBoundaryY; + } else if (y > this.maxBoundaryY) { + if (this.options.shrink == 'scale') { + this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8); + this.indicatorStyle.height = this.height + 'px'; + y = this.maxPosY + this.indicatorHeight - this.height; + } else { + y = this.maxBoundaryY; + } + } else if (this.options.shrink == 'scale' && this.height != this.indicatorHeight) { + this.height = this.indicatorHeight; + this.indicatorStyle.height = this.height + 'px'; + } + } + + this.x = x; + this.y = y; + + if (this.scroller.options.useTransform) { + this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ; + } else { + this.indicatorStyle.left = x + 'px'; + this.indicatorStyle.top = y + 'px'; + } + }, + + _pos: function(x, y) { + if (x < 0) { + x = 0; + } else if (x > this.maxPosX) { + x = this.maxPosX; + } + + if (y < 0) { + y = 0; + } else if (y > this.maxPosY) { + y = this.maxPosY; + } + + x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x; + y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y; + + this.scroller.scrollTo(x, y); + }, + + fade: function(val, hold) { + if (hold && !this.visible) { + return; + } + + clearTimeout(this.fadeTimeout); + this.fadeTimeout = null; + + var time = val ? 250 : 500, + delay = val ? 0 : 300; + + val = val ? '1' : '0'; + + this.wrapperStyle[utils.style.transitionDuration] = time + 'ms'; + + this.fadeTimeout = setTimeout((function(val) { + this.wrapperStyle.opacity = val; + this.visible = +val; + }).bind(this, val), delay); + } + }; + + IScroll.utils = utils; + + if (typeof module != 'undefined' && module.exports) { + module.exports = IScroll; + } else { + window.IScroll = IScroll; + } + + })(window, document, Math); +}); diff --git a/mip-bsml-carousel/mip-bsml-carousel.js b/mip-bsml-carousel/mip-bsml-carousel.js new file mode 100644 index 00000000..948e47d0 --- /dev/null +++ b/mip-bsml-carousel/mip-bsml-carousel.js @@ -0,0 +1,45 @@ +/** + * @file mip-bsml-carousel 组件 + * @author + */ + +define(function (require) { + + var customElement = require('customElement').create(); + var $ = require('zepto'); + var IScroll = require('./iscroll/iscroll'); + + /** + * 构造元素,只会运行一次 + */ + customElement.prototype.build = function () { + // TODO + var me = this; + var element = me.element; + $(element).find('.mip-bsml-carousel-list-item').css({ + width: window.innerWidth + }); + var length = $(element).find('.mip-bsml-carousel-list-item').length; + $(element).find('.mip-bsml-carousel-list').css({ + width: length + '01%' + }); + $(element).find('.mip-bsml-carousel-list-item-point .total-length').html(length); + + var scrollParams = { + scrollX: true, + scrollY: false, + eventPassthrough: true, + momentum: false, + snap: true + }; + var scroll = new IScroll($(element).find('.mip-bsml-carousel')[0], scrollParams); + if (length > 1) { + scroll.on('scrollEnd', function () { + $(element).find('.mip-bsml-carousel-list-item-point .current').html(scroll.currentPage.pageX + 1); + }); + } + scroll.refresh(); + }; + + return customElement; +}); diff --git a/mip-bsml-carousel/package.json b/mip-bsml-carousel/package.json new file mode 100644 index 00000000..a9bb5ca2 --- /dev/null +++ b/mip-bsml-carousel/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-bsml-carousel", + "version": "1.0.0", + "description": "bsml轮播组件", + "contributors": [ + { + "name": "qishunli", + "email": "shunliqi@163.com" + } + ], + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-bsml-fixedbar/README.md b/mip-bsml-fixedbar/README.md new file mode 100644 index 00000000..d849a891 --- /dev/null +++ b/mip-bsml-fixedbar/README.md @@ -0,0 +1,22 @@ +# mip-bsml-fixedbar + +mip-bsml-fixedbar bsml底部转换工具组件 + +标题|内容 +----|---- +类型|通用 +支持布局|fixed +所需脚本|https://c.mipcdn.com/static/v1/mip-bsml-fixedbar/mip-bsml-fixedbar.js + +## 示例 + +### 基本用法 +```html + + + 自定义内容,可以嵌套其他组件 + + +``` + +需要配合mip-fixed组件实现fixed定位,fixed位置参考mip-fixed使用方式 diff --git a/mip-bsml-fixedbar/mip-bsml-fixedbar.js b/mip-bsml-fixedbar/mip-bsml-fixedbar.js new file mode 100644 index 00000000..16aade17 --- /dev/null +++ b/mip-bsml-fixedbar/mip-bsml-fixedbar.js @@ -0,0 +1,36 @@ +/** + * @file mip-bsml-fixed-bar 组件 + * @author + */ + +define(function (require) { + + var customElement = require('customElement').create(); + var $ = require('jquery'); + + /** + * 构造元素,只会运行一次 + */ + customElement.prototype.build = function () { + var me = this; + var element = me.element; + var wHeight = $(window).height(); + + $(element).on('click', '.mip-bsml-fixed-bar-box-appointment', function () { + $(element).find('.bsml-form-lay').fadeIn('fast').css({'height': wHeight}); + $(element).find('.bsml-form').animate({bottom: '0'}, 'fast'); + $(document).on('scroll touchmove', function (e) { + e.preventDefault(); + e.stopPropagation(); + }); + }); + + $(element).on('click', '.bsml-form-close', function () { + $(element).find('.bsml-form-lay').hide(); + $(element).find('.bsml-form').animate({bottom: '-800px'}, 'fast'); + $(document).off('scroll touchmove'); + }); + }; + + return customElement; +}); diff --git a/mip-bsml-fixedbar/package.json b/mip-bsml-fixedbar/package.json new file mode 100644 index 00000000..ecd9e55c --- /dev/null +++ b/mip-bsml-fixedbar/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-bsml-fixedbar", + "version": "1.0.0", + "description": "bsml底部转换工具组件", + "contributors": [ + { + "name": "qishunli", + "email": "shunliqi@163.com" + } + ], + "engines": { + "mip": ">=1.1.0" + } +} diff --git a/mip-bsml-form/README.md b/mip-bsml-form/README.md new file mode 100644 index 00000000..5279c080 --- /dev/null +++ b/mip-bsml-form/README.md @@ -0,0 +1,19 @@ +# mip-bsml-form + +mip-bsml-form bsml表单组件。 + +标题|内容 +----|---- +类型|通用 +支持布局|container, +所需脚本|https://c.mipcdn.com/static/v1/mip-bsml-form/mip-bsml-form.js + +## 示例 + +### 基本使用 + +```html + + 自定义内容,可以嵌套其他组件 + +``` \ No newline at end of file diff --git a/mip-bsml-form/mip-bsml-form.js b/mip-bsml-form/mip-bsml-form.js new file mode 100755 index 00000000..1f60a1b2 --- /dev/null +++ b/mip-bsml-form/mip-bsml-form.js @@ -0,0 +1,94 @@ +/** + * @file mip-bsml-form 组件 + * + * @author jiangsongfang + * @time 2016.12.17 + */ +define(function (require) { + var $ = require('zepto'); + var customElement = require('customElement').create(); + + var REGS = { + EMAIL: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, + PHONE: /^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|17[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/, + IDCAR: /^\d{15}|\d{18}$/ + }; + + /** + * [onSubmit 点击提交按钮事件处理函数] + */ + function onSubmit() { + + } + + /** + * [build build函数] + */ + customElement.prototype.build = function () { + var element = this.element; + var $selects = $(element).find('.bsml-singleselect-container'); + $selects.each(function (i, sel) { + var $sel = $(sel); + var options = $sel.attr('options'); + if (options) { + var name = $sel.attr('name'); + try { + options = JSON.parse(options); + var str = ''; + $sel.html(str); + } catch (e) { + console.log(e); + } + } + }); + + var parm = {}; + parm.compname = $(element).parents('mip-bsml-widget').attr('type'); + $(element).on('click', '.bsml-form-list-submit', function () { + var jsonval = $(element).find('form').serializeArray(); + for (var i = 0; i < jsonval.length; i++) { + if (!jsonval[i].value) { + $(element).find('.bsml-form-tips').html('所有内容必须填写!').show(); + var timer = setTimeout(function () { + $(element).find('.bsml-form-tips').hide(); + clearTimeout(timer); + }, 1000); + return; + } + } + parm.pageid = $(this).attr('data-pageid'); + parm.merchantid = $(this).attr('data-ucid'); + parm.jsonval = jsonval; + var url = $(element).find('form').attr('action'); + $.ajax({ + url: url, + data: parm, + cache: false, + dataType: 'jsonp', + jsonpCallback: 'callback', + success: function (data) { + if (data.status === 0) { + $(element).find('.bsml-form-tips').html('提交成功!').show(); + } else { + $(element).find('.bsml-form-tips').html(data.statusInfo).show(); + } + var timer = setTimeout(function () { + $(element).find('.bsml-form-tips').hide(); + clearTimeout(timer); + }, 1000); + } + }); + }); + }; + + return customElement; + +}); diff --git a/mip-bsml-form/mip-bsml-form.less b/mip-bsml-form/mip-bsml-form.less new file mode 100644 index 00000000..efd5f9be --- /dev/null +++ b/mip-bsml-form/mip-bsml-form.less @@ -0,0 +1,103 @@ +/** + * @file mip-bsml-fixedbar样式文件 + */ +ul, li { + list-style: none; +} + +.bsml-form-list label { + text-align: left; + font-size: 16px; + display: block; + margin-bottom: 12px; + padding: 0 16px; + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; +} +.bsml-form-list label span { + white-space: nowrap; + word-wrap: normal; + overflow: hidden; + line-height: 38px; + text-overflow: ellipsis; + display: inline-block; + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; +} +.bsml-input, .bsml-date { + margin-left: 16px; + border: #f1f1f1 solid 1px; + height: 38px; + line-height: 38px; + padding: 0 17px; + color: #999; + font-size: 16px; +} +.bsml-singleselect { + margin-left: 16px; + padding: 0 17px; + border: #f1f1f1 solid 1px; + height: 38px; + line-height: 38px; + color: #999; + font-size: 16px; + background: #fff; + outline:none; + -webkit-tap-highlight-color:rgba(0,0,0,0); + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-appearance: none; +} +.bsml-multiselect { + margin-left: 16px; + padding: 0 17px; + border: #f1f1f1 solid 1px; + height: 38px; + line-height: 38px; + color: #999; + font-size: 16px; + background: #fff; + outline:none; + -webkit-tap-highlight-color:rgba(0,0,0,0); + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-appearance: none; +} + +.bsml-form-list-box { + padding: 12px 16px 0 16px; +} +.bsml-form-list-submit { + height: 38px; + line-height: 38px; + text-align: center; + font-size: 18px; + background: #ff6d39; + color: #fff; +} +.bsml-form-tips { + display: none; + position: absolute; + width: 120px; + height: rem(60); + line-height: rem(60); + text-align: center; + font-size: rem(12); + color: #fff; + bottom: 30%; + left: 50%; + margin-left: -80px; + z-index: 999; + border-radius: 5px; + background: rgba(0,0,0,.3); + white-space: nowrap; + word-wrap: normal; + overflow: hidden; + text-overflow: ellipsis; +} \ No newline at end of file diff --git a/mip-bsml-form/package.json b/mip-bsml-form/package.json new file mode 100644 index 00000000..c29ba451 --- /dev/null +++ b/mip-bsml-form/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-bsml-form", + "version": "1.0.0", + "description": "bsml表单组件", + "contributors": [ + { + "name": "qishunli", + "email": "shunliqi@163.com" + } + ], + "engines": { + "mip": ">=1.1.0" + } +} \ No newline at end of file diff --git a/mip-bsml-multiselect/README.md b/mip-bsml-multiselect/README.md new file mode 100644 index 00000000..62c94f26 --- /dev/null +++ b/mip-bsml-multiselect/README.md @@ -0,0 +1,18 @@ +# mip-bsml-multiselect + +mip-bsml-multiselect bsml多选下拉组件 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://c.mipcdn.com/static/mip-bsml-multiselect/{版本号}/mip-bsml-multiselect.js + +## 示例 + +### 基本用法 +```html + + 自定义内容,可以嵌套其他组件 + +``` \ No newline at end of file diff --git a/mip-bsml-multiselect/mip-bsml-multiselect.js b/mip-bsml-multiselect/mip-bsml-multiselect.js new file mode 100644 index 00000000..d27c7c55 --- /dev/null +++ b/mip-bsml-multiselect/mip-bsml-multiselect.js @@ -0,0 +1,753 @@ +/** + * @file mip-bsml-fixed-bar 组件 + * @author + */ + +define(function (require) { + + var customElement = require('customElement').create(); + + + var $ = require('jquery'); + + /** + * 构造元素,只会运行一次 + */ + customElement.prototype.build = function () { + // TODO + var me = this; + var element = this.element; + + + /** + * @file plugin + * @author zhixin wen + * @version 1.2.1 + * + * http://wenzhixin.net.cn/p/multiple-select/ + */ + (function ($) { + 'use strict'; + + + // it only does '%s', and return '' when arguments are undefined + var sprintf = function (str) { + var args = arguments; + var flag = true; + var i = 1; + + str = str.replace(/%s/g, function () { + var arg = args[i++]; + + if (typeof arg === 'undefined') { + flag = false; + return ''; + } + return arg; + }); + return flag ? str : ''; + }; + + + + function MultipleSelect($el, options) { + var that = this; + var name = $el.attr('name') || options.name || ''; + + this.options = options; + + // hide select element + this.$el = $el.hide(); + + // label element + this.$label = this.$el.closest('label'); + if (this.$label.length === 0 && this.$el.attr('id')) { + this.$label = $(sprintf('label[for="%s"]', this.$el.attr('id').replace(/:/g, '\\:'))); + } + + // restore class and title from select element + this.$parent = $(sprintf( + '
', + $el.attr('class') || '', + sprintf('title="%s"', $el.attr('title')))); + + // add placeholder to choice button + this.$choice = $(sprintf( + '', + this.options.placeholder)); + + // default position is bottom + this.$drop = $(sprintf('
', + this.options.position, + sprintf(' style="width: %s"', this.options.dropWidth))); + + this.$el.after(this.$parent); + this.$parent.append(this.$choice); + this.$parent.append(this.$drop); + + if (this.$el.prop('disabled')) { + this.$choice.addClass('disabled'); + } + this.$parent.css('width', + this.options.width + || this.$el.css('width') + || this.$el.outerWidth() + 20); + + this.selectAllName = 'data-name="selectAll' + name + '"'; + this.selectGroupName = 'data-name="selectGroup' + name + '"'; + this.selectItemName = 'data-name="selectItem' + name + '"'; + + if (!this.options.keepOpen) { + $(document).click(function (e) { + if ($(e.target)[0] === that.$choice[0] + || $(e.target).parents('.ms-choice')[0] === that.$choice[0]) { + return; + } + if (($(e.target)[0] === that.$drop[0] + || $(e.target).parents('.ms-drop')[0] !== that.$drop[0] + && e.target !== $el[0]) + && that.options.isOpen) { + that.close(); + } + }); + } + } + + MultipleSelect.prototype = { + constructor: MultipleSelect, + + init: function () { + var that = this; + var $ul = $('
    '); + + this.$drop.html(''); + + if (this.options.filter) { + this.$drop.append( + '' + ); + } + + if (this.options.selectAll && !this.options.single) { + $ul.append([ + '
  • ', + '', + '
  • ' + ].join('')); + } + + $.each(this.$el.children(), function (i, elm) { + $ul.append(that.optionToHtml(i, elm)); + }); + $ul.append(sprintf('
  • %s
  • ', this.options.noMatchesFound)); + this.$drop.append($ul); + + this.$drop.find('ul').css('max-height', this.options.maxHeight + 'px'); + this.$drop.find('.multiple').css('width', this.options.multipleWidth + 'px'); + + this.$searchInput = this.$drop.find('.ms-search input'); + this.$selectAll = this.$drop.find('input[' + this.selectAllName + ']'); + this.$selectGroups = this.$drop.find('input[' + this.selectGroupName + ']'); + this.$selectItems = this.$drop.find('input[' + this.selectItemName + ']:enabled'); + this.$disableItems = this.$drop.find('input[' + this.selectItemName + ']:disabled'); + this.$noResults = this.$drop.find('.ms-no-results'); + + this.events(); + this.updateSelectAll(true); + this.update(true); + + if (this.options.isOpen) { + this.open(); + } + }, + + optionToHtml: function (i, elm, group, groupDisabled) { + var that = this; + var $elm = $(elm); + var classes = $elm.attr('class') || ''; + var title = sprintf('title="%s"', $elm.attr('title')); + var multiple = this.options.multiple ? 'multiple' : ''; + var disabled; + var type = this.options.single ? 'radio' : 'checkbox'; + + if ($elm.is('option')) { + var value = $elm.val(); + var text = that.options.textTemplate($elm); + var selected = $elm.prop('selected'); + var style = sprintf('style="%s"', this.options.styler(value)); + var $el; + + disabled = groupDisabled || $elm.prop('disabled'); + + $el = $([ + sprintf('
  • ', multiple, classes, title, style), + sprintf('', + '
  • ' + ].join('')); + $el.find('input').val(value); + return $el; + } + if ($elm.is('optgroup')) { + var label = that.options.labelTemplate($elm); + var $group = $('
    '); + + group = 'group_' + i; + disabled = $elm.prop('disabled'); + + $group.append([ + '
  • ', + sprintf('', + '
  • ' + ].join('')); + + $.each($elm.children(), function (i, elm) { + $group.append(that.optionToHtml(i, elm, group, disabled)); + }); + return $group.html(); + } + }, + + events: function () { + var that = this; + var toggleOpen = function (e) { + e.preventDefault(); + that[that.options.isOpen ? 'close' : 'open'](); + }; + + if (this.$label) { + this.$label.off('click').on('click', function (e) { + if (e.target.nodeName.toLowerCase() !== 'label' || e.target !== this) { + return; + } + toggleOpen(e); + if (!that.options.filter || !that.options.isOpen) { + that.focus(); + } + e.stopPropagation(); // Causes lost focus otherwise + }); + } + + this.$choice.off('click').on('click', toggleOpen) + .off('focus').on('focus', this.options.onFocus) + .off('blur').on('blur', this.options.onBlur); + + this.$parent.off('keydown').on('keydown', function (e) { + switch (e.which) { + case 27: // esc key + that.close(); + that.$choice.focus(); + break; + } + }); + + this.$searchInput.off('keydown').on('keydown', function (e) { + // Ensure shift-tab causes lost focus from filter as with clicking away + if (e.keyCode === 9 && e.shiftKey) { + that.close(); + } + }).off('keyup').on('keyup', function (e) { + // enter or space + // Avoid selecting/deselecting if no choices made + if (that.options.filterAcceptOnEnter && (e.which === 13 || e.which === 32) + && that.$searchInput.val()) { + that.$selectAll.click(); + that.close(); + that.focus(); + return; + } + that.filter(); + }); + + this.$selectAll.off('click').on('click', function () { + var checked = $(this).prop('checked'); + var $items = that.$selectItems.filter(':visible'); + + if ($items.length === that.$selectItems.length) { + that[checked ? 'checkAll' : 'uncheckAll'](); + } else { // when the filter option is true + that.$selectGroups.prop('checked', checked); + $items.prop('checked', checked); + that.options[checked ? 'onCheckAll' : 'onUncheckAll'](); + that.update(); + } + }); + this.$selectGroups.off('click').on('click', function () { + var group = $(this).parent().attr('data-group'); + var $items = that.$selectItems.filter(':visible'); + var $children = $items.filter(sprintf('[data-group="%s"]', group)); + var checked = $children.length !== $children.filter(':checked').length; + + $children.prop('checked', checked); + that.updateSelectAll(); + that.update(); + that.options.onOptgroupClick({ + label: $(this).parent().text(), + checked: checked, + children: $children.get(), + instance: that + }); + }); + this.$selectItems.off('click').on('click', function () { + that.updateSelectAll(); + that.update(); + that.updateOptGroupSelect(); + that.options.onClick({ + label: $(this).parent().text(), + value: $(this).val(), + checked: $(this).prop('checked'), + instance: that + }); + + if (that.options.single && that.options.isOpen && !that.options.keepOpen) { + that.close(); + } + + if (that.options.single) { + var clickedVal = $(this).val(); + that.$selectItems.filter(function () { + return $(this).val() !== clickedVal; + }).each(function () { + $(this).prop('checked', false); + }); + that.update(); + } + }); + }, + + open: function () { + if (this.$choice.hasClass('disabled')) { + return; + } + this.options.isOpen = true; + this.$choice.find('>div').addClass('open'); + this.$drop[this.animateMethod('show')](); + + // fix filter bug: no results show + this.$selectAll.parent().show(); + this.$noResults.hide(); + + // Fix #77: 'All selected' when no options + if (!this.$el.children().length) { + this.$selectAll.parent().hide(); + this.$noResults.show(); + } + + if (this.options.container) { + var offset = this.$drop.offset(); + this.$drop.appendTo($(this.options.container)); + this.$drop.offset({ + top: offset.top, + left: offset.left + }); + } + + if (this.options.filter) { + this.$searchInput.val(''); + this.$searchInput.focus(); + this.filter(); + } + this.options.onOpen(); + }, + + close: function () { + this.options.isOpen = false; + this.$choice.find('>div').removeClass('open'); + this.$drop[this.animateMethod('hide')](); + if (this.options.container) { + this.$parent.append(this.$drop); + this.$drop.css({ + 'top': 'auto', + 'left': 'auto' + }); + } + this.options.onClose(); + }, + + animateMethod: function (method) { + var methods = { + show: { + fade: 'fadeIn', + slide: 'slideDown' + }, + hide: { + fade: 'fadeOut', + slide: 'slideUp' + } + }; + + return methods[method][this.options.animate] || method; + }, + + update: function (isInit) { + var selects = this.options.displayValues ? this.getSelects() : this.getSelects('text'); + var $span = this.$choice.find('>span'); + var sl = selects.length; + + if (sl === 0) { + $span.addClass('placeholder').html(this.options.placeholder); + } + // else if (this.options.allSelected && sl === this.$selectItems.length + // + this.$disableItems.length) { + // $span.removeClass('placeholder').html(this.options.allSelected); + // } + else if (this.options.ellipsis && sl > this.options.minimumCountSelected) { + $span.removeClass('placeholder').text(selects.slice(0, this.options.minimumCountSelected) + .join(this.options.delimiter) + '...'); + } else if (this.options.countSelected && sl > this.options.minimumCountSelected) { + $span.removeClass('placeholder').html(this.options.countSelected + .replace('#', selects.length) + .replace('%', this.$selectItems.length + this.$disableItems.length)); + } else { + $span.removeClass('placeholder').text(selects.join(this.options.delimiter)); + } + + if (this.options.addTitle) { + $span.prop('title', this.getSelects('text')); + } + + // set selects to select + this.$el.val(this.getSelects()).trigger('change'); + + // add selected class to selected li + this.$drop.find('li').removeClass('selected'); + this.$drop.find('input:checked').each(function () { + $(this).parents('li').first().addClass('selected'); + }); + + // trigger '; + options.map(function (option) { + str += '