チャットネーム整形ツール

本番

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta http-equiv="content-language" content="ja,jp-ja"/>
<meta charset="UTF-8"/>
<title>チャット名前整形</title>
<script type="text/javascript" src="http://ja.scp-wiki.net/scpmetatitlesearch/code/4"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded",function(){
    var chatV;
    var defaultSetting = {
        height:600,
        url:"http://cgiirc.synirc.net/irc.cgi?chan=%23site8181,%23scp-jp"
    }
    if(location.href.indexOf("#") < 0){
        try{
            var check = window.parent.window.account;
            check.checkExist()
            return;
        }catch(e){
            createIframe(1);        }
    }else{
        createIframe(0);
    }
 
    function createIframe(runtype){
        chatV = document.createElement("iframe");
        chatV.setAttribute("style","display:none;");
        chatV.setAttribute("scrolling","no");
        chatV.setAttribute("frameborder","0");
        chatV.setAttribute("width","100%");
        chatV.setAttribute("id","chat");
        var srcURL = "";
        switch(runtype){
            case 0:
                srcURL = forWikidotAccount();
            break;
            case 1:
                srcURL = forNoves()
            break;
        }
        shineIE(function(){document.getElementById("chat").removeAttribute("style");});
        chatV.src = srcURL;
        (document.getElementById("set")).appendChild(chatV);
 
    }
 
    function forWikidotAccount(){
        try{
            var name = location.href.split("#")[1];
            var height = defaultSetting.height;
            if(name.indexOf(";") >= 0){
                height = Number(name.split(";")[1]);
                if(height.length <= 0){
                    height = String(defaultSetting.height);
                }
                if(isNaN(Number(height)) ){
                    height = String(defaultSetting.height);
                }
                name = decodeURIExtension(name.split(";")[0]);
            }
            if(name.length == 0){
                return forNoves(height);
            }
            name = name.split(" ").join("_");
            if(name.charAt(0).match(/[0-9]/gi)){
            name = "_"+name;
            }
 
            chatV.height = height+"px";
            return (defaultSetting.url + ";nick="+name);    
        }catch(e){
            return forNoves();
        }
    }
    function forNoves(heightS){
        if(!heightS)heightS=defaultSetting.height;
        chatV.height = heightS+"px";    
        return defaultSetting.url;
 
    }
 
    function shineIE(func){
        if( /*@cc_on ! @*/ false )
        {
            chatV.onreadystatechange = function(){
                if( window.event.srcElement.readyState == "complete" )
                {
                    func();
                }
            }            
        }else{
            chatV.onload = func;
        }
 
    }
    function checkShow(){
        if(chatV.style.display == "none"){
            chatV.removeAttribute("style");
        }
    }
 
});
 
function checkExist(){
return true;
}
</script>
</head>
<body>
<div style="width:100%;" id="set">
 
</div>
</body>
</html>

テスト

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta http-equiv="content-language" content="ja,jp-ja"/>
<meta charset="UTF-8"/>
<title>チャット名前整形</title>
<script type="text/javascript" src="http://ja.scp-wiki.net/scpmetatitlesearch/code/4"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded",function(){
    var chatV;
    var defaultSetting = {
        height:600,
        url:"http://cgiirc.synirc.net/irc.cgi?chan=%23site8181,%23scp-jp"
    }
    if(location.href.indexOf("#") < 0){
        try{
            var check = window.parent.window.account;
            check.checkExist();
            return;
        }catch(e){
            createIframe(1);
        }
    }else{
        createIframe(0);
    }
 
    function createIframe(runtype){
        chatV = document.createElement("iframe");
        chatV.setAttribute("style","display:none;");
        chatV.setAttribute("scrolling","no");
        chatV.setAttribute("frameborder","0");
        chatV.setAttribute("width","100%");
        chatV.setAttribute("id","chat");
        var srcURL = "";
        switch(runtype){
            case 0:
                srcURL = forWikidotAccount();
            break;
            case 1:
                srcURL = forNoves()
            break;
        }
        shineIE(function(){document.getElementById("chat").removeAttribute("style");});
        chatV.src = srcURL;
        (document.getElementById("set")).appendChild(chatV);
 
    }
 
    function forWikidotAccount(){
        try{
            var name = location.href.split("#")[1];
            var height = defaultSetting.height;
            if(name.indexOf(";") >= 0){
                height = Number(name.split(";")[1]);
                if(height.length <= 0){
                    height = String(defaultSetting.height);
                }
                if(isNaN(Number(height)) ){
                    height = String(defaultSetting.height);
                }
                name = decodeURIExtension(name.split(";")[0]);
            }
            if(name.length == 0){
                return forNoves(height);
            }
            name = name.split(" ").join("_");
 
            if(name.charAt(0).match(/[0-9]/gi)){
            name = "_"+name;
            }
 
            chatV.height = height+"px";
            return (defaultSetting.url + ";nick="+name);    
        }catch(e){
            return forNoves();
        }
    }
    function forNoves(heightS){
        if(!heightS)heightS=defaultSetting.height;
        chatV.height = heightS+"px";    
        return defaultSetting.url;
 
    }
 
    function shineIE(func){
        if( /*@cc_on ! @*/ false )
        {
            chatV.onreadystatechange = function(){
                if( window.event.srcElement.readyState == "complete" )
                {
                    func();
                }
            }            
        }else{
            chatV.onload = func;
        }
 
    }
    function checkShow(){
        if(chatV.style.display == "none"){
            chatV.removeAttribute("style");
        }
    }
 
});
 
function checkExist(){
return true;
}
</script>
</head>
<body>
<div style="width:100%;" id="set">
 
</div>
</body>
</html>
特に指定がない限り、このサイトのコンテンツには次のライセンスが適用されます: Creative Commons Attribution-ShareAlike 3.0 License