Wednesday, August 29, 2012

OtherBrowser

[Update 5:30pm 8/29: I made a small change to OtherBrowser to make it less intrusive when you run it. It will no longer pop up in your dock for a second while it runs. There’s no update mechanism though. So re-download below and install as before.]

Since upgrading to Mountain Lion, and with it Safari 6, I’ve been doing my hardest to switch back to Safari as my default browser. I can’t really say why, maybe I’m just in the mood for change. Chrome is a fantastic browser. So is Safari. Safari’s UI just seems more polished, and less intrusive. I LIKE it. Anyway’s I’m trying.

I’m also trying to keep from installing Flash system wide, which means I can’t view flash on Safari. So I find myself switching between browsers a fair amount. I know other folks have offered up excellent tips, tricks, and scripts for grabbing your current page in Safari and opening it in Chrome. But none of them offered up what I wanted, which is a bookmarklet sitting in my bookmarks toolbar that I click and, shazam, the current page in the current browser is opened in the other browser. So I did some fiddling. And came up with OtherBrowser.

OtherBrowser is a VERY simple (21 lines of code) applescript application that makes it very simple to send a url to a specific browser (chrome and safari only) on your mac. The main use case here is a bookmarklet in your browser’s toolbar that will automatically send the current page to your other browser. I use this a lot when browsing on Safari I come across a site that requires flash. Hit my OtherBrowser bookmarklet (cmd–5 in safari for the fifth bookmark in the toolbar) and that site pops open in flash supporting Chrome. OtherBrowser works in the reverse direction as well (Chrome to Safari), it just requires a slight change to your bookmarklet.

OtherBrowser works by using OS X’s URL scheme support. OtherBrowser registers two new URL schemes:

otherbrowser-safari:// 
otherbrowser-chrome:// 

