Please move styles and js to external files

BarisW - September 23, 2009 - 14:39
Project:Text Size
Version:6.x-1.4-alpha1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Currently, the head of my page is littered with this:

<style type="text/css" media="screen, projection, tty, tv, print">
<!--
/* <![CDATA[ */
div.wrapper {
  font-size: 100% !important;
}
div.textsize-5 { font-size: 5% !important; }
div.textsize-10 { font-size: 10% !important; }
div.textsize-15 { font-size: 15% !important; }
div.textsize-20 { font-size: 20% !important; }
div.textsize-25 { font-size: 25% !important; }
div.textsize-30 { font-size: 30% !important; }
div.textsize-35 { font-size: 35% !important; }
div.textsize-40 { font-size: 40% !important; }
div.textsize-45 { font-size: 45% !important; }
div.textsize-50 { font-size: 50% !important; }
div.textsize-55 { font-size: 55% !important; }
div.textsize-60 { font-size: 60% !important; }
div.textsize-65 { font-size: 65% !important; }
div.textsize-70 { font-size: 70% !important; }
div.textsize-75 { font-size: 75% !important; }
div.textsize-80 { font-size: 80% !important; }
div.textsize-85 { font-size: 85% !important; }
div.textsize-90 { font-size: 90% !important; }
div.textsize-95 { font-size: 95% !important; }
div.textsize-100 { font-size: 100% !important; }
div.textsize-105 { font-size: 105% !important; }
div.textsize-110 { font-size: 110% !important; }
div.textsize-115 { font-size: 115% !important; }
div.textsize-120 { font-size: 120% !important; }
div.textsize-125 { font-size: 125% !important; }
div.textsize-130 { font-size: 130% !important; }
div.textsize-135 { font-size: 135% !important; }
div.textsize-140 { font-size: 140% !important; }
div.textsize-145 { font-size: 145% !important; }
div.textsize-150 { font-size: 150% !important; }
div.textsize-155 { font-size: 155% !important; }
div.textsize-160 { font-size: 160% !important; }
div.textsize-165 { font-size: 165% !important; }
div.textsize-170 { font-size: 170% !important; }
div.textsize-175 { font-size: 175% !important; }
div.textsize-180 { font-size: 180% !important; }
div.textsize-185 { font-size: 185% !important; }
div.textsize-190 { font-size: 190% !important; }
div.textsize-195 { font-size: 195% !important; }
div.textsize-200 { font-size: 200% !important; }
/* ]]>*/
-->
</style>
<script type="text/javascript">
<!--//--><![CDATA[//><!--

    var textsize_element = "div";
    var textsize_element_class = ".wrapper";
    var textsize_cookie = $.cookie("textsize") ;
    var textsize_increment = 20;
    var textsize_normal = 100;
    var textsize_minimum = 80;
    var textsize_maximum = 140;
    function textsize_increase(ts_a, ts_b) {
      if (ts_a == textsize_maximum) {
        return ts_a;
      }
      else {
        return 1*ts_a + 1*textsize_increment;
      }
    };
    function textsize_decrease(ts_a, ts_b) {
      if (ts_a == textsize_minimum) {
        return ts_a;
      }
      else {
        return 1*ts_a - 1*textsize_increment;
      }
    };
    function textsize_normal(value) {
      return value;
    };
 
//--><!]]>
</script>

Where this could have been:

<style type="text/css" media="screen, projection, tty, tv, print">
div.wrapper {
  font-size: 100% !important;
}
</style>
<link rel="stylesheet" type="text/css" media="screen, projection, tty, tv, print" href="path_to_style.css" />
<script type="text/javascript">
<!--//--><![CDATA[//><!--

    var textsize_element = "div";
    var textsize_element_class = ".wrapper";
    var textsize_cookie = $.cookie("textsize") ;
    var textsize_increment = 20;
    var textsize_normal = 100;
    var textsize_minimum = 80;
    var textsize_maximum = 140;
//--><!]]>
</script>
<script type="text/javascript" href="path_to_js"></script>

This would clean up the code a lot, and makes it possible to pack the files together with all other JS and CSS files. Or am I missing something and is this necessary?

#1

Christian Zwahlen - September 26, 2009 - 14:11
Status:active» fixed

Added in the latest version.

#2

System Message - October 10, 2009 - 14:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.