Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007, 12:26 PM
New Pligger
 
Join Date: Aug 2007
Posts: 25
Thanks: 1
Thanked 4 Times in 3 Posts
Pligg This! v2

I have seen much discussion on Pligg this buttons, firefox extensions, bookmarklets etc, in particular I was looking at a way to automatically populate the summary. If you have used, or tweaked?, the Digg This extension, the url paramter of &bodytext=..... does not work.

I have tweaked the Digg This! extension code a little so that it now works: highlight some text on a page you want to submit, use the Pligg This toolbar button or context-menu entry and a new tab will open, url, title AND summary all populated for you.

Add the following to the bottom of the digg() function in the Digg This! extension
Code:
    var contentArea = document.getElementById('content');
    contentArea.addEventListener('load', addsummary, true);
}

function addsummary(){
    var body = window.content.document.getElementById('bodytext');
    body.value = notes;
    var contentArea = document.getElementById('content');
    contentArea.removeEventListener('load',addsummary,true);
}
Note the use of the Global 'notes' variable, you will have to declare this and tweak the beginning of the function to make it global as well.

Code:
var notes ='';

function digg(){
.....
    var selectedObj = getSelectedText();
        if ( selectedObj)
        {
            notes = selectedObj;
        }
.........
}
Any cgi programmers out there, we could hook up to make a Pligg This! extension generator, so people would fill in their site name and url, the script goes away and just replaces the few occurences of Pligg this and the url in the extension.

Cheers, T.
Reply With Quote
The Following 2 Users Say Thank You to tones For This Useful Post:
  #2 (permalink)  
Old 08-09-2007, 09:49 AM
New Pligger
 
Join Date: Aug 2007
Posts: 25
Thanks: 1
Thanked 4 Times in 3 Posts
Have attached an example .xpi file which should be easier than modifying the digg this extension (for starters I have not put the code in a jar file, it really is not needed for small extensions).

1) Download the zip file and extract it to a folder somewhere.
2) Open up the install.rdf file and change the <em:name> and <em:description> contents to suit.
Code:
 eg <em:name>Not Pligg This, Something Else!</em:name>
3) Open up pligg.js and change line 63 to your domain
Code:
var domain = 'http://www.pligg.com';
4) Optionally change the summary count on line 81 if you altered this in your pligg install
Code:
var limit = 150;
5) Open up pligg.xul and change all occurances of "Pligg This!" to suit.
6) Open up winzip or similar and create a new zipfile, making sure it has the extension of .xpi NOT .zip
7) Drag in install.rdf, chrome.manifest, and content folder in one. DO NOT drag in a folder that contains these items, it must be these items themselves.
8) Optionally change the icons, naming them pligg-24.png and pligg-16.png
9) You done!

Please feel free to seek clarification. T.
Attached Files
File Type: zip pligg_this_0.1.zip (4.9 KB, 52 views)
Reply With Quote
The Following User Says Thank You to tones For This Useful Post:
  #3 (permalink)  
Old 08-09-2007, 01:30 PM
Casual Pligger
 
Join Date: Jul 2007
Posts: 61
Thanks: 0
Thanked 1 Time in 1 Post
is there a demo or something of this?
__________________
little ubuntu
Reply With Quote
  #4 (permalink)  
Old 08-09-2007, 01:51 PM
New Pligger
 
Join Date: Aug 2007
Posts: 25
Thanks: 1
Thanked 4 Times in 3 Posts
This is a firefox extension, you can't "demo" it. The only way to see this in action is to follow the instructions above.

T.
Reply With Quote
  #5 (permalink)  
Old 08-09-2007, 02:24 PM
New Pligger
 
Join Date: Aug 2007
Posts: 25
Thanks: 1
Thanked 4 Times in 3 Posts
Silent 1643

I have quickly tried this for your littleubuntu site, allthough have only changed the domain, everything else is still Pligg This!

Save this file to your desktop, then drag it into an open firefox window to install

http://firefox.spatialviews.com/file...ubuntu_0.1.xpi

Now, with the extension installed, select some text on a page, right click and select Pligg This from the menu. There is also a toolbar button

T.
Reply With Quote
  #6 (permalink)  
Old 08-13-2007, 11:45 AM
mathcv's Avatar
New Pligger
Pligg Version: 9.7
Pligg Template: yGet
 
Join Date: Jul 2007
Location: Argentina
Posts: 14
Thanks: 1
Thanked 6 Times in 4 Posts
Hi!
Exelent plugin!
Simplify the work.... =)

This is my contribute:

Install plugin online

1)Insert in you page before </head> this code:

<script language="javascript">
function isGecko()
{
var agent = navigator.userAgent.toLowerCase();
return (agent.indexOf('gecko') > -1);
}

function doInstall(aExt, aLang)
{
var xpi = null;
var lang = (aLang != null ? "-" + aLang : "");

switch (aExt)
{
case "ejecutar":
xpi = {
"Publica esto!" : {
URL: "/directory/nameofplugin" + lang + ".xpi",
toString: function () { return this.URL; }
}
};
break;
}

if (xpi != null)
InstallTrigger.install(xpi);
else
alert("Please select a valid extension!");
}
</script>

2)Modify "/directory/nameofplugin" by the corresponding directory, without .xpi, is already inserted...

3)And make the link of this form....:
<a href="javascript:doInstall('ejecutar');"">DOWNLOAD PLUGIN</a>

Finishhh




Tones: i make one plugin, whith you instruction, public, and work perfectly, but don't show icons...

Can view my plugin please?

http://www.hepatitisc2000.com.ar/noticias/firefox/publicar/Publicar_en_HepaRed!.xpi

I thinks wath the trouble is in chrome.manifest file...

Thanks for advanced...

Last edited by mathcv; 08-13-2007 at 01:24 PM..
Reply With Quote
The Following User Says Thank You to mathcv For This Useful Post:
  #7 (permalink)  
Old 08-13-2007, 06:57 PM
New Pligger
 
Join Date: Aug 2007
Posts: 25
Thanks: 1
Thanked 4 Times in 3 Posts
Hi, thanks for the install code!!

I managed to install the example extension you posted ok, with images. By default, the toolbar button with image will not be there, you will need to right-click your toolbar and select customize. Then drag in the rather rubbish yellow icon with the green tick.

Tones
Reply With Quote
  #8 (permalink)  
Old 08-13-2007, 11:38 PM
mathcv's Avatar
New Pligger
Pligg Version: 9.7
Pligg Template: yGet
 
Join Date: Jul 2007
Location: Argentina
Posts: 14
Thanks: 1
Thanked 6 Times in 4 Posts
oooohhh !! is maggic! ajajja

Yeah now view the icon...
Now understand everything...

Thanksss!
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT: Have 80% Pligg Design Done, Need Experienced Programmer/Designer to finish it anothercollegestudent Template Support 3 11-07-2007 01:39 AM


Search Engine Friendly URLs by vBSEO 3.2.0