Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Simple Bookmarklet
So here’s a quickie but a goodie – a bookmarklet for your TXP blog (modified from the Tumblr bookmarklet). Just plug in your TXP install path and use the Bookmarklet Builder to make yourself a nice little bookmarklet for posting to your TXP. The code below will also take the current page’s title and selected text. There’s a lot more data you can use like putting the current page’s url in a custom field.
javascript:
var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)),
f='http://PathToYourTXPFolder/index.php',
l=d.location,
e=encodeURIComponent,
p='?bm=1&Section=SectionName&from_view=1&Category1=CategoryName&Title='+e(d.title)+'&Body='+e(s),
u=f+p;
a=function(){
if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=800,height=800'))
l.href=u;
}
;
if(/Firefox/.test(navigator.userAgent))
setTimeout(a,0);
else
a();
void(0)
Offline
Re: Simple Bookmarklet
sweeeet.
Will there be a second version with page URL in a custom field? :)
This would go nicely with a whole tumblr-style setup, wouldn’t it….
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Offline
Re: Simple Bookmarklet
Very cool. I may actually start blogging about sites I visit.
Offline
Re: Simple Bookmarklet
fyi – I’ve integrated this bookmarklet into asv_tumblelog and built a new interface for the bookmarklet
Offline
Re: Simple Bookmarklet
fyi – you are awesome.
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Re: Simple Bookmarklet
I’m almost finished porting a tumblr theme called microblogger to textpattern and I would like to make a few bookmarklets to post various content to custom fields and if possible set the category.
I’ve tried the asv_tumblelog bookmarklet, but ecause I use custom fields for urls and page titles, it doesn’t work for me.
Is it possible to set the category/section with the bookmarklet?
Could someone show me how/where I would add the custom field code p = p + '&custom_1='+e(l.href)
Offline
Re: Simple Bookmarklet
You can already define the section/category with this bookmarklet. Just replace “SectionName” and “CategoryName”.
To set custom fields just tack on “&custom_1=” to the definition of p. Check it out:
p='?bm=1&Section=SectionName&from_view=1&Category1=CategoryName&Title='+e(d.title)+'&Body='+e(s)+'&custom_1='+e(l.href)
Offline
Offline
Pages: 1