Changeset 13282

Show
Ignore:
Timestamp:
06/05/08 20:06:48 (5 years ago)
Author:
trapezoid
Message:

直後にページ遷移すると遷移後のページがブックマークされる可能性があったのを修正しました

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/direct_bookmark.js

    r13217 r13282  
    11// Vimperator plugin: 'Direct Post to Social Bookmarks' 
    2 // Version: 0.09 
    3 // Last Change: 04-Jun-2008. Jan 2008 
     2// Version: 0.10 
     3// Last Change: 05-Jun-2008. Jan 2008 
    44// License: Creative Commons 
    55// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid 
     
    4444//  ':bentry' 
    4545//      Goto Bookmark Entry Page 
    46 //  ':bicon' 
    47 //      Show Bookmark Count as Icon 
    4846(function(){ 
    4947    var evalFunc = window.eval; 
     
    5553            } 
    5654        } 
    57     } catch(e) { liberator.log('warning: wassr.js is working with unsafe sandbox.'); } 
     55    } catch(e) { liberator.log('warning: direct_bookmark.js is working with unsafe sandbox.'); } 
    5856 
    5957    var useServicesByPost = liberator.globalVariables.direct_sbm_use_services_by_post || 'hdl'; 
     
    323321            loginPrompt:{ user:'', password:'', description:'Enter username and password.' }, 
    324322            entryPage:'http://b.hatena.ne.jp/entry/%URL%', 
    325             poster:function(user,password,url,comment,tags){ 
     323            poster:function(user,password,url,title,comment,tags){ 
    326324                var tagString = tags.length > 0 ? '[' + tags.join('][') + ']' : ""; 
    327325                var request = 
     
    370368            loginPrompt:{ user:'', password:'', description:'Enter username and password.' }, 
    371369            entryPage:'http://del.icio.us/url/%URL::MD5%', 
    372             poster:function(user,password,url,comment,tags){ 
    373                 var title = liberator.buffer.title; 
     370            poster:function(user,password,url,title,comment,tags){ 
    374371                var request_url = 'https://api.del.icio.us/v1/posts/add?' + [ 
    375372                    ['url', url], ['description', title], ['extended', comment], ['tags', tags.join(' ')] 
     
    419416            loginPrompt:{ user:'', password:'apikey', description:'Enter username and apikey.\nyou can get "api-key" from\n\thttp://clip.livedoor.com/config/api' }, 
    420417            entryPage:'http://clip.livedoor.com/page/%URL%', 
    421             poster:function(user,password,url,comment,tags){ 
    422                 var title = liberator.buffer.title; 
     418            poster:function(user,password,url,title,comment,tags){ 
    423419                var request_url = 'http://api.clip.livedoor.com/v1/posts/add?' + [ 
    424420                    ['url', url], ['description', title], ['extended', comment], ['tags', tags.join(' ')] 
     
    458454            loginPrompt:null, 
    459455            entryPage:'%URL%', 
    460             poster:function(user,password,url,comment,tags){ 
     456            poster:function(user,password,url,title,comment,tags){ 
    461457                var request_url = 'http://www.google.com/bookmarks/mark'; 
    462458                var params = [ 
    463                     ['bkmk', url], ['title', liberator.buffer.title], ['labels', tags.join(',')] 
     459                    ['bkmk', url], ['title', title], ['labels', tags.join(',')] 
    464460                ].map(function(p) p[0] + '=' + encodeURIComponent(p[1])).join('&'); 
    465461                return Deferred.http({ 
     
    481477            loginPrompt:null, 
    482478            entryPage:'%URL%', 
    483             poster:function(user,password,url,comment,tags){ 
     479            poster:function(user,password,url,title,comment,tags){ 
    484480                const taggingService = Cc["@mozilla.org/browser/tagging-service;1"].getService(Ci.nsITaggingService); 
    485481                var nsUrl = Cc["@mozilla.org/network/standard-url;1"].createInstance(Ci.nsIURL); 
     
    487483                taggingService.tagURI(nsUrl,tags); 
    488484                try{ 
    489                     Application.bookmarks.tags.addBookmark(liberator.buffer.title, nsUrl); 
     485                    Application.bookmarks.tags.addBookmark(title, nsUrl); 
    490486                }catch(e){ 
    491487                    throw "Places: faild"; 
     
    590586            } 
    591587 
     588            var url = liberator.buffer.URL; 
     589            var title = liberator.buffer.title; 
     590 
    592591            targetServices.split(/\s*/).forEach(function(service){ 
    593592                var user, password, currentService = services[service] || null; 
     
    595594                d = d.next(function() currentService.poster( 
    596595                    user,password, 
    597                     isNormalize ? getNormalizedPermalink(liberator.buffer.URL) : liberator.buffer.URL, 
     596                    isNormalize ? getNormalizedPermalink(url) : url,title, 
    598597                    comment,tags 
    599598                ));