Dew-Code.com   Download this file   Questions + Feedback Forum


0  Introduction

in brief

Bookmarklets are tools to help with repetitive or otherwise impossible tasks in your web browser. It is like a normal bookmark but performs a certain, more complex task or function.

This Bookmarklet is made to facilitate the entry of new urls into a Dew-NewPHPLinks link database management system. Just click the bookmark and it will fill out the "new-link" form almost by itself using the data from the web-site you are currently visiting.

Basic steps for bookmarklet usage:
  1. Read through the above links step by step from 1 to 5 and follow the guidelines
  2. Drag the bookmarklet to your Bookmarks Toolbar or Links Bar.
  3. While viewing a page you want to enter in your Dew-NewPHPLinks database, click the bookmarklet from your Bookmarks Toolbar.

in detail

This is an advanced bookmarklet for all of you that think it's a useless pain/nusance to enter all the already existing data manually! Just click on it, and an almost ready to submit Dew-NewPHPLinks "new link form" will show in a popup window.
This bookmarklet tries to catch all relevant meta-data from the url if available and enters them in the relevant part of the new-links form of your Dew-NewPHPLinks installation automagically. Currently it catches the following information and meta-tags to your liking: additionally you can let the bookmarklet automagically enter the following Dew-NewPHPLinks data:
I had to make two versions of the bookmarklet because of a stupid limitation of IE 6.0 (IE < 6.0 did not have this limitation!). The IE version is crippled in features. I recommend to use a different browser anyway!

For me this improves usefullness of Dew-NewPHPLinks +80% so I took the time to write it. The use of meta tag information strangely is yet missing in all existing similar bookmarklet applications to my knowledge.

What else can I do for you? Bookmarklets/Scriptlets there we go! (scriptlet == bookmarklet)
This is a Bookmarklet as requested in: Dew-NewPHPLinks Forum

The code in these bookmarklets and in the php bookmarklet builder is open sourced under the GNU-licence. Please send me a little notice if the code was of help for one of your GNU open source projects- thank's.

1  Preconditions

2  Prepare Dew-NewPHPLinks (Code Change)


Short explanation for the change (for non coders):
Unluckily the current add.php script of "Dew-NewPHPLinks" can only cope with POST variables. bookmarklets can only cope with GET variables.
In future versions of Dew-NewPHPLinks this change will be already included!

SIMPLE CODE CHANGE


in Dew-NewPHPLinks "/include/add.php" lines ~12-24
starting with "$SiteName=mysql_escape_string($_POST['SiteName']);"...
ending with ..."$submit_add=$_POST['submit_add'];"
replace with:
"
$SiteName=mysql_escape_string($_REQUEST['SiteName']);
$SiteURL=mysql_escape_string($_REQUEST['SiteURL']);
$RecipURL=mysql_escape_string($_REQUEST['RecipURL']);
$Description=mysql_escape_string($_REQUEST['Description']);
$Category=mysql_escape_string($_REQUEST['Category']);
$Country=mysql_escape_string($_REQUEST['Country']);
$UserName=mysql_escape_string($_REQUEST['UserName']);
$PW=mysql_escape_string($_REQUEST['PW']);
$PID=mysql_escape_string($_REQUEST['PID']);
$PW2=mysql_escape_string($_REQUEST['PW2']);
$Hint=mysql_escape_string($_REQUEST['Hint']);
$Email=mysql_escape_string($_REQUEST['Email']);
$submit_add=$_REQUEST['submit_add'];
"

That's it! You can go to the next step-



Short explanation for the change (for coders):
So there has to be a minor change made in the code of add.php to make these bookmarklets work because it is almost impossible to make bookmarklets that post data via the POST method (except via XML HTTP request object = too complicated to implement for this purpose).
So all you have to do is to alter the code so the add.php script considers POST as well as GET variables when they come correctly named. All I've done ist to replace the loading of the variables from "$_POST['x']" to "$_REQUEST['x']".

3  Your Bookmarklet Settings

Main Settings (obligatory)

phpLinks Server Directory:

(URL in the format: "http://www.some.so/phplinks";
your server, NO trailing slash please!)

Just leave these empty if you don't (want) to use them:
phpLinks username:
(your phplinks username)
phpLinks e-mail:
(your phplinks e-mail)
phpLinks password 1:
(your phplinks password 1)
phpLinks password 2:
(your phplinks password 2)
phpLinks hint:
(your phplinks hint)


Optional Settings

Get Description from Web-Site
Prefix Keywords:
Get Keywords from Web-Site
Prefix Author:
Get Author from Web-Site
Prefix Modified Date:
Get last Modified Date from Web-Site

Popup Window Settings (optional)

width: px (480 suggested)
height: px (520 suggested)
scrollbars: (yes suggested)
resizable: (yes suggested)




 

### IE 6.0x version ###

IE 6.0x only can take a maximum of 508 characters within a link/bookmarklet! All prior version could cope with (so this version has reduced functionality and only ~481 chars) if you exceed the maximum number of chars after changing username, e-mail and location then you have only the option to leave the user name and or e-mail away and enter it manually every time you input a new url or to reduce some of the remaining functionality (happy hacking!).

4  Here come your bookmarklets


"drag & drop" the appropriate link into the bookmark-bar or onto the bookmark menue of your browser.   If there is a popup message/warning push the OK buttons-

you have to properly customize your Bookmarklet first!
-->> Please return to the customisation page <<--

You now should have got a new bookmark(let) wherever you put it.
Find out how it works by clicking it like you would with any bookmark and see what happens -- See something happening?

It will only work when java-script is enabled in your browser (=standard setting).



code to use to display this bookmarklet on a web page:


Below you can see the settings you chose:
phpLinks Server Directory:
phpLinks username:  phpLinks e-mail:  phpLinks password 1:  phpLinks password 2:  phpLinks hint:
Web-Site Description:  Keywords:  Author:  last Modified Date:
width:400   height:520   scrollbars:yes   resizable:yes

5  Bookmarklet Usage


You now should have got a new bookmark(let) wherever you put it.
Find out how it works by clicking it like you would with any bookmark and see what happens -- See something happening?

It will only work when java-script is enabled in your browser (=standard setting).



code to use to display this bookmarklet on a web page:

For more Information read This:

http://en.wikipedia.org/wiki/Bookmarklet


To further exercise, play around & understand the use of Bookmarklets you might go to:
Squarefree Bookmarklets
OR
bookmarklets.com