Move this topic
New plugin
in Getting Started
•
10 years ago
Hello all,
I've been developing a piece of JavaScript for quite a while now and have been recommended to turn it into a jQuery plugin.
What's the procedure for doing that - what's the first step?
Do you write the code on your own site first, as a jQuery plugin or do you submit the conventional JavaScript somewhere?
Thanks in advance,
Kind regards
1
Replies(15)
Re: New plugin
10 years ago
Since the current official jQuery plugins directory is down, i suggest using gitHub or googlecode, or some other online source control tool to host your plugin. This will allow easy integration into the upcoming new plugins directory.
-- Kevin
-- Kevin
Leave a comment on Kevin B's reply
Re: New plugin
10 years ago
Thanks Kevin!
Is it a good idea to encapsulate the code as a jQuery plugin in the meantime? (on my site)
(until the jQuery plugin directory is back up?)
Cheers!
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
Ah so it isn't even a plugin at this point.
If it is something that you or someone else will be able to use elsewhere, and you plan to keep it up to date with each passing version of jQuery, it is worth turning it into a plugin. There's also nothing wrong with you hosting it on your own website.
-- Kevin
-- Kevin
Leave a comment on Kevin B's reply
Re: New plugin
10 years ago
Thanks again Kevin!
No, it's conventional JS code at the moment, which employs jQuery and should be rather easy to port as a jQuery plugin.
Here's a link to the current code:
I've tested it excessively and deem it to be free of error.
So I reckon, I'll wrap it up as a jQuery plugin, test it and go from there.
Yes, I would like to share it and keep it up to date with new jQuery versions...
Kind regards
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
Hello all,
just a very basic question:
(I'm an absolute newcomer to jQuery plugins)
Why doesn't this work: http://4nf.org/bo.js
I've newly created it, am including it along with jQuery from http://4nf.org/
I reckon, it should show an alert, but it doesn't...
Any help is greatly appreciated!
Thanks in advance and kind regards
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
When you define a method on $.fn, you call it with $("#someel").myPlugin()
If you want to call it with $.myPlugin(), define it directly on $
$.myPlugin = function(){...};
-- Kevin
-- Kevin
Leave a comment on Kevin B's reply
Re: New plugin
10 years ago
Thanks Kevin!
Works now - the whole plugin: http://4nf.org/bo.js
You can see a description of what it's supposed to do on the site: http://4nf.org/
Though it works, it's obvious, that I have to wrap it up in the form a jQuery plugin should be designed in.
It'd be great, if you could help me in that process.
Also feel free to state your opinion on the plugin!
What do you think?
Thanks very much and kind regards
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
I don't like that it uses async:false due to the blocking effect it has on the UX and the fact that it will be depreciated in jQuery 1.8, and removed in 1.9/2.0
I can't tell what it is supposed to do or how i'm supposed to use it.
-- Kevin
-- Kevin
Leave a comment on Kevin B's reply
Re: New plugin
10 years ago
Hi Kevin,
Thanks for that bit of information!
Just tried to re-write the synchronous AJAX request to asynchronous - seems to work:
Unfortunately, I have no further specification of what it does other than what is visible on http://4nf.org/
Any other ideas on how to improve the code?
Thanks and kind regards
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
The only other nitpick i have is the code is very hard to follow. Variable names are too short and aren't very descriptive, there aren't any comments, etc. There's no real reason to not use descriptive variable names and comments when you can provide a minified version of your code that shortens them for you, leaving the non-minified version easily readable and maintainable.
This of course has no affect on the outcome of the code.
-- Kevin
-- Kevin
Leave a comment on Kevin B's reply
Re: New plugin
10 years ago
Hi Kevin,
thanks, you're right! Yes I'll do my best to change that...
(I've started entering some comments)
Any other feedback?
Kind regards
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
Hi again,
I was wondering, whether this is the classic way to use a jQuery plugin:
Does that make sense or is there a better way?
Thanks!
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
Hi again,
so I presume the way I'm including the plugin is alright.
Can I submit the code like that:
http://4nf.org/bo.js
...or are some changes required?
For example, do the functions have to be encapsulated in the
Thanks very much for your guidance!
Kind regards
so I presume the way I'm including the plugin is alright.
Can I submit the code like that:
http://4nf.org/bo.js
...or are some changes required?
For example, do the functions have to be encapsulated in the
(function( $ ) {block?
...
})( jQuery );
Thanks very much for your guidance!
Kind regards
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
I've just integrated the HTML5 History API into the plugin!
Check out it's awesome speed at loading sub-pages: http://4nf.org/
Any feedback?
Check out it's awesome speed at loading sub-pages: http://4nf.org/
Any feedback?
Leave a comment on arvgta's reply
Re: New plugin
10 years ago
A jQuery professional edited the code for me:
http://4nf.org/bo.js
does that look better?
Can I submit it at plugins.jquery.com that way?
http://4nf.org/bo.js
does that look better?
Can I submit it at plugins.jquery.com that way?
Leave a comment on arvgta's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic
Reply to arvgta's question
{"z3123152":[14737000003511885,14737000003511891,14737000003511979,14737000003517042,14737000003517058],"z20833501":[14737000003514190,14737000003516023,14737000003516043,14737000003516119,14737000003516173,14737000003516243,14737000003516251,14737000003516273,14737000003517209,14737000003543159,14737000003545381]}
Statistics
- 15 Replies
- 3434 Views
- 0 Followers