diff options
-rw-r--r-- | ego_counter.js | 9 | ||||
-rw-r--r-- | pixiv.js | 17 | ||||
-rw-r--r-- | simg.js | 18 | ||||
-rw-r--r-- | tinami.js | 18 | ||||
-rw-r--r-- | walk-input.js | 20 |
5 files changed, 61 insertions, 21 deletions
diff --git a/ego_counter.js b/ego_counter.js index 77c8f36..66a3e03 100644 --- a/ego_counter.js +++ b/ego_counter.js @@ -33,10 +33,9 @@ }; })(); - let myHatebu = document.getElementById('status-bar') - .insertBefore(document.createElement('statusbarpanel'), - document.getElementById('security-button') - .nextSibling); + let myHatebu = document.getElementById('status-bar').appendChild( + document.createElement('statusbarpanel') + ); myHatebu.setAttribute('id', 'my-hatebu-count-icon'); myHatebu.setAttribute('class', 'statusbarpanel-iconic'); update(rotate(true)); @@ -47,3 +46,5 @@ }, false); })() + +// vim: sw=2 ts=2 et: @@ -1,6 +1,6 @@ // INFO // var INFO = -<plugin name="pixiv.js" version="0.5" +<plugin name="pixiv.js" version="0.6" summary="Download image from pixiv" href="http://github.com/vimpr/vimperator-plugins/blob/master/pixiv.js" xmlns="http://vimperator.org/namespaces/liberator"> @@ -77,8 +77,8 @@ commands.addUserCommand( } return path; }; - let savePath=directoryPicker(); - if(savePath.length<1) return; + let saveDirectory=directoryPicker(); + if(saveDirectory.length<1) return; let getDOMHtmlDocument=function(str){ let doc; @@ -131,11 +131,20 @@ commands.addUserCommand( if (-1!=fileName.indexOf('?')){ fileName=fileName.substr(0,fileName.indexOf('?')); } - let tmpPath=savePath+fileName; + let tmpPath=saveDirectory+fileName; let instream=xhrImg.responseText; let aFile=Cc["@mozilla.org/file/local;1"] .createInstance(Ci.nsILocalFile); aFile.initWithPath(tmpPath); + if(true===aFile.exists()){ + let value=window.prompt('すでに同じ名前のファイルがあります。デフォルトファイル名を変更してください。',fileName.substr(1)); + if(null===value){ + return false; + } + fileName='/'+value; + tmpPath=saveDirectory+fileName; + aFile.initWithPath(tmpPath); + } let outstream=Cc["@mozilla.org/network/safe-file-output-stream;1"] .createInstance(Ci.nsIFileOutputStream); outstream.init(aFile,0x02|0x08|0x20,0664,0); @@ -1,6 +1,6 @@ // INFO // var INFO = -<plugin name="simg.js" version="0.2" +<plugin name="simg.js" version="0.3" summary="Save image on contents area" href="http://github.com/vimpr/vimperator-plugins/blob/master/simg.js" xmlns="http://vimperator.org/namespaces/liberator"> @@ -45,19 +45,29 @@ commands.addUserCommand( return path; }; - let savePath=directoryPicker(); - if(savePath.length<1) return; + let saveDirectory=directoryPicker(); + if(saveDirectory.length<1) return; let imgURL=contents.URL; + let savePath; let trueCurrntImg=function(){ let fileName=imgURL.substr(imgURL.lastIndexOf('/')); if (-1!=fileName.indexOf('?')){ fileName=fileName.substr(0,fileName.indexOf('?')); } - savePath=savePath+fileName; + savePath=saveDirectory+fileName; let instream=xhrImg.responseText; let aFile=Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); aFile.initWithPath(savePath); + if(true===aFile.exists()){ + let value=window.prompt('すでに同じ名前のファイルがあります。デフォルトファイル名を変更してください。',fileName.substr(1)); + if(null===value){ + return false; + } + fileName='/'+value; + savePath=saveDirectory+fileName; + aFile.initWithPath(savePath); + } let outstream=Cc["@mozilla.org/network/safe-file-output-stream;1"] .createInstance(Ci.nsIFileOutputStream); outstream.init(aFile,0x02|0x08|0x20,0664,0); @@ -1,6 +1,6 @@ // INFO // var INFO = -<plugin name="tinami.js" version="0.1" +<plugin name="tinami.js" version="0.2" summary="Download image from tinami" href="http://github.com/vimpr/vimperator-plugins/blob/master/tinami.js" xmlns="http://vimperator.org/namespaces/liberator"> @@ -59,17 +59,27 @@ commands.addUserCommand( let cookie=contents.cookie; let xhrImgInfo; let xhrImg; - let savePath=directoryPicker(); - if(savePath.length<1) return; + let saveDirectory=directoryPicker(); + if(saveDirectory.length<1) return; let imgUrl; + let savePath; let trueTinamiImg=function(){ let fileName=imgUrl.substr(imgUrl.lastIndexOf('/')); - savePath=savePath+fileName; + savePath=saveDirectory+fileName; let instream=xhrImg.responseText; let aFile=Cc["@mozilla.org/file/local;1"] .createInstance(Ci.nsILocalFile); aFile.initWithPath(savePath); + if(true===aFile.exists()){ + let value=window.prompt('すでに同じ名前のファイルがあります。\nデフォルトファイル名を変更してください。',fileName.substr(1)); + if(null===value){ + return false; + } + fileName='/'+value; + savePath=saveDirectory+fileName; + aFile.initWithPath(savePath); + } let outstream=Cc["@mozilla.org/network/safe-file-output-stream;1"] .createInstance(Ci.nsIFileOutputStream); outstream.init(aFile,0x02|0x08|0x20,0664,0); diff --git a/walk-input.js b/walk-input.js index 77d4caa..04f21f5 100644 --- a/walk-input.js +++ b/walk-input.js @@ -1,8 +1,8 @@ // Vimperator plugin: 'Walk Input' -// Last Change: 2009-01-25 // License: BSD -// Version: 1.1 +// Version: 1.2.2 // Maintainer: Takayama Fumihiko <tekezo@pqrs.org> +// anekos <anekos@snca.net> // ------------------------------------------------------------ // The focus walks <input> & <textarea> elements. @@ -20,11 +20,12 @@ // PLUGIN_INFO {{{ let INFO = -<plugin name="Walk-Input" version="1.2" +<plugin name="Walk-Input" version="1.2.2" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/walk-input.js" summary="The focus walks 'input' and 'textarea' element." xmlns="http://vimperator.org/namespaces/liberator"> <author email="tekezo@pqrs.org">Takayama Fumihiko</author> + <author email="anekos@snca.net">anekos</author> <license>BSD</license> <project name="Vimperator" minVersion="2.2"/> <p> @@ -81,7 +82,16 @@ var types = [ "tel", "color", ].map(function(type) "@type=" + type.quote()).join(" or "); -var xpath = '//input[' + types + ' or not(@type)] | //textarea'; +var xpath = '//input[(' + types + ' or not(@type)) and not(@disabled)] | //textarea'; + +function isVisible (elem) { + while (elem && !(elem instanceof HTMLDocument)) { + if (/^none$/i.test(getComputedStyle(elem, '').display)) + return false; + elem = elem.parentNode; + } + return true; +} var walkinput = function (forward) { var focused = document.commandDispatcher.focusedElement; @@ -96,7 +106,7 @@ var walkinput = function (forward) { let r = doc.evaluate(xpath, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0, l = r.snapshotLength; i < l; ++i) { let e = r.snapshotItem(i); - if (/^none$/i.test(getComputedStyle(e, '').display)) + if (!isVisible(e)) continue; let ef = {element: e, frame: frame}; list.push(ef); |