Browse Source

Merge branch 'master' of github.com:10sr/dotfiles

pull/1/head
10sr 12 years ago
parent
commit
88c16f9ceb
2 changed files with 39 additions and 62 deletions
  1. +10
    -39
      _keysnail.js
  2. +29
    -23
      emacs.el

+ 10
- 39
_keysnail.js View File

@@ -26,6 +26,13 @@ function ignore(k, i) [k, null];
///////////////////////////////////////////
//// firefox
// style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}");
style.register( //not work
<><![CDATA[
input,textarea {
font-family: monospace !important;
}
]]></>.toString()
);

///////////////////////////////////
//search engine
@@ -222,47 +229,10 @@ ext.add("strong-fullscreen", function(){

}, "go fullscreen with hiding toolbar and tabbar");

ext.add("list-page-url", function(){
// window.content.document.links
var urls = [];
var aa = window.content.document.getElementsByTagName("a");
var text = "";
var alt = "";
for (var i = 0; i < aa.length ; i++) {
if(aa[i].href == ""){ continue; }

if (aa[i].text == "" && aa[i].hasChildNodes() && aa[i].childNodes[0].nodeType == Node.ELEMENT_NODE){
alt = aa[i].childNodes[0].getAttribute("alt");
text = " " + aa[i].childNodes[0].nodeName + (alt ? ": " + alt : "");
}else{
text = aa[i].text;
}
urls.push([text, decodeURIComponent(aa[i].href)]);
}

if(urls.length == 0){
display.echoStatusBar("No url found.");
return;
}

prompt.selector(
{
message : "Select URL",
collection : urls,
width : [35, 65],
header : ["text", "url"],
callback : function (i) {
if (i >= 0)
openUILinkIn(urls[i][1], "tab"); // or current tabshifted window
}
}
);
}, "list url");

ext.add("bookmark-delicious", function(){
f= 'http://www.delicious.com/save?url=' + encodeURIComponent(window.content.location.href) +
'&title=' + encodeURIComponent(document.title) +
'&notes=' + encodeURIComponent('' + (window.getSelection ?
'&title=' + encodeURIComponent(document.title) +
'&notes=' + encodeURIComponent('' + (window.getSelection ?
window.getSelection() : document.getSelection ?
document.getSelection() : document.selection.createRange().text)) + '&v=6&';
a = function(){
@@ -344,6 +314,7 @@ ext.add('auto-install-plugins', function(ev, arg){
'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js',
'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js',
'https://raw.github.com/10sr/keysnail-plugin/master/pixiv_autojump.ks.js',
'https://raw.github.com/10sr/keysnail-plugin/master/list-current-urls.ks.js',
'https://raw.github.com/gist/1976942/firefox-addon-manager.ks.js',
'https://raw.github.com/gist/1450594/mstranslator.ks.js'
];


+ 29
- 23
emacs.el View File

@@ -1249,12 +1249,12 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
(defun dired-get-file-info ()
"dired get file info"
(interactive)
(let ((f (dired-get-filename)))
(let ((f (shell-quote-argument (dired-get-filename t))))
(if (file-directory-p f)
(progn
(message "calculating du...")
(message "Calculating disk usage...")
(shell-command (concat "du -hsD "
(shell-quote-argument f))))
f)))
(shell-command (concat "file "
f)))))

@@ -1268,33 +1268,39 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
(interactive)
(my-dired-next-line (- (window-height) 1)))

;; (defun my-dired-forward-line (arg)
;; ""
;; (interactive "p"))

(defun my-dired-previous-line (arg)
""
(interactive "p")
(when (> arg 0)
;; (ignore 'my-dired-print-current-dir-and-file)
(dired-previous-line 1)
(when (eq (line-number-at-pos)
2)
(goto-char (point-max))
(forward-line -1)
(dired-move-to-filename))
(my-dired-previous-line (- arg 1))
))
(if (> arg 0)
(progn
;; (ignore 'my-dired-print-current-dir-and-file)
(forward-line -1)
(when (eq (line-number-at-pos)
1)
(goto-char (point-max)))
(my-dired-previous-line (if (dired-get-filename nil t)
(- arg 1)
arg)))
(dired-move-to-filename)))

(defun my-dired-next-line (arg)
""
(interactive "p")
(when (> arg 0)
;; (ignore 'my-dired-print-current-dir-and-file)
(dired-next-line 1)
(when (eq (point)
(point-max))
(goto-char (point-min))
(forward-line 2)
(dired-move-to-filename))
(my-dired-next-line (- arg 1))
))
(if (> arg 0)
(progn
;; (ignore 'my-dired-print-current-dir-and-file)
(forward-line 1)
(when (eq (point)
(point-max))
(goto-char (point-min)))
(my-dired-next-line (if (dired-get-filename nil t)
(- arg 1)
arg)))
(dired-move-to-filename)))

(defun my-dired-print-current-dir-and-file ()
(message "%s %s"


Loading…
Cancel
Save