jenkins-bot has submitted this change and it was merged.
Change subject: Fix jshint errors
......................................................................
Fix jshint errors
Fix jshint errors
Change to UNIX line endings
Remove trailing whitespace
Fix some indents to match convention
Add .jshintrc and .jshintignore
Ignore modules/qrcode.js because it's a
3rd party library
Bug: T63641
Change-Id: I2bb7156452c1554d3aee89a57a7f66875b49ccda
---
A .jshintignore
A .jshintrc
M modules/jquery.qrcode.js
3 files changed, 112 insertions(+), 89 deletions(-)
Approvals:
Hashar: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..819e184
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1 @@
+modules/qrcode.js
\ No newline at end of file
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..ea2f243
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,22 @@
+{
+ // Enforcing
+ "bitwise": true,
+ "eqeqeq": true,
+ "es3": true,
+ "freeze": true,
+ "latedef": true,
+ "noarg": true,
+ "nonew": true,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+
+ // Environment
+ "browser": true,
+
+ "globals": {
+ "jQuery": false,
+ "QRCode": false,
+ "QRErrorCorrectLevel": false
+ }
+}
diff --git a/modules/jquery.qrcode.js b/modules/jquery.qrcode.js
index 0a401d1..74b1dc7 100644
--- a/modules/jquery.qrcode.js
+++ b/modules/jquery.qrcode.js
@@ -1,89 +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();
- jQuery(element).appendTo(this);
- });
- };
-})( jQuery );
+(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();
+ jQuery(element).appendTo(this);
+ });
+ };
+})( jQuery );
--
To view, visit https://gerrit.wikimedia.org/r/186138
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2bb7156452c1554d3aee89a57a7f66875b49ccda
Gerrit-PatchSet: 23
Gerrit-Project: mediawiki/extensions/TwoFactorAuthentication
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits