Legend

Forum

Unread topics or posts

Topic

Unread posts

Locked

Announcement

Forums > Tips & Tricks

GreaseMonkey (Firefox) script for auto show subtasks



AuthorMessage
matt

Posted: Jun 27, 2009
Score: 1



Install greasemonkey for firefox and restart.

Go Tools --> GreaseMonkey --> New User Scripts

Name: Toggle subtasks on page load and swap tabs
Namespace: http://www.toodledo.com/delayedFeatures/expandsubtasks
Includes: http://www.toodledo.com/views/*

Script:

// ==UserScript==
// @name Expand Subtasks
// @namespace http://www.toodledo.com/delayedFeatures/expandsubtasks
// @include http://www.toodledo.com/views/*
// ==/UserScript==



var fireClicker = function fireClicker(oid)
{
var target=document.getElementById(oid);
if(document.dispatchEvent)
{
var oEvent = document.createEvent("MouseEvents");
oEvent.initMouseEvent("click", true, true,window, 1, 1, 1, 1, 1, false, false, false, false, 0, target);
target.dispatchEvent(oEvent);
}
else if(document.fireEvent)
{
target.fireEvent("onclick");
}
}

fireClicker('action_toggleSubtasks');

var originalSwapTab = unsafeWindow.swapTab;

unsafeWindow.swapTab = function(e) { originalSwapTab(); fireClicker('action_toggleSubtasks'); }


This message was edited Jun 27, 2009.
matt

Posted: Jun 27, 2009
Score: 0



(fixed)

This message was edited Jun 27, 2009.
Anders

Posted: Jun 30, 2009
Score: 0



Cool. Thanks for sharing.
dweiss

Posted: Jul 13, 2009
Score: 0



When I try to install this I get a js error that says "document is not defined". Any ideas?
ablank

Posted: Jul 14, 2009
Score: 0



It does nothing at my side (even after a page reload by pressing CTRL+F5). Are there special Toodledo settings needed?
Anders

Posted: Jul 14, 2009
Score: 0



It's working for me. Make sure you restart Firefox after installing Greasemonkey, and restart again after adding the script. Also make sure you put the "Includes" URL in the correct box, and skip the description box. Finally, retype the URLs instead of copying and pasting them which will give you problems.
ablank

Posted: Jul 14, 2009
Score: 0



Aaaah, I found the problem when I typed the basic things manualy as you supposed. Because I'm pro plus member, I've enabled SSL.. So the include and the namespace URL is https instead of http. Now it works great :)

Thanks a lot!
dweiss

Posted: Jul 15, 2009
Score: 0



I'm also on Pro with SSL but I still get the following error:

Windows Script Host
Script: C:\Documents and Settings\user\Desktop\toodledo.js
Line 11
Char 1
Error: 'document' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error

The error appears when I try to add the script to greasemonkey. I don't have so much experience installing greasemonkey scripts. I just copy/pasted your code into a .js file and then added it via greasemonkey. Maybe I did it incorrectly?


This message was edited Jul 15, 2009.
Anders

Posted: Jul 15, 2009
Score: 0



If you copy and paste the URLs in that original post, you will notice they paste as something quite different, and that could definitely be your problem. Try typing the "@namespace" and "@include" parts in manually, and see if that makes a difference.
dweiss

Posted: Jul 16, 2009
Score: 0



What do you mean by "the paste as something quite different"?

I made sure all the urls were correct and I still get the same js error.

I am using FF 3.5 if that matters. Any ideas?
Anders

Posted: Jul 16, 2009
Score: 0



If you copy those URLs from the first post and paste them, the result will be a completely different URL in one case and the * character missing in the other case due to the imperfections of automatic URL recognition in forum posts. I am on my phone browser now, but I have been using it on FF 3.5 also, and I'm pretty sure it worked on the encrypted connection as well. You may want to see what happens if you delete the "s" in https in your address bar and refresh. Anyway, I will play around with it when I am back on a proper computer, and see if I can figure it out, but my guess is it must either be another addon interfering or a problem with using it on SSL as suggested.
Anders

Posted: Jul 17, 2009
Score: 0



If you want this script to work for the SSL connection available to Pro users you have to use "https" instead of "http" for both the "namespace" and "includes" URLs. I have two scripts (one with http, and the other with https), so that it works regardless of the connection I am using.
Rich

Posted: Jul 17, 2009
Score: 0



Works great on mouse click. But how do you get it to work when moving between sections and tabs with the keyboard (i.e m,o,c,e and 1-9)
J-Mac

Posted: Jul 24, 2009
Score: 0



Not working at all here. Tried with and without SSL; nothing. I still have to click the Toggle thing.

Jim
Anders

Posted: Jul 30, 2009
Score: 1



I made it an installable script. You can find it here: http://userscripts.org/scripts/show/54729
This version will work on either the normal or Pro encrypted connection.
softboysxp

Posted: Aug 05, 2009
Score: 0



works like a charm ! thank you so much! also it works with Fluidapp
raShMan

Posted: Aug 27, 2009
Score: 0



*updated to the firefox and opera compatible version*

you could have this much easier, maybe it's also faster and it should be more portable.
this uses directly toodledo's javascript methods instead of simulating a click:

// ==UserScript==
// @name toogle toodledo subtasks
// @author raShMan
// @version 1.0
// @include http://www.toodledo.com/*
// @include http://toodledo.com/*
// @include https://www.toodledo.com/*
// @include https://toodledo.com/*
// ==/UserScript==

if (!window.opera) {
unsafeWindow.$('action_toggleSubtasks').setAttribute('c',1);
unsafeWindow.$('action_toggleSubtasks').update("Toggle Subtasks");
unsafeWindow.getAllSubtasks();
} else {
$('action_toggleSubtasks').setAttribute('c',1);
$('action_toggleSubtasks').update("Toggle Subtasks");
getAllSubtasks();
}


This message was edited Aug 27, 2009.
Anders

Posted: Aug 27, 2009
Score: 0



I am probably doing something wrong, but I can't get that to work.
raShMan

Posted: Aug 27, 2009
Score: 0



*edit: fixed in original post*

hmm, interestingly this only works in opera...
currently trying to figur out why it doesn't work in firefox...


This message was edited Aug 27, 2009.
raShMan

Posted: Aug 27, 2009
Score: 0



forget my script, when clicking on a tab it is not opening subtasks as the original script.
next problem: in opera this doesn't work even with the original script. how can this be solved?
You cannot reply yet
Skip to Page:  1   2      Next


To participate in these forums, you must be signed in.



Toodledo Forums > Tips & Tricks