mylib

我的工具

Versione datata 13/01/2022. Vedi la nuova versione l'ultima versione.

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/435697/1008250/mylib.js

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

function 添加样式(css,id='') {//植入css
    const style = document.createElement('style');
    style.type='text/css';
    id!=''?style.id = id:0;
    style.textContent = css;
    const h0 =document.querySelector('html');
    h0.insertBefore(style,h0.children[0]);
}function seconds2date(seconds){//秒数转日期//getDateStr(1524637692)>"2018-4-25  14:28:12"
    var date = new Date(seconds*1000)
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    var currentTime = year + "-" + month + "-" + day + "  " + hour + ":" + minute + ":" + second;
    return currentTime
}function 追加子元素(父亲,标签,内容) {//追加子元素(document.body,'标签','内容','idk','true','data-s')
    const 新元素 = document.createElement(标签)
    新元素.appendChild(document.createTextNode(内容));
    const 长 = arguments.length;
    if (长>3) {
        for(let i=3;i<长;i+=2){
            新元素.setAttribute([arguments[i]],arguments[i+1])
        }
    }
    父亲.appendChild(新元素);
    return 新元素;
}function 追加兄弟元素(哥哥,标签,内容){//紧跟其后追加元素//追加兄弟元素(document.body,'div','','suck','1','dick')
    const 弟弟 = document.createElement(标签);
    弟弟.appendChild(document.createTextNode(内容));
    const 长 = arguments.length;
    if (长>3) {
        for(let i=3;i<长;i+=2){
            弟弟.setAttribute([arguments[i]],arguments[i+1])
        }
    }
    return 哥哥.parentNode.insertBefore(弟弟,哥哥.nextElementSibling);
}function fuckTiebaLogin(userName,password){//跳出登录框后再执行
    document.getElementById('TANGRAM__PSP_5__footerULoginBtn').click();
    document.getElementById('TANGRAM__PSP_5__userName').outerHTML+='';
    document.getElementById('TANGRAM__PSP_5__password').outerHTML+='';
    document.getElementById('TANGRAM__PSP_5__userName').value=userName;
    document.getElementById('TANGRAM__PSP_5__password').value=password;
    return document.getElementById('TANGRAM__PSP_5__submit').click();
}function xb_getValue(k, aDefault) {
  let val = localStorage.getItem('_GM_STORAGE_PREFIX_' + k);
  if (null === val && 'undefined' != typeof aDefault) return aDefault;
  return val;
}function xb_setValue(k, v) {//xb_setValue('k', 'v')
  localStorage.setItem('_GM_STORAGE_PREFIX_' + k, v);
}function xb_deleteValue(k) {
  localStorage.removeItem('_GM_STORAGE_PREFIX_' + k);
}function cl(t) {
  console.log(t);
}function al(t) {
  alert(t);
}