Skip to content

Instantly share code, notes, and snippets.

@robcee
Created October 1, 2012 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robcee/3812544 to your computer and use it in GitHub Desktop.
Save robcee/3812544 to your computer and use it in GitHub Desktop.
Scratch-kit Scratchpad to post to App.net
var currentTab = require('tabs').activeTab;
var url = currentTab.url; // get the location.
var title = currentTab.title;
var appscript = "self.port.on('update', function _update() {" +
" console.log('hi');" +
" document.querySelector('div.navbar').setAttribute('hidden', 'true'); " +
" document.querySelector('div.hero-unit').setAttribute('hidden', 'true'); " +
" document.querySelector('div.post-stream').setAttribute('hidden', 'true'); " +
" let newPost = document.querySelector('textarea.editable.input-flex');" +
" newPost.value = '" + title + " — " + url + "';" +
" document.querySelector('button.btn.btn-primary').click(); " +
"}, false);";
var panel = require('panel').Panel({
height: 240,
width: 480,
contentURL: "https://alpha.app.net/global/",
contentScript: appscript,
onShow: function() { panel.port.emit("update"); }
});
panel.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment