Mercurial > hg > Members > nobuyasu > Consensus
diff public/viewer/viewer.html @ 53:a405991e39d8
modified ClaiMode/computeUnaimously method
author | one |
---|---|
date | Thu, 04 Oct 2012 18:01:16 +0900 |
parents | a76259e2ca9f |
children | 2f6b0b1bd03b |
line wrap: on
line diff
--- a/public/viewer/viewer.html Thu Oct 04 17:04:38 2012 +0900 +++ b/public/viewer/viewer.html Thu Oct 04 18:01:16 2012 +0900 @@ -1,4 +1,5 @@ <meta http-equiv="content-type" content="text/html;charset=utf-8" /> +<title>R-Consensus</title> <link rel='stylesheet' href="form.css"> <script src='form.js'></script> <script type="text/javascript" src="js/lib/jquery-1.8.1-min.js"></script> @@ -25,12 +26,14 @@ } } -var userName=localStorage.userName; +var userName; + var treeInfo; var userList=[]; var root_id; function loadConsensus(id){ function onload(json){ + document.title="R-Consensus : "+json.toulmin.title; $("#header_title").text("R-Consensus : "+json.toulmin.title) if(treeInfo){ updateToNew(json); @@ -53,7 +56,7 @@ function loadUserList(){ $.ajax({ url:BASE_URL+"/users/all", - success:function(o){userList=o.sort()}, + success:function(o){userList=o.sort();showUserList([]);}, type:"GET",cache:false, error:function(o){console.log("ERROR",o)} }); @@ -61,6 +64,22 @@ $(function(){ + userName=localStorage.userName; + if(userName)start(); + else $("#loginPopup").css("display","block"); +}) +function login(uname){ + userName=localStorage.userName=uname; + start(); +} +function start(){ + $.ajax({ + url:BASE_URL+"/users/create/"+userName, + success:function(o){console.log(o)}, + type:"PUT",cache:false, + error:function(o){console.log(o)} + }); + popupInit(); jsPlumb.importDefaults({ Connector : [ "Straight", { curviness:50 } ], @@ -68,7 +87,6 @@ EndpointStyle : {}, Anchors: ["BottomCenter","TopCenter"] }); - var consensus_id=(location.search.match("[0-9]+")||[])[0]; if(consensus_id){ root_id=consensus_id; @@ -78,7 +96,7 @@ }else{ document.body.innerHTML="<div style='color:white;font-size:64px'>No ClaimID Specified.<br><a href='index.html' style='color:#88f'>back</a></div>"; } -}) +} function updateToNew(json){ var t2=createJSONTreeInfo(json) @@ -291,6 +309,7 @@ height:50px; width:100%; background:#223; + background:-moz-linear-gradient(top,#002,#223); background:-webkit-gradient(linear,left top,left bottom,from(#002),to(#223)); color:silver; font-size:40px; @@ -530,4 +549,22 @@ <div class='cover' id='mention_cover'></div> </div> </div> -</div> \ No newline at end of file +</div> + + + + +<div id="loginPopup" style='position:fixed;left:0;top:0;width:100%;height:100%;z-index:10;display:none;'> +<div style='position:absolute;left:0;top:0;width:100%;height:100%;background:black;opacity:0.5'></div> +<div style='position:absolute;left:50%;top:50%;'> +<div style='position:absolute;left:-160px;top:-80px;width:320px;height:120px;background:white'> +<form onsubmit="try{a=$('#loginUserName');if(a.val()){login(a.val());$('#loginPopup').remove();}}catch(e){console.log(e)}return false"> +<div style='position:absolute;left:20px;top:15px;font-size:24px;width:280;text-align:center;'> + R-Consensus Login +</div> +<input type=text placeholder='username' style='position:absolute;left:20px;top:70px;width:180px;font-size:16px;height:24px;' id='loginUserName'> +<span style='position:absolute;left:220px;top:70px;width:80px;font-size:16px;height:24px;line-height:24px;' class='button' value='login' onclick="try{a=$('#loginUserName');if(a.val()){login(a.val());$('#loginPopup').remove();}}catch(e){console.log(e)}return false">login</span> +</form> +</div> +</div> +</div>