Skip to content

Instantly share code, notes, and snippets.

@Muges
Created July 8, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Muges/9cd22b8f7395e61073cc to your computer and use it in GitHub Desktop.
Save Muges/9cd22b8f7395e61073cc to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QRShaarli</title>
<!-- http://neocotic.com/qr.js/ -->
<script src="qr.min.js" type="text/javascript"></script>
</head>
<body>
<form id="qrform">
URL :<br />
<input id="post" type="text"><br />
Titre :<br />
<input id="title" type="text"><br />
Description :<br />
<textarea id="description"></textarea><br />
Tags :<br />
<input id="tags" type="text"><br />
</form>
<canvas id="qrcode"></canvas>
<script type="text/javascript">
// Adresse de votre shaarli
var root = "";
var post_input = document.getElementById("post");
var title_input = document.getElementById("title");
var tags_input = document.getElementById("tags");
var desc_input = document.getElementById("description");
function generate_qrcode() {
var post = encodeURIComponent(post_input.value);
var title = encodeURIComponent(title_input.value);
var tags = encodeURIComponent(tags_input.value);
var description = encodeURIComponent(desc_input.value);
var url = root + '/?post=' + post + '&title=' + title + '&tags=' + tags + '&description=' + description + '&source=bookmarklet';
qr.canvas({
canvas: document.getElementById('qrcode'),
value: url,
size:10
});
};
post_input.oninput = generate_qrcode;
title_input.oninput = generate_qrcode;
tags_input.oninput = generate_qrcode;
desc_input.oninput = generate_qrcode;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment