Commit 8dd42484 authored by cameo's avatar cameo
Browse files

WIP settings page

parent 0e96be20
......@@ -7,11 +7,27 @@
// @description try to take over the time, White Snow way
// @author Victor Cameo Ponz
// @match https://badgeuse.cines.fr/WD190AWP/wd190awp.exe/CTX_*/p_e_accueilp/SYNC_*
// @grant none
// @grant GM_getValue
// @grant GM_setValue
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @require http://momentjs.com/downloads/moment.min.js
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js
// ==/UserScript==
GM_config.init(
{
'id': 'hey-ho configuration', // The id used for this instance of GM_config
'fields': // Fields object
{
'contract_hours_per_day': // This is the id of the field
{
'label': 'Contratual working day duration (format hh:mm)', // Appears next to field
'type': 'text', // Makes this setting a text field
'default': '7:54' // Default value if user doesn't change it
}
}
});
function toHHMMSS(duration) {
if(duration.asMilliseconds() < 0){
return "-" + toHHMMSS(moment.duration(-duration.asMilliseconds(), 'ms'));
......@@ -26,6 +42,7 @@ $(document).ready(function() {
const extra_activation_threshold = moment.duration({hours: 6})
const extra_amout = moment.duration({minutes: 20})
const table_config_pattern = '<tr><td height="20" width="460" style=" ;" valign="top" class="l-0 padding"><div style=" ;" id="ZR_CPT_4"><table><tbody><tr><td width="460px"></td><td height="1px"></td></tr><tr><td width="460px"><table id="c-4-CELLULE1" bgcolor="#66ff33" style="position:relative;"><tbody><tr><td height="19" width="460" bgcolor="#66ff33" valign="top"><div class="ff3fix63895rel" style=""><table cellpadding="0" cellspacing="0" style="position:relative;left:0;border-collapse:separate;"><tbody><tr><td width="5px"><img src="/weoctime90_WEB/arrondiGauche-DB.gif" width="5" height="19" hspace="0" vspace="0" alt="" name="zrl_4_CH_IMG_SOLDE_BORDG" id="c-4-zrl_4_CH_IMG_SOLDE_BORDG" class="l-7 padding" style="-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;"></td><td height="19px"></td></tr><tr class="d-0"><td width="5px"></td><td></td></tr></tbody></table><div id="dwwzrl4CHIMGSOLDE" style="position:absolute;left:399px;top:0px;width:60px;height:19px;z-index:0;"><img src="/weoctime90_WEB/octime68_bouton_solde_gris-DB.gif" width="60" height="19" hspace="0" vspace="0" alt="" name="zrl_4_CH_IMG_SOLDE" id="c-4-zrl_4_CH_IMG_SOLDE" class="l-7 padding" style="-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;"></div><div id="dwwzrl4CHCPTLIB" style="position:absolute;left:13px;top:0px;z-index:2; "><table width="205px" style="height:19px;"><tbody><tr><td class="Octime68-Standard wbstyle padding" id="hey-ho_settings"><div id="zrl_4_ZR_LIB">CLICK HERE TO >>Configure settings<<</div></td></tr></tbody></table></div></div></td></tr></tbody></table></td><td height="19px"></td></tr><tr class="d-0"><td width="460px"></td><td></td></tr></tbody></table></div></td></tr>'
const table_row_patern = '<tr><td height="20" width="460" style=" ;" valign="top" class="l-0 padding"><div style=" ;" id="ZR_CPT_4"><table><tbody><tr><td width="460px"></td><td height="1px"></td></tr><tr><td width="460px"><table id="c-4-CELLULE1" bgcolor="#66ff33" style="position:relative;"><tbody><tr><td height="19" width="460" bgcolor="#66ff33" valign="top"><div class="ff3fix63895rel" style=""><table cellpadding="0" cellspacing="0" style="position:relative;left:0;border-collapse:separate;"><tbody><tr><td width="5px"><img src="/weoctime90_WEB/arrondiGauche-DB.gif" width="5" height="19" hspace="0" vspace="0" alt="" name="zrl_4_CH_IMG_SOLDE_BORDG" id="c-4-zrl_4_CH_IMG_SOLDE_BORDG" class="l-7 padding" style="-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;"></td><td height="19px"></td></tr><tr class="d-0"><td width="5px"></td><td></td></tr></tbody></table><div id="dwwzrl4CHIMGSOLDE" style="position:absolute;left:399px;top:0px;width:60px;height:19px;z-index:0;"><img src="/weoctime90_WEB/octime68_bouton_solde_gris-DB.gif" width="60" height="19" hspace="0" vspace="0" alt="" name="zrl_4_CH_IMG_SOLDE" id="c-4-zrl_4_CH_IMG_SOLDE" class="l-7 padding" style="-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;"></div><div id="dwwzrl4CHCPTLIB" style="position:absolute;left:13px;top:0px;z-index:2; "><table width="205px" style="height:19px;"><tbody><tr><td class="Octime68-Standard wbstyle padding" id="tzc-4-CH-CPTLIB"><div id="zrl_4_ZR_LIB">__TITLE__</div></td></tr></tbody></table></div><div id="dwwzrl4CHCPTVAL" style="position:absolute;left:401px;top:0px;z-index:3; "><div class="lh0 dzSpan dzCH_CPTVAL" id="dzc-4-CH-CPTVAL" style="min-height:19px\9;"><table style="height:19px;"><tbody><tr><td width="56px" class="Octime68-bouton-val wbstyle padding" id="tzc-4-CH-CPTVAL"><div id="zrl_4_ZR_VAL">__VALUE__</div></td></tr></tbody></table></div></div><div id="dwwzrl4CHCPTDAT" style="position:absolute;left:224px;top:0px;z-index:4; "><div class="lh0 dzSpan dzCH_CPTDAT" id="dzc-4-CH-CPTDAT" style="min-height:19px\9;"><table style="height:19px;"><tbody><tr><td width="170px" class="Octime68-date-soldeTab wbstyle padding" id="tzc-4-CH-CPTDAT"><div id="zrl_4_ZR_DAT">__COMMENT__</div></td></tr></tbody></table></div></div></div></td></tr></tbody></table></td><td height="19px"></td></tr><tr class="d-0"><td width="460px"></td><td></td></tr></tbody></table></div></td></tr>';
var solde_dc_str = $('#zrl_1_ZR_VAL').text()
......@@ -84,6 +101,8 @@ $(document).ready(function() {
var current_time_today_dc = current_time_today.clone()
current_time_today_dc.subtract(contract_hours_per_day)
$('#con-ZR_CPT > tbody:last-child').append(table_config_pattern);
$("#hey-ho_settings").click(function(){GM_config.open();});
$('#con-ZR_CPT > tbody:last-child').append(
table_row_patern.replace("__TITLE__", "Quotidien avec sortie imédiate")
.replace("__COMMENT__", extra_str + "/" + remaining_lunch_str)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment