# Encoding: UTF-8

[{beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env perl\n#\n# Written by John Gruber, taken with permission from:\n# http://daringfireball.net/2007/03/javascript_bookmarklet_builder\n\nuse strict;\nuse warnings;\nuse URI::Escape qw(uri_escape_utf8);\nuse open  IO  => \":utf8\",       # UTF8 by default\n          \":std\";               # Apply to STDIN/STDOUT/STDERR\n\nmy $src = do { local $/; <> };\n\n# Zap the first line if there's already a bookmarklet comment:\n$src =~ s{^// ?javascript:.+\\n}{};\nmy $bookmarklet = $src;\n\n$bookmarklet =~ s{^\\s*//.+\\n}{}gm;  # Kill comments.\n$bookmarklet =~ s{\\t}{ }gm;         # Tabs to spaces\n$bookmarklet =~ s{ +}{ }gm;         # Space runs to one space\n$bookmarklet =~ s{^\\s+}{}gm;        # Kill line-leading whitespace\n$bookmarklet =~ s{\\s+$}{}gm;        # Kill line-ending whitespace\n$bookmarklet =~ s{\\n}{}gm;          # Kill newlines\n\n# Escape single- and double-quotes, spaces, control chars, unicode:\n$bookmarklet = \"javascript:\" .\n    uri_escape_utf8($bookmarklet, qq('\" \\x00-\\x1f\\x7f-\\xff));\n\nprint \"// $bookmarklet\\n\" . $src;\n\n# Put bookmarklet on clipboard:\n`/bin/echo -n '$bookmarklet' | /usr/bin/pbcopy`;\n",
  input: "selection",
  keyEquivalent: "^H",
  name: "Copy as Bookmarklet to Clipboard",
  output: "replaceSelectedText",
  scope: "source.js",
  uuid: "20E61C43-B81F-4FB9-9362-BFFE668EB9C9"},
 {beforeRunningCommand: "nop",
  command: 
   "# index created using: curl -s 'http://devguru.com/technologies/javascript/index.asp'|grep -o '<a href=\"[0-9]*.asp\">[a-z][a-zA-Z]*</a>'|perl -pe 's/<a href=\"([^\"]*)\">([^<]*)<\\/a>/$2\\t$1/'|sort|uniq|gzip >dev_guru_index.gz\n\nref=$(zgrep -w \"^${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}\" \"$TM_BUNDLE_SUPPORT/dev_guru_index.gz\"|cut -f2)\n\n[[ -n \"$ref\" ]] && exit_show_html \"<meta http-equiv='Refresh' content='0;URL=http://devguru.com/technologies/javascript/$ref'>\"\n\necho \"No documentation found.\"",
  fallbackInput: "word",
  input: "selection",
  keyEquivalent: "^h",
  name: "Documentation for Word / Selection",
  output: "showAsTooltip",
  scope: "source.js",
  uuid: "B4874A14-2491-465A-A349-61E4EBCF4700"},
 {beforeRunningCommand: "nop",
  command: 
   "cat <<SNIPPET\nfunction ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}(\\${1:args}) {\n\t\\$0\n}\nSNIPPET",
  fallbackInput: "word",
  input: "selection",
  keyEquivalent: "$\n",
  name: "New Function",
  output: "insertAsSnippet",
  scope: "source.js",
  uuid: "73951799-AC15-40A6-81DB-EC051AB4A033"},
 {beforeRunningCommand: "nop",
  command: 
   "cat <<SNIPPET\n${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}: function(\\${1:args}) {\n\t\\$0\n}\\${2:,}\nSNIPPET",
  fallbackInput: "word",
  input: "selection",
  keyEquivalent: "~$\n",
  name: "New Method",
  output: "insertAsSnippet",
  scope: "source.js",
  uuid: "1717B5AE-209B-4548-9155-9E88A7230C1C"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env php\n<?php\n/*\n\nJS Beautifier\n\n(c) 2007, Einars \"elfz\" Lielmanis\n\nhttp://elfz.laacz.lv/beautify/\n\nYou are free to use this in any way you want, in case you find this useful or working for you.\n\nPorted with permission to TextMate by Ale Muñoz.\n\n(Based on v42 of JS Beautifier)\n\n*/\n\nrequire($_ENV['TM_BUNDLE_SUPPORT'] . '/lib/beautify.php'); \n\nif (isset($_ENV['TM_SELECTED_TEXT'])) {\n  $input = get_magic_quotes_gpc() ? stripslashes($_ENV['TM_SELECTED_TEXT']) : $_ENV['TM_SELECTED_TEXT'];\n} else {\n  $input = file_get_contents('php://stdin');\n}\n\nprint js_beautify($input);\n\n?>",
  input: "selection",
  keyEquivalent: "^H",
  name: "Reformat Document / Selection",
  output: "replaceSelectedText",
  scope: "source.js",
  uuid: "36EC03E9-EFF4-479A-AB90-8DFA16800642"}]
