Skip to content

Instantly share code, notes, and snippets.

@pblocz
Created February 28, 2019 15:21
Show Gist options
  • Save pblocz/c965ffc2644187f037b954084c9e437f to your computer and use it in GitHub Desktop.
Save pblocz/c965ffc2644187f037b954084c9e437f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Open week view in zoho
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://people.zoho.com/*/zp
// @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js
// @grant unsafeWindow
// ==/UserScript==
(async function() {
'use strict';
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
result[key] = (_.isObject(value) && _.isObject(base[key])) ? changes(value, base[key]) : value;
}
});
}
return changes(object, base);
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
if ( ! /#timetracker\/timelogs\/listview/.test(location.hash) ) return
var win = unsafeWindow;
while(true) {
try {
// This will check that week exists
var time = win.Timetracker.constants.WEEK;
console.log(win.Timetracker.timelogs.currentTimelogData);
await sleep(2000);
console.log(win.Timetracker.timelogs.currentTimelogData);
win.Timetracker.timelogs.showDayWeekMonthLogTime(time);
break;
} catch (err) {
await sleep(500);
}
}
console.log(location.hash);
console.log(win.Timetracker.timelogs.showDayWeekMonthLogTime);
console.log(win.Timetracker.constants.WEEK);
// console.log(win.Timetracker.timelogs.showDayWeekMonthLogTime(win.Timetracker.constants.WEEK));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment