soocrate-core
Version:
this is the core of soocrate application
194 lines (165 loc) • 8.66 kB
HTML
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../">
<title data-ice="title">view/link.js | jquery-crate</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="Cratify tool that turns a division into a distributed and decentralized collaborative editor"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="jquery-crate"><meta property="twitter:description" content="Cratify tool that turns a division into a distributed and decentralized collaborative editor"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./">Home</a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/haouarin/jquery-crate.git"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/view/marker.js~Marker.html">Marker</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-Editor">Editor</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-LinkView">LinkView</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-StatesHeader">StatesHeader</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">view/link.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">
function LinkView(container, id){
this.linkContainer = jQuery('<div>').appendTo(container)
.css('position', 'relative')
.css('top', '0px')
.css('width', '60%')
.css('z-index', '0')
.css('opacity', '0.9')
.attr('id','linkContainer')
.hide();
// #0 qr code modal
var qrCodeModal = jQuery('<div>').appendTo(container)
.attr('id', 'modalQRCode'+id)
.attr('tabindex','-1')
.attr('role','dialog')
.attr('aria-labelledby','modalQRCodeLabel')
.attr('aria-hidden', 'true')
.addClass('modal');
var qrCodeModalDialog = jQuery('<div>').appendTo(qrCodeModal)
.addClass('modal-dialog');
var qrCodeModalContent = jQuery('<div>').appendTo(qrCodeModalDialog)
.addClass('modal-content text-center');
this.qrcodeCanvas = jQuery('<div>');
qrCodeModalContent.append(jQuery('<br>'))
.append(this.qrcodeCanvas)
.append(jQuery('<br>'));
// #1 overall division
this.alert = jQuery('<div>').appendTo(this.linkContainer);
// #2 cross to close the division
this.dismiss = jQuery('<button>').appendTo(this.alert)
.attr('type', 'button')
.addClass('close')
.html('<span aria-hidden="true">&times;</span><span class="sr-only"> '+
'Close </span>');
var rowContainer = jQuery('<div>').appendTo(this.alert)
.addClass('container');
var inputGroup = jQuery('<div>').appendTo(rowContainer)
.addClass('input-group')
.attr('style','margin-left: -16px;');
this.input = jQuery('<input>').appendTo(inputGroup)
.attr('type', 'text')
.attr('id', 'sessionUrl')
.attr('placeholder', 'Nothing to see here, move along.')
.addClass('form-control');
var inputGroup2 = jQuery('<span>').appendTo(inputGroup)
.addClass('input-group-btn');
this.qrcode = jQuery('<button>').appendTo(inputGroup2)
.attr('aria-label', 'QR-code')
.attr('type', 'button')
.attr('data-target', '#modalQRCode'+id)
.attr('data-toggle', 'modal')
.addClass('btn btn-default')
.html('<i class="fa fa-qrcode"></i> QR-Code');
this.action = jQuery('<button id="copyButton">').appendTo(inputGroup2)
.attr('aria-label', 'Go!')
.attr('type', 'button')
.addClass('btn btn-default')
.html('Go!')
.css('z-index', '15');
var self = this;
this.dismiss.unbind("click").click(function(){self.linkContainer.hide();});
};
LinkView.prototype.printLink = function(link){
this.linkContainer.show();
this.action.html('<i class="fa fa-clipboard"></i> Copy');
this.action.attr("aria-label", "Copy to clipboard");
this.input.attr("readonly","readonly");
this.input.val(link);
this.qrcode.show();
};
LinkView.prototype.printLaunchLink = function(link){
this.printLink(link);
this.input.attr("placeholder",
"A link will appear in this field, give it to your "+
"friend!");
this.action.unbind("click");
this.qrcode.hide();
return this.action;
};
LinkView.prototype.printAnswerLink = function(link){
this.printLink(link);
this.input.attr("placeholder",
"A link will appear in this field. Please give it "+
"back to your friend.");
this.action.unbind("click");
this.qrcode.hide();
return this.action;
};
LinkView.prototype.askLink = function(){
this.linkContainer.show();
this.alert.removeClass("alert-warning").addClass("alert-info");
this.action.html('Go!');
this.action.attr("aria-label", "Stamp the ticket");
this.input.removeAttr("readonly");
this.input.val("");
this.action.unbind("click");
this.qrcode.hide();
};
LinkView.prototype.askLaunchLink = function(){
this.askLink();
this.input.attr("placeholder",
"Please, copy the ticket of your friend here to stamp "+
"it!");
this.qrcode.hide();
return this.action;
};
LinkView.prototype.askAnswerLink = function(){
this.askLink();
this.input.attr("placeholder", "Copy the stamped ticket to confirm "+
"your arrival in the network");
this.qrcode.hide();
return this.action;
};
LinkView.prototype.hide = function(){
this.linkContainer.hide();
};
module.exports = LinkView;
</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.0.4)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>