npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jq-simple-connect

v1.0.0

Published

A lightweight JavaScript library which allows to visually connect elements in a web page

Downloads

23

Readme

jqSimpleConnect

jqSimpleConnect is a lightweight JavaScript library which provides the functionality for visually connect elements in a web page.

It uses <div> elements to draw the connectors, in order to avoid dependencies with SVG and Canvas and in order to be more fast and simple.

His only requirement is jQuery, another JavaScript library, which must be included in the web page along with jqSimpleConnect.

Usage

In order to use jqSimpleConnect, the only thing that you have to do is to include the JavaScript files of jqSimpleConnect and jQuery into your page's <head> tag:

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jqSimpleConnect.min.js"></script>

And then call the connect method:

<div style="position:relative; height: 80px;">
    <div id="div_a" style="position:absolute; top:5px; left:5px;">Div A</div>
    <div id="div_b" style="position:absolute; top:50px; left:150px;">Div B</div>
</div>
<script type="text/javascript">
    jqSimpleConnect.connect("#div_a", "#div_b", {radius: 8, color: 'green'});
</script>

You can find examples in the following links:

API Documentation

jqSimpleConnect.connect

Draws a connection between the elements "A" and "B".

jqSimpleConnect.connect = function(elementA, elementB, options)

Parameters

Parameter | Description --------- | ----------- elementA | A CSS selector or a jQuery's object for select the first element. elementB | A CSS selector or a jQuery's object for select the second element. options | (optional) An associative array with the properties (all of them optionals): color (which defines the color of the connection), radius (which defines the width of the connection's lines), roundedCorners (a boolean indicating if the corners must be round), anchorA (which defines the anchor type of the first element, 'horizontal' or 'vertical') and anchorB (which defines the anchor type of the second element, 'horizontal' or 'vertical').

Returns

An string which identifies uniquely the connection.

jqSimpleConnect.repaintConnection

Repaints an specific connection from the page.

jqSimpleConnect.repaintConnection = function(connectionId)

Parameters

Parameter | Description --------- | ----------- connectionId | The connection's unique identifier.

Returns

true if the connection was repainted or false if no connection with that identifier was found.

jqSimpleConnect.repaintAll

Repaints all the connections in the page.

jqSimpleConnect.repaintAll = function()

jqSimpleConnect.removeConnection

Removes an specific connection from the page.

jqSimpleConnect.removeConnection = function(connectionId)

Parameters

Parameter | Description --------- | ----------- connectionId | The connection's unique identifier.

Returns

true if the connection was removed or false if no connection with that identifier was found.

jqSimpleConnect.removeAll

Removes all the connections in the page.

jqSimpleConnect.removeAll = function()

License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; If not, see http://www.gnu.org/licenses/.