In the normal site state, the pagestyle module injects a pagestyle_standard body class which, because of the CSS associated with that class, means that all text with font-weight: bold as defined by the theme or content is rendered as font-weight: normal.

A workaround is suggested here http://drupal.org/node/837552#comment-4445010 for D6, but I gather the template preprocessors have changed somewhat for D7.

Regardless of this workaround, I think the module should not inject CSS classes for the standard style.

Has anyone got any thoughts on this?

Comments

mshepherd’s picture

I've made a workaround for this, but I'd rather this was dealt with inside of the module. Adding the current style's class into the body tag is really useful, but it should only appear for non-standard styles.

I added this into my theme's template.php file. It works by looking for pagestyle_standard in the classes_array and removing it if it exists.

function MYTHEME_preprocess_html(&$vars) {
  if (function_exists('pagestyle_get_current')) {
    $vars['classes_array'] = array_filter($vars['classes_array'], 'is_pagestyle_standard');
  }
}

function is_pagestyle_standard($current_pagestyle) {
  if (strpos($current_pagestyle,'pagestyle_standard')===FALSE) {
    return TRUE;
  } else {
    return FALSE;
  }
}

CZ’s picture

OK, you will not the body class "pagestyle_standard"? I read the issue #837552: Add current style to $body_classes? as it is "add current style to the body". The standard CSS is a style. But clear, it is possible to add no standard class.
The code for the pagestyle.module file:

/**
 * Add body classes into the html template.
 *
 * @see template_preprocess_html
 */
function pagestyle_preprocess_html(&$vars) {
  if (function_exists('pagestyle_get_current')) {
    if (pagestyle_get_current($value = 'int') != 'standard') {
      $vars['classes_array'][] = ' pagestyle_'. pagestyle_get_current($value = 'int');
    }
  }
}

And then the JavaScript file, like the php file. Is this ok for you?

mshepherd’s picture

Hi,
Let me test the change you suggest to pagestyle.module. I'm getting weird side effects from the change I suggested above. And the behaviour is significantly different in firefox7 and chrome14.
Is there some change I need to make to javascript also?
Matthew

mshepherd’s picture

Hi,

The change you suggested to pagestyle.module makes the module work as I expected without any javascript changes.

There is a minor niggle in that when I switch back to pagestyle_standard from any other style, the pagestyle module's font-weight: normal !important; overrides my theme's font weights. But when I navigate to another page or reload the page, the theme's styles prevail. I see this as a relatively minor niggle.

Is this a change you'd consider committing?

Matthew

CZ’s picture

Well, the CSS for the "standard" style is basically empty in "pagestyle/css/style_standard.css". "font-weight" for the standard style is not required. But the definition of "font-weight" for the standard style in the admin page is required for the JavaScript switch (from another style - except "standard" - to another style), because the other pagestyle styles use "!important".

So, you have to make the style "Standard font weight" consistent with your theme. Or is this a problem?

PS: Line 22 in jquery.pagestyle.js

      if (pagestyleCurrent != "standard") {
        $("body").addClass("pagestyle_" + pagestyleCurrent);
      }

But that's not enough.

mshepherd’s picture

Hi Christian,
The problem is that in most content, there's a mixture of text with font-weight: bold and font-weight: normal . Out-of-the-box, the pagestyle module adds the body class pagestyle-standard who's styles override the theme's variation in font weight and makes it all normal. I don't think this is desirable out-of-the box behaviour.
The code in #2 fixes the out-of-the-box behaviour, but obviously there are some implications when switching back to the standard style, at least until a new page is loaded. I, for one, can live with those more than I can live with the current behaviour.
Matthew

CZ’s picture

OK, the problem exists only if the browser use JavaScript.

But I think the problem is the linked CSS. So the one and only solution (also for #1184054: Can't switch back to Standard) is, a feature to remove the style changer in the browser menue. And this maybe by default?

mshepherd’s picture

StatusFileSize
new43.86 KB
new43.9 KB

No, this problems exists with or without javascript enabled.

Example (A fresh install of D7.9 with the most recent dev version of pagestyle, enabled but with no other settings changed, not even with the pagestyle block displayed)

Before enabling pagestyle

with bold text

With pagestyle module enabled, no pagestyle block enabled, javascript disabled

no bold text

Notice title is no longer bold & text in body that was bold, no longer is.

CZ’s picture

Yes. Thank you. In fact, the definition "Standard font weight" can be removed (?), because the "style_standard.css" do not use this defnition. I will fix these both bugs.

mshepherd’s picture

Thanks for patience and help Christian.

CZ’s picture

Status: Active » Closed (won't fix)

No longer required to fix this bug.

mshepherd’s picture

oh, have you made some other change to make it unnecessary?
Matthew

CZ’s picture

Status: Closed (won't fix) » Fixed

Yes, removed "font-weight" for normal style. This issue marked as "fixed", is better :-).

mshepherd’s picture

Christian - that's great - thanks for your time.
Matthew

Status: Fixed » Closed (fixed)

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