この文書の現在のバージョンと選択したバージョンの差分を表示します。
— |
ブックマークレット [2017/11/30 23:48] (現在) fifi 作成 |
||
---|---|---|---|
ライン 1: | ライン 1: | ||
+ | |||
+ | ## 基本形 | ||
+ | |||
+ | ```js | ||
+ | javascript:(function(){ | ||
+ | |||
+ | try{ | ||
+ | document.getElementById('userid').value='fifi@fifi.com'; | ||
+ | document.getElementById('pass').value='****************'; | ||
+ | }catch(e){ | ||
+ | console.log(e); | ||
+ | }; | ||
+ | |||
+ | })(); | ||
+ | |||
+ | ``` | ||
+ | |||
+ | ## dom操作 | ||
+ | |||
+ | ```js | ||
+ | /* | ||
+ | PixisのチェックボックスをAll Check | ||
+ | |||
+ | */ | ||
+ | javascript:(function(){ | ||
+ | var tbody = document.querySelector('#APPROVALGRD > tbody'); | ||
+ | for(var i=0; i<tbody.childElementCount; i++){ | ||
+ | |||
+ | console.log(i); | ||
+ | tr = tbody.children[i]; | ||
+ | |||
+ | col0 = tr.firstChild; | ||
+ | |||
+ | input = col0.querySelector('input'); | ||
+ | |||
+ | if(input == null){ | ||
+ | console.log("is null"); | ||
+ | continue; | ||
+ | } | ||
+ | input.checked = !input.checked; | ||
+ | } | ||
+ | |||
+ | })(); | ||
+ | |||
+ | |||
+ | ``` | ||
+ | |||
+ | ```js | ||
+ | /* | ||
+ | Pixisの勤務時間を自動入力 | ||
+ | 1. DIFF_MINで決められた分数だけ加算/減算 | ||
+ | - 開始時間 = 打刻時間 + DIFF_MIN | ||
+ | - 終了時間 = 打刻時間 - DIFF_MIN | ||
+ | |||
+ | */ | ||
+ | javascript:(function(){ | ||
+ | DIFF_MIN=5; | ||
+ | var tbody = document.querySelector('#APPROVALGRD > tbody'); | ||
+ | |||
+ | for(var i=0; i<tbody.childElementCount; i++){ | ||
+ | |||
+ | console.log(i); | ||
+ | tr = tbody.children[i]; | ||
+ | |||
+ | col0=tr.children[0]; | ||
+ | if(col0.className=="mg_dh_holiday") continue; | ||
+ | if(col0.className=="mg_dh_sat") continue; | ||
+ | if(col0.className=="mg_dh_sun") continue; | ||
+ | if(col0.textContent=='-') continue; | ||
+ | |||
+ | //打刻時間 | ||
+ | td=tr.children[9]; | ||
+ | if(td.textContent=="(打刻情報なし)"){ console.log("打刻無し"); continue; } | ||
+ | |||
+ | h1 = td.querySelectorAll('span')[1].textContent; | ||
+ | m1 = td.querySelectorAll('span')[2].textContent; | ||
+ | h2 = td.querySelectorAll('span')[4].textContent; | ||
+ | m2 = td.querySelectorAll('span')[5].textContent; | ||
+ | h1=Number(h1); | ||
+ | m1=Number(m1); | ||
+ | h2=Number(h2); | ||
+ | m2=Number(m2); | ||
+ | |||
+ | d1 = new Date(2017,11,1,h1,m1+DIFF_MIN); | ||
+ | |||
+ | // 17:45-18:00の間の場合は17:45に丸める | ||
+ | d2 = new Date(2017,11,1,h2,m2); | ||
+ | d1745 = new Date(2017,11,1,17,45); | ||
+ | d1800 = new Date(2017,11,1,18,00); | ||
+ | if((d1745 < d2) && (d2 <= d1800)){ | ||
+ | d2 = new Date(2017,11,1,17,45); | ||
+ | }else{ | ||
+ | d2 = new Date(2017,11,1,h2,m2-DIFF_MIN); | ||
+ | } | ||
+ | |||
+ | //勤務時間 | ||
+ | td=tr.children[8]; | ||
+ | inputs=td.querySelectorAll('input'); | ||
+ | inputs[0].value = d1.getHours(); | ||
+ | inputs[1].value = d1.getMinutes(); | ||
+ | inputs[2].value = d2.getHours(); | ||
+ | inputs[3].value = d2.getMinutes(); | ||
+ | } | ||
+ | |||
+ | })(); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ``` | ||
+ | |||