;(function() { function includeLinkScript(url, callback) { var doc = document; var script = doc.createElement('script'); if (script.readyState) { script.onreadystatechange = function() { if (script.readyState == 'loaded' || script.readyState == 'complete') { script.onreadystatechange = null; callback(); } }; } else { script.onload = function () { callback(); }; } script.src = url; doc.getElementsByTagName('head')[0].appendChild(script); } function FixedAdv(object) { var $window = $(window); var viewpostH = $window.height(); if (typeof FixedAdv._initialized === 'undefined') { FixedAdv.prototype.includeStyleElement = function(styles, styleId) { var doc = document; if (doc.getElementById(styleId)) { return; } var style = doc.createElement('style'); style.id = styleId; doc.getElementsByTagName('head')[0].appendChild(style); if (style.styleSheet) { style.styleSheet.cssText = styles; } else { style.appendChild(doc.createTextNode(styles)); } }; FixedAdv.prototype.getIEVersion = function() { var undef; var v = 3; var div = document.createElement('div'); var all = div.getElementsByTagName('i'); while ( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); return v > 4 ? v : undef; }; FixedAdv.prototype.setSmall = function() { var _self = this; _self.object.find('.close').click(function() { _self.object.addClass('bmhVideoFixedAdv-small'); }); }; FixedAdv.prototype.autoSetSmall = function() { var _self = this; setTimeout(function() { _self.object.addClass('bmhVideoFixedAdv-small'); }, 15*1000); }; FixedAdv.prototype.setFull = function() { var _self = this; _self.object.mouseenter(function() { _self.object.removeClass('bmhVideoFixedAdv-small'); }); }; FixedAdv.prototype.addPane = function() { var styles = ['body,div,span,a,strong,img,h2,h3,h4,ul,li,p {margin: 0;padding: 0;}', 'h1,h2,h3,h4{font-size: 100%;}', 'img {border: none;}', 'ul {list-style: none;}', '.bmhVideoFixedAdv {width: 300px;height: 250px;overflow: hidden;font-size: 12px;line-height: 1.5em;color: #333;background: #f1f1f1;position: fixed;right: 0;bottom: 0;_position: absolute;z-index: 9999;}', '.bmhVideoFixedAdv-small{width:100px;height:100px;_margin-top:150px;}', '.bmhVideoFixedAdv-small .close{display:none;}', '.bmhVideoFixedAdv-small .bmhVideoFixedAdv-bd{padding:6px 6px 0;}', '.bmhVideoFixedAdv-small .bmhVideoFixedAdv-recommend .img img{width:88px; height:58px;}', '.bmhVideoFixedAdv a {text-decoration: none;}', '.bmhVideoFixedAdv-hd {position: relative;height: 30px;padding-left: 35px;color: #666;background: #ccc;line-height: 30px;}', '.bmhVideoFixedAdv .icon-dot-small {position: absolute;top: 9px;left: 0;width: 2px;height: 3px;overflow: hidden;font-size: 0;background: #666;}', '.bmhVideoFixedAdv .icon-logo-mini {position: absolute;top: 6px;left: 6px;width: 24px;height: 18px;background: url(http://static01.baomihua.com/img/video/v2/icon-logo-mini.png) no-repeat;background-position: 0 0;}', '.bmhVideoFixedAdv-hd .close {position: absolute;top: 5px;right: 6px;width: 18px;height: 18px;overflow: hidden;font-size: 17px;color: #666;text-align: center;line-height: 18px;border: 1px solid #666;cursor: pointer;}', '.bmhVideoFixedAdv-bd {padding: 10px 10px 0;}', '.bmhVideoFixedAdv-recommend {width: 100%;height: 80px;overflow: hidden;margin-bottom: 10px;}', '.bmhVideoFixedAdv-recommend .link {display: block;width: 100%;height: 100%;color: #888;}', '.bmhVideoFixedAdv-recommend h4 {width: 140px;height: 18px;overflow: hidden;margin-bottom: 6px;color: #428ace;white-space: nowrap;text-overflow: ellipsis;}', '.bmhVideoFixedAdv-recommend p {height: 72px;overflow: hidden;}', '.bmhVideoFixedAdv-recommend .img {float: left;}', '.bmhVideoFixedAdv-recommend .txt {margin-left: 158px;}', '.bmhVideoFixedAdv-hot-hd {margin-bottom: 4px;}', '.bmhVideoFixedAdv-hot-hd .heading {display: inline;}', '.bmhVideoFixedAdv-hot-hd .link-hot {color: #333;}', '.bmhVideoFixedAdv-hot-bd {width: 280px;overflow: hidden;}', '.bmhVideoFixedAdv-hot-bd ul {width: 340px;}', '.bmhVideoFixedAdv-hot-bd .item-word {position: relative;display: inline;float: left;width: 122px;height: 22px;margin-right: 20px;padding-left: 8px;overflow: hidden;line-height: 22px;white-space: nowrap;text-overflow: ellipsis;}', '.bmhVideoFixedAdv-hot-bd .item-word a {color: #666;}', '.bmhVideoFixedAdv-hot-bd .item-word a:hover {color: #428ace;}', '.bmhVideoFixedAdv-hot-bd .item-media {position: relative;display: inline;float: left;width: 165px;height: 88px;overflow: hidden;margin-top: 8px;margin-right: 10px;}', '.bmhVideoFixedAdv-hot-bd .item-media .wrap {position: absolute;bottom: 0;left: 0;width: 155px;height: 22px;padding-right: 5px;padding-left: 5px;filter:progid:DXImageTransform.Microsoft.gradient(enabled=\'true\',startColorstr=\'#7F000000\', endColorstr=\'#7F000000\');background:rgba(0,0,0,0.5);color: #a7a7a7;}', '.bmhVideoFixedAdv-hot-bd .item-media h4 {font-weight: normal;width: 155px;height: 22px;overflow: hidden;line-height: 22px;white-space: nowrap;text-overflow: ellipsis;}'].join(''); this.includeStyleElement(styles, 'fixedAdvStyles'); var html = ['<div class="bmhVideoFixedAdv" id="J_BMHVideoFixedAdv">', '<div class="bmhVideoFixedAdv-hd">', '<h2 class="heading"><i class="icon-logo-mini"></i>精品推荐</h2>', '<span class="close">×</span>', '</div>', '<div class="bmhVideoFixedAdv-bd">', '<div class="bmhVideoFixedAdv-recommend">', '<a class="link" href="http://www.39yss.com/qingan/2013101823603.html?1385718733" title="2013热门搞笑图片榜" target="_blank">', '<div class="img">', '<img src="http://29293.pic.baomihua.com/pic/4850689446499066402.jpg" width="144" height="80" alt="2013热门搞笑图片榜">', '</div>', '<div class="txt">', '<h4>2013热门搞笑图片榜</h4>', '<p>女主持遭狗狗扑倒瞬间、超人的内裤怎么穿?超震撼24张搞笑图片,处处是亮点!</p>', '</div>', '</a>', '</div>', '<div class="bmhVideoFixedAdv-hot">', '<div class="bmhVideoFixedAdv-hot-hd">', '<h3 class="heading">热门视频:</h3>', '<a class="link-hot" href="http://youxi.baomihua.com/tuiguang/246?fcwz01" title="直击《爸爸去哪儿》电影现场" target="_blank">直击《爸爸去哪儿》电影现场</a>', '</div>', '<div class="bmhVideoFixedAdv-hot-bd">', '<ul>', '<li class="item-word"><a href="http://youxi.baomihua.com/tuiguang/247?fcwz02" title="2013年度影视大盘点" target="_blank"><i class="icon-dot-small"></i>2013年度影视大盘点</a></li>', '<li class="item-word"><a href="http://youxi.baomihua.com/tuiguang/246?fcwz03" title="杨幂疑似怀双胞胎" target="_blank"><i class="icon-dot-small"></i>杨幂疑似怀双胞胎</a></li>', '<li class="item-word"><a href="http://www.39yss.com/sexhealth/jiqiao/2013112723754.html?1385722263" title="曝光24张真实UFO照" target="_blank"><i class="icon-dot-small"></i>曝光24张真实UFO照</a></li>', '<li class="item-word"><a href="http://www.39yss.com/qingan/2013101823602.html?1385718777" title="揭秘8岁就结婚的古寨" target="_blank"><i class="icon-dot-small"></i>揭秘8岁就结婚的古寨</a></li>', '<li class="item-word"><a href="http://www.39yss.com/qingan/2013100823396.html" title="大学校园无敌极品姐" target="_blank"><i class="icon-dot-small"></i>大学校园无敌极品姐</a></li>', '<li class="item-word"><a href="http://www.39yss.com/qingan/2013120223843.html?1386045391" title="宅男最爱的女神" target="_blank"><i class="icon-dot-small"></i>宅男最爱的女神</a></li>', '<li class="item-word"><a href="http://www.39yss.com/sexhealth/love/2013101023436.html?1385722610" title="妹子喝醉酒丑态百出" target="_blank"><i class="icon-dot-small"></i>妹子喝醉酒丑态百出</a></li>', '<li class="item-word"><a href="http://www.baomihua.com/v2/channelindex_v2.html/?fc03" title="农大校花唯美泳装写真" target="_blank"><i class="icon-dot-small"></i>农大校花唯美泳装写真</a></li>', '</ul>', '</div>', '</div>', '</div>', '</div>'].join(''); $('body').append(html); this.object = $(object); this.advH = this.object.height(); this.setSmall(); this.autoSetSmall(); this.setFull(); this.fixPosition(); }; FixedAdv.prototype.fixPosition = function() { var _self = this; if (_self.getIEVersion() === 6) { $window.scroll(function() { _self.object.css('top', ($window.scrollTop() + viewpostH - _self.advH) + 'px'); }); } }; FixedAdv._initialized = true; } } if (typeof jQuery === 'undefined') { includeLinkScript('http://static01.baomihua.com/js/lib/jquery-1.4.4.min.js?t=20120926.js', function() { var fixedAdv = new FixedAdv('#J_BMHVideoFixedAdv'); fixedAdv.addPane(); }); } else { var fixedAdv = new FixedAdv('#J_BMHVideoFixedAdv'); fixedAdv.addPane(); } })();