Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Output HTML source code is bloated (http://forum.bytesforall.com/showthread.php?t=3435)

islandman Sep 14, 2009 06:56 PM

Output HTML source code is bloated
 
Why is the HTML code bloated? 41694 characters!

I look at the source code and I see the stylesheet and JQUERY script within the header.

Aren't stylesheet and jquery scripts being called from include files?

How can I clean this up?

Code:

<style type="text/css">body{text-align:center;margin:0;padding:0;font-family:tahoma,arial,sans-serif;font-size:0.8em;color:#000000;background:#ffffff}a:link,a:visited,a:active{color:#666666;font-weight:bold;text-decoration:none;}a:hover{color:#cc0000;font-weight:bold;text-decoration:underline;}ul,ol,dl,p,h1,h2,h3,h4,h5,h6{margin-top:10px;margin-bottom:10px;padding-top:0;padding-bottom:0}ul ul,ul ol,ol ul,ol ol{margin-top:0;margin-bottom:0}h1{font-size:2.15em;font-weight:bold}h2{font-size:1.85em;font-weight:bold}h3{font-size:1.6em;font-weight:bold;}h4{font-size:1.4em}h5{font-size:1.2em}h6{font-size:1em}code,pre{font-family:"Courier New",Courier,monospace;font-size:1em}pre{overflow:auto;word-wrap:normal;padding-bottom:1.5em;overflow-y:hidden;width:99%}abbr[title],acronym[title]{border-bottom:1px dotted}hr{display:block;height:2px;border:none;margin:0.5em auto;color:#cccccc;background-color:#cccccc}table{font-size:1em;}div.post,ul.commentlist li,ol.commentlist li{word-wrap:break-word;}pre,.wp_syntax{word-wrap:normal;}div#wrapper{text-align:center;margin-left:auto;margin-right:auto;display:block;width:99%}div#container{padding:0;width:auto;margin-left:auto;margin-right:auto;text-align:left;display:block}table#layout{font-size:100%;width:100%;table-layout:fixed}.colone{width:200px}.colone-inner{width:200px}.coltwo{width:100% }.colthree-inner{width:200px}.colthree{width:200px}td#header{width:auto;padding:0}table#logoarea,table#logoarea tr,table#logoarea td{margin:0;padding:0;background:none;border:0}table#logoarea{width:100%;border-spacing:0px}img.logo{display:block;margin:0 10px 0 0}td.logoarea-logo{width:1%}h1.blogtitle,h2.blogtitle{display:block;margin:0;padding:0;letter-spacing:-1px;line-height:1.0em;font-family:tahoma,arial,sans-serif;font-size:240%}h1.blogtitle a:link,h1.blogtitle a:visited,h1.blogtitle a:active,h2.blogtitle a:link,h2.blogtitle a:visited,h2.blogtitle a:active{text-decoration:none;color:#666666;font-weight:bold}h1.blogtitle a:hover,h2.blogtitle a:hover{text-decoration:none;color:#000000;font-weight:bold}p.tagline{margin:0;padding:0;font-size:1.2em;font-weight:bold;color:#666666}td.feed-icons{white-space:nowrap;}div.rss-box{height:1%;display:block;padding:10px 0 10px 10px;margin:0;width:280px}a.comments-icon{background:transparent url(http://macpcwiz.com/blog/wp-content/themes/atahualpa/images/comment-feed-small.gif) no-repeat scroll 0;height:22px;line-height:22px;margin:0 10px 0 0;padding-left:27px;display:block;text-decoration:none;float:right;white-space:nowrap}a.posts-icon{background:transparent url(http://macpcwiz.com/blog/wp-content/themes/atahualpa/images/post-feed-small.gif) no-repeat scroll 0;height:22px;line-height:22px;margin:0 10px 0 0;padding-left:25px;display:block;text-decoration:none;float:right;white-space:nowrap}a.email-icon{background:transparent url(http://macpcwiz.com/blog/wp-content/themes/atahualpa/images/email-feed-small.gif) no-repeat scroll 0;height:22px;line-height:22px;margin:0 10px 0 0;padding-left:28px;display:block;text-decoration:none;float:right;white-space:nowrap}td.search-box{height:1%}div.searchbox{height:35px;border:1px dashed #cccccc;border-bottom:0;width:200px;margin:0;padding:0}div.searchbox-form{margin:5px 10px 5px 10px}div.horbar1,div.horbar2{font-size:1px;clear:both;display:block;position:relative;padding:0;margin:0;width:100%;}div.horbar1{height:5px;background:#ffffff;border-top:dashed 1px #cccccc}div.horbar2{height:5px;background:#ffffff;border-bottom:dashed 1px #cccccc}div.header-image-container{position:relative;margin:0;padding:0;height:150px;}div.opacityleft{position:absolute;z-index:2;top:0;left:0;background-color:#ffffff;height:150px;width:200px;filter:alpha(opacity=40);-moz-opacity:.40;opacity:.40}div.opacityright{position:absolute;z-index:2;top:0;right:0;background-color:#ffffff;height:150px;width:200px;filter:alpha(opacity=40);-moz-opacity:.40;opacity:.40}a.divclick:link,a.divclick:visited,a.divclick:active,a.divclick:hover{width:100%;height:100%;display:block;text-decoration:none}td#left{vertical-align:top;border-right:dashed 1px #CCCCCC;padding:10px 10px 10px 10px;background:#ffffff}td#left-inner{vertical-align:top;border-right:dashed 1px #CCCCCC;padding:10px 10px 10px 10px;background:#ffffff}td#right{vertical-align:top;border-left:dashed 1px #CCCCCC;padding:10px 10px 10px

islandman Sep 14, 2009 06:57 PM

here's the javascript code that also gets printed within the <header> section...

Code:

<script type="text/javascript">/* IE5.5+ PNG Alpha Fix v2.0 Alpha: Background Tiling Support
  (c) 2008 Angus Turnbull http://www.twinhelix.com

  This is licensed under the GNU LGPL, version 2.1 or later.
  For details, see: http://creativecommons.org/licenses/LGPL/2.1/  */

 
var IEPNGFix = window.IEPNGFix || {};

IEPNGFix.tileBG = function(elm, pngSrc, ready) {
        /* Params: A reference to a DOM element, the PNG src file pathname, and a
          hidden "ready-to-run" passed when called back after image preloading. */

        var data = this.data[elm.uniqueID],
                elmW = Math.max(elm.clientWidth, elm.scrollWidth),
                elmH = Math.max(elm.clientHeight, elm.scrollHeight),
                bgX = elm.currentStyle.backgroundPositionX,
                bgY = elm.currentStyle.backgroundPositionY,
                bgR = elm.currentStyle.backgroundRepeat;

        /* Cache of DIVs created per element, and image preloader/data. */
        if (!data.tiles) {
                data.tiles = {
                        elm: elm,
                        src: '',
                        cache: [],
                        img: new Image(),
                        old: {}
                };
        }
        var tiles = data.tiles,
                pngW = tiles.img.width,
                pngH = tiles.img.height;

        if (pngSrc) {
                if (!ready && pngSrc != tiles.src) {
                        /* New image? Preload it with a callback to detect dimensions. */
                        tiles.img.onload = function() {
                                this.onload = null;
                                IEPNGFix.tileBG(elm, pngSrc, 1);
                        };
                        return tiles.img.src = pngSrc;
                }
        } else {
                /* No image? */
                if (tiles.src) ready = 1;
                pngW = pngH = 0;
        }
        tiles.src = pngSrc;

        if (!ready && elmW == tiles.old.w && elmH == tiles.old.h &&
                bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) {
                return;
        }

        /* Convert English and percentage positions to pixels. */
        var pos = {
                        top: '0%',
                        left: '0%',
                        center: '50%',
                        bottom: '100%',
                        right: '100%'
                },
                x,
                y,
                pc;
        x = pos[bgX] || bgX;
        y = pos[bgY] || bgY;
        if (pc = x.match(/(\d+)%/)) {
                x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100));
        }
        if (pc = y.match(/(\d+)%/)) {
                y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100));
        }
        x = parseInt(x);
        y = parseInt(y);

        /* Handle backgroundRepeat. */
        var repeatX = { 'repeat': 1, 'repeat-x': 1 }[bgR],
                repeatY = { 'repeat': 1, 'repeat-y': 1 }[bgR];
        if (repeatX) {
                x %= pngW;
                if (x > 0) x -= pngW;
        }
        if (repeatY) {
                y %= pngH;
                if (y > 0) y -= pngH;
        }

        /* Go! */
        this.hook.enabled = 0;
        if (!({ relative: 1, absolute: 1 }[elm.currentStyle.position])) {
                elm.style.position = 'relative';
        }
        var count = 0,
                xPos,
                maxX = repeatX ? elmW : x + 0.1,
                yPos,
                maxY = repeatY ? elmH : y + 0.1,
                d,
                s,
                isNew;
        if (pngW && pngH) {
                for (xPos = x; xPos < maxX; xPos += pngW) {
                        for (yPos = y; yPos < maxY; yPos += pngH) {
                                isNew = 0;
                                if (!tiles.cache[count]) {
                                        tiles.cache[count] = document.createElement('div');
                                        isNew = 1;
                                }
                                var clipR = (xPos + pngW > elmW ? elmW - xPos : pngW),
                                        clipB = (yPos + pngH > elmH ? elmH - yPos : pngH);
                                d = tiles.cache[count];
                                s = d.style;
                                s.behavior = 'none';
                                s.left = xPos + 'px';
                                s.top = yPos + 'px';
                                s.width = clipR + 'px';
                                s.height = clipB + 'px';
                                s.clip = 'rect(' +
                                        (yPos < 0 ? 0 - yPos : 0) + 'px,' +
                                        clipR + 'px,' +
                                        clipB + 'px,' +
                                        (xPos < 0 ? 0 - xPos : 0) + 'px)';
                                s.display = 'block';
                                if (isNew) {
                                        s.position = 'absolute';
                                        s.zIndex = -999;
                                        if (elm.firstChild) {
                                                elm.insertBefore(d, elm.firstChild);
                                        } else {
                                                elm.appendChild(d);
                                        }
                                }
                                this.fix(d, pngSrc, 0);
                                count++;
                        }
                }
        }
        while (count < tiles.cache.length) {
                this.fix(tiles.cache[count], '', 0);
                tiles.cache[count++].style.display = 'none';
        }

        this.hook.enabled = 1;

        /* Cache so updates are infrequent. */
        tiles.old = {
                w: elmW,
                h: elmH,
                x: bgX,
                y: bgY,
                r: bgR
        };
};


