thaieibvn / BigGame68 PD

// ==UserScript==
// @name         BigGame68 PD
// @namespace    http://BigGame68.com/
// @version      0.3
// @description  BigGame68 PD Information catcher
// @author       You
// @match        https://biggame68.com/pd/create*
// @grant        none
// @updateURL   https://openuserjs.org/meta/thaieibvn/BigGame68_PD.meta.js
// ==/UserScript==

(function() {
    'use strict';
    
    insertVCB('info_M40e919');
    insertVCB('info_M7711de');
    insertVCB('info_Ma7fc7b');
    
})();

function insertVCB(txt){
    var toAcc = getElementByXpath1('//*[@id="'+txt+'"]/div/div/div[2]/dl/dd[2]');
    
    var sotien = getElementByXpath1('//*[@id="'+txt+'"]/div/div/div[2]/dl/dd[5]');
    
    var dg = getElementByXpath1('//*[@id="'+txt+'"]/div/div/div[2]/dl/dd[6]');
    
    var url =   "https://www.vietcombank.com.vn/ibanking2015/6058865ffd22f91407390878ea902219/chuyentien/taikhoan/chuyentientronghethong/" + toAcc.outerText + "_" + sotien.outerText +"_"+ dg.outerText ;
    
    url = "<a target='_blank' href='"+ url +"'> <img src='https://www.vietcombank.com.vn/IBanking2015/Content/web/images/logo_login.png' alt='VCB Internet Banking' width = '95' height = '45' border='0'/></a>";
    
    var tab1 = getElementByXpath1('/html/body/div/div/div/section[2]/div[2]/div[2]/div[2]/table/tbody');
    var bankURL = getElementByXpath1('//*[@id="'+txt+'"]/div/div/div[2]/dl');
    bankURL.innerHTML += '<dt>VCB Ebanking</dt><dd  class="btn btn-xs btn-success">'+ url+'</dd>';

}
String.prototype.replaceAll = function(str1, str2, ignore) 
{
    return this.replace(new RegExp(str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&"),(ignore?"gi":"g")),(typeof(str2)=="string")?str2.replace(/\$/g,"$$$$"):str2);
} 
function getElementByXpath1(path) {
  return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}