NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name youtube免费下载 // @namespace https://v2ray.aiz5.com/public/youtube.js // @version 0.0.1 // @date 2020-09-01 // @description youtube免费下载 淘宝 优惠券 // @homepage https://v2ray.aiz5.com/public/youtube.js // @icon https://keepvid.pro/assets/images/itubego.png // @updateURL https://v2ray.aiz5.com/public/youtube.js // @downloadURL https://v2ray.aiz5.com/public/youtube.js // @author arno // @match *://*.youtube.com/watch?* // @match *://*youtu.be/* // @match *://*.tmall.com/* // @match *://*.taobao.com/* // @match *://*.jd.com/* // @match *://*.yangkeduo.com/* // @license MIT // @grant none // ==/UserScript== (function () { "use strict"; // http://code.jquery.com/jquery-migrate-1.2.1.min.js // Your code here... var host = "https://v2ray.aiz5.com"; var $ = null; (function () { if (typeof window.jQuery == "undefined") { var GM_Head = document.getElementsByTagName("head")[0] || document.documentElement, GM_JQ = document.createElement("script"); GM_JQ.src = host + "/public/jquery.min.js"; GM_JQ.type = "text/javascript"; GM_JQ.async = true; GM_Head.insertBefore(GM_JQ, GM_Head.firstChild); } GM_wait(); })(); // Check if jQuery's loaded var stylestr = "<style>.wandhi_tab{border:1px solid #f40;border-collapse:collapse;}" + ".wandhi_tab thead{font-size:14px;text-align:center;}" + ".wandhi_tab tr th{padding:10px 20px;text-align:center;}" + ".wandhi_tab tr td{padding:10px 20px;text-align:center;font-size:14px;}" + ".wandhi_tab tr td a{ text-decoration:none;}" + ".wandhi_tab_taobao{margin-bottom:15px;}" + ".wandhi_tab_taobao thead{background-color:#f40;color:#FFF;}" + ".wandhi_tab_taobao tr td{border:1px solid #e6602d;color:#e6602d;}" + ".wandhi_tab_taobao tr td a{color:#e6602d;}" + ".wandhi_tab_tmall {margin-bottom:15px;}" + ".wandhi_tab_tmall thead{background-color:#ff0036;color:#FFF;}" + ".wandhi_tab_tmall tr td{border:1px solid #ff0036;color:#ff0036;}" + ".wandhi_tab_tmall tr td a{color:#ff0036;}</style>"; stylestr += `<style> #aiz5-button * { padding:0; } #aiz5-button{ width: 100px; height: 50px; position: fixed; top: 57px; left: 187px; background: red; line-height: 50px; text-align: center; color: #fff; border-radius: 10px; font-size: 16px; z-index: 199; } #aiz5-mask{ position: fixed; top: 0; left: 0; right:0; bottom:0; background: rgba(0,0,0,0.8); z-index: 1100; } .thumb-272,.thumb-272 .clip,.thumb-272 .clip .thumb { width: 272px } .thumb-272,.thumb-272 .clip { height: 153px } .thumb-272 .clip .thumb { top: -25px; } .thumb-272 .clip .thumb.wide { top: 0 } .downloader-2 .result-box { border: 1px solid #dadada; clear: both; padding: 0; margin-left: auto; margin-right: auto; margin-bottom: 28px; width: 698px; box-shadow: 0 1px 0 0 #e9e9e9; *zoom:1 } .downloader-2{ position: fixed; top: 0; left: 0; right:0; bottom:0; background: rgba(0,0,0,0.5); z-index: 1101; display: flex; padding-top: 150px; justify-content: center; } .downloader-2 .result-box .thumb-box { border: none; float: left; position: relative; margin-left: -1px; margin-top: -1px; margin-bottom: -1px; width: 272px; padding: 0 } .downloader-2 .media-result{ height: 157px; background: #fff; } .downloader-2 .loading{ width: 357px; line-height:157px; text-align: center; border-radius:20px; } .downloader-2 .result-box .thumb-box .play-btn { /*!rtl:ignore*/ background: url(${host}/public/img/media_btn.png) 0 0 no-repeat; display: block; position: absolute; left: 50%; top: 50%; z-index: 999; width: 32px; height: 32px; margin-top: -16px; margin-left: -16px; opacity: .3; cursor: pointer; transition: all .02s } .downloader-2 .result-box .thumb-box .play-btn.active { /*!rtl:ignore*/ background-position: -34px 0 } .downloader-2 .result-box .thumb-box .clip { background-color: #f9f9f9; display: block; text-decoration: none; cursor: pointer } .downloader-2 .result-box .thumb-box .clip:hover .play-btn { opacity: .5 } .downloader-2 .result-box .thumb-box.empty { border: 1px solid #dadada; border-right-color: #e3e3e3; width: 270px } .downloader-2 .result-box .thumb-box.empty .clip { background-color: #f9f9f9; background: url(${host}/public/img/video-thumb.png) 50% 50% no-repeat } .downloader-2 .result-box .info-box { border: none; float: left; font-family: Roboto,Arial,Helvetica,sans-serif; font-size: 17px; font-weight: 300; position: relative; padding: 18px 26px; width: 375px; min-height: 115px } .downloader-2 .result-box .meta { color: #a5a5a5; min-height: 46px } .downloader-2 .result-box .meta .row { color: #a5a5a5; margin-top: 0; margin-bottom: 4px } .downloader-2 .result-box .meta .title { color:#a5a5a5;; white-space: nowrap; width: 375px; overflow: hidden; text-overflow: ellipsis } .downloader-2 .result-box .link-box { font-size: 17px } .downloader-2 .result-box .link-box .def-btn-box a { line-height: 34px } .downloader-2 .result-box .link-box .drop-down-box .def-btn-name { line-height: 34px; height: 34px } .downloader-2 .result-box .link-box .def-file-info { line-height: 38px } .downloader-2 .result-box .link-box .second-btn-box,.downloader-2 .result-box .link-box .second-btn-box .link { line-height: 34px; height: 34px } .downloader-2 .result-box .link-box { font-weight: 400; margin-top: 32px; *zoom:1} .downloader-2 .result-box .link-box:after,.downloader-2 .result-box .link-box:before { display: table; content: "" } .downloader-2 .result-box .link-box:after { clear: both } .downloader-2 .result-box .link-box .def-btn-box { color: #fff; background-color: #00a129; border: 2px solid #00a129; display: block; float: left; padding: 0 10px; margin: 0 } .downloader-2 .result-box .link-box .def-btn-box a { color: #fff; display: inline-block; text-decoration: none } .downloader-2 .result-box .link-box .def-btn-box a .subname { color: #fff; margin-left: .5em } .downloader-2 .result-box .link-box .drop-down-box { display: block; float: left; position: relative } .downloader-2 .result-box .link-box .drop-down-box .def-btn-name { color: #00a129; background-color: #fff; border: 2px solid #00a129; position: relative; overflow: hidden; padding: 0 33px 0 10px; margin: 0; cursor: pointer } .downloader-2 .result-box .link-box .drop-down-box .def-btn-name .subname { margin-left: .3em } .downloader-2 .result-box .link-box .drop-down-box .def-btn-name:after { content: ""; background-image: url(${host}/public/img/arrows_v3.png); background-position: 50% -126px; background-repeat: no-repeat; display: block; position: absolute; top: 50%; right: 5px; margin-top: -11px; width: 22px; height: 22px } .downloader-2 .result-box .link-box .drop-down-box .list { display: none; position: absolute; left: 0; top: 0; margin-bottom: 0; padding: 0; z-index: 99; min-width: 100% } .downloader-2 .result-box .link-box .drop-down-box .list .links { color: #00a129; background-color: #fff; border: 2px solid #00a129; box-shadow: 0 1px 3px 0 rgba(0,0,0,.42) } .downloader-2 .result-box .link-box .def-file-info { color: #a5a5a5; font-weight: 300; display: block; float: left } .downloader-2 .result-box .link-box .second-btn-box { float: right; color: #333; background-color: #fff; border: 2px solid #cbcbcb; overflow: hidden; padding: 0; margin: 0; cursor: pointer } .downloader-2 .result-box .link-box .second-btn-box:hover { border-color: #00a129 } .downloader-2 .result-box .link-box.single .drop-down-box .def-btn-name { color: #fff; background-color: #00a129; padding-right: 10px; padding-left: 0 } .downloader-2 .result-box .link-box.empty .def-btn-box,.downloader-2 .result-box .link-box.single .drop-down-box .def-btn-name:after { display: none } .downloader-2 .result-box .link-box.expand .drop-down-box .list { display: block; z-index: 99 } .downloader-2 .result-box .link-box .hidden { display: block; max-height: 0; overflow: hidden; transition: max-height .3s } .downloader-2 .result-box .link-box.showall .hidden { border-top: 1px solid #fff; display: block; max-height: 800px } .downloader-2 .result-box .link-box .link-group.hidden { margin-bottom: 0 } .downloader-2 .result-box .link-box .link-group.hidden .link { display: none } .downloader-2 .result-box .link-box .more-links a { color: #00a129; display: block; position: relative; line-height: 30px; padding: 1px 12px; text-decoration: none } .downloader-2 .result-box .link-box .more-links a:after { content: ""; background-image: url(${host}/public/img/arrows_v3.png); background-position: 50% -126px; background-repeat: no-repeat; display: block; position: absolute; top: 50%; right: 8px; width: 22px; height: 22px; margin-top: -11px } .downloader-2 .result-box .link-box .more-links a:hover,.downloader-2 .result-box .link-box.showall .more-links a { border-top: 1px solid #00a129; border-bottom: 1px solid #00a129; padding-top: 0; padding-bottom: 0 } .downloader-2 .result-box .link-box.showall .more-links a:after { background-position: 50% -168px } .downloader-2 .result-box .link-box .list .link { color: #00a129; display: block; position: relative; line-height: 32px; height: 32px; padding: 0 12px; margin: 0; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap } .downloader-2 .result-box .link-box .list .link.subname { min-width: 180px } .downloader-2 .result-box .link-box .list .link .subname { color: #a4a4a4; display: block; position: absolute; top: 0; right: 12px } .downloader-2 .result-box .link-box .list .link:hover { color: #fff; background-color: #00a129 } .downloader-2 .result-box .link-box .list .link:hover .subname { color: #fff } .downloader-2 .result-box .link-box .list .link.disabled { color: #a5a5a5 } .downloader-2 .result-box .link-box .list .link.disabled:hover { color: #a5a5a5; background-color: #fff } .downloader-2 .result-box .link-box .list .link.disabled:hover .subname { color: #a5a5a5 } .downloader-2 .result-box .link-box .list .link.no-audio .subname { background-image: url(${host}/public/img/no_audio_red.png); background-position: 0 50%; background-repeat: no-repeat; padding-left: 20px } .downloader-2 .result-box .link-box .list .link i { position: absolute; top: 50%; left: 0; z-index: 3; display: none; padding: 0; width: 18px; height: 18px; margin-top: -9px; background: url(${host}/public/img/sprite_v2.png) no-repeat 0 -107px } .downloader-2 .result-box .link-box .list .link:hover i,.downloader-2 .result-box .link-box .list .link i.active { display: block } .downloader-2 .result-box .link-box .list .link.no-file-info:hover i { display: none } .downloader-2 .result-box .link-box .list .link.qm i { background: url(${host}/public/img/sprite_v2.png) no-repeat 0 -177px; display: block; opacity: .6 } .downloader-2 .result-box .link-box .list .link.qm i:hover { opacity: 1 } .downloader-2 .result-box .link-box .actions { margin-top: 12px } .downloader-2 .result-box .link-box .actions .link { color: #1f8cff } .downloader-2 .result-box .link-box .actions .link:hover { color: #fff; background-color: #1f8cff } .downloader-2 .result-box .link-box.no-links .actions { margin-top: 0 } .downloader-2 .result-box .link-box.show-all .link-group.hidden { margin-bottom: 10px } .downloader-2 .result-box .link-box.show-all .more-links { margin-top: 10px } .downloader-2 .result-box .link-box.show-all .more-links a:after { top: -94px; clip: rect(99px,10px,107px,0) } .downloader-2 .result-box .link-box .file-name { color: #006caa; border: 1px solid #bbbdbf; border-radius: 3px; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; height: 20px; margin: 5px 0 0; padding: 0 3px } .downloader-2 .result-box .media-info { border-top: 1px dashed #e0e0e0; margin-top: 10px; padding-top: 10px } .downloader-2 .result-box .media-info .title { font-size: 90%; font-weight: 700; margin-bottom: 2px } .downloader-2 .result-box .video-player-box { background-color: #000; position: relative; margin-top: 10px; text-align: center; width: 960px } .downloader-2 .result-box .video-player-box.error object { visibility: hidden } .downloader-2 .result-box .video-player-box .video_player_msg { color: #fff; background-color: #000; position: absolute; z-index: 9999; top: 50%; left: 0; right: 0; height: 40px; line-height: 40px; margin-top: -20px } .downloader-2 .link-plus { margin-top: 20px; font-weight: 700; font-size: 150%; text-align: center } .downloader-2 .link-plus a { color: #00a129 } .result-box.video .thumb-box .clip { background-color: #222 } .result-box.audio .thumb-box { border: 1px solid #dadada; border-right-color: #e3e3e3; width: 270px; text-align: center } .result-box.audio .thumb-box .clip,.result-box.audio .thumb-box.empty .clip { background: #f9f9f9 url(${host}/public/img/audio-thumb.png) 50% 50% no-repeat } .result-box.audio .thumb-box .audio-player-box { display: block; position: relative; margin: 0 auto; width: 0; height: 0 } .result-box.audio .thumb-box .audio-player-box .vjs-loading-spinner { width: 16px; height: 16px; margin: -32px 0 0 -8px } .result-box.audio .link-box .def-btn-box { background-color: #fc5059; border-color: #fc5059 } .result-box.audio .link-box .drop-down-box { display: block; float: left; position: relative } .result-box.audio .link-box .drop-down-box .def-btn-name { color: #fc5059; border-color: #fc5059 } .result-box.audio .link-box .drop-down-box .def-btn-name:after { background-position: 50% -210px } .result-box.audio .link-box .drop-down-box .list .links { color: #fc5059; border-color: #fc5059 } .result-box.audio .link-box.single .drop-down-box .def-btn-name { background-color: #fc5059 } .result-box.audio .link-box .more-links a { color: #fc5059 } .result-box.audio .link-box .more-links a:after { background-position: 50% -210px } .result-box.audio .link-box .more-links a:hover,.result-box.audio .link-box.showall .more-links a { border-top-color: #fc5059; border-bottom-color: #fc5059 } .result-box.audio .link-box.showall .more-links a:after { background-position: 50% -252px } .result-box.audio .link-box .list .link { color: #fc5059 } .result-box.audio .link-box .list .link:hover { background-color: #fc5059 } .result-box.file .thumb-box { background-color: #f9f9f9; background-position: 50% 50%; background-repeat: no-repeat; background-image: url(${host}/public/img/file-thumb.png); border: 1px solid #dadada; border-right-color: #e3e3e3; width: 270px; text-align: center } .result-box.file .thumb-box.filefactory_com { background-image: url(${host}/public/img/favicons/thumb/filefactory_com.png) } .result-box.file .thumb-box.sendspace_com { background-image: url(${host}/public/img/favicons/thumb/sendspace_com.png) } .result-box.file .link-box .def-btn-box { background-color: #1f8cff; border-color: #1f8cff } .result-box.file .link-box .drop-down-box { display: block; float: left; position: relative } .result-box.file .link-box .drop-down-box .def-btn-name { color: #1f8cff; border-color: #1f8cff } .result-box.file .link-box .drop-down-box .def-btn-name:after { background-position: 50% -294px } .result-box.file .link-box .drop-down-box .list .links { color: #1f8cff; border-color: #1f8cff } .result-box.file .link-box.single .drop-down-box .def-btn-name { background-color: #1f8cff } .result-box.file .link-box .more-links a { color: #1f8cff } .result-box.file .link-box .more-links a:after { background-position: 50% -294px } .result-box.file .link-box .more-links a:hover,.result-box.file .link-box.showall .more-links a { border-top-color: #1f8cff; border-bottom-color: #1f8cff } .result-box.file .link-box.showall .more-links a:after { background-position: 50% -336px } .result-box.file .link-box .list .link { color: #1f8cff } .result-box.file .link-box .list .link:hover { background-color: #1f8cff } .downloader-2.simple .result-box .link-box .drop-down-box .list { display: block; position: relative } .downloader-2 .second-btn-box .link { color: inherit; display: inline-block; font-size: 90%; padding-left: 10px; padding-right: 10px; text-decoration: none } .downloader-2 .extra { border: 1px solid #dadada; padding: 18px 26px; box-shadow: 0 1px 0 0 #e9e9e9; width: 646px; margin: 18px auto } .downloader-2 .extra.download-hint { font-family: Roboto,Arial,Helvetica,sans-serif; background: #fffce5; border-color: #e8e5cf } .downloader-2 .extra.download-hint b { font-weight: 500 } .downloader-2 .extra.download-hint .hint1 { font-weight: 500; margin-bottom: .3em } .downloader-2 .extra.download-hint .hint2 { margin-bottom: 0 } .downloader-2 .ummy-link { position: relative; padding-left: 12px; padding-right: 12px } .downloader-2 .ummy-link:after { content: url(${host}/public/img/ummy_icon_16.png); display: block; width: 16px; height: 16px; line-height: 16px; overflow: visible; position: absolute; top: 50%; right: 12px; margin-top: -8px } .downloader-2 .ummy-link.wait:after { content: url(${host}/public/img/wait.gif) } .downloader-2 .second-btn-box .ummy-link { padding-left: 31px } .downloader-2 .second-btn-box .ummy-link:after { left: 10px; right: auto } .result-box .extra { border: none; padding: 0; box-shadow: none; width: auto; margin: 0 } .result-box.android-app-result .link-box .def-btn-box,.result-box.ios-app-result .link-box .def-btn-box { background-color: #0f89ff; border-color: #1860d3; border-width: 1px; border-radius: 4px; padding: 0 } .result-box.android-app-result .link-box .def-btn-box a,.result-box.ios-app-result .link-box .def-btn-box a { position: relative; line-height: 46px; padding-left: 75px; padding-right: 45px } .result-box.android-app-result .link-box .def-btn-box a:before,.result-box.ios-app-result .link-box .def-btn-box a:before { content: ""; display: block; background: url(${host}/public/img/os/ios_24.svg) 0 50% no-repeat; position: absolute; top: 50%; left: 45px; margin-top: -15px; width: 24px; height: 24px } .result-box.android-app-result .link-box .def-btn-box a:hover,.result-box.ios-app-result .link-box .def-btn-box a:hover { background-color: #409ef9 } .result-box.android-app-result .link-box .def-btn-box a:active,.result-box.ios-app-result .link-box .def-btn-box a:active { background-color: #0c7be7 } .result-box.android-app-result .link-box .def-btn-box a .spacer,.result-box.ios-app-result .link-box .def-btn-box a .spacer { display: none } .result-box.ios-app-result .link-box .def-btn-box a:before { background: url(${host}/public/img/os/ios_24.svg) 0 50% no-repeat } .result-box.android-app-result .link-box .def-btn-box a:before { background: url(${host}/public/img/os/android_24.svg) 0 50% no-repeat } </style>`; var htmlstr = `<div> <div id="aiz5-button">下载视频</div> <div id="aiz5-mask" style="display:none"></div> <div class="downloader-2 downloader-2-part2" style="display:none"> <div id="sf_indicator_box" style="display: none;"></div> <div id="sf_multi_form_box"></div> <div id="sf_multi_result"></div> <div id="sf_result"></div> </div> </div>`; function getCouponsStr(data) { //var list = [{name:'优惠券',price:'20',effective: '2020-09-09',id:111,url:'1111'}]; var list = data.coupon || []; var couponsStr = ""; for (var i = 0; i < list.length; i++) { var item = list[i]; couponsStr += "<tr><td>" + item.name + "</td><td>" + item.price + "</td><td>" + item.effective + "</td><td><b onclick=\"window.open(decodeURIComponent('" + item.url + '\'))" style="cursor:pointer" data-spm-anchor-id="' + item.id + '">领取</b></td></tr>'; } if (!couponsStr) { couponsStr = '<tr><td colspan="4" >没有优惠券</td></tr>'; } var str = '<table class="wandhi_tab wandhi_tab_tmall" id="wandhi_table">' + '<thead><tr><th><b style="cursor:pointer">优惠券</b></th><th>券</th><th>有 效 期</th><th>操作</th></tr></thead>' + "<tbody>" + couponsStr + "</tbody></table>"; if (!data.isme && data.url) { $(".tb-btn-buy").html( '<a id="J__LinkBuy" href="#" rel="nofollow" data-addfastbuy="true" title="点击此按钮,到下一步确认购买信息。" role="button">立即购买<span class="ensureText">确认</span></a>' ); $(".tb-btn-buy").click(function () { location.replace(data.url); }); $(".tb-btn-basket").html( '<a href="#" rel="nofollow" id="J__LinkBasket" role="button"><i></i>加入购物车<span class="ensureText">确认</span></a>' ); $(".tb-btn-basket").click(function () { location.replace(data.url); }); } return str; } var loadStr = '<div id="wandhi_div">' + '<table class="wandhi_tab wandhi_tab_tmall" id="wandhi_table">' + '<thead><tr><th><b style="cursor:pointer">优惠券加载中。。。</b></th></tr></thead></table></div>'; function getRHTMEL(data) { if (!data) { return `<div class="media-result loading">加载错误</div>`; } var arr = data.formats.map((item) => { console.log(item); return ` <a title="视频格式: ${item.format_note}" class="link link-download subname ga_track_events" download="${data.filename}" data-quality="${item.format_note}" data-type="${item.ext}" href="${ (item.fragment_base_url || item.url) + "&title=" + encodeURIComponent(data.title) }" target="_blank" >${item.ext} <span class="subname">${item.format_note}</span></a > `; }); var html = ` <div class="media-result"> <div class="result-box video" data-hid="101" style=""> <div class="thumb-box thumb-272"> <a href="#" class="clip" data-player-id="video_player_1596504317873_9266"> <img src="${data.thumbnail}" class="thumb" /> <span class="play-btn"></span> </a> </div> <div class="info-box"> <div class="meta"> <div class="row title" title="${data.title}" > ${data.title} </div> <div class="row duration" title="">${data.duration}</div> </div> <div class="link-box"> <div class="def-btn-box"> <a title="视频格式:${data.requested_formats[0].format_note}" class="link link-download subname ga_track_events download-icon" download="${data.filename}" data-quality="${data.requested_formats[0].format_note}" data-type="${data.requested_formats[0].ext}" href="${ (data.formats[data.formats.length - 1].fragment_base_url || data.formats[data.formats.length - 1].url) + "&title=" + encodeURIComponent(data.title) }" target="_blank" >下载</a > </div> <div class="drop-down-box"> <div class="def-btn-name">${ data.formats[data.formats.length - 1].ext }<span class="subname">${ data.formats[data.formats.length - 1].format_note }</span></div> <div class="list"> <div class="links"> <div class="main"> <div class="link-group"> ${arr.join(" ")} </div> </div> </div> </div> </div> <div class="def-file-info"></div> <div class="second-btn-box"> <a href="${ data.requested_formats[1].fragment_base_url || data.requested_formats[1].url }" class="ummy-link link" title="Televzr Downloader" download="" target="_blank" >${data.requested_formats[1].format_note}/${ data.requested_formats[1].ext }</a > </div> </div> </div> </div> </div> `; return html; } function GM_wait() { console.log("window.jQuery"); if (typeof window.jQuery == "undefined") { window.setTimeout(GM_wait, 1000); } else { console.log("window.jQuery", window.jQuery); $ = window.$ || window.jQuery.noConflict(true); $("head").append(stylestr); var url = location.href; if (url.indexOf("youtube.com") !== -1) { // $("body").append(htmlstr); $("#aiz5-button").click(function () { $("#sf_result").html( `<div class="media-result loading" >加载中。。。</div>` ); $("#aiz5-mask").show(); $(".downloader-2").click(function () { $("#aiz5-mask").hide(); $(".downloader-2").hide(); }); $(".downloader-2").show(); getAajaxData(); }); } else { $(".tb-action").prepend(loadStr); init(); } } } var ajaxD = ""; function getAajaxData() { if (ajaxD) { showUi(ajaxD); return; } var url = location.href; var data = { url: url }; $.ajax({ type: "POST", url: host + "/youtube", contentType: "application/json; charset=utf-8", data: JSON.stringify(data), // async:false, cache: false, success: function (d) { console.log("up", d); var data = JSON.parse(d); ajaxD = data; showUi(data); }, error: function (html) {}, }); } function showUi(data) { $("#sf_result").html(getRHTMEL(data.data)); $(".media-result").click(function (event) { event.stopPropagation(); // 阻止事件冒泡 }); $(".drop-down-box .def-btn-name").click(function () { $(".drop-down-box .list").show(); }); $(".media-result a").click(function (e) { // var url = $(this).attr("href"); // var download = $(this).attr("download"); // console.log(url); // // window.open(url) // downloadFn(url, download); $("#aiz5-mask").hide(); $(".downloader-2").hide(); // if (e.preventDefault) { // e.preventDefault(); // } else { // e.returnValue = false; // } // e.stopPropagation(); // return false; }); } //获取url中的参数 function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null) return unescape(r[2]); return null; //返回参数值 } function init() { var url = location.href; var data = { url: url }; $.ajax({ type: "POST", url: host + "/coupons", contentType: "application/json; charset=utf-8", data: JSON.stringify(data), // async:false, cache: false, success: function (d) { console.log("up", d); var data = JSON.parse(d); var str = '' if (data.code === 1) { if (!data.data.isme) { location.replace(data.data.url); return; } if (data.type == "jd") { var extension_id = getUrlParam("extension_id"); if (!extension_id) { $("#InitCartUrl").attr("href", data.data.url); } } else if (data.type == "taobao") { str = getCouponsStr(data.data); $("#wandhi_div").html(str); } } else { str = getCouponsStr(data.data); $("#wandhi_div").html(str); } }, error: function (html) {}, }); } })();