JavaScript阻止加载广告代码

时间:2015-05-27 15:29:41

标签: javascript

我已经建立了一个响应式网站,可以加载init.js来处理各种设备上的呈现,而且我遇到了问题,因为它阻止了我的media.net广告代码。有没有人经历过这个?我对JS的了解很少,而且我使用HTML5UP中的模板。如果有人可以提供帮助或指出我进一步研究修复的方向,我非常感激。 media.net的技术团队说"你的init.js文件正在阻止第三层广告代码"。谷歌广告可以正常工作。

到目前为止,这是我的代码:

<script id="mNCC" language="javascript">  medianet_width='336';  medianet_height= '280';  medianet_crid='178863808';  </script>  
<script id="mNSC" src="http://contextual.media.net/nmedianet.js?cid=7CUH007T4" language="javascript"></script>

这里是init.js文件..

/*
    Arcana by HTML5 UP
    html5up.net | @n33co
    Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/

(function($) {

    skel.init({
        reset: 'full',
        breakpoints: {
            global:     { range: '*', href: 'css/style.css', containers: 1400, grid: { gutters: 50 } },
            wide:       { range: '-1680', href: 'css/style-wide.css', containers: 1200, grid: { gutters: 40 } },
            normal:     { range: '-1280', href: 'css/style-normal.css', containers: 960, grid: { gutters: 30 }, viewport: { scalable: false } },
            narrow:     { range: '-980', href: 'css/style-narrow.css', containers: '95%' },
            narrower:   { range: '-840', href: 'css/style-narrower.css', containers: '95%!'},
            mobile:     { range: '-736', href: 'css/style-mobile.css', containers: '90%!', grid: { gutters: 20 } },
            mobilep:    { range: '-480', href: 'css/style-mobilep.css', containers: '100%' }
        },
        plugins: {
            layers: {
                config: {
                    mode: 'transform'
                },
                navPanel: {
                    animation: 'revealX',
                    breakpoints: 'narrower',
                    clickToHide: true,
                    height: '100%',
                    hidden: true,
                    html: '<div data-action="navList" data-args="nav"></div>',
                    orientation: 'vertical',
                    position: 'top-left',
                    side: 'left',
                    width: 275
                },
                titleBar: {
                    breakpoints: 'narrower',
                    height: 44,
                    html: '<span class="toggle" data-action="toggleLayer" data-args="navPanel"></span><span class="title" data-action="copyHTML" data-args="logo"></span>',
                    position: 'top-left',
                    side: 'top',
                    width: '100%'
                }
            }
        }
    });

    $(function() {

        var $window = $(window),
            $body = $('body');

        // Disable animations/transitions until the page has loaded.
            $body.addClass('is-loading');

            $window.on('load', function() {
                $body.removeClass('is-loading');
            });

        // Forms (IE<10).
            var $form = $('form');
            if ($form.length > 0) {

                $form.find('.form-button-submit')
                    .on('click', function() {
                        $(this).parents('form').submit();
                        return false;
                    });

                if (skel.vars.IEVersion < 10) {
                    $.fn.n33_formerize=function(){var _fakes=new Array(),_form = $(this);_form.find('input[type=text],textarea').each(function() { var e = $(this); if (e.val() == '' || e.val() == e.attr('placeholder')) { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } }).blur(function() { var e = $(this); if (e.attr('name').match(/_fakeformerizefield$/)) return; if (e.val() == '') { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } }).focus(function() { var e = $(this); if (e.attr('name').match(/_fakeformerizefield$/)) return; if (e.val() == e.attr('placeholder')) { e.removeClass('formerize-placeholder'); e.val(''); } }); _form.find('input[type=password]').each(function() { var e = $(this); var x = $($('<div>').append(e.clone()).remove().html().replace(/type="password"/i, 'type="text"').replace(/type=password/i, 'type=text')); if (e.attr('id') != '') x.attr('id', e.attr('id') + '_fakeformerizefield'); if (e.attr('name') != '') x.attr('name', e.attr('name') + '_fakeformerizefield'); x.addClass('formerize-placeholder').val(x.attr('placeholder')).insertAfter(e); if (e.val() == '') e.hide(); else x.hide(); e.blur(function(event) { event.preventDefault(); var e = $(this); var x = e.parent().find('input[name=' + e.attr('name') + '_fakeformerizefield]'); if (e.val() == '') { e.hide(); x.show(); } }); x.focus(function(event) { event.preventDefault(); var x = $(this); var e = x.parent().find('input[name=' + x.attr('name').replace('_fakeformerizefield', '') + ']'); x.hide(); e.show().focus(); }); x.keypress(function(event) { event.preventDefault(); x.val(''); }); });  _form.submit(function() { $(this).find('input[type=text],input[type=password],textarea').each(function(event) { var e = $(this); if (e.attr('name').match(/_fakeformerizefield$/)) e.attr('name', ''); if (e.val() == e.attr('placeholder')) { e.removeClass('formerize-placeholder'); e.val(''); } }); }).bind("reset", function(event) { event.preventDefault(); $(this).find('select').val($('option:first').val()); $(this).find('input,textarea').each(function() { var e = $(this); var x; e.removeClass('formerize-placeholder'); switch (this.type) { case 'submit': case 'reset': break; case 'password': e.val(e.attr('defaultValue')); x = e.parent().find('input[name=' + e.attr('name') + '_fakeformerizefield]'); if (e.val() == '') { e.hide(); x.show(); } else { e.show(); x.hide(); } break; case 'checkbox': case 'radio': e.attr('checked', e.attr('defaultValue')); break; case 'text': case 'textarea': e.val(e.attr('defaultValue')); if (e.val() == '') { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } break; default: e.val(e.attr('defaultValue')); break; } }); window.setTimeout(function() { for (x in _fakes) _fakes[x].trigger('formerize_sync'); }, 10); }); return _form; };
                    $form.n33_formerize();
                }

            }

        // Dropdowns.
            $('#nav > ul').dropotron({
                offsetY: -15,
                hoverDelay: 0,
                alignment: 'center'
            });

    });

})(jQuery);

0 个答案:

没有答案