zoukankan      html  css  js  c++  java
  • AD 对联

    /*
    对联广告 首页、检索页、搜索、媒体页
    by sunhw 2014-12-16
    */
    ;(function() {
    if( F.config.isWangjs ){
    return;
    }
    function Couplet( option ) {
    this.option = T.object.extend( {
    root : '',
    position : '',
    zindex : '',
    top : '',
    right : '',
    left : ''
    }, option || {} );
    this.init();
    }
    Couplet.prototype.resize = function() {
    var me = this;
    var maxWidth = ( F.config.isFsHost == false && F.config.isFsDomain == true ) ? 0 : 1400,
    pageWidth = T.page.getViewWidth();
    if ( pageWidth >= maxWidth ) {
    if ( T.get( 'coupletad' ) ) {
    T.show( T.get( 'coupletad' ) );
    }
    } else {
    if ( T.get( 'coupletad' ) ) {
    T.hide( T.get( 'coupletad' ) );
    }
    }
    };
    Couplet.prototype.init = function() {
    var me = this;
    if ( T.get( 'coupletad' ) ) {
    return;
    }
    var fck = F.cookie.get('fck'),
    uid = F.user.userid,
    url = window.location.href,
    match = [],
    mid = '',
    timer = 0,
    ttl = 2000,
    refer = document.referrer;
    if( url ){
    match = url.match(/d+/g);
    }
    if( match ){
    mid = String(match[0]);
    }
    var requestURL = "http://pub.funshion.com/interface/deliver?ap=w_a_couplet&fck=" + fck + "&uid=" + uid + "&url=" + url + "&refer=" + refer + "&mid=" + mid;
    F.http.jsonp( requestURL, function( json ) {
    if ( !json ) {
    return;
    }
    var data = json[ 0 ].ad_list[ 0 ];
    if ( !data ) {
    return;
    }
    var reportURL = data.monitor,
    width = data.width ,
    height = data.height,
    closeSrc = data.close || 'http://adm.funshion.com/mat/20140704162826-10271647.png',
    leftURl = data.LeftMaterial,
    rightURl = data.RightMaterial;
    var wrapHTML = '<div id="coupletad"></div>';
    var leftHTML = '<iframe width="' + width + 'px" height="' + height + 'px" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0" marginwidth="0" marginheight="0" src="' + leftURl + '"></iframe><a href="javascript:;" class="close-bnt" style="display:none;background:url(' + closeSrc + ') no-repeat 0 0;position:absolute;top:0;left:0;18px;height:18px;"></a>';
    var rightHTML = '<iframe width="' + width + 'px" height="' + height + 'px" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0" marginwidth="0" marginheight="0" src="' + rightURl + '"></iframe><a href="javascript:;" class="close-bnt" style="display:none;background:url(' + closeSrc + ') no-repeat 0 0;position:absolute;top:0;right:0;18px;height:18px;"></a>';
    var layoutHTML = '<div class="fixedIe6" id="coup_ad_left" style="'+width+'px;height:'+height+'px;position:'+me.option.position+';left:'+me.option.left+';top:'+me.option.top+'px;z-index:'+me.option.zindex+';">' + leftHTML + '</div><div class="fixedIe6" id="coup_ad_right" style="'+width+'px;height:'+height+'px;position:'+me.option.position+';right:'+me.option.right+';top:'+me.option.top+'px;z-index:'+me.option.zindex+';">' + rightHTML + '</div>';
    T.dom.insertHTML( T.query( 'body' )[ 0 ], 'beforeEnd', wrapHTML );
    T.get( 'coupletad' ).innerHTML = layoutHTML;
    clearTimeout( timer );
    timer = setTimeout( function() {
    T.each( T.query( '.close-bnt' ), function( item ) {
    T.dom.setStyle( item, 'display', 'block' );
    T.on( item, 'click', function( e ) {
    T.event.stop( T.event.get( e ) );
    if ( T.get( 'coupletad' ) ) {
    T.dom.remove( T.get( 'coupletad' ) );
    }
    } );
    } );;
    }, ttl );
    (new Image).src = reportURL;
    } );
    T.un( window, 'resize', me.resize );
    T.on( window, 'resize', me.resize );
    };
    T.dom.ready( function() {
    var maxWidth = ( F.config.isFsHost == false && F.config.isFsDomain == true ) ? 0 : 1400, mask = false;
    var couplet = null;
    function _init() {
    if ( mask == false && T.page.getViewWidth() >= maxWidth && T.array.indexOf( [ 'index_', 'list_', 'search_media', 'subject_' ], F.config.ctrlname ) > -1 ) {
    mask = true;
    couplet = new Couplet( {
    root : 'body',
    position : 'fixed',
    zindex : 9,
    top : 240,
    right : 0,
    left : 0
    } );
    }
    }
    _init();
    T.un( window, 'resize', _init );
    T.on( window, 'resize', _init );
    } );
    })();

  • 相关阅读:
    jvm基本结构和解析
    多态的意思
    java中对象的简单解读
    double类型和int类型的区别
    python 解析xml文件
    win10不能映射Ubuntu共享文件
    Qt程序打包
    Ubuntu boot分区文件误删,系统无法启动,怎么解
    ubuntu Boot空间不够问题“The volume boot has only 5.1MB disk space remaining”
    Ubuntu 分辨率更改 xrandr Failed to get size of gamma for output default
  • 原文地址:https://www.cnblogs.com/sunhw360/p/4190169.html
Copyright © 2011-2022 走看看