From ddfed77f12d1fd9642e8dac426313d9177b19376 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 21 Mar 2012 01:09:40 +0900 Subject: Good Bye Sharp Variables!!! http://www.youtube.com/watch?v=YUjrGq5aAiM --- tabsort.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'tabsort.js') diff --git a/tabsort.js b/tabsort.js index 82371a1..40023e5 100644 --- a/tabsort.js +++ b/tabsort.js @@ -1,5 +1,5 @@ /* NEW BSD LICENSE {{{ -Copyright (c) 2009, anekos. +Copyright (c) 2009-2012, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -38,10 +38,9 @@ let PLUGIN_INFO = tabsort Add ":tabsort" and ":tabuniq" command. ":tabsort", ":tabuniq" コマンドを追加する - 1.1.3 + 1.1.4 anekos 2.3 - 2.3 https://github.com/vimpr/vimperator-plugins/raw/master/tabsort.js new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -68,17 +67,21 @@ let PLUGIN_INFO = function memberCompare (name) function (a, b) a[name].toString().localeCompare(b[name].toString()); - function getTabs () [ - { - index: i, - tab: tab, - browser: #1=(tab.linkedBrowser), - doc: #2=(#1#.contentDocument), - url: (#1#.__SS_restore_data ? #1#.__SS_restore_data.url : (#2#.location && #2#.location.href)), - title: (#1#.__SS_restore_data ? #1#.__SS_restore_data.title : #2#.title) + function getTabs () { + function gen(tab, i) { + let browser = tab.linkedBrowser; + let doc = browser.contentDocument; + return { + index: i, + tab: tab, + browser: browser, + doc: doc, + url: (browser.__SS_restore_data ? browser.__SS_restore_data.url : (doc.location && doc.location.href)), + title: (browser.__SS_restore_data ? browser.__SS_restore_data.title : doc.title) + }; } - for ([i, tab] in util.Array(config.browser.mTabs)) - ]; + return [gen(tab, i) for ([i, tab] in Iterator(config.browser.mTabs))]; + } function tabUniq (cmp) { let rms = []; -- cgit v1.2.3