newsPopup.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. (function(win, doc) {
  2. var md5=window.md5||{};!function(){function r(r){return C(t(A(r),r.length*S))}function t(r,t){r[t>>5]|=128<<t%32,r[(t+64>>>9<<4)+14]=t;for(var n=1732584193,h=-271733879,u=-1732584194,A=271733878,d=0;d<r.length;d+=16){var C=n,i=h,g=u,v=A;n=e(n,h,u,A,r[d+0],7,-680876936),A=e(A,n,h,u,r[d+1],12,-389564586),u=e(u,A,n,h,r[d+2],17,606105819),h=e(h,u,A,n,r[d+3],22,-1044525330),n=e(n,h,u,A,r[d+4],7,-176418897),A=e(A,n,h,u,r[d+5],12,1200080426),u=e(u,A,n,h,r[d+6],17,-1473231341),h=e(h,u,A,n,r[d+7],22,-45705983),n=e(n,h,u,A,r[d+8],7,1770035416),A=e(A,n,h,u,r[d+9],12,-1958414417),u=e(u,A,n,h,r[d+10],17,-42063),h=e(h,u,A,n,r[d+11],22,-1990404162),n=e(n,h,u,A,r[d+12],7,1804603682),A=e(A,n,h,u,r[d+13],12,-40341101),u=e(u,A,n,h,r[d+14],17,-1502002290),h=e(h,u,A,n,r[d+15],22,1236535329),n=o(n,h,u,A,r[d+1],5,-165796510),A=o(A,n,h,u,r[d+6],9,-1069501632),u=o(u,A,n,h,r[d+11],14,643717713),h=o(h,u,A,n,r[d+0],20,-373897302),n=o(n,h,u,A,r[d+5],5,-701558691),A=o(A,n,h,u,r[d+10],9,38016083),u=o(u,A,n,h,r[d+15],14,-660478335),h=o(h,u,A,n,r[d+4],20,-405537848),n=o(n,h,u,A,r[d+9],5,568446438),A=o(A,n,h,u,r[d+14],9,-1019803690),u=o(u,A,n,h,r[d+3],14,-187363961),h=o(h,u,A,n,r[d+8],20,1163531501),n=o(n,h,u,A,r[d+13],5,-1444681467),A=o(A,n,h,u,r[d+2],9,-51403784),u=o(u,A,n,h,r[d+7],14,1735328473),h=o(h,u,A,n,r[d+12],20,-1926607734),n=a(n,h,u,A,r[d+5],4,-378558),A=a(A,n,h,u,r[d+8],11,-2022574463),u=a(u,A,n,h,r[d+11],16,1839030562),h=a(h,u,A,n,r[d+14],23,-35309556),n=a(n,h,u,A,r[d+1],4,-1530992060),A=a(A,n,h,u,r[d+4],11,1272893353),u=a(u,A,n,h,r[d+7],16,-155497632),h=a(h,u,A,n,r[d+10],23,-1094730640),n=a(n,h,u,A,r[d+13],4,681279174),A=a(A,n,h,u,r[d+0],11,-358537222),u=a(u,A,n,h,r[d+3],16,-722521979),h=a(h,u,A,n,r[d+6],23,76029189),n=a(n,h,u,A,r[d+9],4,-640364487),A=a(A,n,h,u,r[d+12],11,-421815835),u=a(u,A,n,h,r[d+15],16,530742520),h=a(h,u,A,n,r[d+2],23,-995338651),n=c(n,h,u,A,r[d+0],6,-198630844),A=c(A,n,h,u,r[d+7],10,1126891415),u=c(u,A,n,h,r[d+14],15,-1416354905),h=c(h,u,A,n,r[d+5],21,-57434055),n=c(n,h,u,A,r[d+12],6,1700485571),A=c(A,n,h,u,r[d+3],10,-1894986606),u=c(u,A,n,h,r[d+10],15,-1051523),h=c(h,u,A,n,r[d+1],21,-2054922799),n=c(n,h,u,A,r[d+8],6,1873313359),A=c(A,n,h,u,r[d+15],10,-30611744),u=c(u,A,n,h,r[d+6],15,-1560198380),h=c(h,u,A,n,r[d+13],21,1309151649),n=c(n,h,u,A,r[d+4],6,-145523070),A=c(A,n,h,u,r[d+11],10,-1120210379),u=c(u,A,n,h,r[d+2],15,718787259),h=c(h,u,A,n,r[d+9],21,-343485551),n=f(n,C),h=f(h,i),u=f(u,g),A=f(A,v)}return Array(n,h,u,A)}function n(r,t,n,e,o,a){return f(u(f(f(t,r),f(e,a)),o),n)}function e(r,t,e,o,a,c,h){return n(t&e|~t&o,r,t,a,c,h)}function o(r,t,e,o,a,c,h){return n(t&o|e&~o,r,t,a,c,h)}function a(r,t,e,o,a,c,h){return n(t^e^o,r,t,a,c,h)}function c(r,t,e,o,a,c,h){return n(e^(t|~o),r,t,a,c,h)}function h(r,n){var e=A(r);e.length>16&&(e=t(e,r.length*S));for(var o=Array(16),a=Array(16),c=0;16>c;c++)o[c]=909522486^e[c],a[c]=1549556828^e[c];var h=t(o.concat(A(n)),512+n.length*S);return t(a.concat(h),640)}function f(r,t){var n=(65535&r)+(65535&t),e=(r>>16)+(t>>16)+(n>>16);return e<<16|65535&n}function u(r,t){return r<<t|r>>>32-t}function A(r){for(var t=Array(),n=(1<<S)-1,e=0;e<r.length*S;e+=S)t[e>>5]|=(r.charCodeAt(e/S)&n)<<e%32;return t}function d(r){for(var t="",n=(1<<S)-1,e=0;e<32*r.length;e+=S)t+=String.fromCharCode(r[e>>5]>>>e%32&n);return t}function C(r){for(var t=m?"0123456789ABCDEF":"0123456789abcdef",n="",e=0;e<4*r.length;e++)n+=t.charAt(r[e>>2]>>e%4*8+4&15)+t.charAt(r[e>>2]>>e%4*8&15);return n}function i(r){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",e=0;e<4*r.length;e+=3)for(var o=(r[e>>2]>>8*(e%4)&255)<<16|(r[e+1>>2]>>8*((e+1)%4)&255)<<8|r[e+2>>2]>>8*((e+2)%4)&255,a=0;4>a;a++)n+=8*e+6*a>32*r.length?s:t.charAt(o>>6*(3-a)&63);return n}function g(r){function t(r,t){var n=r<<t|r>>>32-t;return n}function n(r){var t,n,e="";for(t=7;t>=0;t--)n=r>>>4*t&15,e+=n.toString(16);return e}function e(r){r=r.replace(/\r\n/g,"\n");for(var t="",n=0;n<r.length;n++){var e=r.charCodeAt(n);128>e?t+=String.fromCharCode(e):e>127&&2048>e?(t+=String.fromCharCode(e>>6|192),t+=String.fromCharCode(63&e|128)):(t+=String.fromCharCode(e>>12|224),t+=String.fromCharCode(e>>6&63|128),t+=String.fromCharCode(63&e|128))}return t}var o,a,c,h,f,u,A,d,C,i=new Array(80),g=1732584193,v=4023233417,l=2562383102,m=271733878,s=3285377520;r=e(r);var S=r.length,b=new Array;for(a=0;S-3>a;a+=4)c=r.charCodeAt(a)<<24|r.charCodeAt(a+1)<<16|r.charCodeAt(a+2)<<8|r.charCodeAt(a+3),b.push(c);switch(S%4){case 0:a=2147483648;break;case 1:a=r.charCodeAt(S-1)<<24|8388608;break;case 2:a=r.charCodeAt(S-2)<<24|r.charCodeAt(S-1)<<16|32768;break;case 3:a=r.charCodeAt(S-3)<<24|r.charCodeAt(S-2)<<16|r.charCodeAt(S-1)<<8|128}for(b.push(a);b.length%16!=14;)b.push(0);for(b.push(S>>>29),b.push(S<<3&4294967295),o=0;o<b.length;o+=16){for(a=0;16>a;a++)i[a]=b[o+a];for(a=16;79>=a;a++)i[a]=t(i[a-3]^i[a-8]^i[a-14]^i[a-16],1);for(h=g,f=v,u=l,A=m,d=s,a=0;19>=a;a++)C=t(h,5)+(f&u|~f&A)+d+i[a]+1518500249&4294967295,d=A,A=u,u=t(f,30),f=h,h=C;for(a=20;39>=a;a++)C=t(h,5)+(f^u^A)+d+i[a]+1859775393&4294967295,d=A,A=u,u=t(f,30),f=h,h=C;for(a=40;59>=a;a++)C=t(h,5)+(f&u|f&A|u&A)+d+i[a]+2400959708&4294967295,d=A,A=u,u=t(f,30),f=h,h=C;for(a=60;79>=a;a++)C=t(h,5)+(f^u^A)+d+i[a]+3395469782&4294967295,d=A,A=u,u=t(f,30),f=h,h=C;g=g+h&4294967295,v=v+f&4294967295,l=l+u&4294967295,m=m+A&4294967295,s=s+d&4294967295}var C=n(g)+n(v)+n(l)+n(m)+n(s);return C.toLowerCase()}function v(r){var t,n,e,o,a,c,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(e=r.length,n=0,t="";e>n;){if(o=255&r.charCodeAt(n++),n==e){t+=h.charAt(o>>2),t+=h.charAt((3&o)<<4),t+="==";break}if(a=r.charCodeAt(n++),n==e){t+=h.charAt(o>>2),t+=h.charAt((3&o)<<4|(240&a)>>4),t+=h.charAt((15&a)<<2),t+="=";break}c=r.charCodeAt(n++),t+=h.charAt(o>>2),t+=h.charAt((3&o)<<4|(240&a)>>4),t+=h.charAt((15&a)<<2|(192&c)>>6),t+=h.charAt(63&c)}return t}function l(r,t){for(var n="",e=0,o=r.length,a=t.length;o>e&&!(e>=a);e++)n+=String.fromCharCode(r.charCodeAt(e)^t.charCodeAt(e));return n}md5.xor=l,md5.sha1=g,md5.hex_md5=r,md5.base64encode=v;var m=0,s="",S=8}();;
  3. var cssStyle = ".dw-mini-popup-wrap{position:fixed;right:-380px;bottom:0;width:300px;height:426px;background:#fff;box-shadow:0 0 3px 0 #dcdcdc;*border:1px solid #f6f6f6;font-family:\"Microsoft Yahei\";z-index:1001;text-align:left}.dw-mini-popup-wrap.show{right:0}.dw-mini-popup{position:relative;width:100%;height:100%}.dw-mini-popup ul{list-style:none;margin:0;padding:0}.dw-mini-popup a{text-decoration:none}.dw-mini-popup .footer-shadow{position:absolute;left:0;width:100%;bottom:0;background-color:#000;background-color:rgba(0,0,0,.8);filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);color:#fff;font:12px/24px Simsun;text-align:center}.dw-mini-popup .news-image{display:block;width:100%;border:0}.dw-mini-popup .news-link{position:relative;display:block;color:#333;overflow:hidden}.dw-mini-popup .dw-popup-title{height:40px;padding-left:10px;background:#e94646;overflow:hidden}.dw-popup-title .popup-title{float:left;height:100%}.dw-popup-title .dw-popup-hide{float:right;width:8px;height:40px;padding:0 10px;background:url(http://pub.ouj.com/common//newsPopup/assets/popup_hide_daaa1a4.png) no-repeat center;cursor:pointer}.dw-popup-title .dw-popup-hide:hover{background-color:#ed6c6c}.dw-popup-title .web-address{float:left;cursor:pointer}.dw-popup-title .dw-popup-icon{float:left;height:40px;width:26px;background:url(http://pub.ouj.com/common//newsPopup/assets/dw_mini_popup_logo_558e01d.png) no-repeat center}.dw-popup-title .popup-title .dw-name{float:left;width:60px;height:20px;background:url(http://pub.ouj.com/common//newsPopup/assets/dw_big_text_1c49840.png) no-repeat center;margin:10px 5px;color:#fff}.dw-popup-title .popup-title .dw-popup-tip{float:left;margin-top:18px;*margin-top:16px;font:12px/1 SimSun;color:#ffc0c0}.dw-mini-popup .dw-mini-popup-nav{border-bottom:1px solid #e3e3e3;background:#fafafa;font-size:14px;line-height:33px;text-align:center}.dw-mini-popup .dw-mini-popup-nav .dw-mini-nav-list{height:34px;margin:0 -30px 0 0}.dw-mini-popup .dw-mini-popup-nav .dw-mini-nav-item{position:relative;display:inline-block;*display:inline;*zoom:1;margin-right:30px;color:#333;cursor:pointer}.dw-mini-popup .dw-mini-popup-nav .have-award:after{content:'';position:absolute;left:-5px;top:0;height:100%;width:42px;background:#fafafa url(http://pub.ouj.com/common//newsPopup/assets/kadow_active_41043b5.gif) no-repeat left center}.dw-mini-popup .dw-mini-popup-nav .dw-mini-nav-item.active{border-bottom:2px solid #e94646;font-weight:700;color:#e94646}.dw-mini-popup .dw-mini-popup-content{overflow:hidden}.dw-mini-news-panel{display:none}.dw-mini-news-panel.active{display:block}.popup-vital-news{padding:10px 10px 0}.popup-vital-news .big-news-wrap{width:278px;height:156px;position:relative}.popup-vital-news .big-news-wrap .big-news{display:block;height:100%;overflow:hidden}.popup-vital-news .big-news-wrap .footer-shadow{height:24px}.popup-vital-news .main-news-wrap{overflow:hidden;margin-top:10px}.popup-vital-news .main-news-wrap .middle-news-wrap{float:left;width:116px}.middle-news-wrap .middle-news-item{position:relative;height:78px;margin-bottom:10px;overflow:hidden}.middle-news-wrap .middle-news-item .zhibo-icon{position:absolute;top:0;right:0;font-size:12px;font-style:normal;font:12px/1 Simsun;padding:3px;color:#fff;line-height:1;z-index:9;background-color:#e94646}.middle-news-wrap .news-link{height:100%}.middle-news-wrap .middle-news-item .footer-shadow{height:24px}.popup-vital-news .main-news-wrap .text-news-wrap{float:left;width:150px;margin-left:10px;font-size:0;color:#333;overflow:hidden}.text-news-list li{overflow:hidden;*zoom:1}.text-news-list .first-news a{font-size:14px;font-weight:700;line-height:24px;color:#e94646}.text-news-list a{display:block;height:24px;font-size:12px;line-height:24px;color:#333;overflow:hidden;text-overflow:clip;*zoom:1}.text-news-list a:hover{color:#e94646;text-decoration:underline}.text-news-list .type-news{font-family:SimSun}.text-news-list .type-news i{float:left}.text-news-list .type-news.normal-type i,.text-news-list .type-news.red-type i{width:2px;height:2px;margin:13px 5px 0 0;background-color:#f60}.text-news-list .type-news.red-type a{color:#e94646}.text-news-list .type-news.video-type i,.text-news-list .type-news.image-type i{width:20px;height:24px;background-color:#ff7d1a}.text-news-list .type-news.video-type i{background:url(http://pub.ouj.com/common//newsPopup/assets/news_type_video_c0c01d2.png) no-repeat left center}.text-news-list .type-news.image-type i{background:url(http://pub.ouj.com/common//newsPopup/assets/news_type_image_90a12e7.png) no-repeat left center}.popup-videos-wrap .dw-mini-video-list{margin-right:-10px;padding:10px 10px 0;border-bottom:1px solid #e3e3e3;font-family:Simsun;overflow:hidden}.popup-videos-wrap .dw-mini-video-item{float:left;width:134px;margin-right:10px}.popup-videos-wrap .dw-mini-video-item .play-icon{position:absolute;width:16px;height:16px;background-image:url(http://pub.ouj.com/common//newsPopup/assets/play_icon_efee776.png);left:5px;top:50px}.popup-videos-wrap .news-image{height:73px}.popup-videos-wrap .news-title{margin:0;height:32px;font:12px/32px PingFang sc,\"Helvetica Neue\",Helvetica,Tahoma,Arial,SimSun,TW-Sung,\"WenQuanYi Bitmap Song\",\"AR PL UMing CN\",\"AR PL UMing HK\",\"AR PL UMing TW\",\"AR PL UMing TW MBE\",serif;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:100%}.popup-videos-wrap .more-news{font:12px/25px Simsun;text-align:center}.more-news .news-link{color:#333}.more-news .news-link:hover{color:#e94646}.popup-photo-gallery{font-family:Simsun}.popup-photo-gallery .big-text-news{height:38px;margin-top:3px;font-size:14px;font-weight:700;line-height:38px;text-align:center;overflow:hidden}.big-text-news .news-link{color:#e94646}.popup-photo-gallery .dw-mini-video-list{margin-right:-10px;padding:0 10px;border-bottom:1px solid #e3e3e3;overflow:hidden}.popup-photo-gallery .dw-mini-video-item{float:left;width:134px;margin-right:10px}.popup-photo-gallery .news-image{height:92px}.popup-photo-gallery .news-title{height:36px;margin:7px 0;font-size:12px;line-height:18px;overflow:hidden;width:100%}.popup-photo-gallery .more-news{font-size:12px;line-height:25px;text-align:center}.popup-kadou-wrap{padding:5px 15px 0}.popup-kadou-wrap .base-btn{display:block;border:0;padding:0;margin:0 auto;background-color:transparent;outline:0}.popup-kadou-wrap .kadou-box{height:228px;overflow:hidden}.popup-kadou-wrap .kadou-info-box .kadou-info{text-align:center;font-size:0;line-height:30px;margin-bottom:3px}.popup-kadou-wrap .kadou-info-box .kadou-icon{display:inline-block;*display:inline;*zoom:1;width:20px;height:20px;vertical-align:middle;background:url(http://pub.ouj.com/common//newsPopup/assets/kadou_icon_0a28d35.png) no-repeat center}.popup-kadou-wrap .kadou-info-box .kadou-num{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;font-size:14px;line-height:30px;color:#333;font-style:normal}.popup-kadou-wrap .kadou-info-box .daliy-lottery{width:100%;height:36px;line-height:36px;text-align:center;font-size:14px;color:#fff;cursor:pointer;border-radius:3px;background-color:#ffb018}.popup-kadou-wrap .kadou-info-box .daliy-lottery.lottery-finished{background-color:#c8c8c8}.popup-kadou-wrap .not-login-box{margin-top:10px}.popup-kadou-wrap .not-login-box .login-btn{width:100%;height:34px;border:1px solid #e94646;line-height:34px;text-align:center;font-size:14px;color:#ec6969;cursor:pointer;border-radius:3px}.popup-kadou-wrap .not-login-box .register-btn{width:100%;height:26px;line-height:36px;text-align:center;font-size:12px;color:#333;cursor:pointer;overflow:hidden}.popup-kadou-wrap .box-hd{*zoom:1}.popup-kadou-wrap .box-hd:before,.popup-kadou-wrap .box-hd:after{content:'';display:table;line-height:0}.popup-kadou-wrap .box-hd:after{clear:both}.popup-kadou-wrap .box-hd h3{float:left;margin:0;font-size:14px;line-height:40px;color:#999;font-weight:400}.popup-kadou-wrap .box-hd a{float:right;padding-right:13px;font-size:14px;line-height:40px;color:#999;background:url(http://pub.ouj.com/common//newsPopup/assets/arrow_icon_8526d9c.png) no-repeat right center}.popup-kadou-wrap .task-list li{margin-bottom:7px;height:24px;font-size:12px;line-height:24px;*zoom:1}.popup-kadou-wrap .task-list li a{vertical-align:top}.popup-kadou-wrap .task-list li.last-task{margin-bottom:0}.popup-kadou-wrap .task-list li:before,.popup-kadou-wrap .task-list li:after{content:\"\";display:table;line-height:0}.popup-kadou-wrap .task-list li:after{clear:both}.popup-kadou-wrap .task-list .task-name{float:left;white-space:nowrap;word-wrap:normal;overflow:hidden;text-overflow:ellipsis;text-align:left;color:#333;width:213px;line-height:24px;text-decoration:none}.popup-kadou-wrap .task-list .state-finished,.popup-kadou-wrap .task-list .state-notyet,.popup-kadou-wrap .task-list .state-ing{float:right;width:53px;height:22px;border:1px solid #e94646;text-align:center;color:#fff;background-color:#e94646;line-height:22px;border-radius:2px;cursor:pointer}.popup-kadou-wrap .task-list .state-ing:hover,.popup-kadou-wrap .task-list .state-notyet:hover,.popup-kadou-wrap .task-list .state-finished:hover{opacity:.8}.popup-kadou-wrap .task-list .state-notyet{color:#e94646;background-color:transparent}.popup-kadou-wrap .task-list .state-finished{border:1px solid #bebebe;background-color:transparent;color:#c6c6c6}.popup-kadou-wrap .exchange-list{font-size:0;margin-right:-4px}.popup-kadou-wrap .exchange-list li{display:inline-block;*display:inline;*zoom:1;vertical-align:top;width:62px;height:62px;border:1px solid #bebebe;margin-right:4px}.popup-kadou-wrap .exchange-list li a,.popup-kadou-wrap .exchange-list li img{position:relative;display:block;width:100%;height:100%}.popup-kadou-wrap .exchange-list .exchange-gold{position:absolute;left:0;bottom:0;width:100%;height:17px;font-size:12px;line-height:17px;color:#fff;text-align:center;background:url(http://pub.ouj.com/common//newsPopup/assets/shadow_icon_f3abc38.png) repeat-x;font-style:normal}.dw-mini-popup-littleboy{width:60px;height:90px;position:absolute;bottom:0;left:-52px;cursor:pointer;background:url(http://pub.ouj.com/common//newsPopup/assets/dw_news_littleboy_15b83cd.png) no-repeat}.dw-mini-popup-littleboy:hover{animation:boybounce .8s 1 ease backwards}@keyframes boybounce{0%,100%,20%,50%,80%{-webkit-transform:translateY(0);transform:translateY(0)}40%{-webkit-transform:translateY(-12px);transform:translateY(-12px)}60%{-webkit-transform:translateY(-5px);transform:translateY(-5px)}}.dw-min-popup-dancer{position:fixed;width:52px;height:75px;right:-60px;bottom:50px;border:0;cursor:pointer;z-index:9999;background:url(http://pub.ouj.com/common//newsPopup/assets/dw_min_popup_dancer_2f54c22.png) no-repeat}.dw-min-popup-dancer:hover{background-image:url(http://pub.ouj.com/common//newsPopup/assets/dw_min_popup_dancer_64a930f.gif)}.dw-min-popup-dancer.show{right:0}.dw-mini-popup-award{position:absolute;left:0;right:0;top:40px;bottom:0}.dw-mini-popup-award .dw-mini-award-bg{position:absolute;left:0;top:0;width:100%;height:100%;background:url(http://pub.ouj.com/common//newsPopup/assets/award-bg_7aa0bad.png) repeat}.dw-mini-popup-award .dw-mini-award-warp{position:absolute;left:50%;top:50%;width:230px;height:122px;margin-left:-115px;margin-top:-61px;background-color:#fff;z-index:9}.dw-mini-popup-award .dw-mini-award-msg{width:170px;margin:16px auto 0;font-size:13px;font-weight:700;line-height:1.6;color:#000;text-align:center}.dw-mini-popup-award .dw-mini-award-link{display:block;width:80px;height:30px;margin:16px auto 0;font-size:13px;line-height:30px;color:#fff;text-align:center;background-color:#ed5454;text-decoration:none;cursor:pointer}";
  4. var template = function(obj){
  5. var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
  6. with(obj||{}){
  7. __p+='<div class="dw-mini-popup-wrap '+
  8. ((__t=( option==1?'show':''))==null?'':__t)+
  9. '">\r\n <div class="dw-mini-popup">\r\n <!--新闻header -->\r\n <div class="dw-popup-title">\r\n <div class="popup-title">\r\n <a class="web-address" href="http://www.duowan.com/?wen" target="_blank">\r\n <i class="dw-popup-icon"></i>\r\n <span class="dw-name"></span>\r\n </a>\r\n <span class="dw-popup-tip">迷你版</span>\r\n </div>\r\n <span class="dw-popup-hide"></span>\r\n </div>\r\n <!-- 新闻header -->\r\n\r\n <!--新闻Nav -->\r\n <div class="dw-mini-popup-nav">\r\n <ul class="dw-mini-nav-list">\r\n <li class="dw-mini-nav-item">\r\n 要闻\r\n </li>\r\n <li class="dw-mini-nav-item tuku-item">\r\n 图库\r\n </li>\r\n <li class="dw-mini-nav-item kadou-item">\r\n 金豆\r\n </li>\r\n </ul>\r\n </div>\r\n <!-- 新闻Nav -->\r\n\r\n <!--新闻内容 -->\r\n <div class="dw-mini-popup-content">\r\n <div class="dw-mini-news-panel popup-vital-news">\r\n \r\n </div>\r\n \r\n <!--图库新闻{-->\r\n <div class="dw-mini-news-panel popup-photo-gallery">\r\n\r\n </div>\r\n <!--}图库新闻-->\r\n\r\n <!--特权金豆{-->\r\n <div class="dw-mini-news-panel popup-kadou-wrap">\r\n\r\n </div>\r\n <!--}特权金豆-->\r\n </div>\r\n <!-- 新闻内容 -->\r\n\r\n\r\n\r\n <!--招手的小矮人-->\r\n <div class="dw-mini-popup-littleboy"></div>\r\n <!--招手的小矮人 -->\r\n </div>\r\n\r\n <!--挥手的小矮人{-->\r\n <div class="dw-min-popup-dancer '+
  10. ((__t=( option==0?'show':''))==null?'':__t)+
  11. '">\r\n </div>\r\n <!--}挥手的小矮人-->\r\n\r\n <!--金豆奖励-->\r\n <div class="dw-mini-popup-award" style="display:none;">\r\n <div class="dw-mini-award-bg"></div>\r\n <div class="dw-mini-award-warp">\r\n <div class="dw-mini-award-msg">\r\n </div>\r\n <a title="领取金豆" class="dw-mini-award-link btn-reward" data-taskid target="_blank">领取</a>\r\n </div>\r\n </div>\r\n <!--金豆奖励 -->\r\n\r\n</div>';
  12. }
  13. return __p;
  14. };
  15. var vitalNewsTpl = function(obj){
  16. var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
  17. with(obj||{}){
  18. __p+='<!--大图新闻{-->\r\n <div class="big-news-wrap">\r\n <a href="'+
  19. ((__t=( news.headpic1&&news.headpic1.url ))==null?'':__t)+
  20. '?wen" class="big-news news-link" title="'+
  21. ((__t=( news.headpic1&&news.headpic1.title ))==null?'':__t)+
  22. '"\r\n target="_blank">\r\n <img src="'+
  23. ((__t=( news.headpic1&&news.headpic1.img ))==null?'':__t)+
  24. '" class="news-image" />\r\n <span class="footer-shadow">'+
  25. ((__t=( news.headpic1&&news.headpic1.title ))==null?'':__t)+
  26. '</span>\r\n </a>\r\n </div>\r\n <!--}大图新闻-->\r\n <div class="main-news-wrap">\r\n <!--左侧中图新闻{-->\r\n <div class="middle-news-wrap">\r\n <ul class="middle-news-list">\r\n ';
  27. if(zhibo){
  28. __p+='\r\n <li class="middle-news-item">\r\n <i class="zhibo-icon">直播</i>\r\n <a href="'+
  29. ((__t=( zhibo.url ))==null?'':__t)+
  30. '?wen" class="news-link" title="'+
  31. ((__t=( zhibo.room_name ))==null?'':__t)+
  32. '"\r\n target="_blank">\r\n <img src="'+
  33. ((__t=( zhibo.room_thumb ))==null?'':__t)+
  34. '" class="news-image" />\r\n <span class="footer-shadow">'+
  35. ((__t=( zhibo.room_name ))==null?'':__t)+
  36. '</span>\r\n </a>\r\n </li>\r\n ';
  37. }
  38. __p+='\r\n <li class="middle-news-item">\r\n <a href="'+
  39. ((__t=( news.headpic2&&news.headpic2.url ))==null?'':__t)+
  40. '?wen" class="news-link" title="'+
  41. ((__t=( news.headpic2&&news.headpic2.title ))==null?'':__t)+
  42. '"\r\n target="_blank">\r\n <img src="'+
  43. ((__t=( news.headpic2&&news.headpic2.img ))==null?'':__t)+
  44. '" class="news-image" />\r\n <span class="footer-shadow">'+
  45. ((__t=( news.headpic2&&news.headpic2.title ))==null?'':__t)+
  46. '</span>\r\n </a>\r\n </li>\r\n <li class="middle-news-item">\r\n <a href="'+
  47. ((__t=( news.headpic3&&news.headpic3.url ))==null?'':__t)+
  48. '?wen" class="news-link" title="'+
  49. ((__t=( news.headpic3&&news.headpic3.title ))==null?'':__t)+
  50. '"\r\n target="_blank">\r\n <img src="'+
  51. ((__t=( news.headpic3&&news.headpic3.img ))==null?'':__t)+
  52. '" class="news-image" />\r\n <span class="footer-shadow">'+
  53. ((__t=( news.headpic3&&news.headpic3.title ))==null?'':__t)+
  54. '</span>\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n <!--}左侧中图新闻-->\r\n\r\n <!--无图新闻列表{-->\r\n <div class="text-news-wrap">\r\n <ul class="text-news-list">\r\n ';
  55. for(var i = 1;i<=7;i++){
  56. var newsitem = news['line'+i]
  57. if(i==1){
  58. __p+='\r\n <li class="first-news">\r\n <a href="'+
  59. ((__t=( newsitem.url))==null?'':__t)+
  60. '?wen" title="'+
  61. ((__t=( newsitem.title ))==null?'':__t)+
  62. '" target="_blank">\r\n '+
  63. ((__t=( newsitem.title ))==null?'':__t)+
  64. '\r\n </a>\r\n ';
  65. }else{
  66. __p+='\r\n </li>\r\n <li class="type-news '+
  67. ((__t=( newsitem.type+'-type' ))==null?'':__t)+
  68. '">\r\n <i class="type-icon"></i>\r\n <a href="'+
  69. ((__t=( newsitem.url ))==null?'':__t)+
  70. '?wen" title="'+
  71. ((__t=( newsitem.title ))==null?'':__t)+
  72. '" target="_blank">\r\n '+
  73. ((__t=( newsitem.title ))==null?'':__t)+
  74. '\r\n </a>\r\n </li>\r\n ';
  75. }
  76. }
  77. __p+='\r\n </ul>\r\n </div>\r\n <!--}无图新闻列表-->\r\n\r\n </div>';
  78. }
  79. return __p;
  80. };
  81. var tukuTpl = function(obj){
  82. var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
  83. with(obj||{}){
  84. __p+='<div class="big-text-news">\r\n <a href="'+
  85. ((__t=( news['line8']&&news['line8'].url ))==null?'':__t)+
  86. '?wen" class="news-link" title="'+
  87. ((__t=( news['line8']&&news['line8'].title ))==null?'':__t)+
  88. '"\r\n target="_blank">\r\n '+
  89. ((__t=( news['line8']&&news['line8'].title ))==null?'':__t)+
  90. '\r\n </a>\r\n</div>\r\n<div class="dw-mini-videos-wrap">\r\n <ul class="dw-mini-video-list">\r\n ';
  91. for(var i =0;i<4;i++){
  92. var galleryitem = gallerys[i]
  93. __p+='\r\n <li class="dw-mini-video-item">\r\n <a href="'+
  94. ((__t=( galleryitem.link ))==null?'':__t)+
  95. '?wen" class="news-link" title="'+
  96. ((__t=( galleryitem.title ))==null?'':__t)+
  97. '" target="_blank">\r\n <img src="'+
  98. ((__t=( galleryitem.picsrc ))==null?'':__t)+
  99. '" class="news-image" />\r\n <p class="news-title">\r\n '+
  100. ((__t=( galleryitem.title ))==null?'':__t)+
  101. '\r\n </p>\r\n </a>\r\n ';
  102. }
  103. __p+='\r\n </li>\r\n </ul>\r\n</div>\r\n<div class="more-news">\r\n <a href="http://tu.duowan.com/tu?wen" class="news-link" target="_blank">点击查看更多></a>\r\n</div>';
  104. }
  105. return __p;
  106. };
  107. var kaTpl = function(obj){
  108. var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
  109. with(obj||{}){
  110. __p+='<div class="kadou-box">\r\n ';
  111. if(isLogin){
  112. __p+='\r\n <div class="login-box">\r\n <div class="kadou-info-box">\r\n <p class="kadou-info">\r\n <i class="kadou-icon"></i>\r\n <em class="kadou-num">'+
  113. ((__t=( ka.userInfo.gold / 100 ))==null?'':__t)+
  114. '</em>\r\n </p>\r\n ';
  115. if(ka.lottery.can || ka.lottery.reset >= 0){
  116. __p+='\r\n <a href="http://plus.duowan.com/?from=lottery" target="_blank" class="daliy-lottery base-btn">'+
  117. ((__t=( ka.lottery.nextBatch ==1 ? '每日抽奖':'再次抽奖'))==null?'':__t)+
  118. '('+
  119. ((__t=( ka.lottery.nextBatch - 1 ))==null?'':__t)+
  120. '/'+
  121. ((__t=( ka.lottery.maxBatch ))==null?'':__t)+
  122. ')</a>\r\n ';
  123. } else {
  124. __p+='\r\n ';
  125. if (ka.lottery.cart) {
  126. __p+='\r\n <a href="'+
  127. ((__t=( ka.lottery.cart ))==null?'':__t)+
  128. '" target="_blank" class="base-btn">领取奖品</a>\r\n ';
  129. } else{
  130. __p+='\r\n <button class="daliy-lottery base-btn lottery-finished">今日已抽奖</button>\r\n ';
  131. }
  132. __p+='\r\n ';
  133. }
  134. __p+='\r\n </div>\r\n </div>\r\n ';
  135. }else{
  136. __p+='\r\n <div class="not-login-box">\r\n <button class="login-btn base-btn" title="登录">登录</button>\r\n <a class="register-btn base-btn" title="注册账号" href="http://aq.yy.com/p/reg/account.do?appid=&url=&fromadv=udbclsd_r" target="_blank">注册账号</a>\r\n </div>\r\n ';
  137. }
  138. __p+='\r\n\r\n <div class="kadou-task-box">\r\n <div class="box-hd">\r\n <h3>金豆任务</h3>\r\n <a href="http://plus.duowan.com/userTask" title="更多" target="_blank">更多<i class="arrow-icon"></i></a>\r\n </div>\r\n <ul class="task-list">\r\n ';
  139. if(!isLogin){
  140. __p+='\r\n <li>\r\n <a class="state-ing login-btn">签到</a>\r\n <a class="task-name">每日签到,领取金豆</a>\r\n </li>\r\n ';
  141. }else if(!ka.signDays.isSignedToday) {
  142. __p+='\r\n <li>\r\n <a class="state-ing action-sign">签到</a>\r\n <a class="task-name">每日签到,领取金豆</a>\r\n </li>\r\n ';
  143. }
  144. __p+='\r\n\r\n ';
  145. for(var i = 0; i < ka.tasks.length ; i++){
  146. __p+='\r\n <li>\r\n ';
  147. if(!isLogin){
  148. __p+='\r\n <a class="state-notyet login-btn">做任务</a>\r\n ';
  149. }else if (ka.tasks[i]['status'] == 2) {
  150. __p+='\r\n <a href="'+
  151. ((__t=( ka.tasks[i]['target_url'] ))==null?'':__t)+
  152. '" class="state-notyet" target="_blank">做任务</a>\r\n ';
  153. } else if (ka.tasks[i]['status'] == 3) {
  154. __p+='\r\n <a class="state-ing btn-reward" data-shopid="9" data-taskid="'+
  155. ((__t=( ka.tasks[i]['task_id']))==null?'':__t)+
  156. '">领奖励</a>\r\n ';
  157. } else if (ka.tasks[i]['status'] == 4){
  158. __p+='\r\n <a class="state-finished">已完成</a>\r\n ';
  159. } else {
  160. __p+='\r\n <a class="state-finished">已完成</a>\r\n ';
  161. }
  162. __p+='\r\n\r\n <a target="_blank" class="task-name" href="'+
  163. ((__t=( ka.tasks[i].target_url ))==null?'':__t)+
  164. '">'+
  165. ((__t=( ka.tasks[i].task_name ))==null?'':__t)+
  166. '</a>\r\n </li>\r\n ';
  167. }
  168. __p+='\r\n </ul>\r\n </div>\r\n</div>\r\n\r\n<div class="hot-exchange-box">\r\n <div class="box-hd">\r\n <h3>热门兑换</h3>\r\n <a href="http://plus.duowan.com/" title="更多" target="_blank">更多</a>\r\n </div>\r\n\r\n <ul class="exchange-list">\r\n ';
  169. for(var i = 0; i < exList.length ; i++){
  170. __p+='\r\n <li>\r\n <a href="http://plus.duowan.com/default/goods?goods_id='+
  171. ((__t=( exList[i].goods_id ))==null?'':__t)+
  172. '" title="'+
  173. ((__t=( exList[i].goods_name ))==null?'':__t)+
  174. '" target="_blank">\r\n <img src="'+
  175. ((__t=( exList[i].goods_img ))==null?'':__t)+
  176. '" alt="'+
  177. ((__t=( exList[i].goods_name ))==null?'':__t)+
  178. '"/>\r\n <em class="exchange-gold">'+
  179. ((__t=( exList[i].gold / 100 ))==null?'':__t)+
  180. '金豆</em>\r\n </a>\r\n </li>\r\n ';
  181. }
  182. __p+='\r\n </ul>\r\n</div>';
  183. }
  184. return __p;
  185. };
  186. var _BUSY_STORAGE_ = "dw_mini_popup_busy_status";
  187. var _NORMAL_STORAGE_ = "dw_mini_popup_status";
  188. var plainFunction = function() {};
  189. var allData = {}; //所有数据
  190. var Util = {
  191. getCookie: function(key) {
  192. var arr,
  193. reg = new RegExp("(^| )" + key + "=([^;]*)(;|$)");
  194. if ((arr = doc.cookie.match(reg))) return unescape(arr[2]);
  195. else return null;
  196. },
  197. setCookie: function(key, value, day) {
  198. day = day || 1; //天数
  199. var cookie =
  200. key +
  201. "=" +
  202. escape(value) +
  203. "; max-age=" +
  204. day * 24 * 60 * 60 +
  205. "; domain=duowan.com; path=/";
  206. doc.cookie = cookie;
  207. },
  208. getScript: function(url, callback) {
  209. var head = document.getElementsByTagName("head")[0];
  210. var script = document.createElement("script");
  211. script.type = "text/javascript";
  212. script.src = url;
  213. var done = false;
  214. script.onload = script.onreadystatechange = function() {
  215. if (
  216. !this.readyState ||
  217. this.readyState == "complete" ||
  218. this.readyState == "loaded"
  219. ) {
  220. callback();
  221. head.removeChild(script);
  222. }
  223. };
  224. head.appendChild(script);
  225. },
  226. isLogin: function() {
  227. return Util.getCookie("yyuid") || Util.getCookie("lg_uid");
  228. },
  229. encodePwd: function(random, pwd) {
  230. var k1 = md5.sha1(random);
  231. var k2 = md5.sha1(k1);
  232. var v = md5.xor(md5.xor(pwd, k2), k1);
  233. return md5.base64encode(v);
  234. },
  235. // 16点至凌晨2点
  236. isBusyTime: function() {
  237. var hour = new Date().getHours();
  238. return hour >= 16 || hour < 2;
  239. }
  240. };
  241. var NewsPopup = {
  242. popupUI: null,
  243. newsWrap: null, //新闻区域
  244. dancer: null, //招手的小人
  245. hideButton: null, //右上角关闭按钮
  246. navBar: null, //导航栏
  247. littleboy: null, //不动的小人
  248. popupTimer: null, // 16点定时弹出的定时器
  249. firstTuku: true,
  250. firstKa: true,
  251. initDom: function(data) {
  252. var option = null;
  253. var isBusy = Util.isBusyTime();
  254. //忙时默认打开,闲时默认关闭
  255. if (isBusy) {
  256. option = ClosedOption.getBusy();
  257. allData.option = parseInt(option) == 0 ? 0 : 1;
  258. } else {
  259. option = ClosedOption.get();
  260. allData.option = parseInt(option) == 1 ? 1 : 0;
  261. }
  262. this.popupUI = $(template(data));
  263. this.vitalNews = this.popupUI.find(".popup-vital-news");
  264. this.tuku = this.popupUI.find(".popup-photo-gallery");
  265. this.newsWrap = this.popupUI.find(".dw-mini-popup");
  266. this.navlist = this.popupUI.find(".dw-mini-nav-item");
  267. this.newsPanel = this.popupUI.find(".dw-mini-news-panel");
  268. this.hideButton = this.popupUI.find(".dw-popup-hide");
  269. this.navBar = this.popupUI.find(".dw-mini-nav-list");
  270. this.littleboy = this.popupUI.find(".dw-mini-popup-littleboy");
  271. this.dancer = this.popupUI.find(".dw-min-popup-dancer");
  272. this.award = this.popupUI.find(".dw-mini-popup-award");
  273. //添加dom
  274. this.addEvent()
  275. .append()
  276. .openTimer();
  277. },
  278. //首屏新闻
  279. getVitalNewsData: function(callback) {
  280. $.when(
  281. $.ajax({
  282. url: "//tips.duowan.com/tnews",
  283. dataType: "jsonp"
  284. }),
  285. $.ajax({
  286. url: "//plus.duowan.com/zhibo/list",
  287. dataType: "jsonp"
  288. })
  289. )
  290. .done(function(ret1, ret2) {
  291. allData.news = ret1[0];
  292. allData.zhibo = ret2 && ret2[0].data && ret2[0].data[0];
  293. })
  294. .then(function() {
  295. callback(allData);
  296. });
  297. },
  298. renderVitalNews: function(data) {
  299. this.vitalNews.html(vitalNewsTpl(data));
  300. this.navlist.eq(0).trigger("mouseover");
  301. },
  302. getTukuData(callback) {
  303. $.ajax({
  304. url: "//www.duowan.com/s/newsPopup/news.json",
  305. dataType: "jsonp",
  306. jsonp: "jsonp1",
  307. jsonpCallback: "jsonp1"
  308. }).done(function(ret) {
  309. allData.gallerys = ret.gallery;
  310. allData.videos = ret.video;
  311. callback(allData);
  312. });
  313. },
  314. renderTuku(tukuData) {
  315. this.tuku.html(tukuTpl(tukuData));
  316. this.navlist.eq(1).trigger("mouseover");
  317. },
  318. /**添加事件 */
  319. addEvent: function() {
  320. var self = this;
  321. if (window.dwUDBProxy) {
  322. dwUDBProxy.add(loadData);
  323. } else {
  324. Util.getScript(
  325. "//pub.dwstatic.com/common/js/dwudbproxy.js",
  326. function() {
  327. dwUDBProxy.add(loadData);
  328. }
  329. );
  330. }
  331. this.hideButton.click(function() {
  332. self.hideNews();
  333. });
  334. this.littleboy.click(function() {
  335. self.hideNews();
  336. });
  337. this.award.children(".dw-mini-award-bg").click(function() {
  338. self._ClosedKaDou();
  339. });
  340. this.dancer.click(function() {
  341. self.showNews();
  342. });
  343. //金豆页面点击事件
  344. this.popupUI
  345. .on("click", ".login-btn", function() {
  346. if (window.dwUDBProxy) {
  347. dwUDBProxy.login(plainFunction);
  348. } else {
  349. Util.getScript(
  350. "//pub.dwstatic.com/common/js/dwudbproxy.js",
  351. function() {
  352. dwUDBProxy.login(plainFunction);
  353. }
  354. );
  355. }
  356. })
  357. .on("click", ".action-sign", function() {
  358. var $e = $(this);
  359. var api = "//plus.duowan.com/task/sign";
  360. var data = {
  361. shop_id: 6,
  362. time: new Date().getTime()
  363. };
  364. var password =
  365. Util.getCookie("password") ||
  366. Util.getCookie("lg_openid");
  367. data["sign"] = Util.encodePwd(
  368. password,
  369. md5.sha1($.param(data))
  370. );
  371. $.ajax({
  372. url: api,
  373. dataType: "jsonp",
  374. data: data
  375. }).done(function(ret) {
  376. if (ret.code == 0) {
  377. allData.ka.userInfo.gold =
  378. allData.ka.userInfo.gold * 1 +
  379. ret.data.gold * 1;
  380. $e.removeClass("action-sign state-ing")
  381. .addClass("state-finished")
  382. .text("已签到");
  383. self.popupUI
  384. .find(".kadou-info .kadou-num")
  385. .text(allData.ka.userInfo.gold / 100);
  386. }
  387. });
  388. })
  389. .on("click", ".btn-reward", function() {
  390. var $e = $(this);
  391. var taskid = $e.attr("data-taskid");
  392. var api =
  393. "//kaplus.duowan.com/task/reward?task_id=" + taskid;
  394. $.ajax({
  395. url: api,
  396. dataType: "jsonp"
  397. }).done(function(ret) {
  398. if (ret.code == 0) {
  399. $e.removeClass("btn-reward state-ing")
  400. .addClass("state-finished")
  401. .text("已完成");
  402. if ($e.hasClass("dw-mini-award-link")) {
  403. var $kadouItem = self.navlist.filter(
  404. ".kadou-item"
  405. );
  406. $kadouItem
  407. .trigger("mouseover")
  408. .addClass("have-award");
  409. self.popupUI
  410. .find(
  411. ".task-list a[data-taskid=" +
  412. taskid +
  413. "]"
  414. )
  415. .removeClass("state-ing state-notyet")
  416. .addClass("state-finished")
  417. .text("已完成");
  418. self._ClosedKaDou();
  419. }
  420. //如果已经请求过ka数据
  421. if (allData.ka) {
  422. allData.ka.userInfo.gold =
  423. allData.ka.userInfo.gold * 1 +
  424. ret.data.gold * 1;
  425. self.popupUI
  426. .find(".kadou-info .kadou-num")
  427. .text(allData.ka.userInfo.gold / 100);
  428. }
  429. }
  430. });
  431. });
  432. this.navlist.hover(self.togglePanel);
  433. //mouseover 图库tab 时再去请求
  434. this.navlist.filter(".tuku-item").hover(function() {
  435. if (!self.firstTuku) return;
  436. self.firstTuku = false;
  437. self.getTukuData(function(data) {
  438. self.renderTuku(data);
  439. });
  440. });
  441. //mouseover 金豆tab 时再去请求
  442. this.navlist.filter(".kadou-item").hover(function() {
  443. if (!self.firstKa) return;
  444. self.firstKa = false;
  445. loadData();
  446. });
  447. function loadData() {
  448. allData.isLogin = Util.isLogin();
  449. $.when(
  450. $.ajax({
  451. url: "//plus.duowan.com/popup",
  452. data: { task_num: 4 },
  453. dataType: "jsonp"
  454. }),
  455. $.ajax({
  456. url: "//plus.duowan.com/open/GetShopGoods",
  457. dataType: "jsonp"
  458. })
  459. )
  460. .done(function(ret, ret2) {
  461. ret[0].code == 0 && (allData.ka = ret[0].data);
  462. ret2[0].code == 0 &&
  463. (allData.exList = ret2[0].data.slice(0, 4));
  464. })
  465. .then(function() {
  466. $(".popup-kadou-wrap").html(kaTpl(allData));
  467. });
  468. }
  469. return this;
  470. },
  471. append: function() {
  472. $("body")
  473. .append("<style>" + cssStyle + "</style>")
  474. .append(this.popupUI);
  475. return this;
  476. },
  477. /**显示新闻 */
  478. showNews: function() {
  479. var self = this;
  480. this.dancer.animate(
  481. {
  482. right: "-60px"
  483. },
  484. 200,
  485. function() {
  486. self.popupUI.animate(
  487. {
  488. right: "0px"
  489. },
  490. 600
  491. );
  492. }
  493. );
  494. Util.isBusyTime() ? ClosedOption.setBusy(1) : ClosedOption.set(1);
  495. },
  496. /**隐藏新闻 */
  497. hideNews: function() {
  498. var self = this;
  499. this.popupUI.animate(
  500. {
  501. right: "-380px"
  502. },
  503. 600,
  504. function() {
  505. self.dancer.animate(
  506. {
  507. right: "0px"
  508. },
  509. 200
  510. );
  511. }
  512. );
  513. Util.isBusyTime() ? ClosedOption.setBusy(0) : ClosedOption.set(0);
  514. },
  515. /**切换panel */
  516. togglePanel: function() {
  517. var _this = $(this);
  518. var index = _this.index();
  519. if (_this.hasClass("active")) return;
  520. _this.siblings(".active").removeClass("active");
  521. _this.addClass("active");
  522. NewsPopup.newsPanel
  523. .removeClass("active")
  524. .eq(index)
  525. .addClass("active");
  526. },
  527. showKaDou: function(obj) {
  528. this.award.find(".dw-mini-award-msg").text(obj.text);
  529. this.award
  530. .find(".dw-mini-award-link")
  531. .attr("data-taskid", obj.taskid);
  532. this.award.show();
  533. this.showNews();
  534. },
  535. /** 关闭金豆奖励*/
  536. _ClosedKaDou: function() {
  537. var self = this;
  538. this.award.hide();
  539. setTimeout(function() {
  540. self.navlist.filter(".kadou-item").removeClass("have-award");
  541. }, 4000);
  542. },
  543. /**16点左右弹出弹窗 */
  544. openTimer: function() {
  545. if (!Util.isBusyTime()) {
  546. var self = this;
  547. var now = new Date();
  548. var minutes =
  549. (15 - now.getHours()) * 60 + (60 - now.getMinutes());
  550. var duration = minutes * 60 * 1000;
  551. // var duration = 5 * 1000;
  552. console.log("minutes:", minutes);
  553. this.popupTimer = setTimeout(function() {
  554. self.getVitalNewsData(function(data) {
  555. self.renderVitalNews(data);
  556. self.showNews();
  557. });
  558. }, duration);
  559. }
  560. return this;
  561. }
  562. };
  563. /**根据用户操作读写cookie
  564. * 每天16:00到第二天2:00强制展开
  565. * 凌晨2点以后强制保持关闭状态,至16:00
  566. */
  567. var ClosedOption = {
  568. getBusy: function() {
  569. var ret = Util.getCookie(_BUSY_STORAGE_);
  570. return ret;
  571. },
  572. setBusy: function(option) {
  573. Util.setCookie(_BUSY_STORAGE_, option, 1 / 3);
  574. },
  575. get: function() {
  576. var ret = Util.getCookie(_NORMAL_STORAGE_);
  577. return ret;
  578. },
  579. /**option:0 / 1 */
  580. set: function(option) {
  581. Util.setCookie(_NORMAL_STORAGE_, option, 365);
  582. }
  583. };
  584. var init = function() {
  585. NewsPopup.getVitalNewsData(function(data) {
  586. NewsPopup.initDom(data);
  587. NewsPopup.renderVitalNews(data);
  588. });
  589. //暴露全局变量给其他地方调用
  590. window.dwMiniNewsPopup = {
  591. showKaDou: function(obj) {
  592. NewsPopup.showKaDou(obj);
  593. }
  594. };
  595. };
  596. //判断是否有引入jquery
  597. if (typeof $ == "undefined") {
  598. Util.getScript("//pub.dwstatic.com/common/js/jquery.js", function() {
  599. init();
  600. });
  601. } else {
  602. init();
  603. }
  604. })(window, document);