Anytime you open a url on a mac with OtherBrowser installed that starts with one of those schemes (instead of, say, http://), that url gets sent to OtherBrowser instead of your Mac’s default browser. When OtherBrowser gets its hands on that URL, it sends safari url’s to safari, and chrome url’s to chrome.

So along with the app itself, I’ve included a javascript bookmarklet for each browser that takes the url in your current tab at switches it to one of these URL schemes. Which sends the URL to OtherBrowser which sends it along to the other browser. I should say this sounds like a lot, and is a mouthful (or keyboardful) to write. But goes very quick in practice. Almost instant.

I can’t imagine this not working. It’s very simple. But I’ve only tested it myself. Let’s call it a beta and all disclaimers related to it being a beta apply.

There’s more potential here. I might could build a browser extension that lets you use the OtherBrowser bookmarklet from a contextual menu. So right-click on a link and send that from Safari to Chrome. But this is a start.

You can dowload OtherBrowser here.


To install the app:  

  • Drag OtherBrowser somewhere on your mac. Your Applications folder is fine (as it is an application), but it’s a tiny app that you never launch directly. I keep mine in ~/Applications/.
  • Right-click (or control-click) on OtherBrowser to bring up the contextual menu and select “Open” to launch it once. All this does is get you past Mountain Lion’s gatekeeper (sorry, I haven’t signed this) and to make sure OtherBrowser’s URL schemes get registered with OS X. The app will launch and immediately quit. And nothing else noticeable will happen. This is expected.

To install the bookmarklets:  

  • Open the text file titled “OtherBrowser Bookmarklets” in a text editor (TextEdit is fine).
  • Copy the browser appropriate bookmarklet.
  • Go to the browser you want to install the bookmarklet it in, create a new bookmark, paste the bookmarklet in as its address. Name it whatever. I use “toChrome” and “toSafari”

To Use: click bookmarklet when alternate browsing experience is desired…

Enjoy,

David Halter

aka ElasticThreads


P.S. Purely as a reference, so you know what you’re installing and how OtherBrowser works, I’ll paste in the Applescript source code below (you can also read it by showing OtherBrowser’s package contents, and checking out …/OtherBrowser.app/Contents/Resources/Scripts/main.scpt)

on open location a_URL

	set offs to offset of "://" in a_URL

	set this_URL to characters offs thru (count of a_URL) of a_URL as string

	set this_URL to "http" & this_URL as string

	set offs to offs - 1

	set daScheme to characters 1 thru offs of a_URL as string

	if daScheme is "otherbrowser-chrome" then

		tell application "Google Chrome"

			open location this_URL

			activate

		end tell

	else if daScheme is "otherbrowser-safari" then

		tell application "Safari"

			open location this_URL

			activate

		end tell

	end if

end open location 
Thursday, March 15, 2012 Monday, March 12, 2012

nvIt for Chrome update

I’ve updated the Chrome version of my nvIt extension, which gives you various ways of creating notes in nvALT from your browser. Couple things about it:

  • Back when I originally released the Chrome version, I did not implement an auto-update mechanism correctly. Apologies. So if you already have nvIt installed in Chrome: Go to chrome://extensions and remove the old version. Then install the new version. Auto-updating should work from here on out, so this is the only time you’ll have to do this.
  • The update fixes a bug in the extension (caused by a change in Chrome itself) that removed all paragraph and line endings from selected text if you went to create a note from selected text. The result was an unreadable, condensed block of text. Now fixed.
  • The update fixes a bug that screwed up creating a note with selected text on a web page whose URL contained a certain set of funny characters.
  • The update does not fix a bug in the current beta (version 2.2) of nvALT (since the bug is not in the extension) that causes it to crash when creating a note by importing from a URL. This bug will be fixed in nvALT in the next beta update. In the meantime, I recommend only using the extension to create notes using selected text. Once the bug in nvALT is fixed, the extension should work just fine.
  • Safari users: no update for you. Pretty sure that version works fine already. Also, the auto-update mechanism already works for the Safari extension. 

Download the new version of nvIt for Chrome, here.

It’s not an update, but here’s a quick link to the Safari version of the extension.

Tuesday, February 28, 2012

nvALT 2.2 Public Beta

nvALT has Lions in-line Find and ReplacenvALT has Lion’s in-line Find and Replace

Brett and I are excited to announce the public beta phase for nvALT 2.2; which includes Lion compatibility stuff, many bug fixes, a handful of new features, and a new markdown engine. You can read about new features and bug fixes below. We want to get this release beta tested a bit, and we’re hoping you’re up for the task.

2.2 definitely runs on 10.6 and 10.7. It should run on Leopard, but I am unable to test it. As with 2.1, and going forward, we’re unable to support PPC Macs. Apologies.

Since this is a beta, I just want to disclaim the standard disclaimer: its a beta! There will be bugs. You should back up your existing notes database (which, if you haven’t moved it, is at ~/Library/Application Support/Notational Data). We really need [Snow] Leopard testers, but 2.2 has mainly been tested on Lion so far. Which means more opportunities for you, as a beta tester, to find bugs. And report them.

There are still reported bugs that haven’t been fixed. We’re working on getting the release schedule moving a little faster, but be patient. Among the larger bugs we still need to fix are Simplenote escaping and a crasher when importing URLs as Markdown. Fixes coming soon.

While it is in beta, nvALT 2.2 will be on a separate update channel. This means you need to download the beta here. Once installed, you can just “Check for Updates…” within the app and you’ll get the freshest beta. When 2.2 becomes a final release, we’ll return to the official channel. So if you don’t want to beta test, stay on 2.1 and you’ll be able to update to 2.2 when its ready.

Please report bugs here. When you do, in the first line of that report include the following info: OS X version, hardware details about your Mac (ie 2008 2.4 GHz MBP), nvALT version from the About window (ie “Version 2.2b (93)”), AND whether you store your notes as separate files and what format (ie .txt) or as a database, and whether its secure. Also, tag your bug report using the “2.2 beta” tag.

Twitter is REALLY not a good place to do support/bug reporting stuff. Email is better, but could get drowned out. But the GitHub site is the best. Use the Git. If we’re not responding, and you really want/need us to THEN follow up that Git report with an email containing a link to that Git report.

On another note, I just want to express my gratitude for all the encouragement and support Brett and I have received over the last 9 months since merging our NV forks into nvALT 2. Also for patience. I realize its been quite some time since 2.1 was released. Since before Lion, which both introduced bugs and offered up some APIs (like full screen) that were crying out for nvALT support. It’s here now.

Enjoy. Download the nvALT 2.2 beta here.

p.s. one more thing: you can follow nvALT on Twitter now! @nvALTApp

Release Notes:

  • Requires Leopard & intel procssors now (we had tried previously to support Tiger/PPC, but neither Brett or I have access to either). Also, Leopard is getting increasingly harder to support. If your intel mac runs Leopard, it will run Snow Leopard; and it will run faster on 10.6, and will have more free space. There’s really no reason for you to keep an intel mac on Leopard. So it is likely we’ll move the minimum OS to Snow Leopard at some time in the next year. At which point we’ll stop cutting off support for older OSes so frequently.
  • If you have custom CSS and/or templates, they need to move to ~/Library/Application Support/nvALT. The blank print issues we’ve been having were caused by a CSS issue, and due to the way nvALT writes the default templates out we wouldn’t be able to update existing user’s files. The new support directory is created automatically when you run nvALT, and you can place custom.css and template.html directly into that folder and override the internal template and stylesheet. We’ll post some example styles soon.

Bug fixes and improvements for 10.5 - 10.7

  • Added some initial, optional, markdown auto-completion/syntax tricks (see below).
  • Improved auto-pairing
  • The “Keep note text width readable” (in Preferences » “Fonts & Colors”) is significantly improved; much less janky. (still needs to be renamed.)
  • Hitting cmd-return moves the cursor to the end of your current paragraph, and then inserts a new line (like TextMate).
  • Hitting cmd-shift-return moves the cursor to the start of your current paragraph.
  • Re-jiggered the (optional) menu bar icon/menu. clicking on the icon will hide/show nvALT’s window (even if you cmd-w/click on the red stop light to close the window, you can click the menu bar icon to bring back the window). Right-clicking/control-clicking the menu bar icon will drop down a contextual menu of useful commands.
  • The plus buttons in Prefs»Notes»Storage are back
  • Visual fixes to the location bar
  • Improved German Localization
  • Fixed text rendering bug
  • Added “Use Selection for Find” and “Jump to Selection” to the “Find…” menu (which is in the Edit menu).
  • Custom CSS and HTML files for the Markdown Preview window should now be stored in ~/Library/Application Support/nvALT/ (which will get created the first time you run 2.2)
  • MultiMarkdown updated to version 3, peg-multimarkdown. There are some minor changes in the way certain syntax is rendered (such as footnotes and citations), but it’s faster and up to date with the current development of MultiMarkdown.

Lion compatibility features and bug fixes

nvALT in full screen mode on LionnvALT in full screen mode on Lion

  • Lion full screen mode
  • Find… and Replace… features fixed. On Lion, implements the new in line (Safari style) Find bar.
  • Better compatibility with Lion scrollers. (There’s also a preference setting, in the needs-to-be-renamed Fonts & Colors section, to re-enable nvALT’s old custom scrollers in Lion. Useful if you like always seeing the scrollbar as a measure of the length of a note, and your position within the text).
  • Elastic scrolling.

Markdown auto-completion/syntax tricks

  • note: Unless otherwise noted, you have to “Enabled Markdown Completion” in the Preview menu (cmd-shift-m to toggle) for the following to work.
  • Cmd > adds a “>” to the start of your current paragraph(s) (i.e. increases quote level)
  • Cmd < removes a “>” from the start of your current paragraph(s) (i.e. decreases quote level)
  • Cmd + adds a “#” to the start of your current paragraph(s) (i.e. increases header level)
  • Cmd - removes a “#” from the start of your current paragraph(s) (i.e. decreases header level)
  • Cmd B Works exactly like bolding/unbolding text, except that it uses strong emphasis instead of BOLDed font. Will wrap/unwrap/rewrap selected text. Will insert **** and put your cursor in the middle if no text is selected.
  • Cmd I Same as with Cmd B, except uses emphasis instead of strong emphasis
  • Link syntax completion. A bit harder to describe. Easier to play around with and see. Basically, you can use the tab key to have nvALT autocomplete some of the syntax around Markdown links. It does 3 main things, I’ll explain by telling you 3 things to test out in a note in nvALT somewhere:

    1. Create a new line. Type “[1]” (or just “[1”, if you have auto-pairing turned on). Hit the tab key. nvALT will turn “[1]” into “[1]: http://”, and select “http://”. Hit the tab key again to deselect and move the cursor to the end of the line. Type “google.com”. You should now have a reference-style link of “[1]: http://google.com
    2. Elsewhere in the same note, add some random text so you have an opportunity to now use the reference link we just created. In that paragraph of random text type “[Google]” (or just “[Google” if you use auto-pairing). Now hit tab. nvALT will insert “[]” and put your cursor in the middle. Now type “1”. You’ve now referenced the link from above.
    3. Move your cursor elsewhere in that same paragraph of random text so you can create an inline-style link. Type “[Googs]” and hit shift-tab. nvALT will add “(http://)” and select “http://”. Hit tab or shift-tab again and nvALT will deselect and move the cursor after the “http://” and before the “)”. Type “google.com”. Now you’ve got an inline link.

Markdown Link Pasting

  • (Does not require the use of the “Enable Markdown Completion” menu item).
  • If you have a URL (and only the URL) on your clipboard, you can hit cmd-option-v (or use “Paste Markdown Link” in the Edit menu) to, yes, paste the URL on your clipboard as a markdown link. nvALT can tell if the cursor is on a new paragraph (and assumes you want to use a reference-style link) or an existing paragraph of text (and assumes you want to use an inline-style link).
  • This feature will also paste “around” selected text, using any text you’ve selected before using the “Paste Markdown Link” command as either the link text (for inline style links) or the reference link name (for reference links). So if you select all the text in a paragraph and Paste Markdown Link, nvALT will use the paragraph as the reference name, wrap it in “[]” and add “: http://the.link.com”. Play around with this. Much easier to see how it works, than explain it.
Thursday, February 16, 2012

Safari Extensions Fix

An apology and a fix. When OS X updated to 10.7.3 a couple weeks ago, Safari was also updated to 5.1.3. Something about that update caused a small bug with one of my Safari extensions, InstapaperIt, where the toolbar button icons got real small. When I went to fix that bug, I discovered that back when I updated to Lion (haven’t worked on the extensions since then) I lost my Safari Developer Certificate; which signs all my extensions, and which Safari requires (as a security measure). Without the certificate, I couldn’t update any extensions. 

I did the wrong thing in trying to re-install my certificate, and actually revoked it instead. This caused ALL my Safari extensions to break. And uninstall themselves automatically the next time a user launched Safari. 

What a cluster-f$@#k.

Anyhow. I apologize for any confusion, annoyance, and the general screw up. Will try to avoid such pitfalls in the future.

I have installed a Safari Developer Certificate. I have recompiled my extensions. They should work. I also fixed the toolbar icon for InstapaperIt. You can download them below.

One quick caveat. Safari extensions have a built in auto-update mechanism. In a world where I didn’t revoke my certificate I could just release the updated extension and Safari would help you update it. Since I revoked the certificate, Safari probably uninstalled the extension, so there’s nothing to update. If somehow that didn’t happen, Safari might auto-update the extension. It might not. Uncharted waters. If you have any of my extensions still installed and can’t seem to update them, uninstall them and use the download links below.

InstapaperIt

Instapaper Article Tools

Instapaper Greystyled

nvIt

p.s. If you’re just learning about my extensions now, you can read about the Instapaper related extensions here, and nvIt here.

Monday, September 26, 2011
CS5+Launchpad=special

CS5+Launchpad=special

Thursday, September 15, 2011

It’s coming…

Sunday, August 21, 2011

Mobile Safari+Instapaper tip

If you’ve ever been reading a page in Mobile Safari and wished you were reading it in Instapaper instead, this is the quickest way to back that happen: Install the javascript below as a bookmarklet in Safari. Whenever you want to add an article to Instapaper and switch to instapaper all you have to do is hit that bookmarklet up.

javascript:function%20ipNOW(){var%20d='i'+document.location;document.location=d;}ipNOW();void(0)

How does it work? A while back Instapaper added a url scheme “ihttp://…”. So that any url you open on your iOS device instantly switches you to Instapaper and adds that url (minus the ‘i’, of course) to your articles. This bookmarklet just takes the url of the webpage you’re at, prepends an ‘i’, and opens that link.

As with all bookmarklets and Mobile Safari, the clunkiest part is the install. Here’s one way to do it:

1. If you’re not reading this post in Mobile Safari, switch over to your iOS device and come back. Here’s a link back here, if that helps.

2. Bookmark this page on Mobile Safari. Go through all the steps to actually bookmark this page, only you can rename to bookmark to what you’d like your bookmarklet to be called, lets call it “ipNOW” as an example.

3. Scroll up to the javascript above, select it and copy it.

4. Go back to your bookmarks, tap the “Edit” button, and select the bookmark you created in Step 2. Tap the url field for that bookmark to edit it. Tap and hold and select all of the old tumblr url. Delete. Tap and hold and paste in the javascript.

done.

UPDATE: if you tried that javascript and it got scrambled on copy/paste in mobile safari, that was because i didn’t use the <code>tag</code> .  I fixed it. Try again. SHOULD work this time.

Friday, July 29, 2011

nvIt — Chrome and Safari extensions for nvALT

Brett and I just released nvALT 2.1 with a lot of bug fixes, UI improvements, and some new features. Some of my favorite additions:

- TextMate style auto-pairing of matched characters like parenthesis, brackets, and double quotes.

- Shortcut (CMD-Shift-L) for Inserting [[Links]]

Read more about it here.  Full release notes here. You can use the in-app update mechanism or download it here.

But I also just finished up developing Safari and Chrome extensions to extend nvALT’s notational velocity (or something ;) into the browser. 

They let you create a new note in Safari 4 different ways:

  • Click the toolbar button to have nvALT download the current page you’re on as a new note
  • Right-click on a link, and select the appropriate option from the contextual menu,  to have nvALT download the linked page as a new note.
  • Right-click away from either a link or a selection, and select the appropriate option from the contextual menu, to have nvALT download the current page you’re on as a new note.
  • Right-click on selected text, and select the appropriate option from the contextual menu, to have nvALT create a new note with the selected text as well as a link to the current page you’re on.

There’s an preference setting to have nvALT use Instapaper’s Mobilizer when downloading pages into new notes, so that those notes are more readable. This is not turned on by default. To turn it on go to the extension’s preference page.

Since these extensions require OS X and nvALT 2.1, I don’t have any plans to release them on their respective Browser’s extensions page. Check back here or follow me on Twitter @elasticthreads for updates to the extensions.

Please email any bug reports to elasticthreads att gmail.com  with “nvIt bug report” in the subject

Downloads:

Safari Extension

Chrome Extension

p.s. I’ll post the source for these on GitHub soon, but if you are willing and able to develop a Firefox version please email me. 

Thursday, July 28, 2011

InstapaperIt Safari extension users: if you updated to Safari 5.1 you need to re-enter Instapaper credentials in Preferences

If you updated to Safari 5.1 InstapaperIt might have stop working correctly for you.

When Safari updated to 5.1 it lost some of your extension settings. This includes your Instapaper login credentials you have to enter into InstapaperIt’s preferences.

To fix:

  • Go to Safari’s Preferences
  • Click on the Extensions tab,
  • Click on the InstapaperIt extension.
  • Re-enter your username/password.
  • Reload any pages currently open in Safari (so they reload the extension)