Results 1 to 1 of 1

Thread: UbuntuForums / UbuntuWiki Socializer

  1. #1
    Join Date
    Mar 2009
    Location
    Buenos Aires, AR
    Beans
    2,325
    Distro
    Ubuntu

    Smile UbuntuForums / UbuntuWiki Socializer

    UbuntuForums / UbuntuWiki Socializer

    • Agrega botones para compartir lo que estas leyendo/posteando en Twitter y Google Plus
    • Agnostico al Idioma (es 1 boton y 1 numero)




    UBUNTUFORUMS.ORG:

    Code:
    // ==UserScript==
    // @name       UbuntuForums Socializer
    // @version    0.1
    // @description  Adds TW and G+ Social Buttons
    // @include    http://ubuntuforums.org/*
    // @copyright  GPLv3, juancarlospaco@ubuntu.com 
    // ==/UserScript==
    
    function insertPlusOne(node) {
      var button = document.createElement("g:plusone"); 
      button.setAttribute("size", "small");
      node.appendChild(button);
      var po = document.createElement("script"); 
      po.type = "text/javascript"; 
      po.async = true;
      po.src = "https://apis.google.com/js/plusone.js";
      document.head.appendChild(po);
    }
    
    function insertTw(node) {
      var button = document.createElement("a"); 
      button.setAttribute("href", "http://twitter.com/share");
      button.setAttribute("class", "twitter-share-button");
      button.setAttribute("data-count", "small");  
      node.appendChild(button);
      var po = document.createElement("script"); 
      po.type = "text/javascript"; 
      po.async = true;
      po.src = "http://platform.twitter.com/widgets.js";
      document.head.appendChild(po);
    }
    
    insertPlusOne(document.getElementById("lastpost"));
    insertTw(document.getElementById("lastpost"));
    UBUNTU WIKI:

    Code:
    // ==UserScript==
    // @name       UbuntuWiki Socializer
    // @version    0.1
    // @description  Adds TW and G+ Social Buttons
    // @include    https://wiki.ubuntu.com/*
    // @copyright  GPLv3, juancarlospaco@ubuntu.com 
    // ==/UserScript==
    function insertPlusOne(node) {
      var button = document.createElement("g:plusone"); 
      button.setAttribute("size", "small");
      node.appendChild(button);
      var po = document.createElement("script"); 
      po.type = "text/javascript"; 
      po.async = true;
      po.src = "https://apis.google.com/js/plusone.js";
      document.head.appendChild(po);
    }
    function insertTw(node) {
      var button = document.createElement("a"); 
      button.setAttribute("href", "http://twitter.com/share");
      button.setAttribute("class", "twitter-share-button");
      button.setAttribute("data-count", "small");  
      node.appendChild(button);
      var po = document.createElement("script"); 
      po.type = "text/javascript"; 
      po.async = true;
      po.src = "http://platform.twitter.com/widgets.js";
      document.head.appendChild(po);
    }
    
    insertPlusOne(document.getElementsByTagName("h1")[0]);
    insertTw(document.getElementsByTagName("h1")[0]);


    Probado en Firefox, Chromium y Chrome; deberia funcionar en cualquiera,
    se guarda el codigo como "socializer.user.js" y se lo abre con el navegador, intentara instalarlo como un plugin mas.

    Screenshots:
    Attached Images Attached Images

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •