Created
October 1, 2012 15:35
-
-
Save robcee/3812544 to your computer and use it in GitHub Desktop.
Scratch-kit Scratchpad to post to App.net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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