https://store.touchpanelcontrol.com/wp-content/plugins/qr-code/public/js/qr-code-public.js?ver=1.0.0
1;(function ($) { 2 'use strict' 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 * http://qrcoder.ru/?d=http%3A%2F%2Fwww.touchpanelcontrol.com&s=10 31 */ 32 33 $(function () { 34 let optionA = $('#option-a'), 35 profileNumber = optionA.find('#profile-number'), 36 ipAddress = optionA.find('#ip-address'), 37 deviceId = optionA.find('#device-id'), 38 profileName = optionA.find('#profile-name'), 39 screenSize = optionA.find('#screen-size'), 40 buttonGenerateOptionA = $('#generate-option-a') 41 42 buttonGenerateOptionA.click(function () { 43 let screenResize = screenSize.find('option:selected'), 44 imgOptionA = optionA.find('#img-option-a'), 45 imgQrCodeA = imgOptionA.find('img'), 46 errorMsg = optionA.find('#error-msg') 47 48 if (profileNumber.val().trim() === '') { 49 errorMsg 50 .addClass('invalid') 51 .text(`Please provide your ${profileNumber.attr('placeholder')}.`) 52 53 return 54 } 55 56 if (ipAddress.val().trim() === '') { 57 errorMsg 58 .addClass('invalid') 59 .text(`Please provide your ${ipAddress.attr('placeholder')}.`) 60 61 return 62 } 63 64 if (deviceId.val().trim() === '') { 65 errorMsg 66 .addClass('invalid') 67 .text(`Please provide your ${deviceId.attr('placeholder')}.`) 68 69 return 70 } 71 72 if (profileName.val().trim() === '') { 73 errorMsg 74 .addClass('invalid') 75 .text(`Please provide your ${profileName.attr('placeholder')}.`) 76 77 return 78 } 79 80 if ( 81 !['scale', 'stretch', 'none'].includes( 82 screenResize.val().trim().toLowerCase(), 83 ) 84 ) { 85 errorMsg.addClass('invalid').text(`Please provide your Screen resize.`) 86 87 return 88 } 89 90 errorMsg.removeClass('invalid').text('') 91 92 let data = `tpcontrol://?tpccmd-${profileNumber.val()};Localhost,${ipAddress.val()};DeviceID,${deviceId.val()};Profilename,${profileName.val()};ScreenResize,${screenResize.val()} 93 `, 94 src = `https://quickchart.io/chart?cht=qr&chs=320x320&chl=${data.trim()};ApplyProfile;&choe=UTF-8` 95 96 imgQrCodeA 97 .on('load', function () { 98 let downloadOptionA = optionA.find('#download-option-a'), 99 downloadLink = downloadOptionA.find('a') 100 101 downloadOptionA.addClass('generated') 102 downloadLink.attr('href', src) 103 104 imgOptionA.addClass('generated') 105 buttonGenerateOptionA.text('Refresh') 106 107 // Save data to sessionStorage 108 sessionStorage.setItem( 109 'tpc-qr-code-a', 110 JSON.stringify({ 111 'profile-number': profileNumber.val(), 112 'ip-address': ipAddress.val(), 113 'device-id': deviceId.val(), 114 'profile-name': profileName.val(), 115 'screen-resize': screenResize.val(), 116 }), 117 ) 118 }) 119 .removeAttr('srcset') 120 .attr({ 121 src: src, 122 title: src, 123 'data-src': src, 124 }) 125 }) 126 127 let buttonGenerateOptionB = $('#generate-option-b'), 128 optionB = $('#option-b'), 129 commandString = optionB.find('#command-string'), 130 imgOptionB = optionB.find('#img-option-b'), 131 imgQrCodeB = imgOptionB.find('img') 132 133 //option b 134 buttonGenerateOptionB.click(function () { 135 let errorMsg = optionB.find('#error-msg-b') 136 137 if (commandString.val().trim() === '') { 138 errorMsg 139 .addClass('invalid') 140 .text(`Please provide your ${commandString.attr('placeholder')}.`) 141 142 return 143 } 144 145 if (commandString.val().trim().indexOf('ApplyProfile;') < 0) { 146 errorMsg 147 .addClass('invalid') 148 .text( 149 `${commandString.attr( 150 'placeholder', 151 )} must end with 'ApplyProfile;' value.`, 152 ) 153 154 return 155 } 156 157 errorMsg.removeClass('invalid').text('') 158
159 const src = `https://quickchart.io/chart?cht=qr&chs=320x320&chl=tpcontrol://?tpccmd-${commandString.val()};&choe=UTF-8` 160 161 imgQrCodeB 162 .on('load', function () { 163 let downloadOptionB = optionB.find('#download-option-b'), 164 downloadLink = downloadOptionB.find('a') 165 166 downloadOptionB.addClass('generated') 167 downloadLink.attr('href', src) 168 169 imgOptionB.addClass('generated') 170 buttonGenerateOptionB.text('Refresh') 171 172 // Save data to sessionStorage 173 sessionStorage.setItem( 174 'tpc-qr-code-b', 175 JSON.stringify({ 176 'command-string': commandString.val(), 177 }), 178 ) 179 }) 180 .removeAttr('srcset') 181 .attr({ 182 src: src, 183 title: src, 184 'data-src': src, 185 }) 186 }) 187 188 // Get saved data from sessionStorage 189 const data = sessionStorage.getItem('tpc-qr-code-a') 190 if (data) { 191 const qrData = JSON.parse(data) 192 193 profileNumber.val(qrData['profile-number']) 194 ipAddress.val(qrData['ip-address']) 195 deviceId.val(qrData['device-id']) 196 profileName.val(qrData['profile-name']) 197 screenSize 198 .find(`option[value="${qrData['screen-resize']}"]`) 199 .prop('selected', true) 200 buttonGenerateOptionA.trigger('click') 201 } 202 203 // Get saved data from sessionStorage 204 const dataB = sessionStorage.getItem('tpc-qr-code-b') 205 if (dataB) { 206 const qrData = JSON.parse(dataB) 207 208 commandString.val(qrData['command-string']) 209 buttonGenerateOptionB.trigger('click') 210 } 211 }) 212})(jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.