Goiフォーマット対応用Interwikiモック
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>SCPNET Interwikiもっく</title> <base target="_parent" /> <style> body { margin: 0; padding: 5px; font-size: 0.80em; } /* width: 217px; */ .interwiki__title { color: #600; border-bottom: solid 1px #600; padding-left: 15px; margin-top: 10px; margin-bottom: 5px; font-size: 8pt; font-weight: bold; } .interwiki__entry { position: relative; } .interwiki__entry:before { content: "■"; font-size: 7px; color: #b01; position: relative; margin: 0 7px 0 5px; bottom: 3px; } .interwiki__entry a, .interwiki__entry a:visited { font-weight: bold; color: #b01; text-decoration: none; background: transparent; } .interwiki__entry a:hover { text-decoration: underline; } @media (min-width: 14.375em) { .interwiki { width: 17em; } } </style> </head> <!-- これはモック用のスクリプトです --> <script type="text/javascript"> function showChange(){ var locationH = location.href; if(locationH.indexOf("#") < 0){ return; } var showNumber = locationH.split("#")[1]; showNumber = Number(showNumber); if(isNaN(showNumber)){return;} var Divcount = 0; var Divs = document.getElementsByTagName("div"); for(var i = 0;i < Divs.length;i++){ if(Divs[i].getAttribute("class") == "interwiki__entry"){ Divcount++; if(Divcount > showNumber){ Divs[i].parentNode.removeChild(Divs[i]); i--; } } } } </script> <!-- ↓これが自動調整に必要なスクリプトです --> <script type="text/javascript"> var isResizeCatch = false;//Trigger var ParentWindow;//Contain Parent Frame document.addEventListener("DOMContentLoaded",function(){ //Get Parent Frame ParentWindow = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined); showChange(); //Set Event Method that if It catched Message from Parent Frame window.addEventListener("message",function(event){ switch(event.data){ case "Request your Height": //If it receive request,it begin send own heigth to parent frame isResizeCatch = false; //If getting own parent frame was successed,It start to post own height to parent frame if (typeof(ParentWindow) != "undefined") { postMyHeight(); } break; case "I got your Height": //If it receive resize completed message,It stop sending isResizeCatch = true; break; } }); //Post Method function postMyHeight(){ //post ParentWindow.postMessage(getMyHeight(),"*"); //Repeated action for transmission failure if(!isResizeCatch){ setTimeout(postMyHeight,5); } } function getMyHeight() { //Operation to acquire the height according to the browser if (document.body.scrollHeight) { return document.body.scrollHeight; } if (document.height) { return document.height; } return document.body.offsetHeight; }; }); </script> <body> <div class="interwiki"> <div class="interwiki__title">他言語版</div> <div class="interwiki__entry"><a href="http://scp-wiki-cn.wikidot.com/main">中文</a></div> <div class="interwiki__entry"><a href="http://www.scp-wiki.net/main">English</a></div> <div class="interwiki__entry"><a href="http://scp-wiki-de.wikidot.com/main">Deutsch</a></div> <div class="interwiki__entry"><a href="http://fondazionescp.wikidot.com/main">Italiano</a></div> <div class="interwiki__entry"><a href="http://ko.scp-wiki.net/main">한국어</a></div> <div class="interwiki__entry"><a href="http://scp-wiki.net.pl/main">Polski</a></div> <div class="interwiki__entry"><a href="http://scpfoundation.ru/main">Русский</a></div> <div class="interwiki__entry"><a href="http://scp-th.wikidot.com/main">ภาษาไทย</a></div> </div> <!-- SCP Foundation Russia Networks --> </body> </html>
page revision: 1, last edited: 04 Jan 2018 12:38




.png)


