适用于Twitter和Google Plus的纯Javascript API

Using this code I can share to Facebook using just Javascript and my own UI buttons/links etc.

FB.init({
    appId      : 'MyAppId',
    xfbml      : true,
    version    : 'v2.0'
});

//In my .click() method)
FB.ui(
    {
        method: 'share',
        href: document.URL,
    }, 
    function(response){
        log(response);
        if (typeof response != 'undefined') {
            alert('Thanks for sharing');
        }
    }
); 

Do Twitter and Google Plus have something similar? At the moment I'm needing to use their HTML, and therefore their styling. I'd like to be able to style the "share" options I have to match the site I'm working on.

If it isn't possible through just Javascript is it possible using PHP? I'm thinking I could do an Ajax call to share the page if PHP could do this.

Google+ has a JavaScript API that supports all of their existing API functionality. However Google+ does not allow posting without using their button and UI. The exceptions being if you want to use app activities or are only going to be used by Google Apps accounts.

Twitter had a JavaScript API that they stopped supporting in 2013. To post to Twitter you will have to proxy requests through your own server.