Okay, I have to add jQuery.qrcode to the repo then

This commit is contained in:
Falkvinge
2016-11-23 20:21:56 +01:00
parent f8de121455
commit 8200212589
8 changed files with 1351 additions and 2 deletions
-1
View File
@@ -203,4 +203,3 @@ Site/hotwallet*
*.csproj.[Dd]ot[Ss]ettings
#Packages provided by NuGet
Site/Scripts/*qrcode*
+1 -1
View File
@@ -519,7 +519,7 @@
if (newValue) // this is a boolean, so "== true" is implicit
{
<%= this.ModalMasterEnableBitId.ClientID %>_open();
$('div#divBitIdEnable').qrcode({ text: "https://falkvinge.net/", size: 400, quiet: 4 });
$('div#divBitIdEnable').qrcode({ text: "https://falkvinge.net/", size:400, quiet: 4 });
}
else
{ // The user is requesting their 2FA be removed
+89
View File
@@ -0,0 +1,89 @@
(function( $ ){
$.fn.qrcode = function(options) {
// if options is string,
if( typeof options === 'string' ){
options = { text: options };
}
// set default values
// typeNumber < 1 for automatic calculation
options = $.extend( {}, {
render : "canvas",
width : 256,
height : 256,
typeNumber : -1,
correctLevel : QRErrorCorrectLevel.H,
background : "#ffffff",
foreground : "#000000"
}, options);
var createCanvas = function(){
// create the qrcode itself
var qrcode = new QRCode(options.typeNumber, options.correctLevel);
qrcode.addData(options.text);
qrcode.make();
// create canvas element
var canvas = document.createElement('canvas');
canvas.width = options.width;
canvas.height = options.height;
var ctx = canvas.getContext('2d');
// compute tileW/tileH based on options.width/options.height
var tileW = options.width / qrcode.getModuleCount();
var tileH = options.height / qrcode.getModuleCount();
// draw in the canvas
for( var row = 0; row < qrcode.getModuleCount(); row++ ){
for( var col = 0; col < qrcode.getModuleCount(); col++ ){
ctx.fillStyle = qrcode.isDark(row, col) ? options.foreground : options.background;
var w = (Math.ceil((col+1)*tileW) - Math.floor(col*tileW));
var h = (Math.ceil((row+1)*tileW) - Math.floor(row*tileW));
ctx.fillRect(Math.round(col*tileW),Math.round(row*tileH), w, h);
}
}
// return just built canvas
return canvas;
}
// from Jon-Carlos Rivera (https://github.com/imbcmdth)
var createTable = function(){
// create the qrcode itself
var qrcode = new QRCode(options.typeNumber, options.correctLevel);
qrcode.addData(options.text);
qrcode.make();
// create table element
var $table = $('<table></table>')
.css("width", options.width+"px")
.css("height", options.height+"px")
.css("border", "0px")
.css("border-collapse", "collapse")
.css('background-color', options.background);
// compute tileS percentage
var tileW = options.width / qrcode.getModuleCount();
var tileH = options.height / qrcode.getModuleCount();
// draw in the table
for(var row = 0; row < qrcode.getModuleCount(); row++ ){
var $row = $('<tr></tr>').css('height', tileH+"px").appendTo($table);
for(var col = 0; col < qrcode.getModuleCount(); col++ ){
$('<td></td>')
.css('width', tileW+"px")
.css('background-color', qrcode.isDark(row, col) ? options.foreground : options.background)
.appendTo($row);
}
}
// return just built canvas
return $table;
}
return this.each(function(){
var element = options.render == "canvas" ? createCanvas() : createTable();
$(element).appendTo(this);
});
};
})( jQuery );
+4
View File
@@ -0,0 +1,4 @@
(function(n){n.fn.qrcode=function(t){typeof t=="string"&&(t={text:t});t=n.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,correctLevel:QRErrorCorrectLevel.H,background:"#ffffff",foreground:"#000000"},t);var i=function(){var n=new QRCode(t.typeNumber,t.correctLevel),u,i,r,o,s;n.addData(t.text);n.make();u=document.createElement("canvas");u.width=t.width;u.height=t.height;var e=u.getContext("2d"),f=t.width/n.getModuleCount(),h=t.height/n.getModuleCount();for(i=0;i<n.getModuleCount();i++)for(r=0;r<n.getModuleCount();r++)e.fillStyle=n.isDark(i,r)?t.foreground:t.background,o=Math.ceil((r+1)*f)-Math.floor(r*f),s=Math.ceil((i+1)*f)-Math.floor(i*f),e.fillRect(Math.round(r*f),Math.round(i*h),o,s);return u},r=function(){var i=new QRCode(t.typeNumber,t.correctLevel),r,e,u;i.addData(t.text);i.make();var f=n("<table><\/table>").css("width",t.width+"px").css("height",t.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",t.background),o=t.width/i.getModuleCount(),s=t.height/i.getModuleCount();for(r=0;r<i.getModuleCount();r++)for(e=n("<tr><\/tr>").css("height",s+"px").appendTo(f),u=0;u<i.getModuleCount();u++)n("<td><\/td>").css("width",o+"px").css("background-color",i.isDark(r,u)?t.foreground:t.background).appendTo(e);return f};return this.each(function(){var u=t.render=="canvas"?i():r();n(u).appendTo(this)})}})(jQuery);
/*
//# sourceMappingURL=jquery.qrcode.min.js.map
*/
+8
View File
@@ -0,0 +1,8 @@
{
"version":3,
"file":"jquery.qrcode.min.js",
"lineCount":1,
"mappings":"CAAC,QAAQ,CAAEA,CAAF,CAAK,CACbA,CAACC,GAAGC,OAAQ,CAAEC,QAAQ,CAACC,CAAD,CAAU,CAE3B,OAAOA,CAAQ,EAAI,Q,GACtBA,CAAQ,CAAE,CAAE,IAAI,CAAEA,CAAR,EAAiB,CAK5BA,CAAQ,CAAEJ,CAACK,OAAO,CAAE,CAAA,CAAE,CAAE,CACvB,MAAQ,CAAE,QAAQ,CAClB,KAAO,CAAE,GAAG,CACZ,MAAQ,CAAE,GAAG,CACb,UAAW,CAAE,EAAE,CACf,YAAa,CAAEC,mBAAmBC,EAAE,CACf,UAAgB,CAAE,SAAS,CAC3B,UAAgB,CAAE,SAPhB,CAQvB,CAAEH,CARe,CAQP,CAEX,IAAII,EAAe,QAAQ,CAAA,CAAE,CAE5B,IAAIN,EAAS,IAAIO,MAAM,CAACL,CAAOM,WAAW,CAAEN,CAAOO,aAA5B,EAKnBC,EAUKC,EACCC,EAEJC,EACAC,CAnB2D,CACjEd,CAAMe,QAAQ,CAACb,CAAOc,KAAR,CAAc,CAC5BhB,CAAMiB,KAAK,CAAA,CAAE,CAGTP,CAAO,CAAEQ,QAAQC,cAAc,CAAC,QAAD,C,CACnCT,CAAMU,MAAO,CAAElB,CAAOkB,MAAM,CAC5BV,CAAMW,OAAQ,CAAEnB,CAAOmB,OAAO,CAC9B,IAAIC,EAAOZ,CAAMa,WAAW,CAAC,IAAD,EAGxBC,EAAQtB,CAAOkB,MAAQ,CAAEpB,CAAMyB,eAAe,CAAA,EAC9CC,EAAQxB,CAAOmB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CAAE,KAAX,CACJA,IAAI,CAAC,iBAAiB,CAAE,UAApB,CACJA,IAAI,CAAC,kBAAkB,CAAErC,CAAO4B,WAA5B,EAGDN,EAAQtB,CAAOkB,MAAO,CAAEpB,CAAMyB,eAAe,CAAA,EAC7CC,EAAQxB,CAAOmB,OAAQ,CAAErB,CAAMyB,eAAe,CAAA,CAJL,CAO7C,IAAQd,CAAI,CAAE,CAAC,CAAEA,CAAI,CAAEX,CAAMyB,eAAe,CAAA,CAAE,CAAEd,CAAG,EAAnD,CAGC,IAFI0B,CAAK,CAAEvC,CAAC,CAAC,YAAD,CAAayC,IAAI,CAAC,QAAQ,CAAEb,CAAK,CAAC,IAAjB,CAAsBc,SAAS,CAACF,CAAD,C,CAEpD1B,CAAI,CAAE,CAAC,CAAEA,CAAI,CAAEZ,CAAMyB,eAAe,CAAA,CAAE,CAAEb,CAAG,EAAnD,CACCd,CAAC,CAAC,YAAD,CACAyC,IAAI,CAAC,OAAO,CAAEf,CAAK,CAAC,IAAhB,CACJe,IAAI,CAAC,kBAAkB,CAAEvC,CAAM4B,OAAO,CAACjB,CAAG,CAAEC,CAAN,CAAW,CAAEV,CAAO2B,WAAY,CAAE3B,CAAO4B,WAA3E,CACJU,SAAS,CAACH,CAAD,CAEZ,CAEA,OAAOC,CA9BoB,C,CAkC5B,OAAO,IAAIG,KAAK,CAAC,QAAQ,CAAA,CAAE,CAC1B,IAAIC,EAAUxC,CAAOyC,OAAQ,EAAG,QAAS,CAAErC,CAAY,CAAA,CAAG,CAAE8B,CAAW,CAAA,CAAE,CACzEtC,CAAC,CAAC4C,CAAD,CAASF,SAAS,CAAC,IAAD,CAFO,CAAX,CAlFe,CADnB,EAwFZ,CAAEI,MAAF,CAAU",
"sources":["jquery.qrcode.js"],
"names":["$","fn","qrcode","$.fn.qrcode","options","extend","QRErrorCorrectLevel","H","createCanvas","QRCode","typeNumber","correctLevel","canvas","row","col","w","h","addData","text","make","document","createElement","width","height","ctx","getContext","tileW","getModuleCount","tileH","fillStyle","isDark","foreground","background","Math","ceil","floor","fillRect","round","createTable","$row","$table","css","appendTo","each","element","render","jQuery"]
}
File diff suppressed because it is too large Load Diff
+4
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long