home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 9866 / 9866.xpi / modules / samfind_modsbservices.jsm < prev    next >
Encoding:
Text File  |  2009-12-13  |  43.5 KB  |  1,482 lines

  1. //-------------------------------------------------------------------------------------------
  2. // Social & Bookmarking services module.
  3. //-------------------------------------------------------------------------------------------
  4.  
  5. const Cc = Components.classes;
  6. const Ci = Components.interfaces;
  7.  
  8. var EXPORTED_SYMBOLS = ["samfind_modsbservices"];
  9.  
  10. var samfind_modsbservices_json = { JSON : null };
  11. Components.utils.import("resource://samfind/JSON.jsm", samfind_modsbservices_json);
  12. Components.utils.import("resource://samfind/samfind_modutils.jsm");
  13.  
  14. var samfind_modsbservices =
  15. {
  16.     _services : null,
  17.     _services_dynamic : null,
  18.  
  19.     _init : function()
  20.     {
  21.         samfind_modsbservices._services = {
  22.              aim : "AIM Share",
  23.              amazon : "Amazon Wishlist",
  24.              allvoices : "Allvoices",
  25.              ask : "Ask",
  26.              attentionmeter : "AttentionMeter",
  27.              ballhype : "BallHype",
  28.              barrapunto : "Barrapunto",
  29.              bebo : "Bebo",
  30.              bitly : "bit.ly",
  31.              bizsugar : "bizSugar",
  32.              blinklist : "BlinkList",
  33.              blogger : "Blogger",
  34.              bloglines : "Bloglines",
  35.              blogmemesfr : "BlogMemes.fr",
  36.              bookmarksfr : "Bookmarks.fr",
  37.              bx : "Business Exchange",
  38.              care2 : "Care2",
  39.              citeulike : "CiteULike",
  40.              cliqset : "Cliqset",
  41.              connotea : "Connotea",
  42.              current : "Current",
  43.              dailyme : "DailyMe",
  44.              delicious : "Delicious",
  45.              designbump : "Design Bump",
  46.              designfloat : "Design Float",
  47.              digg : "Digg",
  48.              diggita : "Diggita",
  49.              diigo : "Diigo",
  50.              dotnetkicks : "DotNetKicks",
  51.              dropjack : "Dropjack",
  52.              dzone : "DZone",
  53.              ekudos : "eKudos",
  54.              email : "Email to a friend",
  55.              evernote : "Evernote",
  56.              facebook : "Facebook",
  57.              fark : "Fark",
  58.              faves : "Faves",
  59.              favoritus : "Favoritus",
  60.              fnews : "Fnews",
  61.              followup : "FollowUp",
  62.              foxiewire : "FoxieWire",
  63.              fresqui : "Fresqui",
  64.              friendfeed : "FriendFeed",
  65.              fsdaily : "FSDaily",
  66.              funp : "Funp",
  67.              gabbr : "Gabbr",
  68.              gather : "Gather",
  69.              globalgrind : "Global Grind",
  70.              gmail : "Gmail",
  71.              googlebookmarks : "Google Bookmarks",
  72.              googlenotebook : "Google Notebook",
  73.              googlereader : "Google Reader",
  74.              hatena : "Hatena",
  75.              healthranker : "Health Ranker",
  76.              hellotxt : "HelloTxt",
  77.              hemidemi : "HEMiDEMi",
  78.              hipstr : "hipstr",
  79.              hotmail : "Hotmail",
  80.              hyves : "Hyves.nl",
  81.              identica : "Identi.ca",
  82.              indianpad : "IndianPad",
  83.              instapaper : "Instapaper",
  84.              isgd : "is.gd",
  85.              jumptags : "Jumptags",
  86.              kaboodle : "Kaboodle",
  87.              kirtsy : "Kirtsy",
  88.              laterthis : "LaterThis",
  89.              linkarena : "linkARENA",
  90.              linkagogo : "linkaGoGo",
  91.              linkninja : "Link Ninja",
  92.              linkedin : "LinkedIn",
  93.              live : "Live",
  94.              livejournal : "LiveJournal",
  95.              lunch : "Lunch",
  96.              meneame : "Meneame",
  97.              misterwong : "Mister Wong",
  98.              mixx : "Mixx",
  99.              mozillaca : "Mozillaca",
  100.              multiply : "Multiply",
  101.              myaol : "MyAOL",
  102.              myshare : "MyShare",
  103.              myspace : "MySpace",
  104.              n4g : "N4G",
  105.              netvibes : "Netvibes",
  106.              netvouz : "Netvouz",
  107.              newstrust : "NewsTrust",
  108.              newsvine : "Newsvine",
  109.              nujij : "NUjij",
  110.              oknotizie : "OKNOtizie",
  111.              oneviewcom : "oneview.com",
  112.              oneviewde : "oneview.de",
  113.              orkut : "Orkut",
  114.              picnik : "Picnik",
  115.              pingfm : "Ping.fm",
  116.              plurk : "Plurk",
  117.              posterous : "Posterous",
  118.              propeller : "Propeller",
  119.              pusha : "Pusha",
  120.              quantcast : "Quantcast",
  121.              reddit : "Reddit",
  122.              scoopeo : "Scoopeo",
  123.              scoopit : "Scoopit",
  124.              segnalo : "Segnalo",
  125.              shoutwire : "ShoutWire",
  126.              simpy : "Simpy",
  127.              slashdot : "Slashdot",
  128.              smaknews : "SmakNews",
  129.              socialmedian : "socialmedian",
  130.              socialogs : "Socialogs",
  131.              soup : "Soup",
  132.              sphere : "Sphere It!",
  133.              sphinn : "Sphinn",
  134.              spring : "Spring",
  135.              spurl : "Spurl",
  136.              squidoo : "Squidoo",
  137.              strands : "Strands",
  138.              streakr : "Streakr",
  139.              stumble : "Stumble!",
  140.              stumbleupon : "StumbleUpon",
  141.              stumpedia : "Stumpedia",
  142.              stylehive : "Stylehive",
  143.              supr : "Su.pr",
  144.              swik : "SWiK",
  145.              symbaloo : "Symbaloo",
  146.              tailrank : "Tailrank",
  147.              tbuzz : "TBUZZ",
  148.              technorati : "Technorati",
  149.              thisnext : "ThisNext",
  150.              tinyurl : "TinyURL",
  151.              tipd : "Tip'd",
  152.              trim2 : "tr.im",
  153.              truemors : "Truemors",
  154.              tumblr : "Tumblr",
  155.              twackle : "Twackle",
  156.              twiddla : "Twiddla",
  157.              twine : "Twine",
  158.              twitter : "Twitter",
  159.              viadeo : "Viadeo",
  160.              visualize : "vi.sualize.us",
  161.              weheartit : "We heart it",
  162.              wikio : "Wikio",
  163.              wists : "Wists",
  164.              wordpress : "WordPress",
  165.              xanga : "Xanga",
  166.              xerpi : "Xerpi",
  167.              yahoobookmarks : "Yahoo! Bookmarks",
  168.              yahoobuzz : "Yahoo! Buzz",
  169.              yammer : "Yammer",
  170.              ycombinator : "Y Combinator",
  171.              yigg : "YiGG",
  172.              yoolink : "Yoolink",
  173.              youmob : "YouMob"
  174.         };
  175.         //
  176.         samfind_modsbservices._services_dynamic = new Array(
  177.             "delicious",
  178.             "digg",
  179.             "reddit"
  180.         );
  181.       },
  182.  
  183.     createButtons : function(services, parent, dataProvider, sidebarOpener)
  184.     {
  185.         var dynamic = false;
  186.         var space = samfind_modutils._pref_branch.getCharPref("social.space");
  187.         for (var i=0; i<services.length; ++i)
  188.         {
  189.             var service = services[i];
  190.             switch (service)
  191.             {
  192.                 case "delicious":
  193.                 case "digg":
  194.                 case "reddit":
  195.                     {
  196.                         dynamic = true;
  197.                     }
  198.                 default:
  199.                     {
  200.                         samfind_modsbservices.createButton(service, parent, dataProvider, sidebarOpener);
  201.                     }
  202.             }
  203.             if (i != services.length - 1 && space != "small")
  204.             {
  205.                 var spacer = parent.appendChild(parent.ownerDocument.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "spacer"));
  206.                 spacer.width = (space == "medium" ? 3 : 6);
  207.             }
  208.         }
  209.         return dynamic;
  210.     },
  211.  
  212.     createButton : function(service, parent, dataProvider, sidebarOpener)
  213.     {
  214.         var service_text = samfind_modsbservices._services[service];
  215.         var toolbarbutton = parent.appendChild(parent.ownerDocument.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "toolbarbutton"));
  216.         toolbarbutton.setAttribute("id", "samfind-" + service);
  217.         toolbarbutton.setAttribute("class", "samfindsb sb-" + service);
  218.         toolbarbutton.setAttribute("dataprovider", dataProvider);
  219.         var command_share = "samfind_modsbservices.share(" + dataProvider + ", '" + service + "');";
  220.         switch (service)
  221.         {
  222.             case "amazon":
  223.                 {
  224.                     toolbarbutton.setAttribute("tooltiptext", "Save to your Amazon Wishlist");
  225.                     toolbarbutton.setAttribute("oncommand", command_share);
  226.                 }
  227.                 break;
  228.             case "attentionmeter":
  229.                 {
  230.                     toolbarbutton.setAttribute("tooltiptext", "Compare with AttentionMeter");
  231.                     toolbarbutton.setAttribute("oncommand", command_share);
  232.                 }
  233.                 break;
  234.             case "bitly":
  235.                 {
  236.                     toolbarbutton.setAttribute("tooltiptext", "Shorten URL with bit.ly");
  237.                     var login = samfind_modutils._pref_branch.getCharPref("bitly.user.login");
  238.                     var apikey = samfind_modutils._pref_branch.getCharPref("bitly.user.apikey");
  239.                     if (login.length && apikey.length)
  240.                     {
  241.                         toolbarbutton.setAttribute("oncommand", (sidebarOpener == null ? "toggleSidebar('samfind-bitly-view', true);" : (sidebarOpener + "('bitly', event);")));
  242.                     }
  243.                     else
  244.                     {
  245.                         toolbarbutton.setAttribute("oncommand", command_share);
  246.                     }
  247.                 }
  248.                 break;
  249.             case "email":
  250.                 {
  251.                     toolbarbutton.setAttribute("tooltiptext", service_text);
  252.                     toolbarbutton.setAttribute("oncommand", (sidebarOpener == null ? "toggleSidebar('samfind-email-view', true);" : (sidebarOpener + "('email', event);")));
  253.                 }
  254.                 break;
  255.             case "identica":
  256.                 {
  257.                     toolbarbutton.setAttribute("tooltiptext", "Share with Identi.ca");
  258.                     toolbarbutton.setAttribute("oncommand", (sidebarOpener == null ? "toggleSidebar('samfind-identica-view', true);" : (sidebarOpener + "('identica', event);")));
  259.                 }
  260.                 break;
  261.             case "isgd":
  262.                 {
  263.                     toolbarbutton.setAttribute("tooltiptext", "Shorten URL with is.gd");
  264.                     toolbarbutton.setAttribute("oncommand", command_share);
  265.                 }
  266.                 break;
  267.             case "n4g":
  268.                 {
  269.                     toolbarbutton.setAttribute("tooltiptext", "Tips N4G");
  270.                     toolbarbutton.setAttribute("oncommand", command_share);
  271.                 }
  272.                 break;
  273.             case "quantcast":
  274.                 {
  275.                     toolbarbutton.setAttribute("tooltiptext", "Quantify with Quantcast");
  276.                     toolbarbutton.setAttribute("oncommand", command_share);
  277.                 }
  278.                 break;
  279.             case "sphere":
  280.             case "stumble":
  281.                 {
  282.                     toolbarbutton.setAttribute("tooltiptext", service_text);
  283.                     toolbarbutton.setAttribute("oncommand", command_share);
  284.                 }
  285.                 break;
  286.             case "supr":
  287.                 {
  288.                     toolbarbutton.setAttribute("tooltiptext", "Shorten URL with Su.pr");
  289.                     toolbarbutton.setAttribute("oncommand", command_share);
  290.                 }
  291.                 break;
  292.             case "tinyurl":
  293.                 {
  294.                     toolbarbutton.setAttribute("tooltiptext", "Make TinyURL!");
  295.                     toolbarbutton.setAttribute("oncommand", command_share);
  296.                 }
  297.                 break;
  298.             case "trim2":
  299.                 {
  300.                     toolbarbutton.setAttribute("tooltiptext", "Shorten URL with tr.im");
  301.                     toolbarbutton.setAttribute("oncommand", command_share);
  302.                 }
  303.                 break;
  304.             case "twitter":
  305.                 {
  306.                     toolbarbutton.setAttribute("tooltiptext", "Share with Twitter");
  307.                     toolbarbutton.setAttribute("oncommand", (sidebarOpener == null ? "toggleSidebar('samfind-twitter-view', true);" : (sidebarOpener + "('twitter', event);")));
  308.                 }
  309.                 break;
  310.             case "wordpress":
  311.                 {
  312.                     toolbarbutton.setAttribute("tooltiptext", "Press to " + samfind_modutils._pref_branch.getCharPref("wordpress.blogname"));
  313.                     toolbarbutton.setAttribute("oncommand", command_share);
  314.                 }
  315.                 break;
  316.             default:
  317.                 {
  318.                     toolbarbutton.setAttribute("tooltiptext", "Share with " + service_text);
  319.                     toolbarbutton.setAttribute("oncommand", command_share);
  320.                 }
  321.         }
  322.     },
  323.  
  324.     resetDynamicInfo : function(button, service)
  325.     {
  326.         var width = button.boxObject.width;
  327.         button.removeAttribute("label");
  328.         var total_width = (width - button.boxObject.width);
  329.         switch (service)
  330.         {
  331.             case "digg":
  332.                 {
  333.                     button.setAttribute("tooltiptext", "Share with Digg");
  334.                 }
  335.                 break;
  336.             case "reddit":
  337.                 {
  338.                     button.setAttribute("tooltiptext", "Share with Reddit");
  339.                 }
  340.                 break;
  341.         }
  342.         button.setAttribute("oncommand", "samfind_modsbservices.share(" + button.getAttribute("dataprovider") + ", '" + service + "');");
  343.         return total_width;
  344.     },
  345.  
  346.     fetchDynamicInfo : function(service, href, button, fetchedObserver)
  347.     {
  348.         switch (service)
  349.         {
  350.             case "delicious":
  351.                 {
  352.                     samfind_modsbservices.getDeliciousSaves(href, button, fetchedObserver);
  353.                 }
  354.                 break;
  355.             case "digg":
  356.                 {
  357.                     samfind_modsbservices.getDiggs(href, button, fetchedObserver);
  358.                 }
  359.                 break;
  360.             case "reddit":
  361.                 {
  362.                     samfind_modsbservices.getRedditPoints(href, button, fetchedObserver);
  363.                 }
  364.                 break;
  365.         }
  366.     },
  367.  
  368.     getDeliciousSaves : function(href, button, fetchedObserver)
  369.     {
  370.         try
  371.         {
  372.             var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  373.             xhr.open("GET", "http://feeds.delicious.com/v2/json/urlinfo/data?url=" + href, true);
  374.             var timeout = samfind_modutils.setXhrAbortTimeout(xhr, 10000);
  375.             xhr.onreadystatechange = function(e)
  376.             {
  377.                 if (xhr.readyState == 4)
  378.                 {
  379.                     timeout.cancel();
  380.                     timeout = null;
  381.                     if (xhr.status == 200)
  382.                     {
  383.                         var json_obj = samfind_modsbservices_json.JSON.parse(xhr.responseText);
  384.                         var info = json_obj[0];
  385.                         var saves = 0;
  386.                         if (info)
  387.                         {
  388.                             saves = info.total_posts;
  389.                         }
  390.                         info = null;
  391.                         json_obj = null;
  392.                         if (saves > 0)
  393.                         {
  394.                             button.setAttribute("label", "(" + saves + ")");
  395.                             if (fetchedObserver != null)
  396.                             {
  397.                                 fetchedObserver.dynamicInfoFetched();
  398.                             }
  399.                         }
  400.                     }
  401.                     xhr = null;
  402.                 }
  403.             }
  404.             xhr.send(null);
  405.         }
  406.         catch (e)
  407.         {}
  408.     },
  409.  
  410.     getDiggs : function(href, button, fetchedObserver)
  411.     {
  412.         try
  413.         {
  414.             var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  415.             xhr.open("GET", "http://services.digg.com/stories?count=1&type=json&appkey=http://samfind.com&link=" + href, true);
  416.             var timeout = samfind_modutils.setXhrAbortTimeout(xhr, 10000);
  417.             xhr.onreadystatechange = function(e)
  418.             {
  419.                 if (xhr.readyState == 4)
  420.                 {
  421.                     timeout.cancel();
  422.                     timeout = null;
  423.                     if (xhr.status == 200)
  424.                     {
  425.                         var json_obj = samfind_modsbservices_json.JSON.parse(xhr.responseText);
  426.                         var total_stories = json_obj.total;
  427.                         var diggs = 0;
  428.                         var comments;
  429.                         var href;
  430.                         if (total_stories > 0)
  431.                         {
  432.                             var story_info = json_obj.stories[0];
  433.                             if (story_info)
  434.                             {
  435.                                 diggs = story_info.diggs;
  436.                                 comments = story_info.comments;
  437.                                 href = story_info.href;
  438.                             }
  439.                         }
  440.                         json_obj = null;
  441.                         if (diggs > 0)
  442.                         {
  443.                             button.setAttribute("label", "(" + diggs + ")");
  444.                             button.setAttribute("tooltiptext", diggs + " diggs, " + comments + " comments, click to digg and comment");
  445.                             button.setAttribute("oncommand", "samfind_utils.openTab('" + href + "', false, null, event);");
  446.                             if (fetchedObserver != null)
  447.                             {
  448.                                 fetchedObserver.dynamicInfoFetched();
  449.                             }
  450.                         }
  451.                     }
  452.                     xhr = null;
  453.                 }
  454.             }
  455.             xhr.send(null);
  456.         }
  457.         catch (e)
  458.         {}
  459.     },
  460.  
  461.     getRedditPoints : function(href, button, fetchedObserver)
  462.     {
  463.         try
  464.         {
  465.             var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  466.             xhr.open("GET", "http://www.reddit.com/api/info.json?count=1&url=" + href, true);
  467.             var timeout = samfind_modutils.setXhrAbortTimeout(xhr, 10000);
  468.             xhr.onreadystatechange = function(e)
  469.             {
  470.                 if (xhr.readyState == 4)
  471.                 {
  472.                     timeout.cancel();
  473.                     timeout = null;
  474.                     if (xhr.status == 200)
  475.                     {
  476.                         var json_obj = samfind_modsbservices_json.JSON.parse(xhr.responseText);
  477.                         var data = json_obj.data;
  478.                         var points = 0;
  479.                         var id;
  480.                         if (data)
  481.                         {
  482.                             var children = data.children;
  483.                             if (children && children.length)
  484.                             {
  485.                                 for (var i=0; i<children.length; ++i)
  486.                                 {
  487.                                     data = children[i].data;
  488.                                     if (data && data.score > 0)
  489.                                     {
  490.                                         points = data.score;
  491.                                         id = data.id;
  492.                                         break;
  493.                                     }
  494.                                 }
  495.                             }
  496.                         }
  497.                         json_obj = null;
  498.                         if (points > 0)
  499.                         {
  500.                             button.setAttribute("label", "(" + points + ")");
  501.                             button.setAttribute("tooltiptext", points + " points, click to vote and comment");
  502.                             button.setAttribute("oncommand", "samfind_utils.openTab('http://www.reddit.com/comments/" + id + "', false, null, event);");
  503.                             if (fetchedObserver != null)
  504.                             {
  505.                                 fetchedObserver.dynamicInfoFetched();
  506.                             }
  507.                         }
  508.                     }
  509.                     xhr = null;
  510.                 }
  511.             }
  512.             xhr.send(null);
  513.         }
  514.         catch (e)
  515.         {}
  516.     },
  517.  
  518.     share : function(dataProvider, aService)
  519.     {
  520.         var location = dataProvider.getLocation();
  521.         if (location == null)
  522.         {
  523.             return;
  524.         }
  525.         else
  526.         {
  527.             location = encodeURIComponent(location);
  528.         }
  529.         var title = dataProvider.getTitle();
  530.         if (title.length)
  531.         {
  532.             title = encodeURIComponent(title);
  533.         }
  534.         var selection = dataProvider.getSelection();
  535.         if (selection.length)
  536.         {
  537.             selection = encodeURIComponent(selection);
  538.         }
  539.         //
  540.         var url = null;
  541.         var win = samfind_modutils.getWindow();
  542.         //
  543.         switch (aService)
  544.         {
  545.             case "aim":
  546.                 {
  547.                     url = "http://share.aim.com/share/?url=" + location + "&title=" + title;
  548.                 }
  549.                 break;
  550.             case "amazon":
  551.                 {
  552.                     url = "http://www.amazon.com/wishlist/add?u=" + location + "&t=" + title;
  553.                 }
  554.                 break;
  555.             case "allvoices":
  556.                 {
  557.                     url = "http://www.allvoices.com/post_event?url=" + location + "&title=" + title;
  558.                 }
  559.                 break;
  560.             case "ask":
  561.                 {
  562.                     url = "http://myjeeves.ask.com/mysearch/BookmarkIt?v=1.2&t=webpages&url=" + location + "&title=" + title + "&abstext=" + selection;
  563.                 }
  564.                 break;
  565.             case "attentionmeter":
  566.                 {
  567.                     var decoded = decodeURIComponent(location);
  568.                     var decoded_uri = samfind_modutils._io_service.newURI(decoded, null, null);
  569.                     var host = decoded_uri.host;
  570.                     if (host.indexOf("www.") == 0)
  571.                     {
  572.                         host = host.substring(4);
  573.                     }
  574.                     url = "http://www.attentionmeter.com/bookmarklet.php?d1=" + host;
  575.                 }
  576.                 break;
  577.             case "ballhype":
  578.                 {
  579.                     url = "http://ballhype.com/post/url/?url=" + location + "&title=" + title;
  580.                 }
  581.                 break;
  582.             case "barrapunto":
  583.                 {
  584.                     url = "http://barrapunto.com/submit.pl?subj=" + title + "&story=" + location;
  585.                 }
  586.                 break;
  587.             case "bebo":
  588.                 {
  589.                     url = "http://www.bebo.com/c/share?Url=" + location + "&Title=" + title;
  590.                 }
  591.                 break;
  592.             case "bitly":
  593.                 {
  594.                     url = "http://bit.ly/?url=" + location;
  595.                 }
  596.                 break;
  597.             case "bizsugar":
  598.                 {
  599.                     url = "http://www.bizsugar.com/submit.php?url=" + location;
  600.                 }
  601.                 break;
  602.             case "blinklist":
  603.                 {
  604.                     url = "http://blinklist.com/blink?u=" + location + "&t=" + title + "&d=" + selection + "&v=2";
  605.                 }
  606.                 break;
  607.             case "blogger":
  608.                 {
  609.                     url = "http://www.blogger.com/blog_this.pyra?u=" + location + "&n=" + title + "&t=" + selection;
  610.                 }
  611.                 break;
  612.             case "bloglines":
  613.                 {
  614.                     url = "http://www.bloglines.com/sub/" + decodeURIComponent(location);
  615.                 }
  616.                 break;
  617.             case "blogmemesfr":
  618.                 {
  619.                     url = "http://www.blogmemes.fr/post.php?url=" + location + "&title=" + title;
  620.                 }
  621.                 break;
  622.             case "bookmarksfr":
  623.                 {
  624.                     url = "http://www.bookmarks.fr/favoris/AjoutFavori?action=add&address=" + location + "&title=" + title + "&description=" + selection;
  625.                 }
  626.                 break;
  627.             case "bx":
  628.                 {
  629.                     url = "http://bx.businessweek.com/api/add-article-to-bx.tn?url=" + location;
  630.                 }
  631.                 break;
  632.             case "care2":
  633.                 {
  634.                     url = "http://www.care2.com/news/compose?share[link_url]=" + location + "&share[title]=" + title;
  635.                 }
  636.                 break;
  637.             case "citeulike":
  638.                 {
  639.                     url = "http://www.citeulike.org/posturl?bml=nopopup&url=" + location + "&title=" + title;
  640.                 }
  641.                 break;
  642.             case "cliqset":
  643.                 {
  644.                     win.getBrowser().loadURI("javascript:void((function(){var%20b=document.body;if(b){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','http://cliqset.com/bookmarklet/bookmarklet.js');b.appendChild(e);}})());");
  645.                 }
  646.                 break;
  647.             case "connotea":
  648.                 {
  649.                     url = "http://www.connotea.org/add?continue=return&uri=" + location + "&title=" + title + "&description=" + selection;
  650.                 }
  651.                 break;
  652.             case "current":
  653.                 {
  654.                     url = "http://current.com/clipper.htm?url=" + location + "&title=" + title;
  655.                 }
  656.                 break;
  657.             case "dailyme":
  658.                 {
  659.                     url = "http://dailyme.com/bookmarklet?u=" + location + "&t=" + title;
  660.                 }
  661.                 break;
  662.             case "designbump":
  663.                 {
  664.                     url = "http://designbump.com/node/add/drigg?url=" + location;
  665.                 }
  666.                 break;
  667.             case "designfloat":
  668.                 {
  669.                     url = "http://designfloat.com/submit.php?url=" + decodeURIComponent(location);
  670.                 }
  671.                 break;
  672.             case "delicious":
  673.                 {
  674.                     url = "http://delicious.com/save?url=" + location + "&title=" + title + "¬es=" + selection + "&jump=yes";
  675.                 }
  676.                 break;
  677.             case "digg":
  678.                 {
  679.                     url = "http://digg.com/submit?phase=2&url=" + location + "&title=" + title + "&bodytext=" + selection;
  680.                 }
  681.                 break;
  682.             case "diggita":
  683.                 {
  684.                     url = "http://www.diggita.it/submit.php?url=" + location + "&title=" + title;
  685.                 }
  686.                 break;
  687.             case "diigo":
  688.                 {
  689.                     win.content.document.location = "http://www.diigo.com/post?url=" + location + "&title=" + title + "&desc=" + selection;
  690.                     win.content.focus();
  691.                 }
  692.                 break;
  693.             case "dotnetkicks":
  694.                 {
  695.                     url = "http://www.dotnetkicks.com/kick/?url=" + location + "&title=" + title;
  696.                 }
  697.                 break;
  698.             case "dropjack":
  699.                 {
  700.                     url = "http://www.dropjack.com/submit.php?url=" + location + "&title=" + title;
  701.                 }
  702.                 break;
  703.             case "dzone":
  704.                 {
  705.                     url = "http://www.dzone.com/links/add.html?url=" + location + "&title=" + title;
  706.                 }
  707.                 break;
  708.             case "ekudos":
  709.                 {
  710.                     url = "http://www.ekudos.nl/artikel/nieuw?url=" + location + "&title=" + title + "&desc=" + selection;
  711.                 }
  712.                 break;
  713.             case "evernote":
  714.                 {
  715.                     url = "http://www.evernote.com/clip.action?url=" + location + "&title=" + title;
  716.                 }
  717.                 break;
  718.             case "facebook":
  719.                 {
  720.                     url = "http://www.facebook.com/share.php?u=" + location + "&t=" + title;
  721.                 }
  722.                 break;
  723.             case "fark":
  724.                 {
  725.                     url = "http://cgi.fark.com/cgi/fark/farkit.pl?u=" + location + "&h=" + title;
  726.                 }
  727.                 break;
  728.             case "faves":
  729.                 {
  730.                     url = "http://faves.com/Authoring.aspx?u=" + location + "&t=" + title;
  731.                 }
  732.                 break;
  733.             case "favoritus":
  734.                 {
  735.                     url = "http://www.favoritus.com/add.php?lang=EN&gettitle=" + title + "&getlink=" + location;
  736.                 }
  737.                 break;
  738.             case "fnews":
  739.                 {
  740.                     url = "http://fnews.az/node/add/drigg?url=" + location + "&title=" + title + "&body=" + selection;
  741.                 }
  742.                 break;
  743.             case "followup":
  744.                 {
  745.                     url = "http://www.followup.cc/bookmark.php?url=" + location + "&title=" + title;
  746.                 }
  747.                 break;
  748.             case "foxiewire":
  749.                 {
  750.                     url = "http://www.foxiewire.com/?q=submit&url=" + location + "&title=" + title + "&body=" + selection;
  751.                 }
  752.                 break;
  753.             case "fresqui":
  754.                 {
  755.                     url = "http://fresqui.com/enviar?url=" + location + "&title=" + title;
  756.                 }
  757.                 break;
  758.             case "friendfeed":
  759.                 {
  760.                     url = "http://friendfeed.com/?url=" + location + "&title=" + title;
  761.                 }
  762.                 break;
  763.             case "fsdaily":
  764.                 {
  765.                     url = "http://www.fsdaily.com/submit?url=" + location + "&title=" + title;
  766.                 }
  767.                 break;
  768.             case "funp":
  769.                 {
  770.                     url = "http://funp.com/pages/submit/add.php?title=" + title + "&url=" + location;
  771.                 }
  772.                 break;
  773.             case "gabbr":
  774.                 {
  775.                     url = "http://www.gabbr.com/submit/?bookurl=" + location;
  776.                 }
  777.                 break;
  778.             case "gather":
  779.                 {
  780.                     url = "http://www.gather.com/sharePosts.action?title=" + title + "&body=" + location;
  781.                 }
  782.                 break;
  783.             case "globalgrind":
  784.                 {            
  785.                     url = "http://globalgrind.com/submission/submit.aspx?url=" + location + "&type=Article&title=" + title;
  786.                 }
  787.                 break;
  788.             case "gmail":
  789.                 {
  790.                     url = "http://mail.google.com/mail/?ui=1&view=cm&fs=1&tf=1&to=&su=" + title + "&body=Link: " + location + "%0D%0A%0D%0A" + selection + "%0D%0A%0D%0A" + "%28via samfind Bookmarks Bar%29";
  791.                 }
  792.                 break;
  793.             case "googlebookmarks":
  794.                 {
  795.                     url = "http://www.google.com/bookmarks/mark?op=add&bkmk=" + location + "&title=" + title + "&annotation=" + selection;
  796.                 }
  797.                 break;
  798.             case "googlenotebook":
  799.                 {
  800.                     win.getBrowser().loadURI("javascript:(function(){var%20w=window;var%20d=document;var%20g=w.open('about:blank','gnotesWin','location=0,menubar=0,scrollbars=0,status=0,toolbar=0,width=300,height=300,resizable=1');var%20s=d.createElement('script');s.setAttribute('src','http://www.google.com/notebook/bookmarkletPoster?zx='+(new%20Date()).valueOf());d.body.appendChild(s);w.setTimeout(function(){w.blur();g.focus();},%20100)}).call({});");
  801.                 }
  802.                 break;
  803.             case "googlereader":
  804.                 {
  805.                     win.getBrowser().loadURI(
  806. "javascript:var%20b=document.body;var%20GR________bookmarklet_domain='https://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='https://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}");
  807.                 }
  808.                 break;
  809.             case "hatena":
  810.                 {
  811.                     url = "http://b.hatena.ne.jp/bookmarklet?url=" + location + "&btitle=" + title;
  812.                 }
  813.                 break;
  814.             case "healthranker":
  815.                 {
  816.                     url = "http://www.healthranker.com/submit.php?url=" + location + "&title=" + title;
  817.                 }
  818.                 break;
  819.             case "hellotxt":
  820.                 {
  821.                     url = "http://hellotxt.com/?status=" + title + "%20" + location;
  822.                 }
  823.                 break;
  824.             case "hemidemi":
  825.                 {
  826.                     url = "http://www.hemidemi.com/user_bookmark/new?title=" + title + "&url=" + location + "&description=" + selection + "&via=samfind%20Bookmarks%20Bar";
  827.                 }
  828.                 break;
  829.             case "hipstr":
  830.                 {
  831.                     url = "http://hipstr.com/submit.php?burl=" + location;
  832.                 }
  833.                 break;
  834.             case "hotmail":
  835.                 {
  836.                     url = "http://mail.live.com/default.aspx?rru=compose%3Fsubject%3D" + encodeURIComponent(escape(decodeURIComponent(title))) + "%26body%3DLink: " + encodeURIComponent(escape(decodeURIComponent(location))) + "%0D%0A%0D%0A" + encodeURIComponent(escape(decodeURIComponent(selection))) + "%0D%0A%0D%0A" + "%28via samfind Bookmarks Bar%29";
  837.                 }
  838.                 break;
  839.             case "hyves":
  840.                 {
  841.                     url = "http://www.hyves.nl/profilemanage/add/tips/?name=" + title + "&text=" + location;
  842.                 }
  843.                 break;
  844.             case "identica":
  845.                 {
  846.                     url = "http://identi.ca/?action=newnotice&status_textarea=" + title + "%20" + location;
  847.                 }
  848.                 break;
  849.             case "indianpad":
  850.                 {
  851.                     url = "http://www.indianpad.com/submit.php?url=" + location;
  852.                 }
  853.                 break;
  854.             case "instapaper":
  855.                 {
  856.                     url = "http://www.instapaper.com/b?u=" + location + "&t=" + title;
  857.                 }
  858.                 break;
  859.             case "isgd":
  860.                 {
  861.                     url = "http://is.gd/create.php?longurl=" + location;
  862.                 }
  863.                 break;
  864.             case "jumptags":
  865.                 {
  866.                     url = "http://www.jumptags.com/add/?url=" + location + "&title=" + title;
  867.                 }
  868.                 break;
  869.             case "kaboodle":
  870.                 {
  871.                     url = "http://www.kaboodle.com/za/selectpage?p_pop=false&pa=url&u=" + location;
  872.                 }
  873.                 break;
  874.             case "kirtsy":
  875.                 {
  876.                     url = "http://www.kirtsy.com/submit.php?url=" + location;
  877.                 }
  878.                 break;
  879.             case "linkagogo":
  880.                 {
  881.                     url = "http://www.linkagogo.com/go/AddNoPopup?url=" + location + "&title=" + title + "&comments=" + selection;
  882.                 }
  883.                 break;
  884.             case "linkninja":
  885.                 {
  886.                     url = "http://linkninja.com.br/enviar_link.php?story_url=" + location + "&story_title=" + title + "&story_desc=" + selection;
  887.                 }
  888.                 break;
  889.             case "laterthis":
  890.                 {
  891.                     win.content.document.location = "http://laterthis.com/post?stand_alone=true&link_url=" + location + "&link_title=" + title + "&link_comment=" + selection;
  892.                     win.content.focus();
  893.                 }
  894.                 break;
  895.             case "linkarena":
  896.                 {
  897.                     url = "http://linkarena.com/bookmarks/addlink/?url=" + location + "&title=" + title;
  898.                 }
  899.                 break;
  900.             case "linkedin":
  901.                 {
  902.                     url = "http://www.linkedin.com/shareArticle?mini=true&url=" + location + "&title=" + title + "&summary=" + selection + "&source=Posted via samfind Bookmarks Bar";
  903.                 }
  904.                 break;
  905.             case "live":
  906.                 {    
  907.                     win.content.document.location = "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=" + location + "&title=" + title;
  908.                     win.content.focus();
  909.                 }
  910.                 break;
  911.             case "livejournal":
  912.                 {
  913.                     url = "http://www.livejournal.com/update.bml?subject=" + title + "&event=" + location + escape(" (via samfind Bookmarks Bar) \n\n") + selection;
  914.                 }
  915.                 break;
  916.             case "lunch":
  917.                 {
  918.                     url = "http://www.lunch.com//Bookmarklet/LunchThis.html?url=" + location + "&title=" + title;
  919.                 }
  920.                 break;
  921.             case "meneame":
  922.                 {
  923.                     url = "http://meneame.net/submit.php?url=" + location + "&title=" + title;
  924.                 }
  925.                 break;
  926.             case "misterwong":
  927.                 {
  928.                     url = "http://www.mister-wong.com/index.php?action=addurl&bm_url=" + location + "&bm_description=" + title;
  929.                 }
  930.                 break;
  931.             case "mixx":
  932.                 {
  933.                     url = "http://www.mixx.com/submit?page_url=" + location;
  934.                 }
  935.                 break;
  936.             case "mozillaca":
  937.                 {
  938.                     url = "http://mozillaca.com/index.php?action=newnotice&status_textarea=\"" + title + "\" from " + location;
  939.                 }
  940.                 break;
  941.             case "multiply":
  942.                 {
  943.                     url = "http://multiply.com/gus/journal/compose/?url=" + location + "&subject=" + title + "&body=" + selection;
  944.                 }
  945.                 break;
  946.             case "myaol":
  947.                 {
  948.                     url = "http://favorites.my.aol.com/ffclient/AddBookmark?url=" + location + "&title=" + title + "&favelet=true";
  949.                 }
  950.                 break;
  951.             case "myshare":
  952.                 {
  953.                     url = "http://myshare.url.com.tw/index.php?func=newurl&url=" + location + "&desc=" + title;
  954.                 }
  955.                 break;
  956.             case "myspace":
  957.                 {
  958.                     url = "http://www.myspace.com/Modules/PostTo/Pages/?l=3&u=" + location + "&t=" + title + "&c=" + selection + "<p>Posted via <a href=\"https://addons.mozilla.org/en-US/firefox/addon/9866\">samfind Bookmarks Bar</a></p>";
  959.                 }
  960.                 break;
  961.             case "n4g":
  962.                 {
  963.                     url = "http://www.n4g.com/tips.aspx?url=" + location + "&title=" + title;
  964.                 }
  965.                 break;
  966.             case "netvibes":
  967.                 {
  968.                     url = "http://www.netvibes.com/share?url=" + location + "&title=" + title;
  969.                 }
  970.                 break;
  971.             case "netvouz":
  972.                 {
  973.                     url = "http://netvouz.com/action/submitBookmark?url=" + location + "&title=" + title;
  974.                 }
  975.                 break;
  976.             case "newstrust":
  977.                 {
  978.                     url = "http://newstrust.net/submit?url=" + location + "&title=" + title + "&bookmarklet=1";
  979.                 }
  980.                 break;
  981.             case "newsvine":
  982.                 {
  983.                     url = "http://www.newsvine.com/_tools/seed&save?u=" + location + "&h=" + title;
  984.                 }
  985.                 break;
  986.             case "nujij":
  987.                 {
  988.                     url = "http://nujij.nl/jij.lynkx?t=" + title + "&u=" + location + "&b=" + selection;
  989.                 }
  990.                 break;
  991.             case "oknotizie":
  992.                 {
  993.                     url = "http://oknotizie.alice.it/post?url=" + location + "&title=" + title;
  994.                 }
  995.                 break;
  996.             case "oneviewcom":
  997.                 {
  998.                     url = "http://www.oneview.com/quickadd/neu/addBookmark.jsf?URL=" + location + "&title=" + title;
  999.                 }
  1000.                 break;
  1001.             case "oneviewde":
  1002.                 {
  1003.                     url = "http://www.oneview.de/add/?URL=" + location + "&title=" + title;
  1004.                 }
  1005.                 break;
  1006.             case "orkut":
  1007.                 {
  1008.                     url = "http://promote.orkut.com/preview?src=bkmrklt&v=1&nt=orkut.com&du=" + location + "&tt=" + title + "&rdrinl=1";
  1009.                 }
  1010.                 break;
  1011.             case "picnik":
  1012.                 {
  1013.                     url = "http://www.picnik.com/?import=" + location;
  1014.                 }
  1015.                 break;
  1016.             case "pingfm":
  1017.                 {
  1018.                     url = "http://ping.fm/ref/?link=" + location + "&title=" + title;
  1019.                 }
  1020.                 break;
  1021.             case "plurk":
  1022.                 {
  1023.                     url = "http://www.plurk.com/m?content=" + location + "&qualifier=shares";
  1024.                 }
  1025.                 break;
  1026.             case "posterous":
  1027.                 {
  1028.                     url = "http://posterous.com/share?linkto=" + location + "&title=" + title;
  1029.                 }
  1030.                 break;
  1031.             case "propeller":
  1032.                 {
  1033.                     url = "http://www.propeller.com/story/submit/?url=" + location + "&title=" + title;
  1034.                 }
  1035.                 break;
  1036.             case "pusha":
  1037.                 {
  1038.                     url = "http://www.pusha.se/posta?url=" + location + "&title=" + title + "&description=" + selection;
  1039.                 }
  1040.                 break;
  1041.             case "quantcast":
  1042.                 {
  1043.                     var decoded = decodeURIComponent(location);
  1044.                     var decoded_uri = samfind_modutils._io_service.newURI(decoded, null, null);
  1045.                     var host = decoded_uri.host;
  1046.                     if (host.indexOf("www.") == 0)
  1047.                     {
  1048.                         host = host.substring(4);
  1049.                     }
  1050.                     url = "http://www.quantcast.com/" + host;
  1051.                 }
  1052.                 break;
  1053.             case "reddit":
  1054.                 {
  1055.                     url = "http://reddit.com/submit?url=" + location + "&title=" + title;
  1056.                 }
  1057.                 break;
  1058.             case "scoopeo":
  1059.                 {
  1060.                     url = "http://www.scoopeo.com/scoop/new?newurl=" + location + "&title=" + title + "&content=" + selection;
  1061.                 }
  1062.                 break;
  1063.             case "scoopit":
  1064.                 {
  1065.                     url = "http://www.scoopit.co.nz/submit.php?url=" + location;
  1066.                 }
  1067.                 break;
  1068.             case "segnalo":
  1069.                 {
  1070.                     url = "http://segnalo.virgilio.it/post.html.php?url=" + location + "&title=" + title +"&descr" + selection;
  1071.                 }
  1072.                 break;
  1073.             case "shoutwire":
  1074.                 {
  1075.                     url = "http://www.shoutwire.com/?p=submit&link=" + location;
  1076.                 }
  1077.                 break;
  1078.             case "simpy":
  1079.                 {
  1080.                     url = "http://www.simpy.com/simpy/LinkAdd.do?href=" + location + "&title=" + title + "¬e=" + selection + "&src=bookmarklet";
  1081.                 }
  1082.                 break;
  1083.             case "slashdot":
  1084.                 {
  1085.                     url = "http://slashdot.org/slashdot-it.pl?op=basic&url=" + location;
  1086.                 }
  1087.                 break;
  1088.             case "smaknews":
  1089.                 {
  1090.                     url = "http://smaknews.com/submit.php?url=" + location;
  1091.                 }
  1092.                 break;
  1093.             case "socialmedian":
  1094.                 {
  1095.                     url = "http://www.socialmedian.com/bookmarker?u=" + location + "&t=" + title + "&s=" + selection;
  1096.                 }
  1097.                 break;
  1098.             case "socialogs":
  1099.                 {
  1100.                     url = "http://socialogs.com/add_story.php?story_url=" + location + "&story_title=" + title + "&story_desc=" + selection;
  1101.                 }
  1102.                 break;
  1103.             case "soup":
  1104.                 {
  1105.                     var d = win.content.document;
  1106.                     var di = win.content.document.images;
  1107.                     var dom = win.content.document.location.href.match(/(.*)\/.*$/)[1];
  1108.                     var i = '';
  1109.                     for (var n=0; n<di.length; n++)
  1110.                     {
  1111.                         if (di[n].offsetWidth*di[n].offsetHeight > 1400)
  1112.                         {
  1113.                             i += di[n].src.replace(dom, '@@') + '|' + di[n].offsetWidth + '|' + di[n].offsetHeight +',';
  1114.                         }
  1115.                     }
  1116.                     url = "http://www.soup.io/bookmarklet?v=5&u=" + location + "&t=" + title + "&s=" + location + "&dom=" + encodeURIComponent(dom) + "&i=" + encodeURIComponent(i);
  1117.                 }
  1118.                 break;
  1119.             case "sphere":
  1120.                 {
  1121.                     url = "http://www.sphere.com/search/blogs/?q=sphereit:" + location + "&title=" + title;
  1122.                 }
  1123.                 break;
  1124.             case "sphinn":
  1125.                 {
  1126.                     url = "http://sphinn.com/submit.php?url=" + location + "&title=" + title;
  1127.                 }
  1128.                 break;
  1129.             case "spring":
  1130.                 {    win.getBrowser().loadURI("javascript:(function(){SP_HOST='http://springpadit.com';try{var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src=SP_HOST+'/public/clipper_inline.js?'+(new%20Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=SP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();");
  1131.                 }
  1132.                 break;
  1133.             case "spurl":
  1134.                 {
  1135.                     url = "http://www.spurl.net/spurl.php?url=" + location + "&title=" + title;
  1136.                 }
  1137.                 break;
  1138.             case "squidoo":
  1139.                 {
  1140.                     url = "http://www.squidoo.com/lensmaster/bookmark?" + location;
  1141.                 }
  1142.                 break;
  1143.             case "strands":
  1144.                 {
  1145.                     url = "http://www.strands.com/tools/share/webpage?title=" + title + "&url=" + location;
  1146.                 }
  1147.                 break;
  1148.             case "streakr":
  1149.                 {
  1150.                     url = "http://www.streakr.com/mystreakr/emailfriend.aspx?SiteURL=" + location;
  1151.                 }
  1152.                 break;
  1153.             case "stumble":
  1154.                 {
  1155.                     url = "http://www.stumbleupon.com/su/";
  1156.                 }
  1157.                 break;
  1158.             case "stumbleupon":
  1159.                 {
  1160.                     url = "http://www.stumbleupon.com/submit?url=" + location + "&title=" + title;
  1161.                 }
  1162.                 break;
  1163.             case "stumpedia":
  1164.                 {
  1165.                     url = "http://www.stumpedia.com/submit?url=" + location + "&title=" + title;
  1166.                 }
  1167.                 break;
  1168.             case "stylehive":
  1169.                 {
  1170.                     url = "http://www.stylehive.com/savebookmark/index.htm?url=" + location;
  1171.                 }
  1172.                 break;
  1173.             case "supr":
  1174.                 {
  1175.                     win.getBrowser().loadURI("javascript:var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','http://su.pr/supr_shortcut.php?action=js_post');document.body.appendChild(e);void(0);");
  1176.                 }
  1177.                 break;
  1178.             case "swik":
  1179.                 {
  1180.                     url = "http://stories.swik.net/?bookmarklet=v1&submitUrl&url=" + location + "&title=" + title + "&description=" + selection;
  1181.                 }
  1182.                 break;
  1183.             case "symbaloo":
  1184.                 {
  1185.                     url = "http://www.symbaloo.com/en/add/?url=" + location + "&title=" + title;
  1186.                 }
  1187.                 break;
  1188.             case "tailrank":
  1189.                 {
  1190.                     url = "http://tailrank.com/share/?link_href=" + location + "&title=" + title;
  1191.                 }
  1192.                 break;
  1193.             case "tbuzz":
  1194.                 {
  1195.                     win.getBrowser().loadURI("javascript:(function(){_tbuzz_css=document.createElement('LINK');_tbuzz_css.rel='stylesheet';_tbuzz_css.href='http://tbuzz.arc90.com/css/tbuzz';_tbuzz_css.href+=(document.all%20&&%20!window.opera%20&&%20window.XMLHttpRequest%20&&%20document.compatMode!='CSS1Compat')%20?%20'IE7.css?x='%20:%20'.css?x=';_tbuzz_css.href+=(Math.random());_tbuzz_css.type='text/css';document.getElementsByTagName('head')[0].appendChild(_tbuzz_css);_tbuzz_script=document.createElement('SCRIPT');_tbuzz_script.type='text/javascript';_tbuzz_script.src='http://tbuzz.arc90.com/js/tbuzz.bookmarklet.js?x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(_tbuzz_script);})();");
  1196.                 }
  1197.                 break;
  1198.             case "technorati":
  1199.                 {
  1200.                     url = "http://technorati.com/faves?add=" + location;
  1201.                 }
  1202.                 break;
  1203.             case "thisnext":
  1204.                 {
  1205.                     url = "http://www.thisnext.com/pick/new/submit/sociable/?url=" + location + "&name=" + title;
  1206.                 }
  1207.                 break;
  1208.             case "tinyurl":
  1209.                 {
  1210.                     url = "http://tinyurl.com/create.php?url=" + location;
  1211.                 }
  1212.                 break;
  1213.             case "tipd":
  1214.                 {
  1215.                     url = "http://tipd.com/submit.php?url=" + location;
  1216.                 }
  1217.                 break;
  1218.             case "trim2":
  1219.                 {
  1220.                     url = "http://tr.im/marklet?url=" + location;
  1221.                 }
  1222.                 break;
  1223.             case "truemors":
  1224.                 {
  1225.                     url = "http://truemors.nowpublic.com/post/?headline=" + title + "&truemor=" + selection + "%0D%0D%0A%3Ca href=%22" + location + "%22%3E%3C/a%3E";
  1226.                 }
  1227.                 break;
  1228.             case "tumblr":
  1229.                 {
  1230.                     url = "http://www.tumblr.com/share?v=3&u=" + location + "&t=" + title + "&s=" + selection;
  1231.                 }
  1232.                 break;
  1233.             case "twackle":
  1234.                 {    
  1235.                     url = "http://www.twackle.com/chicklet?site=" + location;
  1236.                 }
  1237.                 break;
  1238.             case "twiddla":
  1239.                 {
  1240.                     url = "http://www.twiddla.com/NewSession.aspx?url=" + escape(decodeURIComponent(location)) + "&title=" + escape(decodeURIComponent(title).substr(0, 50));
  1241.                 }
  1242.                 break;
  1243.             case "twine":
  1244.                 {    
  1245.                     url = "http://www.twine.com/bookmark/basic?u=" + location + "&t=" + title + "&v=3";
  1246.                 }
  1247.                 break;
  1248.             case "twitter":
  1249.                 {
  1250.                     url = "http://twitter.com/home?status=" + title + "%20" + location + "&source=samfindtoolbar";
  1251.                 }
  1252.                 break;
  1253.             case "viadeo":
  1254.                 {
  1255.                     url = "http://www.viadeo.com/shareit/share/?url=" + loation + "&title=" + title + "&encoding=UTF-8";
  1256.                 }
  1257.                 break;
  1258.             case "visualize":
  1259.                 {
  1260.                     win.getBrowser().loadURI("javascript:(function(){function%20l(u,i){var%20d=document;if(!d.getElementById(i)){var%20s=d.createElement('script');s.src=u;s.id=i;d.body.appendChild(s);}}l('http://vi.sualize.us/js/visualizeus.js','visualizeus')})();");
  1261.                 }
  1262.                 break;
  1263.             case "weheartit":
  1264.                 {
  1265.                     win.getBrowser().loadURI("javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://weheartit.com/bookmarklet.js');document.body.appendChild(e)})());");
  1266.                 }
  1267.                 break;
  1268.             case "wikio":
  1269.                 {
  1270.                     url = "http://www.wikio.com/sharethis?url=" + location + "&title=" + title;
  1271.                 }
  1272.                 break;
  1273.             case "wists":
  1274.                 {
  1275.                     url = "http://wists.com/u.php?r=" + location + "&t=" + title;
  1276.                 }
  1277.                 break;
  1278.             case "wordpress":
  1279.                 {
  1280.                     win.getBrowser().loadURI("javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='https://" + samfind_modutils._pref_branch.getCharPref("wordpress.blogname") + "/wp-admin/press-this.php',l=d.location,e=encodeURIComponent,g=f+'?u=" + location + "&t=" + title + "&s=" + selection + "&v=2';function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=620,left=" + ((win.screen.availWidth - 720) / 2) + ",top=" + ((win.screen.availHeight - 620) / 2) + "')){l.href=g;}}setTimeout(a,0);void(0);");
  1281.                 }
  1282.                 break;
  1283.             case "xanga":
  1284.                 {
  1285.                     url = "http://www.xanga.com/private/editorx.aspx?u=" + location + "&t=" + title;
  1286.                 }
  1287.                 break;
  1288.             case "xerpi":
  1289.                 {
  1290.                     url = "http://www.xerpi.com/favorite/post?url=" + location + "&title=" + title;
  1291.                 }
  1292.                 break;
  1293.             case "yahoobookmarks":
  1294.                 {
  1295.                     url = "http://bookmarks.yahoo.com/toolbar/savebm?u=" + location + "&t=" + title + "&d=" + selection + "&opener=bm&ei=UTF-8";
  1296.                 }
  1297.                 break;
  1298.             case "yahoobuzz":
  1299.                 {
  1300.                     url = "http://buzz.yahoo.com/buzz?targetUrl=" + location + "&headline=" + title + "&summary=" + selection;
  1301.                 }
  1302.                 break;
  1303.             case "yammer":
  1304.                 {
  1305.                     url = "http://www.yammer.com/home/bookmarklet?bookmarklet_pop=0&v=1&u=" + location + "&t=" + title + "&s=" + selection;
  1306.                 }
  1307.                 break;
  1308.             case "ycombinator":
  1309.                 {
  1310.                     url = "http://news.ycombinator.com/submitlink?u=" + location + "&t=" + title;
  1311.                 }
  1312.                 break;
  1313.             case "yigg":
  1314.                 {
  1315.                     url = "http://www.yigg.de/neu?exturl=" + location + "&exttitle=" + title;
  1316.                 }
  1317.                 break;
  1318.             case "yoolink":
  1319.                 {
  1320.                     url = "http://www.yoolink.fr/addorshare?url_value=" + location + "&title=" + title;
  1321.                 }
  1322.                 break;
  1323.             case "youmob":
  1324.                 {
  1325.                     url = "http://youmob.com/startmob.aspx?mob=" + location;
  1326.                 }
  1327.                 break;
  1328.         }
  1329.         //
  1330.         if (url != null)
  1331.         {
  1332.             samfind_modutils.openTab(url, null);
  1333.         }
  1334.     },
  1335.  
  1336.     shortenURL : function(url, observer)
  1337.     {
  1338.         var login = samfind_modutils._pref_branch.getCharPref("bitly.user.login");
  1339.         if (login.length == 0)
  1340.         {
  1341.             login = "samfind";
  1342.         }
  1343.         var apikey = samfind_modutils._pref_branch.getCharPref("bitly.user.apikey");
  1344.         if (apikey.length == 0)
  1345.         {
  1346.             apikey = "R_5e58220fae38fe8a7b63d7bf0e73852a";
  1347.         }
  1348.         //
  1349.         try
  1350.         {
  1351.             var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  1352.             xhr.open("GET", "http://api.bit.ly/shorten?version=2.0.1&longUrl=" + escape(url) + "&login=" + login + "&apiKey=" + apikey,
  1353.                             true);
  1354.             var timeout = samfind_modutils.setXhrAbortTimeout(xhr, 10000);
  1355.             xhr.onreadystatechange = function(e)
  1356.             {
  1357.                 if (xhr.readyState == 4)
  1358.                 {
  1359.                     timeout.cancel();
  1360.                     timeout = null;
  1361.                     if (xhr.status == 200)
  1362.                     {
  1363.                         var json_obj = samfind_modsbservices_json.JSON.parse(xhr.responseText);
  1364.                         if (json_obj.errorCode != 0)
  1365.                         {
  1366.                             observer.fail();
  1367.                         }
  1368.                         else
  1369.                         {
  1370.                             var results = json_obj.results;
  1371.                             for (var i in results)
  1372.                             {
  1373.                                 var result = results[i];
  1374.                                 if (result.errorCode)
  1375.                                 {
  1376.                                     observer.fail();
  1377.                                 }
  1378.                                 else
  1379.                                 {
  1380.                                     observer.ok(result.shortUrl);
  1381.                                 }
  1382.                             }
  1383.                             results = null;
  1384.                         }
  1385.                         json_obj = null;
  1386.                     }
  1387.                     else
  1388.                     {
  1389.                         observer.fail();
  1390.                     }
  1391.                     xhr = null;
  1392.                 }
  1393.             };
  1394.             xhr.send(null);
  1395.         }
  1396.         catch (e)
  1397.         {
  1398.             observer.fail();
  1399.         }
  1400.     },
  1401.  
  1402.     getTwitterAuth : function()
  1403.     {
  1404.         return samfind_modutils.getAuth("samfindtwitter", "samfindtwitter");
  1405.     },
  1406.  
  1407.     postToTwitter : function(update, auth, observer)
  1408.     {
  1409.         var post_param = "source=samfindtoolbar&status=" + encodeURIComponent(update);
  1410.         if (auth == null)
  1411.         {
  1412.             auth = samfind_modsbservices.getTwitterAuth();
  1413.         }
  1414.         var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  1415.         xhr.open("POST", "http://twitter.com/statuses/update.json", true);
  1416.         xhr.setRequestHeader("Authorization", "Basic " + btoa(auth.username + ":" + auth.password));
  1417.         xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  1418.         xhr.setRequestHeader("Content-Length", post_param.length);
  1419.         var timeout = samfind_modutils.setXhrAbortTimeout(xhr, 10000);
  1420.         xhr.onreadystatechange = function()
  1421.         {
  1422.             if (xhr.readyState == 4)
  1423.             {
  1424.                 timeout.cancel();
  1425.                 timeout = null;
  1426.                 if (xhr.status == 200)
  1427.                 {
  1428.                     observer.ok();
  1429.                 }
  1430.                 else
  1431.                 {
  1432.                     observer.fail(xhr.status);
  1433.                 }
  1434.                 xhr = null;
  1435.             }
  1436.         };
  1437.         xhr.send(post_param);
  1438.     },
  1439.  
  1440.     getIdenticaAuth : function()
  1441.     {
  1442.         return samfind_modutils.getAuth("samfindidentica", "samfindidentica");
  1443.     },
  1444.  
  1445.     postToIdentica : function(update, auth, observer)
  1446.     {
  1447.         var post_param = "status=" + encodeURIComponent(update);
  1448.         if (auth == null)
  1449.         {
  1450.             auth = samfind_modsbservices.getIdenticaAuth();
  1451.         }
  1452.         var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  1453.         xhr.open("POST", "http://identi.ca/api/statuses/update.json", true);
  1454.         xhr.setRequestHeader("Authorization", "Basic " + btoa(auth.username + ":" + auth.password));
  1455.         xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  1456.         xhr.setRequestHeader("Content-Length", post_param.length);
  1457.         var timeout = samfind_modutils.setXhrAbortTimeout(xhr, 10000);
  1458.         xhr.onreadystatechange = function()
  1459.         {
  1460.             if (xhr.readyState == 4)
  1461.             {
  1462.                 timeout.cancel();
  1463.                 timeout = null;
  1464.                 if (xhr.status == 200)
  1465.                 {
  1466.                     observer.ok();
  1467.                 }
  1468.                 else
  1469.                 {
  1470.                     observer.fail(xhr.status);
  1471.                 }
  1472.                 xhr = null;
  1473.             }
  1474.         };
  1475.         xhr.send(post_param);
  1476.     }
  1477. };
  1478.  
  1479. /**
  1480.  * Constructor.
  1481.  */
  1482. (function() { this._init(); }).apply(samfind_modsbservices);