NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name QPay Ticket Count Viewer // @namespace https://jscheah.me/ // @version 2 // @description View a breakdown of tickets and their custom properties, and disables form validation // @author JS Cheah // @match http*://*.getqpay.com/tickets // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; function showTicketDetails() { var tickets = window.tickettypesArr; var status = document.createElement('div'); for (var ticketTypeId in tickets) { var ticketType = tickets[ticketTypeId]; var name = ticketType.names[ticketTypeId].name; var numLeft = 'No limit'; var customFields = document.createElement('ul'); if (ticketType.numberleft !== undefined) { numLeft = ticketType.numberleft + ' out of ' + ticketType.quantity + ' left'; } for (var customFieldIdx in ticketType.custom_fields.vals) { var customField = ticketType.custom_fields.vals[customFieldIdx]; console.log(customField); var item = document.createElement('li'); item.innerHTML = customField.fieldName + ': ' + customField.mandatory; customFields.appendChild(item); } var ticketElem = document.createElement('div'); ticketElem.innerHTML = '<p>' + name + '</p><p>' + numLeft + '</p>'; ticketElem.appendChild(customFields); status.appendChild(ticketElem); status.innerHTML += '<hr>'; } status.style.position = 'absolute'; status.style.left = '20px'; status.style.top = '175px'; status.style.backgroundColor = 'rgba(255, 255, 255, 0.5)'; status.style.borderColor = 'blue'; status.style.borderStyle = 'solid'; status.style.padding = '10px'; status.style.borderRadius = '10px'; document.body.appendChild(status); } function disableValidation() { $('#ticketsForm').data('formValidation').isValid = function () { return true; }; console.log('Form validation status: ', $('#ticketsForm').data('formValidation').isValid()); } showTicketDetails(); disableValidation(); })();