NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @author chako@PNScoder // @name LocalStorageSSCN-chako // @version 2.4.9 // @description Untuk VERIFIKATOR SSCN : Helper verifikasi berkas pelamar // @copyright perdana1cell@gmail.com 2019 // @license MIT // @updateURL https://openuserjs.org/meta/chako/LocalStorageSSCN-chako.meta.js // @downloadURL https://openuserjs.org/install/chako/LocalStorageSSCN-chako.user.js // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_log // @grant GM_deleteValue // @grant GM_notification // @grant GM_openInTab // @grant GM_setClipboard // @grant GM_info // @grant GM_addStyle // @namespace https://sscnverifikasi.bkn.go.id/verifikasi.do // @match https://sscnverifikasi.bkn.go.id/verifikasi.do* // @require http://userscripts-mirror.org/scripts/source/107941.user.js // ==/UserScript== var isAntrianBelumSelesai = GM_SuperValue.get('isAntrianBelumSelesai', false); var isTabMode = GM_SuperValue.get('isTabMode', 'tab') == 'tab'; var idRegs = GM_SuperValue.get('idRegsQueue', []); var idAcc = GM_SuperValue.get('idRegsAcc', []); var idTms = GM_SuperValue.get('idRegsTms', []); let e = document.querySelector("#defaultSearchField"); e.focus(); e.select(); var noreg = $("#defaultSearchField").val(); var firstreg = $("#myTable > tbody > tr:nth-child(1) > td:nth-child(3)").html(); if (noreg != '' && noreg == firstreg) { if(isAntrianBelumSelesai){ $("#myTable > tbody > tr:nth-child(1) > td:nth-child(6) > a.btn.btn-sm.btn-primary").trigger('click'); } else { $("#myTable > tbody > tr:nth-child(1) > td:nth-child(6) > button").trigger('click'); } } else { if(noreg != '' && firstreg != null){ //handle back browser $("#searchBar > div:nth-child(4) > div > a").trigger('click'); } else if (idRegs.length > 0){ if(noreg !== $.trim(idRegs[0])){ //load antrian selanjutnya noreg = $.trim(idRegs[0]); $("#defaultSearchField").val(noreg); if(checkRegister(noreg)){ if(isAntrianBelumSelesai){ $('#statver').val(2); } else { $('#statver').val(null); } $("#searchBar > div:nth-child(4) > div > a").trigger('click'); } else { //remove bila nomor register tidak sesuai pattern if(idRegs.splice( $.inArray(noreg, idRegs), 1 ).length > 0){ GM_SuperValue.set ('idRegsQueue', idRegs); GM_notification ({ title: noreg, text: 'Cek kembali nomor register', ondone: () => { location.reload(); } }); } } } else { //remove bila no register sudah diproses if(idRegs.splice( $.inArray(noreg, idRegs), 1 ).length > 0){ GM_SuperValue.set ('idRegsQueue', idRegs); alert('Nomor register '+noreg+' tidak ditemukan. Refresh halaman untuk membuka antrian berikutnya'); location.reload(); /*GM_notification ( { title: noreg, text: 'Nomor register '+noreg+' tidak ditemukan. Refresh halaman untuk membuka antrian berikutnya', ondone: () => { location.reload(); } } );*/ } } } } //header buttons let btnMode = ' <button type="button" id="btnMode" class="btn btn-sm btn-warning">'+ (isTabMode? 'Mode Popup' : 'Mode Tab') +'</button> '; let btnAddQueue = ' <button type="button" id="btnAddQueue" class="btn btn-sm btn-success">Tambah Antrian</button> '; let btnViewQueue = ' <button type="button" id="btnViewQueue" class="btn btn-sm btn-info">Lihat Antrian</button> '; let btnViewAcc = ' <button type="button" id="btnViewAcc" class="btn btn-sm btn-info">Lihat ACC</button> '; let btnViewTms = ' <button type="button" id="btnViewTms" class="btn btn-sm btn-info">Lihat TMS</button> '; let btnResetQueue = ' <button type="button" id="btnResetQueue" class="btn btn-sm btn-danger">Reset Antrian</button> '; let btnViewInfo = ' <button type="button" id="btnViewInfo" class="btn btn-sm btn-primary">Informasi</button> '; let info = ' ' + GM_info.script.name + ' v.' + GM_info.script.version + '. copyright ' + GM_info.script.author + ' ('+GM_info.script.copyright+')'; $('#body').prepend('<div class="alert alert-success text-center" role="alert">' + btnAddQueue + btnViewQueue + btnViewAcc + btnViewTms + btnResetQueue + btnViewInfo + btnMode + '</div>'); $('#body').append('<footer class="footer-copyright"><strong>'+info+'</strong></footer>'); let ta = '<div class="row col-md-12"><textarea id="taRegister" rows="20" cols="20" style="width: 100%; margin: 10px;" required></textarea></div>'; let divBtn = '<div class="row col-md-12" style="margin-left: 10px;"><button type="button" id="btnSaveReg" class="btn btn-success" style="margin-right: 3px;">Tambah BELUM VERIFIKASI</button> <button type="button" id="btnSaveRegBlmSelesai" class="btn btn-primary"style="margin-right: 3px;">Tambah BELUM SELESAI</button> <button type="button" id="btnClose" class="btn btn-warning"style="margin-right: 3px;">Batal</button> </div>'; $('#body').append('<div id="myCustomDialog" style="overflow-x: hidden; width: auto; min-height: 0px; height: 853.249px;" class="ui-dialog-content ui-widget-content" scrolltop="0" scrollleft="0">'+ta+divBtn+'</div>'); GM_addStyle('.footer-copyright {position: fixed; left: 0px; bottom: 0px; vertical-align: center; width: 100%; padding: .75rem 1.25rem; text-align: center; color: #721c24; background-color: #f8d7da; border-color: #f5c6cb;}'); /*LOGIC MENU COMMAND*/ GM_registerMenuCommand ("Tambah Antrian", addRegisterNumbers, "A"); GM_registerMenuCommand ("Lihat Antrian", viewQueue, "Q"); GM_registerMenuCommand ("Lihat ACC", viewAcc, "Y"); GM_registerMenuCommand ("Lihat TMS", viewTms, "N"); GM_registerMenuCommand ("Reset Antrian", resetQueue, "X"); GM_registerMenuCommand ("Informasi", viewInfo, "I"); var IdCommandMode = null; if(isTabMode){ IdCommandMode = GM_registerMenuCommand ("Mode Popup", modePopup, "P"); document.getElementById('btnMode').addEventListener('click', modePopup); } else { IdCommandMode = GM_registerMenuCommand ("Mode Tab", modeTab, "P"); document.getElementById('btnMode').addEventListener('click', modeTab); } function modeTab () { isTabMode = true; $('#btnMode').html('Mode Popup'); document.getElementById('btnMode').removeEventListener('click', modeTab); document.getElementById('btnMode').addEventListener('click', modePopup); GM_unregisterMenuCommand(IdCommandMode); IdCommandMode = GM_registerMenuCommand ("Mode Popup", modePopup, "T"); GM_SuperValue.set ('isTabMode', 'tab'); GM_notification ( {title: 'Mode Tab', text: 'Mode buka dokumen di new tab diaktifkan'} ); } function modePopup () { isTabMode = false; $('#btnMode').html('Mode Tab'); document.getElementById('btnMode').removeEventListener('click', modePopup); document.getElementById('btnMode').addEventListener('click', modeTab); GM_unregisterMenuCommand(IdCommandMode); IdCommandMode = GM_registerMenuCommand ("Mode Tab", modeTab, "T"); GM_SuperValue.set ('isTabMode', 'popup'); GM_notification ( {title: 'Mode Popup', text: 'Mode buka dokumen di form verifikasi diaktifkan'} ); } function addRegisterNumbers () { $( "#myCustomDialog" ).dialog({ title: "Tambah Nomor Register" }); $('#myCustomDialog').dialog('open'); $('#btnSaveReg').show(); $('#btnSaveRegBlmSelesai').show(); $('textarea#taRegister').val(''); $('textarea#taRegister').prop('disabled',false); } function viewQueue () { $( "#myCustomDialog" ).dialog({ title: "Daftar Antrian" }); $('#myCustomDialog').dialog('open'); $('#btnSaveReg').hide(); $('#btnSaveRegBlmSelesai').hide(); $('textarea#taRegister').val(''); let idRegs = GM_SuperValue.get ('idRegsQueue', []); if(idRegs !== null){ $('textarea#taRegister').val(idRegs.join('\n')); } $('textarea#taRegister').prop('disabled',true); } function viewAcc () { $( "#myCustomDialog" ).dialog({ title: "Daftar ACC" }); $('#myCustomDialog').dialog('open'); $('#btnSaveReg').hide(); $('#btnSaveRegBlmSelesai').hide(); $('textarea#taRegister').val(''); let idRegs = GM_SuperValue.get ('idRegsAcc', []); if(idRegs !== null){ $('textarea#taRegister').val(idRegs.reverse().join('\n')); } $('textarea#taRegister').prop('disabled',true); } function viewTms () { $( "#myCustomDialog" ).dialog({ title: "Daftar TMS" }); $('#myCustomDialog').dialog('open'); $('#btnSaveReg').hide(); $('#btnSaveRegBlmSelesai').hide(); $('textarea#taRegister').val(''); let idRegs = GM_SuperValue.get ('idRegsTms', []); if(idRegs !== null){ $('textarea#taRegister').val(idRegs.reverse().join('\n')); } $('textarea#taRegister').prop('disabled',true); } function resetQueue () { GM_deleteValue('idRegsQueue'); GM_notification ( {title: 'Berhasil', text: 'Antrian berhasil direset'} ); } function viewInfo () { GM_notification ({title: $('#header > div > div > div.col-sm-9.new-btn-header > div:nth-child(1) > div > div > button.btn.btn-sm.btn-primary > b').html(), text: '\ Program hanyalah sebuah tools pembantu, ketelitian dalam memverifikasi berkas tetap harus dijaga. Ganbatte!'}); } function getElementAccredited(){ if($('#lembaga > label > i').length > 0){ let cloneLembaga = $("#lembaga").clone(); cloneLembaga.addClass("alert alert-info text-center divDocument"); return cloneLembaga; } return null; } function getElementFormasi(){ var elm = ''; var formasi = $('#jenisFormasiPendaftar > label').html(); if(formasi.indexOf('LULUSAN TERBAIK') != -1){ elm += "<div class='alert alert-danger text-center h5 divDocument'>" + $("#jenisFormasiPendaftar").clone().html() + "</div>"; } if(formasi.indexOf('PUTRA/PUTRI PAPUA DAN PAPUA BARAT') != -1){ elm += "<div class='alert alert-danger text-center h5 divDocument'>" + $("#jenisFormasiPendaftar").clone().html() + "</div>"; } if($('#disables').length > 0 && $('#disables').html() != ''){ elm += "<div class='alert alert-danger text-center h5 divDocument'>" + $("#disables").clone().html() + "</div>"; } if($("#isP1tl").length > 0){ elm += "<div class='alert alert-warning text-center h5 divDocument'>" + $("#pendidikanP1tl > div > div.col-md-10 > div").clone().html() + "</div>"; } if($("#alasanSupervisorDiv > div > div > div > div").length > 0){ elm += "<div class='alert alert-warning text-center h5 divDocument'>" + $("#alasanSupervisorDiv > div > div > div > div").clone().html() + "</div>"; } return elm != '' ? $(elm) : null; } function checkRegister(noreg){ var pattern = /^\d{17}$/; return pattern.test(noreg); } function addQueue(isBelumSelesai){ var val = $('textarea#taRegister').val(); if(val.length > 0){ if(GM_SuperValue.get ('isAntrianBelumSelesai', false) != isBelumSelesai){ //kalo ganti antrian GM_deleteValue('idRegsQueue'); GM_SuperValue.set ('isAntrianBelumSelesai', isBelumSelesai); } var arr = val.split(/\s+/g); var initArr = GM_SuperValue.get ('idRegsQueue', []); $.each(arr, function( index, reg ) { initArr.push(reg); }); GM_SuperValue.set ('idRegsQueue', initArr); $('#myCustomDialog').dialog('close'); $("#defaultSearchField").val($.trim(initArr[0])); let reg = $.trim(initArr[0]); if(checkRegister(reg)){ if(isBelumSelesai){ $('#statver').val(2); } else { $('#statver').val(null); } $("#searchBar > div:nth-child(4) > div > a").trigger('click'); GM_notification ( {title: 'Berhasil', text: 'Antrian berhasil ditambah'} ); } else { //GM_notification ( {title: $.trim(initArr[0]), text: 'Cek kembali nomor register'} ); if(initArr.splice( $.inArray(reg, initArr), 1 ).length > 0){ GM_SuperValue.set ('idRegsQueue', initArr); GM_notification ({ title: reg, text: 'Cek kembali nomor register', ondone: () => { location.reload(); } }); } } } else { GM_notification ( {title: 'Tidak Ada Data', text: 'Silakan isi nomor register yang akan dimasukkan ke dalam antrian'} ); } } let w = $(window).width(); let h = $(window).height(); $("#myCustomDialog").dialog({ autoOpen: false, height: h, width: 1120, position: { my: "center", at: "top", of: window }, modal: true, resizable: true, open: function(){ $('.ui-widget-overlay').bind('click',function(){ $('#myCustomDialog').dialog('close'); }); //action close button document.getElementById('btnClose').addEventListener('click', function() { $('#myCustomDialog').dialog('close'); }); } }); //form verifikasi $("#myModal").dialog({ autoOpen: false, height: h, width: w, position: { my: "center", at: "top", of: window }, modal: true, open: function(event, ui) { var arrDoc = [ "#persyaratanDiv > div:nth-child(1) > div > div:nth-child(2) > label > a",//pas foto "#persyaratanDiv > div:nth-child(2) > div:nth-child(2) > label > a",//ktp "#persyaratanDiv > div:nth-child(3) > div > div:nth-child(2) > label > a", "#persyaratanDiv > div:nth-child(4) > div:nth-child(2) > label > a", "#persyaratanDiv > div:nth-child(5) > div > div:nth-child(2) > label > a", "#persyaratanDiv > div:nth-child(6) > div:nth-child(2) > label > a", ]; if(!isTabMode){ let cloneDiv = $("#formVerifikasi > div:nth-child(5)").clone(); cloneDiv.addClass("divDocument"); cloneDiv.insertAfter("#formVerifikasi > div:nth-child(5)"); } //info pelamar lulusan terbaik / papua / disabilitas / P1 TL let formasi = getElementFormasi(); if(formasi != null){ formasi.insertAfter("body > div:nth-child(9) > div.ui-dialog-titlebar.ui-widget-header.ui-corner-all.ui-helper-clearfix"); formasi.clone().insertAfter("#myModal"); } //info lembaga terakreditasi let lembaga = getElementAccredited(); if(lembaga != null){ lembaga.insertAfter("body > div:nth-child(9) > div.ui-dialog-titlebar.ui-widget-header.ui-corner-all.ui-helper-clearfix"); lembaga.clone().insertAfter("#myModal"); } $.each(arrDoc.reverse(), function( index, doc ) { var isFoto = index == 5; var doc_id = document.querySelector(doc).getAttribute("onclick").substring(22, 54); if(isTabMode){ //README : Block or allow pop-ups from a specific site //https://support.google.com/chrome/answer/95472?co=GENIE.Platform%3DDesktop&hl=en-GB GM_openInTab('https://sscnverifikasi.bkn.go.id/showdokumen.do?dokumenpindai='+doc_id/*, {active:isFoto}*/); } else { //load dokumen di form verifikasi let height = isFoto ? 614 : 750; let e = document.createElement('div'); e.setAttribute('class', (isFoto ? 'col-md-6' : 'col-md-12')+' divDocument'); e.setAttribute('style', 'padding: 0 150px;'); e.innerHTML = "<div id='docModal_"+index+"' title='' style='overflow-x:hidden'><object type='application/pdf' data='https://sscnverifikasi.bkn.go.id/showdokumen.do?dokumenpindai="+doc_id+"' width='100%' height='"+height+"'>No Support</object></div><br>"; $(e).insertAfter( "#formVerifikasi > div:nth-child(5)" ); } }); //select all check list $("#selectedAll").prop('checked', true); $('input[name=persyaratanIds\\[\\]]').prop('checked', true); //logic button final if(isTabMode && !($("#isP1tl").length > 0)){ //kalau mode TAB dan bukan P1 TL, click button final document.querySelector("#formVerifikasi > div:nth-child(6) > div:nth-child(12) > div > div > button.btn.btn-success.btn-large.verifikasiBtn").click(); } }, close: function(event, ui) { $( ".divDocument" ).remove(); } }); document.getElementById('btnAddQueue').addEventListener('click', addRegisterNumbers); document.getElementById('btnViewQueue').addEventListener('click', viewQueue); document.getElementById('btnViewAcc').addEventListener('click', viewAcc); document.getElementById('btnViewTms').addEventListener('click', viewTms); document.getElementById('btnResetQueue').addEventListener('click', resetQueue); document.getElementById('btnViewInfo').addEventListener('click', viewInfo); //btn tambah antrian BELUM VERIFIKASI document.getElementById('btnSaveReg').addEventListener('click', function() { addQueue(false); }); //btn tambah antrian BELUM SELESAI document.getElementById('btnSaveRegBlmSelesai').addEventListener('click', function() { addQueue(true); }); //btn konfirmasi final $('body').on('click', 'body > div:nth-child(12) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)', function (){ //remove no register yang sudah diproses idRegs.splice( $.inArray(noreg, idRegs), 1 ); GM_SuperValue.set ('idRegsQueue', idRegs); var j = $('input[name=persyaratanIds\\[\\]]').length; var k = $('input[name=persyaratanIds\\[\\]]:checked').length; if (k == j && k > 0) { //push no register acc idAcc.push(noreg); GM_SuperValue.set ('idRegsAcc', idAcc); //copy status di clipboard untuk paste di spreadsheet GM_setClipboard (1); } else if (k < j) { //push no register tms if($('#alasanTolak').length > 0){ let ket = $('#alasanTolak').val(); noreg = noreg+' - '+ket; //copy keterangan di clipboard untuk paste di spreadsheet GM_setClipboard (noreg); } idTms.push(noreg); GM_SuperValue.set ('idRegsTms', idTms); } }); //paste no register $('#defaultSearchField').on('paste', function(elm){ var e = $(this); setTimeout(function(){ if(checkRegister($.trim(e.val()))){ $("#searchBar > div:nth-child(4) > div > a").trigger('click'); } else { GM_notification ( {title: e.val(), text: 'Cek kembali nomor register'} ); } }, 0); }); $('#defaultSearchField').on('change', function(elm){ if(checkRegister($.trim($(this).val()))){ $("#searchBar > div:nth-child(4) > div > a").trigger('click'); } else { GM_notification ( {title: $(this).val(), text: 'Cek kembali nomor register'} ); } });