IEPNGFix.update = function() {
        /* Update all PNG backgrounds. */
        for (var i in IEPNGFix.data) {
                var t = IEPNGFix.data[i].tiles;
                if (t && t.elm && t.src) {
                        IEPNGFix.tileBG(t.elm, t.src);
                }
        }
};
IEPNGFix.update.timer = 0;

if (window.attachEvent && !window.opera) {
        window.attachEvent('onresize', function() {
                clearTimeout(IEPNGFix.update.timer);
                IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100);
        });
}



/* Apply PNG fix for IE6 */

 if (document.all && /MSIE (5\.5|6)/.test(navigator.userAgent) &&
        document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule) {
        document.styleSheets[0].addRule('*', 'behavior: url(http://macpcwiz.com/blog/wp-content/themes/atahualpa/js/iepngfix.php)');
        /* Feel free to add rules for specific elements only, as above.
        You have to call this once for each selector, like so:
        document.styleSheets[0].addRule('img', 'behavior: url(http://macpcwiz.com/blog/wp-content/themes/atahualpa/js/iepngfix.php)');
        document.styleSheets[0].addRule('div', 'behavior: url(http://macpcwiz.com/blog/wp-content/themes/atahualpa/js/iepngfix.php)'); */
 }
 

/* JQUERY */


