diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-27 15:05:35 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-27 15:05:35 -0400 |
commit | cc2c4de595bc3c4f7424d30342d74a5974fdefe0 (patch) | |
tree | 38a1daec46b11484c12eb6f08128dd05619b1e10 | |
parent | ie5 (diff) | |
download | website-cc2c4de595bc3c4f7424d30342d74a5974fdefe0.tar.gz website-cc2c4de595bc3c4f7424d30342d74a5974fdefe0.tar.bz2 website-cc2c4de595bc3c4f7424d30342d74a5974fdefe0.zip |
ie4
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/public/css/bucket/legacy.css | 1 | ||||
-rw-r--r-- | src/public/css/ie/boxsizing.css | 1 | ||||
-rw-r--r-- | src/public/css/ie/ie.css | 2 | ||||
-rw-r--r-- | src/public/css/ie/ie4.css | 1 | ||||
-rw-r--r-- | src/public/css/ie/ie5.css | 1 | ||||
-rw-r--r-- | src/public/css/ie/ie6.css | 2 | ||||
-rw-r--r-- | src/public/css/ie/ie6.scss.css | 1 | ||||
-rw-r--r-- | src/public/css/ie/main.css | 1 | ||||
-rw-r--r-- | src/scss/blog.scss | 4 | ||||
-rw-r--r-- | src/scss/ie/ie.scss | 21 | ||||
-rw-r--r-- | src/scss/ie/ie4.scss | 16 | ||||
-rw-r--r-- | src/scss/ie/ie6.scss | 14 | ||||
-rw-r--r-- | src/web/_model/blog.php | 2 | ||||
-rw-r--r-- | src/web/_views/comments.php | 10 | ||||
-rw-r--r-- | src/web/_views/footer.php | 4 | ||||
-rw-r--r-- | src/web/_views/head.php | 8 | ||||
-rw-r--r-- | src/web/_views/header.php | 5 | ||||
-rw-r--r-- | src/web/helpers/ie.php | 29 | ||||
-rw-r--r-- | src/web/index.php | 7 |
20 files changed, 86 insertions, 46 deletions
@@ -10,7 +10,7 @@ all: clean css stamp clean: @# clean scss @printf "\033[31m RM \033[0m%s\n" src/public/css - @rm -f src/public/css/*.css + @rm -fr src/public/css/* @git stash -- src/public/css/prism.css > /dev/null @# clean stamps diff --git a/src/public/css/bucket/legacy.css b/src/public/css/bucket/legacy.css deleted file mode 100644 index 9075e82..0000000 --- a/src/public/css/bucket/legacy.css +++ /dev/null @@ -1 +0,0 @@ -#webring{height:5px} diff --git a/src/public/css/ie/boxsizing.css b/src/public/css/ie/boxsizing.css deleted file mode 100644 index 1301de2..0000000 --- a/src/public/css/ie/boxsizing.css +++ /dev/null @@ -1 +0,0 @@ -*{behavior:url(boxsizing.htc)} diff --git a/src/public/css/ie/ie.css b/src/public/css/ie/ie.css index 2ff327a..b39dc37 100644 --- a/src/public/css/ie/ie.css +++ b/src/public/css/ie/ie.css @@ -1 +1 @@ -#header .ie-nav{margin-left:90px}#main .col{display:block !important;width:100% !important}#main .col.left{padding-right:0 !important}#main .section .heading{background:#366199 !important}#main #post .posted,#main #writeup .posted{margin-top:16px}#main #comments #new_comment{width:400px}#main #comments #new_comment #author,#main #comments #new_comment #content{width:400px !important}#main table{behavior:url(boxsizing.htc)} +#header .ie-nav{margin-left:90px}#main .col{display:block;width:100%}#main .col.left{padding-right:0}#main .section h2.heading{background:#366199}#main #post .posted,#main #writeup .posted{margin-top:16px}#main #comments form,#main #comments form#new_comment{width:400px}#main #comments form input,#main #comments form input#author,#main #comments form input#content,#main #comments form#new_comment input,#main #comments form#new_comment input#author,#main #comments form#new_comment input#content{width:400px}#main table{behavior:url(boxsizing.htc)} diff --git a/src/public/css/ie/ie4.css b/src/public/css/ie/ie4.css new file mode 100644 index 0000000..d0b006b --- /dev/null +++ b/src/public/css/ie/ie4.css @@ -0,0 +1 @@ +#header #nav li{padding:0px !important;margin:0px !important;margin-top:16px} diff --git a/src/public/css/ie/ie5.css b/src/public/css/ie/ie5.css deleted file mode 100644 index c533312..0000000 --- a/src/public/css/ie/ie5.css +++ /dev/null @@ -1 +0,0 @@ -.ie-nav{margin-left:90px}#main .col{display:block !important;width:100% !important}#main .left{padding-right:0 !important;padding-bottom:16px}#main .right{margin-top:16px}#new_comment{width:400px}#new_comment .input{width:400px} diff --git a/src/public/css/ie/ie6.css b/src/public/css/ie/ie6.css index e19ec4e..809bdc0 100644 --- a/src/public/css/ie/ie6.css +++ b/src/public/css/ie/ie6.css @@ -1 +1 @@ -*{behavior:url(boxsizing.htc)}body #main .col.left{margin-bottom:16px}body #main .col.right{margin-top:16px !important}body #contact{margin-bottom:0 !important}body #footer{margin-top:16px !important} +*{behavior:url(boxsizing.htc)}body #main .coldiv.left{margin-bottom:16px}body #main .coldiv.right{margin-top:16px}body div#contact{margin-bottom:0}body div#footer{margin-top:16px} diff --git a/src/public/css/ie/ie6.scss.css b/src/public/css/ie/ie6.scss.css deleted file mode 100644 index 1301de2..0000000 --- a/src/public/css/ie/ie6.scss.css +++ /dev/null @@ -1 +0,0 @@ -*{behavior:url(boxsizing.htc)} diff --git a/src/public/css/ie/main.css b/src/public/css/ie/main.css deleted file mode 100644 index c533312..0000000 --- a/src/public/css/ie/main.css +++ /dev/null @@ -1 +0,0 @@ -.ie-nav{margin-left:90px}#main .col{display:block !important;width:100% !important}#main .left{padding-right:0 !important;padding-bottom:16px}#main .right{margin-top:16px}#new_comment{width:400px}#new_comment .input{width:400px} diff --git a/src/scss/blog.scss b/src/scss/blog.scss index 415530a..6fad483 100644 --- a/src/scss/blog.scss +++ b/src/scss/blog.scss @@ -42,7 +42,8 @@ } } - #new_comment { + form, /* ie4 */ + form#new_comment { margin-left: $inner-gap; max-width: 400px; padding-right: $inner-gap; @@ -53,6 +54,7 @@ input#author, input#content { + display: block; width: 100%; } diff --git a/src/scss/ie/ie.scss b/src/scss/ie/ie.scss index bf8cc4f..f65d6b9 100644 --- a/src/scss/ie/ie.scss +++ b/src/scss/ie/ie.scss @@ -10,18 +10,18 @@ #main { .col { - display: block !important; - width: 100% !important; + display: block; + width: 100%; &.left { - padding-right: 0 !important; + padding-right: 0; } } .section { - .heading { - background: $blue !important; + h2.heading { + background: $blue; } } @@ -33,12 +33,15 @@ } #comments { - #new_comment { + form, /* ie4 */ + form#new_comment { + width: 400px; - #author, - #content { - width: 400px !important; + input, + input#author, + input#content { + width: 400px; } } } diff --git a/src/scss/ie/ie4.scss b/src/scss/ie/ie4.scss new file mode 100644 index 0000000..e2335a7 --- /dev/null +++ b/src/scss/ie/ie4.scss @@ -0,0 +1,16 @@ +/* IE 4 Only */ + +@import "../variables"; + +/** + * Display inner block does not seem to work on thead + * li elements in IE4, so just make the list vertical + */ + +#header { + #nav li { + padding: 0px !important; + margin: 0px !important; + margin-top: $inner-gap; + } +} diff --git a/src/scss/ie/ie6.scss b/src/scss/ie/ie6.scss index 2731e24..a443956 100644 --- a/src/scss/ie/ie6.scss +++ b/src/scss/ie/ie6.scss @@ -20,22 +20,22 @@ body { #main { .col { - &.left { + &div.left { margin-bottom: $inner-gap; } - &.right { - margin-top: $inner-gap !important; + &div.right { + margin-top: $inner-gap; } } } - #contact { - margin-bottom: 0 !important; + div#contact { + margin-bottom: 0; } - #footer { - margin-top: $inner-gap !important; + div#footer { + margin-top: $inner-gap; } } diff --git a/src/web/_model/blog.php b/src/web/_model/blog.php index c91bfa8..94ca049 100644 --- a/src/web/_model/blog.php +++ b/src/web/_model/blog.php @@ -42,7 +42,7 @@ class Blog_model extends Model { $base = $this->get_url(''); $replace = "<a href=\"{$base}\\1\">"; - $replace .= IE_START . "<img class=\"center\" src=\"{$base}\\1\" title=\"\\2\" alt=\"\\2\">" . IE_END; + $replace .= ie('<center>') . "<img class=\"center\" src=\"{$base}\\1\" title=\"\\2\" alt=\"\\2\">" . ie('</center>'); $replace .= "</a>"; $md = preg_replace($pattern, $replace, $md); diff --git a/src/web/_views/comments.php b/src/web/_views/comments.php index bf30ec5..0828753 100644 --- a/src/web/_views/comments.php +++ b/src/web/_views/comments.php @@ -18,24 +18,24 @@ <div class="new"> <h3><?=lang('new_comment_title')?></h3> <form id="new_comment" method="get" action="<?=lang('base_path') . '_comments/post'?>"> - <input + <div><input type="text" name="author" id="author" aria-label="<?=lang('new_comment_author_label')?>" - placeholder="<?=lang('new_comment_author_ph')?>"> - <input + placeholder="<?=lang('new_comment_author_ph')?>"></div> + <div><input type="text" name="content" id="content" aria-label="<?=lang('new_comment_content_label')?>" - placeholder="<?=lang('new_comment_content_ph')?>"> + placeholder="<?=lang('new_comment_content_ph')?>"></div> <input type="hidden" class="hidden" name="ref" value="<?=base64_encode($ref)?>"> - <input + <div><input type="hidden" class="hidden" name="page" diff --git a/src/web/_views/footer.php b/src/web/_views/footer.php index eb0ee4c..59127ec 100644 --- a/src/web/_views/footer.php +++ b/src/web/_views/footer.php @@ -47,8 +47,6 @@ ></iframe> </div> </div> -<!--[if lt IE 8 ]> - </center> -<![endif]--> + <?=ie('</center>')?> </body> </html> diff --git a/src/web/_views/head.php b/src/web/_views/head.php index e54fd1c..f184953 100644 --- a/src/web/_views/head.php +++ b/src/web/_views/head.php @@ -21,15 +21,17 @@ <link rel="icon" type="image/png" sizes="512x512" href="<?=$this->get_url("public/icons/logo512.png", TRUE)?>"> <link rel="icon" type="image/png" sizes="640x640" href="<?=$this->get_url("public/icons/logo640.png", TRUE)?>"> <link rel="manifest" href="/manifest.json"> - <!--[if lt IE 8 ]> - <?=$this->embed_css('css/ie/ie.css')?> - <![endif]--> + <?=$this->link_css('css/main.css');?> + <?=ie($this->embed_css('css/ie/ie.css'))?> + <?=ie_ua($this->embed_css('css/ie/ie4.css'), 4)?> <!--[if (gt IE 5)&(lt IE 8) ]> <?=$this->embed_css('css/ie/ie6.css')?> <![endif]--> <?php foreach($css as $file) echo $this->embed_css($file); ?> + <?=ie('<iframe width="0" height="0">')?> <?php foreach($js as $file) echo $this->link_js($file); ?> + <?=ie('</iframe>')?> diff --git a/src/web/_views/header.php b/src/web/_views/header.php index c06cef8..90a31ea 100644 --- a/src/web/_views/header.php +++ b/src/web/_views/header.php @@ -1,13 +1,10 @@ <?php /* Copyright (c) 2024 Freya Murphy */ ?> <?php $this->view('head', $data); - echo $this->link_css('css/main.css'); ?> </head> <body> -<!--[if lt IE 8 ]> - <center> -<![endif]--> +<?=ie('<center>')?> <div class="center"> <div id="header" role="banner" aria-label="banner"> <?=image('img/headerLogo', 'alt_website_logo', size: '200')?> diff --git a/src/web/helpers/ie.php b/src/web/helpers/ie.php new file mode 100644 index 0000000..75e4015 --- /dev/null +++ b/src/web/helpers/ie.php @@ -0,0 +1,29 @@ +<?php /* Copyright (c) 2024 Freya Murphy */ + +/// IE 5 though 8 support IE conditional comments +/// IE 4 does not (need to fall back to user agent) + +$__ie_ver = FALSE; + +if (preg_match('/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $B)) { + $__ie_ver = $B['v']; +} +if ($__ie_ver == FALSE || $__ie_ver > 4) { + // ADD COND COMMENTS + define('IE_START', "<!--[if lt IE 8 ]>"); + define('IE_END', "<![endif]-->"); +} else { + // IE4 DETECTED, DO NOT ADD COMMENTS + define('IE_START', ''); + define('IE_END', ''); +} + +function ie(string $inner) { + return IE_START . $inner . IE_END; +} + +function ie_ua(string $inner, int $ver) { + if ($GLOBALS['__ie_ver'] == $ver) + return $inner; + return ''; +} diff --git a/src/web/index.php b/src/web/index.php index 83ab9d4..6b4bf06 100644 --- a/src/web/index.php +++ b/src/web/index.php @@ -3,6 +3,7 @@ // ========================= ENVIRONMENT == ini_set('html_errors', '1'); +ini_set('browscap', 'browscap.ini'); date_default_timezone_set('America/New_York'); // ENVIRONMENT @@ -23,11 +24,6 @@ define('WEB_ROOT', PHP_ROOT . '/web'); define('ASSET_ROOT', PHP_ROOT . '/assets'); define('PUBLIC_ROOT', PHP_ROOT . '/public'); -// ========================== VARIABLES == - -define('IE_START', "<!--[if lt IE 8 ]>\n<center>\n<![endif]-->"); -define('IE_END', "<!--[if lt IE 8 ]>\n</center>\n<![endif]-->"); - // ========================== BOOTSTRAP == // load all third party @@ -39,6 +35,7 @@ require(WEB_ROOT . '/config/routes.php'); require(WEB_ROOT . '/config/style.php'); // load all the helpers +require(WEB_ROOT . '/helpers/ie.php'); require(WEB_ROOT . '/helpers/lang.php'); require(WEB_ROOT . '/helpers/aria.php'); require(WEB_ROOT . '/helpers/image.php'); |