Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-03 04:46:24

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

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

#2 2007-12-03 04:56:28

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

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

#3 2007-12-03 05:01:13

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: Simple Bookmarklet

haha easily done

p = p + '&custom_1='+e(l.href)

Offline

#4 2007-12-03 16:53:55

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: Simple Bookmarklet

Very cool. I may actually start blogging about sites I visit.

Offline

#5 2007-12-12 20:36:14

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: Simple Bookmarklet

fyi – I’ve integrated this bookmarklet into asv_tumblelog and built a new interface for the bookmarklet

Offline

#6 2007-12-12 20:47:25

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: Simple Bookmarklet

fyi – you are awesome.


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#7 2007-12-31 17:47:51

swf
Plugin Author
From: Saskatoon, Saskatchewan Canada
Registered: 2004-06-21
Posts: 109
Website

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

#8 2007-12-31 23:16:24

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

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

#9 2008-01-01 02:11:13

swf
Plugin Author
From: Saskatoon, Saskatchewan Canada
Registered: 2004-06-21
Posts: 109
Website

Re: Simple Bookmarklet

thank you, i did finally figure out my problems. I’ve never edited bookmarklets before so knowing when to put something in apostrophes. Do you have any suggestions for good bookmarklet guides/tutorials?

Thank you

Offline

Board footer

Powered by FluxBB