From 9ecbb96cd80e0725bcde7ede684e9da759bee9d1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 22 Oct 2012 16:57:40 +0900 Subject: [PATCH 1/4] write keysnail plugin list-current-urls.ks.js --- _keysnail.js | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 1e709f8..4246aa5 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -222,43 +222,6 @@ 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) + @@ -344,6 +307,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' ]; From 8f9379d3f5cb862607992b4c68a509509d16935e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 23 Oct 2012 22:06:37 +0900 Subject: [PATCH 2/4] fix my-dired-previous/next-line --- emacs.el | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/emacs.el b/emacs.el index b5a3a26..a4e649b 100644 --- a/emacs.el +++ b/emacs.el @@ -1267,33 +1267,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" From 3e4f0fe522d0e7f844afa5beaa8339c9c1d9f645 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 23 Oct 2012 23:51:13 +0900 Subject: [PATCH 3/4] fix dired-get-file-info --- emacs.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index a4e649b..364d936 100644 --- a/emacs.el +++ b/emacs.el @@ -1248,12 +1248,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))))) From f3b27eb72990010018f196c57775da67016bf2b6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 24 Oct 2012 20:30:14 +0900 Subject: [PATCH 4/4] add style but seems not to work --- _keysnail.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 4246aa5..e7922d2 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -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 + <>.toString() +); /////////////////////////////////// //search engine @@ -224,8 +231,8 @@ ext.add("strong-fullscreen", function(){ ext.add("bookmark-delicious", function(){ f= 'http://www.delicious.com/save?url=' + encodeURIComponent(window.content.location.href) + - '&title=' + encodeURIComponent(document.title) + - '¬es=' + encodeURIComponent('' + (window.getSelection ? + '&title=' + encodeURIComponent(document.title) + + '¬es=' + encodeURIComponent('' + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text)) + '&v=6&'; a = function(){