User:Evalprime/bank.js

// add checkmark/x mark on the bank page // not commented nor clean - don't edit unless you understand this // if you do understand this rip conf = mw.config.get('wgUserName'), icons = { 'yes': 'https://static.wikia.nocookie.net/big-nate-comments/images/e/eb/Yes.svg/revision/latest', 'no': 'https://static.wikia.nocookie.net/big-nate-comments/images/c/cf/No.svg/revision/latest', },

self = { init: function { console.log("Started!"); self.loadData(conf) },

status: function(text) { mw.notify( text ) },       loadData: function(username) { if (username === null) { self.status('Couldn\'t retrieve data. Perhaps you\'re not logged in?') return }       	self.status('Loading data for ' + username) $.ajax({		       type: "GET",		        url: "https://big-nate-comments.fandom.com/api.php?action=query&format=json&list=usercontribs&uclimit=500&ucuser=" + username,		        dataType: "json",		        success: function(msg) {		            if (msg.query.usercontribs.length === 0) {		            	self.status("Error loading data.");		                console.error("Error loading data.");		            } else {		                var edits = 0		                var editDays = []		                msg.query.usercontribs.forEach(function(item) { var currentDate = new Date(new Date.toISOString) var currentDay = currentDate.getDay var distance = 0 - currentDay currentDate.setDate(currentDate.getDate + distance) currentDate.setHours(0,0,0,0) var editDate = new Date(new Date(item.timestamp).toISOString) if (editDate > currentDate) { edits++ }							if (editDate.getDay <= currentDay) { if (editDays.indexOf(editDate.getDay) === -1) { editDays.push(editDate.getDay) }							}		               })		                self.addIcons(edits, editDays);		            }		        }		    }) },       addIcons: function(edits, editDays) { $('.editing-prize tbody tr').not(':first-child').not(':nth-of-type(2)').each(function(index) {       			var editRequirement = $(this).children('td:not(:nth-of-type(2))').html.replace(/\D/g,'')        			if (edits > editRequirement) {        				$(this).children('td:nth-of-type(2)').append('  ')        			} else {        				$(this).children('td:nth-of-type(2)').append('  ')        			}        	}) if (editDays.length === 7) { $('.editing-prize tbody tr:nth-of-type(2)').children('td:nth-of-type(2)').append('  ') } else { $('.editing-prize tbody tr:nth-of-type(2)').children('td:nth-of-type(2)').append('  ') }       }    } $(self.init);