jQuery.noConflict();
jQuery(document).ready(function(){ 
 
        /* For IE6 */
        if (jQuery.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent)) {
       
                /* Max-width for images in IE6 */               
                var centerwidth = jQuery("td#middle").width();
               
                /* Images without caption */
                jQuery(".post img").each(function() {
                        var maxwidth = centerwidth - 10 + 'px';
                        var imgwidth = jQuery(this).width();
                        var imgheight = jQuery(this).height();
                        var newimgheight = (centerwidth / imgwidth * imgheight) + 'px';       
                        if (imgwidth > centerwidth) {
                                jQuery(this).css({width: maxwidth});
                                jQuery(this).css({height: newimgheight});
                        }
                });
               
                /* Images with caption */
                jQuery("div.wp-caption").each(function() {
                        var captionwidth = jQuery(this).width();
                        var maxcaptionwidth = centerwidth + 'px';
                        var captionheight = jQuery(this).height();
                        var captionimgwidth =  jQuery("div.wp-caption img").width();
                        var captionimgheight =  jQuery("div.wp-caption img").height();
                        if (captionwidth > centerwidth) {
                                jQuery(this).css({width: maxcaptionwidth});
                                var newcaptionheight = (centerwidth / captionwidth * captionheight) + 'px';
                                var newcaptionimgheight = (centerwidth / captionimgwidth * captionimgheight) + 'px';
                                jQuery(this).css({height: newcaptionheight});
                                jQuery("div.wp-caption img").css({height: newcaptionimgheight});
                                }
                });
               
                /* sfhover for LI:HOVER support in IE6: */
                jQuery("ul li").hover(
                function() {
                        jQuery(this).addClass("sfhover")
                },
                function() {
                        jQuery(this).removeClass("sfhover")
                }
                );


        /* End IE6 */
        }
       
       
        jQuery(".post table tr").
                mouseover(function() {
                        jQuery(this).addClass("over");
                }).
                mouseout(function() {
                        jQuery(this).removeClass("over");
                });
       
        jQuery(".post table tr:even").
                addClass("alt");
       
        jQuery("input.text, input.TextField, input.file, input.password, textarea").
                focus(function () { 
                        jQuery(this).addClass("highlight");
                }).
                blur(function () {
                        jQuery(this).removeClass("highlight");
                })
       
        jQuery("input.inputblur").
                focus(function () { 
                        jQuery(this).addClass("inputfocus");
                }).
                blur(function () {
                        jQuery(this).removeClass("inputfocus");
                })
       
       
        jQuery("input.button, input.Button").
                mouseover(function() {
                        jQuery(this).addClass("buttonhover");
                }).
                mouseout(function() {
                        jQuery(this).removeClass("buttonhover");
                });

        /* toggle "you can use these xhtml tags" */
        jQuery("a.xhtmltags").
                click(function(){
                        jQuery("div.xhtml-tags").slideToggle(300);
                });

        /* For the Tabbed Widgets plugin: */
        jQuery("ul.tw-nav-list").
                addClass("clearfix");

        /* strech short pages to full height, keep footer at bottom */

});


</script>


Aubergine Sep 15, 2009 06:20 AM

In the last ATO option, Configure CSS & JS, did you change the setting for "CSS: External file or Inline" from the default "Inline" to "External"? Same for JavaScript.

islandman Sep 18, 2009 09:38 AM

got it, thanks dude!


All times are GMT -6. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.