Dec 9 2008

CiteDrag

by Elijah Grey

Firefox 3.1 beta 2 recently added support for the standard drag and drop model (also with some extra Mozilla-only ones). I had an idea to automatically add citation info to text dragged from websites to plain and rich text editors using this newly supported API. I named the finished script CiteDrag, which requires no setup other than adding a single script tag anywhere in your website’s page. CiteDrag displays a enlarged gray (with black shadow) copy of the text you are dragging as the drag image instead of the default text drag image generated by Firefox. CiteDrag is licensed CC GNU LGPL and free to download in two flavors: CiteDrag and CiteDrag + Drag Image. CiteDrag + Drag Image is all of the normal CiteDrag code with some additional code to give a fancy canvas-generated drag image that shows the text content being dragged. You can customize this for your website if you want to. CiteDrag is mostly useful for when someone blogs about another person’s blog post. Having the text automatically go into a cited blockquote and having a link back is very useful. I have installed CiteDrag on this blog and I have a demo of it and a rich text area you can use to test out CiteDrag fully.

Here are some examples of what it does when you drag various data types to various input areas: (Note wherever it says title, it will be replaced with the host name of the source page if there is no page title)

  • Drag a link or image (or linked image) to a normal text input: { [link URI] or [image URI] } via {source title} ( {source URI} )
    • Example:  http://example.com/ via Foobar ( http://foo.bar/post/example.com-ftw/ )
  • Drag a link or image (or linked image) to a rich text input: { [clickable link to link URI] or [image URI] or [clickable image linked to link URI] } via {clickable link to source page with title as text}
  • Drag formatted or non-formatted text to a normal text input: “{Text dragged}” ― {source title} ( {source URI} )
    • Example:  “Lorem ipsum dolor sit amet.” ― Elijah Grey ( http://www.eligrey.com/ )
  • Drag formatted or non-formatted text into a rich text input: The dragged text goes into a <blockquote cite=”{source URI}”> and after the blockquote is ― {clickable link to source page with title as text}

Dec 6 2008

Passwords Viewer

by Elijah Grey

Less than a year ago, I made a passwords viewer written in XHTML and JavaScript to view exported xml files from the Password Exporter Firefox addon. It was made to make human-readable (I know XML is readable but the exported XML can be much harder to read than tables and if you have it Base64 encoded you would have to decode all of the Base64 encoded attributes, one by one) text tables with the hosts, usernames, and passwords in the exported xml files for my personal use. The text table dynamically resizes with the longest values and is meant to be stored in a text file encrypted with a master password. I was using my passwords viewer today and thought I would share it with everyone else who uses Password Exporter.

You can download the passwords viewer (XHTML) or try out the online version (also XHTML) displaying a text table of a fake example passwords file. Due to this webapp being meant to help out people who use a certain Firefox addon, I only made it so it works in Firefox. Disregard that, I made it cross-browser* with 1 small tweak. The normal version is made for local use on your computer’s filesystem ONLY and the online version works both online and on your computer’s filesystem but requires you tto type out the filename instead of picking it with a file picker. Appending a query or hash string containing file=FILENAME to the end of the URI will auto-load the passwords file specified.

*Except for IE. I see no reason to waste my time on making something like this work in IE.

› Continue reading


Nov 23 2008

The jData Standard

by Elijah Grey

If jData is ever going to succeed, it needs standards. I have made a list of jData standards and recommendations for the jData Standard version 0.1 (this is an unfinished draft and is subject to change). I will update this soon:

  • jData Website - Currently jdata.eligrey.com
  • The size limit: Browsers will limit how much data can be stored in the jData Website’s localStorage object, so please do not set preferences that use anything near or over 1kb of data. jData is supposed to be a global resource that any website can access. If a website starts storing excessive amounts of data in your jData storage, report it by emailing me or commenting here and I will block the website from using jData on their website.
  • Standard Types: (Case sensitive unless otherwise stated)
    • Boolean: “true”, “false”, “0″, or “1 (0 = false, 1 = true)
    • String: Can be anything in a string.
    • Integer: An integer. Suggested to parse using JavaScript’s parseInt() function.
    • Double: A double. Suggested to parse using JavaScript’s parseFloat() function.
    • Decimal: A decimal (uses periods, not commas). (ECMAScript under 4 can’t parse so use server-side)
    • Preceding “?” in class type: Usually the type but can vary
    • Any: Can be any type.
    • Types are separed from the class by a colon and multiple types can be stated as such: class:type1|type2|type3 (ect…)
  • Standard classes:
    • permit:Boolean - User permit’s item
    • personal:?String - Ask user before setting item(s). Personal information. Usually a string.
    • public:?String - You can give the user a warning but it is not required. Public information. Usually a string.
    • preference:Any - A user’s preference about an item.
    • understand:Boolean - A user understands an item. (eg. understand.javascript => ‘true’ means they understand javascript)

› Continue reading


Nov 23 2008

jData - Publicly Share Data

by Elijah Grey

jData is a new (extremely tiny) library for sharing data about yourself everywhere without a website needing permission/URIs/ect. It is like having a globally accessible localStorage. It is accessible at jdata.eligrey.com in two different API flavors: postMessage and HTTP queries. It only works in browsers that support window.postMessage (ie. advanced browsers like Firefox 3 and the WebKit nightlies) and sorta works in IE 8 beta 2. I may add Google Gears support someday.

What is jData? - Think of the data stored on jData like cookies with no size limit; cookies that can be accessed by any website on the internet. It’s so lightweight that the postMessage API is exactly 300 bytes.
Why make this? - This would be a good resource for storing info about yourself that you are okay with any website on the internet knowing.

Hypothetical situation: Facebook started storing your name (with your permission) to jData.fullname. Then the people who run MySpace think this is a good idea and implement it too. Then other websites start checking jData and see if jData.fullname has been set already and pre-fill the corresponding input text box with your name on a sign up page.

› Continue reading


Oct 22 2008

HTTP Auth Mailto Redirection

by Elijah Grey

I have made a php script that makes linking to email addresses through http: links but in the exact same format as mailto: links possible. You can test it out by going to http://mail-noreply@mailto.eligrey.com?subject=Hello World! (IE users: click here after reading paragraph below). If you took away the double slashes (which would still work) and replaced http with mailto, the link would work as a mailto link. You may be asked if you would like to log on with the username ‘mail-noreply’. Click OK if you see this. One reason for doing this is that most spambots can’t handle HTTP authentication.

IE users: IE doesn’t support username:password@host URIs so you need to go to the normal URI without everything before the @ sign. You will get prompted to type in a username (ignore password), type in the username in the email address you want to email.
› Continue reading