Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've just made such a thing. Here's a break down of my process.</p> <p>I need to keep a list of quotes from different web pages, and to add some info to each quote. </p> <p>My bookmarklet will dynamically <strong>generate a google form</strong> (I've just viewed the source of the real google form that I've already created), it'll <strong>automatically fill</strong> the current url, the page title, and the currently selected text, than, <strong>the form will be submitted</strong>.</p> <p>Since I need to manually add info, I intentionally didn't include at least one required field, so I receive the google form with an error message (but with url, title &amp; quote already filled). Now I can manually add all the other info that I need and submit the form.</p> <p>If the bookmarklet fill all the required fields you'll just receive the google form success response "Thanks! Your response has been recorded."</p> <p>I've used the following site to generate a bookmarklet that use jQuery: <a href="http://benalman.com/code/test/jquery-run-code-bookmarklet/" rel="nofollow">http://benalman.com/code/test/jquery-run-code-bookmarklet/</a> (I'm using jQuery to be able to scrap additional info &amp; content from the webpage)</p> <p>To be able to use that site properly, you'll have to escape your <strong>one-liner</strong> html (you can use this <a href="http://www.web-code.org/coding-tools/javascript-escape-unescape-converter-tool.html" rel="nofollow">escape tool</a>)</p> <p>The required steps are:</p> <ol> <li>Create a google form / spreadsheets</li> <li>View the source of the form and copy the fields you want the bookmarklet to fill</li> <li>Escape your html and use <a href="http://benalman.com/code/test/jquery-run-code-bookmarklet/" rel="nofollow">this</a> to write your script that fill the info, this site will create the bookmarklet for you</li> </ol> <p>So in my case:</p> <p><strong>1.</strong> I've created a form that include one text field to hold the url, another text field to hold the title of the page, a paragraph text to hold the quote (the selected text). The form also include some other required fields that I fill manually.</p> <p><strong>2.</strong> I prepared the following html:</p> <pre> &lt;form method=&quot;POST&quot; action=&quot;https://spreadsheets.google.com/spreadsheet/formResponse?formkey=XYZXYZXYZXYZXYZXYZXYZ&amp;amp;ifq&quot;&gt; &lt;input type=&quot;text&quot; name=&quot;entry.0.single&quot; value=&quot;&quot; id=&quot;entry_0&quot; /&gt; &lt;input type=&quot;text&quot; name=&quot;entry.3.single&quot; value=&quot;&quot; id=&quot;entry_3&quot; /&gt; &lt;textarea name=&quot;entry.2.single&quot; id=&quot;entry_2&quot;&gt;&lt;/textarea&gt; &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;submit&quot; /&gt; &lt;/form&gt; </pre> <p>(entry_0 - url, entry_3 - page title, entry_2 - quote)</p> <p><strong>3.</strong> After putting it in one line and escaping it. I've used the following script:</p> <pre><code>frm = $(unescape('%3Cform%20action%3D%22https%3A//spreadsheets.google.com/spreadsheet/formResponse%3Fformkey%3DXYZXYZXYZXYZXYZXYZXYZ%26amp%3Bifq%22%20method%3D%22POST%22%3E%0A%3Cinput%20type%3D%22text%22%20name%3D%22entry.0.single%22%20value%3D%22%22%20id%3D%22entry_0%22%20/%3E%0A%3Cinput%20type%3D%22text%22%20name%3D%22entry.3.single%22%20value%3D%22%22%20id%3D%22entry_3%22%20/%3E%0A%3Ctextarea%20name%3D%22entry.2.single%22%20id%3D%22entry_2%22%3E%3C/textarea%3E%0A%3Cinput%20type%3D%22submit%22%20name%3D%22submit%22%20value%3D%22submit%22%20/%3E%0A%3C/form%3E')); $(frm).children('#entry_0').attr('value',location.href); $(frm).children('#entry_3').attr('value',$('title')[0].innerHTML); $(frm).children('#entry_2').html(window.getSelection().toString()); $(frm).children('input[type=submit]').click() </code></pre> <p>This method has been tested with chrome. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload