Jump to content

Can anyone help me understand this small bookmarklet java script please

- - - - -

  • Please log in to reply
2 replies to this topic

#1
martingchapman

martingchapman

    Newbie

  • Members
  • Pip
  • 1 posts
I am using a bookmarklet in Google Chrome to automatically create a Remember The Milk (RTM) task from a Google Mail email.

I found the javascript for the bookmarklet in one of the RTM forum posts.

The script works really well, when clicked it opens up the RTM mobile site (m.rememberthemilk.com) "add a task" form and automatically populates some of the fields in the form (due, list, tag).
My problem is that in the "Task Name" field as well as adding the Gmail title it puts our company name at the beginning and my email address at the end eg.
"Supportspan Group Ltd Mail - email title - martinc@supportspangroup.com".

Can any of you experts who frequent this forum work out from the script below if there is a way of modifying the script so that it just enters the email title into the Task Name box without our company name and my email address?

Here is the script;
java script:(
function(){cp='http://m.rememberthemilk.com/add?name='+encodeURIComponent(document.title)+' &due=today&list=18906301&tags=@laptop&url='+encodeURIComponent('https://mail.google.com/a/supportspangroup.com/?fs=1&tf=1&source=atom&view=cv&search=all&shva=1&th=')+escape(location.href.substr(-16));w=window.open(cp,'addwindow','status=no,toolbar=no,width=250,height=660,resizable=yes');setTimeout(function(){w.focus();}, 500);})(); 
I have added a space between the java and script to prevent it running on this page (not sure if I need to do that or not, I really dont know very much about javascript)

Thank you for reading this post and really appreciate any help you can give me.

Regards Martin (javascript "very" newbie).

Edited by Alexander, 17 May 2011 - 06:45 PM.
Recovered formatting.


#2
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
:) Don't worry you have to put in a bit of script to make it run :D
Hmmmmm...
It appears to send some type of AJAX request, and open a pop-up. Or more likely it is opening a popup with some GET variables.
From what I see its just trying to tell Gmail that this user wants to do something with the page, ima guess its adding it to a bookmark list.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
I think that script just opens a new window at Login - Remember The Milk....

(posting javascript won't cause it to run here)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users