您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Easy way to log multiple TBs at once!
当前为
// ==UserScript== // @name Bulk TB Logger // @namespace http://tampermonkey.net/ // @version 1.3.1 // @description Easy way to log multiple TBs at once! // @author Technical_13 // @supportURL https://Discord.me/TheShoeStore // @include *logthemall.org/* // @grant none // ==/UserScript== var isDebug = false; var intVerbosity = 1; const ver = '1.3.1'; const scriptName = 'Bulk TB Logger v' + ver; console.info( scriptName + ' loaded.' ); function toBoolean( val ) { const arrTrue = [ undefined, null, '', true, 'true', 1, '1', 'on', 'yes' ]; val = ( typeof( val ) === 'string' ? val.toLowerCase() : val ); return ( arrTrue.indexOf( val ) !== -1 ? true : false ); } const intParamsStart = ( document.URL.indexOf( '?' ) + 1 ); const strParams = document.URL.substr( intParamsStart ); const arrParamSets = strParams.split( '&' ); var objParams = {}; arrParamSets.forEach( function( strParam ) { let arrParam = strParam.split( '=' ); if ( arrParam[ 0 ] === 'debug' ) { isDebug = toBoolean( arrParam[ 1 ] ); } else if ( arrParam[ 0 ] === 'verbosity' ) { intVerbosity = ( arrParam[ 1 ] ? ( parseInt( arrParam[ 1 ] ) < 0 ? 0 : ( parseInt( arrParam[ 1 ] ) > 9 ? 9 : parseInt( arrParam[ 1 ] ) ) ) : 9 ); } } ); if ( isDebug ) { console.log( 'Debug mode is on with verbosity level: %d', intVerbosity ); } arrParamSets.forEach( function( strParam ) { let arrParam = strParam.split( '=' ); if ( arrParam[ 0 ] === 'debug' || arrParam[ 0 ] === 'verbosity' ) { objParams.debug = isDebug; objParams.verbosity = intVerbosity; } else if ( arrParam[ 0 ] === 'date' ) { let arrDate = arrParam[ 1 ].split( '/' ); if ( isDebug && intVerbosity > 3 ) { console.log( scriptName + ': Date parameter found: %o', arrDate ); } if ( arrDate.length !== 3 ) { console.error( 'Unable to parse date: please use mm/dd/yyyy format' ); } else { let strMonth = ( arrDate[ 0 ] < 10 ? '0' : '' ) + arrDate[ 0 ]; let strDate = ( arrDate[ 1 ] < 10 ? '0' : '' ) + arrDate[ 1 ]; let intYear = ( new Date() ).getFullYear().toString().substr( 2 ); let intCentury = ( new Date() ).getFullYear().toString().substr( 0, 2 ); let strFullYear = ( arrDate[ 2 ] < 100 ? ( arrDate[ 2 ] <= intYear ? intCentury : ( intCentury - 1 ) ) + arrDate[ 2 ] : arrDate[ 2 ] ); let objDate = ( new Date( strMonth + '-' + strDate + '-' + strFullYear + 'T00:00:00.000Z' ) ); let intMonth = ( objDate.getMonth() + 1 ); let intDate = objDate.getDate(); let intFullYear = ( objDate.getFullYear() + 1 ); objParams.date = strMonth + '/' + strDate + '/' + strFullYear; } } else if ( arrParam[ 0 ] === 'spellcheck' ) { objParams.spellcheck = toBoolean( arrParam[ 0 ] ); } else { objParams[ arrParam[ 0 ].toLowerCase() ] = ( arrParam[ 1 ] || '' ); } } ); ( function() { if ( isDebug && intVerbosity > 1 ) { console.log( scriptName + ': Parameters: %o', objParams ) } if ( objParams.date ) { if ( isDebug && intVerbosity > 2 ) { console.log( scriptName + ': Setting date to: %o', objParams.date ) } document.getElementsByName( 'datedisc' )[ 0 ].value = objParams.date; } document.getElementById( 'Codes' ).setAttribute( 'spellcheck', false ); if ( objParams.codes ) { if ( isDebug && intVerbosity > 2 ) { console.log( scriptName + ': Filling in codes: %o', objParams.codes ) } document.getElementById( 'Codes' ).value = objParams.codes.toUpperCase(); } document.getElementById( 'LogEntry' ).setAttribute( 'spellcheck', toBoolean( objParams.spellcheck ) ); if ( objParams.logentry ) { if ( isDebug && intVerbosity > 2 ) { console.log( scriptName + ': Filling in Log Entry: %o', objParams.logentry ) } document.getElementById( 'LogEntry' ).value = decodeURIComponent( objParams.logentry ); } } )();