Changeset 37866
- Timestamp:
- 06/27/10 15:14:34 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/HTML-MobileJpCSS/trunk/lib/HTML/MobileJpCSS.pm
r35772 r37866 56 56 my ($self, $content) = @_; 57 57 return $content if $self->{agent}->is_non_mobile; 58 return $content if $self->{agent}->is_ezweb && !( map { $self->{$_} } qw/inliner_ezweb css_file css/);58 return $content if $self->{agent}->is_ezweb && !(grep { $self->{$_} } qw/inliner_ezweb css_file css/); 59 59 60 60 $content =~ s/(?:\r\n|\n)/\n/g; 61 61 62 62 my @css; 63 my @link = $content =~ /<link\s .*?rel="stylesheet".*?>/isg;63 my @link = $content =~ /<link\s[^>]*?rel="stylesheet"[^>]*?>/isg; 64 64 for (@link) { 65 65 if (/href="(.+?)"/) { … … 68 68 } 69 69 } 70 $content =~ s/<link\s .*?rel="stylesheet".*?>\s*//isg if @link;70 $content =~ s/<link\s[^>]*?rel="stylesheet"[^>]*?>\s*//isg if @link; 71 71 72 72 push @css, $self->_read($self->{css_file}) if $self->{css_file}; … … 76 76 for my $css (@css) { 77 77 for (keys %$css) { 78 if (/^a :(?:link|focus|visited)$/) {78 if (/^a(?:\..+?)?:(?:link|focus|visited)$/) { 79 79 $style->{pseudo}->{$_} = $style->{pseudo}->{$_} 80 80 ? { %{$style->{pseudo}->{$_}}, %{$css->{$_}} } … … 103 103 my $css = bless $style->{pseudo}, 'CSS::Tiny'; 104 104 my $pseudo = $self->{agent}->is_docomo ? "<![CDATA[\n".$css->write_string."]]>" : $css->write_string; 105 $content =~ s{< head>(.*)</head>}{<head>$1<style type="text/css">\n$pseudo</style></head>}is;105 $content =~ s{</head>}{<style type="text/css">\n$pseudo</style></head>}is; 106 106 } 107 107 … … 131 131 $content = $self->_replace_style($content, $node, $props); 132 132 } 133 $content =~ s/<([^<>]+?)\sclass="$class"([^<>]*?)>/<$1$2>/isg; 133 # 適用されたクラスをとり去る必要はないと思うな 134 # $content =~ s/<([^<>]+?)\sclass="$class"([^<>]*?)>/<$1$2>/isg; 134 135 } 135 136 136 137 # istyle for DoCoMo 137 if ($self->{agent}->is_docomo) { 138 $content =~ s/(<input[^>]*?)(istyle="(\d)")([^>]*?>)/$1style="$IstyleDoCoMo{$3}"$4/isg; 139 $content =~ s/(<textarea[^>]*?)(istyle="(\d)")([^>]*?>)/$1style="$IstyleDoCoMo{$3}"$4/isg; 138 if ( ! $self->{no_istyle} ) { 139 if ($self->{agent}->is_docomo) { 140 $content =~ s/(<input[^>]*?)(istyle="(\d)")([^>]*?>)/$1style="$IstyleDoCoMo{$3}"$4/isg; 141 $content =~ s/(<textarea[^>]*?)(istyle="(\d)")([^>]*?>)/$1style="$IstyleDoCoMo{$3}"$4/isg; 142 } 140 143 } 141 144 return $content; … … 145 148 my $self = shift; 146 149 if ($self->{agent}) { 147 $self->{agent} = HTTP::MobileAgent->new($self->{agent}) unless (ref $self->{agent}) =~ /^HTTP::Mobile(Agent|Attribute)/; 150 if ( ! ref $self->{agent} ) { 151 $self->{agent} = HTTP::MobileAgent->new($self->{agent}); 152 } 148 153 } 149 154 else { … … 200 205 my ($tag) = $node =~ /^<([^\s]+).*?>/is; 201 206 my $replace = $node; 202 my $style ;207 my $style = ""; 203 208 for (keys %$props) { 204 209 $style .= $self->_filter($tag, $_, $props->{$_});
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)