Commit b6346fa4 authored by 神楽坂玲奈's avatar 神楽坂玲奈

copy init

parent a8ea9854
...@@ -232,6 +232,40 @@ $(document).ready -> ...@@ -232,6 +232,40 @@ $(document).ready ->
new_room.server.value = Server.choice(false, new_room.pvp.ckecked).id new_room.server.value = Server.choice(false, new_room.pvp.ckecked).id
new_room.server.onchange() #这个怎么能自动触发... new_room.server.onchange() #这个怎么能自动触发...
$('#new_room_dialog').dialog('open') $('#new_room_dialog').dialog('open')
$('#new_room_copy_room_url').zclip('remove')
$('#new_room_copy_room_url').zclip
path:'/vendor/javascripts/ZeroClipboard.swf',
copy: ->
if server_id = parseInt new_room.server.value
server = Server.find server_id
server_ip = server.ip
server_port = server.port
server_auth = server.auth
else
server_ip = new_room.server_ip.value
server_port = parseInt new_room.server_port.value
server_auth = new_room.server_auth.checked
mycard.room_url server_ip, server_port, mycard.room_name(new_room.name.value, null, new_room.pvp.checked, parseInt(new_room.rule.value), parseInt(new_room.mode.value), parseInt(new_room.start_lp.value), parseInt(new_room.start_hand.value), parseInt(new_room.draw_count.value)), null, null, new_room.password.value.length, server_auth
new_room.password.onchange = ->
$('#new_room_copy_room_url_with_password').zclip('remove')
if new_room.password.value
$('#new_room_copy_room_url_with_password').show()
$('#new_room_copy_room_url_with_password').zclip
path:'/vendor/javascripts/ZeroClipboard.swf',
copy: ->
if server_id = parseInt new_room.server.value
server = Server.find server_id
server_ip = server.ip
server_port = server.port
server_auth = server.auth
else
server_ip = new_room.server_ip.value
server_port = parseInt new_room.server_port.value
server_auth = new_room.server_auth.checked
mycard.room_url server_ip, server_port, mycard.room_name(new_room.name.value, new_room.password.value, new_room.pvp.checked, parseInt(new_room.rule.value), parseInt(new_room.mode.value), parseInt(new_room.start_lp.value), parseInt(new_room.start_hand.value), parseInt(new_room.draw_count.value)), null, null, false, server_auth
else
$('#new_room_copy_room_url_with_password').hide()
#$('#login_domain').combobox() #$('#login_domain').combobox()
...@@ -251,6 +285,7 @@ $(document).ready -> ...@@ -251,6 +285,7 @@ $(document).ready ->
$('#logout_button').click -> $('#logout_button').click ->
logout() logout()
setRosterHeight(); setRosterHeight();
$(window).resize(setRosterHeight); $(window).resize(setRosterHeight);
......
...@@ -356,8 +356,51 @@ ...@@ -356,8 +356,51 @@
new_room.name.value = Math.floor(Math.random() * 1000); new_room.name.value = Math.floor(Math.random() * 1000);
new_room.server.value = Server.choice(false, new_room.pvp.ckecked).id; new_room.server.value = Server.choice(false, new_room.pvp.ckecked).id;
new_room.server.onchange(); new_room.server.onchange();
return $('#new_room_dialog').dialog('open'); $('#new_room_dialog').dialog('open');
$('#new_room_copy_room_url').zclip('remove');
return $('#new_room_copy_room_url').zclip({
path: '/vendor/javascripts/ZeroClipboard.swf',
copy: function() {
var server, server_auth, server_id, server_ip, server_port;
if (server_id = parseInt(new_room.server.value)) {
server = Server.find(server_id);
server_ip = server.ip;
server_port = server.port;
server_auth = server.auth;
} else {
server_ip = new_room.server_ip.value;
server_port = parseInt(new_room.server_port.value);
server_auth = new_room.server_auth.checked;
}
return mycard.room_url(server_ip, server_port, mycard.room_name(new_room.name.value, null, new_room.pvp.checked, parseInt(new_room.rule.value), parseInt(new_room.mode.value), parseInt(new_room.start_lp.value), parseInt(new_room.start_hand.value), parseInt(new_room.draw_count.value)), null, null, new_room.password.value.length, server_auth);
}
});
}); });
new_room.password.onchange = function() {
$('#new_room_copy_room_url_with_password').zclip('remove');
if (new_room.password.value) {
$('#new_room_copy_room_url_with_password').show();
return $('#new_room_copy_room_url_with_password').zclip({
path: '/vendor/javascripts/ZeroClipboard.swf',
copy: function() {
var server, server_auth, server_id, server_ip, server_port;
if (server_id = parseInt(new_room.server.value)) {
server = Server.find(server_id);
server_ip = server.ip;
server_port = server.port;
server_auth = server.auth;
} else {
server_ip = new_room.server_ip.value;
server_port = parseInt(new_room.server_port.value);
server_auth = new_room.server_auth.checked;
}
return mycard.room_url(server_ip, server_port, mycard.room_name(new_room.name.value, new_room.password.value, new_room.pvp.checked, parseInt(new_room.rule.value), parseInt(new_room.mode.value), parseInt(new_room.start_lp.value), parseInt(new_room.start_hand.value), parseInt(new_room.draw_count.value)), null, null, false, server_auth);
}
});
} else {
return $('#new_room_copy_room_url_with_password').hide();
}
};
$('#login_button').click(function() { $('#login_button').click(function() {
return login(); return login();
}); });
......
...@@ -244,6 +244,8 @@ ...@@ -244,6 +244,8 @@
<input class="newRoomSubmit" type="submit" value="确定"/> <input class="newRoomSubmit" type="submit" value="确定"/>
<button type="button" id="new_room_copy_room_url" title="Click to copy me.">复制房间地址</button>
<button type="button" id="new_room_copy_room_url_with_password" title="Click to copy me." hidden>复制房间地址(带密码)</button>
</form> </form>
</div> </div>
<div id="join_private_room_dialog" hidden> <div id="join_private_room_dialog" hidden>
...@@ -279,6 +281,7 @@ ...@@ -279,6 +281,7 @@
<script src="/vendor/javascripts/spine/relation.js"></script> <script src="/vendor/javascripts/spine/relation.js"></script>
<script src="/vendor/javascripts/underscore-min.js"></script> <script src="/vendor/javascripts/underscore-min.js"></script>
<script src="/vendor/javascripts/stroll.min.js"></script> <script src="/vendor/javascripts/stroll.min.js"></script>
<script src="/vendor/javascripts/jquery.zclip.min.js"></script>
<script src="/vendor/javascripts/mycard.js"></script> <script src="/vendor/javascripts/mycard.js"></script>
......
/*!
* zeroclipboard
* The Zero Clipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface.
* Copyright 2012 Jon Rohan, James M. Greene, .
* Released under the MIT license
* http://jonrohan.github.com/ZeroClipboard/
* v1.1.6
*/(function(){"use strict";var a=function(a,b){var c=a.style[b];a.currentStyle?c=a.currentStyle[b]:window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null).getPropertyValue(b));if(c=="auto"&&b=="cursor"){var d=["a"];for(var e=0;e<d.length;e++)if(a.tagName.toLowerCase()==d[e])return"pointer"}return c},b=function(a){if(!l.prototype._singleton)return;a||(a=window.event);var b;this!==window?b=this:a.target?b=a.target:a.srcElement&&(b=a.srcElement),l.prototype._singleton.setCurrent(b)},c=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},d=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},e=function(a,b){if(a.addClass)return a.addClass(b),a;if(b&&typeof b=="string"){var c=(b||"").split(/\s+/);if(a.nodeType===1)if(!a.className)a.className=b;else{var d=" "+a.className+" ",e=a.className;for(var f=0,g=c.length;f<g;f++)d.indexOf(" "+c[f]+" ")<0&&(e+=" "+c[f]);a.className=e.replace(/^\s+|\s+$/g,"")}}return a},f=function(a,b){if(a.removeClass)return a.removeClass(b),a;if(b&&typeof b=="string"||b===undefined){var c=(b||"").split(/\s+/);if(a.nodeType===1&&a.className)if(b){var d=(" "+a.className+" ").replace(/[\n\t]/g," ");for(var e=0,f=c.length;e<f;e++)d=d.replace(" "+c[e]+" "," ");a.className=d.replace(/^\s+|\s+$/g,"")}else a.className=""}return a},g=function(b){var c={left:0,top:0,width:b.width||b.offsetWidth||0,height:b.height||b.offsetHeight||0,zIndex:9999},d=a(b,"zIndex");d&&d!="auto"&&(c.zIndex=parseInt(d,10));while(b){var e=parseInt(a(b,"borderLeftWidth"),10),f=parseInt(a(b,"borderTopWidth"),10);c.left+=isNaN(b.offsetLeft)?0:b.offsetLeft,c.left+=isNaN(e)?0:e,c.top+=isNaN(b.offsetTop)?0:b.offsetTop,c.top+=isNaN(f)?0:f,b=b.offsetParent}return c},h=function(a){return(a.indexOf("?")>=0?"&":"?")+"nocache="+(new Date).getTime()},i=function(a){var b=[];return a.trustedDomains&&(a.trustedDomains.length?b.push("trustedDomain="+a.trustedDomains.join(",")):b.push("trustedDomain="+a.trustedDomains)),b.join("&")},j=function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},k=function(a){if(typeof a=="string")throw new TypeError("ZeroClipboard doesn't accept query strings.");return a.length?a:[a]},l=function(a,b){a&&(l.prototype._singleton||this).glue(a);if(l.prototype._singleton)return l.prototype._singleton;l.prototype._singleton=this,this.options={};for(var c in o)this.options[c]=o[c];for(var d in b)this.options[d]=b[d];this.handlers={},l.detectFlashSupport()&&p()},m,n=[];l.prototype.setCurrent=function(b){m=b,this.reposition(),this.setText(this.options.text||b.getAttribute("data-clipboard-text")),b.getAttribute("title")&&this.setTitle(b.getAttribute("title")),this.setHandCursor(a(b,"cursor")=="pointer")},l.prototype.setText=function(a){a&&a!==""&&(this.options.text=a,this.ready()&&this.flashBridge.setText(a))},l.prototype.setTitle=function(a){a&&a!==""&&this.htmlBridge.setAttribute("title",a)},l.prototype.setSize=function(a,b){this.ready()&&this.flashBridge.setSize(a,b)},l.prototype.setHandCursor=function(a){this.ready()&&this.flashBridge.setHandCursor(a)},l.version="1.1.6";var o={moviePath:"ZeroClipboard.swf",trustedDomains:null,text:null,hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active"};l.setDefaults=function(a){for(var b in a)o[b]=a[b]},l.destroy=function(){l.prototype._singleton.unglue(n);var a=l.prototype._singleton.htmlBridge;a.parentNode.removeChild(a),delete l.prototype._singleton},l.detectFlashSupport=function(){var a=!1;try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(a=!0)}catch(b){navigator.mimeTypes["application/x-shockwave-flash"]&&(a=!0)}return a};var p=function(){var a=l.prototype._singleton;a.htmlBridge=document.getElementById("global-zeroclipboard-html-bridge");if(a.htmlBridge){a.flashBridge=document["global-zeroclipboard-flash-bridge"];return}var b=' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="'+a.options.moviePath+h(a.options.moviePath)+'"/> <param name="allowScriptAccess" value="always" /> <param name="scale" value="exactfit"> <param name="loop" value="false" /> <param name="menu" value="false" /> <param name="quality" value="best" /> <param name="bgcolor" value="#ffffff" /> <param name="wmode" value="transparent"/> <param name="flashvars" value="'+i(a.options)+'"/> <embed src="'+a.options.moviePath+h(a.options.moviePath)+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global-zeroclipboard-flash-bridge" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+i(a.options)+'" scale="exactfit"> </embed> </object>';a.htmlBridge=document.createElement("div"),a.htmlBridge.id="global-zeroclipboard-html-bridge",a.htmlBridge.setAttribute("class","global-zeroclipboard-container"),a.htmlBridge.setAttribute("data-clipboard-ready",!1),a.htmlBridge.style.position="absolute",a.htmlBridge.style.left="-9999px",a.htmlBridge.style.top="-9999px",a.htmlBridge.style.width="15px",a.htmlBridge.style.height="15px",a.htmlBridge.style.zIndex="9999",a.htmlBridge.innerHTML=b,document.body.appendChild(a.htmlBridge),a.flashBridge=document["global-zeroclipboard-flash-bridge"]};l.prototype.resetBridge=function(){this.htmlBridge.style.left="-9999px",this.htmlBridge.style.top="-9999px",this.htmlBridge.removeAttribute("title"),this.htmlBridge.removeAttribute("data-clipboard-text"),f(m,this.options.activeClass),m=null},l.prototype.ready=function(){var a=this.htmlBridge.getAttribute("data-clipboard-ready");return a==="true"||a===!0},l.prototype.reposition=function(){if(!m)return!1;var a=g(m);this.htmlBridge.style.top=a.top+"px",this.htmlBridge.style.left=a.left+"px",this.htmlBridge.style.width=a.width+"px",this.htmlBridge.style.height=a.height+"px",this.htmlBridge.style.zIndex=a.zIndex+1,this.setSize(a.width,a.height)},l.dispatch=function(a,b){l.prototype._singleton.receiveEvent(a,b)},l.prototype.on=function(a,b){var c=a.toString().split(/\s/g);for(var d=0;d<c.length;d++)a=c[d].toLowerCase().replace(/^on/,""),this.handlers[a]||(this.handlers[a]=b);this.handlers.noflash&&!l.detectFlashSupport()&&this.receiveEvent("onNoFlash",null)},l.prototype.addEventListener=l.prototype.on,l.prototype.receiveEvent=function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");var c=m;switch(a){case"load":if(b&&parseFloat(b.flashVersion.replace(",",".").replace(/[^0-9\.]/gi,""))<10){this.receiveEvent("onWrongFlash",{flashVersion:b.flashVersion});return}this.htmlBridge.setAttribute("data-clipboard-ready",!0);break;case"mouseover":e(c,this.options.hoverClass);break;case"mouseout":f(c,this.options.hoverClass),this.resetBridge();break;case"mousedown":e(c,this.options.activeClass);break;case"mouseup":f(c,this.options.activeClass);break;case"complete":this.options.text=null}if(this.handlers[a]){var d=this.handlers[a];typeof d=="function"?d.call(c,this,b):typeof d=="string"&&window[d].call(c,this,b)}},l.prototype.glue=function(a){a=k(a);for(var d=0;d<a.length;d++)j(a[d],n)==-1&&(n.push(a[d]),c(a[d],"mouseover",b))},l.prototype.unglue=function(a){a=k(a);for(var c=0;c<a.length;c++){d(a[c],"mouseover",b);var e=j(a[c],n);e!=-1&&n.splice(e,1)}},typeof module!="undefined"?module.exports=l:window.ZeroClipboard=l})();
\ No newline at end of file
/*
* zClip :: jQuery ZeroClipboard v1.1.1
* http://steamdev.com/zclip
*
* Copyright 2011, SteamDev
* Released under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Date: Wed Jun 01, 2011
*/
(function(a){a.fn.zclip=function(c){if(typeof c=="object"&&!c.length){var b=a.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:true,setHandCursor:true,setCSSEffects:true},c);return this.each(function(){var e=a(this);if(e.is(":visible")&&(typeof b.copy=="string"||a.isFunction(b.copy))){ZeroClipboard.setMoviePath(b.path);var d=new ZeroClipboard.Client();if(a.isFunction(b.copy)){e.bind("zClip_copy",b.copy)}if(a.isFunction(b.beforeCopy)){e.bind("zClip_beforeCopy",b.beforeCopy)}if(a.isFunction(b.afterCopy)){e.bind("zClip_afterCopy",b.afterCopy)}d.setHandCursor(b.setHandCursor);d.setCSSEffects(b.setCSSEffects);d.addEventListener("mouseOver",function(f){e.trigger("mouseenter")});d.addEventListener("mouseOut",function(f){e.trigger("mouseleave")});d.addEventListener("mouseDown",function(f){e.trigger("mousedown");if(!a.isFunction(b.copy)){d.setText(b.copy)}else{d.setText(e.triggerHandler("zClip_copy"))}if(a.isFunction(b.beforeCopy)){e.trigger("zClip_beforeCopy")}});d.addEventListener("complete",function(f,g){if(a.isFunction(b.afterCopy)){e.trigger("zClip_afterCopy")}else{if(g.length>500){g=g.substr(0,500)+"...\n\n("+(g.length-500)+" characters not shown)"}e.removeClass("hover");alert("Copied text to clipboard:\n\n "+g)}if(b.clickAfter){e.trigger("click")}});d.glue(e[0],e.parent()[0]);a(window).bind("load resize",function(){d.reposition()})}})}else{if(typeof c=="string"){return this.each(function(){var f=a(this);c=c.toLowerCase();var e=f.data("zclipId");var d=a("#"+e+".zclip");if(c=="remove"){d.remove();f.removeClass("active hover")}else{if(c=="hide"){d.hide();f.removeClass("active hover")}else{if(c=="show"){d.show()}}}})}}}})(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(!a.addClass){a.hide=function(){this.style.display="none"};a.show=function(){this.style.display=""};a.addClass=function(b){this.removeClass(b);this.className+=" "+b};a.removeClass=function(d){var e=this.className.split(/\s+/);var b=-1;for(var c=0;c<e.length;c++){if(e[c]==d){b=c;c=e.length}}if(b>-1){e.splice(b,1);this.className=e.join(" ")}return this};a.hasClass=function(b){return !!this.className.match(new RegExp("\\s*"+b+"\\s*"))}}return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c)}},register:function(b,a){this.clients[b]=a},getDOMObjectPosition:function(c,a){var b={left:0,top:0,width:c.width?c.width:c.offsetWidth,height:c.height?c.height:c.offsetHeight};if(c&&(c!=a)){b.left+=c.offsetLeft;b.top+=c.offsetTop}return b},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a)}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(d,b,e){this.domElement=ZeroClipboard.$(d);var f=99;if(this.domElement.style.zIndex){f=parseInt(this.domElement.style.zIndex,10)+1}if(typeof(b)=="string"){b=ZeroClipboard.$(b)}else{if(typeof(b)=="undefined"){b=document.getElementsByTagName("body")[0]}}var c=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div");this.div.className="zclip";this.div.id="zclip-"+this.movieId;$(this.domElement).data("zclipId","zclip-"+this.movieId);var a=this.div.style;a.position="absolute";a.left=""+c.left+"px";a.top=""+c.top+"px";a.width=""+c.width+"px";a.height=""+c.height+"px";a.zIndex=f;if(typeof(e)=="object"){for(addedStyle in e){a[addedStyle]=e[addedStyle]}}b.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height)},getHTML:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+b+'"/><param name="wmode" value="transparent"/></object>'}else{c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+d+'" height="'+a+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+b+'" wmode="transparent" />'}return c},hide:function(){if(this.div){this.div.style.left="-2000px"}},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null;this.div=null}},reposition:function(c){if(c){this.domElement=ZeroClipboard.$(c);if(!this.domElement){this.hide()}}if(this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement);var a=this.div.style;a.left=""+b.left+"px";a.top=""+b.top+"px"}},setText:function(a){this.clipText=a;if(this.ready){this.movie.setText(a)}},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;if(this.ready){this.movie.setHandCursor(a)}},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(d,f){d=d.toString().toLowerCase().replace(/^on/,"");switch(d){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=true;return}this.ready=true;try{this.movie.setText(this.clipText)}catch(h){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(h){}break;case"mouseover":if(this.domElement&&this.cssEffects){this.domElement.addClass("hover");if(this.recoverActive){this.domElement.addClass("active")}}break;case"mouseout":if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true}this.domElement.removeClass("hover")}break;case"mousedown":if(this.domElement&&this.cssEffects){this.domElement.addClass("active")}break;case"mouseup":if(this.domElement&&this.cssEffects){this.domElement.removeClass("active");this.recoverActive=false}break}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b<a;b++){var g=this.handlers[d][b];if(typeof(g)=="function"){g(this,f)}else{if((typeof(g)=="object")&&(g.length==2)){g[0][g[1]](this,f)}else{if(typeof(g)=="string"){window[g](this,f)}}}}}}};
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
result result
#127.0.0.1:8087/test #127.0.0.1:8087/test
@mycard.room_string = (ip,port,room,username,password)-> @mycard.room_string = (ip,port,room,username,password, _private, server_auth)->
result = '' result = ''
if username if username
result += encodeURIComponent(username) result += encodeURIComponent(username)
...@@ -26,15 +26,21 @@ ...@@ -26,15 +26,21 @@
result += ':' + encodeURIComponent(password) result += ':' + encodeURIComponent(password)
result += '@' result += '@'
result += ip + ':' + port + '/' + encodeURIComponent(room) result += ip + ':' + port + '/' + encodeURIComponent(room)
if _private
result += '?private=true'
if server_auth
result += '&server_auth=true'
else if server_auth
result += '?server_auth=true'
result result
#http://my-card.in/rooms/127.0.0.1:8087/test #http://my-card.in/rooms/127.0.0.1:8087/test
@mycard.room_url = (ip,port,room,username,password)-> @mycard.room_url = (ip,port,room,username,password, _private, server_auth)->
result = 'http://my-card.in/rooms/' + @room_string(ip,port,room,username,password) result = 'http://my-card.in/rooms/' + @room_string(ip,port,room,username,password, _private, server_auth)
#mycard://127.0.0.1:8087/test #mycard://127.0.0.1:8087/test
@mycard.room_url_mycard = (ip,port,room,username,password)-> @mycard.room_url_mycard = (ip,port,room,username,password, _private, server_auth)->
result = 'mycard://' + @room_string(ip,port,room,username,password) result = 'mycard://' + @room_string(ip,port,room,username,password, _private, server_auth)
@mycard.join = (ip,port,room,username,password)-> @mycard.join = (ip,port,room,username,password, _private, server_auth)->
window.location.href = @room_url_mycard(ip,port,room,username,password) window.location.href = @room_url_mycard(ip,port,room,username,password, _private, server_auth)
\ No newline at end of file \ No newline at end of file
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
return result; return result;
}; };
this.mycard.room_string = function(ip, port, room, username, password) { this.mycard.room_string = function(ip, port, room, username, password, _private, server_auth) {
var result; var result;
result = ''; result = '';
if (username) { if (username) {
...@@ -54,21 +54,29 @@ ...@@ -54,21 +54,29 @@
result += '@'; result += '@';
} }
result += ip + ':' + port + '/' + encodeURIComponent(room); result += ip + ':' + port + '/' + encodeURIComponent(room);
if (_private) {
result += '?private=true';
if (server_auth) {
result += '&server_auth=true';
}
} else if (server_auth) {
result += '?server_auth=true';
}
return result; return result;
}; };
this.mycard.room_url = function(ip, port, room, username, password) { this.mycard.room_url = function(ip, port, room, username, password, _private, server_auth) {
var result; var result;
return result = 'http://my-card.in/rooms/' + this.room_string(ip, port, room, username, password); return result = 'http://my-card.in/rooms/' + this.room_string(ip, port, room, username, password, _private, server_auth);
}; };
this.mycard.room_url_mycard = function(ip, port, room, username, password) { this.mycard.room_url_mycard = function(ip, port, room, username, password, _private, server_auth) {
var result; var result;
return result = 'mycard://' + this.room_string(ip, port, room, username, password); return result = 'mycard://' + this.room_string(ip, port, room, username, password, _private, server_auth);
}; };
this.mycard.join = function(ip, port, room, username, password) { this.mycard.join = function(ip, port, room, username, password, _private, server_auth) {
return window.location.href = this.room_url_mycard(ip, port, room, username, password); return window.location.href = this.room_url_mycard(ip, port, room, username, password, _private, server_auth);
}; };
}).call(this); }).call(this);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment