|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 | + <meta http-equiv="Content-Language" content="ja" /> |
| 7 | + <meta http-equiv="Content-Style-Type" content="text/css" /> |
| 8 | + <meta http-equiv="Content-Script-Type" content="text/javascript" /> |
| 9 | + <link rel="stylesheet" type="text/css" href="style.css"> |
| 10 | + <script type="text/javascript" src="jquery-1.9.0.min.js"></script> |
| 11 | + <script type="text/javascript" src="config.js"></script> |
| 12 | + <!--[if IE]> |
| 13 | + <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
| 14 | + <![endif]--> |
| 15 | + <title>WINT</title> |
| 16 | + <style> |
| 17 | + * { |
| 18 | + margin:0; |
| 19 | + padding:0; |
| 20 | + } |
| 21 | + |
| 22 | + html,body { |
| 23 | + height:100%; |
| 24 | + overflow: hidden; /* スクロールバー非表示へ */ |
| 25 | + } |
| 26 | + |
| 27 | + #content { |
| 28 | + text-align: center; /* コンテンツ画面を中心に配置 */ |
| 29 | + } |
| 30 | + |
| 31 | + #footer { |
| 32 | + line-height:0; /* 二つのspanの縦位置をあわせる */ |
| 33 | + } |
| 34 | + |
| 35 | + #footer > span{ |
| 36 | + position: relative; /* スライドさせるアニメーションに必要 */ |
| 37 | + } |
| 38 | + |
| 39 | + iframe { |
| 40 | + border: 0; |
| 41 | + background-color:#fff; |
| 42 | + } |
| 43 | + </style> |
| 44 | + <script> |
| 45 | + var frame = { |
| 46 | + "iframe": ["#iframe0", "#iframe1"], |
| 47 | + "img": ["#img0", "#img1"] |
| 48 | + }; |
| 49 | + |
| 50 | + var dispId = 0; |
| 51 | + var dispType = "iframe"; |
| 52 | + var prevType = "iframe"; |
| 53 | + var loadType = "iframe"; |
| 54 | + |
| 55 | + var contentList = ["dummy"]; |
| 56 | + var i = 0; // 表示中のコンテンツ番号 |
| 57 | + var duration = 5; // コンテンツの表示時間 |
| 58 | + |
| 59 | + function resize(){ |
| 60 | + target = frame[dispType][dispId]; |
| 61 | + |
| 62 | + scrWidth = $(window).width(); |
| 63 | + scrHeight = $(window).height() - $("#footer").height(); |
| 64 | + $("#content").css({"height": scrHeight}); |
| 65 | + |
| 66 | + if(dispType == "img"){ |
| 67 | + imgWidth = $(target).width(); |
| 68 | + imgHeight = $(target).height(); |
| 69 | + |
| 70 | + if( imgWidth/imgHeight < scrWidth/scrHeight ){ |
| 71 | + // スクリーンに対して縦長 |
| 72 | + $(target).css({ |
| 73 | + "width": imgWidth * scrHeight / imgHeight, |
| 74 | + "height": scrHeight |
| 75 | + }); |
| 76 | + } else { |
| 77 | + // スクリーンに対して横長; |
| 78 | + $(target).css({ |
| 79 | + "width": scrWidth, |
| 80 | + "height": imgHeight * scrWidth / imgWidth |
| 81 | + }); |
| 82 | + } |
| 83 | + } else if(dispType == "iframe"){ |
| 84 | + $(target).css({ |
| 85 | + "width": scrWidth, |
| 86 | + "height": scrHeight |
| 87 | + }); |
| 88 | + } |
| 89 | + |
| 90 | + var hspace = scrHeight - $(target).height(); |
| 91 | + |
| 92 | + $(target).css({ |
| 93 | + "margin-top": hspace > 0 ? hspace / 2 : 0, |
| 94 | + "margin-bottom": hspace > 0 ? hspace / 2 + 1 : 0 |
| 95 | + }); |
| 96 | + } |
| 97 | + |
| 98 | + $(window).load(function(){ |
| 99 | + console.log("window load"); |
| 100 | + resize(); |
| 101 | + $(frame[dispType][dispId]).fadeIn(contentFadeInTime); |
| 102 | + }); |
| 103 | + |
| 104 | + $(window).resize(function(){ |
| 105 | + resize(); |
| 106 | + }); |
| 107 | + |
| 108 | + $(document).ready(function(){ |
| 109 | + /* コンテンツ画面の実装 */ |
| 110 | + function loadContent(data){ |
| 111 | + contentList = data; |
| 112 | + console.log(contentList); |
| 113 | + } |
| 114 | + |
| 115 | + $.getJSON(contentJsonUrl, null, loadContent); |
| 116 | + |
| 117 | + var state = 0; // 0: load 1: change content 2: go to state0 |
| 118 | + var passedsec = 0; // 経過時間 |
| 119 | + |
| 120 | + var timestamp; // JSON取得時のキャッシュを防ぐためにURLにtimestampを含ませる |
| 121 | + |
| 122 | + setInterval(function () { |
| 123 | + passedsec++; |
| 124 | + |
| 125 | + if(state == 0){ |
| 126 | + console.log("load"); |
| 127 | + |
| 128 | + loadType = contentList[i]["type"]; |
| 129 | + |
| 130 | + $(frame[loadType][1-dispId]).attr('src', contentList[i]["url"]); |
| 131 | + |
| 132 | + state = 1; |
| 133 | + if(i+1==contentList.length){ |
| 134 | + timestamp = (contentJsonUrl.indexOf("?") == -1 ? "?" : "&")+"timestamp="+(new Date()).getTime(); |
| 135 | + $.getJSON(contentJsonUrl+timestamp, null, loadContent); |
| 136 | + } |
| 137 | + } else if(state == 1){ |
| 138 | + if(passedsec > duration - 1){ |
| 139 | + state = 2; |
| 140 | + passedsec = 0; |
| 141 | + |
| 142 | + console.log("change"); |
| 143 | + dispId = 1-dispId; |
| 144 | + dispType = loadType; |
| 145 | + $(frame[dispType][dispId]).css({ |
| 146 | + "width": "", |
| 147 | + "height": "" |
| 148 | + }); |
| 149 | + resize(); |
| 150 | + $(frame[dispType][dispId]).delay(contentFadeOutTime).fadeIn(contentFadeInTime); |
| 151 | + $(frame[prevType][1-dispId]).fadeOut(contentFadeOutTime); |
| 152 | + |
| 153 | + prevType = dispType; |
| 154 | + duration = contentList[i]["duration"]; |
| 155 | + |
| 156 | + if(i+1==contentList.length) i = 0; else i++; |
| 157 | + } |
| 158 | + } else if(state == 2){ |
| 159 | + if(passedsec >= 1){ |
| 160 | + state = 0; |
| 161 | + passedsec = 0; |
| 162 | + } |
| 163 | + } |
| 164 | + }, 1000); |
| 165 | + |
| 166 | + /* ニュースバーの実装 */ |
| 167 | + function loadNews(data){ |
| 168 | + newsList = data; |
| 169 | + console.log(newsList); |
| 170 | + } |
| 171 | + |
| 172 | + var newsList = Array(); |
| 173 | + var newsOrder = 0; |
| 174 | + var newsElm = ["#news0", "#news1"]; |
| 175 | + var newsState = 0; |
| 176 | + var newsWidth = $("#footer").width(); |
| 177 | + |
| 178 | + $.getJSON(newsJsonUrl, null, loadNews); |
| 179 | + |
| 180 | + $(newsElm[newsState]).css({left:(newsWidth),display:'block',opacity:'0'}). |
| 181 | + animate({left:'0',opacity:'1'},newsEffectSpeed,newsEasing); |
| 182 | + |
| 183 | + setInterval(function(){ |
| 184 | + $(newsElm[newsState]).animate({left:(-(newsWidth)),opacity:'0'},newsEffectSpeed,newsEasing); |
| 185 | + |
| 186 | + newsState = 1 - newsState; |
| 187 | + |
| 188 | + $(newsElm[newsState]).text(newsList[newsOrder]); |
| 189 | + newsOrder++; |
| 190 | + |
| 191 | + if(newsOrder == newsList.length){ |
| 192 | + timestamp = (newsJsonUrl.indexOf("?") == -1 ? "?" : "&")+"timestamp="+(new Date()).getTime(); |
| 193 | + $.getJSON(newsJsonUrl+timestamp, null, loadNews); |
| 194 | + newsOrder = 0; |
| 195 | + } |
| 196 | + |
| 197 | + $(newsElm[newsState]).css({left:(newsWidth),display:'block',opacity:'0'}). |
| 198 | + animate({left:'0',opacity:'1'},newsEffectSpeed,newsEasing); |
| 199 | + |
| 200 | + },newsSwitchDelay); |
| 201 | + }); |
| 202 | + |
| 203 | + </script> |
| 204 | + </head> |
| 205 | + <body> |
| 206 | + <div id="container"> |
| 207 | + <div id="content"> |
| 208 | + <iframe id="iframe0" src="boot.html" scrolling="no" style="display:none;"></iframe> |
| 209 | + <iframe id="iframe1" src="boot.html" scrolling="no" style="display:none;"></iframe> |
| 210 | + <img id="img0" src="" style="display:none;"/> |
| 211 | + <img id="img1" src="" style="display:none;"/> |
| 212 | + </div> |
| 213 | + </div> |
| 214 | + <div id="footer"> |
| 215 | + <span id="news0">WINT Information</span> |
| 216 | + <span id="news1" style="display:none;">news</span> |
| 217 | + </div> |
| 218 | + </body> |
| 219 | +</html> |
0 commit comments