/[pub]/suikawiki/script/misc/plugins/view/Downgrade.wp2
Suika

Contents of /suikawiki/script/misc/plugins/view/Downgrade.wp2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Tue Mar 15 08:50:05 2005 UTC (19 years, 7 months ago) by wakaba
Branch: MAIN
CVS Tags: suikawiki3-redirect, HEAD
Branch point for: helowiki, helowiki-2005
Changes since 1.5: +4 -2 lines
No JavaScript regex literal for old User Agents

1 wakaba 1.1 #?SuikaWikiConfig/2.0
2    
3     Plugin:
4     @Name: Downgrade
5     @Description:
6     @@@: WikiView output partial downgrade for old clients
7     @@lang:en
8 wakaba 1.5 @License: %%Perl%%
9 wakaba 1.1 @Author:
10     @@Name:
11     @@@@: Wakaba
12     @@@lang:ja
13     @@@script:Latn
14     @@Mail[list]: w@suika.fam.cx
15 wakaba 1.5 @Date.RCS:
16 wakaba 1.6 $Date: 2005/03/15 08:50:05 $
17 wakaba 1.1
18     PluginConst:
19     @NS_XHTML1:
20     http://www.w3.org/1999/xhtml
21    
22     Function:
23     @Name: set_downgrade_flags
24     @Description:
25     @@@: Setting value to downgrade flags ($wiki->{var}->{client}->{downgrade})
26     @@lang:en
27     @Main:
28     my (undef, $wiki) = @_;
29     my $flag = $wiki->{var}->{client}->{downgrade} ||= {};
30     my $ua_name = $wiki->{var}->{client}->{user_agent_name};
31    
32 wakaba 1.2 ## Gecko Mozilla
33 wakaba 1.3 if ($ua_name =~m#\bGecko/([0-9]+)#) {
34 wakaba 1.2 my $geckover = $1;
35     $flag->{media_type_no_rdf_plus_xml} = 1;
36     $flag->{http_no_see_other} = 1 if $geckover > 20030331;
37 wakaba 1.4 $flag->{html_no_table_abbr} = 1;
38 wakaba 1.2
39     ## Opera
40     } elsif ($ua_name =~ m#\bOpera/([0-9]\.[0-9]+)#) {
41     ## At least Opera/6 does not supports:
42     $flag->{http_refresh_no_quoted_url} = 1;
43     $flag->{http_regresh_no_semicolon_in_uri} = 1;
44    
45 wakaba 1.1 ## Classic Mozilla
46 wakaba 1.2 } elsif ($ua_name =~ m#^Mozilla/([0-4]\.[0-9]+)#) {
47     my $mozver = 0+$1;
48 wakaba 1.3 $flag->{html_no_pi} = 1;
49 wakaba 1.2 $flag->{html_no_id} = 1;
50 wakaba 1.4 $flag->{html_no_table_abbr} = 1;
51 wakaba 1.2 $flag->{media_type_no_xml} = 1;
52     $flag->{html_no_latin1} = 1 if $mozver < 3;
53     ## ISSUE: Is NN3 support latin-1 character on Japanese Windoze?
54     $flag->{charset_name_with_x} = 1 if $mozver < 3;
55     $flag->{http_refresh_no_semicolon_in_uri} = 1;
56 wakaba 1.3 if ($mozver >= 4) {
57     $flag->{ua_netscape4} = 1;
58     $flag->{stylesheet_non_standard} = 1;
59     $flag->{html_link_no_media} = 1;
60     } elsif ($mozver < 1) {
61 wakaba 1.2 $flag->{http_no_see_other} = 1;
62     $flag->{media_type_no_parameter} = 1;
63 wakaba 1.3 $flag->{stylesheet_no_css} = 1;
64     } else {
65     $flag->{stylesheet_no_css} = 1;
66 wakaba 1.2 }
67    
68     ## IE
69 wakaba 1.3 if ($ua_name =~ /\bMSIE ([2-9]\.[0-9]+)/) {
70 wakaba 1.2 my $iever = 0+$1;
71 wakaba 1.3 if ($iever >= 6) {
72 wakaba 1.2 $flag->{media_type_no_xml} = 0;
73     $flag->{media_type_no_plus_xml} = 1;
74 wakaba 1.3 $flag->{ua_winie60} = 1;
75     } elsif ($iever >= 5) {
76     $flag->{media_type_no_xml} = 0;
77     $flag->{media_type_no_plus_xml} = 1;
78     if ($iever >= 5.5) {
79     $flag->{ua_winie55} = 1;
80     } else {
81     $flag->{ua_winie50} = 1;
82     }
83     } elsif ($iever >= 4) {
84     $flag->{ua_winie40} = 1;
85     } elsif ($iever >= 3) {
86     $flag->{html_no_latin1} = 1;
87 wakaba 1.6 ## ISSUE: Does WinIE4 support latin-1 character on Japanese Windoze?
88 wakaba 1.3 $flag->{ua_winie30} = 1;
89 wakaba 1.6 $flag->{js_no_regex} = 1;
90     ## ISSUE: Does WinIE4 support /regex-literal/?
91 wakaba 1.3 } else { # WinIE 2
92     $flag->{html_no_div} = 1;
93     $flag->{stylesheet_no_css} = 1;
94     $flag->{http_refresh_no_quoted_url} = 1;
95 wakaba 1.2 }
96 wakaba 1.3 $flag->{media_type_no_app_js} = 1;
97 wakaba 1.4 $flag->{html_no_table_abbr} = 1;
98 wakaba 1.3 $flag->{stylesheet_non_standard} = 1 if $iever >= 3;
99     $flag->{ua_netscape4} = 0;
100 wakaba 1.2 }
101     ## WinIE 1.0
102 wakaba 1.3 } elsif ($ua_name =~ m#^Microsoft Internet Explorer\b#) {
103 wakaba 1.2 $flag->{html_no_id} = 1;
104     $flag->{html_no_div} = 1;
105 wakaba 1.4 $flag->{html_no_table_abbr} = 1;
106 wakaba 1.2 $flag->{http_no_see_other} = 1;
107 wakaba 1.3 $flag->{stylesheet_no_css} = 1;
108     } elsif ($ua_name =~ /^Infomosaic\b/) {
109 wakaba 1.2 $flag->{media_type_no_parameter} = 1;
110 wakaba 1.1 $flag->{html_no_id} = 1;
111 wakaba 1.2 $flag->{html_no_div} = 1;
112 wakaba 1.4 $flag->{html_no_table_abbr} = 1;
113 wakaba 1.3 $flag->{stylesheet_no_css} = 1;
114 wakaba 1.1 }
115 wakaba 1.5
116     if ($ua_name =~ /[Bb][Oo][Tt]/) {
117     $flag->{is_robot} = 1;
118     }
119    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24