Changeset 12543
- Timestamp:
- 05/27/08 19:01:08 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/direct_bookmark.js
r11924 r12543 1 1 // Vimperator plugin: 'Direct Post to Social Bookmarks' 2 // Version: 0.0 63 // Last Change: 18-May-2008. Jan 20082 // Version: 0.07 3 // Last Change: 27-May-2008. Jan 2008 4 4 // License: Creative Commons 5 5 // Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid … … 44 44 // ':bentry' 45 45 // Goto Bookmark Entry Page 46 // ':bicon' 47 // Show Bookmark Count as Icon 46 48 (function(){ 47 49 var useServicesByPost = liberator.globalVariables.direct_sbm_use_services_by_post || 'hdl'; … … 348 350 liberator.echo("Hatena Bookmark: Tag parsing is finished. Taglist length: " + tags.length); 349 351 return hatena_tags; 352 }, 353 icon:function(url){ 354 return '<img src="http://b.hatena.ne.jp/entry/image/' + url + '" style="vertical-align: middle;" />'; 350 355 }, 351 356 }, … … 382 387 return returnValue; 383 388 }, 389 icon:function(url){ 390 var url = liberator.buffer.URL; 391 var cryptoHash = Cc["@mozilla.org/security/hash;1"].createInstance(Ci.nsICryptoHash); 392 cryptoHash.init(Ci.nsICryptoHash.MD5); 393 var inputStream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream); 394 inputStream.setData(url, url.length); 395 cryptoHash.updateFromStream(inputStream, -1); 396 var hash = cryptoHash.finish(false), ascii = []; 397 const hexchars = '0123456789ABCDEF'; 398 var hexrep = new Array(hash.length * 2); 399 for(var i = 0; i < hash.length; i++) { 400 ascii[i * 2] = hexchars.charAt((hash.charCodeAt(i) >> 4) & 0xF); 401 ascii[i * 2 + 1] = hexchars.charAt(hash.charCodeAt(i) & 0xF); 402 } 403 return '<img src="http://del.icio.us/feeds/img/savedcount/' + ascii.join('').toLowerCase() + '?aggregate" style="vertical-align: middle;" />'; 404 }, 384 405 }, 385 406 'l': { … … 417 438 liberator.echo("livedoor clip: Tag parsing is finished. Taglist length: " + tags.length); 418 439 return ldc_tags; 440 }, 441 icon:function(url){ 442 return '<img src="http://image.clip.livedoor.com/counter/' + url + '" style="vertical-align: middle;" />'; 419 443 }, 420 444 }, … … 512 536 } 513 537 ); 538 liberator.commands.addUserCommand(['bicon'],"Show Bookmark Count as Icon", 539 function(arg){ 540 var url = getNormalizedPermalink(liberator.buffer.URL); 541 var html = useServicesByTag.split(/\s*/).map(function(service){ 542 var currentService = services[service] || null; 543 return (currentService && typeof currentService.icon === 'function') ? 544 (currentService.description + ': ' + currentService.icon(url)) : null; 545 }).join('<br />'); 546 liberator.echo(html, true); 547 }, {}); 514 548 liberator.commands.addUserCommand(['sbm'],"Post to Social Bookmark", 515 549 function(arg){
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)