Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For creating qr-codes this project uses qrcodejs (https://github.com/davidshimjs/qrcodejs) which is licensed under MIT License. This license can be found in the qrcodejs sub-directory.
4 changes: 4 additions & 0 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ <h3>Settings for YOURLS</h3>
<input type="checkbox" id="keyword" /> Ask for a keyword
</p>

<p>
<input type="checkbox" id="qrcode" /> Create QR-Code
</p>

<p>
<span id='info'></span><br/>
<input type="button" id="save" value="Save Settings" />
Expand Down
2 changes: 2 additions & 0 deletions html/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
<title>YOURLS-ChromeExtension</title>
<link href="../css/style.css?1" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/popup.js"></script>
<script type="text/javascript" src="../qrcodejs/qrcode.min.js"></script>
</head>
<body id="___yourls_body">
<div id='___yourls_div'>
</div>
<div id="qrcode"></div>
</body>
</html>
5 changes: 5 additions & 0 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function RestoreOptions ()
var secret = document.getElementById ('secret');
var keyword = document.getElementById ('keyword');
var wait = document.getElementById ('wait');
var qrcode = document.getElementById ('qrcode');

if (typeof localStorage['yourls_url'] !== 'undefined')
url.value = localStorage['yourls_url'];
Expand All @@ -39,6 +40,8 @@ function RestoreOptions ()
keyword.checked = localStorage['yourls_keyword'] === "true";
if (typeof localStorage['yourls_wait'] !== 'undefined')
wait.value = localStorage['yourls_wait'];
if (typeof localStorage['yourls_qrcode'] !== 'undefined')
qrcode.checked = localStorage['yourls_qrcode'] === "true";

}
function SaveOptions (e)
Expand All @@ -48,10 +51,12 @@ function SaveOptions (e)
var info = document.getElementById ('info');
var keyword = document.getElementById ('keyword');
var wait = document.getElementById ('wait');
var qrcode = document.getElementById ('qrcode');

localStorage['yourls_url'] = url.value;
localStorage['yourls_secret'] = secret.value;
localStorage['yourls_keyword'] = keyword.checked;
localStorage['yourls_qrcode'] = qrcode.checked;
if (isInt (wait.value))
localStorage['yourls_wait'] = wait.value;

Expand Down
13 changes: 13 additions & 0 deletions js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ function shorten (url)
{
logg ("popup reveives message: shortenLink");
updateShort (response.url);

if (localStorage['yourls_qrcode'] == "true"){
var createqrcode = new QRCode("qrcode", {
text: response.url,
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.M
});
document.getElementById("qrcode").style.marginTop = '20px';
}

// select the short url -> ^c
var range = document.createRange();
range.selectNode(document.getElementById ("___yourls_done"));
Expand Down
4 changes: 4 additions & 0 deletions qrcodejs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store

.idea
.project
14 changes: 14 additions & 0 deletions qrcodejs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The MIT License (MIT)
---------------------
Copyright (c) 2012 davidshimjs

Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 changes: 46 additions & 0 deletions qrcodejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# QRCode.js
QRCode.js is javascript library for making QRCode. QRCode.js supports Cross-browser with HTML5 Canvas and table tag in DOM.
QRCode.js has no dependencies.

## Basic Usages
```
<div id="qrcode"></div>
<script type="text/javascript">
new QRCode(document.getElementById("qrcode"), "http://jindo.dev.naver.com/collie");
</script>
```

or with some options

```
<div id="qrcode"></div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: "http://jindo.dev.naver.com/collie",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
</script>
```

and you can use some methods

```
qrcode.clear(); // clear the code.
qrcode.makeCode("http://naver.com"); // make another code.
```

## Browser Compatibility
IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile, ETC.

## License
MIT License

## Contact
twitter @davidshimjs

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/davidshimjs/qrcodejs/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

18 changes: 18 additions & 0 deletions qrcodejs/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "qrcode.js",
"version": "0.0.1",
"homepage": "https://github.com/davidshimjs/qrcodejs",
"authors": [
"Sangmin Shim", "Sangmin Shim <ssm0123@gmail.com> (http://jaguarjs.com)"
],
"description": "Cross-browser QRCode generator for javascript",
"main": "qrcode.js",
"ignore": [
"bower_components",
"node_modules",
"index.html",
"index.svg",
"jquery.min.js",
"qrcode.min.js"
]
}
47 changes: 47 additions & 0 deletions qrcodejs/index-svg.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!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="ko" lang="ko">
<head>
<title>Cross-Browser QRCode generator for Javascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="qrcode.js"></script>
</head>
<body>
<input id="text" type="text" value="http://jindo.dev.naver.com/collie" style="width:80%" />
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="qrcode"/>
</svg>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 100,
height : 100,
useSVG: true
});

function makeCode () {
var elText = document.getElementById("text");

if (!elText.value) {
alert("Input a text");
elText.focus();
return;
}

qrcode.makeCode(elText.value);
}

makeCode();

$("#text").
on("blur", function () {
makeCode();
}).
on("keydown", function (e) {
if (e.keyCode == 13) {
makeCode();
}
});
</script>
</body>
</html>
44 changes: 44 additions & 0 deletions qrcodejs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!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="ko" lang="ko">
<head>
<title>Cross-Browser QRCode generator for Javascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="qrcode.js"></script>
</head>
<body>
<input id="text" type="text" value="http://jindo.dev.naver.com/collie" style="width:80%" /><br />
<div id="qrcode" style="width:100px; height:100px; margin-top:15px;"></div>

<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 100,
height : 100
});

function makeCode () {
var elText = document.getElementById("text");

if (!elText.value) {
alert("Input a text");
elText.focus();
return;
}

qrcode.makeCode(elText.value);
}

makeCode();

$("#text").
on("blur", function () {
makeCode();
}).
on("keydown", function (e) {
if (e.keyCode == 13) {
makeCode();
}
});
</script>
</body>
37 changes: 37 additions & 0 deletions qrcodejs/index.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions qrcodejs/jquery.min.js

Large diffs are not rendered by default.

Loading