view bin/subtly @ 50:e1262140937e tip

Removed follow temporarily
author unexist
date Sun, 24 Jan 2010 17:28:25 +0100
parents 878a40d32d22
children
line wrap: on
line source
#!/usr/bin/ruby
##
# @package subtly
#
# @file subtly
# @author Christoph Kappel <unexist@dorfelite.net>
# @version $Id: subtly.rb,v 27 2010/01/22 14:57:49 unexist $
#
# This program can be distributed under the terms of the GNU GPL.
##
 
require "subtly/browser"

b = Subtly::Browser.new

# Add keys
b.add_keys({
  "o"   => :SubtlyUriOpen,
  "O"   => :SubtlyUriEdit,
  "p"   => :SubtlyUriPaste,
  "y"   => :SubtlyUriYank,
  "i"   => :SubtlyModeInsert,
  "Esc" => :SubtlyModeCommand,
  "s"   => :SubtlyBrowserStop,
  "b"   => :SubtlyBrowserBack,
  "m"   => :SubtlyBrowserForward,
  "r"   => :SubtlyBrowserReloadCache,
  "R"   => :SubtlyBrowserReload,
  "+"   => :SubtlyBrowserZoomIn,
  "-"   => :SubtlyBrowserZoomOut,
  "/"   => :SubtlyFindForward,
  "\\"  => :SubtlyFindBackward,
  "gg"  => :SubtlyScrollTop,
  "G"   => :SubtlyScrollBottom,
  "ZZ"  => :SubtlyQuit,

  # Jumps
  "g_"  => "http://www.google.de/search?q=%s",

  # Javascript
  "t"   => "alert('test')"
})

# Set proxy
#b.proxy = "http://localhost:8118"

# Set default page
b.uri = ARGV[0] || "http://www.google.de"

# Hooks
=begin
b.on(:link_hover) do |uri|
  puts "Hover %s" % [ uri ]
end

b.on(:link_unhover) do
  puts "Unhover"
end

b.on(:title_change) do |title|
  puts "Title %s" % [ title ]
end

b.on(:scroll) do |percent|
  puts "Scroll %d" % [ percent ]
end

b.on(:progress) do |percent|
  puts "Progress %d" % [ percent ]
end

b.on(:load_start) do |uri|
  puts "Load %s" % [ uri ]
end

b.on(:load_finish) do
  puts "Finished"
end

b.on(:exit) do
  puts "Exit"
end

b.on(:keypress) do |key|
  puts "Key %d" % [ key ]
end
=end

b.run

# vim:ts=2:bs=2:sw=2:et:fdm=marker