Raw Source
hyuken / CustomVerifikasiSSCN

// ==UserScript==
// @name     CustomVerifikasiSSCN
// @version  1
// @grant    none
// @namespace    https://sscnverifikasi.bkn.go.id/
// @version      0.1.2
// @description  Custom Verifikasi (untuk VERIFIKATOR) SSCN agar mudah di baca
// @author       Agus Sudarmanto
// @match        https://sscnverifikasi.bkn.go.id/verifikasi.do*
// @copyright 2019, Agus Sudarmanto (agussudarmanto.blogspot.com)
// @license MIT
// @updateURL https://openuserjs.org/meta/hyuken/My_Script.meta.js
// ==/UserScript==

setTimeout(function(){
  var noreg = document.querySelector("#defaultSearchField").value;
  var e = document.querySelector("#defaultSearchField");
  e.focus();
  e.select();

  if ( document.querySelector(".odd > td:nth-child(3)").textContent == noreg ) {

    console.log('data sudah sama');
    document.querySelector("#myTable > tbody > tr > td:nth-child(6) > button").click();

    setTimeout(function(){
      var arrDoc = [
        "#persyaratanDiv > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > label:nth-child(1) > a:nth-child(1)",
        "#persyaratanDiv > div:nth-child(2) > div:nth-child(2) > label:nth-child(1) > a:nth-child(1)",
        "#persyaratanDiv > div:nth-child(3) > div:nth-child(1) > div:nth-child(2) > label:nth-child(1) > a:nth-child(1)",
        "#persyaratanDiv > div:nth-child(4) > div:nth-child(2) > label:nth-child(1) > a:nth-child(1)",
        "#persyaratanDiv > div:nth-child(5) > div:nth-child(1) > div:nth-child(2) > label:nth-child(1) > a:nth-child(1)",
        "#persyaratanDiv > div:nth-child(6) > div:nth-child(2) > label:nth-child(1) > a:nth-child(1)"
      ];
      c = arrDoc.length;
      for (i=0; i<c; i++) {
        var doc_id = document.querySelector(arrDoc[i]).getAttribute("onclick").substring(22, 54);
        var iframe = "<object type='application/pdf' data='https://sscnverifikasi.bkn.go.id/showdokumen.do?dokumenpindai="+doc_id+"' width='100%' height='500'>No Support</object>";
        // width='100%' height='500'
        htmldata = "<div id='docModal_"+i+"' title='' style='overflow-x:hidden'>" + iframe + "</div><br>";
        var e = document.createElement('div');
        e.setAttribute('class', 'col-md-6')
        e.innerHTML = htmldata;
        container_block = document.getElementById( 'formVerifikasi' );
        container_block.appendChild( e );
      }

      document.querySelector("body > div:nth-child(9)").setAttribute('style', 'display: block; z-index: 1002; outline: currentcolor none 0px; position: absolute; height: 95%; width: 99%; top: 0px; left: 0px;');

		}, 3000);
    
  } else {

    console.log('data tidak sama');
    var e = document.querySelector("#defaultSearchField");
    e.focus();
    e.select();
    // document.querySelector("#defaultSearchField").value = noreg;
    // document.querySelector(".fa-search").click();

  }

}, 3000);