• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン68b31a025c76799907579ba1f9557783b5a9e7d7 (tree)
日時2020-02-04 05:43:04
作者umorigu <umorigu@gmai...>
コミッターumorigu

ログメッセージ

BugTrack/2387 Responsive layout for Smartphone

Use flexbox layout with modern web browsers that support CSS3.
Add viewport meta for device width.

* PC (over 768px): horizontal block layout
* Smartphone (under 768px): vertical stack layout

* break-all for URL and long words
* Plugin support with media query

  • comment, pcomment and article plugin
  • tracker and bugtrack plugin

* Suitable word wrap properties

  • word-break: break-all;
  • overflow-wrap: break-word;
  • word-wrap: break-word; (for Compatibility)

* Fix too thin MenuBar for PC layout
* word-break in header
* Responsive edit_form and select for Smartphone
* Responsive images (max-width: 100%)
* Set max-width of div#body
* Fit textarea width to window

変更サマリ

差分

--- a/plugin/article.inc.php
+++ b/plugin/article.inc.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // article.inc.php
44 // Copyright
5-// 2002-2017 PukiWiki Development Team
5+// 2002-2020 PukiWiki Development Team
66 // 2002 Originally written by OKAWARA,Satoshi <kawara@dml.co.jp>
77 // http://www.dml.co.jp/~kawara/pukiwiki/pukiwiki.php
88 // License: GPL v2 or (at your option) any later version
@@ -170,10 +170,13 @@ function plugin_article_convert()
170170 <input type="hidden" name="digest" value="$s_digest" />
171171 <input type="hidden" name="refer" value="$s_page" />
172172 <label for="_p_article_name_$article_no">$_btn_name</label>
173- <input type="text" name="name" id="_p_article_name_$article_no" size="$name_cols" /><br />
173+ <input type="text" name="name" id="_p_article_name_$article_no"
174+ size="$name_cols" class="_p_article_name" /><br />
174175 <label for="_p_article_subject_$article_no">$_btn_subject</label>
175- <input type="text" name="subject" id="_p_article_subject_$article_no" size="$subject_cols" /><br />
176- <textarea name="msg" rows="$article_rows" cols="$article_cols">\n</textarea><br />
176+ <input type="text" name="subject" id="_p_article_subject_$article_no"
177+ size="$subject_cols" class="_p_article_subject" /><br />
178+ <textarea name="msg" rows="$article_rows" cols="$article_cols"
179+ class="_p_article_msg">\n</textarea><br />
177180 <input type="submit" name="article" value="$_btn_article" />
178181 </div>
179182 </form>
--- a/plugin/bugtrack.inc.php
+++ b/plugin/bugtrack.inc.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // bugtrack.inc.php
44 // Copyright
5-// 2002-2017 PukiWiki Development Team
5+// 2002-2020 PukiWiki Development Team
66 // 2002 Y.MASUI GPL2 http://masui.net/pukiwiki/ masui@masui.net
77 //
88 // BugTrack plugin
@@ -114,7 +114,7 @@ function plugin_bugtrack_print_form($base, $category)
114114 $s_body = htmlsc($_plugin_bugtrack['body']);
115115 $s_submit = htmlsc($_plugin_bugtrack['submit']);
116116 $body = <<<EOD
117-<form action="$script" method="post">
117+<form action="$script" method="post" class="_p_bugtrack_form">
118118 <table border="0">
119119 <tr>
120120 <th><label for="_p_bugtrack_name_$id">$s_name</label></th>
@@ -144,11 +144,13 @@ function plugin_bugtrack_print_form($base, $category)
144144 </tr>
145145 <tr>
146146 <th><label for="_p_bugtrack_summary_$id">$s_summary</label></th>
147- <td><input id="_p_bugtrack_summary_$id" name="summary" size="60" type="text" /></td>
147+ <td><input id="_p_bugtrack_summary_$id" name="summary" size="60"
148+ class="_p_bugtrack_form_summary" type="text" /></td>
148149 </tr>
149150 <tr>
150151 <th><label for="_p_bugtrack_body_$id">$s_body</label></th>
151- <td><textarea id="_p_bugtrack_body_$id" name="body" cols="60" rows="6"></textarea></td>
152+ <td><textarea id="_p_bugtrack_body_$id" name="body" cols="60" rows="6"
153+ class="_p_bugtrack_form_body"></textarea></td>
152154 </tr>
153155 <tr>
154156 <td colspan="2" align="center">
--- a/plugin/comment.inc.php
+++ b/plugin/comment.inc.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // comment.inc.php
44 // Copyright
5-// 2002-2017 PukiWiki Development Team
5+// 2002-2020 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -109,7 +109,7 @@ function plugin_comment_convert()
109109 $_btn_name . '</label>' .
110110 '<input type="text" name="name" id="_p_comment_name_' .
111111 $comment_no . '" size="' . PLUGIN_COMMENT_SIZE_NAME .
112- '" />' . "\n";
112+ '" class="_p_comment_name" />' . "\n";
113113 }
114114 $nodate = in_array('nodate', $options) ? '1' : '0';
115115 $above = in_array('above', $options) ? '1' :
@@ -128,7 +128,8 @@ function plugin_comment_convert()
128128 <input type="hidden" name="above" value="$above" />
129129 <input type="hidden" name="digest" value="$digest" />
130130 $nametags
131- <input type="text" name="msg" id="_p_comment_comment_{$comment_no}" size="$comment_cols" />
131+ <input type="text" name="msg" id="_p_comment_comment_{$comment_no}"
132+ class="_p_comment_msg" size="$comment_cols" />
132133 <input type="submit" name="comment" value="$_btn_comment" />
133134 </div>
134135 </form>
--- a/plugin/pcomment.inc.php
+++ b/plugin/pcomment.inc.php
@@ -1,7 +1,7 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // pcomment.inc.php
4-// Copyright 2002-2017 PukiWiki Development Team
4+// Copyright 2002-2020 PukiWiki Development Team
55 // License: GPL v2 or (at your option) any later version
66 //
77 // pcomment plugin - Show/Insert comments into specified (another) page
@@ -121,12 +121,15 @@ function plugin_pcomment_convert()
121121 $name = '';
122122 } else {
123123 $title = $_pcmt_messages['btn_name'];
124- $name = '<input type="text" name="name" size="' . PLUGIN_PCOMMENT_SIZE_NAME . '" />';
124+ $name = '<input type="text" name="name" size="' .
125+ PLUGIN_PCOMMENT_SIZE_NAME .
126+ '" class="_p_comment_name" />';
125127 }
126128
127129 $radio = $params['reply'] ?
128130 '<input type="radio" name="reply" value="0" tabindex="0" checked="checked" />' : '';
129- $comment = '<input type="text" name="msg" size="' . PLUGIN_PCOMMENT_SIZE_MSG . '" />';
131+ $comment = '<input type="text" name="msg" size="' .
132+ PLUGIN_PCOMMENT_SIZE_MSG . '" class="_p_comment_msg" />';
130133
131134 $s_page = htmlsc($page);
132135 $s_refer = htmlsc($vars_page);
--- a/plugin/tracker.inc.php
+++ b/plugin/tracker.inc.php
@@ -1,7 +1,7 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // tracker.inc.php
4-// Copyright 2003-2018 PukiWiki Development Team
4+// Copyright 2003-2020 PukiWiki Development Team
55 // License: GPL v2 or (at your option) any later version
66 //
77 // Issue tracker plugin (See Also bugtrack plugin)
@@ -76,7 +76,8 @@ function plugin_tracker_convert()
7676 $retval = str_replace("[$name]",$replace,$retval);
7777 }
7878 return <<<EOD
79-<form enctype="multipart/form-data" action="$script" method="post">
79+<form enctype="multipart/form-data" action="$script" method="post"
80+ class="_p_tracker_form">
8081 <div>
8182 $retval
8283 $hiddens
--- a/skin/pukiwiki.css
+++ b/skin/pukiwiki.css
@@ -24,6 +24,10 @@ body,td {
2424 font-size:90%;
2525 font-family:verdana, arial, helvetica, Sans-Serif;
2626 }
27+textarea {
28+ box-sizing:border-box;
29+ max-width:99.5%;
30+}
2731
2832 a:link {
2933 color:#215dc6;
@@ -340,11 +344,15 @@ strong.word9 {
340344 .edit_form {
341345 clear:both;
342346 }
347+.edit_form textarea,.edit_form select {
348+ width:95%;
349+}
343350
344351 /* pukiwiki.skin.php */
345352 div#header {
346353 padding:0;
347354 margin:0;
355+ word-break:break-all;
348356 }
349357
350358 div#navigator {
@@ -353,18 +361,23 @@ div#navigator {
353361 margin:0;
354362 }
355363
356-td.menubar {
357- width:9em;
358- vertical-align:top;
364+div#contents {
365+ display:flex;
366+ flex-flow:row nowrap;
367+ word-break:break-all;
368+ overflow-wrap:break-word;
369+ word-wrap:break-word;
359370 }
360371
361372 div#menubar {
362- width:9em;
373+ min-width:9em;
374+ max-width:9em;
363375 padding:0;
364376 margin:4px;
365- word-break:break-all;
366377 font-size:90%;
367378 overflow:hidden;
379+ order:1;
380+ flex-grow:0;
368381 }
369382 div#menubar ul {
370383 margin:0 0 0 .5em;
@@ -380,11 +393,16 @@ div#menubar h4 {
380393 div#body {
381394 padding:0;
382395 margin:0 0 0 .5em;
396+ max-width:98%;
397+ order:2;
398+ flex-grow:1;
383399 }
400+
384401 div#note {
385402 clear:both;
386403 padding:0;
387404 margin:0;
405+ word-break:break-all;
388406 }
389407 div#attach {
390408 clear:both;
@@ -591,6 +609,27 @@ span.new5 {
591609 font-size:xx-small;
592610 }
593611
612+/* comment.inc.php */
613+._p_comment_name {
614+ width:9em;
615+}
616+._p_comment_msg {
617+ width:38em;
618+ max-width:90%;
619+}
620+
621+/* article.inc.php */
622+._p_article_name {
623+ width:15em;
624+}
625+._p_article_subject {
626+ width:35em;
627+}
628+._p_article_msg {
629+ width:38em;
630+ height:5em;
631+}
632+
594633 /* popular.inc.php */
595634 span.counter {
596635 font-size:70%;
@@ -646,6 +685,17 @@ tr.bugtrack_state_cancel td {
646685 tr.bugtrack_state_undef td {
647686 background-color:#ff3333;
648687 }
688+._p_bugtrack_form_summary {
689+ width:35em;
690+}
691+._p_bugtrack_form_body {
692+ width:35em;
693+}
694+
695+/* tracker.inc.php */
696+._p_tracker_form th {
697+ min-width:5em;
698+}
649699
650700 /* search2.inc.php */
651701 .search-result-page-summary {
@@ -656,6 +706,59 @@ tr.bugtrack_state_undef td {
656706 white-space:nowrap;
657707 }
658708
709+/* Mobile-friendly Responsive layout */
710+@media (max-width:767px) {
711+ div#contents {
712+ flex-flow:column wrap;
713+ }
714+ div#menubar {
715+ width:auto;
716+ max-width:none;
717+ font-size:100%;
718+ order:2;
719+ }
720+ div#body {
721+ order:1;
722+ }
723+ div#body img {
724+ max-width:95%;
725+ height:auto;
726+ }
727+
728+ ._p_article_subject {
729+ width:82%;
730+ }
731+ ._p_article_msg {
732+ box-sizing:border-box;
733+ width:99.5%;
734+ }
735+
736+ ._p_tracker_form th,._p_tracker_form td {
737+ display:block;
738+ text-align:left !important;
739+ width:auto !important;
740+ margin:0;
741+ }
742+ ._p_tracker_form td input[type=text] {
743+ box-sizing:border-box;
744+ width:99.5%;
745+ }
746+ ._p_tracker_form td textarea {
747+ box-sizing:border-box;
748+ width:99.5%;
749+ }
750+
751+ ._p_bugtrack_form th,._p_bugtrack_form td {
752+ display:block;
753+ text-align:left !important;
754+ margin:0;
755+ }
756+ ._p_bugtrack_form_summary,._p_bugtrack_form_body {
757+ box-sizing:border-box;
758+ width:99.5%;
759+ }
760+}
761+
659762 @media print {
660763 a:link,
661764 a:visited {
@@ -664,7 +767,6 @@ tr.bugtrack_state_undef td {
664767 img#logo,
665768 div#navigator,
666769 div#menubar,
667- td.menubar,
668770 div#related,
669771 div#attach,
670772 div#toolbar {
--- a/skin/pukiwiki.skin.php
+++ b/skin/pukiwiki.skin.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // pukiwiki.skin.php
44 // Copyright
5-// 2002-2017 PukiWiki Development Team
5+// 2002-2020 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -61,6 +61,7 @@ header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
6161 <html lang="<?php echo LANG ?>">
6262 <head>
6363 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" />
64+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6465 <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
6566 <?php if ($html_meta_referrer_policy) { ?> <meta name="referrer" content="<?php echo htmlsc(html_meta_referrer_policy) ?>" /><?php } ?>
6667
@@ -153,20 +154,12 @@ function _navigator($key, $value = '', $javascript = ''){
153154
154155 <?php echo $hr ?>
155156
157+<div id="contents">
158+ <div id="body"><?php echo $body ?></div>
156159 <?php if ($menu !== FALSE) { ?>
157-<table border="0" style="width:100%">
158- <tr>
159- <td class="menubar">
160- <div id="menubar"><?php echo $menu ?></div>
161- </td>
162- <td valign="top">
163- <div id="body"><?php echo $body ?></div>
164- </td>
165- </tr>
166-</table>
167-<?php } else { ?>
168-<div id="body"><?php echo $body ?></div>
160+ <div id="menubar"><?php echo $menu ?></div>
169161 <?php } ?>
162+</div>
170163
171164 <?php if ($notes != '') { ?>
172165 <div id="note"><?php echo $notes ?></div>