Anuko time tracker 填報工具

自用
如圖

  1. 填報本月開始和結束日期(如 2號到7號)
  2. 填報這區間內的所有工作,每項一行
  3. 點擊 Enable jQery 標籤
  4. 點擊 AnukoFill 標籤即可把任務平均分到每天。提交後頁面會自動刷新。

瀏覽器 標籤或書籤的內容

Enable jQuery

javascript:void(function(){if(!document.getElementById('jQscript')){var jQscript=document.createElement('script');jQscript.id='jQscript';jQscript.src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js';document.documentElement.appendChild(jQscript);}}());

AnukoFill

javascript:!function(){var t=window.location.href.substr(0,window.location.href.lastIndexOf("/")),i=$("#activity").val().trim(),r=$("#project").val().trim();if(!i||!r)return void alert("Select product and activity please!");for(var a=$("#start").val().trim(),e=$("#finish").val().trim(),n=$("#note").val().trim().split("\n"),o=parseInt(n.length/(e-a+1)),l="",s=$("a.CalendarLinkRecordsExist").attr("href").substr(6),d=s.trim().substr(6,4),c=s.trim().substr(0,2),v=parseInt(a),m=0;m<n.length;m++)l+=n[m]+" ",(1==o||m>0&&m%o==0||m==n.length-1)&&(console.log("Adding "+(c+"/"+v+"/"+d)+": "+l),$.post(t+"/time.php",{project:r,activity:i,duration:8,note:l,billable:1,date:c+"/"+v+"/"+d,btn_submit:"Submit"}),l="",v++);window.location.reload()}();

Clear Today

javascript:!function(){for(var e=window.location.href.substr(0,window.location.href.lastIndexOf("/")),t=$("a").filter(function(){return"Delete"==$(this).text()}),o=0;o<t.length;o++){var l=$(t[o]).attr("href").substr(19);$.post(e+"/time_delete.php?id="+l,{delete_button:"Delete",id:l}),console.log("Deleted "+l)}location.reload()}();

源代碼

AnukoFill

(function() {
var basePath=window.location.href.substr(0,window.location.href.lastIndexOf('/'));
var activity = $('#activity').val().trim();
var project = $('#project').val().trim();
if(!activity || !project){
    alert('Select product and activity please!');
    return;
}
var start = $('#start').val().trim();
var end =$('#finish').val().trim();
var allIssueList=$('#note').val().trim().split("\n");
var eachPartLength=parseInt(allIssueList.length/(end-start+1));
var cachedIssue='';
var currentDate=$('a.CalendarLinkRecordsExist').attr('href').substr(6);
var year=currentDate.trim().substr(6,4);
var month=currentDate.trim().substr(0,2);
var iterDay=parseInt(start);
for(var i =0;i< allIssueList.length; i++){
    cachedIssue+=allIssueList[i]+' ';
    if(eachPartLength==1 || (i > 0 && i % eachPartLength == 0 ) || i == allIssueList.length - 1) {
       console.log('Adding ' + (month + "/" + iterDay + "/" + year) +': ' + cachedIssue);
       $.post( basePath+"/time.php", { project: project, activity:activity, duration:8, note: cachedIssue, billable:1, date: (month + "/" + iterDay + "/" + year), btn_submit:"Submit" } );
       cachedIssue='';
       iterDay++;
    }
}
window.location.reload();
})();

Clear Today

(function() {
var basePath=window.location.href.substr(0,window.location.href.lastIndexOf('/'));
var btns=$('a').filter(function(index){return $(this).text() == "Delete"});
for(var i=0;i<btns.length;i++){ 
  var deleteId=$(btns[i]).attr('href').substr(19); 
  $.post( basePath+"/time_delete.php?id="+deleteId, { delete_button: 'Delete', id : deleteId} );
  console.log('Deleted ' + deleteId)
};
location.reload();
})();

問題:
任務數目目前不能少於天數

發佈了57 篇原創文章 · 獲贊 15 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章